@geekmidas/cli 10.0.0-alpha.139 → 10.0.0-alpha.140

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.
Files changed (221) hide show
  1. package/dist/{EndpointGenerator-DDfPq2AZ.mjs → EndpointGenerator-BMRL04ic.mjs} +2 -2
  2. package/dist/{EndpointGenerator-DDfPq2AZ.mjs.map → EndpointGenerator-BMRL04ic.mjs.map} +1 -1
  3. package/dist/{EndpointGenerator-BGKb_Ie6.cjs → EndpointGenerator-ePscnbwB.cjs} +2 -2
  4. package/dist/{EndpointGenerator-BGKb_Ie6.cjs.map → EndpointGenerator-ePscnbwB.cjs.map} +1 -1
  5. package/dist/{GoDaddyProvider-baMIwhIy.mjs → GoDaddyProvider-BgY6mqoH.mjs} +42 -17
  6. package/dist/GoDaddyProvider-BgY6mqoH.mjs.map +1 -0
  7. package/dist/{GoDaddyProvider-DA0rzRQt.cjs → GoDaddyProvider-C-rs22Zv.cjs} +42 -17
  8. package/dist/GoDaddyProvider-C-rs22Zv.cjs.map +1 -0
  9. package/dist/{HostingerProvider-Cjh_2Ml6.mjs → HostingerProvider-CgMuKgO_.mjs} +13 -4
  10. package/dist/HostingerProvider-CgMuKgO_.mjs.map +1 -0
  11. package/dist/{HostingerProvider-OdQmKXE3.cjs → HostingerProvider-DEqpvoiD.cjs} +13 -4
  12. package/dist/HostingerProvider-DEqpvoiD.cjs.map +1 -0
  13. package/dist/{LegacyStateStore-h1u5xlpb.cjs → LegacyStateStore-6xskEtld.cjs} +3 -3
  14. package/dist/{LegacyStateStore-h1u5xlpb.cjs.map → LegacyStateStore-6xskEtld.cjs.map} +1 -1
  15. package/dist/{LegacyStateStore-BSrw1yNS.mjs → LegacyStateStore-Dx65SWE9.mjs} +3 -3
  16. package/dist/{LegacyStateStore-BSrw1yNS.mjs.map → LegacyStateStore-Dx65SWE9.mjs.map} +1 -1
  17. package/dist/{LocalStateStore-HmKqUWkF.cjs → LocalStateStore-DFtTtHty.cjs} +2 -2
  18. package/dist/{LocalStateStore-HmKqUWkF.cjs.map → LocalStateStore-DFtTtHty.cjs.map} +1 -1
  19. package/dist/{LocalStateStore-BlH6Eanc.mjs → LocalStateStore-Dto39TCx.mjs} +2 -2
  20. package/dist/{LocalStateStore-BlH6Eanc.mjs.map → LocalStateStore-Dto39TCx.mjs.map} +1 -1
  21. package/dist/{OpenApiTsGenerator-DSy2gbfi.mjs → OpenApiTsGenerator-B-PQLx8X.mjs} +2 -2
  22. package/dist/{OpenApiTsGenerator-DSy2gbfi.mjs.map → OpenApiTsGenerator-B-PQLx8X.mjs.map} +1 -1
  23. package/dist/{OpenApiTsGenerator-B33Y_6oe.cjs → OpenApiTsGenerator-BvacdbiG.cjs} +2 -2
  24. package/dist/{OpenApiTsGenerator-B33Y_6oe.cjs.map → OpenApiTsGenerator-BvacdbiG.cjs.map} +1 -1
  25. package/dist/{S3StateStore-Ccz7J7Cf.cjs → S3StateStore-B-9ea-sX.cjs} +2 -2
  26. package/dist/{S3StateStore-Ccz7J7Cf.cjs.map → S3StateStore-B-9ea-sX.cjs.map} +1 -1
  27. package/dist/{S3StateStore-CwVWjNXJ.mjs → S3StateStore-C01zMOYm.mjs} +2 -2
  28. package/dist/{S3StateStore-CwVWjNXJ.mjs.map → S3StateStore-C01zMOYm.mjs.map} +1 -1
  29. package/dist/{SSMStateStore-CAxcx0U2.cjs → SSMStateStore-CKArcPUh.cjs} +2 -2
  30. package/dist/{SSMStateStore-CAxcx0U2.cjs.map → SSMStateStore-CKArcPUh.cjs.map} +1 -1
  31. package/dist/{SSMStateStore-CASt-lob.mjs → SSMStateStore-k-4XM7mb.mjs} +2 -2
  32. package/dist/{SSMStateStore-CASt-lob.mjs.map → SSMStateStore-k-4XM7mb.mjs.map} +1 -1
  33. package/dist/{SubscriberGenerator-zUd87wvg.mjs → SubscriberGenerator-DLPH-ynS.mjs} +148 -11
  34. package/dist/SubscriberGenerator-DLPH-ynS.mjs.map +1 -0
  35. package/dist/{SubscriberGenerator-DDCqRTbq.cjs → SubscriberGenerator-DR4Y7ihK.cjs} +170 -9
  36. package/dist/SubscriberGenerator-DR4Y7ihK.cjs.map +1 -0
  37. package/dist/{add-Cq7B_VSJ.cjs → add-BgzsYxUq.cjs} +6 -6
  38. package/dist/{add-Cq7B_VSJ.cjs.map → add-BgzsYxUq.cjs.map} +1 -1
  39. package/dist/{add-6tyL4tWq.mjs → add-CiIrpOb9.mjs} +6 -6
  40. package/dist/{add-6tyL4tWq.mjs.map → add-CiIrpOb9.mjs.map} +1 -1
  41. package/dist/{bundler-CXuVyqXY.mjs → bundler-C4uMSy8e.mjs} +5 -5
  42. package/dist/{bundler-CXuVyqXY.mjs.map → bundler-C4uMSy8e.mjs.map} +1 -1
  43. package/dist/{bundler-DRmdcbXx.cjs → bundler-DKxuDoVL.cjs} +5 -5
  44. package/dist/{bundler-DRmdcbXx.cjs.map → bundler-DKxuDoVL.cjs.map} +1 -1
  45. package/dist/{cli-DxtrQdRa.mjs → cli-Bm2is6R_.mjs} +3 -3
  46. package/dist/{cli-DxtrQdRa.mjs.map → cli-Bm2is6R_.mjs.map} +1 -1
  47. package/dist/{cli-DYru-gjk.cjs → cli-na0npMhC.cjs} +3 -3
  48. package/dist/{cli-DYru-gjk.cjs.map → cli-na0npMhC.cjs.map} +1 -1
  49. package/dist/{compose-Bdx2rqtO.mjs → compose-CVatM7Cl.mjs} +31 -7
  50. package/dist/compose-CVatM7Cl.mjs.map +1 -0
  51. package/dist/{compose-DJMHSSDI.cjs → compose-D8U9ygdm.cjs} +31 -7
  52. package/dist/compose-D8U9ygdm.cjs.map +1 -0
  53. package/dist/{config-B7HaIfYM.d.mts → config-BbivVpq0.d.mts} +3 -3
  54. package/dist/{config-B7HaIfYM.d.mts.map → config-BbivVpq0.d.mts.map} +1 -1
  55. package/dist/{config-DySjXKd2.d.cts → config-BcL1Fojs.d.cts} +3 -3
  56. package/dist/{config-DySjXKd2.d.cts.map → config-BcL1Fojs.d.cts.map} +1 -1
  57. package/dist/config.cjs +2 -2
  58. package/dist/config.d.cts +3 -3
  59. package/dist/config.d.mts +3 -3
  60. package/dist/config.mjs +2 -2
  61. package/dist/{credentialSchemas-DYzO2_yG.mjs → credentialSchemas-DUCSYl9a.mjs} +2 -2
  62. package/dist/{credentialSchemas-DYzO2_yG.mjs.map → credentialSchemas-DUCSYl9a.mjs.map} +1 -1
  63. package/dist/{credentialSchemas-BJMvQlks.cjs → credentialSchemas-DZ2Nh5li.cjs} +2 -2
  64. package/dist/{credentialSchemas-BJMvQlks.cjs.map → credentialSchemas-DZ2Nh5li.cjs.map} +1 -1
  65. package/dist/deploy/public.cjs +8 -8
  66. package/dist/deploy/public.d.cts +3 -8
  67. package/dist/deploy/public.d.cts.map +1 -1
  68. package/dist/deploy/public.d.mts +3 -8
  69. package/dist/deploy/public.d.mts.map +1 -1
  70. package/dist/deploy/public.mjs +8 -8
  71. package/dist/{deploy-o5n6l4MO.mjs → deploy-CDcO08Xz.mjs} +457 -47
  72. package/dist/deploy-CDcO08Xz.mjs.map +1 -0
  73. package/dist/{deploy-88E_1bHW.cjs → deploy-DrQB7ytj.cjs} +457 -46
  74. package/dist/deploy-DrQB7ytj.cjs.map +1 -0
  75. package/dist/{discover-DWtHjc1x.mjs → discover-B2m8ytyq.mjs} +2 -2
  76. package/dist/{discover-DWtHjc1x.mjs.map → discover-B2m8ytyq.mjs.map} +1 -1
  77. package/dist/{discover-B3G8eyWX.cjs → discover-yqeJ2Bx7.cjs} +2 -2
  78. package/dist/{discover-B3G8eyWX.cjs.map → discover-yqeJ2Bx7.cjs.map} +1 -1
  79. package/dist/{dokploy-al6V2P9s.cjs → dokploy-BKjPDvSN.cjs} +2 -2
  80. package/dist/{dokploy-al6V2P9s.cjs.map → dokploy-BKjPDvSN.cjs.map} +1 -1
  81. package/dist/{dokploy-C1QCPJ1t.mjs → dokploy-k4_ZN8zN.mjs} +2 -2
  82. package/dist/{dokploy-C1QCPJ1t.mjs.map → dokploy-k4_ZN8zN.mjs.map} +1 -1
  83. package/dist/{eas-D0jmXv7F.mjs → eas-B1wBvwPH.mjs} +2 -2
  84. package/dist/{eas-D0jmXv7F.mjs.map → eas-B1wBvwPH.mjs.map} +1 -1
  85. package/dist/{eas-DAsdU35R.cjs → eas-Bg4dI6n2.cjs} +2 -2
  86. package/dist/{eas-DAsdU35R.cjs.map → eas-Bg4dI6n2.cjs.map} +1 -1
  87. package/dist/{encryption-G8Ouiy55.mjs → encryption-Bve0PVOo.mjs} +3 -3
  88. package/dist/{encryption-G8Ouiy55.mjs.map → encryption-Bve0PVOo.mjs.map} +1 -1
  89. package/dist/{encryption-C5c50qvt.cjs → encryption-DL_y8t6V.cjs} +3 -3
  90. package/dist/{encryption-C5c50qvt.cjs.map → encryption-DL_y8t6V.cjs.map} +1 -1
  91. package/dist/{engine-9C68_A78.cjs → engine-BhR5lt_V.cjs} +5 -5
  92. package/dist/{engine-9C68_A78.cjs.map → engine-BhR5lt_V.cjs.map} +1 -1
  93. package/dist/{engine-bEuItjJN.mjs → engine-HMLf20iZ.mjs} +5 -5
  94. package/dist/{engine-bEuItjJN.mjs.map → engine-HMLf20iZ.mjs.map} +1 -1
  95. package/dist/{github-R-Pot7QV.cjs → github-B2hJVl-n.cjs} +6 -6
  96. package/dist/{github-R-Pot7QV.cjs.map → github-B2hJVl-n.cjs.map} +1 -1
  97. package/dist/{github-Buh2ldNN.mjs → github-DKn9ACi2.mjs} +6 -6
  98. package/dist/{github-Buh2ldNN.mjs.map → github-DKn9ACi2.mjs.map} +1 -1
  99. package/dist/{googlePlay-B_X_DJp0.mjs → googlePlay-CWq7ND_X.mjs} +3 -3
  100. package/dist/{googlePlay-B_X_DJp0.mjs.map → googlePlay-CWq7ND_X.mjs.map} +1 -1
  101. package/dist/{googlePlay-Bi5qneXA.cjs → googlePlay-DtuN0-7D.cjs} +3 -3
  102. package/dist/{googlePlay-Bi5qneXA.cjs.map → googlePlay-DtuN0-7D.cjs.map} +1 -1
  103. package/dist/{index-CTKfBwU3.d.cts → index-BZZeEWug.d.mts} +2 -2
  104. package/dist/{index-BymyHYdL.d.mts.map → index-BZZeEWug.d.mts.map} +1 -1
  105. package/dist/{index-BymyHYdL.d.mts → index-C1jffZ5_.d.cts} +2 -2
  106. package/dist/{index-CTKfBwU3.d.cts.map → index-C1jffZ5_.d.cts.map} +1 -1
  107. package/dist/index.cjs +61 -61
  108. package/dist/index.cjs.map +1 -1
  109. package/dist/index.mjs +61 -61
  110. package/dist/index.mjs.map +1 -1
  111. package/dist/{migrate-DjCvZL4P.cjs → migrate-BLVZqHtN.cjs} +3 -3
  112. package/dist/{migrate-DjCvZL4P.cjs.map → migrate-BLVZqHtN.cjs.map} +1 -1
  113. package/dist/{migrate-WkC0pay4.mjs → migrate-DCvD4RJW.mjs} +4 -4
  114. package/dist/{migrate-WkC0pay4.mjs.map → migrate-DCvD4RJW.mjs.map} +1 -1
  115. package/dist/{migrate-C9abovJK.mjs → migrate-W0ruUNb9.mjs} +3 -3
  116. package/dist/{migrate-C9abovJK.mjs.map → migrate-W0ruUNb9.mjs.map} +1 -1
  117. package/dist/{migrate-Bv4AqxYP.cjs → migrate-iUui7B4q.cjs} +4 -4
  118. package/dist/{migrate-Bv4AqxYP.cjs.map → migrate-iUui7B4q.cjs.map} +1 -1
  119. package/dist/openapi.cjs +3 -3
  120. package/dist/openapi.d.cts +1 -1
  121. package/dist/openapi.d.mts +1 -1
  122. package/dist/openapi.mjs +3 -3
  123. package/dist/{publish-BbJ7Ols2.cjs → publish-CqvDA5ry.cjs} +2 -2
  124. package/dist/{publish-BbJ7Ols2.cjs.map → publish-CqvDA5ry.cjs.map} +1 -1
  125. package/dist/{publish-BVsLFs-n.mjs → publish-CxIBBD3b.mjs} +2 -2
  126. package/dist/{publish-BVsLFs-n.mjs.map → publish-CxIBBD3b.mjs.map} +1 -1
  127. package/dist/{ready-B_to-BSY.mjs → ready-CGqJ74Kt.mjs} +5 -5
  128. package/dist/{ready-B_to-BSY.mjs.map → ready-CGqJ74Kt.mjs.map} +1 -1
  129. package/dist/{ready-C-nMK_FB.cjs → ready-DuU0FXSj.cjs} +5 -5
  130. package/dist/{ready-C-nMK_FB.cjs.map → ready-DuU0FXSj.cjs.map} +1 -1
  131. package/dist/reconcile/public.cjs +1 -1
  132. package/dist/reconcile/public.d.cts +1 -1
  133. package/dist/reconcile/public.d.mts +1 -1
  134. package/dist/reconcile/public.mjs +1 -1
  135. package/dist/{resolve-CBEFNYca.cjs → resolve-BEVVvi13.cjs} +3 -3
  136. package/dist/{resolve-CBEFNYca.cjs.map → resolve-BEVVvi13.cjs.map} +1 -1
  137. package/dist/{resolve-CTYtfl0x.mjs → resolve-CMC0MI0Z.mjs} +3 -3
  138. package/dist/{resolve-CTYtfl0x.mjs.map → resolve-CMC0MI0Z.mjs.map} +1 -1
  139. package/dist/{rollback-BT6oPcnZ.mjs → rollback-CZiQkukY.mjs} +5 -5
  140. package/dist/{rollback-BT6oPcnZ.mjs.map → rollback-CZiQkukY.mjs.map} +1 -1
  141. package/dist/{rollback-RzUJ728z.cjs → rollback-e0zGkaBx.cjs} +5 -5
  142. package/dist/{rollback-RzUJ728z.cjs.map → rollback-e0zGkaBx.cjs.map} +1 -1
  143. package/dist/{runtime-mR2O0z64.d.mts → runtime-Bvgyxm88.d.cts} +2 -2
  144. package/dist/{runtime-Dl601UcU.d.cts.map → runtime-Bvgyxm88.d.cts.map} +1 -1
  145. package/dist/{runtime-Dl601UcU.d.cts → runtime-CeAt1IJd.d.mts} +2 -2
  146. package/dist/{runtime-mR2O0z64.d.mts.map → runtime-CeAt1IJd.d.mts.map} +1 -1
  147. package/dist/{s3-BUkV5_fV.cjs → s3-BKnL6YGQ.cjs} +2 -2
  148. package/dist/{s3-BUkV5_fV.cjs.map → s3-BKnL6YGQ.cjs.map} +1 -1
  149. package/dist/{s3-VpdagzYE.mjs → s3-DW7SLsb8.mjs} +2 -2
  150. package/dist/{s3-VpdagzYE.mjs.map → s3-DW7SLsb8.mjs.map} +1 -1
  151. package/dist/sandbox/credentials-worker.cjs +2 -2
  152. package/dist/sandbox/credentials-worker.mjs +2 -2
  153. package/dist/sandbox/discover-worker.cjs +1 -1
  154. package/dist/sandbox/discover-worker.mjs +1 -1
  155. package/dist/sandbox/migrate-worker.cjs +1 -1
  156. package/dist/sandbox/migrate-worker.mjs +1 -1
  157. package/dist/{seeds-CcK_C30B.cjs → seeds-BR_7hJTw.cjs} +122 -13
  158. package/dist/seeds-BR_7hJTw.cjs.map +1 -0
  159. package/dist/{seeds-CSNYLc4p.mjs → seeds-nCxxlP5h.mjs} +111 -14
  160. package/dist/seeds-nCxxlP5h.mjs.map +1 -0
  161. package/dist/{serverSetup-DiJPhPOz.mjs → serverSetup-C3Tt9X1R.mjs} +6 -6
  162. package/dist/{serverSetup-DiJPhPOz.mjs.map → serverSetup-C3Tt9X1R.mjs.map} +1 -1
  163. package/dist/{serverSetup-C2U4-2i0.cjs → serverSetup-D2Xzsp2t.cjs} +6 -6
  164. package/dist/{serverSetup-C2U4-2i0.cjs.map → serverSetup-D2Xzsp2t.cjs.map} +1 -1
  165. package/dist/{sniffer-B1iineXX.cjs → sniffer-BWgXPFAt.cjs} +8 -8
  166. package/dist/{sniffer-B1iineXX.cjs.map → sniffer-BWgXPFAt.cjs.map} +1 -1
  167. package/dist/{sniffer-z-p2lTtc.mjs → sniffer-eEF_fIId.mjs} +8 -8
  168. package/dist/{sniffer-z-p2lTtc.mjs.map → sniffer-eEF_fIId.mjs.map} +1 -1
  169. package/dist/{snsSubscriptions-CYy7Faid.mjs → snsSubscriptions-BSoqUgsq.mjs} +28 -13
  170. package/dist/snsSubscriptions-BSoqUgsq.mjs.map +1 -0
  171. package/dist/{snsSubscriptions-C7wClS6U.cjs → snsSubscriptions-Y9declDd.cjs} +28 -13
  172. package/dist/snsSubscriptions-Y9declDd.cjs.map +1 -0
  173. package/dist/{stage-Cn3EEIB9.cjs → stage-BEcxppsu.cjs} +6 -6
  174. package/dist/{stage-Cn3EEIB9.cjs.map → stage-BEcxppsu.cjs.map} +1 -1
  175. package/dist/{stage-Cx1KKX_o.mjs → stage-DhcbcAar.mjs} +6 -6
  176. package/dist/{stage-Cx1KKX_o.mjs.map → stage-DhcbcAar.mjs.map} +1 -1
  177. package/dist/{stages-CuV3zh-h.cjs → stages--icWbhPy.cjs} +2 -2
  178. package/dist/{stages-CuV3zh-h.cjs.map → stages--icWbhPy.cjs.map} +1 -1
  179. package/dist/{stages-COSKjrfd.mjs → stages-CUwSy39f.mjs} +2 -2
  180. package/dist/{stages-COSKjrfd.mjs.map → stages-CUwSy39f.mjs.map} +1 -1
  181. package/dist/target/public.cjs +1 -1
  182. package/dist/target/public.d.cts +2 -2
  183. package/dist/target/public.d.mts +2 -2
  184. package/dist/target/public.mjs +1 -1
  185. package/dist/{terminal-BIZRxV-e.cjs → terminal-DURcYlVX.cjs} +2 -2
  186. package/dist/{terminal-BIZRxV-e.cjs.map → terminal-DURcYlVX.cjs.map} +1 -1
  187. package/dist/{terminal-PEvt24kO.mjs → terminal-yOZ7kKF9.mjs} +2 -2
  188. package/dist/{terminal-PEvt24kO.mjs.map → terminal-yOZ7kKF9.mjs.map} +1 -1
  189. package/dist/{types-DOYYfQme.d.cts → types-C6hDCkV2.d.mts} +168 -129
  190. package/dist/types-C6hDCkV2.d.mts.map +1 -0
  191. package/dist/{types-C-uwKr3O.d.mts → types-Dy1eV7yc.d.cts} +169 -128
  192. package/dist/types-Dy1eV7yc.d.cts.map +1 -0
  193. package/dist/vitest.cjs +1 -1
  194. package/dist/vitest.mjs +1 -1
  195. package/dist/workspace/index.cjs +1 -1
  196. package/dist/workspace/index.d.cts +2 -2
  197. package/dist/workspace/index.d.mts +2 -2
  198. package/dist/workspace/index.mjs +1 -1
  199. package/dist/{workspace-aiDQZMje.mjs → workspace-BbfBFtjn.mjs} +95 -10
  200. package/dist/workspace-BbfBFtjn.mjs.map +1 -0
  201. package/dist/{workspace-secxwA6K.cjs → workspace-Dkm3HL9e.cjs} +118 -9
  202. package/dist/workspace-Dkm3HL9e.cjs.map +1 -0
  203. package/package.json +16 -15
  204. package/dist/GoDaddyProvider-DA0rzRQt.cjs.map +0 -1
  205. package/dist/GoDaddyProvider-baMIwhIy.mjs.map +0 -1
  206. package/dist/HostingerProvider-Cjh_2Ml6.mjs.map +0 -1
  207. package/dist/HostingerProvider-OdQmKXE3.cjs.map +0 -1
  208. package/dist/SubscriberGenerator-DDCqRTbq.cjs.map +0 -1
  209. package/dist/SubscriberGenerator-zUd87wvg.mjs.map +0 -1
  210. package/dist/compose-Bdx2rqtO.mjs.map +0 -1
  211. package/dist/compose-DJMHSSDI.cjs.map +0 -1
  212. package/dist/deploy-88E_1bHW.cjs.map +0 -1
  213. package/dist/deploy-o5n6l4MO.mjs.map +0 -1
  214. package/dist/seeds-CSNYLc4p.mjs.map +0 -1
  215. package/dist/seeds-CcK_C30B.cjs.map +0 -1
  216. package/dist/snsSubscriptions-C7wClS6U.cjs.map +0 -1
  217. package/dist/snsSubscriptions-CYy7Faid.mjs.map +0 -1
  218. package/dist/types-C-uwKr3O.d.mts.map +0 -1
  219. package/dist/types-DOYYfQme.d.cts.map +0 -1
  220. package/dist/workspace-aiDQZMje.mjs.map +0 -1
  221. package/dist/workspace-secxwA6K.cjs.map +0 -1
