@geekmidas/cli 10.0.0-alpha.94 → 10.0.0-alpha.95

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 (192) hide show
  1. package/dist/{GoDaddyProvider-BRZUWD8z.mjs → GoDaddyProvider-BwW51hPm.mjs} +3 -3
  2. package/dist/{GoDaddyProvider-BRZUWD8z.mjs.map → GoDaddyProvider-BwW51hPm.mjs.map} +1 -1
  3. package/dist/{GoDaddyProvider-DzguxU_a.cjs → GoDaddyProvider-C_DgIkMv.cjs} +3 -3
  4. package/dist/{GoDaddyProvider-DzguxU_a.cjs.map → GoDaddyProvider-C_DgIkMv.cjs.map} +1 -1
  5. package/dist/{HostingerProvider-Cjh_2Ml6.mjs → HostingerProvider-BNpS9aRJ.mjs} +2 -2
  6. package/dist/{HostingerProvider-Cjh_2Ml6.mjs.map → HostingerProvider-BNpS9aRJ.mjs.map} +1 -1
  7. package/dist/{HostingerProvider-OdQmKXE3.cjs → HostingerProvider-DR1iws1P.cjs} +2 -2
  8. package/dist/{HostingerProvider-OdQmKXE3.cjs.map → HostingerProvider-DR1iws1P.cjs.map} +1 -1
  9. package/dist/{LegacyStateStore-D50dgUPc.cjs → LegacyStateStore-BawjE_5n.cjs} +3 -3
  10. package/dist/{LegacyStateStore-D50dgUPc.cjs.map → LegacyStateStore-BawjE_5n.cjs.map} +1 -1
  11. package/dist/{LegacyStateStore-BQZb6-j2.mjs → LegacyStateStore-D5DarNA2.mjs} +3 -3
  12. package/dist/{LegacyStateStore-BQZb6-j2.mjs.map → LegacyStateStore-D5DarNA2.mjs.map} +1 -1
  13. package/dist/{LocalStateStore-EFBUjuMX.cjs → LocalStateStore-D8fu5WiF.cjs} +2 -2
  14. package/dist/{LocalStateStore-EFBUjuMX.cjs.map → LocalStateStore-D8fu5WiF.cjs.map} +1 -1
  15. package/dist/{LocalStateStore-BSaS2535.mjs → LocalStateStore-YjIqlgAz.mjs} +2 -2
  16. package/dist/{LocalStateStore-BSaS2535.mjs.map → LocalStateStore-YjIqlgAz.mjs.map} +1 -1
  17. package/dist/{S3StateStore-CrFq4UZU.mjs → S3StateStore-CjTAVsWh.mjs} +2 -2
  18. package/dist/{S3StateStore-CrFq4UZU.mjs.map → S3StateStore-CjTAVsWh.mjs.map} +1 -1
  19. package/dist/{S3StateStore-C5mv8To3.cjs → S3StateStore-Cm-v2IPI.cjs} +2 -2
  20. package/dist/{S3StateStore-C5mv8To3.cjs.map → S3StateStore-Cm-v2IPI.cjs.map} +1 -1
  21. package/dist/{SSMStateStore-DuZCH7_v.cjs → SSMStateStore-BS4BiZCN.cjs} +2 -2
  22. package/dist/{SSMStateStore-DuZCH7_v.cjs.map → SSMStateStore-BS4BiZCN.cjs.map} +1 -1
  23. package/dist/{SSMStateStore-D3Z6mZnA.mjs → SSMStateStore-BhtM6jOh.mjs} +2 -2
  24. package/dist/{SSMStateStore-D3Z6mZnA.mjs.map → SSMStateStore-BhtM6jOh.mjs.map} +1 -1
  25. package/dist/{add-DsVDdvon.cjs → add-D-3IKT7W.cjs} +22 -51
  26. package/dist/add-D-3IKT7W.cjs.map +1 -0
  27. package/dist/{add-C85isXFl.mjs → add-ylx8dejw.mjs} +21 -50
  28. package/dist/add-ylx8dejw.mjs.map +1 -0
  29. package/dist/{bundler-BEgUKc4j.cjs → bundler-CI3elfZS.cjs} +5 -5
  30. package/dist/{bundler-BEgUKc4j.cjs.map → bundler-CI3elfZS.cjs.map} +1 -1
  31. package/dist/{bundler-BSHog8CH.mjs → bundler-ywR3C1B_.mjs} +5 -5
  32. package/dist/{bundler-BSHog8CH.mjs.map → bundler-ywR3C1B_.mjs.map} +1 -1
  33. package/dist/{cli-BsFenyaf.mjs → cli-BCSuCfQk.mjs} +4 -4
  34. package/dist/{cli-BsFenyaf.mjs.map → cli-BCSuCfQk.mjs.map} +1 -1
  35. package/dist/{cli-BvBdv660.cjs → cli-Dewt2T21.cjs} +4 -4
  36. package/dist/{cli-BvBdv660.cjs.map → cli-Dewt2T21.cjs.map} +1 -1
  37. package/dist/{compose-D2RFYd_f.mjs → compose-C4js1JDv.mjs} +42 -46
  38. package/dist/compose-C4js1JDv.mjs.map +1 -0
  39. package/dist/{compose-Cd09gW-n.cjs → compose-Dd0XphvF.cjs} +59 -63
  40. package/dist/compose-Dd0XphvF.cjs.map +1 -0
  41. package/dist/{config-Ngesg4O8.d.mts → config-4yirvxS8.d.cts} +4 -4
  42. package/dist/{config-DvHNMoOp.d.cts.map → config-4yirvxS8.d.cts.map} +1 -1
  43. package/dist/{config-DvHNMoOp.d.cts → config-C8NPCn1l.d.mts} +4 -4
  44. package/dist/{config-Ngesg4O8.d.mts.map → config-C8NPCn1l.d.mts.map} +1 -1
  45. package/dist/config.d.cts +3 -3
  46. package/dist/config.d.mts +3 -3
  47. package/dist/{credentials-DpfnUvIR.mjs → credentials-B5N5yKk6.mjs} +4 -132
  48. package/dist/credentials-B5N5yKk6.mjs.map +1 -0
  49. package/dist/{credentials-D7XJypNd.cjs → credentials-Zqr3QQYB.cjs} +3 -173
  50. package/dist/credentials-Zqr3QQYB.cjs.map +1 -0
  51. package/dist/deploy/public.cjs +15 -14
  52. package/dist/deploy/public.cjs.map +1 -1
  53. package/dist/deploy/public.d.cts +5 -5
  54. package/dist/deploy/public.d.cts.map +1 -1
  55. package/dist/deploy/public.d.mts +5 -5
  56. package/dist/deploy/public.d.mts.map +1 -1
  57. package/dist/deploy/public.mjs +10 -9
  58. package/dist/deploy/public.mjs.map +1 -1
  59. package/dist/{providers-sTj-BG0S.mjs → deploy-B0drCD6s.mjs} +898 -123
  60. package/dist/deploy-B0drCD6s.mjs.map +1 -0
  61. package/dist/{providers-BFeP_mYw.cjs → deploy-Bw1FjX_x.cjs} +939 -134
  62. package/dist/deploy-Bw1FjX_x.cjs.map +1 -0
  63. package/dist/{discover-CTzOSGUF.d.cts → discover-BtFofyQB.d.cts} +2 -2
  64. package/dist/{discover-CTzOSGUF.d.cts.map → discover-BtFofyQB.d.cts.map} +1 -1
  65. package/dist/{discover-CihAtaoj.d.mts → discover-D-MdXZgm.d.mts} +2 -2
  66. package/dist/{discover-CihAtaoj.d.mts.map → discover-D-MdXZgm.d.mts.map} +1 -1
  67. package/dist/dns-Bmk7P9c2.cjs +663 -0
  68. package/dist/dns-Bmk7P9c2.cjs.map +1 -0
  69. package/dist/dns-CyMIq6to.cjs +55 -0
  70. package/dist/dns-CyMIq6to.cjs.map +1 -0
  71. package/dist/dns-X3oqEV4C.mjs +44 -0
  72. package/dist/dns-X3oqEV4C.mjs.map +1 -0
  73. package/dist/dns-idXfyCay.mjs +610 -0
  74. package/dist/dns-idXfyCay.mjs.map +1 -0
  75. package/dist/{dokploy-D_aat2Xj.mjs → dokploy-CZYxXeMa.mjs} +2 -2
  76. package/dist/{dokploy-D_aat2Xj.mjs.map → dokploy-CZYxXeMa.mjs.map} +1 -1
  77. package/dist/{dokploy-CV7GcobZ.cjs → dokploy-DaT0mgLU.cjs} +2 -2
  78. package/dist/{dokploy-CV7GcobZ.cjs.map → dokploy-DaT0mgLU.cjs.map} +1 -1
  79. package/dist/{encryption-_4qKqtTx.mjs → encryption-D0ucY4O7.mjs} +2 -2
  80. package/dist/{encryption-_4qKqtTx.mjs.map → encryption-D0ucY4O7.mjs.map} +1 -1
  81. package/dist/{encryption-DFcivJaO.cjs → encryption-Dp0IvLVX.cjs} +2 -2
  82. package/dist/{encryption-DFcivJaO.cjs.map → encryption-Dp0IvLVX.cjs.map} +1 -1
  83. package/dist/{engine-DPMHThkg.mjs → engine-BcuhnyQO.mjs} +13 -31
  84. package/dist/{engine-DPMHThkg.mjs.map → engine-BcuhnyQO.mjs.map} +1 -1
  85. package/dist/{engine-Bv-LZpmj.cjs → engine-WY6j_kvA.cjs} +17 -35
  86. package/dist/engine-WY6j_kvA.cjs.map +1 -0
  87. package/dist/{github-xsDT19im.mjs → github-DUGA57du.mjs} +4 -2
  88. package/dist/{github-xsDT19im.mjs.map → github-DUGA57du.mjs.map} +1 -1
  89. package/dist/{github-Br42NMrW.cjs → github-DgmW83OP.cjs} +8 -6
  90. package/dist/{github-Br42NMrW.cjs.map → github-DgmW83OP.cjs.map} +1 -1
  91. package/dist/{index-CwLvFqtH.d.cts → index-5eL8rM6H.d.mts} +2 -2
  92. package/dist/{index-BlpcClwM.d.mts.map → index-5eL8rM6H.d.mts.map} +1 -1
  93. package/dist/{index-BlpcClwM.d.mts → index-Dz-gyjm_.d.cts} +2 -2
  94. package/dist/{index-CwLvFqtH.d.cts.map → index-Dz-gyjm_.d.cts.map} +1 -1
  95. package/dist/index.cjs +53 -52
  96. package/dist/index.cjs.map +1 -1
  97. package/dist/index.mjs +51 -50
  98. package/dist/index.mjs.map +1 -1
  99. package/dist/{local-B7Zv1NoA.mjs → local-BwC2v2Y8.mjs} +2 -2
  100. package/dist/{local-B7Zv1NoA.mjs.map → local-BwC2v2Y8.mjs.map} +1 -1
  101. package/dist/{local-OPC9BCZt.cjs → local-DNhnkugT.cjs} +3 -3
  102. package/dist/{local-OPC9BCZt.cjs.map → local-DNhnkugT.cjs.map} +1 -1
  103. package/dist/{migrate-SkWJotn5.cjs → migrate-BBcG1dhS.cjs} +2 -2
  104. package/dist/{migrate-SkWJotn5.cjs.map → migrate-BBcG1dhS.cjs.map} +1 -1
  105. package/dist/{migrate-DhvFPGLi.mjs → migrate-CZ-v5WV0.mjs} +2 -2
  106. package/dist/{migrate-DhvFPGLi.mjs.map → migrate-CZ-v5WV0.mjs.map} +1 -1
  107. package/dist/{migrate-B7evHv7O.mjs → migrate-D6PlNv2o.mjs} +2 -2
  108. package/dist/{migrate-B7evHv7O.mjs.map → migrate-D6PlNv2o.mjs.map} +1 -1
  109. package/dist/{migrate-D5jUz20_.cjs → migrate-afgRL3Hg.cjs} +2 -2
  110. package/dist/{migrate-D5jUz20_.cjs.map → migrate-afgRL3Hg.cjs.map} +1 -1
  111. package/dist/openapi.d.cts +1 -1
  112. package/dist/openapi.d.mts +1 -1
  113. package/dist/reconcile/public.d.cts +2 -2
  114. package/dist/reconcile/public.d.mts +2 -2
  115. package/dist/{resolve-CFEOtRsl.cjs → resolve-CFb4Navi.cjs} +4 -4
  116. package/dist/{resolve-CFEOtRsl.cjs.map → resolve-CFb4Navi.cjs.map} +1 -1
  117. package/dist/{resolve-Dyd1S2wn.mjs → resolve-DakDhr6Z.mjs} +4 -4
  118. package/dist/{resolve-Dyd1S2wn.mjs.map → resolve-DakDhr6Z.mjs.map} +1 -1
  119. package/dist/{rollback-D720SFhV.cjs → rollback-B-1dPP0m.cjs} +7 -8
  120. package/dist/{rollback-D720SFhV.cjs.map → rollback-B-1dPP0m.cjs.map} +1 -1
  121. package/dist/{rollback-NroNbGC0.mjs → rollback-B1TIpjdE.mjs} +6 -7
  122. package/dist/{rollback-NroNbGC0.mjs.map → rollback-B1TIpjdE.mjs.map} +1 -1
  123. package/dist/run-BJLIerMM.mjs +133 -0
  124. package/dist/run-BJLIerMM.mjs.map +1 -0
  125. package/dist/run-fVZ-rLnc.cjs +174 -0
  126. package/dist/run-fVZ-rLnc.cjs.map +1 -0
  127. package/dist/{runtime-VktAo_8B.d.cts → runtime-DUQdM-mW.d.cts} +2 -2
  128. package/dist/{runtime-BRCq6dQ7.d.mts.map → runtime-DUQdM-mW.d.cts.map} +1 -1
  129. package/dist/{runtime-BRCq6dQ7.d.mts → runtime-Vr6mleo2.d.mts} +2 -2
  130. package/dist/{runtime-VktAo_8B.d.cts.map → runtime-Vr6mleo2.d.mts.map} +1 -1
  131. package/dist/{sandbox-D1gd0iDz.d.cts → sandbox-BbJmh2rI.d.cts} +2 -2
  132. package/dist/{sandbox-D1gd0iDz.d.cts.map → sandbox-BbJmh2rI.d.cts.map} +1 -1
  133. package/dist/{sandbox-zHnRLCj0.d.mts → sandbox-DGOsMPMf.d.mts} +2 -2
  134. package/dist/{sandbox-zHnRLCj0.d.mts.map → sandbox-DGOsMPMf.d.mts.map} +1 -1
  135. package/dist/{secrets-DAvi_O9g.cjs → secrets-CPM0Qffe.cjs} +2 -2
  136. package/dist/{secrets-DAvi_O9g.cjs.map → secrets-CPM0Qffe.cjs.map} +1 -1
  137. package/dist/{secrets-CwLauUB_.mjs → secrets-oI9ClAPR.mjs} +2 -2
  138. package/dist/{secrets-CwLauUB_.mjs.map → secrets-oI9ClAPR.mjs.map} +1 -1
  139. package/dist/{seeds-BCg8X36S.cjs → seeds-CnXkgKUv.cjs} +192 -945
  140. package/dist/seeds-CnXkgKUv.cjs.map +1 -0
  141. package/dist/{seeds-CTxTZa-R.mjs → seeds-CoKkrSny.mjs} +156 -825
  142. package/dist/seeds-CoKkrSny.mjs.map +1 -0
  143. package/dist/{sniffer-DCcuzHz_.mjs → sniffer-CFRzIrby.mjs} +7 -7
  144. package/dist/{sniffer-DCcuzHz_.mjs.map → sniffer-CFRzIrby.mjs.map} +1 -1
  145. package/dist/{sniffer-C0z3NB2A.cjs → sniffer-vbiQ2Isn.cjs} +7 -7
  146. package/dist/{sniffer-C0z3NB2A.cjs.map → sniffer-vbiQ2Isn.cjs.map} +1 -1
  147. package/dist/{sst-DRDSDwOk.mjs → sst-CGdjHn2A.mjs} +4 -3
  148. package/dist/{sst-DRDSDwOk.mjs.map → sst-CGdjHn2A.mjs.map} +1 -1
  149. package/dist/{sst-DKNH243z.cjs → sst-DGuHDxVU.cjs} +5 -4
  150. package/dist/{sst-DKNH243z.cjs.map → sst-DGuHDxVU.cjs.map} +1 -1
  151. package/dist/{stack-B3fPDTBg.cjs → stack-1g57OfOw.cjs} +13 -51
  152. package/dist/stack-1g57OfOw.cjs.map +1 -0
  153. package/dist/{stack-NrdH5ngX.mjs → stack-B7O975TR.mjs} +13 -51
  154. package/dist/stack-B7O975TR.mjs.map +1 -0
  155. package/dist/{stages-veC4TcQe.mjs → stages-Bt4OggMm.mjs} +3 -2
  156. package/dist/{stages-veC4TcQe.mjs.map → stages-Bt4OggMm.mjs.map} +1 -1
  157. package/dist/{stages-CkqP1N4S.cjs → stages-BujUB4we.cjs} +4 -3
  158. package/dist/{stages-CkqP1N4S.cjs.map → stages-BujUB4we.cjs.map} +1 -1
  159. package/dist/target/public.cjs +1 -1
  160. package/dist/target/public.d.cts +2 -2
  161. package/dist/target/public.d.mts +2 -2
  162. package/dist/target/public.mjs +1 -1
  163. package/dist/{terminal-CkUYuAPd.cjs → terminal-CPHuH4S1.cjs} +2 -2
  164. package/dist/{terminal-CkUYuAPd.cjs.map → terminal-CPHuH4S1.cjs.map} +1 -1
  165. package/dist/{terminal-DAHs2Zko.mjs → terminal-iNmAXXjs.mjs} +2 -2
  166. package/dist/{terminal-DAHs2Zko.mjs.map → terminal-iNmAXXjs.mjs.map} +1 -1
  167. package/dist/{types-DMoaFrjg.d.mts → types-bkqVscdN.d.mts} +12 -3
  168. package/dist/types-bkqVscdN.d.mts.map +1 -0
  169. package/dist/{types-DXyaSmqu.d.cts → types-dipJRmKV.d.cts} +12 -3
  170. package/dist/types-dipJRmKV.d.cts.map +1 -0
  171. package/dist/workspace/index.d.cts +2 -2
  172. package/dist/workspace/index.d.mts +2 -2
  173. package/package.json +15 -15
  174. package/dist/add-C85isXFl.mjs.map +0 -1
  175. package/dist/add-DsVDdvon.cjs.map +0 -1
  176. package/dist/compose-Cd09gW-n.cjs.map +0 -1
  177. package/dist/compose-D2RFYd_f.mjs.map +0 -1
  178. package/dist/credentials-D7XJypNd.cjs.map +0 -1
  179. package/dist/credentials-DpfnUvIR.mjs.map +0 -1
  180. package/dist/deploy-C911Akkn.cjs +0 -670
  181. package/dist/deploy-C911Akkn.cjs.map +0 -1
  182. package/dist/deploy-CeJ5D0xn.mjs +0 -641
  183. package/dist/deploy-CeJ5D0xn.mjs.map +0 -1
  184. package/dist/engine-Bv-LZpmj.cjs.map +0 -1
  185. package/dist/providers-BFeP_mYw.cjs.map +0 -1
  186. package/dist/providers-sTj-BG0S.mjs.map +0 -1
  187. package/dist/seeds-BCg8X36S.cjs.map +0 -1
  188. package/dist/seeds-CTxTZa-R.mjs.map +0 -1
  189. package/dist/stack-B3fPDTBg.cjs.map +0 -1
  190. package/dist/stack-NrdH5ngX.mjs.map +0 -1
  191. package/dist/types-DMoaFrjg.d.mts.map +0 -1
  192. package/dist/types-DXyaSmqu.d.cts.map +0 -1
