@geekmidas/cli 10.0.0-alpha.16 → 10.0.0-alpha.160
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-B5BKAoLz.mjs +1039 -0
- package/dist/EndpointGenerator-B5BKAoLz.mjs.map +1 -0
- package/dist/EndpointGenerator-DxrRqfJ3.cjs +1098 -0
- package/dist/EndpointGenerator-DxrRqfJ3.cjs.map +1 -0
- package/dist/GoDaddyProvider-C9dDlH9I.mjs +412 -0
- package/dist/GoDaddyProvider-C9dDlH9I.mjs.map +1 -0
- package/dist/GoDaddyProvider-DkUMcMYy.cjs +412 -0
- package/dist/GoDaddyProvider-DkUMcMYy.cjs.map +1 -0
- package/dist/{HostingerProvider-BZFGYYVA.cjs → HostingerProvider-9faYOQnQ.cjs} +23 -9
- package/dist/HostingerProvider-9faYOQnQ.cjs.map +1 -0
- package/dist/{HostingerProvider-BY26bWwB.mjs → HostingerProvider-BEuKG2gz.mjs} +23 -9
- package/dist/HostingerProvider-BEuKG2gz.mjs.map +1 -0
- package/dist/LegacyStateStore-C44jUnMH.cjs +124 -0
- package/dist/LegacyStateStore-C44jUnMH.cjs.map +1 -0
- package/dist/LegacyStateStore-DPKhjUR6.mjs +124 -0
- package/dist/LegacyStateStore-DPKhjUR6.mjs.map +1 -0
- package/dist/LocalStateStore-B95WE99i.cjs +178 -0
- package/dist/LocalStateStore-B95WE99i.cjs.map +1 -0
- package/dist/LocalStateStore-BU3fWkcT.mjs +167 -0
- package/dist/LocalStateStore-BU3fWkcT.mjs.map +1 -0
- package/dist/OpenApiTsGenerator-DOTLKBFf.cjs +539 -0
- package/dist/OpenApiTsGenerator-DOTLKBFf.cjs.map +1 -0
- package/dist/OpenApiTsGenerator-Vaf0pI8u.mjs +534 -0
- package/dist/OpenApiTsGenerator-Vaf0pI8u.mjs.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-Cpbeijr5.mjs +223 -0
- package/dist/S3StateStore-Cpbeijr5.mjs.map +1 -0
- package/dist/S3StateStore-zU5kClhd.cjs +222 -0
- package/dist/S3StateStore-zU5kClhd.cjs.map +1 -0
- package/dist/SSMStateStore-BxkKMBi_.mjs +205 -0
- package/dist/SSMStateStore-BxkKMBi_.mjs.map +1 -0
- package/dist/SSMStateStore-D9uviQ3T.cjs +204 -0
- package/dist/SSMStateStore-D9uviQ3T.cjs.map +1 -0
- package/dist/SubscriberGenerator-BybB6uez.mjs +783 -0
- package/dist/SubscriberGenerator-BybB6uez.mjs.map +1 -0
- package/dist/SubscriberGenerator-mZpSuSU7.cjs +848 -0
- package/dist/SubscriberGenerator-mZpSuSU7.cjs.map +1 -0
- package/dist/add-Bb2IL3Yq.cjs +713 -0
- package/dist/add-Bb2IL3Yq.cjs.map +1 -0
- package/dist/add-Dj-gtqTO.mjs +711 -0
- package/dist/add-Dj-gtqTO.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-0vc4Oz9_.cjs +6247 -0
- package/dist/apps-0vc4Oz9_.cjs.map +1 -0
- package/dist/apps-FRNlECwi.mjs +5621 -0
- package/dist/apps-FRNlECwi.mjs.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-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-BodTL4kf.mjs → bundler-9EM4ZHcu.mjs} +59 -14
- package/dist/bundler-9EM4ZHcu.mjs.map +1 -0
- package/dist/{bundler-BeNDZdHQ.cjs → bundler-Bg2eEFEh.cjs} +59 -14
- package/dist/bundler-Bg2eEFEh.cjs.map +1 -0
- package/dist/cli-CmoSOzNq.mjs +80 -0
- package/dist/cli-CmoSOzNq.mjs.map +1 -0
- package/dist/cli-YtLjcAZT.cjs +80 -0
- package/dist/cli-YtLjcAZT.cjs.map +1 -0
- package/dist/compose-3AtZF7ul.mjs +1560 -0
- package/dist/compose-3AtZF7ul.mjs.map +1 -0
- package/dist/compose-CW1DGfYc.cjs +1919 -0
- package/dist/compose-CW1DGfYc.cjs.map +1 -0
- package/dist/compose-CnXZAYNM.mjs +3068 -0
- package/dist/compose-CnXZAYNM.mjs.map +1 -0
- package/dist/compose-D7gOSspy.cjs +3157 -0
- package/dist/compose-D7gOSspy.cjs.map +1 -0
- package/dist/config-B5Hi3mLK.cjs +821 -0
- package/dist/config-B5Hi3mLK.cjs.map +1 -0
- package/dist/config-BNmLn0dw.d.mts +291 -0
- package/dist/config-BNmLn0dw.d.mts.map +1 -0
- package/dist/config-CkuiD9Jv.d.cts +291 -0
- package/dist/config-CkuiD9Jv.d.cts.map +1 -0
- package/dist/config-DWTUVGRE.mjs +696 -0
- package/dist/config-DWTUVGRE.mjs.map +1 -0
- package/dist/config.cjs +13 -3
- package/dist/config.d.cts +4 -117
- package/dist/config.d.mts +4 -117
- package/dist/config.mjs +3 -3
- package/dist/credentialSchemas-BAklWDna.cjs +271 -0
- package/dist/credentialSchemas-BAklWDna.cjs.map +1 -0
- package/dist/credentialSchemas-mz9QZTYh.mjs +236 -0
- package/dist/credentialSchemas-mz9QZTYh.mjs.map +1 -0
- package/dist/credentials-CjFtNBVH.mjs +1834 -0
- package/dist/credentials-CjFtNBVH.mjs.map +1 -0
- package/dist/credentials-DwIRfeBL.cjs +2289 -0
- package/dist/credentials-DwIRfeBL.cjs.map +1 -0
- package/dist/databases-C1qqNxTu.mjs +588 -0
- package/dist/databases-C1qqNxTu.mjs.map +1 -0
- package/dist/databases-CrKh5jw6.cjs +703 -0
- package/dist/databases-CrKh5jw6.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 +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-3bsiWJxj.cjs +3925 -0
- package/dist/deploy-3bsiWJxj.cjs.map +1 -0
- package/dist/deploy-BI3fHnyb.mjs +3869 -0
- package/dist/deploy-BI3fHnyb.mjs.map +1 -0
- package/dist/discover-CRywE7yc.cjs +1085 -0
- package/dist/discover-CRywE7yc.cjs.map +1 -0
- package/dist/discover-DbDrCQ8h.mjs +940 -0
- package/dist/discover-DbDrCQ8h.mjs.map +1 -0
- package/dist/docker-CwayjAF2.cjs +1515 -0
- package/dist/docker-CwayjAF2.cjs.map +1 -0
- package/dist/docker-DPdn7tYJ.mjs +1408 -0
- package/dist/docker-DPdn7tYJ.mjs.map +1 -0
- package/dist/dokploy-BMBL-_Xu.cjs +38 -0
- package/dist/dokploy-BMBL-_Xu.cjs.map +1 -0
- package/dist/dokploy-tmnH0Du_.mjs +38 -0
- package/dist/dokploy-tmnH0Du_.mjs.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-BVGQAUDc.mjs +334 -0
- package/dist/eas-BVGQAUDc.mjs.map +1 -0
- package/dist/eas-meN1xady.cjs +337 -0
- package/dist/eas-meN1xady.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-C8AMbomA.mjs +89 -0
- package/dist/encryption-C8AMbomA.mjs.map +1 -0
- package/dist/encryption-DvFVZdGz.cjs +90 -0
- package/dist/encryption-DvFVZdGz.cjs.map +1 -0
- package/dist/engine-BbWj0w3F.mjs +3217 -0
- package/dist/engine-BbWj0w3F.mjs.map +1 -0
- package/dist/engine-BmiIUVWa.cjs +3330 -0
- package/dist/engine-BmiIUVWa.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-BWqQr8q6.cjs +901 -0
- package/dist/github-BWqQr8q6.cjs.map +1 -0
- package/dist/github-Dc1daUbH.mjs +900 -0
- package/dist/github-Dc1daUbH.mjs.map +1 -0
- package/dist/googlePlay-ByaFUly7.mjs +931 -0
- package/dist/googlePlay-ByaFUly7.mjs.map +1 -0
- package/dist/googlePlay-CdVCdfU8.cjs +931 -0
- package/dist/googlePlay-CdVCdfU8.cjs.map +1 -0
- package/dist/{index-C-VLwB_Y.d.mts → index-B35vTdAW.d.cts} +38 -14
- package/dist/index-B35vTdAW.d.cts.map +1 -0
- package/dist/{index-C-HkOEBt.d.cts → index-Dv1Zj86i.d.mts} +38 -14
- package/dist/index-Dv1Zj86i.d.mts.map +1 -0
- package/dist/index.cjs +13730 -12325
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +13771 -12364
- package/dist/index.mjs.map +1 -1
- package/dist/local-CnVFHJjS.mjs +224 -0
- package/dist/local-CnVFHJjS.mjs.map +1 -0
- package/dist/local-qevrV6dZ.cjs +241 -0
- package/dist/local-qevrV6dZ.cjs.map +1 -0
- package/dist/migrate-BEuCcCwN.mjs +267 -0
- package/dist/migrate-BEuCcCwN.mjs.map +1 -0
- package/dist/migrate-CRRps1i6.cjs +272 -0
- package/dist/migrate-CRRps1i6.cjs.map +1 -0
- package/dist/migrate-CU8_ZWP1.cjs +181 -0
- package/dist/migrate-CU8_ZWP1.cjs.map +1 -0
- package/dist/migrate-DgfKZB41.mjs +181 -0
- package/dist/migrate-DgfKZB41.mjs.map +1 -0
- package/dist/notes-BrBnyZz5.cjs +500 -0
- package/dist/notes-BrBnyZz5.cjs.map +1 -0
- package/dist/notes-CIzrdBKE.mjs +399 -0
- package/dist/notes-CIzrdBKE.mjs.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-CDJd3prK.mjs +222 -0
- package/dist/projectBucket-CDJd3prK.mjs.map +1 -0
- package/dist/projectBucket-CKr_zObJ.cjs +263 -0
- package/dist/projectBucket-CKr_zObJ.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-Bq96_QnK.mjs +123 -0
- package/dist/publish-Bq96_QnK.mjs.map +1 -0
- package/dist/publish-DMKXh1Tb.cjs +124 -0
- package/dist/publish-DMKXh1Tb.cjs.map +1 -0
- package/dist/ready-BjFMu_1J.mjs +375 -0
- package/dist/ready-BjFMu_1J.mjs.map +1 -0
- package/dist/ready-eVMJIcWn.cjs +404 -0
- package/dist/ready-eVMJIcWn.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-DhQ00DpU.mjs → reconcile--I7V4Klj.mjs} +2 -2
- package/dist/{reconcile-DhQ00DpU.mjs.map → reconcile--I7V4Klj.mjs.map} +1 -1
- package/dist/{reconcile-Dd2iyILf.cjs → reconcile-CuCQBa5-.cjs} +3 -3
- package/dist/{reconcile-Dd2iyILf.cjs.map → reconcile-CuCQBa5-.cjs.map} +1 -1
- package/dist/resolve-CSsE7frp.mjs +263 -0
- package/dist/resolve-CSsE7frp.mjs.map +1 -0
- package/dist/resolve-DF9GrosZ.cjs +316 -0
- package/dist/resolve-DF9GrosZ.cjs.map +1 -0
- package/dist/rollback-BBFGGmMa.cjs +165 -0
- package/dist/rollback-BBFGGmMa.cjs.map +1 -0
- package/dist/rollback-CZthwqus.mjs +136 -0
- package/dist/rollback-CZthwqus.mjs.map +1 -0
- package/dist/runtime-CFvcLEJW.d.cts +82 -0
- package/dist/runtime-CFvcLEJW.d.cts.map +1 -0
- package/dist/runtime-dwsH6ddo.d.mts +82 -0
- package/dist/runtime-dwsH6ddo.d.mts.map +1 -0
- package/dist/s3-BBRkezf7.mjs +215 -0
- package/dist/s3-BBRkezf7.mjs.map +1 -0
- package/dist/s3-CI2QYgXH.cjs +215 -0
- package/dist/s3-CI2QYgXH.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-mFpI_ky_.cjs → schemas-BCwKKA42.mjs} +399 -1162
- package/dist/schemas-BCwKKA42.mjs.map +1 -0
- package/dist/{workspace-CgwmXEtc.mjs → schemas-BQ_v0lEX.cjs} +487 -971
- 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-B3xvUAQf.cjs +363 -0
- package/dist/seeds-B3xvUAQf.cjs.map +1 -0
- package/dist/seeds-BCC8vAXR.mjs +298 -0
- package/dist/seeds-BCC8vAXR.mjs.map +1 -0
- package/dist/serverSetup-C4iAABtI.mjs +685 -0
- package/dist/serverSetup-C4iAABtI.mjs.map +1 -0
- package/dist/serverSetup-Dt2DTlwa.cjs +685 -0
- package/dist/serverSetup-Dt2DTlwa.cjs.map +1 -0
- package/dist/sniffer-C2Ot1IbK.mjs +1824 -0
- package/dist/sniffer-C2Ot1IbK.mjs.map +1 -0
- package/dist/sniffer-bTrGuu9z.cjs +1997 -0
- package/dist/sniffer-bTrGuu9z.cjs.map +1 -0
- package/dist/snsSubscriptions-CFKb7fv0.cjs +1173 -0
- package/dist/snsSubscriptions-CFKb7fv0.cjs.map +1 -0
- package/dist/snsSubscriptions-QDDDn9Qi.mjs +1048 -0
- package/dist/snsSubscriptions-QDDDn9Qi.mjs.map +1 -0
- package/dist/sst-DDRWlXdv.mjs +478 -0
- package/dist/sst-DDRWlXdv.mjs.map +1 -0
- package/dist/sst-iRdMlGKd.cjs +501 -0
- package/dist/sst-iRdMlGKd.cjs.map +1 -0
- package/dist/stack-B9iDYMrq.cjs +2431 -0
- package/dist/stack-B9iDYMrq.cjs.map +1 -0
- package/dist/stack-CIOY44aC.mjs +2256 -0
- package/dist/stack-CIOY44aC.mjs.map +1 -0
- package/dist/stage-DA74aD_V.mjs +302 -0
- package/dist/stage-DA74aD_V.mjs.map +1 -0
- package/dist/stage-ycFS9mVn.cjs +313 -0
- package/dist/stage-ycFS9mVn.cjs.map +1 -0
- package/dist/stages-B0yOikgt.cjs +190 -0
- package/dist/stages-B0yOikgt.cjs.map +1 -0
- package/dist/stages-yA9bhStl.mjs +190 -0
- package/dist/stages-yA9bhStl.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-DX22WLvT.mjs +85 -0
- package/dist/terminal-DX22WLvT.mjs.map +1 -0
- package/dist/terminal-RxfbNUwl.cjs +85 -0
- package/dist/terminal-RxfbNUwl.cjs.map +1 -0
- package/dist/types-Bl_CwZC9.cjs +90 -0
- package/dist/types-Bl_CwZC9.cjs.map +1 -0
- package/dist/{types-kvBQjpPo.d.mts → types-Dk--xVOT.d.cts} +2159 -364
- package/dist/types-Dk--xVOT.d.cts.map +1 -0
- package/dist/{types-RhXmHR-e.d.cts → types-DwQYpd_0.d.mts} +2157 -364
- package/dist/types-DwQYpd_0.d.mts.map +1 -0
- package/dist/types-Y1NfWlyG.mjs +61 -0
- package/dist/types-Y1NfWlyG.mjs.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-1szcahj9.cjs +2916 -0
- package/dist/workspace-1szcahj9.cjs.map +1 -0
- package/dist/workspace-DFGsrjGD.mjs +2480 -0
- package/dist/workspace-DFGsrjGD.mjs.map +1 -0
- package/package.json +65 -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-BeNDZdHQ.cjs.map +0 -1
- package/dist/bundler-BodTL4kf.mjs.map +0 -1
- package/dist/config-Q1rvKHvw.cjs +0 -467
- package/dist/config-Q1rvKHvw.cjs.map +0 -1
- package/dist/config-pqGD3hF9.mjs +0 -414
- package/dist/config-pqGD3hF9.mjs.map +0 -1
- package/dist/config.d.cts.map +0 -1
- package/dist/config.d.mts.map +0 -1
- package/dist/credentials-BekkKtY_.mjs +0 -2780
- package/dist/credentials-BekkKtY_.mjs.map +0 -1
- package/dist/credentials-Q6F0uqJq.cjs +0 -2917
- package/dist/credentials-Q6F0uqJq.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/fullstack-secrets-BET8gqwK.mjs +0 -81
- package/dist/fullstack-secrets-BET8gqwK.mjs.map +0 -1
- package/dist/fullstack-secrets-DXsWO-5m.cjs +0 -92
- package/dist/fullstack-secrets-DXsWO-5m.cjs.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-BfflNPVe.cjs +0 -203
- package/dist/github-BfflNPVe.cjs.map +0 -1
- package/dist/github-CRwnxKmD.mjs +0 -203
- package/dist/github-CRwnxKmD.mjs.map +0 -1
- package/dist/index-C-HkOEBt.d.cts.map +0 -1
- package/dist/index-C-VLwB_Y.d.mts.map +0 -1
- package/dist/keystore-B4PRlbgE.mjs +0 -81
- package/dist/keystore-B4PRlbgE.mjs.map +0 -1
- package/dist/keystore-DgGRj2Yy.cjs +0 -98
- package/dist/keystore-DgGRj2Yy.cjs.map +0 -1
- package/dist/openapi-Dcbme-Us.cjs +0 -2038
- package/dist/openapi-Dcbme-Us.cjs.map +0 -1
- package/dist/openapi-vy4JzhUv.mjs +0 -1991
- package/dist/openapi-vy4JzhUv.mjs.map +0 -1
- package/dist/storage-C-30BD1e.cjs +0 -272
- package/dist/storage-C-30BD1e.cjs.map +0 -1
- package/dist/storage-P_b3w7uj.mjs +0 -231
- package/dist/storage-P_b3w7uj.mjs.map +0 -1
- package/dist/sync-B3xxXtJT.mjs +0 -88
- package/dist/sync-B3xxXtJT.mjs.map +0 -1
- package/dist/sync-D7uTIIEi.cjs +0 -111
- package/dist/sync-D7uTIIEi.cjs.map +0 -1
- package/dist/types-RhXmHR-e.d.cts.map +0 -1
- package/dist/types-kvBQjpPo.d.mts.map +0 -1
- package/dist/workspace-CgwmXEtc.mjs.map +0 -1
- package/dist/workspace-mFpI_ky_.cjs.map +0 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
2
|
+
//#region src/reconcile/emit.ts
|
|
3
|
+
/**
|
|
4
|
+
* Point each handler discovery found at the entry the build generated for it.
|
|
5
|
+
*
|
|
6
|
+
* Discovery already nested every endpoint, route, cron, function, consumer,
|
|
7
|
+
* subscriber and processor, with its edges — the graph is the same for every
|
|
8
|
+
* command. A build adds one fact: where it wrote each handler. So this
|
|
9
|
+
* replaces `handler` and nothing else, and a handler the build generated no
|
|
10
|
+
* entry of its own for keeps its source.
|
|
11
|
+
*
|
|
12
|
+
* That is the `server` provider's whole application: it generates one
|
|
13
|
+
* catch-all — `ALL *` pointing at the Hono app that routes in-process — which
|
|
14
|
+
* matches no endpoint, so every endpoint keeps the source it was found at.
|
|
15
|
+
*/
|
|
16
|
+
function withHandlers(manifest, generated) {
|
|
17
|
+
const next = { ...manifest };
|
|
18
|
+
const at = (list, id, handler) => list.map((item) => item.id === id ? {
|
|
19
|
+
...item,
|
|
20
|
+
handler
|
|
21
|
+
} : item);
|
|
22
|
+
for (const route of generated.routes ?? []) for (const [id, declaration] of Object.entries(next)) {
|
|
23
|
+
if (declaration.kind !== "rest-api") continue;
|
|
24
|
+
if (route.surface && route.surface !== id) continue;
|
|
25
|
+
next[id] = {
|
|
26
|
+
...declaration,
|
|
27
|
+
endpoints: declaration.endpoints.map((endpoint) => endpoint.method === route.method && endpoint.path === route.path ? {
|
|
28
|
+
...endpoint,
|
|
29
|
+
handler: route.handler
|
|
30
|
+
} : endpoint)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
for (const route of generated.websocketRoutes ?? []) {
|
|
34
|
+
const surface = next[route.surface];
|
|
35
|
+
if (surface?.kind !== "websocket-api") continue;
|
|
36
|
+
const routes = surface.routes ?? [];
|
|
37
|
+
next[surface.id] = {
|
|
38
|
+
...surface,
|
|
39
|
+
routes: routes.some((r) => r.action === route.action) ? routes.map((r) => r.action === route.action ? {
|
|
40
|
+
...r,
|
|
41
|
+
handler: route.handler
|
|
42
|
+
} : r) : [...routes, {
|
|
43
|
+
id: `${surface.id}${route.action}`,
|
|
44
|
+
action: route.action,
|
|
45
|
+
handler: route.handler,
|
|
46
|
+
dependencies: []
|
|
47
|
+
}]
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
for (const fn of [...generated.functions ?? [], ...generated.crons ?? []]) {
|
|
51
|
+
const declaration = next[fn.name];
|
|
52
|
+
if (declaration?.kind === "function" || declaration?.kind === "cron") next[fn.name] = {
|
|
53
|
+
...declaration,
|
|
54
|
+
handler: fn.handler
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
for (const consumer of generated.queues ?? []) {
|
|
58
|
+
const queue = next[(0, _geekmidas_manifest.canonicalId)(consumer.name)];
|
|
59
|
+
if (queue?.kind !== "queue") continue;
|
|
60
|
+
next[queue.id] = {
|
|
61
|
+
...queue,
|
|
62
|
+
worker: {
|
|
63
|
+
...queue.worker,
|
|
64
|
+
handler: consumer.handler
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
for (const subscriber of generated.subscribers ?? []) {
|
|
69
|
+
const bucket = subscriber.bucket ? next[(0, _geekmidas_manifest.canonicalId)(subscriber.bucket)] : void 0;
|
|
70
|
+
if (bucket?.kind === "objects") {
|
|
71
|
+
next[bucket.id] = {
|
|
72
|
+
...bucket,
|
|
73
|
+
subscribers: at(bucket.subscribers ?? [], subscriber.name, subscriber.handler)
|
|
74
|
+
};
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
const topic = subscriber.topic ? next[(0, _geekmidas_manifest.canonicalId)(subscriber.topic)] : void 0;
|
|
78
|
+
if (topic?.kind !== "topic") continue;
|
|
79
|
+
next[topic.id] = {
|
|
80
|
+
...topic,
|
|
81
|
+
subscribers: at(topic.subscribers, subscriber.name, subscriber.handler)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
for (const processor of generated.processors ?? []) {
|
|
85
|
+
const server = next[processor.fileServer];
|
|
86
|
+
if (server?.kind !== "file-server") continue;
|
|
87
|
+
next[server.id] = {
|
|
88
|
+
...server,
|
|
89
|
+
processors: at(server.processors ?? [], processor.name, processor.handler)
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return next;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The manifest as TypeScript source.
|
|
96
|
+
*
|
|
97
|
+
* Pure, so what gets written can be asserted without touching a filesystem.
|
|
98
|
+
*/
|
|
99
|
+
function manifestModule(manifest, backends = {}) {
|
|
100
|
+
return `${HEADER}
|
|
101
|
+
export const constructs = ${serialise(manifest)} as const satisfies ConstructManifest;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Where the backends that are *config* rather than declaration resolved to.
|
|
105
|
+
*
|
|
106
|
+
* Recorded because they were being answered twice: once by the build, which
|
|
107
|
+
* registers exactly one cache driver, and once by a deploy config, which told
|
|
108
|
+
* the provisioner something else. The result was a deployed URL the running code
|
|
109
|
+
* had no driver for — two documents disagreeing about one fact, which is what
|
|
110
|
+
* this manifest exists to stop.
|
|
111
|
+
*/
|
|
112
|
+
export const backends = ${serialise(backends)} as const;
|
|
113
|
+
|
|
114
|
+
// Derived types
|
|
115
|
+
export type Ids = IdsOf<typeof constructs>;
|
|
116
|
+
export type Construct<Id extends Ids> = DeclarationOf<typeof constructs, Id>;
|
|
117
|
+
export type Kind = Construct<Ids>['kind'];
|
|
118
|
+
|
|
119
|
+
// Useful union types
|
|
120
|
+
export type ProvidedKeys = AllProvidedKeys<typeof constructs>;
|
|
121
|
+
export type Surfaces = IdsOfKind<typeof constructs, 'rest-api'>;
|
|
122
|
+
export type CacheBackend = (typeof backends)['cache'];
|
|
123
|
+
export type EmailBackend = (typeof backends)['email'];
|
|
124
|
+
`;
|
|
125
|
+
}
|
|
126
|
+
const HEADER = `// Generated by \`gkm build\`. Do not edit.
|
|
127
|
+
//
|
|
128
|
+
// Discovery imports application code, so it runs once here rather than in every
|
|
129
|
+
// consumer — a deploy config that discovered for itself would evaluate the whole
|
|
130
|
+
// runtime graph inside its own toolchain. This is the result, as literals.
|
|
131
|
+
|
|
132
|
+
import type {
|
|
133
|
+
AllProvidedKeys,
|
|
134
|
+
ConstructManifest,
|
|
135
|
+
DeclarationOf,
|
|
136
|
+
IdsOf,
|
|
137
|
+
IdsOfKind,
|
|
138
|
+
} from '@geekmidas/manifest';
|
|
139
|
+
`;
|
|
140
|
+
/**
|
|
141
|
+
* JSON, re-indented with tabs and with keys left unquoted where they can be.
|
|
142
|
+
*
|
|
143
|
+
* Cosmetic, and worth it: this file is read by people trying to work out what
|
|
144
|
+
* their app declares, and a wall of quoted keys reads as output rather than as
|
|
145
|
+
* something anyone is expected to understand.
|
|
146
|
+
*/
|
|
147
|
+
function serialise(value) {
|
|
148
|
+
return JSON.stringify(value, null, " ").replace(/^(\t*)"([A-Za-z_$][\w$]*)":/gm, "$1$2:").replace(/"/g, "'");
|
|
149
|
+
}
|
|
150
|
+
//#endregion
|
|
151
|
+
Object.defineProperty(exports, "manifestModule", {
|
|
152
|
+
enumerable: true,
|
|
153
|
+
get: function() {
|
|
154
|
+
return manifestModule;
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
Object.defineProperty(exports, "withHandlers", {
|
|
158
|
+
enumerable: true,
|
|
159
|
+
get: function() {
|
|
160
|
+
return withHandlers;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
//# sourceMappingURL=emit-DiW0kbue.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit-DiW0kbue.cjs","names":["canonicalId"],"sources":["../src/reconcile/emit.ts"],"sourcesContent":["/**\n * The manifest, written out as a module.\n *\n * Discovery imports the application's own code — that is how it finds\n * constructs — so anything calling it evaluates the whole runtime graph: React\n * email templates, database clients, modules that read env at import time. That\n * is fine inside `gkm dev`, which is already running the app. It is not fine\n * inside a deploy config, where it fails on the first thing the deploy toolchain\n * does not expect and would keep failing on the next.\n *\n * So discovery happens once, in the build, and everything downstream reads what\n * it wrote. The same split `RestApi` makes by naming a routes glob rather than\n * importing route modules.\n *\n * A module rather than JSON, because a manifest is not just data to this\n * codebase — `as const satisfies ConstructManifest` is what keeps every id,\n * kind and provided key a *literal*, so `IdsOf`, `ProvidedKeys` and the rest\n * can select out of it. `JSON.parse` returns `any` and gives all of that up.\n */\n\nimport type {\n\tConstructManifest,\n\tCronInfo,\n\tDeclaration,\n\tFunctionInfo,\n\tProcessorInfo,\n\tQueueInfo,\n\tRouteInfo,\n\tSubscriberInfo,\n\tWebSocketRouteInfo,\n} from '@geekmidas/manifest';\nimport { canonicalId } from '@geekmidas/manifest';\nimport type { CacheBackend, EmailBackend } from '../types.js';\n\n/** What a build generated: the entry each handler was written to. */\nexport interface GeneratedHandlers {\n\t/** Each route, with the surface the app that generated it serves. */\n\troutes?: readonly (RouteInfo & { surface?: string })[];\n\tfunctions?: readonly FunctionInfo[];\n\tcrons?: readonly CronInfo[];\n\tqueues?: readonly QueueInfo[];\n\tsubscribers?: readonly SubscriberInfo[];\n\tprocessors?: readonly ProcessorInfo[];\n\t/** A WebSocket surface's routes, each the Lambda API Gateway invokes. */\n\twebsocketRoutes?: readonly WebSocketRouteInfo[];\n}\n\n/**\n * Point each handler discovery found at the entry the build generated for it.\n *\n * Discovery already nested every endpoint, route, cron, function, consumer,\n * subscriber and processor, with its edges — the graph is the same for every\n * command. A build adds one fact: where it wrote each handler. So this\n * replaces `handler` and nothing else, and a handler the build generated no\n * entry of its own for keeps its source.\n *\n * That is the `server` provider's whole application: it generates one\n * catch-all — `ALL *` pointing at the Hono app that routes in-process — which\n * matches no endpoint, so every endpoint keeps the source it was found at.\n */\nexport function withHandlers(\n\tmanifest: ConstructManifest,\n\tgenerated: GeneratedHandlers,\n): ConstructManifest {\n\tconst next: Record<string, Declaration> = { ...manifest };\n\tconst at = <T extends { id: string; handler: string }>(\n\t\tlist: readonly T[],\n\t\tid: string,\n\t\thandler: string,\n\t): T[] => list.map((item) => (item.id === id ? { ...item, handler } : item));\n\n\tfor (const route of generated.routes ?? []) {\n\t\tfor (const [id, declaration] of Object.entries(next)) {\n\t\t\tif (declaration.kind !== 'rest-api') continue;\n\t\t\tif (route.surface && route.surface !== id) continue;\n\t\t\tnext[id] = {\n\t\t\t\t...declaration,\n\t\t\t\tendpoints: declaration.endpoints.map((endpoint) =>\n\t\t\t\t\tendpoint.method === route.method && endpoint.path === route.path\n\t\t\t\t\t\t? { ...endpoint, handler: route.handler }\n\t\t\t\t\t\t: endpoint,\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t}\n\n\t// A route the build generated and discovery did not find is the adaptor's\n\t// own lifecycle — `$connect` writes the connection table even where the\n\t// surface declares no connect handler — so it is added, with no edges.\n\tfor (const route of generated.websocketRoutes ?? []) {\n\t\tconst surface = next[route.surface];\n\t\tif (surface?.kind !== 'websocket-api') continue;\n\t\tconst routes = surface.routes ?? [];\n\t\tnext[surface.id] = {\n\t\t\t...surface,\n\t\t\troutes: routes.some((r) => r.action === route.action)\n\t\t\t\t? routes.map((r) =>\n\t\t\t\t\t\tr.action === route.action ? { ...r, handler: route.handler } : r,\n\t\t\t\t\t)\n\t\t\t\t: [\n\t\t\t\t\t\t...routes,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: `${surface.id}${route.action}`,\n\t\t\t\t\t\t\taction: route.action,\n\t\t\t\t\t\t\thandler: route.handler,\n\t\t\t\t\t\t\tdependencies: [],\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t};\n\t}\n\n\tfor (const fn of [\n\t\t...(generated.functions ?? []),\n\t\t...(generated.crons ?? []),\n\t]) {\n\t\tconst declaration = next[fn.name];\n\t\tif (declaration?.kind === 'function' || declaration?.kind === 'cron') {\n\t\t\tnext[fn.name] = { ...declaration, handler: fn.handler };\n\t\t}\n\t}\n\n\tfor (const consumer of generated.queues ?? []) {\n\t\tconst queue = next[canonicalId(consumer.name)];\n\t\tif (queue?.kind !== 'queue') continue;\n\t\tnext[queue.id] = {\n\t\t\t...queue,\n\t\t\tworker: { ...queue.worker, handler: consumer.handler },\n\t\t};\n\t}\n\n\tfor (const subscriber of generated.subscribers ?? []) {\n\t\tconst bucket = subscriber.bucket\n\t\t\t? next[canonicalId(subscriber.bucket)]\n\t\t\t: undefined;\n\t\tif (bucket?.kind === 'objects') {\n\t\t\tnext[bucket.id] = {\n\t\t\t\t...bucket,\n\t\t\t\tsubscribers: at(\n\t\t\t\t\tbucket.subscribers ?? [],\n\t\t\t\t\tsubscriber.name,\n\t\t\t\t\tsubscriber.handler,\n\t\t\t\t),\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\t\tconst topic = subscriber.topic\n\t\t\t? next[canonicalId(subscriber.topic)]\n\t\t\t: undefined;\n\t\tif (topic?.kind !== 'topic') continue;\n\t\tnext[topic.id] = {\n\t\t\t...topic,\n\t\t\tsubscribers: at(topic.subscribers, subscriber.name, subscriber.handler),\n\t\t};\n\t}\n\n\tfor (const processor of generated.processors ?? []) {\n\t\tconst server = next[processor.fileServer];\n\t\tif (server?.kind !== 'file-server') continue;\n\t\tnext[server.id] = {\n\t\t\t...server,\n\t\t\tprocessors: at(\n\t\t\t\tserver.processors ?? [],\n\t\t\t\tprocessor.name,\n\t\t\t\tprocessor.handler,\n\t\t\t),\n\t\t};\n\t}\n\n\treturn next;\n}\n\n/**\n * The manifest as TypeScript source.\n *\n * Pure, so what gets written can be asserted without touching a filesystem.\n */\nexport function manifestModule(\n\tmanifest: ConstructManifest,\n\tbackends: Backends = {},\n): string {\n\treturn `${HEADER}\nexport const constructs = ${serialise(manifest)} as const satisfies ConstructManifest;\n\n/**\n * Where the backends that are *config* rather than declaration resolved to.\n *\n * Recorded because they were being answered twice: once by the build, which\n * registers exactly one cache driver, and once by a deploy config, which told\n * the provisioner something else. The result was a deployed URL the running code\n * had no driver for — two documents disagreeing about one fact, which is what\n * this manifest exists to stop.\n */\nexport const backends = ${serialise(backends)} as const;\n\n// Derived types\nexport type Ids = IdsOf<typeof constructs>;\nexport type Construct<Id extends Ids> = DeclarationOf<typeof constructs, Id>;\nexport type Kind = Construct<Ids>['kind'];\n\n// Useful union types\nexport type ProvidedKeys = AllProvidedKeys<typeof constructs>;\nexport type Surfaces = IdsOfKind<typeof constructs, 'rest-api'>;\nexport type CacheBackend = (typeof backends)['cache'];\nexport type EmailBackend = (typeof backends)['email'];\n`;\n}\n\n/** The choices that are deployment config rather than declaration. */\nexport interface Backends {\n\tcache?: CacheBackend;\n\temail?: EmailBackend;\n\t/**\n\t * The labels no tenant of the wildcard site may take — every app's own\n\t * and the workspace's `protectedSubdomains`. Config the AWS target cannot\n\t * read for itself, so it travels with the manifest.\n\t */\n\tprotectedSubdomains?: readonly string[];\n}\n\nconst HEADER = `// Generated by \\`gkm build\\`. Do not edit.\n//\n// Discovery imports application code, so it runs once here rather than in every\n// consumer — a deploy config that discovered for itself would evaluate the whole\n// runtime graph inside its own toolchain. This is the result, as literals.\n\nimport type {\n\tAllProvidedKeys,\n\tConstructManifest,\n\tDeclarationOf,\n\tIdsOf,\n\tIdsOfKind,\n} from '@geekmidas/manifest';\n`;\n\n/**\n * JSON, re-indented with tabs and with keys left unquoted where they can be.\n *\n * Cosmetic, and worth it: this file is read by people trying to work out what\n * their app declares, and a wall of quoted keys reads as output rather than as\n * something anyone is expected to understand.\n */\nfunction serialise(value: object): string {\n\treturn JSON.stringify(value, null, '\\t')\n\t\t.replace(/^(\\t*)\"([A-Za-z_$][\\w$]*)\":/gm, '$1$2:')\n\t\t.replace(/\"/g, \"'\");\n}\n"],"mappings":";;;;;;;;;;;;;;;AA4DA,SAAgB,aACf,UACA,WACoB;CACpB,MAAM,OAAoC,EAAE,GAAG,SAAS;CACxD,MAAM,MACL,MACA,IACA,YACS,KAAK,KAAK,SAAU,KAAK,OAAO,KAAK;EAAE,GAAG;EAAM;CAAQ,IAAI,IAAK;CAE3E,KAAK,MAAM,SAAS,UAAU,UAAU,CAAC,GACxC,KAAK,MAAM,CAAC,IAAI,gBAAgB,OAAO,QAAQ,IAAI,GAAG;EACrD,IAAI,YAAY,SAAS,YAAY;EACrC,IAAI,MAAM,WAAW,MAAM,YAAY,IAAI;EAC3C,KAAK,MAAM;GACV,GAAG;GACH,WAAW,YAAY,UAAU,KAAK,aACrC,SAAS,WAAW,MAAM,UAAU,SAAS,SAAS,MAAM,OACzD;IAAE,GAAG;IAAU,SAAS,MAAM;GAAQ,IACtC,QACJ;EACD;CACD;CAMD,KAAK,MAAM,SAAS,UAAU,mBAAmB,CAAC,GAAG;EACpD,MAAM,UAAU,KAAK,MAAM;EAC3B,IAAI,SAAS,SAAS,iBAAiB;EACvC,MAAM,SAAS,QAAQ,UAAU,CAAC;EAClC,KAAK,QAAQ,MAAM;GAClB,GAAG;GACH,QAAQ,OAAO,MAAM,MAAM,EAAE,WAAW,MAAM,MAAM,IACjD,OAAO,KAAK,MACZ,EAAE,WAAW,MAAM,SAAS;IAAE,GAAG;IAAG,SAAS,MAAM;GAAQ,IAAI,CAChE,IACC,CACA,GAAG,QACH;IACC,IAAI,GAAG,QAAQ,KAAK,MAAM;IAC1B,QAAQ,MAAM;IACd,SAAS,MAAM;IACf,cAAc,CAAC;GAChB,CACD;EACH;CACD;CAEA,KAAK,MAAM,MAAM,CAChB,GAAI,UAAU,aAAa,CAAC,GAC5B,GAAI,UAAU,SAAS,CAAC,CACzB,GAAG;EACF,MAAM,cAAc,KAAK,GAAG;EAC5B,IAAI,aAAa,SAAS,cAAc,aAAa,SAAS,QAC7D,KAAK,GAAG,QAAQ;GAAE,GAAG;GAAa,SAAS,GAAG;EAAQ;CAExD;CAEA,KAAK,MAAM,YAAY,UAAU,UAAU,CAAC,GAAG;EAC9C,MAAM,QAAQ,MAAA,GAAKA,oBAAAA,YAAAA,CAAY,SAAS,IAAI;EAC5C,IAAI,OAAO,SAAS,SAAS;EAC7B,KAAK,MAAM,MAAM;GAChB,GAAG;GACH,QAAQ;IAAE,GAAG,MAAM;IAAQ,SAAS,SAAS;GAAQ;EACtD;CACD;CAEA,KAAK,MAAM,cAAc,UAAU,eAAe,CAAC,GAAG;EACrD,MAAM,SAAS,WAAW,SACvB,MAAA,GAAKA,oBAAAA,YAAAA,CAAY,WAAW,MAAM,KAClC,KAAA;EACH,IAAI,QAAQ,SAAS,WAAW;GAC/B,KAAK,OAAO,MAAM;IACjB,GAAG;IACH,aAAa,GACZ,OAAO,eAAe,CAAC,GACvB,WAAW,MACX,WAAW,OACZ;GACD;GACA;EACD;EACA,MAAM,QAAQ,WAAW,QACtB,MAAA,GAAKA,oBAAAA,YAAAA,CAAY,WAAW,KAAK,KACjC,KAAA;EACH,IAAI,OAAO,SAAS,SAAS;EAC7B,KAAK,MAAM,MAAM;GAChB,GAAG;GACH,aAAa,GAAG,MAAM,aAAa,WAAW,MAAM,WAAW,OAAO;EACvE;CACD;CAEA,KAAK,MAAM,aAAa,UAAU,cAAc,CAAC,GAAG;EACnD,MAAM,SAAS,KAAK,UAAU;EAC9B,IAAI,QAAQ,SAAS,eAAe;EACpC,KAAK,OAAO,MAAM;GACjB,GAAG;GACH,YAAY,GACX,OAAO,cAAc,CAAC,GACtB,UAAU,MACV,UAAU,OACX;EACD;CACD;CAEA,OAAO;AACR;;;;;;AAOA,SAAgB,eACf,UACA,WAAqB,CAAC,GACb;CACT,OAAO,GAAG,OAAO;4BACU,UAAU,QAAQ,EAAE;;;;;;;;;;;0BAWtB,UAAU,QAAQ,EAAE;;;;;;;;;;;;;AAa9C;AAcA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;AAsBf,SAAS,UAAU,OAAuB;CACzC,OAAO,KAAK,UAAU,OAAO,MAAM,GAAI,CAAC,CACtC,QAAQ,iCAAiC,OAAO,CAAC,CACjD,QAAQ,MAAM,GAAG;AACpB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
|
|
2
|
+
import { E as providerOf, I as withCustomSecret, k as secretsStoreFor } from "./credentials-CjFtNBVH.mjs";
|
|
3
|
+
import { N as assertDeployedStage } from "./workspace-DFGsrjGD.mjs";
|
|
4
|
+
import { h as loadWorkspaceSettings } from "./config-DWTUVGRE.mjs";
|
|
5
|
+
import { canonicalId, provideKey } from "@geekmidas/manifest";
|
|
6
|
+
import { parseKeyring, retireKey, rotateKeyring } from "@geekmidas/constructs/encryption";
|
|
7
|
+
//#region src/encryption/index.ts
|
|
8
|
+
/**
|
|
9
|
+
* `gkm encryption:rotate` and `gkm encryption:retire` — the keyring of an
|
|
10
|
+
* `Encryption` construct on a server stage.
|
|
11
|
+
*
|
|
12
|
+
* Rotating adds a key in front and keeps every older one, so what they wrote
|
|
13
|
+
* still opens. Retiring removes one, and is the half that makes rotating worth
|
|
14
|
+
* doing: until a key is gone, it still opens everything it ever wrote. It is
|
|
15
|
+
* never automatic, because the only thing that knows nothing is left under a
|
|
16
|
+
* key is the sweep that re-encrypted the column — so it is done after one,
|
|
17
|
+
* deliberately, by name.
|
|
18
|
+
*
|
|
19
|
+
* Neither applies everywhere, and each says so rather than doing something
|
|
20
|
+
* that looks right: a local stage's keyring is derived and would be replaced on
|
|
21
|
+
* the next `gkm dev`, and on AWS the key is KMS's, which rotates it itself and
|
|
22
|
+
* never strands a value.
|
|
23
|
+
*/
|
|
24
|
+
const logger = console;
|
|
25
|
+
var LocalKeyringIsDerived = class extends GkmError {
|
|
26
|
+
construct;
|
|
27
|
+
stage;
|
|
28
|
+
constructor(construct, stage) {
|
|
29
|
+
super(`'${stage}' is the local stage, where ${construct}'s keyring is derived from the project and stage — nothing stored there would be read. Rotate a deployed stage: gkm encryption:rotate ${construct} --stage <stage>.`);
|
|
30
|
+
this.construct = construct;
|
|
31
|
+
this.stage = stage;
|
|
32
|
+
this.name = "LocalKeyringIsDerived";
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var KmsRotatesItself = class extends GkmError {
|
|
36
|
+
construct;
|
|
37
|
+
constructor(construct) {
|
|
38
|
+
super(`${construct} is a KMS key on AWS: KMS rotates it yearly and keeps every version, so no value is ever stranded and there is no key to retire. Nothing to do here.`);
|
|
39
|
+
this.construct = construct;
|
|
40
|
+
this.name = "KmsRotatesItself";
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var NoKeyringYet = class extends GkmError {
|
|
44
|
+
construct;
|
|
45
|
+
stage;
|
|
46
|
+
key;
|
|
47
|
+
constructor(construct, stage, key) {
|
|
48
|
+
super(`'${stage}' has no ${key} yet. The first deploy generates ${construct}'s keyring: gkm deploy --stage ${stage}.`);
|
|
49
|
+
this.construct = construct;
|
|
50
|
+
this.stage = stage;
|
|
51
|
+
this.key = key;
|
|
52
|
+
this.name = "NoKeyringYet";
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
async function encryptionRotateCommand(construct, options, context = {}) {
|
|
56
|
+
return updateKeyring(construct, options, context, (id, url) => {
|
|
57
|
+
const next = rotateKeyring(id, url);
|
|
58
|
+
const [current, ...older] = parseKeyring(id, next).keys.map(({ id }) => id);
|
|
59
|
+
logger.log(`\n✓ ${id} on '${options.stage}' now writes with '${current}'.`);
|
|
60
|
+
logger.log(` Still opening: ${older.join(", ")}. Redeploy to start writing with '${current}', reencrypt what is stored, then: gkm encryption:retire ${id} <key> --stage ${options.stage}`);
|
|
61
|
+
return next;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
async function encryptionRetireCommand(construct, keyId, options, context = {}) {
|
|
65
|
+
return updateKeyring(construct, options, context, (id, url) => {
|
|
66
|
+
const next = retireKey(id, url, keyId);
|
|
67
|
+
logger.log(`\n✓ ${id} on '${options.stage}' no longer holds '${keyId}'. Anything still under it cannot be read after the next deploy.`);
|
|
68
|
+
return next;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
async function updateKeyring(construct, { stage }, context, update) {
|
|
72
|
+
const workspace = context.workspace ?? await loadWorkspaceSettings();
|
|
73
|
+
const id = canonicalId(construct);
|
|
74
|
+
if (stage === workspace.stages.local) throw new LocalKeyringIsDerived(id, stage);
|
|
75
|
+
assertDeployedStage(workspace.stages, stage);
|
|
76
|
+
if (providerOf(workspace) === "aws") throw new KmsRotatesItself(id);
|
|
77
|
+
const store = context.store ?? await secretsStoreFor(workspace, stage);
|
|
78
|
+
const key = provideKey(id, "url");
|
|
79
|
+
const secrets = await store.read(stage);
|
|
80
|
+
const url = secrets?.custom[key];
|
|
81
|
+
if (!secrets || !url) throw new NoKeyringYet(id, stage, key);
|
|
82
|
+
const next = update(id, url);
|
|
83
|
+
await store.write(stage, withCustomSecret(secrets, key, next));
|
|
84
|
+
return next;
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { encryptionRetireCommand, encryptionRotateCommand };
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=encryption-C8AMbomA.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption-C8AMbomA.mjs","names":[],"sources":["../src/encryption/index.ts"],"sourcesContent":["/**\n * `gkm encryption:rotate` and `gkm encryption:retire` — the keyring of an\n * `Encryption` construct on a server stage.\n *\n * Rotating adds a key in front and keeps every older one, so what they wrote\n * still opens. Retiring removes one, and is the half that makes rotating worth\n * doing: until a key is gone, it still opens everything it ever wrote. It is\n * never automatic, because the only thing that knows nothing is left under a\n * key is the sweep that re-encrypted the column — so it is done after one,\n * deliberately, by name.\n *\n * Neither applies everywhere, and each says so rather than doing something\n * that looks right: a local stage's keyring is derived and would be replaced on\n * the next `gkm dev`, and on AWS the key is KMS's, which rotates it itself and\n * never strands a value.\n */\n\nimport {\n\tparseKeyring,\n\tretireKey,\n\trotateKeyring,\n} from '@geekmidas/constructs/encryption';\nimport { canonicalId, provideKey } from '@geekmidas/manifest';\nimport { loadWorkspaceSettings } from '../config';\nimport { GkmError } from '../errors';\nimport { withCustomSecret } from '../secrets/storage.js';\nimport { type SecretsStore, secretsStoreFor } from '../secrets/store.js';\nimport { providerOf } from '../workspace/backends.js';\nimport { assertDeployedStage } from '../workspace/stages.js';\nimport type { NormalizedWorkspace } from '../workspace/types.js';\n\nconst logger = console;\n\nexport class LocalKeyringIsDerived extends GkmError {\n\tconstructor(\n\t\treadonly construct: string,\n\t\treadonly stage: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' is the local stage, where ${construct}'s keyring is derived from the project and stage — nothing stored there would be read. Rotate a deployed stage: gkm encryption:rotate ${construct} --stage <stage>.`,\n\t\t);\n\t\tthis.name = 'LocalKeyringIsDerived';\n\t}\n}\n\nexport class KmsRotatesItself extends GkmError {\n\tconstructor(readonly construct: string) {\n\t\tsuper(\n\t\t\t`${construct} is a KMS key on AWS: KMS rotates it yearly and keeps every version, so no value is ever stranded and there is no key to retire. Nothing to do here.`,\n\t\t);\n\t\tthis.name = 'KmsRotatesItself';\n\t}\n}\n\nexport class NoKeyringYet extends GkmError {\n\tconstructor(\n\t\treadonly construct: string,\n\t\treadonly stage: string,\n\t\treadonly key: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' has no ${key} yet. The first deploy generates ${construct}'s keyring: gkm deploy --stage ${stage}.`,\n\t\t);\n\t\tthis.name = 'NoKeyringYet';\n\t}\n}\n\nexport interface EncryptionCommandOptions {\n\tstage: string;\n}\n\n/** Where a command reads and writes; the real ones unless a test says. */\nexport interface EncryptionCommandContext {\n\tworkspace?: NormalizedWorkspace;\n\tstore?: SecretsStore;\n}\n\nexport async function encryptionRotateCommand(\n\tconstruct: string,\n\toptions: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext = {},\n): Promise<string> {\n\treturn updateKeyring(construct, options, context, (id, url) => {\n\t\tconst next = rotateKeyring(id, url);\n\t\tconst [current, ...older] = parseKeyring(id, next).keys.map(({ id }) => id);\n\n\t\tlogger.log(`\\n✓ ${id} on '${options.stage}' now writes with '${current}'.`);\n\t\tlogger.log(\n\t\t\t` Still opening: ${older.join(', ')}. Redeploy to start writing with '${current}', reencrypt what is stored, then: gkm encryption:retire ${id} <key> --stage ${options.stage}`,\n\t\t);\n\t\treturn next;\n\t});\n}\n\nexport async function encryptionRetireCommand(\n\tconstruct: string,\n\tkeyId: string,\n\toptions: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext = {},\n): Promise<string> {\n\treturn updateKeyring(construct, options, context, (id, url) => {\n\t\tconst next = retireKey(id, url, keyId);\n\n\t\tlogger.log(\n\t\t\t`\\n✓ ${id} on '${options.stage}' no longer holds '${keyId}'. Anything still under it cannot be read after the next deploy.`,\n\t\t);\n\t\treturn next;\n\t});\n}\n\nasync function updateKeyring(\n\tconstruct: string,\n\t{ stage }: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext,\n\tupdate: (id: string, url: string) => string,\n): Promise<string> {\n\tconst workspace = context.workspace ?? (await loadWorkspaceSettings());\n\tconst id = canonicalId(construct);\n\n\tif (stage === workspace.stages.local) {\n\t\tthrow new LocalKeyringIsDerived(id, stage);\n\t}\n\tassertDeployedStage(workspace.stages, stage);\n\tif (providerOf(workspace) === 'aws') throw new KmsRotatesItself(id);\n\n\tconst store = context.store ?? (await secretsStoreFor(workspace, stage));\n\tconst key = provideKey(id, 'url');\n\tconst secrets = await store.read(stage);\n\tconst url = secrets?.custom[key];\n\tif (!secrets || !url) throw new NoKeyringYet(id, stage, key);\n\n\tconst next = update(id, url);\n\tawait store.write(stage, withCustomSecret(secrets, key, next));\n\treturn next;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,SAAS;AAEf,IAAa,wBAAb,cAA2C,SAAS;CAEzC;CACA;CAFV,YACC,WACA,OACC;EACD,MACC,IAAI,MAAM,8BAA8B,UAAU,wIAAwI,UAAU,kBACrM;EALS,KAAA,YAAA;EACA,KAAA,QAAA;EAKT,KAAK,OAAO;CACb;AACD;AAEA,IAAa,mBAAb,cAAsC,SAAS;CACzB;CAArB,YAAY,WAA4B;EACvC,MACC,GAAG,UAAU,qJACd;EAHoB,KAAA,YAAA;EAIpB,KAAK,OAAO;CACb;AACD;AAEA,IAAa,eAAb,cAAkC,SAAS;CAEhC;CACA;CACA;CAHV,YACC,WACA,OACA,KACC;EACD,MACC,IAAI,MAAM,WAAW,IAAI,mCAAmC,UAAU,iCAAiC,MAAM,EAC9G;EANS,KAAA,YAAA;EACA,KAAA,QAAA;EACA,KAAA,MAAA;EAKT,KAAK,OAAO;CACb;AACD;AAYA,eAAsB,wBACrB,WACA,SACA,UAAoC,CAAC,GACnB;CAClB,OAAO,cAAc,WAAW,SAAS,UAAU,IAAI,QAAQ;EAC9D,MAAM,OAAO,cAAc,IAAI,GAAG;EAClC,MAAM,CAAC,SAAS,GAAG,SAAS,aAAa,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,EAAE,SAAS,EAAE;EAE1E,OAAO,IAAI,OAAO,GAAG,OAAO,QAAQ,MAAM,qBAAqB,QAAQ,GAAG;EAC1E,OAAO,IACN,oBAAoB,MAAM,KAAK,IAAI,EAAE,oCAAoC,QAAQ,2DAA2D,GAAG,iBAAiB,QAAQ,OACzK;EACA,OAAO;CACR,CAAC;AACF;AAEA,eAAsB,wBACrB,WACA,OACA,SACA,UAAoC,CAAC,GACnB;CAClB,OAAO,cAAc,WAAW,SAAS,UAAU,IAAI,QAAQ;EAC9D,MAAM,OAAO,UAAU,IAAI,KAAK,KAAK;EAErC,OAAO,IACN,OAAO,GAAG,OAAO,QAAQ,MAAM,qBAAqB,MAAM,iEAC3D;EACA,OAAO;CACR,CAAC;AACF;AAEA,eAAe,cACd,WACA,EAAE,SACF,SACA,QACkB;CAClB,MAAM,YAAY,QAAQ,aAAc,MAAM,sBAAsB;CACpE,MAAM,KAAK,YAAY,SAAS;CAEhC,IAAI,UAAU,UAAU,OAAO,OAC9B,MAAM,IAAI,sBAAsB,IAAI,KAAK;CAE1C,oBAAoB,UAAU,QAAQ,KAAK;CAC3C,IAAI,WAAW,SAAS,MAAM,OAAO,MAAM,IAAI,iBAAiB,EAAE;CAElE,MAAM,QAAQ,QAAQ,SAAU,MAAM,gBAAgB,WAAW,KAAK;CACtE,MAAM,MAAM,WAAW,IAAI,KAAK;CAChC,MAAM,UAAU,MAAM,MAAM,KAAK,KAAK;CACtC,MAAM,MAAM,SAAS,OAAO;CAC5B,IAAI,CAAC,WAAW,CAAC,KAAK,MAAM,IAAI,aAAa,IAAI,OAAO,GAAG;CAE3D,MAAM,OAAO,OAAO,IAAI,GAAG;CAC3B,MAAM,MAAM,MAAM,OAAO,iBAAiB,SAAS,KAAK,IAAI,CAAC;CAC7D,OAAO;AACR"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const require_errors = require("./errors-DMC4Umsb.cjs");
|
|
2
|
+
const require_credentials = require("./credentials-DwIRfeBL.cjs");
|
|
3
|
+
const require_workspace = require("./workspace-1szcahj9.cjs");
|
|
4
|
+
const require_config = require("./config-B5Hi3mLK.cjs");
|
|
5
|
+
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
6
|
+
let _geekmidas_constructs_encryption = require("@geekmidas/constructs/encryption");
|
|
7
|
+
//#region src/encryption/index.ts
|
|
8
|
+
/**
|
|
9
|
+
* `gkm encryption:rotate` and `gkm encryption:retire` — the keyring of an
|
|
10
|
+
* `Encryption` construct on a server stage.
|
|
11
|
+
*
|
|
12
|
+
* Rotating adds a key in front and keeps every older one, so what they wrote
|
|
13
|
+
* still opens. Retiring removes one, and is the half that makes rotating worth
|
|
14
|
+
* doing: until a key is gone, it still opens everything it ever wrote. It is
|
|
15
|
+
* never automatic, because the only thing that knows nothing is left under a
|
|
16
|
+
* key is the sweep that re-encrypted the column — so it is done after one,
|
|
17
|
+
* deliberately, by name.
|
|
18
|
+
*
|
|
19
|
+
* Neither applies everywhere, and each says so rather than doing something
|
|
20
|
+
* that looks right: a local stage's keyring is derived and would be replaced on
|
|
21
|
+
* the next `gkm dev`, and on AWS the key is KMS's, which rotates it itself and
|
|
22
|
+
* never strands a value.
|
|
23
|
+
*/
|
|
24
|
+
const logger = console;
|
|
25
|
+
var LocalKeyringIsDerived = class extends require_errors.GkmError {
|
|
26
|
+
construct;
|
|
27
|
+
stage;
|
|
28
|
+
constructor(construct, stage) {
|
|
29
|
+
super(`'${stage}' is the local stage, where ${construct}'s keyring is derived from the project and stage — nothing stored there would be read. Rotate a deployed stage: gkm encryption:rotate ${construct} --stage <stage>.`);
|
|
30
|
+
this.construct = construct;
|
|
31
|
+
this.stage = stage;
|
|
32
|
+
this.name = "LocalKeyringIsDerived";
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var KmsRotatesItself = class extends require_errors.GkmError {
|
|
36
|
+
construct;
|
|
37
|
+
constructor(construct) {
|
|
38
|
+
super(`${construct} is a KMS key on AWS: KMS rotates it yearly and keeps every version, so no value is ever stranded and there is no key to retire. Nothing to do here.`);
|
|
39
|
+
this.construct = construct;
|
|
40
|
+
this.name = "KmsRotatesItself";
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var NoKeyringYet = class extends require_errors.GkmError {
|
|
44
|
+
construct;
|
|
45
|
+
stage;
|
|
46
|
+
key;
|
|
47
|
+
constructor(construct, stage, key) {
|
|
48
|
+
super(`'${stage}' has no ${key} yet. The first deploy generates ${construct}'s keyring: gkm deploy --stage ${stage}.`);
|
|
49
|
+
this.construct = construct;
|
|
50
|
+
this.stage = stage;
|
|
51
|
+
this.key = key;
|
|
52
|
+
this.name = "NoKeyringYet";
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
async function encryptionRotateCommand(construct, options, context = {}) {
|
|
56
|
+
return updateKeyring(construct, options, context, (id, url) => {
|
|
57
|
+
const next = (0, _geekmidas_constructs_encryption.rotateKeyring)(id, url);
|
|
58
|
+
const [current, ...older] = (0, _geekmidas_constructs_encryption.parseKeyring)(id, next).keys.map(({ id }) => id);
|
|
59
|
+
logger.log(`\n✓ ${id} on '${options.stage}' now writes with '${current}'.`);
|
|
60
|
+
logger.log(` Still opening: ${older.join(", ")}. Redeploy to start writing with '${current}', reencrypt what is stored, then: gkm encryption:retire ${id} <key> --stage ${options.stage}`);
|
|
61
|
+
return next;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
async function encryptionRetireCommand(construct, keyId, options, context = {}) {
|
|
65
|
+
return updateKeyring(construct, options, context, (id, url) => {
|
|
66
|
+
const next = (0, _geekmidas_constructs_encryption.retireKey)(id, url, keyId);
|
|
67
|
+
logger.log(`\n✓ ${id} on '${options.stage}' no longer holds '${keyId}'. Anything still under it cannot be read after the next deploy.`);
|
|
68
|
+
return next;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
async function updateKeyring(construct, { stage }, context, update) {
|
|
72
|
+
const workspace = context.workspace ?? await require_config.loadWorkspaceSettings();
|
|
73
|
+
const id = (0, _geekmidas_manifest.canonicalId)(construct);
|
|
74
|
+
if (stage === workspace.stages.local) throw new LocalKeyringIsDerived(id, stage);
|
|
75
|
+
require_workspace.assertDeployedStage(workspace.stages, stage);
|
|
76
|
+
if (require_credentials.providerOf(workspace) === "aws") throw new KmsRotatesItself(id);
|
|
77
|
+
const store = context.store ?? await require_credentials.secretsStoreFor(workspace, stage);
|
|
78
|
+
const key = (0, _geekmidas_manifest.provideKey)(id, "url");
|
|
79
|
+
const secrets = await store.read(stage);
|
|
80
|
+
const url = secrets?.custom[key];
|
|
81
|
+
if (!secrets || !url) throw new NoKeyringYet(id, stage, key);
|
|
82
|
+
const next = update(id, url);
|
|
83
|
+
await store.write(stage, require_credentials.withCustomSecret(secrets, key, next));
|
|
84
|
+
return next;
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
exports.encryptionRetireCommand = encryptionRetireCommand;
|
|
88
|
+
exports.encryptionRotateCommand = encryptionRotateCommand;
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=encryption-DvFVZdGz.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption-DvFVZdGz.cjs","names":["GkmError","rotateKeyring","parseKeyring","retireKey","loadWorkspaceSettings","canonicalId","providerOf","secretsStoreFor","provideKey","withCustomSecret"],"sources":["../src/encryption/index.ts"],"sourcesContent":["/**\n * `gkm encryption:rotate` and `gkm encryption:retire` — the keyring of an\n * `Encryption` construct on a server stage.\n *\n * Rotating adds a key in front and keeps every older one, so what they wrote\n * still opens. Retiring removes one, and is the half that makes rotating worth\n * doing: until a key is gone, it still opens everything it ever wrote. It is\n * never automatic, because the only thing that knows nothing is left under a\n * key is the sweep that re-encrypted the column — so it is done after one,\n * deliberately, by name.\n *\n * Neither applies everywhere, and each says so rather than doing something\n * that looks right: a local stage's keyring is derived and would be replaced on\n * the next `gkm dev`, and on AWS the key is KMS's, which rotates it itself and\n * never strands a value.\n */\n\nimport {\n\tparseKeyring,\n\tretireKey,\n\trotateKeyring,\n} from '@geekmidas/constructs/encryption';\nimport { canonicalId, provideKey } from '@geekmidas/manifest';\nimport { loadWorkspaceSettings } from '../config';\nimport { GkmError } from '../errors';\nimport { withCustomSecret } from '../secrets/storage.js';\nimport { type SecretsStore, secretsStoreFor } from '../secrets/store.js';\nimport { providerOf } from '../workspace/backends.js';\nimport { assertDeployedStage } from '../workspace/stages.js';\nimport type { NormalizedWorkspace } from '../workspace/types.js';\n\nconst logger = console;\n\nexport class LocalKeyringIsDerived extends GkmError {\n\tconstructor(\n\t\treadonly construct: string,\n\t\treadonly stage: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' is the local stage, where ${construct}'s keyring is derived from the project and stage — nothing stored there would be read. Rotate a deployed stage: gkm encryption:rotate ${construct} --stage <stage>.`,\n\t\t);\n\t\tthis.name = 'LocalKeyringIsDerived';\n\t}\n}\n\nexport class KmsRotatesItself extends GkmError {\n\tconstructor(readonly construct: string) {\n\t\tsuper(\n\t\t\t`${construct} is a KMS key on AWS: KMS rotates it yearly and keeps every version, so no value is ever stranded and there is no key to retire. Nothing to do here.`,\n\t\t);\n\t\tthis.name = 'KmsRotatesItself';\n\t}\n}\n\nexport class NoKeyringYet extends GkmError {\n\tconstructor(\n\t\treadonly construct: string,\n\t\treadonly stage: string,\n\t\treadonly key: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' has no ${key} yet. The first deploy generates ${construct}'s keyring: gkm deploy --stage ${stage}.`,\n\t\t);\n\t\tthis.name = 'NoKeyringYet';\n\t}\n}\n\nexport interface EncryptionCommandOptions {\n\tstage: string;\n}\n\n/** Where a command reads and writes; the real ones unless a test says. */\nexport interface EncryptionCommandContext {\n\tworkspace?: NormalizedWorkspace;\n\tstore?: SecretsStore;\n}\n\nexport async function encryptionRotateCommand(\n\tconstruct: string,\n\toptions: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext = {},\n): Promise<string> {\n\treturn updateKeyring(construct, options, context, (id, url) => {\n\t\tconst next = rotateKeyring(id, url);\n\t\tconst [current, ...older] = parseKeyring(id, next).keys.map(({ id }) => id);\n\n\t\tlogger.log(`\\n✓ ${id} on '${options.stage}' now writes with '${current}'.`);\n\t\tlogger.log(\n\t\t\t` Still opening: ${older.join(', ')}. Redeploy to start writing with '${current}', reencrypt what is stored, then: gkm encryption:retire ${id} <key> --stage ${options.stage}`,\n\t\t);\n\t\treturn next;\n\t});\n}\n\nexport async function encryptionRetireCommand(\n\tconstruct: string,\n\tkeyId: string,\n\toptions: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext = {},\n): Promise<string> {\n\treturn updateKeyring(construct, options, context, (id, url) => {\n\t\tconst next = retireKey(id, url, keyId);\n\n\t\tlogger.log(\n\t\t\t`\\n✓ ${id} on '${options.stage}' no longer holds '${keyId}'. Anything still under it cannot be read after the next deploy.`,\n\t\t);\n\t\treturn next;\n\t});\n}\n\nasync function updateKeyring(\n\tconstruct: string,\n\t{ stage }: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext,\n\tupdate: (id: string, url: string) => string,\n): Promise<string> {\n\tconst workspace = context.workspace ?? (await loadWorkspaceSettings());\n\tconst id = canonicalId(construct);\n\n\tif (stage === workspace.stages.local) {\n\t\tthrow new LocalKeyringIsDerived(id, stage);\n\t}\n\tassertDeployedStage(workspace.stages, stage);\n\tif (providerOf(workspace) === 'aws') throw new KmsRotatesItself(id);\n\n\tconst store = context.store ?? (await secretsStoreFor(workspace, stage));\n\tconst key = provideKey(id, 'url');\n\tconst secrets = await store.read(stage);\n\tconst url = secrets?.custom[key];\n\tif (!secrets || !url) throw new NoKeyringYet(id, stage, key);\n\n\tconst next = update(id, url);\n\tawait store.write(stage, withCustomSecret(secrets, key, next));\n\treturn next;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,SAAS;AAEf,IAAa,wBAAb,cAA2CA,eAAAA,SAAS;CAEzC;CACA;CAFV,YACC,WACA,OACC;EACD,MACC,IAAI,MAAM,8BAA8B,UAAU,wIAAwI,UAAU,kBACrM;EALS,KAAA,YAAA;EACA,KAAA,QAAA;EAKT,KAAK,OAAO;CACb;AACD;AAEA,IAAa,mBAAb,cAAsCA,eAAAA,SAAS;CACzB;CAArB,YAAY,WAA4B;EACvC,MACC,GAAG,UAAU,qJACd;EAHoB,KAAA,YAAA;EAIpB,KAAK,OAAO;CACb;AACD;AAEA,IAAa,eAAb,cAAkCA,eAAAA,SAAS;CAEhC;CACA;CACA;CAHV,YACC,WACA,OACA,KACC;EACD,MACC,IAAI,MAAM,WAAW,IAAI,mCAAmC,UAAU,iCAAiC,MAAM,EAC9G;EANS,KAAA,YAAA;EACA,KAAA,QAAA;EACA,KAAA,MAAA;EAKT,KAAK,OAAO;CACb;AACD;AAYA,eAAsB,wBACrB,WACA,SACA,UAAoC,CAAC,GACnB;CAClB,OAAO,cAAc,WAAW,SAAS,UAAU,IAAI,QAAQ;EAC9D,MAAM,QAAA,GAAOC,iCAAAA,cAAAA,CAAc,IAAI,GAAG;EAClC,MAAM,CAAC,SAAS,GAAG,UAAA,GAASC,iCAAAA,aAAAA,CAAa,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,EAAE,SAAS,EAAE;EAE1E,OAAO,IAAI,OAAO,GAAG,OAAO,QAAQ,MAAM,qBAAqB,QAAQ,GAAG;EAC1E,OAAO,IACN,oBAAoB,MAAM,KAAK,IAAI,EAAE,oCAAoC,QAAQ,2DAA2D,GAAG,iBAAiB,QAAQ,OACzK;EACA,OAAO;CACR,CAAC;AACF;AAEA,eAAsB,wBACrB,WACA,OACA,SACA,UAAoC,CAAC,GACnB;CAClB,OAAO,cAAc,WAAW,SAAS,UAAU,IAAI,QAAQ;EAC9D,MAAM,QAAA,GAAOC,iCAAAA,UAAAA,CAAU,IAAI,KAAK,KAAK;EAErC,OAAO,IACN,OAAO,GAAG,OAAO,QAAQ,MAAM,qBAAqB,MAAM,iEAC3D;EACA,OAAO;CACR,CAAC;AACF;AAEA,eAAe,cACd,WACA,EAAE,SACF,SACA,QACkB;CAClB,MAAM,YAAY,QAAQ,aAAc,MAAMC,eAAAA,sBAAsB;CACpE,MAAM,MAAA,GAAKC,oBAAAA,YAAAA,CAAY,SAAS;CAEhC,IAAI,UAAU,UAAU,OAAO,OAC9B,MAAM,IAAI,sBAAsB,IAAI,KAAK;CAE1C,kBAAA,oBAAoB,UAAU,QAAQ,KAAK;CAC3C,IAAIC,oBAAAA,WAAW,SAAS,MAAM,OAAO,MAAM,IAAI,iBAAiB,EAAE;CAElE,MAAM,QAAQ,QAAQ,SAAU,MAAMC,oBAAAA,gBAAgB,WAAW,KAAK;CACtE,MAAM,OAAA,GAAMC,oBAAAA,WAAAA,CAAW,IAAI,KAAK;CAChC,MAAM,UAAU,MAAM,MAAM,KAAK,KAAK;CACtC,MAAM,MAAM,SAAS,OAAO;CAC5B,IAAI,CAAC,WAAW,CAAC,KAAK,MAAM,IAAI,aAAa,IAAI,OAAO,GAAG;CAE3D,MAAM,OAAO,OAAO,IAAI,GAAG;CAC3B,MAAM,MAAM,MAAM,OAAOC,oBAAAA,iBAAiB,SAAS,KAAK,IAAI,CAAC;CAC7D,OAAO;AACR"}
|