@@ -1,23 +1,23 @@
1
1
  import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
2
2
  import { r as storedCredentials, x as gkmHome } from "./credentials-DpfnUvIR.mjs";
3
- import { $ as IamUserNotOwned, G as checkS3Config, J as BucketNameUnavailable, K as AccessKeyLimit, L as resolveStageTelemetry, N as assertDeployedStage, Q as BucketRegionUnknown, U as stageProvider, W as S3_PROVISIONING, X as BucketProbeFailed, Y as BucketOwnedByAnotherProject, Z as BucketRegionMismatch, et as ProvisionedBucketUnreachable, ht as isReservedStageKey, nt as RotationInProgress, q as BucketKeySetElsewhere, rt as S3RegionRequired, tt as RecordedBucketUnreachable, u as getAppBuildOrder } from "./workspace-aiDQZMje.mjs";
4
- import { E as BACKUPS_URL_KEY, I as stageBackups, L as deploysWithCompose, M as backupExpiries, P as backupsPrefix, S as assertSitePasswords, T as BACKUPS_SERVICE, _ as stageDnsDomains, a as subscriptionKey, b as awsEndpoint, d as recordTtl, l as dnsCredentials, m as settleStackDns, o as subscriptionResource, x as awsProvisioningCredentials, y as awsClientConfig } from "./snsSubscriptions-CYy7Faid.mjs";
3
+ import { $ as BucketOwnedByAnotherProject, G as checkSesConfig, J as S3_PROVISIONING, K as InboxNotProvisioned, L as resolveStageTelemetry, N as assertDeployedStage, Q as BucketNameUnavailable, U as stageProvider, W as SES_PROVISIONING, X as AccessKeyLimit, Y as checkS3Config, Z as BucketKeySetElsewhere, at as RecordedBucketUnreachable, et as BucketProbeFailed, it as ProvisionedBucketUnreachable, nt as BucketRegionUnknown, ot as RotationInProgress, q as SesReceivingUnsupported, rt as IamUserNotOwned, st as S3RegionRequired, tt as BucketRegionMismatch, u as getAppBuildOrder, yt as isReservedStageKey } from "./workspace-BbfBFtjn.mjs";
4
+ import { E as BACKUPS_URL_KEY, I as stageBackups, L as deploysWithCompose, M as backupExpiries, P as backupsPrefix, S as assertSitePasswords, T as BACKUPS_SERVICE, _ as stageDnsDomains, a as subscriptionKey, b as awsEndpoint, d as recordTtl, l as dnsCredentials, m as settleStackDns, o as subscriptionResource, x as awsProvisioningCredentials, y as awsClientConfig } from "./snsSubscriptions-BSoqUgsq.mjs";
5
5
  import { o as builtinTarget } from "./define-6poNqm5O.mjs";
