@geekmidas/cli 10.0.0-alpha.124 → 10.0.0-alpha.126
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-B2MUa4M2.cjs → EndpointGenerator-BGxf9jWE.cjs} +8 -4
- package/dist/{EndpointGenerator-B2MUa4M2.cjs.map → EndpointGenerator-BGxf9jWE.cjs.map} +1 -1
- package/dist/{EndpointGenerator-Z_BUTocT.mjs → EndpointGenerator-errMeldx.mjs} +8 -4
- package/dist/{EndpointGenerator-Z_BUTocT.mjs.map → EndpointGenerator-errMeldx.mjs.map} +1 -1
- package/dist/{GoDaddyProvider-55x4o-4z.mjs → GoDaddyProvider-CvRVmN4W.mjs} +2 -2
- package/dist/{GoDaddyProvider-55x4o-4z.mjs.map → GoDaddyProvider-CvRVmN4W.mjs.map} +1 -1
- package/dist/{GoDaddyProvider-0z5RAN1k.cjs → GoDaddyProvider-DFfpzCOP.cjs} +2 -2
- package/dist/{GoDaddyProvider-0z5RAN1k.cjs.map → GoDaddyProvider-DFfpzCOP.cjs.map} +1 -1
- package/dist/{LegacyStateStore-DRpB-yC5.cjs → LegacyStateStore-BFrCHrFQ.cjs} +3 -3
- package/dist/{LegacyStateStore-DRpB-yC5.cjs.map → LegacyStateStore-BFrCHrFQ.cjs.map} +1 -1
- package/dist/{LegacyStateStore-C-vumKSN.mjs → LegacyStateStore-CgfENrXF.mjs} +3 -3
- package/dist/{LegacyStateStore-C-vumKSN.mjs.map → LegacyStateStore-CgfENrXF.mjs.map} +1 -1
- package/dist/{LocalStateStore-C3ummuDT.cjs → LocalStateStore-BU5z_IOE.cjs} +2 -2
- package/dist/{LocalStateStore-C3ummuDT.cjs.map → LocalStateStore-BU5z_IOE.cjs.map} +1 -1
- package/dist/{LocalStateStore-CtOjpV1w.mjs → LocalStateStore-DxoNpiBg.mjs} +2 -2
- package/dist/{LocalStateStore-CtOjpV1w.mjs.map → LocalStateStore-DxoNpiBg.mjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-MtnMQL_g.mjs → OpenApiTsGenerator-W_HRXH1X.mjs} +2 -2
- package/dist/{OpenApiTsGenerator-MtnMQL_g.mjs.map → OpenApiTsGenerator-W_HRXH1X.mjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-t3_E98Fi.cjs → OpenApiTsGenerator-cQgtxWQo.cjs} +2 -2
- package/dist/{OpenApiTsGenerator-t3_E98Fi.cjs.map → OpenApiTsGenerator-cQgtxWQo.cjs.map} +1 -1
- package/dist/{S3StateStore-BC4Jm3Tw.mjs → S3StateStore-CGMSDilh.mjs} +2 -2
- package/dist/{S3StateStore-BC4Jm3Tw.mjs.map → S3StateStore-CGMSDilh.mjs.map} +1 -1
- package/dist/{S3StateStore-BeArp0aF.cjs → S3StateStore-DiekMLpn.cjs} +2 -2
- package/dist/{S3StateStore-BeArp0aF.cjs.map → S3StateStore-DiekMLpn.cjs.map} +1 -1
- package/dist/{SSMStateStore-DcstR6cW.cjs → SSMStateStore-BDCOFdKq.cjs} +2 -2
- package/dist/{SSMStateStore-DcstR6cW.cjs.map → SSMStateStore-BDCOFdKq.cjs.map} +1 -1
- package/dist/{SSMStateStore-Crl76aYZ.mjs → SSMStateStore-Cq2H9MlF.mjs} +2 -2
- package/dist/{SSMStateStore-Crl76aYZ.mjs.map → SSMStateStore-Cq2H9MlF.mjs.map} +1 -1
- package/dist/{SubscriberGenerator-COAVPgM-.mjs → SubscriberGenerator-BALddfuW.mjs} +4 -62
- package/dist/SubscriberGenerator-BALddfuW.mjs.map +1 -0
- package/dist/{SubscriberGenerator-C3QTae-R.cjs → SubscriberGenerator-LgyTxZ8r.cjs} +3 -91
- package/dist/SubscriberGenerator-LgyTxZ8r.cjs.map +1 -0
- package/dist/{add-BFjb6mMq.cjs → add-BsiBYkAW.cjs} +6 -6
- package/dist/{add-BFjb6mMq.cjs.map → add-BsiBYkAW.cjs.map} +1 -1
- package/dist/{add-CIjmgzkb.mjs → add-CamA9Uqv.mjs} +6 -6
- package/dist/{add-CIjmgzkb.mjs.map → add-CamA9Uqv.mjs.map} +1 -1
- package/dist/{bundler-D6KFNpQk.mjs → bundler-2V2PR_E-.mjs} +5 -5
- package/dist/{bundler-D6KFNpQk.mjs.map → bundler-2V2PR_E-.mjs.map} +1 -1
- package/dist/{bundler-CiUoIsku.cjs → bundler-CijtdIZ2.cjs} +5 -5
- package/dist/{bundler-CiUoIsku.cjs.map → bundler-CijtdIZ2.cjs.map} +1 -1
- package/dist/{cli-r4eUr98C.cjs → cli-7gc1QG8X.cjs} +3 -3
- package/dist/{cli-r4eUr98C.cjs.map → cli-7gc1QG8X.cjs.map} +1 -1
- package/dist/{cli-DNtSTtMc.mjs → cli-PiyYqHGx.mjs} +3 -3
- package/dist/{cli-DNtSTtMc.mjs.map → cli-PiyYqHGx.mjs.map} +1 -1
- package/dist/{compose-BfXXWJSp.cjs → compose-8e2xJ61E.cjs} +236 -39
- package/dist/compose-8e2xJ61E.cjs.map +1 -0
- package/dist/{compose-DJvvmF3X.mjs → compose-CvHIjMDd.mjs} +235 -38
- package/dist/compose-CvHIjMDd.mjs.map +1 -0
- package/dist/{config-IgK6YaGp.d.cts → config-CdytFgSR.d.cts} +3 -3
- package/dist/{config-IgK6YaGp.d.cts.map → config-CdytFgSR.d.cts.map} +1 -1
- package/dist/{config-kE-p5hxq.d.mts → config-_y1FGBWR.d.mts} +3 -3
- package/dist/{config-kE-p5hxq.d.mts.map → config-_y1FGBWR.d.mts.map} +1 -1
- package/dist/config.cjs +2 -2
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +2 -2
- package/dist/{credentialSchemas-AhIBuQxQ.cjs → credentialSchemas-DFxvGEwa.cjs} +2 -2
- package/dist/{credentialSchemas-AhIBuQxQ.cjs.map → credentialSchemas-DFxvGEwa.cjs.map} +1 -1
- package/dist/{credentialSchemas-DLKbxYBy.mjs → credentialSchemas-DaMpt-Dx.mjs} +2 -2
- package/dist/{credentialSchemas-DLKbxYBy.mjs.map → credentialSchemas-DaMpt-Dx.mjs.map} +1 -1
- package/dist/{databases-BPOgTn1u.mjs → databases-6GD0tI2F.mjs} +65 -3
- package/dist/databases-6GD0tI2F.mjs.map +1 -0
- package/dist/{databases-fOaoBInm.cjs → databases-CuVGf7-M.cjs} +75 -1
- package/dist/databases-CuVGf7-M.cjs.map +1 -0
- package/dist/deploy/public.cjs +8 -8
- package/dist/deploy/public.d.cts +3 -3
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +3 -3
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +8 -8
- package/dist/{deploy-CiRYwFmr.mjs → deploy-CIPwTJ47.mjs} +797 -25
- package/dist/deploy-CIPwTJ47.mjs.map +1 -0
- package/dist/{deploy-BbI1UMh3.cjs → deploy-wSlIRPn5.cjs} +796 -24
- package/dist/deploy-wSlIRPn5.cjs.map +1 -0
- package/dist/{discover-BvJOVsYG.mjs → discover-CzGM5P3p.mjs} +71 -1
- package/dist/discover-CzGM5P3p.mjs.map +1 -0
- package/dist/{discover-ojkcbxHw.cjs → discover-DL6h-J97.cjs} +71 -1
- package/dist/discover-DL6h-J97.cjs.map +1 -0
- package/dist/{dokploy-C0aQrCgs.cjs → dokploy-BKbUrz05.cjs} +2 -2
- package/dist/{dokploy-C0aQrCgs.cjs.map → dokploy-BKbUrz05.cjs.map} +1 -1
- package/dist/{dokploy-MM7c3IE0.mjs → dokploy-BZf1AHd0.mjs} +2 -2
- package/dist/{dokploy-MM7c3IE0.mjs.map → dokploy-BZf1AHd0.mjs.map} +1 -1
- package/dist/{drivers-CQ32PB5w.cjs → drivers-C47nm-wB.cjs} +91 -4
- package/dist/drivers-C47nm-wB.cjs.map +1 -0
- package/dist/{drivers-Chb5Akov.mjs → drivers-CDjpjakg.mjs} +60 -3
- package/dist/drivers-CDjpjakg.mjs.map +1 -0
- package/dist/{eas-1Ee6kql0.mjs → eas-CxX2RCE_.mjs} +2 -2
- package/dist/{eas-1Ee6kql0.mjs.map → eas-CxX2RCE_.mjs.map} +1 -1
- package/dist/{eas-CJoys9yh.cjs → eas-DzDMGzfc.cjs} +2 -2
- package/dist/{eas-CJoys9yh.cjs.map → eas-DzDMGzfc.cjs.map} +1 -1
- package/dist/{emit-qvHxMV9b.cjs → emit-CYloptRS.cjs} +18 -1
- package/dist/emit-CYloptRS.cjs.map +1 -0
- package/dist/{emit-CNpuV_6Q.mjs → emit-CiJGdy_f.mjs} +18 -1
- package/dist/emit-CiJGdy_f.mjs.map +1 -0
- package/dist/{encryption-B8Bk1Mvu.mjs → encryption-BFSrt89F.mjs} +3 -3
- package/dist/{encryption-B8Bk1Mvu.mjs.map → encryption-BFSrt89F.mjs.map} +1 -1
- package/dist/{encryption-Bo9VlRnl.cjs → encryption-RNcBnG4Z.cjs} +3 -3
- package/dist/{encryption-Bo9VlRnl.cjs.map → encryption-RNcBnG4Z.cjs.map} +1 -1
- package/dist/{engine-esxTxcIx.cjs → engine-Dqe9KQCm.cjs} +142 -15
- package/dist/engine-Dqe9KQCm.cjs.map +1 -0
- package/dist/{engine-BuinpJfS.mjs → engine-_0pjyCd_.mjs} +142 -15
- package/dist/engine-_0pjyCd_.mjs.map +1 -0
- package/dist/{github-BEA4K3_X.cjs → github-Csev5EFf.cjs} +41 -6
- package/dist/github-Csev5EFf.cjs.map +1 -0
- package/dist/{github-BUlKJfOV.mjs → github-Dck0nLW9.mjs} +41 -6
- package/dist/github-Dck0nLW9.mjs.map +1 -0
- package/dist/{googlePlay-CiqAS2ma.cjs → googlePlay-DBtDAGBk.cjs} +3 -3
- package/dist/{googlePlay-CiqAS2ma.cjs.map → googlePlay-DBtDAGBk.cjs.map} +1 -1
- package/dist/{googlePlay-CK05QiTq.mjs → googlePlay-DTuvDHi5.mjs} +3 -3
- package/dist/{googlePlay-CK05QiTq.mjs.map → googlePlay-DTuvDHi5.mjs.map} +1 -1
- package/dist/{index-DhUf0B0m.d.mts → index-DrkV7N5w.d.mts} +2 -2
- package/dist/{index-4CO0HD27.d.cts.map → index-DrkV7N5w.d.mts.map} +1 -1
- package/dist/{index-4CO0HD27.d.cts → index-yaXZ9m-J.d.cts} +2 -2
- package/dist/{index-DhUf0B0m.d.mts.map → index-yaXZ9m-J.d.cts.map} +1 -1
- package/dist/index.cjs +150 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +149 -66
- package/dist/index.mjs.map +1 -1
- package/dist/{migrate-C-hmbjpG.cjs → migrate-3ZEoqx5q.cjs} +3 -3
- package/dist/{migrate-C-hmbjpG.cjs.map → migrate-3ZEoqx5q.cjs.map} +1 -1
- package/dist/{migrate-BzCHT9qs.mjs → migrate-BABIuzQj.mjs} +3 -3
- package/dist/{migrate-BzCHT9qs.mjs.map → migrate-BABIuzQj.mjs.map} +1 -1
- package/dist/{migrate-CnbvrVag.mjs → migrate-DZeNpuX2.mjs} +8 -6
- package/dist/migrate-DZeNpuX2.mjs.map +1 -0
- package/dist/{migrate-DeQJBexh.cjs → migrate-pGiUqvBi.cjs} +8 -6
- package/dist/migrate-pGiUqvBi.cjs.map +1 -0
- package/dist/openapi.cjs +3 -3
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.mjs +3 -3
- package/dist/{publish-BISBrrqR.mjs → publish-BsnDeOVL.mjs} +2 -2
- package/dist/{publish-BISBrrqR.mjs.map → publish-BsnDeOVL.mjs.map} +1 -1
- package/dist/{publish-DtSIB-hZ.cjs → publish-CS6xDvGT.cjs} +2 -2
- package/dist/{publish-DtSIB-hZ.cjs.map → publish-CS6xDvGT.cjs.map} +1 -1
- package/dist/{ready-IVGu-q18.cjs → ready-CxPJm0Hc.cjs} +6 -6
- package/dist/{ready-IVGu-q18.cjs.map → ready-CxPJm0Hc.cjs.map} +1 -1
- package/dist/{ready-DqsyadOs.mjs → ready-DrvaAwKv.mjs} +6 -6
- package/dist/{ready-DqsyadOs.mjs.map → ready-DrvaAwKv.mjs.map} +1 -1
- package/dist/reconcile/public.cjs +2 -2
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.cts.map +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/reconcile/public.d.mts.map +1 -1
- package/dist/reconcile/public.mjs +2 -2
- package/dist/{resolve-BT7fkPN5.mjs → resolve-fCGJmM-R.mjs} +3 -3
- package/dist/{resolve-BT7fkPN5.mjs.map → resolve-fCGJmM-R.mjs.map} +1 -1
- package/dist/{resolve-C7GKQcE4.cjs → resolve-zqCMFio0.cjs} +3 -3
- package/dist/{resolve-C7GKQcE4.cjs.map → resolve-zqCMFio0.cjs.map} +1 -1
- package/dist/{rollback-DbP0KuDw.mjs → rollback-BkhVrtAf.mjs} +5 -5
- package/dist/{rollback-DbP0KuDw.mjs.map → rollback-BkhVrtAf.mjs.map} +1 -1
- package/dist/{rollback-BEiB-Pje.cjs → rollback-qc79mj6L.cjs} +5 -5
- package/dist/{rollback-BEiB-Pje.cjs.map → rollback-qc79mj6L.cjs.map} +1 -1
- package/dist/{runtime-BFJQNqwd.d.mts → runtime-DCkfI2E7.d.mts} +2 -2
- package/dist/{runtime-BFJQNqwd.d.mts.map → runtime-DCkfI2E7.d.mts.map} +1 -1
- package/dist/{runtime-BJO-FFef.d.cts → runtime-Ie4znWIB.d.cts} +2 -2
- package/dist/{runtime-BJO-FFef.d.cts.map → runtime-Ie4znWIB.d.cts.map} +1 -1
- package/dist/{s3-B4FTQQkV.mjs → s3-BZzSnker.mjs} +2 -2
- package/dist/{s3-B4FTQQkV.mjs.map → s3-BZzSnker.mjs.map} +1 -1
- package/dist/{s3-DwKLXwUT.cjs → s3-pqgmCTOq.cjs} +2 -2
- package/dist/{s3-DwKLXwUT.cjs.map → s3-pqgmCTOq.cjs.map} +1 -1
- package/dist/sandbox/credentials-worker.cjs +2 -2
- package/dist/sandbox/credentials-worker.mjs +2 -2
- package/dist/sandbox/discover-worker.cjs +1 -1
- package/dist/sandbox/discover-worker.mjs +1 -1
- package/dist/sandbox/migrate-worker.cjs +5 -4
- package/dist/sandbox/migrate-worker.cjs.map +1 -1
- package/dist/sandbox/migrate-worker.mjs +5 -4
- package/dist/sandbox/migrate-worker.mjs.map +1 -1
- package/dist/{seeds-DOfxmDRO.cjs → seeds-3awh33Wz.cjs} +607 -45
- package/dist/seeds-3awh33Wz.cjs.map +1 -0
- package/dist/{seeds-rG-Evfz9.mjs → seeds-Cfejy8wj.mjs} +517 -39
- package/dist/seeds-Cfejy8wj.mjs.map +1 -0
- package/dist/{serverSetup-CWWVcU6Y.cjs → serverSetup-BFQuwUeL.cjs} +6 -6
- package/dist/{serverSetup-CWWVcU6Y.cjs.map → serverSetup-BFQuwUeL.cjs.map} +1 -1
- package/dist/{serverSetup-xGw1fxuZ.mjs → serverSetup-C8ZbHTm_.mjs} +6 -6
- package/dist/{serverSetup-xGw1fxuZ.mjs.map → serverSetup-C8ZbHTm_.mjs.map} +1 -1
- package/dist/{sniffer-DVPgfyHr.mjs → sniffer-CCkdzjiU.mjs} +8 -8
- package/dist/{sniffer-DVPgfyHr.mjs.map → sniffer-CCkdzjiU.mjs.map} +1 -1
- package/dist/{sniffer-C7O9Pna_.cjs → sniffer-Cq1nhxIB.cjs} +8 -8
- package/dist/{sniffer-C7O9Pna_.cjs.map → sniffer-Cq1nhxIB.cjs.map} +1 -1
- package/dist/{snsSubscriptions-CSkteK2J.cjs → snsSubscriptions-DYyYP0Xf.cjs} +15 -3
- package/dist/snsSubscriptions-DYyYP0Xf.cjs.map +1 -0
- package/dist/{snsSubscriptions-CvBIGGp0.mjs → snsSubscriptions-R_AKBZYK.mjs} +4 -4
- package/dist/snsSubscriptions-R_AKBZYK.mjs.map +1 -0
- package/dist/{stage-fRfFtLwj.cjs → stage-BkgbVJ9Z.cjs} +6 -6
- package/dist/{stage-fRfFtLwj.cjs.map → stage-BkgbVJ9Z.cjs.map} +1 -1
- package/dist/{stage-2EKpzPQ1.mjs → stage-DCaxqm-G.mjs} +6 -6
- package/dist/{stage-2EKpzPQ1.mjs.map → stage-DCaxqm-G.mjs.map} +1 -1
- package/dist/{stages-B7mCWI_R.cjs → stages-3yUZaZeA.cjs} +2 -2
- package/dist/{stages-B7mCWI_R.cjs.map → stages-3yUZaZeA.cjs.map} +1 -1
- package/dist/{stages-DSltTW2d.mjs → stages-DTTv0NZW.mjs} +2 -2
- package/dist/{stages-DSltTW2d.mjs.map → stages-DTTv0NZW.mjs.map} +1 -1
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.d.cts +2 -2
- package/dist/target/public.d.mts +2 -2
- package/dist/target/public.mjs +1 -1
- package/dist/{terminal-D1aeTkgv.cjs → terminal-PKhPAajN.cjs} +2 -2
- package/dist/{terminal-D1aeTkgv.cjs.map → terminal-PKhPAajN.cjs.map} +1 -1
- package/dist/{terminal-BAVrDhhN.mjs → terminal-bqY33lpN.mjs} +2 -2
- package/dist/{terminal-BAVrDhhN.mjs.map → terminal-bqY33lpN.mjs.map} +1 -1
- package/dist/{types-CFU2uvrz.d.cts → types-Bmjs4jZV.d.mts} +8 -2
- package/dist/{types-D3BeGucy.d.mts.map → types-Bmjs4jZV.d.mts.map} +1 -1
- package/dist/{types-D3BeGucy.d.mts → types-D0IsQxES.d.cts} +9 -1
- package/dist/{types-CFU2uvrz.d.cts.map → types-D0IsQxES.d.cts.map} +1 -1
- package/dist/vitest.cjs +1 -1
- package/dist/vitest.mjs +1 -1
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace/index.mjs +1 -1
- package/dist/{workspace-DUnnVjqC.mjs → workspace-DBHF9Gba.mjs} +5 -3
- package/dist/workspace-DBHF9Gba.mjs.map +1 -0
- package/dist/{workspace-C82GLPnf.cjs → workspace-Du4Afb03.cjs} +5 -3
- package/dist/workspace-Du4Afb03.cjs.map +1 -0
- package/package.json +17 -15
- package/dist/SubscriberGenerator-C3QTae-R.cjs.map +0 -1
- package/dist/SubscriberGenerator-COAVPgM-.mjs.map +0 -1
- package/dist/compose-BfXXWJSp.cjs.map +0 -1
- package/dist/compose-DJvvmF3X.mjs.map +0 -1
- package/dist/databases-BPOgTn1u.mjs.map +0 -1
- package/dist/databases-fOaoBInm.cjs.map +0 -1
- package/dist/deploy-BbI1UMh3.cjs.map +0 -1
- package/dist/deploy-CiRYwFmr.mjs.map +0 -1
- package/dist/discover-BvJOVsYG.mjs.map +0 -1
- package/dist/discover-ojkcbxHw.cjs.map +0 -1
- package/dist/drivers-CQ32PB5w.cjs.map +0 -1
- package/dist/drivers-Chb5Akov.mjs.map +0 -1
- package/dist/emit-CNpuV_6Q.mjs.map +0 -1
- package/dist/emit-qvHxMV9b.cjs.map +0 -1
- package/dist/engine-BuinpJfS.mjs.map +0 -1
- package/dist/engine-esxTxcIx.cjs.map +0 -1
- package/dist/github-BEA4K3_X.cjs.map +0 -1
- package/dist/github-BUlKJfOV.mjs.map +0 -1
- package/dist/migrate-CnbvrVag.mjs.map +0 -1
- package/dist/migrate-DeQJBexh.cjs.map +0 -1
- package/dist/seeds-DOfxmDRO.cjs.map +0 -1
- package/dist/seeds-rG-Evfz9.mjs.map +0 -1
- package/dist/snsSubscriptions-CSkteK2J.cjs.map +0 -1
- package/dist/snsSubscriptions-CvBIGGp0.mjs.map +0 -1
- package/dist/workspace-C82GLPnf.cjs.map +0 -1
- package/dist/workspace-DUnnVjqC.mjs.map +0 -1
|
@@ -112,6 +112,23 @@ function withCompute(manifest, compute) {
|
|
|
112
112
|
}]
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
+
for (const processor of compute.processors ?? []) {
|
|
116
|
+
const server = next[processor.fileServer];
|
|
117
|
+
if (server?.kind !== "file-server") continue;
|
|
118
|
+
next[server.id] = {
|
|
119
|
+
...server,
|
|
120
|
+
processors: [...(server.processors ?? []).filter((p) => p.id !== processor.name), {
|
|
121
|
+
id: processor.name,
|
|
122
|
+
handler: processor.handler,
|
|
123
|
+
path: processor.path,
|
|
124
|
+
prefix: processor.prefix,
|
|
125
|
+
...processor.native?.length ? { native: processor.native } : {},
|
|
126
|
+
...processor.timeout !== void 0 ? { timeout: processor.timeout } : {},
|
|
127
|
+
...processor.memorySize !== void 0 ? { memorySize: processor.memorySize } : {},
|
|
128
|
+
dependencies: edgesTo(manifest, processor.dependencies)
|
|
129
|
+
}].sort((a, b) => a.id.localeCompare(b.id))
|
|
130
|
+
};
|
|
131
|
+
}
|
|
115
132
|
return next;
|
|
116
133
|
}
|
|
117
134
|
/**
|
|
@@ -223,4 +240,4 @@ Object.defineProperty(exports, "withRoutes", {
|
|
|
223
240
|
}
|
|
224
241
|
});
|
|
225
242
|
|
|
226
|
-
//# sourceMappingURL=emit-
|
|
243
|
+
//# sourceMappingURL=emit-CYloptRS.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-CYloptRS.cjs","names":["provideKey","canonicalId"],"sources":["../src/reconcile/emit.ts"],"sourcesContent":["/**\n * The manifest, written out as a module.\n *\n * Discovery imports the application's own code — that is how it finds\n * constructs — so anything calling it evaluates the whole runtime graph: React\n * email templates, database clients, modules that read env at import time. That\n * is fine inside `gkm dev`, which is already running the app. It is not fine\n * inside a deploy config, where it fails on the first thing the deploy toolchain\n * does not expect and would keep failing on the next.\n *\n * So discovery happens once, in the build, and everything downstream reads what\n * it wrote. The same split `RestApi` makes by naming a routes glob rather than\n * importing route modules.\n *\n * A module rather than JSON, because a manifest is not just data to this\n * codebase — `as const satisfies ConstructManifest` is what keeps every id,\n * kind and provided key a *literal*, so `IdsOf`, `ProvidedKeys` and the rest\n * can select out of it. `JSON.parse` returns `any` and gives all of that up.\n */\n\nimport type {\n\tConstructManifest,\n\tCronInfo,\n\tDeclaration,\n\tDependency,\n\tFunctionInfo,\n\tProcessorInfo,\n\tQueueInfo,\n\tRestApiEndpoint,\n\tRouteInfo,\n\tSubscriberInfo,\n} from '@geekmidas/manifest';\nimport { canonicalId, provideKey } from '@geekmidas/manifest';\nimport type { CacheBackend, EmailBackend } from '../types.js';\n\n/**\n * Fold the build's generated routes into the surface that serves them.\n *\n * The routes already exist: `gkm build` generates one handler per endpoint and\n * records its path, method and environment. What was missing is that the\n * *construct* manifest never learned about them, so a `rest-api` node said\n * `endpoints: []` while five handlers sat in `.gkm/`. Two documents describing\n * the same routes, one of them wrong.\n *\n * Merging here rather than making the construct name a glob or import its\n * endpoints: the build is the thing that already walked the filesystem and\n * already knows where it wrote each handler. Asking the declaration to restate\n * any of that is how the two come to disagree.\n *\n * Attribution is to the surface the build served — the one whose `path` is\n * the app being built. Without one, routes go to the surface that declared none\n * of its own; a surface with static endpoints (an auth server's single\n * wildcard) keeps them.\n *\n * **Only from a provider that generates one handler per route.** The `server`\n * provider generates a single catch-all — `ALL *` pointing at the Hono app that\n * routes in-process — which is a true description of that build and a false\n * description of the application. Merging it wrote `endpoints: [{ method:\n * 'ALL', path: '*' }]` into a manifest for an app with five routes, and made the\n * document's contents depend on which `--provider` ran last. A manifest must not\n * do that.\n */\nexport function withRoutes(\n\tmanifest: ConstructManifest,\n\troutes: readonly RouteInfo[],\n\toptions: { perRoute: boolean; surface?: string },\n): ConstructManifest {\n\tif (routes.length === 0 || !options.perRoute) return manifest;\n\n\tconst target = Object.entries(manifest).find(([id, declaration]) =>\n\t\toptions.surface\n\t\t\t? id === options.surface\n\t\t\t: declaration.kind === 'rest-api' && declaration.endpoints.length === 0,\n\t);\n\n\tif (!target) return manifest;\n\n\tconst [id, declaration] = target;\n\tif (declaration.kind !== 'rest-api') return manifest;\n\n\treturn {\n\t\t...manifest,\n\t\t[id]: {\n\t\t\t...declaration,\n\t\t\tendpoints: routes.map((route) => asEndpoint(manifest, id, route)),\n\t\t},\n\t};\n}\n\n/**\n * Fold in the compute the build generated: functions, crons, queue workers and\n * topic subscribers.\n *\n * All four are named by their *export*, the same way an endpoint's handler is —\n * `CronGenerator` uses the export key as the name — so none of them can declare\n * themselves and all of them are the build's to add. That is why a `Function`\n * has no `declare()` and never will.\n *\n * A worker and a subscriber **nest** inside the queue or topic that triggers\n * them, because position carries the trigger. A function and a cron are\n * top-level, because nothing triggers them but a caller or a clock.\n */\nexport function withCompute(\n\tmanifest: ConstructManifest,\n\tcompute: {\n\t\tfunctions?: readonly FunctionInfo[];\n\t\tcrons?: readonly CronInfo[];\n\t\tqueues?: readonly QueueInfo[];\n\t\tsubscribers?: readonly SubscriberInfo[];\n\t\tprocessors?: readonly ProcessorInfo[];\n\t},\n): ConstructManifest {\n\tconst next: Record<string, Declaration> = { ...manifest };\n\n\tfor (const fn of compute.functions ?? []) {\n\t\tnext[fn.name] = {\n\t\t\tkind: 'function',\n\t\t\tid: fn.name,\n\t\t\thandler: fn.handler,\n\t\t\tdependencies: edgesTo(manifest, fn.dependencies),\n\t\t\tprovides: [provideKey(fn.name, 'url')],\n\t\t};\n\t}\n\n\tfor (const cron of compute.crons ?? []) {\n\t\tnext[cron.name] = {\n\t\t\tkind: 'cron',\n\t\t\tid: cron.name,\n\t\t\thandler: cron.handler,\n\t\t\tschedule: cron.schedule,\n\t\t\tdependencies: edgesTo(manifest, cron.dependencies),\n\t\t};\n\t}\n\n\t// A worker drains exactly one queue, so it is matched by the queue it names\n\t// rather than by anything about the handler.\n\tfor (const worker of compute.queues ?? []) {\n\t\tconst queue = next[canonicalId(worker.name)];\n\t\tif (queue?.kind !== 'queue') continue;\n\n\t\tnext[queue.id] = {\n\t\t\t...queue,\n\t\t\tworker: {\n\t\t\t\tid: `${queue.id}Worker`,\n\t\t\t\thandler: worker.handler,\n\t\t\t\tdependencies: edgesTo(manifest, worker.dependencies),\n\t\t\t},\n\t\t};\n\t}\n\n\tfor (const subscriber of compute.subscribers ?? []) {\n\t\t// A bucket's subscriber nests in the bucket, as a topic's does in the\n\t\t// topic: the storage is what triggers it.\n\t\tif (subscriber.bucket) {\n\t\t\tconst bucket = next[canonicalId(subscriber.bucket)];\n\t\t\tif (bucket?.kind !== 'objects') continue;\n\n\t\t\tnext[bucket.id] = {\n\t\t\t\t...bucket,\n\t\t\t\tsubscribers: [\n\t\t\t\t\t...(bucket.subscribers ?? []),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: subscriber.name,\n\t\t\t\t\t\thandler: subscriber.handler,\n\t\t\t\t\t\tevents: subscriber.subscribedEvents,\n\t\t\t\t\t\t...(subscriber.prefix ? { prefix: subscriber.prefix } : {}),\n\t\t\t\t\t\t...(subscriber.suffix ? { suffix: subscriber.suffix } : {}),\n\t\t\t\t\t\tdependencies: edgesTo(manifest, subscriber.dependencies),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst topicId = subscriber.topic && canonicalId(subscriber.topic);\n\t\tconst topic = topicId ? next[topicId] : undefined;\n\t\tif (topic?.kind !== 'topic') continue;\n\n\t\tnext[topic.id] = {\n\t\t\t...topic,\n\t\t\tsubscribers: [\n\t\t\t\t...topic.subscribers,\n\t\t\t\t{\n\t\t\t\t\tid: subscriber.name,\n\t\t\t\t\thandler: subscriber.handler,\n\t\t\t\t\tevents: subscriber.subscribedEvents,\n\t\t\t\t\tdependencies: edgesTo(manifest, subscriber.dependencies),\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t}\n\n\t// Discovery nested each processor with its source as its handler; the\n\t// build's is the one a target runs.\n\tfor (const processor of compute.processors ?? []) {\n\t\tconst server = next[processor.fileServer];\n\t\tif (server?.kind !== 'file-server') continue;\n\n\t\tnext[server.id] = {\n\t\t\t...server,\n\t\t\tprocessors: [\n\t\t\t\t...(server.processors ?? []).filter((p) => p.id !== processor.name),\n\t\t\t\t{\n\t\t\t\t\tid: processor.name,\n\t\t\t\t\thandler: processor.handler,\n\t\t\t\t\tpath: processor.path,\n\t\t\t\t\tprefix: processor.prefix,\n\t\t\t\t\t...(processor.native?.length ? { native: processor.native } : {}),\n\t\t\t\t\t...(processor.timeout !== undefined\n\t\t\t\t\t\t? { timeout: processor.timeout }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\t...(processor.memorySize !== undefined\n\t\t\t\t\t\t? { memorySize: processor.memorySize }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\tdependencies: edgesTo(manifest, processor.dependencies),\n\t\t\t\t},\n\t\t\t].sort((a, b) => a.id.localeCompare(b.id)),\n\t\t};\n\t}\n\n\treturn next;\n}\n\n/**\n * Construct ids as manifest edges.\n *\n * A `Dependency` carries the target's kind as well as its id, and the kind is\n * read off the manifest rather than recorded beside the edge — the same rule\n * `edgeTo` follows, for the same reason: a hand-written kind is one fact stated\n * twice, and the copy is what goes stale.\n *\n * An id that names nothing is dropped rather than thrown on. A handler can\n * depend on a construct that declares no node of its own — a lifted `Service`\n * is exactly that — and a build is the wrong place to refuse it; what a target\n * needs from this list is the subset it can actually grant.\n */\nfunction edgesTo(\n\tmanifest: ConstructManifest,\n\tids: readonly string[] = [],\n): Dependency[] {\n\treturn ids.flatMap((target) => {\n\t\tconst declaration = manifest[target];\n\n\t\treturn declaration ? [{ target, kind: declaration.kind }] : [];\n\t});\n}\n\n/** One generated route as the manifest's shape. */\nfunction asEndpoint(\n\tmanifest: ConstructManifest,\n\tsurface: string,\n\troute: RouteInfo,\n): RestApiEndpoint {\n\treturn {\n\t\t// The handler path is already unique per route and is what a target needs\n\t\t// to point a function at, so it is also the natural id.\n\t\tid: `${surface}${route.method}${route.path}`,\n\t\thandler: route.handler,\n\t\tmethod: route.method,\n\t\tpath: route.path,\n\t\t// The edges the handler declared, which is what a target reads to grant\n\t\t// this one function access to exactly those constructs. `environment` is\n\t\t// the same edges' shadow — the keys read — and cannot be turned back into\n\t\t// them, which is why the ids are carried rather than inferred.\n\t\tdependencies: edgesTo(manifest, route.dependencies),\n\t\t...(route.authorizer ? { authorizer: route.authorizer } : {}),\n\t};\n}\n\n/**\n * The manifest as TypeScript source.\n *\n * Pure, so what gets written can be asserted without touching a filesystem.\n */\nexport function manifestModule(\n\tmanifest: ConstructManifest,\n\tbackends: Backends = {},\n): string {\n\treturn `${HEADER}\nexport const constructs = ${serialise(manifest)} as const satisfies ConstructManifest;\n\n/**\n * Where the backends that are *config* rather than declaration resolved to.\n *\n * Recorded because they were being answered twice: once by the build, which\n * registers exactly one cache driver, and once by a deploy config, which told\n * the provisioner something else. The result was a deployed URL the running code\n * had no driver for — two documents disagreeing about one fact, which is what\n * this manifest exists to stop.\n */\nexport const backends = ${serialise(backends)} as const;\n\n// Derived types\nexport type Ids = IdsOf<typeof constructs>;\nexport type Construct<Id extends Ids> = DeclarationOf<typeof constructs, Id>;\nexport type Kind = Construct<Ids>['kind'];\n\n// Useful union types\nexport type ProvidedKeys = AllProvidedKeys<typeof constructs>;\nexport type Surfaces = IdsOfKind<typeof constructs, 'rest-api'>;\nexport type CacheBackend = (typeof backends)['cache'];\nexport type EmailBackend = (typeof backends)['email'];\n`;\n}\n\n/** The choices that are deployment config rather than declaration. */\nexport interface Backends {\n\tcache?: CacheBackend;\n\temail?: EmailBackend;\n}\n\nconst HEADER = `// Generated by \\`gkm build\\`. Do not edit.\n//\n// Discovery imports application code, so it runs once here rather than in every\n// consumer — a deploy config that discovered for itself would evaluate the whole\n// runtime graph inside its own toolchain. This is the result, as literals.\n\nimport type {\n\tAllProvidedKeys,\n\tConstructManifest,\n\tDeclarationOf,\n\tIdsOf,\n\tIdsOfKind,\n} from '@geekmidas/manifest';\n`;\n\n/**\n * JSON, re-indented with tabs and with keys left unquoted where they can be.\n *\n * Cosmetic, and worth it: this file is read by people trying to work out what\n * their app declares, and a wall of quoted keys reads as output rather than as\n * something anyone is expected to understand.\n */\nfunction serialise(value: object): string {\n\treturn JSON.stringify(value, null, '\\t')\n\t\t.replace(/^(\\t*)\"([A-Za-z_$][\\w$]*)\":/gm, '$1$2:')\n\t\t.replace(/\"/g, \"'\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,WACf,UACA,QACA,SACoB;CACpB,IAAI,OAAO,WAAW,KAAK,CAAC,QAAQ,UAAU,OAAO;CAErD,MAAM,SAAS,OAAO,QA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,IACnC,CAAC;IACJ,cAAc,QAAQ,UAAU,UAAU,YAAY;GACvD,CACD,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc,EAAE,EAAE,CAAC;EAC1C;CACD;CAEA,OAAO;AACR;;;;;;;;;;;;;;AAeA,SAAS,QACR,UACA,MAAyB,CAAC,GACX;CACf,OAAO,IAAI,SAAS,WAAW;EAC9B,MAAM,cAAc,SAAS;EAE7B,OAAO,cAAc,CAAC;GAAE;GAAQ,MAAM,YAAY;EAAK,CAAC,IAAI,CAAC;CAC9D,CAAC;AACF;;AAGA,SAAS,WACR,UACA,SACA,OACkB;CAClB,OAAO;EAGN,IAAI,GAAG,UAAU,MAAM,SAAS,MAAM;EACtC,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,MAAM,MAAM;EAKZ,cAAc,QAAQ,UAAU,MAAM,YAAY;EAClD,GAAI,MAAM,aAAa,EAAE,YAAY,MAAM,WAAW,IAAI,CAAC;CAC5D;AACD;;;;;;AAOA,SAAgB,eACf,UACA,WAAqB,CAAC,GACb;CACT,OAAO,GAAG,OAAO;4BACU,UAAU,QAAQ,EAAE;;;;;;;;;;;0BAWtB,UAAU,QAAQ,EAAE;;;;;;;;;;;;;AAa9C;AAQA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;AAsBf,SAAS,UAAU,OAAuB;CACzC,OAAO,KAAK,UAAU,OAAO,MAAM,GAAI,CAAC,CACtC,QAAQ,iCAAiC,OAAO,CAAC,CACjD,QAAQ,MAAM,GAAG;AACpB"}
|
|
@@ -112,6 +112,23 @@ function withCompute(manifest, compute) {
|
|
|
112
112
|
}]
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
+
for (const processor of compute.processors ?? []) {
|
|
116
|
+
const server = next[processor.fileServer];
|
|
117
|
+
if (server?.kind !== "file-server") continue;
|
|
118
|
+
next[server.id] = {
|
|
119
|
+
...server,
|
|
120
|
+
processors: [...(server.processors ?? []).filter((p) => p.id !== processor.name), {
|
|
121
|
+
id: processor.name,
|
|
122
|
+
handler: processor.handler,
|
|
123
|
+
path: processor.path,
|
|
124
|
+
prefix: processor.prefix,
|
|
125
|
+
...processor.native?.length ? { native: processor.native } : {},
|
|
126
|
+
...processor.timeout !== void 0 ? { timeout: processor.timeout } : {},
|
|
127
|
+
...processor.memorySize !== void 0 ? { memorySize: processor.memorySize } : {},
|
|
128
|
+
dependencies: edgesTo(manifest, processor.dependencies)
|
|
129
|
+
}].sort((a, b) => a.id.localeCompare(b.id))
|
|
130
|
+
};
|
|
131
|
+
}
|
|
115
132
|
return next;
|
|
116
133
|
}
|
|
117
134
|
/**
|
|
@@ -206,4 +223,4 @@ function serialise(value) {
|
|
|
206
223
|
//#endregion
|
|
207
224
|
export { withCompute as n, withRoutes as r, manifestModule as t };
|
|
208
225
|
|
|
209
|
-
//# sourceMappingURL=emit-
|
|
226
|
+
//# sourceMappingURL=emit-CiJGdy_f.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-CiJGdy_f.mjs","names":[],"sources":["../src/reconcile/emit.ts"],"sourcesContent":["/**\n * The manifest, written out as a module.\n *\n * Discovery imports the application's own code — that is how it finds\n * constructs — so anything calling it evaluates the whole runtime graph: React\n * email templates, database clients, modules that read env at import time. That\n * is fine inside `gkm dev`, which is already running the app. It is not fine\n * inside a deploy config, where it fails on the first thing the deploy toolchain\n * does not expect and would keep failing on the next.\n *\n * So discovery happens once, in the build, and everything downstream reads what\n * it wrote. The same split `RestApi` makes by naming a routes glob rather than\n * importing route modules.\n *\n * A module rather than JSON, because a manifest is not just data to this\n * codebase — `as const satisfies ConstructManifest` is what keeps every id,\n * kind and provided key a *literal*, so `IdsOf`, `ProvidedKeys` and the rest\n * can select out of it. `JSON.parse` returns `any` and gives all of that up.\n */\n\nimport type {\n\tConstructManifest,\n\tCronInfo,\n\tDeclaration,\n\tDependency,\n\tFunctionInfo,\n\tProcessorInfo,\n\tQueueInfo,\n\tRestApiEndpoint,\n\tRouteInfo,\n\tSubscriberInfo,\n} from '@geekmidas/manifest';\nimport { canonicalId, provideKey } from '@geekmidas/manifest';\nimport type { CacheBackend, EmailBackend } from '../types.js';\n\n/**\n * Fold the build's generated routes into the surface that serves them.\n *\n * The routes already exist: `gkm build` generates one handler per endpoint and\n * records its path, method and environment. What was missing is that the\n * *construct* manifest never learned about them, so a `rest-api` node said\n * `endpoints: []` while five handlers sat in `.gkm/`. Two documents describing\n * the same routes, one of them wrong.\n *\n * Merging here rather than making the construct name a glob or import its\n * endpoints: the build is the thing that already walked the filesystem and\n * already knows where it wrote each handler. Asking the declaration to restate\n * any of that is how the two come to disagree.\n *\n * Attribution is to the surface the build served — the one whose `path` is\n * the app being built. Without one, routes go to the surface that declared none\n * of its own; a surface with static endpoints (an auth server's single\n * wildcard) keeps them.\n *\n * **Only from a provider that generates one handler per route.** The `server`\n * provider generates a single catch-all — `ALL *` pointing at the Hono app that\n * routes in-process — which is a true description of that build and a false\n * description of the application. Merging it wrote `endpoints: [{ method:\n * 'ALL', path: '*' }]` into a manifest for an app with five routes, and made the\n * document's contents depend on which `--provider` ran last. A manifest must not\n * do that.\n */\nexport function withRoutes(\n\tmanifest: ConstructManifest,\n\troutes: readonly RouteInfo[],\n\toptions: { perRoute: boolean; surface?: string },\n): ConstructManifest {\n\tif (routes.length === 0 || !options.perRoute) return manifest;\n\n\tconst target = Object.entries(manifest).find(([id, declaration]) =>\n\t\toptions.surface\n\t\t\t? id === options.surface\n\t\t\t: declaration.kind === 'rest-api' && declaration.endpoints.length === 0,\n\t);\n\n\tif (!target) return manifest;\n\n\tconst [id, declaration] = target;\n\tif (declaration.kind !== 'rest-api') return manifest;\n\n\treturn {\n\t\t...manifest,\n\t\t[id]: {\n\t\t\t...declaration,\n\t\t\tendpoints: routes.map((route) => asEndpoint(manifest, id, route)),\n\t\t},\n\t};\n}\n\n/**\n * Fold in the compute the build generated: functions, crons, queue workers and\n * topic subscribers.\n *\n * All four are named by their *export*, the same way an endpoint's handler is —\n * `CronGenerator` uses the export key as the name — so none of them can declare\n * themselves and all of them are the build's to add. That is why a `Function`\n * has no `declare()` and never will.\n *\n * A worker and a subscriber **nest** inside the queue or topic that triggers\n * them, because position carries the trigger. A function and a cron are\n * top-level, because nothing triggers them but a caller or a clock.\n */\nexport function withCompute(\n\tmanifest: ConstructManifest,\n\tcompute: {\n\t\tfunctions?: readonly FunctionInfo[];\n\t\tcrons?: readonly CronInfo[];\n\t\tqueues?: readonly QueueInfo[];\n\t\tsubscribers?: readonly SubscriberInfo[];\n\t\tprocessors?: readonly ProcessorInfo[];\n\t},\n): ConstructManifest {\n\tconst next: Record<string, Declaration> = { ...manifest };\n\n\tfor (const fn of compute.functions ?? []) {\n\t\tnext[fn.name] = {\n\t\t\tkind: 'function',\n\t\t\tid: fn.name,\n\t\t\thandler: fn.handler,\n\t\t\tdependencies: edgesTo(manifest, fn.dependencies),\n\t\t\tprovides: [provideKey(fn.name, 'url')],\n\t\t};\n\t}\n\n\tfor (const cron of compute.crons ?? []) {\n\t\tnext[cron.name] = {\n\t\t\tkind: 'cron',\n\t\t\tid: cron.name,\n\t\t\thandler: cron.handler,\n\t\t\tschedule: cron.schedule,\n\t\t\tdependencies: edgesTo(manifest, cron.dependencies),\n\t\t};\n\t}\n\n\t// A worker drains exactly one queue, so it is matched by the queue it names\n\t// rather than by anything about the handler.\n\tfor (const worker of compute.queues ?? []) {\n\t\tconst queue = next[canonicalId(worker.name)];\n\t\tif (queue?.kind !== 'queue') continue;\n\n\t\tnext[queue.id] = {\n\t\t\t...queue,\n\t\t\tworker: {\n\t\t\t\tid: `${queue.id}Worker`,\n\t\t\t\thandler: worker.handler,\n\t\t\t\tdependencies: edgesTo(manifest, worker.dependencies),\n\t\t\t},\n\t\t};\n\t}\n\n\tfor (const subscriber of compute.subscribers ?? []) {\n\t\t// A bucket's subscriber nests in the bucket, as a topic's does in the\n\t\t// topic: the storage is what triggers it.\n\t\tif (subscriber.bucket) {\n\t\t\tconst bucket = next[canonicalId(subscriber.bucket)];\n\t\t\tif (bucket?.kind !== 'objects') continue;\n\n\t\t\tnext[bucket.id] = {\n\t\t\t\t...bucket,\n\t\t\t\tsubscribers: [\n\t\t\t\t\t...(bucket.subscribers ?? []),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: subscriber.name,\n\t\t\t\t\t\thandler: subscriber.handler,\n\t\t\t\t\t\tevents: subscriber.subscribedEvents,\n\t\t\t\t\t\t...(subscriber.prefix ? { prefix: subscriber.prefix } : {}),\n\t\t\t\t\t\t...(subscriber.suffix ? { suffix: subscriber.suffix } : {}),\n\t\t\t\t\t\tdependencies: edgesTo(manifest, subscriber.dependencies),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst topicId = subscriber.topic && canonicalId(subscriber.topic);\n\t\tconst topic = topicId ? next[topicId] : undefined;\n\t\tif (topic?.kind !== 'topic') continue;\n\n\t\tnext[topic.id] = {\n\t\t\t...topic,\n\t\t\tsubscribers: [\n\t\t\t\t...topic.subscribers,\n\t\t\t\t{\n\t\t\t\t\tid: subscriber.name,\n\t\t\t\t\thandler: subscriber.handler,\n\t\t\t\t\tevents: subscriber.subscribedEvents,\n\t\t\t\t\tdependencies: edgesTo(manifest, subscriber.dependencies),\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t}\n\n\t// Discovery nested each processor with its source as its handler; the\n\t// build's is the one a target runs.\n\tfor (const processor of compute.processors ?? []) {\n\t\tconst server = next[processor.fileServer];\n\t\tif (server?.kind !== 'file-server') continue;\n\n\t\tnext[server.id] = {\n\t\t\t...server,\n\t\t\tprocessors: [\n\t\t\t\t...(server.processors ?? []).filter((p) => p.id !== processor.name),\n\t\t\t\t{\n\t\t\t\t\tid: processor.name,\n\t\t\t\t\thandler: processor.handler,\n\t\t\t\t\tpath: processor.path,\n\t\t\t\t\tprefix: processor.prefix,\n\t\t\t\t\t...(processor.native?.length ? { native: processor.native } : {}),\n\t\t\t\t\t...(processor.timeout !== undefined\n\t\t\t\t\t\t? { timeout: processor.timeout }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\t...(processor.memorySize !== undefined\n\t\t\t\t\t\t? { memorySize: processor.memorySize }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\tdependencies: edgesTo(manifest, processor.dependencies),\n\t\t\t\t},\n\t\t\t].sort((a, b) => a.id.localeCompare(b.id)),\n\t\t};\n\t}\n\n\treturn next;\n}\n\n/**\n * Construct ids as manifest edges.\n *\n * A `Dependency` carries the target's kind as well as its id, and the kind is\n * read off the manifest rather than recorded beside the edge — the same rule\n * `edgeTo` follows, for the same reason: a hand-written kind is one fact stated\n * twice, and the copy is what goes stale.\n *\n * An id that names nothing is dropped rather than thrown on. A handler can\n * depend on a construct that declares no node of its own — a lifted `Service`\n * is exactly that — and a build is the wrong place to refuse it; what a target\n * needs from this list is the subset it can actually grant.\n */\nfunction edgesTo(\n\tmanifest: ConstructManifest,\n\tids: readonly string[] = [],\n): Dependency[] {\n\treturn ids.flatMap((target) => {\n\t\tconst declaration = manifest[target];\n\n\t\treturn declaration ? [{ target, kind: declaration.kind }] : [];\n\t});\n}\n\n/** One generated route as the manifest's shape. */\nfunction asEndpoint(\n\tmanifest: ConstructManifest,\n\tsurface: string,\n\troute: RouteInfo,\n): RestApiEndpoint {\n\treturn {\n\t\t// The handler path is already unique per route and is what a target needs\n\t\t// to point a function at, so it is also the natural id.\n\t\tid: `${surface}${route.method}${route.path}`,\n\t\thandler: route.handler,\n\t\tmethod: route.method,\n\t\tpath: route.path,\n\t\t// The edges the handler declared, which is what a target reads to grant\n\t\t// this one function access to exactly those constructs. `environment` is\n\t\t// the same edges' shadow — the keys read — and cannot be turned back into\n\t\t// them, which is why the ids are carried rather than inferred.\n\t\tdependencies: edgesTo(manifest, route.dependencies),\n\t\t...(route.authorizer ? { authorizer: route.authorizer } : {}),\n\t};\n}\n\n/**\n * The manifest as TypeScript source.\n *\n * Pure, so what gets written can be asserted without touching a filesystem.\n */\nexport function manifestModule(\n\tmanifest: ConstructManifest,\n\tbackends: Backends = {},\n): string {\n\treturn `${HEADER}\nexport const constructs = ${serialise(manifest)} as const satisfies ConstructManifest;\n\n/**\n * Where the backends that are *config* rather than declaration resolved to.\n *\n * Recorded because they were being answered twice: once by the build, which\n * registers exactly one cache driver, and once by a deploy config, which told\n * the provisioner something else. The result was a deployed URL the running code\n * had no driver for — two documents disagreeing about one fact, which is what\n * this manifest exists to stop.\n */\nexport const backends = ${serialise(backends)} as const;\n\n// Derived types\nexport type Ids = IdsOf<typeof constructs>;\nexport type Construct<Id extends Ids> = DeclarationOf<typeof constructs, Id>;\nexport type Kind = Construct<Ids>['kind'];\n\n// Useful union types\nexport type ProvidedKeys = AllProvidedKeys<typeof constructs>;\nexport type Surfaces = IdsOfKind<typeof constructs, 'rest-api'>;\nexport type CacheBackend = (typeof backends)['cache'];\nexport type EmailBackend = (typeof backends)['email'];\n`;\n}\n\n/** The choices that are deployment config rather than declaration. */\nexport interface Backends {\n\tcache?: CacheBackend;\n\temail?: EmailBackend;\n}\n\nconst HEADER = `// Generated by \\`gkm build\\`. Do not edit.\n//\n// Discovery imports application code, so it runs once here rather than in every\n// consumer — a deploy config that discovered for itself would evaluate the whole\n// runtime graph inside its own toolchain. This is the result, as literals.\n\nimport type {\n\tAllProvidedKeys,\n\tConstructManifest,\n\tDeclarationOf,\n\tIdsOf,\n\tIdsOfKind,\n} from '@geekmidas/manifest';\n`;\n\n/**\n * JSON, re-indented with tabs and with keys left unquoted where they can be.\n *\n * Cosmetic, and worth it: this file is read by people trying to work out what\n * their app declares, and a wall of quoted keys reads as output rather than as\n * something anyone is expected to understand.\n */\nfunction serialise(value: object): string {\n\treturn JSON.stringify(value, null, '\\t')\n\t\t.replace(/^(\\t*)\"([A-Za-z_$][\\w$]*)\":/gm, '$1$2:')\n\t\t.replace(/\"/g, \"'\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,SAAgB,WACf,UACA,QACA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,IACnC,CAAC;IACJ,cAAc,QAAQ,UAAU,UAAU,YAAY;GACvD,CACD,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc,EAAE,EAAE,CAAC;EAC1C;CACD;CAEA,OAAO;AACR;;;;;;;;;;;;;;AAeA,SAAS,QACR,UACA,MAAyB,CAAC,GACX;CACf,OAAO,IAAI,SAAS,WAAW;EAC9B,MAAM,cAAc,SAAS;EAE7B,OAAO,cAAc,CAAC;GAAE;GAAQ,MAAM,YAAY;EAAK,CAAC,IAAI,CAAC;CAC9D,CAAC;AACF;;AAGA,SAAS,WACR,UACA,SACA,OACkB;CAClB,OAAO;EAGN,IAAI,GAAG,UAAU,MAAM,SAAS,MAAM;EACtC,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,MAAM,MAAM;EAKZ,cAAc,QAAQ,UAAU,MAAM,YAAY;EAClD,GAAI,MAAM,aAAa,EAAE,YAAY,MAAM,WAAW,IAAI,CAAC;CAC5D;AACD;;;;;;AAOA,SAAgB,eACf,UACA,WAAqB,CAAC,GACb;CACT,OAAO,GAAG,OAAO;4BACU,UAAU,QAAQ,EAAE;;;;;;;;;;;0BAWtB,UAAU,QAAQ,EAAE;;;;;;;;;;;;;AAa9C;AAQA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;AAsBf,SAAS,UAAU,OAAuB;CACzC,OAAO,KAAK,UAAU,OAAO,MAAM,GAAI,CAAC,CACtC,QAAQ,iCAAiC,OAAO,CAAC,CACjD,QAAQ,MAAM,GAAG;AACpB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
|
|
2
|
-
import { N as assertDeployedStage } from "./workspace-
|
|
3
|
-
import {
|
|
2
|
+
import { N as assertDeployedStage } from "./workspace-DBHF9Gba.mjs";
|
|
3
|
+
import { Rt as providerOf, Yt as secretsStoreFor, nn as withCustomSecret } from "./seeds-Cfejy8wj.mjs";
|
|
4
4
|
import { loadWorkspaceSettings } from "./config.mjs";
|
|
5
5
|
import { canonicalId, provideKey } from "@geekmidas/manifest";
|
|
6
6
|
import { parseKeyring, retireKey, rotateKeyring } from "@geekmidas/constructs/encryption";
|
|
@@ -86,4 +86,4 @@ async function updateKeyring(construct, { stage }, context, update) {
|
|
|
86
86
|
//#endregion
|
|
87
87
|
export { encryptionRetireCommand, encryptionRotateCommand };
|
|
88
88
|
|
|
89
|
-
//# sourceMappingURL=encryption-
|
|
89
|
+
//# sourceMappingURL=encryption-BFSrt89F.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption-
|
|
1
|
+
{"version":3,"file":"encryption-BFSrt89F.mjs","names":[],"sources":["../src/encryption/index.ts"],"sourcesContent":["/**\n * `gkm encryption:rotate` and `gkm encryption:retire` — the keyring of an\n * `Encryption` construct on a server stage.\n *\n * Rotating adds a key in front and keeps every older one, so what they wrote\n * still opens. Retiring removes one, and is the half that makes rotating worth\n * doing: until a key is gone, it still opens everything it ever wrote. It is\n * never automatic, because the only thing that knows nothing is left under a\n * key is the sweep that re-encrypted the column — so it is done after one,\n * deliberately, by name.\n *\n * Neither applies everywhere, and each says so rather than doing something\n * that looks right: a local stage's keyring is derived and would be replaced on\n * the next `gkm dev`, and on AWS the key is KMS's, which rotates it itself and\n * never strands a value.\n */\n\nimport {\n\tparseKeyring,\n\tretireKey,\n\trotateKeyring,\n} from '@geekmidas/constructs/encryption';\nimport { canonicalId, provideKey } from '@geekmidas/manifest';\nimport { loadWorkspaceSettings } from '../config';\nimport { GkmError } from '../errors';\nimport { withCustomSecret } from '../secrets/storage.js';\nimport { type SecretsStore, secretsStoreFor } from '../secrets/store.js';\nimport { providerOf } from '../workspace/backends.js';\nimport { assertDeployedStage } from '../workspace/stages.js';\nimport type { NormalizedWorkspace } from '../workspace/types.js';\n\nconst logger = console;\n\nexport class LocalKeyringIsDerived extends GkmError {\n\tconstructor(\n\t\treadonly construct: string,\n\t\treadonly stage: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' is the local stage, where ${construct}'s keyring is derived from the project and stage — nothing stored there would be read. Rotate a deployed stage: gkm encryption:rotate ${construct} --stage <stage>.`,\n\t\t);\n\t\tthis.name = 'LocalKeyringIsDerived';\n\t}\n}\n\nexport class KmsRotatesItself extends GkmError {\n\tconstructor(readonly construct: string) {\n\t\tsuper(\n\t\t\t`${construct} is a KMS key on AWS: KMS rotates it yearly and keeps every version, so no value is ever stranded and there is no key to retire. Nothing to do here.`,\n\t\t);\n\t\tthis.name = 'KmsRotatesItself';\n\t}\n}\n\nexport class NoKeyringYet extends GkmError {\n\tconstructor(\n\t\treadonly construct: string,\n\t\treadonly stage: string,\n\t\treadonly key: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' has no ${key} yet. The first deploy generates ${construct}'s keyring: gkm deploy --stage ${stage}.`,\n\t\t);\n\t\tthis.name = 'NoKeyringYet';\n\t}\n}\n\nexport interface EncryptionCommandOptions {\n\tstage: string;\n}\n\n/** Where a command reads and writes; the real ones unless a test says. */\nexport interface EncryptionCommandContext {\n\tworkspace?: NormalizedWorkspace;\n\tstore?: SecretsStore;\n}\n\nexport async function encryptionRotateCommand(\n\tconstruct: string,\n\toptions: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext = {},\n): Promise<string> {\n\treturn updateKeyring(construct, options, context, (id, url) => {\n\t\tconst next = rotateKeyring(id, url);\n\t\tconst [current, ...older] = parseKeyring(id, next).keys.map(({ id }) => id);\n\n\t\tlogger.log(`\\n✓ ${id} on '${options.stage}' now writes with '${current}'.`);\n\t\tlogger.log(\n\t\t\t` Still opening: ${older.join(', ')}. Redeploy to start writing with '${current}', reencrypt what is stored, then: gkm encryption:retire ${id} <key> --stage ${options.stage}`,\n\t\t);\n\t\treturn next;\n\t});\n}\n\nexport async function encryptionRetireCommand(\n\tconstruct: string,\n\tkeyId: string,\n\toptions: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext = {},\n): Promise<string> {\n\treturn updateKeyring(construct, options, context, (id, url) => {\n\t\tconst next = retireKey(id, url, keyId);\n\n\t\tlogger.log(\n\t\t\t`\\n✓ ${id} on '${options.stage}' no longer holds '${keyId}'. Anything still under it cannot be read after the next deploy.`,\n\t\t);\n\t\treturn next;\n\t});\n}\n\nasync function updateKeyring(\n\tconstruct: string,\n\t{ stage }: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext,\n\tupdate: (id: string, url: string) => string,\n): Promise<string> {\n\tconst workspace = context.workspace ?? (await loadWorkspaceSettings());\n\tconst id = canonicalId(construct);\n\n\tif (stage === workspace.stages.local) {\n\t\tthrow new LocalKeyringIsDerived(id, stage);\n\t}\n\tassertDeployedStage(workspace.stages, stage);\n\tif (providerOf(workspace) === 'aws') throw new KmsRotatesItself(id);\n\n\tconst store = context.store ?? (await secretsStoreFor(workspace, stage));\n\tconst key = provideKey(id, 'url');\n\tconst secrets = await store.read(stage);\n\tconst url = secrets?.custom[key];\n\tif (!secrets || !url) throw new NoKeyringYet(id, stage, key);\n\n\tconst next = update(id, url);\n\tawait store.write(stage, withCustomSecret(secrets, key, next));\n\treturn next;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,SAAS;AAEf,IAAa,wBAAb,cAA2C,SAAS;CAEzC;CACA;CAFV,YACC,WACA,OACC;EACD,MACC,IAAI,MAAM,8BAA8B,UAAU,wIAAwI,UAAU,kBACrM;EALS,KAAA,YAAA;EACA,KAAA,QAAA;EAKT,KAAK,OAAO;CACb;AACD;AAEA,IAAa,mBAAb,cAAsC,SAAS;CACzB;CAArB,YAAY,WAA4B;EACvC,MACC,GAAG,UAAU,qJACd;EAHoB,KAAA,YAAA;EAIpB,KAAK,OAAO;CACb;AACD;AAEA,IAAa,eAAb,cAAkC,SAAS;CAEhC;CACA;CACA;CAHV,YACC,WACA,OACA,KACC;EACD,MACC,IAAI,MAAM,WAAW,IAAI,mCAAmC,UAAU,iCAAiC,MAAM,EAC9G;EANS,KAAA,YAAA;EAC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AM,IAAI,aAAa,IAAI,OAAO,GAAG;CAE3D,MAAM,OAAO,OAAO,IAAI,GAAG;CAC3B,MAAM,MAAM,MAAM,OAAO,iBAAiB,SAAS,KAAK,IAAI,CAAC;CAC7D,OAAO;AACR"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_errors = require("./errors-DMC4Umsb.cjs");
|
|
2
|
-
const require_workspace = require("./workspace-
|
|
3
|
-
const require_seeds = require("./seeds-
|
|
2
|
+
const require_workspace = require("./workspace-Du4Afb03.cjs");
|
|
3
|
+
const require_seeds = require("./seeds-3awh33Wz.cjs");
|
|
4
4
|
const require_config = require("./config.cjs");
|
|
5
5
|
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
6
6
|
let _geekmidas_constructs_encryption = require("@geekmidas/constructs/encryption");
|
|
@@ -87,4 +87,4 @@ async function updateKeyring(construct, { stage }, context, update) {
|
|
|
87
87
|
exports.encryptionRetireCommand = encryptionRetireCommand;
|
|
88
88
|
exports.encryptionRotateCommand = encryptionRotateCommand;
|
|
89
89
|
|
|
90
|
-
//# sourceMappingURL=encryption-
|
|
90
|
+
//# sourceMappingURL=encryption-RNcBnG4Z.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption-
|
|
1
|
+
{"version":3,"file":"encryption-RNcBnG4Z.cjs","names":["GkmError","rotateKeyring","parseKeyring","retireKey","loadWorkspaceSettings","canonicalId","providerOf","secretsStoreFor","provideKey","withCustomSecret"],"sources":["../src/encryption/index.ts"],"sourcesContent":["/**\n * `gkm encryption:rotate` and `gkm encryption:retire` — the keyring of an\n * `Encryption` construct on a server stage.\n *\n * Rotating adds a key in front and keeps every older one, so what they wrote\n * still opens. Retiring removes one, and is the half that makes rotating worth\n * doing: until a key is gone, it still opens everything it ever wrote. It is\n * never automatic, because the only thing that knows nothing is left under a\n * key is the sweep that re-encrypted the column — so it is done after one,\n * deliberately, by name.\n *\n * Neither applies everywhere, and each says so rather than doing something\n * that looks right: a local stage's keyring is derived and would be replaced on\n * the next `gkm dev`, and on AWS the key is KMS's, which rotates it itself and\n * never strands a value.\n */\n\nimport {\n\tparseKeyring,\n\tretireKey,\n\trotateKeyring,\n} from '@geekmidas/constructs/encryption';\nimport { canonicalId, provideKey } from '@geekmidas/manifest';\nimport { loadWorkspaceSettings } from '../config';\nimport { GkmError } from '../errors';\nimport { withCustomSecret } from '../secrets/storage.js';\nimport { type SecretsStore, secretsStoreFor } from '../secrets/store.js';\nimport { providerOf } from '../workspace/backends.js';\nimport { assertDeployedStage } from '../workspace/stages.js';\nimport type { NormalizedWorkspace } from '../workspace/types.js';\n\nconst logger = console;\n\nexport class LocalKeyringIsDerived extends GkmError {\n\tconstructor(\n\t\treadonly construct: string,\n\t\treadonly stage: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' is the local stage, where ${construct}'s keyring is derived from the project and stage — nothing stored there would be read. Rotate a deployed stage: gkm encryption:rotate ${construct} --stage <stage>.`,\n\t\t);\n\t\tthis.name = 'LocalKeyringIsDerived';\n\t}\n}\n\nexport class KmsRotatesItself extends GkmError {\n\tconstructor(readonly construct: string) {\n\t\tsuper(\n\t\t\t`${construct} is a KMS key on AWS: KMS rotates it yearly and keeps every version, so no value is ever stranded and there is no key to retire. Nothing to do here.`,\n\t\t);\n\t\tthis.name = 'KmsRotatesItself';\n\t}\n}\n\nexport class NoKeyringYet extends GkmError {\n\tconstructor(\n\t\treadonly construct: string,\n\t\treadonly stage: string,\n\t\treadonly key: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' has no ${key} yet. The first deploy generates ${construct}'s keyring: gkm deploy --stage ${stage}.`,\n\t\t);\n\t\tthis.name = 'NoKeyringYet';\n\t}\n}\n\nexport interface EncryptionCommandOptions {\n\tstage: string;\n}\n\n/** Where a command reads and writes; the real ones unless a test says. */\nexport interface EncryptionCommandContext {\n\tworkspace?: NormalizedWorkspace;\n\tstore?: SecretsStore;\n}\n\nexport async function encryptionRotateCommand(\n\tconstruct: string,\n\toptions: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext = {},\n): Promise<string> {\n\treturn updateKeyring(construct, options, context, (id, url) => {\n\t\tconst next = rotateKeyring(id, url);\n\t\tconst [current, ...older] = parseKeyring(id, next).keys.map(({ id }) => id);\n\n\t\tlogger.log(`\\n✓ ${id} on '${options.stage}' now writes with '${current}'.`);\n\t\tlogger.log(\n\t\t\t` Still opening: ${older.join(', ')}. Redeploy to start writing with '${current}', reencrypt what is stored, then: gkm encryption:retire ${id} <key> --stage ${options.stage}`,\n\t\t);\n\t\treturn next;\n\t});\n}\n\nexport async function encryptionRetireCommand(\n\tconstruct: string,\n\tkeyId: string,\n\toptions: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext = {},\n): Promise<string> {\n\treturn updateKeyring(construct, options, context, (id, url) => {\n\t\tconst next = retireKey(id, url, keyId);\n\n\t\tlogger.log(\n\t\t\t`\\n✓ ${id} on '${options.stage}' no longer holds '${keyId}'. Anything still under it cannot be read after the next deploy.`,\n\t\t);\n\t\treturn next;\n\t});\n}\n\nasync function updateKeyring(\n\tconstruct: string,\n\t{ stage }: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext,\n\tupdate: (id: string, url: string) => string,\n): Promise<string> {\n\tconst workspace = context.workspace ?? (await loadWorkspaceSettings());\n\tconst id = canonicalId(construct);\n\n\tif (stage === workspace.stages.local) {\n\t\tthrow new LocalKeyringIsDerived(id, stage);\n\t}\n\tassertDeployedStage(workspace.stages, stage);\n\tif (providerOf(workspace) === 'aws') throw new KmsRotatesItself(id);\n\n\tconst store = context.store ?? (await secretsStoreFor(workspace, stage));\n\tconst key = provideKey(id, 'url');\n\tconst secrets = await store.read(stage);\n\tconst url = secrets?.custom[key];\n\tif (!secrets || !url) throw new NoKeyringYet(id, stage, key);\n\n\tconst next = update(id, url);\n\tawait store.write(stage, withCustomSecret(secrets, key, next));\n\treturn next;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA+BA,MA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O,IACN,OAAO,GAAG,OAAO,QAAQ,MAAM,qBAAqB,MAAM,iEAC3D;EACA,OAAO;CACR,CAAC;AACF;AAEA,eAAe,cACd,WACA,EAAE,SACF,SACA,QACkB;CAClB,MAAM,YAAY,QAAQ,aAAc,MAAMC,eAAAA,sBAAsB;CACpE,MAAM,MAAA,GAAKC,oBAAAA,YAAAA,CAAY,SAAS;CAEhC,IAAI,UAAU,UAAU,OAAO,OAC9B,MAAM,IAAI,sBAAsB,IAAI,KAAK;CAE1C,kBAAA,oBAAoB,UAAU,QAAQ,KAAK;CAC3C,IAAIC,cAAAA,WAAW,SAAS,MAAM,OAAO,MAAM,IAAI,iBAAiB,EAAE;CAElE,MAAM,QAAQ,QAAQ,SAAU,MAAMC,cAAAA,gBAAgB,WAAW,KAAK;CACtE,MAAM,OAAA,GAAMC,oBAAAA,WAAAA,CAAW,IAAI,KAAK;CAChC,MAAM,UAAU,MAAM,MAAM,KAAK,KAAK;CACtC,MAAM,MAAM,SAAS,OAAO;CAC5B,IAAI,CAAC,WAAW,CAAC,KAAK,MAAM,IAAI,aAAa,IAAI,OAAO,GAAG;CAE3D,MAAM,OAAO,OAAO,IAAI,GAAG;CAC3B,MAAM,MAAM,MAAM,OAAOC,cAAAA,iBAAiB,SAAS,KAAK,IAAI,CAAC;CAC7D,OAAO;AACR"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
const require_errors = require("./errors-DMC4Umsb.cjs");
|
|
2
2
|
const require_credentials = require("./credentials-D7XJypNd.cjs");
|
|
3
|
-
const require_workspace = require("./workspace-
|
|
3
|
+
const require_workspace = require("./workspace-Du4Afb03.cjs");
|
|
4
4
|
const require_schemas = require("./schemas-BQ_v0lEX.cjs");
|
|
5
|
-
const require_seeds = require("./seeds-
|
|
5
|
+
const require_seeds = require("./seeds-3awh33Wz.cjs");
|
|
6
6
|
const require_derive = require("./derive-DAbo49sm.cjs");
|
|
7
7
|
const require_identity = require("./identity-CbLfgQNT.cjs");
|
|
8
|
-
const require_discover = require("./discover-
|
|
8
|
+
const require_discover = require("./discover-DL6h-J97.cjs");
|
|
9
9
|
const require_sandbox = require("./sandbox-CHv3OYXg.cjs");
|
|
10
10
|
const require_local = require("./local-OPC9BCZt.cjs");
|
|
11
|
-
const require_sniffer = require("./sniffer-
|
|
12
|
-
const require_databases = require("./databases-
|
|
11
|
+
const require_sniffer = require("./sniffer-Cq1nhxIB.cjs");
|
|
12
|
+
const require_databases = require("./databases-CuVGf7-M.cjs");
|
|
13
13
|
let node_path = require("node:path");
|
|
14
14
|
let node_fs_promises = require("node:fs/promises");
|
|
15
15
|
let node_os = require("node:os");
|
|
@@ -1611,7 +1611,8 @@ async function runMigrations(options) {
|
|
|
1611
1611
|
root: options.root,
|
|
1612
1612
|
stage: options.stage,
|
|
1613
1613
|
manifest: options.manifest,
|
|
1614
|
-
patterns: options.patterns
|
|
1614
|
+
patterns: options.patterns,
|
|
1615
|
+
backends: options.backends
|
|
1615
1616
|
})],
|
|
1616
1617
|
cwd: options.root,
|
|
1617
1618
|
timeoutMs: options.timeoutMs ?? 9e5,
|
|
@@ -1837,6 +1838,24 @@ var BackendDeployFailed = class extends Error {
|
|
|
1837
1838
|
}
|
|
1838
1839
|
};
|
|
1839
1840
|
/**
|
|
1841
|
+
* A file server's processors on a Dokploy stage nothing can reach: Dokploy
|
|
1842
|
+
* serves a file server on MinIO itself, path-style, with no host of its own
|
|
1843
|
+
* to route a pattern on, so only the CDN in front of an S3 bucket reaches a
|
|
1844
|
+
* processor unit — and that CDN's deploy records the secret it sends.
|
|
1845
|
+
*/
|
|
1846
|
+
var ProcessorsNeedCdn = class extends Error {
|
|
1847
|
+
fileServer;
|
|
1848
|
+
secretKey;
|
|
1849
|
+
stage;
|
|
1850
|
+
constructor(fileServer, secretKey, stage) {
|
|
1851
|
+
super(`'${fileServer}' has processors, and on Dokploy only the CDN in front of an S3 bucket can reach them: the stage '${stage}' has no domain, or no ${secretKey}, which the s3 provider writes when it puts a CDN in front of the bucket. Give the stage a domain and deploy.objects.${stage}: { provider: 's3' }, then deploy again.`);
|
|
1852
|
+
this.fileServer = fileServer;
|
|
1853
|
+
this.secretKey = secretKey;
|
|
1854
|
+
this.stage = stage;
|
|
1855
|
+
this.name = "ProcessorsNeedCdn";
|
|
1856
|
+
}
|
|
1857
|
+
};
|
|
1858
|
+
/**
|
|
1840
1859
|
* Sites failed to release or to answer. Every site is attempted before this
|
|
1841
1860
|
* is thrown, so one broken site does not keep the others back — but the run
|
|
1842
1861
|
* fails, and what failed is rolled back.
|
|
@@ -1952,10 +1971,13 @@ async function validateDokploy(phase) {
|
|
|
1952
1971
|
const background = phase.background ?? {};
|
|
1953
1972
|
const workers = require_seeds.workerUnits(workspace, phase.manifest, background).filter((worker) => appsToDeployNames.includes(worker.app));
|
|
1954
1973
|
if (workers.length > 0) logger.log(` Deploying workers: ${workers.map((w) => `${w.name} (from ${w.app})`).join(", ")}`);
|
|
1974
|
+
const processors = require_seeds.processorUnits(workspace, phase.manifest).filter((unit) => appsToDeployNames.includes(unit.app));
|
|
1975
|
+
if (processors.length > 0) logger.log(` Deploying processors: ${processors.map((p) => `${p.name} (from ${p.app})`).join(", ")}`);
|
|
1955
1976
|
return {
|
|
1956
1977
|
...run,
|
|
1957
1978
|
devServices: devServices.map((use) => use.service),
|
|
1958
1979
|
workers,
|
|
1980
|
+
processors,
|
|
1959
1981
|
runnables,
|
|
1960
1982
|
preflight: await preflight(run),
|
|
1961
1983
|
verify: verifySettings(workspace.deploy.dokploy?.verify),
|
|
@@ -2290,7 +2312,7 @@ async function releaseDokploy(run) {
|
|
|
2290
2312
|
* attach its domain, and wait for Dokploy to finish — then record the
|
|
2291
2313
|
* release, with what ran before it as the one a rollback restores.
|
|
2292
2314
|
*/
|
|
2293
|
-
const release = async (appName, applicationId, image, envVars, host) => {
|
|
2315
|
+
const release = async (appName, applicationId, image, envVars, host, port = workspace.apps[appName]?.port) => {
|
|
2294
2316
|
released.applicationIds.set(appName, applicationId);
|
|
2295
2317
|
const since = await api.latestDeploymentAt(applicationId);
|
|
2296
2318
|
const before = state.releases?.[appName]?.current;
|
|
@@ -2303,7 +2325,7 @@ async function releaseDokploy(run) {
|
|
|
2303
2325
|
logger.log(` Deploying to Dokploy...`);
|
|
2304
2326
|
await api.deployApplication(applicationId);
|
|
2305
2327
|
if (host) {
|
|
2306
|
-
const domainId = await ensureDomain(api, journal, host,
|
|
2328
|
+
const domainId = await ensureDomain(api, journal, host, port, applicationId, applied);
|
|
2307
2329
|
appHostnames.set(appName, host);
|
|
2308
2330
|
if (domainId) appDomainIds.set(appName, domainId);
|
|
2309
2331
|
}
|
|
@@ -2482,6 +2504,79 @@ async function releaseDokploy(run) {
|
|
|
2482
2504
|
}
|
|
2483
2505
|
}
|
|
2484
2506
|
}
|
|
2507
|
+
if (run.processors.length > 0) {
|
|
2508
|
+
logger.log("\n🖼️ Deploying processors...");
|
|
2509
|
+
for (const unit of run.processors) {
|
|
2510
|
+
ctx.signal?.throwIfAborted();
|
|
2511
|
+
logger.log(`\n 🖼️ Deploying ${unit.name} (processors of ${unit.id})...`);
|
|
2512
|
+
const domain = workspace.domains?.[stage];
|
|
2513
|
+
const secretKey = require_seeds.originSecretKey(unit.id);
|
|
2514
|
+
const secret = stageSecrets.custom?.[secretKey];
|
|
2515
|
+
if (!domain || !secret) throw new ProcessorsNeedCdn(unit.id, secretKey, stage);
|
|
2516
|
+
try {
|
|
2517
|
+
const application = await ensureApplication(api, journal, unit.name, require_identity.applicationName(identity, unit.name), project.projectId, environmentId, applied);
|
|
2518
|
+
const keys = [...require_seeds.processorEnvKeys(run.manifest, unit.id, run.runnables) ?? []].sort();
|
|
2519
|
+
const secrets = prepareSecretsForApp(stageSecrets, {
|
|
2520
|
+
appName: unit.name,
|
|
2521
|
+
requiredEnvVars: keys,
|
|
2522
|
+
optionalEnvVars: []
|
|
2523
|
+
});
|
|
2524
|
+
const credentials = secrets.secretCount > 0 ? {
|
|
2525
|
+
encrypted: secrets.payload.encrypted,
|
|
2526
|
+
iv: secrets.payload.iv
|
|
2527
|
+
} : void 0;
|
|
2528
|
+
const imageRef$3 = require_identity.imageRef(identity, unit.name, registry, imageTag);
|
|
2529
|
+
logger.log(` Building Docker image: ${imageRef$3}`);
|
|
2530
|
+
const image = await deployDocker({
|
|
2531
|
+
stage,
|
|
2532
|
+
tag: imageTag,
|
|
2533
|
+
skipPush: false,
|
|
2534
|
+
config: {
|
|
2535
|
+
registry,
|
|
2536
|
+
imageName: require_identity.imageName(identity, unit.name),
|
|
2537
|
+
appName: unit.name
|
|
2538
|
+
},
|
|
2539
|
+
credentials,
|
|
2540
|
+
cwd: workspace.root,
|
|
2541
|
+
dockerfile: require_seeds.workerDockerfileOf(unit.name),
|
|
2542
|
+
...ctx.signal ? { signal: ctx.signal } : {},
|
|
2543
|
+
...ctx.stdio ? { stdio: ctx.stdio } : {}
|
|
2544
|
+
});
|
|
2545
|
+
built(unit.name, image, imageRef$3);
|
|
2546
|
+
const env = {
|
|
2547
|
+
...require_seeds.scopeTelemetryEnv(Object.fromEntries(Object.entries(declaredEnv).filter(([key]) => keys.includes(key))), {
|
|
2548
|
+
uses: require_seeds.telemetryOf(run.manifest, unit.id) !== void 0,
|
|
2549
|
+
serviceName: unit.name,
|
|
2550
|
+
...telemetryValues ? { telemetry: telemetryValues } : {}
|
|
2551
|
+
}),
|
|
2552
|
+
...credentials ? { GKM_MASTER_KEY: secrets.masterKey } : {},
|
|
2553
|
+
[require_seeds.PROCESSOR_ORIGIN_SECRET_ENV]: secret,
|
|
2554
|
+
NODE_ENV: "production",
|
|
2555
|
+
PORT: String(require_seeds.PROCESSOR_PORT),
|
|
2556
|
+
STAGE: stage
|
|
2557
|
+
};
|
|
2558
|
+
const host = require_seeds.processorOriginHost(unit.id, domain);
|
|
2559
|
+
await release(unit.name, application.applicationId, {
|
|
2560
|
+
ref: image.imageRef ?? imageRef$3,
|
|
2561
|
+
...image.digest ? { digest: image.digest } : {}
|
|
2562
|
+
}, Object.entries(env).map(([key, value]) => `${key}=${value}`), host, require_seeds.PROCESSOR_PORT);
|
|
2563
|
+
await checkHealth(run, unit.name);
|
|
2564
|
+
results.push({
|
|
2565
|
+
appName: unit.name,
|
|
2566
|
+
type: "backend",
|
|
2567
|
+
success: true,
|
|
2568
|
+
applicationId: application.applicationId,
|
|
2569
|
+
imageRef: imageRef$3,
|
|
2570
|
+
...image.digest ? { digest: image.digest } : {}
|
|
2571
|
+
});
|
|
2572
|
+
logger.log(` ✓ ${unit.name} deployed at https://${host}`);
|
|
2573
|
+
} catch (error) {
|
|
2574
|
+
if (ctx.signal?.aborted) throw ctx.signal.reason;
|
|
2575
|
+
failed(run, unit.name, error);
|
|
2576
|
+
throw new BackendDeployFailed(unit.name, error);
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2485
2580
|
let frontendFailure;
|
|
2486
2581
|
if (frontendApps.length > 0) {
|
|
2487
2582
|
logger.log("\n🌐 PHASE 2: Deploying frontend applications...");
|
|
@@ -2519,8 +2614,8 @@ async function releaseDokploy(run) {
|
|
|
2519
2614
|
}
|
|
2520
2615
|
}
|
|
2521
2616
|
if (buildArgs.length > 0) logger.log(` Build args: ${publicUrlArgNames.join(", ")}`);
|
|
2522
|
-
const imageRef$
|
|
2523
|
-
logger.log(` Building Docker image: ${imageRef$
|
|
2617
|
+
const imageRef$4 = require_identity.imageRef(identity, appName, registry, imageTag);
|
|
2618
|
+
logger.log(` Building Docker image: ${imageRef$4}`);
|
|
2524
2619
|
const image = await deployDocker({
|
|
2525
2620
|
stage,
|
|
2526
2621
|
tag: imageTag,
|
|
@@ -2534,7 +2629,7 @@ async function releaseDokploy(run) {
|
|
|
2534
2629
|
publicUrlArgs: publicUrlArgNames,
|
|
2535
2630
|
...dockerRun(workspace, app, ctx)
|
|
2536
2631
|
});
|
|
2537
|
-
built(appName, image, imageRef$
|
|
2632
|
+
built(appName, image, imageRef$4);
|
|
2538
2633
|
const envVars = [
|
|
2539
2634
|
`NODE_ENV=production`,
|
|
2540
2635
|
`PORT=${app.port}`,
|
|
@@ -2542,14 +2637,14 @@ async function releaseDokploy(run) {
|
|
|
2542
2637
|
];
|
|
2543
2638
|
for (const [key, value] of Object.entries(resolved)) envVars.push(`${key}=${value}`);
|
|
2544
2639
|
await release(appName, application.applicationId, {
|
|
2545
|
-
ref: image.imageRef ?? imageRef$
|
|
2640
|
+
ref: image.imageRef ?? imageRef$4,
|
|
2546
2641
|
...image.digest ? { digest: image.digest } : {}
|
|
2547
2642
|
}, envVars, frontendHost);
|
|
2548
2643
|
deployed(appName, {
|
|
2549
2644
|
appName,
|
|
2550
2645
|
type: app.type,
|
|
2551
2646
|
applicationId: application.applicationId,
|
|
2552
|
-
imageRef: imageRef$
|
|
2647
|
+
imageRef: imageRef$4,
|
|
2553
2648
|
...image.digest ? { digest: image.digest } : {}
|
|
2554
2649
|
}, frontendHost);
|
|
2555
2650
|
logger.log(` ✓ ${appName} deployed successfully`);
|
|
@@ -2635,6 +2730,7 @@ async function migrate(run) {
|
|
|
2635
2730
|
stage,
|
|
2636
2731
|
manifest,
|
|
2637
2732
|
patterns: require_seeds.constructGlobs(workspace),
|
|
2733
|
+
backends: require_seeds.backendsOf(workspace),
|
|
2638
2734
|
urls,
|
|
2639
2735
|
signal: ctx.signal
|
|
2640
2736
|
});
|
|
@@ -2696,7 +2792,7 @@ async function checkHealth(run, appName) {
|
|
|
2696
2792
|
logger.log(` ✓ ${appName}: no domain, so its finished deployment is its check`);
|
|
2697
2793
|
return;
|
|
2698
2794
|
}
|
|
2699
|
-
const url = `https://${host}${workspace.apps[appName]
|
|
2795
|
+
const url = `https://${host}${workspace.apps[appName]?.type === "web" ? "/" : verify.healthCheckPath}`;
|
|
2700
2796
|
logger.log(`\n🩺 Checking ${appName} at ${url}...`);
|
|
2701
2797
|
await verifyHealth({
|
|
2702
2798
|
app: appName,
|
|
@@ -3063,6 +3159,37 @@ async function planDokploy(run) {
|
|
|
3063
3159
|
...existing ? { applicationId: existing.applicationId } : {}
|
|
3064
3160
|
});
|
|
3065
3161
|
}
|
|
3162
|
+
for (const unit of run.processors) {
|
|
3163
|
+
const dokployAppName = require_identity.applicationName(identity, unit.name);
|
|
3164
|
+
const recordedId = state?.applications?.[unit.name];
|
|
3165
|
+
const existing = project && environment ? (recordedId ? await api.getApplication(recordedId).catch(() => null) : null) ?? await api.findApplicationByName(project.projectId, dokployAppName, environment.environmentId) : null;
|
|
3166
|
+
const domain = workspace.domains?.[stage];
|
|
3167
|
+
const host = domain ? require_seeds.processorOriginHost(unit.id, domain) : void 0;
|
|
3168
|
+
plan(existing ? {
|
|
3169
|
+
key: `application:${unit.name}`,
|
|
3170
|
+
resourceType: "application",
|
|
3171
|
+
action: "reuse",
|
|
3172
|
+
id: existing.applicationId
|
|
3173
|
+
} : {
|
|
3174
|
+
key: `application:${unit.name}`,
|
|
3175
|
+
resourceType: "application",
|
|
3176
|
+
action: "create"
|
|
3177
|
+
}, `${dokployAppName}, processors of ${unit.id}${host ? ` at https://${host}` : ""}`);
|
|
3178
|
+
const ref = require_identity.imageRef(identity, unit.name, workspace.deploy.registry, imageTag);
|
|
3179
|
+
plan({
|
|
3180
|
+
key: `image:${unit.name}`,
|
|
3181
|
+
resourceType: "image",
|
|
3182
|
+
action: "build"
|
|
3183
|
+
}, ref);
|
|
3184
|
+
apps.push({
|
|
3185
|
+
appName: unit.name,
|
|
3186
|
+
type: "backend",
|
|
3187
|
+
success: true,
|
|
3188
|
+
imageRef: ref,
|
|
3189
|
+
...host ? { url: `https://${host}` } : {},
|
|
3190
|
+
...existing ? { applicationId: existing.applicationId } : {}
|
|
3191
|
+
});
|
|
3192
|
+
}
|
|
3066
3193
|
const creates = changes.filter((c) => c.action !== "reuse").length;
|
|
3067
3194
|
logger.log(`\n✅ Dry run complete: ${creates} to create or build, ${changes.length - creates} to reuse.`);
|
|
3068
3195
|
run.result = {
|
|
@@ -3198,4 +3325,4 @@ Object.defineProperty(exports, "verifySettings", {
|
|
|
3198
3325
|
}
|
|
3199
3326
|
});
|
|
3200
3327
|
|
|
3201
|
-
//# sourceMappingURL=engine-
|
|
3328
|
+
//# sourceMappingURL=engine-Dqe9KQCm.cjs.map
|