@geekmidas/cli 10.0.0-alpha.179 → 10.0.0-alpha.180
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{EndpointGenerator-DMq6ameY.mjs → EndpointGenerator-CBKH87_b.mjs} +3 -3
- package/dist/{EndpointGenerator-DMq6ameY.mjs.map → EndpointGenerator-CBKH87_b.mjs.map} +1 -1
- package/dist/{EndpointGenerator-yx7_SoXT.cjs → EndpointGenerator-iyA3HkOH.cjs} +3 -3
- package/dist/{EndpointGenerator-yx7_SoXT.cjs.map → EndpointGenerator-iyA3HkOH.cjs.map} +1 -1
- package/dist/{LegacyStateStore-BzUlIHvz.mjs → LegacyStateStore-B7pQA25B.mjs} +2 -2
- package/dist/{LegacyStateStore-BzUlIHvz.mjs.map → LegacyStateStore-B7pQA25B.mjs.map} +1 -1
- package/dist/{LegacyStateStore-C7FFaVce.cjs → LegacyStateStore-l0hBdv-E.cjs} +2 -2
- package/dist/{LegacyStateStore-C7FFaVce.cjs.map → LegacyStateStore-l0hBdv-E.cjs.map} +1 -1
- package/dist/{LocalStateStore-BvI8RUtS.mjs → LocalStateStore-CP0UHL85.mjs} +2 -2
- package/dist/{LocalStateStore-BvI8RUtS.mjs.map → LocalStateStore-CP0UHL85.mjs.map} +1 -1
- package/dist/{LocalStateStore-BJQvLCrg.cjs → LocalStateStore-DEE0Kc_s.cjs} +2 -2
- package/dist/{LocalStateStore-BJQvLCrg.cjs.map → LocalStateStore-DEE0Kc_s.cjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-C_JqxkWt.mjs → OpenApiTsGenerator-CoVA3Ykv.mjs} +2 -2
- package/dist/{OpenApiTsGenerator-C_JqxkWt.mjs.map → OpenApiTsGenerator-CoVA3Ykv.mjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-gM70-7qw.cjs → OpenApiTsGenerator-vy-fOJgs.cjs} +2 -2
- package/dist/{OpenApiTsGenerator-gM70-7qw.cjs.map → OpenApiTsGenerator-vy-fOJgs.cjs.map} +1 -1
- package/dist/{S3StateStore-C1ZX1w5v.cjs → S3StateStore-DE0BNuXc.cjs} +4 -4
- package/dist/{S3StateStore-C1ZX1w5v.cjs.map → S3StateStore-DE0BNuXc.cjs.map} +1 -1
- package/dist/{S3StateStore-DYQSxiVw.mjs → S3StateStore-vmxZWMKh.mjs} +4 -4
- package/dist/{S3StateStore-DYQSxiVw.mjs.map → S3StateStore-vmxZWMKh.mjs.map} +1 -1
- package/dist/{SSMStateStore-DWQk17j8.mjs → SSMStateStore-DQyXnX2M.mjs} +2 -2
- package/dist/{SSMStateStore-DWQk17j8.mjs.map → SSMStateStore-DQyXnX2M.mjs.map} +1 -1
- package/dist/{SSMStateStore-tXnZSJxP.cjs → SSMStateStore-p4hBdTg3.cjs} +2 -2
- package/dist/{SSMStateStore-tXnZSJxP.cjs.map → SSMStateStore-p4hBdTg3.cjs.map} +1 -1
- package/dist/{SubscriberGenerator-NxcLNeDJ.mjs → SubscriberGenerator-B3jHf26s.mjs} +4 -4
- package/dist/{SubscriberGenerator-NxcLNeDJ.mjs.map → SubscriberGenerator-B3jHf26s.mjs.map} +1 -1
- package/dist/{SubscriberGenerator-DXh1Touk.cjs → SubscriberGenerator-JhwVlWBS.cjs} +4 -4
- package/dist/{SubscriberGenerator-DXh1Touk.cjs.map → SubscriberGenerator-JhwVlWBS.cjs.map} +1 -1
- package/dist/{add-D6GloVNz.cjs → add-DEdpKya-.cjs} +8 -8
- package/dist/{add-D6GloVNz.cjs.map → add-DEdpKya-.cjs.map} +1 -1
- package/dist/{add-nJBUo4fT.mjs → add-QBvDmVA-.mjs} +8 -8
- package/dist/{add-nJBUo4fT.mjs.map → add-QBvDmVA-.mjs.map} +1 -1
- package/dist/{apps-GDmO_v7v.mjs → apps-D0LULFmU.mjs} +15 -361
- package/dist/apps-D0LULFmU.mjs.map +1 -0
- package/dist/{apps-DPw1i9E7.cjs → apps-qJ5FPJGQ.cjs} +12 -389
- package/dist/apps-qJ5FPJGQ.cjs.map +1 -0
- package/dist/{aws-DKC2m3sT.cjs → aws-BXfiWNbi.cjs} +2 -2
- package/dist/{aws-DKC2m3sT.cjs.map → aws-BXfiWNbi.cjs.map} +1 -1
- package/dist/{aws-C5LAU_Ii.mjs → aws-BjvSTTcE.mjs} +2 -2
- package/dist/{aws-C5LAU_Ii.mjs.map → aws-BjvSTTcE.mjs.map} +1 -1
- package/dist/{awsStore-Bx5nCFnS.mjs → awsStore-BYYCmXiq.mjs} +2 -2
- package/dist/{awsStore-Bx5nCFnS.mjs.map → awsStore-BYYCmXiq.mjs.map} +1 -1
- package/dist/{awsStore-u3ehhMoY.cjs → awsStore-DKQUElJL.cjs} +2 -2
- package/dist/{awsStore-u3ehhMoY.cjs.map → awsStore-DKQUElJL.cjs.map} +1 -1
- package/dist/{bundler-DzN34D-8.cjs → bundler-BuBCXA0t.cjs} +6 -6
- package/dist/{bundler-DzN34D-8.cjs.map → bundler-BuBCXA0t.cjs.map} +1 -1
- package/dist/{bundler-BFGjH_mQ.mjs → bundler-DZKdVVKZ.mjs} +6 -6
- package/dist/{bundler-BFGjH_mQ.mjs.map → bundler-DZKdVVKZ.mjs.map} +1 -1
- package/dist/{cli-CVlkduxS.cjs → cli-BCGkzaR1.cjs} +5 -5
- package/dist/{cli-CVlkduxS.cjs.map → cli-BCGkzaR1.cjs.map} +1 -1
- package/dist/{cli-Ik7ar-Ux.mjs → cli-CgEbT00Q.mjs} +5 -5
- package/dist/{cli-Ik7ar-Ux.mjs.map → cli-CgEbT00Q.mjs.map} +1 -1
- package/dist/clientTelemetry-BAwj6MOf.d.cts +10 -0
- package/dist/clientTelemetry-BAwj6MOf.d.cts.map +1 -0
- package/dist/clientTelemetry-CvamPJj_.d.mts +10 -0
- package/dist/clientTelemetry-CvamPJj_.d.mts.map +1 -0
- package/dist/{compose-CE0Vi7zq.cjs → compose-AO8u4mBI.cjs} +51 -49
- package/dist/compose-AO8u4mBI.cjs.map +1 -0
- package/dist/{compose-BKLJMnDI.cjs → compose-C-yjexqX.cjs} +9 -37
- package/dist/compose-C-yjexqX.cjs.map +1 -0
- package/dist/{compose-pFnSi3Zf.mjs → compose-C23RpAaF.mjs} +15 -13
- package/dist/compose-C23RpAaF.mjs.map +1 -0
- package/dist/{compose-DH1ToGh2.mjs → compose-DtfoUChm.mjs} +10 -32
- package/dist/compose-DtfoUChm.mjs.map +1 -0
- package/dist/{config-CsCYzlVO.d.mts → config-BODxZemw.d.mts} +3 -3
- package/dist/{config-CsCYzlVO.d.mts.map → config-BODxZemw.d.mts.map} +1 -1
- package/dist/{config-D-gHQXhi.d.cts → config-C3U5HulX.d.cts} +3 -3
- package/dist/{config-D-gHQXhi.d.cts.map → config-C3U5HulX.d.cts.map} +1 -1
- package/dist/config.cjs +3 -3
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +3 -3
- package/dist/{credentialSchemas-BzJiK1nQ.mjs → credentialSchemas-D_85KW2k.mjs} +3 -3
- package/dist/{credentialSchemas-BzJiK1nQ.mjs.map → credentialSchemas-D_85KW2k.mjs.map} +1 -1
- package/dist/{credentialSchemas-OVXofU-r.cjs → credentialSchemas-DjK6xKMk.cjs} +3 -3
- package/dist/{credentialSchemas-OVXofU-r.cjs.map → credentialSchemas-DjK6xKMk.cjs.map} +1 -1
- package/dist/{databases-SFnPaOGM.mjs → databases-CV22HzrI.mjs} +2 -2
- package/dist/{databases-SFnPaOGM.mjs.map → databases-CV22HzrI.mjs.map} +1 -1
- package/dist/{databases-BOuB-zg4.cjs → databases-DwYYH2mX.cjs} +2 -2
- package/dist/{databases-BOuB-zg4.cjs.map → databases-DwYYH2mX.cjs.map} +1 -1
- package/dist/{dbTunnel-BnacLKDV.cjs → dbTunnel-Bve0zBqT.cjs} +7 -7
- package/dist/{dbTunnel-BnacLKDV.cjs.map → dbTunnel-Bve0zBqT.cjs.map} +1 -1
- package/dist/{dbTunnel-CqDaxQig.mjs → dbTunnel-CnubkLBa.mjs} +7 -7
- package/dist/{dbTunnel-CqDaxQig.mjs.map → dbTunnel-CnubkLBa.mjs.map} +1 -1
- package/dist/{define-6poNqm5O.mjs → define-BfrNaY82.mjs} +2 -2
- package/dist/{define-6poNqm5O.mjs.map → define-BfrNaY82.mjs.map} +1 -1
- package/dist/{define-crmMcXFS.cjs → define-zKgLY65H.cjs} +2 -2
- package/dist/{define-crmMcXFS.cjs.map → define-zKgLY65H.cjs.map} +1 -1
- package/dist/deploy/public.cjs +15 -15
- package/dist/deploy/public.d.cts +5 -4
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +5 -4
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +15 -15
- package/dist/{deploy-l0Vc846k.cjs → deploy-C2MKxzm9.cjs} +20 -19
- package/dist/deploy-C2MKxzm9.cjs.map +1 -0
- package/dist/{deploy-CpAkrZ25.mjs → deploy-Qq41vtpm.mjs} +19 -18
- package/dist/deploy-Qq41vtpm.mjs.map +1 -0
- package/dist/{destroy-eeB_PrmN.mjs → destroy-Bg4IUf_Z.mjs} +11 -10
- package/dist/destroy-Bg4IUf_Z.mjs.map +1 -0
- package/dist/{destroy-DtAqmjGz.cjs → destroy-CCpnHI2v.cjs} +13 -12
- package/dist/destroy-CCpnHI2v.cjs.map +1 -0
- package/dist/{discover-B_PDDaVj.mjs → discover-Dfmn6HQ7.mjs} +2 -2
- package/dist/{discover-B_PDDaVj.mjs.map → discover-Dfmn6HQ7.mjs.map} +1 -1
- package/dist/{discover-39VKSE2i.cjs → discover-OXczlq08.cjs} +2 -2
- package/dist/{discover-39VKSE2i.cjs.map → discover-OXczlq08.cjs.map} +1 -1
- package/dist/{dns-B2vsk2Rc.mjs → dns-BAM8VH1v.mjs} +147 -179
- package/dist/dns-BAM8VH1v.mjs.map +1 -0
- package/dist/{dns-WneRa4VJ.cjs → dns-D_0z9Tm1.cjs} +145 -201
- package/dist/dns-D_0z9Tm1.cjs.map +1 -0
- package/dist/{docker-Dk6p33pD.cjs → docker-6EUbKrEl.cjs} +9 -9
- package/dist/{docker-Dk6p33pD.cjs.map → docker-6EUbKrEl.cjs.map} +1 -1
- package/dist/{docker-DyUpcwqy.mjs → docker-DQoE3Fr7.mjs} +9 -9
- package/dist/{docker-DyUpcwqy.mjs.map → docker-DQoE3Fr7.mjs.map} +1 -1
- package/dist/{dokploy-Byg0zr1O.cjs → dokploy-BD8NXy8y.cjs} +3 -3
- package/dist/{dokploy-Byg0zr1O.cjs.map → dokploy-BD8NXy8y.cjs.map} +1 -1
- package/dist/{dokploy-De5b47YI.mjs → dokploy-CU9iuc35.mjs} +3 -3
- package/dist/{dokploy-De5b47YI.mjs.map → dokploy-CU9iuc35.mjs.map} +1 -1
- package/dist/{eas-DAH6D89J.cjs → eas-BhTOdQrE.cjs} +4 -4
- package/dist/{eas-DAH6D89J.cjs.map → eas-BhTOdQrE.cjs.map} +1 -1
- package/dist/{eas-BnLaz86I.mjs → eas-iYyg7Xjy.mjs} +4 -4
- package/dist/{eas-BnLaz86I.mjs.map → eas-iYyg7Xjy.mjs.map} +1 -1
- package/dist/{encryption-IiDQJs6j.mjs → encryption-hgmnMZw0.mjs} +4 -4
- package/dist/{encryption-IiDQJs6j.mjs.map → encryption-hgmnMZw0.mjs.map} +1 -1
- package/dist/{encryption-D7u_SKqz.cjs → encryption-yROMpM67.cjs} +4 -4
- package/dist/{encryption-D7u_SKqz.cjs.map → encryption-yROMpM67.cjs.map} +1 -1
- package/dist/{engine-BhS-wyH0.mjs → engine-B4whsrrE.mjs} +12 -12
- package/dist/engine-B4whsrrE.mjs.map +1 -0
- package/dist/{engine-CaWo9tZO.cjs → engine-D0XYdIiE.cjs} +12 -12
- package/dist/engine-D0XYdIiE.cjs.map +1 -0
- package/dist/{errors-D8Gwp5kU.mjs → errors-C9uIyIDt.mjs} +7 -3
- package/dist/{errors-D8Gwp5kU.mjs.map → errors-C9uIyIDt.mjs.map} +1 -1
- package/dist/{errors-DMC4Umsb.cjs → errors-D1x8duqI.cjs} +7 -3
- package/dist/errors-D1x8duqI.cjs.map +1 -0
- package/dist/{github-BQCqBMZ9.mjs → github-CBkZF4PS.mjs} +11 -11
- package/dist/{github-BQCqBMZ9.mjs.map → github-CBkZF4PS.mjs.map} +1 -1
- package/dist/{github-Cz_LTqBn.cjs → github-D1-_OnGL.cjs} +11 -11
- package/dist/{github-Cz_LTqBn.cjs.map → github-D1-_OnGL.cjs.map} +1 -1
- package/dist/{googlePlay-DowNo3wp.mjs → googlePlay-Bwv8TVi8.mjs} +5 -5
- package/dist/{googlePlay-DowNo3wp.mjs.map → googlePlay-Bwv8TVi8.mjs.map} +1 -1
- package/dist/{googlePlay-CuqPxtno.cjs → googlePlay-s9dGfrrb.cjs} +5 -5
- package/dist/{googlePlay-CuqPxtno.cjs.map → googlePlay-s9dGfrrb.cjs.map} +1 -1
- package/dist/{iam-Cs2Ph5f2.mjs → iam-BzFyFf7T.mjs} +2 -2
- package/dist/{iam-Cs2Ph5f2.mjs.map → iam-BzFyFf7T.mjs.map} +1 -1
- package/dist/{iam-CGd_oEyz.cjs → iam-WIoKnLBp.cjs} +2 -2
- package/dist/{iam-CGd_oEyz.cjs.map → iam-WIoKnLBp.cjs.map} +1 -1
- package/dist/{index-QxGYzGEN.d.mts → index-BKgOlfK2.d.mts} +2 -2
- package/dist/{index-QxGYzGEN.d.mts.map → index-BKgOlfK2.d.mts.map} +1 -1
- package/dist/{index-tFzoro1V.d.cts → index-zPzigXh-.d.cts} +2 -2
- package/dist/{index-tFzoro1V.d.cts.map → index-zPzigXh-.d.cts.map} +1 -1
- package/dist/index.cjs +75 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +73 -71
- package/dist/index.mjs.map +1 -1
- package/dist/{local-CWNFE8Sg.cjs → local-CFnHQgWC.cjs} +3 -3
- package/dist/{local-CWNFE8Sg.cjs.map → local-CFnHQgWC.cjs.map} +1 -1
- package/dist/{local-BQQHvZ4q.mjs → local-JOnTFJA5.mjs} +3 -3
- package/dist/{local-BQQHvZ4q.mjs.map → local-JOnTFJA5.mjs.map} +1 -1
- package/dist/{migrate-D_7oRThu.mjs → migrate-BtnpQocG.mjs} +6 -6
- package/dist/{migrate-D_7oRThu.mjs.map → migrate-BtnpQocG.mjs.map} +1 -1
- package/dist/{migrate-8QGCWIqm.cjs → migrate-CGXrmZyV.cjs} +8 -8
- package/dist/{migrate-8QGCWIqm.cjs.map → migrate-CGXrmZyV.cjs.map} +1 -1
- package/dist/{migrate-CNrPM5zg.cjs → migrate-CxWXW-Lw.cjs} +6 -6
- package/dist/{migrate-CNrPM5zg.cjs.map → migrate-CxWXW-Lw.cjs.map} +1 -1
- package/dist/{migrate-CqiOiRvz.mjs → migrate-fLIgSpPB.mjs} +8 -8
- package/dist/{migrate-CqiOiRvz.mjs.map → migrate-fLIgSpPB.mjs.map} +1 -1
- package/dist/{notes-dD3gRvZw.cjs → notes-ChYPaRLu.cjs} +4 -4
- package/dist/{notes-dD3gRvZw.cjs.map → notes-ChYPaRLu.cjs.map} +1 -1
- package/dist/{notes-D2KWnUSL.mjs → notes-LATU2vLI.mjs} +4 -4
- package/dist/{notes-D2KWnUSL.mjs.map → notes-LATU2vLI.mjs.map} +1 -1
- package/dist/openapi.cjs +3 -3
- package/dist/openapi.d.cts +3 -8
- package/dist/openapi.d.cts.map +1 -1
- package/dist/openapi.d.mts +3 -8
- package/dist/openapi.d.mts.map +1 -1
- package/dist/openapi.mjs +3 -3
- package/dist/{projectBucket-BcTodL8A.cjs → projectBucket-BIeh2HTj.cjs} +3 -3
- package/dist/{projectBucket-BcTodL8A.cjs.map → projectBucket-BIeh2HTj.cjs.map} +1 -1
- package/dist/{projectBucket-BDytiu7A.mjs → projectBucket-D_4zb_oh.mjs} +3 -3
- package/dist/{projectBucket-BDytiu7A.mjs.map → projectBucket-D_4zb_oh.mjs.map} +1 -1
- package/dist/{provider-CEOKk8NS.mjs → provider-BvjDbsTR.mjs} +3 -3
- package/dist/{provider-CEOKk8NS.mjs.map → provider-BvjDbsTR.mjs.map} +1 -1
- package/dist/{provider-BqpjG9QM.cjs → provider-DLhgo-mB.cjs} +3 -3
- package/dist/{provider-BqpjG9QM.cjs.map → provider-DLhgo-mB.cjs.map} +1 -1
- package/dist/{publish-Da9gxP5Q.cjs → publish-Dc-1GQp8.cjs} +3 -3
- package/dist/{publish-Da9gxP5Q.cjs.map → publish-Dc-1GQp8.cjs.map} +1 -1
- package/dist/{publish-Cr8wv7nO.mjs → publish-DhzRYhVZ.mjs} +3 -3
- package/dist/{publish-Cr8wv7nO.mjs.map → publish-DhzRYhVZ.mjs.map} +1 -1
- package/dist/{ready-D1gctv-5.mjs → ready-BcV28QoW.mjs} +6 -6
- package/dist/{ready-D1gctv-5.mjs.map → ready-BcV28QoW.mjs.map} +1 -1
- package/dist/{ready-Bgj2cf4j.cjs → ready-ByQvw4-W.cjs} +6 -6
- package/dist/{ready-Bgj2cf4j.cjs.map → ready-ByQvw4-W.cjs.map} +1 -1
- package/dist/reconcile/public.cjs +1 -1
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/reconcile/public.mjs +1 -1
- package/dist/{resolve-Dyki9ZJX.mjs → resolve-CJvM2bUx.mjs} +6 -6
- package/dist/{resolve-Dyki9ZJX.mjs.map → resolve-CJvM2bUx.mjs.map} +1 -1
- package/dist/{resolve-DRldmRYb.cjs → resolve-DyUXmA0z.cjs} +6 -6
- package/dist/{resolve-DRldmRYb.cjs.map → resolve-DyUXmA0z.cjs.map} +1 -1
- package/dist/{rollback-Do0i6x3b.mjs → rollback-BO1asWkd.mjs} +8 -8
- package/dist/{rollback-Do0i6x3b.mjs.map → rollback-BO1asWkd.mjs.map} +1 -1
- package/dist/{rollback-R_j7f9cY.cjs → rollback-Op8Tc5N-.cjs} +8 -8
- package/dist/{rollback-R_j7f9cY.cjs.map → rollback-Op8Tc5N-.cjs.map} +1 -1
- package/dist/{runtime-BpGIXfYr.d.mts → runtime-CaejlcZt.d.mts} +2 -2
- package/dist/{runtime-BpGIXfYr.d.mts.map → runtime-CaejlcZt.d.mts.map} +1 -1
- package/dist/{runtime-DLV0CNZ4.d.cts → runtime-D3jD4Dvn.d.cts} +2 -2
- package/dist/{runtime-DLV0CNZ4.d.cts.map → runtime-D3jD4Dvn.d.cts.map} +1 -1
- package/dist/{s3-CYEU7r1x.mjs → s3-BbtwHSod.mjs} +5 -5
- package/dist/{s3-CYEU7r1x.mjs.map → s3-BbtwHSod.mjs.map} +1 -1
- package/dist/{s3-D9aPMh9u.cjs → s3-CwacPd8J.cjs} +5 -5
- package/dist/{s3-D9aPMh9u.cjs.map → s3-CwacPd8J.cjs.map} +1 -1
- package/dist/sandbox/credentials-worker.cjs +2 -2
- package/dist/sandbox/credentials-worker.mjs +2 -2
- package/dist/sandbox/discover-worker.cjs +1 -1
- package/dist/sandbox/discover-worker.mjs +1 -1
- package/dist/sandbox/migrate-worker.cjs +2 -2
- package/dist/sandbox/migrate-worker.mjs +2 -2
- package/dist/{secretsManager-CJyxFcBH.mjs → secretsManager-CjTo6CRq.mjs} +2 -2
- package/dist/{secretsManager-CJyxFcBH.mjs.map → secretsManager-CjTo6CRq.mjs.map} +1 -1
- package/dist/{secretsManager-D8on44WI.cjs → secretsManager-CvmBGjdM.cjs} +2 -2
- package/dist/{secretsManager-D8on44WI.cjs.map → secretsManager-CvmBGjdM.cjs.map} +1 -1
- package/dist/{serverSetup-BmPwcMQN.cjs → serverSetup-BFdzPTIT.cjs} +7 -7
- package/dist/{serverSetup-BmPwcMQN.cjs.map → serverSetup-BFdzPTIT.cjs.map} +1 -1
- package/dist/{serverSetup-Bw5gc57O.mjs → serverSetup-CSxaZ7ha.mjs} +7 -7
- package/dist/{serverSetup-Bw5gc57O.mjs.map → serverSetup-CSxaZ7ha.mjs.map} +1 -1
- package/dist/{sniffer-XsTiFI3l.mjs → sniffer-CwxpsSez.mjs} +9 -9
- package/dist/{sniffer-XsTiFI3l.mjs.map → sniffer-CwxpsSez.mjs.map} +1 -1
- package/dist/{sniffer-BPLYWu70.cjs → sniffer-D3gH7aJT.cjs} +9 -9
- package/dist/{sniffer-BPLYWu70.cjs.map → sniffer-D3gH7aJT.cjs.map} +1 -1
- package/dist/{snsSubscriptions-CATtZwGv.cjs → snsSubscriptions-B8tGxND5.cjs} +10 -8
- package/dist/snsSubscriptions-B8tGxND5.cjs.map +1 -0
- package/dist/{snsSubscriptions-D9Rm_Eug.mjs → snsSubscriptions-n3sjbrRM.mjs} +7 -5
- package/dist/snsSubscriptions-n3sjbrRM.mjs.map +1 -0
- package/dist/{sst-C56i2cst.cjs → sst-Cjocp7gi.cjs} +8 -8
- package/dist/{sst-C56i2cst.cjs.map → sst-Cjocp7gi.cjs.map} +1 -1
- package/dist/{sst-BCvYZtVF.mjs → sst-DeF0BfDA.mjs} +8 -8
- package/dist/{sst-BCvYZtVF.mjs.map → sst-DeF0BfDA.mjs.map} +1 -1
- package/dist/{stack-TttsEL7X.mjs → stack-CyoRqyPt.mjs} +16 -609
- package/dist/stack-CyoRqyPt.mjs.map +1 -0
- package/dist/{stack-Dal2Oq2D.cjs → stack-Dr2FSxGm.cjs} +28 -687
- package/dist/stack-Dr2FSxGm.cjs.map +1 -0
- package/dist/{stage--ixwLSTc.mjs → stage-TAx0Gcq8.mjs} +8 -8
- package/dist/{stage--ixwLSTc.mjs.map → stage-TAx0Gcq8.mjs.map} +1 -1
- package/dist/{stage-BLsuXUP_.cjs → stage-aTBLKonw.cjs} +8 -8
- package/dist/{stage-BLsuXUP_.cjs.map → stage-aTBLKonw.cjs.map} +1 -1
- package/dist/{stages-8izznWib.cjs → stages-BeSQQQ4z.cjs} +3 -3
- package/dist/{stages-8izznWib.cjs.map → stages-BeSQQQ4z.cjs.map} +1 -1
- package/dist/{stages-QPWgbm9P.mjs → stages-DjFKQv08.mjs} +3 -3
- package/dist/{stages-QPWgbm9P.mjs.map → stages-DjFKQv08.mjs.map} +1 -1
- package/dist/target/public.cjs +3 -3
- package/dist/target/public.d.cts +2 -2
- package/dist/target/public.d.mts +2 -2
- package/dist/target/public.mjs +3 -3
- package/dist/{terminal-gOLDmpW-.mjs → terminal-Bk4PjXWY.mjs} +4 -4
- package/dist/{terminal-gOLDmpW-.mjs.map → terminal-Bk4PjXWY.mjs.map} +1 -1
- package/dist/{terminal-Dy4zzTCA.cjs → terminal-DPf137EJ.cjs} +4 -4
- package/dist/{terminal-Dy4zzTCA.cjs.map → terminal-DPf137EJ.cjs.map} +1 -1
- package/dist/{types-CV4AzwC_.d.cts → types-CLxsw-QY.d.cts} +3 -16
- package/dist/types-CLxsw-QY.d.cts.map +1 -0
- package/dist/{types-Bj1A1wkS.d.mts → types-wLlwkSib.d.mts} +3 -16
- package/dist/types-wLlwkSib.d.mts.map +1 -0
- package/dist/vitest.cjs +1 -1
- package/dist/vitest.mjs +1 -1
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace/index.mjs +1 -1
- package/dist/{workspace-BBa1Ck5j.mjs → workspace-DJjhfAGf.mjs} +3 -3
- package/dist/{workspace-BBa1Ck5j.mjs.map → workspace-DJjhfAGf.mjs.map} +1 -1
- package/dist/{workspace-DirP2-ed.cjs → workspace-wTLnc1Ef.cjs} +3 -3
- package/dist/{workspace-DirP2-ed.cjs.map → workspace-wTLnc1Ef.cjs.map} +1 -1
- package/package.json +16 -15
- package/dist/GoDaddyProvider-B9AMLUHF.cjs +0 -412
- package/dist/GoDaddyProvider-B9AMLUHF.cjs.map +0 -1
- package/dist/GoDaddyProvider-DLVKx7er.mjs +0 -412
- package/dist/GoDaddyProvider-DLVKx7er.mjs.map +0 -1
- package/dist/HostingerProvider-DBPWhL_s.cjs +0 -257
- package/dist/HostingerProvider-DBPWhL_s.cjs.map +0 -1
- package/dist/HostingerProvider-kLQsBCjz.mjs +0 -257
- package/dist/HostingerProvider-kLQsBCjz.mjs.map +0 -1
- package/dist/Route53Provider-Di_SD9CF.mjs +0 -209
- package/dist/Route53Provider-Di_SD9CF.mjs.map +0 -1
- package/dist/Route53Provider-emLuQHVw.cjs +0 -209
- package/dist/Route53Provider-emLuQHVw.cjs.map +0 -1
- package/dist/apps-DPw1i9E7.cjs.map +0 -1
- package/dist/apps-GDmO_v7v.mjs.map +0 -1
- package/dist/compose-BKLJMnDI.cjs.map +0 -1
- package/dist/compose-CE0Vi7zq.cjs.map +0 -1
- package/dist/compose-DH1ToGh2.mjs.map +0 -1
- package/dist/compose-pFnSi3Zf.mjs.map +0 -1
- package/dist/deploy-CpAkrZ25.mjs.map +0 -1
- package/dist/deploy-l0Vc846k.cjs.map +0 -1
- package/dist/destroy-DtAqmjGz.cjs.map +0 -1
- package/dist/destroy-eeB_PrmN.mjs.map +0 -1
- package/dist/dns-B2vsk2Rc.mjs.map +0 -1
- package/dist/dns-WneRa4VJ.cjs.map +0 -1
- package/dist/engine-BhS-wyH0.mjs.map +0 -1
- package/dist/engine-CaWo9tZO.cjs.map +0 -1
- package/dist/errors-DMC4Umsb.cjs.map +0 -1
- package/dist/snsSubscriptions-CATtZwGv.cjs.map +0 -1
- package/dist/snsSubscriptions-D9Rm_Eug.mjs.map +0 -1
- package/dist/stack-Dal2Oq2D.cjs.map +0 -1
- package/dist/stack-TttsEL7X.mjs.map +0 -1
- package/dist/types-Bj1A1wkS.d.mts.map +0 -1
- package/dist/types-CV4AzwC_.d.cts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iam-CGd_oEyz.cjs","names":["IamUserNotOwned","IAM_USER_PATH","s3Url","BucketKeySetElsewhere","RotationInProgress","AccessKeyLimit"],"sources":["../src/providers/s3/policy.ts","../src/providers/iam.ts"],"sourcesContent":["/**\n * The documents the `s3` provider writes: the user's inline policy, the\n * bucket's policy, its CORS rule and its public access block.\n *\n * Pure, so each is tested as JSON and compared with what AWS holds on every\n * run — a document that differs is drift, and is put back.\n */\n\n/** One IAM or bucket policy statement. */\nexport interface PolicyStatement {\n\tSid: string;\n\tEffect: 'Allow' | 'Deny';\n\tPrincipal?: '*' | { AWS: string | string[] } | { Service: string };\n\tAction: string | string[];\n\tResource: string | string[];\n\tCondition?: Record<string, Record<string, string | string[]>>;\n}\n\nexport interface PolicyDocument {\n\tVersion: '2012-10-17';\n\tStatement: PolicyStatement[];\n}\n\nconst bucketArn = (bucket: string) => `arn:aws:s3:::${bucket}`;\n\n/**\n * What the app's key may do: objects in this bucket, and listing it — and\n * nothing else in the account.\n *\n * Multipart uploads are in it because a presigned upload of a large file is\n * one, and an abandoned one is cleaned up by the app. Reading old versions is\n * added only when the bucket keeps them.\n */\nexport function userPolicy(\n\tbucket: string,\n\toptions: {\n\t\tversioning?: boolean;\n\t\t/**\n\t\t * The bucket's events topic, when a subscriber watches it: the worker\n\t\t * confirms the subscriptions the deploy made with this key, and does\n\t\t * nothing else to the topic.\n\t\t */\n\t\teventsTopicArn?: string;\n\t} = {},\n): PolicyDocument {\n\treturn {\n\t\tVersion: '2012-10-17',\n\t\tStatement: [\n\t\t\t{\n\t\t\t\tSid: 'GkmObjects',\n\t\t\t\tEffect: 'Allow',\n\t\t\t\tAction: [\n\t\t\t\t\t's3:GetObject',\n\t\t\t\t\t's3:PutObject',\n\t\t\t\t\t's3:DeleteObject',\n\t\t\t\t\t's3:AbortMultipartUpload',\n\t\t\t\t\t's3:ListMultipartUploadParts',\n\t\t\t\t\t...(options.versioning ? ['s3:GetObjectVersion'] : []),\n\t\t\t\t],\n\t\t\t\tResource: `${bucketArn(bucket)}/*`,\n\t\t\t},\n\t\t\t{\n\t\t\t\tSid: 'GkmBucket',\n\t\t\t\tEffect: 'Allow',\n\t\t\t\tAction: [\n\t\t\t\t\t's3:ListBucket',\n\t\t\t\t\t's3:GetBucketLocation',\n\t\t\t\t\t's3:ListBucketMultipartUploads',\n\t\t\t\t],\n\t\t\t\tResource: bucketArn(bucket),\n\t\t\t},\n\t\t\t...(options.eventsTopicArn\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tSid: 'GkmEvents',\n\t\t\t\t\t\t\tEffect: 'Allow' as const,\n\t\t\t\t\t\t\tAction: 'sns:ConfirmSubscription',\n\t\t\t\t\t\t\tResource: options.eventsTopicArn,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t],\n\t};\n}\n\n/**\n * One open pattern as the resource it is public on. A `**` is S3's `*`; a\n * single `*` is too, which crosses `/` where the construct's own check does\n * not — the construct is the stricter of the two (see `bucketPolicy` in\n * reconcile, which the local MinIO is given the same way).\n */\nexport function openResource(bucket: string, pattern: string): string {\n\tconst path = pattern.replace(/^\\/+/, '').replace(/\\*\\*/g, '*');\n\treturn `${bucketArn(bucket)}/${path}`;\n}\n\n/**\n * The bucket's own policy: every request refused unless it came over TLS,\n * and — only when a file server opens paths on it — `s3:GetObject` on\n * exactly those prefixes: to anyone, or, when a CDN serves them, to\n * CloudFront alone, for exactly the stage's distributions. Behind a CDN the\n * bucket is never public: a key outside the open prefixes is refused to\n * CloudFront too, so the edge answers it 403.\n */\nexport function bucketPolicy(\n\tbucket: string,\n\topen: readonly string[] = [],\n\toptions: {\n\t\tcdn?: { distributionArns: readonly string[] };\n\t\t/**\n\t\t * SES may write received mail under this prefix — the bucket an inbox\n\t\t * owns — and only for this account's receipt rules.\n\t\t */\n\t\tsesWrite?: { prefix: string; account: string };\n\t} = {},\n): PolicyDocument {\n\tconst statements: PolicyStatement[] = [\n\t\t{\n\t\t\tSid: 'GkmDenyInsecureTransport',\n\t\t\tEffect: 'Deny',\n\t\t\tPrincipal: '*',\n\t\t\tAction: 's3:*',\n\t\t\tResource: [bucketArn(bucket), `${bucketArn(bucket)}/*`],\n\t\t\tCondition: { Bool: { 'aws:SecureTransport': 'false' } },\n\t\t},\n\t];\n\tconst resources = [\n\t\t...new Set(open.map((p) => openResource(bucket, p))),\n\t].sort();\n\tif (open.length > 0 && options.cdn) {\n\t\tstatements.push({\n\t\t\tSid: 'GkmCdnRead',\n\t\t\tEffect: 'Allow',\n\t\t\tPrincipal: { Service: 'cloudfront.amazonaws.com' },\n\t\t\tAction: 's3:GetObject',\n\t\t\tResource: resources,\n\t\t\tCondition: {\n\t\t\t\tStringEquals: {\n\t\t\t\t\t'AWS:SourceArn': [...new Set(options.cdn.distributionArns)].sort(),\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\t} else if (open.length > 0) {\n\t\tstatements.push({\n\t\t\tSid: 'GkmOpenPaths',\n\t\t\tEffect: 'Allow',\n\t\t\tPrincipal: '*',\n\t\t\tAction: 's3:GetObject',\n\t\t\tResource: resources,\n\t\t});\n\t}\n\tif (options.sesWrite) {\n\t\tstatements.push({\n\t\t\tSid: 'GkmSesWritesMail',\n\t\t\tEffect: 'Allow',\n\t\t\tPrincipal: { Service: 'ses.amazonaws.com' },\n\t\t\tAction: 's3:PutObject',\n\t\t\tResource: `${bucketArn(bucket)}/${options.sesWrite.prefix}*`,\n\t\t\tCondition: {\n\t\t\t\tStringEquals: { 'aws:SourceAccount': options.sesWrite.account },\n\t\t\t},\n\t\t});\n\t}\n\treturn { Version: '2012-10-17', Statement: statements };\n}\n\n/**\n * Block Public Access. All four flags on, unless the bucket has open paths:\n * then a *policy* may make it public (`BlockPublicPolicy`,\n * `RestrictPublicBuckets` off), and ACLs still may not.\n */\nexport function publicAccessBlock(open: boolean): {\n\tBlockPublicAcls: boolean;\n\tIgnorePublicAcls: boolean;\n\tBlockPublicPolicy: boolean;\n\tRestrictPublicBuckets: boolean;\n} {\n\treturn {\n\t\tBlockPublicAcls: true,\n\t\tIgnorePublicAcls: true,\n\t\tBlockPublicPolicy: !open,\n\t\tRestrictPublicBuckets: !open,\n\t};\n}\n\n/** The one CORS rule: browsers on the stage's sites upload and read. */\nexport interface CorsRule {\n\tAllowedMethods: string[];\n\tAllowedOrigins: string[];\n\tAllowedHeaders: string[];\n\tExposeHeaders: string[];\n\tMaxAgeSeconds: number;\n}\n\nexport function corsRule(origins: readonly string[]): CorsRule {\n\treturn {\n\t\tAllowedMethods: ['GET', 'HEAD', 'POST', 'PUT'],\n\t\tAllowedOrigins: [...new Set(origins)].sort(),\n\t\tAllowedHeaders: ['*'],\n\t\tExposeHeaders: ['ETag'],\n\t\tMaxAgeSeconds: 3000,\n\t};\n}\n\n/**\n * A policy document in one canonical form — keys sorted, a lone string a\n * one-element list, lists sorted — so one AWS reformatted reads as the same\n * document rather than as drift.\n */\nexport function canonicalPolicy(value: unknown): string {\n\treturn JSON.stringify(canonical(value));\n}\n\nfunction canonical(value: unknown, key?: string): unknown {\n\tif (Array.isArray(value)) {\n\t\tconst items = value.map((v) => canonical(v));\n\t\treturn key === 'Statement'\n\t\t\t? items\n\t\t\t: items.map((v) => JSON.stringify(v)).sort();\n\t}\n\tif (value && typeof value === 'object') {\n\t\treturn Object.fromEntries(\n\t\t\tObject.keys(value)\n\t\t\t\t.sort()\n\t\t\t\t.map((k) => {\n\t\t\t\t\tconst v = (value as Record<string, unknown>)[k];\n\t\t\t\t\tconst listy =\n\t\t\t\t\t\tk === 'Action' ||\n\t\t\t\t\t\tk === 'Resource' ||\n\t\t\t\t\t\tk === 'AWS' ||\n\t\t\t\t\t\tk === 'AWS:SourceArn'\n\t\t\t\t\t\t\t? Array.isArray(v)\n\t\t\t\t\t\t\t\t? v\n\t\t\t\t\t\t\t\t: [v]\n\t\t\t\t\t\t\t: v;\n\t\t\t\t\treturn [k, canonical(listy, k)];\n\t\t\t\t}),\n\t\t);\n\t}\n\treturn value;\n}\n","/**\n * An IAM user gkm creates for one thing on a stage, its inline policy, and\n * the access key written into the stage's secrets — as an `s3://` URL for\n * what the `s3` provider gives each bucket and the deploy gives a stage's\n * backups, as an `smtp://` one for the `ses` mail provider.\n *\n * - **The user** is under `/gkm/`, tagged with the deploy identity, the stage\n * and what it is for. One that exists without those tags is someone\n * else's, and is refused rather than taken over.\n * - **Its policy** is read on every run and put back when it drifted.\n * - **Its key**: one, written into the stage's secrets the moment IAM shows\n * its secret. `--rotate-keys` issues a successor and keeps the old one\n * active until the stage has deployed with the new one; the next run after\n * that — or `--retire-old-keys` — deletes it.\n * - **A new key** takes IAM seconds to become usable: the state records when\n * it was issued, and a check made with it waits that out\n * ({@link whileKeyIsNew}).\n */\n\nimport * as s3Url from '@geekmidas/storage/s3-url';\nimport type { ResourceRecord } from '../deploy/StateStore.js';\nimport {\n\tAccessKeyLimit,\n\tBucketKeySetElsewhere,\n\tIamUserNotOwned,\n\tRotationInProgress,\n} from './s3/errors.js';\nimport { IAM_USER_PATH } from './s3/naming.js';\nimport { canonicalPolicy } from './s3/policy.js';\nimport type { EnsureContext, ProviderConfig, StateEntry } from './types.js';\n\ntype IamModule = typeof import('@aws-sdk/client-iam');\n\n/** The tags gkm finds its own buckets and users by. */\nexport const TAG_PROJECT = 'gkm:project';\nexport const TAG_STAGE = 'gkm:stage';\nexport const TAG_CONSTRUCT = 'gkm:construct';\n\n/** What creating a user and its key is done through. */\nexport interface IamClients {\n\tIAM: IamModule;\n\tiam: InstanceType<IamModule['IAMClient']>;\n\t/** The region the key's URL names. */\n\tregion: string;\n\t/** An emulator's endpoint, written into the URL when there is one. */\n\tendpoint?: string;\n}\n\n/** What creating a user and its key reads from a provisioning run. */\nexport type KeyContext = Pick<\n\tEnsureContext<ProviderConfig, unknown>,\n\t| 'identity'\n\t| 'stage'\n\t| 'state'\n\t| 'change'\n\t| 'dryRun'\n\t| 'secrets'\n\t| 'writeSecrets'\n\t| 'rotateKeys'\n\t| 'retireOldKeys'\n\t| 'log'\n>;\n\n/** The keys gkm tags a bucket and a user with. */\nexport function identityTags(\n\tctx: Pick<KeyContext, 'identity' | 'stage'>,\n\tid: string,\n) {\n\treturn [\n\t\t{ Key: TAG_PROJECT, Value: ctx.identity.key },\n\t\t{ Key: TAG_STAGE, Value: ctx.stage },\n\t\t{ Key: TAG_CONSTRUCT, Value: id },\n\t];\n}\n\n/** A read whose \"there is none\" answer is one of `missing`. */\nasync function readOr<T>(\n\tread: () => Promise<T>,\n\tmissing: readonly string[],\n): Promise<T | undefined> {\n\ttry {\n\t\treturn await read();\n\t} catch (error) {\n\t\tconst e = error as { name?: string; Code?: string };\n\t\tif (missing.includes(e?.Code ?? e?.name ?? '')) return undefined;\n\t\tthrow error;\n\t}\n}\n\n/** IAM returns a policy document URL-encoded; an emulator may not. */\nfunction decodePolicy(document: string): string {\n\ttry {\n\t\treturn decodeURIComponent(document);\n\t} catch {\n\t\treturn document;\n\t}\n}\n\nexport interface IamUserInput {\n\t/** What it is for: a bucket construct's id, or `backups`. */\n\tid: string;\n\t/** `gkm-<project>-<stage>-<id>`. */\n\tuser: string;\n\t/** The inline policy's name. */\n\tpolicyName: string;\n\tpolicy: object;\n\t/** The policy's change line: `this bucket only`. */\n\tdescribe: string;\n}\n\n/**\n * The user and its inline policy: found — and refused when it is not this\n * stage's — or created, and the policy put back when it drifted.\n *\n * @throws {IamUserNotOwned}\n */\nexport async function ensureIamUser(\n\tctx: KeyContext,\n\tclients: IamClients,\n\tinput: IamUserInput,\n): Promise<{ user: string; exists: boolean }> {\n\tconst { IAM, iam } = clients;\n\tconst { id, user, policy } = input;\n\tconst entry: StateEntry = { key: `iam-user:${id}`, type: 'iam-user' };\n\tconst found = await readOr(\n\t\t() => iam.send(new IAM.GetUserCommand({ UserName: user })),\n\t\t['NoSuchEntity', 'NoSuchEntityException'],\n\t);\n\n\tif (found?.User) {\n\t\tconst tags = await iam.send(\n\t\t\tnew IAM.ListUserTagsCommand({ UserName: user }),\n\t\t);\n\t\tconst tag = (key: string) => tags.Tags?.find((t) => t.Key === key)?.Value;\n\t\tif (\n\t\t\tfound.User.Path !== IAM_USER_PATH ||\n\t\t\ttag(TAG_PROJECT) !== ctx.identity.key ||\n\t\t\ttag(TAG_STAGE) !== ctx.stage\n\t\t) {\n\t\t\tthrow new IamUserNotOwned(user, ctx.identity.key, ctx.stage);\n\t\t}\n\t\tawait ctx.state.ready(entry, user);\n\t} else {\n\t\tawait ctx.change(\n\t\t\t{\n\t\t\t\tconstruct: id,\n\t\t\t\tresource: `IAM user ${user}`,\n\t\t\t\tchange: `create under ${IAM_USER_PATH}`,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tawait ctx.state.pending(entry);\n\t\t\t\tawait iam.send(\n\t\t\t\t\tnew IAM.CreateUserCommand({\n\t\t\t\t\t\tUserName: user,\n\t\t\t\t\t\tPath: IAM_USER_PATH,\n\t\t\t\t\t\tTags: identityTags(ctx, id),\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\tawait ctx.state.ready(entry, user);\n\t\t\t},\n\t\t);\n\t}\n\n\tconst exists = Boolean(found?.User) || !ctx.dryRun;\n\tconst current = exists\n\t\t? await readOr(\n\t\t\t\t() =>\n\t\t\t\t\tiam.send(\n\t\t\t\t\t\tnew IAM.GetUserPolicyCommand({\n\t\t\t\t\t\t\tUserName: user,\n\t\t\t\t\t\t\tPolicyName: input.policyName,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t['NoSuchEntity', 'NoSuchEntityException'],\n\t\t\t)\n\t\t: undefined;\n\tconst document = current?.PolicyDocument\n\t\t? JSON.parse(decodePolicy(current.PolicyDocument))\n\t\t: undefined;\n\tif (!document || canonicalPolicy(document) !== canonicalPolicy(policy)) {\n\t\tawait ctx.change(\n\t\t\t{\n\t\t\t\tconstruct: id,\n\t\t\t\tresource: `IAM user ${user}`,\n\t\t\t\tchange: `policy ${input.policyName}: ${input.describe}`,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tawait iam.send(\n\t\t\t\t\tnew IAM.PutUserPolicyCommand({\n\t\t\t\t\t\tUserName: user,\n\t\t\t\t\t\tPolicyName: input.policyName,\n\t\t\t\t\t\tPolicyDocument: JSON.stringify(policy),\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t},\n\t\t);\n\t}\n\treturn { user, exists };\n}\n\n/**\n * The secret a user's access key is written into, and how: an `s3://` URL\n * for a bucket ({@link s3KeySecret}), an `smtp://` one for mail.\n */\nexport interface KeySecret {\n\t/** The secret's key: `UPLOADS_URL`, `BACKUPS_URL`, `MAIL_URL`. */\n\tkey: string;\n\t/**\n\t * The access key a stored value holds — or `undefined` when it holds\n\t * none this user could have issued for it, so a new one is.\n\t *\n\t * @throws when the value is another resource's, set by hand\n\t */\n\tkeyIdOf(value: string): string | undefined;\n\t/** The value for a newly issued key. */\n\tvalue(accessKeyId: string, secretAccessKey: string): string;\n\t/**\n\t * A value holding the right key whose address drifted: what it should\n\t * be, and the change line. `undefined` when it is right.\n\t */\n\trepair?(value: string): { value: string; change: string } | undefined;\n}\n\n/**\n * A bucket's URL as a key's secret: `s3://KEY:SECRET@bucket?region=…`.\n *\n * @throws {BucketKeySetElsewhere} from `keyIdOf`, when the URL names another bucket\n */\nexport function s3KeySecret(\n\tctx: Pick<KeyContext, 'stage'>,\n\tclients: Pick<IamClients, 'region' | 'endpoint'>,\n\tinput: { bucket: string; urlKey: string },\n): KeySecret {\n\tconst { bucket, urlKey } = input;\n\tconst parse = (value: string) => {\n\t\tlet parsed: s3Url.S3Address | undefined;\n\t\ttry {\n\t\t\tparsed = s3Url.parse(value);\n\t\t} catch {\n\t\t\tparsed = undefined;\n\t\t}\n\t\tif (parsed?.bucket !== bucket) {\n\t\t\tthrow new BucketKeySetElsewhere(\n\t\t\t\turlKey,\n\t\t\t\tbucket,\n\t\t\t\tparsed?.bucket ?? value.replace(/\\/\\/[^@]*@/, '//'),\n\t\t\t\tctx.stage,\n\t\t\t);\n\t\t}\n\t\treturn parsed;\n\t};\n\treturn {\n\t\tkey: urlKey,\n\t\tkeyIdOf: (value) => parse(value).accessKeyId,\n\t\tvalue: (accessKeyId, secretAccessKey) =>\n\t\t\ts3Url.build({\n\t\t\t\tbucket,\n\t\t\t\tregion: clients.region,\n\t\t\t\t...(clients.endpoint\n\t\t\t\t\t? { endpoint: clients.endpoint, forcePathStyle: true }\n\t\t\t\t\t: {}),\n\t\t\t\taccessKeyId,\n\t\t\t\tsecretAccessKey,\n\t\t\t}),\n\t\trepair(value) {\n\t\t\t// The key is good; the address must name where the bucket is.\n\t\t\tconst address = parse(value);\n\t\t\tif (address.region === clients.region) return undefined;\n\t\t\treturn {\n\t\t\t\tvalue: s3Url.build({ ...address, region: clients.region }),\n\t\t\t\tchange: `name ${clients.region}, the bucket's region (it said ${address.region ?? 'none'})`,\n\t\t\t};\n\t\t},\n\t};\n}\n\nexport interface AccessKeyInput {\n\t/** What it is for, as {@link IamUserInput.id}. */\n\tid: string;\n\tuser: string;\n\t/** Whether the user exists yet — false in a dry run that would create it. */\n\texists: boolean;\n\t/** Where the key is written. */\n\tsecret: KeySecret;\n}\n\n/**\n * The user's access key, in the stage's secrets as `secret` writes it.\n *\n * - First run: one key, written into the stage's secrets.\n * - `--rotate-keys`: a second key, written in place of the first; the first\n * stays active until the stage has deployed with the second, and the next\n * run after that deploy — or `--retire-old-keys` — deletes it.\n * - A key the secrets no longer hold (a store emptied by hand): replaced the\n * same way, since its secret cannot be read back.\n *\n * @throws whatever `secret.keyIdOf` throws for a value set elsewhere\n * @throws {RotationInProgress} on `--rotate-keys` with the last rotation's old key still active\n * @throws {AccessKeyLimit} when the user has two keys gkm did not record\n */\nexport async function ensureAccessKey(\n\tctx: KeyContext,\n\tclients: IamClients,\n\tinput: AccessKeyInput,\n): Promise<void> {\n\tconst { IAM, iam } = clients;\n\tconst { id, user, secret } = input;\n\tconst entryKey = `iam-access-key:${id}`;\n\tconst record = ctx.state.record(entryKey);\n\n\tconst given = ctx.secrets[secret.key];\n\tconst inUrl = given !== undefined ? secret.keyIdOf(given) : undefined;\n\n\tconst listed = input.exists\n\t\t? ((\n\t\t\t\tawait iam.send(new IAM.ListAccessKeysCommand({ UserName: user }))\n\t\t\t).AccessKeyMetadata?.map((k) => k.AccessKeyId!) ?? [])\n\t\t: [];\n\n\tlet current = record?.status === 'ready' ? record.id : undefined;\n\tlet previous =\n\t\ttypeof record?.data?.previous === 'string'\n\t\t\t? record.data.previous\n\t\t\t: undefined;\n\tconst rotatedAt =\n\t\ttypeof record?.data?.rotatedAt === 'string'\n\t\t\t? record.data.rotatedAt\n\t\t\t: undefined;\n\tconst entry = (data: Record<string, unknown> = {}): StateEntry => ({\n\t\tkey: entryKey,\n\t\ttype: 'iam-access-key',\n\t\tdata: { user, ...data },\n\t});\n\n\t// The old key of a rotation: deleted once the stage deployed after it.\n\tif (previous && current) {\n\t\tconst deployed =\n\t\t\trotatedAt !== undefined &&\n\t\t\tctx.state.lastDeployedAt !== undefined &&\n\t\t\tctx.state.lastDeployedAt > rotatedAt;\n\t\tif (ctx.retireOldKeys || deployed) {\n\t\t\tconst old = previous;\n\t\t\tconst keep = current;\n\t\t\tawait ctx.change(\n\t\t\t\t{\n\t\t\t\t\tconstruct: id,\n\t\t\t\t\tresource: `IAM user ${user}`,\n\t\t\t\t\tchange: `delete the rotated-out access key ${old}`,\n\t\t\t\t},\n\t\t\t\tasync () => {\n\t\t\t\t\tif (listed.includes(old)) {\n\t\t\t\t\t\tawait iam.send(\n\t\t\t\t\t\t\tnew IAM.DeleteAccessKeyCommand({\n\t\t\t\t\t\t\t\tUserName: user,\n\t\t\t\t\t\t\t\tAccessKeyId: old,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tawait ctx.state.ready(entry(), keep);\n\t\t\t\t},\n\t\t\t);\n\t\t\tprevious = undefined;\n\t\t} else {\n\t\t\tctx.log(\n\t\t\t\t` ${id}: the old access key ${previous} stays active until '${ctx.stage}' is deployed with the new one; the next deploy after that deletes it (or pass --retire-old-keys)`,\n\t\t\t);\n\t\t}\n\t}\n\n\t// No record, and the secrets hold a key of this user's: adopt it.\n\tif (!current && inUrl && listed.includes(inUrl)) {\n\t\tawait ctx.state.ready(entry(), inUrl);\n\t\tcurrent = inUrl;\n\t}\n\n\tconst valid =\n\t\tcurrent !== undefined && listed.includes(current) && inUrl === current;\n\tif (valid && !ctx.rotateKeys) {\n\t\tconst repaired = given !== undefined ? secret.repair?.(given) : undefined;\n\t\tif (repaired) {\n\t\t\tawait ctx.change(\n\t\t\t\t{ construct: id, resource: secret.key, change: repaired.change },\n\t\t\t\t() => ctx.writeSecrets({ [secret.key]: repaired.value }),\n\t\t\t);\n\t\t}\n\t\treturn;\n\t}\n\tif (ctx.rotateKeys && previous) {\n\t\tthrow new RotationInProgress(id, previous, ctx.stage);\n\t}\n\n\tconst outgoing = current && listed.includes(current) ? current : undefined;\n\tif (listed.length >= 2) throw new AccessKeyLimit(user, listed);\n\n\tconst why = !current\n\t\t? 'create an access key'\n\t\t: ctx.rotateKeys\n\t\t\t? 'rotate: issue a new access key'\n\t\t\t: 'issue a new access key (the secrets no longer hold the recorded one)';\n\tawait ctx.change(\n\t\t{ construct: id, resource: `IAM user ${user}`, change: why },\n\t\tasync () => {\n\t\t\tawait ctx.state.pending(entry(outgoing ? { previous: outgoing } : {}));\n\t\t\tconst created = await iam.send(\n\t\t\t\tnew IAM.CreateAccessKeyCommand({ UserName: user }),\n\t\t\t);\n\t\t\tconst key = created.AccessKey!;\n\t\t\t// Into the stage's secrets before anything else: IAM shows a secret\n\t\t\t// once, and a key whose secret is lost is a key to replace.\n\t\t\tawait ctx.writeSecrets({\n\t\t\t\t[secret.key]: secret.value(key.AccessKeyId!, key.SecretAccessKey!),\n\t\t\t});\n\t\t\t// When it was issued: IAM takes seconds to make a new key usable,\n\t\t\t// and the deploy's check waits for one this young.\n\t\t\tconst issuedAt = new Date().toISOString();\n\t\t\tawait ctx.state.ready(\n\t\t\t\tentry(\n\t\t\t\t\toutgoing\n\t\t\t\t\t\t? { previous: outgoing, rotatedAt: issuedAt, issuedAt }\n\t\t\t\t\t\t: { issuedAt },\n\t\t\t\t),\n\t\t\t\tkey.AccessKeyId!,\n\t\t\t);\n\t\t},\n\t);\n\tif (outgoing) {\n\t\tctx.log(\n\t\t\t` ${secret.key} holds the new key. This deploy moves '${ctx.stage}' onto it; the next deploy after it deletes the old key ${outgoing}`,\n\t\t);\n\t}\n}\n\n/** How long a key issued this recently counts as new to IAM. */\nconst NEW_KEY_WINDOW_MS = 10 * 60 * 1000;\n\n/** The waits between asks while a new key becomes usable: about a minute. */\nlet newKeyWaits: readonly number[] = [2000, 4000, 8000, 15000, 15000, 15000];\n\n/** For tests: the waits for a new key. Returns the old ones. */\nexport function useNewKeyWaits(waits: readonly number[]): readonly number[] {\n\tconst previous = newKeyWaits;\n\tnewKeyWaits = waits;\n\treturn previous;\n}\n\n/**\n * When the key in a URL was issued, if the stage's state says it was just\n * now — the record of `id`'s key naming that very key.\n */\nexport function issuedJustNow(\n\tresources: Readonly<Record<string, ResourceRecord>> | undefined,\n\tid: string,\n\taccessKeyId: string,\n): string | undefined {\n\tconst record = resources?.[`iam-access-key:${id}`];\n\tconst issuedAt = record?.data?.issuedAt;\n\tif (record?.id !== accessKeyId || typeof issuedAt !== 'string') {\n\t\treturn undefined;\n\t}\n\tconst age = Date.now() - Date.parse(issuedAt);\n\treturn age >= 0 && age < NEW_KEY_WINDOW_MS ? issuedAt : undefined;\n}\n\n/**\n * `ask` again, for about a minute, while it is `refused` and the key was\n * issued just now — IAM refuses a key for seconds after making it. Returns\n * the last answer and how long was waited.\n */\nexport async function whileKeyIsNew<T>(\n\tfirst: T,\n\toptions: {\n\t\tissuedAt: string | undefined;\n\t\trefused: (answer: T) => boolean;\n\t\task: () => Promise<T>;\n\t\t/** Said once, before the first wait. */\n\t\tonWait?: () => void;\n\t},\n): Promise<{ answer: T; waited: number }> {\n\tlet answer = first;\n\tlet waited = 0;\n\tif (!options.issuedAt || !options.refused(answer)) return { answer, waited };\n\toptions.onWait?.();\n\tfor (const wait of newKeyWaits) {\n\t\tawait new Promise((resolve) => setTimeout(resolve, wait));\n\t\twaited += wait;\n\t\tanswer = await options.ask();\n\t\tif (!options.refused(answer)) break;\n\t}\n\treturn { answer, waited };\n}\n"],"mappings":";;;;;AAuBA,MAAM,aAAa,WAAmB,gBAAgB;;;;;;;;;AAUtD,SAAgB,WACf,QACA,UAQI,CAAC,GACY;CACjB,OAAO;EACN,SAAS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I,SAAS;CACb,IAAI,CAAC,QAAQ,YAAY,CAAC,QAAQ,QAAQ,MAAM,GAAG,OAAO;EAAE;EAAQ;CAAO;CAC3E,QAAQ,SAAS;CACjB,KAAK,MAAM,QAAQ,aAAa;EAC/B,MAAM,IAAI,SAAS,YAAY,WAAW,SAAS,IAAI,CAAC;EACxD,UAAU;EACV,SAAS,MAAM,QAAQ,IAAI;EAC3B,IAAI,CAAC,QAAQ,QAAQ,MAAM,GAAG;CAC/B;CACA,OAAO;EAAE;EAAQ;CAAO;AACzB"}
|
|
1
|
+
{"version":3,"file":"iam-WIoKnLBp.cjs","names":["IamUserNotOwned","IAM_USER_PATH","s3Url","BucketKeySetElsewhere","RotationInProgress","AccessKeyLimit"],"sources":["../src/providers/s3/policy.ts","../src/providers/iam.ts"],"sourcesContent":["/**\n * The documents the `s3` provider writes: the user's inline policy, the\n * bucket's policy, its CORS rule and its public access block.\n *\n * Pure, so each is tested as JSON and compared with what AWS holds on every\n * run — a document that differs is drift, and is put back.\n */\n\n/** One IAM or bucket policy statement. */\nexport interface PolicyStatement {\n\tSid: string;\n\tEffect: 'Allow' | 'Deny';\n\tPrincipal?: '*' | { AWS: string | string[] } | { Service: string };\n\tAction: string | string[];\n\tResource: string | string[];\n\tCondition?: Record<string, Record<string, string | string[]>>;\n}\n\nexport interface PolicyDocument {\n\tVersion: '2012-10-17';\n\tStatement: PolicyStatement[];\n}\n\nconst bucketArn = (bucket: string) => `arn:aws:s3:::${bucket}`;\n\n/**\n * What the app's key may do: objects in this bucket, and listing it — and\n * nothing else in the account.\n *\n * Multipart uploads are in it because a presigned upload of a large file is\n * one, and an abandoned one is cleaned up by the app. Reading old versions is\n * added only when the bucket keeps them.\n */\nexport function userPolicy(\n\tbucket: string,\n\toptions: {\n\t\tversioning?: boolean;\n\t\t/**\n\t\t * The bucket's events topic, when a subscriber watches it: the worker\n\t\t * confirms the subscriptions the deploy made with this key, and does\n\t\t * nothing else to the topic.\n\t\t */\n\t\teventsTopicArn?: string;\n\t} = {},\n): PolicyDocument {\n\treturn {\n\t\tVersion: '2012-10-17',\n\t\tStatement: [\n\t\t\t{\n\t\t\t\tSid: 'GkmObjects',\n\t\t\t\tEffect: 'Allow',\n\t\t\t\tAction: [\n\t\t\t\t\t's3:GetObject',\n\t\t\t\t\t's3:PutObject',\n\t\t\t\t\t's3:DeleteObject',\n\t\t\t\t\t's3:AbortMultipartUpload',\n\t\t\t\t\t's3:ListMultipartUploadParts',\n\t\t\t\t\t...(options.versioning ? ['s3:GetObjectVersion'] : []),\n\t\t\t\t],\n\t\t\t\tResource: `${bucketArn(bucket)}/*`,\n\t\t\t},\n\t\t\t{\n\t\t\t\tSid: 'GkmBucket',\n\t\t\t\tEffect: 'Allow',\n\t\t\t\tAction: [\n\t\t\t\t\t's3:ListBucket',\n\t\t\t\t\t's3:GetBucketLocation',\n\t\t\t\t\t's3:ListBucketMultipartUploads',\n\t\t\t\t],\n\t\t\t\tResource: bucketArn(bucket),\n\t\t\t},\n\t\t\t...(options.eventsTopicArn\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tSid: 'GkmEvents',\n\t\t\t\t\t\t\tEffect: 'Allow' as const,\n\t\t\t\t\t\t\tAction: 'sns:ConfirmSubscription',\n\t\t\t\t\t\t\tResource: options.eventsTopicArn,\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t: []),\n\t\t],\n\t};\n}\n\n/**\n * One open pattern as the resource it is public on. A `**` is S3's `*`; a\n * single `*` is too, which crosses `/` where the construct's own check does\n * not — the construct is the stricter of the two (see `bucketPolicy` in\n * reconcile, which the local MinIO is given the same way).\n */\nexport function openResource(bucket: string, pattern: string): string {\n\tconst path = pattern.replace(/^\\/+/, '').replace(/\\*\\*/g, '*');\n\treturn `${bucketArn(bucket)}/${path}`;\n}\n\n/**\n * The bucket's own policy: every request refused unless it came over TLS,\n * and — only when a file server opens paths on it — `s3:GetObject` on\n * exactly those prefixes: to anyone, or, when a CDN serves them, to\n * CloudFront alone, for exactly the stage's distributions. Behind a CDN the\n * bucket is never public: a key outside the open prefixes is refused to\n * CloudFront too, so the edge answers it 403.\n */\nexport function bucketPolicy(\n\tbucket: string,\n\topen: readonly string[] = [],\n\toptions: {\n\t\tcdn?: { distributionArns: readonly string[] };\n\t\t/**\n\t\t * SES may write received mail under this prefix — the bucket an inbox\n\t\t * owns — and only for this account's receipt rules.\n\t\t */\n\t\tsesWrite?: { prefix: string; account: string };\n\t} = {},\n): PolicyDocument {\n\tconst statements: PolicyStatement[] = [\n\t\t{\n\t\t\tSid: 'GkmDenyInsecureTransport',\n\t\t\tEffect: 'Deny',\n\t\t\tPrincipal: '*',\n\t\t\tAction: 's3:*',\n\t\t\tResource: [bucketArn(bucket), `${bucketArn(bucket)}/*`],\n\t\t\tCondition: { Bool: { 'aws:SecureTransport': 'false' } },\n\t\t},\n\t];\n\tconst resources = [\n\t\t...new Set(open.map((p) => openResource(bucket, p))),\n\t].sort();\n\tif (open.length > 0 && options.cdn) {\n\t\tstatements.push({\n\t\t\tSid: 'GkmCdnRead',\n\t\t\tEffect: 'Allow',\n\t\t\tPrincipal: { Service: 'cloudfront.amazonaws.com' },\n\t\t\tAction: 's3:GetObject',\n\t\t\tResource: resources,\n\t\t\tCondition: {\n\t\t\t\tStringEquals: {\n\t\t\t\t\t'AWS:SourceArn': [...new Set(options.cdn.distributionArns)].sort(),\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\t} else if (open.length > 0) {\n\t\tstatements.push({\n\t\t\tSid: 'GkmOpenPaths',\n\t\t\tEffect: 'Allow',\n\t\t\tPrincipal: '*',\n\t\t\tAction: 's3:GetObject',\n\t\t\tResource: resources,\n\t\t});\n\t}\n\tif (options.sesWrite) {\n\t\tstatements.push({\n\t\t\tSid: 'GkmSesWritesMail',\n\t\t\tEffect: 'Allow',\n\t\t\tPrincipal: { Service: 'ses.amazonaws.com' },\n\t\t\tAction: 's3:PutObject',\n\t\t\tResource: `${bucketArn(bucket)}/${options.sesWrite.prefix}*`,\n\t\t\tCondition: {\n\t\t\t\tStringEquals: { 'aws:SourceAccount': options.sesWrite.account },\n\t\t\t},\n\t\t});\n\t}\n\treturn { Version: '2012-10-17', Statement: statements };\n}\n\n/**\n * Block Public Access. All four flags on, unless the bucket has open paths:\n * then a *policy* may make it public (`BlockPublicPolicy`,\n * `RestrictPublicBuckets` off), and ACLs still may not.\n */\nexport function publicAccessBlock(open: boolean): {\n\tBlockPublicAcls: boolean;\n\tIgnorePublicAcls: boolean;\n\tBlockPublicPolicy: boolean;\n\tRestrictPublicBuckets: boolean;\n} {\n\treturn {\n\t\tBlockPublicAcls: true,\n\t\tIgnorePublicAcls: true,\n\t\tBlockPublicPolicy: !open,\n\t\tRestrictPublicBuckets: !open,\n\t};\n}\n\n/** The one CORS rule: browsers on the stage's sites upload and read. */\nexport interface CorsRule {\n\tAllowedMethods: string[];\n\tAllowedOrigins: string[];\n\tAllowedHeaders: string[];\n\tExposeHeaders: string[];\n\tMaxAgeSeconds: number;\n}\n\nexport function corsRule(origins: readonly string[]): CorsRule {\n\treturn {\n\t\tAllowedMethods: ['GET', 'HEAD', 'POST', 'PUT'],\n\t\tAllowedOrigins: [...new Set(origins)].sort(),\n\t\tAllowedHeaders: ['*'],\n\t\tExposeHeaders: ['ETag'],\n\t\tMaxAgeSeconds: 3000,\n\t};\n}\n\n/**\n * A policy document in one canonical form — keys sorted, a lone string a\n * one-element list, lists sorted — so one AWS reformatted reads as the same\n * document rather than as drift.\n */\nexport function canonicalPolicy(value: unknown): string {\n\treturn JSON.stringify(canonical(value));\n}\n\nfunction canonical(value: unknown, key?: string): unknown {\n\tif (Array.isArray(value)) {\n\t\tconst items = value.map((v) => canonical(v));\n\t\treturn key === 'Statement'\n\t\t\t? items\n\t\t\t: items.map((v) => JSON.stringify(v)).sort();\n\t}\n\tif (value && typeof value === 'object') {\n\t\treturn Object.fromEntries(\n\t\t\tObject.keys(value)\n\t\t\t\t.sort()\n\t\t\t\t.map((k) => {\n\t\t\t\t\tconst v = (value as Record<string, unknown>)[k];\n\t\t\t\t\tconst listy =\n\t\t\t\t\t\tk === 'Action' ||\n\t\t\t\t\t\tk === 'Resource' ||\n\t\t\t\t\t\tk === 'AWS' ||\n\t\t\t\t\t\tk === 'AWS:SourceArn'\n\t\t\t\t\t\t\t? Array.isArray(v)\n\t\t\t\t\t\t\t\t? v\n\t\t\t\t\t\t\t\t: [v]\n\t\t\t\t\t\t\t: v;\n\t\t\t\t\treturn [k, canonical(listy, k)];\n\t\t\t\t}),\n\t\t);\n\t}\n\treturn value;\n}\n","/**\n * An IAM user gkm creates for one thing on a stage, its inline policy, and\n * the access key written into the stage's secrets — as an `s3://` URL for\n * what the `s3` provider gives each bucket and the deploy gives a stage's\n * backups, as an `smtp://` one for the `ses` mail provider.\n *\n * - **The user** is under `/gkm/`, tagged with the deploy identity, the stage\n * and what it is for. One that exists without those tags is someone\n * else's, and is refused rather than taken over.\n * - **Its policy** is read on every run and put back when it drifted.\n * - **Its key**: one, written into the stage's secrets the moment IAM shows\n * its secret. `--rotate-keys` issues a successor and keeps the old one\n * active until the stage has deployed with the new one; the next run after\n * that — or `--retire-old-keys` — deletes it.\n * - **A new key** takes IAM seconds to become usable: the state records when\n * it was issued, and a check made with it waits that out\n * ({@link whileKeyIsNew}).\n */\n\nimport * as s3Url from '@geekmidas/storage/s3-url';\nimport type { ResourceRecord } from '../deploy/StateStore.js';\nimport {\n\tAccessKeyLimit,\n\tBucketKeySetElsewhere,\n\tIamUserNotOwned,\n\tRotationInProgress,\n} from './s3/errors.js';\nimport { IAM_USER_PATH } from './s3/naming.js';\nimport { canonicalPolicy } from './s3/policy.js';\nimport type { EnsureContext, ProviderConfig, StateEntry } from './types.js';\n\ntype IamModule = typeof import('@aws-sdk/client-iam');\n\n/** The tags gkm finds its own buckets and users by. */\nexport const TAG_PROJECT = 'gkm:project';\nexport const TAG_STAGE = 'gkm:stage';\nexport const TAG_CONSTRUCT = 'gkm:construct';\n\n/** What creating a user and its key is done through. */\nexport interface IamClients {\n\tIAM: IamModule;\n\tiam: InstanceType<IamModule['IAMClient']>;\n\t/** The region the key's URL names. */\n\tregion: string;\n\t/** An emulator's endpoint, written into the URL when there is one. */\n\tendpoint?: string;\n}\n\n/** What creating a user and its key reads from a provisioning run. */\nexport type KeyContext = Pick<\n\tEnsureContext<ProviderConfig, unknown>,\n\t| 'identity'\n\t| 'stage'\n\t| 'state'\n\t| 'change'\n\t| 'dryRun'\n\t| 'secrets'\n\t| 'writeSecrets'\n\t| 'rotateKeys'\n\t| 'retireOldKeys'\n\t| 'log'\n>;\n\n/** The keys gkm tags a bucket and a user with. */\nexport function identityTags(\n\tctx: Pick<KeyContext, 'identity' | 'stage'>,\n\tid: string,\n) {\n\treturn [\n\t\t{ Key: TAG_PROJECT, Value: ctx.identity.key },\n\t\t{ Key: TAG_STAGE, Value: ctx.stage },\n\t\t{ Key: TAG_CONSTRUCT, Value: id },\n\t];\n}\n\n/** A read whose \"there is none\" answer is one of `missing`. */\nasync function readOr<T>(\n\tread: () => Promise<T>,\n\tmissing: readonly string[],\n): Promise<T | undefined> {\n\ttry {\n\t\treturn await read();\n\t} catch (error) {\n\t\tconst e = error as { name?: string; Code?: string };\n\t\tif (missing.includes(e?.Code ?? e?.name ?? '')) return undefined;\n\t\tthrow error;\n\t}\n}\n\n/** IAM returns a policy document URL-encoded; an emulator may not. */\nfunction decodePolicy(document: string): string {\n\ttry {\n\t\treturn decodeURIComponent(document);\n\t} catch {\n\t\treturn document;\n\t}\n}\n\nexport interface IamUserInput {\n\t/** What it is for: a bucket construct's id, or `backups`. */\n\tid: string;\n\t/** `gkm-<project>-<stage>-<id>`. */\n\tuser: string;\n\t/** The inline policy's name. */\n\tpolicyName: string;\n\tpolicy: object;\n\t/** The policy's change line: `this bucket only`. */\n\tdescribe: string;\n}\n\n/**\n * The user and its inline policy: found — and refused when it is not this\n * stage's — or created, and the policy put back when it drifted.\n *\n * @throws {IamUserNotOwned}\n */\nexport async function ensureIamUser(\n\tctx: KeyContext,\n\tclients: IamClients,\n\tinput: IamUserInput,\n): Promise<{ user: string; exists: boolean }> {\n\tconst { IAM, iam } = clients;\n\tconst { id, user, policy } = input;\n\tconst entry: StateEntry = { key: `iam-user:${id}`, type: 'iam-user' };\n\tconst found = await readOr(\n\t\t() => iam.send(new IAM.GetUserCommand({ UserName: user })),\n\t\t['NoSuchEntity', 'NoSuchEntityException'],\n\t);\n\n\tif (found?.User) {\n\t\tconst tags = await iam.send(\n\t\t\tnew IAM.ListUserTagsCommand({ UserName: user }),\n\t\t);\n\t\tconst tag = (key: string) => tags.Tags?.find((t) => t.Key === key)?.Value;\n\t\tif (\n\t\t\tfound.User.Path !== IAM_USER_PATH ||\n\t\t\ttag(TAG_PROJECT) !== ctx.identity.key ||\n\t\t\ttag(TAG_STAGE) !== ctx.stage\n\t\t) {\n\t\t\tthrow new IamUserNotOwned(user, ctx.identity.key, ctx.stage);\n\t\t}\n\t\tawait ctx.state.ready(entry, user);\n\t} else {\n\t\tawait ctx.change(\n\t\t\t{\n\t\t\t\tconstruct: id,\n\t\t\t\tresource: `IAM user ${user}`,\n\t\t\t\tchange: `create under ${IAM_USER_PATH}`,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tawait ctx.state.pending(entry);\n\t\t\t\tawait iam.send(\n\t\t\t\t\tnew IAM.CreateUserCommand({\n\t\t\t\t\t\tUserName: user,\n\t\t\t\t\t\tPath: IAM_USER_PATH,\n\t\t\t\t\t\tTags: identityTags(ctx, id),\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\tawait ctx.state.ready(entry, user);\n\t\t\t},\n\t\t);\n\t}\n\n\tconst exists = Boolean(found?.User) || !ctx.dryRun;\n\tconst current = exists\n\t\t? await readOr(\n\t\t\t\t() =>\n\t\t\t\t\tiam.send(\n\t\t\t\t\t\tnew IAM.GetUserPolicyCommand({\n\t\t\t\t\t\t\tUserName: user,\n\t\t\t\t\t\t\tPolicyName: input.policyName,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t['NoSuchEntity', 'NoSuchEntityException'],\n\t\t\t)\n\t\t: undefined;\n\tconst document = current?.PolicyDocument\n\t\t? JSON.parse(decodePolicy(current.PolicyDocument))\n\t\t: undefined;\n\tif (!document || canonicalPolicy(document) !== canonicalPolicy(policy)) {\n\t\tawait ctx.change(\n\t\t\t{\n\t\t\t\tconstruct: id,\n\t\t\t\tresource: `IAM user ${user}`,\n\t\t\t\tchange: `policy ${input.policyName}: ${input.describe}`,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tawait iam.send(\n\t\t\t\t\tnew IAM.PutUserPolicyCommand({\n\t\t\t\t\t\tUserName: user,\n\t\t\t\t\t\tPolicyName: input.policyName,\n\t\t\t\t\t\tPolicyDocument: JSON.stringify(policy),\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t},\n\t\t);\n\t}\n\treturn { user, exists };\n}\n\n/**\n * The secret a user's access key is written into, and how: an `s3://` URL\n * for a bucket ({@link s3KeySecret}), an `smtp://` one for mail.\n */\nexport interface KeySecret {\n\t/** The secret's key: `UPLOADS_URL`, `BACKUPS_URL`, `MAIL_URL`. */\n\tkey: string;\n\t/**\n\t * The access key a stored value holds — or `undefined` when it holds\n\t * none this user could have issued for it, so a new one is.\n\t *\n\t * @throws when the value is another resource's, set by hand\n\t */\n\tkeyIdOf(value: string): string | undefined;\n\t/** The value for a newly issued key. */\n\tvalue(accessKeyId: string, secretAccessKey: string): string;\n\t/**\n\t * A value holding the right key whose address drifted: what it should\n\t * be, and the change line. `undefined` when it is right.\n\t */\n\trepair?(value: string): { value: string; change: string } | undefined;\n}\n\n/**\n * A bucket's URL as a key's secret: `s3://KEY:SECRET@bucket?region=…`.\n *\n * @throws {BucketKeySetElsewhere} from `keyIdOf`, when the URL names another bucket\n */\nexport function s3KeySecret(\n\tctx: Pick<KeyContext, 'stage'>,\n\tclients: Pick<IamClients, 'region' | 'endpoint'>,\n\tinput: { bucket: string; urlKey: string },\n): KeySecret {\n\tconst { bucket, urlKey } = input;\n\tconst parse = (value: string) => {\n\t\tlet parsed: s3Url.S3Address | undefined;\n\t\ttry {\n\t\t\tparsed = s3Url.parse(value);\n\t\t} catch {\n\t\t\tparsed = undefined;\n\t\t}\n\t\tif (parsed?.bucket !== bucket) {\n\t\t\tthrow new BucketKeySetElsewhere(\n\t\t\t\turlKey,\n\t\t\t\tbucket,\n\t\t\t\tparsed?.bucket ?? value.replace(/\\/\\/[^@]*@/, '//'),\n\t\t\t\tctx.stage,\n\t\t\t);\n\t\t}\n\t\treturn parsed;\n\t};\n\treturn {\n\t\tkey: urlKey,\n\t\tkeyIdOf: (value) => parse(value).accessKeyId,\n\t\tvalue: (accessKeyId, secretAccessKey) =>\n\t\t\ts3Url.build({\n\t\t\t\tbucket,\n\t\t\t\tregion: clients.region,\n\t\t\t\t...(clients.endpoint\n\t\t\t\t\t? { endpoint: clients.endpoint, forcePathStyle: true }\n\t\t\t\t\t: {}),\n\t\t\t\taccessKeyId,\n\t\t\t\tsecretAccessKey,\n\t\t\t}),\n\t\trepair(value) {\n\t\t\t// The key is good; the address must name where the bucket is.\n\t\t\tconst address = parse(value);\n\t\t\tif (address.region === clients.region) return undefined;\n\t\t\treturn {\n\t\t\t\tvalue: s3Url.build({ ...address, region: clients.region }),\n\t\t\t\tchange: `name ${clients.region}, the bucket's region (it said ${address.region ?? 'none'})`,\n\t\t\t};\n\t\t},\n\t};\n}\n\nexport interface AccessKeyInput {\n\t/** What it is for, as {@link IamUserInput.id}. */\n\tid: string;\n\tuser: string;\n\t/** Whether the user exists yet — false in a dry run that would create it. */\n\texists: boolean;\n\t/** Where the key is written. */\n\tsecret: KeySecret;\n}\n\n/**\n * The user's access key, in the stage's secrets as `secret` writes it.\n *\n * - First run: one key, written into the stage's secrets.\n * - `--rotate-keys`: a second key, written in place of the first; the first\n * stays active until the stage has deployed with the second, and the next\n * run after that deploy — or `--retire-old-keys` — deletes it.\n * - A key the secrets no longer hold (a store emptied by hand): replaced the\n * same way, since its secret cannot be read back.\n *\n * @throws whatever `secret.keyIdOf` throws for a value set elsewhere\n * @throws {RotationInProgress} on `--rotate-keys` with the last rotation's old key still active\n * @throws {AccessKeyLimit} when the user has two keys gkm did not record\n */\nexport async function ensureAccessKey(\n\tctx: KeyContext,\n\tclients: IamClients,\n\tinput: AccessKeyInput,\n): Promise<void> {\n\tconst { IAM, iam } = clients;\n\tconst { id, user, secret } = input;\n\tconst entryKey = `iam-access-key:${id}`;\n\tconst record = ctx.state.record(entryKey);\n\n\tconst given = ctx.secrets[secret.key];\n\tconst inUrl = given !== undefined ? secret.keyIdOf(given) : undefined;\n\n\tconst listed = input.exists\n\t\t? ((\n\t\t\t\tawait iam.send(new IAM.ListAccessKeysCommand({ UserName: user }))\n\t\t\t).AccessKeyMetadata?.map((k) => k.AccessKeyId!) ?? [])\n\t\t: [];\n\n\tlet current = record?.status === 'ready' ? record.id : undefined;\n\tlet previous =\n\t\ttypeof record?.data?.previous === 'string'\n\t\t\t? record.data.previous\n\t\t\t: undefined;\n\tconst rotatedAt =\n\t\ttypeof record?.data?.rotatedAt === 'string'\n\t\t\t? record.data.rotatedAt\n\t\t\t: undefined;\n\tconst entry = (data: Record<string, unknown> = {}): StateEntry => ({\n\t\tkey: entryKey,\n\t\ttype: 'iam-access-key',\n\t\tdata: { user, ...data },\n\t});\n\n\t// The old key of a rotation: deleted once the stage deployed after it.\n\tif (previous && current) {\n\t\tconst deployed =\n\t\t\trotatedAt !== undefined &&\n\t\t\tctx.state.lastDeployedAt !== undefined &&\n\t\t\tctx.state.lastDeployedAt > rotatedAt;\n\t\tif (ctx.retireOldKeys || deployed) {\n\t\t\tconst old = previous;\n\t\t\tconst keep = current;\n\t\t\tawait ctx.change(\n\t\t\t\t{\n\t\t\t\t\tconstruct: id,\n\t\t\t\t\tresource: `IAM user ${user}`,\n\t\t\t\t\tchange: `delete the rotated-out access key ${old}`,\n\t\t\t\t},\n\t\t\t\tasync () => {\n\t\t\t\t\tif (listed.includes(old)) {\n\t\t\t\t\t\tawait iam.send(\n\t\t\t\t\t\t\tnew IAM.DeleteAccessKeyCommand({\n\t\t\t\t\t\t\t\tUserName: user,\n\t\t\t\t\t\t\t\tAccessKeyId: old,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tawait ctx.state.ready(entry(), keep);\n\t\t\t\t},\n\t\t\t);\n\t\t\tprevious = undefined;\n\t\t} else {\n\t\t\tctx.log(\n\t\t\t\t` ${id}: the old access key ${previous} stays active until '${ctx.stage}' is deployed with the new one; the next deploy after that deletes it (or pass --retire-old-keys)`,\n\t\t\t);\n\t\t}\n\t}\n\n\t// No record, and the secrets hold a key of this user's: adopt it.\n\tif (!current && inUrl && listed.includes(inUrl)) {\n\t\tawait ctx.state.ready(entry(), inUrl);\n\t\tcurrent = inUrl;\n\t}\n\n\tconst valid =\n\t\tcurrent !== undefined && listed.includes(current) && inUrl === current;\n\tif (valid && !ctx.rotateKeys) {\n\t\tconst repaired = given !== undefined ? secret.repair?.(given) : undefined;\n\t\tif (repaired) {\n\t\t\tawait ctx.change(\n\t\t\t\t{ construct: id, resource: secret.key, change: repaired.change },\n\t\t\t\t() => ctx.writeSecrets({ [secret.key]: repaired.value }),\n\t\t\t);\n\t\t}\n\t\treturn;\n\t}\n\tif (ctx.rotateKeys && previous) {\n\t\tthrow new RotationInProgress(id, previous, ctx.stage);\n\t}\n\n\tconst outgoing = current && listed.includes(current) ? current : undefined;\n\tif (listed.length >= 2) throw new AccessKeyLimit(user, listed);\n\n\tconst why = !current\n\t\t? 'create an access key'\n\t\t: ctx.rotateKeys\n\t\t\t? 'rotate: issue a new access key'\n\t\t\t: 'issue a new access key (the secrets no longer hold the recorded one)';\n\tawait ctx.change(\n\t\t{ construct: id, resource: `IAM user ${user}`, change: why },\n\t\tasync () => {\n\t\t\tawait ctx.state.pending(entry(outgoing ? { previous: outgoing } : {}));\n\t\t\tconst created = await iam.send(\n\t\t\t\tnew IAM.CreateAccessKeyCommand({ UserName: user }),\n\t\t\t);\n\t\t\tconst key = created.AccessKey!;\n\t\t\t// Into the stage's secrets before anything else: IAM shows a secret\n\t\t\t// once, and a key whose secret is lost is a key to replace.\n\t\t\tawait ctx.writeSecrets({\n\t\t\t\t[secret.key]: secret.value(key.AccessKeyId!, key.SecretAccessKey!),\n\t\t\t});\n\t\t\t// When it was issued: IAM takes seconds to make a new key usable,\n\t\t\t// and the deploy's check waits for one this young.\n\t\t\tconst issuedAt = new Date().toISOString();\n\t\t\tawait ctx.state.ready(\n\t\t\t\tentry(\n\t\t\t\t\toutgoing\n\t\t\t\t\t\t? { previous: outgoing, rotatedAt: issuedAt, issuedAt }\n\t\t\t\t\t\t: { issuedAt },\n\t\t\t\t),\n\t\t\t\tkey.AccessKeyId!,\n\t\t\t);\n\t\t},\n\t);\n\tif (outgoing) {\n\t\tctx.log(\n\t\t\t` ${secret.key} holds the new key. This deploy moves '${ctx.stage}' onto it; the next deploy after it deletes the old key ${outgoing}`,\n\t\t);\n\t}\n}\n\n/** How long a key issued this recently counts as new to IAM. */\nconst NEW_KEY_WINDOW_MS = 10 * 60 * 1000;\n\n/** The waits between asks while a new key becomes usable: about a minute. */\nlet newKeyWaits: readonly number[] = [2000, 4000, 8000, 15000, 15000, 15000];\n\n/** For tests: the waits for a new key. Returns the old ones. */\nexport function useNewKeyWaits(waits: readonly number[]): readonly number[] {\n\tconst previous = newKeyWaits;\n\tnewKeyWaits = waits;\n\treturn previous;\n}\n\n/**\n * When the key in a URL was issued, if the stage's state says it was just\n * now — the record of `id`'s key naming that very key.\n */\nexport function issuedJustNow(\n\tresources: Readonly<Record<string, ResourceRecord>> | undefined,\n\tid: string,\n\taccessKeyId: string,\n): string | undefined {\n\tconst record = resources?.[`iam-access-key:${id}`];\n\tconst issuedAt = record?.data?.issuedAt;\n\tif (record?.id !== accessKeyId || typeof issuedAt !== 'string') {\n\t\treturn undefined;\n\t}\n\tconst age = Date.now() - Date.parse(issuedAt);\n\treturn age >= 0 && age < NEW_KEY_WINDOW_MS ? issuedAt : undefined;\n}\n\n/**\n * `ask` again, for about a minute, while it is `refused` and the key was\n * issued just now — IAM refuses a key for seconds after making it. Returns\n * the last answer and how long was waited.\n */\nexport async function whileKeyIsNew<T>(\n\tfirst: T,\n\toptions: {\n\t\tissuedAt: string | undefined;\n\t\trefused: (answer: T) => boolean;\n\t\task: () => Promise<T>;\n\t\t/** Said once, before the first wait. */\n\t\tonWait?: () => void;\n\t},\n): Promise<{ answer: T; waited: number }> {\n\tlet answer = first;\n\tlet waited = 0;\n\tif (!options.issuedAt || !options.refused(answer)) return { answer, waited };\n\toptions.onWait?.();\n\tfor (const wait of newKeyWaits) {\n\t\tawait new Promise((resolve) => setTimeout(resolve, wait));\n\t\twaited += wait;\n\t\tanswer = await options.ask();\n\t\tif (!options.refused(answer)) break;\n\t}\n\treturn { answer, waited };\n}\n"],"mappings":";;;;;AAuBA,MAAM,aAAa,WAAmB,gBAAgB;;;;;;;;;AAUtD,SAAgB,WACf,QACA,UAQI,CAAC,GACY;CACjB,OAAO;EACN,SAAS;EACT,WAAW;GACV;IACC,KAAK;IACL,QAAQ;IACR,QAAQ;KACP;KACA;KACA;KACA;KACA;KACA,GAAI,QAAQ,aAAa,CAAC,qBAAqB,IAAI,CAAC;IACrD;IACA,UAAU,GAAG,UAAU,MAAM,EAAE;GAChC;GACA;IACC,KAAK;IACL,QAAQ;IACR,QAAQ;KACP;KACA;KACA;IACD;IACA,UAAU,UAAU,MAAM;GAC3B;GACA,GAAI,QAAQ,iBACT,CACA;IACC,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,UAAU,QAAQ;GACnB,CACD,IACC,CAAC;EACL;CACD;AACD;;;;;;;AAQA,SAAgB,aAAa,QAAgB,SAAyB;CACrE,MAAM,OAAO,QAAQ,QAAQ,QAAQ,EAAE,CAAC,CAAC,QAAQ,SAAS,GAAG;CAC7D,OAAO,GAAG,UAAU,MAAM,EAAE,GAAG;AAChC;;;;;;;;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;EAGD,MAAM,4BAAW,IAAI,KAAK,EAAA,CAAE,YAAY;EACxC,MAAM,IAAI,MAAM,MACf,MACC,WACG;GAAE,UAAU;GAAU,WAAW;GAAU;EAAS,IACpD,EAAE,SAAS,CACf,GACA,IAAI,WACL;CACD,CACD;CACA,IAAI,UACH,IAAI,IACH,MAAM,OAAO,IAAI,yCAAyC,IAAI,MAAM,0DAA0D,UAC/H;AAEF;;AAGA,MAAM,oBAAoB;;AAG1B,IAAI,cAAiC;CAAC;CAAM;CAAM;CAAM;CAAO;CAAO;AAAK;;;;;AAa3E,SAAgB,cACf,WACA,IACA,aACqB;CACrB,MAAM,SAAS,YAAY,kBAAkB;CAC7C,MAAM,WAAW,QAAQ,MAAM;CAC/B,IAAI,QAAQ,OAAO,eAAe,OAAO,aAAa,UACrD;CAED,MAAM,MAAM,KAAK,IAAI,IAAI,KAAK,MAAM,QAAQ;CAC5C,OAAO,OAAO,KAAK,MAAM,oBAAoB,WAAW,KAAA;AACzD;;;;;;AAOA,eAAsB,cACrB,OACA,SAOyC;CACzC,IAAI,SAAS;CACb,IAAI,SAAS;CACb,IAAI,CAAC,QAAQ,YAAY,CAAC,QAAQ,QAAQ,MAAM,GAAG,OAAO;EAAE;EAAQ;CAAO;CAC3E,QAAQ,SAAS;CACjB,KAAK,MAAM,QAAQ,aAAa;EAC/B,MAAM,IAAI,SAAS,YAAY,WAAW,SAAS,IAAI,CAAC;EACxD,UAAU;EACV,SAAS,MAAM,QAAQ,IAAI;EAC3B,IAAI,CAAC,QAAQ,QAAQ,MAAM,GAAG;CAC/B;CACA,OAAO;EAAE;EAAQ;CAAO;AACzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as WorkspaceConfig, Gt as GkmError, O as WorkspaceInput, _ as InferredWorkspaceConfig, a as Routes, j as Framework, l as AppsRecord, r as GkmConfig, v as LoadedConfig, x as NormalizedWorkspace } from "./types-
|
|
1
|
+
import { D as WorkspaceConfig, Gt as GkmError, O as WorkspaceInput, _ as InferredWorkspaceConfig, a as Routes, j as Framework, l as AppsRecord, r as GkmConfig, v as LoadedConfig, x as NormalizedWorkspace } from "./types-wLlwkSib.mjs";
|
|
2
2
|
//#region src/workspace/publicEnv.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* All public env-var prefixes the toolbox understands.
|
|
@@ -187,4 +187,4 @@ declare function getEndpointForStage(dokployConfig: {
|
|
|
187
187
|
} | undefined, stage: string): string | undefined;
|
|
188
188
|
//#endregion
|
|
189
189
|
export { PUBLIC_ENV_PREFIXES as _, allConstructGlobs as a, constructPatterns as c, getAppGkmConfig as d, getEndpointForStage as f, wrapSingleAppAsWorkspace as g, workspaceConstructGlobs as h, InvalidWorkspaceConfig as i, defineWorkspace as l, processConfig as m, DokployRegistryMoved as n, appConstructGlobs as o, normalizeWorkspace as p, DomainsMoved as r, assertNoMovedDeployKeys as s, DnsMoved as t, getAppBuildOrder as u, getPublicEnvPrefix as v, stripPublicPrefix as y };
|
|
190
|
-
//# sourceMappingURL=index-
|
|
190
|
+
//# sourceMappingURL=index-BKgOlfK2.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-BKgOlfK2.d.mts","names":[],"sources":["../src/workspace/publicEnv.ts","../src/workspace/index.ts"],"mappings":";;;;;;;;;cASa;;;;;;;;;;;;;;;iBAoBG,mBAAmB,YAAY;;;;;iBAoB/B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCiFlB,sBACT,cAAc,kBACd,mCACL,QAAQ,eAAe,OAAO,aAAa,wBAAwB;;;;iBAiCrD,mBACf,QAAQ,iBACR,cACE;;;;;iBAqDa,yBACf,QAAQ,WACR,cACE;;;;;;;;;;;;cAgEU,6BAA6B;WACpB;EAArB,YAAqB;;;;;;;cAcT,qBAAqB;WACZ;EAArB,YAAqB;;;;;;cAaT,iBAAiB;WACR;EAArB,YAAqB;;;iBAcN,wBAAwB;iBAaxB,cACf,QAAQ,YAAY,iBACpB,cACE;;cAiCU,+BAA+B;EAC3C,YAAY;;;;;;;;iBAYG,wBACf,WAAW;;;;;;;;;;;;iBAkBI,kBACf,WAAW,qBACX;;;;;;;iBAsBe,kBAAkB,WAAW;;iBAa7B,kBAAkB,QAAQ;;;;;iBAS1B,gBACf,WAAW,qBACX,kBACE;;;;;iBAgCa,iBAAiB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoD5B,oBACf;EACK;EAAmB,YAAY;eAEpC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as WorkspaceConfig, Gt as GkmError, O as WorkspaceInput, _ as InferredWorkspaceConfig, a as Routes, j as Framework, l as AppsRecord, r as GkmConfig, v as LoadedConfig, x as NormalizedWorkspace } from "./types-
|
|
1
|
+
import { D as WorkspaceConfig, Gt as GkmError, O as WorkspaceInput, _ as InferredWorkspaceConfig, a as Routes, j as Framework, l as AppsRecord, r as GkmConfig, v as LoadedConfig, x as NormalizedWorkspace } from "./types-CLxsw-QY.cjs";
|
|
2
2
|
//#region src/workspace/publicEnv.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* All public env-var prefixes the toolbox understands.
|
|
@@ -187,4 +187,4 @@ declare function getEndpointForStage(dokployConfig: {
|
|
|
187
187
|
} | undefined, stage: string): string | undefined;
|
|
188
188
|
//#endregion
|
|
189
189
|
export { PUBLIC_ENV_PREFIXES as _, allConstructGlobs as a, constructPatterns as c, getAppGkmConfig as d, getEndpointForStage as f, wrapSingleAppAsWorkspace as g, workspaceConstructGlobs as h, InvalidWorkspaceConfig as i, defineWorkspace as l, processConfig as m, DokployRegistryMoved as n, appConstructGlobs as o, normalizeWorkspace as p, DomainsMoved as r, assertNoMovedDeployKeys as s, DnsMoved as t, getAppBuildOrder as u, getPublicEnvPrefix as v, stripPublicPrefix as y };
|
|
190
|
-
//# sourceMappingURL=index-
|
|
190
|
+
//# sourceMappingURL=index-zPzigXh-.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-zPzigXh-.d.cts","names":[],"sources":["../src/workspace/publicEnv.ts","../src/workspace/index.ts"],"mappings":";;;;;;;;;cASa;;;;;;;;;;;;;;;iBAoBG,mBAAmB,YAAY;;;;;iBAoB/B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCiFlB,sBACT,cAAc,kBACd,mCACL,QAAQ,eAAe,OAAO,aAAa,wBAAwB;;;;iBAiCrD,mBACf,QAAQ,iBACR,cACE;;;;;iBAqDa,yBACf,QAAQ,WACR,cACE;;;;;;;;;;;;cAgEU,6BAA6B;WACpB;EAArB,YAAqB;;;;;;;cAcT,qBAAqB;WACZ;EAArB,YAAqB;;;;;;cAaT,iBAAiB;WACR;EAArB,YAAqB;;;iBAcN,wBAAwB;iBAaxB,cACf,QAAQ,YAAY,iBACpB,cACE;;cAiCU,+BAA+B;EAC3C,YAAY;;;;;;;;iBAYG,wBACf,WAAW;;;;;;;;;;;;iBAkBI,kBACf,WAAW,qBACX;;;;;;;iBAsBe,kBAAkB,WAAW;;iBAa7B,kBAAkB,QAAQ;;;;;iBAS1B,gBACf,WAAW,qBACX,kBACE;;;;;iBAgCa,iBAAiB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoD5B,oBACf;EACK;EAAmB,YAAY;eAEpC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env -S npx tsx
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
4
|
-
const require_errors = require("./errors-
|
|
5
|
-
const require_dns = require("./dns-
|
|
6
|
-
const require_compose = require("./compose-
|
|
7
|
-
const require_workspace = require("./workspace-
|
|
8
|
-
const require_apps = require("./apps-
|
|
4
|
+
const require_errors = require("./errors-D1x8duqI.cjs");
|
|
5
|
+
const require_dns = require("./dns-D_0z9Tm1.cjs");
|
|
6
|
+
const require_compose = require("./compose-AO8u4mBI.cjs");
|
|
7
|
+
const require_workspace = require("./workspace-wTLnc1Ef.cjs");
|
|
8
|
+
const require_apps = require("./apps-qJ5FPJGQ.cjs");
|
|
9
9
|
const require_schemas = require("./schemas-BQ_v0lEX.cjs");
|
|
10
|
-
const require_compose$1 = require("./compose-
|
|
11
|
-
const require_SubscriberGenerator = require("./SubscriberGenerator-
|
|
10
|
+
const require_compose$1 = require("./compose-C-yjexqX.cjs");
|
|
11
|
+
const require_SubscriberGenerator = require("./SubscriberGenerator-JhwVlWBS.cjs");
|
|
12
12
|
const require_drivers = require("./drivers-DP7__dJX.cjs");
|
|
13
|
-
const require_EndpointGenerator = require("./EndpointGenerator-
|
|
14
|
-
const require_discover = require("./discover-
|
|
13
|
+
const require_EndpointGenerator = require("./EndpointGenerator-iyA3HkOH.cjs");
|
|
14
|
+
const require_discover = require("./discover-OXczlq08.cjs");
|
|
15
15
|
const require_config = require("./config.cjs");
|
|
16
|
-
const require_notes = require("./notes-
|
|
17
|
-
const require_stack = require("./stack-
|
|
18
|
-
const require_docker = require("./docker-
|
|
16
|
+
const require_notes = require("./notes-ChYPaRLu.cjs");
|
|
17
|
+
const require_stack = require("./stack-Dr2FSxGm.cjs");
|
|
18
|
+
const require_docker = require("./docker-6EUbKrEl.cjs");
|
|
19
19
|
const require_openapi = require("./openapi.cjs");
|
|
20
20
|
const require_appPorts = require("./appPorts-IW-OZmRi.cjs");
|
|
21
21
|
const require_emit = require("./emit-DiW0kbue.cjs");
|
|
22
|
-
const require_local = require("./local-
|
|
23
|
-
const require_sniffer = require("./sniffer-
|
|
24
|
-
const require_deploy = require("./deploy-
|
|
22
|
+
const require_local = require("./local-CFnHQgWC.cjs");
|
|
23
|
+
const require_sniffer = require("./sniffer-D3gH7aJT.cjs");
|
|
24
|
+
const require_deploy = require("./deploy-C2MKxzm9.cjs");
|
|
25
25
|
const require_seeds = require("./seeds-Bc3niNVb.cjs");
|
|
26
|
-
const require_credentialSchemas = require("./credentialSchemas-
|
|
27
|
-
const require_LocalStateStore = require("./LocalStateStore-
|
|
26
|
+
const require_credentialSchemas = require("./credentialSchemas-DjK6xKMk.cjs");
|
|
27
|
+
const require_LocalStateStore = require("./LocalStateStore-DEE0Kc_s.cjs");
|
|
28
28
|
const require_utils = require("./utils-D2Nk1Nv2.cjs");
|
|
29
|
-
const require_ready = require("./ready-
|
|
29
|
+
const require_ready = require("./ready-ByQvw4-W.cjs");
|
|
30
30
|
let node_path = require("node:path");
|
|
31
31
|
let commander = require("commander");
|
|
32
32
|
let node_process = require("node:process");
|
|
@@ -39,6 +39,8 @@ let node_stream_promises = require("node:stream/promises");
|
|
|
39
39
|
let node_child_process = require("node:child_process");
|
|
40
40
|
let node_net = require("node:net");
|
|
41
41
|
let node_crypto = require("node:crypto");
|
|
42
|
+
let _geekmidas_edge_certificates_local = require("@geekmidas/edge/certificates/local");
|
|
43
|
+
let _geekmidas_edge_proxy_traefik = require("@geekmidas/edge/proxy/traefik");
|
|
42
44
|
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
43
45
|
let node_module = require("node:module");
|
|
44
46
|
let node_url = require("node:url");
|
|
@@ -60,7 +62,7 @@ let crypto = require("crypto");
|
|
|
60
62
|
crypto = require_rolldown_runtime.__toESM(crypto, 1);
|
|
61
63
|
let _geekmidas_constructs_topic = require("@geekmidas/constructs/topic");
|
|
62
64
|
//#region package.json
|
|
63
|
-
var version = "10.0.0-alpha.
|
|
65
|
+
var version = "10.0.0-alpha.180";
|
|
64
66
|
//#endregion
|
|
65
67
|
//#region src/prompt.ts
|
|
66
68
|
/**
|
|
@@ -143,7 +145,7 @@ const logger$8 = console;
|
|
|
143
145
|
* Validate Dokploy token by making a test API call
|
|
144
146
|
*/
|
|
145
147
|
async function validateDokployToken(endpoint, token) {
|
|
146
|
-
const { DokployApi } = await Promise.resolve().then(() => require("./sniffer-
|
|
148
|
+
const { DokployApi } = await Promise.resolve().then(() => require("./sniffer-D3gH7aJT.cjs")).then((n) => n.dokploy_api_exports);
|
|
147
149
|
return new DokployApi({
|
|
148
150
|
baseUrl: endpoint,
|
|
149
151
|
token
|
|
@@ -1164,7 +1166,7 @@ function installation(platform, certificate) {
|
|
|
1164
1166
|
* same entry, so running it twice is not an error.
|
|
1165
1167
|
*/
|
|
1166
1168
|
async function trustCommand(options = {}) {
|
|
1167
|
-
const { certFile: certificate } = await
|
|
1169
|
+
const { certFile: certificate } = await (0, _geekmidas_edge_certificates_local.ensureLocalAuthority)(options.authority ?? (0, _geekmidas_edge_certificates_local.localAuthorityPaths)(require_dns.gkmHome()));
|
|
1168
1170
|
const { describe, asks, steps } = installation(process.platform, certificate);
|
|
1169
1171
|
logger$7.log(`\n🔐 Trusting the local authority in ${describe}`);
|
|
1170
1172
|
logger$7.log(` ${certificate}\n`);
|
|
@@ -2528,7 +2530,7 @@ async function execCommand(commandArgs, options = {}, stageDeps) {
|
|
|
2528
2530
|
const cwd = options.cwd ?? process.cwd();
|
|
2529
2531
|
if (!commandArgs[0]) throw new NoCommandSpecified();
|
|
2530
2532
|
if (options.stage && !require_apps.isImageBuild()) {
|
|
2531
|
-
const { execOnStage } = await Promise.resolve().then(() => require("./stage-
|
|
2533
|
+
const { execOnStage } = await Promise.resolve().then(() => require("./stage-aTBLKonw.cjs")).then((n) => n.stage_exports);
|
|
2532
2534
|
const { loadWorkspaceConfig } = await Promise.resolve().then(() => require("./config.cjs"));
|
|
2533
2535
|
const { workspace } = await loadWorkspaceConfig(cwd);
|
|
2534
2536
|
if (options.stage !== workspace.stages.local) {
|
|
@@ -3104,9 +3106,9 @@ async function workspaceDevCommand(configured, options) {
|
|
|
3104
3106
|
for (const { id, port } of fakes) logger$5.log(`🎭 ${id} fake: http://localhost:${port}`);
|
|
3105
3107
|
logger$5.log(options.migrate || options.seed ? "🗄️ Migrating the databases" : "🗄️ Checking for pending migrations");
|
|
3106
3108
|
if (options.migrate || options.seed) {
|
|
3107
|
-
const { prepareDevDatabases } = await Promise.resolve().then(() => require("./migrate-
|
|
3109
|
+
const { prepareDevDatabases } = await Promise.resolve().then(() => require("./migrate-CGXrmZyV.cjs"));
|
|
3108
3110
|
await prepareDevDatabases(workspace, secretsEnv, { seed: !!options.seed });
|
|
3109
|
-
} else await Promise.resolve().then(() => require("./migrate-
|
|
3111
|
+
} else await Promise.resolve().then(() => require("./migrate-CGXrmZyV.cjs")).then(({ reportPendingMigrations }) => reportPendingMigrations(workspace, reconciled.env)).catch((error) => {
|
|
3110
3112
|
logger$5.log(`⚠️ Could not check for pending migrations: ${error instanceof Error ? error.message : String(error)}`);
|
|
3111
3113
|
});
|
|
3112
3114
|
const appUrls = {};
|
|
@@ -4254,7 +4256,7 @@ async function buildApp(input) {
|
|
|
4254
4256
|
...telemetry ? { telemetry } : {},
|
|
4255
4257
|
trustedOriginsKey: (0, _geekmidas_manifest.providedKeyFor)(selfServing.id, "rest-api", "trustedOrigins")
|
|
4256
4258
|
});
|
|
4257
|
-
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-
|
|
4259
|
+
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-BuBCXA0t.cjs"));
|
|
4258
4260
|
await bundleServer({
|
|
4259
4261
|
entryPoint,
|
|
4260
4262
|
outputDir: (0, node_path.join)(outputDir, "dist"),
|
|
@@ -4535,7 +4537,7 @@ async function buildWorkers(input) {
|
|
|
4535
4537
|
});
|
|
4536
4538
|
logger$4.log(`Generated worker ${worker.id}: ${crons.length} crons, ${queues.length} queues, ${subscribers.length} subscribers`);
|
|
4537
4539
|
if (!input.bundle) continue;
|
|
4538
|
-
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-
|
|
4540
|
+
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-BuBCXA0t.cjs"));
|
|
4539
4541
|
const outfile = require_docker.workerBundleName(worker.id);
|
|
4540
4542
|
await bundleServer({
|
|
4541
4543
|
entryPoint,
|
|
@@ -4577,7 +4579,7 @@ async function buildProcessors(input) {
|
|
|
4577
4579
|
for (const { key, construct } of processors) infos.push(await require_docker.processorInfo(key, construct, handler, context));
|
|
4578
4580
|
logger$4.log(`Generated processors for ${fileServerId}: ${processors.map(({ key }) => key).join(", ")}`);
|
|
4579
4581
|
if (!input.bundle) continue;
|
|
4580
|
-
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-
|
|
4582
|
+
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-BuBCXA0t.cjs"));
|
|
4581
4583
|
const outfile = require_docker.processorBundleName(fileServerId);
|
|
4582
4584
|
await bundleServer({
|
|
4583
4585
|
entryPoint,
|
|
@@ -4663,7 +4665,7 @@ async function buildForTarget(target, context, appRoot, outputDir, workspaceRoot
|
|
|
4663
4665
|
let masterKey;
|
|
4664
4666
|
if (context.production?.bundle && !skipBundle) {
|
|
4665
4667
|
logger$4.log(`\n📦 Bundling production server...`);
|
|
4666
|
-
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-
|
|
4668
|
+
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-BuBCXA0t.cjs"));
|
|
4667
4669
|
const allConstructs = [
|
|
4668
4670
|
...endpoints.map((e) => e.construct),
|
|
4669
4671
|
...functions.map((f) => f.construct),
|
|
@@ -4942,7 +4944,7 @@ async function composeCommand(options, deps = {}) {
|
|
|
4942
4944
|
["tag", "--tag"]
|
|
4943
4945
|
].find(([key]) => options[key] !== void 0 && options[key] !== false)?.[1];
|
|
4944
4946
|
if (flag) throw new ComposeDestroyConflict(flag);
|
|
4945
|
-
const { composeDestroyCommand } = await Promise.resolve().then(() => require("./destroy-
|
|
4947
|
+
const { composeDestroyCommand } = await Promise.resolve().then(() => require("./destroy-CCpnHI2v.cjs"));
|
|
4946
4948
|
await composeDestroyCommand({
|
|
4947
4949
|
stage: options.stage,
|
|
4948
4950
|
...options.cwd ? { cwd: options.cwd } : {},
|
|
@@ -4960,12 +4962,12 @@ async function composeCommand(options, deps = {}) {
|
|
|
4960
4962
|
const { workspace } = loaded;
|
|
4961
4963
|
const { stage } = options;
|
|
4962
4964
|
if (options.down) {
|
|
4963
|
-
const { composeStackRef } = await Promise.resolve().then(() => require("./destroy-
|
|
4965
|
+
const { composeStackRef } = await Promise.resolve().then(() => require("./destroy-CCpnHI2v.cjs"));
|
|
4964
4966
|
const { ref, dir, server } = await composeStackRef(workspace, stage);
|
|
4965
4967
|
const docker = deps.docker ?? require_compose.dockerCompose;
|
|
4966
4968
|
if (server) console.log(`→ ${require_compose.sshTarget(server)} (docker over ssh)`);
|
|
4967
|
-
const edgeFile = (0, node_path.join)(dir, `${
|
|
4968
|
-
if ((server || (0, node_fs.existsSync)(edgeFile)) && await require_compose.removeEdgeRoutes(docker, require_compose.edgeRef(edgeFile, { host: ref.host }), ref.project)) console.log(`🌐 Removed ${ref.project}'s routes from ${
|
|
4969
|
+
const edgeFile = (0, node_path.join)(dir, `${_geekmidas_edge_proxy_traefik.EDGE_PROJECT}.yml`);
|
|
4970
|
+
if ((server || (0, node_fs.existsSync)(edgeFile)) && await require_compose.removeEdgeRoutes(docker, require_compose.edgeRef(edgeFile, { host: ref.host }), ref.project)) console.log(`🌐 Removed ${ref.project}'s routes from ${_geekmidas_edge_proxy_traefik.EDGE_PROJECT}.`);
|
|
4969
4971
|
await docker.down(ref);
|
|
4970
4972
|
console.log(`🛑 Stopped ${ref.project}. Its volumes are kept.`);
|
|
4971
4973
|
return;
|
|
@@ -6541,25 +6543,25 @@ function loadPackageJson() {
|
|
|
6541
6543
|
* Run: pnpm --filter @geekmidas/cli sync-versions
|
|
6542
6544
|
*/
|
|
6543
6545
|
const GEEKMIDAS_VERSIONS = {
|
|
6544
|
-
"@geekmidas/audit": ">=10.0.0-alpha.
|
|
6545
|
-
"@geekmidas/auth": ">=10.0.0-alpha.
|
|
6546
|
-
"@geekmidas/cache": ">=10.0.0-alpha.
|
|
6547
|
-
"@geekmidas/client": ">=10.0.0-alpha.
|
|
6548
|
-
"@geekmidas/cloud": ">=10.0.0-alpha.
|
|
6549
|
-
"@geekmidas/constructs": ">=10.0.0-alpha.
|
|
6550
|
-
"@geekmidas/db": ">=10.0.0-alpha.
|
|
6551
|
-
"@geekmidas/emailkit": ">=10.0.0-alpha.
|
|
6552
|
-
"@geekmidas/envkit": ">=10.0.0-alpha.
|
|
6553
|
-
"@geekmidas/errors": ">=10.0.0-alpha.
|
|
6554
|
-
"@geekmidas/events": ">=10.0.0-alpha.
|
|
6555
|
-
"@geekmidas/logger": ">=10.0.0-alpha.
|
|
6556
|
-
"@geekmidas/manifest": ">=10.0.0-alpha.
|
|
6557
|
-
"@geekmidas/rate-limit": ">=10.0.0-alpha.
|
|
6558
|
-
"@geekmidas/schema": ">=10.0.0-alpha.
|
|
6559
|
-
"@geekmidas/services": ">=10.0.0-alpha.
|
|
6560
|
-
"@geekmidas/storage": ">=10.0.0-alpha.
|
|
6561
|
-
"@geekmidas/telescope": ">=10.0.0-alpha.
|
|
6562
|
-
"@geekmidas/testkit": ">=10.0.0-alpha.
|
|
6546
|
+
"@geekmidas/audit": ">=10.0.0-alpha.180 <10.0.0",
|
|
6547
|
+
"@geekmidas/auth": ">=10.0.0-alpha.180 <10.0.0",
|
|
6548
|
+
"@geekmidas/cache": ">=10.0.0-alpha.180 <10.0.0",
|
|
6549
|
+
"@geekmidas/client": ">=10.0.0-alpha.180 <10.0.0",
|
|
6550
|
+
"@geekmidas/cloud": ">=10.0.0-alpha.180 <10.0.0",
|
|
6551
|
+
"@geekmidas/constructs": ">=10.0.0-alpha.180 <10.0.0",
|
|
6552
|
+
"@geekmidas/db": ">=10.0.0-alpha.180 <10.0.0",
|
|
6553
|
+
"@geekmidas/emailkit": ">=10.0.0-alpha.180 <10.0.0",
|
|
6554
|
+
"@geekmidas/envkit": ">=10.0.0-alpha.180 <10.0.0",
|
|
6555
|
+
"@geekmidas/errors": ">=10.0.0-alpha.180 <10.0.0",
|
|
6556
|
+
"@geekmidas/events": ">=10.0.0-alpha.180 <10.0.0",
|
|
6557
|
+
"@geekmidas/logger": ">=10.0.0-alpha.180 <10.0.0",
|
|
6558
|
+
"@geekmidas/manifest": ">=10.0.0-alpha.180 <10.0.0",
|
|
6559
|
+
"@geekmidas/rate-limit": ">=10.0.0-alpha.180 <10.0.0",
|
|
6560
|
+
"@geekmidas/schema": ">=10.0.0-alpha.180 <10.0.0",
|
|
6561
|
+
"@geekmidas/services": ">=10.0.0-alpha.180 <10.0.0",
|
|
6562
|
+
"@geekmidas/storage": ">=10.0.0-alpha.180 <10.0.0",
|
|
6563
|
+
"@geekmidas/telescope": ">=10.0.0-alpha.180 <10.0.0",
|
|
6564
|
+
"@geekmidas/testkit": ">=10.0.0-alpha.180 <10.0.0",
|
|
6563
6565
|
"@geekmidas/cli": versionRange(loadPackageJson().version)
|
|
6564
6566
|
};
|
|
6565
6567
|
//#endregion
|
|
@@ -7752,7 +7754,7 @@ const COMMIT = /^[0-9a-f]{40}$/;
|
|
|
7752
7754
|
* The `uses:` value for the stages action, with a comment saying which CLI
|
|
7753
7755
|
* release the pinned commit is.
|
|
7754
7756
|
*/
|
|
7755
|
-
function stagesActionUses(commit = "
|
|
7757
|
+
function stagesActionUses(commit = "b3f466642f50d73b9c79b58f1df26b2fa59a60e7", version = cliVersion()) {
|
|
7756
7758
|
return commit && COMMIT.test(commit) ? `${STAGES_ACTION}@${commit} # @geekmidas/cli ${version}` : `${STAGES_ACTION}@main # pin to a commit SHA: see the action's README`;
|
|
7757
7759
|
}
|
|
7758
7760
|
//#endregion
|
|
@@ -16725,8 +16727,8 @@ function testDatabases(reconciled) {
|
|
|
16725
16727
|
* starts without the reference data the app needs.
|
|
16726
16728
|
*/
|
|
16727
16729
|
async function migrateTestStage(workspace, env) {
|
|
16728
|
-
const { migrateAndSeed } = await Promise.resolve().then(() => require("./migrate-
|
|
16729
|
-
const { discover } = await Promise.resolve().then(() => require("./discover-
|
|
16730
|
+
const { migrateAndSeed } = await Promise.resolve().then(() => require("./migrate-CGXrmZyV.cjs"));
|
|
16731
|
+
const { discover } = await Promise.resolve().then(() => require("./discover-OXczlq08.cjs")).then((n) => n.discover_exports);
|
|
16730
16732
|
const sources = {};
|
|
16731
16733
|
const manifest = await discover({
|
|
16732
16734
|
patterns: require_apps.constructGlobs(workspace),
|
|
@@ -17179,7 +17181,7 @@ program.command("db:tunnel").description("Open an SSH tunnel to a deployed compo
|
|
|
17179
17181
|
try {
|
|
17180
17182
|
const globalOptions = program.opts();
|
|
17181
17183
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
17182
|
-
const { dbTunnel } = await Promise.resolve().then(() => require("./dbTunnel-
|
|
17184
|
+
const { dbTunnel } = await Promise.resolve().then(() => require("./dbTunnel-Bve0zBqT.cjs"));
|
|
17183
17185
|
await dbTunnel({
|
|
17184
17186
|
...options,
|
|
17185
17187
|
...construct ? { construct } : {}
|
|
@@ -17192,7 +17194,7 @@ program.command("eas:sync").description("Set up a mobile app's EAS project for a
|
|
|
17192
17194
|
try {
|
|
17193
17195
|
const globalOptions = program.opts();
|
|
17194
17196
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
17195
|
-
const { easSync } = await Promise.resolve().then(() => require("./eas-
|
|
17197
|
+
const { easSync } = await Promise.resolve().then(() => require("./eas-BhTOdQrE.cjs"));
|
|
17196
17198
|
await easSync(options);
|
|
17197
17199
|
} catch (error) {
|
|
17198
17200
|
exitWithError(error);
|
|
@@ -17202,7 +17204,7 @@ program.command("publish").description("Ship a mobile app for a deployed stage:
|
|
|
17202
17204
|
try {
|
|
17203
17205
|
const globalOptions = program.opts();
|
|
17204
17206
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
17205
|
-
const { publish, PublishModeConflict } = await Promise.resolve().then(() => require("./publish-
|
|
17207
|
+
const { publish, PublishModeConflict } = await Promise.resolve().then(() => require("./publish-Dc-1GQp8.cjs"));
|
|
17206
17208
|
if (options.build && options.update) throw new PublishModeConflict();
|
|
17207
17209
|
const { build, update, ...rest } = options;
|
|
17208
17210
|
await publish({
|
|
@@ -17218,7 +17220,7 @@ program.command("deploy:google-play").description("Let EAS Submit publish a mobi
|
|
|
17218
17220
|
try {
|
|
17219
17221
|
const globalOptions = program.opts();
|
|
17220
17222
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
17221
|
-
const { deployGooglePlay } = await Promise.resolve().then(() => require("./googlePlay-
|
|
17223
|
+
const { deployGooglePlay } = await Promise.resolve().then(() => require("./googlePlay-s9dGfrrb.cjs"));
|
|
17222
17224
|
await deployGooglePlay(options);
|
|
17223
17225
|
} catch (error) {
|
|
17224
17226
|
exitWithError(error);
|
|
@@ -17240,7 +17242,7 @@ program.command("migrate").description("Apply each database construct's migratio
|
|
|
17240
17242
|
try {
|
|
17241
17243
|
const globalOptions = program.opts();
|
|
17242
17244
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
17243
|
-
const { migrateCommand } = await Promise.resolve().then(() => require("./migrate-
|
|
17245
|
+
const { migrateCommand } = await Promise.resolve().then(() => require("./migrate-CGXrmZyV.cjs"));
|
|
17244
17246
|
await migrateCommand({
|
|
17245
17247
|
...options,
|
|
17246
17248
|
...construct ? { construct } : {}
|
|
@@ -17253,7 +17255,7 @@ program.command("seed").description("Migrate, then run each database construct's
|
|
|
17253
17255
|
try {
|
|
17254
17256
|
const globalOptions = program.opts();
|
|
17255
17257
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
17256
|
-
const { seedCommand } = await Promise.resolve().then(() => require("./migrate-
|
|
17258
|
+
const { seedCommand } = await Promise.resolve().then(() => require("./migrate-CGXrmZyV.cjs"));
|
|
17257
17259
|
await seedCommand({
|
|
17258
17260
|
...options,
|
|
17259
17261
|
...construct ? { construct } : {}
|
|
@@ -17266,7 +17268,7 @@ program.command("migration").description("Write a construct's next migration: an
|
|
|
17266
17268
|
try {
|
|
17267
17269
|
const globalOptions = program.opts();
|
|
17268
17270
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
17269
|
-
const { migrationCommand } = await Promise.resolve().then(() => require("./migrate-
|
|
17271
|
+
const { migrationCommand } = await Promise.resolve().then(() => require("./migrate-CGXrmZyV.cjs"));
|
|
17270
17272
|
await migrationCommand({
|
|
17271
17273
|
construct,
|
|
17272
17274
|
...name ? { name } : {}
|
|
@@ -17366,7 +17368,7 @@ program.command("secrets:add").description("Build the keys a stage must be given
|
|
|
17366
17368
|
try {
|
|
17367
17369
|
const globalOptions = program.opts();
|
|
17368
17370
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
17369
|
-
const { secretsAddCommand } = await Promise.resolve().then(() => require("./add-
|
|
17371
|
+
const { secretsAddCommand } = await Promise.resolve().then(() => require("./add-DEdpKya-.cjs"));
|
|
17370
17372
|
await secretsAddCommand(options);
|
|
17371
17373
|
} catch (error) {
|
|
17372
17374
|
exitWithError(error);
|
|
@@ -17376,7 +17378,7 @@ program.command("encryption:rotate").description("Add a new current key to an En
|
|
|
17376
17378
|
try {
|
|
17377
17379
|
const globalOptions = program.opts();
|
|
17378
17380
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
17379
|
-
const { encryptionRotateCommand } = await Promise.resolve().then(() => require("./encryption-
|
|
17381
|
+
const { encryptionRotateCommand } = await Promise.resolve().then(() => require("./encryption-yROMpM67.cjs"));
|
|
17380
17382
|
await encryptionRotateCommand(construct, options);
|
|
17381
17383
|
} catch (error) {
|
|
17382
17384
|
exitWithError(error);
|
|
@@ -17386,7 +17388,7 @@ program.command("encryption:retire").description("Remove an old key from an Encr
|
|
|
17386
17388
|
try {
|
|
17387
17389
|
const globalOptions = program.opts();
|
|
17388
17390
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
17389
|
-
const { encryptionRetireCommand } = await Promise.resolve().then(() => require("./encryption-
|
|
17391
|
+
const { encryptionRetireCommand } = await Promise.resolve().then(() => require("./encryption-yROMpM67.cjs"));
|
|
17390
17392
|
await encryptionRetireCommand(construct, key, options);
|
|
17391
17393
|
} catch (error) {
|
|
17392
17394
|
exitWithError(error);
|
|
@@ -17425,7 +17427,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
|
|
|
17425
17427
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
17426
17428
|
const { loadWorkspaceConfig } = await Promise.resolve().then(() => require("./config.cjs"));
|
|
17427
17429
|
const { reconcileMissingSecrets } = await Promise.resolve().then(() => require("./reconcile-CuCQBa5-.cjs"));
|
|
17428
|
-
const { secretsStoreFor } = await Promise.resolve().then(() => require("./dns-
|
|
17430
|
+
const { secretsStoreFor } = await Promise.resolve().then(() => require("./dns-D_0z9Tm1.cjs")).then((n) => n.store_exports);
|
|
17429
17431
|
const { workspace } = await loadWorkspaceConfig();
|
|
17430
17432
|
const stage = options.stage ?? workspace.stages.local;
|
|
17431
17433
|
const store = await secretsStoreFor(workspace, stage);
|
|
@@ -17434,7 +17436,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
|
|
|
17434
17436
|
console.error(`No secrets found for stage "${stage}". Run "gkm secrets:init --stage ${stage}" first.`);
|
|
17435
17437
|
process.exit(1);
|
|
17436
17438
|
}
|
|
17437
|
-
const { derivedContainers } = await Promise.resolve().then(() => require("./apps-
|
|
17439
|
+
const { derivedContainers } = await Promise.resolve().then(() => require("./apps-qJ5FPJGQ.cjs")).then((n) => n.workspace_exports);
|
|
17438
17440
|
const result = reconcileMissingSecrets(secrets, workspace, await derivedContainers(workspace, stage));
|
|
17439
17441
|
if (!result) {
|
|
17440
17442
|
console.log(`\n✓ Secrets for stage "${stage}" are up-to-date`);
|
|
@@ -17451,14 +17453,14 @@ program.command("secrets:migrate").description("Copy a deployed stage's secrets
|
|
|
17451
17453
|
try {
|
|
17452
17454
|
const globalOptions = program.opts();
|
|
17453
17455
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
17454
|
-
const { secretsMigrateCommand } = await Promise.resolve().then(() => require("./migrate-
|
|
17456
|
+
const { secretsMigrateCommand } = await Promise.resolve().then(() => require("./migrate-CxWXW-Lw.cjs"));
|
|
17455
17457
|
await secretsMigrateCommand(options);
|
|
17456
17458
|
} catch (error) {
|
|
17457
17459
|
exitWithError(error);
|
|
17458
17460
|
}
|
|
17459
17461
|
});
|
|
17460
17462
|
program.command("deploy").description("Deploy a stage through its target").option("--target <name>", "Deploy target: dokploy, compose, sst, or one named in deploy.targets (default: deploy.default)").option("--provider <provider>", "[DEPRECATED] Use --target instead").requiredOption("--stage <stage>", "Deployment stage (e.g., production, staging)").option("--tag <tag>", "Release tag (default: a timestamp; compose: the commit). Each image is tagged <tag>-<stage>. Compose pulls a given tag").option("--skip-push", "Skip pushing image to registry").option("--skip-build", "Skip build step (use existing build)").option("--json", "Write events as JSON lines instead of progress; never prompts").option("--dry-run", "Show what would be created or reused; change, build and push nothing").option("--atomic", "If the release fails, roll back every app it released, not only the failed ones").option("--allow-dev-services", "Server targets: run the dev service (MinIO, Mailpit) for every bucket and mail the stage doesn't account for. Not production-grade").option("--skip-dns", "Compose: neither write the public hosts' DNS records nor check they point at GKM_SERVER_IPV4 (a CDN or proxy in front, or records written elsewhere)").option("--rotate-keys", "Deployed stage: each provider issues its runtime keys a successor (the old one is deleted by the next deploy)").option("--retire-old-keys", "Deployed stage: delete a rotated-out key now instead of on the next deploy").action(async (options) => {
|
|
17461
|
-
const { deployCli } = await Promise.resolve().then(() => require("./cli-
|
|
17463
|
+
const { deployCli } = await Promise.resolve().then(() => require("./cli-BCGkzaR1.cjs"));
|
|
17462
17464
|
const globalOptions = program.opts();
|
|
17463
17465
|
const code = await deployCli({
|
|
17464
17466
|
cwd: (0, node_path.resolve)(globalOptions.cwd ?? process.cwd()),
|
|
@@ -17478,8 +17480,8 @@ program.command("deploy").description("Deploy a stage through its target").optio
|
|
|
17478
17480
|
});
|
|
17479
17481
|
program.command("deploy:rollback").description("Put a stage's app back on its previous release (Dokploy): one app with --app, every app with --atomic").requiredOption("--stage <stage>", "A deployed stage").option("--app <app>", "The app to roll back").option("--atomic", "Roll back every app that has an earlier release").action(async (options) => {
|
|
17480
17482
|
try {
|
|
17481
|
-
const { rollbackStage } = await Promise.resolve().then(() => require("./rollback-
|
|
17482
|
-
const { terminalCredentials } = await Promise.resolve().then(() => require("./terminal-
|
|
17483
|
+
const { rollbackStage } = await Promise.resolve().then(() => require("./rollback-Op8Tc5N-.cjs")).then((n) => n.rollback_exports);
|
|
17484
|
+
const { terminalCredentials } = await Promise.resolve().then(() => require("./terminal-DPf137EJ.cjs"));
|
|
17483
17485
|
const globalOptions = program.opts();
|
|
17484
17486
|
await rollbackStage({
|
|
17485
17487
|
cwd: (0, node_path.resolve)(globalOptions.cwd ?? process.cwd()),
|
|
@@ -17497,7 +17499,7 @@ program.command("compose:server").description("Set up a stage's server for compo
|
|
|
17497
17499
|
try {
|
|
17498
17500
|
const globalOptions = program.opts();
|
|
17499
17501
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
17500
|
-
const { composeServerCommand } = await Promise.resolve().then(() => require("./serverSetup-
|
|
17502
|
+
const { composeServerCommand } = await Promise.resolve().then(() => require("./serverSetup-BFdzPTIT.cjs"));
|
|
17501
17503
|
await composeServerCommand(options);
|
|
17502
17504
|
} catch (error) {
|
|
17503
17505
|
exitWithError(error);
|
|
@@ -17522,7 +17524,7 @@ program.command("deploy:github").description("Let GitHub Actions deploy a stage:
|
|
|
17522
17524
|
try {
|
|
17523
17525
|
const globalOptions = program.opts();
|
|
17524
17526
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
17525
|
-
const { deployGithubCommand } = await Promise.resolve().then(() => require("./github-
|
|
17527
|
+
const { deployGithubCommand } = await Promise.resolve().then(() => require("./github-D1-_OnGL.cjs"));
|
|
17526
17528
|
await deployGithubCommand(options);
|
|
17527
17529
|
} catch (error) {
|
|
17528
17530
|
exitWithError(error);
|
|
@@ -17532,7 +17534,7 @@ program.command("stages").description("The workspace's stages from gkm.config.ts
|
|
|
17532
17534
|
try {
|
|
17533
17535
|
const globalOptions = program.opts();
|
|
17534
17536
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
17535
|
-
const { stagesCommand } = await Promise.resolve().then(() => require("./stages-
|
|
17537
|
+
const { stagesCommand } = await Promise.resolve().then(() => require("./stages-BeSQQQ4z.cjs"));
|
|
17536
17538
|
await stagesCommand(options);
|
|
17537
17539
|
} catch (error) {
|
|
17538
17540
|
exitWithError(error);
|