@geekmidas/cli 10.0.0-alpha.162 → 10.0.0-alpha.164
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/{GoDaddyProvider-COSh6bNI.mjs → GoDaddyProvider-BrZ7WtmP.mjs} +2 -2
- package/dist/{GoDaddyProvider-COSh6bNI.mjs.map → GoDaddyProvider-BrZ7WtmP.mjs.map} +1 -1
- package/dist/{GoDaddyProvider-DyhN8PEn.cjs → GoDaddyProvider-DSzYpSc3.cjs} +2 -2
- package/dist/{GoDaddyProvider-DyhN8PEn.cjs.map → GoDaddyProvider-DSzYpSc3.cjs.map} +1 -1
- package/dist/{HostingerProvider-5Nekoneq.mjs → HostingerProvider-D7N8GbQm.mjs} +2 -2
- package/dist/{HostingerProvider-5Nekoneq.mjs.map → HostingerProvider-D7N8GbQm.mjs.map} +1 -1
- package/dist/{HostingerProvider-DG08aTyh.cjs → HostingerProvider-DQusFkZJ.cjs} +2 -2
- package/dist/{HostingerProvider-DG08aTyh.cjs.map → HostingerProvider-DQusFkZJ.cjs.map} +1 -1
- package/dist/{LegacyStateStore-CafGn2Yl.mjs → LegacyStateStore-B2vZVXVe.mjs} +2 -2
- package/dist/{LegacyStateStore-CafGn2Yl.mjs.map → LegacyStateStore-B2vZVXVe.mjs.map} +1 -1
- package/dist/{LegacyStateStore-5W4kFia3.cjs → LegacyStateStore-CxQkI3fQ.cjs} +2 -2
- package/dist/{LegacyStateStore-5W4kFia3.cjs.map → LegacyStateStore-CxQkI3fQ.cjs.map} +1 -1
- package/dist/{LocalStateStore--CJ7ksx6.cjs → LocalStateStore-CrrjFgMc.cjs} +2 -2
- package/dist/{LocalStateStore--CJ7ksx6.cjs.map → LocalStateStore-CrrjFgMc.cjs.map} +1 -1
- package/dist/{LocalStateStore-DrTw_EIu.mjs → LocalStateStore-ff4XiebR.mjs} +2 -2
- package/dist/{LocalStateStore-DrTw_EIu.mjs.map → LocalStateStore-ff4XiebR.mjs.map} +1 -1
- package/dist/{S3StateStore-DGEwSkf2.mjs → S3StateStore-62sFppnE.mjs} +4 -4
- package/dist/{S3StateStore-DGEwSkf2.mjs.map → S3StateStore-62sFppnE.mjs.map} +1 -1
- package/dist/{S3StateStore-M8vVPpr7.cjs → S3StateStore-EnatbBd3.cjs} +4 -4
- package/dist/{S3StateStore-M8vVPpr7.cjs.map → S3StateStore-EnatbBd3.cjs.map} +1 -1
- package/dist/{SSMStateStore-VYfuykBd.mjs → SSMStateStore-BON4jyRR.mjs} +2 -2
- package/dist/{SSMStateStore-VYfuykBd.mjs.map → SSMStateStore-BON4jyRR.mjs.map} +1 -1
- package/dist/{SSMStateStore-B2A27u0C.cjs → SSMStateStore-CYPYh1c7.cjs} +2 -2
- package/dist/{SSMStateStore-B2A27u0C.cjs.map → SSMStateStore-CYPYh1c7.cjs.map} +1 -1
- package/dist/{add-CistiUc6.mjs → add-CzoX8swL.mjs} +5 -5
- package/dist/{add-CistiUc6.mjs.map → add-CzoX8swL.mjs.map} +1 -1
- package/dist/{add-CijlgwVr.cjs → add-D65M2URP.cjs} +5 -5
- package/dist/{add-CijlgwVr.cjs.map → add-D65M2URP.cjs.map} +1 -1
- package/dist/{apps-5iJb710M.cjs → apps-DY82zCeA.cjs} +17 -12
- package/dist/apps-DY82zCeA.cjs.map +1 -0
- package/dist/{apps-BE97n0jO.mjs → apps-Dquc1K9N.mjs} +17 -12
- package/dist/apps-Dquc1K9N.mjs.map +1 -0
- package/dist/{bundler-D-SXSUZI.mjs → bundler-9RpLU2H3.mjs} +6 -6
- package/dist/{bundler-D-SXSUZI.mjs.map → bundler-9RpLU2H3.mjs.map} +1 -1
- package/dist/{bundler-D4E7kCYb.cjs → bundler-wtMYRk9K.cjs} +6 -6
- package/dist/{bundler-D4E7kCYb.cjs.map → bundler-wtMYRk9K.cjs.map} +1 -1
- package/dist/{cli-D--xSSlK.cjs → cli-CgZuiNWv.cjs} +5 -5
- package/dist/{cli-D--xSSlK.cjs.map → cli-CgZuiNWv.cjs.map} +1 -1
- package/dist/{cli-Brr1IVq1.mjs → cli-D0Tu6u1G.mjs} +5 -5
- package/dist/{cli-Brr1IVq1.mjs.map → cli-D0Tu6u1G.mjs.map} +1 -1
- package/dist/{compose-Dk0Z8zdf.mjs → compose-BfTrMiAk.mjs} +7 -7
- package/dist/{compose-Dk0Z8zdf.mjs.map → compose-BfTrMiAk.mjs.map} +1 -1
- package/dist/{compose-Dpkkp-Qq.cjs → compose-DgBUpgXh.cjs} +5 -5
- package/dist/{compose-Dpkkp-Qq.cjs.map → compose-DgBUpgXh.cjs.map} +1 -1
- package/dist/{compose-BoxgqTF8.cjs → compose-kEjxTamg.cjs} +7 -7
- package/dist/{compose-BoxgqTF8.cjs.map → compose-kEjxTamg.cjs.map} +1 -1
- package/dist/{compose-CuoV9T9U.mjs → compose-pbLaJlts.mjs} +5 -5
- package/dist/{compose-CuoV9T9U.mjs.map → compose-pbLaJlts.mjs.map} +1 -1
- package/dist/{config-CLXSXbcs.cjs → config-CXj-9eRo.cjs} +77 -8
- package/dist/config-CXj-9eRo.cjs.map +1 -0
- package/dist/{config-Da9bxnkT.mjs → config-Di0oJwM9.mjs} +72 -9
- package/dist/config-Di0oJwM9.mjs.map +1 -0
- package/dist/config.cjs +1 -1
- package/dist/config.mjs +1 -1
- package/dist/{credentials-BR3dNNtO.cjs → credentials-Bel6afW2.cjs} +5 -5
- package/dist/{credentials-BR3dNNtO.cjs.map → credentials-Bel6afW2.cjs.map} +1 -1
- package/dist/{credentials-DhCCRQJp.mjs → credentials-BgtOz5ec.mjs} +5 -5
- package/dist/{credentials-DhCCRQJp.mjs.map → credentials-BgtOz5ec.mjs.map} +1 -1
- package/dist/deploy/public.cjs +11 -11
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +11 -11
- package/dist/{deploy-Ck0zXkM7.cjs → deploy-C4V-nsOF.cjs} +42 -19
- package/dist/deploy-C4V-nsOF.cjs.map +1 -0
- package/dist/{deploy-Bb-o2KYC.mjs → deploy-D-5ib-ah.mjs} +42 -19
- package/dist/deploy-D-5ib-ah.mjs.map +1 -0
- package/dist/{destroy-DIV6l_94.mjs → destroy-CYQCEn4A.mjs} +8 -8
- package/dist/{destroy-DIV6l_94.mjs.map → destroy-CYQCEn4A.mjs.map} +1 -1
- package/dist/{destroy-JHapr9UF.cjs → destroy-DuQqz53a.cjs} +8 -8
- package/dist/{destroy-JHapr9UF.cjs.map → destroy-DuQqz53a.cjs.map} +1 -1
- package/dist/{docker-zaY5JoqN.mjs → docker-BEsTfsFc.mjs} +5 -5
- package/dist/{docker-zaY5JoqN.mjs.map → docker-BEsTfsFc.mjs.map} +1 -1
- package/dist/{docker-CIpOFfOw.cjs → docker-BMReDeMB.cjs} +5 -5
- package/dist/{docker-CIpOFfOw.cjs.map → docker-BMReDeMB.cjs.map} +1 -1
- package/dist/{dokploy-DLVSItVD.cjs → dokploy-BpPAgZ0u.cjs} +2 -2
- package/dist/{dokploy-DLVSItVD.cjs.map → dokploy-BpPAgZ0u.cjs.map} +1 -1
- package/dist/{dokploy-BTzdAG5F.mjs → dokploy-BuYCnz9U.mjs} +2 -2
- package/dist/{dokploy-BTzdAG5F.mjs.map → dokploy-BuYCnz9U.mjs.map} +1 -1
- package/dist/{eas-C1WvLOi1.mjs → eas-DjVtUdb4.mjs} +3 -3
- package/dist/{eas-C1WvLOi1.mjs.map → eas-DjVtUdb4.mjs.map} +1 -1
- package/dist/{eas-B6VYsGLs.cjs → eas-H-6ixmsY.cjs} +3 -3
- package/dist/{eas-B6VYsGLs.cjs.map → eas-H-6ixmsY.cjs.map} +1 -1
- package/dist/{encryption-oVcZSyLK.cjs → encryption-BvCsBp2p.cjs} +3 -3
- package/dist/{encryption-oVcZSyLK.cjs.map → encryption-BvCsBp2p.cjs.map} +1 -1
- package/dist/{encryption-DdnL7dor.mjs → encryption-CR4aMkSK.mjs} +3 -3
- package/dist/{encryption-DdnL7dor.mjs.map → encryption-CR4aMkSK.mjs.map} +1 -1
- package/dist/{engine-_zA1Selg.cjs → engine-CV2wqRFl.cjs} +9 -9
- package/dist/{engine-_zA1Selg.cjs.map → engine-CV2wqRFl.cjs.map} +1 -1
- package/dist/{engine-Viv9p-yK.mjs → engine-upEpdhEF.mjs} +9 -9
- package/dist/{engine-Viv9p-yK.mjs.map → engine-upEpdhEF.mjs.map} +1 -1
- package/dist/{github-CRvdaD2Y.cjs → github-BDOLgdMp.cjs} +9 -8
- package/dist/github-BDOLgdMp.cjs.map +1 -0
- package/dist/{github-BOXn5NEP.mjs → github-D2l7aqFx.mjs} +9 -8
- package/dist/github-D2l7aqFx.mjs.map +1 -0
- package/dist/{googlePlay-C5T1SOGW.cjs → googlePlay-B3FR1VGL.cjs} +5 -5
- package/dist/{googlePlay-C5T1SOGW.cjs.map → googlePlay-B3FR1VGL.cjs.map} +1 -1
- package/dist/{googlePlay-C4UsG1Vd.mjs → googlePlay-DJ2Kv0UX.mjs} +5 -5
- package/dist/{googlePlay-C4UsG1Vd.mjs.map → googlePlay-DJ2Kv0UX.mjs.map} +1 -1
- package/dist/index.cjs +63 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +63 -63
- package/dist/index.mjs.map +1 -1
- package/dist/{local-Bqx5Xj3z.mjs → local-COaqGFDc.mjs} +2 -2
- package/dist/{local-Bqx5Xj3z.mjs.map → local-COaqGFDc.mjs.map} +1 -1
- package/dist/{local-vSeEreyp.cjs → local-DhAnAhXn.cjs} +2 -2
- package/dist/{local-vSeEreyp.cjs.map → local-DhAnAhXn.cjs.map} +1 -1
- package/dist/{migrate-D8PSR_08.mjs → migrate-CpT7qBZE.mjs} +3 -3
- package/dist/{migrate-D8PSR_08.mjs.map → migrate-CpT7qBZE.mjs.map} +1 -1
- package/dist/{migrate-DvdpT5Y4.cjs → migrate-CusdrYsn.cjs} +5 -5
- package/dist/{migrate-DvdpT5Y4.cjs.map → migrate-CusdrYsn.cjs.map} +1 -1
- package/dist/{migrate-CLSY8gSY.cjs → migrate-Hjvo9j_J.cjs} +3 -3
- package/dist/{migrate-CLSY8gSY.cjs.map → migrate-Hjvo9j_J.cjs.map} +1 -1
- package/dist/{migrate-CEhUGDFy.mjs → migrate-Nt9NOr1s.mjs} +5 -5
- package/dist/{migrate-CEhUGDFy.mjs.map → migrate-Nt9NOr1s.mjs.map} +1 -1
- package/dist/{notes-CdbUjLBC.mjs → notes-B-tgKkvp.mjs} +4 -4
- package/dist/notes-B-tgKkvp.mjs.map +1 -0
- package/dist/{notes-B9ro_R3x.cjs → notes-CZvLIjfg.cjs} +4 -4
- package/dist/notes-CZvLIjfg.cjs.map +1 -0
- package/dist/openapi.cjs +1 -1
- package/dist/openapi.mjs +1 -1
- package/dist/{projectBucket-DPaUiLyY.mjs → projectBucket-DNAOBIYZ.mjs} +2 -2
- package/dist/{projectBucket-DPaUiLyY.mjs.map → projectBucket-DNAOBIYZ.mjs.map} +1 -1
- package/dist/{projectBucket-DUtWAxWn.cjs → projectBucket-XyxlpATc.cjs} +2 -2
- package/dist/{projectBucket-DUtWAxWn.cjs.map → projectBucket-XyxlpATc.cjs.map} +1 -1
- package/dist/{publish-CoCRpbPl.mjs → publish-CwjRq8Ye.mjs} +2 -2
- package/dist/{publish-CoCRpbPl.mjs.map → publish-CwjRq8Ye.mjs.map} +1 -1
- package/dist/{publish-DbR3j4TS.cjs → publish-DmBXVNlk.cjs} +2 -2
- package/dist/{publish-DbR3j4TS.cjs.map → publish-DmBXVNlk.cjs.map} +1 -1
- package/dist/{resolve-DDcPuS_G.cjs → resolve-BuqA14hD.cjs} +4 -4
- package/dist/{resolve-DDcPuS_G.cjs.map → resolve-BuqA14hD.cjs.map} +1 -1
- package/dist/{resolve-BjRvKEpw.mjs → resolve-vOUrXSHP.mjs} +4 -4
- package/dist/{resolve-BjRvKEpw.mjs.map → resolve-vOUrXSHP.mjs.map} +1 -1
- package/dist/{rollback-CvlebzBY.cjs → rollback-CiyKH1HK.cjs} +6 -6
- package/dist/{rollback-CvlebzBY.cjs.map → rollback-CiyKH1HK.cjs.map} +1 -1
- package/dist/{rollback-xLGFZaHy.mjs → rollback-glkFgz6-.mjs} +6 -6
- package/dist/{rollback-xLGFZaHy.mjs.map → rollback-glkFgz6-.mjs.map} +1 -1
- package/dist/{s3-CXA6Lleo.mjs → s3-BZbRcH8T.mjs} +2 -2
- package/dist/{s3-CXA6Lleo.mjs.map → s3-BZbRcH8T.mjs.map} +1 -1
- package/dist/{s3-D9pFisyo.cjs → s3-C0EBuF8n.cjs} +2 -2
- package/dist/{s3-D9pFisyo.cjs.map → s3-C0EBuF8n.cjs.map} +1 -1
- package/dist/{serverSetup-DxcbUlwE.mjs → serverSetup-Dlj7JQW-.mjs} +6 -6
- package/dist/{serverSetup-DxcbUlwE.mjs.map → serverSetup-Dlj7JQW-.mjs.map} +1 -1
- package/dist/{serverSetup-BoxtHWkI.cjs → serverSetup-n1Znminh.cjs} +6 -6
- package/dist/{serverSetup-BoxtHWkI.cjs.map → serverSetup-n1Znminh.cjs.map} +1 -1
- package/dist/{sniffer-Csft3UaJ.mjs → sniffer-BgzTs_Zt.mjs} +6 -6
- package/dist/{sniffer-Csft3UaJ.mjs.map → sniffer-BgzTs_Zt.mjs.map} +1 -1
- package/dist/{sniffer-B2jgjk-F.cjs → sniffer-DDAxYDqU.cjs} +6 -6
- package/dist/{sniffer-B2jgjk-F.cjs.map → sniffer-DDAxYDqU.cjs.map} +1 -1
- package/dist/{snsSubscriptions-DgbFGyac.mjs → snsSubscriptions-CCyxCMoc.mjs} +2 -2
- package/dist/{snsSubscriptions-DgbFGyac.mjs.map → snsSubscriptions-CCyxCMoc.mjs.map} +1 -1
- package/dist/{snsSubscriptions-CSyPnoEQ.cjs → snsSubscriptions-Dr5ghfa5.cjs} +2 -2
- package/dist/{snsSubscriptions-CSyPnoEQ.cjs.map → snsSubscriptions-Dr5ghfa5.cjs.map} +1 -1
- package/dist/{sst-CmNUadAV.mjs → sst-CV5TemXa.mjs} +5 -5
- package/dist/{sst-CmNUadAV.mjs.map → sst-CV5TemXa.mjs.map} +1 -1
- package/dist/{sst-BtrgnhHy.cjs → sst-DBkHn3mA.cjs} +5 -5
- package/dist/{sst-BtrgnhHy.cjs.map → sst-DBkHn3mA.cjs.map} +1 -1
- package/dist/{stack-9qBhn2pd.cjs → stack-Dku1pOA2.cjs} +8 -8
- package/dist/stack-Dku1pOA2.cjs.map +1 -0
- package/dist/{stack-dVgzDUiH.mjs → stack-r97Ao-uG.mjs} +8 -8
- package/dist/stack-r97Ao-uG.mjs.map +1 -0
- package/dist/{stage-CwXpkN-y.mjs → stage-Deb-7Ohk.mjs} +6 -6
- package/dist/{stage-CwXpkN-y.mjs.map → stage-Deb-7Ohk.mjs.map} +1 -1
- package/dist/{stage-HEZZZJKr.cjs → stage-Du8I-UIa.cjs} +6 -6
- package/dist/{stage-HEZZZJKr.cjs.map → stage-Du8I-UIa.cjs.map} +1 -1
- package/dist/{stages-gG-DGHLb.mjs → stages-CW7qtiJ2.mjs} +2 -2
- package/dist/{stages-gG-DGHLb.mjs.map → stages-CW7qtiJ2.mjs.map} +1 -1
- package/dist/{stages-rzyes8Ew.cjs → stages-CtqmEJJW.cjs} +2 -2
- package/dist/{stages-rzyes8Ew.cjs.map → stages-CtqmEJJW.cjs.map} +1 -1
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.mjs +1 -1
- package/dist/{terminal-BqqGsi0O.mjs → terminal-BEa0E3pz.mjs} +2 -2
- package/dist/{terminal-BqqGsi0O.mjs.map → terminal-BEa0E3pz.mjs.map} +1 -1
- package/dist/{terminal-8AA2uK0U.cjs → terminal-BXpp9kBr.cjs} +2 -2
- package/dist/{terminal-8AA2uK0U.cjs.map → terminal-BXpp9kBr.cjs.map} +1 -1
- package/package.json +15 -15
- package/dist/apps-5iJb710M.cjs.map +0 -1
- package/dist/apps-BE97n0jO.mjs.map +0 -1
- package/dist/config-CLXSXbcs.cjs.map +0 -1
- package/dist/config-Da9bxnkT.mjs.map +0 -1
- package/dist/deploy-Bb-o2KYC.mjs.map +0 -1
- package/dist/deploy-Ck0zXkM7.cjs.map +0 -1
- package/dist/github-BOXn5NEP.mjs.map +0 -1
- package/dist/github-CRvdaD2Y.cjs.map +0 -1
- package/dist/notes-B9ro_R3x.cjs.map +0 -1
- package/dist/notes-CdbUjLBC.mjs.map +0 -1
- package/dist/stack-9qBhn2pd.cjs.map +0 -1
- package/dist/stack-dVgzDUiH.mjs.map +0 -1
|
@@ -6,6 +6,31 @@ let node_path = require("node:path");
|
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
8
8
|
let node_async_hooks = require("node:async_hooks");
|
|
9
|
+
//#region src/workspace/fileServerLabel.ts
|
|
10
|
+
/**
|
|
11
|
+
* The name a file server answers on.
|
|
12
|
+
*
|
|
13
|
+
* `new FileServer('Assets', …)` is two manifest nodes: the bucket, which keeps
|
|
14
|
+
* the id (`Assets`, `ASSETS_URL`), and the surface in front of it,
|
|
15
|
+
* `AssetsServer` (`ASSETS_SERVER_URL`). The suffix keeps the two nodes and
|
|
16
|
+
* their keys apart, and that is all it is for. A host is not a key, so it
|
|
17
|
+
* takes the name the construct was given: `assets.<domain>`, never
|
|
18
|
+
* `assets-server.<domain>`.
|
|
19
|
+
*
|
|
20
|
+
* Read off the surface's id rather than its `of`: with `{ origin }` the bucket
|
|
21
|
+
* is another construct's, and its id is not this file server's name.
|
|
22
|
+
*
|
|
23
|
+
* Every host a file server has — its CDN alias and certificate, its edge
|
|
24
|
+
* route, its local `*.localhost` address, its processors' origin and unit —
|
|
25
|
+
* is built from this one label, so no two of them can disagree.
|
|
26
|
+
*
|
|
27
|
+
* @example fileServerLabel('AssetsServer') // 'assets'
|
|
28
|
+
* @example fileServerLabel('UserUploadsServer') // 'user-uploads'
|
|
29
|
+
*/
|
|
30
|
+
function fileServerLabel(serverId) {
|
|
31
|
+
return (0, _geekmidas_manifest.kebabCase)(serverId.replace(/Server$/, ""));
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
9
34
|
//#region src/workspace/subdomains.ts
|
|
10
35
|
/**
|
|
11
36
|
* The subdomains of a stage's domain, as a wildcard site sees them.
|
|
@@ -50,6 +75,25 @@ var SiteHostsEndpointMissing = class extends require_errors.GkmError {
|
|
|
50
75
|
this.name = "SiteHostsEndpointMissing";
|
|
51
76
|
}
|
|
52
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* A file server whose host another construct already answers on.
|
|
80
|
+
*
|
|
81
|
+
* A file server answers on its own name — `FileServer('Assets')` on
|
|
82
|
+
* `assets.<domain>` — so an app named `Assets` beside it would claim the same
|
|
83
|
+
* host, and whichever deployed second would take it from the first.
|
|
84
|
+
*/
|
|
85
|
+
var FileServerHostTaken = class extends require_errors.GkmError {
|
|
86
|
+
fileServer;
|
|
87
|
+
subdomain;
|
|
88
|
+
app;
|
|
89
|
+
constructor(fileServer, subdomain, app) {
|
|
90
|
+
super(`'${fileServer}' answers on '${subdomain}', which '${app}' answers on too, and two constructs cannot share a host. Rename one of them, or give '${app}' a subdomain of its own.`);
|
|
91
|
+
this.fileServer = fileServer;
|
|
92
|
+
this.subdomain = subdomain;
|
|
93
|
+
this.app = app;
|
|
94
|
+
this.name = "FileServerHostTaken";
|
|
95
|
+
}
|
|
96
|
+
};
|
|
53
97
|
/** The project's one wildcard site, or `undefined` when it has none. */
|
|
54
98
|
function wildcardSite(manifest) {
|
|
55
99
|
return Object.values(manifest).find(_geekmidas_manifest.isWildcardSite);
|
|
@@ -65,23 +109,25 @@ function wildcardSite(manifest) {
|
|
|
65
109
|
* wildcard site has none — its labels are whatever is left.
|
|
66
110
|
*/
|
|
67
111
|
function appSubdomains(manifest) {
|
|
68
|
-
|
|
112
|
+
return new Map(claimedLabels(manifest));
|
|
113
|
+
}
|
|
114
|
+
/** Each label a construct answers on, with that construct's id, in manifest order. */
|
|
115
|
+
function* claimedLabels(manifest) {
|
|
69
116
|
for (const [id, declaration] of Object.entries(manifest)) switch (declaration.kind) {
|
|
70
117
|
case "rest-api":
|
|
71
118
|
case "websocket-api":
|
|
72
|
-
|
|
119
|
+
yield [declaration.subdomain ?? (0, _geekmidas_manifest.kebabCase)(id), id];
|
|
73
120
|
break;
|
|
74
121
|
case "site":
|
|
75
122
|
if (declaration.subdomain === _geekmidas_manifest.WILDCARD_SUBDOMAIN) break;
|
|
76
|
-
|
|
123
|
+
yield [declaration.subdomain ?? (0, _geekmidas_manifest.kebabCase)(id), id];
|
|
77
124
|
break;
|
|
78
125
|
case "file-server":
|
|
79
|
-
|
|
80
|
-
if (declaration.processors?.length)
|
|
126
|
+
yield [fileServerLabel(id), id];
|
|
127
|
+
if (declaration.processors?.length) yield [`${fileServerLabel(id)}-processors`, id];
|
|
81
128
|
break;
|
|
82
|
-
case "worker":
|
|
129
|
+
case "worker": yield [(0, _geekmidas_manifest.kebabCase)(id), id];
|
|
83
130
|
}
|
|
84
|
-
return labels;
|
|
85
131
|
}
|
|
86
132
|
/**
|
|
87
133
|
* The labels no tenant may take: every app's own and the workspace's
|
|
@@ -97,6 +143,7 @@ function protectedSubdomains(manifest, configured = []) {
|
|
|
97
143
|
* @throws {SecondWildcardSite} when two sites declare `subdomain: '*'`
|
|
98
144
|
* @throws {SiteHostsEndpointMissing} when the wildcard site's `hosts` route is not served
|
|
99
145
|
* @throws {ProtectedSubdomainIsAnApp} when `protectedSubdomains` repeats an app's own
|
|
146
|
+
* @throws {FileServerHostTaken} when a file server's host is another construct's
|
|
100
147
|
*/
|
|
101
148
|
function assertSubdomains(manifest, configured = []) {
|
|
102
149
|
const wildcards = Object.values(manifest).filter(_geekmidas_manifest.isWildcardSite);
|
|
@@ -106,12 +153,28 @@ function assertSubdomains(manifest, configured = []) {
|
|
|
106
153
|
const surface = manifest[site.hosts.surface];
|
|
107
154
|
if (!(surface?.kind === "rest-api" && surface.endpoints.some((endpoint) => endpoint.method.toUpperCase() === "GET" && endpoint.path === site.hosts?.path))) throw new SiteHostsEndpointMissing(site.id, site.hosts.surface, site.hosts.path);
|
|
108
155
|
}
|
|
156
|
+
assertFileServerHosts(manifest);
|
|
109
157
|
const labels = appSubdomains(manifest);
|
|
110
158
|
for (const subdomain of configured) {
|
|
111
159
|
const app = labels.get(subdomain);
|
|
112
160
|
if (app) throw new ProtectedSubdomainIsAnApp(subdomain, app);
|
|
113
161
|
}
|
|
114
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Every host a file server answers on — its own and its processors' origin —
|
|
165
|
+
* is no other construct's. {@link appSubdomains} keeps one owner per label,
|
|
166
|
+
* so the clash it would hide is found here, before either is deployed.
|
|
167
|
+
*/
|
|
168
|
+
function assertFileServerHosts(manifest) {
|
|
169
|
+
const owners = /* @__PURE__ */ new Map();
|
|
170
|
+
for (const [label, id] of claimedLabels(manifest)) {
|
|
171
|
+
const other = owners.get(label);
|
|
172
|
+
owners.set(label, id);
|
|
173
|
+
if (other === void 0 || other === id) continue;
|
|
174
|
+
if (manifest[id]?.kind === "file-server") throw new FileServerHostTaken(id, label, other);
|
|
175
|
+
if (manifest[other]?.kind === "file-server") throw new FileServerHostTaken(other, label, id);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
115
178
|
//#endregion
|
|
116
179
|
//#region src/workspace/derive.ts
|
|
117
180
|
/**
|
|
@@ -751,6 +814,12 @@ Object.defineProperty(exports, "derivedApps", {
|
|
|
751
814
|
return derivedApps;
|
|
752
815
|
}
|
|
753
816
|
});
|
|
817
|
+
Object.defineProperty(exports, "fileServerLabel", {
|
|
818
|
+
enumerable: true,
|
|
819
|
+
get: function() {
|
|
820
|
+
return fileServerLabel;
|
|
821
|
+
}
|
|
822
|
+
});
|
|
754
823
|
Object.defineProperty(exports, "findWorkspaceRoot", {
|
|
755
824
|
enumerable: true,
|
|
756
825
|
get: function() {
|
|
@@ -818,4 +887,4 @@ Object.defineProperty(exports, "withLoadedConfig", {
|
|
|
818
887
|
}
|
|
819
888
|
});
|
|
820
889
|
|
|
821
|
-
//# sourceMappingURL=config-
|
|
890
|
+
//# sourceMappingURL=config-CXj-9eRo.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-CXj-9eRo.cjs","names":["kebabCase","GkmError","isWildcardSite","appKey","WILDCARD_SUBDOMAIN","kebabCase","WILDCARD_SUBDOMAIN","dependenciesOf","existsSync","dirname","parse","join","GkmError","runWorker","AsyncLocalStorage","resolve","activeSandbox","isWorkspaceConfig","processConfig","allConstructGlobs","discover","sep","realpathSync","getAppGkmConfig"],"sources":["../src/workspace/fileServerLabel.ts","../src/workspace/subdomains.ts","../src/workspace/derive.ts","../src/config.ts"],"sourcesContent":["import { kebabCase } from '@geekmidas/manifest';\n\n/**\n * The name a file server answers on.\n *\n * `new FileServer('Assets', …)` is two manifest nodes: the bucket, which keeps\n * the id (`Assets`, `ASSETS_URL`), and the surface in front of it,\n * `AssetsServer` (`ASSETS_SERVER_URL`). The suffix keeps the two nodes and\n * their keys apart, and that is all it is for. A host is not a key, so it\n * takes the name the construct was given: `assets.<domain>`, never\n * `assets-server.<domain>`.\n *\n * Read off the surface's id rather than its `of`: with `{ origin }` the bucket\n * is another construct's, and its id is not this file server's name.\n *\n * Every host a file server has — its CDN alias and certificate, its edge\n * route, its local `*.localhost` address, its processors' origin and unit —\n * is built from this one label, so no two of them can disagree.\n *\n * @example fileServerLabel('AssetsServer') // 'assets'\n * @example fileServerLabel('UserUploadsServer') // 'user-uploads'\n */\nexport function fileServerLabel(serverId: string): string {\n\treturn kebabCase(serverId.replace(/Server$/, ''));\n}\n","/**\n * The subdomains of a stage's domain, as a wildcard site sees them.\n *\n * A site declared `subdomain: '*'` answers on every label nothing else does,\n * so the labels something else does answer on are the ones a tenant can never\n * take. They come from two places and from nowhere else: every app's own\n * label, read off the constructs and never listed by hand, and the names no\n * construct declares (`www`, `mail`, `status`), listed once in the workspace\n * config as `protectedSubdomains`.\n */\n\nimport {\n\tkebabCase as appKey,\n\ttype ConstructManifest,\n\tisWildcardSite,\n\ttype SiteDeclaration,\n\tWILDCARD_SUBDOMAIN,\n} from '@geekmidas/manifest';\nimport { GkmError } from '../errors';\nimport { fileServerLabel } from './fileServerLabel.js';\n\n/** A `protectedSubdomains` entry an app already answers on. */\nexport class ProtectedSubdomainIsAnApp extends GkmError {\n\tconstructor(\n\t\treadonly subdomain: string,\n\t\treadonly app: string,\n\t) {\n\t\tsuper(\n\t\t\t`protectedSubdomains lists '${subdomain}', which '${app}' already ` +\n\t\t\t\t`answers on — a construct's own subdomain is protected without ` +\n\t\t\t\t`being listed. Remove it from protectedSubdomains.`,\n\t\t);\n\t\tthis.name = 'ProtectedSubdomainIsAnApp';\n\t}\n}\n\n/** Two sites that both answer on every subdomain. */\nexport class SecondWildcardSite extends GkmError {\n\tconstructor(readonly sites: readonly string[]) {\n\t\tsuper(\n\t\t\t`${sites.join(' and ')} both declare subdomain: '*', and two sites ` +\n\t\t\t\t`cannot share the same hosts. Keep one wildcard site per project; ` +\n\t\t\t\t`give the other a subdomain of its own.`,\n\t\t);\n\t\tthis.name = 'SecondWildcardSite';\n\t}\n}\n\n/** A wildcard site whose `hosts` route is on no surface the project declares. */\nexport class SiteHostsEndpointMissing extends GkmError {\n\tconstructor(\n\t\treadonly site: string,\n\t\treadonly surface: string,\n\t\treadonly path: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${site}' checks its hosts with GET ${path} on '${surface}', but ` +\n\t\t\t\t`'${surface}' serves no such route. Export the endpoint from the ` +\n\t\t\t\t`surface's endpoints, or point \\`hosts\\` at one it serves.`,\n\t\t);\n\t\tthis.name = 'SiteHostsEndpointMissing';\n\t}\n}\n\n/**\n * A file server whose host another construct already answers on.\n *\n * A file server answers on its own name — `FileServer('Assets')` on\n * `assets.<domain>` — so an app named `Assets` beside it would claim the same\n * host, and whichever deployed second would take it from the first.\n */\nexport class FileServerHostTaken extends GkmError {\n\tconstructor(\n\t\treadonly fileServer: string,\n\t\treadonly subdomain: string,\n\t\treadonly app: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${fileServer}' answers on '${subdomain}', which '${app}' answers on ` +\n\t\t\t\t`too, and two constructs cannot share a host. Rename one of them, ` +\n\t\t\t\t`or give '${app}' a subdomain of its own.`,\n\t\t);\n\t\tthis.name = 'FileServerHostTaken';\n\t}\n}\n\n/** The project's one wildcard site, or `undefined` when it has none. */\nexport function wildcardSite(\n\tmanifest: ConstructManifest,\n): SiteDeclaration | undefined {\n\treturn Object.values(manifest).find(isWildcardSite);\n}\n\n/**\n * Every label an app answers on, by the app it belongs to — what a deploy\n * puts under the stage's domain: a surface's or site's `subdomain` (or its id\n * kebab-cased), each file server and its processors' origin, and each worker,\n * which SNS may push to on a host of its own.\n *\n * The root site's is kept although it answers on the domain itself: which\n * site is the root can change without a tenant's slug changing meaning. The\n * wildcard site has none — its labels are whatever is left.\n */\nexport function appSubdomains(\n\tmanifest: ConstructManifest,\n): Map<string, string> {\n\treturn new Map(claimedLabels(manifest));\n}\n\n/** Each label a construct answers on, with that construct's id, in manifest order. */\nfunction* claimedLabels(\n\tmanifest: ConstructManifest,\n): Generator<[label: string, id: string]> {\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\tswitch (declaration.kind) {\n\t\t\tcase 'rest-api':\n\t\t\tcase 'websocket-api':\n\t\t\t\tyield [declaration.subdomain ?? appKey(id), id];\n\t\t\t\tbreak;\n\t\t\tcase 'site':\n\t\t\t\tif (declaration.subdomain === WILDCARD_SUBDOMAIN) break;\n\t\t\t\tyield [declaration.subdomain ?? appKey(id), id];\n\t\t\t\tbreak;\n\t\t\tcase 'file-server':\n\t\t\t\tyield [fileServerLabel(id), id];\n\t\t\t\tif (declaration.processors?.length) {\n\t\t\t\t\tyield [`${fileServerLabel(id)}-processors`, id];\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'worker':\n\t\t\t\tyield [appKey(id), id];\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n\n/**\n * The labels no tenant may take: every app's own and the workspace's\n * `protectedSubdomains`, sorted.\n */\nexport function protectedSubdomains(\n\tmanifest: ConstructManifest,\n\tconfigured: readonly string[] = [],\n): string[] {\n\treturn [\n\t\t...new Set([...appSubdomains(manifest).keys(), ...configured]),\n\t].sort();\n}\n\n/**\n * What a project's subdomains have to satisfy before anything is derived\n * from them.\n *\n * @throws {SecondWildcardSite} when two sites declare `subdomain: '*'`\n * @throws {SiteHostsEndpointMissing} when the wildcard site's `hosts` route is not served\n * @throws {ProtectedSubdomainIsAnApp} when `protectedSubdomains` repeats an app's own\n * @throws {FileServerHostTaken} when a file server's host is another construct's\n */\nexport function assertSubdomains(\n\tmanifest: ConstructManifest,\n\tconfigured: readonly string[] = [],\n): void {\n\tconst wildcards = Object.values(manifest).filter(isWildcardSite);\n\tif (wildcards.length > 1) {\n\t\tthrow new SecondWildcardSite(wildcards.map((site) => site.id).sort());\n\t}\n\n\tconst site = wildcards[0];\n\tif (site?.hosts) {\n\t\tconst surface = manifest[site.hosts.surface];\n\t\t// Every endpoint is in the surface's node, as discovery nested it.\n\t\tconst served =\n\t\t\tsurface?.kind === 'rest-api' &&\n\t\t\tsurface.endpoints.some(\n\t\t\t\t(endpoint) =>\n\t\t\t\t\tendpoint.method.toUpperCase() === 'GET' &&\n\t\t\t\t\tendpoint.path === site.hosts?.path,\n\t\t\t);\n\t\tif (!served) {\n\t\t\tthrow new SiteHostsEndpointMissing(\n\t\t\t\tsite.id,\n\t\t\t\tsite.hosts.surface,\n\t\t\t\tsite.hosts.path,\n\t\t\t);\n\t\t}\n\t}\n\n\tassertFileServerHosts(manifest);\n\n\tconst labels = appSubdomains(manifest);\n\tfor (const subdomain of configured) {\n\t\tconst app = labels.get(subdomain);\n\t\tif (app) throw new ProtectedSubdomainIsAnApp(subdomain, app);\n\t}\n}\n\n/**\n * Every host a file server answers on — its own and its processors' origin —\n * is no other construct's. {@link appSubdomains} keeps one owner per label,\n * so the clash it would hide is found here, before either is deployed.\n */\nfunction assertFileServerHosts(manifest: ConstructManifest): void {\n\tconst owners = new Map<string, string>();\n\tfor (const [label, id] of claimedLabels(manifest)) {\n\t\tconst other = owners.get(label);\n\t\towners.set(label, id);\n\t\tif (other === undefined || other === id) continue;\n\t\tif (manifest[id]?.kind === 'file-server') {\n\t\t\tthrow new FileServerHostTaken(id, label, other);\n\t\t}\n\t\tif (manifest[other]?.kind === 'file-server') {\n\t\t\tthrow new FileServerHostTaken(other, label, id);\n\t\t}\n\t}\n}\n","/**\n * The apps a manifest implies.\n *\n * `gkm.config.ts` used to carry an `apps` block naming every app: its type, its\n * path, its port, its framework, which other apps it depended on. Every one of\n * those facts was already declared. A `StaticSite('Web', { path: 'apps/web' })`\n * and an `apps.web = { type: 'web', path: 'apps/web', framework: 'vite',\n * dependencies: ['api'] }` are the same statement written twice, and only one of\n * them was checked against anything — so the copy in config was free to drift,\n * and a surface config had no entry for simply never deployed.\n *\n * So the list comes from the graph. A `site` is an app, and so is every\n * `rest-api` — one surface, one container, at the `path` it declared.\n *\n * What config still supplies is what no graph can answer: the backends a cache\n * and a mailer resolve to, the deploy endpoint, the stage's domain.\n */\n\nimport {\n\ttype AppSpec,\n\ttype ConstructManifest,\n\tdependenciesOf,\n\tkebabCase,\n\tWILDCARD_SUBDOMAIN,\n} from '@geekmidas/manifest';\nimport { assertSubdomains } from './subdomains.js';\nimport type {\n\tAppDomainConfig,\n\tDeployTargetName,\n\tFramework,\n\tNormalizedAppConfig,\n\tNormalizedWorkspace,\n} from './types.js';\n\n/** Which frontend framework builds each site variant. */\nconst FRAMEWORKS: Record<string, Framework> = {\n\tstatic: 'vite',\n\tnext: 'nextjs',\n\ttanstack: 'tanstack-start',\n};\n\n/**\n * The app key a construct id becomes.\n *\n * The same kebab form every physical name is built from, so `Api` is `api` in\n * the config, `production-kitchen-sink-api` on Dokploy, and `API_URL` in an\n * environment — one id, three renderings, no second list.\n */\nexport function appKey(id: string): string {\n\treturn kebabCase(id);\n}\n\n/**\n * The app serving a surface: its own, always.\n *\n * Every surface gets a container. There is no arrangement in which one runs\n * inside another — two surfaces in a process share a filesystem, an\n * environment, and every credential either was granted, so an auth server\n * beside an API is one bug in the API away from being read by it.\n */\nexport function hostOf(\n\tmanifest: ConstructManifest,\n\tid: string,\n): string | undefined {\n\tconst declaration = manifest[id];\n\tif (\n\t\t!declaration ||\n\t\t(declaration.kind !== 'rest-api' && declaration.kind !== 'websocket-api')\n\t)\n\t\treturn undefined;\n\n\treturn id;\n}\n\n/**\n * Local ports, assigned so that adding a site does not renumber the others.\n *\n * Backends first, then the site holding the base domain, then the rest\n * alphabetically. The ordering is arbitrary but it is *fixed*, which is the\n * property that matters: a port that moves when an unrelated app is added is a\n * port nobody can put in a bookmark. A construct that names its own port keeps\n * it, and is skipped here.\n */\nfunction assignPorts(apps: Record<string, NormalizedAppConfig>): void {\n\tconst rank = (\n\t\tname: string,\n\t\tapp: NormalizedAppConfig,\n\t): [number, number, string] => [\n\t\tapp.type === 'backend' ? 0 : app.type === 'web' ? 1 : 2,\n\t\tapp.root ? 0 : 1,\n\t\tname,\n\t];\n\n\tconst ordered = Object.entries(apps).sort(([aName, a], [bName, b]) => {\n\t\tconst [at, ar, an] = rank(aName, a);\n\t\tconst [bt, br, bn] = rank(bName, b);\n\t\treturn at - bt || ar - br || an.localeCompare(bn);\n\t});\n\n\tconst taken = new Set(\n\t\tordered.map(([, app]) => app.port).filter((p): p is number => !!p),\n\t);\n\n\tlet next = 3000;\n\tfor (const [, app] of ordered) {\n\t\tif (app.port) continue;\n\t\twhile (taken.has(next)) next += 1;\n\t\tapp.port = next;\n\t\ttaken.add(next);\n\t}\n}\n\n/**\n * Whichever site holds the base domain.\n *\n * The convention first — a site named `web` — because it is one people already\n * rely on. Then an explicit `root: true`. A project with one site needs neither.\n */\nfunction markRoot(apps: Record<string, NormalizedAppConfig>): void {\n\t// A wildcard site answers on every subdomain, never on the domain itself.\n\tconst sites = Object.entries(apps).filter(\n\t\t([, a]) => a.type === 'web' && a.subdomain !== WILDCARD_SUBDOMAIN,\n\t);\n\tif (sites.length === 0) return;\n\tif (sites.some(([, a]) => a.root)) return;\n\n\tconst chosen =\n\t\tsites.find(([name]) => name === 'web') ??\n\t\t(sites.length === 1 ? sites[0] : undefined);\n\tif (chosen) chosen[1].root = true;\n}\n\nexport function derivedApps(\n\tmanifest: ConstructManifest,\n\tworkspace: NormalizedWorkspace,\n): Record<string, NormalizedAppConfig> {\n\tassertSubdomains(manifest, workspace.protectedSubdomains);\n\n\tconst apps: Record<string, NormalizedAppConfig> = {};\n\tconst defaultTarget: DeployTargetName =\n\t\tworkspace.deploy?.default ?? 'dokploy';\n\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\t// Three kinds are apps: a site, a mobile app and an HTTP surface. A worker\n\t\t// is not one — it names the process that runs a cron or a subscriber, and\n\t\t// that process is the app's server, which already exists. Everything else\n\t\t// is a resource one of them uses.\n\t\tif (\n\t\t\tdeclaration.kind !== 'site' &&\n\t\t\tdeclaration.kind !== 'mobile-app' &&\n\t\t\tdeclaration.kind !== 'rest-api' &&\n\t\t\tdeclaration.kind !== 'websocket-api'\n\t\t)\n\t\t\tcontinue;\n\n\t\t// No opt-in to be had. Each says where it lives.\n\t\tconst spec: AppSpec =\n\t\t\tdeclaration.kind === 'site' || declaration.kind === 'mobile-app'\n\t\t\t\t? declaration.app\n\t\t\t\t: {\n\t\t\t\t\t\tpath: declaration.path,\n\t\t\t\t\t\t...(declaration.kind === 'rest-api' && declaration.telescope\n\t\t\t\t\t\t\t? { telescope: true }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t};\n\n\t\tconst name = appKey(id);\n\t\t// A config entry of the same name still wins, so a workspace can override\n\t\t// one field without restating the app. Nothing in this repo needs to.\n\t\tconst configured = workspace.apps[name];\n\n\t\tapps[name] = {\n\t\t\t...configured,\n\t\t\ttype:\n\t\t\t\tdeclaration.kind === 'site'\n\t\t\t\t\t? 'web'\n\t\t\t\t\t: declaration.kind === 'mobile-app'\n\t\t\t\t\t\t? 'mobile'\n\t\t\t\t\t\t: 'backend',\n\t\t\tpath: spec.path,\n\t\t\tport: spec.port ?? configured?.port ?? 0,\n\t\t\t// The label it answers on, under a stage's domain and locally alike.\n\t\t\t...((declaration.kind === 'rest-api' ||\n\t\t\t\tdeclaration.kind === 'websocket-api' ||\n\t\t\t\tdeclaration.kind === 'site') &&\n\t\t\tdeclaration.subdomain\n\t\t\t\t? { subdomain: declaration.subdomain }\n\t\t\t\t: {}),\n\t\t\tdependencies: [],\n\t\t\tresolvedDeployTarget: configured?.resolvedDeployTarget ?? defaultTarget,\n\t\t\t...(declaration.kind === 'site'\n\t\t\t\t? {\n\t\t\t\t\t\tframework: configured?.framework ?? FRAMEWORKS[declaration.variant],\n\t\t\t\t\t\t...(declaration.root ? { root: true } : {}),\n\t\t\t\t\t\t...(spec.config ? { config: spec.config } : {}),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\t...(declaration.kind === 'mobile-app'\n\t\t\t\t? {\n\t\t\t\t\t\tframework: configured?.framework ?? declaration.variant,\n\t\t\t\t\t\t...(spec.config ? { config: spec.config } : {}),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\t// One glob fans out to the six the build reads, because each generator\n\t\t\t// already inspects every export and keeps what it recognises. A\n\t\t\t// per-kind field still wins where one was given.\n\t\t\t...(spec.telescope !== undefined ? { telescope: spec.telescope } : {}),\n\t\t\t...(spec.openapi !== undefined ? { openapi: spec.openapi } : {}),\n\t\t\t...(spec.runtime !== undefined ? { runtime: spec.runtime } : {}),\n\t\t\t...(spec.env !== undefined ? { env: spec.env } : {}),\n\t\t\t...(spec.entry !== undefined ? { entry: spec.entry } : {}),\n\t\t\t...(configured?.domain\n\t\t\t\t? { domain: configured.domain as AppDomainConfig }\n\t\t\t\t: {}),\n\t\t} as NormalizedAppConfig;\n\t}\n\n\t// Build order, from the edges rather than from a hand-kept list. A site that\n\t// depends on a surface depends on the app that serves it — which for a\n\t// mounted auth server is its host, not a container that does not exist.\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\tif (\n\t\t\tdeclaration.kind !== 'site' &&\n\t\t\tdeclaration.kind !== 'mobile-app' &&\n\t\t\tdeclaration.kind !== 'rest-api' &&\n\t\t\tdeclaration.kind !== 'websocket-api'\n\t\t)\n\t\t\tcontinue;\n\n\t\tconst app = apps[appKey(id)];\n\t\tif (!app) continue;\n\n\t\t// Every edge it has: a site's own, a surface's authenticator and its\n\t\t// routes' — the same graph every other reader sees.\n\t\tconst edges = dependenciesOf(declaration);\n\n\t\tconst names = new Set<string>();\n\t\tfor (const edge of edges) {\n\t\t\tif (edge.kind !== 'rest-api') continue;\n\t\t\tconst host = hostOf(manifest, edge.target);\n\t\t\tif (!host) continue;\n\t\t\tconst key = appKey(host);\n\t\t\tif (key !== appKey(id) && apps[key]) names.add(key);\n\t\t}\n\n\t\tapp.dependencies = [...names].sort();\n\t}\n\n\tmarkRoot(apps);\n\tassignPorts(apps);\n\n\t// Apps config declared that the graph knows nothing about — a `type: 'mobile'`\n\t// entry, or a hand-run process. Kept rather than dropped: config is still the\n\t// escape hatch for what nothing declares.\n\tfor (const [name, app] of Object.entries(workspace.apps)) {\n\t\tif (!apps[name]) apps[name] = app;\n\t}\n\n\treturn apps;\n}\n","import { AsyncLocalStorage } from 'node:async_hooks';\nimport { existsSync, realpathSync } from 'node:fs';\nimport { dirname, join, parse, resolve, sep } from 'node:path';\nimport { z } from 'zod';\nimport { GkmError } from './errors';\nimport { output } from './output.js';\nimport { discover } from './reconcile/discover.js';\nimport { activeSandbox, type Sandbox } from './sandbox/sandbox.js';\nimport { runWorker } from './sandbox/worker.js';\nimport type { GkmConfig } from './types.js';\nimport { derivedApps } from './workspace/derive.js';\nimport {\n\tallConstructGlobs,\n\tgetAppGkmConfig,\n\tisWorkspaceConfig,\n\ttype LoadedConfig,\n\ttype NormalizedAppConfig,\n\ttype NormalizedWorkspace,\n\tprocessConfig,\n\ttype WorkspaceConfig,\n} from './workspace/index.js';\n\n// What `gkm dev`'s discovery endpoint answers, for the tools that read it.\nexport type {\n\tAppStatus,\n\tDataApiKind,\n\tDiscoveredApp,\n\tDiscoveredDataApi,\n\tDiscoveredWorkspace,\n\tDiscoveryEvent,\n\tDiscoveryResponse,\n} from './dev/discovery.js';\nexport type { GkmConfig } from './types.js';\nexport type { LoadedConfig, WorkspaceConfig } from './workspace/index.js';\nexport { defineWorkspace } from './workspace/index.js';\nexport type { DevConfig } from './workspace/types.js';\n/**\n * Define GKM configuration with full TypeScript support.\n * This is an identity function that provides type safety and autocomplete.\n *\n * @example\n * ```ts\n * // gkm.config.ts\n * import { defineConfig } from '@geekmidas/cli/config';\n *\n * export default defineConfig({\n * routes: './src/endpoints/**\\/*.ts',\n * envParser: './src/config/env',\n * logger: './src/config/logger',\n * telescope: true,\n * });\n * ```\n */\nexport function defineConfig(config: GkmConfig): GkmConfig {\n\treturn config;\n}\n\nexport interface ParsedModuleConfig {\n\tpath: string;\n\timportPattern: string;\n}\n\n/**\n * Parse a module config string into path and import pattern.\n *\n * @param configString - Config string in format \"./path/to/module\" or \"./path/to/module#exportName\"\n * @param defaultAlias - The default alias name to use if no export name specified\n * @returns Object with path and import pattern\n *\n * @example\n * parseModuleConfig('./src/config/env', 'envParser')\n * // { path: './src/config/env', importPattern: 'envParser' }\n *\n * parseModuleConfig('./src/config/env#envParser', 'envParser')\n * // { path: './src/config/env', importPattern: '{ envParser }' }\n *\n * parseModuleConfig('./src/config/env#myEnv', 'envParser')\n * // { path: './src/config/env', importPattern: '{ myEnv as envParser }' }\n */\nexport function parseModuleConfig(\n\tconfigString: string,\n\tdefaultAlias: string,\n): ParsedModuleConfig {\n\tconst parts = configString.split('#');\n\tconst path = parts[0] ?? configString;\n\tconst exportName = parts[1];\n\tconst importPattern = !exportName\n\t\t? defaultAlias\n\t\t: exportName === defaultAlias\n\t\t\t? `{ ${defaultAlias} }`\n\t\t\t: `{ ${exportName} as ${defaultAlias} }`;\n\n\treturn { path, importPattern };\n}\n\nexport interface ConfigDiscoveryResult {\n\tconfigPath: string;\n\tworkspaceRoot: string;\n}\n\n/**\n * Find and return the path to the config file.\n *\n * Resolution order:\n * 1. GKM_CONFIG_PATH env var (set by workspace dev command)\n * 2. Walk up directory tree from cwd\n */\nfunction findConfigPath(cwd: string): ConfigDiscoveryResult {\n\tconst files = ['gkm.config.json', 'gkm.config.ts', 'gkm.config.js'];\n\n\t// Check GKM_CONFIG_PATH env var first (set by workspace dev command)\n\tconst envConfigPath = process.env.GKM_CONFIG_PATH;\n\tif (envConfigPath && existsSync(envConfigPath)) {\n\t\treturn {\n\t\t\tconfigPath: envConfigPath,\n\t\t\tworkspaceRoot: dirname(envConfigPath),\n\t\t};\n\t}\n\n\t// Walk up directory tree to find config\n\tlet currentDir = cwd;\n\tconst { root } = parse(currentDir);\n\n\twhile (currentDir !== root) {\n\t\tfor (const file of files) {\n\t\t\tconst configPath = join(currentDir, file);\n\t\t\tif (existsSync(configPath)) {\n\t\t\t\treturn {\n\t\t\t\t\tconfigPath,\n\t\t\t\t\tworkspaceRoot: currentDir,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tcurrentDir = dirname(currentDir);\n\t}\n\n\tthrow new ConfigNotFound(cwd);\n}\n\n/**\n * The directory holding the gkm config that `cwd` belongs to — the project a\n * sandbox for it is confined to.\n *\n * @throws {ConfigNotFound} when neither `cwd` nor any parent has one.\n */\nexport function findWorkspaceRoot(cwd: string): string {\n\treturn findConfigPath(cwd).workspaceRoot;\n}\n\n/** No gkm config in a directory or any of its parents. */\nexport class ConfigNotFound extends GkmError {\n\tconstructor(readonly cwd: string) {\n\t\tsuper(\n\t\t\t'Configuration file not found. Please create gkm.config.json, gkm.config.ts, or gkm.config.js in the project root.',\n\t\t);\n\t\tthis.name = 'ConfigNotFound';\n\t}\n}\n\nexport interface RawConfigResult {\n\tconfig: GkmConfig | WorkspaceConfig;\n\tworkspaceRoot: string;\n}\n\nexport interface LoadConfigOptions {\n\t/**\n\t * Load the config — and discover the constructs it names — in this\n\t * sandbox rather than in this process. The config then arrives as data;\n\t * see {@link Sandbox.isolating} for what happens to one holding live\n\t * objects. Defaults to the run's own (`withSandbox`); with neither, the\n\t * config is imported here, as `gkm` always has.\n\t */\n\tsandbox?: Sandbox;\n\t/**\n\t * How long the sandboxed config load may run. Defaults to\n\t * {@link CONFIG_LOAD_TIMEOUT_MS}.\n\t */\n\ttimeoutMs?: number;\n}\n\n/**\n * How long loading a config, or discovering its constructs, may take in a\n * sandbox: room for tsx to compile a large project cold, and not a deploy\n * held open by a config that never finishes importing.\n */\nexport const CONFIG_LOAD_TIMEOUT_MS = 60_000;\n\n/** The config failed to import, or threw while it ran. */\nexport class ConfigLoadFailed extends Error {\n\tconstructor(\n\t\treadonly configPath: string,\n\t\treadonly detail: string,\n\t) {\n\t\tsuper(`Failed to load config: ${detail}`);\n\t\tthis.name = 'ConfigLoadFailed';\n\t}\n}\n\n/**\n * The config holds something that is not data — a custom state store, an\n * inline deploy target, a function — and the sandbox it was loaded in hands\n * the deploy nothing but data.\n */\nexport class ConfigObjectNotSerializable extends Error {\n\tconstructor(\n\t\treadonly configPath: string,\n\t\treadonly paths: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`${configPath} holds values that are not plain data at: ` +\n\t\t\t\t`${paths.join(', ')}. It was loaded in an isolating sandbox, which ` +\n\t\t\t\t'hands the deploy the config as JSON, so a live object — a custom ' +\n\t\t\t\t'store, an inline target, a function — cannot reach it. Configure ' +\n\t\t\t\t'these with plain values instead, or deploy this project with a ' +\n\t\t\t\t'sandbox that is not isolating (the default) if the host trusts it.',\n\t\t);\n\t\tthis.name = 'ConfigObjectNotSerializable';\n\t}\n}\n\n/** What the config worker answers. Checked: the worker ran project code. */\nconst ConfigAnswer = z.discriminatedUnion('reason', [\n\tz.object({\n\t\treason: z.literal('loaded'),\n\t\tconfig: z.record(z.string(), z.unknown()),\n\t}),\n\tz.object({ reason: z.literal('live'), paths: z.array(z.string()) }),\n\tz.object({\n\t\treason: z.literal('failed'),\n\t\terror: z.object({ name: z.string(), message: z.string() }),\n\t}),\n]);\n\n/** Import the config in this process — live objects and all. */\nasync function importConfig(\n\tconfigPath: string,\n): Promise<GkmConfig | WorkspaceConfig> {\n\ttry {\n\t\tconst config = await import(configPath);\n\t\treturn config.default;\n\t} catch (error) {\n\t\tthrow new ConfigLoadFailed(configPath, (error as Error).message);\n\t}\n}\n\n/**\n * The config, loaded in `sandbox` and handed back as JSON.\n *\n * A config holding live objects cannot come back that way. An isolating\n * sandbox refuses it with {@link ConfigObjectNotSerializable}; any other\n * imports it here as well, as before, since the host already runs this\n * project's code as its own.\n */\nasync function loadConfigInSandbox(\n\tsandbox: Sandbox,\n\tconfigPath: string,\n\tworkspaceRoot: string,\n\ttimeoutMs = CONFIG_LOAD_TIMEOUT_MS,\n): Promise<GkmConfig | WorkspaceConfig> {\n\tconst { value } = await runWorker(sandbox, 'config load', {\n\t\tname: 'config-worker',\n\t\targs: [configPath],\n\t\tcwd: workspaceRoot,\n\t\ttimeoutMs,\n\t\tschema: ConfigAnswer,\n\t});\n\n\tswitch (value.reason) {\n\t\tcase 'loaded':\n\t\t\t// Its shape is `processConfig`'s to check, against the workspace\n\t\t\t// schema, exactly as for a config imported here.\n\t\t\treturn value.config as unknown as GkmConfig | WorkspaceConfig;\n\t\tcase 'failed':\n\t\t\tthrow new ConfigLoadFailed(configPath, value.error.message);\n\t\tcase 'live':\n\t\t\tif (sandbox.isolating) {\n\t\t\t\tthrow new ConfigObjectNotSerializable(configPath, value.paths);\n\t\t\t}\n\t\t\treturn importConfig(configPath);\n\t}\n}\n\n/** A run's config, as its caller already loaded it (`withLoadedConfig`). */\ninterface LoadedRun {\n\tworkspaceRoot: string;\n\tconfig: GkmConfig | WorkspaceConfig;\n}\n\nconst loadedRun = new AsyncLocalStorage<LoadedRun>();\n\n/**\n * Run `fn` with `config` as the config of the workspace at `workspaceRoot`:\n * every load of it inside — however deep, sandboxed or not — answers with\n * this one rather than importing the file again.\n *\n * A config is the workspace's settings, and settings may come from the\n * environment it was loaded in (`domains: { prod: process.env.DOMAIN }`). A\n * reload in a sandbox, which passes on an allowlist of the environment, read\n * the same file to a different answer: the deploy saw no domain the command\n * had been given. Loaded once by the caller, every step of the run sees the\n * same settings. The constructs are still discovered in the run's sandbox.\n */\nexport function withLoadedConfig<T>(\n\tworkspaceRoot: string,\n\tconfig: GkmConfig | WorkspaceConfig,\n\tfn: () => T,\n): T {\n\treturn loadedRun.run({ workspaceRoot: resolve(workspaceRoot), config }, fn);\n}\n\n/**\n * The raw config of the workspace a directory belongs to, imported in this\n * process: what a caller hands {@link withLoadedConfig}, or `deploy()` as its\n * `config`.\n */\nexport async function loadRawWorkspaceConfig(\n\tcwd: string = process.cwd(),\n): Promise<RawConfigResult> {\n\tconst { configPath, workspaceRoot } = findConfigPath(cwd);\n\treturn { config: await importConfig(configPath), workspaceRoot };\n}\n\n/**\n * Load raw configuration from file.\n */\nasync function loadRawConfig(\n\tcwd: string,\n\toptions: LoadConfigOptions = {},\n): Promise<RawConfigResult> {\n\tconst { configPath, workspaceRoot } = findConfigPath(cwd);\n\tconst loaded = loadedRun.getStore();\n\tif (loaded && loaded.workspaceRoot === resolve(workspaceRoot)) {\n\t\treturn { config: loaded.config, workspaceRoot };\n\t}\n\t// The run's own sandbox when none is given: a deploy reloads the config\n\t// deep in the engine (generating Dockerfiles), and that load is the\n\t// project's code as much as the first.\n\tconst sandbox = options.sandbox ?? activeSandbox();\n\tconst config = sandbox\n\t\t? await loadConfigInSandbox(\n\t\t\t\tsandbox,\n\t\t\t\tconfigPath,\n\t\t\t\tworkspaceRoot,\n\t\t\t\toptions.timeoutMs,\n\t\t\t)\n\t\t: await importConfig(configPath);\n\n\treturn { config, workspaceRoot };\n}\n\n/**\n * Load configuration file (single-app format).\n * For backwards compatibility with existing code.\n *\n * @deprecated Use loadWorkspaceConfig for new code\n */\nexport async function loadConfig(\n\tcwd: string = process.cwd(),\n): Promise<GkmConfig> {\n\tconst { config } = await loadRawConfig(cwd);\n\n\t// If it's a workspace config, throw an error\n\tif (isWorkspaceConfig(config)) {\n\t\tthrow new Error(\n\t\t\t'Workspace configuration detected. Use loadWorkspaceConfig() instead.',\n\t\t);\n\t}\n\n\treturn config;\n}\n\n/**\n * Load configuration file and process it as a workspace.\n * Works with both single-app and workspace configurations.\n *\n * Single-app configs are automatically wrapped as a workspace with one app.\n *\n * @example\n * ```ts\n * const { type, workspace } = await loadWorkspaceConfig();\n *\n * if (type === 'workspace') {\n * console.log('Multi-app workspace:', workspace.apps);\n * } else {\n * console.log('Single app wrapped as workspace');\n * }\n * ```\n */\n/**\n * The workspace a directory belongs to, as its config states it — without\n * discovering its constructs.\n *\n * For callers that need a fact the config holds (where a stage's secrets are\n * stored) and nothing the graph adds. `loadWorkspaceConfig` imports every\n * construct module to derive the apps, which is a cost a secrets read should\n * not pay.\n */\nexport async function loadWorkspaceSettings(\n\tcwd: string = process.cwd(),\n\toptions: LoadConfigOptions = {},\n): Promise<LoadedConfig['workspace']> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd, options);\n\treturn processConfig(config, workspaceRoot).workspace;\n}\n\nexport async function loadWorkspaceConfig(\n\tcwd: string = process.cwd(),\n\toptions: LoadConfigOptions = {},\n): Promise<LoadedConfig> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd, options);\n\treturn withDerivedApps(processConfig(config, workspaceRoot), options.sandbox);\n}\n\n/**\n * The loaded config, with its apps read off the graph.\n *\n * Here rather than at each call site because every command needs the same\n * answer, and the ones that forgot to ask were exactly the bugs: a site that\n * never deployed, a surface that could not be its own process. `gkm dev`,\n * `gkm build`, `gkm docker` and `gkm deploy` now all see the same apps without\n * any of them knowing a derivation happened.\n *\n * Discovery imports the construct modules — declarations only, not endpoints —\n * which is the same import the reconciler and the build already do. A workspace\n * with no `constructs` glob discovers nothing and keeps whatever its config\n * said, so nothing that worked before changes.\n *\n * A construct file that throws is reported and skipped rather than taking the\n * command down: `gkm dev` failing to start because a half-written declaration\n * cannot be imported is a worse failure than starting with the app it does not\n * describe yet.\n */\nasync function withDerivedApps(\n\tloaded: LoadedConfig,\n\tsandbox?: Sandbox,\n): Promise<LoadedConfig> {\n\tconst globs = allConstructGlobs(loaded.workspace);\n\tif (globs.length === 0) {\n\t\tthrow new WorkspaceDeclaresNoConstructs(loaded.workspace.root);\n\t}\n\n\ttry {\n\t\tconst background: Record<string, string[]> = {};\n\t\tconst manifest = await discover({\n\t\t\tpatterns: globs,\n\t\t\tcwd: loaded.workspace.root,\n\t\t\tbackground,\n\t\t\t...(sandbox ? { sandbox } : {}),\n\t\t});\n\n\t\treturn {\n\t\t\t...loaded,\n\t\t\tmanifest,\n\t\t\tbackground,\n\t\t\tworkspace: {\n\t\t\t\t...loaded.workspace,\n\t\t\t\tapps: derivedApps(manifest, loaded.workspace),\n\t\t\t},\n\t\t};\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\toutput.warn(\n\t\t\t`⚠️ Could not read constructs, so apps come from config alone: ${message}`,\n\t\t);\n\t\treturn loaded;\n\t}\n}\n\n/**\n * A workspace with no `constructs` glob.\n *\n * In v10 every address, container and app comes from what the workspace\n * declares — there is no second path that reads a hand-written compose file or\n * an `apps` block's ports. A config that declares nothing has nothing to run.\n */\nexport class WorkspaceDeclaresNoConstructs extends GkmError {\n\tconstructor(readonly root: string) {\n\t\tsuper(\n\t\t\t`The workspace at ${root} declares no constructs. Every workspace names ` +\n\t\t\t\t\"where its constructs live — `constructs: ['./constructs/**/*.ts', \" +\n\t\t\t\t\"'./apps/*/endpoints/**/*.ts']` in gkm.config.ts — and its apps, \" +\n\t\t\t\t'containers and URLs are derived from them.',\n\t\t);\n\t\tthis.name = 'WorkspaceDeclaresNoConstructs';\n\t}\n}\n\nexport interface AppConfigResult {\n\tappName: string;\n\tapp: NormalizedAppConfig;\n\tgkmConfig: GkmConfig;\n\tworkspace: NormalizedWorkspace;\n\tworkspaceRoot: string;\n\tappRoot: string;\n}\n\n/**\n * The app a directory is part of: the one whose `path` contains it.\n *\n * An app's path is the one its construct declares — `new RestApi('Api',\n * { path: 'apps/api' })` — read off the workspace the constructs were derived\n * into, never off the filesystem's package names. The deepest match wins, so\n * an app inside another app's folder is its own; the workspace root belongs to\n * no app unless one lives there.\n */\nfunction resolveWorkspaceApp(\n\tloadedConfig: LoadedConfig,\n\tcwd: string,\n): { key: string; app: NormalizedAppConfig } | undefined {\n\tconst here = real(cwd);\n\tlet found: { key: string; app: NormalizedAppConfig; dir: string } | undefined;\n\n\tfor (const [key, app] of Object.entries(loadedConfig.workspace.apps)) {\n\t\tconst dir = real(join(loadedConfig.workspace.root, app.path));\n\t\tconst inside = here === dir || here.startsWith(`${dir}${sep}`);\n\t\tif (inside && (!found || dir.length > found.dir.length)) {\n\t\t\tfound = { key, app, dir };\n\t\t}\n\t}\n\n\treturn found && { key: found.key, app: found.app };\n}\n\n/** A path with its symlinks resolved, where it exists — `/tmp` is `/private/tmp`. */\nfunction real(path: string): string {\n\tconst absolute = resolve(path);\n\treturn existsSync(absolute) ? realpathSync(absolute) : absolute;\n}\n\n/** A directory that no app in the workspace lives in. */\nexport class NotInAnApp extends GkmError {\n\tconstructor(\n\t\treadonly cwd: string,\n\t\treadonly apps: Readonly<Record<string, string>>,\n\t) {\n\t\tsuper(\n\t\t\t`${cwd} is not inside any app's path. Apps: ` +\n\t\t\t\tObject.entries(apps)\n\t\t\t\t\t.map(([key, path]) => `${key} (${path})`)\n\t\t\t\t\t.join(', ') +\n\t\t\t\t'.',\n\t\t);\n\t\tthis.name = 'NotInAnApp';\n\t}\n}\n\n/** Every app's path, by key — what `NotInAnApp` lists. */\nfunction appPaths(loadedConfig: LoadedConfig): Record<string, string> {\n\treturn Object.fromEntries(\n\t\tObject.entries(loadedConfig.workspace.apps).map(([key, app]) => [\n\t\t\tkey,\n\t\t\tapp.path,\n\t\t]),\n\t);\n}\n\n/**\n * The backend app a directory is part of, with its gkm config — found by the\n * `path` its construct declares.\n *\n * @example\n * ```ts\n * // From apps/api, where a construct declares `path: 'apps/api'`\n * const { app, workspace, workspaceRoot } = await loadAppConfig();\n * ```\n *\n * @throws {NotInAnApp} when no app's path contains the directory.\n * @throws {NotABackendApp} when the app it is in has no gkm config to run.\n */\nexport async function loadAppConfig(\n\tcwd: string = process.cwd(),\n): Promise<AppConfigResult> {\n\tconst { appName, app, workspace, workspaceRoot } =\n\t\tawait loadWorkspaceAppInfo(cwd);\n\n\tconst gkmConfig = getAppGkmConfig(workspace, appName);\n\tif (!gkmConfig) throw new NotABackendApp(appName);\n\n\treturn {\n\t\tappName,\n\t\tapp,\n\t\tgkmConfig,\n\t\tworkspace,\n\t\tworkspaceRoot,\n\t\tappRoot: join(workspaceRoot, app.path),\n\t};\n}\n\n/** The app a directory is in has no gkm config — a site, or an entry app. */\nexport class NotABackendApp extends GkmError {\n\tconstructor(readonly appName: string) {\n\t\tsuper(\n\t\t\t`App \"${appName}\" is not a backend app and cannot be run with gkm dev.`,\n\t\t);\n\t\tthis.name = 'NotABackendApp';\n\t}\n}\n\nexport interface WorkspaceAppInfo {\n\t/** The app's key in the workspace. */\n\tappName: string;\n\tapp: NormalizedAppConfig;\n\tworkspace: NormalizedWorkspace;\n\tworkspaceRoot: string;\n}\n\n/**\n * The app a directory is part of, frontend or backend — found by the `path`\n * its construct declares. Unlike `loadAppConfig`, the app need not have a\n * gkm config, which is what `gkm exec` and `gkm test` from a site need.\n *\n * @throws {NotInAnApp} when no app's path contains the directory.\n */\nexport async function loadWorkspaceAppInfo(\n\tcwd: string = process.cwd(),\n): Promise<WorkspaceAppInfo> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd);\n\tconst loadedConfig = await withDerivedApps(\n\t\tprocessConfig(config, workspaceRoot),\n\t);\n\n\tconst resolved = resolveWorkspaceApp(loadedConfig, cwd);\n\tif (!resolved) throw new NotInAnApp(cwd, appPaths(loadedConfig));\n\n\treturn {\n\t\tappName: resolved.key,\n\t\tapp: resolved.app,\n\t\tworkspace: loadedConfig.workspace,\n\t\tworkspaceRoot,\n\t};\n}\n"],"mappings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,cAAoD;CACrE,OAAO,OAAO,YACb,OAAO,QAAQ,aAAa,UAAU,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,SAAS,CAC/D,KACA,IAAI,IACL,CAAC,CACF;AACD;;;;;;;;;;;;;;AAeA,eAAsB,cACrB,MAAc,QAAQ,IAAI,GACC;CAC3B,MAAM,EAAE,SAAS,KAAK,WAAW,kBAChC,MAAM,qBAAqB,GAAG;CAE/B,MAAM,YAAYW,kBAAAA,gBAAgB,WAAW,OAAO;CACpD,IAAI,CAAC,WAAW,MAAM,IAAI,eAAe,OAAO;CAEhD,OAAO;EACN;EACA;EACA;EACA;EACA;EACA,UAAA,GAASZ,UAAAA,KAAAA,CAAK,eAAe,IAAI,IAAI;CACtC;AACD;;AAGA,IAAa,iBAAb,cAAoCC,eAAAA,SAAS;CACvB;CAArB,YAAY,SAA0B;EACrC,MACC,QAAQ,QAAQ,uDACjB;EAHoB,KAAA,UAAA;EAIpB,KAAK,OAAO;CACb;AACD;;;;;;;;AAiBA,eAAsB,qBACrB,MAAc,QAAQ,IAAI,GACE;CAC5B,MAAM,EAAE,QAAQ,kBAAkB,MAAM,cAAc,GAAG;CACzD,MAAM,eAAe,MAAM,gBAC1BM,kBAAAA,cAAc,QAAQ,aAAa,CACpC;CAEA,MAAM,WAAW,oBAAoB,cAAc,GAAG;CACtD,IAAI,CAAC,UAAU,MAAM,IAAI,WAAW,KAAK,SAAS,YAAY,CAAC;CAE/D,OAAO;EACN,SAAS,SAAS;EAClB,KAAK,SAAS;EACd,WAAW,aAAa;EACxB;CACD;AACD"}
|
|
@@ -6,6 +6,31 @@ import { dirname, join, parse, resolve, sep } from "node:path";
|
|
|
6
6
|
import { existsSync, realpathSync } from "node:fs";
|
|
7
7
|
import { WILDCARD_SUBDOMAIN, dependenciesOf, isWildcardSite, kebabCase } from "@geekmidas/manifest";
|
|
8
8
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
9
|
+
//#region src/workspace/fileServerLabel.ts
|
|
10
|
+
/**
|
|
11
|
+
* The name a file server answers on.
|
|
12
|
+
*
|
|
13
|
+
* `new FileServer('Assets', …)` is two manifest nodes: the bucket, which keeps
|
|
14
|
+
* the id (`Assets`, `ASSETS_URL`), and the surface in front of it,
|
|
15
|
+
* `AssetsServer` (`ASSETS_SERVER_URL`). The suffix keeps the two nodes and
|
|
16
|
+
* their keys apart, and that is all it is for. A host is not a key, so it
|
|
17
|
+
* takes the name the construct was given: `assets.<domain>`, never
|
|
18
|
+
* `assets-server.<domain>`.
|
|
19
|
+
*
|
|
20
|
+
* Read off the surface's id rather than its `of`: with `{ origin }` the bucket
|
|
21
|
+
* is another construct's, and its id is not this file server's name.
|
|
22
|
+
*
|
|
23
|
+
* Every host a file server has — its CDN alias and certificate, its edge
|
|
24
|
+
* route, its local `*.localhost` address, its processors' origin and unit —
|
|
25
|
+
* is built from this one label, so no two of them can disagree.
|
|
26
|
+
*
|
|
27
|
+
* @example fileServerLabel('AssetsServer') // 'assets'
|
|
28
|
+
* @example fileServerLabel('UserUploadsServer') // 'user-uploads'
|
|
29
|
+
*/
|
|
30
|
+
function fileServerLabel(serverId) {
|
|
31
|
+
return kebabCase(serverId.replace(/Server$/, ""));
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
9
34
|
//#region src/workspace/subdomains.ts
|
|
10
35
|
/**
|
|
11
36
|
* The subdomains of a stage's domain, as a wildcard site sees them.
|
|
@@ -50,6 +75,25 @@ var SiteHostsEndpointMissing = class extends GkmError {
|
|
|
50
75
|
this.name = "SiteHostsEndpointMissing";
|
|
51
76
|
}
|
|
52
77
|
};
|
|
78
|
+
/**
|
|
79
|
+
* A file server whose host another construct already answers on.
|
|
80
|
+
*
|
|
81
|
+
* A file server answers on its own name — `FileServer('Assets')` on
|
|
82
|
+
* `assets.<domain>` — so an app named `Assets` beside it would claim the same
|
|
83
|
+
* host, and whichever deployed second would take it from the first.
|
|
84
|
+
*/
|
|
85
|
+
var FileServerHostTaken = class extends GkmError {
|
|
86
|
+
fileServer;
|
|
87
|
+
subdomain;
|
|
88
|
+
app;
|
|
89
|
+
constructor(fileServer, subdomain, app) {
|
|
90
|
+
super(`'${fileServer}' answers on '${subdomain}', which '${app}' answers on too, and two constructs cannot share a host. Rename one of them, or give '${app}' a subdomain of its own.`);
|
|
91
|
+
this.fileServer = fileServer;
|
|
92
|
+
this.subdomain = subdomain;
|
|
93
|
+
this.app = app;
|
|
94
|
+
this.name = "FileServerHostTaken";
|
|
95
|
+
}
|
|
96
|
+
};
|
|
53
97
|
/** The project's one wildcard site, or `undefined` when it has none. */
|
|
54
98
|
function wildcardSite(manifest) {
|
|
55
99
|
return Object.values(manifest).find(isWildcardSite);
|
|
@@ -65,23 +109,25 @@ function wildcardSite(manifest) {
|
|
|
65
109
|
* wildcard site has none — its labels are whatever is left.
|
|
66
110
|
*/
|
|
67
111
|
function appSubdomains(manifest) {
|
|
68
|
-
|
|
112
|
+
return new Map(claimedLabels(manifest));
|
|
113
|
+
}
|
|
114
|
+
/** Each label a construct answers on, with that construct's id, in manifest order. */
|
|
115
|
+
function* claimedLabels(manifest) {
|
|
69
116
|
for (const [id, declaration] of Object.entries(manifest)) switch (declaration.kind) {
|
|
70
117
|
case "rest-api":
|
|
71
118
|
case "websocket-api":
|
|
72
|
-
|
|
119
|
+
yield [declaration.subdomain ?? kebabCase(id), id];
|
|
73
120
|
break;
|
|
74
121
|
case "site":
|
|
75
122
|
if (declaration.subdomain === WILDCARD_SUBDOMAIN) break;
|
|
76
|
-
|
|
123
|
+
yield [declaration.subdomain ?? kebabCase(id), id];
|
|
77
124
|
break;
|
|
78
125
|
case "file-server":
|
|
79
|
-
|
|
80
|
-
if (declaration.processors?.length)
|
|
126
|
+
yield [fileServerLabel(id), id];
|
|
127
|
+
if (declaration.processors?.length) yield [`${fileServerLabel(id)}-processors`, id];
|
|
81
128
|
break;
|
|
82
|
-
case "worker":
|
|
129
|
+
case "worker": yield [kebabCase(id), id];
|
|
83
130
|
}
|
|
84
|
-
return labels;
|
|
85
131
|
}
|
|
86
132
|
/**
|
|
87
133
|
* The labels no tenant may take: every app's own and the workspace's
|
|
@@ -97,6 +143,7 @@ function protectedSubdomains(manifest, configured = []) {
|
|
|
97
143
|
* @throws {SecondWildcardSite} when two sites declare `subdomain: '*'`
|
|
98
144
|
* @throws {SiteHostsEndpointMissing} when the wildcard site's `hosts` route is not served
|
|
99
145
|
* @throws {ProtectedSubdomainIsAnApp} when `protectedSubdomains` repeats an app's own
|
|
146
|
+
* @throws {FileServerHostTaken} when a file server's host is another construct's
|
|
100
147
|
*/
|
|
101
148
|
function assertSubdomains(manifest, configured = []) {
|
|
102
149
|
const wildcards = Object.values(manifest).filter(isWildcardSite);
|
|
@@ -106,12 +153,28 @@ function assertSubdomains(manifest, configured = []) {
|
|
|
106
153
|
const surface = manifest[site.hosts.surface];
|
|
107
154
|
if (!(surface?.kind === "rest-api" && surface.endpoints.some((endpoint) => endpoint.method.toUpperCase() === "GET" && endpoint.path === site.hosts?.path))) throw new SiteHostsEndpointMissing(site.id, site.hosts.surface, site.hosts.path);
|
|
108
155
|
}
|
|
156
|
+
assertFileServerHosts(manifest);
|
|
109
157
|
const labels = appSubdomains(manifest);
|
|
110
158
|
for (const subdomain of configured) {
|
|
111
159
|
const app = labels.get(subdomain);
|
|
112
160
|
if (app) throw new ProtectedSubdomainIsAnApp(subdomain, app);
|
|
113
161
|
}
|
|
114
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Every host a file server answers on — its own and its processors' origin —
|
|
165
|
+
* is no other construct's. {@link appSubdomains} keeps one owner per label,
|
|
166
|
+
* so the clash it would hide is found here, before either is deployed.
|
|
167
|
+
*/
|
|
168
|
+
function assertFileServerHosts(manifest) {
|
|
169
|
+
const owners = /* @__PURE__ */ new Map();
|
|
170
|
+
for (const [label, id] of claimedLabels(manifest)) {
|
|
171
|
+
const other = owners.get(label);
|
|
172
|
+
owners.set(label, id);
|
|
173
|
+
if (other === void 0 || other === id) continue;
|
|
174
|
+
if (manifest[id]?.kind === "file-server") throw new FileServerHostTaken(id, label, other);
|
|
175
|
+
if (manifest[other]?.kind === "file-server") throw new FileServerHostTaken(other, label, id);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
115
178
|
//#endregion
|
|
116
179
|
//#region src/workspace/derive.ts
|
|
117
180
|
/**
|
|
@@ -691,6 +754,6 @@ async function loadWorkspaceAppInfo(cwd = process.cwd()) {
|
|
|
691
754
|
};
|
|
692
755
|
}
|
|
693
756
|
//#endregion
|
|
694
|
-
export { withLoadedConfig as _, NotABackendApp as a, protectedSubdomains as b, defineConfig as c, loadConfig as d, loadRawWorkspaceConfig as f, parseModuleConfig as g, loadWorkspaceSettings as h, ConfigObjectNotSerializable as i, findWorkspaceRoot as l, loadWorkspaceConfig as m, ConfigLoadFailed as n, NotInAnApp as o, loadWorkspaceAppInfo as p, ConfigNotFound as r, WorkspaceDeclaresNoConstructs as s, CONFIG_LOAD_TIMEOUT_MS as t, loadAppConfig as u, appKey as v, wildcardSite as x, derivedApps as y };
|
|
757
|
+
export { fileServerLabel as S, withLoadedConfig as _, NotABackendApp as a, protectedSubdomains as b, defineConfig as c, loadConfig as d, loadRawWorkspaceConfig as f, parseModuleConfig as g, loadWorkspaceSettings as h, ConfigObjectNotSerializable as i, findWorkspaceRoot as l, loadWorkspaceConfig as m, ConfigLoadFailed as n, NotInAnApp as o, loadWorkspaceAppInfo as p, ConfigNotFound as r, WorkspaceDeclaresNoConstructs as s, CONFIG_LOAD_TIMEOUT_MS as t, loadAppConfig as u, appKey as v, wildcardSite as x, derivedApps as y };
|
|
695
758
|
|
|
696
|
-
//# sourceMappingURL=config-
|
|
759
|
+
//# sourceMappingURL=config-Di0oJwM9.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-Di0oJwM9.mjs","names":["appKey","z.discriminatedUnion","z.object","z.literal","z.record","z.string","z.unknown","z.array"],"sources":["../src/workspace/fileServerLabel.ts","../src/workspace/subdomains.ts","../src/workspace/derive.ts","../src/config.ts"],"sourcesContent":["import { kebabCase } from '@geekmidas/manifest';\n\n/**\n * The name a file server answers on.\n *\n * `new FileServer('Assets', …)` is two manifest nodes: the bucket, which keeps\n * the id (`Assets`, `ASSETS_URL`), and the surface in front of it,\n * `AssetsServer` (`ASSETS_SERVER_URL`). The suffix keeps the two nodes and\n * their keys apart, and that is all it is for. A host is not a key, so it\n * takes the name the construct was given: `assets.<domain>`, never\n * `assets-server.<domain>`.\n *\n * Read off the surface's id rather than its `of`: with `{ origin }` the bucket\n * is another construct's, and its id is not this file server's name.\n *\n * Every host a file server has — its CDN alias and certificate, its edge\n * route, its local `*.localhost` address, its processors' origin and unit —\n * is built from this one label, so no two of them can disagree.\n *\n * @example fileServerLabel('AssetsServer') // 'assets'\n * @example fileServerLabel('UserUploadsServer') // 'user-uploads'\n */\nexport function fileServerLabel(serverId: string): string {\n\treturn kebabCase(serverId.replace(/Server$/, ''));\n}\n","/**\n * The subdomains of a stage's domain, as a wildcard site sees them.\n *\n * A site declared `subdomain: '*'` answers on every label nothing else does,\n * so the labels something else does answer on are the ones a tenant can never\n * take. They come from two places and from nowhere else: every app's own\n * label, read off the constructs and never listed by hand, and the names no\n * construct declares (`www`, `mail`, `status`), listed once in the workspace\n * config as `protectedSubdomains`.\n */\n\nimport {\n\tkebabCase as appKey,\n\ttype ConstructManifest,\n\tisWildcardSite,\n\ttype SiteDeclaration,\n\tWILDCARD_SUBDOMAIN,\n} from '@geekmidas/manifest';\nimport { GkmError } from '../errors';\nimport { fileServerLabel } from './fileServerLabel.js';\n\n/** A `protectedSubdomains` entry an app already answers on. */\nexport class ProtectedSubdomainIsAnApp extends GkmError {\n\tconstructor(\n\t\treadonly subdomain: string,\n\t\treadonly app: string,\n\t) {\n\t\tsuper(\n\t\t\t`protectedSubdomains lists '${subdomain}', which '${app}' already ` +\n\t\t\t\t`answers on — a construct's own subdomain is protected without ` +\n\t\t\t\t`being listed. Remove it from protectedSubdomains.`,\n\t\t);\n\t\tthis.name = 'ProtectedSubdomainIsAnApp';\n\t}\n}\n\n/** Two sites that both answer on every subdomain. */\nexport class SecondWildcardSite extends GkmError {\n\tconstructor(readonly sites: readonly string[]) {\n\t\tsuper(\n\t\t\t`${sites.join(' and ')} both declare subdomain: '*', and two sites ` +\n\t\t\t\t`cannot share the same hosts. Keep one wildcard site per project; ` +\n\t\t\t\t`give the other a subdomain of its own.`,\n\t\t);\n\t\tthis.name = 'SecondWildcardSite';\n\t}\n}\n\n/** A wildcard site whose `hosts` route is on no surface the project declares. */\nexport class SiteHostsEndpointMissing extends GkmError {\n\tconstructor(\n\t\treadonly site: string,\n\t\treadonly surface: string,\n\t\treadonly path: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${site}' checks its hosts with GET ${path} on '${surface}', but ` +\n\t\t\t\t`'${surface}' serves no such route. Export the endpoint from the ` +\n\t\t\t\t`surface's endpoints, or point \\`hosts\\` at one it serves.`,\n\t\t);\n\t\tthis.name = 'SiteHostsEndpointMissing';\n\t}\n}\n\n/**\n * A file server whose host another construct already answers on.\n *\n * A file server answers on its own name — `FileServer('Assets')` on\n * `assets.<domain>` — so an app named `Assets` beside it would claim the same\n * host, and whichever deployed second would take it from the first.\n */\nexport class FileServerHostTaken extends GkmError {\n\tconstructor(\n\t\treadonly fileServer: string,\n\t\treadonly subdomain: string,\n\t\treadonly app: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${fileServer}' answers on '${subdomain}', which '${app}' answers on ` +\n\t\t\t\t`too, and two constructs cannot share a host. Rename one of them, ` +\n\t\t\t\t`or give '${app}' a subdomain of its own.`,\n\t\t);\n\t\tthis.name = 'FileServerHostTaken';\n\t}\n}\n\n/** The project's one wildcard site, or `undefined` when it has none. */\nexport function wildcardSite(\n\tmanifest: ConstructManifest,\n): SiteDeclaration | undefined {\n\treturn Object.values(manifest).find(isWildcardSite);\n}\n\n/**\n * Every label an app answers on, by the app it belongs to — what a deploy\n * puts under the stage's domain: a surface's or site's `subdomain` (or its id\n * kebab-cased), each file server and its processors' origin, and each worker,\n * which SNS may push to on a host of its own.\n *\n * The root site's is kept although it answers on the domain itself: which\n * site is the root can change without a tenant's slug changing meaning. The\n * wildcard site has none — its labels are whatever is left.\n */\nexport function appSubdomains(\n\tmanifest: ConstructManifest,\n): Map<string, string> {\n\treturn new Map(claimedLabels(manifest));\n}\n\n/** Each label a construct answers on, with that construct's id, in manifest order. */\nfunction* claimedLabels(\n\tmanifest: ConstructManifest,\n): Generator<[label: string, id: string]> {\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\tswitch (declaration.kind) {\n\t\t\tcase 'rest-api':\n\t\t\tcase 'websocket-api':\n\t\t\t\tyield [declaration.subdomain ?? appKey(id), id];\n\t\t\t\tbreak;\n\t\t\tcase 'site':\n\t\t\t\tif (declaration.subdomain === WILDCARD_SUBDOMAIN) break;\n\t\t\t\tyield [declaration.subdomain ?? appKey(id), id];\n\t\t\t\tbreak;\n\t\t\tcase 'file-server':\n\t\t\t\tyield [fileServerLabel(id), id];\n\t\t\t\tif (declaration.processors?.length) {\n\t\t\t\t\tyield [`${fileServerLabel(id)}-processors`, id];\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'worker':\n\t\t\t\tyield [appKey(id), id];\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n\n/**\n * The labels no tenant may take: every app's own and the workspace's\n * `protectedSubdomains`, sorted.\n */\nexport function protectedSubdomains(\n\tmanifest: ConstructManifest,\n\tconfigured: readonly string[] = [],\n): string[] {\n\treturn [\n\t\t...new Set([...appSubdomains(manifest).keys(), ...configured]),\n\t].sort();\n}\n\n/**\n * What a project's subdomains have to satisfy before anything is derived\n * from them.\n *\n * @throws {SecondWildcardSite} when two sites declare `subdomain: '*'`\n * @throws {SiteHostsEndpointMissing} when the wildcard site's `hosts` route is not served\n * @throws {ProtectedSubdomainIsAnApp} when `protectedSubdomains` repeats an app's own\n * @throws {FileServerHostTaken} when a file server's host is another construct's\n */\nexport function assertSubdomains(\n\tmanifest: ConstructManifest,\n\tconfigured: readonly string[] = [],\n): void {\n\tconst wildcards = Object.values(manifest).filter(isWildcardSite);\n\tif (wildcards.length > 1) {\n\t\tthrow new SecondWildcardSite(wildcards.map((site) => site.id).sort());\n\t}\n\n\tconst site = wildcards[0];\n\tif (site?.hosts) {\n\t\tconst surface = manifest[site.hosts.surface];\n\t\t// Every endpoint is in the surface's node, as discovery nested it.\n\t\tconst served =\n\t\t\tsurface?.kind === 'rest-api' &&\n\t\t\tsurface.endpoints.some(\n\t\t\t\t(endpoint) =>\n\t\t\t\t\tendpoint.method.toUpperCase() === 'GET' &&\n\t\t\t\t\tendpoint.path === site.hosts?.path,\n\t\t\t);\n\t\tif (!served) {\n\t\t\tthrow new SiteHostsEndpointMissing(\n\t\t\t\tsite.id,\n\t\t\t\tsite.hosts.surface,\n\t\t\t\tsite.hosts.path,\n\t\t\t);\n\t\t}\n\t}\n\n\tassertFileServerHosts(manifest);\n\n\tconst labels = appSubdomains(manifest);\n\tfor (const subdomain of configured) {\n\t\tconst app = labels.get(subdomain);\n\t\tif (app) throw new ProtectedSubdomainIsAnApp(subdomain, app);\n\t}\n}\n\n/**\n * Every host a file server answers on — its own and its processors' origin —\n * is no other construct's. {@link appSubdomains} keeps one owner per label,\n * so the clash it would hide is found here, before either is deployed.\n */\nfunction assertFileServerHosts(manifest: ConstructManifest): void {\n\tconst owners = new Map<string, string>();\n\tfor (const [label, id] of claimedLabels(manifest)) {\n\t\tconst other = owners.get(label);\n\t\towners.set(label, id);\n\t\tif (other === undefined || other === id) continue;\n\t\tif (manifest[id]?.kind === 'file-server') {\n\t\t\tthrow new FileServerHostTaken(id, label, other);\n\t\t}\n\t\tif (manifest[other]?.kind === 'file-server') {\n\t\t\tthrow new FileServerHostTaken(other, label, id);\n\t\t}\n\t}\n}\n","/**\n * The apps a manifest implies.\n *\n * `gkm.config.ts` used to carry an `apps` block naming every app: its type, its\n * path, its port, its framework, which other apps it depended on. Every one of\n * those facts was already declared. A `StaticSite('Web', { path: 'apps/web' })`\n * and an `apps.web = { type: 'web', path: 'apps/web', framework: 'vite',\n * dependencies: ['api'] }` are the same statement written twice, and only one of\n * them was checked against anything — so the copy in config was free to drift,\n * and a surface config had no entry for simply never deployed.\n *\n * So the list comes from the graph. A `site` is an app, and so is every\n * `rest-api` — one surface, one container, at the `path` it declared.\n *\n * What config still supplies is what no graph can answer: the backends a cache\n * and a mailer resolve to, the deploy endpoint, the stage's domain.\n */\n\nimport {\n\ttype AppSpec,\n\ttype ConstructManifest,\n\tdependenciesOf,\n\tkebabCase,\n\tWILDCARD_SUBDOMAIN,\n} from '@geekmidas/manifest';\nimport { assertSubdomains } from './subdomains.js';\nimport type {\n\tAppDomainConfig,\n\tDeployTargetName,\n\tFramework,\n\tNormalizedAppConfig,\n\tNormalizedWorkspace,\n} from './types.js';\n\n/** Which frontend framework builds each site variant. */\nconst FRAMEWORKS: Record<string, Framework> = {\n\tstatic: 'vite',\n\tnext: 'nextjs',\n\ttanstack: 'tanstack-start',\n};\n\n/**\n * The app key a construct id becomes.\n *\n * The same kebab form every physical name is built from, so `Api` is `api` in\n * the config, `production-kitchen-sink-api` on Dokploy, and `API_URL` in an\n * environment — one id, three renderings, no second list.\n */\nexport function appKey(id: string): string {\n\treturn kebabCase(id);\n}\n\n/**\n * The app serving a surface: its own, always.\n *\n * Every surface gets a container. There is no arrangement in which one runs\n * inside another — two surfaces in a process share a filesystem, an\n * environment, and every credential either was granted, so an auth server\n * beside an API is one bug in the API away from being read by it.\n */\nexport function hostOf(\n\tmanifest: ConstructManifest,\n\tid: string,\n): string | undefined {\n\tconst declaration = manifest[id];\n\tif (\n\t\t!declaration ||\n\t\t(declaration.kind !== 'rest-api' && declaration.kind !== 'websocket-api')\n\t)\n\t\treturn undefined;\n\n\treturn id;\n}\n\n/**\n * Local ports, assigned so that adding a site does not renumber the others.\n *\n * Backends first, then the site holding the base domain, then the rest\n * alphabetically. The ordering is arbitrary but it is *fixed*, which is the\n * property that matters: a port that moves when an unrelated app is added is a\n * port nobody can put in a bookmark. A construct that names its own port keeps\n * it, and is skipped here.\n */\nfunction assignPorts(apps: Record<string, NormalizedAppConfig>): void {\n\tconst rank = (\n\t\tname: string,\n\t\tapp: NormalizedAppConfig,\n\t): [number, number, string] => [\n\t\tapp.type === 'backend' ? 0 : app.type === 'web' ? 1 : 2,\n\t\tapp.root ? 0 : 1,\n\t\tname,\n\t];\n\n\tconst ordered = Object.entries(apps).sort(([aName, a], [bName, b]) => {\n\t\tconst [at, ar, an] = rank(aName, a);\n\t\tconst [bt, br, bn] = rank(bName, b);\n\t\treturn at - bt || ar - br || an.localeCompare(bn);\n\t});\n\n\tconst taken = new Set(\n\t\tordered.map(([, app]) => app.port).filter((p): p is number => !!p),\n\t);\n\n\tlet next = 3000;\n\tfor (const [, app] of ordered) {\n\t\tif (app.port) continue;\n\t\twhile (taken.has(next)) next += 1;\n\t\tapp.port = next;\n\t\ttaken.add(next);\n\t}\n}\n\n/**\n * Whichever site holds the base domain.\n *\n * The convention first — a site named `web` — because it is one people already\n * rely on. Then an explicit `root: true`. A project with one site needs neither.\n */\nfunction markRoot(apps: Record<string, NormalizedAppConfig>): void {\n\t// A wildcard site answers on every subdomain, never on the domain itself.\n\tconst sites = Object.entries(apps).filter(\n\t\t([, a]) => a.type === 'web' && a.subdomain !== WILDCARD_SUBDOMAIN,\n\t);\n\tif (sites.length === 0) return;\n\tif (sites.some(([, a]) => a.root)) return;\n\n\tconst chosen =\n\t\tsites.find(([name]) => name === 'web') ??\n\t\t(sites.length === 1 ? sites[0] : undefined);\n\tif (chosen) chosen[1].root = true;\n}\n\nexport function derivedApps(\n\tmanifest: ConstructManifest,\n\tworkspace: NormalizedWorkspace,\n): Record<string, NormalizedAppConfig> {\n\tassertSubdomains(manifest, workspace.protectedSubdomains);\n\n\tconst apps: Record<string, NormalizedAppConfig> = {};\n\tconst defaultTarget: DeployTargetName =\n\t\tworkspace.deploy?.default ?? 'dokploy';\n\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\t// Three kinds are apps: a site, a mobile app and an HTTP surface. A worker\n\t\t// is not one — it names the process that runs a cron or a subscriber, and\n\t\t// that process is the app's server, which already exists. Everything else\n\t\t// is a resource one of them uses.\n\t\tif (\n\t\t\tdeclaration.kind !== 'site' &&\n\t\t\tdeclaration.kind !== 'mobile-app' &&\n\t\t\tdeclaration.kind !== 'rest-api' &&\n\t\t\tdeclaration.kind !== 'websocket-api'\n\t\t)\n\t\t\tcontinue;\n\n\t\t// No opt-in to be had. Each says where it lives.\n\t\tconst spec: AppSpec =\n\t\t\tdeclaration.kind === 'site' || declaration.kind === 'mobile-app'\n\t\t\t\t? declaration.app\n\t\t\t\t: {\n\t\t\t\t\t\tpath: declaration.path,\n\t\t\t\t\t\t...(declaration.kind === 'rest-api' && declaration.telescope\n\t\t\t\t\t\t\t? { telescope: true }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t};\n\n\t\tconst name = appKey(id);\n\t\t// A config entry of the same name still wins, so a workspace can override\n\t\t// one field without restating the app. Nothing in this repo needs to.\n\t\tconst configured = workspace.apps[name];\n\n\t\tapps[name] = {\n\t\t\t...configured,\n\t\t\ttype:\n\t\t\t\tdeclaration.kind === 'site'\n\t\t\t\t\t? 'web'\n\t\t\t\t\t: declaration.kind === 'mobile-app'\n\t\t\t\t\t\t? 'mobile'\n\t\t\t\t\t\t: 'backend',\n\t\t\tpath: spec.path,\n\t\t\tport: spec.port ?? configured?.port ?? 0,\n\t\t\t// The label it answers on, under a stage's domain and locally alike.\n\t\t\t...((declaration.kind === 'rest-api' ||\n\t\t\t\tdeclaration.kind === 'websocket-api' ||\n\t\t\t\tdeclaration.kind === 'site') &&\n\t\t\tdeclaration.subdomain\n\t\t\t\t? { subdomain: declaration.subdomain }\n\t\t\t\t: {}),\n\t\t\tdependencies: [],\n\t\t\tresolvedDeployTarget: configured?.resolvedDeployTarget ?? defaultTarget,\n\t\t\t...(declaration.kind === 'site'\n\t\t\t\t? {\n\t\t\t\t\t\tframework: configured?.framework ?? FRAMEWORKS[declaration.variant],\n\t\t\t\t\t\t...(declaration.root ? { root: true } : {}),\n\t\t\t\t\t\t...(spec.config ? { config: spec.config } : {}),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\t...(declaration.kind === 'mobile-app'\n\t\t\t\t? {\n\t\t\t\t\t\tframework: configured?.framework ?? declaration.variant,\n\t\t\t\t\t\t...(spec.config ? { config: spec.config } : {}),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\t// One glob fans out to the six the build reads, because each generator\n\t\t\t// already inspects every export and keeps what it recognises. A\n\t\t\t// per-kind field still wins where one was given.\n\t\t\t...(spec.telescope !== undefined ? { telescope: spec.telescope } : {}),\n\t\t\t...(spec.openapi !== undefined ? { openapi: spec.openapi } : {}),\n\t\t\t...(spec.runtime !== undefined ? { runtime: spec.runtime } : {}),\n\t\t\t...(spec.env !== undefined ? { env: spec.env } : {}),\n\t\t\t...(spec.entry !== undefined ? { entry: spec.entry } : {}),\n\t\t\t...(configured?.domain\n\t\t\t\t? { domain: configured.domain as AppDomainConfig }\n\t\t\t\t: {}),\n\t\t} as NormalizedAppConfig;\n\t}\n\n\t// Build order, from the edges rather than from a hand-kept list. A site that\n\t// depends on a surface depends on the app that serves it — which for a\n\t// mounted auth server is its host, not a container that does not exist.\n\tfor (const [id, declaration] of Object.entries(manifest)) {\n\t\tif (\n\t\t\tdeclaration.kind !== 'site' &&\n\t\t\tdeclaration.kind !== 'mobile-app' &&\n\t\t\tdeclaration.kind !== 'rest-api' &&\n\t\t\tdeclaration.kind !== 'websocket-api'\n\t\t)\n\t\t\tcontinue;\n\n\t\tconst app = apps[appKey(id)];\n\t\tif (!app) continue;\n\n\t\t// Every edge it has: a site's own, a surface's authenticator and its\n\t\t// routes' — the same graph every other reader sees.\n\t\tconst edges = dependenciesOf(declaration);\n\n\t\tconst names = new Set<string>();\n\t\tfor (const edge of edges) {\n\t\t\tif (edge.kind !== 'rest-api') continue;\n\t\t\tconst host = hostOf(manifest, edge.target);\n\t\t\tif (!host) continue;\n\t\t\tconst key = appKey(host);\n\t\t\tif (key !== appKey(id) && apps[key]) names.add(key);\n\t\t}\n\n\t\tapp.dependencies = [...names].sort();\n\t}\n\n\tmarkRoot(apps);\n\tassignPorts(apps);\n\n\t// Apps config declared that the graph knows nothing about — a `type: 'mobile'`\n\t// entry, or a hand-run process. Kept rather than dropped: config is still the\n\t// escape hatch for what nothing declares.\n\tfor (const [name, app] of Object.entries(workspace.apps)) {\n\t\tif (!apps[name]) apps[name] = app;\n\t}\n\n\treturn apps;\n}\n","import { AsyncLocalStorage } from 'node:async_hooks';\nimport { existsSync, realpathSync } from 'node:fs';\nimport { dirname, join, parse, resolve, sep } from 'node:path';\nimport { z } from 'zod';\nimport { GkmError } from './errors';\nimport { output } from './output.js';\nimport { discover } from './reconcile/discover.js';\nimport { activeSandbox, type Sandbox } from './sandbox/sandbox.js';\nimport { runWorker } from './sandbox/worker.js';\nimport type { GkmConfig } from './types.js';\nimport { derivedApps } from './workspace/derive.js';\nimport {\n\tallConstructGlobs,\n\tgetAppGkmConfig,\n\tisWorkspaceConfig,\n\ttype LoadedConfig,\n\ttype NormalizedAppConfig,\n\ttype NormalizedWorkspace,\n\tprocessConfig,\n\ttype WorkspaceConfig,\n} from './workspace/index.js';\n\n// What `gkm dev`'s discovery endpoint answers, for the tools that read it.\nexport type {\n\tAppStatus,\n\tDataApiKind,\n\tDiscoveredApp,\n\tDiscoveredDataApi,\n\tDiscoveredWorkspace,\n\tDiscoveryEvent,\n\tDiscoveryResponse,\n} from './dev/discovery.js';\nexport type { GkmConfig } from './types.js';\nexport type { LoadedConfig, WorkspaceConfig } from './workspace/index.js';\nexport { defineWorkspace } from './workspace/index.js';\nexport type { DevConfig } from './workspace/types.js';\n/**\n * Define GKM configuration with full TypeScript support.\n * This is an identity function that provides type safety and autocomplete.\n *\n * @example\n * ```ts\n * // gkm.config.ts\n * import { defineConfig } from '@geekmidas/cli/config';\n *\n * export default defineConfig({\n * routes: './src/endpoints/**\\/*.ts',\n * envParser: './src/config/env',\n * logger: './src/config/logger',\n * telescope: true,\n * });\n * ```\n */\nexport function defineConfig(config: GkmConfig): GkmConfig {\n\treturn config;\n}\n\nexport interface ParsedModuleConfig {\n\tpath: string;\n\timportPattern: string;\n}\n\n/**\n * Parse a module config string into path and import pattern.\n *\n * @param configString - Config string in format \"./path/to/module\" or \"./path/to/module#exportName\"\n * @param defaultAlias - The default alias name to use if no export name specified\n * @returns Object with path and import pattern\n *\n * @example\n * parseModuleConfig('./src/config/env', 'envParser')\n * // { path: './src/config/env', importPattern: 'envParser' }\n *\n * parseModuleConfig('./src/config/env#envParser', 'envParser')\n * // { path: './src/config/env', importPattern: '{ envParser }' }\n *\n * parseModuleConfig('./src/config/env#myEnv', 'envParser')\n * // { path: './src/config/env', importPattern: '{ myEnv as envParser }' }\n */\nexport function parseModuleConfig(\n\tconfigString: string,\n\tdefaultAlias: string,\n): ParsedModuleConfig {\n\tconst parts = configString.split('#');\n\tconst path = parts[0] ?? configString;\n\tconst exportName = parts[1];\n\tconst importPattern = !exportName\n\t\t? defaultAlias\n\t\t: exportName === defaultAlias\n\t\t\t? `{ ${defaultAlias} }`\n\t\t\t: `{ ${exportName} as ${defaultAlias} }`;\n\n\treturn { path, importPattern };\n}\n\nexport interface ConfigDiscoveryResult {\n\tconfigPath: string;\n\tworkspaceRoot: string;\n}\n\n/**\n * Find and return the path to the config file.\n *\n * Resolution order:\n * 1. GKM_CONFIG_PATH env var (set by workspace dev command)\n * 2. Walk up directory tree from cwd\n */\nfunction findConfigPath(cwd: string): ConfigDiscoveryResult {\n\tconst files = ['gkm.config.json', 'gkm.config.ts', 'gkm.config.js'];\n\n\t// Check GKM_CONFIG_PATH env var first (set by workspace dev command)\n\tconst envConfigPath = process.env.GKM_CONFIG_PATH;\n\tif (envConfigPath && existsSync(envConfigPath)) {\n\t\treturn {\n\t\t\tconfigPath: envConfigPath,\n\t\t\tworkspaceRoot: dirname(envConfigPath),\n\t\t};\n\t}\n\n\t// Walk up directory tree to find config\n\tlet currentDir = cwd;\n\tconst { root } = parse(currentDir);\n\n\twhile (currentDir !== root) {\n\t\tfor (const file of files) {\n\t\t\tconst configPath = join(currentDir, file);\n\t\t\tif (existsSync(configPath)) {\n\t\t\t\treturn {\n\t\t\t\t\tconfigPath,\n\t\t\t\t\tworkspaceRoot: currentDir,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tcurrentDir = dirname(currentDir);\n\t}\n\n\tthrow new ConfigNotFound(cwd);\n}\n\n/**\n * The directory holding the gkm config that `cwd` belongs to — the project a\n * sandbox for it is confined to.\n *\n * @throws {ConfigNotFound} when neither `cwd` nor any parent has one.\n */\nexport function findWorkspaceRoot(cwd: string): string {\n\treturn findConfigPath(cwd).workspaceRoot;\n}\n\n/** No gkm config in a directory or any of its parents. */\nexport class ConfigNotFound extends GkmError {\n\tconstructor(readonly cwd: string) {\n\t\tsuper(\n\t\t\t'Configuration file not found. Please create gkm.config.json, gkm.config.ts, or gkm.config.js in the project root.',\n\t\t);\n\t\tthis.name = 'ConfigNotFound';\n\t}\n}\n\nexport interface RawConfigResult {\n\tconfig: GkmConfig | WorkspaceConfig;\n\tworkspaceRoot: string;\n}\n\nexport interface LoadConfigOptions {\n\t/**\n\t * Load the config — and discover the constructs it names — in this\n\t * sandbox rather than in this process. The config then arrives as data;\n\t * see {@link Sandbox.isolating} for what happens to one holding live\n\t * objects. Defaults to the run's own (`withSandbox`); with neither, the\n\t * config is imported here, as `gkm` always has.\n\t */\n\tsandbox?: Sandbox;\n\t/**\n\t * How long the sandboxed config load may run. Defaults to\n\t * {@link CONFIG_LOAD_TIMEOUT_MS}.\n\t */\n\ttimeoutMs?: number;\n}\n\n/**\n * How long loading a config, or discovering its constructs, may take in a\n * sandbox: room for tsx to compile a large project cold, and not a deploy\n * held open by a config that never finishes importing.\n */\nexport const CONFIG_LOAD_TIMEOUT_MS = 60_000;\n\n/** The config failed to import, or threw while it ran. */\nexport class ConfigLoadFailed extends Error {\n\tconstructor(\n\t\treadonly configPath: string,\n\t\treadonly detail: string,\n\t) {\n\t\tsuper(`Failed to load config: ${detail}`);\n\t\tthis.name = 'ConfigLoadFailed';\n\t}\n}\n\n/**\n * The config holds something that is not data — a custom state store, an\n * inline deploy target, a function — and the sandbox it was loaded in hands\n * the deploy nothing but data.\n */\nexport class ConfigObjectNotSerializable extends Error {\n\tconstructor(\n\t\treadonly configPath: string,\n\t\treadonly paths: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`${configPath} holds values that are not plain data at: ` +\n\t\t\t\t`${paths.join(', ')}. It was loaded in an isolating sandbox, which ` +\n\t\t\t\t'hands the deploy the config as JSON, so a live object — a custom ' +\n\t\t\t\t'store, an inline target, a function — cannot reach it. Configure ' +\n\t\t\t\t'these with plain values instead, or deploy this project with a ' +\n\t\t\t\t'sandbox that is not isolating (the default) if the host trusts it.',\n\t\t);\n\t\tthis.name = 'ConfigObjectNotSerializable';\n\t}\n}\n\n/** What the config worker answers. Checked: the worker ran project code. */\nconst ConfigAnswer = z.discriminatedUnion('reason', [\n\tz.object({\n\t\treason: z.literal('loaded'),\n\t\tconfig: z.record(z.string(), z.unknown()),\n\t}),\n\tz.object({ reason: z.literal('live'), paths: z.array(z.string()) }),\n\tz.object({\n\t\treason: z.literal('failed'),\n\t\terror: z.object({ name: z.string(), message: z.string() }),\n\t}),\n]);\n\n/** Import the config in this process — live objects and all. */\nasync function importConfig(\n\tconfigPath: string,\n): Promise<GkmConfig | WorkspaceConfig> {\n\ttry {\n\t\tconst config = await import(configPath);\n\t\treturn config.default;\n\t} catch (error) {\n\t\tthrow new ConfigLoadFailed(configPath, (error as Error).message);\n\t}\n}\n\n/**\n * The config, loaded in `sandbox` and handed back as JSON.\n *\n * A config holding live objects cannot come back that way. An isolating\n * sandbox refuses it with {@link ConfigObjectNotSerializable}; any other\n * imports it here as well, as before, since the host already runs this\n * project's code as its own.\n */\nasync function loadConfigInSandbox(\n\tsandbox: Sandbox,\n\tconfigPath: string,\n\tworkspaceRoot: string,\n\ttimeoutMs = CONFIG_LOAD_TIMEOUT_MS,\n): Promise<GkmConfig | WorkspaceConfig> {\n\tconst { value } = await runWorker(sandbox, 'config load', {\n\t\tname: 'config-worker',\n\t\targs: [configPath],\n\t\tcwd: workspaceRoot,\n\t\ttimeoutMs,\n\t\tschema: ConfigAnswer,\n\t});\n\n\tswitch (value.reason) {\n\t\tcase 'loaded':\n\t\t\t// Its shape is `processConfig`'s to check, against the workspace\n\t\t\t// schema, exactly as for a config imported here.\n\t\t\treturn value.config as unknown as GkmConfig | WorkspaceConfig;\n\t\tcase 'failed':\n\t\t\tthrow new ConfigLoadFailed(configPath, value.error.message);\n\t\tcase 'live':\n\t\t\tif (sandbox.isolating) {\n\t\t\t\tthrow new ConfigObjectNotSerializable(configPath, value.paths);\n\t\t\t}\n\t\t\treturn importConfig(configPath);\n\t}\n}\n\n/** A run's config, as its caller already loaded it (`withLoadedConfig`). */\ninterface LoadedRun {\n\tworkspaceRoot: string;\n\tconfig: GkmConfig | WorkspaceConfig;\n}\n\nconst loadedRun = new AsyncLocalStorage<LoadedRun>();\n\n/**\n * Run `fn` with `config` as the config of the workspace at `workspaceRoot`:\n * every load of it inside — however deep, sandboxed or not — answers with\n * this one rather than importing the file again.\n *\n * A config is the workspace's settings, and settings may come from the\n * environment it was loaded in (`domains: { prod: process.env.DOMAIN }`). A\n * reload in a sandbox, which passes on an allowlist of the environment, read\n * the same file to a different answer: the deploy saw no domain the command\n * had been given. Loaded once by the caller, every step of the run sees the\n * same settings. The constructs are still discovered in the run's sandbox.\n */\nexport function withLoadedConfig<T>(\n\tworkspaceRoot: string,\n\tconfig: GkmConfig | WorkspaceConfig,\n\tfn: () => T,\n): T {\n\treturn loadedRun.run({ workspaceRoot: resolve(workspaceRoot), config }, fn);\n}\n\n/**\n * The raw config of the workspace a directory belongs to, imported in this\n * process: what a caller hands {@link withLoadedConfig}, or `deploy()` as its\n * `config`.\n */\nexport async function loadRawWorkspaceConfig(\n\tcwd: string = process.cwd(),\n): Promise<RawConfigResult> {\n\tconst { configPath, workspaceRoot } = findConfigPath(cwd);\n\treturn { config: await importConfig(configPath), workspaceRoot };\n}\n\n/**\n * Load raw configuration from file.\n */\nasync function loadRawConfig(\n\tcwd: string,\n\toptions: LoadConfigOptions = {},\n): Promise<RawConfigResult> {\n\tconst { configPath, workspaceRoot } = findConfigPath(cwd);\n\tconst loaded = loadedRun.getStore();\n\tif (loaded && loaded.workspaceRoot === resolve(workspaceRoot)) {\n\t\treturn { config: loaded.config, workspaceRoot };\n\t}\n\t// The run's own sandbox when none is given: a deploy reloads the config\n\t// deep in the engine (generating Dockerfiles), and that load is the\n\t// project's code as much as the first.\n\tconst sandbox = options.sandbox ?? activeSandbox();\n\tconst config = sandbox\n\t\t? await loadConfigInSandbox(\n\t\t\t\tsandbox,\n\t\t\t\tconfigPath,\n\t\t\t\tworkspaceRoot,\n\t\t\t\toptions.timeoutMs,\n\t\t\t)\n\t\t: await importConfig(configPath);\n\n\treturn { config, workspaceRoot };\n}\n\n/**\n * Load configuration file (single-app format).\n * For backwards compatibility with existing code.\n *\n * @deprecated Use loadWorkspaceConfig for new code\n */\nexport async function loadConfig(\n\tcwd: string = process.cwd(),\n): Promise<GkmConfig> {\n\tconst { config } = await loadRawConfig(cwd);\n\n\t// If it's a workspace config, throw an error\n\tif (isWorkspaceConfig(config)) {\n\t\tthrow new Error(\n\t\t\t'Workspace configuration detected. Use loadWorkspaceConfig() instead.',\n\t\t);\n\t}\n\n\treturn config;\n}\n\n/**\n * Load configuration file and process it as a workspace.\n * Works with both single-app and workspace configurations.\n *\n * Single-app configs are automatically wrapped as a workspace with one app.\n *\n * @example\n * ```ts\n * const { type, workspace } = await loadWorkspaceConfig();\n *\n * if (type === 'workspace') {\n * console.log('Multi-app workspace:', workspace.apps);\n * } else {\n * console.log('Single app wrapped as workspace');\n * }\n * ```\n */\n/**\n * The workspace a directory belongs to, as its config states it — without\n * discovering its constructs.\n *\n * For callers that need a fact the config holds (where a stage's secrets are\n * stored) and nothing the graph adds. `loadWorkspaceConfig` imports every\n * construct module to derive the apps, which is a cost a secrets read should\n * not pay.\n */\nexport async function loadWorkspaceSettings(\n\tcwd: string = process.cwd(),\n\toptions: LoadConfigOptions = {},\n): Promise<LoadedConfig['workspace']> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd, options);\n\treturn processConfig(config, workspaceRoot).workspace;\n}\n\nexport async function loadWorkspaceConfig(\n\tcwd: string = process.cwd(),\n\toptions: LoadConfigOptions = {},\n): Promise<LoadedConfig> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd, options);\n\treturn withDerivedApps(processConfig(config, workspaceRoot), options.sandbox);\n}\n\n/**\n * The loaded config, with its apps read off the graph.\n *\n * Here rather than at each call site because every command needs the same\n * answer, and the ones that forgot to ask were exactly the bugs: a site that\n * never deployed, a surface that could not be its own process. `gkm dev`,\n * `gkm build`, `gkm docker` and `gkm deploy` now all see the same apps without\n * any of them knowing a derivation happened.\n *\n * Discovery imports the construct modules — declarations only, not endpoints —\n * which is the same import the reconciler and the build already do. A workspace\n * with no `constructs` glob discovers nothing and keeps whatever its config\n * said, so nothing that worked before changes.\n *\n * A construct file that throws is reported and skipped rather than taking the\n * command down: `gkm dev` failing to start because a half-written declaration\n * cannot be imported is a worse failure than starting with the app it does not\n * describe yet.\n */\nasync function withDerivedApps(\n\tloaded: LoadedConfig,\n\tsandbox?: Sandbox,\n): Promise<LoadedConfig> {\n\tconst globs = allConstructGlobs(loaded.workspace);\n\tif (globs.length === 0) {\n\t\tthrow new WorkspaceDeclaresNoConstructs(loaded.workspace.root);\n\t}\n\n\ttry {\n\t\tconst background: Record<string, string[]> = {};\n\t\tconst manifest = await discover({\n\t\t\tpatterns: globs,\n\t\t\tcwd: loaded.workspace.root,\n\t\t\tbackground,\n\t\t\t...(sandbox ? { sandbox } : {}),\n\t\t});\n\n\t\treturn {\n\t\t\t...loaded,\n\t\t\tmanifest,\n\t\t\tbackground,\n\t\t\tworkspace: {\n\t\t\t\t...loaded.workspace,\n\t\t\t\tapps: derivedApps(manifest, loaded.workspace),\n\t\t\t},\n\t\t};\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\toutput.warn(\n\t\t\t`⚠️ Could not read constructs, so apps come from config alone: ${message}`,\n\t\t);\n\t\treturn loaded;\n\t}\n}\n\n/**\n * A workspace with no `constructs` glob.\n *\n * In v10 every address, container and app comes from what the workspace\n * declares — there is no second path that reads a hand-written compose file or\n * an `apps` block's ports. A config that declares nothing has nothing to run.\n */\nexport class WorkspaceDeclaresNoConstructs extends GkmError {\n\tconstructor(readonly root: string) {\n\t\tsuper(\n\t\t\t`The workspace at ${root} declares no constructs. Every workspace names ` +\n\t\t\t\t\"where its constructs live — `constructs: ['./constructs/**/*.ts', \" +\n\t\t\t\t\"'./apps/*/endpoints/**/*.ts']` in gkm.config.ts — and its apps, \" +\n\t\t\t\t'containers and URLs are derived from them.',\n\t\t);\n\t\tthis.name = 'WorkspaceDeclaresNoConstructs';\n\t}\n}\n\nexport interface AppConfigResult {\n\tappName: string;\n\tapp: NormalizedAppConfig;\n\tgkmConfig: GkmConfig;\n\tworkspace: NormalizedWorkspace;\n\tworkspaceRoot: string;\n\tappRoot: string;\n}\n\n/**\n * The app a directory is part of: the one whose `path` contains it.\n *\n * An app's path is the one its construct declares — `new RestApi('Api',\n * { path: 'apps/api' })` — read off the workspace the constructs were derived\n * into, never off the filesystem's package names. The deepest match wins, so\n * an app inside another app's folder is its own; the workspace root belongs to\n * no app unless one lives there.\n */\nfunction resolveWorkspaceApp(\n\tloadedConfig: LoadedConfig,\n\tcwd: string,\n): { key: string; app: NormalizedAppConfig } | undefined {\n\tconst here = real(cwd);\n\tlet found: { key: string; app: NormalizedAppConfig; dir: string } | undefined;\n\n\tfor (const [key, app] of Object.entries(loadedConfig.workspace.apps)) {\n\t\tconst dir = real(join(loadedConfig.workspace.root, app.path));\n\t\tconst inside = here === dir || here.startsWith(`${dir}${sep}`);\n\t\tif (inside && (!found || dir.length > found.dir.length)) {\n\t\t\tfound = { key, app, dir };\n\t\t}\n\t}\n\n\treturn found && { key: found.key, app: found.app };\n}\n\n/** A path with its symlinks resolved, where it exists — `/tmp` is `/private/tmp`. */\nfunction real(path: string): string {\n\tconst absolute = resolve(path);\n\treturn existsSync(absolute) ? realpathSync(absolute) : absolute;\n}\n\n/** A directory that no app in the workspace lives in. */\nexport class NotInAnApp extends GkmError {\n\tconstructor(\n\t\treadonly cwd: string,\n\t\treadonly apps: Readonly<Record<string, string>>,\n\t) {\n\t\tsuper(\n\t\t\t`${cwd} is not inside any app's path. Apps: ` +\n\t\t\t\tObject.entries(apps)\n\t\t\t\t\t.map(([key, path]) => `${key} (${path})`)\n\t\t\t\t\t.join(', ') +\n\t\t\t\t'.',\n\t\t);\n\t\tthis.name = 'NotInAnApp';\n\t}\n}\n\n/** Every app's path, by key — what `NotInAnApp` lists. */\nfunction appPaths(loadedConfig: LoadedConfig): Record<string, string> {\n\treturn Object.fromEntries(\n\t\tObject.entries(loadedConfig.workspace.apps).map(([key, app]) => [\n\t\t\tkey,\n\t\t\tapp.path,\n\t\t]),\n\t);\n}\n\n/**\n * The backend app a directory is part of, with its gkm config — found by the\n * `path` its construct declares.\n *\n * @example\n * ```ts\n * // From apps/api, where a construct declares `path: 'apps/api'`\n * const { app, workspace, workspaceRoot } = await loadAppConfig();\n * ```\n *\n * @throws {NotInAnApp} when no app's path contains the directory.\n * @throws {NotABackendApp} when the app it is in has no gkm config to run.\n */\nexport async function loadAppConfig(\n\tcwd: string = process.cwd(),\n): Promise<AppConfigResult> {\n\tconst { appName, app, workspace, workspaceRoot } =\n\t\tawait loadWorkspaceAppInfo(cwd);\n\n\tconst gkmConfig = getAppGkmConfig(workspace, appName);\n\tif (!gkmConfig) throw new NotABackendApp(appName);\n\n\treturn {\n\t\tappName,\n\t\tapp,\n\t\tgkmConfig,\n\t\tworkspace,\n\t\tworkspaceRoot,\n\t\tappRoot: join(workspaceRoot, app.path),\n\t};\n}\n\n/** The app a directory is in has no gkm config — a site, or an entry app. */\nexport class NotABackendApp extends GkmError {\n\tconstructor(readonly appName: string) {\n\t\tsuper(\n\t\t\t`App \"${appName}\" is not a backend app and cannot be run with gkm dev.`,\n\t\t);\n\t\tthis.name = 'NotABackendApp';\n\t}\n}\n\nexport interface WorkspaceAppInfo {\n\t/** The app's key in the workspace. */\n\tappName: string;\n\tapp: NormalizedAppConfig;\n\tworkspace: NormalizedWorkspace;\n\tworkspaceRoot: string;\n}\n\n/**\n * The app a directory is part of, frontend or backend — found by the `path`\n * its construct declares. Unlike `loadAppConfig`, the app need not have a\n * gkm config, which is what `gkm exec` and `gkm test` from a site need.\n *\n * @throws {NotInAnApp} when no app's path contains the directory.\n */\nexport async function loadWorkspaceAppInfo(\n\tcwd: string = process.cwd(),\n): Promise<WorkspaceAppInfo> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd);\n\tconst loadedConfig = await withDerivedApps(\n\t\tprocessConfig(config, workspaceRoot),\n\t);\n\n\tconst resolved = resolveWorkspaceApp(loadedConfig, cwd);\n\tif (!resolved) throw new NotInAnApp(cwd, appPaths(loadedConfig));\n\n\treturn {\n\t\tappName: resolved.key,\n\t\tapp: resolved.app,\n\t\tworkspace: loadedConfig.workspace,\n\t\tworkspaceRoot,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,gBAAgB,UAA0B;CACzD,OAAO,UAAU,SAAS,QAAQ,WAAW,EAAE,CAAC;AACjD;;;;;;;;;;;;;;ACFA,IAAa,4BAAb,cAA+C,SAAS;CAE7C;CACA;CAFV,YACC,WACA,KACC;EACD,MACC,8BAA8B,UAAU,YAAY,IAAI,0HAGzD;EAPS,KAAA,YAAA;EACA,KAAA,MAAA;EAOT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,qBAAb,cAAwC,SAAS;CAC3B;CAArB,YAAY,OAAmC;EAC9C,MACC,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KAAK,CAAC,KAAK,UAAU,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC,CACxC,KAAK,IAAI,IACX,GACF;EATS,KAAA,MAAA;EACA,KAAA,OAAA;EAST,KAAK,OAAO;CACb;AACD;;AAGA,SAAS,SAAS,cAAoD;CACrE,OAAO,OAAO,YACb,OAAO,QAAQ,aAAa,UAAU,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,SAAS,CAC/D,KACA,IAAI,IACL,CAAC,CACF;AACD;;;;;;;;;;;;;;AAeA,eAAsB,cACrB,MAAc,QAAQ,IAAI,GACC;CAC3B,MAAM,EAAE,SAAS,KAAK,WAAW,kBAChC,MAAM,qBAAqB,GAAG;CAE/B,MAAM,YAAY,gBAAgB,WAAW,OAAO;CACpD,IAAI,CAAC,WAAW,MAAM,IAAI,eAAe,OAAO;CAEhD,OAAO;EACN;EACA;EACA;EACA;EACA;EACA,SAAS,KAAK,eAAe,IAAI,IAAI;CACtC;AACD;;AAGA,IAAa,iBAAb,cAAoC,SAAS;CACvB;CAArB,YAAY,SAA0B;EACrC,MACC,QAAQ,QAAQ,uDACjB;EAHoB,KAAA,UAAA;EAIpB,KAAK,OAAO;CACb;AACD;;;;;;;;AAiBA,eAAsB,qBACrB,MAAc,QAAQ,IAAI,GACE;CAC5B,MAAM,EAAE,QAAQ,kBAAkB,MAAM,cAAc,GAAG;CACzD,MAAM,eAAe,MAAM,gBAC1B,cAAc,QAAQ,aAAa,CACpC;CAEA,MAAM,WAAW,oBAAoB,cAAc,GAAG;CACtD,IAAI,CAAC,UAAU,MAAM,IAAI,WAAW,KAAK,SAAS,YAAY,CAAC;CAE/D,OAAO;EACN,SAAS,SAAS;EAClB,KAAK,SAAS;EACd,WAAW,aAAa;EACxB;CACD;AACD"}
|
package/dist/config.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_workspace = require("./workspace-VhzmoxOv.cjs");
|
|
3
|
-
const require_config = require("./config-
|
|
3
|
+
const require_config = require("./config-CXj-9eRo.cjs");
|
|
4
4
|
exports.CONFIG_LOAD_TIMEOUT_MS = require_config.CONFIG_LOAD_TIMEOUT_MS;
|
|
5
5
|
exports.ConfigLoadFailed = require_config.ConfigLoadFailed;
|
|
6
6
|
exports.ConfigNotFound = require_config.ConfigNotFound;
|
package/dist/config.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { l as defineWorkspace } from "./workspace-D5Vm2qcy.mjs";
|
|
2
|
-
import { _ as withLoadedConfig, a as NotABackendApp, c as defineConfig, d as loadConfig, f as loadRawWorkspaceConfig, g as parseModuleConfig, h as loadWorkspaceSettings, i as ConfigObjectNotSerializable, l as findWorkspaceRoot, m as loadWorkspaceConfig, n as ConfigLoadFailed, o as NotInAnApp, p as loadWorkspaceAppInfo, r as ConfigNotFound, s as WorkspaceDeclaresNoConstructs, t as CONFIG_LOAD_TIMEOUT_MS, u as loadAppConfig } from "./config-
|
|
2
|
+
import { _ as withLoadedConfig, a as NotABackendApp, c as defineConfig, d as loadConfig, f as loadRawWorkspaceConfig, g as parseModuleConfig, h as loadWorkspaceSettings, i as ConfigObjectNotSerializable, l as findWorkspaceRoot, m as loadWorkspaceConfig, n as ConfigLoadFailed, o as NotInAnApp, p as loadWorkspaceAppInfo, r as ConfigNotFound, s as WorkspaceDeclaresNoConstructs, t as CONFIG_LOAD_TIMEOUT_MS, u as loadAppConfig } from "./config-Di0oJwM9.mjs";
|
|
3
3
|
export { CONFIG_LOAD_TIMEOUT_MS, ConfigLoadFailed, ConfigNotFound, ConfigObjectNotSerializable, NotABackendApp, NotInAnApp, WorkspaceDeclaresNoConstructs, defineConfig, defineWorkspace, findWorkspaceRoot, loadAppConfig, loadConfig, loadRawWorkspaceConfig, loadWorkspaceAppInfo, loadWorkspaceConfig, loadWorkspaceSettings, parseModuleConfig, withLoadedConfig };
|
|
@@ -3,7 +3,7 @@ const require_errors = require("./errors-DMC4Umsb.cjs");
|
|
|
3
3
|
const require_workspace = require("./workspace-VhzmoxOv.cjs");
|
|
4
4
|
const require_types = require("./types-Bl_CwZC9.cjs");
|
|
5
5
|
const require_discover = require("./discover-CRywE7yc.cjs");
|
|
6
|
-
const require_resolve = require("./resolve-
|
|
6
|
+
const require_resolve = require("./resolve-BuqA14hD.cjs");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -995,7 +995,7 @@ async function storeFromConfig(workspace, config, options = {}) {
|
|
|
995
995
|
const profile = options.profile ? { profile: options.profile } : {};
|
|
996
996
|
switch (config.provider) {
|
|
997
997
|
case "s3": {
|
|
998
|
-
const { S3SecretsStore } = await Promise.resolve().then(() => require("./s3-
|
|
998
|
+
const { S3SecretsStore } = await Promise.resolve().then(() => require("./s3-C0EBuF8n.cjs"));
|
|
999
999
|
const { deployIdentity } = await Promise.resolve().then(() => identity_exports);
|
|
1000
1000
|
const location = require_workspace.s3SecretsLocation(config, workspace.state);
|
|
1001
1001
|
return new S3SecretsStore({
|
|
@@ -1330,7 +1330,7 @@ async function createDnsProvider(options) {
|
|
|
1330
1330
|
if (isDnsProvider(config.provider)) return config.provider;
|
|
1331
1331
|
const provider = config.provider;
|
|
1332
1332
|
if (provider === "hostinger") {
|
|
1333
|
-
const { HostingerProvider } = await Promise.resolve().then(() => require("./HostingerProvider-
|
|
1333
|
+
const { HostingerProvider } = await Promise.resolve().then(() => require("./HostingerProvider-DQusFkZJ.cjs"));
|
|
1334
1334
|
return new HostingerProvider(options.hostinger);
|
|
1335
1335
|
}
|
|
1336
1336
|
if (provider === "route53") {
|
|
@@ -1343,7 +1343,7 @@ async function createDnsProvider(options) {
|
|
|
1343
1343
|
});
|
|
1344
1344
|
}
|
|
1345
1345
|
if (provider === "godaddy") {
|
|
1346
|
-
const { GoDaddyProvider } = await Promise.resolve().then(() => require("./GoDaddyProvider-
|
|
1346
|
+
const { GoDaddyProvider } = await Promise.resolve().then(() => require("./GoDaddyProvider-DSzYpSc3.cjs"));
|
|
1347
1347
|
return new GoDaddyProvider(options.godaddy ?? {});
|
|
1348
1348
|
}
|
|
1349
1349
|
if (provider === "cloudflare") throw new DnsProviderNotImplemented("cloudflare");
|
|
@@ -2290,4 +2290,4 @@ Object.defineProperty(exports, "withCustomSecret", {
|
|
|
2290
2290
|
}
|
|
2291
2291
|
});
|
|
2292
2292
|
|
|
2293
|
-
//# sourceMappingURL=credentials-
|
|
2293
|
+
//# sourceMappingURL=credentials-Bel6afW2.cjs.map
|