@geekmidas/cli 10.0.0-alpha.177 → 10.0.0-alpha.179

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 (174) hide show
  1. package/dist/{GoDaddyProvider-Bos-4m3b.cjs → GoDaddyProvider-B9AMLUHF.cjs} +2 -2
  2. package/dist/{GoDaddyProvider-Bos-4m3b.cjs.map → GoDaddyProvider-B9AMLUHF.cjs.map} +1 -1
  3. package/dist/{GoDaddyProvider-B5Vp3PFa.mjs → GoDaddyProvider-DLVKx7er.mjs} +2 -2
  4. package/dist/{GoDaddyProvider-B5Vp3PFa.mjs.map → GoDaddyProvider-DLVKx7er.mjs.map} +1 -1
  5. package/dist/{HostingerProvider-jar5l8ck.cjs → HostingerProvider-DBPWhL_s.cjs} +2 -2
  6. package/dist/{HostingerProvider-jar5l8ck.cjs.map → HostingerProvider-DBPWhL_s.cjs.map} +1 -1
  7. package/dist/{HostingerProvider-DCg0rGXq.mjs → HostingerProvider-kLQsBCjz.mjs} +2 -2
  8. package/dist/{HostingerProvider-DCg0rGXq.mjs.map → HostingerProvider-kLQsBCjz.mjs.map} +1 -1
  9. package/dist/{LegacyStateStore-mUqUP71P.mjs → LegacyStateStore-BzUlIHvz.mjs} +2 -2
  10. package/dist/{LegacyStateStore-mUqUP71P.mjs.map → LegacyStateStore-BzUlIHvz.mjs.map} +1 -1
  11. package/dist/{LegacyStateStore-qUlI9q4J.cjs → LegacyStateStore-C7FFaVce.cjs} +2 -2
  12. package/dist/{LegacyStateStore-qUlI9q4J.cjs.map → LegacyStateStore-C7FFaVce.cjs.map} +1 -1
  13. package/dist/{LocalStateStore-C8KQoWQ4.cjs → LocalStateStore-BJQvLCrg.cjs} +2 -2
  14. package/dist/{LocalStateStore-C8KQoWQ4.cjs.map → LocalStateStore-BJQvLCrg.cjs.map} +1 -1
  15. package/dist/{LocalStateStore-B3BGSP9X.mjs → LocalStateStore-BvI8RUtS.mjs} +2 -2
  16. package/dist/{LocalStateStore-B3BGSP9X.mjs.map → LocalStateStore-BvI8RUtS.mjs.map} +1 -1
  17. package/dist/{S3StateStore-Bb_pR9qR.cjs → S3StateStore-C1ZX1w5v.cjs} +4 -4
  18. package/dist/{S3StateStore-Bb_pR9qR.cjs.map → S3StateStore-C1ZX1w5v.cjs.map} +1 -1
  19. package/dist/{S3StateStore-BrXQgGqq.mjs → S3StateStore-DYQSxiVw.mjs} +4 -4
  20. package/dist/{S3StateStore-BrXQgGqq.mjs.map → S3StateStore-DYQSxiVw.mjs.map} +1 -1
  21. package/dist/{SSMStateStore-B8Opl_On.mjs → SSMStateStore-DWQk17j8.mjs} +2 -2
  22. package/dist/{SSMStateStore-B8Opl_On.mjs.map → SSMStateStore-DWQk17j8.mjs.map} +1 -1
  23. package/dist/{SSMStateStore-BY_I0tyB.cjs → SSMStateStore-tXnZSJxP.cjs} +2 -2
  24. package/dist/{SSMStateStore-BY_I0tyB.cjs.map → SSMStateStore-tXnZSJxP.cjs.map} +1 -1
  25. package/dist/{add-DGmk0dXQ.cjs → add-D6GloVNz.cjs} +4 -4
  26. package/dist/{add-DGmk0dXQ.cjs.map → add-D6GloVNz.cjs.map} +1 -1
  27. package/dist/{add-DLOigaYm.mjs → add-nJBUo4fT.mjs} +4 -4
  28. package/dist/{add-DLOigaYm.mjs.map → add-nJBUo4fT.mjs.map} +1 -1
  29. package/dist/{apps-CyfjJh6v.cjs → apps-DPw1i9E7.cjs} +14 -6
  30. package/dist/apps-DPw1i9E7.cjs.map +1 -0
  31. package/dist/{apps-G1Q2j-fs.mjs → apps-GDmO_v7v.mjs} +15 -7
  32. package/dist/apps-GDmO_v7v.mjs.map +1 -0
  33. package/dist/{bundler-8pVRVXVZ.mjs → bundler-BFGjH_mQ.mjs} +6 -6
  34. package/dist/{bundler-8pVRVXVZ.mjs.map → bundler-BFGjH_mQ.mjs.map} +1 -1
  35. package/dist/{bundler-y6p6zWLI.cjs → bundler-DzN34D-8.cjs} +6 -6
  36. package/dist/{bundler-y6p6zWLI.cjs.map → bundler-DzN34D-8.cjs.map} +1 -1
  37. package/dist/{cli-_yRVgYDB.cjs → cli-CVlkduxS.cjs} +4 -4
  38. package/dist/{cli-_yRVgYDB.cjs.map → cli-CVlkduxS.cjs.map} +1 -1
  39. package/dist/{cli-SNWyT6q5.mjs → cli-Ik7ar-Ux.mjs} +4 -4
  40. package/dist/{cli-SNWyT6q5.mjs.map → cli-Ik7ar-Ux.mjs.map} +1 -1
  41. package/dist/{compose-CNDZELiP.cjs → compose-BKLJMnDI.cjs} +6 -8
  42. package/dist/compose-BKLJMnDI.cjs.map +1 -0
  43. package/dist/{compose-CNEv5lGg.cjs → compose-CE0Vi7zq.cjs} +10 -8
  44. package/dist/compose-CE0Vi7zq.cjs.map +1 -0
  45. package/dist/{compose-D_shZ1mI.mjs → compose-DH1ToGh2.mjs} +7 -9
  46. package/dist/compose-DH1ToGh2.mjs.map +1 -0
  47. package/dist/{compose-X-ZypRKX.mjs → compose-pFnSi3Zf.mjs} +10 -8
  48. package/dist/compose-pFnSi3Zf.mjs.map +1 -0
  49. package/dist/{dbTunnel-Cw8zODrt.cjs → dbTunnel-BnacLKDV.cjs} +6 -6
  50. package/dist/{dbTunnel-Cw8zODrt.cjs.map → dbTunnel-BnacLKDV.cjs.map} +1 -1
  51. package/dist/{dbTunnel-B3TEZuFY.mjs → dbTunnel-CqDaxQig.mjs} +6 -6
  52. package/dist/{dbTunnel-B3TEZuFY.mjs.map → dbTunnel-CqDaxQig.mjs.map} +1 -1
  53. package/dist/deploy/public.cjs +10 -10
  54. package/dist/deploy/public.mjs +10 -10
  55. package/dist/{deploy-DFul9UAF.mjs → deploy-CpAkrZ25.mjs} +17 -16
  56. package/dist/deploy-CpAkrZ25.mjs.map +1 -0
  57. package/dist/{deploy-OPNZJCUm.cjs → deploy-l0Vc846k.cjs} +17 -16
  58. package/dist/deploy-l0Vc846k.cjs.map +1 -0
  59. package/dist/{destroy-DbOw1hTz.cjs → destroy-DtAqmjGz.cjs} +7 -7
  60. package/dist/{destroy-DbOw1hTz.cjs.map → destroy-DtAqmjGz.cjs.map} +1 -1
  61. package/dist/{destroy-C9c6S9oI.mjs → destroy-eeB_PrmN.mjs} +7 -7
  62. package/dist/{destroy-C9c6S9oI.mjs.map → destroy-eeB_PrmN.mjs.map} +1 -1
  63. package/dist/{dns-BM2DE6jt.mjs → dns-B2vsk2Rc.mjs} +5 -5
  64. package/dist/{dns-BM2DE6jt.mjs.map → dns-B2vsk2Rc.mjs.map} +1 -1
  65. package/dist/{dns-_WH7kO9x.cjs → dns-WneRa4VJ.cjs} +5 -5
  66. package/dist/{dns-_WH7kO9x.cjs.map → dns-WneRa4VJ.cjs.map} +1 -1
  67. package/dist/{docker-wE0zDnhu.cjs → docker-Dk6p33pD.cjs} +5 -5
  68. package/dist/docker-Dk6p33pD.cjs.map +1 -0
  69. package/dist/{docker-DCtw3rjP.mjs → docker-DyUpcwqy.mjs} +6 -6
  70. package/dist/{docker-DCtw3rjP.mjs.map → docker-DyUpcwqy.mjs.map} +1 -1
  71. package/dist/{dokploy-CCDXCzTa.cjs → dokploy-Byg0zr1O.cjs} +2 -2
  72. package/dist/{dokploy-CCDXCzTa.cjs.map → dokploy-Byg0zr1O.cjs.map} +1 -1
  73. package/dist/{dokploy-DeXtesSz.mjs → dokploy-De5b47YI.mjs} +2 -2
  74. package/dist/{dokploy-DeXtesSz.mjs.map → dokploy-De5b47YI.mjs.map} +1 -1
  75. package/dist/{eas-DfJbfJOE.mjs → eas-BnLaz86I.mjs} +2 -2
  76. package/dist/{eas-DfJbfJOE.mjs.map → eas-BnLaz86I.mjs.map} +1 -1
  77. package/dist/{eas-Ct9AE935.cjs → eas-DAH6D89J.cjs} +2 -2
  78. package/dist/{eas-Ct9AE935.cjs.map → eas-DAH6D89J.cjs.map} +1 -1
  79. package/dist/{encryption-DDkv3EFD.cjs → encryption-D7u_SKqz.cjs} +2 -2
  80. package/dist/{encryption-DDkv3EFD.cjs.map → encryption-D7u_SKqz.cjs.map} +1 -1
  81. package/dist/{encryption-BgLW4Tb2.mjs → encryption-IiDQJs6j.mjs} +2 -2
  82. package/dist/{encryption-BgLW4Tb2.mjs.map → encryption-IiDQJs6j.mjs.map} +1 -1
  83. package/dist/{engine-CKkCaRAd.mjs → engine-BhS-wyH0.mjs} +8 -8
  84. package/dist/{engine-CKkCaRAd.mjs.map → engine-BhS-wyH0.mjs.map} +1 -1
  85. package/dist/{engine-CINx5LA_.cjs → engine-CaWo9tZO.cjs} +8 -8
  86. package/dist/{engine-CINx5LA_.cjs.map → engine-CaWo9tZO.cjs.map} +1 -1
  87. package/dist/{github-BORbm5Kn.mjs → github-BQCqBMZ9.mjs} +6 -6
  88. package/dist/{github-BORbm5Kn.mjs.map → github-BQCqBMZ9.mjs.map} +1 -1
  89. package/dist/{github-DsmDwi7a.cjs → github-Cz_LTqBn.cjs} +6 -6
  90. package/dist/{github-DsmDwi7a.cjs.map → github-Cz_LTqBn.cjs.map} +1 -1
  91. package/dist/{googlePlay-bh7gEiz4.cjs → googlePlay-CuqPxtno.cjs} +4 -4
  92. package/dist/{googlePlay-bh7gEiz4.cjs.map → googlePlay-CuqPxtno.cjs.map} +1 -1
  93. package/dist/{googlePlay-Dk53obw3.mjs → googlePlay-DowNo3wp.mjs} +4 -4
  94. package/dist/{googlePlay-Dk53obw3.mjs.map → googlePlay-DowNo3wp.mjs.map} +1 -1
  95. package/dist/index.cjs +61 -61
  96. package/dist/index.cjs.map +1 -1
  97. package/dist/index.mjs +61 -61
  98. package/dist/index.mjs.map +1 -1
  99. package/dist/{local-CpSldDSi.mjs → local-BQQHvZ4q.mjs} +2 -2
  100. package/dist/{local-CpSldDSi.mjs.map → local-BQQHvZ4q.mjs.map} +1 -1
  101. package/dist/{local-BObpR_rL.cjs → local-CWNFE8Sg.cjs} +2 -2
  102. package/dist/{local-BObpR_rL.cjs.map → local-CWNFE8Sg.cjs.map} +1 -1
  103. package/dist/{migrate-B-O5VhwA.cjs → migrate-8QGCWIqm.cjs} +4 -4
  104. package/dist/{migrate-B-O5VhwA.cjs.map → migrate-8QGCWIqm.cjs.map} +1 -1
  105. package/dist/{migrate-BClTCUdZ.cjs → migrate-CNrPM5zg.cjs} +2 -2
  106. package/dist/{migrate-BClTCUdZ.cjs.map → migrate-CNrPM5zg.cjs.map} +1 -1
  107. package/dist/{migrate-FatDUatE.mjs → migrate-CqiOiRvz.mjs} +4 -4
  108. package/dist/{migrate-FatDUatE.mjs.map → migrate-CqiOiRvz.mjs.map} +1 -1
  109. package/dist/{migrate-ChURsPXl.mjs → migrate-D_7oRThu.mjs} +2 -2
  110. package/dist/{migrate-ChURsPXl.mjs.map → migrate-D_7oRThu.mjs.map} +1 -1
  111. package/dist/{notes-BwBGVMYR.mjs → notes-D2KWnUSL.mjs} +2 -2
  112. package/dist/{notes-BwBGVMYR.mjs.map → notes-D2KWnUSL.mjs.map} +1 -1
  113. package/dist/{notes-jaDD8Vda.cjs → notes-dD3gRvZw.cjs} +2 -2
  114. package/dist/{notes-jaDD8Vda.cjs.map → notes-dD3gRvZw.cjs.map} +1 -1
  115. package/dist/{projectBucket-CgGk1Nd_.mjs → projectBucket-BDytiu7A.mjs} +2 -2
  116. package/dist/{projectBucket-CgGk1Nd_.mjs.map → projectBucket-BDytiu7A.mjs.map} +1 -1
  117. package/dist/{projectBucket-CEDRY3N2.cjs → projectBucket-BcTodL8A.cjs} +2 -2
  118. package/dist/{projectBucket-CEDRY3N2.cjs.map → projectBucket-BcTodL8A.cjs.map} +1 -1
  119. package/dist/{publish-CG9ooEnS.mjs → publish-Cr8wv7nO.mjs} +2 -2
  120. package/dist/{publish-CG9ooEnS.mjs.map → publish-Cr8wv7nO.mjs.map} +1 -1
  121. package/dist/{publish-oCdqimOZ.cjs → publish-Da9gxP5Q.cjs} +2 -2
  122. package/dist/{publish-oCdqimOZ.cjs.map → publish-Da9gxP5Q.cjs.map} +1 -1
  123. package/dist/{resolve-XaHTbLJ0.cjs → resolve-DRldmRYb.cjs} +4 -4
  124. package/dist/{resolve-XaHTbLJ0.cjs.map → resolve-DRldmRYb.cjs.map} +1 -1
  125. package/dist/{resolve-DGSN4f-J.mjs → resolve-Dyki9ZJX.mjs} +4 -4
  126. package/dist/{resolve-DGSN4f-J.mjs.map → resolve-Dyki9ZJX.mjs.map} +1 -1
  127. package/dist/{rollback-xiYg-iz_.mjs → rollback-Do0i6x3b.mjs} +5 -5
  128. package/dist/{rollback-xiYg-iz_.mjs.map → rollback-Do0i6x3b.mjs.map} +1 -1
  129. package/dist/{rollback-DQl_hh1s.cjs → rollback-R_j7f9cY.cjs} +5 -5
  130. package/dist/{rollback-DQl_hh1s.cjs.map → rollback-R_j7f9cY.cjs.map} +1 -1
  131. package/dist/{s3-CQqDhnF-.mjs → s3-CYEU7r1x.mjs} +2 -2
  132. package/dist/{s3-CQqDhnF-.mjs.map → s3-CYEU7r1x.mjs.map} +1 -1
  133. package/dist/{s3-CB4ekfza.cjs → s3-D9aPMh9u.cjs} +2 -2
  134. package/dist/{s3-CB4ekfza.cjs.map → s3-D9aPMh9u.cjs.map} +1 -1
  135. package/dist/{serverSetup-B0ZqkKcY.cjs → serverSetup-BmPwcMQN.cjs} +5 -5
  136. package/dist/{serverSetup-B0ZqkKcY.cjs.map → serverSetup-BmPwcMQN.cjs.map} +1 -1
  137. package/dist/{serverSetup-DWUQ_sQR.mjs → serverSetup-Bw5gc57O.mjs} +5 -5
  138. package/dist/{serverSetup-DWUQ_sQR.mjs.map → serverSetup-Bw5gc57O.mjs.map} +1 -1
  139. package/dist/{sniffer-BVmzTN9C.cjs → sniffer-BPLYWu70.cjs} +6 -6
  140. package/dist/{sniffer-BVmzTN9C.cjs.map → sniffer-BPLYWu70.cjs.map} +1 -1
  141. package/dist/{sniffer-CkSC8MZ9.mjs → sniffer-XsTiFI3l.mjs} +6 -6
  142. package/dist/{sniffer-CkSC8MZ9.mjs.map → sniffer-XsTiFI3l.mjs.map} +1 -1
  143. package/dist/{snsSubscriptions-DOUaur2w.cjs → snsSubscriptions-CATtZwGv.cjs} +50 -10
  144. package/dist/{snsSubscriptions-DOUaur2w.cjs.map → snsSubscriptions-CATtZwGv.cjs.map} +1 -1
  145. package/dist/{snsSubscriptions-CdbBWvzg.mjs → snsSubscriptions-D9Rm_Eug.mjs} +39 -11
  146. package/dist/{snsSubscriptions-CdbBWvzg.mjs.map → snsSubscriptions-D9Rm_Eug.mjs.map} +1 -1
  147. package/dist/{sst-r4pOOAkf.mjs → sst-BCvYZtVF.mjs} +4 -4
  148. package/dist/{sst-r4pOOAkf.mjs.map → sst-BCvYZtVF.mjs.map} +1 -1
  149. package/dist/{sst-3iKqe9vk.cjs → sst-C56i2cst.cjs} +4 -4
  150. package/dist/{sst-3iKqe9vk.cjs.map → sst-C56i2cst.cjs.map} +1 -1
  151. package/dist/{stack-DUADq62v.cjs → stack-Dal2Oq2D.cjs} +6 -6
  152. package/dist/{stack-DUADq62v.cjs.map → stack-Dal2Oq2D.cjs.map} +1 -1
  153. package/dist/{stack-LelP4jv7.mjs → stack-TttsEL7X.mjs} +6 -6
  154. package/dist/{stack-LelP4jv7.mjs.map → stack-TttsEL7X.mjs.map} +1 -1
  155. package/dist/{stage-DQuJRU3S.mjs → stage--ixwLSTc.mjs} +5 -5
  156. package/dist/{stage-DQuJRU3S.mjs.map → stage--ixwLSTc.mjs.map} +1 -1
  157. package/dist/{stage-BwY2DLIb.cjs → stage-BLsuXUP_.cjs} +5 -5
  158. package/dist/{stage-BwY2DLIb.cjs.map → stage-BLsuXUP_.cjs.map} +1 -1
  159. package/dist/target/public.cjs +1 -1
  160. package/dist/target/public.mjs +1 -1
  161. package/dist/{terminal-EeBAmc7P.cjs → terminal-Dy4zzTCA.cjs} +2 -2
  162. package/dist/{terminal-EeBAmc7P.cjs.map → terminal-Dy4zzTCA.cjs.map} +1 -1
  163. package/dist/{terminal-BTX6f2XO.mjs → terminal-gOLDmpW-.mjs} +2 -2
  164. package/dist/{terminal-BTX6f2XO.mjs.map → terminal-gOLDmpW-.mjs.map} +1 -1
  165. package/package.json +15 -15
  166. package/dist/apps-CyfjJh6v.cjs.map +0 -1
  167. package/dist/apps-G1Q2j-fs.mjs.map +0 -1
  168. package/dist/compose-CNDZELiP.cjs.map +0 -1
  169. package/dist/compose-CNEv5lGg.cjs.map +0 -1
  170. package/dist/compose-D_shZ1mI.mjs.map +0 -1
  171. package/dist/compose-X-ZypRKX.mjs.map +0 -1
  172. package/dist/deploy-DFul9UAF.mjs.map +0 -1
  173. package/dist/deploy-OPNZJCUm.cjs.map +0 -1
  174. package/dist/docker-wE0zDnhu.cjs.map +0 -1
