@geekmidas/cli 10.0.0-alpha.11 → 10.0.0-alpha.110
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 +315 -414
- 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-BwbYTMtB.cjs +1090 -0
- package/dist/EndpointGenerator-BwbYTMtB.cjs.map +1 -0
- package/dist/EndpointGenerator-CvLX8bpx.mjs +1031 -0
- package/dist/EndpointGenerator-CvLX8bpx.mjs.map +1 -0
- package/dist/GoDaddyProvider-CjeOduia.mjs +388 -0
- package/dist/GoDaddyProvider-CjeOduia.mjs.map +1 -0
- package/dist/GoDaddyProvider-qNUzTXI7.cjs +388 -0
- package/dist/GoDaddyProvider-qNUzTXI7.cjs.map +1 -0
- package/dist/{HostingerProvider-BcyFRbqV.mjs → HostingerProvider-BNpS9aRJ.mjs} +29 -25
- package/dist/HostingerProvider-BNpS9aRJ.mjs.map +1 -0
- package/dist/{HostingerProvider-BOvsgATO.cjs → HostingerProvider-DR1iws1P.cjs} +29 -25
- package/dist/HostingerProvider-DR1iws1P.cjs.map +1 -0
- package/dist/LegacyStateStore-MxiSu7KJ.cjs +124 -0
- package/dist/LegacyStateStore-MxiSu7KJ.cjs.map +1 -0
- package/dist/LegacyStateStore-pgscYsiG.mjs +124 -0
- package/dist/LegacyStateStore-pgscYsiG.mjs.map +1 -0
- package/dist/LocalStateStore-BcvyKbAw.mjs +167 -0
- package/dist/LocalStateStore-BcvyKbAw.mjs.map +1 -0
- package/dist/LocalStateStore-Bm8Vmwjb.cjs +178 -0
- package/dist/LocalStateStore-Bm8Vmwjb.cjs.map +1 -0
- package/dist/OpenApiTsGenerator-BD6ZOQ51.cjs +541 -0
- package/dist/OpenApiTsGenerator-BD6ZOQ51.cjs.map +1 -0
- package/dist/OpenApiTsGenerator-DXXFXSbO.mjs +536 -0
- package/dist/OpenApiTsGenerator-DXXFXSbO.mjs.map +1 -0
- package/dist/{Route53Provider-CH9XH7bz.cjs → Route53Provider-Bllus2NR.cjs} +21 -22
- package/dist/Route53Provider-Bllus2NR.cjs.map +1 -0
- package/dist/{Route53Provider-C0xmer8U.mjs → Route53Provider-QXxjkZO1.mjs} +13 -13
- package/dist/Route53Provider-QXxjkZO1.mjs.map +1 -0
- package/dist/S3StateStore-DXHSBVsV.cjs +222 -0
- package/dist/S3StateStore-DXHSBVsV.cjs.map +1 -0
- package/dist/S3StateStore-H2XsAzpJ.mjs +223 -0
- package/dist/S3StateStore-H2XsAzpJ.mjs.map +1 -0
- package/dist/SSMStateStore-BLPSNl-U.cjs +204 -0
- package/dist/SSMStateStore-BLPSNl-U.cjs.map +1 -0
- package/dist/SSMStateStore-CENciQEM.mjs +205 -0
- package/dist/SSMStateStore-CENciQEM.mjs.map +1 -0
- package/dist/SubscriberGenerator-CeH7wbYt.cjs +571 -0
- package/dist/SubscriberGenerator-CeH7wbYt.cjs.map +1 -0
- package/dist/SubscriberGenerator-DHnIYwUU.mjs +518 -0
- package/dist/SubscriberGenerator-DHnIYwUU.mjs.map +1 -0
- package/dist/add-Cdg1kEqN.cjs +719 -0
- package/dist/add-Cdg1kEqN.cjs.map +1 -0
- package/dist/add-snhdVmR-.mjs +717 -0
- package/dist/add-snhdVmR-.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/aws-8QQ8n-t6.mjs +89 -0
- package/dist/aws-8QQ8n-t6.mjs.map +1 -0
- package/dist/aws-DY9NqQIT.cjs +100 -0
- package/dist/aws-DY9NqQIT.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-DXXg6FIL.mjs → backup-provisioner-C8DnCmxK.mjs} +11 -8
- package/dist/backup-provisioner-C8DnCmxK.mjs.map +1 -0
- package/dist/{backup-provisioner-cE2PuCTb.cjs → backup-provisioner-oDEsPj02.cjs} +22 -20
- 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-CaTGtiaO.cjs → bundler-B4GDxImV.cjs} +38 -35
- package/dist/bundler-B4GDxImV.cjs.map +1 -0
- package/dist/{bundler-S3ek7ea-.mjs → bundler-Wd9H4QLJ.mjs} +36 -32
- package/dist/bundler-Wd9H4QLJ.mjs.map +1 -0
- package/dist/cli-BZYz55tO.cjs +71 -0
- package/dist/cli-BZYz55tO.cjs.map +1 -0
- package/dist/cli-BzrDSNSg.mjs +71 -0
- package/dist/cli-BzrDSNSg.mjs.map +1 -0
- package/dist/compose-DN9zySvQ.cjs +3330 -0
- package/dist/compose-DN9zySvQ.cjs.map +1 -0
- package/dist/compose-Gsd1Nq7R.mjs +3187 -0
- package/dist/compose-Gsd1Nq7R.mjs.map +1 -0
- package/dist/config-D48erO2j.d.mts +269 -0
- package/dist/config-D48erO2j.d.mts.map +1 -0
- package/dist/config-DHDtsQrB.d.cts +269 -0
- package/dist/config-DHDtsQrB.d.cts.map +1 -0
- package/dist/config.cjs +421 -11
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +4 -120
- package/dist/config.d.mts +4 -120
- package/dist/config.mjs +405 -4
- package/dist/config.mjs.map +1 -0
- package/dist/credentialSchemas-Cf5Pf8VE.mjs +237 -0
- package/dist/credentialSchemas-Cf5Pf8VE.mjs.map +1 -0
- package/dist/credentialSchemas-D_VUCDUh.cjs +272 -0
- package/dist/credentialSchemas-D_VUCDUh.cjs.map +1 -0
- package/dist/credentials-B5N5yKk6.mjs +267 -0
- package/dist/credentials-B5N5yKk6.mjs.map +1 -0
- package/dist/credentials-Zqr3QQYB.cjs +350 -0
- package/dist/credentials-Zqr3QQYB.cjs.map +1 -0
- package/dist/databases-BeGP5eDh.mjs +495 -0
- package/dist/databases-BeGP5eDh.mjs.map +1 -0
- package/dist/databases-DGALFDG3.cjs +598 -0
- package/dist/databases-DGALFDG3.cjs.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 +212 -0
- package/dist/deploy/public.cjs.map +1 -0
- package/dist/deploy/public.d.cts +653 -0
- package/dist/deploy/public.d.cts.map +1 -0
- package/dist/deploy/public.d.mts +653 -0
- package/dist/deploy/public.d.mts.map +1 -0
- package/dist/deploy/public.mjs +145 -0
- package/dist/deploy/public.mjs.map +1 -0
- package/dist/deploy/sniffer-envkit-patch.cjs +18 -10
- package/dist/deploy/sniffer-envkit-patch.cjs.map +1 -1
- package/dist/deploy/sniffer-envkit-patch.d.cts +0 -2
- package/dist/deploy/sniffer-envkit-patch.d.cts.map +1 -1
- package/dist/deploy/sniffer-envkit-patch.d.mts +0 -2
- package/dist/deploy/sniffer-envkit-patch.d.mts.map +1 -1
- package/dist/deploy/sniffer-envkit-patch.mjs +10 -2
- package/dist/deploy/sniffer-envkit-patch.mjs.map +1 -1
- 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 +13 -7
- package/dist/deploy/sniffer-hooks.cjs.map +1 -1
- package/dist/deploy/sniffer-hooks.d.cts +1 -2
- package/dist/deploy/sniffer-hooks.d.cts.map +1 -1
- package/dist/deploy/sniffer-hooks.d.mts +1 -2
- package/dist/deploy/sniffer-hooks.d.mts.map +1 -1
- package/dist/deploy/sniffer-hooks.mjs +10 -3
- package/dist/deploy/sniffer-hooks.mjs.map +1 -1
- package/dist/deploy/sniffer-loader.cjs +16 -7
- package/dist/deploy/sniffer-loader.cjs.map +1 -1
- package/dist/deploy/sniffer-loader.d.cts +1 -1
- package/dist/deploy/sniffer-loader.d.mts +1 -1
- package/dist/deploy/sniffer-loader.mjs +14 -3
- package/dist/deploy/sniffer-loader.mjs.map +1 -1
- package/dist/deploy/sniffer-routes-worker.cjs +11 -11
- package/dist/deploy/sniffer-routes-worker.cjs.map +1 -1
- package/dist/deploy/sniffer-routes-worker.d.cts +1 -1
- package/dist/deploy/sniffer-routes-worker.d.mts +1 -1
- package/dist/deploy/sniffer-routes-worker.mjs +4 -4
- package/dist/deploy/sniffer-routes-worker.mjs.map +1 -1
- package/dist/deploy/sniffer-worker.cjs +15 -6
- package/dist/deploy/sniffer-worker.cjs.map +1 -1
- package/dist/deploy/sniffer-worker.d.cts +1 -3
- package/dist/deploy/sniffer-worker.d.cts.map +1 -1
- package/dist/deploy/sniffer-worker.d.mts +1 -3
- package/dist/deploy/sniffer-worker.d.mts.map +1 -1
- package/dist/deploy/sniffer-worker.mjs +15 -4
- package/dist/deploy/sniffer-worker.mjs.map +1 -1
- package/dist/deploy-CFvq8daZ.cjs +2390 -0
- package/dist/deploy-CFvq8daZ.cjs.map +1 -0
- package/dist/deploy-H2S8_mTx.mjs +2317 -0
- package/dist/deploy-H2S8_mTx.mjs.map +1 -0
- package/dist/derive-B4vDpzgP.mjs +150 -0
- package/dist/derive-B4vDpzgP.mjs.map +1 -0
- package/dist/derive-DAbo49sm.cjs +161 -0
- package/dist/derive-DAbo49sm.cjs.map +1 -0
- package/dist/discover-Bsr7HjqJ.cjs +616 -0
- package/dist/discover-Bsr7HjqJ.cjs.map +1 -0
- package/dist/discover-Ca8U75dl.mjs +537 -0
- package/dist/discover-Ca8U75dl.mjs.map +1 -0
- package/dist/discover-CvTtV5ZD.d.cts +108 -0
- package/dist/discover-CvTtV5ZD.d.cts.map +1 -0
- package/dist/discover-W2kab9Lc.d.mts +108 -0
- package/dist/discover-W2kab9Lc.d.mts.map +1 -0
- package/dist/dns-BdETzP10.cjs +1057 -0
- package/dist/dns-BdETzP10.cjs.map +1 -0
- package/dist/dns-pFMShDqW.mjs +926 -0
- package/dist/dns-pFMShDqW.mjs.map +1 -0
- package/dist/dokploy-HioAjP7K.cjs +38 -0
- package/dist/dokploy-HioAjP7K.cjs.map +1 -0
- package/dist/dokploy-oDJbnvCb.mjs +38 -0
- package/dist/dokploy-oDJbnvCb.mjs.map +1 -0
- package/dist/drivers-D11JHxrD.mjs +177 -0
- package/dist/drivers-D11JHxrD.mjs.map +1 -0
- package/dist/drivers-GKaA6ITM.cjs +200 -0
- package/dist/drivers-GKaA6ITM.cjs.map +1 -0
- package/dist/{emit-CIlvnDvV.mjs → emit-C1e8qD08.mjs} +13 -26
- package/dist/emit-C1e8qD08.mjs.map +1 -0
- package/dist/{emit-CUD1BWls.cjs → emit-Dmc1nvdS.cjs} +31 -57
- package/dist/emit-Dmc1nvdS.cjs.map +1 -0
- package/dist/encryption-D5pDJyp2.mjs +89 -0
- package/dist/encryption-D5pDJyp2.mjs.map +1 -0
- package/dist/encryption-DVCxD-gV.cjs +90 -0
- package/dist/encryption-DVCxD-gV.cjs.map +1 -0
- package/dist/engine-BaJGPzte.cjs +3196 -0
- package/dist/engine-BaJGPzte.cjs.map +1 -0
- package/dist/engine-CfAKgr2_.mjs +3083 -0
- package/dist/engine-CfAKgr2_.mjs.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-D902Vwr9.cjs +829 -0
- package/dist/github-D902Vwr9.cjs.map +1 -0
- package/dist/github-E-ZxqFPq.mjs +829 -0
- package/dist/github-E-ZxqFPq.mjs.map +1 -0
- package/dist/identity-CBXr4wNi.mjs +129 -0
- package/dist/identity-CBXr4wNi.mjs.map +1 -0
- package/dist/identity-CbLfgQNT.cjs +182 -0
- package/dist/identity-CbLfgQNT.cjs.map +1 -0
- package/dist/{index-Ayxg_DQY.d.mts → index-8OfpOtSI.d.cts} +39 -24
- package/dist/index-8OfpOtSI.d.cts.map +1 -0
- package/dist/{index-CR5urhWX.d.cts → index-Dpji6Bxq.d.mts} +39 -24
- package/dist/index-Dpji6Bxq.d.mts.map +1 -0
- package/dist/index.cjs +13764 -12651
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +13654 -12553
- package/dist/index.mjs.map +1 -1
- package/dist/local-BwC2v2Y8.mjs +224 -0
- package/dist/local-BwC2v2Y8.mjs.map +1 -0
- package/dist/local-DNhnkugT.cjs +241 -0
- package/dist/local-DNhnkugT.cjs.map +1 -0
- package/dist/migrate-BZ0GnSZQ.mjs +181 -0
- package/dist/migrate-BZ0GnSZQ.mjs.map +1 -0
- package/dist/migrate-CTqhWtev.cjs +271 -0
- package/dist/migrate-CTqhWtev.cjs.map +1 -0
- package/dist/migrate-DCXwHcWX.mjs +266 -0
- package/dist/migrate-DCXwHcWX.mjs.map +1 -0
- package/dist/migrate-Df81ew0k.cjs +181 -0
- package/dist/migrate-Df81ew0k.cjs.map +1 -0
- package/dist/openapi.cjs +214 -10
- package/dist/openapi.cjs.map +1 -0
- package/dist/openapi.d.cts +38 -17
- package/dist/openapi.d.cts.map +1 -1
- package/dist/openapi.d.mts +38 -17
- package/dist/openapi.d.mts.map +1 -1
- package/dist/openapi.mjs +208 -5
- package/dist/openapi.mjs.map +1 -0
- package/dist/projectBucket-BBbQ1lHF.cjs +263 -0
- package/dist/projectBucket-BBbQ1lHF.cjs.map +1 -0
- package/dist/projectBucket-C_DN4WzF.mjs +222 -0
- package/dist/projectBucket-C_DN4WzF.mjs.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/ready-BMFjxBYA.cjs +404 -0
- package/dist/ready-BMFjxBYA.cjs.map +1 -0
- package/dist/ready-CIt5SOtg.mjs +375 -0
- package/dist/ready-CIt5SOtg.mjs.map +1 -0
- package/dist/reconcile/public.cjs +3 -5
- package/dist/reconcile/public.d.cts +11 -87
- package/dist/reconcile/public.d.cts.map +1 -1
- package/dist/reconcile/public.d.mts +11 -87
- package/dist/reconcile/public.d.mts.map +1 -1
- package/dist/reconcile/public.mjs +3 -4
- package/dist/{reconcile-C13ERt1U.mjs → reconcile--I7V4Klj.mjs} +4 -7
- package/dist/reconcile--I7V4Klj.mjs.map +1 -0
- package/dist/{reconcile-CYMhFSYy.cjs → reconcile-CuCQBa5-.cjs} +5 -8
- package/dist/reconcile-CuCQBa5-.cjs.map +1 -0
- package/dist/resolve-BMpPd8x3.mjs +263 -0
- package/dist/resolve-BMpPd8x3.mjs.map +1 -0
- package/dist/resolve-D043YmW9.cjs +316 -0
- package/dist/resolve-D043YmW9.cjs.map +1 -0
- package/dist/rollback-CBiYsQ3T.cjs +165 -0
- package/dist/rollback-CBiYsQ3T.cjs.map +1 -0
- package/dist/rollback-CDs_XNb0.mjs +136 -0
- package/dist/rollback-CDs_XNb0.mjs.map +1 -0
- package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
- package/dist/{chunk-CUT6urMc.cjs → rolldown-runtime-C0BPl7ul.cjs} +23 -10
- package/dist/run-BJLIerMM.mjs +133 -0
- package/dist/run-BJLIerMM.mjs.map +1 -0
- package/dist/run-fVZ-rLnc.cjs +174 -0
- package/dist/run-fVZ-rLnc.cjs.map +1 -0
- package/dist/runtime-ACdfK59n.d.cts +82 -0
- package/dist/runtime-ACdfK59n.d.cts.map +1 -0
- package/dist/runtime-YyQuekxi.d.mts +82 -0
- package/dist/runtime-YyQuekxi.d.mts.map +1 -0
- package/dist/s3-CrPoA89T.cjs +215 -0
- package/dist/s3-CrPoA89T.cjs.map +1 -0
- package/dist/s3-DQXZdmCM.mjs +215 -0
- package/dist/s3-DQXZdmCM.mjs.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 +54 -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 +55 -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/sandbox-C4g1eG31.d.mts +104 -0
- package/dist/sandbox-C4g1eG31.d.mts.map +1 -0
- package/dist/sandbox-CHv3OYXg.cjs +165 -0
- package/dist/sandbox-CHv3OYXg.cjs.map +1 -0
- package/dist/sandbox-CbVB7uOD.mjs +118 -0
- package/dist/sandbox-CbVB7uOD.mjs.map +1 -0
- package/dist/sandbox-CdKgQ3XU.d.cts +104 -0
- package/dist/sandbox-CdKgQ3XU.d.cts.map +1 -0
- package/dist/{workspace-C-a3G_U0.cjs → schemas-BCwKKA42.mjs} +958 -1868
- package/dist/schemas-BCwKKA42.mjs.map +1 -0
- package/dist/{workspace-DaEX7FEg.mjs → schemas-BQ_v0lEX.cjs} +1048 -1678
- package/dist/schemas-BQ_v0lEX.cjs.map +1 -0
- package/dist/secretsManager-CQORubp9.mjs +97 -0
- package/dist/secretsManager-CQORubp9.mjs.map +1 -0
- package/dist/secretsManager-RAGcEDX1.cjs +108 -0
- package/dist/secretsManager-RAGcEDX1.cjs.map +1 -0
- package/dist/seeds-BjcO4DDa.mjs +8194 -0
- package/dist/seeds-BjcO4DDa.mjs.map +1 -0
- package/dist/seeds-DNqRA1aQ.cjs +9173 -0
- package/dist/seeds-DNqRA1aQ.cjs.map +1 -0
- package/dist/sniffer-DipSS8r8.cjs +1998 -0
- package/dist/sniffer-DipSS8r8.cjs.map +1 -0
- package/dist/sniffer-b0XPmSyT.mjs +1825 -0
- package/dist/sniffer-b0XPmSyT.mjs.map +1 -0
- package/dist/sst-B-Uz4cvm.cjs +464 -0
- package/dist/sst-B-Uz4cvm.cjs.map +1 -0
- package/dist/sst-C1pxbFEd.mjs +441 -0
- package/dist/sst-C1pxbFEd.mjs.map +1 -0
- package/dist/stage-C_y2UovO.cjs +266 -0
- package/dist/stage-C_y2UovO.cjs.map +1 -0
- package/dist/stage-DrDmZusd.mjs +266 -0
- package/dist/stage-DrDmZusd.mjs.map +1 -0
- package/dist/stages-DJrOYLZ-.mjs +176 -0
- package/dist/stages-DJrOYLZ-.mjs.map +1 -0
- package/dist/stages-_3RVNG83.cjs +176 -0
- package/dist/stages-_3RVNG83.cjs.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-CvRLxz6g.mjs +85 -0
- package/dist/terminal-CvRLxz6g.mjs.map +1 -0
- package/dist/terminal-D_NRPW4W.cjs +85 -0
- package/dist/terminal-D_NRPW4W.cjs.map +1 -0
- package/dist/types-B6UXlEkf.d.cts +7650 -0
- package/dist/types-B6UXlEkf.d.cts.map +1 -0
- package/dist/types-HqVPddRK.d.mts +7649 -0
- package/dist/types-HqVPddRK.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 +8 -4
- package/dist/workspace/index.d.cts +3 -3
- package/dist/workspace/index.d.mts +3 -3
- package/dist/workspace/index.mjs +2 -3
- package/dist/workspace-BwqQnool.cjs +2806 -0
- package/dist/workspace-BwqQnool.cjs.map +1 -0
- package/dist/workspace-D1QbNd55.mjs +2394 -0
- package/dist/workspace-D1QbNd55.mjs.map +1 -0
- package/package.json +54 -22
- package/dist/CachedStateProvider-BEBl2wQT.cjs +0 -60
- package/dist/CachedStateProvider-BEBl2wQT.cjs.map +0 -1
- package/dist/CachedStateProvider-C-8wtlto.mjs +0 -3
- package/dist/CachedStateProvider-Co4n5Wvs.mjs +0 -54
- package/dist/CachedStateProvider-Co4n5Wvs.mjs.map +0 -1
- package/dist/CachedStateProvider-DqhGpzsm.cjs +0 -3
- package/dist/HostingerProvider-BOvsgATO.cjs.map +0 -1
- package/dist/HostingerProvider-BcyFRbqV.mjs.map +0 -1
- package/dist/LocalStateProvider-Bq-0C0sg.mjs +0 -42
- package/dist/LocalStateProvider-Bq-0C0sg.mjs.map +0 -1
- package/dist/LocalStateProvider-yjXZXZDM.cjs +0 -43
- package/dist/LocalStateProvider-yjXZXZDM.cjs.map +0 -1
- package/dist/Route53Provider-C0xmer8U.mjs.map +0 -1
- package/dist/Route53Provider-CH9XH7bz.cjs.map +0 -1
- package/dist/SSMStateProvider-CXtNgPfy.cjs +0 -66
- package/dist/SSMStateProvider-CXtNgPfy.cjs.map +0 -1
- package/dist/SSMStateProvider-DOZifZfE.mjs +0 -66
- package/dist/SSMStateProvider-DOZifZfE.mjs.map +0 -1
- package/dist/backup-provisioner-DXXg6FIL.mjs.map +0 -1
- package/dist/backup-provisioner-cE2PuCTb.cjs.map +0 -1
- package/dist/bundler-CaTGtiaO.cjs.map +0 -1
- package/dist/bundler-S3ek7ea-.mjs.map +0 -1
- package/dist/chunk-Duj1WY3L.mjs +0 -7
- package/dist/config-B0L2tvvC.mjs +0 -402
- package/dist/config-B0L2tvvC.mjs.map +0 -1
- package/dist/config-HhDpJmLO.cjs +0 -462
- package/dist/config-HhDpJmLO.cjs.map +0 -1
- package/dist/config.d.cts.map +0 -1
- package/dist/config.d.mts.map +0 -1
- package/dist/credentials-B2Pyh3bJ.cjs +0 -2681
- package/dist/credentials-B2Pyh3bJ.cjs.map +0 -1
- package/dist/credentials-B5zRHdAl.mjs +0 -141
- package/dist/credentials-B5zRHdAl.mjs.map +0 -1
- package/dist/credentials-BapzjyV5.cjs +0 -195
- package/dist/credentials-BapzjyV5.cjs.map +0 -1
- package/dist/credentials-CZrys9C5.mjs +0 -2549
- package/dist/credentials-CZrys9C5.mjs.map +0 -1
- package/dist/discover-CAlFgYec.mjs +0 -229
- package/dist/discover-CAlFgYec.mjs.map +0 -1
- package/dist/discover-DTmFeloL.cjs +0 -271
- package/dist/discover-DTmFeloL.cjs.map +0 -1
- package/dist/dokploy-api-5cK2InBm.cjs +0 -3
- package/dist/dokploy-api-D2Ny4Jrc.mjs +0 -3
- package/dist/dokploy-api-pdaBryoY.mjs +0 -706
- package/dist/dokploy-api-pdaBryoY.mjs.map +0 -1
- package/dist/dokploy-api-zqKe9lHH.cjs +0 -718
- package/dist/dokploy-api-zqKe9lHH.cjs.map +0 -1
- package/dist/emit-CIlvnDvV.mjs.map +0 -1
- package/dist/emit-CUD1BWls.cjs.map +0 -1
- package/dist/encryption-D2pL3tHH.cjs +0 -54
- package/dist/encryption-D2pL3tHH.cjs.map +0 -1
- package/dist/encryption-YDsXXi6w.mjs +0 -3
- package/dist/encryption-_4zwjOAR.mjs +0 -42
- package/dist/encryption-_4zwjOAR.mjs.map +0 -1
- package/dist/encryption-sQ2Oxx0d.cjs +0 -4
- package/dist/fullstack-secrets-D6MyHhQP.cjs +0 -111
- package/dist/fullstack-secrets-D6MyHhQP.cjs.map +0 -1
- package/dist/fullstack-secrets-METaRLS1.mjs +0 -87
- package/dist/fullstack-secrets-METaRLS1.mjs.map +0 -1
- package/dist/generator-CNzBw7g5.cjs +0 -289
- package/dist/generator-CNzBw7g5.cjs.map +0 -1
- package/dist/generator-VE2JrFlY.mjs +0 -253
- package/dist/generator-VE2JrFlY.mjs.map +0 -1
- package/dist/github-BrvaPkFf.cjs +0 -197
- package/dist/github-BrvaPkFf.cjs.map +0 -1
- package/dist/github-CrpsXSfV.mjs +0 -196
- package/dist/github-CrpsXSfV.mjs.map +0 -1
- package/dist/index-Ayxg_DQY.d.mts.map +0 -1
- package/dist/index-CR5urhWX.d.cts.map +0 -1
- package/dist/keystore-C9rint2E.cjs +0 -101
- package/dist/keystore-C9rint2E.cjs.map +0 -1
- package/dist/keystore-TxeYM7an.mjs +0 -83
- package/dist/keystore-TxeYM7an.mjs.map +0 -1
- package/dist/openapi-DaKlTKxz.cjs +0 -2075
- package/dist/openapi-DaKlTKxz.cjs.map +0 -1
- package/dist/openapi-react-query-BKH334Ug.cjs +0 -173
- package/dist/openapi-react-query-BKH334Ug.cjs.map +0 -1
- package/dist/openapi-react-query-DoR5CmzQ.mjs +0 -167
- package/dist/openapi-react-query-DoR5CmzQ.mjs.map +0 -1
- package/dist/openapi-react-query.cjs +0 -4
- package/dist/openapi-react-query.d.cts +0 -11
- package/dist/openapi-react-query.d.cts.map +0 -1
- package/dist/openapi-react-query.d.mts +0 -11
- package/dist/openapi-react-query.d.mts.map +0 -1
- package/dist/openapi-react-query.mjs +0 -4
- package/dist/openapi-y1d7Kalt.mjs +0 -2021
- package/dist/openapi-y1d7Kalt.mjs.map +0 -1
- package/dist/reconcile-C13ERt1U.mjs.map +0 -1
- package/dist/reconcile-CYMhFSYy.cjs.map +0 -1
- package/dist/setup-BWgMs4gg.mjs +0 -12
- package/dist/setup-DOv92pIu.cjs +0 -473
- package/dist/setup-DOv92pIu.cjs.map +0 -1
- package/dist/setup-DQo_h_yK.mjs +0 -443
- package/dist/setup-DQo_h_yK.mjs.map +0 -1
- package/dist/setup-lCx_DcUo.cjs +0 -12
- package/dist/storage-B020InPW.mjs +0 -222
- package/dist/storage-B020InPW.mjs.map +0 -1
- package/dist/storage-CSNplaJn.cjs +0 -282
- package/dist/storage-CSNplaJn.cjs.map +0 -1
- package/dist/storage-DGBzMLZa.mjs +0 -4
- package/dist/storage-DlVol_oj.cjs +0 -8
- package/dist/sync-0ILCb-1S.cjs +0 -93
- package/dist/sync-0ILCb-1S.cjs.map +0 -1
- package/dist/sync-CzHXiR9c.mjs +0 -76
- package/dist/sync-CzHXiR9c.mjs.map +0 -1
- package/dist/sync-DYENfOt4.cjs +0 -4
- package/dist/sync-HAau6h_R.mjs +0 -3
- package/dist/types-CL7jPFM2.d.mts +0 -2220
- package/dist/types-CL7jPFM2.d.mts.map +0 -1
- package/dist/types-Y3fKQSAK.d.cts +0 -2220
- package/dist/types-Y3fKQSAK.d.cts.map +0 -1
- package/dist/workspace-C-a3G_U0.cjs.map +0 -1
- package/dist/workspace-DQxxs7Jk.cjs +0 -10
- package/dist/workspace-DaEX7FEg.mjs.map +0 -1
- package/dist/workspace-DbI580qS.mjs +0 -9
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { K as DeployRuntime, et as TargetOptionsIssue, jt as GkmError } from "./types-HqVPddRK.mjs";
|
|
2
|
+
//#region src/target/builtins.d.ts
|
|
3
|
+
/** A target name that is neither built in nor in `deploy.targets`. */
|
|
4
|
+
declare class UnknownDeployTarget extends GkmError {
|
|
5
|
+
readonly target: string;
|
|
6
|
+
/** The names that would have resolved. */
|
|
7
|
+
readonly known: readonly string[];
|
|
8
|
+
constructor(target: string,
|
|
9
|
+
/** The names that would have resolved. */
|
|
10
|
+
known: readonly string[]);
|
|
11
|
+
}
|
|
12
|
+
/** A built-in target `gkm deploy` cannot deploy through yet. */
|
|
13
|
+
declare class DeployTargetNotYetSupported extends GkmError {
|
|
14
|
+
readonly target: string;
|
|
15
|
+
/** What to do instead, when there is something. */
|
|
16
|
+
readonly instead?: string | undefined;
|
|
17
|
+
constructor(target: string,
|
|
18
|
+
/** What to do instead, when there is something. */
|
|
19
|
+
instead?: string | undefined);
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/target/package.d.ts
|
|
23
|
+
/** A target package the project does not have installed. */
|
|
24
|
+
declare class TargetPackageNotFound extends GkmError {
|
|
25
|
+
readonly target: string;
|
|
26
|
+
readonly packageName: string;
|
|
27
|
+
readonly from: string;
|
|
28
|
+
constructor(target: string, packageName: string, from: string);
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/target/provider.d.ts
|
|
32
|
+
/** A `--provider` that no longer exists. */
|
|
33
|
+
declare class ProviderRemoved extends GkmError {
|
|
34
|
+
readonly provider: string;
|
|
35
|
+
/** What to use instead. */
|
|
36
|
+
readonly instead: string;
|
|
37
|
+
constructor(provider: string,
|
|
38
|
+
/** What to use instead. */
|
|
39
|
+
instead: string);
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/target/resolve.d.ts
|
|
43
|
+
/** A target package whose default export is not a target. */
|
|
44
|
+
declare class TargetPackageInvalid extends GkmError {
|
|
45
|
+
readonly target: string;
|
|
46
|
+
readonly packageName: string;
|
|
47
|
+
constructor(target: string, packageName: string);
|
|
48
|
+
}
|
|
49
|
+
/** A `deploy.targets` entry that is not a target, a package name or a pair. */
|
|
50
|
+
declare class TargetEntryInvalid extends GkmError {
|
|
51
|
+
readonly target: string;
|
|
52
|
+
constructor(target: string);
|
|
53
|
+
}
|
|
54
|
+
/** A target whose `runtime` is not the one its package declares. */
|
|
55
|
+
declare class TargetRuntimeMismatch extends GkmError {
|
|
56
|
+
readonly target: string;
|
|
57
|
+
readonly packageName: string;
|
|
58
|
+
readonly declared: DeployRuntime;
|
|
59
|
+
readonly actual: DeployRuntime;
|
|
60
|
+
constructor(target: string, packageName: string, declared: DeployRuntime, actual: DeployRuntime);
|
|
61
|
+
}
|
|
62
|
+
/** Options a target's schema rejected. */
|
|
63
|
+
declare class InvalidTargetOptions extends GkmError {
|
|
64
|
+
readonly target: string;
|
|
65
|
+
readonly issues: readonly TargetOptionsIssue[];
|
|
66
|
+
constructor(target: string, issues: readonly TargetOptionsIssue[]);
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/target/runtime.d.ts
|
|
70
|
+
/** A target package whose `package.json` does not say where it runs. */
|
|
71
|
+
declare class TargetRuntimeUndeclared extends GkmError {
|
|
72
|
+
readonly target: string;
|
|
73
|
+
readonly packageName: string;
|
|
74
|
+
/** What `gkm.runtime` held instead, when it held anything. */
|
|
75
|
+
readonly found?: unknown;
|
|
76
|
+
constructor(target: string, packageName: string,
|
|
77
|
+
/** What `gkm.runtime` held instead, when it held anything. */
|
|
78
|
+
found?: unknown);
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { TargetRuntimeMismatch as a, DeployTargetNotYetSupported as c, TargetPackageInvalid as i, UnknownDeployTarget as l, InvalidTargetOptions as n, ProviderRemoved as o, TargetEntryInvalid as r, TargetPackageNotFound as s, TargetRuntimeUndeclared as t };
|
|
82
|
+
//# sourceMappingURL=runtime-YyQuekxi.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-YyQuekxi.d.mts","names":[],"sources":["../src/target/builtins.ts","../src/target/package.ts","../src/target/provider.ts","../src/target/resolve.ts","../src/target/runtime.ts"],"mappings":";;;cAgEa,4BAA4B;WAE9B;;WAEA;EAHV,YACU,gBAEA;;EAAA;;;cAUE,oCAAoC;WAEtC;;WAEA;EAHV,YACU,gBAEA;;EAAA;;;;;cCrDE,8BAA8B;WAEhC;WACA;WACA;EAHV,YACU,gBACA,qBACA;;;;;cCZE,wBAAwB;WAE1B;;WAEA;EAHV,YACU,kBAEA;;EAAA;;;;;cCoCE,6BAA6B;WAE/B;WACA;EAFV,YACU,gBACA;;;cAUE,2BAA2B;WAClB;EAArB,YAAqB;;;cAST,8BAA8B;WAEhC;WACA;WACA,UAAU;WACV,QAAQ;EAJlB,YACU,gBACA,qBACA,UAAU,eACV,QAAQ;;;cAUN,6BAA6B;WAE/B;WACA,iBAAiB;EAF3B,YACU,gBACA,iBAAiB;;;;;cC1Ef,gCAAgC;WAElC;WACA;;WAEA;EAJV,YACU,gBACA,qBAEA;;EAAA"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
const require_errors = require("./errors-DMC4Umsb.cjs");
|
|
2
|
+
const require_workspace = require("./workspace-BwqQnool.cjs");
|
|
3
|
+
const require_projectBucket = require("./projectBucket-BBbQ1lHF.cjs");
|
|
4
|
+
const require_awsStore = require("./awsStore-u3ehhMoY.cjs");
|
|
5
|
+
let _aws_sdk_client_s3 = require("@aws-sdk/client-s3");
|
|
6
|
+
let _aws_sdk_client_sts = require("@aws-sdk/client-sts");
|
|
7
|
+
//#region src/secrets/s3.ts
|
|
8
|
+
/**
|
|
9
|
+
* A stage's secrets in S3: one object per stage,
|
|
10
|
+
* `<prefix>/<project>/<stage>/secrets.json`, in the project bucket beside the
|
|
11
|
+
* deploy state (`providers/projectBucket.ts`) — or in a bucket the config
|
|
12
|
+
* names, which must exist.
|
|
13
|
+
*
|
|
14
|
+
* Encrypted at rest with SSE-S3, asked for on every write although the
|
|
15
|
+
* project bucket defaults to it, so no KMS key is another place to keep. The
|
|
16
|
+
* bucket's versioning keeps every past document. Unlike an SSM parameter
|
|
17
|
+
* there is no size to outgrow.
|
|
18
|
+
*
|
|
19
|
+
* The project bucket is created by the first write, never by a read: a stage
|
|
20
|
+
* whose bucket or object does not exist yet has no secrets. Every write is
|
|
21
|
+
* conditional — `If-Match` on the ETag this store last read for the stage,
|
|
22
|
+
* `If-None-Match: *` when it read none — so two `secrets:set` runs at once
|
|
23
|
+
* cannot each overwrite the other's key: the second is refused with
|
|
24
|
+
* {@link StageSecretsChanged}.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Another run wrote the stage's secrets after this one read them. Nothing was
|
|
28
|
+
* written: the change is to be made again, on top of theirs.
|
|
29
|
+
*/
|
|
30
|
+
var StageSecretsChanged = class extends require_errors.GkmError {
|
|
31
|
+
stage;
|
|
32
|
+
location;
|
|
33
|
+
constructor(stage, location) {
|
|
34
|
+
super(`The secrets for stage "${stage}" at ${location} changed after this command read them — another secrets command or deploy wrote them first. Nothing was written; run the command again to make the change on top of theirs.`);
|
|
35
|
+
this.stage = stage;
|
|
36
|
+
this.location = location;
|
|
37
|
+
this.name = "StageSecretsChanged";
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
/** A conditional write that lost: the object is not what the write assumed. */
|
|
41
|
+
function lostRace(error) {
|
|
42
|
+
const { name, $metadata } = error;
|
|
43
|
+
return name === "PreconditionFailed" || name === "ConditionalRequestConflict" || $metadata?.httpStatusCode === 412 || $metadata?.httpStatusCode === 409;
|
|
44
|
+
}
|
|
45
|
+
function notFound(error) {
|
|
46
|
+
const { name, $metadata } = error;
|
|
47
|
+
return name === "NoSuchKey" || name === "NotFound" || $metadata?.httpStatusCode === 404;
|
|
48
|
+
}
|
|
49
|
+
var S3SecretsStore = class {
|
|
50
|
+
options;
|
|
51
|
+
name = "s3";
|
|
52
|
+
clients;
|
|
53
|
+
/** The bucket's name, once known. */
|
|
54
|
+
bucketName;
|
|
55
|
+
/** Whether the bucket is known to exist. */
|
|
56
|
+
exists = false;
|
|
57
|
+
/** The ETag each stage was last read at — null: read, and not there. */
|
|
58
|
+
etags = /* @__PURE__ */ new Map();
|
|
59
|
+
constructor(options) {
|
|
60
|
+
this.options = options;
|
|
61
|
+
if (options.bucket) {
|
|
62
|
+
this.bucketName = options.bucket;
|
|
63
|
+
this.exists = true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** The bucket's name; the project bucket's is known after the first call. */
|
|
67
|
+
get bucket() {
|
|
68
|
+
return this.bucketName ?? require_projectBucket.projectBucketName(this.options.identity.scope, "<account id>");
|
|
69
|
+
}
|
|
70
|
+
/** Where a stage's secrets are kept: `s3://<bucket>/<key>`. */
|
|
71
|
+
location(stage) {
|
|
72
|
+
return `s3://${this.bucket}/${this.key(stage)}`;
|
|
73
|
+
}
|
|
74
|
+
key(stage) {
|
|
75
|
+
return require_workspace.s3SecretsKey(this.options.prefix, this.options.project, stage);
|
|
76
|
+
}
|
|
77
|
+
async client() {
|
|
78
|
+
if (this.clients) return this.clients;
|
|
79
|
+
const base = await require_awsStore.awsClientConfig(this.options);
|
|
80
|
+
const endpoint = base.endpoint ?? process.env.AWS_ENDPOINT_URL_S3 ?? process.env.AWS_ENDPOINT_URL;
|
|
81
|
+
const credentials = this.options.credentials ?? base.credentials;
|
|
82
|
+
this.clients = {
|
|
83
|
+
s3: new _aws_sdk_client_s3.S3Client({
|
|
84
|
+
region: base.region,
|
|
85
|
+
...endpoint ? {
|
|
86
|
+
endpoint,
|
|
87
|
+
forcePathStyle: true
|
|
88
|
+
} : {},
|
|
89
|
+
...credentials ? { credentials } : {}
|
|
90
|
+
}),
|
|
91
|
+
sts: new _aws_sdk_client_sts.STSClient({
|
|
92
|
+
region: base.region,
|
|
93
|
+
...base.endpoint ? { endpoint: base.endpoint } : {},
|
|
94
|
+
...credentials ? { credentials } : {}
|
|
95
|
+
})
|
|
96
|
+
};
|
|
97
|
+
return this.clients;
|
|
98
|
+
}
|
|
99
|
+
/** One AWS call, a missing or expired credential refused by name. */
|
|
100
|
+
call(stage, access, run) {
|
|
101
|
+
return require_awsStore.withStageCredentials({
|
|
102
|
+
stage,
|
|
103
|
+
store: this.name,
|
|
104
|
+
profile: this.options.profile,
|
|
105
|
+
access
|
|
106
|
+
}, run);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The bucket, or null for a project bucket that does not exist yet and is
|
|
110
|
+
* not to be created (a read).
|
|
111
|
+
*/
|
|
112
|
+
async use(stage, create) {
|
|
113
|
+
const { s3, sts } = await this.client();
|
|
114
|
+
if (this.exists) return {
|
|
115
|
+
s3,
|
|
116
|
+
bucket: this.bucketName
|
|
117
|
+
};
|
|
118
|
+
const access = create ? "write" : "read";
|
|
119
|
+
this.bucketName ??= require_projectBucket.projectBucketName(this.options.identity.scope, await this.call(stage, access, () => require_projectBucket.callerAccountId(sts)));
|
|
120
|
+
const bucket = this.bucketName;
|
|
121
|
+
if (create) await this.call(stage, access, () => require_projectBucket.ensureProjectBucket(s3, {
|
|
122
|
+
bucket,
|
|
123
|
+
region: this.options.region,
|
|
124
|
+
identity: this.options.identity
|
|
125
|
+
}));
|
|
126
|
+
else if (await this.call(stage, access, () => require_projectBucket.findProjectBucket(s3, bucket)) === "none") return {
|
|
127
|
+
s3,
|
|
128
|
+
bucket: null
|
|
129
|
+
};
|
|
130
|
+
this.exists = true;
|
|
131
|
+
return {
|
|
132
|
+
s3,
|
|
133
|
+
bucket
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* @throws {StageSecretsUnreadable} when there are no AWS credentials to
|
|
138
|
+
* read it with, or they have expired
|
|
139
|
+
*/
|
|
140
|
+
async read(stage) {
|
|
141
|
+
const { s3, bucket } = await this.use(stage, false);
|
|
142
|
+
if (!bucket) {
|
|
143
|
+
this.etags.set(stage, null);
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
try {
|
|
147
|
+
const response = await this.call(stage, "read", () => s3.send(new _aws_sdk_client_s3.GetObjectCommand({
|
|
148
|
+
Bucket: bucket,
|
|
149
|
+
Key: this.key(stage)
|
|
150
|
+
})));
|
|
151
|
+
const body = await response.Body.transformToString("utf-8");
|
|
152
|
+
this.remember(stage, response.ETag);
|
|
153
|
+
return JSON.parse(body);
|
|
154
|
+
} catch (error) {
|
|
155
|
+
if (!notFound(error)) throw error;
|
|
156
|
+
this.etags.set(stage, null);
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Replace the stage's secrets — on the condition that they are still what
|
|
162
|
+
* this store last read. A stage never read here is replaced as it is now.
|
|
163
|
+
*
|
|
164
|
+
* @throws {StageSecretsChanged} when another run wrote them in between
|
|
165
|
+
* @throws {StageSecretsUnreadable} when there are no AWS credentials to
|
|
166
|
+
* write it with, or they have expired
|
|
167
|
+
*/
|
|
168
|
+
async write(stage, secrets) {
|
|
169
|
+
const { s3, bucket } = await this.use(stage, true);
|
|
170
|
+
const Bucket = bucket;
|
|
171
|
+
const Key = this.key(stage);
|
|
172
|
+
const expected = this.etags.has(stage) ? this.etags.get(stage) ?? null : await this.currentEtag(s3, stage, Bucket, Key);
|
|
173
|
+
try {
|
|
174
|
+
const { ETag } = await this.call(stage, "write", () => s3.send(new _aws_sdk_client_s3.PutObjectCommand({
|
|
175
|
+
Bucket,
|
|
176
|
+
Key,
|
|
177
|
+
Body: JSON.stringify(secrets),
|
|
178
|
+
ContentType: "application/json",
|
|
179
|
+
ServerSideEncryption: "AES256",
|
|
180
|
+
...expected === null ? { IfNoneMatch: "*" } : { IfMatch: expected }
|
|
181
|
+
})));
|
|
182
|
+
this.remember(stage, ETag);
|
|
183
|
+
} catch (error) {
|
|
184
|
+
if (lostRace(error)) {
|
|
185
|
+
this.etags.delete(stage);
|
|
186
|
+
throw new StageSecretsChanged(stage, `s3://${Bucket}/${Key}`);
|
|
187
|
+
}
|
|
188
|
+
throw error;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* The ETag the stage is now at. Some S3-compatible servers answer without
|
|
193
|
+
* one: then nothing is remembered, and the next write asks for it first.
|
|
194
|
+
*/
|
|
195
|
+
remember(stage, etag) {
|
|
196
|
+
if (etag) this.etags.set(stage, etag);
|
|
197
|
+
else this.etags.delete(stage);
|
|
198
|
+
}
|
|
199
|
+
async currentEtag(s3, stage, Bucket, Key) {
|
|
200
|
+
try {
|
|
201
|
+
const { ETag } = await this.call(stage, "write", () => s3.send(new _aws_sdk_client_s3.HeadObjectCommand({
|
|
202
|
+
Bucket,
|
|
203
|
+
Key
|
|
204
|
+
})));
|
|
205
|
+
return ETag ?? null;
|
|
206
|
+
} catch (error) {
|
|
207
|
+
if (notFound(error)) return null;
|
|
208
|
+
throw error;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
//#endregion
|
|
213
|
+
exports.S3SecretsStore = S3SecretsStore;
|
|
214
|
+
|
|
215
|
+
//# sourceMappingURL=s3-CrPoA89T.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3-CrPoA89T.cjs","names":["GkmError","projectBucketName","s3SecretsKey","awsClientConfig","S3Client","STSClient","withStageCredentials","callerAccountId","ensureProjectBucket","findProjectBucket","GetObjectCommand","PutObjectCommand","HeadObjectCommand"],"sources":["../src/secrets/s3.ts"],"sourcesContent":["/**\n * A stage's secrets in S3: one object per stage,\n * `<prefix>/<project>/<stage>/secrets.json`, in the project bucket beside the\n * deploy state (`providers/projectBucket.ts`) — or in a bucket the config\n * names, which must exist.\n *\n * Encrypted at rest with SSE-S3, asked for on every write although the\n * project bucket defaults to it, so no KMS key is another place to keep. The\n * bucket's versioning keeps every past document. Unlike an SSM parameter\n * there is no size to outgrow.\n *\n * The project bucket is created by the first write, never by a read: a stage\n * whose bucket or object does not exist yet has no secrets. Every write is\n * conditional — `If-Match` on the ETag this store last read for the stage,\n * `If-None-Match: *` when it read none — so two `secrets:set` runs at once\n * cannot each overwrite the other's key: the second is refused with\n * {@link StageSecretsChanged}.\n */\n\nimport {\n\tGetObjectCommand,\n\tHeadObjectCommand,\n\tPutObjectCommand,\n\tS3Client,\n\ttype S3ClientConfig,\n} from '@aws-sdk/client-s3';\nimport { STSClient } from '@aws-sdk/client-sts';\nimport type { DeployIdentity } from '../deploy/identity.js';\nimport { GkmError } from '../errors';\nimport {\n\tcallerAccountId,\n\tensureProjectBucket,\n\tfindProjectBucket,\n\tprojectBucketName,\n} from '../providers/projectBucket.js';\nimport {\n\ttype AwsStoreOptions,\n\tawsClientConfig,\n\twithStageCredentials,\n} from './awsStore.js';\nimport { s3SecretsKey } from './providers.js';\nimport type { SecretsStore } from './store.js';\nimport type { StageSecrets } from './types.js';\n\nexport interface S3SecretsStoreOptions extends AwsStoreOptions {\n\t/** The deploy identity: the project bucket's name and its tag. */\n\tidentity: Pick<DeployIdentity, 'scope' | 'key'>;\n\t/** A bucket that exists; omitted, the project bucket. */\n\tbucket?: string;\n\t/** Key prefix inside the bucket, without a trailing slash. */\n\tprefix: string;\n\t/** For tests: credentials to use instead of the default chain. */\n\tcredentials?: S3ClientConfig['credentials'];\n}\n\n/**\n * Another run wrote the stage's secrets after this one read them. Nothing was\n * written: the change is to be made again, on top of theirs.\n */\nexport class StageSecretsChanged extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\t/** `s3://<bucket>/<key>` */\n\t\treadonly location: string,\n\t) {\n\t\tsuper(\n\t\t\t`The secrets for stage \"${stage}\" at ${location} changed after this command read them — ` +\n\t\t\t\t'another secrets command or deploy wrote them first. Nothing was written; run the command ' +\n\t\t\t\t'again to make the change on top of theirs.',\n\t\t);\n\t\tthis.name = 'StageSecretsChanged';\n\t}\n}\n\ninterface S3Failure {\n\tname?: string;\n\t$metadata?: { httpStatusCode?: number };\n}\n\n/** A conditional write that lost: the object is not what the write assumed. */\nfunction lostRace(error: unknown): boolean {\n\tconst { name, $metadata } = error as S3Failure;\n\treturn (\n\t\tname === 'PreconditionFailed' ||\n\t\tname === 'ConditionalRequestConflict' ||\n\t\t$metadata?.httpStatusCode === 412 ||\n\t\t$metadata?.httpStatusCode === 409\n\t);\n}\n\nfunction notFound(error: unknown): boolean {\n\tconst { name, $metadata } = error as S3Failure;\n\treturn (\n\t\tname === 'NoSuchKey' ||\n\t\tname === 'NotFound' ||\n\t\t$metadata?.httpStatusCode === 404\n\t);\n}\n\nexport class S3SecretsStore implements SecretsStore {\n\treadonly name = 's3';\n\n\tprivate clients?: { s3: S3Client; sts: STSClient };\n\t/** The bucket's name, once known. */\n\tprivate bucketName?: string;\n\t/** Whether the bucket is known to exist. */\n\tprivate exists = false;\n\t/** The ETag each stage was last read at — null: read, and not there. */\n\tprivate readonly etags = new Map<string, string | null>();\n\n\tconstructor(private readonly options: S3SecretsStoreOptions) {\n\t\tif (options.bucket) {\n\t\t\tthis.bucketName = options.bucket;\n\t\t\tthis.exists = true;\n\t\t}\n\t}\n\n\t/** The bucket's name; the project bucket's is known after the first call. */\n\tget bucket(): string {\n\t\treturn (\n\t\t\tthis.bucketName ??\n\t\t\tprojectBucketName(this.options.identity.scope, '<account id>')\n\t\t);\n\t}\n\n\t/** Where a stage's secrets are kept: `s3://<bucket>/<key>`. */\n\tlocation(stage: string): string {\n\t\treturn `s3://${this.bucket}/${this.key(stage)}`;\n\t}\n\n\tprivate key(stage: string): string {\n\t\treturn s3SecretsKey(this.options.prefix, this.options.project, stage);\n\t}\n\n\tprivate async client(): Promise<{ s3: S3Client; sts: STSClient }> {\n\t\tif (this.clients) return this.clients;\n\t\tconst base = await awsClientConfig(this.options);\n\t\tconst endpoint =\n\t\t\tbase.endpoint ??\n\t\t\tprocess.env.AWS_ENDPOINT_URL_S3 ??\n\t\t\tprocess.env.AWS_ENDPOINT_URL;\n\t\tconst credentials = this.options.credentials ?? base.credentials;\n\t\tthis.clients = {\n\t\t\ts3: new S3Client({\n\t\t\t\tregion: base.region,\n\t\t\t\t...(endpoint ? { endpoint, forcePathStyle: true } : {}),\n\t\t\t\t...(credentials ? { credentials } : {}),\n\t\t\t}),\n\t\t\tsts: new STSClient({\n\t\t\t\tregion: base.region,\n\t\t\t\t...(base.endpoint ? { endpoint: base.endpoint } : {}),\n\t\t\t\t...(credentials ? { credentials } : {}),\n\t\t\t}),\n\t\t};\n\t\treturn this.clients;\n\t}\n\n\t/** One AWS call, a missing or expired credential refused by name. */\n\tprivate call<T>(\n\t\tstage: string,\n\t\taccess: 'read' | 'write',\n\t\trun: () => Promise<T>,\n\t): Promise<T> {\n\t\treturn withStageCredentials(\n\t\t\t{ stage, store: this.name, profile: this.options.profile, access },\n\t\t\trun,\n\t\t);\n\t}\n\n\t/**\n\t * The bucket, or null for a project bucket that does not exist yet and is\n\t * not to be created (a read).\n\t */\n\tprivate async use(\n\t\tstage: string,\n\t\tcreate: boolean,\n\t): Promise<{ s3: S3Client; bucket: string | null }> {\n\t\tconst { s3, sts } = await this.client();\n\t\tif (this.exists) return { s3, bucket: this.bucketName! };\n\t\tconst access = create ? 'write' : 'read';\n\t\tthis.bucketName ??= projectBucketName(\n\t\t\tthis.options.identity.scope,\n\t\t\tawait this.call(stage, access, () => callerAccountId(sts)),\n\t\t);\n\t\tconst bucket = this.bucketName;\n\t\tif (create) {\n\t\t\tawait this.call(stage, access, () =>\n\t\t\t\tensureProjectBucket(s3, {\n\t\t\t\t\tbucket,\n\t\t\t\t\tregion: this.options.region,\n\t\t\t\t\tidentity: this.options.identity,\n\t\t\t\t}),\n\t\t\t);\n\t\t} else if (\n\t\t\t(await this.call(stage, access, () => findProjectBucket(s3, bucket))) ===\n\t\t\t'none'\n\t\t) {\n\t\t\treturn { s3, bucket: null };\n\t\t}\n\t\tthis.exists = true;\n\t\treturn { s3, bucket };\n\t}\n\n\t/**\n\t * @throws {StageSecretsUnreadable} when there are no AWS credentials to\n\t * read it with, or they have expired\n\t */\n\tasync read(stage: string): Promise<StageSecrets | null> {\n\t\tconst { s3, bucket } = await this.use(stage, false);\n\t\tif (!bucket) {\n\t\t\tthis.etags.set(stage, null);\n\t\t\treturn null;\n\t\t}\n\t\ttry {\n\t\t\tconst response = await this.call(stage, 'read', () =>\n\t\t\t\ts3.send(new GetObjectCommand({ Bucket: bucket, Key: this.key(stage) })),\n\t\t\t);\n\t\t\tconst body = await (\n\t\t\t\tresponse.Body as {\n\t\t\t\t\ttransformToString(encoding: string): Promise<string>;\n\t\t\t\t}\n\t\t\t).transformToString('utf-8');\n\t\t\tthis.remember(stage, response.ETag);\n\t\t\treturn JSON.parse(body) as StageSecrets;\n\t\t} catch (error) {\n\t\t\tif (!notFound(error)) throw error;\n\t\t\tthis.etags.set(stage, null);\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t/**\n\t * Replace the stage's secrets — on the condition that they are still what\n\t * this store last read. A stage never read here is replaced as it is now.\n\t *\n\t * @throws {StageSecretsChanged} when another run wrote them in between\n\t * @throws {StageSecretsUnreadable} when there are no AWS credentials to\n\t * write it with, or they have expired\n\t */\n\tasync write(stage: string, secrets: StageSecrets): Promise<void> {\n\t\tconst { s3, bucket } = await this.use(stage, true);\n\t\tconst Bucket = bucket!;\n\t\tconst Key = this.key(stage);\n\t\tconst expected = this.etags.has(stage)\n\t\t\t? (this.etags.get(stage) ?? null)\n\t\t\t: await this.currentEtag(s3, stage, Bucket, Key);\n\n\t\ttry {\n\t\t\tconst { ETag } = await this.call(stage, 'write', () =>\n\t\t\t\ts3.send(\n\t\t\t\t\tnew PutObjectCommand({\n\t\t\t\t\t\tBucket,\n\t\t\t\t\t\tKey,\n\t\t\t\t\t\tBody: JSON.stringify(secrets),\n\t\t\t\t\t\tContentType: 'application/json',\n\t\t\t\t\t\tServerSideEncryption: 'AES256',\n\t\t\t\t\t\t...(expected === null\n\t\t\t\t\t\t\t? { IfNoneMatch: '*' }\n\t\t\t\t\t\t\t: { IfMatch: expected }),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t);\n\t\t\tthis.remember(stage, ETag);\n\t\t} catch (error) {\n\t\t\tif (lostRace(error)) {\n\t\t\t\tthis.etags.delete(stage);\n\t\t\t\tthrow new StageSecretsChanged(stage, `s3://${Bucket}/${Key}`);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * The ETag the stage is now at. Some S3-compatible servers answer without\n\t * one: then nothing is remembered, and the next write asks for it first.\n\t */\n\tprivate remember(stage: string, etag: string | undefined): void {\n\t\tif (etag) this.etags.set(stage, etag);\n\t\telse this.etags.delete(stage);\n\t}\n\n\tprivate async currentEtag(\n\t\ts3: S3Client,\n\t\tstage: string,\n\t\tBucket: string,\n\t\tKey: string,\n\t): Promise<string | null> {\n\t\ttry {\n\t\t\tconst { ETag } = await this.call(stage, 'write', () =>\n\t\t\t\ts3.send(new HeadObjectCommand({ Bucket, Key })),\n\t\t\t);\n\t\t\treturn ETag ?? null;\n\t\t} catch (error) {\n\t\t\tif (notFound(error)) return null;\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,IAAa,sBAAb,cAAyCA,eAAAA,SAAS;CAEvC;CAEA;CAHV,YACC,OAEA,UACC;EACD,MACC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E,SAAS,MAAM,KAAK,KAAK,OAAO,eACvC,GAAG,KAAK,IAAIC,mBAAAA,kBAAkB;IAAE;IAAQ;GAAI,CAAC,CAAC,CAC/C;GACA,OAAO,QAAQ;EAChB,SAAS,OAAO;GACf,IAAI,SAAS,KAAK,GAAG,OAAO;GAC5B,MAAM;EACP;CACD;AACD"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
|
|
2
|
+
import { lt as s3SecretsKey } from "./workspace-D1QbNd55.mjs";
|
|
3
|
+
import { a as findProjectBucket, i as ensureProjectBucket, o as projectBucketName, r as callerAccountId } from "./projectBucket-C_DN4WzF.mjs";
|
|
4
|
+
import { r as withStageCredentials, t as awsClientConfig } from "./awsStore-Bx5nCFnS.mjs";
|
|
5
|
+
import { GetObjectCommand, HeadObjectCommand, PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
|
|
6
|
+
import { STSClient } from "@aws-sdk/client-sts";
|
|
7
|
+
//#region src/secrets/s3.ts
|
|
8
|
+
/**
|
|
9
|
+
* A stage's secrets in S3: one object per stage,
|
|
10
|
+
* `<prefix>/<project>/<stage>/secrets.json`, in the project bucket beside the
|
|
11
|
+
* deploy state (`providers/projectBucket.ts`) — or in a bucket the config
|
|
12
|
+
* names, which must exist.
|
|
13
|
+
*
|
|
14
|
+
* Encrypted at rest with SSE-S3, asked for on every write although the
|
|
15
|
+
* project bucket defaults to it, so no KMS key is another place to keep. The
|
|
16
|
+
* bucket's versioning keeps every past document. Unlike an SSM parameter
|
|
17
|
+
* there is no size to outgrow.
|
|
18
|
+
*
|
|
19
|
+
* The project bucket is created by the first write, never by a read: a stage
|
|
20
|
+
* whose bucket or object does not exist yet has no secrets. Every write is
|
|
21
|
+
* conditional — `If-Match` on the ETag this store last read for the stage,
|
|
22
|
+
* `If-None-Match: *` when it read none — so two `secrets:set` runs at once
|
|
23
|
+
* cannot each overwrite the other's key: the second is refused with
|
|
24
|
+
* {@link StageSecretsChanged}.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Another run wrote the stage's secrets after this one read them. Nothing was
|
|
28
|
+
* written: the change is to be made again, on top of theirs.
|
|
29
|
+
*/
|
|
30
|
+
var StageSecretsChanged = class extends GkmError {
|
|
31
|
+
stage;
|
|
32
|
+
location;
|
|
33
|
+
constructor(stage, location) {
|
|
34
|
+
super(`The secrets for stage "${stage}" at ${location} changed after this command read them — another secrets command or deploy wrote them first. Nothing was written; run the command again to make the change on top of theirs.`);
|
|
35
|
+
this.stage = stage;
|
|
36
|
+
this.location = location;
|
|
37
|
+
this.name = "StageSecretsChanged";
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
/** A conditional write that lost: the object is not what the write assumed. */
|
|
41
|
+
function lostRace(error) {
|
|
42
|
+
const { name, $metadata } = error;
|
|
43
|
+
return name === "PreconditionFailed" || name === "ConditionalRequestConflict" || $metadata?.httpStatusCode === 412 || $metadata?.httpStatusCode === 409;
|
|
44
|
+
}
|
|
45
|
+
function notFound(error) {
|
|
46
|
+
const { name, $metadata } = error;
|
|
47
|
+
return name === "NoSuchKey" || name === "NotFound" || $metadata?.httpStatusCode === 404;
|
|
48
|
+
}
|
|
49
|
+
var S3SecretsStore = class {
|
|
50
|
+
options;
|
|
51
|
+
name = "s3";
|
|
52
|
+
clients;
|
|
53
|
+
/** The bucket's name, once known. */
|
|
54
|
+
bucketName;
|
|
55
|
+
/** Whether the bucket is known to exist. */
|
|
56
|
+
exists = false;
|
|
57
|
+
/** The ETag each stage was last read at — null: read, and not there. */
|
|
58
|
+
etags = /* @__PURE__ */ new Map();
|
|
59
|
+
constructor(options) {
|
|
60
|
+
this.options = options;
|
|
61
|
+
if (options.bucket) {
|
|
62
|
+
this.bucketName = options.bucket;
|
|
63
|
+
this.exists = true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** The bucket's name; the project bucket's is known after the first call. */
|
|
67
|
+
get bucket() {
|
|
68
|
+
return this.bucketName ?? projectBucketName(this.options.identity.scope, "<account id>");
|
|
69
|
+
}
|
|
70
|
+
/** Where a stage's secrets are kept: `s3://<bucket>/<key>`. */
|
|
71
|
+
location(stage) {
|
|
72
|
+
return `s3://${this.bucket}/${this.key(stage)}`;
|
|
73
|
+
}
|
|
74
|
+
key(stage) {
|
|
75
|
+
return s3SecretsKey(this.options.prefix, this.options.project, stage);
|
|
76
|
+
}
|
|
77
|
+
async client() {
|
|
78
|
+
if (this.clients) return this.clients;
|
|
79
|
+
const base = await awsClientConfig(this.options);
|
|
80
|
+
const endpoint = base.endpoint ?? process.env.AWS_ENDPOINT_URL_S3 ?? process.env.AWS_ENDPOINT_URL;
|
|
81
|
+
const credentials = this.options.credentials ?? base.credentials;
|
|
82
|
+
this.clients = {
|
|
83
|
+
s3: new S3Client({
|
|
84
|
+
region: base.region,
|
|
85
|
+
...endpoint ? {
|
|
86
|
+
endpoint,
|
|
87
|
+
forcePathStyle: true
|
|
88
|
+
} : {},
|
|
89
|
+
...credentials ? { credentials } : {}
|
|
90
|
+
}),
|
|
91
|
+
sts: new STSClient({
|
|
92
|
+
region: base.region,
|
|
93
|
+
...base.endpoint ? { endpoint: base.endpoint } : {},
|
|
94
|
+
...credentials ? { credentials } : {}
|
|
95
|
+
})
|
|
96
|
+
};
|
|
97
|
+
return this.clients;
|
|
98
|
+
}
|
|
99
|
+
/** One AWS call, a missing or expired credential refused by name. */
|
|
100
|
+
call(stage, access, run) {
|
|
101
|
+
return withStageCredentials({
|
|
102
|
+
stage,
|
|
103
|
+
store: this.name,
|
|
104
|
+
profile: this.options.profile,
|
|
105
|
+
access
|
|
106
|
+
}, run);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The bucket, or null for a project bucket that does not exist yet and is
|
|
110
|
+
* not to be created (a read).
|
|
111
|
+
*/
|
|
112
|
+
async use(stage, create) {
|
|
113
|
+
const { s3, sts } = await this.client();
|
|
114
|
+
if (this.exists) return {
|
|
115
|
+
s3,
|
|
116
|
+
bucket: this.bucketName
|
|
117
|
+
};
|
|
118
|
+
const access = create ? "write" : "read";
|
|
119
|
+
this.bucketName ??= projectBucketName(this.options.identity.scope, await this.call(stage, access, () => callerAccountId(sts)));
|
|
120
|
+
const bucket = this.bucketName;
|
|
121
|
+
if (create) await this.call(stage, access, () => ensureProjectBucket(s3, {
|
|
122
|
+
bucket,
|
|
123
|
+
region: this.options.region,
|
|
124
|
+
identity: this.options.identity
|
|
125
|
+
}));
|
|
126
|
+
else if (await this.call(stage, access, () => findProjectBucket(s3, bucket)) === "none") return {
|
|
127
|
+
s3,
|
|
128
|
+
bucket: null
|
|
129
|
+
};
|
|
130
|
+
this.exists = true;
|
|
131
|
+
return {
|
|
132
|
+
s3,
|
|
133
|
+
bucket
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* @throws {StageSecretsUnreadable} when there are no AWS credentials to
|
|
138
|
+
* read it with, or they have expired
|
|
139
|
+
*/
|
|
140
|
+
async read(stage) {
|
|
141
|
+
const { s3, bucket } = await this.use(stage, false);
|
|
142
|
+
if (!bucket) {
|
|
143
|
+
this.etags.set(stage, null);
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
try {
|
|
147
|
+
const response = await this.call(stage, "read", () => s3.send(new GetObjectCommand({
|
|
148
|
+
Bucket: bucket,
|
|
149
|
+
Key: this.key(stage)
|
|
150
|
+
})));
|
|
151
|
+
const body = await response.Body.transformToString("utf-8");
|
|
152
|
+
this.remember(stage, response.ETag);
|
|
153
|
+
return JSON.parse(body);
|
|
154
|
+
} catch (error) {
|
|
155
|
+
if (!notFound(error)) throw error;
|
|
156
|
+
this.etags.set(stage, null);
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Replace the stage's secrets — on the condition that they are still what
|
|
162
|
+
* this store last read. A stage never read here is replaced as it is now.
|
|
163
|
+
*
|
|
164
|
+
* @throws {StageSecretsChanged} when another run wrote them in between
|
|
165
|
+
* @throws {StageSecretsUnreadable} when there are no AWS credentials to
|
|
166
|
+
* write it with, or they have expired
|
|
167
|
+
*/
|
|
168
|
+
async write(stage, secrets) {
|
|
169
|
+
const { s3, bucket } = await this.use(stage, true);
|
|
170
|
+
const Bucket = bucket;
|
|
171
|
+
const Key = this.key(stage);
|
|
172
|
+
const expected = this.etags.has(stage) ? this.etags.get(stage) ?? null : await this.currentEtag(s3, stage, Bucket, Key);
|
|
173
|
+
try {
|
|
174
|
+
const { ETag } = await this.call(stage, "write", () => s3.send(new PutObjectCommand({
|
|
175
|
+
Bucket,
|
|
176
|
+
Key,
|
|
177
|
+
Body: JSON.stringify(secrets),
|
|
178
|
+
ContentType: "application/json",
|
|
179
|
+
ServerSideEncryption: "AES256",
|
|
180
|
+
...expected === null ? { IfNoneMatch: "*" } : { IfMatch: expected }
|
|
181
|
+
})));
|
|
182
|
+
this.remember(stage, ETag);
|
|
183
|
+
} catch (error) {
|
|
184
|
+
if (lostRace(error)) {
|
|
185
|
+
this.etags.delete(stage);
|
|
186
|
+
throw new StageSecretsChanged(stage, `s3://${Bucket}/${Key}`);
|
|
187
|
+
}
|
|
188
|
+
throw error;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* The ETag the stage is now at. Some S3-compatible servers answer without
|
|
193
|
+
* one: then nothing is remembered, and the next write asks for it first.
|
|
194
|
+
*/
|
|
195
|
+
remember(stage, etag) {
|
|
196
|
+
if (etag) this.etags.set(stage, etag);
|
|
197
|
+
else this.etags.delete(stage);
|
|
198
|
+
}
|
|
199
|
+
async currentEtag(s3, stage, Bucket, Key) {
|
|
200
|
+
try {
|
|
201
|
+
const { ETag } = await this.call(stage, "write", () => s3.send(new HeadObjectCommand({
|
|
202
|
+
Bucket,
|
|
203
|
+
Key
|
|
204
|
+
})));
|
|
205
|
+
return ETag ?? null;
|
|
206
|
+
} catch (error) {
|
|
207
|
+
if (notFound(error)) return null;
|
|
208
|
+
throw error;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
//#endregion
|
|
213
|
+
export { S3SecretsStore };
|
|
214
|
+
|
|
215
|
+
//# sourceMappingURL=s3-DQXZdmCM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3-DQXZdmCM.mjs","names":[],"sources":["../src/secrets/s3.ts"],"sourcesContent":["/**\n * A stage's secrets in S3: one object per stage,\n * `<prefix>/<project>/<stage>/secrets.json`, in the project bucket beside the\n * deploy state (`providers/projectBucket.ts`) — or in a bucket the config\n * names, which must exist.\n *\n * Encrypted at rest with SSE-S3, asked for on every write although the\n * project bucket defaults to it, so no KMS key is another place to keep. The\n * bucket's versioning keeps every past document. Unlike an SSM parameter\n * there is no size to outgrow.\n *\n * The project bucket is created by the first write, never by a read: a stage\n * whose bucket or object does not exist yet has no secrets. Every write is\n * conditional — `If-Match` on the ETag this store last read for the stage,\n * `If-None-Match: *` when it read none — so two `secrets:set` runs at once\n * cannot each overwrite the other's key: the second is refused with\n * {@link StageSecretsChanged}.\n */\n\nimport {\n\tGetObjectCommand,\n\tHeadObjectCommand,\n\tPutObjectCommand,\n\tS3Client,\n\ttype S3ClientConfig,\n} from '@aws-sdk/client-s3';\nimport { STSClient } from '@aws-sdk/client-sts';\nimport type { DeployIdentity } from '../deploy/identity.js';\nimport { GkmError } from '../errors';\nimport {\n\tcallerAccountId,\n\tensureProjectBucket,\n\tfindProjectBucket,\n\tprojectBucketName,\n} from '../providers/projectBucket.js';\nimport {\n\ttype AwsStoreOptions,\n\tawsClientConfig,\n\twithStageCredentials,\n} from './awsStore.js';\nimport { s3SecretsKey } from './providers.js';\nimport type { SecretsStore } from './store.js';\nimport type { StageSecrets } from './types.js';\n\nexport interface S3SecretsStoreOptions extends AwsStoreOptions {\n\t/** The deploy identity: the project bucket's name and its tag. */\n\tidentity: Pick<DeployIdentity, 'scope' | 'key'>;\n\t/** A bucket that exists; omitted, the project bucket. */\n\tbucket?: string;\n\t/** Key prefix inside the bucket, without a trailing slash. */\n\tprefix: string;\n\t/** For tests: credentials to use instead of the default chain. */\n\tcredentials?: S3ClientConfig['credentials'];\n}\n\n/**\n * Another run wrote the stage's secrets after this one read them. Nothing was\n * written: the change is to be made again, on top of theirs.\n */\nexport class StageSecretsChanged extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\t/** `s3://<bucket>/<key>` */\n\t\treadonly location: string,\n\t) {\n\t\tsuper(\n\t\t\t`The secrets for stage \"${stage}\" at ${location} changed after this command read them — ` +\n\t\t\t\t'another secrets command or deploy wrote them first. Nothing was written; run the command ' +\n\t\t\t\t'again to make the change on top of theirs.',\n\t\t);\n\t\tthis.name = 'StageSecretsChanged';\n\t}\n}\n\ninterface S3Failure {\n\tname?: string;\n\t$metadata?: { httpStatusCode?: number };\n}\n\n/** A conditional write that lost: the object is not what the write assumed. */\nfunction lostRace(error: unknown): boolean {\n\tconst { name, $metadata } = error as S3Failure;\n\treturn (\n\t\tname === 'PreconditionFailed' ||\n\t\tname === 'ConditionalRequestConflict' ||\n\t\t$metadata?.httpStatusCode === 412 ||\n\t\t$metadata?.httpStatusCode === 409\n\t);\n}\n\nfunction notFound(error: unknown): boolean {\n\tconst { name, $metadata } = error as S3Failure;\n\treturn (\n\t\tname === 'NoSuchKey' ||\n\t\tname === 'NotFound' ||\n\t\t$metadata?.httpStatusCode === 404\n\t);\n}\n\nexport class S3SecretsStore implements SecretsStore {\n\treadonly name = 's3';\n\n\tprivate clients?: { s3: S3Client; sts: STSClient };\n\t/** The bucket's name, once known. */\n\tprivate bucketName?: string;\n\t/** Whether the bucket is known to exist. */\n\tprivate exists = false;\n\t/** The ETag each stage was last read at — null: read, and not there. */\n\tprivate readonly etags = new Map<string, string | null>();\n\n\tconstructor(private readonly options: S3SecretsStoreOptions) {\n\t\tif (options.bucket) {\n\t\t\tthis.bucketName = options.bucket;\n\t\t\tthis.exists = true;\n\t\t}\n\t}\n\n\t/** The bucket's name; the project bucket's is known after the first call. */\n\tget bucket(): string {\n\t\treturn (\n\t\t\tthis.bucketName ??\n\t\t\tprojectBucketName(this.options.identity.scope, '<account id>')\n\t\t);\n\t}\n\n\t/** Where a stage's secrets are kept: `s3://<bucket>/<key>`. */\n\tlocation(stage: string): string {\n\t\treturn `s3://${this.bucket}/${this.key(stage)}`;\n\t}\n\n\tprivate key(stage: string): string {\n\t\treturn s3SecretsKey(this.options.prefix, this.options.project, stage);\n\t}\n\n\tprivate async client(): Promise<{ s3: S3Client; sts: STSClient }> {\n\t\tif (this.clients) return this.clients;\n\t\tconst base = await awsClientConfig(this.options);\n\t\tconst endpoint =\n\t\t\tbase.endpoint ??\n\t\t\tprocess.env.AWS_ENDPOINT_URL_S3 ??\n\t\t\tprocess.env.AWS_ENDPOINT_URL;\n\t\tconst credentials = this.options.credentials ?? base.credentials;\n\t\tthis.clients = {\n\t\t\ts3: new S3Client({\n\t\t\t\tregion: base.region,\n\t\t\t\t...(endpoint ? { endpoint, forcePathStyle: true } : {}),\n\t\t\t\t...(credentials ? { credentials } : {}),\n\t\t\t}),\n\t\t\tsts: new STSClient({\n\t\t\t\tregion: base.region,\n\t\t\t\t...(base.endpoint ? { endpoint: base.endpoint } : {}),\n\t\t\t\t...(credentials ? { credentials } : {}),\n\t\t\t}),\n\t\t};\n\t\treturn this.clients;\n\t}\n\n\t/** One AWS call, a missing or expired credential refused by name. */\n\tprivate call<T>(\n\t\tstage: string,\n\t\taccess: 'read' | 'write',\n\t\trun: () => Promise<T>,\n\t): Promise<T> {\n\t\treturn withStageCredentials(\n\t\t\t{ stage, store: this.name, profile: this.options.profile, access },\n\t\t\trun,\n\t\t);\n\t}\n\n\t/**\n\t * The bucket, or null for a project bucket that does not exist yet and is\n\t * not to be created (a read).\n\t */\n\tprivate async use(\n\t\tstage: string,\n\t\tcreate: boolean,\n\t): Promise<{ s3: S3Client; bucket: string | null }> {\n\t\tconst { s3, sts } = await this.client();\n\t\tif (this.exists) return { s3, bucket: this.bucketName! };\n\t\tconst access = create ? 'write' : 'read';\n\t\tthis.bucketName ??= projectBucketName(\n\t\t\tthis.options.identity.scope,\n\t\t\tawait this.call(stage, access, () => callerAccountId(sts)),\n\t\t);\n\t\tconst bucket = this.bucketName;\n\t\tif (create) {\n\t\t\tawait this.call(stage, access, () =>\n\t\t\t\tensureProjectBucket(s3, {\n\t\t\t\t\tbucket,\n\t\t\t\t\tregion: this.options.region,\n\t\t\t\t\tidentity: this.options.identity,\n\t\t\t\t}),\n\t\t\t);\n\t\t} else if (\n\t\t\t(await this.call(stage, access, () => findProjectBucket(s3, bucket))) ===\n\t\t\t'none'\n\t\t) {\n\t\t\treturn { s3, bucket: null };\n\t\t}\n\t\tthis.exists = true;\n\t\treturn { s3, bucket };\n\t}\n\n\t/**\n\t * @throws {StageSecretsUnreadable} when there are no AWS credentials to\n\t * read it with, or they have expired\n\t */\n\tasync read(stage: string): Promise<StageSecrets | null> {\n\t\tconst { s3, bucket } = await this.use(stage, false);\n\t\tif (!bucket) {\n\t\t\tthis.etags.set(stage, null);\n\t\t\treturn null;\n\t\t}\n\t\ttry {\n\t\t\tconst response = await this.call(stage, 'read', () =>\n\t\t\t\ts3.send(new GetObjectCommand({ Bucket: bucket, Key: this.key(stage) })),\n\t\t\t);\n\t\t\tconst body = await (\n\t\t\t\tresponse.Body as {\n\t\t\t\t\ttransformToString(encoding: string): Promise<string>;\n\t\t\t\t}\n\t\t\t).transformToString('utf-8');\n\t\t\tthis.remember(stage, response.ETag);\n\t\t\treturn JSON.parse(body) as StageSecrets;\n\t\t} catch (error) {\n\t\t\tif (!notFound(error)) throw error;\n\t\t\tthis.etags.set(stage, null);\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t/**\n\t * Replace the stage's secrets — on the condition that they are still what\n\t * this store last read. A stage never read here is replaced as it is now.\n\t *\n\t * @throws {StageSecretsChanged} when another run wrote them in between\n\t * @throws {StageSecretsUnreadable} when there are no AWS credentials to\n\t * write it with, or they have expired\n\t */\n\tasync write(stage: string, secrets: StageSecrets): Promise<void> {\n\t\tconst { s3, bucket } = await this.use(stage, true);\n\t\tconst Bucket = bucket!;\n\t\tconst Key = this.key(stage);\n\t\tconst expected = this.etags.has(stage)\n\t\t\t? (this.etags.get(stage) ?? null)\n\t\t\t: await this.currentEtag(s3, stage, Bucket, Key);\n\n\t\ttry {\n\t\t\tconst { ETag } = await this.call(stage, 'write', () =>\n\t\t\t\ts3.send(\n\t\t\t\t\tnew PutObjectCommand({\n\t\t\t\t\t\tBucket,\n\t\t\t\t\t\tKey,\n\t\t\t\t\t\tBody: JSON.stringify(secrets),\n\t\t\t\t\t\tContentType: 'application/json',\n\t\t\t\t\t\tServerSideEncryption: 'AES256',\n\t\t\t\t\t\t...(expected === null\n\t\t\t\t\t\t\t? { IfNoneMatch: '*' }\n\t\t\t\t\t\t\t: { IfMatch: expected }),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t);\n\t\t\tthis.remember(stage, ETag);\n\t\t} catch (error) {\n\t\t\tif (lostRace(error)) {\n\t\t\t\tthis.etags.delete(stage);\n\t\t\t\tthrow new StageSecretsChanged(stage, `s3://${Bucket}/${Key}`);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * The ETag the stage is now at. Some S3-compatible servers answer without\n\t * one: then nothing is remembered, and the next write asks for it first.\n\t */\n\tprivate remember(stage: string, etag: string | undefined): void {\n\t\tif (etag) this.etags.set(stage, etag);\n\t\telse this.etags.delete(stage);\n\t}\n\n\tprivate async currentEtag(\n\t\ts3: S3Client,\n\t\tstage: string,\n\t\tBucket: string,\n\t\tKey: string,\n\t): Promise<string | null> {\n\t\ttry {\n\t\t\tconst { ETag } = await this.call(stage, 'write', () =>\n\t\t\t\ts3.send(new HeadObjectCommand({ Bucket, Key })),\n\t\t\t);\n\t\t\treturn ETag ?? null;\n\t\t} catch (error) {\n\t\t\tif (notFound(error)) return null;\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n"],"mapp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,SAAS,MAAM,KAAK,KAAK,OAAO,eACvC,GAAG,KAAK,IAAI,kBAAkB;IAAE;IAAQ;GAAI,CAAC,CAAC,CAC/C;GACA,OAAO,QAAQ;EAChB,SAAS,OAAO;GACf,IAAI,SAAS,KAAK,GAAG,OAAO;GAC5B,MAAM;EACP;CACD;AACD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const require_workerRuntime = require("../workerRuntime-BXfhbe13.cjs");
|
|
2
|
+
let node_fs_promises = require("node:fs/promises");
|
|
3
|
+
let node_url = require("node:url");
|
|
4
|
+
//#region src/sandbox/config-worker.ts
|
|
5
|
+
/**
|
|
6
|
+
* Loads `gkm.config.ts` in a sandbox and answers with it as data.
|
|
7
|
+
*
|
|
8
|
+
* Usage (by `loadWorkspaceConfig` with a sandbox, never by hand):
|
|
9
|
+
* node --import=<tsx> config-worker.ts /path/to/gkm.config.ts
|
|
10
|
+
*
|
|
11
|
+
* Answers `{ reason: 'loaded', config }`, `{ reason: 'live', paths }` when the
|
|
12
|
+
* config holds something JSON cannot carry, or `{ reason: 'failed', error }`
|
|
13
|
+
* when it could not be loaded at all.
|
|
14
|
+
*/
|
|
15
|
+
async function load(configPath) {
|
|
16
|
+
if (configPath.endsWith(".json")) return JSON.parse(await (0, node_fs_promises.readFile)(configPath, "utf8"));
|
|
17
|
+
return (await import((0, node_url.pathToFileURL)(configPath).href)).default;
|
|
18
|
+
}
|
|
19
|
+
async function main() {
|
|
20
|
+
const configPath = process.argv[2];
|
|
21
|
+
try {
|
|
22
|
+
if (!configPath) throw new TypeError("No config path was given.");
|
|
23
|
+
await require_workerRuntime.registerAdjacentTsconfig();
|
|
24
|
+
const config = await load(configPath);
|
|
25
|
+
const paths = require_workerRuntime.liveValuePaths(config);
|
|
26
|
+
require_workerRuntime.answer(paths.length > 0 ? {
|
|
27
|
+
reason: "live",
|
|
28
|
+
paths
|
|
29
|
+
} : {
|
|
30
|
+
reason: "loaded",
|
|
31
|
+
config
|
|
32
|
+
});
|
|
33
|
+
} catch (error) {
|
|
34
|
+
require_workerRuntime.answer({
|
|
35
|
+
reason: "failed",
|
|
36
|
+
error: require_workerRuntime.errorData(error)
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
main();
|
|
41
|
+
//#endregion
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=config-worker.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-worker.cjs","names":["readFile","pathToFileURL","registerAdjacentTsconfig","liveValuePaths","errorData"],"sources":["../../src/sandbox/config-worker.ts"],"sourcesContent":["/**\n * Loads `gkm.config.ts` in a sandbox and answers with it as data.\n *\n * Usage (by `loadWorkspaceConfig` with a sandbox, never by hand):\n * node --import=<tsx> config-worker.ts /path/to/gkm.config.ts\n *\n * Answers `{ reason: 'loaded', config }`, `{ reason: 'live', paths }` when the\n * config holds something JSON cannot carry, or `{ reason: 'failed', error }`\n * when it could not be loaded at all.\n */\n\nimport { readFile } from 'node:fs/promises';\nimport { pathToFileURL } from 'node:url';\nimport {\n\tanswer,\n\terrorData,\n\tliveValuePaths,\n\tregisterAdjacentTsconfig,\n} from './workerRuntime';\n\nasync function load(configPath: string): Promise<unknown> {\n\tif (configPath.endsWith('.json')) {\n\t\treturn JSON.parse(await readFile(configPath, 'utf8'));\n\t}\n\tconst module = await import(pathToFileURL(configPath).href);\n\treturn module.default;\n}\n\nasync function main(): Promise<void> {\n\tconst configPath = process.argv[2];\n\ttry {\n\t\tif (!configPath) throw new TypeError('No config path was given.');\n\t\tawait registerAdjacentTsconfig();\n\t\tconst config = await load(configPath);\n\t\tconst paths = liveValuePaths(config);\n\t\tanswer(\n\t\t\tpaths.length > 0\n\t\t\t\t? { reason: 'live', paths }\n\t\t\t\t: { reason: 'loaded', config },\n\t\t);\n\t} catch (error) {\n\t\tanswer({ reason: 'failed', error: errorData(error) });\n\t}\n}\n\nvoid main();\n"],"mappings":";;;;;;;;;;;;;;AAoBA,eAAe,KAAK,YAAsC;CACzD,IAAI,WAAW,SAAS,OAAO,GAC9B,OAAO,KAAK,MAAM,OAAA,GAAMA,iBAAAA,SAAAA,CAAS,YAAY,MAAM,CAAC;CAGrD,QAAO,MADc,QAAA,GAAOC,SAAAA,cAAAA,CAAc,UAAU,CAAC,CAAC,MAAA,CACxC;AACf;AAEA,eAAe,OAAsB;CACpC,MAAM,aAAa,QAAQ,KAAK;CAChC,IAAI;EACH,IAAI,CAAC,YAAY,MAAM,IAAI,UAAU,2BAA2B;EAChE,MAAMC,sBAAAA,yBAAyB;EAC/B,MAAM,SAAS,MAAM,KAAK,UAAU;EACpC,MAAM,QAAQC,sBAAAA,eAAe,MAAM;EACnC,sBAAA,OACC,MAAM,SAAS,IACZ;GAAE,QAAQ;GAAQ;EAAM,IACxB;GAAE,QAAQ;GAAU;EAAO,CAC/B;CACD,SAAS,OAAO;EACf,sBAAA,OAAO;GAAE,QAAQ;GAAU,OAAOC,sBAAAA,UAAU,KAAK;EAAE,CAAC;CACrD;AACD;AAEK,KAAK"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|