6
- import { $ as ORIGIN_VERIFY_HEADER, En as mergeLifecycle, N as stageProviderNotes, P as PROVIDER_KINDS, Qt as initStageSecrets, Yt as secretsStoreFor, _t as appEnvKeys, b as createComposeState, br as isMainFrontendApp, ct as ExternalServicesNotConfigured, d as DeployJournal, dt as devServicesUsed, f as extractSubdomain, ft as externalServices, ht as stageServiceDeclarations, j as assertStageProvidersEnabled, m as normalizeDnsConfig, nt as originSecretKey, p as findRootDomain, pt as reportDevServices, rt as processorOriginHost, st as DevServicesNeedServerTarget, tr as usesTelemetry, tt as newOriginSecret, wt as constructGlobs, x as createEmptyState, xr as resolveHost, yr as NoDomainForStage } from "./seeds-CSNYLc4p.mjs";
6
+ import { C as createEmptyState, Cr as resolveHost, Et as constructGlobs, F as stageProviderNotes, I as PROVIDER_KINDS, N as assertStageProvidersEnabled, On as mergeLifecycle, S as createComposeState, Sr as isMainFrontendApp, Zt as secretsStoreFor, _t as stageServiceDeclarations, at as processorOriginHost, d as DeployJournal, en as initStageSecrets, f as extractSubdomain, ht as reportDevServices, it as originSecretKey, lt as DevServicesNeedServerTarget, m as normalizeDnsConfig, mt as externalServices, p as findRootDomain, pt as devServicesUsed, rr as usesTelemetry, rt as newOriginSecret, tt as ORIGIN_VERIFY_HEADER, ut as ExternalServicesNotConfigured, xr as NoDomainForStage, y as mxValue, yt as appEnvKeys } from "./seeds-nCxxlP5h.mjs";
7
+ import { s as subscriberRoute } from "./SubscriberGenerator-DLPH-ynS.mjs";
7
8
  import { n as derivedApps, t as appKey } from "./derive-Cd7Hl3r2.mjs";
