@geekmidas/cli 10.0.0-alpha.17 → 10.0.0-alpha.170
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-C1h_wExz.cjs +1098 -0
- package/dist/EndpointGenerator-C1h_wExz.cjs.map +1 -0
- package/dist/EndpointGenerator-CSKhAD6W.mjs +1039 -0
- package/dist/EndpointGenerator-CSKhAD6W.mjs.map +1 -0
- package/dist/GoDaddyProvider-Cf4MIuaD.mjs +412 -0
- package/dist/GoDaddyProvider-Cf4MIuaD.mjs.map +1 -0
- package/dist/GoDaddyProvider-DK9_Jw9d.cjs +412 -0
- package/dist/GoDaddyProvider-DK9_Jw9d.cjs.map +1 -0
- package/dist/{HostingerProvider-BY26bWwB.mjs → HostingerProvider-CQebZrz3.mjs} +23 -9
- package/dist/HostingerProvider-CQebZrz3.mjs.map +1 -0
- package/dist/{HostingerProvider-BZFGYYVA.cjs → HostingerProvider-qQzo4MYp.cjs} +23 -9
- package/dist/HostingerProvider-qQzo4MYp.cjs.map +1 -0
- package/dist/LegacyStateStore-BeMRGXRi.cjs +124 -0
- package/dist/LegacyStateStore-BeMRGXRi.cjs.map +1 -0
- package/dist/LegacyStateStore-DXPHKdMk.mjs +124 -0
- package/dist/LegacyStateStore-DXPHKdMk.mjs.map +1 -0
- package/dist/LocalStateStore-BYQ9lPje.mjs +167 -0
- package/dist/LocalStateStore-BYQ9lPje.mjs.map +1 -0
- package/dist/LocalStateStore-E_sa5GR2.cjs +178 -0
- package/dist/LocalStateStore-E_sa5GR2.cjs.map +1 -0
- package/dist/OpenApiTsGenerator-5xPn-p65.mjs +534 -0
- package/dist/OpenApiTsGenerator-5xPn-p65.mjs.map +1 -0
- package/dist/OpenApiTsGenerator-CzrLGzC0.cjs +539 -0
- package/dist/OpenApiTsGenerator-CzrLGzC0.cjs.map +1 -0
- package/dist/{Route53Provider-Cvj40A8I.mjs → Route53Provider-Di_SD9CF.mjs} +3 -3
- package/dist/Route53Provider-Di_SD9CF.mjs.map +1 -0
- package/dist/{Route53Provider-DVILBsvV.cjs → Route53Provider-emLuQHVw.cjs} +3 -3
- package/dist/Route53Provider-emLuQHVw.cjs.map +1 -0
- package/dist/S3StateStore-BQaGVNRf.mjs +223 -0
- package/dist/S3StateStore-BQaGVNRf.mjs.map +1 -0
- package/dist/S3StateStore-Cjr4Rtsf.cjs +222 -0
- package/dist/S3StateStore-Cjr4Rtsf.cjs.map +1 -0
- package/dist/SSMStateStore-Bq_S7x5_.mjs +205 -0
- package/dist/SSMStateStore-Bq_S7x5_.mjs.map +1 -0
- package/dist/SSMStateStore-Cnfwdlme.cjs +204 -0
- package/dist/SSMStateStore-Cnfwdlme.cjs.map +1 -0
- package/dist/SubscriberGenerator-CfZWX0lT.mjs +783 -0
- package/dist/SubscriberGenerator-CfZWX0lT.mjs.map +1 -0
- package/dist/SubscriberGenerator-DMi4siph.cjs +848 -0
- package/dist/SubscriberGenerator-DMi4siph.cjs.map +1 -0
- package/dist/add-3_IHpF5F.cjs +713 -0
- package/dist/add-3_IHpF5F.cjs.map +1 -0
- package/dist/add-CNQFnG0C.mjs +711 -0
- package/dist/add-CNQFnG0C.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-BGu47YRF.cjs +6404 -0
- package/dist/apps-BGu47YRF.cjs.map +1 -0
- package/dist/apps-DGod3aS9.mjs +5765 -0
- package/dist/apps-DGod3aS9.mjs.map +1 -0
- package/dist/aws-C5LAU_Ii.mjs +97 -0
- package/dist/aws-C5LAU_Ii.mjs.map +1 -0
- package/dist/aws-DKC2m3sT.cjs +108 -0
- package/dist/aws-DKC2m3sT.cjs.map +1 -0
- package/dist/awsStore-Bx5nCFnS.mjs +121 -0
- package/dist/awsStore-Bx5nCFnS.mjs.map +1 -0
- package/dist/awsStore-u3ehhMoY.cjs +138 -0
- package/dist/awsStore-u3ehhMoY.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-DWGxNGSB.cjs} +59 -14
- package/dist/bundler-DWGxNGSB.cjs.map +1 -0
- package/dist/{bundler-mwH7WOb1.mjs → bundler-Dm0mB7EK.mjs} +59 -14
- package/dist/bundler-Dm0mB7EK.mjs.map +1 -0
- package/dist/cli-CYeZF85I.cjs +80 -0
- package/dist/cli-CYeZF85I.cjs.map +1 -0
- package/dist/cli-Qm-8tG46.mjs +80 -0
- package/dist/cli-Qm-8tG46.mjs.map +1 -0
- package/dist/compose-BVeevJO_.mjs +3139 -0
- package/dist/compose-BVeevJO_.mjs.map +1 -0
- package/dist/compose-CXgwCuqv.mjs +1560 -0
- package/dist/compose-CXgwCuqv.mjs.map +1 -0
- package/dist/compose-CshnO-Th.cjs +1919 -0
- package/dist/compose-CshnO-Th.cjs.map +1 -0
- package/dist/compose-IsvqY6iX.cjs +3240 -0
- package/dist/compose-IsvqY6iX.cjs.map +1 -0
- package/dist/config-B8gSu59v.d.mts +291 -0
- package/dist/config-B8gSu59v.d.mts.map +1 -0
- package/dist/config-u5XdE1Cq.d.cts +291 -0
- package/dist/config-u5XdE1Cq.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-BzJiK1nQ.mjs +236 -0
- package/dist/credentialSchemas-BzJiK1nQ.mjs.map +1 -0
- package/dist/credentialSchemas-OVXofU-r.cjs +271 -0
- package/dist/credentialSchemas-OVXofU-r.cjs.map +1 -0
- package/dist/credentials-CKIeLL7T.mjs +1838 -0
- package/dist/credentials-CKIeLL7T.mjs.map +1 -0
- package/dist/credentials-DzR2j8h1.cjs +2293 -0
- package/dist/credentials-DzR2j8h1.cjs.map +1 -0
- package/dist/databases-CuTL1e7s.cjs +703 -0
- package/dist/databases-CuTL1e7s.cjs.map +1 -0
- package/dist/databases-zN-gEox0.mjs +588 -0
- package/dist/databases-zN-gEox0.mjs.map +1 -0
- package/dist/define-6poNqm5O.mjs +106 -0
- package/dist/define-6poNqm5O.mjs.map +1 -0
- package/dist/define-crmMcXFS.cjs +153 -0
- package/dist/define-crmMcXFS.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 +658 -0
- package/dist/deploy/public.d.cts.map +1 -0
- package/dist/deploy/public.d.mts +658 -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-CjubyZlP.mjs +3848 -0
- package/dist/deploy-CjubyZlP.mjs.map +1 -0
- package/dist/deploy-DQjEjUfB.cjs +3904 -0
- package/dist/deploy-DQjEjUfB.cjs.map +1 -0
- package/dist/destroy-D1375m8C.cjs +789 -0
- package/dist/destroy-D1375m8C.cjs.map +1 -0
- package/dist/destroy-D4m5aO9k.mjs +788 -0
- package/dist/destroy-D4m5aO9k.mjs.map +1 -0
- package/dist/discover-39VKSE2i.cjs +1085 -0
- package/dist/discover-39VKSE2i.cjs.map +1 -0
- package/dist/discover-B_PDDaVj.mjs +940 -0
- package/dist/discover-B_PDDaVj.mjs.map +1 -0
- package/dist/docker-C27YUUMQ.mjs +1413 -0
- package/dist/docker-C27YUUMQ.mjs.map +1 -0
- package/dist/docker-CSEAKwFr.cjs +1520 -0
- package/dist/docker-CSEAKwFr.cjs.map +1 -0
- package/dist/dokploy-CSqDsvY-.mjs +38 -0
- package/dist/dokploy-CSqDsvY-.mjs.map +1 -0
- package/dist/dokploy-DJDdiFz6.cjs +38 -0
- package/dist/dokploy-DJDdiFz6.cjs.map +1 -0
- package/dist/drivers-BhdC9Efj.cjs +248 -0
- package/dist/drivers-BhdC9Efj.cjs.map +1 -0
- package/dist/drivers-wcDnzf7l.mjs +213 -0
- package/dist/drivers-wcDnzf7l.mjs.map +1 -0
- package/dist/eas-DC3F8cy0.mjs +334 -0
- package/dist/eas-DC3F8cy0.mjs.map +1 -0
- package/dist/eas-DryGYjFk.cjs +337 -0
- package/dist/eas-DryGYjFk.cjs.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-8qZGm15p.cjs +90 -0
- package/dist/encryption-8qZGm15p.cjs.map +1 -0
- package/dist/encryption-C8Y8Ly6n.mjs +89 -0
- package/dist/encryption-C8Y8Ly6n.mjs.map +1 -0
- package/dist/engine-C9E0MeLm.mjs +3216 -0
- package/dist/engine-C9E0MeLm.mjs.map +1 -0
- package/dist/engine-DI7JAyiD.cjs +3329 -0
- package/dist/engine-DI7JAyiD.cjs.map +1 -0
- package/dist/errors-D8Gwp5kU.mjs +23 -0
- package/dist/errors-D8Gwp5kU.mjs.map +1 -0
- package/dist/errors-DMC4Umsb.cjs +34 -0
- package/dist/errors-DMC4Umsb.cjs.map +1 -0
- package/dist/github-DdaV-Gll.mjs +977 -0
- package/dist/github-DdaV-Gll.mjs.map +1 -0
- package/dist/github-g3nRZlli.cjs +978 -0
- package/dist/github-g3nRZlli.cjs.map +1 -0
- package/dist/googlePlay-BHJ_iThq.cjs +931 -0
- package/dist/googlePlay-BHJ_iThq.cjs.map +1 -0
- package/dist/googlePlay-BmeR1kY4.mjs +931 -0
- package/dist/googlePlay-BmeR1kY4.mjs.map +1 -0
- package/dist/iam-BoYPPNdM.cjs +521 -0
- package/dist/iam-BoYPPNdM.cjs.map +1 -0
- package/dist/iam-ra1_Y405.mjs +442 -0
- package/dist/iam-ra1_Y405.mjs.map +1 -0
- package/dist/{index-RCUizGxL.d.cts → index-1H93w_H6.d.cts} +38 -14
- package/dist/index-1H93w_H6.d.cts.map +1 -0
- package/dist/{index-B4H4XF7A.d.mts → index-DFZ0SMwN.d.mts} +38 -14
- package/dist/index-DFZ0SMwN.d.mts.map +1 -0
- package/dist/index.cjs +15142 -13470
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +14959 -13285
- package/dist/index.mjs.map +1 -1
- package/dist/local-Bkv-e8uM.mjs +224 -0
- package/dist/local-Bkv-e8uM.mjs.map +1 -0
- package/dist/local-DTidpa-a.cjs +241 -0
- package/dist/local-DTidpa-a.cjs.map +1 -0
- package/dist/migrate-BZRsJwni.mjs +181 -0
- package/dist/migrate-BZRsJwni.mjs.map +1 -0
- package/dist/migrate-CXLhrHwu.cjs +272 -0
- package/dist/migrate-CXLhrHwu.cjs.map +1 -0
- package/dist/migrate-DNOI23QA.mjs +267 -0
- package/dist/migrate-DNOI23QA.mjs.map +1 -0
- package/dist/migrate-DU4MtKxz.cjs +181 -0
- package/dist/migrate-DU4MtKxz.cjs.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-1TM_Vzi7.mjs +408 -0
- package/dist/notes-1TM_Vzi7.mjs.map +1 -0
- package/dist/notes-BpaXOAkA.cjs +509 -0
- package/dist/notes-BpaXOAkA.cjs.map +1 -0
- package/dist/openapi.cjs +213 -7
- package/dist/openapi.cjs.map +1 -0
- package/dist/openapi.d.cts +32 -8
- package/dist/openapi.d.cts.map +1 -1
- package/dist/openapi.d.mts +32 -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-BRgsSv2P.mjs +222 -0
- package/dist/projectBucket-BRgsSv2P.mjs.map +1 -0
- package/dist/projectBucket-DbEWuLGX.cjs +263 -0
- package/dist/projectBucket-DbEWuLGX.cjs.map +1 -0
- package/dist/provider-BqpjG9QM.cjs +57 -0
- package/dist/provider-BqpjG9QM.cjs.map +1 -0
- package/dist/provider-CEOKk8NS.mjs +46 -0
- package/dist/provider-CEOKk8NS.mjs.map +1 -0
- package/dist/publish-BN1l3tPF.cjs +124 -0
- package/dist/publish-BN1l3tPF.cjs.map +1 -0
- package/dist/publish-DjFgxu2v.mjs +123 -0
- package/dist/publish-DjFgxu2v.mjs.map +1 -0
- package/dist/ready-COJHr1Yi.mjs +375 -0
- package/dist/ready-COJHr1Yi.mjs.map +1 -0
- package/dist/ready-DcD0SCnV.cjs +404 -0
- package/dist/ready-DcD0SCnV.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-BHVyg4Hg.cjs +316 -0
- package/dist/resolve-BHVyg4Hg.cjs.map +1 -0
- package/dist/resolve-NEKsqNAw.mjs +263 -0
- package/dist/resolve-NEKsqNAw.mjs.map +1 -0
- package/dist/rollback-BVgyLE7B.mjs +136 -0
- package/dist/rollback-BVgyLE7B.mjs.map +1 -0
- package/dist/rollback-CUjvOIDE.cjs +165 -0
- package/dist/rollback-CUjvOIDE.cjs.map +1 -0
- package/dist/runtime-CKOkIrw0.d.cts +82 -0
- package/dist/runtime-CKOkIrw0.d.cts.map +1 -0
- package/dist/runtime-Cdvv8SfU.d.mts +82 -0
- package/dist/runtime-Cdvv8SfU.d.mts.map +1 -0
- package/dist/s3-BO4yr61G.mjs +240 -0
- package/dist/s3-BO4yr61G.mjs.map +1 -0
- package/dist/s3-DnPbDfQN.cjs +240 -0
- package/dist/s3-DnPbDfQN.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-B8NLb54N.cjs → schemas-BCwKKA42.mjs} +399 -1173
- package/dist/schemas-BCwKKA42.mjs.map +1 -0
- package/dist/{workspace-DI-M3BnN.mjs → schemas-BQ_v0lEX.cjs} +487 -982
- package/dist/schemas-BQ_v0lEX.cjs.map +1 -0
- package/dist/secretsManager-CJyxFcBH.mjs +113 -0
- package/dist/secretsManager-CJyxFcBH.mjs.map +1 -0
- package/dist/secretsManager-D8on44WI.cjs +124 -0
- package/dist/secretsManager-D8on44WI.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-BxnCM11A.mjs +685 -0
- package/dist/serverSetup-BxnCM11A.mjs.map +1 -0
- package/dist/serverSetup-DScJ7tQs.cjs +685 -0
- package/dist/serverSetup-DScJ7tQs.cjs.map +1 -0
- package/dist/sniffer-9smKtb86.mjs +1824 -0
- package/dist/sniffer-9smKtb86.mjs.map +1 -0
- package/dist/sniffer-DHcxlSJF.cjs +1997 -0
- package/dist/sniffer-DHcxlSJF.cjs.map +1 -0
- package/dist/snsSubscriptions-B8TYeAM-.cjs +1184 -0
- package/dist/snsSubscriptions-B8TYeAM-.cjs.map +1 -0
- package/dist/snsSubscriptions-CygsiXhb.mjs +1053 -0
- package/dist/snsSubscriptions-CygsiXhb.mjs.map +1 -0
- package/dist/sst-Bgb3WWEl.mjs +478 -0
- package/dist/sst-Bgb3WWEl.mjs.map +1 -0
- package/dist/sst-DiHVSku5.cjs +501 -0
- package/dist/sst-DiHVSku5.cjs.map +1 -0
- package/dist/stack-A3evQgbk.cjs +2512 -0
- package/dist/stack-A3evQgbk.cjs.map +1 -0
- package/dist/stack-Cy2FwO3Z.mjs +2331 -0
- package/dist/stack-Cy2FwO3Z.mjs.map +1 -0
- package/dist/stage-Bm1x9Anp.cjs +313 -0
- package/dist/stage-Bm1x9Anp.cjs.map +1 -0
- package/dist/stage-Dgy08WVL.mjs +302 -0
- package/dist/stage-Dgy08WVL.mjs.map +1 -0
- package/dist/stages-BWg3NU3J.cjs +190 -0
- package/dist/stages-BWg3NU3J.cjs.map +1 -0
- package/dist/stages-COiipV8N.mjs +190 -0
- package/dist/stages-COiipV8N.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-BDRxzEZD.cjs +85 -0
- package/dist/terminal-BDRxzEZD.cjs.map +1 -0
- package/dist/terminal-BRAIvH83.mjs +85 -0
- package/dist/terminal-BRAIvH83.mjs.map +1 -0
- package/dist/types-Bl_CwZC9.cjs +90 -0
- package/dist/types-Bl_CwZC9.cjs.map +1 -0
- package/dist/{types-7R81hu0i.d.mts → types-DEmuMHsS.d.cts} +2147 -428
- package/dist/types-DEmuMHsS.d.cts.map +1 -0
- package/dist/types-Y1NfWlyG.mjs +61 -0
- package/dist/types-Y1NfWlyG.mjs.map +1 -0
- package/dist/{types-N7c2O2m7.d.cts → types-g_S0_RAi.d.mts} +2145 -428
- package/dist/types-g_S0_RAi.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-CEpojAus.cjs +3528 -0
- package/dist/workspace-CEpojAus.cjs.map +1 -0
- package/dist/workspace-_aoe8v6u.mjs +2990 -0
- package/dist/workspace-_aoe8v6u.mjs.map +1 -0
- package/package.json +75 -13
- package/dist/HostingerProvider-BY26bWwB.mjs.map +0 -1
- 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.map +0 -1
- 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-CdTMeMU_.cjs +0 -467
- package/dist/config-CdTMeMU_.cjs.map +0 -1
- package/dist/config-DPnPkWyH.mjs +0 -414
- package/dist/config-DPnPkWyH.mjs.map +0 -1
- package/dist/config.d.cts.map +0 -1
- package/dist/config.d.mts.map +0 -1
- package/dist/credentials-fJP5-fa1.mjs +0 -2780
- package/dist/credentials-fJP5-fa1.mjs.map +0 -1
- package/dist/credentials-tvyReUAd.cjs +0 -2917
- package/dist/credentials-tvyReUAd.cjs.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-CAfKyYPN.mjs +0 -216
- package/dist/github-CAfKyYPN.mjs.map +0 -1
- package/dist/github-DVE8Gg_F.cjs +0 -216
- package/dist/github-DVE8Gg_F.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-BeckoaP9.cjs +0 -2038
- package/dist/openapi-BeckoaP9.cjs.map +0 -1
- package/dist/openapi-DolhBm6r.mjs +0 -1991
- package/dist/openapi-DolhBm6r.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-4A4S2hcw.mjs +0 -122
- package/dist/transfer-4A4S2hcw.mjs.map +0 -1
- package/dist/transfer-DdmtKLzi.cjs +0 -151
- package/dist/transfer-DdmtKLzi.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-B8NLb54N.cjs.map +0 -1
- package/dist/workspace-DI-M3BnN.mjs.map +0 -1
|
@@ -0,0 +1,788 @@
|
|
|
1
|
+
import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
|
|
2
|
+
import { X as deployIdentity, a as findRootDomain, i as extractSubdomain, k as secretsStoreFor, o as normalizeDnsConfig, r as storedCredentials } from "./credentials-CKIeLL7T.mjs";
|
|
3
|
+
import { c as edgeRef, d as dockerHost, g as dockerCompose, l as removeEdgeRoutes, o as stackOverrideFile, p as sshTarget, u as composeServer } from "./compose-BVeevJO_.mjs";
|
|
4
|
+
import { N as assertDeployedStage } from "./workspace-_aoe8v6u.mjs";
|
|
5
|
+
import { loadWorkspaceConfig } from "./config.mjs";
|
|
6
|
+
import { a as composeProject, d as stackDir, v as EDGE_PROJECT } from "./stack-Cy2FwO3Z.mjs";
|
|
7
|
+
import { S as awsProvisioningCredentials, b as awsClientConfig, d as pruneStackDns, f as recordTtl, l as dnsCredentials, x as awsEndpoint } from "./snsSubscriptions-CygsiXhb.mjs";
|
|
8
|
+
import { S as createStateStore } from "./sniffer-9smKtb86.mjs";
|
|
9
|
+
import { c as defaultCdnClients, o as defaultClients, s as cdnName } from "./deploy-CjubyZlP.mjs";
|
|
10
|
+
import "./iam-ra1_Y405.mjs";
|
|
11
|
+
import { c as dnsRecordFqdn, d as dnsResources } from "./seeds-Ccn0Ru2T.mjs";
|
|
12
|
+
import { l as canPrompt, u as prompt } from "./index.mjs";
|
|
13
|
+
import { join, resolve } from "node:path";
|
|
14
|
+
import { existsSync } from "node:fs";
|
|
15
|
+
//#region src/providers/s3/destroy.ts
|
|
16
|
+
/** The record types this plans. Every other is the command's to report. */
|
|
17
|
+
const AWS_RESOURCE_TYPES = [
|
|
18
|
+
"cloudfront-distribution",
|
|
19
|
+
"cloudfront-oac",
|
|
20
|
+
"cloudfront-headers",
|
|
21
|
+
"acm-certificate",
|
|
22
|
+
"sns-subscription",
|
|
23
|
+
"sns-topic",
|
|
24
|
+
"sqs-queue",
|
|
25
|
+
"iam-access-key",
|
|
26
|
+
"iam-user",
|
|
27
|
+
"s3-bucket"
|
|
28
|
+
];
|
|
29
|
+
/** A distribution disabled before it is deleted can take this long. */
|
|
30
|
+
const DISABLE_WAIT = {
|
|
31
|
+
timeoutMs: 27e5,
|
|
32
|
+
intervalMs: 2e4
|
|
33
|
+
};
|
|
34
|
+
/** A disabled distribution that never finished deploying. */
|
|
35
|
+
var DistributionStillDeploying = class extends GkmError {
|
|
36
|
+
id;
|
|
37
|
+
waitedMs;
|
|
38
|
+
constructor(id, waitedMs) {
|
|
39
|
+
super(`CloudFront distribution ${id} was disabled, and is still deploying after ${Math.round(waitedMs / 6e4)} minutes. CloudFront deletes only a disabled distribution that has finished deploying. Run the destroy again later: everything deleted so far is forgotten, and it carries on from here.`);
|
|
40
|
+
this.id = id;
|
|
41
|
+
this.waitedMs = waitedMs;
|
|
42
|
+
this.name = "DistributionStillDeploying";
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
/** What an AWS SDK error is called, whichever field carries it. */
|
|
46
|
+
function errorName(error) {
|
|
47
|
+
const e = error;
|
|
48
|
+
return e?.Code ?? e?.name ?? "";
|
|
49
|
+
}
|
|
50
|
+
/** A read whose "there is none" answer is one of `missing`. */
|
|
51
|
+
async function readOr(read, missing) {
|
|
52
|
+
try {
|
|
53
|
+
return await read();
|
|
54
|
+
} catch (error) {
|
|
55
|
+
if (missing.includes(errorName(error))) return void 0;
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
60
|
+
/** Whether a tag list says gkm made it for this project's stage. */
|
|
61
|
+
function ours(tags, input) {
|
|
62
|
+
const of = (key) => tags?.find((t) => t.Key === key)?.Value;
|
|
63
|
+
return of("gkm:project") === input.identityKey && of("gkm:stage") === input.stage;
|
|
64
|
+
}
|
|
65
|
+
const NOT_TAGGED = "not tagged as this stage's (gkm:project, gkm:stage): gkm found it, it did not make it";
|
|
66
|
+
/** The id after the type in a record's key: `cloudfront-oac:Uploads` → `Uploads`. */
|
|
67
|
+
function keyId(record) {
|
|
68
|
+
return record.key.slice(record.key.indexOf(":") + 1);
|
|
69
|
+
}
|
|
70
|
+
/** The file server a CDN record is for: `cloudfront-headers:Uploads:cors` → `Uploads`. */
|
|
71
|
+
function serverOf(record) {
|
|
72
|
+
return keyId(record).split(":")[0] ?? "";
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Each AWS resource the stage's state records, checked, in the order it is
|
|
76
|
+
* deleted — and the DNS records the deleted ones were given.
|
|
77
|
+
*/
|
|
78
|
+
async function planAwsDestroy(input) {
|
|
79
|
+
const steps = [];
|
|
80
|
+
const dns = [];
|
|
81
|
+
const records = Object.values(input.resources);
|
|
82
|
+
const of = (type) => records.filter((r) => r.type === type);
|
|
83
|
+
const wait = input.wait ?? DISABLE_WAIT;
|
|
84
|
+
if ([
|
|
85
|
+
...of("cloudfront-distribution"),
|
|
86
|
+
...of("cloudfront-oac"),
|
|
87
|
+
...of("cloudfront-headers"),
|
|
88
|
+
...of("acm-certificate")
|
|
89
|
+
].length > 0) {
|
|
90
|
+
const cdn = await (input.clients?.cdn ?? defaultCdnClients)(input.credential);
|
|
91
|
+
const kept = /* @__PURE__ */ new Map();
|
|
92
|
+
for (const record of of("cloudfront-distribution")) {
|
|
93
|
+
const step = await distributionStep(cdn, record, input, wait, dns);
|
|
94
|
+
if (step.leftAlone) kept.set(serverOf(record), step.label);
|
|
95
|
+
steps.push(step);
|
|
96
|
+
}
|
|
97
|
+
const usedBy = async (record, step) => {
|
|
98
|
+
const holder = kept.get(serverOf(record));
|
|
99
|
+
if (!holder) return step();
|
|
100
|
+
const label = (await step()).label;
|
|
101
|
+
return {
|
|
102
|
+
key: record.key,
|
|
103
|
+
label,
|
|
104
|
+
leftAlone: `used by ${holder}, which is left alone`
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
for (const record of of("cloudfront-oac")) steps.push(await usedBy(record, () => originAccessControlStep(cdn, record, input)));
|
|
108
|
+
for (const record of of("cloudfront-headers")) steps.push(await usedBy(record, () => headersPolicyStep(cdn, record, input)));
|
|
109
|
+
for (const record of of("acm-certificate")) {
|
|
110
|
+
const found = [];
|
|
111
|
+
const step = await usedBy(record, () => certificateStep(cdn, record, input, found));
|
|
112
|
+
if (!step.leftAlone) dns.push(...found);
|
|
113
|
+
steps.push(step);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if ([
|
|
117
|
+
...of("sns-subscription"),
|
|
118
|
+
...of("sns-topic"),
|
|
119
|
+
...of("sqs-queue")
|
|
120
|
+
].length > 0) {
|
|
121
|
+
const events = await eventClients(input.credential, records);
|
|
122
|
+
for (const record of of("sns-subscription")) steps.push(subscriptionStep(events, record));
|
|
123
|
+
for (const record of of("sns-topic")) steps.push(await topicStep(events, record, input));
|
|
124
|
+
for (const record of of("sqs-queue")) steps.push(await queueStep(events, record, input));
|
|
125
|
+
}
|
|
126
|
+
const users = of("iam-user");
|
|
127
|
+
const keys = of("iam-access-key");
|
|
128
|
+
const buckets = of("s3-bucket");
|
|
129
|
+
if (users.length + keys.length + buckets.length > 0) {
|
|
130
|
+
const global = await (input.clients?.s3 ?? defaultClients)(input.credential, regionOf(buckets[0]) ?? "us-east-1");
|
|
131
|
+
const userSteps = /* @__PURE__ */ new Map();
|
|
132
|
+
for (const record of users) {
|
|
133
|
+
const step = await userStep(global, record, input);
|
|
134
|
+
userSteps.set(record.id ?? "", step);
|
|
135
|
+
steps.push(step);
|
|
136
|
+
}
|
|
137
|
+
for (const record of keys) {
|
|
138
|
+
const user = record.data?.user;
|
|
139
|
+
const owner = user ? userSteps.get(user) : void 0;
|
|
140
|
+
steps.push({
|
|
141
|
+
key: record.key,
|
|
142
|
+
label: `IAM access key ${record.id ?? ""} of ${user ?? "an unknown user"}`,
|
|
143
|
+
...owner?.leftAlone ? { leftAlone: `its user is left alone: ${owner.leftAlone}` } : owner ? { withUser: true } : { leftAlone: "its user is not one this stage recorded" }
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
for (const record of buckets) {
|
|
147
|
+
const region = regionOf(record) ?? global.region;
|
|
148
|
+
const clients = region === global.region ? global : await (input.clients?.s3 ?? defaultClients)(input.credential, region);
|
|
149
|
+
steps.push(await bucketStep(clients, record, input));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
steps,
|
|
154
|
+
dns
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function regionOf(record) {
|
|
158
|
+
return (record?.data)?.region;
|
|
159
|
+
}
|
|
160
|
+
async function distributionStep({ CF, cloudfront }, record, input, wait, dns) {
|
|
161
|
+
const id = record.id ?? "";
|
|
162
|
+
const distribution = (await readOr(() => cloudfront.send(new CF.GetDistributionCommand({ Id: id })), ["NoSuchDistribution"]))?.Distribution;
|
|
163
|
+
const aliases = distribution?.DistributionConfig?.Aliases?.Items ?? [];
|
|
164
|
+
const label = `CloudFront distribution ${id}${aliases.length ? ` (${aliases.join(", ")})` : ""}`;
|
|
165
|
+
if (!distribution) return {
|
|
166
|
+
key: record.key,
|
|
167
|
+
label,
|
|
168
|
+
gone: true
|
|
169
|
+
};
|
|
170
|
+
const tags = await cloudfront.send(new CF.ListTagsForResourceCommand({ Resource: distribution.ARN }));
|
|
171
|
+
const comment = `gkm ${input.identityKey} ${input.stage} ${serverOf(record)}`;
|
|
172
|
+
const marked = distribution.DistributionConfig?.Comment === comment.slice(0, 128);
|
|
173
|
+
if (!ours(tags.Tags?.Items, input) && !marked) return {
|
|
174
|
+
key: record.key,
|
|
175
|
+
label,
|
|
176
|
+
leftAlone: `${NOT_TAGGED}, and its comment is not "${comment}"`
|
|
177
|
+
};
|
|
178
|
+
for (const host of aliases) dns.push({
|
|
179
|
+
host,
|
|
180
|
+
type: "CNAME",
|
|
181
|
+
value: distribution.DomainName ?? ""
|
|
182
|
+
});
|
|
183
|
+
return {
|
|
184
|
+
key: record.key,
|
|
185
|
+
label,
|
|
186
|
+
remove: async () => {
|
|
187
|
+
let current = await cloudfront.send(new CF.GetDistributionConfigCommand({ Id: id }));
|
|
188
|
+
if (current.DistributionConfig?.Enabled) await cloudfront.send(new CF.UpdateDistributionCommand({
|
|
189
|
+
Id: id,
|
|
190
|
+
IfMatch: current.ETag,
|
|
191
|
+
DistributionConfig: {
|
|
192
|
+
...current.DistributionConfig,
|
|
193
|
+
Enabled: false
|
|
194
|
+
}
|
|
195
|
+
}));
|
|
196
|
+
const started = Date.now();
|
|
197
|
+
for (;;) {
|
|
198
|
+
if ((await cloudfront.send(new CF.GetDistributionCommand({ Id: id }))).Distribution?.Status === "Deployed") break;
|
|
199
|
+
if (Date.now() - started > wait.timeoutMs) throw new DistributionStillDeploying(id, Date.now() - started);
|
|
200
|
+
await sleep(wait.intervalMs);
|
|
201
|
+
}
|
|
202
|
+
current = await cloudfront.send(new CF.GetDistributionConfigCommand({ Id: id }));
|
|
203
|
+
await cloudfront.send(new CF.DeleteDistributionCommand({
|
|
204
|
+
Id: id,
|
|
205
|
+
IfMatch: current.ETag
|
|
206
|
+
}));
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
async function originAccessControlStep({ CF, cloudfront }, record, input) {
|
|
211
|
+
const id = record.id ?? "";
|
|
212
|
+
const expected = cdnName(input.scope, input.stage, keyId(record));
|
|
213
|
+
const label = `CloudFront origin access control ${expected}`;
|
|
214
|
+
const found = await readOr(() => cloudfront.send(new CF.GetOriginAccessControlCommand({ Id: id })), ["NoSuchOriginAccessControl"]);
|
|
215
|
+
if (!found) return {
|
|
216
|
+
key: record.key,
|
|
217
|
+
label,
|
|
218
|
+
gone: true
|
|
219
|
+
};
|
|
220
|
+
const name = found.OriginAccessControl?.OriginAccessControlConfig?.Name;
|
|
221
|
+
if (name !== expected) return {
|
|
222
|
+
key: record.key,
|
|
223
|
+
label,
|
|
224
|
+
leftAlone: `named ${name}, not this stage's ${expected}`
|
|
225
|
+
};
|
|
226
|
+
return {
|
|
227
|
+
key: record.key,
|
|
228
|
+
label,
|
|
229
|
+
remove: async () => {
|
|
230
|
+
const { ETag } = await cloudfront.send(new CF.GetOriginAccessControlCommand({ Id: id }));
|
|
231
|
+
await cloudfront.send(new CF.DeleteOriginAccessControlCommand({
|
|
232
|
+
Id: id,
|
|
233
|
+
IfMatch: ETag
|
|
234
|
+
}));
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
async function headersPolicyStep({ CF, cloudfront }, record, input) {
|
|
239
|
+
const id = record.id ?? "";
|
|
240
|
+
const [server = "", kind = ""] = keyId(record).split(":");
|
|
241
|
+
const expected = `${cdnName(input.scope, input.stage, server)}-${kind}`;
|
|
242
|
+
const label = `CloudFront response headers policy ${expected}`;
|
|
243
|
+
const found = await readOr(() => cloudfront.send(new CF.GetResponseHeadersPolicyConfigCommand({ Id: id })), ["NoSuchResponseHeadersPolicy"]);
|
|
244
|
+
if (!found) return {
|
|
245
|
+
key: record.key,
|
|
246
|
+
label,
|
|
247
|
+
gone: true
|
|
248
|
+
};
|
|
249
|
+
const name = found.ResponseHeadersPolicyConfig?.Name;
|
|
250
|
+
if (name !== expected) return {
|
|
251
|
+
key: record.key,
|
|
252
|
+
label,
|
|
253
|
+
leftAlone: `named ${name}, not this stage's ${expected}`
|
|
254
|
+
};
|
|
255
|
+
return {
|
|
256
|
+
key: record.key,
|
|
257
|
+
label,
|
|
258
|
+
remove: async () => {
|
|
259
|
+
const { ETag } = await cloudfront.send(new CF.GetResponseHeadersPolicyConfigCommand({ Id: id }));
|
|
260
|
+
await cloudfront.send(new CF.DeleteResponseHeadersPolicyCommand({
|
|
261
|
+
Id: id,
|
|
262
|
+
IfMatch: ETag
|
|
263
|
+
}));
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
async function certificateStep({ ACM, acm }, record, input, dns) {
|
|
268
|
+
const arn = record.id ?? "";
|
|
269
|
+
const label = `ACM certificate ${record.data?.host ?? arn} (us-east-1)`;
|
|
270
|
+
const found = await readOr(() => acm.send(new ACM.DescribeCertificateCommand({ CertificateArn: arn })), ["ResourceNotFoundException"]);
|
|
271
|
+
if (!found?.Certificate) return {
|
|
272
|
+
key: record.key,
|
|
273
|
+
label,
|
|
274
|
+
gone: true
|
|
275
|
+
};
|
|
276
|
+
if (!ours((await acm.send(new ACM.ListTagsForCertificateCommand({ CertificateArn: arn }))).Tags, input)) return {
|
|
277
|
+
key: record.key,
|
|
278
|
+
label,
|
|
279
|
+
leftAlone: NOT_TAGGED
|
|
280
|
+
};
|
|
281
|
+
for (const option of found.Certificate.DomainValidationOptions ?? []) {
|
|
282
|
+
const r = option.ResourceRecord;
|
|
283
|
+
if (r?.Name && r.Value && r.Type === "CNAME") dns.push({
|
|
284
|
+
host: r.Name,
|
|
285
|
+
type: "CNAME",
|
|
286
|
+
value: r.Value
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
return {
|
|
290
|
+
key: record.key,
|
|
291
|
+
label,
|
|
292
|
+
remove: async () => {
|
|
293
|
+
await acm.send(new ACM.DeleteCertificateCommand({ CertificateArn: arn }));
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
async function eventClients(credential, _records) {
|
|
298
|
+
const SNS = await import("@aws-sdk/client-sns");
|
|
299
|
+
const SQS = await import("@aws-sdk/client-sqs");
|
|
300
|
+
const sns = /* @__PURE__ */ new Map();
|
|
301
|
+
const sqs = /* @__PURE__ */ new Map();
|
|
302
|
+
return {
|
|
303
|
+
SNS,
|
|
304
|
+
SQS,
|
|
305
|
+
sns: async (region) => {
|
|
306
|
+
if (!sns.has(region)) {
|
|
307
|
+
const endpoint = awsEndpoint(process.env, "SNS");
|
|
308
|
+
sns.set(region, new SNS.SNSClient({
|
|
309
|
+
...await awsClientConfig(credential, region),
|
|
310
|
+
...endpoint ? { endpoint } : {}
|
|
311
|
+
}));
|
|
312
|
+
}
|
|
313
|
+
return sns.get(region);
|
|
314
|
+
},
|
|
315
|
+
sqs: async (region) => {
|
|
316
|
+
if (!sqs.has(region)) {
|
|
317
|
+
const endpoint = awsEndpoint(process.env, "SQS");
|
|
318
|
+
sqs.set(region, new SQS.SQSClient({
|
|
319
|
+
...await awsClientConfig(credential, region),
|
|
320
|
+
...endpoint ? { endpoint } : {}
|
|
321
|
+
}));
|
|
322
|
+
}
|
|
323
|
+
return sqs.get(region);
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
/** `arn:aws:sns:<region>:<account>:<name>` */
|
|
328
|
+
function arnParts(arn) {
|
|
329
|
+
const [, , , region = "", account = "", ...rest] = arn.split(":");
|
|
330
|
+
return {
|
|
331
|
+
region,
|
|
332
|
+
account,
|
|
333
|
+
name: rest.join(":")
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
function subscriptionStep({ SNS, sns }, record) {
|
|
337
|
+
const arn = record.id ?? "";
|
|
338
|
+
const label = `SNS subscription ${keyId(record)}`;
|
|
339
|
+
if (!arn.startsWith("arn:")) return {
|
|
340
|
+
key: record.key,
|
|
341
|
+
label,
|
|
342
|
+
gone: true
|
|
343
|
+
};
|
|
344
|
+
return {
|
|
345
|
+
key: record.key,
|
|
346
|
+
label,
|
|
347
|
+
remove: async () => {
|
|
348
|
+
const client = await sns(arnParts(arn).region);
|
|
349
|
+
await readOr(() => client.send(new SNS.UnsubscribeCommand({ SubscriptionArn: arn })), ["NotFound", "NotFoundException"]);
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
async function topicStep({ SNS, sns }, record, input) {
|
|
354
|
+
const arn = record.id ?? "";
|
|
355
|
+
const label = `SNS topic ${arnParts(arn).name}`;
|
|
356
|
+
const client = await sns(arnParts(arn).region);
|
|
357
|
+
const tags = await readOr(() => client.send(new SNS.ListTagsForResourceCommand({ ResourceArn: arn })), [
|
|
358
|
+
"NotFound",
|
|
359
|
+
"NotFoundException",
|
|
360
|
+
"ResourceNotFound",
|
|
361
|
+
"ResourceNotFoundException"
|
|
362
|
+
]);
|
|
363
|
+
if (!tags) return {
|
|
364
|
+
key: record.key,
|
|
365
|
+
label,
|
|
366
|
+
gone: true
|
|
367
|
+
};
|
|
368
|
+
if (!ours(tags.Tags, input)) return {
|
|
369
|
+
key: record.key,
|
|
370
|
+
label,
|
|
371
|
+
leftAlone: NOT_TAGGED
|
|
372
|
+
};
|
|
373
|
+
return {
|
|
374
|
+
key: record.key,
|
|
375
|
+
label,
|
|
376
|
+
remove: async () => {
|
|
377
|
+
await client.send(new SNS.DeleteTopicCommand({ TopicArn: arn }));
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
async function queueStep({ SQS, sqs }, record, input) {
|
|
382
|
+
const { region, account, name } = arnParts(record.id ?? "");
|
|
383
|
+
const label = `SQS queue ${name}`;
|
|
384
|
+
const client = await sqs(region);
|
|
385
|
+
const url = await readOr(() => client.send(new SQS.GetQueueUrlCommand({
|
|
386
|
+
QueueName: name,
|
|
387
|
+
QueueOwnerAWSAccountId: account
|
|
388
|
+
})), ["QueueDoesNotExist", "AWS.SimpleQueueService.NonExistentQueue"]);
|
|
389
|
+
if (!url?.QueueUrl) return {
|
|
390
|
+
key: record.key,
|
|
391
|
+
label,
|
|
392
|
+
gone: true
|
|
393
|
+
};
|
|
394
|
+
const queueUrl = url.QueueUrl;
|
|
395
|
+
const tags = await client.send(new SQS.ListQueueTagsCommand({ QueueUrl: queueUrl }));
|
|
396
|
+
if (!ours(Object.entries(tags.Tags ?? {}).map(([Key, Value]) => ({
|
|
397
|
+
Key,
|
|
398
|
+
Value
|
|
399
|
+
})), input)) return {
|
|
400
|
+
key: record.key,
|
|
401
|
+
label,
|
|
402
|
+
leftAlone: NOT_TAGGED
|
|
403
|
+
};
|
|
404
|
+
return {
|
|
405
|
+
key: record.key,
|
|
406
|
+
label,
|
|
407
|
+
remove: async () => {
|
|
408
|
+
await client.send(new SQS.DeleteQueueCommand({ QueueUrl: queueUrl }));
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
async function userStep({ IAM, iam }, record, input) {
|
|
413
|
+
const name = record.id ?? "";
|
|
414
|
+
const label = `IAM user ${name}, its access keys and policies`;
|
|
415
|
+
const found = await readOr(() => iam.send(new IAM.GetUserCommand({ UserName: name })), ["NoSuchEntity", "NoSuchEntityException"]);
|
|
416
|
+
if (!found?.User) return {
|
|
417
|
+
key: record.key,
|
|
418
|
+
label,
|
|
419
|
+
gone: true
|
|
420
|
+
};
|
|
421
|
+
const tags = await iam.send(new IAM.ListUserTagsCommand({ UserName: name }));
|
|
422
|
+
if (found.User.Path !== "/gkm/" || !ours(tags.Tags, input)) return {
|
|
423
|
+
key: record.key,
|
|
424
|
+
label,
|
|
425
|
+
leftAlone: NOT_TAGGED
|
|
426
|
+
};
|
|
427
|
+
return {
|
|
428
|
+
key: record.key,
|
|
429
|
+
label,
|
|
430
|
+
remove: async () => {
|
|
431
|
+
const keys = await iam.send(new IAM.ListAccessKeysCommand({ UserName: name }));
|
|
432
|
+
for (const key of keys.AccessKeyMetadata ?? []) await iam.send(new IAM.DeleteAccessKeyCommand({
|
|
433
|
+
UserName: name,
|
|
434
|
+
AccessKeyId: key.AccessKeyId
|
|
435
|
+
}));
|
|
436
|
+
const inline = await iam.send(new IAM.ListUserPoliciesCommand({ UserName: name }));
|
|
437
|
+
for (const policy of inline.PolicyNames ?? []) await iam.send(new IAM.DeleteUserPolicyCommand({
|
|
438
|
+
UserName: name,
|
|
439
|
+
PolicyName: policy
|
|
440
|
+
}));
|
|
441
|
+
const attached = await iam.send(new IAM.ListAttachedUserPoliciesCommand({ UserName: name }));
|
|
442
|
+
for (const policy of attached.AttachedPolicies ?? []) await iam.send(new IAM.DetachUserPolicyCommand({
|
|
443
|
+
UserName: name,
|
|
444
|
+
PolicyArn: policy.PolicyArn
|
|
445
|
+
}));
|
|
446
|
+
await iam.send(new IAM.DeleteUserCommand({ UserName: name }));
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
/** Every object version and delete marker in a bucket, a page at a time. */
|
|
451
|
+
async function* bucketVersions({ S3, s3 }, bucket) {
|
|
452
|
+
let KeyMarker;
|
|
453
|
+
let VersionIdMarker;
|
|
454
|
+
for (;;) {
|
|
455
|
+
const page = await s3.send(new S3.ListObjectVersionsCommand({
|
|
456
|
+
Bucket: bucket,
|
|
457
|
+
...KeyMarker ? { KeyMarker } : {},
|
|
458
|
+
...VersionIdMarker ? { VersionIdMarker } : {}
|
|
459
|
+
}));
|
|
460
|
+
const objects = [...page.Versions ?? [], ...page.DeleteMarkers ?? []].filter((o) => o.Key).map((o) => ({
|
|
461
|
+
Key: o.Key,
|
|
462
|
+
...o.VersionId && o.VersionId !== "null" ? { VersionId: o.VersionId } : {}
|
|
463
|
+
}));
|
|
464
|
+
if (objects.length > 0) yield objects;
|
|
465
|
+
if (!page.IsTruncated) return;
|
|
466
|
+
KeyMarker = page.NextKeyMarker;
|
|
467
|
+
VersionIdMarker = page.NextVersionIdMarker;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
async function bucketStep(clients, record, input) {
|
|
471
|
+
const { S3, s3 } = clients;
|
|
472
|
+
const bucket = record.id ?? "";
|
|
473
|
+
const tagging = await readOr(() => s3.send(new S3.GetBucketTaggingCommand({ Bucket: bucket })), [
|
|
474
|
+
"NoSuchBucket",
|
|
475
|
+
"NoSuchTagSet",
|
|
476
|
+
"NoSuchTagSetError"
|
|
477
|
+
]);
|
|
478
|
+
const exists = await readOr(() => s3.send(new S3.HeadBucketCommand({ Bucket: bucket })), ["NotFound", "NoSuchBucket"]);
|
|
479
|
+
const base = `S3 bucket ${bucket}`;
|
|
480
|
+
if (!exists) return {
|
|
481
|
+
key: record.key,
|
|
482
|
+
label: base,
|
|
483
|
+
gone: true
|
|
484
|
+
};
|
|
485
|
+
if (!ours(tagging?.TagSet, input)) return {
|
|
486
|
+
key: record.key,
|
|
487
|
+
label: base,
|
|
488
|
+
leftAlone: NOT_TAGGED
|
|
489
|
+
};
|
|
490
|
+
let count = 0;
|
|
491
|
+
for await (const page of bucketVersions(clients, bucket)) count += page.length;
|
|
492
|
+
return {
|
|
493
|
+
key: record.key,
|
|
494
|
+
label: `${base}, emptied first: ${count} object version${count === 1 ? "" : "s"}`,
|
|
495
|
+
remove: async () => {
|
|
496
|
+
for (let pass = 0; pass < 5; pass++) {
|
|
497
|
+
let deleted = 0;
|
|
498
|
+
for await (const page of bucketVersions(clients, bucket)) {
|
|
499
|
+
for (let i = 0; i < page.length; i += 1e3) await s3.send(new S3.DeleteObjectsCommand({
|
|
500
|
+
Bucket: bucket,
|
|
501
|
+
Delete: {
|
|
502
|
+
Objects: page.slice(i, i + 1e3),
|
|
503
|
+
Quiet: true
|
|
504
|
+
}
|
|
505
|
+
}));
|
|
506
|
+
deleted += page.length;
|
|
507
|
+
}
|
|
508
|
+
if (deleted === 0) break;
|
|
509
|
+
}
|
|
510
|
+
await s3.send(new S3.DeleteBucketCommand({ Bucket: bucket }));
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
//#endregion
|
|
515
|
+
//#region src/compose/destroy.ts
|
|
516
|
+
/**
|
|
517
|
+
* `gkm compose --stage <stage> --destroy`: everything a deploy made for the
|
|
518
|
+
* stage, deleted for good.
|
|
519
|
+
*
|
|
520
|
+
* The one thing in gkm that deletes what a deploy created — a deploy itself
|
|
521
|
+
* never does. So it is careful in three ways:
|
|
522
|
+
*
|
|
523
|
+
* - **Only what is provably gkm's.** Each AWS resource is checked against
|
|
524
|
+
* what gkm marks its own with before it is deleted (see
|
|
525
|
+
* `providers/s3/destroy.ts`); a DNS record only while it still holds the
|
|
526
|
+
* value gkm wrote. What fails is listed, and left where it is.
|
|
527
|
+
* - **Only with a person typing the stage.** The whole plan is printed
|
|
528
|
+
* first, then the compose project's name — `<project>-<stage>` — has to be
|
|
529
|
+
* typed back. Nothing skips that: there is no flag that answers it, and
|
|
530
|
+
* with no terminal to ask at it refuses before reading anything.
|
|
531
|
+
* - **Resumable.** Each resource's record is forgotten as soon as it is gone,
|
|
532
|
+
* so a run that stops part way — a distribution still deploying — carries
|
|
533
|
+
* on from there when it is run again.
|
|
534
|
+
*
|
|
535
|
+
* What other stages or projects share is never touched: the project bucket
|
|
536
|
+
* that holds every stage's state, the shared Traefik edge, the server's own
|
|
537
|
+
* setup (`gkm compose:server`). The stage's secrets are kept unless
|
|
538
|
+
* `--secrets` is passed.
|
|
539
|
+
*/
|
|
540
|
+
/** A destroy with no terminal to type the stage's name at. */
|
|
541
|
+
var ComposeDestroyNeedsTerminal = class extends GkmError {
|
|
542
|
+
stage;
|
|
543
|
+
project;
|
|
544
|
+
constructor(stage, project) {
|
|
545
|
+
super(`Destroying '${stage}' deletes everything its deploys made, and asks you to type ${project} first — there is no terminal here to ask at, and no flag answers it. Run it yourself, from a terminal. \`--dry-run\` prints what it would delete, anywhere.`);
|
|
546
|
+
this.stage = stage;
|
|
547
|
+
this.project = project;
|
|
548
|
+
this.name = "ComposeDestroyNeedsTerminal";
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
/** What was typed was not the project's name. */
|
|
552
|
+
var ComposeDestroyNotConfirmed = class extends GkmError {
|
|
553
|
+
stage;
|
|
554
|
+
project;
|
|
555
|
+
constructor(stage, project) {
|
|
556
|
+
super(`Nothing was deleted: destroying '${stage}' needs ${project} typed exactly.`);
|
|
557
|
+
this.stage = stage;
|
|
558
|
+
this.project = project;
|
|
559
|
+
this.name = "ComposeDestroyNotConfirmed";
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
/** AWS resources to delete, and no credentials to delete them with. */
|
|
563
|
+
var ComposeDestroyNeedsAwsCredentials = class extends GkmError {
|
|
564
|
+
stage;
|
|
565
|
+
resources;
|
|
566
|
+
constructor(stage, resources) {
|
|
567
|
+
super(`'${stage}' has ${resources.length} AWS resource${resources.length === 1 ? "" : "s"} to delete (${resources.slice(0, 3).join(", ")}${resources.length > 3 ? ", …" : ""}), and no AWS credentials were found to delete them with. Supply the stage's account the way a deploy does — AWS_PROFILE, or AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY — and run it again. Nothing was deleted.`);
|
|
568
|
+
this.stage = stage;
|
|
569
|
+
this.resources = resources;
|
|
570
|
+
this.name = "ComposeDestroyNeedsAwsCredentials";
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
/** `--secrets`, and a store that cannot delete. */
|
|
574
|
+
var SecretsStoreCannotDelete = class extends GkmError {
|
|
575
|
+
stage;
|
|
576
|
+
store;
|
|
577
|
+
constructor(stage, store) {
|
|
578
|
+
super(`--secrets deletes '${stage}''s secrets, and its store (${store}) has no delete(stage). Give the custom store one, or run without --secrets and delete them where they are kept. Nothing was deleted.`);
|
|
579
|
+
this.stage = stage;
|
|
580
|
+
this.store = store;
|
|
581
|
+
this.name = "SecretsStoreCannotDelete";
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
/** What a record of each type is to destroy. */
|
|
585
|
+
const KEPT_TYPES = { server: "the server's setup is kept: gkm compose:server made it, for any stage" };
|
|
586
|
+
/** Records that name no resource of their own — a key in the secrets. */
|
|
587
|
+
const VALUE_TYPES = /* @__PURE__ */ new Set(["url", "email-from"]);
|
|
588
|
+
/**
|
|
589
|
+
* The stage's stack: its project on the server (or this machine), as
|
|
590
|
+
* `gkm compose --down` finds it.
|
|
591
|
+
*/
|
|
592
|
+
async function composeStackRef(workspace, stage) {
|
|
593
|
+
const local = stage === workspace.stages.local;
|
|
594
|
+
const server = local ? void 0 : composeServer({
|
|
595
|
+
stage,
|
|
596
|
+
local,
|
|
597
|
+
config: workspace.deploy?.compose?.server,
|
|
598
|
+
custom: (await (await secretsStoreFor(workspace, stage)).read(stage))?.custom
|
|
599
|
+
});
|
|
600
|
+
const override = stackOverrideFile(workspace.root, stage);
|
|
601
|
+
const dir = join(workspace.root, stackDir(stage));
|
|
602
|
+
return {
|
|
603
|
+
ref: {
|
|
604
|
+
project: composeProject(deployIdentity(workspace, stage)),
|
|
605
|
+
file: join(dir, "docker-compose.yml"),
|
|
606
|
+
...existsSync(override) ? { overrides: [override] } : {},
|
|
607
|
+
cwd: workspace.root,
|
|
608
|
+
...server ? { host: dockerHost(server) } : {}
|
|
609
|
+
},
|
|
610
|
+
dir,
|
|
611
|
+
...server ? { server } : {}
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
/** `gkm compose --stage <stage> --destroy`. */
|
|
615
|
+
async function composeDestroyCommand(options, deps = {}) {
|
|
616
|
+
const log = deps.log ?? ((line) => console.log(line));
|
|
617
|
+
const env = deps.env ?? process.env;
|
|
618
|
+
const cwd = resolve(options.cwd ?? process.cwd());
|
|
619
|
+
const { workspace } = await loadWorkspaceConfig(cwd);
|
|
620
|
+
const { stage } = options;
|
|
621
|
+
const local = stage === workspace.stages.local;
|
|
622
|
+
if (!local) assertDeployedStage(workspace.stages, stage);
|
|
623
|
+
const identity = deployIdentity(workspace, stage);
|
|
624
|
+
const project = composeProject(identity);
|
|
625
|
+
const interactive = deps.interactive ?? canPrompt;
|
|
626
|
+
if (!options.dryRun && !interactive()) throw new ComposeDestroyNeedsTerminal(stage, project);
|
|
627
|
+
const state = deps.state ?? await createStateStore({
|
|
628
|
+
config: local ? void 0 : workspace.state,
|
|
629
|
+
workspaceRoot: workspace.root,
|
|
630
|
+
workspaceName: workspace.name,
|
|
631
|
+
namespace: workspace.deploy?.namespace
|
|
632
|
+
});
|
|
633
|
+
const lock = options.dryRun ? void 0 : await state.lock(stage, { operation: "destroy" });
|
|
634
|
+
try {
|
|
635
|
+
const steps = await plan(workspace, stage, options, deps, state, env);
|
|
636
|
+
const { ref } = await composeStackRef(workspace, stage);
|
|
637
|
+
log(`\n🧨 ${options.dryRun ? "Would delete" : "This deletes"} stage '${stage}' of ${workspace.name} for good:\n`);
|
|
638
|
+
const doing = steps.filter((s) => !s.leftAlone);
|
|
639
|
+
const kept = steps.filter((s) => s.leftAlone);
|
|
640
|
+
for (const step of doing) log(` - ${step.label}`);
|
|
641
|
+
if (kept.length > 0) {
|
|
642
|
+
log("\n Left where it is:");
|
|
643
|
+
for (const step of kept) log(` · ${step.label} — ${step.leftAlone}`);
|
|
644
|
+
}
|
|
645
|
+
if (!options.secrets) log("\n The stage's secrets are kept: a deploy of it again reuses them. --secrets deletes them too.");
|
|
646
|
+
if (options.dryRun) {
|
|
647
|
+
log("\n--dry-run: nothing was deleted.");
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
if ((await (deps.ask ?? ((question) => prompt(question, { instead: "Run it yourself, from a terminal." })))(`\n Type ${project} to destroy it: `)).trim() !== project) throw new ComposeDestroyNotConfirmed(stage, project);
|
|
651
|
+
log("");
|
|
652
|
+
for (const step of doing) {
|
|
653
|
+
await step.run?.();
|
|
654
|
+
for (const key of step.keys ?? []) await state.deleteResource(stage, key);
|
|
655
|
+
log(` ✓ ${step.label}`);
|
|
656
|
+
}
|
|
657
|
+
log(`\n💥 '${stage}' destroyed. ${ref.project} is gone.`);
|
|
658
|
+
} finally {
|
|
659
|
+
await lock?.release();
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
/** Every step, in the order it is carried out. */
|
|
663
|
+
async function plan(workspace, stage, options, deps, state, env) {
|
|
664
|
+
const steps = [];
|
|
665
|
+
const resources = (await state.read(stage))?.resources ?? {};
|
|
666
|
+
const records = Object.values(resources);
|
|
667
|
+
const { ref, dir, server } = await composeStackRef(workspace, stage);
|
|
668
|
+
const docker = deps.docker ?? dockerCompose;
|
|
669
|
+
steps.push({
|
|
670
|
+
label: `${server ? `on ${sshTarget(server)}: ` : ""}stack ${ref.project} — its containers, its volumes and their data, its routes on ${EDGE_PROJECT}`,
|
|
671
|
+
run: async () => {
|
|
672
|
+
const edgeFile = join(dir, `${EDGE_PROJECT}.yml`);
|
|
673
|
+
if (server || existsSync(edgeFile)) await removeEdgeRoutes(docker, edgeRef(edgeFile, { host: ref.host }), ref.project);
|
|
674
|
+
await docker.down(ref, { volumes: true });
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
const aws = records.filter((r) => AWS_RESOURCE_TYPES.includes(r.type));
|
|
678
|
+
let cdnDns = [];
|
|
679
|
+
if (aws.length > 0) {
|
|
680
|
+
const credential = await (deps.awsCredentials ?? (() => awsProvisioningCredentials({
|
|
681
|
+
stage,
|
|
682
|
+
env,
|
|
683
|
+
...deps.home ? { home: deps.home } : {}
|
|
684
|
+
})))();
|
|
685
|
+
if (!credential) throw new ComposeDestroyNeedsAwsCredentials(stage, aws.map((r) => r.key));
|
|
686
|
+
const identity = deployIdentity(workspace, stage);
|
|
687
|
+
const planned = await planAwsDestroy({
|
|
688
|
+
resources,
|
|
689
|
+
identityKey: identity.key,
|
|
690
|
+
scope: identity.scope,
|
|
691
|
+
stage,
|
|
692
|
+
credential,
|
|
693
|
+
...deps.aws ?? {}
|
|
694
|
+
});
|
|
695
|
+
for (const step of planned.steps) steps.push(awsStep(step));
|
|
696
|
+
cdnDns = providerDnsRecords(workspace, planned.dns);
|
|
697
|
+
}
|
|
698
|
+
const recorded = dnsResources(resources).map((r) => ({
|
|
699
|
+
...r,
|
|
700
|
+
fqdn: r.fqdn || dnsRecordFqdn(r.domain, r.name)
|
|
701
|
+
}));
|
|
702
|
+
const seen = new Set(recorded.map((r) => `${r.fqdn} ${r.type}`));
|
|
703
|
+
const dnsRecords = [...recorded, ...cdnDns.filter((r) => !seen.has(`${r.fqdn} ${r.type}`))];
|
|
704
|
+
if (dnsRecords.length > 0) {
|
|
705
|
+
const dns = workspace.dns ? normalizeDnsConfig(workspace.dns) : {};
|
|
706
|
+
const domains = [...new Set(dnsRecords.map((r) => r.domain))].filter((domain) => dns[domain]).map((domain) => ({
|
|
707
|
+
domain,
|
|
708
|
+
config: dns[domain]
|
|
709
|
+
}));
|
|
710
|
+
const tokens = await dnsCredentials(stage, domains, deps.credentials ?? storedCredentials({ env }));
|
|
711
|
+
const log = deps.log ?? ((line) => console.log(line));
|
|
712
|
+
steps.push({
|
|
713
|
+
label: `DNS: ${dnsRecords.map((r) => `${r.type} ${r.fqdn}`).join(", ")} — each only while it holds the value gkm wrote`,
|
|
714
|
+
keys: recorded.map((r) => `dns-record:${r.fqdn.toLowerCase()}:${r.type.toUpperCase()}`),
|
|
715
|
+
run: async () => {
|
|
716
|
+
await pruneStackDns(dnsRecords, {
|
|
717
|
+
stage,
|
|
718
|
+
dns: workspace.dns,
|
|
719
|
+
log,
|
|
720
|
+
credentials: {
|
|
721
|
+
...tokens.godaddy ? { credential: tokens.godaddy } : {},
|
|
722
|
+
log
|
|
723
|
+
},
|
|
724
|
+
...tokens.hostinger ? { hostinger: tokens.hostinger } : {},
|
|
725
|
+
...deps.dnsProviderFor ? { providerFor: deps.dnsProviderFor } : {}
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
const handled = /* @__PURE__ */ new Set([...AWS_RESOURCE_TYPES, "dns-record"]);
|
|
731
|
+
const values = records.filter((r) => VALUE_TYPES.has(r.type));
|
|
732
|
+
for (const record of records) {
|
|
733
|
+
if (handled.has(record.type) || VALUE_TYPES.has(record.type)) continue;
|
|
734
|
+
steps.push({
|
|
735
|
+
label: `${record.type} ${record.id ?? record.key}`,
|
|
736
|
+
leftAlone: KEPT_TYPES[record.type] ?? `gkm does not delete a ${record.type} yet: delete it by hand`
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
if (options.secrets) {
|
|
740
|
+
const store = await secretsStoreFor(workspace, stage, { ...deps.home ? { home: deps.home } : {} });
|
|
741
|
+
if (!store.delete) throw new SecretsStoreCannotDelete(stage, store.name);
|
|
742
|
+
steps.push({
|
|
743
|
+
label: `the stage's secrets, in its ${store.name} store`,
|
|
744
|
+
keys: values.map((r) => r.key),
|
|
745
|
+
run: () => store.delete(stage)
|
|
746
|
+
});
|
|
747
|
+
} else if (values.length > 0) steps.push({
|
|
748
|
+
label: `${values.length} record${values.length === 1 ? "" : "s"} of keys written into the secrets`,
|
|
749
|
+
keys: values.map((r) => r.key)
|
|
750
|
+
});
|
|
751
|
+
return steps;
|
|
752
|
+
}
|
|
753
|
+
function awsStep(step) {
|
|
754
|
+
if (step.leftAlone) return {
|
|
755
|
+
label: step.label,
|
|
756
|
+
leftAlone: step.leftAlone
|
|
757
|
+
};
|
|
758
|
+
return {
|
|
759
|
+
label: step.gone ? `${step.label} (already gone)` : step.withUser ? `${step.label} — deleted with its user` : step.label,
|
|
760
|
+
keys: [step.key],
|
|
761
|
+
...step.remove ? { run: step.remove } : {}
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
/** The CDN's records, as the DNS prune takes them. */
|
|
765
|
+
function providerDnsRecords(workspace, records) {
|
|
766
|
+
const dns = workspace.dns ? normalizeDnsConfig(workspace.dns) : {};
|
|
767
|
+
const out = [];
|
|
768
|
+
for (const record of records) {
|
|
769
|
+
const host = record.host.toLowerCase().replace(/\.$/, "");
|
|
770
|
+
const domain = findRootDomain(host, dns);
|
|
771
|
+
if (!domain) continue;
|
|
772
|
+
const config = dns[domain];
|
|
773
|
+
out.push({
|
|
774
|
+
fqdn: host,
|
|
775
|
+
domain,
|
|
776
|
+
name: extractSubdomain(host, domain),
|
|
777
|
+
type: record.type,
|
|
778
|
+
value: record.value.replace(/\.$/, ""),
|
|
779
|
+
ttl: recordTtl(config),
|
|
780
|
+
...typeof config.provider === "string" ? { provider: config.provider } : {}
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
return out;
|
|
784
|
+
}
|
|
785
|
+
//#endregion
|
|
786
|
+
export { composeDestroyCommand, composeStackRef };
|
|
787
|
+
|
|
788
|
+
//# sourceMappingURL=destroy-D4m5aO9k.mjs.map
|