@@ -1,13 +1,13 @@
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-D7XJypNd.cjs");
3
+ const require_run = require("./run-fVZ-rLnc.cjs");
4
4
  const require_discover = require("./discover-DPgu-ScS.cjs");
5
5
  const require_derive = require("./derive-DAbo49sm.cjs");
6
6
  const require_workspace = require("./workspace-cSyi5nb1.cjs");
7
7
  const require_config = require("./config.cjs");
8
8
  const require_EndpointGenerator = require("./EndpointGenerator-De03t1hd.cjs");
9
9
  const require_SubscriberGenerator = require("./SubscriberGenerator-Dvz7EzqK.cjs");
10
- const require_resolve = require("./resolve-CFEOtRsl.cjs");
10
+ const require_resolve = require("./resolve-CFb4Navi.cjs");
11
11
  let node_path = require("node:path");
12
12
  let node_fs = require("node:fs");
13
13
  let node_fs_promises = require("node:fs/promises");
@@ -609,7 +609,7 @@ function folderName(path) {
609
609
  function getKeystoreDir(project) {
610
610
  if (!PROJECT_KEY.test(project.key)) throw new KeystoreProjectInvalid(project.key);
611
611
  const [namespace, name] = project.key.split("/");
612
- return (0, node_path.join)(project.home ?? require_credentials.gkmHome(), "keys", namespace, name);
612
+ return (0, node_path.join)(project.home ?? require_run.gkmHome(), "keys", namespace, name);
613
613
  }
614
614
  /** Get the path to a stage's encryption key. */
615
615
  function getKeyPath(stage, project) {
@@ -626,7 +626,7 @@ function legacyKeyPaths(stage, project) {
626
626
  key,
627
627
  home: project.home
628
628
  }));
