@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,10 +1,10 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
2
  const require_errors = require("./errors-DMC4Umsb.cjs");
3
- const require_credentials = require("./credentials-CCIXh-cq.cjs");
4
- const require_workspace = require("./workspace-Dkm3HL9e.cjs");
5
- const require_compose = require("./compose-CVAoA04l.cjs");
3
+ const require_credentials = require("./credentials-D11xozSF.cjs");
4
+ const require_workspace = require("./workspace-1szcahj9.cjs");
5
+ const require_compose = require("./compose-Cius-YHS.cjs");
6
6
  const require_SubscriberGenerator = require("./SubscriberGenerator-BNJyPmXJ.cjs");
7
- const require_config = require("./config-QAqAEgb0.cjs");
7
+ const require_config = require("./config-juUyBlb1.cjs");
8
8
  const require_types = require("./types-Bl_CwZC9.cjs");
9
9
  const require_EndpointGenerator = require("./EndpointGenerator-DyLMYClE.cjs");
10
10
  const require_discover = require("./discover-CRywE7yc.cjs");
@@ -24,6 +24,8 @@ let _geekmidas_events_sqs_url = require("@geekmidas/events/sqs/url");
24
24
  _geekmidas_events_sqs_url = require_rolldown_runtime.__toESM(_geekmidas_events_sqs_url, 1);
25
25
  let _geekmidas_cache_postgres = require("@geekmidas/cache/postgres");
26
26
  let node_util = require("node:util");
27
+ let node_forge = require("node-forge");
28
+ node_forge = require_rolldown_runtime.__toESM(node_forge, 1);
27
29
  let _aws_sdk_client_s3 = require("@aws-sdk/client-s3");
28
30
  let _aws_sdk_client_sns = require("@aws-sdk/client-sns");
29
31
  let _aws_sdk_client_sqs = require("@aws-sdk/client-sqs");