8
9
  import { n as deployIdentity, t as applicationName } from "./identity-CBXr4wNi.mjs";
9
- import { i as discover, p as withOutput } from "./discover-DWtHjc1x.mjs";
10
+ import { i as discover, p as withOutput } from "./discover-B2m8ytyq.mjs";
10
11
  import { c as withSandbox } from "./sandbox-CbVB7uOD.mjs";
11
12
  import { findWorkspaceRoot, loadWorkspaceConfig } from "./config.mjs";
12
- import { s as subscriberRoute } from "./SubscriberGenerator-zUd87wvg.mjs";
13
- import { a as parseTargetOptions, o as resolveTarget } from "./resolve-CTYtfl0x.mjs";
13
+ import { a as parseTargetOptions, o as resolveTarget } from "./resolve-CMC0MI0Z.mjs";
14
14
  import { t as LocalSandbox } from "./local-B7Zv1NoA.mjs";
15
- import { E as eventError, S as createStateStore, v as assertStateOutlivesRun, y as assertStateRoom } from "./sniffer-z-p2lTtc.mjs";
15
+ import { E as eventError, S as createStateStore, v as assertStateOutlivesRun, y as assertStateRoom } from "./sniffer-eEF_fIId.mjs";
16
16
  import { a as findProjectBucket, i as ensureProjectBucket, o as projectBucketName, r as callerAccountId, s as reconcileProjectBucketLifecycle } from "./projectBucket-C_DN4WzF.mjs";
17
- import { n as assertStageCredentials } from "./credentialSchemas-DYzO2_yG.mjs";
17
+ import { n as assertStageCredentials } from "./credentialSchemas-DUCSYl9a.mjs";
18
18
  import { resolve } from "node:path";
19
19
  import { randomInt } from "node:crypto";
20
- import { bucketExpiry, dependentsOf, kebabCase, provideKey, providedKeyFor } from "@geekmidas/manifest";
20
+ import { INBOX_MESSAGES_PREFIX, bucketExpiry, dependentsOf, kebabCase, provideKey, providedKeyFor, receiptRecipients } from "@geekmidas/manifest";
21
21
  import * as s3Url from "@geekmidas/storage/s3-url";
22
22
  //#region src/target/secrets.ts
23
23
  /**
@@ -250,6 +250,14 @@ function bucketPolicy(bucket, open = [], options = {}) {
250
250
  Action: "s3:GetObject",
251
251
  Resource: resources
252
252
  });
253
+ if (options.sesWrite) statements.push({
254
+ Sid: "GkmSesWritesMail",
255
+ Effect: "Allow",
256
+ Principal: { Service: "ses.amazonaws.com" },
257
+ Action: "s3:PutObject",
258
+ Resource: `${bucketArn(bucket)}/${options.sesWrite.prefix}*`,
259
+ Condition: { StringEquals: { "aws:SourceAccount": options.sesWrite.account } }
260
+ });
253
261
  return {
254
262
  Version: "2012-10-17",
255
263
  Statement: statements
@@ -810,11 +818,12 @@ async function verifyStageBackups(input) {
810
818
  //#region src/providers/dnsWriter.ts
811
819
  /**
812
820
  * The DNS records a provider asks for — a certificate's validation record, a
813
- * CDN's name — written through the stage's own DNS providers.
821
+ * CDN's name, a domain's MX — written through the stage's own DNS providers.
814
822
  *
815
823
  * The same machinery the deploy's DNS step uses for the stack's hosts
816
- * (`settleStackDns`), handed a plan of CNAMEs instead of the server's
817
- * addresses: a record holding its value is left alone, one with another value
824
+ * (`settleStackDns`), handed a plan of CNAMEs and MX records instead of the
825
+ * server's addresses — an MX's value in its zone-file form,
826
+ * `<priority> <host>`, which every DNS provider reads and writes: a record holding its value is left alone, one with another value
818
827
  * is replaced and printed, and what is written is read back. A host under no
819
828
  * domain in `dns`, or under a `manual` one, is printed for the person to
820
829
  * create and reported back, so the provider can say what it is waiting on.
@@ -826,10 +835,11 @@ async function writeProviderDns(records, options) {
826
835
  const domains = /* @__PURE__ */ new Map();