629
- const homes = [.../* @__PURE__ */ new Set([project.home ?? require_credentials.gkmHome(), (0, node_path.join)((0, node_os.homedir)(), ".gkm")])];
629
+ const homes = [.../* @__PURE__ */ new Set([project.home ?? require_run.gkmHome(), (0, node_path.join)((0, node_os.homedir)(), ".gkm")])];
630
630
  const names = (project.legacy ?? []).filter(isLegacyName);
631
631
  return [...aliases, ...names.flatMap((name) => homes.map((home) => (0, node_path.join)(home, name, `${stage}.key`)))];
632
632
  }
@@ -5636,7 +5636,7 @@ function localCredentialsPath(project) {
5636
5636
  const keys = getKeystoreDir(project);
5637
5637
  const name = keys.split(/[\\/]/).at(-1);
5638
5638
  const namespace = keys.split(/[\\/]/).at(-2);
5639
- return (0, node_path.join)(project.home ?? require_credentials.gkmHome(), "local", namespace, `${name}.json`);
5639
+ return (0, node_path.join)(project.home ?? require_run.gkmHome(), "local", namespace, `${name}.json`);
5640
5640
  }
5641
5641
  /** The local stage's logins file is there, and its key is not. */
5642
5642
  var LocalCredentialsKeyMissing = class extends require_errors.GkmError {
@@ -6669,7 +6669,7 @@ async function createDnsProvider(options) {
6669
6669
  if (isDnsProvider(config.provider)) return config.provider;
6670
6670
  const provider = config.provider;
6671
6671
  if (provider === "hostinger") {
6672
- const { HostingerProvider } = await Promise.resolve().then(() => require("./HostingerProvider-OdQmKXE3.cjs"));
6672
+ const { HostingerProvider } = await Promise.resolve().then(() => require("./HostingerProvider-DR1iws1P.cjs"));
6673
6673
  return new HostingerProvider(options.hostinger);
6674
6674
  }
6675
6675
  if (provider === "route53") {
@@ -6682,7 +6682,7 @@ async function createDnsProvider(options) {
6682
6682
  });
6683
6683
  }
6684
6684
  if (provider === "godaddy") {
6685
- const { GoDaddyProvider } = await Promise.resolve().then(() => require("./GoDaddyProvider-DzguxU_a.cjs"));
6685
+ const { GoDaddyProvider } = await Promise.resolve().then(() => require("./GoDaddyProvider-C_DgIkMv.cjs"));
6686
6686
  return new GoDaddyProvider(options.godaddy ?? {});
6687
6687
  }
6688
6688
  if (provider === "cloudflare") throw new DnsProviderNotImplemented("cloudflare");
@@ -7249,644 +7249,121 @@ async function verifyDnsRecords(appHostnames, serverIp, state) {
7249
7249
  return results;
7250
7250
  }
7251
7251
  //#endregion
7252
- //#region src/compose/dns.ts
7253
- /**
7254
- * A compose stage's DNS: the records its public hosts need, and the check that
7255
- * they resolve to its server before a certificate is asked for.
7256
- *
7257
- * - **The server** (`serverAddress`): the stage's own secrets hold its public
7258
- * addresses — `GKM_SERVER_IPV4`, and `GKM_SERVER_IPV6` where it has one.
7259
- * Reserved for gkm: never handed to an app.
7260
- * - **The plan** (`planStackDns`, pure): every public host the stack serves —
7261
- * its apex, each app, each file server, the public log UI — pointed at the
7262
- * server. An A record per host (and an AAAA with an IPv6 address), or, where
7263
- * the domain's `dns` entry says `records: { mode: 'cname', target }`, one A
7264
- * record for the target and a CNAME to it for every other host but the
7265
- * apex, which DNS forbids a CNAME at.
7266
- * - **Applying it** (`applyStackDns`): through the domain's provider in `dns`,
7267
- * a record set at a time. A record with the right value is left alone; one
7268
- * with another value is replaced and the change printed. A `manual` domain
7269
- * is printed and nothing else. A dry run reads, prints and writes nothing.
7270
- * - **The check** (`checkStackDns`): each host resolved with the system
7271
- * resolver. One that is not the server stops the deploy with
7272
- * {@link HostNotPointingAtServer}, before Caddy or Traefik ask Let's Encrypt
7273
- * for a certificate it cannot get — and use up the rate limit trying.
7274
- * - **The step** (`stageDns`): all three, as every deploy runs them — the plan applied through each provider,
7275
- * what was written read back from the provider, and only the hosts no
7276
- * provider wrote resolved publicly. A brand-new name is never looked up
7277
- * before its record exists, so no resolver caches it as missing.
7278
- */
7279
- /** The line that says how to set the server's address. */
7280
- function serverAddressHint(stage) {
7281
- return `gkm secrets:set ${require_workspace.SERVER_IPV4_KEY} '<ip>' --stage ${stage}`;
7282
- }
7283
- /** A server address in the stage's secrets that is not an address. */
7284
- var ServerAddressInvalid = class extends require_errors.GkmError {
7252
+ //#region src/deploy/journal.ts
7253
+ var DeployJournal = class DeployJournal {
7254
+ store;
7285
7255
  stage;
7286
- key;
7287
- value;
7288
- constructor(stage, key, value) {
7289
- const ipv4 = key === require_workspace.SERVER_IPV4_KEY;
7290
- super(`${key} in the '${stage}' stage's secrets is ${JSON.stringify(value)}, which is not an ${ipv4 ? "IPv4 address (like 203.0.113.10)" : "IPv6 address (like 2001:db8::10)"}. Set the server's public address: gkm secrets:set ${key} '<ip>' --stage ${stage}.`);
7291
- this.stage = stage;
7292
- this.key = key;
7293
- this.value = value;
7294
- this.name = "ServerAddressInvalid";
7295
- }
7296
- };
7297
- /**
7298
- * A compose stage that serves real domains with no server address: its hosts
7299
- * cannot be pointed or checked, and a certificate would be asked for blind.
7300
- */
7301
- var ServerAddressMissing = class extends require_errors.GkmError {
7302
- stage;
7303
- domain;
7304
- constructor(stage, domain) {
7305
- super(`The '${stage}' stage serves ${domain} and its secrets hold no ${require_workspace.SERVER_IPV4_KEY} — the public address of the server its stack runs on, which its hosts' DNS records point at and every deploy checks before asking for certificates. Set it: ${serverAddressHint(stage)} (and ${require_workspace.SERVER_IPV6_KEY} for an IPv6 address).`);
7306
- this.stage = stage;
7307
- this.domain = domain;
7308
- this.name = "ServerAddressMissing";
7309
- }
7310
- };
7311
- /**
7312
- * The server's address from the stage's secrets, checked — `undefined` when
7313
- * `GKM_SERVER_IPV4` is not set.
7314
- *
7315
- * @throws {ServerAddressInvalid} for a value that is not an address
7316
- */
7317
- function serverAddress(stage, custom) {
7318
- const ipv4 = custom?.[require_workspace.SERVER_IPV4_KEY]?.trim();
7319
- const ipv6 = custom?.[require_workspace.SERVER_IPV6_KEY]?.trim();
7320
- if (ipv6 && !(0, node_net.isIPv6)(ipv6)) throw new ServerAddressInvalid(stage, require_workspace.SERVER_IPV6_KEY, ipv6);
7321
- if (!ipv4) return void 0;
7322
- if (!(0, node_net.isIPv4)(ipv4)) throw new ServerAddressInvalid(stage, require_workspace.SERVER_IPV4_KEY, ipv4);
7323
- return {
7324
- ipv4,
7325
- ...ipv6 ? { ipv6 } : {}
7326
- };
7327
- }
7328
- /**
7329
- * A name that resolves to this machine by definition — `localhost` and every
7330
- * `*.localhost` — and is in nobody's DNS.
7331
- */
7332
- function isLocalHost(host) {
7333
- const name = host.toLowerCase().replace(/\.$/, "");
7334
- return name === "localhost" || name.endsWith(".localhost");
7335
- }
7336
- /**
7337
- * The server's address, required where the stage serves real domains — not
7338
- * `*.localhost` ones, which point at this machine already.
7339
- *
7340
- * @throws {ServerAddressMissing} when the stage has a domain and no address
7341
- * @throws {ServerAddressInvalid} for a value that is not an address
7342
- */
7343
- function requiredServerAddress(stage, domain, custom) {
7344
- const server = serverAddress(stage, custom);
7345
- if (!server && domain && !isLocalHost(domain)) throw new ServerAddressMissing(stage, domain);
7346
- return server;
7347
- }
7348
- const MANAGED = [
7349
- "A",
7350
- "AAAA",
7351
- "CNAME"
7352
- ];
7353
- /** Every public host the stack serves, once each, sorted. */
7354
- function stackHosts(stack) {
7355
- return [...new Set(stack.routes.map((route) => route.host))].sort();
7356
- }
7357
- /** The TTL a domain's records are written with. */
7358
- function recordTtl(config) {
7359
- const ttl = "ttl" in config ? config.ttl : void 0;
7360
- if (ttl) return ttl;
7361
- return config.provider === "godaddy" ? 600 : 300;
7362
- }
7363
- function providerName(config) {
7364
- return typeof config.provider === "string" ? config.provider : "custom";
7365
- }
7366
- /**
7367
- * A wildcard host: gkm writes one record per public host, so a stage on
7368
- * another server — or a name someone else points elsewhere — is never caught
7369
- * by a record it did not ask for.
7370
- */
7371
- var DnsWildcardRefused = class extends require_errors.GkmError {
7372
- stage;
7373
- host;
7374
- constructor(stage, host) {
7375
- super(`'${stage}' would point ${host} at its server, and gkm never writes a wildcard record: each public host gets its own. Give the app a subdomain of its own instead.`);
7256
+ state;
7257
+ resources;
7258
+ version;
7259
+ existed;
7260
+ constructor(store, stage, state, resources, version, existed) {
7261
+ this.store = store;
7376
7262
  this.stage = stage;
7377
- this.host = host;
7378
- this.name = "DnsWildcardRefused";
7379
- }
7380
- };
7381
- /** The records a stage's hosts need — pure. */
7382
- function planStackDns(input) {
7383
- const { stage, server } = input;
7384
- const dns = input.dns ? normalizeDnsConfig(input.dns) : {};
7385
- const records = /* @__PURE__ */ new Map();
7386
- const uncovered = [];
7387
- const add = (host, domain, type, value) => {
7388
- const name = extractSubdomain(host, domain);
7389
- records.set(`${domain} ${name} ${type}`, {
7390
- host,
7391
- domain,
7392
- name,
7393
- type,
7394
- value,
7395
- ttl: recordTtl(dns[domain])
7263
+ this.state = state;
7264
+ this.resources = resources;
7265
+ this.version = version;
7266
+ this.existed = existed;
7267
+ }
7268
+ static async open(store, stage, initial, adopt = (stored) => stored) {
7269
+ const stored = await store.read(stage);
7270
+ if (stored) return new DeployJournal(store, stage, adopt(stored.state), stored.resources, stored.version, true);
7271
+ const state = initial();
7272
+ const version = await store.write(stage, state, { expectedVersion: null });
7273
+ return new DeployJournal(store, stage, state, {}, version, false);
7274
+ }
7275
+ record(key) {
7276
+ return this.resources[key];
7277
+ }
7278
+ /** The keys a previous run marked `pending` and never saw created. */
7279
+ unfinished() {
7280
+ return Object.values(this.resources).filter((record) => record.status === "pending").map((record) => record.key);
7281
+ }
7282
+ /** Records that `entry` is about to be created. */
7283
+ async pending(entry) {
7284
+ await this.put({
7285
+ ...entry,
7286
+ status: "pending"
7396
7287
  });
7397
- };
7398
- const pointAt = (host, domain) => {
7399
- add(host, domain, "A", server.ipv4);
7400
- if (server.ipv6) add(host, domain, "AAAA", server.ipv6);
7401
- };
7402
- for (const raw of input.hosts) {
7403
- const host = raw.toLowerCase();
7404
- if (host.includes("*")) throw new DnsWildcardRefused(stage, host);
7405
- const domain = findRootDomain(host, dns);
7406
- if (!domain) {
7407
- uncovered.push(host);
7408
- continue;
7409
- }
7410
- const target = require_workspace.cnameTarget(dns[domain].records, stage);
7411
- if (target) pointAt(target, domain);
7412
- if (target && host !== domain && host !== target) add(host, domain, "CNAME", target);
7413
- else pointAt(host, domain);
7414
- }
7415
- const domains = /* @__PURE__ */ new Map();
7416
- for (const record of [...records.values()].sort((a, b) => a.domain.localeCompare(b.domain) || a.name.localeCompare(b.name) || a.type.localeCompare(b.type))) {
7417
- const config = dns[record.domain];
7418
- const plan = domains.get(record.domain) ?? {
7419
- domain: record.domain,
7420
- provider: providerName(config),
7421
- config,
7422
- records: []
7423
- };
7424
- plan.records.push(record);
7425
- domains.set(record.domain, plan);
7426
7288
  }
7427
- return {
7428
- stage,
7429
- server,
7430
- domains: [...domains.values()],
7431
- uncovered: uncovered.sort()
7432
- };
7433
- }
7434
- /** Records a provider accepted and then did not read back with their value. */
7435
- var DnsRecordsNotConfirmed = class extends require_errors.GkmError {
7436
- stage;
7437
- domain;
7438
- provider;
7439
- records;
7440
- constructor(stage, domain, provider, records) {
7441
- const lines = records.map((r) => ` - ${r.host} ${r.type}: ${r.found.length > 0 ? r.found.join(", ") : "nothing"}, expected ${r.expected}`);
7442
- super(`${provider} accepted '${stage}''s records for ${domain}, and reading them back does not show them:\n${lines.join("\n")}\nDeploy again; if it persists, check the records in the provider's console — another tool may be writing the same names.`);
7443
- this.stage = stage;
7444
- this.domain = domain;
7445
- this.provider = provider;
7446
- this.records = records;
7447
- this.name = "DnsRecordsNotConfirmed";
7448
- }
7449
- };
7450
- /** `api.example.com A 203.0.113.10 (TTL 600)` */
7451
- function describe(record) {
7452
- return `${record.host.padEnd(32)} ${record.type.padEnd(5)} ${record.value} (TTL ${record.ttl})`;
7453
- }
7454
- function printManual(plan, log, why) {
7455
- log(` ${plan.domain}: ${why} — create these records at its DNS host:`);
7456
- for (const record of plan.records) log(` ${describe(record)}`);
7457
- return plan.records.map((r) => ({
7458
- domain: r.domain,
7459
- name: r.name,
7460
- type: r.type,
7461
- action: "manual",
7462
- value: r.value,
7463
- ttl: r.ttl
7464
- }));
7465
- }
7466
- /** The existing records of every planned name, for the types gkm manages. */
7467
- async function existingRecords(provider, plan) {
7468
- const names = [...new Set(plan.records.map((r) => r.name))];
7469
- const wanted = names.flatMap((name) => MANAGED.map((type) => ({
7470
- name,
7471
- type
7472
- })));
7473
- if (provider.readRecords) return provider.readRecords(plan.domain, wanted);
7474
- return (await provider.getRecords(plan.domain)).filter((r) => names.includes(r.name) && MANAGED.includes(r.type));
7475
- }
7476
- const same = (a, b) => a.trim().replace(/\.$/, "").toLowerCase() === b.trim().replace(/\.$/, "").toLowerCase();
7477
- /**
7478
- * What each domain's records need, compared with what is there: creates,
7479
- * updates, and the deletes a change of mode needs — a name moving from an A
7480
- * record to a CNAME, or back, cannot hold both. Nothing else is deleted.
7481
- */
7482
- function diffDomainDns(plan, existing) {
7483
- const changes = [];
7484
- const find = (name, type) => existing.find((r) => r.name === name && r.type === type);
7485
- const planned = /* @__PURE__ */ new Map();
7486
- for (const record of plan.records) {
7487
- const types = planned.get(record.name) ?? /* @__PURE__ */ new Set();
7488
- types.add(record.type);
7489
- planned.set(record.name, types);
7490
- }
7491
- for (const [name, types] of planned) {
7492
- const conflicting = types.has("CNAME") ? ["A", "AAAA"] : ["CNAME"];
7493
- for (const type of conflicting) {
7494
- const found = find(name, type);
7495
- if (!found || found.values.length === 0) continue;
7496
- changes.push({
7497
- domain: plan.domain,
7498
- name,
7499
- type,
7500
- action: "delete",
7501
- previous: found.values.join(", ")
7502
- });
7503
- }
7504
- }
7505
- for (const record of plan.records) {
7506
- const found = find(record.name, record.type);
7507
- const base = {
7508
- domain: plan.domain,
7509
- name: record.name,
7510
- type: record.type,
7511
- value: record.value,
7512
- ttl: record.ttl
7513
- };
7514
- if (!found || found.values.length === 0) changes.push({
7515
- ...base,
7516
- action: "create"
7517
- });
7518
- else if (found.values.length === 1 && same(found.values[0], record.value)) changes.push({
7519
- ...base,
7520
- action: "unchanged"
7521
- });
7522
- else changes.push({
7523
- ...base,
7524
- action: "update",
7525
- previous: found.values.join(", ")
7289
+ /**
7290
+ * Records `entry` as existing with `id`; a no-op if it already is, with
7291
+ * the same data.
7292
+ */
7293
+ async ready(entry, id) {
7294
+ const current = this.resources[entry.key];
7295
+ if (current?.status === "ready" && current.id === id && JSON.stringify(current.data) === JSON.stringify(entry.data)) return;
7296
+ await this.put({
7297
+ ...entry,
7298
+ status: "ready",
7299
+ id
7526
7300
  });
7527
7301
  }
7528
- return changes;
7529
- }
7530
- /** A host's full name from a domain and a relative name. */
7531
- function fullName(domain, name) {
7532
- return name === "@" ? domain : `${name}.${domain}`;
7533
- }
7534
- function printChange(change, dryRun, log) {
7535
- const host = fullName(change.domain, change.name).padEnd(32);
7536
- const type = change.type.padEnd(5);
7537
- const would = dryRun ? "would " : "";
7538
- switch (change.action) {
7539
- case "unchanged":
7540
- log(` ✓ ${host} ${type} ${change.value} (TTL ${change.ttl}) — up to date`);
7541
- break;
7542
- case "create":
7543
- log(` + ${host} ${type} ${change.value} (TTL ${change.ttl}) — ${would}create`);
7544
- break;
7545
- case "update":
7546
- log(` ~ ${host} ${type} ${change.previous} → ${change.value} (TTL ${change.ttl}) — ${would}update`);
7547
- break;
7548
- case "write":
7549
- log(dryRun ? ` ? ${host} ${type} ${change.value} (TTL ${change.ttl}) — would write; current value unknown (key cannot read DNS)` : ` ! ${host} ${type} ${change.value} (TTL ${change.ttl}) — written (not diffed)`);
7550
- break;
7551
- case "delete": log(` - ${host} ${type} ${change.previous} — ${would}delete (a name cannot hold a CNAME and an A record)`);
7552
- }
7553
- }
7554
- /**
7555
- * Each domain's records, through its provider — and, with `confirm`, what was
7556
- * written read back from it. A record already holding its value is neither
7557
- * written nor read again.
7558
- *
7559
- * @throws {DnsRecordsNotConfirmed} when a written record does not read back
7560
- */
7561
- async function settleStackDns(plan, options = {}) {
7562
- const dryRun = options.dryRun === true;
7563
- const log = options.log ?? ((line) => console.log(line));
7564
- const providerFor = options.providerFor ?? ((config) => createDnsProvider({
7565
- config,
7566
- ...options.credentials ? { godaddy: options.credentials } : {},
7567
- ...options.hostinger ? { hostinger: options.hostinger } : {}
7568
- }));
7569
- const changes = [];
7570
- const confirmed = /* @__PURE__ */ new Set();
7571
- const unconfirmed = /* @__PURE__ */ new Set();
7572
- const hostsOf = (domain) => new Set(domain.records.map((r) => r.host));
7573
- for (const host of plan.uncovered) log(` ⚠ ${host} is under no domain in dns — point it at ${plan.server.ipv4} yourself`);
7574
- for (const domain of plan.domains) {
7575
- if (domain.provider === "manual") {
7576
- changes.push(...printManual(domain, log, "manual"));
7577
- for (const host of hostsOf(domain)) unconfirmed.add(host);
7578
- continue;
7579
- }
7580
- const provider = await providerFor(domain.config);
7581
- if (!provider) {
7582
- changes.push(...printManual(domain, log, "manual"));
7583
- for (const host of hostsOf(domain)) unconfirmed.add(host);
7584
- continue;
7585
- }
7586
- log(` ${domain.domain} (${provider.name})${dryRun ? " — dry run" : ""}`);
7587
- let existing;
7588
- let diff;
7589
- let unreadable = false;
7590
- try {
7591
- existing = await existingRecords(provider, domain);
7592
- diff = diffDomainDns(domain, existing);
7593
- } catch (error) {
7594
- if (!(error instanceof DnsRecordsUnreadable)) throw error;
7595
- log(` ℹ The ${provider.name} key cannot read ${domain.domain}'s DNS records, so changes cannot be diffed: every record is written (idempotent).`);
7596
- unreadable = true;
7597
- existing = [];
7598
- diff = domain.records.map((r) => ({
7599
- domain: r.domain,
7600
- name: r.name,
7601
- type: r.type,
7602
- action: "write",
7603
- value: r.value,
7604
- ttl: r.ttl
7605
- }));
7302
+ /**
7303
+ * The resource `entry` names: by its recorded id, else by looking it up,
7304
+ * else created — with `pending` written before the create and `ready`
7305
+ * after, so a run that dies in between leaves a record the next run
7306
+ * resolves by looking the resource up rather than creating another.
7307
+ */
7308
+ async ensure(entry, steps) {
7309
+ const record = this.resources[entry.key];
7310
+ let staleId;
7311
+ if (record?.status === "ready" && record.id && steps.get) {
7312
+ const known = await steps.get(record.id);
7313
+ if (known) {
7314
+ await this.ready(entry, steps.id(known));
7315
+ return {
7316
+ resource: known,
7317
+ via: "recorded"
7318
+ };
7319
+ }
7320
+ staleId = record.id;
7606
7321
  }
7607
- for (const change of diff) printChange(change, dryRun, log);
7608
- if (!plan.server.ipv6) for (const name of new Set(domain.records.map((r) => r.name))) {
7609
- const aaaa = existing.find((r) => r.name === name && r.type === "AAAA");
7610
- const planned = domain.records.find((r) => r.name === name && r.type === "A");
7611
- if (aaaa && planned && aaaa.values.length > 0) log(` ⚠ ${fullName(domain.domain, name)} also has AAAA ${aaaa.values.join(", ")}: set ${require_workspace.SERVER_IPV6_KEY} in the '${plan.stage}' stage's secrets to the server's IPv6 address, or remove that record, or IPv6 clients go elsewhere`);
7322
+ const existing = await steps.find();
7323
+ if (existing) {
7324
+ await this.ready(entry, steps.id(existing));
7325
+ return {
7326
+ resource: existing,
7327
+ via: record?.status === "pending" ? "resumed" : "found",
7328
+ ...staleId ? { staleId } : {}
7329
+ };
7612
7330
  }
7613
- changes.push(...diff);
7614
- const written = new Set(diff.filter((c) => c.action !== "unchanged").map((c) => fullName(c.domain, c.name)));
7615
- for (const host of hostsOf(domain)) if (unreadable) {
7616
- if (!dryRun) unconfirmed.add(host);
7617
- } else if (!written.has(host)) confirmed.add(host);
7618
- if (dryRun) continue;
7619
- const deletes = diff.filter((c) => c.action === "delete");
7620
- if (deletes.length > 0) await provider.deleteRecords(domain.domain, deletes.map((c) => ({
7621
- name: c.name,
7622
- type: c.type
7623
- })));
7624
- const writes = diff.filter((c) => c.action === "create" || c.action === "update" || c.action === "write");
7625
- if (writes.length > 0) await provider.upsertRecords(domain.domain, writes.map((c) => ({
7626
- name: c.name,
7627
- type: c.type,
7628
- value: c.value,
7629
- ttl: c.ttl
7630
- })));
7631
- if (!options.confirm || unreadable || written.size === 0) continue;
7632
- const rewritten = {
7633
- ...domain,
7634
- records: domain.records.filter((r) => written.has(r.host))
7331
+ await this.pending(entry);
7332
+ const created = await steps.create();
7333
+ await this.ready(entry, steps.id(created));
7334
+ return {
7335
+ resource: created,
7336
+ via: "created",
7337
+ ...staleId ? { staleId } : {}
7635
7338
  };
7636
- const after = await existingRecords(provider, rewritten);
7637
- const missing = [];
7638
- for (const record of rewritten.records) {
7639
- const values = after.find((r) => r.name === record.name && r.type === record.type)?.values ?? [];
7640
- if (values.length !== 1 || !same(values[0], record.value)) missing.push({
7641
- host: record.host,
7642
- type: record.type,
7643
- expected: record.value,
7644
- found: values
7645
- });
7646
- }
7647
- if (missing.length > 0) throw new DnsRecordsNotConfirmed(plan.stage, domain.domain, provider.name, missing);
7648
- for (const host of written) confirmed.add(host);
7649
- log(` ✓ ${written.size} host${written.size === 1 ? "" : "s"} read back from ${provider.name}`);
7650
- }
7651
- for (const host of plan.uncovered) unconfirmed.add(host);
7652
- return {
7653
- changes,
7654
- confirmed: [...confirmed].sort(),
7655
- unconfirmed: [...unconfirmed].filter((h) => !confirmed.has(h)).sort()
7656
- };
7657
- }
7658
- /** The system resolver: what the server's own clients would be told. */
7659
- const systemLookup = async (host) => {
7660
- return (await (0, node_dns_promises.lookup)(host, { all: true })).map((a) => a.address);
7661
- };
7662
- /** Hosts that do not resolve to the stage's server. */
7663
- var HostNotPointingAtServer = class extends require_errors.GkmError {
7664
- stage;
7665
- hosts;
7666
- expected;
7667
- fix;
7668
- constructor(stage, hosts, expected, fix) {
7669
- const want = expected.ipv6 ? `${expected.ipv4} (and ${expected.ipv6})` : expected.ipv4;
7670
- const lines = hosts.map((h) => ` - ${h.host} → ${h.resolved.length > 0 ? h.resolved.join(", ") : `nothing${h.error ? ` (${h.error})` : ""}`}, expected ${want}`);
7671
- super(`${hosts.length === 1 ? "A host" : `${hosts.length} hosts`} of '${stage}' do${hosts.length === 1 ? "es" : ""} not resolve to its server, so a certificate for ${hosts.length === 1 ? "it" : "them"} cannot be issued:\n${lines.join("\n")}\n${fix}\nRecords can take a few minutes to propagate. With a CDN or proxy in front of the server, pass --skip-dns.`);
7672
- this.stage = stage;
7673
- this.hosts = hosts;
7674
- this.expected = expected;
7675
- this.fix = fix;
7676
- this.name = "HostNotPointingAtServer";
7677
- }
7678
- };
7679
- /**
7680
- * Every host resolved: each must resolve to the server's IPv4 address and to
7681
- * nothing but the server's addresses.
7682
- *
7683
- * @throws {HostNotPointingAtServer} naming every host that does not
7684
- */
7685
- async function checkStackDns(input) {
7686
- const lookup = input.lookup ?? systemLookup;
7687
- const { server } = input;
7688
- const ours = new Set([server.ipv4, server.ipv6].filter(Boolean).map((a) => a.toLowerCase()));
7689
- const bad = [];
7690
- const ok = [];
7691
- for (const host of input.hosts) {
7692
- let resolved;
7693
- try {
7694
- resolved = [...new Set(await lookup(host))];
7695
- } catch (error) {
7696
- const code = error && typeof error === "object" && "code" in error ? String(error.code) : error instanceof Error ? error.message : String(error);
7697
- bad.push({
7698
- host,
7699
- resolved: [],
7700
- error: code
7701
- });
7702
- continue;
7703
- }
7704
- if (resolved.some((a) => a.toLowerCase() === server.ipv4.toLowerCase()) && resolved.every((a) => ours.has(a.toLowerCase()))) ok.push(host);
7705
- else bad.push({
7706
- host,
7707
- resolved
7708
- });
7709
7339
  }
7710
- if (bad.length > 0) throw new HostNotPointingAtServer(input.stage, bad, {
7711
- ipv4: server.ipv4,
7712
- ...server.ipv6 ? { ipv6: server.ipv6 } : {}
7713
- }, dnsFix(input, bad));
7714
- return ok;
7715
- }
7716
- /** How to fix it: the deploy, or the records to create by hand. */
7717
- function dnsFix(input, bad) {
7718
- const hosts = bad.map((h) => h.host);
7719
- let plan;
7720
- try {
7721
- plan = planStackDns({
7722
- stage: input.stage,
7723
- hosts,
7724
- server: input.server,
7725
- dns: input.dns
7726
- });
7727
- } catch {
7728
- plan = {
7729
- stage: input.stage,
7730
- server: input.server,
7731
- domains: [],
7732
- uncovered: hosts
7340
+ /** Removes `key`'s record — a resource that no longer exists. */
7341
+ async forget(key) {
7342
+ if (!(key in this.resources)) return;
7343
+ this.version = await this.store.deleteResource(this.stage, key, { expectedVersion: this.version });
7344
+ const { [key]: _removed, ...resources } = this.resources;
7345
+ this.resources = resources;
7346
+ }
7347
+ /** Every record, as the journal last wrote or read it. */
7348
+ records() {
7349
+ return this.resources;
7350
+ }
7351
+ /** Writes the stage's state, keeping its resource records. */
7352
+ async save() {
7353
+ this.state.lastDeployedAt = (/* @__PURE__ */ new Date()).toISOString();
7354
+ this.version = await this.store.write(this.stage, this.state, { expectedVersion: this.version });
7355
+ }
7356
+ async put(record) {
7357
+ this.version = await this.store.putResource(this.stage, record, { expectedVersion: this.version });
7358
+ this.resources = {
7359
+ ...this.resources,
7360
+ [record.key]: {
7361
+ ...record,
7362
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
7363
+ }
7733
7364
  };
7734
7365
  }
7735
- const automatic = plan.domains.filter((d) => d.provider !== "manual");
7736
- const byHand = [...plan.domains.filter((d) => d.provider === "manual").flatMap((d) => d.records.map(describe)), ...plan.uncovered.flatMap((host) => [`${host.padEnd(32)} A ${input.server.ipv4}`, ...input.server.ipv6 ? [`${host.padEnd(32)} AAAA ${input.server.ipv6}`] : []])];
7737
- const lines = [];
7738
- if (automatic.length > 0) lines.push(`Fix: gkm deploy --stage ${input.stage} writes the records for ${automatic.map((d) => d.domain).join(", ")} through their provider (--dry-run shows them first).`);
7739
- if (byHand.length > 0) lines.push(`${automatic.length > 0 ? "And create" : "Fix: create"} these records at the DNS host:`, ...byHand.map((line) => ` ${line}`));
7740
- return lines.join("\n");
7741
- }
7742
- /** The environment variable each token-authenticated provider reads. */
7743
- const DNS_TOKEN_KEYS = {
7744
- godaddy: "GODADDY_API_TOKEN",
7745
- hostinger: "HOSTINGER_API_TOKEN"
7746
- };
7747
- /**
7748
- * A domain whose records the deploy writes, and no token to write them with.
7749
- * Raised before anything is built, started or written.
7750
- */
7751
- var DnsCredentialMissing = class extends require_errors.GkmError {
7752
- stage;
7753
- domain;
7754
- provider;
7755
- key;
7756
- constructor(stage, domain, provider, key) {
7757
- super(`'${stage}''s hosts are under ${domain}, whose DNS is ${provider}'s, and the deploy writes their records — but ${key} is not set. In CI, add ${key} as a secret on the '${stage}' GitHub environment and pass it to the step that writes the records: env: { ${key}: \${{ secrets.${key} }} }. On this machine, export ${key} or run gkm login --provider ${provider}. With a CDN or proxy in front of the server, pass --skip-dns.`);
7758
- this.stage = stage;
7759
- this.domain = domain;
7760
- this.provider = provider;
7761
- this.key = key;
7762
- this.name = "DnsCredentialMissing";
7763
- }
7764
7366
  };
7765
- /**
7766
- * The `dns` domain a stage's own domain (`domains.<stage>`) is under — where
7767
- * its hosts' records go — or none.
7768
- */
7769
- function stageDnsDomains(stage, domains, dns) {
7770
- const own = domains?.[stage];
7771
- if (!own || !dns || isLocalHost(own)) return [];
7772
- const normalized = normalizeDnsConfig(dns);
7773
- const root = findRootDomain(own.toLowerCase(), normalized);
7774
- return root ? [{
7775
- domain: root,
7776
- config: normalized[root]
7777
- }] : [];
7778
- }
7779
- /**
7780
- * Each token the domains' providers need, from `credentials` — `manual`,
7781
- * Route53 (the AWS SDK's own chain) and a provider object need none.
7782
- *
7783
- * @throws {DnsCredentialMissing} naming the first domain with no token
7784
- */
7785
- async function dnsCredentials(stage, domains, credentials) {
7786
- const found = {};
7787
- for (const { domain, config } of domains) {
7788
- const provider = config.provider;
7789
- if (provider !== "godaddy" && provider !== "hostinger") continue;
7790
- if (found[provider]) continue;
7791
- const token = await credentials.get({ kind: provider });
7792
- if (!token?.token) throw new DnsCredentialMissing(stage, domain, provider, DNS_TOKEN_KEYS[provider]);
7793
- found[provider] = token;
7794
- }
7795
- return found;
7796
- }
7797
- /**
7798
- * A stage's DNS, as every deploy runs it: the
7799
- * stage's own hosts planned, written through each domain's provider where
7800
- * they differ, and read back from it. Only A, AAAA and CNAME records of
7801
- * those names are touched; nothing is a wildcard, and no other name is read,
7802
- * written or deleted. What no provider confirms — a `manual` domain, a host
7803
- * under no domain in `dns`, a key that cannot read — is resolved publicly.
7804
- * A dry run prints the plan and writes nothing.
7805
- *
7806
- * @throws {DnsCredentialMissing} before anything is read or written
7807
- * @throws {DnsRecordsNotConfirmed} when a written record does not read back
7808
- * @throws {HostNotPointingAtServer} when a resolved host is not the server
7809
- */
7810
- async function stageDns(input) {
7811
- const { stage, server } = input;
7812
- const log = input.log ?? ((line) => console.log(line));
7813
- const plan = planStackDns({
7814
- stage,
7815
- hosts: input.hosts,
7816
- server,
7817
- dns: input.dns
7818
- });
7819
- const tokens = await dnsCredentials(stage, plan.domains.map(({ domain, config }) => ({
7820
- domain,
7821
- config
7822
- })), input.credentials);
7823
- const applied = !input.dns ? {
7824
- changes: [],
7825
- confirmed: [],
7826
- unconfirmed: [...plan.uncovered]
7827
- } : await settleStackDns(plan, {
7828
- ...input.dryRun ? { dryRun: true } : { confirm: true },
7829
- log,
7830
- credentials: {
7831
- ...input.godaddy ?? {},
7832
- ...tokens.godaddy ? { credential: tokens.godaddy } : {},
7833
- log
7834
- },
7835
- ...tokens.hostinger ? { hostinger: tokens.hostinger } : {},
7836
- ...input.providerFor ? { providerFor: input.providerFor } : {}
7837
- });
7838
- let resolved = [];
7839
- if (applied.unconfirmed.length > 0) resolved = await checkStackDns({
7840
- stage,
7841
- hosts: applied.unconfirmed,
7842
- server,
7843
- dns: input.dns,
7844
- ...input.lookup ? { lookup: input.lookup } : {}
7845
- });
7846
- return {
7847
- plan,
7848
- changes: applied.changes,
7849
- confirmed: applied.confirmed,
7850
- resolved
7851
- };
7852
- }
7853
- //#endregion
7854
- //#region src/providers/dns.ts
7855
- var dns_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
7856
- composeStageHosts: () => composeStageHosts,
7857
- deploysWithCompose: () => deploysWithCompose
7858
- });
7859
- /** Whether the workspace deploys through the compose target. */
7860
- function deploysWithCompose(workspace) {
7861
- return workspace.deploy?.default === "compose" || Object.values(workspace.apps).some((app) => app.resolvedDeployTarget === "compose");
7862
- }
7863
- /**
7864
- * The hosts a compose stage serves: its stack composed as a deploy would —
7865
- * with the secrets it would generate made up in memory, never written — and
7866
- * every route's host read off it.
7867
- */
7868
- async function composeStageHosts(options) {
7869
- const { workspace, stage, manifest } = options;
7870
- const { deployedStackSecrets } = await Promise.resolve().then(() => require("./secrets-DAvi_O9g.cjs")).then((n) => n.secrets_exports);
7871
- const { composeStack } = await Promise.resolve().then(() => require("./stack-B3fPDTBg.cjs")).then((n) => n.stack_exports);
7872
- const { secrets } = deployedStackSecrets(workspace, stage, options.stored, manifest);
7873
- return stackHosts(composeStack({
7874
- workspace,
7875
- manifest,
7876
- runnables: options.runnables,
7877
- background: options.background,
7878
- stage,
7879
- identity: deployIdentity(workspace, stage),
7880
- images: {
7881
- mode: "pull",
7882
- tag: "dns",
7883
- ...workspace.deploy?.registry ? { registry: workspace.deploy.registry } : {}
7884
- },
7885
- secrets,
7886
- buildOnly: true,
7887
- allowDevServices: true
7888
- }));
7889
- }
7890
7367
  //#endregion
7891
7368
  //#region src/providers/types.ts
7892
7369
  /** The manifest kinds a stage can name a provider for. */
@@ -7952,88 +7429,6 @@ function assertStageProvidersEnabled(workspace, manifest, stage) {
7952
7429
  if (require_workspace.stageProvider(workspace, kind, stage).mode === "none") throw new StageProviderDisabled(kind, stage, ids);
7953
7430
  }
7954
7431
  }
7955
- const SUFFIX_ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789";
7956
- /** A name that S3 would refuse — what the name builder never returns. */
7957
- var InvalidBucketName = class extends require_errors.GkmError {
7958
- bucket;
7959
- reason;
7960
- constructor(bucket, reason) {
7961
- super(`'${bucket}' is not a valid S3 bucket name: ${reason}. Rename the construct or set deploy.namespace in gkm.config.ts to something that leaves room for it.`);
7962
- this.bucket = bucket;
7963
- this.reason = reason;
7964
- this.name = "InvalidBucketName";
7965
- }
7966
- };
7967
- /** Lowercase `[a-z0-9-]`, runs of anything else one `-`, no edge dashes. */
7968
- function part(value) {
7969
- return (0, _geekmidas_manifest.kebabCase)(value).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
7970
- }
7971
- /**
7972
- * `parts` joined by `-`, shortened to `max` characters by trimming the longest
7973
- * part one character at a time — so a long construct id gives way before a
7974
- * short stage name does, and every part keeps its start.
7975
- */
7976
- function fitParts(parts, max) {
7977
- const kept = parts.map(part).filter(Boolean);
7978
- const length = () => kept.reduce((sum, p) => sum + p.length, 0) + kept.length - 1;
7979
- while (length() > max) {
7980
- let longest = 0;
7981
- for (let i = 1; i < kept.length; i++) if (kept[i].length > kept[longest].length) longest = i;
7982
- if (kept[longest].length <= 1) break;
7983
- kept[longest] = kept[longest].slice(0, -1).replace(/-+$/, "");
7984
- }
7985
- return kept.join("-");
7986
- }
7987
- /** Why `name` is not a valid bucket name, or undefined when it is. */
7988
- function bucketNameProblem(name) {
7989
- if (name.length < 3 || name.length > 63) return `it is ${name.length} characters, and S3 takes 3 to 63`;
7990
- if (!/^[a-z0-9-]+$/.test(name)) return "it may hold only lowercase letters, digits and -";
7991
- if (!/^[a-z0-9].*[a-z0-9]$/.test(name)) return "it must start and end with a letter or a digit";
7992
- if (name.startsWith("xn--") || name.startsWith("sthree-")) return "it starts with a prefix S3 reserves ('xn--', 'sthree-')";
7993
- if (name.endsWith("-s3alias") || name.endsWith("--ol-s3")) return "it ends with a suffix S3 reserves ('-s3alias', '--ol-s3')";
7994
- }
7995
- /**
7996
- * The good name: `<namespace>-<project>-<stage>-<bucket id>`, lowercased, no
7997
- * dots, shortened to leave room for a clash's suffix.
7998
- *
7999
- * @throws {InvalidBucketName} when nothing usable is left
8000
- */
8001
- function bucketName(input) {
8002
- const name = fitParts([
8003
- input.scope,
8004
- input.stage,
8005
- input.id
8006
- ], 56);
8007
- const problem = bucketNameProblem(name);
8008
- if (problem) throw new InvalidBucketName(name, problem);
8009
- return name;
8010
- }
8011
- /** Six random `[a-z0-9]` characters. */
8012
- function randomSuffix(random = node_crypto.randomInt) {
8013
- let suffix = "";
8014
- for (let i = 0; i < 6; i++) suffix += SUFFIX_ALPHABET[random(36)];
8015
- return suffix;
8016
- }
8017
- /** The good name with a clash's suffix. */
8018
- function suffixedBucketName(good, suffix) {
8019
- return `${good}-${suffix}`;
8020
- }
8021
- /**
8022
- * The IAM user a bucket is reached with on a stage:
8023
- * `gkm-<project>-<stage>-<bucket id>`, at most 64 characters.
8024
- */
8025
- function iamUserName(input) {
8026
- return fitParts([
8027
- "gkm",
8028
- input.scope,
8029
- input.stage,
8030
- input.id
8031
- ], 64);
8032
- }
8033
- /** The path every user gkm creates is under, so it finds its own. */
8034
- const IAM_USER_PATH = "/gkm/";
8035
- /** The inline policy each user is given. */
8036
- const IAM_POLICY_NAME = "gkm-bucket";
8037
7432
  //#endregion
8038
7433
  //#region src/deploy/devServices.ts
8039
7434
  /**
@@ -8134,22 +7529,58 @@ var ExternalServicesNotConfigured = class extends require_errors.GkmError {
8134
7529
  this.name = "ExternalServicesNotConfigured";
8135
7530
  }
8136
7531
  };
7532
+ /** The kinds a deployed stage takes from its secrets, or a dev service. */
7533
+ const SERVICE_KINDS = {
7534
+ email: "email",
7535
+ objects: "objects",
7536
+ "file-server": "file-server"
7537
+ };
8137
7538
  /**
8138
- * Every mail and storage construct a manifest declares, with the apps that
8139
- * depend on each — what a target that provisions the whole manifest checks.
7539
+ * Every mail and storage construct a manifest declares, each with the apps
7540
+ * and workers that read it — a process's environment, a site's build args. A
7541
+ * file server's reader reads its bucket too.
7542
+ *
7543
+ * The one list a deploy's readiness check refuses a stage by, every server
7544
+ * target decides its dev services from, and `gkm secrets:add` offers — so
7545
+ * none of them can disagree.
8140
7546
  */
8141
- function manifestServiceDeclarations(manifest) {
7547
+ function stageServiceDeclarations(input) {
7548
+ const { manifest } = input;
7549
+ const runnables = input.runnables ?? {};
7550
+ const owners = /* @__PURE__ */ new Map();
7551
+ for (const [id, declaration] of Object.entries(manifest)) {
7552
+ if (!SERVICE_KINDS[declaration.kind]) continue;
7553
+ owners.set((0, _geekmidas_manifest.provideKey)(id, "url"), id);
7554
+ if (declaration.kind === "email") owners.set((0, _geekmidas_manifest.provideKey)(id, "from"), id);
7555
+ }
7556
+ const readers = /* @__PURE__ */ new Map();
7557
+ const read = (process, keys) => {
7558
+ for (const key of keys) {
7559
+ const id = owners.get(key);
7560
+ if (!id) continue;
7561
+ const declaration = manifest[id];
7562
+ const of = declaration?.kind === "file-server" ? declaration.of : void 0;
7563
+ for (const owner of of ? [id, of] : [id]) {
7564
+ const set = readers.get(owner) ?? /* @__PURE__ */ new Set();
7565
+ set.add(process);
7566
+ readers.set(owner, set);
7567
+ }
7568
+ }
7569
+ };
7570
+ for (const [id, declaration] of Object.entries(manifest)) {
7571
+ const name = require_derive.appKey(id);
7572
+ if (declaration.kind === "rest-api" || declaration.kind === "site" || declaration.kind === "mobile-app") read(name, appEnvKeys(manifest, name, runnables) ?? []);
7573
+ if (declaration.kind === "site") read(name, Object.values((0, _geekmidas_manifest.publicEnvFor)(declaration, manifest)));
7574
+ if (declaration.kind === "worker") read(name, workerEnvKeys(manifest, id, runnables) ?? []);
7575
+ }
8142
7576
  return Object.entries(manifest).flatMap(([id, declaration]) => {
8143
- const { kind } = declaration;
8144
- if (kind !== "email" && kind !== "objects" && kind !== "file-server") return [];
8145
- const apps = (0, _geekmidas_manifest.dependentsOf)(manifest, id).filter((caller) => {
8146
- const callerKind = manifest[caller]?.kind;
8147
- return callerKind === "rest-api" || callerKind === "site";
8148
- }).map(require_derive.appKey);
7577
+ const kind = SERVICE_KINDS[declaration.kind];
7578
+ if (!kind) return [];
7579
+ const apps = [...readers.get(id) ?? []].sort();
8149
7580
  return [{
8150
7581
  id,
8151
7582
  kind,
8152
- ...declaration.kind === "file-server" ? { of: declaration.of } : {},
7583
+ ...declaration.kind === "file-server" && declaration.of ? { of: declaration.of } : {},
8153
7584
  ...apps.length ? { apps } : {}
8154
7585
  }];
8155
7586
  });
@@ -8293,16 +7724,6 @@ function externalServices(input) {
8293
7724
  mailpit
8294
7725
  };
8295
7726
  }
8296
- /**
8297
- * `externalServices`, refusing a stage that lacks anything.
8298
- *
8299
- * @throws {ExternalServicesNotConfigured} naming every missing key
8300
- */
8301
- function assertExternalServices(input) {
8302
- const services = externalServices(input);
8303
- if (services.missing.length > 0) throw new ExternalServicesNotConfigured(input.stage, services.missing);
8304
- return services;
8305
- }
8306
7727
  /** The dev services a run uses, one entry per service it runs. */
8307
7728
  function devServicesUsed(services) {
8308
7729
  const used = [];
@@ -8543,7 +7964,7 @@ async function buildDockerImage(app, buildRoot, options) {
8543
7964
  const fullImageName = validateImageRef(registry ? `${registry}/${app.imageName}:${tag}` : `${app.imageName}:${tag}`);
8544
7965
  logger.log(`\n🐳 Building Docker image: ${fullImageName}`);
8545
7966
  try {
8546
- await require_credentials.run("docker", [
7967
+ await require_run.run("docker", [
8547
7968
  "build",
8548
7969
  `--file=${(0, node_path.relative)(buildRoot, app.dockerfile)}`,
8549
7970
  `--tag=${fullImageName}`,
@@ -8570,7 +7991,7 @@ async function pushDockerImage(imageName, options, cwd) {
8570
7991
  const fullImageName = validateImageRef(`${registry}/${imageName}:${tag}`);
8571
7992
  logger.log(`\n🚀 Pushing Docker image: ${fullImageName}`);
8572
7993
  try {
8573
- await require_credentials.run("docker", ["push", fullImageName], { cwd });
7994
+ await require_run.run("docker", ["push", fullImageName], { cwd });
8574
7995
  logger.log(`✅ Docker image pushed: ${fullImageName}`);
8575
7996
  } catch (error) {
8576
7997
  throw new DockerPushFailed(fullImageName, error);
@@ -8767,96 +8188,6 @@ function printRunInstructions(workspace) {
8767
8188
  logger.log(` docker compose -f ${COMPOSE_PATH}${project} --profile apps up --build`);
8768
8189
  }
8769
8190
  //#endregion
8770
- //#region src/secrets/stale.ts
8771
- /**
8772
- * Stored secrets an older gkm generated that now shadow a derived value.
8773
- *
8774
- * Before constructs, initialising a stage wrote an address for each app into
8775
- * its custom secrets: `<APP>_DATABASE_URL` as a `postgresql://…@localhost`
8776
- * URL with a password of its own, and `http://localhost:<port>` for a site or
8777
- * an auth server. Those keys are now a construct's — `database.schema('AuthDatabase')`
8778
- * provides `AUTH_DATABASE_URL`, `new BetterAuth('Auth')` provides `AUTH_URL`
8779
- * — and a deploy derives them. A value the stage holds is a value set by hand,
8780
- * and set by hand wins: the container is handed `localhost`, where nothing
8781
- * answers, with a password no role has.
8782
- *
8783
- * So a deploy refuses such a stage rather than run it, naming each key and
8784
- * the command that removes it. Nothing is deleted for the user: the value is
8785
- * theirs, and only they can say it is stale. A URL that names a real host — a
8786
- * managed database — is a deliberate choice and still wins.
8787
- */
8788
- /** The kinds whose URL an older gkm wrote into a stage's secrets. */
8789
- const ADDRESSED = /* @__PURE__ */ new Set([
8790
- "database",
8791
- "database-reader",
8792
- "database-schema",
8793
- "rest-api",
8794
- "site"
8795
- ]);
8796
- /** Hosts that are this machine — never anything, inside a container. */
8797
- const LOOPBACK = /* @__PURE__ */ new Set([
8798
- "localhost",
8799
- "127.0.0.1",
8800
- "[::1]",
8801
- "::1"
8802
- ]);
8803
- /**
8804
- * A stage holds a construct's address as a custom secret, pointing at
8805
- * `localhost` — what an older `gkm secrets:init`, `gkm setup` or `gkm init`
8806
- * generated. Set by hand wins over derived, so the app would be handed it.
8807
- */
8808
- var StaleStageSecrets = class extends require_errors.GkmError {
8809
- stage;
8810
- stale;
8811
- constructor(stage, stale) {
8812
- const one = stale.length === 1;
8813
- super(`The stage '${stage}' holds ${one ? "a value" : "values"} an older gkm generated for ${one ? "an address a construct" : "addresses constructs"} now ${one ? "provides" : "provide"}:\n` + stale.map((s) => ` ${s.key}: ${s.construct}'s, stored pointing at ${s.host}`).join("\n") + `
8814
- A stored value wins over the derived one, so the app would be handed an address where nothing answers inside its container. Remove ${one ? "it" : "each"}, and the construct's own value is used:\n` + stale.map((s) => ` gkm secrets:unset ${s.key} --stage ${stage}`).join("\n") + "\nA managed service set with its real host is not affected.");
8815
- this.stage = stage;
8816
- this.stale = stale;
8817
- this.name = "StaleStageSecrets";
8818
- }
8819
- };
8820
- /** The host a stored value names, if it is a URL. */
8821
- function hostOf(value) {
8822
- try {
8823
- return new URL(value).hostname;
8824
- } catch {
8825
- return;
8826
- }
8827
- }
8828
- /**
8829
- * Each stored key that a construct provides an address for, holding an
8830
- * address on this machine.
8831
- */
8832
- function staleStageSecrets(manifest, supplied) {
8833
- const stale = [];
8834
- for (const [id, declaration] of Object.entries(manifest)) {
8835
- if (!ADDRESSED.has(declaration.kind)) continue;
8836
- const key = (0, _geekmidas_manifest.providedKeyFor)(id, declaration.kind, "url");
8837
- const value = supplied[key];
8838
- if (value === void 0) continue;
8839
- const host = hostOf(value);
8840
- if (host === void 0 || !LOOPBACK.has(host)) continue;
8841
- stale.push({
8842
- key,
8843
- construct: id,
8844
- host
8845
- });
8846
- }
8847
- return stale.sort((a, b) => a.key.localeCompare(b.key));
8848
- }
8849
- /**
8850
- * Refuse a stage whose stored secrets would shadow a construct's address with
8851
- * `localhost`.
8852
- *
8853
- * @throws {StaleStageSecrets} naming each key and the command removing it
8854
- */
8855
- function assertNoStaleSecrets(options) {
8856
- const stale = staleStageSecrets(options.manifest, options.supplied);
8857
- if (stale.length > 0) throw new StaleStageSecrets(options.stage, stale);
8858
- }
8859
- //#endregion
8860
8191
  //#region src/target/seeds.ts
8861
8192
  /** A seed of a deployed stage failed; the release stopped before any app. */
8862
8193
  var DeploySeedsFailed = class extends Error {
@@ -8945,6 +8276,12 @@ Object.defineProperty(exports, "DEV_SERVICES", {
8945
8276
  return DEV_SERVICES;
8946
8277
  }
8947
8278
  });
8279
+ Object.defineProperty(exports, "DeployJournal", {
8280
+ enumerable: true,
8281
+ get: function() {
8282
+ return DeployJournal;
8283
+ }
8284
+ });
8948
8285
  Object.defineProperty(exports, "DeploySeedsFailed", {
8949
8286
  enumerable: true,
8950
8287
  get: function() {
@@ -8999,24 +8336,6 @@ Object.defineProperty(exports, "FileSecretsStore", {
8999
8336
  return FileSecretsStore;
9000
8337
  }
9001
8338
  });
9002
- Object.defineProperty(exports, "HostNotPointingAtServer", {
9003
- enumerable: true,
9004
- get: function() {
9005
- return HostNotPointingAtServer;
9006
- }
9007
- });
9008
- Object.defineProperty(exports, "IAM_POLICY_NAME", {
9009
- enumerable: true,
9010
- get: function() {
9011
- return IAM_POLICY_NAME;
9012
- }
9013
- });
9014
- Object.defineProperty(exports, "IAM_USER_PATH", {
9015
- enumerable: true,
9016
- get: function() {
9017
- return IAM_USER_PATH;
9018
- }
9019
- });
9020
8339
  Object.defineProperty(exports, "LEGACY_LOCAL_LOGIN", {
9021
8340
  enumerable: true,
9022
8341
  get: function() {
@@ -9167,18 +8486,6 @@ Object.defineProperty(exports, "assertDevServicesFlag", {
9167
8486
  return assertDevServicesFlag;
9168
8487
  }
9169
8488
  });
9170
- Object.defineProperty(exports, "assertExternalServices", {
9171
- enumerable: true,
9172
- get: function() {
9173
- return assertExternalServices;
9174
- }
9175
- });
9176
- Object.defineProperty(exports, "assertNoStaleSecrets", {
9177
- enumerable: true,
9178
- get: function() {
9179
- return assertNoStaleSecrets;
9180
- }
9181
- });
9182
8489
  Object.defineProperty(exports, "assertStageProvidersEnabled", {
9183
8490
  enumerable: true,
9184
8491
  get: function() {
@@ -9197,12 +8504,6 @@ Object.defineProperty(exports, "bucketClient", {
9197
8504
  return bucketClient;
9198
8505
  }
9199
8506
  });
9200
- Object.defineProperty(exports, "bucketName", {
9201
- enumerable: true,
9202
- get: function() {
9203
- return bucketName;
9204
- }
9205
- });
9206
8507
  Object.defineProperty(exports, "bucketPolicies", {
9207
8508
  enumerable: true,
9208
8509
  get: function() {
@@ -9245,6 +8546,12 @@ Object.defineProperty(exports, "createCredentialsPreload", {
9245
8546
  return createCredentialsPreload;
9246
8547
  }
9247
8548
  });
8549
+ Object.defineProperty(exports, "createDnsProvider", {
8550
+ enumerable: true,
8551
+ get: function() {
8552
+ return createDnsProvider;
8553
+ }
8554
+ });
9248
8555
  Object.defineProperty(exports, "createEmptyState", {
9249
8556
  enumerable: true,
9250
8557
  get: function() {
@@ -9269,12 +8576,6 @@ Object.defineProperty(exports, "deployIdentity", {
9269
8576
  return deployIdentity;
9270
8577
  }
9271
8578
  });
9272
- Object.defineProperty(exports, "deploysWithCompose", {
9273
- enumerable: true,
9274
- get: function() {
9275
- return deploysWithCompose;
9276
- }
9277
- });
9278
8579
  Object.defineProperty(exports, "derivedContainers", {
9279
8580
  enumerable: true,
9280
8581
  get: function() {
@@ -9305,12 +8606,6 @@ Object.defineProperty(exports, "devServicesUsed", {
9305
8606
  return devServicesUsed;
9306
8607
  }
9307
8608
  });
9308
- Object.defineProperty(exports, "dnsCredentials", {
9309
- enumerable: true,
9310
- get: function() {
9311
- return dnsCredentials;
9312
- }
9313
- });
9314
8609
  Object.defineProperty(exports, "dnsRecordResource", {
9315
8610
  enumerable: true,
9316
8611
  get: function() {
@@ -9323,12 +8618,6 @@ Object.defineProperty(exports, "dnsResources", {
9323
8618
  return dnsResources;
9324
8619
  }
9325
8620
  });
9326
- Object.defineProperty(exports, "dns_exports", {
9327
- enumerable: true,
9328
- get: function() {
9329
- return dns_exports;
9330
- }
9331
- });
9332
8621
  Object.defineProperty(exports, "dockerCommand", {
9333
8622
  enumerable: true,
9334
8623
  get: function() {
@@ -9371,6 +8660,12 @@ Object.defineProperty(exports, "externalServices", {
9371
8660
  return externalServices;
9372
8661
  }
9373
8662
  });
8663
+ Object.defineProperty(exports, "extractSubdomain", {
8664
+ enumerable: true,
8665
+ get: function() {
8666
+ return extractSubdomain;
8667
+ }
8668
+ });
9374
8669
  Object.defineProperty(exports, "fakeKey", {
9375
8670
  enumerable: true,
9376
8671
  get: function() {
@@ -9389,6 +8684,12 @@ Object.defineProperty(exports, "findBuildRoot", {
9389
8684
  return findBuildRoot;
9390
8685
  }
9391
8686
  });
8687
+ Object.defineProperty(exports, "findRootDomain", {
8688
+ enumerable: true,
8689
+ get: function() {
8690
+ return findRootDomain;
8691
+ }
8692
+ });
9392
8693
  Object.defineProperty(exports, "forgetState", {
9393
8694
  enumerable: true,
9394
8695
  get: function() {
@@ -9419,12 +8720,6 @@ Object.defineProperty(exports, "hostFor", {
9419
8720
  return hostFor;
9420
8721
  }
9421
8722
  });
9422
- Object.defineProperty(exports, "iamUserName", {
9423
- enumerable: true,
9424
- get: function() {
9425
- return iamUserName;
9426
- }
9427
- });
9428
8723
  Object.defineProperty(exports, "imageBuildCredentials", {
9429
8724
  enumerable: true,
9430
8725
  get: function() {
@@ -9467,12 +8762,6 @@ Object.defineProperty(exports, "isImageBuild", {
9467
8762
  return isImageBuild;
9468
8763
  }
9469
8764
  });
9470
- Object.defineProperty(exports, "isLocalHost", {
9471
- enumerable: true,
9472
- get: function() {
9473
- return isLocalHost;
9474
- }
9475
- });
9476
8765
  Object.defineProperty(exports, "isMainFrontendApp", {
9477
8766
  enumerable: true,
9478
8767
  get: function() {
@@ -9551,12 +8840,6 @@ Object.defineProperty(exports, "logsService", {
9551
8840
  return logsService;
9552
8841
  }
9553
8842
  });
9554
- Object.defineProperty(exports, "manifestServiceDeclarations", {
9555
- enumerable: true,
9556
- get: function() {
9557
- return manifestServiceDeclarations;
9558
- }
9559
- });
9560
8843
  Object.defineProperty(exports, "markerOf", {
9561
8844
  enumerable: true,
9562
8845
  get: function() {
@@ -9575,6 +8858,12 @@ Object.defineProperty(exports, "networkEnv", {
9575
8858
  return networkEnv;
9576
8859
  }
9577
8860
  });
8861
+ Object.defineProperty(exports, "normalizeDnsConfig", {
8862
+ enumerable: true,
8863
+ get: function() {
8864
+ return normalizeDnsConfig;
8865
+ }
8866
+ });
9578
8867
  Object.defineProperty(exports, "orchestrateDns", {
9579
8868
  enumerable: true,
9580
8869
  get: function() {
@@ -9671,12 +8960,6 @@ Object.defineProperty(exports, "quoteIdentifier", {
9671
8960
  return quoteIdentifier;
9672
8961
  }
9673
8962
  });
9674
- Object.defineProperty(exports, "randomSuffix", {
9675
- enumerable: true,
9676
- get: function() {
9677
- return randomSuffix;
9678
- }
9679
- });
9680
8963
  Object.defineProperty(exports, "readKey", {
9681
8964
  enumerable: true,
9682
8965
  get: function() {
@@ -9737,12 +9020,6 @@ Object.defineProperty(exports, "reportPlannedSeeds", {
9737
9020
  return reportPlannedSeeds;
9738
9021
  }
9739
9022
  });
9740
- Object.defineProperty(exports, "requiredServerAddress", {
9741
- enumerable: true,
9742
- get: function() {
9743
- return requiredServerAddress;
9744
- }
9745
- });
9746
9023
  Object.defineProperty(exports, "requiredStageKeys", {
9747
9024
  enumerable: true,
9748
9025
  get: function() {
@@ -9779,12 +9056,6 @@ Object.defineProperty(exports, "secretsStoreFor", {
9779
9056
  return secretsStoreFor;
9780
9057
  }
9781
9058
  });
9782
- Object.defineProperty(exports, "serverAddressHint", {
9783
- enumerable: true,
9784
- get: function() {
9785
- return serverAddressHint;
9786
- }
9787
- });
9788
9059
  Object.defineProperty(exports, "setApplicationId", {
9789
9060
  enumerable: true,
9790
9061
  get: function() {
@@ -9809,12 +9080,6 @@ Object.defineProperty(exports, "setPostgresBackupId", {
9809
9080
  return setPostgresBackupId;
9810
9081
  }
9811
9082
  });
9812
- Object.defineProperty(exports, "stackHosts", {
9813
- enumerable: true,
9814
- get: function() {
9815
- return stackHosts;
9816
- }
9817
- });
9818
9083
  Object.defineProperty(exports, "stackLogs", {
9819
9084
  enumerable: true,
9820
9085
  get: function() {
@@ -9827,22 +9092,16 @@ Object.defineProperty(exports, "stackRedis", {
9827
9092
  return stackRedis;
9828
9093
  }
9829
9094
  });
9830
- Object.defineProperty(exports, "stageDns", {
9831
- enumerable: true,
9832
- get: function() {
9833
- return stageDns;
9834
- }
9835
- });
9836
- Object.defineProperty(exports, "stageDnsDomains", {
9095
+ Object.defineProperty(exports, "stageProviderNotes", {
9837
9096
  enumerable: true,
9838
9097
  get: function() {
9839
- return stageDnsDomains;
9098
+ return stageProviderNotes;
9840
9099
  }
9841
9100
  });
9842
- Object.defineProperty(exports, "stageProviderNotes", {
9101
+ Object.defineProperty(exports, "stageServiceDeclarations", {
9843
9102
  enumerable: true,
9844
9103
  get: function() {
9845
- return stageProviderNotes;
9104
+ return stageServiceDeclarations;
9846
9105
  }
9847
9106
  });
9848
9107
  Object.defineProperty(exports, "storageBackendFor", {
@@ -9869,12 +9128,6 @@ Object.defineProperty(exports, "store_exports", {
9869
9128
  return store_exports;
9870
9129
  }
9871
9130
  });
9872
- Object.defineProperty(exports, "suffixedBucketName", {
9873
- enumerable: true,
9874
- get: function() {
9875
- return suffixedBucketName;
9876
- }
9877
- });
9878
9131
  Object.defineProperty(exports, "suppliedOnly", {
9879
9132
  enumerable: true,
9880
9133
  get: function() {
@@ -9887,12 +9140,6 @@ Object.defineProperty(exports, "surfaceClientTraced", {
9887
9140
  return surfaceClientTraced;
9888
9141
  }
9889
9142
  });
9890
- Object.defineProperty(exports, "systemLookup", {
9891
- enumerable: true,
9892
- get: function() {
9893
- return systemLookup;
9894
- }
9895
- });
9896
9143
  Object.defineProperty(exports, "telemetryOf", {
9897
9144
  enumerable: true,
9898
9145
  get: function() {
@@ -9990,4 +9237,4 @@ Object.defineProperty(exports, "workspace_exports", {
9990
9237
  }
9991
9238
  });
9992
9239
 
9993
- //# sourceMappingURL=seeds-BCg8X36S.cjs.map
9240
+ //# sourceMappingURL=seeds-CnXkgKUv.cjs.map