@geekmidas/cli 10.0.0-alpha.145 → 10.0.0-alpha.147

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 (217) hide show
  1. package/dist/{GoDaddyProvider-DAJIa64i.cjs → GoDaddyProvider-CpO8dFYC.cjs} +2 -2
  2. package/dist/{GoDaddyProvider-DAJIa64i.cjs.map → GoDaddyProvider-CpO8dFYC.cjs.map} +1 -1
  3. package/dist/{GoDaddyProvider-IVuFcWyc.mjs → GoDaddyProvider-DXuPFufW.mjs} +2 -2
  4. package/dist/{GoDaddyProvider-IVuFcWyc.mjs.map → GoDaddyProvider-DXuPFufW.mjs.map} +1 -1
  5. package/dist/{HostingerProvider-DdikWVRy.cjs → HostingerProvider-Beu0Ciky.cjs} +2 -2
  6. package/dist/{HostingerProvider-DdikWVRy.cjs.map → HostingerProvider-Beu0Ciky.cjs.map} +1 -1
  7. package/dist/{HostingerProvider-BtLb-jkn.mjs → HostingerProvider-Dum492dc.mjs} +2 -2
  8. package/dist/{HostingerProvider-BtLb-jkn.mjs.map → HostingerProvider-Dum492dc.mjs.map} +1 -1
  9. package/dist/{LegacyStateStore-CmgUY9kR.mjs → LegacyStateStore-DZjph7ES.mjs} +2 -2
  10. package/dist/{LegacyStateStore-CmgUY9kR.mjs.map → LegacyStateStore-DZjph7ES.mjs.map} +1 -1
  11. package/dist/{LegacyStateStore-CWwT7Mj5.cjs → LegacyStateStore-V4R0llou.cjs} +2 -2
  12. package/dist/{LegacyStateStore-CWwT7Mj5.cjs.map → LegacyStateStore-V4R0llou.cjs.map} +1 -1
  13. package/dist/{LocalStateStore-NOmS4QyA.mjs → LocalStateStore-Bth8pBp-.mjs} +2 -2
  14. package/dist/{LocalStateStore-NOmS4QyA.mjs.map → LocalStateStore-Bth8pBp-.mjs.map} +1 -1
  15. package/dist/{LocalStateStore-BkeQg1ga.cjs → LocalStateStore-DuSotrd3.cjs} +2 -2
  16. package/dist/{LocalStateStore-BkeQg1ga.cjs.map → LocalStateStore-DuSotrd3.cjs.map} +1 -1
  17. package/dist/{S3StateStore-SjIxuWHM.mjs → S3StateStore-DGlh3s2p.mjs} +4 -4
  18. package/dist/{S3StateStore-SjIxuWHM.mjs.map → S3StateStore-DGlh3s2p.mjs.map} +1 -1
  19. package/dist/{S3StateStore-Cw2nwI5C.cjs → S3StateStore-DTPxQS3z.cjs} +4 -4
  20. package/dist/{S3StateStore-Cw2nwI5C.cjs.map → S3StateStore-DTPxQS3z.cjs.map} +1 -1
  21. package/dist/{SSMStateStore-DC1N1Baw.cjs → SSMStateStore-B9R317q0.cjs} +2 -2
  22. package/dist/{SSMStateStore-DC1N1Baw.cjs.map → SSMStateStore-B9R317q0.cjs.map} +1 -1
  23. package/dist/{SSMStateStore-DGqzo4Ob.mjs → SSMStateStore-DCa85jhG.mjs} +2 -2
  24. package/dist/{SSMStateStore-DGqzo4Ob.mjs.map → SSMStateStore-DCa85jhG.mjs.map} +1 -1
  25. package/dist/{add-Bnd7vuUN.mjs → add-Bl33BvDW.mjs} +7 -7
  26. package/dist/{add-Bnd7vuUN.mjs.map → add-Bl33BvDW.mjs.map} +1 -1
  27. package/dist/{add-BwC_EH0e.cjs → add-Cr-9Ku0W.cjs} +7 -7
  28. package/dist/{add-BwC_EH0e.cjs.map → add-Cr-9Ku0W.cjs.map} +1 -1
  29. package/dist/{apps-D1svw9OG.cjs → apps-BIsxWYUo.cjs} +513 -52
  30. package/dist/apps-BIsxWYUo.cjs.map +1 -0
  31. package/dist/{apps-Xrlvir2-.mjs → apps-DFzUuJ22.mjs} +470 -52
  32. package/dist/apps-DFzUuJ22.mjs.map +1 -0
  33. package/dist/{bundler-CoRIF5bx.mjs → bundler-BagXzefF.mjs} +6 -6
  34. package/dist/{bundler-CoRIF5bx.mjs.map → bundler-BagXzefF.mjs.map} +1 -1
  35. package/dist/{bundler-CgWYsgqb.cjs → bundler-Cael9EDc.cjs} +6 -6
  36. package/dist/{bundler-CgWYsgqb.cjs.map → bundler-Cael9EDc.cjs.map} +1 -1
  37. package/dist/{cli-DsPHbC7p.cjs → cli-B1A-cLy-.cjs} +4 -4
  38. package/dist/{cli-DsPHbC7p.cjs.map → cli-B1A-cLy-.cjs.map} +1 -1
  39. package/dist/{cli-CKlTRVwo.mjs → cli-BJRPsFq7.mjs} +4 -4
  40. package/dist/{cli-CKlTRVwo.mjs.map → cli-BJRPsFq7.mjs.map} +1 -1
  41. package/dist/{compose-BMTnoIek.mjs → compose-C7izI7Eo.mjs} +5 -5
  42. package/dist/compose-C7izI7Eo.mjs.map +1 -0
  43. package/dist/{compose-CkvPmijw.mjs → compose-CZU60dwb.mjs} +303 -46
  44. package/dist/compose-CZU60dwb.mjs.map +1 -0
  45. package/dist/{compose-CVAoA04l.cjs → compose-Cius-YHS.cjs} +5 -5
  46. package/dist/compose-Cius-YHS.cjs.map +1 -0
  47. package/dist/{compose-ChUQHKG3.cjs → compose-CnNmDNph.cjs} +302 -45
  48. package/dist/compose-CnNmDNph.cjs.map +1 -0
  49. package/dist/{config-BKpzKP6W.mjs → config-BLrAd7Of.mjs} +2 -2
  50. package/dist/{config-BKpzKP6W.mjs.map → config-BLrAd7Of.mjs.map} +1 -1
  51. package/dist/{config-BcL1Fojs.d.cts → config-CRk2vdSp.d.mts} +3 -3
  52. package/dist/{config-BbivVpq0.d.mts.map → config-CRk2vdSp.d.mts.map} +1 -1
  53. package/dist/{config-QAqAEgb0.cjs → config-juUyBlb1.cjs} +2 -2
  54. package/dist/{config-QAqAEgb0.cjs.map → config-juUyBlb1.cjs.map} +1 -1
  55. package/dist/{config-BbivVpq0.d.mts → config-oBgsbLip.d.cts} +3 -3
  56. package/dist/{config-BcL1Fojs.d.cts.map → config-oBgsbLip.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/{credentials-Jx1Vdisc.mjs → credentials-CJ_z0Nni.mjs} +7 -7
  62. package/dist/{credentials-Jx1Vdisc.mjs.map → credentials-CJ_z0Nni.mjs.map} +1 -1
  63. package/dist/{credentials-CCIXh-cq.cjs → credentials-D11xozSF.cjs} +7 -7
  64. package/dist/{credentials-CCIXh-cq.cjs.map → credentials-D11xozSF.cjs.map} +1 -1
  65. package/dist/deploy/public.cjs +12 -12
  66. package/dist/deploy/public.d.cts +3 -3
  67. package/dist/deploy/public.d.cts.map +1 -1
  68. package/dist/deploy/public.d.mts +3 -3
  69. package/dist/deploy/public.d.mts.map +1 -1
  70. package/dist/deploy/public.mjs +12 -12
  71. package/dist/{deploy-CEX0YRdq.cjs → deploy-Ch1wCsU1.cjs} +13 -13
  72. package/dist/{deploy-CEX0YRdq.cjs.map → deploy-Ch1wCsU1.cjs.map} +1 -1
  73. package/dist/{deploy-8wsaNpPW.mjs → deploy-Dfn21QYG.mjs} +13 -13
  74. package/dist/{deploy-8wsaNpPW.mjs.map → deploy-Dfn21QYG.mjs.map} +1 -1
  75. package/dist/{docker-M_-xKiFU.cjs → docker-BT6G7aJE.cjs} +5 -5
  76. package/dist/{docker-M_-xKiFU.cjs.map → docker-BT6G7aJE.cjs.map} +1 -1
  77. package/dist/{docker-M4kCqczV.mjs → docker-_W_CauBY.mjs} +5 -5
  78. package/dist/{docker-M4kCqczV.mjs.map → docker-_W_CauBY.mjs.map} +1 -1
  79. package/dist/{dokploy-BsAPW8K1.mjs → dokploy-CBgGuei3.mjs} +2 -2
  80. package/dist/{dokploy-BsAPW8K1.mjs.map → dokploy-CBgGuei3.mjs.map} +1 -1
  81. package/dist/{dokploy-Djm8QIQZ.cjs → dokploy-DaQbR_NH.cjs} +2 -2
  82. package/dist/{dokploy-Djm8QIQZ.cjs.map → dokploy-DaQbR_NH.cjs.map} +1 -1
  83. package/dist/{eas-zEpuiYYj.mjs → eas-3L1_yKhk.mjs} +3 -3
  84. package/dist/{eas-zEpuiYYj.mjs.map → eas-3L1_yKhk.mjs.map} +1 -1
  85. package/dist/{eas-B-Ac5NjL.cjs → eas-YxDTJ3ql.cjs} +3 -3
  86. package/dist/{eas-B-Ac5NjL.cjs.map → eas-YxDTJ3ql.cjs.map} +1 -1
  87. package/dist/{encryption-EOEhb95p.mjs → encryption-CRyFk5nu.mjs} +4 -4
  88. package/dist/{encryption-EOEhb95p.mjs.map → encryption-CRyFk5nu.mjs.map} +1 -1
  89. package/dist/{encryption-B4LCEdXH.cjs → encryption-CVIu104e.cjs} +4 -4
  90. package/dist/{encryption-B4LCEdXH.cjs.map → encryption-CVIu104e.cjs.map} +1 -1
  91. package/dist/{engine-Ci-uU3kt.mjs → engine-DZnZy1R5.mjs} +17 -12
  92. package/dist/engine-DZnZy1R5.mjs.map +1 -0
  93. package/dist/{engine-6NLOikTQ.cjs → engine-XecwdLdj.cjs} +17 -12
  94. package/dist/engine-XecwdLdj.cjs.map +1 -0
  95. package/dist/{github-C0oLDg5G.mjs → github-CDJXpBCT.mjs} +9 -9
  96. package/dist/{github-C0oLDg5G.mjs.map → github-CDJXpBCT.mjs.map} +1 -1
  97. package/dist/{github-u9sfpl0l.cjs → github-dnxU_tMp.cjs} +9 -9
  98. package/dist/{github-u9sfpl0l.cjs.map → github-dnxU_tMp.cjs.map} +1 -1
  99. package/dist/{googlePlay-3nfA-wWh.mjs → googlePlay-BYeXKpNE.mjs} +5 -5
  100. package/dist/{googlePlay-3nfA-wWh.mjs.map → googlePlay-BYeXKpNE.mjs.map} +1 -1
  101. package/dist/{googlePlay-DfLH_sPa.cjs → googlePlay-CnIU3qIV.cjs} +5 -5
  102. package/dist/{googlePlay-DfLH_sPa.cjs.map → googlePlay-CnIU3qIV.cjs.map} +1 -1
  103. package/dist/{index-C1jffZ5_.d.cts → index-B35vTdAW.d.cts} +2 -2
  104. package/dist/{index-BZZeEWug.d.mts.map → index-B35vTdAW.d.cts.map} +1 -1
  105. package/dist/{index-BZZeEWug.d.mts → index-Dv1Zj86i.d.mts} +2 -2
  106. package/dist/{index-C1jffZ5_.d.cts.map → index-Dv1Zj86i.d.mts.map} +1 -1
  107. package/dist/index.cjs +73 -80
  108. package/dist/index.cjs.map +1 -1
  109. package/dist/index.mjs +73 -80
  110. package/dist/index.mjs.map +1 -1
  111. package/dist/{local-uvqZDwZ9.mjs → local-BIOpCtLE.mjs} +2 -2
  112. package/dist/{local-uvqZDwZ9.mjs.map → local-BIOpCtLE.mjs.map} +1 -1
  113. package/dist/{local-CtzKG55y.cjs → local-qdNfjzxQ.cjs} +2 -2
  114. package/dist/{local-CtzKG55y.cjs.map → local-qdNfjzxQ.cjs.map} +1 -1
  115. package/dist/{migrate-s9lVmF98.mjs → migrate--VNdTWT7.mjs} +6 -6
  116. package/dist/{migrate-s9lVmF98.mjs.map → migrate--VNdTWT7.mjs.map} +1 -1
  117. package/dist/{migrate-FKPFIzwd.cjs → migrate-CDEHWq-e.cjs} +6 -6
  118. package/dist/{migrate-FKPFIzwd.cjs.map → migrate-CDEHWq-e.cjs.map} +1 -1
  119. package/dist/{migrate-C6V9bEVY.cjs → migrate-CkHtNdre.cjs} +4 -4
  120. package/dist/{migrate-C6V9bEVY.cjs.map → migrate-CkHtNdre.cjs.map} +1 -1
  121. package/dist/{migrate-CA1GWA4t.mjs → migrate-svXhccrs.mjs} +4 -4
  122. package/dist/{migrate-CA1GWA4t.mjs.map → migrate-svXhccrs.mjs.map} +1 -1
  123. package/dist/{notes-Dz1M9_q9.mjs → notes-D9ofENLJ.mjs} +4 -4
  124. package/dist/{notes-Dz1M9_q9.mjs.map → notes-D9ofENLJ.mjs.map} +1 -1
  125. package/dist/{notes-BjxySbyH.cjs → notes-DBNPml4N.cjs} +4 -4
  126. package/dist/{notes-BjxySbyH.cjs.map → notes-DBNPml4N.cjs.map} +1 -1
  127. package/dist/openapi.cjs +2 -2
  128. package/dist/openapi.d.cts +1 -1
  129. package/dist/openapi.d.mts +1 -1
  130. package/dist/openapi.mjs +2 -2
  131. package/dist/{projectBucket-DsXNW1Yc.cjs → projectBucket-BtiC0Cn8.cjs} +2 -2
  132. package/dist/{projectBucket-DsXNW1Yc.cjs.map → projectBucket-BtiC0Cn8.cjs.map} +1 -1
  133. package/dist/{projectBucket-2XgQSnLw.mjs → projectBucket-De0MQeNj.mjs} +2 -2
  134. package/dist/{projectBucket-2XgQSnLw.mjs.map → projectBucket-De0MQeNj.mjs.map} +1 -1
  135. package/dist/{publish-7-dwP5TL.cjs → publish-CohTrVKe.cjs} +2 -2
  136. package/dist/{publish-7-dwP5TL.cjs.map → publish-CohTrVKe.cjs.map} +1 -1
  137. package/dist/{publish-Dmy_OhvF.mjs → publish-k38S418e.mjs} +2 -2
  138. package/dist/{publish-Dmy_OhvF.mjs.map → publish-k38S418e.mjs.map} +1 -1
  139. package/dist/reconcile/public.d.cts +1 -1
  140. package/dist/reconcile/public.d.mts +1 -1
  141. package/dist/{resolve-DhsUJwm8.cjs → resolve-Cr3Qj8ch.cjs} +4 -4
  142. package/dist/{resolve-DhsUJwm8.cjs.map → resolve-Cr3Qj8ch.cjs.map} +1 -1
  143. package/dist/{resolve-BK7mzDBb.mjs → resolve-YMxlYJtO.mjs} +4 -4
  144. package/dist/{resolve-BK7mzDBb.mjs.map → resolve-YMxlYJtO.mjs.map} +1 -1
  145. package/dist/{rollback-8qHgyadV.mjs → rollback-DIoyVrQI.mjs} +7 -7
  146. package/dist/{rollback-8qHgyadV.mjs.map → rollback-DIoyVrQI.mjs.map} +1 -1
  147. package/dist/{rollback-DP2iDjc9.cjs → rollback-eyqvtzW_.cjs} +7 -7
  148. package/dist/{rollback-DP2iDjc9.cjs.map → rollback-eyqvtzW_.cjs.map} +1 -1
  149. package/dist/{runtime-CeAt1IJd.d.mts → runtime-CFvcLEJW.d.cts} +2 -2
  150. package/dist/{runtime-Bvgyxm88.d.cts.map → runtime-CFvcLEJW.d.cts.map} +1 -1
  151. package/dist/{runtime-Bvgyxm88.d.cts → runtime-dwsH6ddo.d.mts} +2 -2
  152. package/dist/{runtime-CeAt1IJd.d.mts.map → runtime-dwsH6ddo.d.mts.map} +1 -1
  153. package/dist/{s3-DSPbU5gN.cjs → s3-CegRM8Sa.cjs} +3 -3
  154. package/dist/{s3-DSPbU5gN.cjs.map → s3-CegRM8Sa.cjs.map} +1 -1
  155. package/dist/{s3-DxCex5Fx.mjs → s3-Cl3tRemt.mjs} +3 -3
  156. package/dist/{s3-DxCex5Fx.mjs.map → s3-Cl3tRemt.mjs.map} +1 -1
  157. package/dist/{serverSetup-BSuHk2t2.cjs → serverSetup-BwfMgz3W.cjs} +7 -7
  158. package/dist/{serverSetup-BSuHk2t2.cjs.map → serverSetup-BwfMgz3W.cjs.map} +1 -1
  159. package/dist/{serverSetup-CeFpl5VJ.mjs → serverSetup-fQwkJ_EI.mjs} +7 -7
  160. package/dist/{serverSetup-CeFpl5VJ.mjs.map → serverSetup-fQwkJ_EI.mjs.map} +1 -1
  161. package/dist/{sniffer-Cb3n63dY.cjs → sniffer-BgdVvvzU.cjs} +7 -7
  162. package/dist/{sniffer-Cb3n63dY.cjs.map → sniffer-BgdVvvzU.cjs.map} +1 -1
  163. package/dist/{sniffer-BfNl8jn-.mjs → sniffer-FF7mfuR8.mjs} +7 -7
  164. package/dist/{sniffer-BfNl8jn-.mjs.map → sniffer-FF7mfuR8.mjs.map} +1 -1
  165. package/dist/{snsSubscriptions-DoZ0Q1n6.mjs → snsSubscriptions-B_WH4o1S.mjs} +3 -3
  166. package/dist/{snsSubscriptions-DoZ0Q1n6.mjs.map → snsSubscriptions-B_WH4o1S.mjs.map} +1 -1
  167. package/dist/{snsSubscriptions-Bd40ebt6.cjs → snsSubscriptions-DUY-Tu6J.cjs} +3 -3
  168. package/dist/{snsSubscriptions-Bd40ebt6.cjs.map → snsSubscriptions-DUY-Tu6J.cjs.map} +1 -1
  169. package/dist/{sst-DKNyfTpw.cjs → sst-BEXeTgDQ.cjs} +5 -5
  170. package/dist/{sst-DKNyfTpw.cjs.map → sst-BEXeTgDQ.cjs.map} +1 -1
  171. package/dist/{sst-B6RbJp8g.mjs → sst-BkTtncop.mjs} +5 -5
  172. package/dist/{sst-B6RbJp8g.mjs.map → sst-BkTtncop.mjs.map} +1 -1
  173. package/dist/{stack-UcV-V6Qk.cjs → stack-CcFgY4sJ.cjs} +106 -49
  174. package/dist/stack-CcFgY4sJ.cjs.map +1 -0
  175. package/dist/{stack-DwQ62dKK.mjs → stack-CqfBL5LA.mjs} +106 -49
  176. package/dist/stack-CqfBL5LA.mjs.map +1 -0
  177. package/dist/{stage-52sKecmS.mjs → stage-4ZtteXz8.mjs} +7 -7
  178. package/dist/{stage-52sKecmS.mjs.map → stage-4ZtteXz8.mjs.map} +1 -1
  179. package/dist/{stage-C2v5890I.cjs → stage-C19XRx7W.cjs} +7 -7
  180. package/dist/{stage-C2v5890I.cjs.map → stage-C19XRx7W.cjs.map} +1 -1
  181. package/dist/{stages-CFI0OiLj.cjs → stages-Bs1THSy7.cjs} +3 -3
  182. package/dist/{stages-CFI0OiLj.cjs.map → stages-Bs1THSy7.cjs.map} +1 -1
  183. package/dist/{stages-DoYa81kN.mjs → stages-_xCG4Ymu.mjs} +3 -3
  184. package/dist/{stages-DoYa81kN.mjs.map → stages-_xCG4Ymu.mjs.map} +1 -1
  185. package/dist/target/public.cjs +1 -1
  186. package/dist/target/public.d.cts +2 -2
  187. package/dist/target/public.d.mts +2 -2
  188. package/dist/target/public.mjs +1 -1
  189. package/dist/{terminal-DkXWdU0E.cjs → terminal-BkyVVOb-.cjs} +2 -2
  190. package/dist/{terminal-DkXWdU0E.cjs.map → terminal-BkyVVOb-.cjs.map} +1 -1
  191. package/dist/{terminal-BDEqpkbO.mjs → terminal-KVX_MmCR.mjs} +2 -2
  192. package/dist/{terminal-BDEqpkbO.mjs.map → terminal-KVX_MmCR.mjs.map} +1 -1
  193. package/dist/{types-Dy1eV7yc.d.cts → types-Dk--xVOT.d.cts} +31 -11
  194. package/dist/{types-Dy1eV7yc.d.cts.map → types-Dk--xVOT.d.cts.map} +1 -1
  195. package/dist/{types-C6hDCkV2.d.mts → types-DwQYpd_0.d.mts} +31 -11
  196. package/dist/{types-C6hDCkV2.d.mts.map → types-DwQYpd_0.d.mts.map} +1 -1
  197. package/dist/workspace/index.cjs +1 -1
  198. package/dist/workspace/index.d.cts +2 -2
  199. package/dist/workspace/index.d.mts +2 -2
  200. package/dist/workspace/index.mjs +1 -1
  201. package/dist/{workspace-Dkm3HL9e.cjs → workspace-1szcahj9.cjs} +19 -27
  202. package/dist/workspace-1szcahj9.cjs.map +1 -0
  203. package/dist/{workspace-BbfBFtjn.mjs → workspace-DFGsrjGD.mjs} +19 -27
  204. package/dist/workspace-DFGsrjGD.mjs.map +1 -0
  205. package/package.json +17 -15
  206. package/dist/apps-D1svw9OG.cjs.map +0 -1
  207. package/dist/apps-Xrlvir2-.mjs.map +0 -1
  208. package/dist/compose-BMTnoIek.mjs.map +0 -1
  209. package/dist/compose-CVAoA04l.cjs.map +0 -1
  210. package/dist/compose-ChUQHKG3.cjs.map +0 -1
  211. package/dist/compose-CkvPmijw.mjs.map +0 -1
  212. package/dist/engine-6NLOikTQ.cjs.map +0 -1
  213. package/dist/engine-Ci-uU3kt.mjs.map +0 -1
  214. package/dist/stack-DwQ62dKK.mjs.map +0 -1
  215. package/dist/stack-UcV-V6Qk.cjs.map +0 -1
  216. package/dist/workspace-BbfBFtjn.mjs.map +0 -1
  217. package/dist/workspace-Dkm3HL9e.cjs.map +0 -1
@@ -1,20 +1,20 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
2
2
  import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
3
- import { A as eventsBackendFor, U as externalsManifestName, j as providerOf, k as cacheBackendFor } from "./credentials-Jx1Vdisc.mjs";
4
- import { R as stageSampleRate, _ as PUBLIC_ENV_PREFIXES, a as allConstructGlobs, j as TEST_STAGE, z as telemetryEnv } from "./workspace-BbfBFtjn.mjs";
5
- import { A as objectsWebhookToken, B as portKeys, D as NOTIFICATION_RULE_PREFIX, E as HOST_GATEWAY$1, F as emulatorQueueUrl, I as emulatorTopicArn, K as LOGS_ORG, N as EMULATOR_REGION, O as minioNotificationRule, P as emulatorEndpoint, U as primaryPortKey, V as portsOf, W as serviceAddresses, X as otlpHeaders, f as savePortState, j as watchedBuckets, l as loadPortState, m as loadLocalCredentials, n as composeFor, r as toYaml, rt as rootSite, t as CLUSTER_DATABASE, v as saveLocalCredentials, z as fakeKey } from "./compose-BMTnoIek.mjs";
3
+ import { A as eventsBackendFor, Tt as gkmHome, U as externalsManifestName, j as providerOf, k as cacheBackendFor } from "./credentials-CJ_z0Nni.mjs";
4
+ import { R as stageSampleRate, _ as PUBLIC_ENV_PREFIXES, a as allConstructGlobs, j as TEST_STAGE, z as telemetryEnv } from "./workspace-DFGsrjGD.mjs";
5
+ import { A as objectsWebhookToken, B as portKeys, D as NOTIFICATION_RULE_PREFIX, E as HOST_GATEWAY$1, F as emulatorQueueUrl, I as emulatorTopicArn, K as LOGS_ORG, N as EMULATOR_REGION, O as minioNotificationRule, P as emulatorEndpoint, U as primaryPortKey, V as portsOf, W as serviceAddresses, X as otlpHeaders, f as savePortState, j as watchedBuckets, l as loadPortState, m as loadLocalCredentials, n as composeFor, r as toYaml, rt as rootSite, t as CLUSTER_DATABASE, v as saveLocalCredentials, z as fakeKey } from "./compose-C7izI7Eo.mjs";
6
6
  import { c as INBOX_RELAY_TOKEN_KEY, d as inboxWebhookUrl, i as readFakes, l as inboxRelayToken, o as objectsRoute, r as readCredentialFakes, u as inboxRelayWorker } from "./SubscriberGenerator-CzPrixYu.mjs";
7
- import { g as appKey, v as protectedSubdomains } from "./config-BKpzKP6W.mjs";
7
+ import { g as appKey, v as protectedSubdomains } from "./config-BLrAd7Of.mjs";
8
8
  import { i as holdsEveryCache, t as DEFAULT_CACHE } from "./types-Y1NfWlyG.mjs";
9
9
  import { u as telemetryArgs } from "./EndpointGenerator-CusLH-9S.mjs";
10
10
  import { i as discover, w as workerEdges, x as eventsEdgeBucket } from "./discover-DbDrCQ8h.mjs";
11
11
  import { dirname, isAbsolute, join, parse, relative, sep } from "node:path";
12
12
  import { existsSync, readFileSync } from "node:fs";
13
- import { chmod, mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
14
- import { networkInterfaces } from "node:os";
13
+ import { chmod, mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
14
+ import { hostname, networkInterfaces, userInfo } from "node:os";
15
15
  import { execFile, spawn } from "node:child_process";
16
16
  import { createServer } from "node:net";
17
- import { createHash } from "node:crypto";
17
+ import { createHash, createPrivateKey, createPublicKey, generateKeyPairSync, randomBytes } from "node:crypto";
18
18
  import { CLIENT_IP_HEADER, PUBLIC_PREFIX, TELEMETRY_KEYS, WILDCARD_SUBDOMAIN, bucketExpiry, cacheTable, cookieDomain, dependenciesOf, dependentsOf, drawSecret, externalApiUrl, isWildcardSite, mobileOrigins, provideKey, providedKeyFor, provisionOrder, publicEnvFor, schemeBase, wildcardDomainOf } from "@geekmidas/manifest";
19
19
  import { formatKeyring } from "@geekmidas/constructs/encryption";
20
20
  import { ownerRole, readerRole, roleStatements } from "@geekmidas/db/pg/roles";
@@ -22,6 +22,7 @@ import * as snsUrl from "@geekmidas/events/sns/url";
22
22
  import * as sqsUrl from "@geekmidas/events/sqs/url";
23
23
  import { cacheTableStatements } from "@geekmidas/cache/postgres";
24
24
  import { promisify } from "node:util";
25
+ import forge from "node-forge";
25
26
  import { CreateBucketCommand, DeleteBucketLifecycleCommand, GetBucketLifecycleConfigurationCommand, GetBucketNotificationConfigurationCommand, GetBucketPolicyCommand, HeadBucketCommand, ListBucketsCommand, PutBucketLifecycleConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketPolicyCommand, S3Client } from "@aws-sdk/client-s3";
26
27
  import { CreateTopicCommand, GetTopicAttributesCommand, SNSClient } from "@aws-sdk/client-sns";
27
28
  import { CreateQueueCommand, GetQueueUrlCommand, SQSClient } from "@aws-sdk/client-sqs";
@@ -57,8 +58,10 @@ function processorsDevRoute(fileServerId) {
57
58
  * caching, because caching is not what is missing locally, and a caching proxy
58
59
  * would add an invalidation story a local stack has no use for.
59
60
  *
60
- * What it buys beyond the shape is a certificate. Caddy issues one per host
61
- * from its own CA, so a local address is `https://` like the deployed one, and
61
+ * What it buys beyond the shape is a certificate: gkm's local authority
62
+ * (`trust/authority.ts`) issues one for the stage's hosts, which the edge
63
+ * serves the way a deployed edge serves the stage's own, so a local address is
64
+ * `https://` like the deployed one, and
62
65
  * everything downstream of that — `Secure` cookies, `SameSite`, a cookie domain
63
66
  * with more than one host under it — starts behaving the way it will in
64
67
  * production rather than the way `http://localhost` allows.
@@ -92,12 +95,14 @@ const EDGE_KINDS = {
92
95
  * maps it to the host gateway.
93
96
  */
94
97
  const HOST_GATEWAY = "host.docker.internal";
98
+ /** Where the edge's container reads `.gkm/caddy-sites/` — routes and certificates. */
99
+ const CADDY_SITES_IN_CONTAINER = "/etc/caddy/sites";
95
100
  /**
96
101
  * The suffix every local host shares.
97
102
  *
98
103
  * `.localhost` rather than a made-up TLD because it resolves to loopback
99
104
  * without touching `/etc/hosts` — macOS and systemd-resolved both answer for
100
- * subdomains of it, and Caddy issues internal certificates for it by default.
105
+ * subdomains of it.
101
106
  */
102
107
  const LOCAL_TLD = "localhost";
103
108
  /**
@@ -236,14 +241,14 @@ function stageOf(resource) {
236
241
  function caddyfileRoot() {
237
242
  return `${GENERATED}
238
243
  {
239
- # No ACME, no public DNS: the CA is local and so are the names.
240
- local_certs
244
+ # No ACME, no public DNS: each stage's certificate is gkm's, beside its
245
+ # routes, and the names are local.
241
246
  auto_https disable_redirects
242
247
  }
243
248
 
244
249
  # One file per stage, so two stages share this edge the way they already share
245
250
  # one Postgres and one MinIO.
246
- import /etc/caddy/sites/*.caddy
251
+ import ${CADDY_SITES_IN_CONTAINER}/*.caddy
247
252
  `;
248
253
  }
249
254
  /**
@@ -256,7 +261,7 @@ import /etc/caddy/sites/*.caddy
256
261
  * and signs on the Host header, so forwarding the requested hostname would make
257
262
  * it look for a bucket named after the domain.
258
263
  */
259
- function toCaddyfile(sites) {
264
+ function toCaddyfile(sites, options) {
260
265
  if (sites.length === 0) return `${GENERATED}
261
266
  # No file server is declared in this stage, so it routes nothing.
262
267
  `;
@@ -274,7 +279,7 @@ function toCaddyfile(sites) {
274
279
  }`;
275
280
  return `
276
281
  https://${host} {
277
- tls internal
282
+ tls ${options.certificate} ${options.certificate}
278
283
 
279
284
  # gkm's own header, which only a service of this stack may send: the auth
280
285
  # server rate-limits by the client address it carries.
@@ -325,9 +330,9 @@ const GENERATED = `# Generated by gkm from the construct manifest — do not edi
325
330
  # bucket — which MinIO alone cannot produce: its virtual-host mode reads the
326
331
  # leading label as the bucket name.
327
332
  #
328
- # Certificates come from Caddy's own CA. "gkm dev" and "gkm test" export its
329
- # root and point Node at it, so nothing has to be installed to use these URLs
330
- # from code; a browser needs the root trusted once.
333
+ # Certificates come from gkm's local CA. "gkm dev" and "gkm test" point Node at
334
+ # its root, so nothing has to be installed to use these URLs from code; a
335
+ # browser needs the root trusted once ("gkm trust").
331
336
  `;
332
337
  //#endregion
333
338
  //#region src/telemetry/edges.ts
@@ -1967,6 +1972,62 @@ function publicBuildValues(site, manifest, resolve, secrets) {
1967
1972
  for (const [key, value] of Object.entries(secrets)) if (key.startsWith(prefix) && args[key] === void 0 && value) args[key] = value;
1968
1973
  return args;
1969
1974
  }
1975
+ /**
1976
+ * Where a site's own hosts point during its image build: this loopback
1977
+ * address, on which nothing in a build container listens — so a request to
1978
+ * one is refused at once instead of waiting on a host that is not up yet.
1979
+ */
1980
+ const OFFLINE_BUILD_ADDRESS = "127.0.0.1";
1981
+ /**
1982
+ * The hosts a site's image build must not wait on: its own and those of the
1983
+ * constructs its `.dependsOn()` names, as this stage serves them.
1984
+ *
1985
+ * None of them answers while the image is built — the stack the site belongs
1986
+ * to is started after it — and a fetch to a public host that does not answer
1987
+ * yet can stall until the framework's prerender limit (Next's 60s). Mapped to
1988
+ * {@link OFFLINE_BUILD_ADDRESS} in the build's `/etc/hosts`, each is refused
1989
+ * at once, and the page renders on its first request instead.
1990
+ *
1991
+ * The mapping is the build's only: the URLs the bundle inlines are the real
1992
+ * ones, and the running container resolves them as anything else does. A
1993
+ * stage secret named for the bundle is someone else's host (an analytics
1994
+ * service, a store) and is left alone, as are `localhost` and an address.
1995
+ */
1996
+ function offlineBuildHosts(site, manifest, resolve) {
1997
+ const sources = [provideKey(site.id, "url"), ...Object.values(publicEnvFor(site, manifest))];
1998
+ const hosts = /* @__PURE__ */ new Set();
1999
+ for (const source of sources) {
2000
+ const host = hostOf(resolve(source));
2001
+ if (host) hosts.add(host);
2002
+ }
2003
+ return [...hosts].sort();
2004
+ }
2005
+ /** A URL's host, where it is a name `/etc/hosts` can map. */
2006
+ function hostOf(value) {
2007
+ if (!value || !URL.canParse(value)) return void 0;
2008
+ const { protocol, hostname } = new URL(value);
2009
+ if (!/^(https?|wss?):$/.test(protocol)) return void 0;
2010
+ if (hostname === "localhost" || hostname.includes("*")) return void 0;
2011
+ if (/^[\d.]+$/.test(hostname) || hostname.startsWith("[")) return void 0;
2012
+ return hostname;
2013
+ }
2014
+ /**
2015
+ * {@link offlineBuildHosts} for a target that knows each app's public URL by
2016
+ * its app key rather than by construct key — the site's own, and each app it
2017
+ * calls. None, for an app that declares no site.
2018
+ */
2019
+ function siteOfflineHosts(manifest, appName, ownUrl, urls) {
2020
+ const entries = Object.entries(manifest);
2021
+ const site = entries.find(([id, d]) => d.kind === "site" && appKey(id) === appName)?.[1];
2022
+ if (site?.kind !== "site") return [];
2023
+ const byKey = /* @__PURE__ */ new Map();
2024
+ for (const [id] of entries) {
2025
+ const name = appKey(id);
2026
+ const url = name === appName ? ownUrl : urls[name];
2027
+ if (url) byKey.set(provideKey(id, "url"), url);
2028
+ }
2029
+ return offlineBuildHosts(site, manifest, (key) => byKey.get(key));
2030
+ }
1970
2031
  //#endregion
1971
2032
  //#region src/exec/imageBuild.ts
1972
2033
  /**
@@ -1985,6 +2046,22 @@ function isImageBuild(env = process.env) {
1985
2046
  return env[IMAGE_BUILD_ENV] === "1";
1986
2047
  }
1987
2048
  /**
2049
+ * Set by a site's Dockerfile in its builder stage: this build is offline —
2050
+ * no stage is reachable from it.
2051
+ *
2052
+ * A site's image is built before the stack it belongs to runs, so the APIs
2053
+ * its `.dependsOn()` names do not answer yet: data a page fetches while the
2054
+ * framework prerenders it would be none, cached as the page. A site tests
2055
+ * `process.env.GKM_BUILD_OFFLINE === '1'` to skip that fetch, and renders the
2056
+ * page on its first request instead — which gkm's warm-up after a deploy
2057
+ * makes before any visitor does.
2058
+ *
2059
+ * Separate from {@link IMAGE_BUILD_ENV}, which says what `gkm exec` injects:
2060
+ * this says what the build can reach. Only the builder stage sets it; the
2061
+ * running container never has it.
2062
+ */
2063
+ const BUILD_OFFLINE_ENV = "GKM_BUILD_OFFLINE";
2064
+ /**
1988
2065
  * What `gkm exec` injects inside an image build: the public values its build
1989
2066
  * args set — every `NEXT_PUBLIC_*`, `VITE_*` and `EXPO_PUBLIC_*` — and
1990
2067
  * nothing read from a secrets store, a file or a container.
@@ -2330,6 +2407,9 @@ const FIND_GKM_BIN = `let d=process.cwd();const{existsSync:e}=require("fs"),{dir
2330
2407
  * no bin linked.
2331
2408
  * - `GKM_IMAGE_BUILD`, which has `gkm exec` inject the build args above — the
2332
2409
  * stage's public URLs — and never load a secret or resolve a local address.
2410
+ * - `GKM_BUILD_OFFLINE`, which tells the site's own code that no stage is
2411
+ * reachable from this build: its APIs are not up yet, so a page that
2412
+ * fetches from them renders on request rather than at build.
2333
2413
  * - each backend's typed client, generated from its endpoints at the
2334
2414
  * workspace root's `.gkm/client/`, where the site's tsconfig paths point.
2335
2415
  */
@@ -2357,12 +2437,15 @@ RUN cd ${root} && GKM_BIN="$(node -e '${FIND_GKM_BIN}')" && \\
2357
2437
  chmod +x /usr/local/bin/gkm
2358
2438
 
2359
2439
  # \`gkm exec\` in this build injects the build args, never a stage's secrets
2360
- ENV ${IMAGE_BUILD_ENV}=1${generate}`;
2440
+ ENV ${IMAGE_BUILD_ENV}=1
2441
+ # No stage is reachable from this build: the site's APIs are not up yet
2442
+ ENV ${BUILD_OFFLINE_ENV}=1${generate}`;
2361
2443
  }
2362
2444
  /**
2363
2445
  * Build the site with turbo. Loose env mode, so the task sees what the
2364
- * Dockerfile set — the build args and `GKM_IMAGE_BUILD` — whatever the
2365
- * project's turbo.json declares: the image's environment holds nothing else.
2446
+ * Dockerfile set — the build args, `GKM_IMAGE_BUILD` and `GKM_BUILD_OFFLINE`
2447
+ * — whatever the project's turbo.json declares: the image's environment
2448
+ * holds nothing else.
2366
2449
  */
2367
2450
  function siteBuild(options) {
2368
2451
  const { turbo } = layout(options);
@@ -2968,6 +3051,352 @@ function toPosix(path) {
2968
3051
  return path.split(sep).join("/");
2969
3052
  }
2970
3053
  //#endregion
3054
+ //#region src/trust/authority.ts
3055
+ /**
3056
+ * gkm's local certificate authority: one per machine, and every local edge's
3057
+ * certificate is issued from it.
3058
+ *
3059
+ * `gkm dev`'s Caddy, a local `gkm compose` stack's Caddy — and anything else
3060
+ * that serves the local stage's `*.localhost` names — serves a certificate
3061
+ * this module issued, the way a deployed stage's edge serves the files
3062
+ * `deploy.compose.tls` names. So there is one root to trust (`gkm trust`), it
3063
+ * exists before any container starts, and a container that calls the stage's
3064
+ * public hosts can be handed it (`NODE_EXTRA_CA_CERTS`) without first copying
3065
+ * it out of a proxy.
3066
+ *
3067
+ * The root lives in the CLI's home (`GKM_HOME`, else `~/.gkm`), outside every
3068
+ * project. Its key never leaves that directory: only certificates it signed —
3069
+ * and their own keys — are written to a workspace or handed to a container.
3070
+ */
3071
+ /** How long the root is good for: ten years, so it is trusted once. */
3072
+ const AUTHORITY_DAYS = 3650;
3073
+ /** An issued certificate this close to its end is issued again. */
3074
+ const RENEW_WITHIN_DAYS = 30;
3075
+ const DAY = 864e5;
3076
+ /** The authority's files, under the CLI's home. */
3077
+ function localAuthorityPaths(home = gkmHome()) {
3078
+ const dir = join(home, "ca");
3079
+ return {
3080
+ dir,
3081
+ certFile: join(dir, "root.pem"),
3082
+ keyFile: join(dir, "root-key.pem")
3083
+ };
3084
+ }
3085
+ /** The authority's directory is there, and its root or key is not readable. */
3086
+ var LocalAuthorityDamaged = class extends GkmError {
3087
+ dir;
3088
+ reason;
3089
+ constructor(dir, reason) {
3090
+ super(`gkm's local certificate authority in ${dir} cannot be used: ${reason}. Delete the directory and run "gkm trust" to make a new one — a browser that trusted the old root has to trust the new one.`);
3091
+ this.dir = dir;
3092
+ this.reason = reason;
3093
+ this.name = "LocalAuthorityDamaged";
3094
+ }
3095
+ };
3096
+ /** A certificate asked for with no names to put on it. */
3097
+ var LocalCertificateWithoutNames = class extends GkmError {
3098
+ constructor() {
3099
+ super("A local certificate needs at least one host name. Pass the hosts the edge serves — localCertificateNames(project, hosts) lists them.");
3100
+ this.name = "LocalCertificateWithoutNames";
3101
+ }
3102
+ };
3103
+ /**
3104
+ * Load the authority, creating it the first time.
3105
+ *
3106
+ * Created whole or not at all: generated into a directory of its own and
3107
+ * renamed into place, so two commands starting at once — `gkm dev` for two
3108
+ * apps — end with one root between them, never one's certificate and the
3109
+ * other's key.
3110
+ *
3111
+ * @throws {LocalAuthorityDamaged} when its directory holds no usable root.
3112
+ */
3113
+ async function ensureLocalAuthority(paths = localAuthorityPaths()) {
3114
+ if (!existsSync(paths.dir)) await createAuthority(paths);
3115
+ return readLocalAuthority(paths);
3116
+ }
3117
+ /**
3118
+ * Load an authority that exists.
3119
+ *
3120
+ * @throws {LocalAuthorityDamaged} when its root or key is missing or unreadable.
3121
+ */
3122
+ async function readLocalAuthority(paths = localAuthorityPaths()) {
3123
+ let cert;
3124
+ let key;
3125
+ try {
3126
+ [cert, key] = await Promise.all([readFile(paths.certFile, "utf-8"), readFile(paths.keyFile, "utf-8")]);
3127
+ } catch {
3128
+ throw new LocalAuthorityDamaged(paths.dir, "its root certificate or key is missing");
3129
+ }
3130
+ try {
3131
+ const root = forge.pki.certificateFromPem(cert);
3132
+ const signer = forge.pki.privateKeyFromPem(key);
3133
+ if (!root.publicKey.n.equals(signer.n)) throw new LocalAuthorityDamaged(paths.dir, "its key is not the root certificate’s");
3134
+ } catch (error) {
3135
+ if (error instanceof LocalAuthorityDamaged) throw error;
3136
+ throw new LocalAuthorityDamaged(paths.dir, "its files are not PEM");
3137
+ }
3138
+ return {
3139
+ certFile: paths.certFile,
3140
+ cert,
3141
+ key
3142
+ };
3143
+ }
3144
+ async function createAuthority(paths) {
3145
+ const { cert, key } = selfSigned();
3146
+ const staging = `${paths.dir}.${process.pid}.${randomBytes(4).toString("hex")}`;
3147
+ await mkdir(staging, {
3148
+ recursive: true,
3149
+ mode: 448
3150
+ });
3151
+ try {
3152
+ await writeFile(join(staging, "root.pem"), cert, { mode: 420 });
3153
+ await writeFile(join(staging, "root-key.pem"), key, { mode: 384 });
3154
+ await mkdir(dirname(paths.dir), { recursive: true });
3155
+ await rename(staging, paths.dir).catch((error) => {
3156
+ if (error.code !== "EEXIST" && error.code !== "ENOTEMPTY") throw error;
3157
+ });
3158
+ } finally {
3159
+ await rm(staging, {
3160
+ recursive: true,
3161
+ force: true
3162
+ });
3163
+ }
3164
+ }
3165
+ /** A new root: who made it, on which machine, so a keychain says whose it is. */
3166
+ function selfSigned() {
3167
+ const { privateKey, publicKey } = keyPair();
3168
+ const cert = forge.pki.createCertificate();
3169
+ cert.publicKey = publicKey;
3170
+ cert.serialNumber = serialNumber();
3171
+ const now = Date.now();
3172
+ cert.validity.notBefore = /* @__PURE__ */ new Date(now - DAY);
3173
+ cert.validity.notAfter = new Date(now + AUTHORITY_DAYS * DAY);
3174
+ const subject = utf8([
3175
+ {
3176
+ name: "organizationName",
3177
+ value: "gkm local CA"
3178
+ },
3179
+ {
3180
+ name: "organizationalUnitName",
3181
+ value: owner()
3182
+ },
3183
+ {
3184
+ name: "commonName",
3185
+ value: `gkm local CA ${owner()}`
3186
+ }
3187
+ ]);
3188
+ cert.setSubject(subject);
3189
+ cert.setIssuer(subject);
3190
+ cert.setExtensions([
3191
+ {
3192
+ name: "basicConstraints",
3193
+ cA: true,
3194
+ pathLenConstraint: 0,
3195
+ critical: true
3196
+ },
3197
+ {
3198
+ name: "keyUsage",
3199
+ keyCertSign: true,
3200
+ cRLSign: true,
3201
+ critical: true
3202
+ },
3203
+ { name: "subjectKeyIdentifier" }
3204
+ ]);
3205
+ cert.sign(privateKey, forge.md.sha256.create());
3206
+ return {
3207
+ cert: forge.pki.certificateToPem(cert),
3208
+ key: forge.pki.privateKeyToPem(privateKey)
3209
+ };
3210
+ }
3211
+ /**
3212
+ * The names a project's local certificate carries: its bare host and every
3213
+ * label under it — `shop.localhost`, `*.shop.localhost` — and any host the
3214
+ * edge serves that those do not cover, a stage's own wildcard among them.
3215
+ * Without a project, the hosts alone: `*.localhost` is nobody's to claim.
3216
+ */
3217
+ function localCertificateNames(project, hosts) {
3218
+ const names = [...project ? [`${project}.localhost`, `*.${project}.localhost`] : []];
3219
+ for (const host of hosts) {
3220
+ const name = host.toLowerCase();
3221
+ if (!names.some((covering) => covers(covering, name))) names.push(name);
3222
+ }
3223
+ return names;
3224
+ }
3225
+ /** Whether a certificate name answers for a host, by the one-label wildcard rule. */
3226
+ function covers(name, host) {
3227
+ if (name === host) return true;
3228
+ if (!name.startsWith("*.") || host.startsWith("*.")) return false;
3229
+ const suffix = name.slice(1);
3230
+ return host.endsWith(suffix) && !host.slice(0, -suffix.length).includes(".");
3231
+ }
3232
+ /**
3233
+ * A certificate for `names`, signed by the authority. Each call makes a new
3234
+ * key; {@link ensureLocalCertificate} is what keeps one across runs.
3235
+ *
3236
+ * @throws {LocalCertificateWithoutNames} for an empty list.
3237
+ */
3238
+ function issueLocalCertificate(authority, names, options = {}) {
3239
+ if (names.length === 0) throw new LocalCertificateWithoutNames();
3240
+ const root = forge.pki.certificateFromPem(authority.cert);
3241
+ const signer = forge.pki.privateKeyFromPem(authority.key);
3242
+ const { privateKey, publicKey } = keyPair();
3243
+ const now = (options.now ?? /* @__PURE__ */ new Date()).getTime();
3244
+ const cert = forge.pki.createCertificate();
3245
+ cert.publicKey = publicKey;
3246
+ cert.serialNumber = serialNumber();
3247
+ cert.validity.notBefore = /* @__PURE__ */ new Date(now - 36e5);
3248
+ cert.validity.notAfter = new Date(now + (options.days ?? 365) * DAY);
3249
+ cert.setSubject(utf8([{
3250
+ name: "organizationName",
3251
+ value: "gkm local certificate"
3252
+ }, {
3253
+ name: "commonName",
3254
+ value: names[0]
3255
+ }]));
3256
+ cert.setIssuer(root.subject.attributes);
3257
+ cert.setExtensions([
3258
+ {
3259
+ name: "basicConstraints",
3260
+ cA: false,
3261
+ critical: true
3262
+ },
3263
+ {
3264
+ name: "keyUsage",
3265
+ digitalSignature: true,
3266
+ keyEncipherment: true,
3267
+ critical: true
3268
+ },
3269
+ {
3270
+ name: "extKeyUsage",
3271
+ serverAuth: true
3272
+ },
3273
+ {
3274
+ name: "subjectAltName",
3275
+ altNames: names.map((value) => ({
3276
+ type: 2,
3277
+ value
3278
+ }))
3279
+ },
3280
+ { name: "subjectKeyIdentifier" },
3281
+ {
3282
+ name: "authorityKeyIdentifier",
3283
+ keyIdentifier: root.generateSubjectKeyIdentifier().getBytes()
3284
+ }
3285
+ ]);
3286
+ cert.sign(signer, forge.md.sha256.create());
3287
+ return {
3288
+ cert: forge.pki.certificateToPem(cert),
3289
+ key: forge.pki.privateKeyToPem(privateKey)
3290
+ };
3291
+ }
3292
+ /**
3293
+ * The certificate for `names` kept in `file` — certificate then key, one PEM
3294
+ * file, which is what a proxy given the same path for both reads — issued
3295
+ * again only when the one there is not the authority's, does not cover every
3296
+ * name, or is near its end.
3297
+ *
3298
+ * One file written by rename, so two commands issuing at once leave a pair
3299
+ * that matches, never one's certificate beside the other's key.
3300
+ *
3301
+ * @throws {LocalCertificateWithoutNames} for an empty list.
3302
+ */
3303
+ async function ensureLocalCertificate(authority, names, file, options = {}) {
3304
+ const now = options.now ?? /* @__PURE__ */ new Date();
3305
+ const existing = await readFile(file, "utf-8").catch(() => void 0);
3306
+ const kept = existing ? splitPem(existing) : void 0;
3307
+ if (kept && stillGood(authority, kept, names, now)) return {
3308
+ ...kept,
3309
+ issued: false
3310
+ };
3311
+ const issued = issueLocalCertificate(authority, names, { now });
3312
+ await mkdir(dirname(file), {
3313
+ recursive: true,
3314
+ mode: 448
3315
+ });
3316
+ const staging = `${file}.${process.pid}.${randomBytes(4).toString("hex")}`;
3317
+ await writeFile(staging, `${issued.cert}${issued.key}`, { mode: 384 });
3318
+ await rename(staging, file);
3319
+ return {
3320
+ ...issued,
3321
+ issued: true
3322
+ };
3323
+ }
3324
+ /** A combined PEM file's certificate and key. */
3325
+ function splitPem(pem) {
3326
+ const cert = pem.match(/-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----\r?\n?/)?.[0];
3327
+ const key = pem.match(/-----BEGIN (?:RSA )?PRIVATE KEY-----[\s\S]+?-----END (?:RSA )?PRIVATE KEY-----\r?\n?/)?.[0];
3328
+ return cert && key ? {
3329
+ cert,
3330
+ key
3331
+ } : void 0;
3332
+ }
3333
+ /** Whether a kept certificate still serves: the authority's, every name, in date. */
3334
+ function stillGood(authority, kept, names, now) {
3335
+ try {
3336
+ const root = forge.pki.certificateFromPem(authority.cert);
3337
+ const cert = forge.pki.certificateFromPem(kept.cert);
3338
+ if (!root.verify(cert)) return false;
3339
+ if (cert.validity.notAfter.getTime() - now.getTime() < RENEW_WITHIN_DAYS * DAY) return false;
3340
+ const certKey = createPublicKey(kept.cert).export({
3341
+ type: "spki",
3342
+ format: "der"
3343
+ });
3344
+ const ownKey = createPublicKey(createPrivateKey(kept.key)).export({
3345
+ type: "spki",
3346
+ format: "der"
3347
+ });
3348
+ if (!certKey.equals(ownKey)) return false;
3349
+ const san = cert.getExtension("subjectAltName");
3350
+ const dns = new Set((san?.altNames ?? []).filter((n) => n.type === 2).map((n) => n.value));
3351
+ return names.every((name) => dns.has(name));
3352
+ } catch {
3353
+ return false;
3354
+ }
3355
+ }
3356
+ /** An RSA key pair, made natively — forge's own generation is slow. */
3357
+ function keyPair() {
3358
+ const { privateKey: pem } = generateKeyPairSync("rsa", {
3359
+ modulusLength: 2048,
3360
+ publicKeyEncoding: {
3361
+ type: "spki",
3362
+ format: "pem"
3363
+ },
3364
+ privateKeyEncoding: {
3365
+ type: "pkcs8",
3366
+ format: "pem"
3367
+ }
3368
+ });
3369
+ const privateKey = forge.pki.privateKeyFromPem(pem);
3370
+ return {
3371
+ privateKey,
3372
+ publicKey: forge.pki.setRsaPublicKey(privateKey.n, privateKey.e)
3373
+ };
3374
+ }
3375
+ /**
3376
+ * Attributes as UTF8String. forge writes PrintableString otherwise, which
3377
+ * has no `@` or `*` — and a TLS stack rejects the certificate outright.
3378
+ */
3379
+ function utf8(attributes) {
3380
+ return attributes.map((attribute) => ({
3381
+ ...attribute,
3382
+ valueTagClass: forge.asn1.Type.UTF8
3383
+ }));
3384
+ }
3385
+ /** A random, positive serial: sixteen bytes, its high bit clear. */
3386
+ function serialNumber() {
3387
+ const bytes = randomBytes(16);
3388
+ bytes[0] = bytes[0] & 127;
3389
+ return bytes.toString("hex");
3390
+ }
3391
+ /** `user@host`, as far as the machine will say. */
3392
+ function owner() {
3393
+ let user = "gkm";
3394
+ try {
3395
+ user = userInfo().username;
3396
+ } catch {}
3397
+ return `${user}@${hostname()}`;
3398
+ }
3399
+ //#endregion
2971
3400
  //#region src/reconcile/clients.ts
2972
3401
  /**
2973
3402
  * The real Postgres and MinIO clients the applier runs against.
@@ -3200,16 +3629,6 @@ const dockerCli = {
3200
3629
  if (options.show) return shown(args, services);
3201
3630
  await run("docker", args);
3202
3631
  },
3203
- async copyOut(composePath, service, from, to) {
3204
- await mkdir(dirname(to), { recursive: true });
3205
- await run("docker", [
3206
- "compose",
3207
- ...composeFiles(composePath),
3208
- "cp",
3209
- `${service}:${from}`,
3210
- to
3211
- ]);
3212
- },
3213
3632
  async reload(composePath, service) {
3214
3633
  await run("docker", [
3215
3634
  "compose",
@@ -3220,7 +3639,8 @@ const dockerCli = {
3220
3639
  "caddy",
3221
3640
  "reload",
3222
3641
  "--config",
3223
- "/etc/caddy/Caddyfile"
3642
+ "/etc/caddy/Caddyfile",
3643
+ "--force"
3224
3644
  ]);
3225
3645
  },
3226
3646
  async exec(composePath, service, argv) {
@@ -3854,17 +4274,12 @@ const CHECKOUT_MOUNTS = ["caddy"];
3854
4274
  */
3855
4275
  const caddySitesPath = (stage) => `.gkm/caddy-sites/${stage}.caddy`;
3856
4276
  /**
3857
- * Where the local edge's root certificate is copied to.
3858
- *
3859
- * Exported so a process can be pointed at it without installing anything:
3860
- * `NODE_EXTRA_CA_CERTS` is the whole of the trust story for Node, and it needs
3861
- * no sudo. A browser is the case that still wants the root in the system store,
3862
- * which is a one-time `caddy trust` rather than something a reconcile should do
3863
- * on a developer's behalf.
4277
+ * Where one stage's certificate is kept: certificate and key in one PEM,
4278
+ * issued from gkm's local authority (`trust/authority.ts`), beside the
4279
+ * stage's routes — so the edge reads it through the mount it already has, and
4280
+ * a stage removed takes its certificate with it.
3864
4281
  */
3865
- const LOCAL_CA_PATH = ".gkm/caddy-root.crt";
3866
- /** Where Caddy keeps the root of the CA it generated. */
3867
- const CADDY_ROOT_IN_CONTAINER = "/data/caddy/pki/authorities/local/root.crt";
4282
+ const caddyCertificatePath = (stage) => `.gkm/caddy-sites/${stage}.pem`;
3868
4283
  /**
3869
4284
  * Converge the local target on what the manifest declares.
3870
4285
  *
@@ -3907,7 +4322,10 @@ async function reconcile(options) {
3907
4322
  ...options.objectWebhooks?.length ? { objectWebhooks: options.objectWebhooks } : {},
3908
4323
  ...options.inboxRelay ? { inboxRelay: options.inboxRelay } : {}
3909
4324
  });
3910
- const caddyfile = toCaddyfile(sitesFor(plan, project, options.addresses, options.processorAddresses));
4325
+ const sites = sitesFor(plan, project, options.addresses, options.processorAddresses);
4326
+ const edged = plan.containers.includes("caddy");
4327
+ const authorityPaths = options.authority ?? localAuthorityPaths();
4328
+ const caddyfile = toCaddyfile(sites, { certificate: `${CADDY_SITES_IN_CONTAINER}/${stage}.pem` });
3911
4329
  const hash = planHash(plan, compose, {
3912
4330
  caddyfile,
3913
4331
  postgres: postgresStatements(plan, project, seed).map((statement) => statement.create).join(";\n")
@@ -3930,7 +4348,7 @@ async function reconcile(options) {
3930
4348
  uses: false,
3931
4349
  serviceName: project
3932
4350
  });
3933
- if (plan.containers.includes("caddy")) env.NODE_EXTRA_CA_CERTS = join(root, LOCAL_CA_PATH);
4351
+ if (edged) env.NODE_EXTRA_CA_CERTS = authorityPaths.certFile;
3934
4352
  return env;
3935
4353
  };
3936
4354
  const result = {
@@ -3948,11 +4366,12 @@ async function reconcile(options) {
3948
4366
  hash,
3949
4367
  changed: false
3950
4368
  };
4369
+ const certificate = edged ? await ensureLocalCertificate(await ensureLocalAuthority(authorityPaths), localCertificateNames(project, sites.map((site) => site.host)), join(root, caddyCertificatePath(stage))) : void 0;
3951
4370
  const recorded = await loadState(root, stage);
3952
4371
  const postgresPort = ports[primaryPortKey("postgres")];
3953
- if (recorded?.hash === hash && existsSync(composePath) && (!start || await docker.healthy(composePath, running, { mounted: CHECKOUT_MOUNTS })) && (!start || !provision || postgresPort === void 0 || await databasesExist(sql(postgresPort, options.credentials.postgres), postgresDatabaseNames(plan)))) return result;
4372
+ if (!certificate?.issued && recorded?.hash === hash && existsSync(composePath) && (!start || await docker.healthy(composePath, running, { mounted: CHECKOUT_MOUNTS })) && (!start || !provision || postgresPort === void 0 || await databasesExist(sql(postgresPort, options.credentials.postgres), postgresDatabaseNames(plan)))) return result;
3954
4373
  await write(composePath, toYaml(compose), 384);
3955
- if (plan.containers.includes("caddy")) {
4374
+ if (edged) {
3956
4375
  await write(join(root, CADDYFILE_PATH), caddyfileRoot());
3957
4376
  await write(join(root, caddySitesPath(stage)), caddyfile);
3958
4377
  await pruneCaddySites(root, [
@@ -3965,8 +4384,7 @@ async function reconcile(options) {
3965
4384
  options.progress?.(`🐳 Starting ${running.join(", ")} — the first start pulls each image, which can take a few minutes`);
3966
4385
  await docker.up(composePath, running, options.progress ? { show: true } : {});
3967
4386
  }
3968
- if (start && plan.containers.includes("caddy")) await docker.reload(composePath, "caddy").catch(() => {});
3969
- if (start && plan.containers.includes("caddy")) await docker.copyOut(composePath, "caddy", CADDY_ROOT_IN_CONTAINER, join(root, LOCAL_CA_PATH)).catch(() => {});
4387
+ if (start && edged) await docker.reload(composePath, "caddy").catch(() => {});
3970
4388
  const checked = start && plan.containers.length > 0 ? await logins({
3971
4389
  credentials: options.credentials,
3972
4390
  containers: plan.containers,
@@ -4051,8 +4469,8 @@ async function observedPorts(docker, composePath, containers, fakes) {
4051
4469
  */
4052
4470
  async function pruneCaddySites(root, stages) {
4053
4471
  const dir = dirname(join(root, caddySitesPath(TEST_STAGE)));
4054
- const keep = new Set(stages.map((stage) => stage && `${stage}.caddy`));
4055
- for (const file of await readdir(dir)) if (file.endsWith(".caddy") && !keep.has(file)) await rm(join(dir, file));
4472
+ const keep = new Set(stages.flatMap((stage) => stage ? [`${stage}.caddy`, `${stage}.pem`] : []));
4473
+ for (const file of await readdir(dir)) if (/\.(caddy|pem)$/.test(file) && !keep.has(file)) await rm(join(dir, file));
4056
4474
  }
4057
4475
  async function write(path, content, mode) {
4058
4476
  try {
@@ -4588,6 +5006,6 @@ function healthcheck(port, path) {
4588
5006
  };
4589
5007
  }
4590
5008
  //#endregion
4591
- export { mergeLifecycle as $, generateNextjsDockerfile as A, processorUnitName as B, TURBO_VERSION as C, generateBackendDockerfile as D, findBuildRoot as E, resolveDockerConfig as F, applyNotifications as G, workerUnits as H, imageBuildCredentials as I, bucketLifecycles as J, applyPolicies as K, isImageBuild as L, generateProcessorDockerfile as M, generateViteStaticDockerfile as N, generateDockerignore as O, generateWorkerDockerfile as P, quoteIdentifier as Q, publicBuildValues as R, PROCESSOR_PORT as S, detectPackageManager as T, applyBuckets as U, processorUnits as V, applyLifecycles as W, postgresDatabaseNames as X, bucketPolicies as Y, postgresStatements as Z, bucketClient as _, workerEnvKeys as a, resourceName as at, composeBuildPaths as b, constructGlobs as c, scopeTelemetryEnv as ct, workspace_exports as d, telemetryOf as dt, envFor as et, COMPOSE_PATH as f, usesTelemetry as ft, ensurePostgresLogin as g, LEGACY_LOCAL_LOGIN as h, PROCESSORS_DEV_PREFIX as ht, processorEnvKeys as i, planFor as it, generateNodeWebDockerfile as j, generateEntryDockerfile as k, derivedContainers as l, siteClientTelemetry as lt, forgetState as m, hostFor$1 as mt, dockerfileOf as n, stageEnv as nt, FAKE_ENV as o, appTelemetry as ot, LOCAL_CA_PATH as p, LOCAL_TLD as pt, applyPostgres as q, networkEnv as r, TELEMETRY_CONTAINER as rt, backendsOf as s, isTelemetryKey as st, appEnvKeys as t, localRolePassword as tt, reconcileWorkspace as u, surfaceClientTraced as ut, pgClient as v, WORKER_PORT as w, imageLayout as x, appImageOptions as y, isUnder as z };
5009
+ export { applyPolicies as $, findBuildRoot as A, imageBuildCredentials as B, appImageOptions as C, TURBO_VERSION as D, PROCESSOR_PORT as E, generateNodeWebDockerfile as F, siteOfflineHosts as G, OFFLINE_BUILD_ADDRESS as H, generateProcessorDockerfile as I, processorUnits as J, isUnder as K, generateViteStaticDockerfile as L, generateDockerignore as M, generateEntryDockerfile as N, WORKER_PORT as O, generateNextjsDockerfile as P, applyNotifications as Q, generateWorkerDockerfile as R, readLocalAuthority as S, PROCESSORS_DEV_PREFIX as St, imageLayout as T, offlineBuildHosts as U, isImageBuild as V, publicBuildValues as W, applyBuckets as X, workerUnits as Y, applyLifecycles as Z, pgClient as _, surfaceClientTraced as _t, workerEnvKeys as a, quoteIdentifier as at, localAuthorityPaths as b, LOCAL_TLD as bt, constructGlobs as c, localRolePassword as ct, workspace_exports as d, planFor as dt, applyPostgres as et, COMPOSE_PATH as f, resourceName as ft, bucketClient as g, siteClientTelemetry as gt, ensurePostgresLogin as h, scopeTelemetryEnv as ht, processorEnvKeys as i, postgresStatements as it, generateBackendDockerfile as j, detectPackageManager as k, derivedContainers as l, stageEnv as lt, LEGACY_LOCAL_LOGIN as m, isTelemetryKey as mt, dockerfileOf as n, bucketPolicies as nt, FAKE_ENV as o, mergeLifecycle as ot, forgetState as p, appTelemetry as pt, processorUnitName as q, networkEnv as r, postgresDatabaseNames as rt, backendsOf as s, envFor as st, appEnvKeys as t, bucketLifecycles as tt, reconcileWorkspace as u, TELEMETRY_CONTAINER as ut, ensureLocalAuthority as v, telemetryOf as vt, composeBuildPaths as w, localCertificateNames as x, hostFor$1 as xt, ensureLocalCertificate as y, usesTelemetry as yt, resolveDockerConfig as z };
4592
5010
 
4593
- //# sourceMappingURL=apps-Xrlvir2-.mjs.map
5011
+ //# sourceMappingURL=apps-DFzUuJ22.mjs.map