827
836
  for (const record of records) {
828
837
  const host = record.host.toLowerCase().replace(/\.$/, "");
829
- const value = record.value.replace(/\.$/, "");
838
+ const target = record.value.replace(/\.$/, "");
839
+ const value = record.type === "MX" ? mxValue(record.priority, target) : target;
830
840
  const domain = findRootDomain(host, dns);
831
841
  if (!domain) {
832
- log(` create at its DNS host: ${host} CNAME ${value}`);
842
+ log(` create at its DNS host: ${host} ${record.type} ${value}`);
833
843
  manual.push(host);
834
844
  continue;
835
845
  }
@@ -1156,7 +1166,7 @@ const defaultCdnClients = async (credential) => {
1156
1166
  };
1157
1167
  let makeCdnClients = defaultCdnClients;
1158
1168
  /** What an AWS SDK error is called, whichever field carries it. */
1159
- function errorName$2(error) {
1169
+ function errorName$3(error) {
1160
1170
  const e = error;
1161
1171
  return e?.Code ?? e?.name ?? "";
1162
1172
  }
@@ -1164,7 +1174,7 @@ async function readOr$2(read, missing) {
1164
1174
  try {
1165
1175
  return await read();
1166
1176
  } catch (error) {
1167
- if (missing.includes(errorName$2(error))) return void 0;
1177
+ if (missing.includes(errorName$3(error))) return void 0;
1168
1178
  throw error;
1169
1179
  }
1170
1180
  }
@@ -1667,7 +1677,11 @@ const defaultEventsClients = async (credential, region) => {
1667
1677
  };
1668
1678
  };
1669
1679
  let makeEventsClients = defaultEventsClients;
1670
- function errorName$1(error) {
1680
+ /** The stage's SNS, SQS and account, through the factory a test may replace. */
1681
+ function eventsClients(credential, region) {
1682
+ return makeEventsClients(credential, region);
1683
+ }
1684
+ function errorName$2(error) {
1671
1685
  const e = error;
1672
1686
  return e?.name ?? e?.Code ?? e?.code ?? "";
1673
1687
  }
@@ -1675,19 +1689,18 @@ async function readOr$1(read, missing) {
1675
1689
  try {
1676
1690
  return await read();
1677
1691
  } catch (error) {
1678
- if (missing.includes(errorName$1(error))) return void 0;
1692
+ if (missing.includes(errorName$2(error))) return void 0;
1679
1693
  throw error;
1680
1694
  }
1681
1695
  }
1682
1696
  /**
1683
- * The topic, its policy, the dead-letter queue and the bucket's notification
1684
- * entry for one watched bucket — created where missing, put back where they
1685
- * drifted.
1697
+ * An SNS topic of the stage's, created where missing, whose policy lets
1698
+ * exactly one AWS service publish to it — put back where it drifted. A
1699
+ * watched bucket's topic is published to by S3; an inbox's by SES.
1686
1700
  */
1687
- async function ensureBucketEvents(ctx, s3, input) {
1688
- const { id, bucket, region } = input;
1689
- const { SNS, SQS, sns, sqs, account } = await makeEventsClients(ctx.credential, region);
1690
- const topicName = eventsTopicName(bucket);
1701
+ async function ensureTopic(ctx, clients, input) {
1702
+ const { SNS, sns, account, region } = clients;
1703
+ const { id, topicName } = input;
1691
1704
  const topicArn = `arn:aws:sns:${region}:${account}:${topicName}`;
1692
1705
  const topicEntry = {
1693
1706
  key: `sns-topic:${id}`,
@@ -1707,12 +1720,12 @@ async function ensureBucketEvents(ctx, s3, input) {
1707
1720
  }));
1708
1721
  await ctx.state.ready(topicEntry, topicArn);
1709
1722
  });
1710
- const topicPolicy = eventsTopicPolicy(topicArn, bucket, account);
1723
+ const topicPolicy = input.policy(topicArn);
1711
1724
  const currentTopicPolicy = topic?.Attributes?.Policy;
1712
1725
  if (!currentTopicPolicy || canonicalPolicy(JSON.parse(currentTopicPolicy)) !== canonicalPolicy(topicPolicy)) await ctx.change({
1713
1726
  construct: id,
1714
1727
  resource: `SNS topic ${topicName}`,
1715
- change: `publishable by '${bucket}' only`
1728
+ change: `publishable by ${input.publisher} only`
1716
1729
  }, async () => {
1717
1730
  await sns.send(new SNS.SetTopicAttributesCommand({
1718
1731
  TopicArn: topicArn,
@@ -1720,6 +1733,24 @@ async function ensureBucketEvents(ctx, s3, input) {
1720
1733
  AttributeValue: JSON.stringify(topicPolicy)
1721
1734
  }));
1722
1735
  });
1736
+ return topicArn;
1737
+ }
1738
+ /**
1739
+ * The topic, its policy, the dead-letter queue and the bucket's notification
1740
+ * entry for one watched bucket — created where missing, put back where they
1741
+ * drifted.
1742
+ */
1743
+ async function ensureBucketEvents(ctx, s3, input) {
1744
+ const { id, bucket, region } = input;
1745
+ const clients = await makeEventsClients(ctx.credential, region);
1746
+ const { SQS, sns, sqs, account } = clients;
1747
+ const topicName = eventsTopicName(bucket);
1748
+ const topicArn = await ensureTopic(ctx, clients, {
1749
+ id,
1750
+ topicName,
1751
+ publisher: `'${bucket}'`,
1752
+ policy: (arn) => eventsTopicPolicy(arn, bucket, account)
1753
+ });
1723
1754
  const queueName = eventsDeadLetterName(bucket);
1724
1755
  const deadLetterArn = `arn:aws:sqs:${region}:${account}:${queueName}`;
1725
1756
  const queueEntry = {
@@ -1782,13 +1813,15 @@ async function ensureBucketEvents(ctx, s3, input) {
1782
1813
  };
1783
1814
  }
1784
1815
  /**
1785
- * The events key: the topic's address, signed by the bucket's own access key
1786
- * — read off the bucket's URL, so a rotated key rotates this one with it.
1816
+ * A topic's connection string: its address, signed by the access key in a
1817
+ * bucket's URL — read off that URL, so a rotated key rotates this one with
1818
+ * it. A watched bucket's events key by default; an inbox's topic, signed by
1819
+ * its own bucket's key, otherwise.
1787
1820
  */
1788
1821
  async function ensureEventsKey(ctx, input) {
1789
1822
  const { id, topicArn, region } = input;
1790
- const key = provideKey(id, "eventsConnectionString");
1791
- const url = ctx.secrets[provideKey(id, "url")];
1823
+ const key = input.key ?? provideKey(id, "eventsConnectionString");
1824
+ const url = ctx.secrets[input.urlKey ?? provideKey(id, "url")];
1792
1825
  let parsed;
1793
1826
  try {
1794
1827
  parsed = url ? s3Url.parse(url) : void 0;
@@ -1995,7 +2028,7 @@ function bucketPublicUrl(bucket, region, endpoint) {
1995
2028
  return `https://${bucket}.s3.${region}.amazonaws.com`;
1996
2029
  }
1997
2030
  /** What an AWS SDK error is called, whichever field carries it. */
1998
- function errorName(error) {
2031
+ function errorName$1(error) {
1999
2032
  const e = error;
2000
2033
  return e?.Code ?? e?.name ?? "";
2001
2034
  }
@@ -2009,7 +2042,7 @@ function s3Answer(error) {
2009
2042
  const id2 = e?.$metadata?.extendedRequestId ?? headers["x-amz-id-2"];
2010
2043
  return {
2011
2044
  ...status !== void 0 ? { status } : {},
2012
- name: errorName(error) || "Error",
2045
+ name: errorName$1(error) || "Error",
2013
2046
  message: e?.message ?? String(error),
2014
2047
  ...region ? { region } : {},
2015
2048
  ...requestId ? { requestId } : {},
@@ -2072,7 +2105,7 @@ async function readOr(read, missing) {
2072
2105
  try {
2073
2106
  return await read();
2074
2107
  } catch (error) {
2075
- if (missing.includes(errorName(error))) return void 0;
2108
+ if (missing.includes(errorName$1(error))) return void 0;
2076
2109
  throw error;
2077
2110
  }
2078
2111
  }
@@ -2206,6 +2239,49 @@ async function ensureBucket(ctx, stageClients, construct, watchers) {
2206
2239
  * The bucket's name: the recorded one, else the good name, else the good
2207
2240
  * name with a random suffix — up to {@link SUFFIX_ATTEMPTS} times.
2208
2241
  */
2242
+ /**
2243
+ * A private bucket a provider makes for a construct that owns one — an
2244
+ * inbox's — by the same steps as any of the stage's buckets: found or
2245
+ * created, its settings put back where they drifted, and reached by an IAM
2246
+ * user of its own whose key is written into `urlKey`. Nothing serves it and
2247
+ * nothing watches it.
2248
+ */
2249
+ async function ensureOwnedBucket(ctx, input) {
2250
+ const bucketCtx = ctx;
2251
+ const stageClients = await makeClients(ctx.credential, s3Region(bucketCtx));
2252
+ const nameInput = {
2253
+ scope: ctx.identity.scope,
2254
+ stage: ctx.stage,
2255
+ id: input.name
2256
+ };
2257
+ const located = await ensureBucketName(bucketCtx, stageClients, input.id, bucketName(nameInput));
2258
+ const clients = located.region === stageClients.region ? stageClients : await makeClients(ctx.credential, located.region);
2259
+ await ensureBucketSettings(bucketCtx, clients, {
2260
+ id: input.id,
2261
+ bucket: located.bucket,
2262
+ exists: located.exists,
2263
+ versioning: false,
2264
+ open: [],
2265
+ ...input.sesWrite ? { sesWrite: input.sesWrite } : {}
2266
+ });
2267
+ const user = await ensureIamUser(bucketCtx, clients, {
2268
+ id: input.id,
2269
+ user: iamUserName(nameInput),
2270
+ policyName: IAM_POLICY_NAME,
2271
+ policy: userPolicy(located.bucket, input.topicArn ? { eventsTopicArn: input.topicArn } : {}),
2272
+ describe: "this bucket only"
2273
+ });
2274
+ await ensureAccessKey(bucketCtx, clients, {
2275
+ id: input.id,
2276
+ bucket: located.bucket,
2277
+ urlKey: input.urlKey,
2278
+ ...user
2279
+ });
2280
+ return {
2281
+ bucket: located.bucket,
2282
+ region: clients.region
2283
+ };
2284
+ }
2209
2285
  async function ensureBucketName(ctx, clients, id, good) {
2210
2286
  const { S3, s3, region } = clients;
2211
2287
  const key = `s3-bucket:${id}`;
@@ -2256,7 +2332,7 @@ async function ensureBucketName(ctx, clients, id, good) {
2256
2332
  ...region === "us-east-1" ? {} : { CreateBucketConfiguration: { LocationConstraint: region } }
2257
2333
  }));
2258
2334
  } catch (error) {
2259
- const code = errorName(error);
2335
+ const code = errorName$1(error);
2260
2336
  if (code === "BucketAlreadyOwnedByYou") return "ours";
2261
2337
  if (code === "BucketAlreadyExists") return "taken";
2262
2338
  throw error;
@@ -2343,7 +2419,10 @@ async function ensureBucketSettings(ctx, clients, input) {
2343
2419
  PublicAccessBlockConfiguration: block
2344
2420
  })));
2345
2421
  };
2346
- const policy = bucketPolicy(bucket, input.open, input.cdn ? { cdn: input.cdn } : {});
2422
+ const policy = bucketPolicy(bucket, input.open, {
2423
+ ...input.cdn ? { cdn: input.cdn } : {},
2424
+ ...input.sesWrite ? { sesWrite: input.sesWrite } : {}
2425
+ });
2347
2426
  const ensurePolicy = async () => {
2348
2427
  const current = await read(() => s3.send(new S3.GetBucketPolicyCommand({ Bucket })), ["NoSuchBucketPolicy"]);
2349
2428
  if (!(current?.Policy !== void 0 && canonicalPolicy(JSON.parse(current.Policy)) === canonicalPolicy(policy))) await set(isOpen ? `policy: TLS only, public read on ${input.open.join(", ")}` : input.cdn && input.open.length > 0 ? `policy: TLS only, CloudFront reads ${input.open.join(", ")}` : "policy: TLS only", () => s3.send(new S3.PutBucketPolicyCommand({
@@ -2463,14 +2542,7 @@ async function verifyS3(ctx) {
2463
2542
  }
2464
2543
  }
2465
2544
  }
2466
- //#endregion
2467
- //#region src/providers/registry.ts
2468
- /**
2469
- * The providers gkm ships, by kind and name — registered the way a deploy
2470
- * target's built-ins are (`target/builtins.ts`). A provider from a package is
2471
- * one more entry here once there is a loading story for it.
2472
- */
2473
- const BUILTIN_PROVIDERS = { objects: { s3: {
2545
+ const s3Provider = {
2474
2546
  kind: "objects",
2475
2547
  name: "s3",
2476
2548
  check: checkS3Config,
@@ -2486,7 +2558,345 @@ const BUILTIN_PROVIDERS = { objects: { s3: {
2486
2558
  },
2487
2559
  ensure: ensureS3,
2488
2560
  verify: verifyS3
2489
- } } };
2561
+ };
2562
+ //#endregion
2563
+ //#region src/providers/ses/index.ts
2564
+ /**
2565
+ * The `ses` provider: what receives an inbox's mail on a deployed stage.
2566
+ *
2567
+ * `deploy.inbox.<stage> = { provider: 'ses', region? }` has the deploy create,
2568
+ * for each `Inbox`:
2569
+ *
2570
+ * - **its own bucket** — never one the stack or `deploy.objects` runs — by
2571
+ * the steps every bucket of the stage takes (`ensureOwnedBucket`), with SES
2572
+ * allowed to write under `messages/` and an IAM user of its own whose key
2573
+ * is the inbox's `<ID>_URL`;
2574
+ * - **its topic** on SNS, publishable by SES alone, whose `sns://` address —
2575
+ * signed by the same key — is the topic's connection string. The deploy's
2576
+ * push subscriptions for a topic on SNS (`topicPushes`) then subscribe each
2577
+ * inbox subscriber at its worker's route, unfiltered;
2578
+ * - **the stage's domain as an SES identity**, verified through Easy DKIM's
2579
+ * CNAMEs, and **MX records** pointing the domain — or every subdomain of it,
2580
+ * with `subdomains: true` — at the region's inbound endpoint, both through
2581
+ * the stage's DNS;
2582
+ * - **a receipt rule** in the region's *active* rule set: the inbox's
2583
+ * recipients, stored under `messages/` and announced on its topic. Never a
2584
+ * new set made active over another — only one is active per region, and
2585
+ * switching would stop every other stage's and app's rules. A set is made
2586
+ * active only where none is.
2587
+ *
2588
+ * A removed inbox's rule is deleted on the next deploy, by its name; nothing
2589
+ * else this provider did not make is touched.
2590
+ */
2591
+ /**
2592
+ * The regions SES receives mail in, each at `inbound-smtp.<region>.amazonaws.com`
2593
+ * — the AWS General Reference's "Email Receiving endpoints".
2594
+ */
2595
+ const SES_RECEIVING_REGIONS = [
2596
+ "us-east-1",
2597
+ "us-east-2",
2598
+ "us-west-1",
2599
+ "us-west-2",
2600
+ "af-south-1",
2601
+ "ap-southeast-3",
2602
+ "ap-south-1",
2603
+ "ap-northeast-3",
2604
+ "ap-northeast-2",
2605
+ "ap-southeast-1",
2606
+ "ap-southeast-2",
2607
+ "ap-northeast-1",
2608
+ "ca-central-1",
2609
+ "eu-central-1",
2610
+ "eu-west-1",
2611
+ "eu-west-2",
2612
+ "eu-south-1",
2613
+ "eu-west-3",
2614
+ "eu-north-1",
2615
+ "il-central-1",
2616
+ "me-south-1",
2617
+ "sa-east-1"
2618
+ ];
2619
+ /** Where mail for a domain is delivered in `region`: its MX target. */
2620
+ function inboundEndpoint(region) {
2621
+ return `inbound-smtp.${region}.amazonaws.com`;
2622
+ }
2623
+ /** Every inbox in the manifest. */
2624
+ function inboxConstructs(manifest) {
2625
+ return Object.values(manifest).filter((d) => d.kind === "inbox").sort((a, b) => a.id.localeCompare(b.id));
2626
+ }
2627
+ /** The name an inbox's receipt rule has: the prefix it is found by, and its id. */
2628
+ function receiptRuleName(scope, stage, inbox) {
2629
+ return `${rulePrefix(scope, stage)}${appKey(inbox)}`.slice(0, 64);
2630
+ }
2631
+ /** What every rule this stage made is named with. */
2632
+ function rulePrefix(scope, stage) {
2633
+ return `gkm-${scope}-${stage}-`.replace(/[^A-Za-z0-9_.-]/g, "-");
2634
+ }
2635
+ /** The topic SES announces an inbox's mail on: publishable by SES, from this account. */
2636
+ function receiptTopicPolicy(topicArn, account) {
2637
+ return {
2638
+ Version: "2012-10-17",
2639
+ Statement: [{
2640
+ Sid: "GkmSesPublishes",
2641
+ Effect: "Allow",
2642
+ Principal: { Service: "ses.amazonaws.com" },
2643
+ Action: "sns:Publish",
2644
+ Resource: topicArn,
2645
+ Condition: { StringEquals: { "aws:SourceAccount": account } }
2646
+ }]
2647
+ };
2648
+ }
2649
+ const defaultSesClients = async (credential, region) => {
2650
+ const SES = await import("@aws-sdk/client-ses");
2651
+ const config = await awsClientConfig(credential, region);
2652
+ const endpoint = awsEndpoint(process.env, "SES");
2653
+ return {
2654
+ SES,
2655
+ ses: new SES.SESClient({
2656
+ ...config,
2657
+ ...endpoint ? { endpoint } : {}
2658
+ })
2659
+ };
2660
+ };
2661
+ let makeSesClients = defaultSesClients;
2662
+ function errorName(error) {
2663
+ const e = error;
2664
+ return e?.name ?? e?.Code ?? e?.code ?? "";
2665
+ }
2666
+ /** The stage's domain, which every inbox receives on. */
2667
+ function stageDomain(ctx) {
2668
+ const domain = ctx.workspace.domains?.[ctx.stage];
2669
+ if (!domain) throw new NoDomainForStage(ctx.stage);
2670
+ return domain;
2671
+ }
2672
+ async function ensureSes(ctx) {
2673
+ const region = s3Region(ctx);
2674
+ if (!SES_RECEIVING_REGIONS.includes(region)) throw new SesReceivingUnsupported(ctx.stage, region, SES_RECEIVING_REGIONS);
2675
+ const inboxes = inboxConstructs(ctx.manifest);
2676
+ const { SES, ses } = await makeSesClients(ctx.credential, region);
2677
+ try {
2678
+ const ruleSet = await activeRuleSet(ctx, {
2679
+ SES,
2680
+ ses
2681
+ }, inboxes.length > 0);
2682
+ if (inboxes.length > 0) {
2683
+ const domain = stageDomain(ctx);
2684
+ await ensureIdentity(ctx, {
2685
+ SES,
2686
+ ses
2687
+ }, domain);
2688
+ const events = await eventsClients(ctx.credential, region);
2689
+ try {
2690
+ for (const inbox of inboxes) await ensureInbox(ctx, {
2691
+ SES,
2692
+ ses
2693
+ }, events, {
2694
+ inbox,
2695
+ domain,
2696
+ region,
2697
+ ruleSet
2698
+ });
2699
+ } finally {
2700
+ events.sns.destroy();
2701
+ events.sqs.destroy();
2702
+ }
2703
+ await ensureMx(ctx, inboxes, domain, region);
2704
+ }
2705
+ if (ruleSet) await retireRules(ctx, {
2706
+ SES,
2707
+ ses
2708
+ }, ruleSet, inboxes);
2709
+ } finally {
2710
+ ses.destroy();
2711
+ }
2712
+ }
2713
+ /**
2714
+ * The region's active rule set. Made — and made active — only where none is
2715
+ * active and an inbox needs one: activating a set deactivates whichever was.
2716
+ */
2717
+ async function activeRuleSet(ctx, { SES, ses }, needed) {
2718
+ const name = (await ses.send(new SES.DescribeActiveReceiptRuleSetCommand({}))).Metadata?.Name;
2719
+ if (name || !needed) return name;
2720
+ await ctx.change({
2721
+ construct: "inbox",
2722
+ resource: `SES receipt rule set gkm`,
2723
+ change: "create and make active — the region has none"
2724
+ }, async () => {
2725
+ try {
2726
+ await ses.send(new SES.CreateReceiptRuleSetCommand({ RuleSetName: "gkm" }));
2727
+ } catch (error) {
2728
+ if (errorName(error) !== "AlreadyExistsException") throw error;
2729
+ }
2730
+ await ses.send(new SES.SetActiveReceiptRuleSetCommand({ RuleSetName: "gkm" }));
2731
+ });
2732
+ return "gkm";
2733
+ }
2734
+ /**
2735
+ * The stage's domain as an SES identity, verified by Easy DKIM: its three
2736
+ * CNAMEs, through the stage's DNS. Receiving requires a verified domain.
2737
+ */
2738
+ async function ensureIdentity(ctx, { SES, ses }, domain) {
2739
+ let tokens = [];
2740
+ await ctx.change({
2741
+ construct: "inbox",
2742
+ resource: `SES identity ${domain}`,
2743
+ change: "verify with DKIM"
2744
+ }, async () => {
2745
+ tokens = (await ses.send(new SES.VerifyDomainDkimCommand({ Domain: domain }))).DkimTokens ?? [];
2746
+ });
2747
+ if (tokens.length === 0) return;
2748
+ await ctx.writeDns(tokens.map((token) => ({
2749
+ host: `${token}._domainkey.${domain}`,
2750
+ type: "CNAME",
2751
+ value: `${token}.dkim.amazonses.com`
2752
+ })));
2753
+ }
2754
+ /** One inbox: its bucket, its topic and their keys, and its receipt rule. */
2755
+ async function ensureInbox(ctx, { SES, ses }, events, input) {
2756
+ const { inbox, domain, region, ruleSet } = input;
2757
+ const name = `${appKey(inbox.id)}-mail`;
2758
+ const urlKey = provideKey(inbox.id, "url");
2759
+ const topicArn = await ensureTopic(ctx, events, {
2760
+ id: inbox.id,
2761
+ topicName: `gkm-${ctx.identity.scope}-${ctx.stage}-${name}`.replace(/[^A-Za-z0-9_-]/g, "-").slice(0, 256),
2762
+ publisher: "SES",
2763
+ policy: (arn) => receiptTopicPolicy(arn, events.account)
2764
+ });
2765
+ const { bucket } = await ensureOwnedBucket(ctx, {
2766
+ id: inbox.id,
2767
+ name,
2768
+ urlKey,
2769
+ sesWrite: {
2770
+ prefix: INBOX_MESSAGES_PREFIX,
2771
+ account: events.account
2772
+ },
2773
+ topicArn
2774
+ });
2775
+ await ensureEventsKey(ctx, {
2776
+ id: inbox.id,
2777
+ topicArn,
2778
+ region,
2779
+ key: provideKey(inbox.topic, "publisherConnectionString"),
2780
+ urlKey
2781
+ });
2782
+ const rule = {
2783
+ Name: receiptRuleName(ctx.identity.scope, ctx.stage, inbox.id),
2784
+ Enabled: true,
2785
+ TlsPolicy: "Optional",
2786
+ ScanEnabled: true,
2787
+ Recipients: receiptRecipients(inbox, domain),
2788
+ Actions: [{ S3Action: {
2789
+ BucketName: bucket,
2790
+ ObjectKeyPrefix: INBOX_MESSAGES_PREFIX,
2791
+ TopicArn: topicArn
2792
+ } }]
2793
+ };
2794
+ const current = await ses.send(new SES.DescribeReceiptRuleCommand({
2795
+ RuleSetName: ruleSet,
2796
+ RuleName: rule.Name
2797
+ })).then((found) => found.Rule, (error) => {
2798
+ if (errorName(error) === "RuleDoesNotExistException") return void 0;
2799
+ throw error;
2800
+ });
2801
+ const entry = {
2802
+ key: `ses-receipt-rule:${inbox.id}`,
2803
+ type: "ses-receipt-rule"
2804
+ };
2805
+ if (current && sameRule(current, rule)) {
2806
+ await ctx.state.ready(entry, rule.Name);
2807
+ return;
2808
+ }
2809
+ await ctx.change({
2810
+ construct: inbox.id,
2811
+ resource: `SES receipt rule ${rule.Name}`,
2812
+ change: current ? `receive at ${rule.Recipients.join(", ")}` : `create, receiving at ${rule.Recipients.join(", ")}`
2813
+ }, async () => {
2814
+ await ctx.state.pending(entry);
2815
+ await ses.send(current ? new SES.UpdateReceiptRuleCommand({
2816
+ RuleSetName: ruleSet,
2817
+ Rule: rule
2818
+ }) : new SES.CreateReceiptRuleCommand({
2819
+ RuleSetName: ruleSet,
2820
+ Rule: rule
2821
+ }));
2822
+ await ctx.state.ready(entry, rule.Name);
2823
+ });
2824
+ }
2825
+ function sameRule(current, wanted) {
2826
+ const s3 = current.Actions?.[0]?.S3Action;
2827
+ const want = wanted.Actions[0].S3Action;
2828
+ return current.Enabled === wanted.Enabled && current.TlsPolicy === wanted.TlsPolicy && current.ScanEnabled === wanted.ScanEnabled && current.Actions?.length === 1 && s3?.BucketName === want.BucketName && s3?.ObjectKeyPrefix === want.ObjectKeyPrefix && s3?.TopicArn === want.TopicArn && [...current.Recipients ?? []].sort().join() === [...wanted.Recipients].sort().join();
2829
+ }
2830
+ /**
2831
+ * MX records for the stage's domain — and, for an inbox on its tenants'
2832
+ * subdomains, for every subdomain — at the region's inbound endpoint.
2833
+ */
2834
+ async function ensureMx(ctx, inboxes, domain, region) {
2835
+ const hosts = /* @__PURE__ */ new Set();
2836
+ for (const inbox of inboxes) hosts.add(inbox.subdomains ? `*.${domain}` : domain);
2837
+ await ctx.writeDns([...hosts].sort().map((host) => ({
2838
+ host,
2839
+ type: "MX",
2840
+ value: inboundEndpoint(region),
2841
+ priority: 10
2842
+ })));
2843
+ }
2844
+ /** Delete the rules this stage made for inboxes no longer declared — only those. */
2845
+ async function retireRules(ctx, { SES, ses }, ruleSet, inboxes) {
2846
+ const prefix = rulePrefix(ctx.identity.scope, ctx.stage);
2847
+ const kept = new Set(inboxes.map((inbox) => receiptRuleName(ctx.identity.scope, ctx.stage, inbox.id)));
2848
+ const set = await ses.send(new SES.DescribeReceiptRuleSetCommand({ RuleSetName: ruleSet }));
2849
+ for (const rule of set.Rules ?? []) {
2850
+ if (!rule.Name?.startsWith(prefix) || kept.has(rule.Name)) continue;
2851
+ await ctx.change({
2852
+ construct: "inbox",
2853
+ resource: `SES receipt rule ${rule.Name}`,
2854
+ change: "delete — its inbox is no longer declared"
2855
+ }, async () => {
2856
+ await ses.send(new SES.DeleteReceiptRuleCommand({
2857
+ RuleSetName: ruleSet,
2858
+ RuleName: rule.Name
2859
+ }));
2860
+ });
2861
+ }
2862
+ }
2863
+ /**
2864
+ * The cheap check every deploy runs: the region receives mail, the stage has
2865
+ * a domain, and each inbox's keys are in the stage's secrets.
2866
+ */
2867
+ async function verifySes(ctx) {
2868
+ const region = s3Region(ctx);
2869
+ if (!SES_RECEIVING_REGIONS.includes(region)) throw new SesReceivingUnsupported(ctx.stage, region, SES_RECEIVING_REGIONS);
2870
+ const inboxes = inboxConstructs(ctx.manifest);
2871
+ if (inboxes.length === 0) return;
2872
+ stageDomain(ctx);
2873
+ for (const inbox of inboxes) {
2874
+ const missing = [provideKey(inbox.id, "url"), provideKey(inbox.topic, "publisherConnectionString")].filter((key) => ctx.secrets[key] === void 0);
2875
+ if (missing.length > 0) throw new InboxNotProvisioned(ctx.stage, inbox.id, missing);
2876
+ }
2877
+ }
2878
+ //#endregion
2879
+ //#region src/providers/registry.ts
2880
+ /**
2881
+ * The providers gkm ships, by kind and name — registered the way a deploy
2882
+ * target's built-ins are (`target/builtins.ts`). A provider from a package is
2883
+ * one more entry here once there is a loading story for it.
2884
+ */
2885
+ const BUILTIN_PROVIDERS = {
2886
+ objects: { s3: s3Provider },
2887
+ inbox: { ses: {
2888
+ kind: "inbox",
2889
+ name: "ses",
2890
+ check: checkSesConfig,
2891
+ provisioning: SES_PROVISIONING,
2892
+ credentials: awsProvisioningCredentials,
2893
+ runtimeKeys(manifest) {
2894
+ return inboxConstructs(manifest).flatMap((inbox) => [provideKey(inbox.id, "url"), provideKey(inbox.topic, "publisherConnectionString")]);
2895
+ },
2896
+ ensure: ensureSes,
2897
+ verify: verifySes
2898
+ } }
2899
+ };
2490
2900
  /** The provider `kind` names `name`, if gkm has one. */
2491
2901
  function builtinProvider(kind, name) {
2492
2902
  return Object.hasOwn(BUILTIN_PROVIDERS[kind], name) ? BUILTIN_PROVIDERS[kind][name] : void 0;
@@ -2583,13 +2993,13 @@ async function provisionStage(options) {
2583
2993
  };
2584
2994
  reports.push(report);
2585
2995
  const ids = constructsOf(manifest, kind);
2586
- if (ids.length === 0) continue;
2587
2996
  const credential = await provider.credentials({
2588
2997
  stage,
2589
2998
  env,
2590
2999
  ...options.profile ? { profile: options.profile } : {},
2591
3000
  ...options.home ? { home: options.home } : {}
2592
3001
  });
3002
+ if (ids.length === 0 && credential === void 0) continue;
2593
3003
  if (credential === void 0) throw new ProviderCredentialsMissing(stage, kind, provider.name, ids, provider.provisioning.env, provider.provisioning.describe, provider.provisioning.login);
2594
3004
  configured.push({
2595
3005
  kind,
@@ -3422,4 +3832,4 @@ async function load(input, sandbox) {
3422
3832
  //#endregion
3423
3833
  export { UnknownDeployApps as a, bucketName as c, TargetBuildsNothing as i, iamUserName as l, NoDeployableApps as n, backupsUserName as o, RollbackFailed as r, IAM_USER_PATH as s, deploy as t };
3424
3834
 
3425
- //# sourceMappingURL=deploy-o5n6l4MO.mjs.map
3835
+ //# sourceMappingURL=deploy-CDcO08Xz.mjs.map