@@ -59,8 +61,10 @@ function processorsDevRoute(fileServerId) {
59
61
  * caching, because caching is not what is missing locally, and a caching proxy
60
62
  * would add an invalidation story a local stack has no use for.
61
63
  *
62
- * What it buys beyond the shape is a certificate. Caddy issues one per host
63
- * from its own CA, so a local address is `https://` like the deployed one, and
64
+ * What it buys beyond the shape is a certificate: gkm's local authority
65
+ * (`trust/authority.ts`) issues one for the stage's hosts, which the edge
66
+ * serves the way a deployed edge serves the stage's own, so a local address is
67
+ * `https://` like the deployed one, and
64
68
  * everything downstream of that — `Secure` cookies, `SameSite`, a cookie domain
65
69
  * with more than one host under it — starts behaving the way it will in
66
70
  * production rather than the way `http://localhost` allows.
@@ -94,12 +98,14 @@ const EDGE_KINDS = {
94
98
  * maps it to the host gateway.
95
99
  */
96
100
  const HOST_GATEWAY = "host.docker.internal";
101
+ /** Where the edge's container reads `.gkm/caddy-sites/` — routes and certificates. */
102
+ const CADDY_SITES_IN_CONTAINER = "/etc/caddy/sites";
97
103
  /**
98
104
  * The suffix every local host shares.
99
105
  *
100
106
  * `.localhost` rather than a made-up TLD because it resolves to loopback
101
107
  * without touching `/etc/hosts` — macOS and systemd-resolved both answer for
102
- * subdomains of it, and Caddy issues internal certificates for it by default.
108
+ * subdomains of it.
103
109
  */
104
110
  const LOCAL_TLD = "localhost";
105
111
  /**
@@ -238,14 +244,14 @@ function stageOf(resource) {
238
244
  function caddyfileRoot() {
239
245
  return `${GENERATED}
240
246
  {
241
- # No ACME, no public DNS: the CA is local and so are the names.
242
- local_certs
247
+ # No ACME, no public DNS: each stage's certificate is gkm's, beside its
248
+ # routes, and the names are local.
243
249
  auto_https disable_redirects
244
250
  }
245
251
 
246
252
  # One file per stage, so two stages share this edge the way they already share
247
253
  # one Postgres and one MinIO.
248
- import /etc/caddy/sites/*.caddy
254
+ import ${CADDY_SITES_IN_CONTAINER}/*.caddy
249
255
  `;
250
256
  }
251
257
  /**
@@ -258,7 +264,7 @@ import /etc/caddy/sites/*.caddy
258
264
  * and signs on the Host header, so forwarding the requested hostname would make
259
265
  * it look for a bucket named after the domain.
260
266
  */
261
- function toCaddyfile(sites) {
267
+ function toCaddyfile(sites, options) {
262
268
  if (sites.length === 0) return `${GENERATED}
263
269
  # No file server is declared in this stage, so it routes nothing.
264
270
  `;
@@ -276,7 +282,7 @@ function toCaddyfile(sites) {
276
282
  }`;
277
283
  return `
278
284
  https://${host} {
279
- tls internal
285
+ tls ${options.certificate} ${options.certificate}
280
286
 
281
287
  # gkm's own header, which only a service of this stack may send: the auth
282
288
  # server rate-limits by the client address it carries.
@@ -327,9 +333,9 @@ const GENERATED = `# Generated by gkm from the construct manifest — do not edi
327
333
  # bucket — which MinIO alone cannot produce: its virtual-host mode reads the
328
334
  # leading label as the bucket name.
329
335
  #
330
- # Certificates come from Caddy's own CA. "gkm dev" and "gkm test" export its
331
- # root and point Node at it, so nothing has to be installed to use these URLs
332
- # from code; a browser needs the root trusted once.
336
+ # Certificates come from gkm's local CA. "gkm dev" and "gkm test" point Node at
337
+ # its root, so nothing has to be installed to use these URLs from code; a
338
+ # browser needs the root trusted once ("gkm trust").
333
339
  `;
334
340
  //#endregion
335
341
  //#region src/telemetry/edges.ts
@@ -1969,6 +1975,62 @@ function publicBuildValues(site, manifest, resolve, secrets) {
1969
1975
  for (const [key, value] of Object.entries(secrets)) if (key.startsWith(prefix) && args[key] === void 0 && value) args[key] = value;
1970
1976
  return args;
1971
1977
  }
1978
+ /**
1979
+ * Where a site's own hosts point during its image build: this loopback
1980
+ * address, on which nothing in a build container listens — so a request to
1981
+ * one is refused at once instead of waiting on a host that is not up yet.
1982
+ */
1983
+ const OFFLINE_BUILD_ADDRESS = "127.0.0.1";
1984
+ /**
1985
+ * The hosts a site's image build must not wait on: its own and those of the
1986
+ * constructs its `.dependsOn()` names, as this stage serves them.
1987
+ *
1988
+ * None of them answers while the image is built — the stack the site belongs
1989
+ * to is started after it — and a fetch to a public host that does not answer
1990
+ * yet can stall until the framework's prerender limit (Next's 60s). Mapped to
1991
+ * {@link OFFLINE_BUILD_ADDRESS} in the build's `/etc/hosts`, each is refused
1992
+ * at once, and the page renders on its first request instead.
1993
+ *
1994
+ * The mapping is the build's only: the URLs the bundle inlines are the real
1995
+ * ones, and the running container resolves them as anything else does. A
1996
+ * stage secret named for the bundle is someone else's host (an analytics
1997
+ * service, a store) and is left alone, as are `localhost` and an address.
1998
+ */
1999
+ function offlineBuildHosts(site, manifest, resolve) {
2000
+ const sources = [(0, _geekmidas_manifest.provideKey)(site.id, "url"), ...Object.values((0, _geekmidas_manifest.publicEnvFor)(site, manifest))];
2001
+ const hosts = /* @__PURE__ */ new Set();
2002
+ for (const source of sources) {
2003
+ const host = hostOf(resolve(source));
2004
+ if (host) hosts.add(host);
2005
+ }
2006
+ return [...hosts].sort();
2007
+ }
2008
+ /** A URL's host, where it is a name `/etc/hosts` can map. */
2009
+ function hostOf(value) {
2010
+ if (!value || !URL.canParse(value)) return void 0;
2011
+ const { protocol, hostname } = new URL(value);
2012
+ if (!/^(https?|wss?):$/.test(protocol)) return void 0;
2013
+ if (hostname === "localhost" || hostname.includes("*")) return void 0;
2014
+ if (/^[\d.]+$/.test(hostname) || hostname.startsWith("[")) return void 0;
2015
+ return hostname;
2016
+ }
2017
+ /**
2018
+ * {@link offlineBuildHosts} for a target that knows each app's public URL by
2019
+ * its app key rather than by construct key — the site's own, and each app it
2020
+ * calls. None, for an app that declares no site.
2021
+ */
2022
+ function siteOfflineHosts(manifest, appName, ownUrl, urls) {
2023
+ const entries = Object.entries(manifest);
2024
+ const site = entries.find(([id, d]) => d.kind === "site" && require_config.appKey(id) === appName)?.[1];
2025
+ if (site?.kind !== "site") return [];
2026
+ const byKey = /* @__PURE__ */ new Map();
2027
+ for (const [id] of entries) {
2028
+ const name = require_config.appKey(id);
2029
+ const url = name === appName ? ownUrl : urls[name];
2030
+ if (url) byKey.set((0, _geekmidas_manifest.provideKey)(id, "url"), url);
2031
+ }
2032
+ return offlineBuildHosts(site, manifest, (key) => byKey.get(key));
2033
+ }
1972
2034
  //#endregion
1973
2035
  //#region src/exec/imageBuild.ts
1974
2036
  /**
@@ -1987,6 +2049,22 @@ function isImageBuild(env = process.env) {
1987
2049
  return env[IMAGE_BUILD_ENV] === "1";
1988
2050
  }
1989
2051
  /**
2052
+ * Set by a site's Dockerfile in its builder stage: this build is offline —
2053
+ * no stage is reachable from it.
2054
+ *
2055
+ * A site's image is built before the stack it belongs to runs, so the APIs
2056
+ * its `.dependsOn()` names do not answer yet: data a page fetches while the
2057
+ * framework prerenders it would be none, cached as the page. A site tests
2058
+ * `process.env.GKM_BUILD_OFFLINE === '1'` to skip that fetch, and renders the
2059
+ * page on its first request instead — which gkm's warm-up after a deploy
2060
+ * makes before any visitor does.
2061
+ *
2062
+ * Separate from {@link IMAGE_BUILD_ENV}, which says what `gkm exec` injects:
2063
+ * this says what the build can reach. Only the builder stage sets it; the
2064
+ * running container never has it.
2065
+ */
2066
+ const BUILD_OFFLINE_ENV = "GKM_BUILD_OFFLINE";
2067
+ /**
1990
2068
  * What `gkm exec` injects inside an image build: the public values its build
1991
2069
  * args set — every `NEXT_PUBLIC_*`, `VITE_*` and `EXPO_PUBLIC_*` — and
1992
2070
  * nothing read from a secrets store, a file or a container.
@@ -2332,6 +2410,9 @@ const FIND_GKM_BIN = `let d=process.cwd();const{existsSync:e}=require("fs"),{dir
2332
2410
  * no bin linked.
2333
2411
  * - `GKM_IMAGE_BUILD`, which has `gkm exec` inject the build args above — the
2334
2412
  * stage's public URLs — and never load a secret or resolve a local address.
2413
+ * - `GKM_BUILD_OFFLINE`, which tells the site's own code that no stage is
2414
+ * reachable from this build: its APIs are not up yet, so a page that
2415
+ * fetches from them renders on request rather than at build.
2335
2416
  * - each backend's typed client, generated from its endpoints at the
2336
2417
  * workspace root's `.gkm/client/`, where the site's tsconfig paths point.
2337
2418
  */
@@ -2359,12 +2440,15 @@ RUN cd ${root} && GKM_BIN="$(node -e '${FIND_GKM_BIN}')" && \\
2359
2440
  chmod +x /usr/local/bin/gkm
2360
2441
 
2361
2442
  # \`gkm exec\` in this build injects the build args, never a stage's secrets
2362
- ENV ${IMAGE_BUILD_ENV}=1${generate}`;
2443
+ ENV ${IMAGE_BUILD_ENV}=1
2444
+ # No stage is reachable from this build: the site's APIs are not up yet
2445
+ ENV ${BUILD_OFFLINE_ENV}=1${generate}`;
2363
2446
  }
2364
2447
  /**
2365
2448
  * Build the site with turbo. Loose env mode, so the task sees what the
2366
- * Dockerfile set — the build args and `GKM_IMAGE_BUILD` — whatever the
2367
- * project's turbo.json declares: the image's environment holds nothing else.
2449
+ * Dockerfile set — the build args, `GKM_IMAGE_BUILD` and `GKM_BUILD_OFFLINE`
2450
+ * — whatever the project's turbo.json declares: the image's environment
2451
+ * holds nothing else.
2368
2452
  */
2369
2453
  function siteBuild(options) {
2370
2454
  const { turbo } = layout(options);
@@ -2970,6 +3054,352 @@ function toPosix(path) {
2970
3054
  return path.split(node_path.sep).join("/");
2971
3055
  }
2972
3056
  //#endregion
3057
+ //#region src/trust/authority.ts
3058
+ /**
3059
+ * gkm's local certificate authority: one per machine, and every local edge's
3060
+ * certificate is issued from it.
3061
+ *
3062
+ * `gkm dev`'s Caddy, a local `gkm compose` stack's Caddy — and anything else
3063
+ * that serves the local stage's `*.localhost` names — serves a certificate
3064
+ * this module issued, the way a deployed stage's edge serves the files
3065
+ * `deploy.compose.tls` names. So there is one root to trust (`gkm trust`), it
3066
+ * exists before any container starts, and a container that calls the stage's
3067
+ * public hosts can be handed it (`NODE_EXTRA_CA_CERTS`) without first copying
3068
+ * it out of a proxy.
3069
+ *
3070
+ * The root lives in the CLI's home (`GKM_HOME`, else `~/.gkm`), outside every
3071
+ * project. Its key never leaves that directory: only certificates it signed —
3072
+ * and their own keys — are written to a workspace or handed to a container.
3073
+ */
3074
+ /** How long the root is good for: ten years, so it is trusted once. */
3075
+ const AUTHORITY_DAYS = 3650;
3076
+ /** An issued certificate this close to its end is issued again. */
3077
+ const RENEW_WITHIN_DAYS = 30;
3078
+ const DAY = 864e5;
3079
+ /** The authority's files, under the CLI's home. */
3080
+ function localAuthorityPaths(home = require_credentials.gkmHome()) {
3081
+ const dir = (0, node_path.join)(home, "ca");
3082
+ return {
3083
+ dir,
3084
+ certFile: (0, node_path.join)(dir, "root.pem"),
3085
+ keyFile: (0, node_path.join)(dir, "root-key.pem")
3086
+ };
3087
+ }
3088
+ /** The authority's directory is there, and its root or key is not readable. */
3089
+ var LocalAuthorityDamaged = class extends require_errors.GkmError {
3090
+ dir;
3091
+ reason;
3092
+ constructor(dir, reason) {
3093
+ 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.`);
3094
+ this.dir = dir;
3095
+ this.reason = reason;
3096
+ this.name = "LocalAuthorityDamaged";
3097
+ }
3098
+ };
3099
+ /** A certificate asked for with no names to put on it. */
3100
+ var LocalCertificateWithoutNames = class extends require_errors.GkmError {
3101
+ constructor() {
3102
+ super("A local certificate needs at least one host name. Pass the hosts the edge serves — localCertificateNames(project, hosts) lists them.");
3103
+ this.name = "LocalCertificateWithoutNames";
3104
+ }
3105
+ };
3106
+ /**
3107
+ * Load the authority, creating it the first time.
3108
+ *
3109
+ * Created whole or not at all: generated into a directory of its own and
3110
+ * renamed into place, so two commands starting at once — `gkm dev` for two
3111
+ * apps — end with one root between them, never one's certificate and the
3112
+ * other's key.
3113
+ *
3114
+ * @throws {LocalAuthorityDamaged} when its directory holds no usable root.
3115
+ */
3116
+ async function ensureLocalAuthority(paths = localAuthorityPaths()) {
3117
+ if (!(0, node_fs.existsSync)(paths.dir)) await createAuthority(paths);
3118
+ return readLocalAuthority(paths);
3119
+ }
3120
+ /**
3121
+ * Load an authority that exists.
3122
+ *
3123
+ * @throws {LocalAuthorityDamaged} when its root or key is missing or unreadable.
3124
+ */
3125
+ async function readLocalAuthority(paths = localAuthorityPaths()) {
3126
+ let cert;
3127
+ let key;
3128
+ try {
3129
+ [cert, key] = await Promise.all([(0, node_fs_promises.readFile)(paths.certFile, "utf-8"), (0, node_fs_promises.readFile)(paths.keyFile, "utf-8")]);
3130
+ } catch {
3131
+ throw new LocalAuthorityDamaged(paths.dir, "its root certificate or key is missing");
3132
+ }
3133
+ try {
3134
+ const root = node_forge.default.pki.certificateFromPem(cert);
3135
+ const signer = node_forge.default.pki.privateKeyFromPem(key);
3136
+ if (!root.publicKey.n.equals(signer.n)) throw new LocalAuthorityDamaged(paths.dir, "its key is not the root certificate’s");
3137
+ } catch (error) {
3138
+ if (error instanceof LocalAuthorityDamaged) throw error;
3139
+ throw new LocalAuthorityDamaged(paths.dir, "its files are not PEM");
3140
+ }
3141
+ return {
3142
+ certFile: paths.certFile,
3143
+ cert,
3144
+ key
3145
+ };
3146
+ }
3147
+ async function createAuthority(paths) {
3148
+ const { cert, key } = selfSigned();
3149
+ const staging = `${paths.dir}.${process.pid}.${(0, node_crypto.randomBytes)(4).toString("hex")}`;
3150
+ await (0, node_fs_promises.mkdir)(staging, {
3151
+ recursive: true,
3152
+ mode: 448
3153
+ });
3154
+ try {
3155
+ await (0, node_fs_promises.writeFile)((0, node_path.join)(staging, "root.pem"), cert, { mode: 420 });
3156
+ await (0, node_fs_promises.writeFile)((0, node_path.join)(staging, "root-key.pem"), key, { mode: 384 });
3157
+ await (0, node_fs_promises.mkdir)((0, node_path.dirname)(paths.dir), { recursive: true });
3158
+ await (0, node_fs_promises.rename)(staging, paths.dir).catch((error) => {
3159
+ if (error.code !== "EEXIST" && error.code !== "ENOTEMPTY") throw error;
3160
+ });
3161
+ } finally {
3162
+ await (0, node_fs_promises.rm)(staging, {
3163
+ recursive: true,
3164
+ force: true
3165
+ });
3166
+ }
3167
+ }
3168
+ /** A new root: who made it, on which machine, so a keychain says whose it is. */
3169
+ function selfSigned() {
3170
+ const { privateKey, publicKey } = keyPair();
3171
+ const cert = node_forge.default.pki.createCertificate();
3172
+ cert.publicKey = publicKey;
3173
+ cert.serialNumber = serialNumber();
3174
+ const now = Date.now();
3175
+ cert.validity.notBefore = /* @__PURE__ */ new Date(now - DAY);
3176
+ cert.validity.notAfter = new Date(now + AUTHORITY_DAYS * DAY);
3177
+ const subject = utf8([
3178
+ {
3179
+ name: "organizationName",
3180
+ value: "gkm local CA"
3181
+ },
3182
+ {
3183
+ name: "organizationalUnitName",
3184
+ value: owner()
3185
+ },
3186
+ {
3187
+ name: "commonName",
3188
+ value: `gkm local CA ${owner()}`
3189
+ }
3190
+ ]);
3191
+ cert.setSubject(subject);
3192
+ cert.setIssuer(subject);
3193
+ cert.setExtensions([
3194
+ {
3195
+ name: "basicConstraints",
3196
+ cA: true,
3197
+ pathLenConstraint: 0,
3198
+ critical: true
3199
+ },
3200
+ {
3201
+ name: "keyUsage",
3202
+ keyCertSign: true,
3203
+ cRLSign: true,
3204
+ critical: true
3205
+ },
3206
+ { name: "subjectKeyIdentifier" }
3207
+ ]);
3208
+ cert.sign(privateKey, node_forge.default.md.sha256.create());
3209
+ return {
3210
+ cert: node_forge.default.pki.certificateToPem(cert),
3211
+ key: node_forge.default.pki.privateKeyToPem(privateKey)
3212
+ };
3213
+ }
3214
+ /**
3215
+ * The names a project's local certificate carries: its bare host and every
3216
+ * label under it — `shop.localhost`, `*.shop.localhost` — and any host the
3217
+ * edge serves that those do not cover, a stage's own wildcard among them.
3218
+ * Without a project, the hosts alone: `*.localhost` is nobody's to claim.
3219
+ */
3220
+ function localCertificateNames(project, hosts) {
3221
+ const names = [...project ? [`${project}.localhost`, `*.${project}.localhost`] : []];
3222
+ for (const host of hosts) {
3223
+ const name = host.toLowerCase();
3224
+ if (!names.some((covering) => covers(covering, name))) names.push(name);
3225
+ }
3226
+ return names;
3227
+ }
3228
+ /** Whether a certificate name answers for a host, by the one-label wildcard rule. */
3229
+ function covers(name, host) {
3230
+ if (name === host) return true;
3231
+ if (!name.startsWith("*.") || host.startsWith("*.")) return false;
3232
+ const suffix = name.slice(1);
3233
+ return host.endsWith(suffix) && !host.slice(0, -suffix.length).includes(".");
3234
+ }
3235
+ /**
3236
+ * A certificate for `names`, signed by the authority. Each call makes a new
3237
+ * key; {@link ensureLocalCertificate} is what keeps one across runs.
3238
+ *
3239
+ * @throws {LocalCertificateWithoutNames} for an empty list.
3240
+ */
3241
+ function issueLocalCertificate(authority, names, options = {}) {
3242
+ if (names.length === 0) throw new LocalCertificateWithoutNames();
3243
+ const root = node_forge.default.pki.certificateFromPem(authority.cert);
3244
+ const signer = node_forge.default.pki.privateKeyFromPem(authority.key);
3245
+ const { privateKey, publicKey } = keyPair();
3246
+ const now = (options.now ?? /* @__PURE__ */ new Date()).getTime();
3247
+ const cert = node_forge.default.pki.createCertificate();
3248
+ cert.publicKey = publicKey;
3249
+ cert.serialNumber = serialNumber();
3250
+ cert.validity.notBefore = /* @__PURE__ */ new Date(now - 36e5);
3251
+ cert.validity.notAfter = new Date(now + (options.days ?? 365) * DAY);
3252
+ cert.setSubject(utf8([{
3253
+ name: "organizationName",
3254
+ value: "gkm local certificate"
3255
+ }, {
3256
+ name: "commonName",
3257
+ value: names[0]
3258
+ }]));
3259
+ cert.setIssuer(root.subject.attributes);
3260
+ cert.setExtensions([
3261
+ {
3262
+ name: "basicConstraints",
3263
+ cA: false,
3264
+ critical: true
3265
+ },
3266
+ {
3267
+ name: "keyUsage",
3268
+ digitalSignature: true,
3269
+ keyEncipherment: true,
3270
+ critical: true
3271
+ },
3272
+ {
3273
+ name: "extKeyUsage",
3274
+ serverAuth: true
3275
+ },
3276
+ {
3277
+ name: "subjectAltName",
3278
+ altNames: names.map((value) => ({
3279
+ type: 2,
3280
+ value
3281
+ }))
3282
+ },
3283
+ { name: "subjectKeyIdentifier" },
3284
+ {
3285
+ name: "authorityKeyIdentifier",
3286
+ keyIdentifier: root.generateSubjectKeyIdentifier().getBytes()
3287
+ }
3288
+ ]);
3289
+ cert.sign(signer, node_forge.default.md.sha256.create());
3290
+ return {
3291
+ cert: node_forge.default.pki.certificateToPem(cert),
3292
+ key: node_forge.default.pki.privateKeyToPem(privateKey)
3293
+ };
3294
+ }
3295
+ /**
3296
+ * The certificate for `names` kept in `file` — certificate then key, one PEM
3297
+ * file, which is what a proxy given the same path for both reads — issued
3298
+ * again only when the one there is not the authority's, does not cover every
3299
+ * name, or is near its end.
3300
+ *
3301
+ * One file written by rename, so two commands issuing at once leave a pair
3302
+ * that matches, never one's certificate beside the other's key.
3303
+ *
3304
+ * @throws {LocalCertificateWithoutNames} for an empty list.
3305
+ */
3306
+ async function ensureLocalCertificate(authority, names, file, options = {}) {
3307
+ const now = options.now ?? /* @__PURE__ */ new Date();
3308
+ const existing = await (0, node_fs_promises.readFile)(file, "utf-8").catch(() => void 0);
3309
+ const kept = existing ? splitPem(existing) : void 0;
3310
+ if (kept && stillGood(authority, kept, names, now)) return {
3311
+ ...kept,
3312
+ issued: false
3313
+ };
3314
+ const issued = issueLocalCertificate(authority, names, { now });
3315
+ await (0, node_fs_promises.mkdir)((0, node_path.dirname)(file), {
3316
+ recursive: true,
3317
+ mode: 448
3318
+ });
3319
+ const staging = `${file}.${process.pid}.${(0, node_crypto.randomBytes)(4).toString("hex")}`;
3320
+ await (0, node_fs_promises.writeFile)(staging, `${issued.cert}${issued.key}`, { mode: 384 });
3321
+ await (0, node_fs_promises.rename)(staging, file);
3322
+ return {
3323
+ ...issued,
3324
+ issued: true
3325
+ };
3326
+ }
3327
+ /** A combined PEM file's certificate and key. */
3328
+ function splitPem(pem) {
3329
+ const cert = pem.match(/-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----\r?\n?/)?.[0];
3330
+ const key = pem.match(/-----BEGIN (?:RSA )?PRIVATE KEY-----[\s\S]+?-----END (?:RSA )?PRIVATE KEY-----\r?\n?/)?.[0];
3331
+ return cert && key ? {
3332
+ cert,
3333
+ key
3334
+ } : void 0;
3335
+ }
3336
+ /** Whether a kept certificate still serves: the authority's, every name, in date. */
3337
+ function stillGood(authority, kept, names, now) {
3338
+ try {
3339
+ const root = node_forge.default.pki.certificateFromPem(authority.cert);
3340
+ const cert = node_forge.default.pki.certificateFromPem(kept.cert);
3341
+ if (!root.verify(cert)) return false;
3342
+ if (cert.validity.notAfter.getTime() - now.getTime() < RENEW_WITHIN_DAYS * DAY) return false;
3343
+ const certKey = (0, node_crypto.createPublicKey)(kept.cert).export({
3344
+ type: "spki",
3345
+ format: "der"
3346
+ });
3347
+ const ownKey = (0, node_crypto.createPublicKey)((0, node_crypto.createPrivateKey)(kept.key)).export({
3348
+ type: "spki",
3349
+ format: "der"
3350
+ });
3351
+ if (!certKey.equals(ownKey)) return false;
3352
+ const san = cert.getExtension("subjectAltName");
3353
+ const dns = new Set((san?.altNames ?? []).filter((n) => n.type === 2).map((n) => n.value));
3354
+ return names.every((name) => dns.has(name));
3355
+ } catch {
3356
+ return false;
3357
+ }
3358
+ }
3359
+ /** An RSA key pair, made natively — forge's own generation is slow. */
3360
+ function keyPair() {
3361
+ const { privateKey: pem } = (0, node_crypto.generateKeyPairSync)("rsa", {
3362
+ modulusLength: 2048,
3363
+ publicKeyEncoding: {
3364
+ type: "spki",
3365
+ format: "pem"
3366
+ },
3367
+ privateKeyEncoding: {
3368
+ type: "pkcs8",
3369
+ format: "pem"
3370
+ }
3371
+ });
3372
+ const privateKey = node_forge.default.pki.privateKeyFromPem(pem);
3373
+ return {
3374
+ privateKey,
3375
+ publicKey: node_forge.default.pki.setRsaPublicKey(privateKey.n, privateKey.e)
3376
+ };
3377
+ }
3378
+ /**
3379
+ * Attributes as UTF8String. forge writes PrintableString otherwise, which
3380
+ * has no `@` or `*` — and a TLS stack rejects the certificate outright.
3381
+ */
3382
+ function utf8(attributes) {
3383
+ return attributes.map((attribute) => ({
3384
+ ...attribute,
3385
+ valueTagClass: node_forge.default.asn1.Type.UTF8
3386
+ }));
3387
+ }
3388
+ /** A random, positive serial: sixteen bytes, its high bit clear. */
3389
+ function serialNumber() {
3390
+ const bytes = (0, node_crypto.randomBytes)(16);
3391
+ bytes[0] = bytes[0] & 127;
3392
+ return bytes.toString("hex");
3393
+ }
3394
+ /** `user@host`, as far as the machine will say. */
3395
+ function owner() {
3396
+ let user = "gkm";
3397
+ try {
3398
+ user = (0, node_os.userInfo)().username;
3399
+ } catch {}
3400
+ return `${user}@${(0, node_os.hostname)()}`;
3401
+ }
3402
+ //#endregion
2973
3403
  //#region src/reconcile/clients.ts
2974
3404
  /**
2975
3405
  * The real Postgres and MinIO clients the applier runs against.
@@ -3202,16 +3632,6 @@ const dockerCli = {
3202
3632
  if (options.show) return shown(args, services);
3203
3633
  await run("docker", args);
3204
3634
  },
3205
- async copyOut(composePath, service, from, to) {
3206
- await (0, node_fs_promises.mkdir)((0, node_path.dirname)(to), { recursive: true });
3207
- await run("docker", [
3208
- "compose",
3209
- ...composeFiles(composePath),
3210
- "cp",
3211
- `${service}:${from}`,
3212
- to
3213
- ]);
3214
- },
3215
3635
  async reload(composePath, service) {
3216
3636
  await run("docker", [
3217
3637
  "compose",
@@ -3222,7 +3642,8 @@ const dockerCli = {
3222
3642
  "caddy",
3223
3643
  "reload",
3224
3644
  "--config",
3225
- "/etc/caddy/Caddyfile"
3645
+ "/etc/caddy/Caddyfile",
3646
+ "--force"
3226
3647
  ]);
3227
3648
  },
3228
3649
  async exec(composePath, service, argv) {
@@ -3856,17 +4277,12 @@ const CHECKOUT_MOUNTS = ["caddy"];
3856
4277
  */
3857
4278
  const caddySitesPath = (stage) => `.gkm/caddy-sites/${stage}.caddy`;
3858
4279
  /**
3859
- * Where the local edge's root certificate is copied to.
3860
- *
3861
- * Exported so a process can be pointed at it without installing anything:
3862
- * `NODE_EXTRA_CA_CERTS` is the whole of the trust story for Node, and it needs
3863
- * no sudo. A browser is the case that still wants the root in the system store,
3864
- * which is a one-time `caddy trust` rather than something a reconcile should do
3865
- * on a developer's behalf.
4280
+ * Where one stage's certificate is kept: certificate and key in one PEM,
4281
+ * issued from gkm's local authority (`trust/authority.ts`), beside the
4282
+ * stage's routes — so the edge reads it through the mount it already has, and
4283
+ * a stage removed takes its certificate with it.
3866
4284
  */
3867
- const LOCAL_CA_PATH = ".gkm/caddy-root.crt";
3868
- /** Where Caddy keeps the root of the CA it generated. */
3869
- const CADDY_ROOT_IN_CONTAINER = "/data/caddy/pki/authorities/local/root.crt";
4285
+ const caddyCertificatePath = (stage) => `.gkm/caddy-sites/${stage}.pem`;
3870
4286
  /**
3871
4287
  * Converge the local target on what the manifest declares.
3872
4288
  *
@@ -3909,7 +4325,10 @@ async function reconcile(options) {
3909
4325
  ...options.objectWebhooks?.length ? { objectWebhooks: options.objectWebhooks } : {},
3910
4326
  ...options.inboxRelay ? { inboxRelay: options.inboxRelay } : {}
3911
4327
  });
3912
- const caddyfile = toCaddyfile(sitesFor(plan, project, options.addresses, options.processorAddresses));
4328
+ const sites = sitesFor(plan, project, options.addresses, options.processorAddresses);
4329
+ const edged = plan.containers.includes("caddy");
4330
+ const authorityPaths = options.authority ?? localAuthorityPaths();
4331
+ const caddyfile = toCaddyfile(sites, { certificate: `${CADDY_SITES_IN_CONTAINER}/${stage}.pem` });
3913
4332
  const hash = planHash(plan, compose, {
3914
4333
  caddyfile,
3915
4334
  postgres: postgresStatements(plan, project, seed).map((statement) => statement.create).join(";\n")
@@ -3932,7 +4351,7 @@ async function reconcile(options) {
3932
4351
  uses: false,
3933
4352
  serviceName: project
3934
4353
  });
3935
- if (plan.containers.includes("caddy")) env.NODE_EXTRA_CA_CERTS = (0, node_path.join)(root, LOCAL_CA_PATH);
4354
+ if (edged) env.NODE_EXTRA_CA_CERTS = authorityPaths.certFile;
3936
4355
  return env;
3937
4356
  };
3938
4357
  const result = {
@@ -3950,11 +4369,12 @@ async function reconcile(options) {
3950
4369
  hash,
3951
4370
  changed: false
3952
4371
  };
4372
+ const certificate = edged ? await ensureLocalCertificate(await ensureLocalAuthority(authorityPaths), localCertificateNames(project, sites.map((site) => site.host)), (0, node_path.join)(root, caddyCertificatePath(stage))) : void 0;
3953
4373
  const recorded = await loadState(root, stage);
3954
4374
  const postgresPort = ports[require_compose.primaryPortKey("postgres")];
3955
- if (recorded?.hash === hash && (0, node_fs.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;
4375
+ if (!certificate?.issued && recorded?.hash === hash && (0, node_fs.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;
3956
4376
  await write(composePath, require_compose.toYaml(compose), 384);
3957
- if (plan.containers.includes("caddy")) {
4377
+ if (edged) {
3958
4378
  await write((0, node_path.join)(root, CADDYFILE_PATH), caddyfileRoot());
3959
4379
  await write((0, node_path.join)(root, caddySitesPath(stage)), caddyfile);
3960
4380
  await pruneCaddySites(root, [
@@ -3967,8 +4387,7 @@ async function reconcile(options) {
3967
4387
  options.progress?.(`🐳 Starting ${running.join(", ")} — the first start pulls each image, which can take a few minutes`);
3968
4388
  await docker.up(composePath, running, options.progress ? { show: true } : {});
3969
4389
  }
3970
- if (start && plan.containers.includes("caddy")) await docker.reload(composePath, "caddy").catch(() => {});
3971
- if (start && plan.containers.includes("caddy")) await docker.copyOut(composePath, "caddy", CADDY_ROOT_IN_CONTAINER, (0, node_path.join)(root, LOCAL_CA_PATH)).catch(() => {});
4390
+ if (start && edged) await docker.reload(composePath, "caddy").catch(() => {});
3972
4391
  const checked = start && plan.containers.length > 0 ? await logins({
3973
4392
  credentials: options.credentials,
3974
4393
  containers: plan.containers,
@@ -4053,8 +4472,8 @@ async function observedPorts(docker, composePath, containers, fakes) {
4053
4472
  */
4054
4473
  async function pruneCaddySites(root, stages) {
4055
4474
  const dir = (0, node_path.dirname)((0, node_path.join)(root, caddySitesPath(require_workspace.TEST_STAGE)));
4056
- const keep = new Set(stages.map((stage) => stage && `${stage}.caddy`));
4057
- for (const file of await (0, node_fs_promises.readdir)(dir)) if (file.endsWith(".caddy") && !keep.has(file)) await (0, node_fs_promises.rm)((0, node_path.join)(dir, file));
4475
+ const keep = new Set(stages.flatMap((stage) => stage ? [`${stage}.caddy`, `${stage}.pem`] : []));
4476
+ for (const file of await (0, node_fs_promises.readdir)(dir)) if (/\.(caddy|pem)$/.test(file) && !keep.has(file)) await (0, node_fs_promises.rm)((0, node_path.join)(dir, file));
4058
4477
  }
4059
4478
  async function write(path, content, mode) {
4060
4479
  try {
@@ -4608,16 +5027,16 @@ Object.defineProperty(exports, "LEGACY_LOCAL_LOGIN", {
4608
5027
  return LEGACY_LOCAL_LOGIN;
4609
5028
  }
4610
5029
  });
4611
- Object.defineProperty(exports, "LOCAL_CA_PATH", {
5030
+ Object.defineProperty(exports, "LOCAL_TLD", {
4612
5031
  enumerable: true,
4613
5032
  get: function() {
4614
- return LOCAL_CA_PATH;
5033
+ return LOCAL_TLD;
4615
5034
  }
4616
5035
  });
4617
- Object.defineProperty(exports, "LOCAL_TLD", {
5036
+ Object.defineProperty(exports, "OFFLINE_BUILD_ADDRESS", {
4618
5037
  enumerable: true,
4619
5038
  get: function() {
4620
- return LOCAL_TLD;
5039
+ return OFFLINE_BUILD_ADDRESS;
4621
5040
  }
4622
5041
  });
4623
5042
  Object.defineProperty(exports, "PROCESSORS_DEV_PREFIX", {
@@ -4752,6 +5171,18 @@ Object.defineProperty(exports, "dockerfileOf", {
4752
5171
  return dockerfileOf;
4753
5172
  }
4754
5173
  });
5174
+ Object.defineProperty(exports, "ensureLocalAuthority", {
5175
+ enumerable: true,
5176
+ get: function() {
5177
+ return ensureLocalAuthority;
5178
+ }
5179
+ });
5180
+ Object.defineProperty(exports, "ensureLocalCertificate", {
5181
+ enumerable: true,
5182
+ get: function() {
5183
+ return ensureLocalCertificate;
5184
+ }
5185
+ });
4755
5186
  Object.defineProperty(exports, "ensurePostgresLogin", {
4756
5187
  enumerable: true,
4757
5188
  get: function() {
@@ -4860,6 +5291,18 @@ Object.defineProperty(exports, "isUnder", {
4860
5291
  return isUnder;
4861
5292
  }
4862
5293
  });
5294
+ Object.defineProperty(exports, "localAuthorityPaths", {
5295
+ enumerable: true,
5296
+ get: function() {
5297
+ return localAuthorityPaths;
5298
+ }
5299
+ });
5300
+ Object.defineProperty(exports, "localCertificateNames", {
5301
+ enumerable: true,
5302
+ get: function() {
5303
+ return localCertificateNames;
5304
+ }
5305
+ });
4863
5306
  Object.defineProperty(exports, "localRolePassword", {
4864
5307
  enumerable: true,
4865
5308
  get: function() {
@@ -4878,6 +5321,12 @@ Object.defineProperty(exports, "networkEnv", {
4878
5321
  return networkEnv;
4879
5322
  }
4880
5323
  });
5324
+ Object.defineProperty(exports, "offlineBuildHosts", {
5325
+ enumerable: true,
5326
+ get: function() {
5327
+ return offlineBuildHosts;
5328
+ }
5329
+ });
4881
5330
  Object.defineProperty(exports, "pgClient", {
4882
5331
  enumerable: true,
4883
5332
  get: function() {
@@ -4932,6 +5381,12 @@ Object.defineProperty(exports, "quoteIdentifier", {
4932
5381
  return quoteIdentifier;
4933
5382
  }
4934
5383
  });
5384
+ Object.defineProperty(exports, "readLocalAuthority", {
5385
+ enumerable: true,
5386
+ get: function() {
5387
+ return readLocalAuthority;
5388
+ }
5389
+ });
4935
5390
  Object.defineProperty(exports, "reconcileWorkspace", {
4936
5391
  enumerable: true,
4937
5392
  get: function() {
@@ -4962,6 +5417,12 @@ Object.defineProperty(exports, "siteClientTelemetry", {
4962
5417
  return siteClientTelemetry;
4963
5418
  }
4964
5419
  });
5420
+ Object.defineProperty(exports, "siteOfflineHosts", {
5421
+ enumerable: true,
5422
+ get: function() {
5423
+ return siteOfflineHosts;
5424
+ }
5425
+ });
4965
5426
  Object.defineProperty(exports, "stageEnv", {
4966
5427
  enumerable: true,
4967
5428
  get: function() {
@@ -5005,4 +5466,4 @@ Object.defineProperty(exports, "workspace_exports", {
5005
5466
  }
5006
5467
  });
5007
5468
 
5008
- //# sourceMappingURL=apps-D1svw9OG.cjs.map
5469
+ //# sourceMappingURL=apps-BIsxWYUo.cjs.map