@geekmidas/cli 10.0.0-alpha.18 → 10.0.0-alpha.180
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/README.md +323 -380
- package/bin/adjacent-tsconfig.mjs +46 -8
- package/bin/gkm.mjs +11 -3
- package/bin/owning-tsconfig-jsx-register.mjs +18 -0
- package/bin/owning-tsconfig-jsx.mjs +108 -0
- package/dist/EndpointGenerator-CBKH87_b.mjs +1043 -0
- package/dist/EndpointGenerator-CBKH87_b.mjs.map +1 -0
- package/dist/EndpointGenerator-iyA3HkOH.cjs +1102 -0
- package/dist/EndpointGenerator-iyA3HkOH.cjs.map +1 -0
- package/dist/LegacyStateStore-B7pQA25B.mjs +124 -0
- package/dist/LegacyStateStore-B7pQA25B.mjs.map +1 -0
- package/dist/LegacyStateStore-l0hBdv-E.cjs +124 -0
- package/dist/LegacyStateStore-l0hBdv-E.cjs.map +1 -0
- package/dist/LocalStateStore-CP0UHL85.mjs +167 -0
- package/dist/LocalStateStore-CP0UHL85.mjs.map +1 -0
- package/dist/LocalStateStore-DEE0Kc_s.cjs +178 -0
- package/dist/LocalStateStore-DEE0Kc_s.cjs.map +1 -0
- package/dist/OpenApiTsGenerator-CoVA3Ykv.mjs +534 -0
- package/dist/OpenApiTsGenerator-CoVA3Ykv.mjs.map +1 -0
- package/dist/OpenApiTsGenerator-vy-fOJgs.cjs +539 -0
- package/dist/OpenApiTsGenerator-vy-fOJgs.cjs.map +1 -0
- package/dist/S3StateStore-DE0BNuXc.cjs +222 -0
- package/dist/S3StateStore-DE0BNuXc.cjs.map +1 -0
- package/dist/S3StateStore-vmxZWMKh.mjs +223 -0
- package/dist/S3StateStore-vmxZWMKh.mjs.map +1 -0
- package/dist/SSMStateStore-DQyXnX2M.mjs +205 -0
- package/dist/SSMStateStore-DQyXnX2M.mjs.map +1 -0
- package/dist/SSMStateStore-p4hBdTg3.cjs +204 -0
- package/dist/SSMStateStore-p4hBdTg3.cjs.map +1 -0
- package/dist/SubscriberGenerator-B3jHf26s.mjs +787 -0
- package/dist/SubscriberGenerator-B3jHf26s.mjs.map +1 -0
- package/dist/SubscriberGenerator-JhwVlWBS.cjs +852 -0
- package/dist/SubscriberGenerator-JhwVlWBS.cjs.map +1 -0
- package/dist/add-DEdpKya-.cjs +713 -0
- package/dist/add-DEdpKya-.cjs.map +1 -0
- package/dist/add-QBvDmVA-.mjs +711 -0
- package/dist/add-QBvDmVA-.mjs.map +1 -0
- package/dist/appPorts-BoXMwolc.mjs +249 -0
- package/dist/appPorts-BoXMwolc.mjs.map +1 -0
- package/dist/appPorts-IW-OZmRi.cjs +296 -0
- package/dist/appPorts-IW-OZmRi.cjs.map +1 -0
- package/dist/apps-D0LULFmU.mjs +4650 -0
- package/dist/apps-D0LULFmU.mjs.map +1 -0
- package/dist/apps-qJ5FPJGQ.cjs +5174 -0
- package/dist/apps-qJ5FPJGQ.cjs.map +1 -0
- package/dist/aws-BXfiWNbi.cjs +108 -0
- package/dist/aws-BXfiWNbi.cjs.map +1 -0
- package/dist/aws-BjvSTTcE.mjs +97 -0
- package/dist/aws-BjvSTTcE.mjs.map +1 -0
- package/dist/awsStore-BYYCmXiq.mjs +121 -0
- package/dist/awsStore-BYYCmXiq.mjs.map +1 -0
- package/dist/awsStore-DKQUElJL.cjs +138 -0
- package/dist/awsStore-DKQUElJL.cjs.map +1 -0
- package/dist/{backup-provisioner-DIVCbfee.mjs → backup-provisioner-C8DnCmxK.mjs} +2 -2
- package/dist/backup-provisioner-C8DnCmxK.mjs.map +1 -0
- package/dist/{backup-provisioner-BmhIO_Yr.cjs → backup-provisioner-oDEsPj02.cjs} +2 -2
- package/dist/backup-provisioner-oDEsPj02.cjs.map +1 -0
- package/dist/backups/runner.cjs +519 -0
- package/dist/backups/runner.cjs.map +1 -0
- package/dist/backups/runner.d.cts +102 -0
- package/dist/backups/runner.d.cts.map +1 -0
- package/dist/backups/runner.d.mts +102 -0
- package/dist/backups/runner.d.mts.map +1 -0
- package/dist/backups/runner.mjs +506 -0
- package/dist/backups/runner.mjs.map +1 -0
- package/dist/{bundler-mjqGAvu1.cjs → bundler-BuBCXA0t.cjs} +67 -14
- package/dist/bundler-BuBCXA0t.cjs.map +1 -0
- package/dist/{bundler-mwH7WOb1.mjs → bundler-DZKdVVKZ.mjs} +68 -15
- package/dist/bundler-DZKdVVKZ.mjs.map +1 -0
- package/dist/cli-BCGkzaR1.cjs +80 -0
- package/dist/cli-BCGkzaR1.cjs.map +1 -0
- package/dist/cli-CgEbT00Q.mjs +80 -0
- package/dist/cli-CgEbT00Q.mjs.map +1 -0
- package/dist/clientTelemetry-BAwj6MOf.d.cts +10 -0
- package/dist/clientTelemetry-BAwj6MOf.d.cts.map +1 -0
- package/dist/clientTelemetry-CvamPJj_.d.mts +10 -0
- package/dist/clientTelemetry-CvamPJj_.d.mts.map +1 -0
- package/dist/compose-AO8u4mBI.cjs +3502 -0
- package/dist/compose-AO8u4mBI.cjs.map +1 -0
- package/dist/compose-C-yjexqX.cjs +2925 -0
- package/dist/compose-C-yjexqX.cjs.map +1 -0
- package/dist/compose-C23RpAaF.mjs +3389 -0
- package/dist/compose-C23RpAaF.mjs.map +1 -0
- package/dist/compose-DtfoUChm.mjs +2434 -0
- package/dist/compose-DtfoUChm.mjs.map +1 -0
- package/dist/config-BODxZemw.d.mts +291 -0
- package/dist/config-BODxZemw.d.mts.map +1 -0
- package/dist/config-C3U5HulX.d.cts +291 -0
- package/dist/config-C3U5HulX.d.cts.map +1 -0
- package/dist/config.cjs +457 -9
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +4 -117
- package/dist/config.d.mts +4 -117
- package/dist/config.mjs +441 -3
- package/dist/config.mjs.map +1 -0
- package/dist/credentialSchemas-D_85KW2k.mjs +236 -0
- package/dist/credentialSchemas-D_85KW2k.mjs.map +1 -0
- package/dist/credentialSchemas-DjK6xKMk.cjs +271 -0
- package/dist/credentialSchemas-DjK6xKMk.cjs.map +1 -0
- package/dist/databases-CV22HzrI.mjs +588 -0
- package/dist/databases-CV22HzrI.mjs.map +1 -0
- package/dist/databases-DwYYH2mX.cjs +703 -0
- package/dist/databases-DwYYH2mX.cjs.map +1 -0
- package/dist/dbTunnel-Bve0zBqT.cjs +154 -0
- package/dist/dbTunnel-Bve0zBqT.cjs.map +1 -0
- package/dist/dbTunnel-CnubkLBa.mjs +154 -0
- package/dist/dbTunnel-CnubkLBa.mjs.map +1 -0
- package/dist/define-BfrNaY82.mjs +106 -0
- package/dist/define-BfrNaY82.mjs.map +1 -0
- package/dist/define-zKgLY65H.cjs +153 -0
- package/dist/define-zKgLY65H.cjs.map +1 -0
- package/dist/deploy/public.cjs +211 -0
- package/dist/deploy/public.cjs.map +1 -0
- package/dist/deploy/public.d.cts +659 -0
- package/dist/deploy/public.d.cts.map +1 -0
- package/dist/deploy/public.d.mts +659 -0
- package/dist/deploy/public.d.mts.map +1 -0
- package/dist/deploy/public.mjs +144 -0
- package/dist/deploy/public.mjs.map +1 -0
- package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
- package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
- package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
- package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
- package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
- package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
- package/dist/deploy/sniffer-hooks.cjs +1 -1
- package/dist/deploy/sniffer-hooks.mjs +1 -1
- package/dist/deploy/sniffer-loader.cjs +2 -2
- package/dist/deploy/sniffer-loader.mjs +1 -1
- package/dist/deploy/sniffer-routes-worker.cjs +2 -2
- package/dist/deploy/sniffer-routes-worker.mjs +1 -1
- package/dist/deploy-C2MKxzm9.cjs +3894 -0
- package/dist/deploy-C2MKxzm9.cjs.map +1 -0
- package/dist/deploy-Qq41vtpm.mjs +3838 -0
- package/dist/deploy-Qq41vtpm.mjs.map +1 -0
- package/dist/destroy-Bg4IUf_Z.mjs +789 -0
- package/dist/destroy-Bg4IUf_Z.mjs.map +1 -0
- package/dist/destroy-CCpnHI2v.cjs +790 -0
- package/dist/destroy-CCpnHI2v.cjs.map +1 -0
- package/dist/discover-Dfmn6HQ7.mjs +940 -0
- package/dist/discover-Dfmn6HQ7.mjs.map +1 -0
- package/dist/discover-OXczlq08.cjs +1085 -0
- package/dist/discover-OXczlq08.cjs.map +1 -0
- package/dist/dns-BAM8VH1v.mjs +1820 -0
- package/dist/dns-BAM8VH1v.mjs.map +1 -0
- package/dist/dns-D_0z9Tm1.cjs +2257 -0
- package/dist/dns-D_0z9Tm1.cjs.map +1 -0
- package/dist/docker-6EUbKrEl.cjs +1798 -0
- package/dist/docker-6EUbKrEl.cjs.map +1 -0
- package/dist/docker-DQoE3Fr7.mjs +1649 -0
- package/dist/docker-DQoE3Fr7.mjs.map +1 -0
- package/dist/dokploy-BD8NXy8y.cjs +38 -0
- package/dist/dokploy-BD8NXy8y.cjs.map +1 -0
- package/dist/dokploy-CU9iuc35.mjs +38 -0
- package/dist/dokploy-CU9iuc35.mjs.map +1 -0
- package/dist/drivers-BQRb3KsL.mjs +294 -0
- package/dist/drivers-BQRb3KsL.mjs.map +1 -0
- package/dist/drivers-DP7__dJX.cjs +377 -0
- package/dist/drivers-DP7__dJX.cjs.map +1 -0
- package/dist/eas-BhTOdQrE.cjs +337 -0
- package/dist/eas-BhTOdQrE.cjs.map +1 -0
- package/dist/eas-iYyg7Xjy.mjs +334 -0
- package/dist/eas-iYyg7Xjy.mjs.map +1 -0
- package/dist/emit-C4KSXOeS.mjs +153 -0
- package/dist/emit-C4KSXOeS.mjs.map +1 -0
- package/dist/emit-DiW0kbue.cjs +164 -0
- package/dist/emit-DiW0kbue.cjs.map +1 -0
- package/dist/encryption-hgmnMZw0.mjs +89 -0
- package/dist/encryption-hgmnMZw0.mjs.map +1 -0
- package/dist/encryption-yROMpM67.cjs +90 -0
- package/dist/encryption-yROMpM67.cjs.map +1 -0
- package/dist/engine-B4whsrrE.mjs +3217 -0
- package/dist/engine-B4whsrrE.mjs.map +1 -0
- package/dist/engine-D0XYdIiE.cjs +3330 -0
- package/dist/engine-D0XYdIiE.cjs.map +1 -0
- package/dist/errors-C9uIyIDt.mjs +27 -0
- package/dist/errors-C9uIyIDt.mjs.map +1 -0
- package/dist/errors-D1x8duqI.cjs +38 -0
- package/dist/errors-D1x8duqI.cjs.map +1 -0
- package/dist/github-CBkZF4PS.mjs +986 -0
- package/dist/github-CBkZF4PS.mjs.map +1 -0
- package/dist/github-D1-_OnGL.cjs +987 -0
- package/dist/github-D1-_OnGL.cjs.map +1 -0
- package/dist/googlePlay-Bwv8TVi8.mjs +931 -0
- package/dist/googlePlay-Bwv8TVi8.mjs.map +1 -0
- package/dist/googlePlay-s9dGfrrb.cjs +931 -0
- package/dist/googlePlay-s9dGfrrb.cjs.map +1 -0
- package/dist/iam-BzFyFf7T.mjs +442 -0
- package/dist/iam-BzFyFf7T.mjs.map +1 -0
- package/dist/iam-WIoKnLBp.cjs +521 -0
- package/dist/iam-WIoKnLBp.cjs.map +1 -0
- package/dist/{index-RCUizGxL.d.cts → index-BKgOlfK2.d.mts} +38 -14
- package/dist/index-BKgOlfK2.d.mts.map +1 -0
- package/dist/{index-B4H4XF7A.d.mts → index-zPzigXh-.d.cts} +38 -14
- package/dist/index-zPzigXh-.d.cts.map +1 -0
- package/dist/index.cjs +14502 -12767
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +15137 -13400
- package/dist/index.mjs.map +1 -1
- package/dist/local-CFnHQgWC.cjs +241 -0
- package/dist/local-CFnHQgWC.cjs.map +1 -0
- package/dist/local-JOnTFJA5.mjs +224 -0
- package/dist/local-JOnTFJA5.mjs.map +1 -0
- package/dist/migrate-BtnpQocG.mjs +181 -0
- package/dist/migrate-BtnpQocG.mjs.map +1 -0
- package/dist/migrate-CGXrmZyV.cjs +272 -0
- package/dist/migrate-CGXrmZyV.cjs.map +1 -0
- package/dist/migrate-CxWXW-Lw.cjs +181 -0
- package/dist/migrate-CxWXW-Lw.cjs.map +1 -0
- package/dist/migrate-fLIgSpPB.mjs +267 -0
- package/dist/migrate-fLIgSpPB.mjs.map +1 -0
- package/dist/next.cjs +59 -0
- package/dist/next.cjs.map +1 -0
- package/dist/next.d.cts +44 -0
- package/dist/next.d.cts.map +1 -0
- package/dist/next.d.mts +44 -0
- package/dist/next.d.mts.map +1 -0
- package/dist/next.mjs +58 -0
- package/dist/next.mjs.map +1 -0
- package/dist/notes-ChYPaRLu.cjs +510 -0
- package/dist/notes-ChYPaRLu.cjs.map +1 -0
- package/dist/notes-LATU2vLI.mjs +409 -0
- package/dist/notes-LATU2vLI.mjs.map +1 -0
- package/dist/openapi.cjs +213 -7
- package/dist/openapi.cjs.map +1 -0
- package/dist/openapi.d.cts +27 -8
- package/dist/openapi.d.cts.map +1 -1
- package/dist/openapi.d.mts +27 -8
- package/dist/openapi.d.mts.map +1 -1
- package/dist/openapi.mjs +208 -2
- package/dist/openapi.mjs.map +1 -0
- package/dist/projectBucket-BIeh2HTj.cjs +263 -0
- package/dist/projectBucket-BIeh2HTj.cjs.map +1 -0
- package/dist/projectBucket-D_4zb_oh.mjs +222 -0
- package/dist/projectBucket-D_4zb_oh.mjs.map +1 -0
- package/dist/provider-BvjDbsTR.mjs +46 -0
- package/dist/provider-BvjDbsTR.mjs.map +1 -0
- package/dist/provider-DLhgo-mB.cjs +57 -0
- package/dist/provider-DLhgo-mB.cjs.map +1 -0
- package/dist/publish-Dc-1GQp8.cjs +124 -0
- package/dist/publish-Dc-1GQp8.cjs.map +1 -0
- package/dist/publish-DhzRYhVZ.mjs +123 -0
- package/dist/publish-DhzRYhVZ.mjs.map +1 -0
- package/dist/ready-BcV28QoW.mjs +375 -0
- package/dist/ready-BcV28QoW.mjs.map +1 -0
- package/dist/ready-ByQvw4-W.cjs +404 -0
- package/dist/ready-ByQvw4-W.cjs.map +1 -0
- package/dist/reconcile/public.cjs +3 -5
- package/dist/reconcile/public.d.cts +33 -89
- package/dist/reconcile/public.d.cts.map +1 -1
- package/dist/reconcile/public.d.mts +33 -89
- package/dist/reconcile/public.d.mts.map +1 -1
- package/dist/reconcile/public.mjs +3 -3
- package/dist/reconcile--I7V4Klj.mjs +34 -0
- package/dist/reconcile--I7V4Klj.mjs.map +1 -0
- package/dist/reconcile-CuCQBa5-.cjs +34 -0
- package/dist/reconcile-CuCQBa5-.cjs.map +1 -0
- package/dist/resolve-CJvM2bUx.mjs +263 -0
- package/dist/resolve-CJvM2bUx.mjs.map +1 -0
- package/dist/resolve-DyUXmA0z.cjs +316 -0
- package/dist/resolve-DyUXmA0z.cjs.map +1 -0
- package/dist/rollback-BO1asWkd.mjs +136 -0
- package/dist/rollback-BO1asWkd.mjs.map +1 -0
- package/dist/rollback-Op8Tc5N-.cjs +165 -0
- package/dist/rollback-Op8Tc5N-.cjs.map +1 -0
- package/dist/runtime-CaejlcZt.d.mts +82 -0
- package/dist/runtime-CaejlcZt.d.mts.map +1 -0
- package/dist/runtime-D3jD4Dvn.d.cts +82 -0
- package/dist/runtime-D3jD4Dvn.d.cts.map +1 -0
- package/dist/s3-BbtwHSod.mjs +240 -0
- package/dist/s3-BbtwHSod.mjs.map +1 -0
- package/dist/s3-CwacPd8J.cjs +240 -0
- package/dist/s3-CwacPd8J.cjs.map +1 -0
- package/dist/sandbox/config-worker.cjs +43 -0
- package/dist/sandbox/config-worker.cjs.map +1 -0
- package/dist/sandbox/config-worker.d.cts +1 -0
- package/dist/sandbox/config-worker.d.mts +1 -0
- package/dist/sandbox/config-worker.mjs +44 -0
- package/dist/sandbox/config-worker.mjs.map +1 -0
- package/dist/sandbox/credentials-worker.cjs +53 -0
- package/dist/sandbox/credentials-worker.cjs.map +1 -0
- package/dist/sandbox/credentials-worker.d.cts +1 -0
- package/dist/sandbox/credentials-worker.d.mts +1 -0
- package/dist/sandbox/credentials-worker.mjs +54 -0
- package/dist/sandbox/credentials-worker.mjs.map +1 -0
- package/dist/sandbox/discover-worker.cjs +47 -0
- package/dist/sandbox/discover-worker.cjs.map +1 -0
- package/dist/sandbox/discover-worker.d.cts +1 -0
- package/dist/sandbox/discover-worker.d.mts +1 -0
- package/dist/sandbox/discover-worker.mjs +48 -0
- package/dist/sandbox/discover-worker.mjs.map +1 -0
- package/dist/sandbox/migrate-worker.cjs +75 -0
- package/dist/sandbox/migrate-worker.cjs.map +1 -0
- package/dist/sandbox/migrate-worker.d.cts +1 -0
- package/dist/sandbox/migrate-worker.d.mts +1 -0
- package/dist/sandbox/migrate-worker.mjs +76 -0
- package/dist/sandbox/migrate-worker.mjs.map +1 -0
- package/dist/{workspace-CRD9YinV.cjs → schemas-BCwKKA42.mjs} +399 -1179
- package/dist/schemas-BCwKKA42.mjs.map +1 -0
- package/dist/{workspace-Bu3xNCej.mjs → schemas-BQ_v0lEX.cjs} +487 -982
- package/dist/schemas-BQ_v0lEX.cjs.map +1 -0
- package/dist/secretsManager-CjTo6CRq.mjs +113 -0
- package/dist/secretsManager-CjTo6CRq.mjs.map +1 -0
- package/dist/secretsManager-CvmBGjdM.cjs +124 -0
- package/dist/secretsManager-CvmBGjdM.cjs.map +1 -0
- package/dist/seeds-Bc3niNVb.cjs +382 -0
- package/dist/seeds-Bc3niNVb.cjs.map +1 -0
- package/dist/seeds-Ccn0Ru2T.mjs +299 -0
- package/dist/seeds-Ccn0Ru2T.mjs.map +1 -0
- package/dist/serverSetup-BFdzPTIT.cjs +685 -0
- package/dist/serverSetup-BFdzPTIT.cjs.map +1 -0
- package/dist/serverSetup-CSxaZ7ha.mjs +685 -0
- package/dist/serverSetup-CSxaZ7ha.mjs.map +1 -0
- package/dist/sniffer-CwxpsSez.mjs +1824 -0
- package/dist/sniffer-CwxpsSez.mjs.map +1 -0
- package/dist/sniffer-D3gH7aJT.cjs +1997 -0
- package/dist/sniffer-D3gH7aJT.cjs.map +1 -0
- package/dist/snsSubscriptions-B8tGxND5.cjs +1135 -0
- package/dist/snsSubscriptions-B8tGxND5.cjs.map +1 -0
- package/dist/snsSubscriptions-n3sjbrRM.mjs +1010 -0
- package/dist/snsSubscriptions-n3sjbrRM.mjs.map +1 -0
- package/dist/sst-Cjocp7gi.cjs +501 -0
- package/dist/sst-Cjocp7gi.cjs.map +1 -0
- package/dist/sst-DeF0BfDA.mjs +478 -0
- package/dist/sst-DeF0BfDA.mjs.map +1 -0
- package/dist/stack-CyoRqyPt.mjs +1777 -0
- package/dist/stack-CyoRqyPt.mjs.map +1 -0
- package/dist/stack-Dr2FSxGm.cjs +1887 -0
- package/dist/stack-Dr2FSxGm.cjs.map +1 -0
- package/dist/stage-TAx0Gcq8.mjs +303 -0
- package/dist/stage-TAx0Gcq8.mjs.map +1 -0
- package/dist/stage-aTBLKonw.cjs +332 -0
- package/dist/stage-aTBLKonw.cjs.map +1 -0
- package/dist/stages-BeSQQQ4z.cjs +190 -0
- package/dist/stages-BeSQQQ4z.cjs.map +1 -0
- package/dist/stages-DjFKQv08.mjs +190 -0
- package/dist/stages-DjFKQv08.mjs.map +1 -0
- package/dist/target/public.cjs +15 -0
- package/dist/target/public.d.cts +28 -0
- package/dist/target/public.d.cts.map +1 -0
- package/dist/target/public.d.mts +28 -0
- package/dist/target/public.d.mts.map +1 -0
- package/dist/target/public.mjs +4 -0
- package/dist/terminal-Bk4PjXWY.mjs +85 -0
- package/dist/terminal-Bk4PjXWY.mjs.map +1 -0
- package/dist/terminal-DPf137EJ.cjs +85 -0
- package/dist/terminal-DPf137EJ.cjs.map +1 -0
- package/dist/{types-7R81hu0i.d.mts → types-CLxsw-QY.d.cts} +2135 -428
- package/dist/types-CLxsw-QY.d.cts.map +1 -0
- package/dist/{types-N7c2O2m7.d.cts → types-wLlwkSib.d.mts} +2133 -428
- package/dist/types-wLlwkSib.d.mts.map +1 -0
- package/dist/utils-D2Nk1Nv2.cjs +205 -0
- package/dist/utils-D2Nk1Nv2.cjs.map +1 -0
- package/dist/utils-D_fxUqvU.mjs +156 -0
- package/dist/utils-D_fxUqvU.mjs.map +1 -0
- package/dist/vitest.cjs +65 -0
- package/dist/vitest.cjs.map +1 -0
- package/dist/vitest.d.cts +29 -0
- package/dist/vitest.d.cts.map +1 -0
- package/dist/vitest.d.mts +29 -0
- package/dist/vitest.d.mts.map +1 -0
- package/dist/vitest.mjs +65 -0
- package/dist/vitest.mjs.map +1 -0
- package/dist/workerRuntime-BXfhbe13.cjs +108 -0
- package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
- package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
- package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
- package/dist/workspace/index.cjs +6 -2
- package/dist/workspace/index.d.cts +3 -3
- package/dist/workspace/index.d.mts +3 -3
- package/dist/workspace/index.mjs +2 -2
- package/dist/workspace-DJjhfAGf.mjs +3027 -0
- package/dist/workspace-DJjhfAGf.mjs.map +1 -0
- package/dist/workspace-wTLnc1Ef.cjs +3577 -0
- package/dist/workspace-wTLnc1Ef.cjs.map +1 -0
- package/package.json +76 -13
- package/dist/HostingerProvider-BY26bWwB.mjs +0 -243
- package/dist/HostingerProvider-BY26bWwB.mjs.map +0 -1
- package/dist/HostingerProvider-BZFGYYVA.cjs +0 -243
- package/dist/HostingerProvider-BZFGYYVA.cjs.map +0 -1
- package/dist/LocalStateProvider-7HR6SS2t.cjs +0 -48
- package/dist/LocalStateProvider-7HR6SS2t.cjs.map +0 -1
- package/dist/LocalStateProvider-D7QyJoLM.mjs +0 -48
- package/dist/LocalStateProvider-D7QyJoLM.mjs.map +0 -1
- package/dist/Route53Provider-Cvj40A8I.mjs +0 -209
- package/dist/Route53Provider-Cvj40A8I.mjs.map +0 -1
- package/dist/Route53Provider-DVILBsvV.cjs +0 -209
- package/dist/Route53Provider-DVILBsvV.cjs.map +0 -1
- package/dist/SSMStateProvider-B0Hu1MKZ.mjs +0 -75
- package/dist/SSMStateProvider-B0Hu1MKZ.mjs.map +0 -1
- package/dist/SSMStateProvider-VrQ-yeqd.cjs +0 -74
- package/dist/SSMStateProvider-VrQ-yeqd.cjs.map +0 -1
- package/dist/backup-provisioner-BmhIO_Yr.cjs.map +0 -1
- package/dist/backup-provisioner-DIVCbfee.mjs.map +0 -1
- package/dist/bundler-mjqGAvu1.cjs.map +0 -1
- package/dist/bundler-mwH7WOb1.mjs.map +0 -1
- package/dist/config-DSXI480r.cjs +0 -467
- package/dist/config-DSXI480r.cjs.map +0 -1
- package/dist/config-DdKkoUE1.mjs +0 -414
- package/dist/config-DdKkoUE1.mjs.map +0 -1
- package/dist/config.d.cts.map +0 -1
- package/dist/config.d.mts.map +0 -1
- package/dist/credentials-C6Pfn6GY.cjs +0 -2939
- package/dist/credentials-C6Pfn6GY.cjs.map +0 -1
- package/dist/credentials-lbv-j0Be.mjs +0 -2802
- package/dist/credentials-lbv-j0Be.mjs.map +0 -1
- package/dist/discover-BERGFg8v.cjs +0 -288
- package/dist/discover-BERGFg8v.cjs.map +0 -1
- package/dist/discover-CK-n3w6b.mjs +0 -244
- package/dist/discover-CK-n3w6b.mjs.map +0 -1
- package/dist/emit-BdoPFjZf.cjs +0 -253
- package/dist/emit-BdoPFjZf.cjs.map +0 -1
- package/dist/emit-Bzq7JsMP.mjs +0 -224
- package/dist/emit-Bzq7JsMP.mjs.map +0 -1
- package/dist/generator-LfZU7NlU.mjs +0 -247
- package/dist/generator-LfZU7NlU.mjs.map +0 -1
- package/dist/generator-Wdfp0jCS.cjs +0 -282
- package/dist/generator-Wdfp0jCS.cjs.map +0 -1
- package/dist/github-DlIrXPee.mjs +0 -216
- package/dist/github-DlIrXPee.mjs.map +0 -1
- package/dist/github-n7N9yOff.cjs +0 -216
- package/dist/github-n7N9yOff.cjs.map +0 -1
- package/dist/index-B4H4XF7A.d.mts.map +0 -1
- package/dist/index-RCUizGxL.d.cts.map +0 -1
- package/dist/openapi-B8bu_OXN.cjs +0 -2038
- package/dist/openapi-B8bu_OXN.cjs.map +0 -1
- package/dist/openapi-DfjbhrsM.mjs +0 -1991
- package/dist/openapi-DfjbhrsM.mjs.map +0 -1
- package/dist/reconcile-Cq4cO83R.cjs +0 -136
- package/dist/reconcile-Cq4cO83R.cjs.map +0 -1
- package/dist/reconcile-fmoluZmZ.mjs +0 -113
- package/dist/reconcile-fmoluZmZ.mjs.map +0 -1
- package/dist/ssm-BKN1Cg4z.mjs +0 -60
- package/dist/ssm-BKN1Cg4z.mjs.map +0 -1
- package/dist/ssm-FxeSAt35.cjs +0 -60
- package/dist/ssm-FxeSAt35.cjs.map +0 -1
- package/dist/storage-DgypfSD6.cjs +0 -351
- package/dist/storage-DgypfSD6.cjs.map +0 -1
- package/dist/storage-TP0x118M.mjs +0 -304
- package/dist/storage-TP0x118M.mjs.map +0 -1
- package/dist/transfer-2aRVVJ6I.mjs +0 -122
- package/dist/transfer-2aRVVJ6I.mjs.map +0 -1
- package/dist/transfer-C3WZVmj_.cjs +0 -151
- package/dist/transfer-C3WZVmj_.cjs.map +0 -1
- package/dist/types-7R81hu0i.d.mts.map +0 -1
- package/dist/types-N7c2O2m7.d.cts.map +0 -1
- package/dist/workspace-Bu3xNCej.mjs.map +0 -1
- package/dist/workspace-CRD9YinV.cjs.map +0 -1
|
@@ -0,0 +1,2257 @@
|
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
2
|
+
const require_errors = require("./errors-D1x8duqI.cjs");
|
|
3
|
+
const require_workspace = require("./workspace-wTLnc1Ef.cjs");
|
|
4
|
+
const require_drivers = require("./drivers-DP7__dJX.cjs");
|
|
5
|
+
const require_discover = require("./discover-OXczlq08.cjs");
|
|
6
|
+
const require_resolve = require("./resolve-DyUXmA0z.cjs");
|
|
7
|
+
let node_path = require("node:path");
|
|
8
|
+
let node_fs = require("node:fs");
|
|
9
|
+
let node_fs_promises = require("node:fs/promises");
|
|
10
|
+
let node_os = require("node:os");
|
|
11
|
+
let node_child_process = require("node:child_process");
|
|
12
|
+
let node_crypto = require("node:crypto");
|
|
13
|
+
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
14
|
+
let node_dns_promises = require("node:dns/promises");
|
|
15
|
+
let _geekmidas_edge_dns = require("@geekmidas/edge/dns");
|
|
16
|
+
//#region src/home.ts
|
|
17
|
+
/**
|
|
18
|
+
* Where the CLI keeps what belongs to a person rather than a project: stage
|
|
19
|
+
* keys and stored provider credentials.
|
|
20
|
+
*
|
|
21
|
+
* `GKM_HOME` names it, so a CI job, a shared build runner or a test can give
|
|
22
|
+
* every run its own instead of reaching into whoever's home directory the
|
|
23
|
+
* process happens to have. Unset, it is `~/.gkm`, where it has always been.
|
|
24
|
+
*/
|
|
25
|
+
/** The environment variable that moves the CLI's home. */
|
|
26
|
+
const GKM_HOME_ENV = "GKM_HOME";
|
|
27
|
+
/** The CLI's home: `GKM_HOME` if set, else `~/.gkm`. */
|
|
28
|
+
function gkmHome(env = process.env) {
|
|
29
|
+
const configured = env[GKM_HOME_ENV];
|
|
30
|
+
return configured ? (0, node_path.resolve)(configured) : (0, node_path.join)((0, node_os.homedir)(), ".gkm");
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/auth/credentials.ts
|
|
34
|
+
/**
|
|
35
|
+
* Get the path to the credentials directory
|
|
36
|
+
*/
|
|
37
|
+
function getCredentialsDir(options) {
|
|
38
|
+
if (options?.home) return options.home;
|
|
39
|
+
return options?.root ? (0, node_path.join)(options.root, ".gkm") : gkmHome();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get the path to the credentials file
|
|
43
|
+
*/
|
|
44
|
+
function getCredentialsPath(options) {
|
|
45
|
+
return (0, node_path.join)(getCredentialsDir(options), "credentials.json");
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Ensure the credentials directory exists
|
|
49
|
+
*/
|
|
50
|
+
function ensureCredentialsDir(options) {
|
|
51
|
+
const dir = getCredentialsDir(options);
|
|
52
|
+
if (!(0, node_fs.existsSync)(dir)) (0, node_fs.mkdirSync)(dir, {
|
|
53
|
+
recursive: true,
|
|
54
|
+
mode: 448
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Read stored credentials from disk
|
|
59
|
+
*/
|
|
60
|
+
async function readCredentials(options) {
|
|
61
|
+
const path = getCredentialsPath(options);
|
|
62
|
+
if (!(0, node_fs.existsSync)(path)) return {};
|
|
63
|
+
try {
|
|
64
|
+
const content = await (0, node_fs_promises.readFile)(path, "utf-8");
|
|
65
|
+
return JSON.parse(content);
|
|
66
|
+
} catch {
|
|
67
|
+
return {};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Write credentials to disk
|
|
72
|
+
*/
|
|
73
|
+
async function writeCredentials(credentials, options) {
|
|
74
|
+
ensureCredentialsDir(options);
|
|
75
|
+
const path = getCredentialsPath(options);
|
|
76
|
+
await (0, node_fs_promises.writeFile)(path, JSON.stringify(credentials, null, 2), { mode: 384 });
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Store Dokploy credentials
|
|
80
|
+
*/
|
|
81
|
+
async function storeDokployCredentials(token, endpoint, options) {
|
|
82
|
+
const credentials = await readCredentials(options);
|
|
83
|
+
credentials.dokploy = {
|
|
84
|
+
token,
|
|
85
|
+
endpoint,
|
|
86
|
+
storedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
87
|
+
};
|
|
88
|
+
await writeCredentials(credentials, options);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Get stored Dokploy credentials
|
|
92
|
+
*/
|
|
93
|
+
async function getDokployCredentials(options) {
|
|
94
|
+
const credentials = await readCredentials(options);
|
|
95
|
+
const token = process.env.DOKPLOY_API_TOKEN ?? credentials.dokploy?.token;
|
|
96
|
+
const endpoint = process.env.DOKPLOY_ENDPOINT ?? credentials.dokploy?.endpoint;
|
|
97
|
+
if (!token || !endpoint) return null;
|
|
98
|
+
return {
|
|
99
|
+
token,
|
|
100
|
+
endpoint: endpoint.replace(/\/$/, ""),
|
|
101
|
+
...credentials.dokploy?.registryId ? { registryId: credentials.dokploy.registryId } : {}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Remove Dokploy credentials
|
|
106
|
+
*/
|
|
107
|
+
async function removeDokployCredentials(options) {
|
|
108
|
+
const credentials = await readCredentials(options);
|
|
109
|
+
if (!credentials.dokploy) return false;
|
|
110
|
+
delete credentials.dokploy;
|
|
111
|
+
await writeCredentials(credentials, options);
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Get Dokploy API token, checking stored credentials first, then environment
|
|
116
|
+
*/
|
|
117
|
+
async function getDokployToken(options) {
|
|
118
|
+
const envToken = process.env.DOKPLOY_API_TOKEN;
|
|
119
|
+
if (envToken) return envToken;
|
|
120
|
+
const stored = await getDokployCredentials(options);
|
|
121
|
+
if (stored) return stored.token;
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get Dokploy registry ID from stored credentials
|
|
126
|
+
*/
|
|
127
|
+
async function getDokployRegistryId(options) {
|
|
128
|
+
return (await getDokployCredentials(options))?.registryId ?? void 0;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Store Hostinger API token
|
|
132
|
+
*
|
|
133
|
+
* @param token - API token from hpanel.hostinger.com/profile/api
|
|
134
|
+
*/
|
|
135
|
+
async function storeHostingerToken(token, options) {
|
|
136
|
+
const credentials = await readCredentials(options);
|
|
137
|
+
credentials.hostinger = {
|
|
138
|
+
token,
|
|
139
|
+
storedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
140
|
+
};
|
|
141
|
+
await writeCredentials(credentials, options);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get stored Hostinger API token
|
|
145
|
+
*
|
|
146
|
+
* Checks environment variable first (HOSTINGER_API_TOKEN),
|
|
147
|
+
* then falls back to stored credentials.
|
|
148
|
+
*/
|
|
149
|
+
async function getHostingerToken(options) {
|
|
150
|
+
const envToken = process.env.HOSTINGER_API_TOKEN;
|
|
151
|
+
if (envToken) return envToken;
|
|
152
|
+
return (await readCredentials(options)).hostinger?.token ?? null;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Store a GoDaddy Personal Access Token.
|
|
156
|
+
*/
|
|
157
|
+
async function storeGoDaddyToken(token, options) {
|
|
158
|
+
const credentials = await readCredentials(options);
|
|
159
|
+
credentials.godaddy = {
|
|
160
|
+
token,
|
|
161
|
+
storedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
162
|
+
};
|
|
163
|
+
await writeCredentials(credentials, options);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Remove GoDaddy credentials
|
|
167
|
+
*/
|
|
168
|
+
async function removeGoDaddyCredentials(options) {
|
|
169
|
+
const credentials = await readCredentials(options);
|
|
170
|
+
if (!credentials.godaddy) return false;
|
|
171
|
+
delete credentials.godaddy;
|
|
172
|
+
await writeCredentials(credentials, options);
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/run.ts
|
|
177
|
+
/**
|
|
178
|
+
* Start a program with an argument array, never a shell string.
|
|
179
|
+
*
|
|
180
|
+
* `gkm build`, `gkm docker` and `gkm deploy` pass values that come from the
|
|
181
|
+
* workspace — image refs, tags, build args, package names — to `docker` and
|
|
182
|
+
* `turbo`. Joined into a string and handed to a shell, a package named
|
|
183
|
+
* `x;curl …|sh` or a tag holding `$(…)` became part of the command line, which
|
|
184
|
+
* matters most where the CLI builds a repository it didn't write: a CI job for a
|
|
185
|
+
* fork, a shared build runner. Here every value reaches the program as one
|
|
186
|
+
* `argv` element, whatever it contains.
|
|
187
|
+
*/
|
|
188
|
+
/** Long enough for a cold image build; short enough that a hung one ends. */
|
|
189
|
+
const DEFAULT_TIMEOUT_MS = 18e5;
|
|
190
|
+
/** How long a timed-out child has to exit on SIGTERM before it is killed. */
|
|
191
|
+
const KILL_GRACE_MS = 5e3;
|
|
192
|
+
/** The command line as a person would read it — for messages, never to run. */
|
|
193
|
+
function display(command, args) {
|
|
194
|
+
return [command, ...args].join(" ");
|
|
195
|
+
}
|
|
196
|
+
/** The program ran and exited unsuccessfully; its own output said why. */
|
|
197
|
+
var CommandFailed = class extends Error {
|
|
198
|
+
command;
|
|
199
|
+
args;
|
|
200
|
+
exitCode;
|
|
201
|
+
signal;
|
|
202
|
+
constructor(command, args, exitCode, signal) {
|
|
203
|
+
super(`\`${display(command, args)}\` ${exitCode === null ? `was stopped by ${signal ?? "a signal"}` : `exited with code ${exitCode}`}. Its output above says why; run it by hand to see it again.`);
|
|
204
|
+
this.command = command;
|
|
205
|
+
this.args = args;
|
|
206
|
+
this.exitCode = exitCode;
|
|
207
|
+
this.signal = signal;
|
|
208
|
+
this.name = "CommandFailed";
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
/** The program ran past its timeout and was killed. */
|
|
212
|
+
var CommandTimedOut = class extends Error {
|
|
213
|
+
command;
|
|
214
|
+
args;
|
|
215
|
+
timeoutMs;
|
|
216
|
+
constructor(command, args, timeoutMs) {
|
|
217
|
+
super(`\`${display(command, args)}\` was still running after ${Math.round(timeoutMs / 1e3)}s and was stopped. Check what it was waiting on — a registry, the Docker daemon, a prompt — and run it again.`);
|
|
218
|
+
this.command = command;
|
|
219
|
+
this.args = args;
|
|
220
|
+
this.timeoutMs = timeoutMs;
|
|
221
|
+
this.name = "CommandTimedOut";
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Run `command` with `args`, resolving when it exits 0.
|
|
226
|
+
*
|
|
227
|
+
* Rejects with {@link CommandFailed} on any other exit, {@link CommandTimedOut}
|
|
228
|
+
* once `timeoutMs` passes (after the child is gone), and with the spawn error
|
|
229
|
+
* itself when the program cannot be started at all — `ENOENT` already names it.
|
|
230
|
+
*/
|
|
231
|
+
async function run(command, args, options = {}) {
|
|
232
|
+
await spawnChild(command, args, options, false);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* {@link run}, resolving with what the program wrote to stdout — for a value
|
|
236
|
+
* the CLI reads back, such as the digest `docker inspect` reports. stderr still
|
|
237
|
+
* reaches the terminal, so a failure explains itself the same way.
|
|
238
|
+
*/
|
|
239
|
+
function runOutput(command, args, options = {}) {
|
|
240
|
+
return spawnChild(command, args, options, true);
|
|
241
|
+
}
|
|
242
|
+
function spawnChild(command, args, options, capture) {
|
|
243
|
+
const { timeoutMs = DEFAULT_TIMEOUT_MS, ...spawnOptions } = options;
|
|
244
|
+
return new Promise((resolve, reject) => {
|
|
245
|
+
const child = (0, node_child_process.spawn)(command, [...args], {
|
|
246
|
+
stdio: "inherit",
|
|
247
|
+
...spawnOptions,
|
|
248
|
+
...capture ? { stdio: [
|
|
249
|
+
"ignore",
|
|
250
|
+
"pipe",
|
|
251
|
+
"inherit"
|
|
252
|
+
] } : {},
|
|
253
|
+
shell: false
|
|
254
|
+
});
|
|
255
|
+
let stdout = "";
|
|
256
|
+
child.stdout?.on("data", (chunk) => {
|
|
257
|
+
stdout += chunk.toString();
|
|
258
|
+
});
|
|
259
|
+
let timedOut = false;
|
|
260
|
+
let killer;
|
|
261
|
+
const timer = setTimeout(() => {
|
|
262
|
+
timedOut = true;
|
|
263
|
+
child.kill("SIGTERM");
|
|
264
|
+
killer = setTimeout(() => child.kill("SIGKILL"), KILL_GRACE_MS);
|
|
265
|
+
killer.unref?.();
|
|
266
|
+
}, timeoutMs);
|
|
267
|
+
timer.unref?.();
|
|
268
|
+
const settle = () => {
|
|
269
|
+
clearTimeout(timer);
|
|
270
|
+
if (killer) clearTimeout(killer);
|
|
271
|
+
};
|
|
272
|
+
child.on("error", (error) => {
|
|
273
|
+
settle();
|
|
274
|
+
reject(spawnOptions.signal?.aborted ? spawnOptions.signal.reason : error);
|
|
275
|
+
});
|
|
276
|
+
child.on("close", (code, signal) => {
|
|
277
|
+
settle();
|
|
278
|
+
if (spawnOptions.signal?.aborted) reject(spawnOptions.signal.reason);
|
|
279
|
+
else if (timedOut) reject(new CommandTimedOut(command, args, timeoutMs));
|
|
280
|
+
else if (code === 0) resolve(stdout);
|
|
281
|
+
else reject(new CommandFailed(command, args, code, signal));
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region src/deploy/identity.ts
|
|
287
|
+
/**
|
|
288
|
+
* Who a deploy is, on a target it shares with other workspaces.
|
|
289
|
+
*
|
|
290
|
+
* A Dokploy server is one flat namespace of projects, images and Docker
|
|
291
|
+
* service names. Deploys used to identify everything they made by the
|
|
292
|
+
* workspace name alone, so two workspaces called `shop` — or `Shop` and
|
|
293
|
+
* `shop` — deploying to one server landed in the same project, pushed over
|
|
294
|
+
* each other's images and redeployed each other's applications. A
|
|
295
|
+
* `DeployIdentity` is what a deploy names and claims its resources by instead.
|
|
296
|
+
*/
|
|
297
|
+
var identity_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
298
|
+
DeployNamespaceInvalid: () => DeployNamespaceInvalid,
|
|
299
|
+
DeployProjectNameInvalid: () => DeployProjectNameInvalid,
|
|
300
|
+
applicationName: () => applicationName,
|
|
301
|
+
defaultNamespace: () => defaultNamespace,
|
|
302
|
+
deployIdentity: () => deployIdentity,
|
|
303
|
+
imageName: () => imageName,
|
|
304
|
+
imageRef: () => imageRef,
|
|
305
|
+
isOwnedBy: () => isOwnedBy,
|
|
306
|
+
markerOf: () => markerOf,
|
|
307
|
+
ownershipMarker: () => ownershipMarker,
|
|
308
|
+
projectName: () => projectName,
|
|
309
|
+
stageTag: () => stageTag
|
|
310
|
+
});
|
|
311
|
+
/** A namespace that cannot be part of a Dokploy name or an image path. */
|
|
312
|
+
var DeployNamespaceInvalid = class extends require_errors.GkmError {
|
|
313
|
+
namespace;
|
|
314
|
+
constructor(namespace) {
|
|
315
|
+
super(`deploy.namespace '${namespace}' is not usable as a name: use lowercase letters, digits and single '-' between them (e.g. 'acme' or 'acme-platform') in gkm.config.ts.`);
|
|
316
|
+
this.namespace = namespace;
|
|
317
|
+
this.name = "DeployNamespaceInvalid";
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
/** A workspace name with nothing a target can name a resource by. */
|
|
321
|
+
var DeployProjectNameInvalid = class extends require_errors.GkmError {
|
|
322
|
+
workspaceName;
|
|
323
|
+
constructor(workspaceName) {
|
|
324
|
+
super(`The workspace name '${workspaceName}' has no letters or digits to name deployed resources by. Set "name" in gkm.config.ts.`);
|
|
325
|
+
this.workspaceName = workspaceName;
|
|
326
|
+
this.name = "DeployProjectNameInvalid";
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
const NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
330
|
+
/**
|
|
331
|
+
* Lowercase `[a-z0-9-]`, runs of anything else collapsed to one `-`: valid as
|
|
332
|
+
* a Docker image path component, a Docker service name and a Dokploy name.
|
|
333
|
+
*/
|
|
334
|
+
function slug(value) {
|
|
335
|
+
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
336
|
+
}
|
|
337
|
+
/** The namespace a workspace is in when it does not name one. */
|
|
338
|
+
function defaultNamespace(workspaceName) {
|
|
339
|
+
return slug((0, _geekmidas_manifest.kebabCase)(workspaceName));
|
|
340
|
+
}
|
|
341
|
+
function deployIdentity(workspace, stage) {
|
|
342
|
+
const project = slug(workspace.name);
|
|
343
|
+
if (!project) throw new DeployProjectNameInvalid(workspace.name);
|
|
344
|
+
const fallback = defaultNamespace(workspace.name);
|
|
345
|
+
const namespace = workspace.deploy?.namespace ?? fallback;
|
|
346
|
+
if (!NAME.test(namespace)) throw new DeployNamespaceInvalid(namespace);
|
|
347
|
+
return {
|
|
348
|
+
namespace,
|
|
349
|
+
project,
|
|
350
|
+
stage,
|
|
351
|
+
key: `${namespace}/${project}`,
|
|
352
|
+
scope: namespace === fallback ? project : `${namespace}-${project}`
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* The token a Dokploy project's description carries to say which identity
|
|
357
|
+
* created it. A project with the right name and no marker belongs to someone
|
|
358
|
+
* else, and a deploy never adopts it.
|
|
359
|
+
*/
|
|
360
|
+
function ownershipMarker(identity) {
|
|
361
|
+
return `gkm:${identity.key}`;
|
|
362
|
+
}
|
|
363
|
+
/** Whether a project description carries `identity`'s marker. */
|
|
364
|
+
function isOwnedBy(description, identity) {
|
|
365
|
+
const marker = ownershipMarker(identity);
|
|
366
|
+
return (description ?? "").split(/\s+/).includes(marker);
|
|
367
|
+
}
|
|
368
|
+
/** Any `gkm:` marker a description carries — whoever's it is. */
|
|
369
|
+
function markerOf(description) {
|
|
370
|
+
return (description ?? "").split(/\s+/).find((t) => t.startsWith("gkm:"));
|
|
371
|
+
}
|
|
372
|
+
/** What the Dokploy project is called. */
|
|
373
|
+
function projectName(identity) {
|
|
374
|
+
return identity.scope;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* The repository an app's image is pushed to, below the registry:
|
|
378
|
+
* `<namespace>/<project>-<app>`.
|
|
379
|
+
*
|
|
380
|
+
* The namespace is a path segment of its own so that a registry that maps
|
|
381
|
+
* paths to owners (an organisation's packages, a Harbor project) can grant it
|
|
382
|
+
* as one; the app is joined to the project so the two read as one name.
|
|
383
|
+
*/
|
|
384
|
+
function imageName(identity, app) {
|
|
385
|
+
return `${identity.namespace}/${identity.project}-${slug((0, _geekmidas_manifest.kebabCase)(app))}`;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* The tag every image a stage runs carries for a release: `v1.4.0-production`
|
|
389
|
+
* and `v1.4.0-staging` are two images of the same commit.
|
|
390
|
+
*
|
|
391
|
+
* Each stage builds its own: a site inlines its stage's public URLs, and two
|
|
392
|
+
* builds of one commit are never byte-for-byte the same image anyway. So a
|
|
393
|
+
* tag shared by two stages would be owned by whichever push finished last,
|
|
394
|
+
* and the other stage would deploy, or fail to find, an image it never built.
|
|
395
|
+
* Every target names every image it builds, pushes and pulls through this.
|
|
396
|
+
*/
|
|
397
|
+
function stageTag(tag, stage) {
|
|
398
|
+
return `${tag}-${stage}`;
|
|
399
|
+
}
|
|
400
|
+
/** The full image ref an app is built, pushed and deployed as. */
|
|
401
|
+
function imageRef(identity, app, registry, tag) {
|
|
402
|
+
const name = imageName(identity, app);
|
|
403
|
+
return registry ? `${registry.replace(/\/+$/, "")}/${name}:${tag}` : `${name}:${tag}`;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* What one application is called on the target.
|
|
407
|
+
*
|
|
408
|
+
* The same rule the constructs use, through the same `scopedName`, scoped by
|
|
409
|
+
* the stage and the identity: the application beside
|
|
410
|
+
* `production-kitchen-sink-database` is `production-kitchen-sink-api`. A
|
|
411
|
+
* Dokploy application's name is also its Docker service name, which is unique
|
|
412
|
+
* on the whole server, so the namespace has to be in it too — `acme`'s and
|
|
413
|
+
* `globex`'s `shop` would otherwise both run `production-shop-api`.
|
|
414
|
+
*
|
|
415
|
+
* The app id is dropped when it repeats the project, so a project named for its
|
|
416
|
+
* one application is `production-kitchen-sink` rather than
|
|
417
|
+
* `production-kitchen-sink-kitchen-sink`.
|
|
418
|
+
*/
|
|
419
|
+
function applicationName(identity, app) {
|
|
420
|
+
return slug(app) === identity.project ? `${identity.stage}-${identity.scope}` : (0, _geekmidas_manifest.scopedName)([identity.stage, identity.scope], app);
|
|
421
|
+
}
|
|
422
|
+
//#endregion
|
|
423
|
+
//#region src/secrets/keystore.ts
|
|
424
|
+
/**
|
|
425
|
+
* The keys that open each stage's encrypted secrets file, kept outside the
|
|
426
|
+
* project in the CLI's home.
|
|
427
|
+
*
|
|
428
|
+
* Keys were kept at `~/.gkm/<folder>/<stage>.key`, named after the project
|
|
429
|
+
* directory — so two checkouts in folders with the same name (`~/work/api`
|
|
430
|
+
* and `~/oss/api`) shared one key, and the second `gkm secrets:init`
|
|
431
|
+
* overwrote the first project's. They are now kept under the project's
|
|
432
|
+
* identity, `<home>/keys/<namespace>/<project>/<stage>.key`, the same
|
|
433
|
+
* `<namespace>/<project>` a deploy claims its Dokploy project by. A key still
|
|
434
|
+
* at the old place is copied to the new one the first time it is read; the
|
|
435
|
+
* old file stays, so an older CLI on the same machine keeps working.
|
|
436
|
+
*/
|
|
437
|
+
/** Key length for AES-256 encryption */
|
|
438
|
+
const KEY_LENGTH = 32;
|
|
439
|
+
/** A keystore project key that is not `<namespace>/<project>`. */
|
|
440
|
+
var KeystoreProjectInvalid = class extends require_errors.GkmError {
|
|
441
|
+
key;
|
|
442
|
+
constructor(key) {
|
|
443
|
+
super(`'${key}' is not a keystore project: expected '<namespace>/<project>' in lowercase letters, digits and '-', as deployIdentity() produces. Pass the workspace's identity key.`);
|
|
444
|
+
this.key = key;
|
|
445
|
+
this.name = "KeystoreProjectInvalid";
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
/** A stage has no key, here or at the place keys used to be kept. */
|
|
449
|
+
var KeyNotFound = class extends require_errors.GkmError {
|
|
450
|
+
stage;
|
|
451
|
+
project;
|
|
452
|
+
path;
|
|
453
|
+
constructor(stage, project, path) {
|
|
454
|
+
super(`Encryption key not found for stage "${stage}" in project "${project}". Expected key at: ${path}. Run \`gkm secrets:init --stage ${stage}\` to create one, or copy the stage's key there.`);
|
|
455
|
+
this.stage = stage;
|
|
456
|
+
this.project = project;
|
|
457
|
+
this.path = path;
|
|
458
|
+
this.name = "KeyNotFound";
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
const PROJECT_KEY = /^[a-z0-9]+(?:-[a-z0-9]+)*\/[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
462
|
+
/**
|
|
463
|
+
* The keystore key of a workspace: its deploy identity without the stage, so
|
|
464
|
+
* a project's keys and its Dokploy project are named by the same thing.
|
|
465
|
+
*/
|
|
466
|
+
function projectKey(workspace) {
|
|
467
|
+
return deployIdentity(workspace, "").key;
|
|
468
|
+
}
|
|
469
|
+
/** The keystore project of a loaded workspace. */
|
|
470
|
+
function keystoreProject(workspace, home) {
|
|
471
|
+
const key = projectKey(workspace);
|
|
472
|
+
const unscoped = projectKey({ name: workspace.name });
|
|
473
|
+
return {
|
|
474
|
+
key,
|
|
475
|
+
legacy: [.../* @__PURE__ */ new Set([folderName(workspace.root), workspace.name])].filter((name) => !!name),
|
|
476
|
+
...unscoped !== key ? { aliases: [unscoped] } : {},
|
|
477
|
+
...home ? { home } : {}
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Whether `name` stays inside the home it is joined to. A workspace name was
|
|
482
|
+
* joined as is — `@acme/shop` is `~/.gkm/@acme/shop` — but never upwards.
|
|
483
|
+
*/
|
|
484
|
+
function isLegacyName(name) {
|
|
485
|
+
return name.split(/[\\/]/).every((part) => part !== ".." && part !== "");
|
|
486
|
+
}
|
|
487
|
+
/** The last segment of a path, as the old keystore named projects. */
|
|
488
|
+
function folderName(path) {
|
|
489
|
+
const name = path.split(/[\\/]/).filter(Boolean).at(-1);
|
|
490
|
+
return name && name !== "." && name !== ".." ? name : void 0;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Get the keystore directory for a project:
|
|
494
|
+
* `<home>/keys/<namespace>/<project>`.
|
|
495
|
+
*/
|
|
496
|
+
function getKeystoreDir(project) {
|
|
497
|
+
if (!PROJECT_KEY.test(project.key)) throw new KeystoreProjectInvalid(project.key);
|
|
498
|
+
const [namespace, name] = project.key.split("/");
|
|
499
|
+
return (0, node_path.join)(project.home ?? gkmHome(), "keys", namespace, name);
|
|
500
|
+
}
|
|
501
|
+
/** Get the path to a stage's encryption key. */
|
|
502
|
+
function getKeyPath(stage, project) {
|
|
503
|
+
return (0, node_path.join)(getKeystoreDir(project), `${stage}.key`);
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Where else a stage's key may be, most likely first: under an alias of the
|
|
507
|
+
* project, then where keys were kept before they were keyed by identity —
|
|
508
|
+
* under the configured home, then under `~/.gkm`, which is where every CLI
|
|
509
|
+
* before `GKM_HOME` wrote.
|
|
510
|
+
*/
|
|
511
|
+
function legacyKeyPaths(stage, project) {
|
|
512
|
+
const aliases = (project.aliases ?? []).map((key) => getKeyPath(stage, {
|
|
513
|
+
key,
|
|
514
|
+
home: project.home
|
|
515
|
+
}));
|
|
516
|
+
const homes = [.../* @__PURE__ */ new Set([project.home ?? gkmHome(), (0, node_path.join)((0, node_os.homedir)(), ".gkm")])];
|
|
517
|
+
const names = (project.legacy ?? []).filter(isLegacyName);
|
|
518
|
+
return [...aliases, ...names.flatMap((name) => homes.map((home) => (0, node_path.join)(home, name, `${stage}.key`)))];
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Generate a new encryption key for a stage, stored owner-only at
|
|
522
|
+
* `<home>/keys/<namespace>/<project>/<stage>.key`.
|
|
523
|
+
*/
|
|
524
|
+
async function generateKey(stage, project, flag = "w") {
|
|
525
|
+
const keyDir = getKeystoreDir(project);
|
|
526
|
+
const keyPath = getKeyPath(stage, project);
|
|
527
|
+
await (0, node_fs_promises.mkdir)(keyDir, {
|
|
528
|
+
recursive: true,
|
|
529
|
+
mode: 448
|
|
530
|
+
});
|
|
531
|
+
const key = (0, node_crypto.randomBytes)(KEY_LENGTH).toString("hex");
|
|
532
|
+
await placeKey(keyPath, key, flag === "wx");
|
|
533
|
+
return key;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Put a key at `keyPath` whole, or not at all.
|
|
537
|
+
*
|
|
538
|
+
* Written beside it first, then linked (exclusive) or renamed into place.
|
|
539
|
+
* Writing the path directly — even with `wx` — creates it empty and fills it
|
|
540
|
+
* after, and another process reading in between found an empty key and
|
|
541
|
+
* failed with `KeyNotFound`: two commands, or two test files, creating one
|
|
542
|
+
* project's key at once.
|
|
543
|
+
*/
|
|
544
|
+
async function placeKey(keyPath, key, exclusive) {
|
|
545
|
+
const staged = `${keyPath}.${process.pid}.${(0, node_crypto.randomBytes)(4).toString("hex")}`;
|
|
546
|
+
await (0, node_fs_promises.writeFile)(staged, key, {
|
|
547
|
+
mode: 384,
|
|
548
|
+
encoding: "utf-8"
|
|
549
|
+
});
|
|
550
|
+
try {
|
|
551
|
+
if (exclusive) await (0, node_fs_promises.link)(staged, keyPath);
|
|
552
|
+
else await (0, node_fs_promises.rename)(staged, keyPath);
|
|
553
|
+
} finally {
|
|
554
|
+
await (0, node_fs_promises.rm)(staged, { force: true });
|
|
555
|
+
}
|
|
556
|
+
await (0, node_fs_promises.chmod)(keyPath, 384);
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Copy a key from where it used to be kept to where it is kept now.
|
|
560
|
+
*
|
|
561
|
+
* Copied, not moved: an older CLI on the same machine still reads the old
|
|
562
|
+
* place. Exclusive, so two processes migrating at once cannot overwrite a key
|
|
563
|
+
* one of them already put there.
|
|
564
|
+
*/
|
|
565
|
+
async function migrateLegacyKey(stage, project) {
|
|
566
|
+
const legacy = legacyKeyPaths(stage, project).find((path) => (0, node_fs.existsSync)(path));
|
|
567
|
+
if (!legacy) return false;
|
|
568
|
+
const keyPath = getKeyPath(stage, project);
|
|
569
|
+
await (0, node_fs_promises.mkdir)(getKeystoreDir(project), {
|
|
570
|
+
recursive: true,
|
|
571
|
+
mode: 448
|
|
572
|
+
});
|
|
573
|
+
try {
|
|
574
|
+
await placeKey(keyPath, await (0, node_fs_promises.readFile)(legacy, "utf-8"), true);
|
|
575
|
+
} catch (error) {
|
|
576
|
+
if (error.code !== "EEXIST") throw error;
|
|
577
|
+
}
|
|
578
|
+
return true;
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Read an encryption key for a stage, or `null` when there is none — after
|
|
582
|
+
* copying it over from where keys used to be kept, if it is still there.
|
|
583
|
+
*/
|
|
584
|
+
async function readKey(stage, project) {
|
|
585
|
+
const keyPath = getKeyPath(stage, project);
|
|
586
|
+
if (!(0, node_fs.existsSync)(keyPath) && !await migrateLegacyKey(stage, project)) return null;
|
|
587
|
+
return (await (0, node_fs_promises.readFile)(keyPath, "utf-8")).trim();
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Read an encryption key for a stage, throwing {@link KeyNotFound} if there
|
|
591
|
+
* is none.
|
|
592
|
+
*/
|
|
593
|
+
async function requireKey(stage, project) {
|
|
594
|
+
const key = await readKey(stage, project);
|
|
595
|
+
if (!key) throw new KeyNotFound(stage, project.key, getKeyPath(stage, project));
|
|
596
|
+
return key;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Get or create a key for a stage.
|
|
600
|
+
* If the key already exists, it is returned. Otherwise, a new key is generated.
|
|
601
|
+
*/
|
|
602
|
+
async function getOrCreateKey(stage, project) {
|
|
603
|
+
const existingKey = await readKey(stage, project);
|
|
604
|
+
if (existingKey) return existingKey;
|
|
605
|
+
try {
|
|
606
|
+
return await generateKey(stage, project, "wx");
|
|
607
|
+
} catch (error) {
|
|
608
|
+
if (error.code !== "EEXIST") throw error;
|
|
609
|
+
return requireKey(stage, project);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
//#endregion
|
|
613
|
+
//#region src/secrets/file.ts
|
|
614
|
+
/** Where the files live, relative to the project root. */
|
|
615
|
+
const SECRETS_DIR = ".gkm/secrets";
|
|
616
|
+
/** AES-256-GCM configuration */
|
|
617
|
+
const ALGORITHM = "aes-256-gcm";
|
|
618
|
+
const IV_LENGTH = 12;
|
|
619
|
+
/**
|
|
620
|
+
* A stage's secrets as an encrypted file on this machine:
|
|
621
|
+
* `.gkm/secrets/<stage>.json`, with its key in the CLI's home at
|
|
622
|
+
* `keys/<namespace>/<project>/<stage>.key`.
|
|
623
|
+
*
|
|
624
|
+
* The local stage's store, always — its secrets belong to the machine running
|
|
625
|
+
* `gkm dev` — and a deployed stage's when `secrets.store` is `'file'`.
|
|
626
|
+
*/
|
|
627
|
+
var FileSecretsStore = class {
|
|
628
|
+
root;
|
|
629
|
+
name = "file";
|
|
630
|
+
project;
|
|
631
|
+
/**
|
|
632
|
+
* @param project - Whose keys: a workspace's `keystoreProject()`. Outside a
|
|
633
|
+
* workspace there is no config to name the project, so it is named the
|
|
634
|
+
* way a workspace without `name` is — its package name, else its folder.
|
|
635
|
+
*/
|
|
636
|
+
constructor(root, project) {
|
|
637
|
+
this.root = root;
|
|
638
|
+
this.project = project ?? {
|
|
639
|
+
key: projectKey({ name: packageName(root) ?? (0, node_path.basename)(root) }),
|
|
640
|
+
legacy: [(0, node_path.basename)(root)]
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
/** The file a stage's secrets are kept in. */
|
|
644
|
+
path(stage) {
|
|
645
|
+
return (0, node_path.join)(this.root, SECRETS_DIR, `${stage}.json`);
|
|
646
|
+
}
|
|
647
|
+
async read(stage) {
|
|
648
|
+
const path = this.path(stage);
|
|
649
|
+
if (!(0, node_fs.existsSync)(path)) return null;
|
|
650
|
+
const data = JSON.parse(await (0, node_fs_promises.readFile)(path, "utf-8"));
|
|
651
|
+
if (!(data.version === 1 && data.encrypted && data.iv)) return data;
|
|
652
|
+
const key = await readKey(stage, this.project);
|
|
653
|
+
if (!key) throw new MissingSecretsKey(stage, this.project.key, getKeyPath(stage, this.project));
|
|
654
|
+
return decrypt(data, key);
|
|
655
|
+
}
|
|
656
|
+
async write(stage, secrets) {
|
|
657
|
+
await (0, node_fs_promises.mkdir)((0, node_path.join)(this.root, SECRETS_DIR), { recursive: true });
|
|
658
|
+
const key = await getOrCreateKey(stage, this.project);
|
|
659
|
+
await (0, node_fs_promises.writeFile)(this.path(stage), JSON.stringify(encrypt(secrets, key), null, 2), "utf-8");
|
|
660
|
+
}
|
|
661
|
+
/** The stage's file. Its key is kept: it opens nothing once this is gone. */
|
|
662
|
+
async delete(stage) {
|
|
663
|
+
await (0, node_fs_promises.rm)(this.path(stage), { force: true });
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
/** A stage's secrets file exists, and the key that opens it does not. */
|
|
667
|
+
var MissingSecretsKey = class extends require_errors.GkmError {
|
|
668
|
+
stage;
|
|
669
|
+
project;
|
|
670
|
+
path;
|
|
671
|
+
constructor(stage, project, path) {
|
|
672
|
+
super(`Decryption key not found for stage "${stage}". Expected key at: ${path}. Copy the stage's key there from whoever created it, or set secrets.store to a store this machine can reach.`);
|
|
673
|
+
this.stage = stage;
|
|
674
|
+
this.project = project;
|
|
675
|
+
this.path = path;
|
|
676
|
+
this.name = "MissingSecretsKey";
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
/** A project's package name without its scope, as a workspace name reads it. */
|
|
680
|
+
function packageName(root) {
|
|
681
|
+
try {
|
|
682
|
+
const pkg = JSON.parse((0, node_fs.readFileSync)((0, node_path.join)(root, "package.json"), "utf-8"));
|
|
683
|
+
return typeof pkg.name === "string" ? pkg.name.replace(/^@[^/]+\//, "") : void 0;
|
|
684
|
+
} catch {
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Encrypt a JSON value with a stage key: AES-256-GCM, the file format every
|
|
690
|
+
* stage's secrets are kept in.
|
|
691
|
+
*/
|
|
692
|
+
function encrypt(secrets, keyHex) {
|
|
693
|
+
const key = Buffer.from(keyHex, "hex");
|
|
694
|
+
const iv = (0, node_crypto.randomBytes)(IV_LENGTH);
|
|
695
|
+
const cipher = (0, node_crypto.createCipheriv)(ALGORITHM, key, iv);
|
|
696
|
+
const ciphertext = Buffer.concat([cipher.update(JSON.stringify(secrets), "utf-8"), cipher.final()]);
|
|
697
|
+
return {
|
|
698
|
+
version: 1,
|
|
699
|
+
encrypted: Buffer.concat([ciphertext, cipher.getAuthTag()]).toString("base64"),
|
|
700
|
+
iv: iv.toString("hex")
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
/** Decrypt what {@link encrypt} wrote. */
|
|
704
|
+
function decrypt(data, keyHex) {
|
|
705
|
+
const key = Buffer.from(keyHex, "hex");
|
|
706
|
+
const combined = Buffer.from(data.encrypted, "base64");
|
|
707
|
+
const decipher = (0, node_crypto.createDecipheriv)(ALGORITHM, key, Buffer.from(data.iv, "hex"));
|
|
708
|
+
decipher.setAuthTag(combined.subarray(-16));
|
|
709
|
+
const plaintext = Buffer.concat([decipher.update(combined.subarray(0, -16)), decipher.final()]);
|
|
710
|
+
return JSON.parse(plaintext.toString("utf-8"));
|
|
711
|
+
}
|
|
712
|
+
//#endregion
|
|
713
|
+
//#region src/build/native.ts
|
|
714
|
+
/**
|
|
715
|
+
* The file beside a bundle naming the packages it left out, each at the
|
|
716
|
+
* version the build resolved: a `package.json` an image installs, for its own
|
|
717
|
+
* platform, next to the bundle. `server.mjs` → `server.externals.json`.
|
|
718
|
+
*/
|
|
719
|
+
function externalsManifestName(outfile) {
|
|
720
|
+
return `${outfile.replace(/\.mjs$/, "")}.externals.json`;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Asked to leave a package out of the bundle, and nothing the app depends on
|
|
724
|
+
* provides it: there is no version to install in the image.
|
|
725
|
+
*/
|
|
726
|
+
var ExternalNotInstalled = class extends Error {
|
|
727
|
+
packageName;
|
|
728
|
+
root;
|
|
729
|
+
constructor(packageName, root) {
|
|
730
|
+
super(`'${packageName}' is left out of the bundle, to be installed beside it, but it is not installed for the app at ${root}: add it to the app's dependencies.`);
|
|
731
|
+
this.packageName = packageName;
|
|
732
|
+
this.root = root;
|
|
733
|
+
this.name = "ExternalNotInstalled";
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
/** Packages whose job is loading a compiled addon. */
|
|
737
|
+
const NATIVE_LOADERS = /* @__PURE__ */ new Set([
|
|
738
|
+
"bindings",
|
|
739
|
+
"node-gyp-build",
|
|
740
|
+
"node-gyp-build-optional-packages",
|
|
741
|
+
"node-pre-gyp",
|
|
742
|
+
"@mapbox/node-pre-gyp",
|
|
743
|
+
"prebuild-install",
|
|
744
|
+
"@neon-rs/load"
|
|
745
|
+
]);
|
|
746
|
+
/** A per-platform binary package: `@node-rs/argon2-linux-x64-gnu`, `@img/sharp-darwin-arm64`. */
|
|
747
|
+
const PLATFORM_PACKAGE = /(?:^|[-/])(?:linux|darwin|win32|freebsd|android)-(?:x64|arm64|arm|ia32)\b/;
|
|
748
|
+
function readPackage(dir) {
|
|
749
|
+
try {
|
|
750
|
+
return JSON.parse((0, node_fs.readFileSync)((0, node_path.join)(dir, "package.json"), "utf-8"));
|
|
751
|
+
} catch {
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Where `name` resolves from `from`, the way Node finds it: the nearest
|
|
757
|
+
* `node_modules/<name>` walking up. Followed through symlinks, so a pnpm
|
|
758
|
+
* store package resolves its own dependencies beside it.
|
|
759
|
+
*/
|
|
760
|
+
function locate(name, from) {
|
|
761
|
+
let dir = from;
|
|
762
|
+
for (;;) {
|
|
763
|
+
const candidate = (0, node_path.join)(dir, "node_modules", name);
|
|
764
|
+
if ((0, node_fs.existsSync)((0, node_path.join)(candidate, "package.json"))) return (0, node_fs.realpathSync)(candidate);
|
|
765
|
+
const parent = (0, node_path.dirname)(dir);
|
|
766
|
+
if (parent === dir) return void 0;
|
|
767
|
+
dir = parent;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Whether a package carries compiled code: a `binding.gyp` or prebuilt
|
|
772
|
+
* binaries of its own, a loader for them, or a binary package per platform.
|
|
773
|
+
* Such a package cannot be inlined into a bundle — it loads a `.node` file
|
|
774
|
+
* from beside its own source, for the platform it was installed on.
|
|
775
|
+
*/
|
|
776
|
+
function isNativePackage(dir, pkg) {
|
|
777
|
+
if (pkg.gypfile || pkg.binary || pkg.napi) return true;
|
|
778
|
+
if (Object.keys({
|
|
779
|
+
...pkg.dependencies,
|
|
780
|
+
...pkg.optionalDependencies
|
|
781
|
+
}).some((dep) => NATIVE_LOADERS.has(dep))) return true;
|
|
782
|
+
if (Object.keys(pkg.optionalDependencies ?? {}).some((dep) => PLATFORM_PACKAGE.test(dep))) return true;
|
|
783
|
+
if ((0, node_fs.existsSync)((0, node_path.join)(dir, "binding.gyp"))) return true;
|
|
784
|
+
if ((0, node_fs.existsSync)((0, node_path.join)(dir, "prebuilds"))) return true;
|
|
785
|
+
try {
|
|
786
|
+
return (0, node_fs.readdirSync)(dir).some((file) => file.endsWith(".node"));
|
|
787
|
+
} catch {
|
|
788
|
+
return false;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* The packages with native code an app's bundle would otherwise inline, each
|
|
793
|
+
* at the version installed for it.
|
|
794
|
+
*
|
|
795
|
+
* Walks what the app depends on at runtime — `dependencies`, never
|
|
796
|
+
* `devDependencies` — through workspace packages and installed ones alike,
|
|
797
|
+
* since anything reached is bundled. A native package is where the walk
|
|
798
|
+
* stops: installing it brings what it depends on.
|
|
799
|
+
*/
|
|
800
|
+
function nativeDependencies(root) {
|
|
801
|
+
const found = {};
|
|
802
|
+
const seen = /* @__PURE__ */ new Set();
|
|
803
|
+
const queue = [(0, node_fs.realpathSync)(root)];
|
|
804
|
+
while (queue.length > 0) {
|
|
805
|
+
const dir = queue.shift();
|
|
806
|
+
if (seen.has(dir)) continue;
|
|
807
|
+
seen.add(dir);
|
|
808
|
+
const pkg = readPackage(dir);
|
|
809
|
+
if (!pkg) continue;
|
|
810
|
+
const isRoot = seen.size === 1;
|
|
811
|
+
const installed = dir.split(node_path.sep).includes("node_modules");
|
|
812
|
+
if (!isRoot && installed && isNativePackage(dir, pkg)) {
|
|
813
|
+
if ((!pkg.os || pkg.os.includes("linux") || pkg.os.every((os) => os.startsWith("!")) && !pkg.os.includes("!linux")) && pkg.name && pkg.version && !(pkg.name in found)) found[pkg.name] = pkg.version;
|
|
814
|
+
continue;
|
|
815
|
+
}
|
|
816
|
+
for (const dep of Object.keys({
|
|
817
|
+
...pkg.dependencies,
|
|
818
|
+
...pkg.optionalDependencies
|
|
819
|
+
})) {
|
|
820
|
+
const location = locate(dep, dir);
|
|
821
|
+
if (location && !seen.has(location)) queue.push(location);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
return Object.fromEntries(Object.entries(found).sort(([a], [b]) => a.localeCompare(b)));
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* What a bundle leaves out, with the version of each to install: the native
|
|
828
|
+
* packages found under `root`, and any it was asked to leave out besides,
|
|
829
|
+
* at the version installed for the app.
|
|
830
|
+
*/
|
|
831
|
+
function bundleExternals(root, declared) {
|
|
832
|
+
const externals = nativeDependencies(root);
|
|
833
|
+
for (const name of declared) {
|
|
834
|
+
if (name in externals) continue;
|
|
835
|
+
const location = locate(name, root);
|
|
836
|
+
const version = location ? readPackage(location)?.version : void 0;
|
|
837
|
+
if (!version) throw new ExternalNotInstalled(name, root);
|
|
838
|
+
externals[name] = version;
|
|
839
|
+
}
|
|
840
|
+
return Object.fromEntries(Object.entries(externals).sort(([a], [b]) => a.localeCompare(b)));
|
|
841
|
+
}
|
|
842
|
+
/** The package a bare specifier names: `argon2/lib` → `argon2`, `@a/b/c` → `@a/b`. */
|
|
843
|
+
function packageOf(specifier) {
|
|
844
|
+
const parts = specifier.split("/");
|
|
845
|
+
return specifier.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* The packages a bundle imports at runtime rather than inlining, read from
|
|
849
|
+
* esbuild's metafile. Nothing when there is no metafile.
|
|
850
|
+
*/
|
|
851
|
+
function importedPackages(metafile) {
|
|
852
|
+
let meta;
|
|
853
|
+
try {
|
|
854
|
+
meta = JSON.parse((0, node_fs.readFileSync)(metafile, "utf-8"));
|
|
855
|
+
} catch {
|
|
856
|
+
return /* @__PURE__ */ new Set();
|
|
857
|
+
}
|
|
858
|
+
const imported = /* @__PURE__ */ new Set();
|
|
859
|
+
for (const output of Object.values(meta.outputs ?? {})) for (const { path, external } of output.imports ?? []) if (external && !path.startsWith(".") && !path.startsWith("node:")) imported.add(packageOf(path));
|
|
860
|
+
return imported;
|
|
861
|
+
}
|
|
862
|
+
//#endregion
|
|
863
|
+
//#region src/secrets/storage.ts
|
|
864
|
+
/**
|
|
865
|
+
* What a stage's secrets are, independent of where they are kept: building
|
|
866
|
+
* them, changing them, and handing them to a process. Where they are kept is a
|
|
867
|
+
* {@link SecretsStore}'s business — see `secretsStoreFor`.
|
|
868
|
+
*/
|
|
869
|
+
var storage_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
870
|
+
initStageSecrets: () => initStageSecrets,
|
|
871
|
+
maskPassword: () => maskPassword,
|
|
872
|
+
toEmbeddableSecrets: () => toEmbeddableSecrets,
|
|
873
|
+
validateEnvironmentVariables: () => validateEnvironmentVariables,
|
|
874
|
+
withCustomSecret: () => withCustomSecret
|
|
875
|
+
});
|
|
876
|
+
/**
|
|
877
|
+
* Initialize an empty StageSecrets object for a stage.
|
|
878
|
+
*/
|
|
879
|
+
function initStageSecrets(stage) {
|
|
880
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
881
|
+
return {
|
|
882
|
+
stage,
|
|
883
|
+
createdAt: now,
|
|
884
|
+
updatedAt: now,
|
|
885
|
+
services: {},
|
|
886
|
+
urls: {},
|
|
887
|
+
custom: {}
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* Convert StageSecrets to embeddable format (flat key-value pairs).
|
|
892
|
+
* This is what gets encrypted and embedded in the bundle.
|
|
893
|
+
*/
|
|
894
|
+
function toEmbeddableSecrets(secrets) {
|
|
895
|
+
return {
|
|
896
|
+
...secrets.urls,
|
|
897
|
+
...Object.fromEntries(Object.entries(secrets.custom).filter(([key]) => !require_workspace.isReservedStageKey(key))),
|
|
898
|
+
...secrets.services.postgres && {
|
|
899
|
+
POSTGRES_USER: secrets.services.postgres.username,
|
|
900
|
+
POSTGRES_PASSWORD: secrets.services.postgres.password,
|
|
901
|
+
POSTGRES_DB: secrets.services.postgres.database ?? "app",
|
|
902
|
+
POSTGRES_HOST: secrets.services.postgres.host,
|
|
903
|
+
POSTGRES_PORT: String(secrets.services.postgres.port)
|
|
904
|
+
},
|
|
905
|
+
...secrets.services.redis && {
|
|
906
|
+
REDIS_PASSWORD: secrets.services.redis.password,
|
|
907
|
+
REDIS_HOST: secrets.services.redis.host,
|
|
908
|
+
REDIS_PORT: String(secrets.services.redis.port)
|
|
909
|
+
},
|
|
910
|
+
...secrets.services.minio && {
|
|
911
|
+
STORAGE_ACCESS_KEY_ID: secrets.services.minio.username,
|
|
912
|
+
STORAGE_SECRET_ACCESS_KEY: secrets.services.minio.password,
|
|
913
|
+
STORAGE_BUCKET: secrets.services.minio.bucket ?? "app",
|
|
914
|
+
STORAGE_REGION: "eu-west-1",
|
|
915
|
+
STORAGE_FORCE_PATH_STYLE: "true"
|
|
916
|
+
},
|
|
917
|
+
...secrets.services.mailpit && {
|
|
918
|
+
SMTP_HOST: secrets.services.mailpit.host,
|
|
919
|
+
SMTP_PORT: String(secrets.services.mailpit.port),
|
|
920
|
+
SMTP_USER: secrets.services.mailpit.username,
|
|
921
|
+
SMTP_PASS: secrets.services.mailpit.password,
|
|
922
|
+
SMTP_SECURE: "false",
|
|
923
|
+
MAIL_FROM: "noreply@localhost"
|
|
924
|
+
},
|
|
925
|
+
...secrets.services.localstack && {
|
|
926
|
+
AWS_ACCESS_KEY_ID: secrets.services.localstack.accessKeyId ?? secrets.services.localstack.username,
|
|
927
|
+
AWS_SECRET_ACCESS_KEY: secrets.services.localstack.password,
|
|
928
|
+
AWS_REGION: secrets.services.localstack.region ?? "us-east-1",
|
|
929
|
+
AWS_ENDPOINT_URL: `http://${secrets.services.localstack.host}:${secrets.services.localstack.port}`
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
/** The same secrets with one custom value set, and `updatedAt` moved on. */
|
|
934
|
+
function withCustomSecret(secrets, key, value) {
|
|
935
|
+
return {
|
|
936
|
+
...secrets,
|
|
937
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
938
|
+
custom: {
|
|
939
|
+
...secrets.custom,
|
|
940
|
+
[key]: value
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Mask a password for display (show first 4 and last 2 chars).
|
|
946
|
+
*/
|
|
947
|
+
function maskPassword(password) {
|
|
948
|
+
if (password.length <= 8) return "********";
|
|
949
|
+
return `${password.slice(0, 4)}${"*".repeat(password.length - 6)}${password.slice(-2)}`;
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Validate that all required environment variables are present in secrets.
|
|
953
|
+
*
|
|
954
|
+
* @param requiredVars - Array of environment variable names required by the application
|
|
955
|
+
* @param secrets - Stage secrets to validate against
|
|
956
|
+
* @returns Validation result with missing and provided variables
|
|
957
|
+
*
|
|
958
|
+
* @example
|
|
959
|
+
* ```typescript
|
|
960
|
+
* const required = ['DATABASE_URL', 'API_KEY', 'JWT_SECRET'];
|
|
961
|
+
* const secrets = await secretsStoreFor(workspace, 'production').then((s) => s.read('production'));
|
|
962
|
+
* const result = validateEnvironmentVariables(required, secrets);
|
|
963
|
+
*
|
|
964
|
+
* if (!result.valid) {
|
|
965
|
+
* console.error(`Missing environment variables: ${result.missing.join(', ')}`);
|
|
966
|
+
* }
|
|
967
|
+
* ```
|
|
968
|
+
*/
|
|
969
|
+
function validateEnvironmentVariables(requiredVars, secrets) {
|
|
970
|
+
const embeddable = toEmbeddableSecrets(secrets);
|
|
971
|
+
const availableVars = new Set(Object.keys(embeddable));
|
|
972
|
+
const missing = [];
|
|
973
|
+
const provided = [];
|
|
974
|
+
for (const varName of requiredVars) if (availableVars.has(varName)) provided.push(varName);
|
|
975
|
+
else missing.push(varName);
|
|
976
|
+
return {
|
|
977
|
+
valid: missing.length === 0,
|
|
978
|
+
missing: missing.sort(),
|
|
979
|
+
provided: provided.sort(),
|
|
980
|
+
required: [...requiredVars].sort()
|
|
981
|
+
};
|
|
982
|
+
}
|
|
983
|
+
//#endregion
|
|
984
|
+
//#region src/secrets/store.ts
|
|
985
|
+
var store_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
986
|
+
FileSecretsStore: () => FileSecretsStore,
|
|
987
|
+
isRemoteStore: () => isRemoteStore,
|
|
988
|
+
secretsStoreFor: () => secretsStoreFor,
|
|
989
|
+
storeFromConfig: () => storeFromConfig
|
|
990
|
+
});
|
|
991
|
+
/**
|
|
992
|
+
* The store a stage's secrets are kept in — what every command reads and
|
|
993
|
+
* writes, for the stage it acts on.
|
|
994
|
+
*
|
|
995
|
+
* The local stage is always the file: its secrets belong to the machine
|
|
996
|
+
* running `gkm dev`. A deployed stage uses `secrets.store`.
|
|
997
|
+
*/
|
|
998
|
+
async function secretsStoreFor(workspace, stage, options = {}) {
|
|
999
|
+
const configured = workspace.secrets.store ?? "file";
|
|
1000
|
+
if (stage === workspace.stages.local || configured === "file") return new FileSecretsStore(workspace.root, keystoreProject(workspace, options.home));
|
|
1001
|
+
return storeFromConfig(workspace, configured, options);
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* The store a `secrets.store` value describes, for any stage — what
|
|
1005
|
+
* {@link secretsStoreFor} answers for a deployed stage, and what
|
|
1006
|
+
* `gkm secrets:migrate` builds for the store it copies to.
|
|
1007
|
+
*/
|
|
1008
|
+
async function storeFromConfig(workspace, config, options = {}) {
|
|
1009
|
+
if (config === "file") return new FileSecretsStore(workspace.root, keystoreProject(workspace, options.home));
|
|
1010
|
+
const profile = options.profile ? { profile: options.profile } : {};
|
|
1011
|
+
switch (config.provider) {
|
|
1012
|
+
case "s3": {
|
|
1013
|
+
const { S3SecretsStore } = await Promise.resolve().then(() => require("./s3-CwacPd8J.cjs"));
|
|
1014
|
+
const { deployIdentity } = await Promise.resolve().then(() => identity_exports);
|
|
1015
|
+
const location = require_workspace.s3SecretsLocation(config, workspace.state);
|
|
1016
|
+
return new S3SecretsStore({
|
|
1017
|
+
project: workspace.name,
|
|
1018
|
+
identity: deployIdentity(workspace, ""),
|
|
1019
|
+
region: location.region,
|
|
1020
|
+
prefix: location.prefix,
|
|
1021
|
+
...location.bucket ? { bucket: location.bucket } : {},
|
|
1022
|
+
...profile
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
case "ssm": {
|
|
1026
|
+
const { AwsSecretsStore } = await Promise.resolve().then(() => require("./aws-BXfiWNbi.cjs")).then((n) => n.aws_exports);
|
|
1027
|
+
return new AwsSecretsStore({
|
|
1028
|
+
project: workspace.name,
|
|
1029
|
+
region: config.region,
|
|
1030
|
+
...profile
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
case "secrets-manager": {
|
|
1034
|
+
const { kmsKeyId } = config;
|
|
1035
|
+
const { SecretsManagerSecretsStore } = await Promise.resolve().then(() => require("./secretsManager-CvmBGjdM.cjs")).then((n) => n.secretsManager_exports);
|
|
1036
|
+
return new SecretsManagerSecretsStore({
|
|
1037
|
+
project: workspace.name,
|
|
1038
|
+
region: config.region,
|
|
1039
|
+
...kmsKeyId ? { kmsKeyId } : {},
|
|
1040
|
+
...profile
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
default: {
|
|
1044
|
+
const provider = config.provider;
|
|
1045
|
+
if (typeof provider === "object" && provider !== null) return provider;
|
|
1046
|
+
throw new require_workspace.UnknownSecretsStoreProvider(provider);
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
/** Whether a stage's secrets live somewhere other than this machine. */
|
|
1051
|
+
function isRemoteStore(workspace, stage) {
|
|
1052
|
+
const configured = workspace.secrets.store ?? "file";
|
|
1053
|
+
return stage !== workspace.stages.local && configured !== "file";
|
|
1054
|
+
}
|
|
1055
|
+
//#endregion
|
|
1056
|
+
//#region src/workspace/backends.ts
|
|
1057
|
+
/**
|
|
1058
|
+
* Which backend each declared kind resolves to — decided by where the project
|
|
1059
|
+
* deploys, and by nothing else.
|
|
1060
|
+
*
|
|
1061
|
+
* These used to be read out of a `services:` block, where one key answered two
|
|
1062
|
+
* questions: *does this exist* and *what backs it*. The first is the manifest's
|
|
1063
|
+
* — a declared `Cache` is why there is a cache — and the second is the deploy
|
|
1064
|
+
* target's, because the right cache for a Lambda is not the right cache for a
|
|
1065
|
+
* box already running Postgres. With both answered elsewhere there was nothing
|
|
1066
|
+
* left for the block to say, so it is gone and these read the target.
|
|
1067
|
+
*
|
|
1068
|
+
* Mail has no answer here at all: every provider speaks SMTP, so the provider
|
|
1069
|
+
* is whichever one the stage's mail URL points at.
|
|
1070
|
+
*/
|
|
1071
|
+
/**
|
|
1072
|
+
* Which family of defaults a workspace's deploy target belongs to.
|
|
1073
|
+
*
|
|
1074
|
+
* One question, asked once: **does this target run containers the project
|
|
1075
|
+
* controls?** Dokploy does, so a bucket or a cache can live beside the app;
|
|
1076
|
+
* AWS, Vercel and Cloudflare do not, so the default has to be something
|
|
1077
|
+
* managed. That is the whole of the distinction, and it is why `MainProvider`
|
|
1078
|
+
* is the right axis rather than the deploy target's own name — targets share
|
|
1079
|
+
* answers.
|
|
1080
|
+
*
|
|
1081
|
+
* Each target declares its answer as its `runtime` — a target package in its
|
|
1082
|
+
* `package.json`, so this never loads one. A workspace that names no target
|
|
1083
|
+
* is on AWS: an SST project predates `deploy.default: 'sst'`.
|
|
1084
|
+
*/
|
|
1085
|
+
function providerOf(workspace) {
|
|
1086
|
+
const target = workspace.deploy?.default;
|
|
1087
|
+
return target ? require_resolve.runtimeOf(target, workspace) : "aws";
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* The cache backend a target implies.
|
|
1091
|
+
*
|
|
1092
|
+
* The same answer locally and deployed: a local `gkm dev` for an AWS app still
|
|
1093
|
+
* uses the Upstash protocol, because a backend that differed between the two
|
|
1094
|
+
* would be worse than a slower one.
|
|
1095
|
+
*/
|
|
1096
|
+
function cacheBackendFor(on) {
|
|
1097
|
+
return require_drivers.DEFAULT_CACHE[on];
|
|
1098
|
+
}
|
|
1099
|
+
/** Where a declared bucket lives on a target. */
|
|
1100
|
+
function storageBackendFor(on) {
|
|
1101
|
+
return require_drivers.DEFAULT_STORAGE[on];
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Which broker carries declared queues and topics on a target.
|
|
1105
|
+
*
|
|
1106
|
+
* Only consulted when something declares one; a project with no `Topic` or
|
|
1107
|
+
* `Queue` has no events at all, whatever the target.
|
|
1108
|
+
*/
|
|
1109
|
+
function eventsBackendFor(on) {
|
|
1110
|
+
return require_drivers.DEFAULT_EVENTS[on];
|
|
1111
|
+
}
|
|
1112
|
+
//#endregion
|
|
1113
|
+
//#region src/deploy/state.ts
|
|
1114
|
+
/**
|
|
1115
|
+
* A stage's deploy state.
|
|
1116
|
+
*
|
|
1117
|
+
* Every target records the same core — when the stage was last deployed, by
|
|
1118
|
+
* which identity, and each app's releases — and a target that keeps ids of
|
|
1119
|
+
* its own adds them in a shape of its own, told apart by `provider`:
|
|
1120
|
+
*
|
|
1121
|
+
* - `dokploy`: the project, applications, services and credentials Dokploy
|
|
1122
|
+
* gave the stage, so a later deploy updates them rather than making more.
|
|
1123
|
+
* - `compose`: nothing beyond the core. A compose stage is one stack on one
|
|
1124
|
+
* server; what it created elsewhere (DNS records) is a resource record.
|
|
1125
|
+
*/
|
|
1126
|
+
/**
|
|
1127
|
+
* Create a new empty state for a stage
|
|
1128
|
+
*/
|
|
1129
|
+
function createEmptyState(stage, projectId, environmentId) {
|
|
1130
|
+
return {
|
|
1131
|
+
provider: "dokploy",
|
|
1132
|
+
stage,
|
|
1133
|
+
projectId,
|
|
1134
|
+
environmentId,
|
|
1135
|
+
applications: {},
|
|
1136
|
+
services: {},
|
|
1137
|
+
lastDeployedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1140
|
+
/** A new compose stage's state. */
|
|
1141
|
+
function createComposeState(stage) {
|
|
1142
|
+
return {
|
|
1143
|
+
provider: "compose",
|
|
1144
|
+
stage,
|
|
1145
|
+
lastDeployedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
/**
|
|
1149
|
+
* `state` as the Dokploy target keeps it. A stage whose state another target
|
|
1150
|
+
* wrote — one moved from compose to Dokploy — keeps its core (releases,
|
|
1151
|
+
* identity) and starts with no Dokploy ids, as a first deploy would.
|
|
1152
|
+
*/
|
|
1153
|
+
function asDokployState(state) {
|
|
1154
|
+
if (state.provider === "dokploy") return state;
|
|
1155
|
+
const { provider: _provider, ...core } = state;
|
|
1156
|
+
return {
|
|
1157
|
+
...core,
|
|
1158
|
+
provider: "dokploy",
|
|
1159
|
+
projectId: "",
|
|
1160
|
+
environmentId: "",
|
|
1161
|
+
applications: {},
|
|
1162
|
+
services: {}
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Set application ID in state (mutates state)
|
|
1167
|
+
*/
|
|
1168
|
+
function setApplicationId(state, appName, applicationId) {
|
|
1169
|
+
state.applications[appName] = applicationId;
|
|
1170
|
+
}
|
|
1171
|
+
/** Two records naming the same image: by digest when both have one. */
|
|
1172
|
+
function sameImage(a, b) {
|
|
1173
|
+
return a.digest && b.digest ? a.digest === b.digest : a.ref === b.ref;
|
|
1174
|
+
}
|
|
1175
|
+
/** The newest release in `history` after `index` that a rollback may restore. */
|
|
1176
|
+
function restorable(history, index, current) {
|
|
1177
|
+
return history.slice(index + 1).find((entry) => !entry.rolledBack && !sameImage(entry, current));
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Record that `image` went live for `appName` (mutates state): it becomes
|
|
1181
|
+
* `current`, and what was current becomes `previous`. Releasing what already
|
|
1182
|
+
* runs — a redeploy of the same digest — changes nothing.
|
|
1183
|
+
*/
|
|
1184
|
+
function recordRelease(state, appName, image, by, releasedAt = /* @__PURE__ */ new Date()) {
|
|
1185
|
+
const releases = state.releases?.[appName];
|
|
1186
|
+
if (releases && sameImage(releases.current, image)) return;
|
|
1187
|
+
const entry = {
|
|
1188
|
+
...image,
|
|
1189
|
+
releasedAt: releasedAt.toISOString(),
|
|
1190
|
+
releasedBy: by
|
|
1191
|
+
};
|
|
1192
|
+
const history = [entry, ...releases?.history ?? []].slice(0, 10);
|
|
1193
|
+
const previous = releases?.current;
|
|
1194
|
+
state.releases = {
|
|
1195
|
+
...state.releases,
|
|
1196
|
+
[appName]: {
|
|
1197
|
+
current: entry,
|
|
1198
|
+
...previous ? { previous } : {},
|
|
1199
|
+
history
|
|
1200
|
+
}
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Record that `appName` was rolled back to `to` (mutates state): every
|
|
1205
|
+
* release newer than it is marked rolled back, so neither this rollback nor
|
|
1206
|
+
* a later one restores it, and `previous` moves to the release before `to`.
|
|
1207
|
+
*/
|
|
1208
|
+
function recordRollback(state, appName, to) {
|
|
1209
|
+
const releases = state.releases?.[appName];
|
|
1210
|
+
if (!releases) return;
|
|
1211
|
+
const index = releases.history.findIndex((entry) => !entry.rolledBack && sameImage(entry, to));
|
|
1212
|
+
if (index === -1) return;
|
|
1213
|
+
const history = releases.history.map((entry, i) => i < index ? {
|
|
1214
|
+
...entry,
|
|
1215
|
+
rolledBack: true
|
|
1216
|
+
} : entry);
|
|
1217
|
+
const current = history[index];
|
|
1218
|
+
const previous = restorable(history, index, current);
|
|
1219
|
+
state.releases = {
|
|
1220
|
+
...state.releases,
|
|
1221
|
+
[appName]: {
|
|
1222
|
+
current,
|
|
1223
|
+
...previous ? { previous } : {},
|
|
1224
|
+
history
|
|
1225
|
+
}
|
|
1226
|
+
};
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* Get a generated secret for an app
|
|
1230
|
+
*/
|
|
1231
|
+
function getGeneratedSecret(state, appName, secretName) {
|
|
1232
|
+
return state?.generatedSecrets?.[appName]?.[secretName];
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Set a generated secret for an app (mutates state)
|
|
1236
|
+
*/
|
|
1237
|
+
function setGeneratedSecret(state, appName, secretName, value) {
|
|
1238
|
+
if (!state.generatedSecrets) state.generatedSecrets = {};
|
|
1239
|
+
if (!state.generatedSecrets[appName]) state.generatedSecrets[appName] = {};
|
|
1240
|
+
state.generatedSecrets[appName][secretName] = value;
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Set DNS verification record for a hostname (mutates state)
|
|
1244
|
+
*/
|
|
1245
|
+
function setDnsVerification(state, hostname, serverIp) {
|
|
1246
|
+
if (!state.dnsVerified) state.dnsVerified = {};
|
|
1247
|
+
state.dnsVerified[hostname] = {
|
|
1248
|
+
serverIp,
|
|
1249
|
+
verifiedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1252
|
+
/**
|
|
1253
|
+
* Check if a hostname is already verified with the given IP
|
|
1254
|
+
*/
|
|
1255
|
+
function isDnsVerified(state, hostname, serverIp) {
|
|
1256
|
+
return (state?.dnsVerified?.[hostname])?.serverIp === serverIp;
|
|
1257
|
+
}
|
|
1258
|
+
/**
|
|
1259
|
+
* Get the key for a DNS record in state
|
|
1260
|
+
*/
|
|
1261
|
+
function getDnsRecordKey(name, type) {
|
|
1262
|
+
return `${name}:${type}`;
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* Set a created DNS record in state (mutates state)
|
|
1266
|
+
*/
|
|
1267
|
+
function setDnsRecord(state, record) {
|
|
1268
|
+
if (!state.dnsRecords) state.dnsRecords = {};
|
|
1269
|
+
const key = getDnsRecordKey(record.name, record.type);
|
|
1270
|
+
state.dnsRecords[key] = {
|
|
1271
|
+
...record,
|
|
1272
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1273
|
+
};
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Get backup state from state
|
|
1277
|
+
*/
|
|
1278
|
+
function getBackupState(state) {
|
|
1279
|
+
return state?.backups;
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Set backup state (mutates state)
|
|
1283
|
+
*/
|
|
1284
|
+
function setBackupState(state, backupState) {
|
|
1285
|
+
state.backups = backupState;
|
|
1286
|
+
}
|
|
1287
|
+
/**
|
|
1288
|
+
* Set postgres backup ID in state (mutates state)
|
|
1289
|
+
*/
|
|
1290
|
+
function setPostgresBackupId(state, backupId) {
|
|
1291
|
+
if (state.backups) state.backups.postgresBackupId = backupId;
|
|
1292
|
+
}
|
|
1293
|
+
//#endregion
|
|
1294
|
+
//#region src/deploy/credentials.ts
|
|
1295
|
+
/**
|
|
1296
|
+
* How a deploy gets the credentials it acts with.
|
|
1297
|
+
*
|
|
1298
|
+
* `deploy()` never prompts and never reads a terminal: it asks a
|
|
1299
|
+
* `CredentialProvider` and, when the provider has nothing, stops with
|
|
1300
|
+
* `MissingCredential` naming what it needed and how to supply it. Whether to
|
|
1301
|
+
* ask a person, read a vault or fail is the caller's decision — `gkm deploy`
|
|
1302
|
+
* prompts at a terminal and stores what was typed; a CI job sets the
|
|
1303
|
+
* environment; a host passes its own provider.
|
|
1304
|
+
*/
|
|
1305
|
+
/**
|
|
1306
|
+
* How to supply each kind the CLI knows, for the error that says it is
|
|
1307
|
+
* missing. A target's own kinds are its to explain.
|
|
1308
|
+
*/
|
|
1309
|
+
const HOW_TO_PROVIDE = {
|
|
1310
|
+
dokploy: "Set DOKPLOY_API_TOKEN (and DOKPLOY_ENDPOINT, or deploy.dokploy.endpoint in gkm.config.ts), run `gkm login --provider dokploy`, or pass them through the deploy's CredentialProvider.",
|
|
1311
|
+
registry: "Add the registry in Dokploy (Settings → Docker Registry) and set deploy.dokploy.registryId, set DOCKER_REGISTRY_USERNAME and DOCKER_REGISTRY_PASSWORD, or run `gkm deploy` at a terminal to be asked for them.",
|
|
1312
|
+
godaddy: "Set GODADDY_API_TOKEN to a Personal Access Token scoped to domains.dns:update (create one in the GoDaddy developer dashboard), or run `gkm login --provider godaddy`.",
|
|
1313
|
+
hostinger: "Set HOSTINGER_API_TOKEN to a token from hpanel.hostinger.com/profile/api, or run `gkm login --provider hostinger`.",
|
|
1314
|
+
aws: "Set AWS_PROFILE to the stage account's profile, or AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY (and AWS_SESSION_TOKEN) — in CI, the keys aws-actions/configure-aws-credentials exports — or pass them through the deploy's CredentialProvider."
|
|
1315
|
+
};
|
|
1316
|
+
/** A deploy needed a credential, and its provider had none. */
|
|
1317
|
+
var MissingCredential = class extends require_errors.GkmError {
|
|
1318
|
+
kind;
|
|
1319
|
+
target;
|
|
1320
|
+
howToProvide;
|
|
1321
|
+
constructor(kind, target, howToProvide = HOW_TO_PROVIDE[kind] ?? "Pass it through the deploy's CredentialProvider.") {
|
|
1322
|
+
const what = kind === "dokploy" ? `No Dokploy credentials${target ? ` for ${target}` : ""}.` : kind === "registry" ? `Dokploy has no registry for ${target ?? "the configured registry"}, and there are no credentials to create one with.` : kind === "aws" ? `No AWS credentials${target ? ` for the "${target}" stage` : ""}.` : kind === "godaddy" ? `No GoDaddy API token${target ? ` for ${target}` : ""}.` : kind === "hostinger" ? `No Hostinger API token${target ? ` for ${target}` : ""}.` : `No "${String(kind)}" credentials${target ? ` for ${target}` : ""}.`;
|
|
1323
|
+
super(`${what} ${howToProvide}`);
|
|
1324
|
+
this.kind = kind;
|
|
1325
|
+
this.target = target;
|
|
1326
|
+
this.howToProvide = howToProvide;
|
|
1327
|
+
this.name = "MissingCredential";
|
|
1328
|
+
}
|
|
1329
|
+
};
|
|
1330
|
+
/** Whatever was asked for, from the first provider that has it. */
|
|
1331
|
+
function chainCredentials(...providers) {
|
|
1332
|
+
return { async get(request, options) {
|
|
1333
|
+
for (const provider of providers) {
|
|
1334
|
+
const found = await provider.get(request, options);
|
|
1335
|
+
if (found) return found;
|
|
1336
|
+
}
|
|
1337
|
+
} };
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* Credentials from the environment, then from what `gkm login` stored. What
|
|
1341
|
+
* `deploy()` uses when it is handed no provider.
|
|
1342
|
+
*
|
|
1343
|
+
* - Dokploy: `DOKPLOY_API_TOKEN` / `DOKPLOY_ENDPOINT`, each falling back to
|
|
1344
|
+
* the stored login, and the endpoint finally to `deploy.dokploy.endpoint`.
|
|
1345
|
+
* Each half is read on its own: a token is a secret and belongs in the
|
|
1346
|
+
* environment, an endpoint is configuration and belongs in the config.
|
|
1347
|
+
* - Registry: `DOCKER_REGISTRY_USERNAME` / `DOCKER_REGISTRY_PASSWORD`.
|
|
1348
|
+
* - AWS: `AWS_PROFILE` when it is set, and then nothing else; otherwise
|
|
1349
|
+
* `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` / `AWS_SESSION_TOKEN`. The
|
|
1350
|
+
* profile winning is `secretsStoreFor`'s rule: a profile is a choice of
|
|
1351
|
+
* account someone made, exported keys may be left over from another.
|
|
1352
|
+
* Read here, by name, and handed only to the command that deploys — the
|
|
1353
|
+
* sandbox every other step runs in passes no `AWS_*` on.
|
|
1354
|
+
*/
|
|
1355
|
+
function storedCredentials(options = {}) {
|
|
1356
|
+
const env = options.env ?? process.env;
|
|
1357
|
+
return { async get(asked) {
|
|
1358
|
+
const request = asked;
|
|
1359
|
+
switch (request.kind) {
|
|
1360
|
+
case "dokploy": {
|
|
1361
|
+
const stored = (await readCredentials(options.home ? { home: options.home } : void 0)).dokploy;
|
|
1362
|
+
const token = env.DOKPLOY_API_TOKEN ?? stored?.token;
|
|
1363
|
+
const endpoint = env.DOKPLOY_ENDPOINT ?? stored?.endpoint ?? request.endpoint;
|
|
1364
|
+
if (!token || !endpoint) return void 0;
|
|
1365
|
+
return {
|
|
1366
|
+
endpoint: endpoint.replace(/\/$/, ""),
|
|
1367
|
+
token
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1370
|
+
case "registry": {
|
|
1371
|
+
const username = env.DOCKER_REGISTRY_USERNAME;
|
|
1372
|
+
const password = env.DOCKER_REGISTRY_PASSWORD;
|
|
1373
|
+
if (!username || !password) return void 0;
|
|
1374
|
+
return {
|
|
1375
|
+
username,
|
|
1376
|
+
password
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
case "godaddy": {
|
|
1380
|
+
const token = env.GODADDY_API_TOKEN || (await readCredentials(options.home ? { home: options.home } : void 0)).godaddy?.token;
|
|
1381
|
+
if (!token) return void 0;
|
|
1382
|
+
return { token };
|
|
1383
|
+
}
|
|
1384
|
+
case "hostinger": {
|
|
1385
|
+
const token = env.HOSTINGER_API_TOKEN || (await readCredentials(options.home ? { home: options.home } : void 0)).hostinger?.token;
|
|
1386
|
+
if (!token) return void 0;
|
|
1387
|
+
return { token };
|
|
1388
|
+
}
|
|
1389
|
+
case "aws": {
|
|
1390
|
+
const region = env.AWS_REGION ?? env.AWS_DEFAULT_REGION;
|
|
1391
|
+
const where = region ? { region } : {};
|
|
1392
|
+
if (env.AWS_PROFILE) return {
|
|
1393
|
+
profile: env.AWS_PROFILE,
|
|
1394
|
+
...where
|
|
1395
|
+
};
|
|
1396
|
+
const accessKeyId = env.AWS_ACCESS_KEY_ID;
|
|
1397
|
+
const secretAccessKey = env.AWS_SECRET_ACCESS_KEY;
|
|
1398
|
+
if (!accessKeyId || !secretAccessKey) return void 0;
|
|
1399
|
+
return {
|
|
1400
|
+
accessKeyId,
|
|
1401
|
+
secretAccessKey,
|
|
1402
|
+
...env.AWS_SESSION_TOKEN ? { sessionToken: env.AWS_SESSION_TOKEN } : {},
|
|
1403
|
+
...where
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
} };
|
|
1408
|
+
}
|
|
1409
|
+
//#endregion
|
|
1410
|
+
//#region src/dns/providers.ts
|
|
1411
|
+
/**
|
|
1412
|
+
* The DNS provider a `dns` domain names, built from the workspace's config.
|
|
1413
|
+
*
|
|
1414
|
+
* The providers themselves are `@geekmidas/edge`'s and take their credentials
|
|
1415
|
+
* as given. Where a credential comes from (a stored login, the environment)
|
|
1416
|
+
* and what to say when there is none are the CLI's, and are decided here.
|
|
1417
|
+
*/
|
|
1418
|
+
/**
|
|
1419
|
+
* Create a DNS provider based on configuration.
|
|
1420
|
+
*
|
|
1421
|
+
* - 'hostinger': HostingerProvider
|
|
1422
|
+
* - 'route53': Route53Provider
|
|
1423
|
+
* - 'godaddy': GoDaddyProvider
|
|
1424
|
+
* - 'manual': Returns null (user handles DNS)
|
|
1425
|
+
* - Custom: Use provided DnsProvider implementation
|
|
1426
|
+
*/
|
|
1427
|
+
async function createDnsProvider(options) {
|
|
1428
|
+
const { config } = options;
|
|
1429
|
+
if (config.provider === "manual") return null;
|
|
1430
|
+
if ((0, _geekmidas_edge_dns.isDnsProvider)(config.provider)) return config.provider;
|
|
1431
|
+
const provider = config.provider;
|
|
1432
|
+
if (provider === "hostinger") {
|
|
1433
|
+
const { HostingerProvider } = await import("@geekmidas/edge/dns/hostinger");
|
|
1434
|
+
return new HostingerProvider(async () => {
|
|
1435
|
+
const token = options.hostinger?.token ?? await getHostingerToken();
|
|
1436
|
+
if (!token) throw new MissingCredential("hostinger", void 0);
|
|
1437
|
+
return { token };
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
if (provider === "route53") {
|
|
1441
|
+
const { Route53Provider } = await import("@geekmidas/edge/dns/route53");
|
|
1442
|
+
const route53Config = config;
|
|
1443
|
+
return new Route53Provider({
|
|
1444
|
+
region: route53Config.region,
|
|
1445
|
+
profile: route53Config.profile,
|
|
1446
|
+
hostedZoneId: route53Config.hostedZoneId
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
if (provider === "godaddy") {
|
|
1450
|
+
const { GoDaddyProvider } = await import("@geekmidas/edge/dns/godaddy");
|
|
1451
|
+
const { credential, env, home, ...rest } = options.godaddy ?? {};
|
|
1452
|
+
return new GoDaddyProvider({
|
|
1453
|
+
...rest,
|
|
1454
|
+
credential: async () => {
|
|
1455
|
+
const found = credential ?? await storedCredentials({
|
|
1456
|
+
env: env ?? process.env,
|
|
1457
|
+
...home ? { home } : {}
|
|
1458
|
+
}).get({ kind: "godaddy" });
|
|
1459
|
+
if (!found) throw new MissingCredential("godaddy", void 0);
|
|
1460
|
+
return found;
|
|
1461
|
+
}
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
if (provider === "cloudflare") throw new DnsProviderNotImplemented("cloudflare");
|
|
1465
|
+
throw new DnsProviderUnknown(config);
|
|
1466
|
+
}
|
|
1467
|
+
/** A DNS provider gkm names and does not have yet. */
|
|
1468
|
+
var DnsProviderNotImplemented = class extends Error {
|
|
1469
|
+
provider;
|
|
1470
|
+
constructor(provider) {
|
|
1471
|
+
super(`The ${provider} DNS provider is not implemented yet. Use 'route53', 'godaddy', 'hostinger' or 'manual' for this domain in dns, or pass your own DnsProvider object.`);
|
|
1472
|
+
this.provider = provider;
|
|
1473
|
+
this.name = "DnsProviderNotImplemented";
|
|
1474
|
+
}
|
|
1475
|
+
};
|
|
1476
|
+
/** A `provider:` that is none of the built-ins, nor a DnsProvider object. */
|
|
1477
|
+
var DnsProviderUnknown = class extends require_errors.GkmError {
|
|
1478
|
+
config;
|
|
1479
|
+
constructor(config) {
|
|
1480
|
+
super(`Unknown DNS provider: ${JSON.stringify(config)}. dns takes 'route53', 'godaddy', 'hostinger', 'manual', or an object implementing DnsProvider.`);
|
|
1481
|
+
this.config = config;
|
|
1482
|
+
this.name = "DnsProviderUnknown";
|
|
1483
|
+
}
|
|
1484
|
+
};
|
|
1485
|
+
//#endregion
|
|
1486
|
+
//#region src/dns/index.ts
|
|
1487
|
+
/**
|
|
1488
|
+
* DNS orchestration for deployments
|
|
1489
|
+
*
|
|
1490
|
+
* Handles automatic DNS record creation for deployed applications.
|
|
1491
|
+
*/
|
|
1492
|
+
const logger = require_discover.output;
|
|
1493
|
+
/**
|
|
1494
|
+
* Check if DNS config is legacy format (single domain with `domain` property)
|
|
1495
|
+
*/
|
|
1496
|
+
function isLegacyDnsConfig(config) {
|
|
1497
|
+
return typeof config === "object" && config !== null && "provider" in config && "domain" in config;
|
|
1498
|
+
}
|
|
1499
|
+
/**
|
|
1500
|
+
* Normalize DNS config to new multi-domain format
|
|
1501
|
+
*/
|
|
1502
|
+
function normalizeDnsConfig(config) {
|
|
1503
|
+
if (isLegacyDnsConfig(config)) {
|
|
1504
|
+
const { domain, ...providerConfig } = config;
|
|
1505
|
+
return { [domain]: providerConfig };
|
|
1506
|
+
}
|
|
1507
|
+
return config;
|
|
1508
|
+
}
|
|
1509
|
+
/**
|
|
1510
|
+
* Find the root domain for a hostname from available DNS configs
|
|
1511
|
+
*
|
|
1512
|
+
* @example
|
|
1513
|
+
* findRootDomain('api.geekmidas.com', { 'geekmidas.com': {...}, 'geekmidas.dev': {...} })
|
|
1514
|
+
* // Returns 'geekmidas.com'
|
|
1515
|
+
*/
|
|
1516
|
+
function findRootDomain(hostname, dnsConfig) {
|
|
1517
|
+
const domains = Object.keys(dnsConfig).sort((a, b) => b.length - a.length);
|
|
1518
|
+
for (const domain of domains) if (hostname === domain || hostname.endsWith(`.${domain}`)) return domain;
|
|
1519
|
+
return null;
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* Group hostnames by their root domain
|
|
1523
|
+
*/
|
|
1524
|
+
function groupHostnamesByDomain(appHostnames, dnsConfig) {
|
|
1525
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
1526
|
+
for (const [appName, hostname] of appHostnames) {
|
|
1527
|
+
const rootDomain = findRootDomain(hostname, dnsConfig);
|
|
1528
|
+
if (!rootDomain) {
|
|
1529
|
+
logger.log(` ⚠ No DNS config found for hostname: ${hostname}`);
|
|
1530
|
+
continue;
|
|
1531
|
+
}
|
|
1532
|
+
if (!grouped.has(rootDomain)) grouped.set(rootDomain, /* @__PURE__ */ new Map());
|
|
1533
|
+
grouped.get(rootDomain).set(appName, hostname);
|
|
1534
|
+
}
|
|
1535
|
+
return grouped;
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1538
|
+
* Resolve IP address from a hostname
|
|
1539
|
+
*/
|
|
1540
|
+
async function resolveHostnameToIp(hostname) {
|
|
1541
|
+
try {
|
|
1542
|
+
return (await (0, node_dns_promises.lookup)(hostname, { family: 4 })).address;
|
|
1543
|
+
} catch (error) {
|
|
1544
|
+
throw new Error(`Failed to resolve IP for ${hostname}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
/**
|
|
1548
|
+
* Extract subdomain from full hostname relative to root domain
|
|
1549
|
+
*
|
|
1550
|
+
* @example
|
|
1551
|
+
* extractSubdomain('api.joemoer.traflabs.io', 'traflabs.io') => 'api.joemoer'
|
|
1552
|
+
* extractSubdomain('joemoer.traflabs.io', 'traflabs.io') => 'joemoer'
|
|
1553
|
+
*/
|
|
1554
|
+
function extractSubdomain(hostname, rootDomain) {
|
|
1555
|
+
if (!hostname.endsWith(rootDomain)) throw new Error(`Hostname ${hostname} is not under root domain ${rootDomain}`);
|
|
1556
|
+
return hostname.slice(0, -(rootDomain.length + 1)) || "@";
|
|
1557
|
+
}
|
|
1558
|
+
/**
|
|
1559
|
+
* Generate required DNS records for a deployment
|
|
1560
|
+
*/
|
|
1561
|
+
function generateRequiredRecords(appHostnames, rootDomain, serverIp) {
|
|
1562
|
+
const records = [];
|
|
1563
|
+
for (const [appName, hostname] of appHostnames) {
|
|
1564
|
+
const subdomain = extractSubdomain(hostname, rootDomain);
|
|
1565
|
+
records.push({
|
|
1566
|
+
hostname,
|
|
1567
|
+
subdomain,
|
|
1568
|
+
type: "A",
|
|
1569
|
+
value: serverIp,
|
|
1570
|
+
appName
|
|
1571
|
+
});
|
|
1572
|
+
}
|
|
1573
|
+
return records;
|
|
1574
|
+
}
|
|
1575
|
+
/**
|
|
1576
|
+
* Print DNS records table
|
|
1577
|
+
*/
|
|
1578
|
+
function printDnsRecordsTable(records, rootDomain) {
|
|
1579
|
+
logger.log(`\n 📋 DNS Records for ${rootDomain}:`);
|
|
1580
|
+
logger.log(" ┌─────────────────────────────────────┬──────┬─────────────────┬────────┐");
|
|
1581
|
+
logger.log(" │ Subdomain │ Type │ Value │ Status │");
|
|
1582
|
+
logger.log(" ├─────────────────────────────────────┼──────┼─────────────────┼────────┤");
|
|
1583
|
+
for (const record of records) {
|
|
1584
|
+
const subdomain = record.subdomain.padEnd(35);
|
|
1585
|
+
const type = record.type.padEnd(4);
|
|
1586
|
+
const value = record.value.padEnd(15);
|
|
1587
|
+
let status;
|
|
1588
|
+
if (record.error) status = "✗";
|
|
1589
|
+
else if (record.created) status = "✓ new";
|
|
1590
|
+
else if (record.existed) status = "✓";
|
|
1591
|
+
else status = "?";
|
|
1592
|
+
logger.log(` │ ${subdomain} │ ${type} │ ${value} │ ${status.padEnd(6)} │`);
|
|
1593
|
+
}
|
|
1594
|
+
logger.log(" └─────────────────────────────────────┴──────┴─────────────────┴────────┘");
|
|
1595
|
+
}
|
|
1596
|
+
/**
|
|
1597
|
+
* Print DNS records in a simple format for manual setup
|
|
1598
|
+
*/
|
|
1599
|
+
function printDnsRecordsSimple(records, rootDomain) {
|
|
1600
|
+
logger.log("\n 📋 Required DNS Records:");
|
|
1601
|
+
logger.log(` Add these A records to your DNS provider (${rootDomain}):\n`);
|
|
1602
|
+
for (const record of records) logger.log(` ${record.subdomain} → ${record.value} (A record)`);
|
|
1603
|
+
logger.log("");
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* Create DNS records for a single domain using its configured provider
|
|
1607
|
+
*/
|
|
1608
|
+
async function createDnsRecordsForDomain(records, rootDomain, providerConfig) {
|
|
1609
|
+
const ttl = "ttl" in providerConfig && providerConfig.ttl ? providerConfig.ttl : 300;
|
|
1610
|
+
let provider;
|
|
1611
|
+
try {
|
|
1612
|
+
provider = await createDnsProvider({ config: providerConfig });
|
|
1613
|
+
} catch (error) {
|
|
1614
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
1615
|
+
logger.log(` ⚠ Failed to create DNS provider for ${rootDomain}: ${message}`);
|
|
1616
|
+
return records.map((r) => ({
|
|
1617
|
+
...r,
|
|
1618
|
+
error: message
|
|
1619
|
+
}));
|
|
1620
|
+
}
|
|
1621
|
+
if (!provider) return records.map((r) => ({
|
|
1622
|
+
...r,
|
|
1623
|
+
created: false,
|
|
1624
|
+
existed: false
|
|
1625
|
+
}));
|
|
1626
|
+
const results = [];
|
|
1627
|
+
const upsertRecords = records.map((r) => ({
|
|
1628
|
+
name: r.subdomain,
|
|
1629
|
+
type: r.type,
|
|
1630
|
+
ttl,
|
|
1631
|
+
value: r.value
|
|
1632
|
+
}));
|
|
1633
|
+
try {
|
|
1634
|
+
const upsertResults = await provider.upsertRecords(rootDomain, upsertRecords);
|
|
1635
|
+
for (const [i, record] of records.entries()) {
|
|
1636
|
+
const result = upsertResults[i];
|
|
1637
|
+
if (!result) {
|
|
1638
|
+
results.push({
|
|
1639
|
+
hostname: record.hostname,
|
|
1640
|
+
subdomain: record.subdomain,
|
|
1641
|
+
type: record.type,
|
|
1642
|
+
value: record.value,
|
|
1643
|
+
appName: record.appName,
|
|
1644
|
+
error: "No result returned from provider"
|
|
1645
|
+
});
|
|
1646
|
+
continue;
|
|
1647
|
+
}
|
|
1648
|
+
if (result.unchanged) results.push({
|
|
1649
|
+
hostname: record.hostname,
|
|
1650
|
+
subdomain: record.subdomain,
|
|
1651
|
+
type: record.type,
|
|
1652
|
+
value: record.value,
|
|
1653
|
+
appName: record.appName,
|
|
1654
|
+
existed: true,
|
|
1655
|
+
created: false
|
|
1656
|
+
});
|
|
1657
|
+
else results.push({
|
|
1658
|
+
hostname: record.hostname,
|
|
1659
|
+
subdomain: record.subdomain,
|
|
1660
|
+
type: record.type,
|
|
1661
|
+
value: record.value,
|
|
1662
|
+
appName: record.appName,
|
|
1663
|
+
created: result.created,
|
|
1664
|
+
existed: !result.created
|
|
1665
|
+
});
|
|
1666
|
+
}
|
|
1667
|
+
} catch (error) {
|
|
1668
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
1669
|
+
logger.log(` ⚠ Failed to create DNS records for ${rootDomain}: ${message}`);
|
|
1670
|
+
return records.map((r) => ({
|
|
1671
|
+
hostname: r.hostname,
|
|
1672
|
+
subdomain: r.subdomain,
|
|
1673
|
+
type: r.type,
|
|
1674
|
+
value: r.value,
|
|
1675
|
+
appName: r.appName,
|
|
1676
|
+
error: message
|
|
1677
|
+
}));
|
|
1678
|
+
}
|
|
1679
|
+
return results;
|
|
1680
|
+
}
|
|
1681
|
+
/**
|
|
1682
|
+
* Main DNS orchestration function for deployments
|
|
1683
|
+
*
|
|
1684
|
+
* Supports both legacy single-domain format and new multi-domain format:
|
|
1685
|
+
* - Legacy: { provider: 'hostinger', domain: 'example.com' }
|
|
1686
|
+
* - Multi: { 'example.com': { provider: 'hostinger' }, 'example.dev': { provider: 'route53' } }
|
|
1687
|
+
*
|
|
1688
|
+
* @param appHostnames - Map of app names to hostnames
|
|
1689
|
+
* @param dnsConfig - DNS configuration (legacy or multi-domain)
|
|
1690
|
+
* @param dokployEndpoint - Dokploy server endpoint to resolve IP from
|
|
1691
|
+
* @param state - Optional state to save created records for later deletion
|
|
1692
|
+
*/
|
|
1693
|
+
async function orchestrateDns(appHostnames, dnsConfig, dokployEndpoint, state) {
|
|
1694
|
+
if (!dnsConfig) return null;
|
|
1695
|
+
const normalizedConfig = normalizeDnsConfig(dnsConfig);
|
|
1696
|
+
logger.log("\n🌐 Setting up DNS records...");
|
|
1697
|
+
let serverIp;
|
|
1698
|
+
try {
|
|
1699
|
+
const endpointUrl = new URL(dokployEndpoint);
|
|
1700
|
+
serverIp = await resolveHostnameToIp(endpointUrl.hostname);
|
|
1701
|
+
logger.log(` Server IP: ${serverIp} (from ${endpointUrl.hostname})`);
|
|
1702
|
+
} catch (error) {
|
|
1703
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
1704
|
+
logger.log(` ⚠ Failed to resolve server IP: ${message}`);
|
|
1705
|
+
return null;
|
|
1706
|
+
}
|
|
1707
|
+
const groupedHostnames = groupHostnamesByDomain(appHostnames, normalizedConfig);
|
|
1708
|
+
if (groupedHostnames.size === 0) {
|
|
1709
|
+
logger.log(" No DNS records needed (no hostnames match configured domains)");
|
|
1710
|
+
return {
|
|
1711
|
+
records: [],
|
|
1712
|
+
success: true,
|
|
1713
|
+
serverIp
|
|
1714
|
+
};
|
|
1715
|
+
}
|
|
1716
|
+
const allRecords = [];
|
|
1717
|
+
let hasFailures = false;
|
|
1718
|
+
for (const [rootDomain, domainHostnames] of groupedHostnames) {
|
|
1719
|
+
const providerConfig = normalizedConfig[rootDomain];
|
|
1720
|
+
if (!providerConfig) {
|
|
1721
|
+
logger.log(` ⚠ No provider config for ${rootDomain}`);
|
|
1722
|
+
continue;
|
|
1723
|
+
}
|
|
1724
|
+
const providerName = typeof providerConfig.provider === "string" ? providerConfig.provider : "custom";
|
|
1725
|
+
const requiredRecords = generateRequiredRecords(domainHostnames, rootDomain, serverIp);
|
|
1726
|
+
if (requiredRecords.length === 0) continue;
|
|
1727
|
+
logger.log(` Creating DNS records for ${rootDomain} (${providerName})...`);
|
|
1728
|
+
const domainRecords = await createDnsRecordsForDomain(requiredRecords, rootDomain, providerConfig);
|
|
1729
|
+
allRecords.push(...domainRecords);
|
|
1730
|
+
const created = domainRecords.filter((r) => r.created).length;
|
|
1731
|
+
const existed = domainRecords.filter((r) => r.existed).length;
|
|
1732
|
+
const failed = domainRecords.filter((r) => r.error).length;
|
|
1733
|
+
if (created > 0) logger.log(` ✓ Created ${created} DNS record(s) for ${rootDomain}`);
|
|
1734
|
+
if (existed > 0) logger.log(` ✓ ${existed} record(s) already exist for ${rootDomain}`);
|
|
1735
|
+
if (failed > 0) {
|
|
1736
|
+
logger.log(` ⚠ ${failed} record(s) failed for ${rootDomain}`);
|
|
1737
|
+
hasFailures = true;
|
|
1738
|
+
}
|
|
1739
|
+
if (state) {
|
|
1740
|
+
for (const record of domainRecords) if (record.created || record.existed) setDnsRecord(state, {
|
|
1741
|
+
domain: rootDomain,
|
|
1742
|
+
name: record.subdomain,
|
|
1743
|
+
type: record.type,
|
|
1744
|
+
value: record.value,
|
|
1745
|
+
ttl: "ttl" in providerConfig && providerConfig.ttl ? providerConfig.ttl : 300
|
|
1746
|
+
});
|
|
1747
|
+
}
|
|
1748
|
+
printDnsRecordsTable(domainRecords, rootDomain);
|
|
1749
|
+
if (providerConfig.provider === "manual" || failed > 0) printDnsRecordsSimple(domainRecords.filter((r) => !r.created && !r.existed), rootDomain);
|
|
1750
|
+
}
|
|
1751
|
+
return {
|
|
1752
|
+
records: allRecords,
|
|
1753
|
+
success: !hasFailures,
|
|
1754
|
+
serverIp
|
|
1755
|
+
};
|
|
1756
|
+
}
|
|
1757
|
+
/**
|
|
1758
|
+
* Verify DNS records resolve correctly after deployment.
|
|
1759
|
+
*
|
|
1760
|
+
* This function:
|
|
1761
|
+
* 1. Checks state for previously verified hostnames (skips if already verified with same IP)
|
|
1762
|
+
* 2. Attempts to resolve each hostname to an IP
|
|
1763
|
+
* 3. Compares resolved IP with expected server IP
|
|
1764
|
+
* 4. Updates state with verification results
|
|
1765
|
+
*
|
|
1766
|
+
* @param appHostnames - Map of app names to hostnames
|
|
1767
|
+
* @param serverIp - Expected IP address the hostnames should resolve to
|
|
1768
|
+
* @param state - Deploy state for caching verification results
|
|
1769
|
+
* @returns Array of verification results
|
|
1770
|
+
*/
|
|
1771
|
+
async function verifyDnsRecords(appHostnames, serverIp, state) {
|
|
1772
|
+
const results = [];
|
|
1773
|
+
logger.log("\n🔍 Verifying DNS records...");
|
|
1774
|
+
for (const [appName, hostname] of appHostnames) {
|
|
1775
|
+
if (isDnsVerified(state, hostname, serverIp)) {
|
|
1776
|
+
logger.log(` ✓ ${hostname} (previously verified)`);
|
|
1777
|
+
results.push({
|
|
1778
|
+
hostname,
|
|
1779
|
+
appName,
|
|
1780
|
+
verified: true,
|
|
1781
|
+
expectedIp: serverIp,
|
|
1782
|
+
skipped: true
|
|
1783
|
+
});
|
|
1784
|
+
continue;
|
|
1785
|
+
}
|
|
1786
|
+
try {
|
|
1787
|
+
const resolvedIp = await resolveHostnameToIp(hostname);
|
|
1788
|
+
if (resolvedIp === serverIp) {
|
|
1789
|
+
setDnsVerification(state, hostname, serverIp);
|
|
1790
|
+
logger.log(` ✓ ${hostname} → ${resolvedIp}`);
|
|
1791
|
+
results.push({
|
|
1792
|
+
hostname,
|
|
1793
|
+
appName,
|
|
1794
|
+
verified: true,
|
|
1795
|
+
resolvedIp,
|
|
1796
|
+
expectedIp: serverIp
|
|
1797
|
+
});
|
|
1798
|
+
} else {
|
|
1799
|
+
logger.log(` ⚠ ${hostname} resolves to ${resolvedIp}, expected ${serverIp}`);
|
|
1800
|
+
results.push({
|
|
1801
|
+
hostname,
|
|
1802
|
+
appName,
|
|
1803
|
+
verified: false,
|
|
1804
|
+
resolvedIp,
|
|
1805
|
+
expectedIp: serverIp
|
|
1806
|
+
});
|
|
1807
|
+
}
|
|
1808
|
+
} catch (error) {
|
|
1809
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
1810
|
+
logger.log(` ⚠ ${hostname} DNS not propagated (${message})`);
|
|
1811
|
+
results.push({
|
|
1812
|
+
hostname,
|
|
1813
|
+
appName,
|
|
1814
|
+
verified: false,
|
|
1815
|
+
expectedIp: serverIp,
|
|
1816
|
+
error: message
|
|
1817
|
+
});
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
const verified = results.filter((r) => r.verified).length;
|
|
1821
|
+
const skipped = results.filter((r) => r.skipped).length;
|
|
1822
|
+
const pending = results.filter((r) => !r.verified).length;
|
|
1823
|
+
if (pending > 0) {
|
|
1824
|
+
logger.log(`\n ${verified} verified, ${pending} pending propagation`);
|
|
1825
|
+
logger.log(" DNS changes may take 5-30 minutes to propagate");
|
|
1826
|
+
} else if (skipped > 0) logger.log(` ${verified} verified (${skipped} from cache)`);
|
|
1827
|
+
return results;
|
|
1828
|
+
}
|
|
1829
|
+
//#endregion
|
|
1830
|
+
Object.defineProperty(exports, "CommandFailed", {
|
|
1831
|
+
enumerable: true,
|
|
1832
|
+
get: function() {
|
|
1833
|
+
return CommandFailed;
|
|
1834
|
+
}
|
|
1835
|
+
});
|
|
1836
|
+
Object.defineProperty(exports, "CommandTimedOut", {
|
|
1837
|
+
enumerable: true,
|
|
1838
|
+
get: function() {
|
|
1839
|
+
return CommandTimedOut;
|
|
1840
|
+
}
|
|
1841
|
+
});
|
|
1842
|
+
Object.defineProperty(exports, "DEFAULT_TIMEOUT_MS", {
|
|
1843
|
+
enumerable: true,
|
|
1844
|
+
get: function() {
|
|
1845
|
+
return DEFAULT_TIMEOUT_MS;
|
|
1846
|
+
}
|
|
1847
|
+
});
|
|
1848
|
+
Object.defineProperty(exports, "FileSecretsStore", {
|
|
1849
|
+
enumerable: true,
|
|
1850
|
+
get: function() {
|
|
1851
|
+
return FileSecretsStore;
|
|
1852
|
+
}
|
|
1853
|
+
});
|
|
1854
|
+
Object.defineProperty(exports, "GKM_HOME_ENV", {
|
|
1855
|
+
enumerable: true,
|
|
1856
|
+
get: function() {
|
|
1857
|
+
return GKM_HOME_ENV;
|
|
1858
|
+
}
|
|
1859
|
+
});
|
|
1860
|
+
Object.defineProperty(exports, "MissingCredential", {
|
|
1861
|
+
enumerable: true,
|
|
1862
|
+
get: function() {
|
|
1863
|
+
return MissingCredential;
|
|
1864
|
+
}
|
|
1865
|
+
});
|
|
1866
|
+
Object.defineProperty(exports, "applicationName", {
|
|
1867
|
+
enumerable: true,
|
|
1868
|
+
get: function() {
|
|
1869
|
+
return applicationName;
|
|
1870
|
+
}
|
|
1871
|
+
});
|
|
1872
|
+
Object.defineProperty(exports, "asDokployState", {
|
|
1873
|
+
enumerable: true,
|
|
1874
|
+
get: function() {
|
|
1875
|
+
return asDokployState;
|
|
1876
|
+
}
|
|
1877
|
+
});
|
|
1878
|
+
Object.defineProperty(exports, "bundleExternals", {
|
|
1879
|
+
enumerable: true,
|
|
1880
|
+
get: function() {
|
|
1881
|
+
return bundleExternals;
|
|
1882
|
+
}
|
|
1883
|
+
});
|
|
1884
|
+
Object.defineProperty(exports, "cacheBackendFor", {
|
|
1885
|
+
enumerable: true,
|
|
1886
|
+
get: function() {
|
|
1887
|
+
return cacheBackendFor;
|
|
1888
|
+
}
|
|
1889
|
+
});
|
|
1890
|
+
Object.defineProperty(exports, "chainCredentials", {
|
|
1891
|
+
enumerable: true,
|
|
1892
|
+
get: function() {
|
|
1893
|
+
return chainCredentials;
|
|
1894
|
+
}
|
|
1895
|
+
});
|
|
1896
|
+
Object.defineProperty(exports, "createComposeState", {
|
|
1897
|
+
enumerable: true,
|
|
1898
|
+
get: function() {
|
|
1899
|
+
return createComposeState;
|
|
1900
|
+
}
|
|
1901
|
+
});
|
|
1902
|
+
Object.defineProperty(exports, "createDnsProvider", {
|
|
1903
|
+
enumerable: true,
|
|
1904
|
+
get: function() {
|
|
1905
|
+
return createDnsProvider;
|
|
1906
|
+
}
|
|
1907
|
+
});
|
|
1908
|
+
Object.defineProperty(exports, "createEmptyState", {
|
|
1909
|
+
enumerable: true,
|
|
1910
|
+
get: function() {
|
|
1911
|
+
return createEmptyState;
|
|
1912
|
+
}
|
|
1913
|
+
});
|
|
1914
|
+
Object.defineProperty(exports, "decrypt", {
|
|
1915
|
+
enumerable: true,
|
|
1916
|
+
get: function() {
|
|
1917
|
+
return decrypt;
|
|
1918
|
+
}
|
|
1919
|
+
});
|
|
1920
|
+
Object.defineProperty(exports, "deployIdentity", {
|
|
1921
|
+
enumerable: true,
|
|
1922
|
+
get: function() {
|
|
1923
|
+
return deployIdentity;
|
|
1924
|
+
}
|
|
1925
|
+
});
|
|
1926
|
+
Object.defineProperty(exports, "encrypt", {
|
|
1927
|
+
enumerable: true,
|
|
1928
|
+
get: function() {
|
|
1929
|
+
return encrypt;
|
|
1930
|
+
}
|
|
1931
|
+
});
|
|
1932
|
+
Object.defineProperty(exports, "eventsBackendFor", {
|
|
1933
|
+
enumerable: true,
|
|
1934
|
+
get: function() {
|
|
1935
|
+
return eventsBackendFor;
|
|
1936
|
+
}
|
|
1937
|
+
});
|
|
1938
|
+
Object.defineProperty(exports, "externalsManifestName", {
|
|
1939
|
+
enumerable: true,
|
|
1940
|
+
get: function() {
|
|
1941
|
+
return externalsManifestName;
|
|
1942
|
+
}
|
|
1943
|
+
});
|
|
1944
|
+
Object.defineProperty(exports, "extractSubdomain", {
|
|
1945
|
+
enumerable: true,
|
|
1946
|
+
get: function() {
|
|
1947
|
+
return extractSubdomain;
|
|
1948
|
+
}
|
|
1949
|
+
});
|
|
1950
|
+
Object.defineProperty(exports, "findRootDomain", {
|
|
1951
|
+
enumerable: true,
|
|
1952
|
+
get: function() {
|
|
1953
|
+
return findRootDomain;
|
|
1954
|
+
}
|
|
1955
|
+
});
|
|
1956
|
+
Object.defineProperty(exports, "getBackupState", {
|
|
1957
|
+
enumerable: true,
|
|
1958
|
+
get: function() {
|
|
1959
|
+
return getBackupState;
|
|
1960
|
+
}
|
|
1961
|
+
});
|
|
1962
|
+
Object.defineProperty(exports, "getCredentialsPath", {
|
|
1963
|
+
enumerable: true,
|
|
1964
|
+
get: function() {
|
|
1965
|
+
return getCredentialsPath;
|
|
1966
|
+
}
|
|
1967
|
+
});
|
|
1968
|
+
Object.defineProperty(exports, "getDokployCredentials", {
|
|
1969
|
+
enumerable: true,
|
|
1970
|
+
get: function() {
|
|
1971
|
+
return getDokployCredentials;
|
|
1972
|
+
}
|
|
1973
|
+
});
|
|
1974
|
+
Object.defineProperty(exports, "getDokployRegistryId", {
|
|
1975
|
+
enumerable: true,
|
|
1976
|
+
get: function() {
|
|
1977
|
+
return getDokployRegistryId;
|
|
1978
|
+
}
|
|
1979
|
+
});
|
|
1980
|
+
Object.defineProperty(exports, "getDokployToken", {
|
|
1981
|
+
enumerable: true,
|
|
1982
|
+
get: function() {
|
|
1983
|
+
return getDokployToken;
|
|
1984
|
+
}
|
|
1985
|
+
});
|
|
1986
|
+
Object.defineProperty(exports, "getGeneratedSecret", {
|
|
1987
|
+
enumerable: true,
|
|
1988
|
+
get: function() {
|
|
1989
|
+
return getGeneratedSecret;
|
|
1990
|
+
}
|
|
1991
|
+
});
|
|
1992
|
+
Object.defineProperty(exports, "getKeyPath", {
|
|
1993
|
+
enumerable: true,
|
|
1994
|
+
get: function() {
|
|
1995
|
+
return getKeyPath;
|
|
1996
|
+
}
|
|
1997
|
+
});
|
|
1998
|
+
Object.defineProperty(exports, "getKeystoreDir", {
|
|
1999
|
+
enumerable: true,
|
|
2000
|
+
get: function() {
|
|
2001
|
+
return getKeystoreDir;
|
|
2002
|
+
}
|
|
2003
|
+
});
|
|
2004
|
+
Object.defineProperty(exports, "getOrCreateKey", {
|
|
2005
|
+
enumerable: true,
|
|
2006
|
+
get: function() {
|
|
2007
|
+
return getOrCreateKey;
|
|
2008
|
+
}
|
|
2009
|
+
});
|
|
2010
|
+
Object.defineProperty(exports, "gkmHome", {
|
|
2011
|
+
enumerable: true,
|
|
2012
|
+
get: function() {
|
|
2013
|
+
return gkmHome;
|
|
2014
|
+
}
|
|
2015
|
+
});
|
|
2016
|
+
Object.defineProperty(exports, "imageName", {
|
|
2017
|
+
enumerable: true,
|
|
2018
|
+
get: function() {
|
|
2019
|
+
return imageName;
|
|
2020
|
+
}
|
|
2021
|
+
});
|
|
2022
|
+
Object.defineProperty(exports, "imageRef", {
|
|
2023
|
+
enumerable: true,
|
|
2024
|
+
get: function() {
|
|
2025
|
+
return imageRef;
|
|
2026
|
+
}
|
|
2027
|
+
});
|
|
2028
|
+
Object.defineProperty(exports, "importedPackages", {
|
|
2029
|
+
enumerable: true,
|
|
2030
|
+
get: function() {
|
|
2031
|
+
return importedPackages;
|
|
2032
|
+
}
|
|
2033
|
+
});
|
|
2034
|
+
Object.defineProperty(exports, "initStageSecrets", {
|
|
2035
|
+
enumerable: true,
|
|
2036
|
+
get: function() {
|
|
2037
|
+
return initStageSecrets;
|
|
2038
|
+
}
|
|
2039
|
+
});
|
|
2040
|
+
Object.defineProperty(exports, "isOwnedBy", {
|
|
2041
|
+
enumerable: true,
|
|
2042
|
+
get: function() {
|
|
2043
|
+
return isOwnedBy;
|
|
2044
|
+
}
|
|
2045
|
+
});
|
|
2046
|
+
Object.defineProperty(exports, "isRemoteStore", {
|
|
2047
|
+
enumerable: true,
|
|
2048
|
+
get: function() {
|
|
2049
|
+
return isRemoteStore;
|
|
2050
|
+
}
|
|
2051
|
+
});
|
|
2052
|
+
Object.defineProperty(exports, "keystoreProject", {
|
|
2053
|
+
enumerable: true,
|
|
2054
|
+
get: function() {
|
|
2055
|
+
return keystoreProject;
|
|
2056
|
+
}
|
|
2057
|
+
});
|
|
2058
|
+
Object.defineProperty(exports, "markerOf", {
|
|
2059
|
+
enumerable: true,
|
|
2060
|
+
get: function() {
|
|
2061
|
+
return markerOf;
|
|
2062
|
+
}
|
|
2063
|
+
});
|
|
2064
|
+
Object.defineProperty(exports, "maskPassword", {
|
|
2065
|
+
enumerable: true,
|
|
2066
|
+
get: function() {
|
|
2067
|
+
return maskPassword;
|
|
2068
|
+
}
|
|
2069
|
+
});
|
|
2070
|
+
Object.defineProperty(exports, "normalizeDnsConfig", {
|
|
2071
|
+
enumerable: true,
|
|
2072
|
+
get: function() {
|
|
2073
|
+
return normalizeDnsConfig;
|
|
2074
|
+
}
|
|
2075
|
+
});
|
|
2076
|
+
Object.defineProperty(exports, "orchestrateDns", {
|
|
2077
|
+
enumerable: true,
|
|
2078
|
+
get: function() {
|
|
2079
|
+
return orchestrateDns;
|
|
2080
|
+
}
|
|
2081
|
+
});
|
|
2082
|
+
Object.defineProperty(exports, "ownershipMarker", {
|
|
2083
|
+
enumerable: true,
|
|
2084
|
+
get: function() {
|
|
2085
|
+
return ownershipMarker;
|
|
2086
|
+
}
|
|
2087
|
+
});
|
|
2088
|
+
Object.defineProperty(exports, "projectKey", {
|
|
2089
|
+
enumerable: true,
|
|
2090
|
+
get: function() {
|
|
2091
|
+
return projectKey;
|
|
2092
|
+
}
|
|
2093
|
+
});
|
|
2094
|
+
Object.defineProperty(exports, "projectName", {
|
|
2095
|
+
enumerable: true,
|
|
2096
|
+
get: function() {
|
|
2097
|
+
return projectName;
|
|
2098
|
+
}
|
|
2099
|
+
});
|
|
2100
|
+
Object.defineProperty(exports, "providerOf", {
|
|
2101
|
+
enumerable: true,
|
|
2102
|
+
get: function() {
|
|
2103
|
+
return providerOf;
|
|
2104
|
+
}
|
|
2105
|
+
});
|
|
2106
|
+
Object.defineProperty(exports, "readCredentials", {
|
|
2107
|
+
enumerable: true,
|
|
2108
|
+
get: function() {
|
|
2109
|
+
return readCredentials;
|
|
2110
|
+
}
|
|
2111
|
+
});
|
|
2112
|
+
Object.defineProperty(exports, "readKey", {
|
|
2113
|
+
enumerable: true,
|
|
2114
|
+
get: function() {
|
|
2115
|
+
return readKey;
|
|
2116
|
+
}
|
|
2117
|
+
});
|
|
2118
|
+
Object.defineProperty(exports, "recordRelease", {
|
|
2119
|
+
enumerable: true,
|
|
2120
|
+
get: function() {
|
|
2121
|
+
return recordRelease;
|
|
2122
|
+
}
|
|
2123
|
+
});
|
|
2124
|
+
Object.defineProperty(exports, "recordRollback", {
|
|
2125
|
+
enumerable: true,
|
|
2126
|
+
get: function() {
|
|
2127
|
+
return recordRollback;
|
|
2128
|
+
}
|
|
2129
|
+
});
|
|
2130
|
+
Object.defineProperty(exports, "removeDokployCredentials", {
|
|
2131
|
+
enumerable: true,
|
|
2132
|
+
get: function() {
|
|
2133
|
+
return removeDokployCredentials;
|
|
2134
|
+
}
|
|
2135
|
+
});
|
|
2136
|
+
Object.defineProperty(exports, "removeGoDaddyCredentials", {
|
|
2137
|
+
enumerable: true,
|
|
2138
|
+
get: function() {
|
|
2139
|
+
return removeGoDaddyCredentials;
|
|
2140
|
+
}
|
|
2141
|
+
});
|
|
2142
|
+
Object.defineProperty(exports, "run", {
|
|
2143
|
+
enumerable: true,
|
|
2144
|
+
get: function() {
|
|
2145
|
+
return run;
|
|
2146
|
+
}
|
|
2147
|
+
});
|
|
2148
|
+
Object.defineProperty(exports, "runOutput", {
|
|
2149
|
+
enumerable: true,
|
|
2150
|
+
get: function() {
|
|
2151
|
+
return runOutput;
|
|
2152
|
+
}
|
|
2153
|
+
});
|
|
2154
|
+
Object.defineProperty(exports, "secretsStoreFor", {
|
|
2155
|
+
enumerable: true,
|
|
2156
|
+
get: function() {
|
|
2157
|
+
return secretsStoreFor;
|
|
2158
|
+
}
|
|
2159
|
+
});
|
|
2160
|
+
Object.defineProperty(exports, "setApplicationId", {
|
|
2161
|
+
enumerable: true,
|
|
2162
|
+
get: function() {
|
|
2163
|
+
return setApplicationId;
|
|
2164
|
+
}
|
|
2165
|
+
});
|
|
2166
|
+
Object.defineProperty(exports, "setBackupState", {
|
|
2167
|
+
enumerable: true,
|
|
2168
|
+
get: function() {
|
|
2169
|
+
return setBackupState;
|
|
2170
|
+
}
|
|
2171
|
+
});
|
|
2172
|
+
Object.defineProperty(exports, "setGeneratedSecret", {
|
|
2173
|
+
enumerable: true,
|
|
2174
|
+
get: function() {
|
|
2175
|
+
return setGeneratedSecret;
|
|
2176
|
+
}
|
|
2177
|
+
});
|
|
2178
|
+
Object.defineProperty(exports, "setPostgresBackupId", {
|
|
2179
|
+
enumerable: true,
|
|
2180
|
+
get: function() {
|
|
2181
|
+
return setPostgresBackupId;
|
|
2182
|
+
}
|
|
2183
|
+
});
|
|
2184
|
+
Object.defineProperty(exports, "stageTag", {
|
|
2185
|
+
enumerable: true,
|
|
2186
|
+
get: function() {
|
|
2187
|
+
return stageTag;
|
|
2188
|
+
}
|
|
2189
|
+
});
|
|
2190
|
+
Object.defineProperty(exports, "storageBackendFor", {
|
|
2191
|
+
enumerable: true,
|
|
2192
|
+
get: function() {
|
|
2193
|
+
return storageBackendFor;
|
|
2194
|
+
}
|
|
2195
|
+
});
|
|
2196
|
+
Object.defineProperty(exports, "storage_exports", {
|
|
2197
|
+
enumerable: true,
|
|
2198
|
+
get: function() {
|
|
2199
|
+
return storage_exports;
|
|
2200
|
+
}
|
|
2201
|
+
});
|
|
2202
|
+
Object.defineProperty(exports, "storeDokployCredentials", {
|
|
2203
|
+
enumerable: true,
|
|
2204
|
+
get: function() {
|
|
2205
|
+
return storeDokployCredentials;
|
|
2206
|
+
}
|
|
2207
|
+
});
|
|
2208
|
+
Object.defineProperty(exports, "storeFromConfig", {
|
|
2209
|
+
enumerable: true,
|
|
2210
|
+
get: function() {
|
|
2211
|
+
return storeFromConfig;
|
|
2212
|
+
}
|
|
2213
|
+
});
|
|
2214
|
+
Object.defineProperty(exports, "storeGoDaddyToken", {
|
|
2215
|
+
enumerable: true,
|
|
2216
|
+
get: function() {
|
|
2217
|
+
return storeGoDaddyToken;
|
|
2218
|
+
}
|
|
2219
|
+
});
|
|
2220
|
+
Object.defineProperty(exports, "storeHostingerToken", {
|
|
2221
|
+
enumerable: true,
|
|
2222
|
+
get: function() {
|
|
2223
|
+
return storeHostingerToken;
|
|
2224
|
+
}
|
|
2225
|
+
});
|
|
2226
|
+
Object.defineProperty(exports, "store_exports", {
|
|
2227
|
+
enumerable: true,
|
|
2228
|
+
get: function() {
|
|
2229
|
+
return store_exports;
|
|
2230
|
+
}
|
|
2231
|
+
});
|
|
2232
|
+
Object.defineProperty(exports, "storedCredentials", {
|
|
2233
|
+
enumerable: true,
|
|
2234
|
+
get: function() {
|
|
2235
|
+
return storedCredentials;
|
|
2236
|
+
}
|
|
2237
|
+
});
|
|
2238
|
+
Object.defineProperty(exports, "toEmbeddableSecrets", {
|
|
2239
|
+
enumerable: true,
|
|
2240
|
+
get: function() {
|
|
2241
|
+
return toEmbeddableSecrets;
|
|
2242
|
+
}
|
|
2243
|
+
});
|
|
2244
|
+
Object.defineProperty(exports, "verifyDnsRecords", {
|
|
2245
|
+
enumerable: true,
|
|
2246
|
+
get: function() {
|
|
2247
|
+
return verifyDnsRecords;
|
|
2248
|
+
}
|
|
2249
|
+
});
|
|
2250
|
+
Object.defineProperty(exports, "withCustomSecret", {
|
|
2251
|
+
enumerable: true,
|
|
2252
|
+
get: function() {
|
|
2253
|
+
return withCustomSecret;
|
|
2254
|
+
}
|
|
2255
|
+
});
|
|
2256
|
+
|
|
2257
|
+
//# sourceMappingURL=dns-D_0z9Tm1.cjs.map
|