@geekmidas/cli 10.0.0-alpha.140 → 10.0.0-alpha.142
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{EndpointGenerator-BMRL04ic.mjs → EndpointGenerator-CusLH-9S.mjs} +2 -2
- package/dist/{EndpointGenerator-BMRL04ic.mjs.map → EndpointGenerator-CusLH-9S.mjs.map} +1 -1
- package/dist/{EndpointGenerator-ePscnbwB.cjs → EndpointGenerator-DyLMYClE.cjs} +2 -2
- package/dist/{EndpointGenerator-ePscnbwB.cjs.map → EndpointGenerator-DyLMYClE.cjs.map} +1 -1
- package/dist/{GoDaddyProvider-BgY6mqoH.mjs → GoDaddyProvider-BIibcRG4.mjs} +2 -3
- package/dist/{GoDaddyProvider-BgY6mqoH.mjs.map → GoDaddyProvider-BIibcRG4.mjs.map} +1 -1
- package/dist/{GoDaddyProvider-C-rs22Zv.cjs → GoDaddyProvider-C7Zt4dVy.cjs} +5 -6
- package/dist/{GoDaddyProvider-C-rs22Zv.cjs.map → GoDaddyProvider-C7Zt4dVy.cjs.map} +1 -1
- package/dist/{HostingerProvider-DEqpvoiD.cjs → HostingerProvider-BVhFhzCW.cjs} +2 -2
- package/dist/{HostingerProvider-DEqpvoiD.cjs.map → HostingerProvider-BVhFhzCW.cjs.map} +1 -1
- package/dist/{HostingerProvider-CgMuKgO_.mjs → HostingerProvider-DSHpNBim.mjs} +2 -2
- package/dist/{HostingerProvider-CgMuKgO_.mjs.map → HostingerProvider-DSHpNBim.mjs.map} +1 -1
- package/dist/{LegacyStateStore-Dx65SWE9.mjs → LegacyStateStore-Bd2I3zz7.mjs} +3 -3
- package/dist/{LegacyStateStore-Dx65SWE9.mjs.map → LegacyStateStore-Bd2I3zz7.mjs.map} +1 -1
- package/dist/{LegacyStateStore-6xskEtld.cjs → LegacyStateStore-DzRGMFhs.cjs} +3 -3
- package/dist/{LegacyStateStore-6xskEtld.cjs.map → LegacyStateStore-DzRGMFhs.cjs.map} +1 -1
- package/dist/{LocalStateStore-DFtTtHty.cjs → LocalStateStore-Ci_tzIfp.cjs} +2 -2
- package/dist/{LocalStateStore-DFtTtHty.cjs.map → LocalStateStore-Ci_tzIfp.cjs.map} +1 -1
- package/dist/{LocalStateStore-Dto39TCx.mjs → LocalStateStore-CzNrVQd2.mjs} +2 -2
- package/dist/{LocalStateStore-Dto39TCx.mjs.map → LocalStateStore-CzNrVQd2.mjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-B-PQLx8X.mjs → OpenApiTsGenerator-BTMuu1WS.mjs} +2 -2
- package/dist/{OpenApiTsGenerator-B-PQLx8X.mjs.map → OpenApiTsGenerator-BTMuu1WS.mjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-BvacdbiG.cjs → OpenApiTsGenerator-CI-tceXV.cjs} +2 -2
- package/dist/{OpenApiTsGenerator-BvacdbiG.cjs.map → OpenApiTsGenerator-CI-tceXV.cjs.map} +1 -1
- package/dist/{S3StateStore-C01zMOYm.mjs → S3StateStore-DVtcCMEc.mjs} +4 -4
- package/dist/{S3StateStore-C01zMOYm.mjs.map → S3StateStore-DVtcCMEc.mjs.map} +1 -1
- package/dist/{S3StateStore-B-9ea-sX.cjs → S3StateStore-LrKb9lH7.cjs} +5 -5
- package/dist/{S3StateStore-B-9ea-sX.cjs.map → S3StateStore-LrKb9lH7.cjs.map} +1 -1
- package/dist/{SSMStateStore-k-4XM7mb.mjs → SSMStateStore-CNHYH6g7.mjs} +2 -2
- package/dist/{SSMStateStore-k-4XM7mb.mjs.map → SSMStateStore-CNHYH6g7.mjs.map} +1 -1
- package/dist/{SSMStateStore-CKArcPUh.cjs → SSMStateStore-CpkvL95K.cjs} +2 -2
- package/dist/{SSMStateStore-CKArcPUh.cjs.map → SSMStateStore-CpkvL95K.cjs.map} +1 -1
- package/dist/{SubscriberGenerator-DR4Y7ihK.cjs → SubscriberGenerator-BNJyPmXJ.cjs} +3 -3
- package/dist/{SubscriberGenerator-DR4Y7ihK.cjs.map → SubscriberGenerator-BNJyPmXJ.cjs.map} +1 -1
- package/dist/{SubscriberGenerator-DLPH-ynS.mjs → SubscriberGenerator-CzPrixYu.mjs} +3 -3
- package/dist/{SubscriberGenerator-DLPH-ynS.mjs.map → SubscriberGenerator-CzPrixYu.mjs.map} +1 -1
- package/dist/{add-BgzsYxUq.cjs → add-AlV6_ljM.cjs} +18 -17
- package/dist/{add-BgzsYxUq.cjs.map → add-AlV6_ljM.cjs.map} +1 -1
- package/dist/{add-CiIrpOb9.mjs → add-B51nMuUd.mjs} +8 -7
- package/dist/{add-CiIrpOb9.mjs.map → add-B51nMuUd.mjs.map} +1 -1
- package/dist/apps-C1KiJqth.mjs +4593 -0
- package/dist/apps-C1KiJqth.mjs.map +1 -0
- package/dist/apps-CPdR2pYw.cjs +5002 -0
- package/dist/apps-CPdR2pYw.cjs.map +1 -0
- package/dist/{bundler-DKxuDoVL.cjs → bundler-B-hw8rJi.cjs} +33 -9
- package/dist/bundler-B-hw8rJi.cjs.map +1 -0
- package/dist/{bundler-C4uMSy8e.mjs → bundler-DbIt3a6I.mjs} +34 -10
- package/dist/bundler-DbIt3a6I.mjs.map +1 -0
- package/dist/{cli-na0npMhC.cjs → cli-6eYxU_Q2.cjs} +4 -4
- package/dist/{cli-na0npMhC.cjs.map → cli-6eYxU_Q2.cjs.map} +1 -1
- package/dist/{cli-Bm2is6R_.mjs → cli-CmmrPCM_.mjs} +4 -4
- package/dist/{cli-Bm2is6R_.mjs.map → cli-CmmrPCM_.mjs.map} +1 -1
- package/dist/compose-B2dCLbrc.cjs +1895 -0
- package/dist/compose-B2dCLbrc.cjs.map +1 -0
- package/dist/{compose-CVatM7Cl.mjs → compose-DVARqEeR.mjs} +16 -1830
- package/dist/compose-DVARqEeR.mjs.map +1 -0
- package/dist/{compose-D8U9ygdm.cjs → compose-D_fNsrkx.cjs} +101 -1969
- package/dist/compose-D_fNsrkx.cjs.map +1 -0
- package/dist/compose-kOpW9Pa1.mjs +1554 -0
- package/dist/compose-kOpW9Pa1.mjs.map +1 -0
- package/dist/config-BKpzKP6W.mjs +659 -0
- package/dist/config-BKpzKP6W.mjs.map +1 -0
- package/dist/config-QAqAEgb0.cjs +772 -0
- package/dist/config-QAqAEgb0.cjs.map +1 -0
- package/dist/config.cjs +16 -419
- package/dist/config.mjs +2 -405
- package/dist/{credentialSchemas-DZ2Nh5li.cjs → credentialSchemas-BAklWDna.cjs} +4 -5
- package/dist/{credentialSchemas-DZ2Nh5li.cjs.map → credentialSchemas-BAklWDna.cjs.map} +1 -1
- package/dist/{credentialSchemas-DUCSYl9a.mjs → credentialSchemas-mz9QZTYh.mjs} +2 -3
- package/dist/{credentialSchemas-DUCSYl9a.mjs.map → credentialSchemas-mz9QZTYh.mjs.map} +1 -1
- package/dist/credentials-CIpa4Hgs.cjs +2336 -0
- package/dist/credentials-CIpa4Hgs.cjs.map +1 -0
- package/dist/credentials-CWa7hRXd.mjs +1851 -0
- package/dist/credentials-CWa7hRXd.mjs.map +1 -0
- package/dist/{databases-P824RTnx.cjs → databases-DawSdqBI.cjs} +2 -2
- package/dist/{databases-P824RTnx.cjs.map → databases-DawSdqBI.cjs.map} +1 -1
- package/dist/{databases-Db48ZIXL.mjs → databases-mzSUFBTw.mjs} +2 -2
- package/dist/{databases-Db48ZIXL.mjs.map → databases-mzSUFBTw.mjs.map} +1 -1
- package/dist/deploy/public.cjs +24 -24
- package/dist/deploy/public.cjs.map +1 -1
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +13 -13
- package/dist/{deploy-DrQB7ytj.cjs → deploy-CjJ447kd.cjs} +73 -72
- package/dist/{deploy-DrQB7ytj.cjs.map → deploy-CjJ447kd.cjs.map} +1 -1
- package/dist/{deploy-CDcO08Xz.mjs → deploy-DqJiCwI9.mjs} +16 -15
- package/dist/{deploy-CDcO08Xz.mjs.map → deploy-DqJiCwI9.mjs.map} +1 -1
- package/dist/{discover-yqeJ2Bx7.cjs → discover-CRywE7yc.cjs} +157 -6
- package/dist/discover-CRywE7yc.cjs.map +1 -0
- package/dist/{discover-B2m8ytyq.mjs → discover-DbDrCQ8h.mjs} +117 -8
- package/dist/discover-DbDrCQ8h.mjs.map +1 -0
- package/dist/docker-CCzFCus7.mjs +1407 -0
- package/dist/docker-CCzFCus7.mjs.map +1 -0
- package/dist/docker-DK4rmb0u.cjs +1514 -0
- package/dist/docker-DK4rmb0u.cjs.map +1 -0
- package/dist/{dokploy-k4_ZN8zN.mjs → dokploy-B5_Y5wf0.mjs} +2 -2
- package/dist/{dokploy-k4_ZN8zN.mjs.map → dokploy-B5_Y5wf0.mjs.map} +1 -1
- package/dist/{dokploy-BKjPDvSN.cjs → dokploy-EJKX2T7M.cjs} +2 -2
- package/dist/{dokploy-BKjPDvSN.cjs.map → dokploy-EJKX2T7M.cjs.map} +1 -1
- package/dist/{drivers-C47nm-wB.cjs → drivers-aM87NQJi.cjs} +4 -91
- package/dist/drivers-aM87NQJi.cjs.map +1 -0
- package/dist/{drivers-CDjpjakg.mjs → drivers-uxLBq3e3.mjs} +3 -60
- package/dist/drivers-uxLBq3e3.mjs.map +1 -0
- package/dist/{eas-Bg4dI6n2.cjs → eas-AqSay-vE.cjs} +6 -6
- package/dist/{eas-Bg4dI6n2.cjs.map → eas-AqSay-vE.cjs.map} +1 -1
- package/dist/{eas-B1wBvwPH.mjs → eas-BQlD6Z-u.mjs} +3 -3
- package/dist/{eas-B1wBvwPH.mjs.map → eas-BQlD6Z-u.mjs.map} +1 -1
- package/dist/{encryption-DL_y8t6V.cjs → encryption-B6_aL5d-.cjs} +6 -6
- package/dist/{encryption-DL_y8t6V.cjs.map → encryption-B6_aL5d-.cjs.map} +1 -1
- package/dist/{encryption-Bve0PVOo.mjs → encryption-Dlh5mcE1.mjs} +3 -3
- package/dist/{encryption-Bve0PVOo.mjs.map → encryption-Dlh5mcE1.mjs.map} +1 -1
- package/dist/{engine-BhR5lt_V.cjs → engine-BAkmPI2z.cjs} +99 -97
- package/dist/{engine-BhR5lt_V.cjs.map → engine-BAkmPI2z.cjs.map} +1 -1
- package/dist/{engine-HMLf20iZ.mjs → engine-D3P2P6RK.mjs} +12 -10
- package/dist/{engine-HMLf20iZ.mjs.map → engine-D3P2P6RK.mjs.map} +1 -1
- package/dist/{github-B2hJVl-n.cjs → github-DokGIXT-.cjs} +18 -17
- package/dist/{github-B2hJVl-n.cjs.map → github-DokGIXT-.cjs.map} +1 -1
- package/dist/{github-DKn9ACi2.mjs → github-STWxD6cu.mjs} +9 -8
- package/dist/{github-DKn9ACi2.mjs.map → github-STWxD6cu.mjs.map} +1 -1
- package/dist/{googlePlay-DtuN0-7D.cjs → googlePlay-DL0htRJD.cjs} +5 -5
- package/dist/{googlePlay-DtuN0-7D.cjs.map → googlePlay-DL0htRJD.cjs.map} +1 -1
- package/dist/{googlePlay-CWq7ND_X.mjs → googlePlay-uAyXzxlu.mjs} +5 -5
- package/dist/{googlePlay-CWq7ND_X.mjs.map → googlePlay-uAyXzxlu.mjs.map} +1 -1
- package/dist/index.cjs +196 -192
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +70 -66
- package/dist/index.mjs.map +1 -1
- package/dist/{local-OPC9BCZt.cjs → local-C6ndR_Wx.cjs} +6 -6
- package/dist/{local-OPC9BCZt.cjs.map → local-C6ndR_Wx.cjs.map} +1 -1
- package/dist/{local-B7Zv1NoA.mjs → local-CC7rdmgg.mjs} +3 -3
- package/dist/{local-B7Zv1NoA.mjs.map → local-CC7rdmgg.mjs.map} +1 -1
- package/dist/{migrate-BLVZqHtN.cjs → migrate-BbJUJ4CY.cjs} +6 -6
- package/dist/{migrate-BLVZqHtN.cjs.map → migrate-BbJUJ4CY.cjs.map} +1 -1
- package/dist/{migrate-iUui7B4q.cjs → migrate-CMurhHuj.cjs} +15 -13
- package/dist/{migrate-iUui7B4q.cjs.map → migrate-CMurhHuj.cjs.map} +1 -1
- package/dist/{migrate-W0ruUNb9.mjs → migrate-D079sADO.mjs} +3 -3
- package/dist/{migrate-W0ruUNb9.mjs.map → migrate-D079sADO.mjs.map} +1 -1
- package/dist/{migrate-DCvD4RJW.mjs → migrate-D27h4H79.mjs} +7 -5
- package/dist/{migrate-DCvD4RJW.mjs.map → migrate-D27h4H79.mjs.map} +1 -1
- package/dist/notes-B655tUny.cjs +500 -0
- package/dist/notes-B655tUny.cjs.map +1 -0
- package/dist/notes-wPJlNUj7.mjs +399 -0
- package/dist/notes-wPJlNUj7.mjs.map +1 -0
- package/dist/openapi.cjs +4 -5
- package/dist/openapi.cjs.map +1 -1
- package/dist/openapi.mjs +3 -4
- package/dist/openapi.mjs.map +1 -1
- package/dist/{projectBucket-BBbQ1lHF.cjs → projectBucket-Bs8ftcgB.cjs} +2 -2
- package/dist/{projectBucket-BBbQ1lHF.cjs.map → projectBucket-Bs8ftcgB.cjs.map} +1 -1
- package/dist/{projectBucket-C_DN4WzF.mjs → projectBucket-XVxyvW1y.mjs} +2 -2
- package/dist/{projectBucket-C_DN4WzF.mjs.map → projectBucket-XVxyvW1y.mjs.map} +1 -1
- package/dist/{publish-CxIBBD3b.mjs → publish-B9BNIaf2.mjs} +2 -2
- package/dist/{publish-CxIBBD3b.mjs.map → publish-B9BNIaf2.mjs.map} +1 -1
- package/dist/{publish-CqvDA5ry.cjs → publish-Bwgb-1JN.cjs} +2 -2
- package/dist/{publish-CqvDA5ry.cjs.map → publish-Bwgb-1JN.cjs.map} +1 -1
- package/dist/{ready-DuU0FXSj.cjs → ready-BNh3zsSn.cjs} +6 -6
- package/dist/{ready-DuU0FXSj.cjs.map → ready-BNh3zsSn.cjs.map} +1 -1
- package/dist/{ready-CGqJ74Kt.mjs → ready-g25dcGzK.mjs} +6 -6
- package/dist/{ready-CGqJ74Kt.mjs.map → ready-g25dcGzK.mjs.map} +1 -1
- package/dist/reconcile/public.cjs +1 -1
- package/dist/reconcile/public.mjs +1 -1
- package/dist/{resolve-CMC0MI0Z.mjs → resolve-DheFxtmy.mjs} +4 -4
- package/dist/{resolve-CMC0MI0Z.mjs.map → resolve-DheFxtmy.mjs.map} +1 -1
- package/dist/{resolve-BEVVvi13.cjs → resolve-Dir9EjMu.cjs} +4 -4
- package/dist/{resolve-BEVVvi13.cjs.map → resolve-Dir9EjMu.cjs.map} +1 -1
- package/dist/{rollback-CZiQkukY.mjs → rollback-BWAB77F9.mjs} +8 -8
- package/dist/{rollback-CZiQkukY.mjs.map → rollback-BWAB77F9.mjs.map} +1 -1
- package/dist/{rollback-e0zGkaBx.cjs → rollback-CrtuUKqe.cjs} +11 -11
- package/dist/{rollback-e0zGkaBx.cjs.map → rollback-CrtuUKqe.cjs.map} +1 -1
- package/dist/{s3-BKnL6YGQ.cjs → s3-DKJfDHUQ.cjs} +2 -2
- package/dist/{s3-BKnL6YGQ.cjs.map → s3-DKJfDHUQ.cjs.map} +1 -1
- package/dist/{s3-DW7SLsb8.mjs → s3-DNp8U0Ea.mjs} +2 -2
- package/dist/{s3-DW7SLsb8.mjs.map → s3-DNp8U0Ea.mjs.map} +1 -1
- package/dist/sandbox/credentials-worker.cjs +3 -4
- package/dist/sandbox/credentials-worker.cjs.map +1 -1
- package/dist/sandbox/credentials-worker.mjs +2 -3
- package/dist/sandbox/credentials-worker.mjs.map +1 -1
- package/dist/sandbox/discover-worker.cjs +1 -1
- package/dist/sandbox/discover-worker.mjs +1 -1
- package/dist/sandbox/migrate-worker.cjs +3 -4
- package/dist/sandbox/migrate-worker.cjs.map +1 -1
- package/dist/sandbox/migrate-worker.mjs +2 -3
- package/dist/sandbox/migrate-worker.mjs.map +1 -1
- package/dist/seeds-B3xvUAQf.cjs +363 -0
- package/dist/seeds-B3xvUAQf.cjs.map +1 -0
- package/dist/seeds-BCC8vAXR.mjs +298 -0
- package/dist/seeds-BCC8vAXR.mjs.map +1 -0
- package/dist/{serverSetup-D2Xzsp2t.cjs → serverSetup-BVL9HhNE.cjs} +9 -8
- package/dist/{serverSetup-D2Xzsp2t.cjs.map → serverSetup-BVL9HhNE.cjs.map} +1 -1
- package/dist/{serverSetup-C3Tt9X1R.mjs → serverSetup-D---hcyW.mjs} +7 -6
- package/dist/{serverSetup-C3Tt9X1R.mjs.map → serverSetup-D---hcyW.mjs.map} +1 -1
- package/dist/{sniffer-BWgXPFAt.cjs → sniffer-BjHnOaCe.cjs} +9 -10
- package/dist/{sniffer-BWgXPFAt.cjs.map → sniffer-BjHnOaCe.cjs.map} +1 -1
- package/dist/{sniffer-eEF_fIId.mjs → sniffer-DOyzfgPF.mjs} +8 -9
- package/dist/{sniffer-eEF_fIId.mjs.map → sniffer-DOyzfgPF.mjs.map} +1 -1
- package/dist/{snsSubscriptions-BSoqUgsq.mjs → snsSubscriptions-Cf5DZfO5.mjs} +4 -453
- package/dist/snsSubscriptions-Cf5DZfO5.mjs.map +1 -0
- package/dist/{snsSubscriptions-Y9declDd.cjs → snsSubscriptions-DB0iRByH.cjs} +12 -559
- package/dist/snsSubscriptions-DB0iRByH.cjs.map +1 -0
- package/dist/{sst-Bz2HJlqc.mjs → sst-3V-rcKcw.mjs} +27 -5
- package/dist/sst-3V-rcKcw.mjs.map +1 -0
- package/dist/{sst-lvCHdYsY.cjs → sst-DuU7Ju0c.cjs} +29 -7
- package/dist/sst-DuU7Ju0c.cjs.map +1 -0
- package/dist/stack-BRKZ69bf.mjs +2307 -0
- package/dist/stack-BRKZ69bf.mjs.map +1 -0
- package/dist/stack-CmHjkg7D.cjs +2536 -0
- package/dist/stack-CmHjkg7D.cjs.map +1 -0
- package/dist/{stage-DhcbcAar.mjs → stage-CTq3Gjsx.mjs} +7 -7
- package/dist/{stage-DhcbcAar.mjs.map → stage-CTq3Gjsx.mjs.map} +1 -1
- package/dist/{stage-BEcxppsu.cjs → stage-s_8HOsH0.cjs} +13 -13
- package/dist/{stage-BEcxppsu.cjs.map → stage-s_8HOsH0.cjs.map} +1 -1
- package/dist/{stages--icWbhPy.cjs → stages-CFI0OiLj.cjs} +2 -2
- package/dist/{stages--icWbhPy.cjs.map → stages-CFI0OiLj.cjs.map} +1 -1
- package/dist/{stages-CUwSy39f.mjs → stages-DoYa81kN.mjs} +2 -2
- package/dist/{stages-CUwSy39f.mjs.map → stages-DoYa81kN.mjs.map} +1 -1
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.mjs +1 -1
- package/dist/{terminal-DURcYlVX.cjs → terminal-ChxtuTYJ.cjs} +3 -3
- package/dist/{terminal-DURcYlVX.cjs.map → terminal-ChxtuTYJ.cjs.map} +1 -1
- package/dist/{terminal-yOZ7kKF9.mjs → terminal-oHKnZHkT.mjs} +3 -3
- package/dist/{terminal-yOZ7kKF9.mjs.map → terminal-oHKnZHkT.mjs.map} +1 -1
- package/dist/types-Bl_CwZC9.cjs +90 -0
- package/dist/types-Bl_CwZC9.cjs.map +1 -0
- package/dist/types-Y1NfWlyG.mjs +61 -0
- package/dist/types-Y1NfWlyG.mjs.map +1 -0
- package/dist/vitest.cjs +1 -1
- package/dist/vitest.mjs +1 -1
- package/package.json +15 -15
- package/dist/bundler-C4uMSy8e.mjs.map +0 -1
- package/dist/bundler-DKxuDoVL.cjs.map +0 -1
- package/dist/compose-CVatM7Cl.mjs.map +0 -1
- package/dist/compose-D8U9ygdm.cjs.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/config.mjs.map +0 -1
- package/dist/credentials-D7XJypNd.cjs +0 -520
- package/dist/credentials-D7XJypNd.cjs.map +0 -1
- package/dist/credentials-DpfnUvIR.mjs +0 -395
- package/dist/credentials-DpfnUvIR.mjs.map +0 -1
- package/dist/derive-Cd7Hl3r2.mjs +0 -259
- package/dist/derive-Cd7Hl3r2.mjs.map +0 -1
- package/dist/derive-CgZfoBU2.cjs +0 -282
- package/dist/derive-CgZfoBU2.cjs.map +0 -1
- package/dist/discover-B2m8ytyq.mjs.map +0 -1
- package/dist/discover-yqeJ2Bx7.cjs.map +0 -1
- package/dist/drivers-C47nm-wB.cjs.map +0 -1
- package/dist/drivers-CDjpjakg.mjs.map +0 -1
- package/dist/identity-CBXr4wNi.mjs +0 -129
- package/dist/identity-CBXr4wNi.mjs.map +0 -1
- package/dist/identity-CbLfgQNT.cjs +0 -182
- package/dist/identity-CbLfgQNT.cjs.map +0 -1
- package/dist/sandbox-CHv3OYXg.cjs +0 -165
- package/dist/sandbox-CHv3OYXg.cjs.map +0 -1
- package/dist/sandbox-CbVB7uOD.mjs +0 -118
- package/dist/sandbox-CbVB7uOD.mjs.map +0 -1
- package/dist/seeds-BR_7hJTw.cjs +0 -10541
- package/dist/seeds-BR_7hJTw.cjs.map +0 -1
- package/dist/seeds-nCxxlP5h.mjs +0 -9418
- package/dist/seeds-nCxxlP5h.mjs.map +0 -1
- package/dist/snsSubscriptions-BSoqUgsq.mjs.map +0 -1
- package/dist/snsSubscriptions-Y9declDd.cjs.map +0 -1
- package/dist/sst-Bz2HJlqc.mjs.map +0 -1
- package/dist/sst-lvCHdYsY.cjs.map +0 -1
package/dist/derive-Cd7Hl3r2.mjs
DELETED
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
|
|
2
|
-
import { WILDCARD_SUBDOMAIN, dependenciesOf, isWildcardSite, kebabCase } from "@geekmidas/manifest";
|
|
3
|
-
//#region src/workspace/subdomains.ts
|
|
4
|
-
/**
|
|
5
|
-
* The subdomains of a stage's domain, as a wildcard site sees them.
|
|
6
|
-
*
|
|
7
|
-
* A site declared `subdomain: '*'` answers on every label nothing else does,
|
|
8
|
-
* so the labels something else does answer on are the ones a tenant can never
|
|
9
|
-
* take. They come from two places and from nowhere else: every app's own
|
|
10
|
-
* label, read off the constructs and never listed by hand, and the names no
|
|
11
|
-
* construct declares (`www`, `mail`, `status`), listed once in the workspace
|
|
12
|
-
* config as `protectedSubdomains`.
|
|
13
|
-
*/
|
|
14
|
-
/** A `protectedSubdomains` entry an app already answers on. */
|
|
15
|
-
var ProtectedSubdomainIsAnApp = class extends GkmError {
|
|
16
|
-
subdomain;
|
|
17
|
-
app;
|
|
18
|
-
constructor(subdomain, app) {
|
|
19
|
-
super(`protectedSubdomains lists '${subdomain}', which '${app}' already answers on — a construct's own subdomain is protected without being listed. Remove it from protectedSubdomains.`);
|
|
20
|
-
this.subdomain = subdomain;
|
|
21
|
-
this.app = app;
|
|
22
|
-
this.name = "ProtectedSubdomainIsAnApp";
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
/** Two sites that both answer on every subdomain. */
|
|
26
|
-
var SecondWildcardSite = class extends GkmError {
|
|
27
|
-
sites;
|
|
28
|
-
constructor(sites) {
|
|
29
|
-
super(`${sites.join(" and ")} both declare subdomain: '*', and two sites cannot share the same hosts. Keep one wildcard site per project; give the other a subdomain of its own.`);
|
|
30
|
-
this.sites = sites;
|
|
31
|
-
this.name = "SecondWildcardSite";
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
/** A wildcard site whose `hosts` route is on no surface the project declares. */
|
|
35
|
-
var SiteHostsEndpointMissing = class extends GkmError {
|
|
36
|
-
site;
|
|
37
|
-
surface;
|
|
38
|
-
path;
|
|
39
|
-
constructor(site, surface, path) {
|
|
40
|
-
super(`'${site}' checks its hosts with GET ${path} on '${surface}', but '${surface}' serves no such route. Export the endpoint from the surface's endpoints, or point \`hosts\` at one it serves.`);
|
|
41
|
-
this.site = site;
|
|
42
|
-
this.surface = surface;
|
|
43
|
-
this.path = path;
|
|
44
|
-
this.name = "SiteHostsEndpointMissing";
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
/** The project's one wildcard site, or `undefined` when it has none. */
|
|
48
|
-
function wildcardSite(manifest) {
|
|
49
|
-
return Object.values(manifest).find(isWildcardSite);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Every label an app answers on, by the app it belongs to — what a deploy
|
|
53
|
-
* puts under the stage's domain: a surface's or site's `subdomain` (or its id
|
|
54
|
-
* kebab-cased), each file server and its processors' origin, and each worker,
|
|
55
|
-
* which SNS may push to on a host of its own.
|
|
56
|
-
*
|
|
57
|
-
* The root site's is kept although it answers on the domain itself: which
|
|
58
|
-
* site is the root can change without a tenant's slug changing meaning. The
|
|
59
|
-
* wildcard site has none — its labels are whatever is left.
|
|
60
|
-
*/
|
|
61
|
-
function appSubdomains(manifest) {
|
|
62
|
-
const labels = /* @__PURE__ */ new Map();
|
|
63
|
-
for (const [id, declaration] of Object.entries(manifest)) switch (declaration.kind) {
|
|
64
|
-
case "rest-api":
|
|
65
|
-
case "websocket-api":
|
|
66
|
-
labels.set(declaration.subdomain ?? kebabCase(id), id);
|
|
67
|
-
break;
|
|
68
|
-
case "site":
|
|
69
|
-
if (declaration.subdomain === WILDCARD_SUBDOMAIN) break;
|
|
70
|
-
labels.set(declaration.subdomain ?? kebabCase(id), id);
|
|
71
|
-
break;
|
|
72
|
-
case "file-server":
|
|
73
|
-
labels.set(kebabCase(id), id);
|
|
74
|
-
if (declaration.processors?.length) labels.set(`${kebabCase(id)}-processors`, id);
|
|
75
|
-
break;
|
|
76
|
-
case "worker": labels.set(kebabCase(id), id);
|
|
77
|
-
}
|
|
78
|
-
return labels;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* The labels no tenant may take: every app's own and the workspace's
|
|
82
|
-
* `protectedSubdomains`, sorted.
|
|
83
|
-
*/
|
|
84
|
-
function protectedSubdomains(manifest, configured = []) {
|
|
85
|
-
return [.../* @__PURE__ */ new Set([...appSubdomains(manifest).keys(), ...configured])].sort();
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* What a project's subdomains have to satisfy before anything is derived
|
|
89
|
-
* from them.
|
|
90
|
-
*
|
|
91
|
-
* @throws {SecondWildcardSite} when two sites declare `subdomain: '*'`
|
|
92
|
-
* @throws {SiteHostsEndpointMissing} when the wildcard site's `hosts` route is not served
|
|
93
|
-
* @throws {ProtectedSubdomainIsAnApp} when `protectedSubdomains` repeats an app's own
|
|
94
|
-
*/
|
|
95
|
-
function assertSubdomains(manifest, configured = []) {
|
|
96
|
-
const wildcards = Object.values(manifest).filter(isWildcardSite);
|
|
97
|
-
if (wildcards.length > 1) throw new SecondWildcardSite(wildcards.map((site) => site.id).sort());
|
|
98
|
-
const site = wildcards[0];
|
|
99
|
-
if (site?.hosts) {
|
|
100
|
-
const surface = manifest[site.hosts.surface];
|
|
101
|
-
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);
|
|
102
|
-
}
|
|
103
|
-
const labels = appSubdomains(manifest);
|
|
104
|
-
for (const subdomain of configured) {
|
|
105
|
-
const app = labels.get(subdomain);
|
|
106
|
-
if (app) throw new ProtectedSubdomainIsAnApp(subdomain, app);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region src/workspace/derive.ts
|
|
111
|
-
/**
|
|
112
|
-
* The apps a manifest implies.
|
|
113
|
-
*
|
|
114
|
-
* `gkm.config.ts` used to carry an `apps` block naming every app: its type, its
|
|
115
|
-
* path, its port, its framework, which other apps it depended on. Every one of
|
|
116
|
-
* those facts was already declared. A `StaticSite('Web', { path: 'apps/web' })`
|
|
117
|
-
* and an `apps.web = { type: 'web', path: 'apps/web', framework: 'vite',
|
|
118
|
-
* dependencies: ['api'] }` are the same statement written twice, and only one of
|
|
119
|
-
* them was checked against anything — so the copy in config was free to drift,
|
|
120
|
-
* and a surface config had no entry for simply never deployed.
|
|
121
|
-
*
|
|
122
|
-
* So the list comes from the graph. A `site` is an app, and so is every
|
|
123
|
-
* `rest-api` — one surface, one container, at the `path` it declared.
|
|
124
|
-
*
|
|
125
|
-
* What config still supplies is what no graph can answer: the backends a cache
|
|
126
|
-
* and a mailer resolve to, the deploy endpoint, the stage's domain.
|
|
127
|
-
*/
|
|
128
|
-
/** Which frontend framework builds each site variant. */
|
|
129
|
-
const FRAMEWORKS = {
|
|
130
|
-
static: "vite",
|
|
131
|
-
next: "nextjs",
|
|
132
|
-
tanstack: "tanstack-start"
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* The app key a construct id becomes.
|
|
136
|
-
*
|
|
137
|
-
* The same kebab form every physical name is built from, so `Api` is `api` in
|
|
138
|
-
* the config, `production-kitchen-sink-api` on Dokploy, and `API_URL` in an
|
|
139
|
-
* environment — one id, three renderings, no second list.
|
|
140
|
-
*/
|
|
141
|
-
function appKey(id) {
|
|
142
|
-
return kebabCase(id);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* The app serving a surface: its own, always.
|
|
146
|
-
*
|
|
147
|
-
* Every surface gets a container. There is no arrangement in which one runs
|
|
148
|
-
* inside another — two surfaces in a process share a filesystem, an
|
|
149
|
-
* environment, and every credential either was granted, so an auth server
|
|
150
|
-
* beside an API is one bug in the API away from being read by it.
|
|
151
|
-
*/
|
|
152
|
-
function hostOf(manifest, id) {
|
|
153
|
-
const declaration = manifest[id];
|
|
154
|
-
if (!declaration || declaration.kind !== "rest-api" && declaration.kind !== "websocket-api") return void 0;
|
|
155
|
-
return id;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Local ports, assigned so that adding a site does not renumber the others.
|
|
159
|
-
*
|
|
160
|
-
* Backends first, then the site holding the base domain, then the rest
|
|
161
|
-
* alphabetically. The ordering is arbitrary but it is *fixed*, which is the
|
|
162
|
-
* property that matters: a port that moves when an unrelated app is added is a
|
|
163
|
-
* port nobody can put in a bookmark. A construct that names its own port keeps
|
|
164
|
-
* it, and is skipped here.
|
|
165
|
-
*/
|
|
166
|
-
function assignPorts(apps) {
|
|
167
|
-
const rank = (name, app) => [
|
|
168
|
-
app.type === "backend" ? 0 : app.type === "web" ? 1 : 2,
|
|
169
|
-
app.root ? 0 : 1,
|
|
170
|
-
name
|
|
171
|
-
];
|
|
172
|
-
const ordered = Object.entries(apps).sort(([aName, a], [bName, b]) => {
|
|
173
|
-
const [at, ar, an] = rank(aName, a);
|
|
174
|
-
const [bt, br, bn] = rank(bName, b);
|
|
175
|
-
return at - bt || ar - br || an.localeCompare(bn);
|
|
176
|
-
});
|
|
177
|
-
const taken = new Set(ordered.map(([, app]) => app.port).filter((p) => !!p));
|
|
178
|
-
let next = 3e3;
|
|
179
|
-
for (const [, app] of ordered) {
|
|
180
|
-
if (app.port) continue;
|
|
181
|
-
while (taken.has(next)) next += 1;
|
|
182
|
-
app.port = next;
|
|
183
|
-
taken.add(next);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Whichever site holds the base domain.
|
|
188
|
-
*
|
|
189
|
-
* The convention first — a site named `web` — because it is one people already
|
|
190
|
-
* rely on. Then an explicit `root: true`. A project with one site needs neither.
|
|
191
|
-
*/
|
|
192
|
-
function markRoot(apps) {
|
|
193
|
-
const sites = Object.entries(apps).filter(([, a]) => a.type === "web" && a.subdomain !== WILDCARD_SUBDOMAIN);
|
|
194
|
-
if (sites.length === 0) return;
|
|
195
|
-
if (sites.some(([, a]) => a.root)) return;
|
|
196
|
-
const chosen = sites.find(([name]) => name === "web") ?? (sites.length === 1 ? sites[0] : void 0);
|
|
197
|
-
if (chosen) chosen[1].root = true;
|
|
198
|
-
}
|
|
199
|
-
function derivedApps(manifest, workspace) {
|
|
200
|
-
assertSubdomains(manifest, workspace.protectedSubdomains);
|
|
201
|
-
const apps = {};
|
|
202
|
-
const defaultTarget = workspace.deploy?.default ?? "dokploy";
|
|
203
|
-
for (const [id, declaration] of Object.entries(manifest)) {
|
|
204
|
-
if (declaration.kind !== "site" && declaration.kind !== "mobile-app" && declaration.kind !== "rest-api" && declaration.kind !== "websocket-api") continue;
|
|
205
|
-
const spec = declaration.kind === "site" || declaration.kind === "mobile-app" ? declaration.app : {
|
|
206
|
-
path: declaration.path,
|
|
207
|
-
...declaration.kind === "rest-api" && declaration.telescope ? { telescope: true } : {}
|
|
208
|
-
};
|
|
209
|
-
const name = appKey(id);
|
|
210
|
-
const configured = workspace.apps[name];
|
|
211
|
-
apps[name] = {
|
|
212
|
-
...configured,
|
|
213
|
-
type: declaration.kind === "site" ? "web" : declaration.kind === "mobile-app" ? "mobile" : "backend",
|
|
214
|
-
path: spec.path,
|
|
215
|
-
port: spec.port ?? configured?.port ?? 0,
|
|
216
|
-
...(declaration.kind === "rest-api" || declaration.kind === "websocket-api" || declaration.kind === "site") && declaration.subdomain ? { subdomain: declaration.subdomain } : {},
|
|
217
|
-
dependencies: [],
|
|
218
|
-
resolvedDeployTarget: configured?.resolvedDeployTarget ?? defaultTarget,
|
|
219
|
-
...declaration.kind === "site" ? {
|
|
220
|
-
framework: configured?.framework ?? FRAMEWORKS[declaration.variant],
|
|
221
|
-
...declaration.root ? { root: true } : {},
|
|
222
|
-
...spec.config ? { config: spec.config } : {}
|
|
223
|
-
} : {},
|
|
224
|
-
...declaration.kind === "mobile-app" ? {
|
|
225
|
-
framework: configured?.framework ?? declaration.variant,
|
|
226
|
-
...spec.config ? { config: spec.config } : {}
|
|
227
|
-
} : {},
|
|
228
|
-
...spec.telescope !== void 0 ? { telescope: spec.telescope } : {},
|
|
229
|
-
...spec.openapi !== void 0 ? { openapi: spec.openapi } : {},
|
|
230
|
-
...spec.runtime !== void 0 ? { runtime: spec.runtime } : {},
|
|
231
|
-
...spec.env !== void 0 ? { env: spec.env } : {},
|
|
232
|
-
...spec.entry !== void 0 ? { entry: spec.entry } : {},
|
|
233
|
-
...configured?.domain ? { domain: configured.domain } : {}
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
for (const [id, declaration] of Object.entries(manifest)) {
|
|
237
|
-
if (declaration.kind !== "site" && declaration.kind !== "mobile-app" && declaration.kind !== "rest-api" && declaration.kind !== "websocket-api") continue;
|
|
238
|
-
const app = apps[appKey(id)];
|
|
239
|
-
if (!app) continue;
|
|
240
|
-
const edges = dependenciesOf(declaration);
|
|
241
|
-
const names = /* @__PURE__ */ new Set();
|
|
242
|
-
for (const edge of edges) {
|
|
243
|
-
if (edge.kind !== "rest-api") continue;
|
|
244
|
-
const host = hostOf(manifest, edge.target);
|
|
245
|
-
if (!host) continue;
|
|
246
|
-
const key = appKey(host);
|
|
247
|
-
if (key !== appKey(id) && apps[key]) names.add(key);
|
|
248
|
-
}
|
|
249
|
-
app.dependencies = [...names].sort();
|
|
250
|
-
}
|
|
251
|
-
markRoot(apps);
|
|
252
|
-
assignPorts(apps);
|
|
253
|
-
for (const [name, app] of Object.entries(workspace.apps)) if (!apps[name]) apps[name] = app;
|
|
254
|
-
return apps;
|
|
255
|
-
}
|
|
256
|
-
//#endregion
|
|
257
|
-
export { wildcardSite as i, derivedApps as n, protectedSubdomains as r, appKey as t };
|
|
258
|
-
|
|
259
|
-
//# sourceMappingURL=derive-Cd7Hl3r2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"derive-Cd7Hl3r2.mjs","names":["appKey"],"sources":["../src/workspace/subdomains.ts","../src/workspace/derive.ts"],"sourcesContent":["/**\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';\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/** 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\tconst labels = new Map<string, 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\tlabels.set(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\tlabels.set(declaration.subdomain ?? appKey(id), id);\n\t\t\t\tbreak;\n\t\t\tcase 'file-server':\n\t\t\t\tlabels.set(appKey(id), id);\n\t\t\t\tif (declaration.processors?.length) {\n\t\t\t\t\tlabels.set(`${appKey(id)}-processors`, id);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'worker':\n\t\t\t\tlabels.set(appKey(id), id);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn labels;\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 */\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\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 * 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"],"mappings":";;;;;;;;;;;;;;AAqBA,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,GAAG,MAAM,KAAK,OAAO,EAAE,oJAGxB;EALoB,KAAA,QAAA;EAMpB,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,2BAAb,cAA8C,SAAS;CAE5C;CACA;CACA;CAHV,YACC,MACA,SACA,MACC;EACD,MACC,IAAI,KAAK,8BAA8B,KAAK,OAAO,QAAQ,UACtD,QAAQ,+GAEd;EARS,KAAA,OAAA;EACA,KAAA,UAAA;EACA,KAAA,OAAA;EAOT,KAAK,OAAO;CACb;AACD;;AAGA,SAAgB,aACf,UAC8B;CAC9B,OAAO,OAAO,OAAO,QAAQ,C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AAK,CAAC,CAAC,KAAK;CACpC;CAEA,SAAS,IAAI;CACb,YAAY,IAAI;CAKhB,KAAK,MAAM,CAAC,MAAM,QAAQ,OAAO,QAAQ,UAAU,IAAI,GACtD,IAAI,CAAC,KAAK,OAAO,KAAK,QAAQ;CAG/B,OAAO;AACR"}
|
package/dist/derive-CgZfoBU2.cjs
DELETED
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
const require_errors = require("./errors-DMC4Umsb.cjs");
|
|
2
|
-
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
3
|
-
//#region src/workspace/subdomains.ts
|
|
4
|
-
/**
|
|
5
|
-
* The subdomains of a stage's domain, as a wildcard site sees them.
|
|
6
|
-
*
|
|
7
|
-
* A site declared `subdomain: '*'` answers on every label nothing else does,
|
|
8
|
-
* so the labels something else does answer on are the ones a tenant can never
|
|
9
|
-
* take. They come from two places and from nowhere else: every app's own
|
|
10
|
-
* label, read off the constructs and never listed by hand, and the names no
|
|
11
|
-
* construct declares (`www`, `mail`, `status`), listed once in the workspace
|
|
12
|
-
* config as `protectedSubdomains`.
|
|
13
|
-
*/
|
|
14
|
-
/** A `protectedSubdomains` entry an app already answers on. */
|
|
15
|
-
var ProtectedSubdomainIsAnApp = class extends require_errors.GkmError {
|
|
16
|
-
subdomain;
|
|
17
|
-
app;
|
|
18
|
-
constructor(subdomain, app) {
|
|
19
|
-
super(`protectedSubdomains lists '${subdomain}', which '${app}' already answers on — a construct's own subdomain is protected without being listed. Remove it from protectedSubdomains.`);
|
|
20
|
-
this.subdomain = subdomain;
|
|
21
|
-
this.app = app;
|
|
22
|
-
this.name = "ProtectedSubdomainIsAnApp";
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
/** Two sites that both answer on every subdomain. */
|
|
26
|
-
var SecondWildcardSite = class extends require_errors.GkmError {
|
|
27
|
-
sites;
|
|
28
|
-
constructor(sites) {
|
|
29
|
-
super(`${sites.join(" and ")} both declare subdomain: '*', and two sites cannot share the same hosts. Keep one wildcard site per project; give the other a subdomain of its own.`);
|
|
30
|
-
this.sites = sites;
|
|
31
|
-
this.name = "SecondWildcardSite";
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
/** A wildcard site whose `hosts` route is on no surface the project declares. */
|
|
35
|
-
var SiteHostsEndpointMissing = class extends require_errors.GkmError {
|
|
36
|
-
site;
|
|
37
|
-
surface;
|
|
38
|
-
path;
|
|
39
|
-
constructor(site, surface, path) {
|
|
40
|
-
super(`'${site}' checks its hosts with GET ${path} on '${surface}', but '${surface}' serves no such route. Export the endpoint from the surface's endpoints, or point \`hosts\` at one it serves.`);
|
|
41
|
-
this.site = site;
|
|
42
|
-
this.surface = surface;
|
|
43
|
-
this.path = path;
|
|
44
|
-
this.name = "SiteHostsEndpointMissing";
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
/** The project's one wildcard site, or `undefined` when it has none. */
|
|
48
|
-
function wildcardSite(manifest) {
|
|
49
|
-
return Object.values(manifest).find(_geekmidas_manifest.isWildcardSite);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Every label an app answers on, by the app it belongs to — what a deploy
|
|
53
|
-
* puts under the stage's domain: a surface's or site's `subdomain` (or its id
|
|
54
|
-
* kebab-cased), each file server and its processors' origin, and each worker,
|
|
55
|
-
* which SNS may push to on a host of its own.
|
|
56
|
-
*
|
|
57
|
-
* The root site's is kept although it answers on the domain itself: which
|
|
58
|
-
* site is the root can change without a tenant's slug changing meaning. The
|
|
59
|
-
* wildcard site has none — its labels are whatever is left.
|
|
60
|
-
*/
|
|
61
|
-
function appSubdomains(manifest) {
|
|
62
|
-
const labels = /* @__PURE__ */ new Map();
|
|
63
|
-
for (const [id, declaration] of Object.entries(manifest)) switch (declaration.kind) {
|
|
64
|
-
case "rest-api":
|
|
65
|
-
case "websocket-api":
|
|
66
|
-
labels.set(declaration.subdomain ?? (0, _geekmidas_manifest.kebabCase)(id), id);
|
|
67
|
-
break;
|
|
68
|
-
case "site":
|
|
69
|
-
if (declaration.subdomain === _geekmidas_manifest.WILDCARD_SUBDOMAIN) break;
|
|
70
|
-
labels.set(declaration.subdomain ?? (0, _geekmidas_manifest.kebabCase)(id), id);
|
|
71
|
-
break;
|
|
72
|
-
case "file-server":
|
|
73
|
-
labels.set((0, _geekmidas_manifest.kebabCase)(id), id);
|
|
74
|
-
if (declaration.processors?.length) labels.set(`${(0, _geekmidas_manifest.kebabCase)(id)}-processors`, id);
|
|
75
|
-
break;
|
|
76
|
-
case "worker": labels.set((0, _geekmidas_manifest.kebabCase)(id), id);
|
|
77
|
-
}
|
|
78
|
-
return labels;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* The labels no tenant may take: every app's own and the workspace's
|
|
82
|
-
* `protectedSubdomains`, sorted.
|
|
83
|
-
*/
|
|
84
|
-
function protectedSubdomains(manifest, configured = []) {
|
|
85
|
-
return [.../* @__PURE__ */ new Set([...appSubdomains(manifest).keys(), ...configured])].sort();
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* What a project's subdomains have to satisfy before anything is derived
|
|
89
|
-
* from them.
|
|
90
|
-
*
|
|
91
|
-
* @throws {SecondWildcardSite} when two sites declare `subdomain: '*'`
|
|
92
|
-
* @throws {SiteHostsEndpointMissing} when the wildcard site's `hosts` route is not served
|
|
93
|
-
* @throws {ProtectedSubdomainIsAnApp} when `protectedSubdomains` repeats an app's own
|
|
94
|
-
*/
|
|
95
|
-
function assertSubdomains(manifest, configured = []) {
|
|
96
|
-
const wildcards = Object.values(manifest).filter(_geekmidas_manifest.isWildcardSite);
|
|
97
|
-
if (wildcards.length > 1) throw new SecondWildcardSite(wildcards.map((site) => site.id).sort());
|
|
98
|
-
const site = wildcards[0];
|
|
99
|
-
if (site?.hosts) {
|
|
100
|
-
const surface = manifest[site.hosts.surface];
|
|
101
|
-
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);
|
|
102
|
-
}
|
|
103
|
-
const labels = appSubdomains(manifest);
|
|
104
|
-
for (const subdomain of configured) {
|
|
105
|
-
const app = labels.get(subdomain);
|
|
106
|
-
if (app) throw new ProtectedSubdomainIsAnApp(subdomain, app);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region src/workspace/derive.ts
|
|
111
|
-
/**
|
|
112
|
-
* The apps a manifest implies.
|
|
113
|
-
*
|
|
114
|
-
* `gkm.config.ts` used to carry an `apps` block naming every app: its type, its
|
|
115
|
-
* path, its port, its framework, which other apps it depended on. Every one of
|
|
116
|
-
* those facts was already declared. A `StaticSite('Web', { path: 'apps/web' })`
|
|
117
|
-
* and an `apps.web = { type: 'web', path: 'apps/web', framework: 'vite',
|
|
118
|
-
* dependencies: ['api'] }` are the same statement written twice, and only one of
|
|
119
|
-
* them was checked against anything — so the copy in config was free to drift,
|
|
120
|
-
* and a surface config had no entry for simply never deployed.
|
|
121
|
-
*
|
|
122
|
-
* So the list comes from the graph. A `site` is an app, and so is every
|
|
123
|
-
* `rest-api` — one surface, one container, at the `path` it declared.
|
|
124
|
-
*
|
|
125
|
-
* What config still supplies is what no graph can answer: the backends a cache
|
|
126
|
-
* and a mailer resolve to, the deploy endpoint, the stage's domain.
|
|
127
|
-
*/
|
|
128
|
-
/** Which frontend framework builds each site variant. */
|
|
129
|
-
const FRAMEWORKS = {
|
|
130
|
-
static: "vite",
|
|
131
|
-
next: "nextjs",
|
|
132
|
-
tanstack: "tanstack-start"
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* The app key a construct id becomes.
|
|
136
|
-
*
|
|
137
|
-
* The same kebab form every physical name is built from, so `Api` is `api` in
|
|
138
|
-
* the config, `production-kitchen-sink-api` on Dokploy, and `API_URL` in an
|
|
139
|
-
* environment — one id, three renderings, no second list.
|
|
140
|
-
*/
|
|
141
|
-
function appKey(id) {
|
|
142
|
-
return (0, _geekmidas_manifest.kebabCase)(id);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* The app serving a surface: its own, always.
|
|
146
|
-
*
|
|
147
|
-
* Every surface gets a container. There is no arrangement in which one runs
|
|
148
|
-
* inside another — two surfaces in a process share a filesystem, an
|
|
149
|
-
* environment, and every credential either was granted, so an auth server
|
|
150
|
-
* beside an API is one bug in the API away from being read by it.
|
|
151
|
-
*/
|
|
152
|
-
function hostOf(manifest, id) {
|
|
153
|
-
const declaration = manifest[id];
|
|
154
|
-
if (!declaration || declaration.kind !== "rest-api" && declaration.kind !== "websocket-api") return void 0;
|
|
155
|
-
return id;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Local ports, assigned so that adding a site does not renumber the others.
|
|
159
|
-
*
|
|
160
|
-
* Backends first, then the site holding the base domain, then the rest
|
|
161
|
-
* alphabetically. The ordering is arbitrary but it is *fixed*, which is the
|
|
162
|
-
* property that matters: a port that moves when an unrelated app is added is a
|
|
163
|
-
* port nobody can put in a bookmark. A construct that names its own port keeps
|
|
164
|
-
* it, and is skipped here.
|
|
165
|
-
*/
|
|
166
|
-
function assignPorts(apps) {
|
|
167
|
-
const rank = (name, app) => [
|
|
168
|
-
app.type === "backend" ? 0 : app.type === "web" ? 1 : 2,
|
|
169
|
-
app.root ? 0 : 1,
|
|
170
|
-
name
|
|
171
|
-
];
|
|
172
|
-
const ordered = Object.entries(apps).sort(([aName, a], [bName, b]) => {
|
|
173
|
-
const [at, ar, an] = rank(aName, a);
|
|
174
|
-
const [bt, br, bn] = rank(bName, b);
|
|
175
|
-
return at - bt || ar - br || an.localeCompare(bn);
|
|
176
|
-
});
|
|
177
|
-
const taken = new Set(ordered.map(([, app]) => app.port).filter((p) => !!p));
|
|
178
|
-
let next = 3e3;
|
|
179
|
-
for (const [, app] of ordered) {
|
|
180
|
-
if (app.port) continue;
|
|
181
|
-
while (taken.has(next)) next += 1;
|
|
182
|
-
app.port = next;
|
|
183
|
-
taken.add(next);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Whichever site holds the base domain.
|
|
188
|
-
*
|
|
189
|
-
* The convention first — a site named `web` — because it is one people already
|
|
190
|
-
* rely on. Then an explicit `root: true`. A project with one site needs neither.
|
|
191
|
-
*/
|
|
192
|
-
function markRoot(apps) {
|
|
193
|
-
const sites = Object.entries(apps).filter(([, a]) => a.type === "web" && a.subdomain !== _geekmidas_manifest.WILDCARD_SUBDOMAIN);
|
|
194
|
-
if (sites.length === 0) return;
|
|
195
|
-
if (sites.some(([, a]) => a.root)) return;
|
|
196
|
-
const chosen = sites.find(([name]) => name === "web") ?? (sites.length === 1 ? sites[0] : void 0);
|
|
197
|
-
if (chosen) chosen[1].root = true;
|
|
198
|
-
}
|
|
199
|
-
function derivedApps(manifest, workspace) {
|
|
200
|
-
assertSubdomains(manifest, workspace.protectedSubdomains);
|
|
201
|
-
const apps = {};
|
|
202
|
-
const defaultTarget = workspace.deploy?.default ?? "dokploy";
|
|
203
|
-
for (const [id, declaration] of Object.entries(manifest)) {
|
|
204
|
-
if (declaration.kind !== "site" && declaration.kind !== "mobile-app" && declaration.kind !== "rest-api" && declaration.kind !== "websocket-api") continue;
|
|
205
|
-
const spec = declaration.kind === "site" || declaration.kind === "mobile-app" ? declaration.app : {
|
|
206
|
-
path: declaration.path,
|
|
207
|
-
...declaration.kind === "rest-api" && declaration.telescope ? { telescope: true } : {}
|
|
208
|
-
};
|
|
209
|
-
const name = appKey(id);
|
|
210
|
-
const configured = workspace.apps[name];
|
|
211
|
-
apps[name] = {
|
|
212
|
-
...configured,
|
|
213
|
-
type: declaration.kind === "site" ? "web" : declaration.kind === "mobile-app" ? "mobile" : "backend",
|
|
214
|
-
path: spec.path,
|
|
215
|
-
port: spec.port ?? configured?.port ?? 0,
|
|
216
|
-
...(declaration.kind === "rest-api" || declaration.kind === "websocket-api" || declaration.kind === "site") && declaration.subdomain ? { subdomain: declaration.subdomain } : {},
|
|
217
|
-
dependencies: [],
|
|
218
|
-
resolvedDeployTarget: configured?.resolvedDeployTarget ?? defaultTarget,
|
|
219
|
-
...declaration.kind === "site" ? {
|
|
220
|
-
framework: configured?.framework ?? FRAMEWORKS[declaration.variant],
|
|
221
|
-
...declaration.root ? { root: true } : {},
|
|
222
|
-
...spec.config ? { config: spec.config } : {}
|
|
223
|
-
} : {},
|
|
224
|
-
...declaration.kind === "mobile-app" ? {
|
|
225
|
-
framework: configured?.framework ?? declaration.variant,
|
|
226
|
-
...spec.config ? { config: spec.config } : {}
|
|
227
|
-
} : {},
|
|
228
|
-
...spec.telescope !== void 0 ? { telescope: spec.telescope } : {},
|
|
229
|
-
...spec.openapi !== void 0 ? { openapi: spec.openapi } : {},
|
|
230
|
-
...spec.runtime !== void 0 ? { runtime: spec.runtime } : {},
|
|
231
|
-
...spec.env !== void 0 ? { env: spec.env } : {},
|
|
232
|
-
...spec.entry !== void 0 ? { entry: spec.entry } : {},
|
|
233
|
-
...configured?.domain ? { domain: configured.domain } : {}
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
for (const [id, declaration] of Object.entries(manifest)) {
|
|
237
|
-
if (declaration.kind !== "site" && declaration.kind !== "mobile-app" && declaration.kind !== "rest-api" && declaration.kind !== "websocket-api") continue;
|
|
238
|
-
const app = apps[appKey(id)];
|
|
239
|
-
if (!app) continue;
|
|
240
|
-
const edges = (0, _geekmidas_manifest.dependenciesOf)(declaration);
|
|
241
|
-
const names = /* @__PURE__ */ new Set();
|
|
242
|
-
for (const edge of edges) {
|
|
243
|
-
if (edge.kind !== "rest-api") continue;
|
|
244
|
-
const host = hostOf(manifest, edge.target);
|
|
245
|
-
if (!host) continue;
|
|
246
|
-
const key = appKey(host);
|
|
247
|
-
if (key !== appKey(id) && apps[key]) names.add(key);
|
|
248
|
-
}
|
|
249
|
-
app.dependencies = [...names].sort();
|
|
250
|
-
}
|
|
251
|
-
markRoot(apps);
|
|
252
|
-
assignPorts(apps);
|
|
253
|
-
for (const [name, app] of Object.entries(workspace.apps)) if (!apps[name]) apps[name] = app;
|
|
254
|
-
return apps;
|
|
255
|
-
}
|
|
256
|
-
//#endregion
|
|
257
|
-
Object.defineProperty(exports, "appKey", {
|
|
258
|
-
enumerable: true,
|
|
259
|
-
get: function() {
|
|
260
|
-
return appKey;
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
Object.defineProperty(exports, "derivedApps", {
|
|
264
|
-
enumerable: true,
|
|
265
|
-
get: function() {
|
|
266
|
-
return derivedApps;
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
Object.defineProperty(exports, "protectedSubdomains", {
|
|
270
|
-
enumerable: true,
|
|
271
|
-
get: function() {
|
|
272
|
-
return protectedSubdomains;
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
Object.defineProperty(exports, "wildcardSite", {
|
|
276
|
-
enumerable: true,
|
|
277
|
-
get: function() {
|
|
278
|
-
return wildcardSite;
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
//# sourceMappingURL=derive-CgZfoBU2.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"derive-CgZfoBU2.cjs","names":["GkmError","isWildcardSite","appKey","WILDCARD_SUBDOMAIN","kebabCase","WILDCARD_SUBDOMAIN","dependenciesOf"],"sources":["../src/workspace/subdomains.ts","../src/workspace/derive.ts"],"sourcesContent":["/**\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';\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/** 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\tconst labels = new Map<string, 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\tlabels.set(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\tlabels.set(declaration.subdomain ?? appKey(id), id);\n\t\t\t\tbreak;\n\t\t\tcase 'file-server':\n\t\t\t\tlabels.set(appKey(id), id);\n\t\t\t\tif (declaration.processors?.length) {\n\t\t\t\t\tlabels.set(`${appKey(id)}-processors`, id);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'worker':\n\t\t\t\tlabels.set(appKey(id), id);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn labels;\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 */\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\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 * 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"],"mappings":";;;;;;;;;;;;;;AAqBA,IAAa,4BAAb,cAA+CA,eAAAA,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,cAAwCA,eAAAA,SAAS;CAC3B;CAArB,YAAY,OAAmC;EAC9C,MACC,GAAG,MAAM,KAAK,OAAO,E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