@@ -1,9 +1,9 @@
1
1
  const require_errors = require("./errors-DMC4Umsb.cjs");
2
- const require_compose = require("./compose-CNEv5lGg.cjs");
3
- const require_apps = require("./apps-CyfjJh6v.cjs");
4
- const require_compose$1 = require("./compose-CNDZELiP.cjs");
5
- const require_stack = require("./stack-DUADq62v.cjs");
6
- const require_stage = require("./stage-BwY2DLIb.cjs");
2
+ const require_compose = require("./compose-CE0Vi7zq.cjs");
3
+ const require_apps = require("./apps-DPw1i9E7.cjs");
4
+ const require_compose$1 = require("./compose-BKLJMnDI.cjs");
5
+ const require_stack = require("./stack-Dal2Oq2D.cjs");
6
+ const require_stage = require("./stage-BLsuXUP_.cjs");
7
7
  let _geekmidas_manifest = require("@geekmidas/manifest");
8
8
  //#region src/exec/dbTunnel.ts
9
9
  /**
@@ -151,4 +151,4 @@ async function dbTunnel(options, deps = defaultDbTunnelDeps) {
151
151
  //#endregion
152
152
  exports.dbTunnel = dbTunnel;
153
153
 
154
- //# sourceMappingURL=dbTunnel-Cw8zODrt.cjs.map
154
+ //# sourceMappingURL=dbTunnel-BnacLKDV.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dbTunnel-Cw8zODrt.cjs","names":["GkmError","LOOPBACK_SERVICES","envFor","primaryPortKey","isDatabase","providedKeyFor","defaultStageExecDeps","loadStage","ExecNotConfirmed","stageServer","dockerHost"],"sources":["../src/exec/dbTunnel.ts"],"sourcesContent":["/**\n * `gkm db:tunnel --stage <stage> [construct]`: a deployed compose stage's\n * Postgres, on this machine's loopback, and each database's owner login to\n * sign in to it with — for a SQL client, a one-off fix, a look at the data.\n *\n * The tunnel is the deploy's own: SSH on the deploy's login to the port the\n * server publishes Postgres on, its loopback alone. The owner URL is the one\n * the deploy migrates with, derived from the stage's secrets the way the\n * deploy derives it — nothing is stored, and nothing is written to disk.\n *\n * It is the owner, not the app's login, because that is what a person\n * changing the schema or its data by hand needs; it is printed, not injected,\n * because a GUI client is not a process gkm starts. `gkm exec --stage` stays\n * the app's login: what a script runs as is what the app runs as.\n */\n\nimport { providedKeyFor } from '@geekmidas/manifest';\nimport { dockerHost } from '../compose/server.js';\nimport type { ComposeStack } from '../compose/stack.js';\nimport { LOOPBACK_SERVICES } from '../compose/stack.js';\nimport { GkmError } from '../errors';\nimport { primaryPortKey } from '../reconcile/containers.js';\nimport { envFor, isDatabase } from '../reconcile/env.js';\nimport {\n\tdefaultStageExecDeps,\n\tExecNotConfirmed,\n\tloadStage,\n\ttype StageExecDeps,\n\ttype StageExecOptions,\n\tstageServer,\n} from './stage.js';\n\nconst logger = console;\n\n/** The stage's stack runs no Postgres: there is nothing to tunnel to. */\nexport class StageHasNoDatabase extends GkmError {\n\tconstructor(readonly stage: string) {\n\t\tsuper(\n\t\t\t`'${stage}' runs no Postgres, so there is no database to tunnel to. ` +\n\t\t\t\t'Declare a Database construct and deploy the stage.',\n\t\t);\n\t\tthis.name = 'StageHasNoDatabase';\n\t}\n}\n\n/** The construct asked for is not one of the stage's databases. */\nexport class DatabaseNotInStage extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly construct: string,\n\t\treadonly databases: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`'${construct}' is not a database '${stage}' runs. Its databases are ` +\n\t\t\t\t`${databases.join(', ')}: gkm db:tunnel --stage ${stage} ` +\n\t\t\t\t`${databases[0] ?? '<construct>'}.`,\n\t\t);\n\t\tthis.name = 'DatabaseNotInStage';\n\t}\n}\n\n/** The server publishes no Postgres: the stack is not running there. */\nexport class DatabaseNotPublished extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly project: string,\n\t) {\n\t\tsuper(\n\t\t\t`No running ${project} postgres publishes ${LOOPBACK_SERVICES.postgres} ` +\n\t\t\t\t`on '${stage}'s server, so there is nothing to tunnel to. Deploy the ` +\n\t\t\t\t`stage (gkm deploy --stage ${stage}), then run this again.`,\n\t\t);\n\t\tthis.name = 'DatabaseNotPublished';\n\t}\n}\n\n/** A database's owner login, as this machine reaches it. */\nexport interface OwnerLogin {\n\t/** The construct's id. */\n\tconstruct: string;\n\t/** The key the deploy's migrations read it from. */\n\tkey: string;\n\turl: string;\n}\n\n/** A login's URL as a SQL client's form asks for it, field by field. */\nexport function loginFields(url: string): [string, string][] {\n\tconst parsed = new URL(url);\n\treturn [\n\t\t['host', parsed.hostname],\n\t\t['port', parsed.port],\n\t\t['database', decodeURIComponent(parsed.pathname.slice(1))],\n\t\t['user', decodeURIComponent(parsed.username)],\n\t\t['password', decodeURIComponent(parsed.password)],\n\t];\n}\n\n/**\n * Each database's owner URL — every one, or the construct asked for — on\n * the port this machine reaches the stack's Postgres by: the same values the\n * deploy's migrations connect with (`migrateAndSeed`), from the same\n * derivation.\n *\n * @throws {DatabaseNotInStage}\n */\nexport function ownerLogins(\n\tstack: Pick<ComposeStack, 'stage' | 'plan' | 'resolution'>,\n\tport: number,\n\tconstruct?: string,\n): OwnerLogin[] {\n\tconst env = envFor(stack.plan, {\n\t\t...stack.resolution,\n\t\tports: { [primaryPortKey('postgres')]: port },\n\t});\n\tconst logins = stack.plan.resources\n\t\t.filter((resource) => isDatabase(resource.kind))\n\t\t.map((resource) => {\n\t\t\tconst key = providedKeyFor(resource.id, resource.kind, 'ownerUrl');\n\t\t\t// A database whose roles are not split has no owner: its one login\n\t\t\t// is the URL itself, and that is the one to sign in with.\n\t\t\tconst url = env[key] ?? env[resource.envKey];\n\t\t\treturn url ? { construct: resource.id, key, url } : undefined;\n\t\t})\n\t\t.filter((login): login is OwnerLogin => login !== undefined);\n\n\tif (construct === undefined) return logins;\n\tconst asked = logins.filter((login) => login.construct === construct);\n\tif (asked.length === 0) {\n\t\tthrow new DatabaseNotInStage(\n\t\t\tstack.stage,\n\t\t\tconstruct,\n\t\t\tlogins.map((login) => login.construct),\n\t\t);\n\t}\n\treturn asked;\n}\n\nexport interface DbTunnelOptions\n\textends Pick<\n\t\tStageExecOptions,\n\t\t'stage' | 'profile' | 'sshUser' | 'yes' | 'cwd'\n\t> {\n\t/** One database construct, by id. Every one when absent. */\n\tconstruct?: string;\n}\n\nexport interface DbTunnelDeps extends StageExecDeps {\n\t/** Resolves when the tunnel should close: Ctrl-C, by default. */\n\theld: () => Promise<void>;\n}\n\n/** Until the person presses Ctrl-C, or the process is told to stop. */\nfunction untilInterrupted(): Promise<void> {\n\treturn new Promise((resolve) => {\n\t\tconst stop = () => {\n\t\t\tprocess.off('SIGINT', stop);\n\t\t\tprocess.off('SIGTERM', stop);\n\t\t\tresolve();\n\t\t};\n\t\tprocess.on('SIGINT', stop);\n\t\tprocess.on('SIGTERM', stop);\n\t});\n}\n\nexport const defaultDbTunnelDeps: DbTunnelDeps = {\n\t...defaultStageExecDeps,\n\theld: untilInterrupted,\n};\n\n/**\n * Open a tunnel to the stage's Postgres, print each database's owner URL\n * through it, and hold it open until `deps.held` resolves. The tunnel is\n * closed however that ends.\n *\n * @throws {StageHasNoDatabase}, {DatabaseNotInStage}, {DatabaseNotPublished},\n * {ExecNotConfirmed}, {ExecStageNotComposed}, {ExecStageNotDeployed},\n * {ComposeServerUnreachable}\n */\nexport async function dbTunnel(\n\toptions: DbTunnelOptions,\n\tdeps: DbTunnelDeps = defaultDbTunnelDeps,\n): Promise<OwnerLogin[]> {\n\tconst { stage } = options;\n\tconst loaded = await loadStage(options, deps.env);\n\tconst { stack } = loaded;\n\tif (!stack.infra.includes('postgres')) throw new StageHasNoDatabase(stage);\n\t// Asked here, before anything is reached: an unknown construct is said\n\t// without an SSH login. The port is a placeholder until the tunnel opens.\n\townerLogins(stack, LOOPBACK_SERVICES.postgres, options.construct);\n\n\tif (loaded.protectedStage && !options.yes) {\n\t\tconst question = `'${stage}' is a protected stage. Open a tunnel to its database as its owner?`;\n\t\tif (!(await deps.confirm(question))) throw new ExecNotConfirmed(stage);\n\t}\n\n\tconst server = stageServer(loaded, options);\n\tawait deps.server.check(server);\n\n\tconst published = await deps.docker.published(\n\t\t{ host: dockerHost(server) },\n\t\tstack.project,\n\t\t'postgres',\n\t\tLOOPBACK_SERVICES.postgres,\n\t);\n\tif (published === undefined) {\n\t\tthrow new DatabaseNotPublished(stage, stack.project);\n\t}\n\n\tconst tunnel = await deps.server.tunnel(server, published);\n\ttry {\n\t\tconst logins = ownerLogins(stack, tunnel.port, options.construct);\n\t\tlogger.log(\n\t\t\t`🚇 '${stage}' postgres → 127.0.0.1:${tunnel.port} (over SSH to ${server.host})`,\n\t\t);\n\t\tfor (const login of logins) {\n\t\t\tlogger.log(`\\n🔑 ${login.construct} (${login.key})`);\n\t\t\tlogger.log(` ${login.url}`);\n\t\t\tfor (const [field, value] of loginFields(login.url)) {\n\t\t\t\tlogger.log(` ${`${field}:`.padEnd(10)}${value}`);\n\t\t\t}\n\t\t}\n\t\tlogger.log('\\nThe tunnel is open. Press Ctrl-C to close it.');\n\t\tawait deps.held();\n\t\treturn logins;\n\t} finally {\n\t\tawait tunnel.close();\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,SAAS;;AAGf,IAAa,qBAAb,cAAwCA,eAAAA,SAAS;CAC3B;CAArB,YAAY,OAAwB;EACnC,MACC,IAAI,MAAM,6GAEX;EAJoB,KAAA,QAAA;EAKpB,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,qBAAb,cAAwCA,eAAAA,SAAS;CAEtC;CACA;CACA;CAHV,YACC,OACA,WACA,WACC;EACD,MACC,IAAI,UAAU,uB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S,MAAM,KAAK,OAAO,OAAO,QAAQ,SAAS;CACzD,IAAI;EACH,MAAM,SAAS,YAAY,OAAO,OAAO,MAAM,QAAQ,SAAS;EAChE,OAAO,IACN,OAAO,MAAM,yBAAyB,OAAO,KAAK,gBAAgB,OAAO,KAAK,EAC/E;EACA,KAAK,MAAM,SAAS,QAAQ;GAC3B,OAAO,IAAI,QAAQ,MAAM,UAAU,IAAI,MAAM,IAAI,EAAE;GACnD,OAAO,IAAI,MAAM,MAAM,KAAK;GAC5B,KAAK,MAAM,CAAC,OAAO,UAAU,YAAY,MAAM,GAAG,GACjD,OAAO,IAAI,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,IAAI,OAAO;EAEnD;EACA,OAAO,IAAI,iDAAiD;EAC5D,MAAM,KAAK,KAAK;EAChB,OAAO;CACR,UAAU;EACT,MAAM,OAAO,MAAM;CACpB;AACD"}
1
+ {"version":3,"file":"dbTunnel-BnacLKDV.cjs","names":["GkmError","LOOPBACK_SERVICES","envFor","primaryPortKey","isDatabase","providedKeyFor","defaultStageExecDeps","loadStage","ExecNotConfirmed","stageServer","dockerHost"],"sources":["../src/exec/dbTunnel.ts"],"sourcesContent":["/**\n * `gkm db:tunnel --stage <stage> [construct]`: a deployed compose stage's\n * Postgres, on this machine's loopback, and each database's owner login to\n * sign in to it with — for a SQL client, a one-off fix, a look at the data.\n *\n * The tunnel is the deploy's own: SSH on the deploy's login to the port the\n * server publishes Postgres on, its loopback alone. The owner URL is the one\n * the deploy migrates with, derived from the stage's secrets the way the\n * deploy derives it — nothing is stored, and nothing is written to disk.\n *\n * It is the owner, not the app's login, because that is what a person\n * changing the schema or its data by hand needs; it is printed, not injected,\n * because a GUI client is not a process gkm starts. `gkm exec --stage` stays\n * the app's login: what a script runs as is what the app runs as.\n */\n\nimport { providedKeyFor } from '@geekmidas/manifest';\nimport { dockerHost } from '../compose/server.js';\nimport type { ComposeStack } from '../compose/stack.js';\nimport { LOOPBACK_SERVICES } from '../compose/stack.js';\nimport { GkmError } from '../errors';\nimport { primaryPortKey } from '../reconcile/containers.js';\nimport { envFor, isDatabase } from '../reconcile/env.js';\nimport {\n\tdefaultStageExecDeps,\n\tExecNotConfirmed,\n\tloadStage,\n\ttype StageExecDeps,\n\ttype StageExecOptions,\n\tstageServer,\n} from './stage.js';\n\nconst logger = console;\n\n/** The stage's stack runs no Postgres: there is nothing to tunnel to. */\nexport class StageHasNoDatabase extends GkmError {\n\tconstructor(readonly stage: string) {\n\t\tsuper(\n\t\t\t`'${stage}' runs no Postgres, so there is no database to tunnel to. ` +\n\t\t\t\t'Declare a Database construct and deploy the stage.',\n\t\t);\n\t\tthis.name = 'StageHasNoDatabase';\n\t}\n}\n\n/** The construct asked for is not one of the stage's databases. */\nexport class DatabaseNotInStage extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly construct: string,\n\t\treadonly databases: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`'${construct}' is not a database '${stage}' runs. Its databases are ` +\n\t\t\t\t`${databases.join(', ')}: gkm db:tunnel --stage ${stage} ` +\n\t\t\t\t`${databases[0] ?? '<construct>'}.`,\n\t\t);\n\t\tthis.name = 'DatabaseNotInStage';\n\t}\n}\n\n/** The server publishes no Postgres: the stack is not running there. */\nexport class DatabaseNotPublished extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly project: string,\n\t) {\n\t\tsuper(\n\t\t\t`No running ${project} postgres publishes ${LOOPBACK_SERVICES.postgres} ` +\n\t\t\t\t`on '${stage}'s server, so there is nothing to tunnel to. Deploy the ` +\n\t\t\t\t`stage (gkm deploy --stage ${stage}), then run this again.`,\n\t\t);\n\t\tthis.name = 'DatabaseNotPublished';\n\t}\n}\n\n/** A database's owner login, as this machine reaches it. */\nexport interface OwnerLogin {\n\t/** The construct's id. */\n\tconstruct: string;\n\t/** The key the deploy's migrations read it from. */\n\tkey: string;\n\turl: string;\n}\n\n/** A login's URL as a SQL client's form asks for it, field by field. */\nexport function loginFields(url: string): [string, string][] {\n\tconst parsed = new URL(url);\n\treturn [\n\t\t['host', parsed.hostname],\n\t\t['port', parsed.port],\n\t\t['database', decodeURIComponent(parsed.pathname.slice(1))],\n\t\t['user', decodeURIComponent(parsed.username)],\n\t\t['password', decodeURIComponent(parsed.password)],\n\t];\n}\n\n/**\n * Each database's owner URL — every one, or the construct asked for — on\n * the port this machine reaches the stack's Postgres by: the same values the\n * deploy's migrations connect with (`migrateAndSeed`), from the same\n * derivation.\n *\n * @throws {DatabaseNotInStage}\n */\nexport function ownerLogins(\n\tstack: Pick<ComposeStack, 'stage' | 'plan' | 'resolution'>,\n\tport: number,\n\tconstruct?: string,\n): OwnerLogin[] {\n\tconst env = envFor(stack.plan, {\n\t\t...stack.resolution,\n\t\tports: { [primaryPortKey('postgres')]: port },\n\t});\n\tconst logins = stack.plan.resources\n\t\t.filter((resource) => isDatabase(resource.kind))\n\t\t.map((resource) => {\n\t\t\tconst key = providedKeyFor(resource.id, resource.kind, 'ownerUrl');\n\t\t\t// A database whose roles are not split has no owner: its one login\n\t\t\t// is the URL itself, and that is the one to sign in with.\n\t\t\tconst url = env[key] ?? env[resource.envKey];\n\t\t\treturn url ? { construct: resource.id, key, url } : undefined;\n\t\t})\n\t\t.filter((login): login is OwnerLogin => login !== undefined);\n\n\tif (construct === undefined) return logins;\n\tconst asked = logins.filter((login) => login.construct === construct);\n\tif (asked.length === 0) {\n\t\tthrow new DatabaseNotInStage(\n\t\t\tstack.stage,\n\t\t\tconstruct,\n\t\t\tlogins.map((login) => login.construct),\n\t\t);\n\t}\n\treturn asked;\n}\n\nexport interface DbTunnelOptions\n\textends Pick<\n\t\tStageExecOptions,\n\t\t'stage' | 'profile' | 'sshUser' | 'yes' | 'cwd'\n\t> {\n\t/** One database construct, by id. Every one when absent. */\n\tconstruct?: string;\n}\n\nexport interface DbTunnelDeps extends StageExecDeps {\n\t/** Resolves when the tunnel should close: Ctrl-C, by default. */\n\theld: () => Promise<void>;\n}\n\n/** Until the person presses Ctrl-C, or the process is told to stop. */\nfunction untilInterrupted(): Promise<void> {\n\treturn new Promise((resolve) => {\n\t\tconst stop = () => {\n\t\t\tprocess.off('SIGINT', stop);\n\t\t\tprocess.off('SIGTERM', stop);\n\t\t\tresolve();\n\t\t};\n\t\tprocess.on('SIGINT', stop);\n\t\tprocess.on('SIGTERM', stop);\n\t});\n}\n\nexport const defaultDbTunnelDeps: DbTunnelDeps = {\n\t...defaultStageExecDeps,\n\theld: untilInterrupted,\n};\n\n/**\n * Open a tunnel to the stage's Postgres, print each database's owner URL\n * through it, and hold it open until `deps.held` resolves. The tunnel is\n * closed however that ends.\n *\n * @throws {StageHasNoDatabase}, {DatabaseNotInStage}, {DatabaseNotPublished},\n * {ExecNotConfirmed}, {ExecStageNotComposed}, {ExecStageNotDeployed},\n * {ComposeServerUnreachable}\n */\nexport async function dbTunnel(\n\toptions: DbTunnelOptions,\n\tdeps: DbTunnelDeps = defaultDbTunnelDeps,\n): Promise<OwnerLogin[]> {\n\tconst { stage } = options;\n\tconst loaded = await loadStage(options, deps.env);\n\tconst { stack } = loaded;\n\tif (!stack.infra.includes('postgres')) throw new StageHasNoDatabase(stage);\n\t// Asked here, before anything is reached: an unknown construct is said\n\t// without an SSH login. The port is a placeholder until the tunnel opens.\n\townerLogins(stack, LOOPBACK_SERVICES.postgres, options.construct);\n\n\tif (loaded.protectedStage && !options.yes) {\n\t\tconst question = `'${stage}' is a protected stage. Open a tunnel to its database as its owner?`;\n\t\tif (!(await deps.confirm(question))) throw new ExecNotConfirmed(stage);\n\t}\n\n\tconst server = stageServer(loaded, options);\n\tawait deps.server.check(server);\n\n\tconst published = await deps.docker.published(\n\t\t{ host: dockerHost(server) },\n\t\tstack.project,\n\t\t'postgres',\n\t\tLOOPBACK_SERVICES.postgres,\n\t);\n\tif (published === undefined) {\n\t\tthrow new DatabaseNotPublished(stage, stack.project);\n\t}\n\n\tconst tunnel = await deps.server.tunnel(server, published);\n\ttry {\n\t\tconst logins = ownerLogins(stack, tunnel.port, options.construct);\n\t\tlogger.log(\n\t\t\t`🚇 '${stage}' postgres → 127.0.0.1:${tunnel.port} (over SSH to ${server.host})`,\n\t\t);\n\t\tfor (const login of logins) {\n\t\t\tlogger.log(`\\n🔑 ${login.construct} (${login.key})`);\n\t\t\tlogger.log(` ${login.url}`);\n\t\t\tfor (const [field, value] of loginFields(login.url)) {\n\t\t\t\tlogger.log(` ${`${field}:`.padEnd(10)}${value}`);\n\t\t\t}\n\t\t}\n\t\tlogger.log('\\nThe tunnel is open. Press Ctrl-C to close it.');\n\t\tawait deps.held();\n\t\treturn logins;\n\t} finally {\n\t\tawait tunnel.close();\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,SAAS;;AAGf,IAAa,qBAAb,cAAwCA,eAAAA,SAAS;CAC3B;CAArB,YAAY,OAAwB;EACnC,MACC,IAAI,MAAM,6GAEX;EAJoB,KAAA,QAAA;EAKpB,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,qBAAb,cAAwCA,eAAAA,SAAS;CAEtC;CACA;CACA;CAHV,YACC,OACA,WACA,WACC;EACD,MACC,IAAI,UAAU,uBAAuB,MAAM,4BACvC,UAAU,KAAK,IAAI,EAAE,0BAA0B,MAAM,GACrD,UAAU,MAAM,cAAc,EACnC;EARS,KAAA,QAAA;EACA,KAAA,YAAA;EACA,KAAA,YAAA;EAOT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,uBAAb,cAA0CA,eAAAA,SAAS;CAExC;CACA;CAFV,YACC,OACA,SACC;EACD,MACC,cAAc,QAAQ,sBAAsBC,cAAAA,kBAAkB,SAAS,OAC/D,MAAM,oFACgB,MAAM,wBACrC;EAPS,KAAA,QAAA;EACA,KAAA,UAAA;EAOT,KAAK,OAAO;CACb;AACD;;AAYA,SAAgB,YAAY,KAAiC;CAC5D,MAAM,SAAS,IAAI,IAAI,GAAG;CAC1B,OAAO;EACN,CAAC,QAAQ,OAAO,QAAQ;EACxB,CAAC,Q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;EACT,MAAM,OAAO,MAAM;CACpB;AACD"}
@@ -1,9 +1,9 @@
1
1
  import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
2
- import { p as dockerHost } from "./compose-X-ZypRKX.mjs";
3
- import { Dt as envFor, Ot as isDatabase } from "./apps-G1Q2j-fs.mjs";
4
- import { dt as primaryPortKey } from "./compose-D_shZ1mI.mjs";
5
- import { i as LOOPBACK_SERVICES } from "./stack-LelP4jv7.mjs";
6
- import { i as stageServer, n as defaultStageExecDeps, r as loadStage, t as ExecNotConfirmed } from "./stage-DQuJRU3S.mjs";
2
+ import { p as dockerHost } from "./compose-pFnSi3Zf.mjs";
3
+ import { Dt as envFor, Ot as isDatabase } from "./apps-GDmO_v7v.mjs";
4
+ import { dt as primaryPortKey } from "./compose-DH1ToGh2.mjs";
5
+ import { i as LOOPBACK_SERVICES } from "./stack-TttsEL7X.mjs";
6
+ import { i as stageServer, n as defaultStageExecDeps, r as loadStage, t as ExecNotConfirmed } from "./stage--ixwLSTc.mjs";
7
7
  import { providedKeyFor } from "@geekmidas/manifest";
8
8
  //#region src/exec/dbTunnel.ts
9
9
  /**
@@ -151,4 +151,4 @@ async function dbTunnel(options, deps = defaultDbTunnelDeps) {
151
151
  //#endregion
152
152
  export { dbTunnel };
153
153
 
154
- //# sourceMappingURL=dbTunnel-B3TEZuFY.mjs.map
154
+ //# sourceMappingURL=dbTunnel-CqDaxQig.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dbTunnel-B3TEZuFY.mjs","names":[],"sources":["../src/exec/dbTunnel.ts"],"sourcesContent":["/**\n * `gkm db:tunnel --stage <stage> [construct]`: a deployed compose stage's\n * Postgres, on this machine's loopback, and each database's owner login to\n * sign in to it with — for a SQL client, a one-off fix, a look at the data.\n *\n * The tunnel is the deploy's own: SSH on the deploy's login to the port the\n * server publishes Postgres on, its loopback alone. The owner URL is the one\n * the deploy migrates with, derived from the stage's secrets the way the\n * deploy derives it — nothing is stored, and nothing is written to disk.\n *\n * It is the owner, not the app's login, because that is what a person\n * changing the schema or its data by hand needs; it is printed, not injected,\n * because a GUI client is not a process gkm starts. `gkm exec --stage` stays\n * the app's login: what a script runs as is what the app runs as.\n */\n\nimport { providedKeyFor } from '@geekmidas/manifest';\nimport { dockerHost } from '../compose/server.js';\nimport type { ComposeStack } from '../compose/stack.js';\nimport { LOOPBACK_SERVICES } from '../compose/stack.js';\nimport { GkmError } from '../errors';\nimport { primaryPortKey } from '../reconcile/containers.js';\nimport { envFor, isDatabase } from '../reconcile/env.js';\nimport {\n\tdefaultStageExecDeps,\n\tExecNotConfirmed,\n\tloadStage,\n\ttype StageExecDeps,\n\ttype StageExecOptions,\n\tstageServer,\n} from './stage.js';\n\nconst logger = console;\n\n/** The stage's stack runs no Postgres: there is nothing to tunnel to. */\nexport class StageHasNoDatabase extends GkmError {\n\tconstructor(readonly stage: string) {\n\t\tsuper(\n\t\t\t`'${stage}' runs no Postgres, so there is no database to tunnel to. ` +\n\t\t\t\t'Declare a Database construct and deploy the stage.',\n\t\t);\n\t\tthis.name = 'StageHasNoDatabase';\n\t}\n}\n\n/** The construct asked for is not one of the stage's databases. */\nexport class DatabaseNotInStage extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly construct: string,\n\t\treadonly databases: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`'${construct}' is not a database '${stage}' runs. Its databases are ` +\n\t\t\t\t`${databases.join(', ')}: gkm db:tunnel --stage ${stage} ` +\n\t\t\t\t`${databases[0] ?? '<construct>'}.`,\n\t\t);\n\t\tthis.name = 'DatabaseNotInStage';\n\t}\n}\n\n/** The server publishes no Postgres: the stack is not running there. */\nexport class DatabaseNotPublished extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly project: string,\n\t) {\n\t\tsuper(\n\t\t\t`No running ${project} postgres publishes ${LOOPBACK_SERVICES.postgres} ` +\n\t\t\t\t`on '${stage}'s server, so there is nothing to tunnel to. Deploy the ` +\n\t\t\t\t`stage (gkm deploy --stage ${stage}), then run this again.`,\n\t\t);\n\t\tthis.name = 'DatabaseNotPublished';\n\t}\n}\n\n/** A database's owner login, as this machine reaches it. */\nexport interface OwnerLogin {\n\t/** The construct's id. */\n\tconstruct: string;\n\t/** The key the deploy's migrations read it from. */\n\tkey: string;\n\turl: string;\n}\n\n/** A login's URL as a SQL client's form asks for it, field by field. */\nexport function loginFields(url: string): [string, string][] {\n\tconst parsed = new URL(url);\n\treturn [\n\t\t['host', parsed.hostname],\n\t\t['port', parsed.port],\n\t\t['database', decodeURIComponent(parsed.pathname.slice(1))],\n\t\t['user', decodeURIComponent(parsed.username)],\n\t\t['password', decodeURIComponent(parsed.password)],\n\t];\n}\n\n/**\n * Each database's owner URL — every one, or the construct asked for — on\n * the port this machine reaches the stack's Postgres by: the same values the\n * deploy's migrations connect with (`migrateAndSeed`), from the same\n * derivation.\n *\n * @throws {DatabaseNotInStage}\n */\nexport function ownerLogins(\n\tstack: Pick<ComposeStack, 'stage' | 'plan' | 'resolution'>,\n\tport: number,\n\tconstruct?: string,\n): OwnerLogin[] {\n\tconst env = envFor(stack.plan, {\n\t\t...stack.resolution,\n\t\tports: { [primaryPortKey('postgres')]: port },\n\t});\n\tconst logins = stack.plan.resources\n\t\t.filter((resource) => isDatabase(resource.kind))\n\t\t.map((resource) => {\n\t\t\tconst key = providedKeyFor(resource.id, resource.kind, 'ownerUrl');\n\t\t\t// A database whose roles are not split has no owner: its one login\n\t\t\t// is the URL itself, and that is the one to sign in with.\n\t\t\tconst url = env[key] ?? env[resource.envKey];\n\t\t\treturn url ? { construct: resource.id, key, url } : undefined;\n\t\t})\n\t\t.filter((login): login is OwnerLogin => login !== undefined);\n\n\tif (construct === undefined) return logins;\n\tconst asked = logins.filter((login) => login.construct === construct);\n\tif (asked.length === 0) {\n\t\tthrow new DatabaseNotInStage(\n\t\t\tstack.stage,\n\t\t\tconstruct,\n\t\t\tlogins.map((login) => login.construct),\n\t\t);\n\t}\n\treturn asked;\n}\n\nexport interface DbTunnelOptions\n\textends Pick<\n\t\tStageExecOptions,\n\t\t'stage' | 'profile' | 'sshUser' | 'yes' | 'cwd'\n\t> {\n\t/** One database construct, by id. Every one when absent. */\n\tconstruct?: string;\n}\n\nexport interface DbTunnelDeps extends StageExecDeps {\n\t/** Resolves when the tunnel should close: Ctrl-C, by default. */\n\theld: () => Promise<void>;\n}\n\n/** Until the person presses Ctrl-C, or the process is told to stop. */\nfunction untilInterrupted(): Promise<void> {\n\treturn new Promise((resolve) => {\n\t\tconst stop = () => {\n\t\t\tprocess.off('SIGINT', stop);\n\t\t\tprocess.off('SIGTERM', stop);\n\t\t\tresolve();\n\t\t};\n\t\tprocess.on('SIGINT', stop);\n\t\tprocess.on('SIGTERM', stop);\n\t});\n}\n\nexport const defaultDbTunnelDeps: DbTunnelDeps = {\n\t...defaultStageExecDeps,\n\theld: untilInterrupted,\n};\n\n/**\n * Open a tunnel to the stage's Postgres, print each database's owner URL\n * through it, and hold it open until `deps.held` resolves. The tunnel is\n * closed however that ends.\n *\n * @throws {StageHasNoDatabase}, {DatabaseNotInStage}, {DatabaseNotPublished},\n * {ExecNotConfirmed}, {ExecStageNotComposed}, {ExecStageNotDeployed},\n * {ComposeServerUnreachable}\n */\nexport async function dbTunnel(\n\toptions: DbTunnelOptions,\n\tdeps: DbTunnelDeps = defaultDbTunnelDeps,\n): Promise<OwnerLogin[]> {\n\tconst { stage } = options;\n\tconst loaded = await loadStage(options, deps.env);\n\tconst { stack } = loaded;\n\tif (!stack.infra.includes('postgres')) throw new StageHasNoDatabase(stage);\n\t// Asked here, before anything is reached: an unknown construct is said\n\t// without an SSH login. The port is a placeholder until the tunnel opens.\n\townerLogins(stack, LOOPBACK_SERVICES.postgres, options.construct);\n\n\tif (loaded.protectedStage && !options.yes) {\n\t\tconst question = `'${stage}' is a protected stage. Open a tunnel to its database as its owner?`;\n\t\tif (!(await deps.confirm(question))) throw new ExecNotConfirmed(stage);\n\t}\n\n\tconst server = stageServer(loaded, options);\n\tawait deps.server.check(server);\n\n\tconst published = await deps.docker.published(\n\t\t{ host: dockerHost(server) },\n\t\tstack.project,\n\t\t'postgres',\n\t\tLOOPBACK_SERVICES.postgres,\n\t);\n\tif (published === undefined) {\n\t\tthrow new DatabaseNotPublished(stage, stack.project);\n\t}\n\n\tconst tunnel = await deps.server.tunnel(server, published);\n\ttry {\n\t\tconst logins = ownerLogins(stack, tunnel.port, options.construct);\n\t\tlogger.log(\n\t\t\t`🚇 '${stage}' postgres → 127.0.0.1:${tunnel.port} (over SSH to ${server.host})`,\n\t\t);\n\t\tfor (const login of logins) {\n\t\t\tlogger.log(`\\n🔑 ${login.construct} (${login.key})`);\n\t\t\tlogger.log(` ${login.url}`);\n\t\t\tfor (const [field, value] of loginFields(login.url)) {\n\t\t\t\tlogger.log(` ${`${field}:`.padEnd(10)}${value}`);\n\t\t\t}\n\t\t}\n\t\tlogger.log('\\nThe tunnel is open. Press Ctrl-C to close it.');\n\t\tawait deps.held();\n\t\treturn logins;\n\t} finally {\n\t\tawait tunnel.close();\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,SAAS;;AAGf,IAAa,qBAAb,cAAwC,SAAS;CAC3B;CAArB,YAAY,OAAwB;EACnC,MACC,IAAI,MAAM,6GAEX;EAJoB,KAAA,QAAA;EAKpB,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,qBAAb,cAAwC,SAAS;CAEtC;CACA;CACA;CAHV,YACC,OACA,WACA,WACC;EACD,MACC,IAAI,UAAU,uBAAuB,MAAM,4BACvC,UAAU,KAAK,IAAI,EAAE,0BAA0B,MAAM,GACrD,UAAU,MAAM,cAAc,EACnC;EARS,KAAA,QAAA;EACA,KAAA,YAAA;EACA,KAAA,YAAA;EAOT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,uBAAb,cAA0C,SAAS;CAExC;CACA;CAFV,YACC,OACA,SACC;EACD,MACC,cAAc,QAAQ,sBAAsB,kBAAkB,SAAS,OAC/D,M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OAAO,EAAE,IAAI,OAAO;EAEnD;EACA,OAAO,IAAI,iDAAiD;EAC5D,MAAM,KAAK,KAAK;EAChB,OAAO;CACR,UAAU;EACT,MAAM,OAAO,MAAM;CACpB;AACD"}
1
+ {"version":3,"file":"dbTunnel-CqDaxQig.mjs","names":[],"sources":["../src/exec/dbTunnel.ts"],"sourcesContent":["/**\n * `gkm db:tunnel --stage <stage> [construct]`: a deployed compose stage's\n * Postgres, on this machine's loopback, and each database's owner login to\n * sign in to it with — for a SQL client, a one-off fix, a look at the data.\n *\n * The tunnel is the deploy's own: SSH on the deploy's login to the port the\n * server publishes Postgres on, its loopback alone. The owner URL is the one\n * the deploy migrates with, derived from the stage's secrets the way the\n * deploy derives it — nothing is stored, and nothing is written to disk.\n *\n * It is the owner, not the app's login, because that is what a person\n * changing the schema or its data by hand needs; it is printed, not injected,\n * because a GUI client is not a process gkm starts. `gkm exec --stage` stays\n * the app's login: what a script runs as is what the app runs as.\n */\n\nimport { providedKeyFor } from '@geekmidas/manifest';\nimport { dockerHost } from '../compose/server.js';\nimport type { ComposeStack } from '../compose/stack.js';\nimport { LOOPBACK_SERVICES } from '../compose/stack.js';\nimport { GkmError } from '../errors';\nimport { primaryPortKey } from '../reconcile/containers.js';\nimport { envFor, isDatabase } from '../reconcile/env.js';\nimport {\n\tdefaultStageExecDeps,\n\tExecNotConfirmed,\n\tloadStage,\n\ttype StageExecDeps,\n\ttype StageExecOptions,\n\tstageServer,\n} from './stage.js';\n\nconst logger = console;\n\n/** The stage's stack runs no Postgres: there is nothing to tunnel to. */\nexport class StageHasNoDatabase extends GkmError {\n\tconstructor(readonly stage: string) {\n\t\tsuper(\n\t\t\t`'${stage}' runs no Postgres, so there is no database to tunnel to. ` +\n\t\t\t\t'Declare a Database construct and deploy the stage.',\n\t\t);\n\t\tthis.name = 'StageHasNoDatabase';\n\t}\n}\n\n/** The construct asked for is not one of the stage's databases. */\nexport class DatabaseNotInStage extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly construct: string,\n\t\treadonly databases: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`'${construct}' is not a database '${stage}' runs. Its databases are ` +\n\t\t\t\t`${databases.join(', ')}: gkm db:tunnel --stage ${stage} ` +\n\t\t\t\t`${databases[0] ?? '<construct>'}.`,\n\t\t);\n\t\tthis.name = 'DatabaseNotInStage';\n\t}\n}\n\n/** The server publishes no Postgres: the stack is not running there. */\nexport class DatabaseNotPublished extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly project: string,\n\t) {\n\t\tsuper(\n\t\t\t`No running ${project} postgres publishes ${LOOPBACK_SERVICES.postgres} ` +\n\t\t\t\t`on '${stage}'s server, so there is nothing to tunnel to. Deploy the ` +\n\t\t\t\t`stage (gkm deploy --stage ${stage}), then run this again.`,\n\t\t);\n\t\tthis.name = 'DatabaseNotPublished';\n\t}\n}\n\n/** A database's owner login, as this machine reaches it. */\nexport interface OwnerLogin {\n\t/** The construct's id. */\n\tconstruct: string;\n\t/** The key the deploy's migrations read it from. */\n\tkey: string;\n\turl: string;\n}\n\n/** A login's URL as a SQL client's form asks for it, field by field. */\nexport function loginFields(url: string): [string, string][] {\n\tconst parsed = new URL(url);\n\treturn [\n\t\t['host', parsed.hostname],\n\t\t['port', parsed.port],\n\t\t['database', decodeURIComponent(parsed.pathname.slice(1))],\n\t\t['user', decodeURIComponent(parsed.username)],\n\t\t['password', decodeURIComponent(parsed.password)],\n\t];\n}\n\n/**\n * Each database's owner URL — every one, or the construct asked for — on\n * the port this machine reaches the stack's Postgres by: the same values the\n * deploy's migrations connect with (`migrateAndSeed`), from the same\n * derivation.\n *\n * @throws {DatabaseNotInStage}\n */\nexport function ownerLogins(\n\tstack: Pick<ComposeStack, 'stage' | 'plan' | 'resolution'>,\n\tport: number,\n\tconstruct?: string,\n): OwnerLogin[] {\n\tconst env = envFor(stack.plan, {\n\t\t...stack.resolution,\n\t\tports: { [primaryPortKey('postgres')]: port },\n\t});\n\tconst logins = stack.plan.resources\n\t\t.filter((resource) => isDatabase(resource.kind))\n\t\t.map((resource) => {\n\t\t\tconst key = providedKeyFor(resource.id, resource.kind, 'ownerUrl');\n\t\t\t// A database whose roles are not split has no owner: its one login\n\t\t\t// is the URL itself, and that is the one to sign in with.\n\t\t\tconst url = env[key] ?? env[resource.envKey];\n\t\t\treturn url ? { construct: resource.id, key, url } : undefined;\n\t\t})\n\t\t.filter((login): login is OwnerLogin => login !== undefined);\n\n\tif (construct === undefined) return logins;\n\tconst asked = logins.filter((login) => login.construct === construct);\n\tif (asked.length === 0) {\n\t\tthrow new DatabaseNotInStage(\n\t\t\tstack.stage,\n\t\t\tconstruct,\n\t\t\tlogins.map((login) => login.construct),\n\t\t);\n\t}\n\treturn asked;\n}\n\nexport interface DbTunnelOptions\n\textends Pick<\n\t\tStageExecOptions,\n\t\t'stage' | 'profile' | 'sshUser' | 'yes' | 'cwd'\n\t> {\n\t/** One database construct, by id. Every one when absent. */\n\tconstruct?: string;\n}\n\nexport interface DbTunnelDeps extends StageExecDeps {\n\t/** Resolves when the tunnel should close: Ctrl-C, by default. */\n\theld: () => Promise<void>;\n}\n\n/** Until the person presses Ctrl-C, or the process is told to stop. */\nfunction untilInterrupted(): Promise<void> {\n\treturn new Promise((resolve) => {\n\t\tconst stop = () => {\n\t\t\tprocess.off('SIGINT', stop);\n\t\t\tprocess.off('SIGTERM', stop);\n\t\t\tresolve();\n\t\t};\n\t\tprocess.on('SIGINT', stop);\n\t\tprocess.on('SIGTERM', stop);\n\t});\n}\n\nexport const defaultDbTunnelDeps: DbTunnelDeps = {\n\t...defaultStageExecDeps,\n\theld: untilInterrupted,\n};\n\n/**\n * Open a tunnel to the stage's Postgres, print each database's owner URL\n * through it, and hold it open until `deps.held` resolves. The tunnel is\n * closed however that ends.\n *\n * @throws {StageHasNoDatabase}, {DatabaseNotInStage}, {DatabaseNotPublished},\n * {ExecNotConfirmed}, {ExecStageNotComposed}, {ExecStageNotDeployed},\n * {ComposeServerUnreachable}\n */\nexport async function dbTunnel(\n\toptions: DbTunnelOptions,\n\tdeps: DbTunnelDeps = defaultDbTunnelDeps,\n): Promise<OwnerLogin[]> {\n\tconst { stage } = options;\n\tconst loaded = await loadStage(options, deps.env);\n\tconst { stack } = loaded;\n\tif (!stack.infra.includes('postgres')) throw new StageHasNoDatabase(stage);\n\t// Asked here, before anything is reached: an unknown construct is said\n\t// without an SSH login. The port is a placeholder until the tunnel opens.\n\townerLogins(stack, LOOPBACK_SERVICES.postgres, options.construct);\n\n\tif (loaded.protectedStage && !options.yes) {\n\t\tconst question = `'${stage}' is a protected stage. Open a tunnel to its database as its owner?`;\n\t\tif (!(await deps.confirm(question))) throw new ExecNotConfirmed(stage);\n\t}\n\n\tconst server = stageServer(loaded, options);\n\tawait deps.server.check(server);\n\n\tconst published = await deps.docker.published(\n\t\t{ host: dockerHost(server) },\n\t\tstack.project,\n\t\t'postgres',\n\t\tLOOPBACK_SERVICES.postgres,\n\t);\n\tif (published === undefined) {\n\t\tthrow new DatabaseNotPublished(stage, stack.project);\n\t}\n\n\tconst tunnel = await deps.server.tunnel(server, published);\n\ttry {\n\t\tconst logins = ownerLogins(stack, tunnel.port, options.construct);\n\t\tlogger.log(\n\t\t\t`🚇 '${stage}' postgres → 127.0.0.1:${tunnel.port} (over SSH to ${server.host})`,\n\t\t);\n\t\tfor (const login of logins) {\n\t\t\tlogger.log(`\\n🔑 ${login.construct} (${login.key})`);\n\t\t\tlogger.log(` ${login.url}`);\n\t\t\tfor (const [field, value] of loginFields(login.url)) {\n\t\t\t\tlogger.log(` ${`${field}:`.padEnd(10)}${value}`);\n\t\t\t}\n\t\t}\n\t\tlogger.log('\\nThe tunnel is open. Press Ctrl-C to close it.');\n\t\tawait deps.held();\n\t\treturn logins;\n\t} finally {\n\t\tawait tunnel.close();\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,SAAS;;AAGf,IAAa,qBAAb,cAAwC,SAAS;CAC3B;CAAr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c,KAAA,GACjB,MAAM,IAAI,qBAAqB,OAAO,MAAM,OAAO;CAGpD,MAAM,SAAS,MAAM,KAAK,OAAO,OAAO,QAAQ,SAAS;CACzD,IAAI;EACH,MAAM,SAAS,YAAY,OAAO,OAAO,MAAM,QAAQ,SAAS;EAChE,OAAO,IACN,OAAO,MAAM,yBAAyB,OAAO,KAAK,gBAAgB,OAAO,KAAK,EAC/E;EACA,KAAK,MAAM,SAAS,QAAQ;GAC3B,OAAO,IAAI,QAAQ,MAAM,UAAU,IAAI,MAAM,IAAI,EAAE;GACnD,OAAO,IAAI,MAAM,MAAM,KAAK;GAC5B,KAAK,MAAM,CAAC,OAAO,UAAU,YAAY,MAAM,GAAG,GACjD,OAAO,IAAI,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,IAAI,OAAO;EAEnD;EACA,OAAO,IAAI,iDAAiD;EAC5D,MAAM,KAAK,KAAK;EAChB,OAAO;CACR,UAAU;EACT,MAAM,OAAO,MAAM;CACpB;AACD"}
@@ -1,21 +1,21 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_errors = require("../errors-DMC4Umsb.cjs");
3
- const require_dns = require("../dns-_WH7kO9x.cjs");
3
+ const require_dns = require("../dns-WneRa4VJ.cjs");
4
4
  const require_workspace = require("../workspace-DirP2-ed.cjs");
5
- const require_apps = require("../apps-CyfjJh6v.cjs");
5
+ const require_apps = require("../apps-DPw1i9E7.cjs");
6
6
  const require_define = require("../define-crmMcXFS.cjs");
7
7
  const require_discover = require("../discover-39VKSE2i.cjs");
8
8
  const require_config = require("../config.cjs");
9
- const require_resolve = require("../resolve-XaHTbLJ0.cjs");
10
- const require_notes = require("../notes-jaDD8Vda.cjs");
11
- const require_local = require("../local-BObpR_rL.cjs");
12
- const require_sniffer = require("../sniffer-BVmzTN9C.cjs");
13
- const require_deploy = require("../deploy-OPNZJCUm.cjs");
9
+ const require_resolve = require("../resolve-DRldmRYb.cjs");
10
+ const require_notes = require("../notes-dD3gRvZw.cjs");
11
+ const require_local = require("../local-CWNFE8Sg.cjs");
12
+ const require_sniffer = require("../sniffer-BPLYWu70.cjs");
13
+ const require_deploy = require("../deploy-l0Vc846k.cjs");
14
14
  const require_seeds = require("../seeds-Bc3niNVb.cjs");
15
- const require_engine = require("../engine-CINx5LA_.cjs");
16
- const require_rollback = require("../rollback-DQl_hh1s.cjs");
15
+ const require_engine = require("../engine-CaWo9tZO.cjs");
16
+ const require_rollback = require("../rollback-R_j7f9cY.cjs");
17
17
  const require_provider = require("../provider-BqpjG9QM.cjs");
18
- const require_sst = require("../sst-3iKqe9vk.cjs");
18
+ const require_sst = require("../sst-C56i2cst.cjs");
19
19
  let node_path = require("node:path");
20
20
  let node_fs = require("node:fs");
21
21
  //#region src/sandbox/install.ts
@@ -1,20 +1,20 @@
1
1
  import { t as GkmError } from "../errors-D8Gwp5kU.mjs";
2
- import { C as storedCredentials, S as chainCredentials, X as deployIdentity, at as CommandTimedOut, bt as GKM_HOME_ENV, it as CommandFailed, x as MissingCredential, xt as gkmHome } from "../dns-BM2DE6jt.mjs";
2
+ import { C as storedCredentials, S as chainCredentials, X as deployIdentity, at as CommandTimedOut, bt as GKM_HOME_ENV, it as CommandFailed, x as MissingCredential, xt as gkmHome } from "../dns-B2vsk2Rc.mjs";
3
3
  import { V as UnknownStageProvider, wt as ProvisionedBucketUnreachable } from "../workspace-BBa1Ck5j.mjs";
4
- import { V as detectPackageManager } from "../apps-G1Q2j-fs.mjs";
4
+ import { V as detectPackageManager } from "../apps-GDmO_v7v.mjs";
5
5
  import { a as UnknownDeployTarget, i as DeployTargetNotYetSupported } from "../define-6poNqm5O.mjs";
6
6
  import { d as SECRETS_DIR_ENV, f as SandboxCwdEscape, g as confineCwd, n as ConstructsNotSerializable, p as SecretNameInvalid, s as SandboxWorkerFailed, t as ConstructDiscoveryFailed } from "../discover-B_PDDaVj.mjs";
7
7
  import { ConfigLoadFailed, ConfigObjectNotSerializable } from "../config.mjs";
8
- import { i as TargetRuntimeMismatch, l as TargetPackageNotFound, n as TargetEntryInvalid, r as TargetPackageInvalid, s as TargetRuntimeUndeclared, t as InvalidTargetOptions } from "../resolve-DGSN4f-J.mjs";
9
- import { c as DevServicesNeedServerTarget, l as ExternalServicesNotConfigured, o as AllowDevServicesTakesNoValue, s as DEV_SERVICES, t as StageProviderDisabled } from "../notes-BwBGVMYR.mjs";
10
- import { n as SANDBOX_ENV_ALLOWLIST, r as allowlistedEnv, t as LocalSandbox } from "../local-CpSldDSi.mjs";
11
- import { a as DeploymentTimedOut, f as StateLocked, g as StateVersionConflict, i as DeploymentFailed, u as LocalStateInCi } from "../sniffer-CkSC8MZ9.mjs";
12
- import { a as UnknownDeployApps, i as TargetBuildsNothing, n as NoDeployableApps, r as RollbackFailed, t as deploy } from "../deploy-DFul9UAF.mjs";
8
+ import { i as TargetRuntimeMismatch, l as TargetPackageNotFound, n as TargetEntryInvalid, r as TargetPackageInvalid, s as TargetRuntimeUndeclared, t as InvalidTargetOptions } from "../resolve-Dyki9ZJX.mjs";
9
+ import { c as DevServicesNeedServerTarget, l as ExternalServicesNotConfigured, o as AllowDevServicesTakesNoValue, s as DEV_SERVICES, t as StageProviderDisabled } from "../notes-D2KWnUSL.mjs";
10
+ import { n as SANDBOX_ENV_ALLOWLIST, r as allowlistedEnv, t as LocalSandbox } from "../local-BQQHvZ4q.mjs";
11
+ import { a as DeploymentTimedOut, f as StateLocked, g as StateVersionConflict, i as DeploymentFailed, u as LocalStateInCi } from "../sniffer-XsTiFI3l.mjs";
12
+ import { a as UnknownDeployApps, i as TargetBuildsNothing, n as NoDeployableApps, r as RollbackFailed, t as deploy } from "../deploy-CpAkrZ25.mjs";
13
13
  import { t as DeploySeedsFailed } from "../seeds-Ccn0Ru2T.mjs";
14
- import { _ as RegistryNotConfigured, g as RegistryAmbiguous, h as HealthCheckTimedOut, m as DeployMigrationsFailed, n as FrontendDeployFailed, r as MissingEnvVars, t as BackendDeployFailed, v as RegistryNotFound, y as ProjectNotOwned } from "../engine-CKkCaRAd.mjs";
15
- import { i as rollbackStage, n as RollbackNeedsApp, r as StageNeverDeployed, t as NothingToRollBack } from "../rollback-xiYg-iz_.mjs";
14
+ import { _ as RegistryNotConfigured, g as RegistryAmbiguous, h as HealthCheckTimedOut, m as DeployMigrationsFailed, n as FrontendDeployFailed, r as MissingEnvVars, t as BackendDeployFailed, v as RegistryNotFound, y as ProjectNotOwned } from "../engine-BhS-wyH0.mjs";
15
+ import { i as rollbackStage, n as RollbackNeedsApp, r as StageNeverDeployed, t as NothingToRollBack } from "../rollback-Do0i6x3b.mjs";
16
16
  import { t as ProviderRemoved } from "../provider-CEOKk8NS.mjs";
17
- import { i as SurfacesUnhealthy, r as SstOutputsUnreadable, t as SstConfigNotFound } from "../sst-r4pOOAkf.mjs";
17
+ import { i as SurfacesUnhealthy, r as SstOutputsUnreadable, t as SstConfigNotFound } from "../sst-BCvYZtVF.mjs";
18
18
  import { join, resolve } from "node:path";
19
19
  import { existsSync } from "node:fs";
20
20
  //#region src/sandbox/install.ts
@@ -1,20 +1,20 @@
1
1
  import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
2
- import { C as storedCredentials, M as initStageSecrets, X as deployIdentity, Y as applicationName, c as mxValue, d as createComposeState, f as createEmptyState, k as secretsStoreFor, n as findRootDomain, r as normalizeDnsConfig, t as extractSubdomain, xt as gkmHome } from "./dns-BM2DE6jt.mjs";
2
+ import { C as storedCredentials, M as initStageSecrets, X as deployIdentity, Y as applicationName, c as mxValue, d as createComposeState, f as createEmptyState, k as secretsStoreFor, n as findRootDomain, r as normalizeDnsConfig, t as extractSubdomain, xt as gkmHome } from "./dns-B2vsk2Rc.mjs";
3
3
  import { $ as SesReceivingUnsupported, G as checkSesConfig, J as inboxBucketId, K as checkSesEmailConfig, L as resolveStageTelemetry, N as assertDeployedStage, Q as InboxNotProvisioned, Rt as isReservedStageKey, St as BucketRegionUnknown, Tt as RecordedBucketUnreachable, U as stageProvider, W as SES_PROVISIONING, X as EmailNotProvisioned, Y as inboxTopicName, Z as EmailSenderUnknown, at as suffixedBucketName, bt as BucketProbeFailed, et as IAM_POLICY_NAME, ft as S3_PROVISIONING, ht as servesOnCdn, it as randomSuffix, mt as s3Region, nt as bucketName, ot as appKey, pt as checkS3Config, q as emailUserName, rt as iamUserName, st as derivedApps, u as getAppBuildOrder, ut as fileServerHost, vt as BucketNameUnavailable, wt as ProvisionedBucketUnreachable, xt as BucketRegionMismatch, yt as BucketOwnedByAnotherProject } from "./workspace-BBa1Ck5j.mjs";
4
- import { A as originSecretKey, D as ORIGIN_VERIFY_HEADER, Et as mergeLifecycle, Ft as backupsPrefix, Lt as stageBackups, Nt as backupExpiries, Rt as deploysWithCompose, dt as BACKUPS_URL_KEY, f as constructGlobs, j as processorOriginHost, k as newOriginSecret, t as appEnvKeys, ut as BACKUPS_SERVICE } from "./apps-G1Q2j-fs.mjs";
4
+ import { A as originSecretKey, D as ORIGIN_VERIFY_HEADER, Et as mergeLifecycle, Ft as backupsPrefix, Lt as stageBackups, Nt as backupExpiries, Rt as deploysWithCompose, dt as BACKUPS_URL_KEY, f as constructGlobs, j as processorOriginHost, k as newOriginSecret, t as appEnvKeys, ut as BACKUPS_SERVICE } from "./apps-GDmO_v7v.mjs";
5
5
  import { o as builtinTarget } from "./define-6poNqm5O.mjs";
6
- import { Et as NoDomainForStage, Ot as isMainFrontendApp, R as usesTelemetry, kt as resolveHost } from "./compose-D_shZ1mI.mjs";
6
+ import { Et as NoDomainForStage, Ot as isMainFrontendApp, R as usesTelemetry, kt as resolveHost } from "./compose-DH1ToGh2.mjs";
7
7
  import { s as subscriberRoute } from "./SubscriberGenerator-NxcLNeDJ.mjs";
8
8
  import { _ as withSandbox, b as withOutput, i as discover } from "./discover-B_PDDaVj.mjs";
9
9
  import { findWorkspaceRoot, loadWorkspaceConfig, withLoadedConfig } from "./config.mjs";
10
- import { a as parseTargetOptions, o as resolveTarget } from "./resolve-DGSN4f-J.mjs";
11
- import { a as PROVIDER_KINDS, c as DevServicesNeedServerTarget, f as devServicesUsed, g as stageServiceDeclarations, i as stageProviderNotes, l as ExternalServicesNotConfigured, m as reportDevServices, n as assertStageProvidersEnabled, p as externalServices } from "./notes-BwBGVMYR.mjs";
12
- import { D as awsClientConfig, O as awsEndpoint, T as assertSitePasswords, k as awsProvisioningCredentials } from "./stack-LelP4jv7.mjs";
13
- import { t as LocalSandbox } from "./local-CpSldDSi.mjs";
14
- import { E as eventError, S as createStateStore, v as assertStateOutlivesRun, y as assertStateRoom } from "./sniffer-CkSC8MZ9.mjs";
15
- import { a as subscriptionKey, f as recordTtl, h as settleStackDns, l as dnsCredentials, o as subscriptionResource, v as stageDnsDomains } from "./snsSubscriptions-CdbBWvzg.mjs";
10
+ import { a as parseTargetOptions, o as resolveTarget } from "./resolve-Dyki9ZJX.mjs";
11
+ import { a as PROVIDER_KINDS, c as DevServicesNeedServerTarget, f as devServicesUsed, g as stageServiceDeclarations, i as stageProviderNotes, l as ExternalServicesNotConfigured, m as reportDevServices, n as assertStageProvidersEnabled, p as externalServices } from "./notes-D2KWnUSL.mjs";
12
+ import { D as awsClientConfig, O as awsEndpoint, T as assertSitePasswords, k as awsProvisioningCredentials } from "./stack-TttsEL7X.mjs";
13
+ import { t as LocalSandbox } from "./local-BQQHvZ4q.mjs";
14
+ import { E as eventError, S as createStateStore, v as assertStateOutlivesRun, y as assertStateRoom } from "./sniffer-XsTiFI3l.mjs";
15
+ import { _ as settleStackDns, b as stageDnsDomains, c as subscriptionResource, d as dnsCredentials, m as recordTtl, r as TOPIC_TYPE, s as subscriptionKey } from "./snsSubscriptions-D9Rm_Eug.mjs";
16
16
  import { a as identityTags, c as whileKeyIsNew, d as corsRule, f as publicAccessBlock, i as ensureIamUser, l as bucketPolicy, o as issuedJustNow, p as userPolicy, r as ensureAccessKey, s as s3KeySecret, t as TAG_PROJECT, u as canonicalPolicy } from "./iam-Cs2Ph5f2.mjs";
17
- import { a as findProjectBucket, i as ensureProjectBucket, o as projectBucketName, r as callerAccountId, s as reconcileProjectBucketLifecycle } from "./projectBucket-CgGk1Nd_.mjs";
17
+ import { a as findProjectBucket, i as ensureProjectBucket, o as projectBucketName, r as callerAccountId, s as reconcileProjectBucketLifecycle } from "./projectBucket-BDytiu7A.mjs";
18
18
  import { m as recordDnsResource, s as DeployJournal, u as dnsResourceKey } from "./seeds-Ccn0Ru2T.mjs";
19
19
  import { n as assertStageCredentials } from "./credentialSchemas-BzJiK1nQ.mjs";
20
20
  import { resolve } from "node:path";
@@ -1284,8 +1284,8 @@ async function ensureTopic(ctx, clients, input) {
1284
1284
  const { id, topicName } = input;
1285
1285
  const topicArn = `arn:aws:sns:${region}:${account}:${topicName}`;
1286
1286
  const topicEntry = {
1287
- key: `sns-topic:${id}`,
1288
- type: "sns-topic"
1287
+ key: `${TOPIC_TYPE}:${id}`,
1288
+ type: TOPIC_TYPE
1289
1289
  };
1290
1290
  const topic = await readOr$1(() => sns.send(new SNS.GetTopicAttributesCommand({ TopicArn: topicArn })), ["NotFound", "NotFoundException"]);
1291
1291
  if (topic) await ctx.state.ready(topicEntry, topicArn);
@@ -2154,9 +2154,10 @@ const s3Provider = {
2154
2154
  * allowed to write under `messages/` and an IAM user of its own whose key
2155
2155
  * is the inbox's `<ID>_URL`;
2156
2156
  * - **its topic** on SNS, publishable by SES alone, whose `sns://` address —
2157
- * signed by the same key — is the topic's connection string. The deploy's
2158
- * push subscriptions for a topic on SNS (`topicPushes`) then subscribe each
2159
- * inbox subscriber at its worker's route, unfiltered;
2157
+ * signed by the same key — is the topic's connection string. That key may
2158
+ * only confirm a subscription: the deploy's push subscriptions for a topic
2159
+ * on SNS (`topicPushes`) subscribe each inbox subscriber at its worker's
2160
+ * route, unfiltered, with the deploy's own credentials, as a bucket's are;
2160
2161
  * - **the stage's domain as an SES identity**, verified through Easy DKIM's
2161
2162
  * CNAMEs, and **MX records** pointing the domain — or every subdomain of it,
2162
2163
  * with `subdomains: true` — at the region's inbound endpoint, both through
@@ -3833,4 +3834,4 @@ async function load(input, sandbox) {
3833
3834
  //#endregion
3834
3835
  export { UnknownDeployApps as a, defaultCdnClients as c, TargetBuildsNothing as i, backupsUserName as l, NoDeployableApps as n, defaultClients as o, RollbackFailed as r, cdnName as s, deploy as t };
3835
3836
 
3836
- //# sourceMappingURL=deploy-DFul9UAF.mjs.map
3837
+ //# sourceMappingURL=deploy-CpAkrZ25.mjs.map