@geekmidas/cli 10.0.0-alpha.91 → 10.0.0-alpha.93

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 (318) hide show
  1. package/dist/{EndpointGenerator-CVc6Oi1Y.mjs → EndpointGenerator-Bor2tZCm.mjs} +14 -4
  2. package/dist/EndpointGenerator-Bor2tZCm.mjs.map +1 -0
  3. package/dist/{EndpointGenerator-CwLjBCFE.cjs → EndpointGenerator-De03t1hd.cjs} +14 -4
  4. package/dist/EndpointGenerator-De03t1hd.cjs.map +1 -0
  5. package/dist/{GoDaddyProvider-DqZ1qD_F.cjs → GoDaddyProvider-BZb-V14e.cjs} +11 -10
  6. package/dist/GoDaddyProvider-BZb-V14e.cjs.map +1 -0
  7. package/dist/{GoDaddyProvider-DSStJVAv.mjs → GoDaddyProvider-Mi3vptSR.mjs} +11 -10
  8. package/dist/GoDaddyProvider-Mi3vptSR.mjs.map +1 -0
  9. package/dist/{HostingerProvider-BI6J7oJr.mjs → HostingerProvider-1mqD6aG8.mjs} +2 -2
  10. package/dist/{HostingerProvider-BI6J7oJr.mjs.map → HostingerProvider-1mqD6aG8.mjs.map} +1 -1
  11. package/dist/{HostingerProvider-CyTpG_jy.cjs → HostingerProvider-C6t-PSNe.cjs} +2 -2
  12. package/dist/{HostingerProvider-CyTpG_jy.cjs.map → HostingerProvider-C6t-PSNe.cjs.map} +1 -1
  13. package/dist/{LegacyStateStore-DXmNA7hy.cjs → LegacyStateStore-BlYXQQSE.cjs} +44 -10
  14. package/dist/LegacyStateStore-BlYXQQSE.cjs.map +1 -0
  15. package/dist/LegacyStateStore-CtwO7fwy.mjs +123 -0
  16. package/dist/LegacyStateStore-CtwO7fwy.mjs.map +1 -0
  17. package/dist/{LocalStateStore-CU-O0SBp.mjs → LocalStateStore-D40_SDmJ.mjs} +2 -2
  18. package/dist/{LocalStateStore-CU-O0SBp.mjs.map → LocalStateStore-D40_SDmJ.mjs.map} +1 -1
  19. package/dist/{LocalStateStore-BBeTlRTH.cjs → LocalStateStore-oX_zxj9V.cjs} +2 -2
  20. package/dist/{LocalStateStore-BBeTlRTH.cjs.map → LocalStateStore-oX_zxj9V.cjs.map} +1 -1
  21. package/dist/{OpenApiTsGenerator-B--HV-sW.cjs → OpenApiTsGenerator-CS_RtWOz.cjs} +2 -2
  22. package/dist/{OpenApiTsGenerator-B--HV-sW.cjs.map → OpenApiTsGenerator-CS_RtWOz.cjs.map} +1 -1
  23. package/dist/{OpenApiTsGenerator-CkvsPdgg.mjs → OpenApiTsGenerator-DWAF-7Fu.mjs} +2 -2
  24. package/dist/{OpenApiTsGenerator-CkvsPdgg.mjs.map → OpenApiTsGenerator-DWAF-7Fu.mjs.map} +1 -1
  25. package/dist/{S3StateStore-bwxcI_wQ.mjs → S3StateStore-BzS0IeSt.mjs} +2 -2
  26. package/dist/{S3StateStore-bwxcI_wQ.mjs.map → S3StateStore-BzS0IeSt.mjs.map} +1 -1
  27. package/dist/{S3StateStore-Br8VMY22.cjs → S3StateStore-DeI7jtvi.cjs} +2 -2
  28. package/dist/{S3StateStore-Br8VMY22.cjs.map → S3StateStore-DeI7jtvi.cjs.map} +1 -1
  29. package/dist/{SSMStateStore-DoZE1Wi1.cjs → SSMStateStore-CaCtrzFL.cjs} +2 -2
  30. package/dist/{SSMStateStore-DoZE1Wi1.cjs.map → SSMStateStore-CaCtrzFL.cjs.map} +1 -1
  31. package/dist/{SSMStateStore-CsOS0W1y.mjs → SSMStateStore-k_Ew7TWx.mjs} +2 -2
  32. package/dist/{SSMStateStore-CsOS0W1y.mjs.map → SSMStateStore-k_Ew7TWx.mjs.map} +1 -1
  33. package/dist/{SubscriberGenerator-BPqQf8fB.mjs → SubscriberGenerator-CyN2VF5X.mjs} +6 -5
  34. package/dist/SubscriberGenerator-CyN2VF5X.mjs.map +1 -0
  35. package/dist/{SubscriberGenerator-BVn7cQ-2.cjs → SubscriberGenerator-Dvz7EzqK.cjs} +6 -5
  36. package/dist/SubscriberGenerator-Dvz7EzqK.cjs.map +1 -0
  37. package/dist/{add-BSHk5Ngn.mjs → add-CP1podDH.mjs} +7 -7
  38. package/dist/add-CP1podDH.mjs.map +1 -0
  39. package/dist/{add-DmmBDV2e.cjs → add-VcyJnsPX.cjs} +8 -8
  40. package/dist/add-VcyJnsPX.cjs.map +1 -0
  41. package/dist/{aws-BTawF0F-.cjs → aws-BTReGjpY.cjs} +24 -6
  42. package/dist/aws-BTReGjpY.cjs.map +1 -0
  43. package/dist/{aws-B-6uEhgP.mjs → aws-Dz2bYxK1.mjs} +24 -6
  44. package/dist/aws-Dz2bYxK1.mjs.map +1 -0
  45. package/dist/awsStore-B5We7bMg.cjs +136 -0
  46. package/dist/awsStore-B5We7bMg.cjs.map +1 -0
  47. package/dist/awsStore-BWa1KNY-.mjs +119 -0
  48. package/dist/awsStore-BWa1KNY-.mjs.map +1 -0
  49. package/dist/{bundler-D6eBfVkl.mjs → bundler-BWrh-AJH.mjs} +5 -5
  50. package/dist/{bundler-D6eBfVkl.mjs.map → bundler-BWrh-AJH.mjs.map} +1 -1
  51. package/dist/{bundler-BQJiB7Ub.cjs → bundler-Dfsr6KXU.cjs} +5 -5
  52. package/dist/{bundler-BQJiB7Ub.cjs.map → bundler-Dfsr6KXU.cjs.map} +1 -1
  53. package/dist/{cli-DD-Yk-I5.mjs → cli-B8otnZfX.mjs} +6 -6
  54. package/dist/{cli-DD-Yk-I5.mjs.map → cli-B8otnZfX.mjs.map} +1 -1
  55. package/dist/{cli-BE9mqeX8.cjs → cli-DL19w4OE.cjs} +5 -5
  56. package/dist/{cli-BE9mqeX8.cjs.map → cli-DL19w4OE.cjs.map} +1 -1
  57. package/dist/compose-BHVKLluX.cjs +1523 -0
  58. package/dist/compose-BHVKLluX.cjs.map +1 -0
  59. package/dist/compose-DrEB_4F-.mjs +1476 -0
  60. package/dist/compose-DrEB_4F-.mjs.map +1 -0
  61. package/dist/{config-pST7E0CS.d.cts → config-CHX5GOo3.d.mts} +8 -8
  62. package/dist/{config-CdEcTrjG.d.mts.map → config-CHX5GOo3.d.mts.map} +1 -1
  63. package/dist/{config-CdEcTrjG.d.mts → config-DCCcrOSo.d.cts} +8 -8
  64. package/dist/{config-pST7E0CS.d.cts.map → config-DCCcrOSo.d.cts.map} +1 -1
  65. package/dist/config.cjs +8 -7
  66. package/dist/config.cjs.map +1 -1
  67. package/dist/config.d.cts +3 -3
  68. package/dist/config.d.mts +3 -3
  69. package/dist/config.mjs +8 -7
  70. package/dist/config.mjs.map +1 -1
  71. package/dist/{credentialSchemas-BJqRJNK4.mjs → credentialSchemas-BJFvfkaz.mjs} +5 -4
  72. package/dist/credentialSchemas-BJFvfkaz.mjs.map +1 -0
  73. package/dist/{credentialSchemas-DCR4Wd1W.cjs → credentialSchemas-CAPKFkrG.cjs} +5 -4
  74. package/dist/credentialSchemas-CAPKFkrG.cjs.map +1 -0
  75. package/dist/{credentials-CnVqoXMb.mjs → credentials-C4KII3PD.mjs} +3 -2
  76. package/dist/{credentials-CnVqoXMb.mjs.map → credentials-C4KII3PD.mjs.map} +1 -1
  77. package/dist/{credentials-BKfIugu2.cjs → credentials-QBu7VgaQ.cjs} +3 -2
  78. package/dist/credentials-QBu7VgaQ.cjs.map +1 -0
  79. package/dist/{databases-CzszQV0N.mjs → databases-BeGP5eDh.mjs} +11 -10
  80. package/dist/databases-BeGP5eDh.mjs.map +1 -0
  81. package/dist/{databases-BY-pEImp.cjs → databases-DGALFDG3.cjs} +11 -10
  82. package/dist/databases-DGALFDG3.cjs.map +1 -0
  83. package/dist/{define-DR8xGYfL.mjs → define-6poNqm5O.mjs} +12 -3
  84. package/dist/define-6poNqm5O.mjs.map +1 -0
  85. package/dist/{define-DzRz8FgH.cjs → define-crmMcXFS.cjs} +12 -3
  86. package/dist/define-crmMcXFS.cjs.map +1 -0
  87. package/dist/deploy/public.cjs +18 -16
  88. package/dist/deploy/public.cjs.map +1 -1
  89. package/dist/deploy/public.d.cts +31 -31
  90. package/dist/deploy/public.d.cts.map +1 -1
  91. package/dist/deploy/public.d.mts +31 -31
  92. package/dist/deploy/public.d.mts.map +1 -1
  93. package/dist/deploy/public.mjs +18 -17
  94. package/dist/deploy/public.mjs.map +1 -1
  95. package/dist/{deploy-CuHasEA4.cjs → deploy-C3Mhnmus.cjs} +15 -13
  96. package/dist/deploy-C3Mhnmus.cjs.map +1 -0
  97. package/dist/{deploy-QNtx_eWR.mjs → deploy-DYIyIUYd.mjs} +15 -13
  98. package/dist/deploy-DYIyIUYd.mjs.map +1 -0
  99. package/dist/{discover-D1It5r_h.cjs → discover-DPgu-ScS.cjs} +4 -3
  100. package/dist/discover-DPgu-ScS.cjs.map +1 -0
  101. package/dist/{discover-CU0paUyH.d.cts → discover-DqwlBVyY.d.mts} +2 -2
  102. package/dist/{discover-CU0paUyH.d.cts.map → discover-DqwlBVyY.d.mts.map} +1 -1
  103. package/dist/{discover-BPelzeGW.mjs → discover-qjFapetL.mjs} +4 -3
  104. package/dist/discover-qjFapetL.mjs.map +1 -0
  105. package/dist/{discover-DFiJxwfv.d.mts → discover-vk2r5giK.d.cts} +2 -2
  106. package/dist/{discover-DFiJxwfv.d.mts.map → discover-vk2r5giK.d.cts.map} +1 -1
  107. package/dist/{dokploy-CYcMLh9-.mjs → dokploy-o4I6vb9W.mjs} +3 -3
  108. package/dist/{dokploy-CYcMLh9-.mjs.map → dokploy-o4I6vb9W.mjs.map} +1 -1
  109. package/dist/{dokploy-DIowwyIB.cjs → dokploy-rivb1RFt.cjs} +3 -3
  110. package/dist/{dokploy-DIowwyIB.cjs.map → dokploy-rivb1RFt.cjs.map} +1 -1
  111. package/dist/{drivers-DTZzxeIl.mjs → drivers-CTaWrA_L.mjs} +2 -2
  112. package/dist/{drivers-DTZzxeIl.mjs.map → drivers-CTaWrA_L.mjs.map} +1 -1
  113. package/dist/{drivers-LYSdQDmd.cjs → drivers-DDojgzz0.cjs} +2 -2
  114. package/dist/{drivers-LYSdQDmd.cjs.map → drivers-DDojgzz0.cjs.map} +1 -1
  115. package/dist/{encryption-BrEef7Jk.mjs → encryption-B6ilrT7p.mjs} +7 -6
  116. package/dist/encryption-B6ilrT7p.mjs.map +1 -0
  117. package/dist/{encryption-CjYdUb2s.cjs → encryption-D7zmwzWz.cjs} +7 -6
  118. package/dist/encryption-D7zmwzWz.cjs.map +1 -0
  119. package/dist/{engine-BhJ7ZP9K.cjs → engine-Cfx8fEZU.cjs} +40 -28
  120. package/dist/engine-Cfx8fEZU.cjs.map +1 -0
  121. package/dist/{engine-2h4k5ICq.mjs → engine-DjEcovm-.mjs} +40 -28
  122. package/dist/engine-DjEcovm-.mjs.map +1 -0
  123. package/dist/errors-D8Gwp5kU.mjs +23 -0
  124. package/dist/errors-D8Gwp5kU.mjs.map +1 -0
  125. package/dist/errors-DMC4Umsb.cjs +34 -0
  126. package/dist/errors-DMC4Umsb.cjs.map +1 -0
  127. package/dist/{github-BCDF6xVH.mjs → github-CzBbs43W.mjs} +31 -9
  128. package/dist/github-CzBbs43W.mjs.map +1 -0
  129. package/dist/{github-B5Bw4HIu.cjs → github-zneTMvnO.cjs} +31 -9
  130. package/dist/github-zneTMvnO.cjs.map +1 -0
  131. package/dist/{index-YFNxR5Ns.d.mts → index-BiYU7cUl.d.mts} +6 -6
  132. package/dist/{index-D-F_hTDz.d.cts.map → index-BiYU7cUl.d.mts.map} +1 -1
  133. package/dist/{index-D-F_hTDz.d.cts → index-Dm6V9bwh.d.cts} +6 -6
  134. package/dist/{index-YFNxR5Ns.d.mts.map → index-Dm6V9bwh.d.cts.map} +1 -1
  135. package/dist/index.cjs +256 -346
  136. package/dist/index.cjs.map +1 -1
  137. package/dist/index.mjs +252 -341
  138. package/dist/index.mjs.map +1 -1
  139. package/dist/{local-BjxDfPvy.cjs → local-B61kUh0w.cjs} +3 -3
  140. package/dist/{local-BjxDfPvy.cjs.map → local-B61kUh0w.cjs.map} +1 -1
  141. package/dist/{local-IuoIF3CT.mjs → local-Otp74ak0.mjs} +3 -3
  142. package/dist/{local-IuoIF3CT.mjs.map → local-Otp74ak0.mjs.map} +1 -1
  143. package/dist/{migrate-DWZz9kah.mjs → migrate-BaC4w0sb.mjs} +8 -7
  144. package/dist/migrate-BaC4w0sb.mjs.map +1 -0
  145. package/dist/{migrate-q2YYLJLE.cjs → migrate-C8wTpakT.cjs} +8 -7
  146. package/dist/migrate-C8wTpakT.cjs.map +1 -0
  147. package/dist/{migrate-DbtcuOr_.mjs → migrate-CsBZKALY.mjs} +9 -8
  148. package/dist/migrate-CsBZKALY.mjs.map +1 -0
  149. package/dist/{migrate-CGaancHY.cjs → migrate-DFjbGnSr.cjs} +8 -7
  150. package/dist/migrate-DFjbGnSr.cjs.map +1 -0
  151. package/dist/openapi.cjs +3 -3
  152. package/dist/openapi.d.cts +1 -10
  153. package/dist/openapi.d.cts.map +1 -1
  154. package/dist/openapi.d.mts +1 -10
  155. package/dist/openapi.d.mts.map +1 -1
  156. package/dist/openapi.mjs +3 -3
  157. package/dist/{provider-C9_-45d5.cjs → provider-BqpjG9QM.cjs} +4 -3
  158. package/dist/provider-BqpjG9QM.cjs.map +1 -0
  159. package/dist/{provider-q4lsYzYG.mjs → provider-CEOKk8NS.mjs} +4 -3
  160. package/dist/provider-CEOKk8NS.mjs.map +1 -0
  161. package/dist/{ready-BpNbORRB.cjs → ready-D3PIjx3S.cjs} +9 -8
  162. package/dist/ready-D3PIjx3S.cjs.map +1 -0
  163. package/dist/{ready-b6vm0-W-.mjs → ready-naOSJpeJ.mjs} +9 -8
  164. package/dist/ready-naOSJpeJ.mjs.map +1 -0
  165. package/dist/reconcile/public.cjs +1 -1
  166. package/dist/reconcile/public.d.cts +2 -2
  167. package/dist/reconcile/public.d.mts +2 -2
  168. package/dist/reconcile/public.mjs +1 -1
  169. package/dist/{reconcile-Dh1Jk7WE.mjs → reconcile--I7V4Klj.mjs} +2 -2
  170. package/dist/{reconcile-Dh1Jk7WE.mjs.map → reconcile--I7V4Klj.mjs.map} +1 -1
  171. package/dist/{resolve-DNg0icnh.mjs → resolve-Ccjlpnd9.mjs} +12 -11
  172. package/dist/resolve-Ccjlpnd9.mjs.map +1 -0
  173. package/dist/{resolve-Cns0v6dN.cjs → resolve-g8htuR80.cjs} +12 -11
  174. package/dist/resolve-g8htuR80.cjs.map +1 -0
  175. package/dist/{rollback-UIjS25F1.cjs → rollback--ympG9ss.cjs} +13 -11
  176. package/dist/rollback--ympG9ss.cjs.map +1 -0
  177. package/dist/{rollback-CFrNLmxs.mjs → rollback-Drbg0OeR.mjs} +13 -11
  178. package/dist/rollback-Drbg0OeR.mjs.map +1 -0
  179. package/dist/{runtime-CN_kmqxo.d.cts → runtime-D_J3ExJn.d.cts} +11 -19
  180. package/dist/runtime-D_J3ExJn.d.cts.map +1 -0
  181. package/dist/{runtime-Cjvon3oj.d.mts → runtime-_wEVtshH.d.mts} +11 -19
  182. package/dist/runtime-_wEVtshH.d.mts.map +1 -0
  183. package/dist/sandbox/credentials-worker.cjs +3 -3
  184. package/dist/sandbox/credentials-worker.mjs +3 -3
  185. package/dist/sandbox/discover-worker.cjs +1 -1
  186. package/dist/sandbox/discover-worker.mjs +1 -1
  187. package/dist/sandbox/migrate-worker.cjs +3 -3
  188. package/dist/sandbox/migrate-worker.mjs +3 -3
  189. package/dist/{sandbox-CL--ZDui.cjs → sandbox-CHv3OYXg.cjs} +4 -3
  190. package/dist/sandbox-CHv3OYXg.cjs.map +1 -0
  191. package/dist/{sandbox-M8UnLhXE.d.cts → sandbox-CPJq1Kia.d.mts} +4 -26
  192. package/dist/sandbox-CPJq1Kia.d.mts.map +1 -0
  193. package/dist/{sandbox-Dm247NGx.mjs → sandbox-CbVB7uOD.mjs} +4 -3
  194. package/dist/sandbox-CbVB7uOD.mjs.map +1 -0
  195. package/dist/{sandbox-M8UnLhXE.d.mts → sandbox-JwuPAl7I.d.cts} +4 -26
  196. package/dist/sandbox-JwuPAl7I.d.cts.map +1 -0
  197. package/dist/secrets-DJteijZo.cjs +47 -0
  198. package/dist/secrets-DJteijZo.cjs.map +1 -0
  199. package/dist/secrets-DbPmAS4k.mjs +36 -0
  200. package/dist/secrets-DbPmAS4k.mjs.map +1 -0
  201. package/dist/{secretsManager-Chs9VV2r.mjs → secretsManager-C6wm-9uZ.mjs} +24 -3
  202. package/dist/secretsManager-C6wm-9uZ.mjs.map +1 -0
  203. package/dist/{secretsManager-DcMlHnRC.cjs → secretsManager-Cwwgs81g.cjs} +24 -3
  204. package/dist/secretsManager-Cwwgs81g.cjs.map +1 -0
  205. package/dist/{seeds-odfgSCmu.mjs → seeds-BSL55F6q.mjs} +946 -107
  206. package/dist/seeds-BSL55F6q.mjs.map +1 -0
  207. package/dist/{seeds-CkIPFGNO.cjs → seeds-c-ByX9je.cjs} +1065 -130
  208. package/dist/seeds-c-ByX9je.cjs.map +1 -0
  209. package/dist/{sniffer-BTtX3NUM.mjs → sniffer-BTtGAtm3.mjs} +14 -8
  210. package/dist/sniffer-BTtGAtm3.mjs.map +1 -0
  211. package/dist/{sniffer-IAQEpsQb.cjs → sniffer-Dq5BS98f.cjs} +14 -8
  212. package/dist/{sniffer-IAQEpsQb.cjs.map → sniffer-Dq5BS98f.cjs.map} +1 -1
  213. package/dist/{sst-CJzvyrEz.mjs → sst-BaRXp2Dd.mjs} +18 -8
  214. package/dist/sst-BaRXp2Dd.mjs.map +1 -0
  215. package/dist/{sst-BgcOsaBi.cjs → sst-CnKY-CSh.cjs} +18 -8
  216. package/dist/sst-CnKY-CSh.cjs.map +1 -0
  217. package/dist/stack-1PeLJS2j.cjs +1346 -0
  218. package/dist/stack-1PeLJS2j.cjs.map +1 -0
  219. package/dist/stack-Co4uZkAo.mjs +1239 -0
  220. package/dist/stack-Co4uZkAo.mjs.map +1 -0
  221. package/dist/{stages-CUn6gvXL.cjs → stages-BI8JvPzI.cjs} +6 -5
  222. package/dist/stages-BI8JvPzI.cjs.map +1 -0
  223. package/dist/{stages-CnZRYmkI.mjs → stages-DY-fQKmo.mjs} +6 -5
  224. package/dist/stages-DY-fQKmo.mjs.map +1 -0
  225. package/dist/target/public.cjs +3 -3
  226. package/dist/target/public.d.cts +2 -2
  227. package/dist/target/public.d.mts +2 -2
  228. package/dist/target/public.mjs +3 -3
  229. package/dist/{terminal-DuapRxh6.cjs → terminal-8XngdSTo.cjs} +6 -5
  230. package/dist/terminal-8XngdSTo.cjs.map +1 -0
  231. package/dist/{terminal-D8TPK7o9.mjs → terminal-C4XRdwnU.mjs} +7 -6
  232. package/dist/terminal-C4XRdwnU.mjs.map +1 -0
  233. package/dist/{types-NqX1Hz4P.d.cts → types-B6lmD3en.d.mts} +94 -47
  234. package/dist/types-B6lmD3en.d.mts.map +1 -0
  235. package/dist/{types-ZHuZ89hv.d.mts → types-BibpiHKB.d.cts} +95 -46
  236. package/dist/types-BibpiHKB.d.cts.map +1 -0
  237. package/dist/vitest.cjs +1 -1
  238. package/dist/vitest.mjs +1 -1
  239. package/dist/workspace/index.cjs +1 -1
  240. package/dist/workspace/index.d.cts +2 -2
  241. package/dist/workspace/index.d.mts +2 -2
  242. package/dist/workspace/index.mjs +1 -1
  243. package/dist/{workspace-CJ0lKFq-.mjs → workspace-Bzw7Zs82.mjs} +34 -33
  244. package/dist/workspace-Bzw7Zs82.mjs.map +1 -0
  245. package/dist/{workspace-CwW3Gkru.cjs → workspace-CHOB2Xg3.cjs} +34 -33
  246. package/dist/workspace-CHOB2Xg3.cjs.map +1 -0
  247. package/package.json +15 -15
  248. package/dist/EndpointGenerator-CVc6Oi1Y.mjs.map +0 -1
  249. package/dist/EndpointGenerator-CwLjBCFE.cjs.map +0 -1
  250. package/dist/GoDaddyProvider-DSStJVAv.mjs.map +0 -1
  251. package/dist/GoDaddyProvider-DqZ1qD_F.cjs.map +0 -1
  252. package/dist/LegacyStateStore-DXmNA7hy.cjs.map +0 -1
  253. package/dist/LegacyStateStore-ZkdmiUFZ.mjs +0 -89
  254. package/dist/LegacyStateStore-ZkdmiUFZ.mjs.map +0 -1
  255. package/dist/SubscriberGenerator-BPqQf8fB.mjs.map +0 -1
  256. package/dist/SubscriberGenerator-BVn7cQ-2.cjs.map +0 -1
  257. package/dist/add-BSHk5Ngn.mjs.map +0 -1
  258. package/dist/add-DmmBDV2e.cjs.map +0 -1
  259. package/dist/aws-B-6uEhgP.mjs.map +0 -1
  260. package/dist/aws-BTawF0F-.cjs.map +0 -1
  261. package/dist/awsStore-7VmS_cZR.cjs +0 -54
  262. package/dist/awsStore-7VmS_cZR.cjs.map +0 -1
  263. package/dist/awsStore-B529csle.mjs +0 -43
  264. package/dist/awsStore-B529csle.mjs.map +0 -1
  265. package/dist/compose-Bhmf0n4o.mjs +0 -3140
  266. package/dist/compose-Bhmf0n4o.mjs.map +0 -1
  267. package/dist/compose-CvpU6ooi.cjs +0 -3265
  268. package/dist/compose-CvpU6ooi.cjs.map +0 -1
  269. package/dist/credentialSchemas-BJqRJNK4.mjs.map +0 -1
  270. package/dist/credentialSchemas-DCR4Wd1W.cjs.map +0 -1
  271. package/dist/credentials-BKfIugu2.cjs.map +0 -1
  272. package/dist/databases-BY-pEImp.cjs.map +0 -1
  273. package/dist/databases-CzszQV0N.mjs.map +0 -1
  274. package/dist/define-DR8xGYfL.mjs.map +0 -1
  275. package/dist/define-DzRz8FgH.cjs.map +0 -1
  276. package/dist/deploy-CuHasEA4.cjs.map +0 -1
  277. package/dist/deploy-QNtx_eWR.mjs.map +0 -1
  278. package/dist/discover-BPelzeGW.mjs.map +0 -1
  279. package/dist/discover-D1It5r_h.cjs.map +0 -1
  280. package/dist/encryption-BrEef7Jk.mjs.map +0 -1
  281. package/dist/encryption-CjYdUb2s.cjs.map +0 -1
  282. package/dist/engine-2h4k5ICq.mjs.map +0 -1
  283. package/dist/engine-BhJ7ZP9K.cjs.map +0 -1
  284. package/dist/github-B5Bw4HIu.cjs.map +0 -1
  285. package/dist/github-BCDF6xVH.mjs.map +0 -1
  286. package/dist/migrate-CGaancHY.cjs.map +0 -1
  287. package/dist/migrate-DWZz9kah.mjs.map +0 -1
  288. package/dist/migrate-DbtcuOr_.mjs.map +0 -1
  289. package/dist/migrate-q2YYLJLE.cjs.map +0 -1
  290. package/dist/provider-C9_-45d5.cjs.map +0 -1
  291. package/dist/provider-q4lsYzYG.mjs.map +0 -1
  292. package/dist/ready-BpNbORRB.cjs.map +0 -1
  293. package/dist/ready-b6vm0-W-.mjs.map +0 -1
  294. package/dist/resolve-Cns0v6dN.cjs.map +0 -1
  295. package/dist/resolve-DNg0icnh.mjs.map +0 -1
  296. package/dist/rollback-CFrNLmxs.mjs.map +0 -1
  297. package/dist/rollback-UIjS25F1.cjs.map +0 -1
  298. package/dist/runtime-CN_kmqxo.d.cts.map +0 -1
  299. package/dist/runtime-Cjvon3oj.d.mts.map +0 -1
  300. package/dist/sandbox-CL--ZDui.cjs.map +0 -1
  301. package/dist/sandbox-Dm247NGx.mjs.map +0 -1
  302. package/dist/sandbox-M8UnLhXE.d.cts.map +0 -1
  303. package/dist/sandbox-M8UnLhXE.d.mts.map +0 -1
  304. package/dist/secretsManager-Chs9VV2r.mjs.map +0 -1
  305. package/dist/secretsManager-DcMlHnRC.cjs.map +0 -1
  306. package/dist/seeds-CkIPFGNO.cjs.map +0 -1
  307. package/dist/seeds-odfgSCmu.mjs.map +0 -1
  308. package/dist/sniffer-BTtX3NUM.mjs.map +0 -1
  309. package/dist/sst-BgcOsaBi.cjs.map +0 -1
  310. package/dist/sst-CJzvyrEz.mjs.map +0 -1
  311. package/dist/stages-CUn6gvXL.cjs.map +0 -1
  312. package/dist/stages-CnZRYmkI.mjs.map +0 -1
  313. package/dist/terminal-D8TPK7o9.mjs.map +0 -1
  314. package/dist/terminal-DuapRxh6.cjs.map +0 -1
  315. package/dist/types-NqX1Hz4P.d.cts.map +0 -1
  316. package/dist/types-ZHuZ89hv.d.mts.map +0 -1
  317. package/dist/workspace-CJ0lKFq-.mjs.map +0 -1
  318. package/dist/workspace-CwW3Gkru.cjs.map +0 -1
@@ -1,11 +1,12 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
- const require_credentials = require("./credentials-BKfIugu2.cjs");
3
- const require_sandbox = require("./sandbox-CL--ZDui.cjs");
4
- const require_workspace = require("./workspace-CwW3Gkru.cjs");
2
+ const require_errors = require("./errors-DMC4Umsb.cjs");
3
+ const require_credentials = require("./credentials-QBu7VgaQ.cjs");
4
+ const require_sandbox = require("./sandbox-CHv3OYXg.cjs");
5
+ const require_workspace = require("./workspace-CHOB2Xg3.cjs");
5
6
  const require_config = require("./config.cjs");
6
- const require_seeds = require("./seeds-CkIPFGNO.cjs");
7
- const require_local = require("./local-BjxDfPvy.cjs");
8
- const require_engine = require("./engine-BhJ7ZP9K.cjs");
7
+ const require_seeds = require("./seeds-c-ByX9je.cjs");
8
+ const require_local = require("./local-B61kUh0w.cjs");
9
+ const require_engine = require("./engine-Cfx8fEZU.cjs");
9
10
  let node_path = require("node:path");
10
11
  //#region src/target/dokploy/rollback.ts
11
12
  /**
@@ -30,7 +31,7 @@ var rollback_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
30
31
  rollbackStage: () => rollbackStage
31
32
  });
32
33
  /** Neither an app nor every app was asked for. */
33
- var RollbackNeedsApp = class extends Error {
34
+ var RollbackNeedsApp = class extends require_errors.GkmError {
34
35
  stage;
35
36
  apps;
36
37
  constructor(stage, apps) {
@@ -41,7 +42,7 @@ var RollbackNeedsApp = class extends Error {
41
42
  }
42
43
  };
43
44
  /** An app has no release before the one it runs. */
44
- var NothingToRollBack = class extends Error {
45
+ var NothingToRollBack = class extends require_errors.GkmError {
45
46
  stage;
46
47
  app;
47
48
  constructor(stage, app) {
@@ -52,7 +53,7 @@ var NothingToRollBack = class extends Error {
52
53
  }
53
54
  };
54
55
  /** The stage was never deployed through Dokploy from this state. */
55
- var StageNeverDeployed = class extends Error {
56
+ var StageNeverDeployed = class extends require_errors.GkmError {
56
57
  stage;
57
58
  constructor(stage) {
58
59
  super(`"${stage}" has no deploy state, so there is nothing to roll back. Check the stage name, and that \`state\` in gkm.config.ts points at the store the deploys write to.`);
@@ -72,6 +73,7 @@ async function rollbackStage(input) {
72
73
  return require_sandbox.withSandbox(sandbox, async () => {
73
74
  const { workspace } = await require_config.loadWorkspaceConfig((0, node_path.resolve)(input.cwd), { sandbox });
74
75
  require_workspace.assertDeployedStage(workspace.stages, input.stage);
76
+ require_seeds.assertStateOutlivesRun(workspace, input.stage, "deploy:rollback");
75
77
  const store = await require_seeds.createStateStore({
76
78
  config: workspace.state,
77
79
  workspaceRoot: workspace.root,
@@ -80,7 +82,7 @@ async function rollbackStage(input) {
80
82
  if (!await store.read(input.stage)) throw new StageNeverDeployed(input.stage);
81
83
  const lock = await store.lock(input.stage, { operation: "rollback" });
82
84
  try {
83
- const journal = await require_seeds.DeployJournal.open(store, input.stage, () => require_seeds.createEmptyState(input.stage, "", ""));
85
+ const journal = await require_seeds.DeployJournal.open(store, input.stage, () => require_seeds.createEmptyState(input.stage, "", ""), require_seeds.asDokployState);
84
86
  const { state } = journal;
85
87
  const releases = state.releases ?? {};
86
88
  const restorable = Object.keys(releases).filter((app) => releases[app].previous);
@@ -158,4 +160,4 @@ Object.defineProperty(exports, "rollback_exports", {
158
160
  }
159
161
  });
160
162
 
161
- //# sourceMappingURL=rollback-UIjS25F1.cjs.map
163
+ //# sourceMappingURL=rollback--ympG9ss.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollback--ympG9ss.cjs","names":["GkmError","storedCredentials","LocalSandbox","findWorkspaceRoot","resolve","withSandbox","loadWorkspaceConfig","createStateStore","DeployJournal","createEmptyState","asDokployState","dokployApi","verifySettings","restoreImage"],"sources":["../src/target/dokploy/rollback.ts"],"sourcesContent":["/**\n * `gkm deploy:rollback`: a stage's apps put back on the release before the\n * one they run, by hand — for a release that passed its checks and turned out\n * wrong anyway.\n *\n * One app by default, because an app is what usually broke: rolling the API\n * back over a site fix that shipped beside it undoes the fix too. `atomic`\n * rolls back every app that has a release to go back to, for apps that only\n * work together — an API and the site built against its newer contract.\n *\n * It restores images and nothing else. The environment an app runs with is\n * the stage's, resolved on every deploy, and migrations are forward-only: a\n * migration that the older code cannot run against is undone by a new\n * migration, never by a rollback.\n */\n\nimport { resolve } from 'node:path';\nimport { findWorkspaceRoot, loadWorkspaceConfig } from '../../config';\nimport {\n\ttype CredentialProvider,\n\tstoredCredentials,\n} from '../../deploy/credentials';\nimport { DeployJournal } from '../../deploy/journal';\nimport {\n\tassertStateOutlivesRun,\n\tcreateStateStore,\n} from '../../deploy/StateStore';\nimport {\n\tasDokployState,\n\tcreateEmptyState,\n\ttype ReleasedImage,\n\trecordRollback,\n} from '../../deploy/state';\nimport { GkmError } from '../../errors';\nimport { LocalSandbox } from '../../sandbox/local';\nimport { type Sandbox, withSandbox } from '../../sandbox/sandbox';\nimport { assertDeployedStage } from '../../workspace/stages';\nimport { dokployApi, restoreImage, verifySettings } from './engine';\n\nexport interface RollbackInput {\n\t/** The project: the directory holding `gkm.config.ts`, or one inside it. */\n\tcwd: string;\n\tstage: string;\n\t/** The app to roll back. */\n\tapp?: string;\n\t/** Every app with an earlier release, instead of one. */\n\tatomic?: boolean;\n\t/** Defaults to the environment, then the logins `gkm login` stored. */\n\tcredentials?: CredentialProvider;\n\tsignal?: AbortSignal;\n\t/** Each progress line. Defaults to none. */\n\tlog?: (line: string) => void;\n\t/** Where the config is loaded. Defaults to a `LocalSandbox` on the project. */\n\tsandbox?: Sandbox;\n}\n\n/** One app rolled back. */\nexport interface RolledBack {\n\tapp: string;\n\tfrom: ReleasedImage;\n\tto: ReleasedImage;\n}\n\n/** Neither an app nor every app was asked for. */\nexport class RollbackNeedsApp extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\t/** The apps that have a release to go back to. */\n\t\treadonly apps: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`Say what to roll back: --app <name> for one app (${apps.join(', ') || 'none has an earlier release'}), ` +\n\t\t\t\t`or --atomic for every app of \"${stage}\" together.`,\n\t\t);\n\t\tthis.name = 'RollbackNeedsApp';\n\t}\n}\n\n/** An app has no release before the one it runs. */\nexport class NothingToRollBack extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly app: string,\n\t) {\n\t\tsuper(\n\t\t\t`\"${app}\" has no earlier release on \"${stage}\" to roll back to: it has been released once, ` +\n\t\t\t\t'or every earlier release was itself rolled back. Deploy the version you want instead.',\n\t\t);\n\t\tthis.name = 'NothingToRollBack';\n\t}\n}\n\n/** The stage was never deployed through Dokploy from this state. */\nexport class StageNeverDeployed extends GkmError {\n\tconstructor(readonly stage: string) {\n\t\tsuper(\n\t\t\t`\"${stage}\" has no deploy state, so there is nothing to roll back. ` +\n\t\t\t\t'Check the stage name, and that `state` in gkm.config.ts points at the store the deploys write to.',\n\t\t);\n\t\tthis.name = 'StageNeverDeployed';\n\t}\n}\n\n/**\n * Roll a stage's app — or, `atomic`, all of them — back to its previous\n * release, holding the stage's lock as a deploy does.\n */\nexport async function rollbackStage(\n\tinput: RollbackInput,\n): Promise<RolledBack[]> {\n\tconst signal = input.signal ?? new AbortController().signal;\n\tconst log = input.log ?? (() => {});\n\tconst credentials = input.credentials ?? storedCredentials();\n\tconst sandbox =\n\t\tinput.sandbox ??\n\t\tnew LocalSandbox({ root: findWorkspaceRoot(resolve(input.cwd)) });\n\n\treturn withSandbox(sandbox, async () => {\n\t\tconst { workspace } = await loadWorkspaceConfig(resolve(input.cwd), {\n\t\t\tsandbox,\n\t\t});\n\t\tassertDeployedStage(workspace.stages, input.stage);\n\t\tassertStateOutlivesRun(workspace, input.stage, 'deploy:rollback');\n\n\t\tconst store = await createStateStore({\n\t\t\tconfig: workspace.state,\n\t\t\tworkspaceRoot: workspace.root,\n\t\t\tworkspaceName: workspace.name,\n\t\t});\n\t\tif (!(await store.read(input.stage))) {\n\t\t\tthrow new StageNeverDeployed(input.stage);\n\t\t}\n\n\t\tconst lock = await store.lock(input.stage, { operation: 'rollback' });\n\t\ttry {\n\t\t\tconst journal = await DeployJournal.open(\n\t\t\t\tstore,\n\t\t\t\tinput.stage,\n\t\t\t\t() => createEmptyState(input.stage, '', ''),\n\t\t\t\tasDokployState,\n\t\t\t);\n\t\t\tconst { state } = journal;\n\t\t\tconst releases = state.releases ?? {};\n\t\t\tconst restorable = Object.keys(releases).filter(\n\t\t\t\t(app) => releases[app]!.previous,\n\t\t\t);\n\n\t\t\tlet apps: string[];\n\t\t\tif (input.atomic) {\n\t\t\t\tapps = restorable;\n\t\t\t\tif (apps.length === 0) {\n\t\t\t\t\tthrow new RollbackNeedsApp(input.stage, restorable);\n\t\t\t\t}\n\t\t\t} else if (input.app) {\n\t\t\t\tif (!releases[input.app]?.previous) {\n\t\t\t\t\tthrow new NothingToRollBack(input.stage, input.app);\n\t\t\t\t}\n\t\t\t\tapps = [input.app];\n\t\t\t} else {\n\t\t\t\tthrow new RollbackNeedsApp(input.stage, restorable);\n\t\t\t}\n\n\t\t\tconst { api } = await dokployApi(workspace, { credentials, signal });\n\t\t\tconst verify = verifySettings(workspace.deploy.dokploy?.verify);\n\t\t\tconst rolled: RolledBack[] = [];\n\n\t\t\tfor (const app of apps) {\n\t\t\t\tsignal.throwIfAborted();\n\t\t\t\tconst { current, previous } = releases[app]!;\n\t\t\t\tconst applicationId = state.applications[app];\n\t\t\t\tif (!previous || !applicationId) {\n\t\t\t\t\tthrow new NothingToRollBack(input.stage, app);\n\t\t\t\t}\n\n\t\t\t\tlog(`⏪ ${app}: ${current.ref} → ${previous.ref}`);\n\t\t\t\tawait restoreImage(api, {\n\t\t\t\t\tapplicationId,\n\t\t\t\t\timage: previous,\n\t\t\t\t\tregistryId: state.registryId,\n\t\t\t\t\tverify,\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\t\t\t\trecordRollback(state, app, previous);\n\t\t\t\tawait journal.save();\n\t\t\t\tlog(` ✓ ${app} is running ${previous.ref}`);\n\t\t\t\trolled.push({ app, from: current, to: previous });\n\t\t\t}\n\n\t\t\treturn rolled;\n\t\t} finally {\n\t\t\tawait lock.release();\n\t\t}\n\t});\n}\n"],"mappings":"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"}
@@ -1,11 +1,12 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
2
- import { r as storedCredentials } from "./credentials-CnVqoXMb.mjs";
3
- import { c as withSandbox } from "./sandbox-Dm247NGx.mjs";
4
- import { N as assertDeployedStage } from "./workspace-CJ0lKFq-.mjs";
2
+ import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
3
+ import { r as storedCredentials } from "./credentials-C4KII3PD.mjs";
4
+ import { c as withSandbox } from "./sandbox-CbVB7uOD.mjs";
5
+ import { N as assertDeployedStage } from "./workspace-Bzw7Zs82.mjs";
5
6
  import { findWorkspaceRoot, loadWorkspaceConfig } from "./config.mjs";
6
- import { T as createEmptyState, U as createStateStore, k as recordRollback, s as DeployJournal } from "./seeds-odfgSCmu.mjs";
7
- import { t as LocalSandbox } from "./local-IuoIF3CT.mjs";
8
- import { i as dokployApi, l as restoreImage, p as verifySettings } from "./engine-2h4k5ICq.mjs";
7
+ import { M as asDokployState, P as createEmptyState, Q as assertStateOutlivesRun, R as recordRollback, et as createStateStore, u as DeployJournal } from "./seeds-BSL55F6q.mjs";
8
+ import { t as LocalSandbox } from "./local-Otp74ak0.mjs";
9
+ import { i as dokployApi, l as restoreImage, p as verifySettings } from "./engine-DjEcovm-.mjs";
9
10
  import { resolve } from "node:path";
10
11
  //#region src/target/dokploy/rollback.ts
11
12
  /**
@@ -30,7 +31,7 @@ var rollback_exports = /* @__PURE__ */ __exportAll({
30
31
  rollbackStage: () => rollbackStage
31
32
  });
32
33
  /** Neither an app nor every app was asked for. */
33
- var RollbackNeedsApp = class extends Error {
34
+ var RollbackNeedsApp = class extends GkmError {
34
35
  stage;
35
36
  apps;
36
37
  constructor(stage, apps) {
@@ -41,7 +42,7 @@ var RollbackNeedsApp = class extends Error {
41
42
  }
42
43
  };
43
44
  /** An app has no release before the one it runs. */
44
- var NothingToRollBack = class extends Error {
45
+ var NothingToRollBack = class extends GkmError {
45
46
  stage;
46
47
  app;
47
48
  constructor(stage, app) {
@@ -52,7 +53,7 @@ var NothingToRollBack = class extends Error {
52
53
  }
53
54
  };
54
55
  /** The stage was never deployed through Dokploy from this state. */
55
- var StageNeverDeployed = class extends Error {
56
+ var StageNeverDeployed = class extends GkmError {
56
57
  stage;
57
58
  constructor(stage) {
58
59
  super(`"${stage}" has no deploy state, so there is nothing to roll back. Check the stage name, and that \`state\` in gkm.config.ts points at the store the deploys write to.`);
@@ -72,6 +73,7 @@ async function rollbackStage(input) {
72
73
  return withSandbox(sandbox, async () => {
73
74
  const { workspace } = await loadWorkspaceConfig(resolve(input.cwd), { sandbox });
74
75
  assertDeployedStage(workspace.stages, input.stage);
76
+ assertStateOutlivesRun(workspace, input.stage, "deploy:rollback");
75
77
  const store = await createStateStore({
76
78
  config: workspace.state,
77
79
  workspaceRoot: workspace.root,
@@ -80,7 +82,7 @@ async function rollbackStage(input) {
80
82
  if (!await store.read(input.stage)) throw new StageNeverDeployed(input.stage);
81
83
  const lock = await store.lock(input.stage, { operation: "rollback" });
82
84
  try {
83
- const journal = await DeployJournal.open(store, input.stage, () => createEmptyState(input.stage, "", ""));
85
+ const journal = await DeployJournal.open(store, input.stage, () => createEmptyState(input.stage, "", ""), asDokployState);
84
86
  const { state } = journal;
85
87
  const releases = state.releases ?? {};
86
88
  const restorable = Object.keys(releases).filter((app) => releases[app].previous);
@@ -129,4 +131,4 @@ async function rollbackStage(input) {
129
131
  //#endregion
130
132
  export { rollback_exports as a, rollbackStage as i, RollbackNeedsApp as n, StageNeverDeployed as r, NothingToRollBack as t };
131
133
 
132
- //# sourceMappingURL=rollback-CFrNLmxs.mjs.map
134
+ //# sourceMappingURL=rollback-Drbg0OeR.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollback-Drbg0OeR.mjs","names":[],"sources":["../src/target/dokploy/rollback.ts"],"sourcesContent":["/**\n * `gkm deploy:rollback`: a stage's apps put back on the release before the\n * one they run, by hand — for a release that passed its checks and turned out\n * wrong anyway.\n *\n * One app by default, because an app is what usually broke: rolling the API\n * back over a site fix that shipped beside it undoes the fix too. `atomic`\n * rolls back every app that has a release to go back to, for apps that only\n * work together — an API and the site built against its newer contract.\n *\n * It restores images and nothing else. The environment an app runs with is\n * the stage's, resolved on every deploy, and migrations are forward-only: a\n * migration that the older code cannot run against is undone by a new\n * migration, never by a rollback.\n */\n\nimport { resolve } from 'node:path';\nimport { findWorkspaceRoot, loadWorkspaceConfig } from '../../config';\nimport {\n\ttype CredentialProvider,\n\tstoredCredentials,\n} from '../../deploy/credentials';\nimport { DeployJournal } from '../../deploy/journal';\nimport {\n\tassertStateOutlivesRun,\n\tcreateStateStore,\n} from '../../deploy/StateStore';\nimport {\n\tasDokployState,\n\tcreateEmptyState,\n\ttype ReleasedImage,\n\trecordRollback,\n} from '../../deploy/state';\nimport { GkmError } from '../../errors';\nimport { LocalSandbox } from '../../sandbox/local';\nimport { type Sandbox, withSandbox } from '../../sandbox/sandbox';\nimport { assertDeployedStage } from '../../workspace/stages';\nimport { dokployApi, restoreImage, verifySettings } from './engine';\n\nexport interface RollbackInput {\n\t/** The project: the directory holding `gkm.config.ts`, or one inside it. */\n\tcwd: string;\n\tstage: string;\n\t/** The app to roll back. */\n\tapp?: string;\n\t/** Every app with an earlier release, instead of one. */\n\tatomic?: boolean;\n\t/** Defaults to the environment, then the logins `gkm login` stored. */\n\tcredentials?: CredentialProvider;\n\tsignal?: AbortSignal;\n\t/** Each progress line. Defaults to none. */\n\tlog?: (line: string) => void;\n\t/** Where the config is loaded. Defaults to a `LocalSandbox` on the project. */\n\tsandbox?: Sandbox;\n}\n\n/** One app rolled back. */\nexport interface RolledBack {\n\tapp: string;\n\tfrom: ReleasedImage;\n\tto: ReleasedImage;\n}\n\n/** Neither an app nor every app was asked for. */\nexport class RollbackNeedsApp extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\t/** The apps that have a release to go back to. */\n\t\treadonly apps: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`Say what to roll back: --app <name> for one app (${apps.join(', ') || 'none has an earlier release'}), ` +\n\t\t\t\t`or --atomic for every app of \"${stage}\" together.`,\n\t\t);\n\t\tthis.name = 'RollbackNeedsApp';\n\t}\n}\n\n/** An app has no release before the one it runs. */\nexport class NothingToRollBack extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly app: string,\n\t) {\n\t\tsuper(\n\t\t\t`\"${app}\" has no earlier release on \"${stage}\" to roll back to: it has been released once, ` +\n\t\t\t\t'or every earlier release was itself rolled back. Deploy the version you want instead.',\n\t\t);\n\t\tthis.name = 'NothingToRollBack';\n\t}\n}\n\n/** The stage was never deployed through Dokploy from this state. */\nexport class StageNeverDeployed extends GkmError {\n\tconstructor(readonly stage: string) {\n\t\tsuper(\n\t\t\t`\"${stage}\" has no deploy state, so there is nothing to roll back. ` +\n\t\t\t\t'Check the stage name, and that `state` in gkm.config.ts points at the store the deploys write to.',\n\t\t);\n\t\tthis.name = 'StageNeverDeployed';\n\t}\n}\n\n/**\n * Roll a stage's app — or, `atomic`, all of them — back to its previous\n * release, holding the stage's lock as a deploy does.\n */\nexport async function rollbackStage(\n\tinput: RollbackInput,\n): Promise<RolledBack[]> {\n\tconst signal = input.signal ?? new AbortController().signal;\n\tconst log = input.log ?? (() => {});\n\tconst credentials = input.credentials ?? storedCredentials();\n\tconst sandbox =\n\t\tinput.sandbox ??\n\t\tnew LocalSandbox({ root: findWorkspaceRoot(resolve(input.cwd)) });\n\n\treturn withSandbox(sandbox, async () => {\n\t\tconst { workspace } = await loadWorkspaceConfig(resolve(input.cwd), {\n\t\t\tsandbox,\n\t\t});\n\t\tassertDeployedStage(workspace.stages, input.stage);\n\t\tassertStateOutlivesRun(workspace, input.stage, 'deploy:rollback');\n\n\t\tconst store = await createStateStore({\n\t\t\tconfig: workspace.state,\n\t\t\tworkspaceRoot: workspace.root,\n\t\t\tworkspaceName: workspace.name,\n\t\t});\n\t\tif (!(await store.read(input.stage))) {\n\t\t\tthrow new StageNeverDeployed(input.stage);\n\t\t}\n\n\t\tconst lock = await store.lock(input.stage, { operation: 'rollback' });\n\t\ttry {\n\t\t\tconst journal = await DeployJournal.open(\n\t\t\t\tstore,\n\t\t\t\tinput.stage,\n\t\t\t\t() => createEmptyState(input.stage, '', ''),\n\t\t\t\tasDokployState,\n\t\t\t);\n\t\t\tconst { state } = journal;\n\t\t\tconst releases = state.releases ?? {};\n\t\t\tconst restorable = Object.keys(releases).filter(\n\t\t\t\t(app) => releases[app]!.previous,\n\t\t\t);\n\n\t\t\tlet apps: string[];\n\t\t\tif (input.atomic) {\n\t\t\t\tapps = restorable;\n\t\t\t\tif (apps.length === 0) {\n\t\t\t\t\tthrow new RollbackNeedsApp(input.stage, restorable);\n\t\t\t\t}\n\t\t\t} else if (input.app) {\n\t\t\t\tif (!releases[input.app]?.previous) {\n\t\t\t\t\tthrow new NothingToRollBack(input.stage, input.app);\n\t\t\t\t}\n\t\t\t\tapps = [input.app];\n\t\t\t} else {\n\t\t\t\tthrow new RollbackNeedsApp(input.stage, restorable);\n\t\t\t}\n\n\t\t\tconst { api } = await dokployApi(workspace, { credentials, signal });\n\t\t\tconst verify = verifySettings(workspace.deploy.dokploy?.verify);\n\t\t\tconst rolled: RolledBack[] = [];\n\n\t\t\tfor (const app of apps) {\n\t\t\t\tsignal.throwIfAborted();\n\t\t\t\tconst { current, previous } = releases[app]!;\n\t\t\t\tconst applicationId = state.applications[app];\n\t\t\t\tif (!previous || !applicationId) {\n\t\t\t\t\tthrow new NothingToRollBack(input.stage, app);\n\t\t\t\t}\n\n\t\t\t\tlog(`⏪ ${app}: ${current.ref} → ${previous.ref}`);\n\t\t\t\tawait restoreImage(api, {\n\t\t\t\t\tapplicationId,\n\t\t\t\t\timage: previous,\n\t\t\t\t\tregistryId: state.registryId,\n\t\t\t\t\tverify,\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\t\t\t\trecordRollback(state, app, previous);\n\t\t\t\tawait journal.save();\n\t\t\t\tlog(` ✓ ${app} is running ${previous.ref}`);\n\t\t\t\trolled.push({ app, from: current, to: previous });\n\t\t\t}\n\n\t\t\treturn rolled;\n\t\t} finally {\n\t\t\tawait lock.release();\n\t\t}\n\t});\n}\n"],"mappings":"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"}
@@ -1,7 +1,7 @@
1
- import { K as DeployRuntime, et as TargetOptionsIssue } from "./types-NqX1Hz4P.cjs";
1
+ import { K as DeployRuntime, et as TargetOptionsIssue, jt as GkmError } from "./types-BibpiHKB.cjs";
2
2
  //#region src/target/builtins.d.ts
3
3
  /** A target name that is neither built in nor in `deploy.targets`. */
4
- declare class UnknownDeployTarget extends Error {
4
+ declare class UnknownDeployTarget extends GkmError {
5
5
  readonly target: string;
6
6
  /** The names that would have resolved. */
7
7
  readonly known: readonly string[];
@@ -10,7 +10,7 @@ declare class UnknownDeployTarget extends Error {
10
10
  known: readonly string[]);
11
11
  }
12
12
  /** A built-in target `gkm deploy` cannot deploy through yet. */
13
- declare class DeployTargetNotYetSupported extends Error {
13
+ declare class DeployTargetNotYetSupported extends GkmError {
14
14
  readonly target: string;
15
15
  /** What to do instead, when there is something. */
16
16
  readonly instead?: string | undefined;
@@ -21,7 +21,7 @@ declare class DeployTargetNotYetSupported extends Error {
21
21
  //#endregion
22
22
  //#region src/target/package.d.ts
23
23
  /** A target package the project does not have installed. */
24
- declare class TargetPackageNotFound extends Error {
24
+ declare class TargetPackageNotFound extends GkmError {
25
25
  readonly target: string;
26
26
  readonly packageName: string;
27
27
  readonly from: string;
@@ -29,16 +29,8 @@ declare class TargetPackageNotFound extends Error {
29
29
  }
30
30
  //#endregion
31
31
  //#region src/target/provider.d.ts
32
- /**
33
- * `gkm deploy --provider`, from before there were targets.
34
- *
35
- * It named three things, and only one of them ever deployed a workspace:
36
- * `dokploy` is now the target of that name; `docker` and `aws-lambda` were
37
- * accepted and always failed, so they are gone with a pointer to what does
38
- * the job.
39
- */
40
32
  /** A `--provider` that no longer exists. */
41
- declare class ProviderRemoved extends Error {
33
+ declare class ProviderRemoved extends GkmError {
42
34
  readonly provider: string;
43
35
  /** What to use instead. */
44
36
  readonly instead: string;
@@ -49,18 +41,18 @@ declare class ProviderRemoved extends Error {
49
41
  //#endregion
50
42
  //#region src/target/resolve.d.ts
51
43
  /** A target package whose default export is not a target. */
52
- declare class TargetPackageInvalid extends Error {
44
+ declare class TargetPackageInvalid extends GkmError {
53
45
  readonly target: string;
54
46
  readonly packageName: string;
55
47
  constructor(target: string, packageName: string);
56
48
  }
57
49
  /** A `deploy.targets` entry that is not a target, a package name or a pair. */
58
- declare class TargetEntryInvalid extends Error {
50
+ declare class TargetEntryInvalid extends GkmError {
59
51
  readonly target: string;
60
52
  constructor(target: string);
61
53
  }
62
54
  /** A target whose `runtime` is not the one its package declares. */
63
- declare class TargetRuntimeMismatch extends Error {
55
+ declare class TargetRuntimeMismatch extends GkmError {
64
56
  readonly target: string;
65
57
  readonly packageName: string;
66
58
  readonly declared: DeployRuntime;
@@ -68,7 +60,7 @@ declare class TargetRuntimeMismatch extends Error {
68
60
  constructor(target: string, packageName: string, declared: DeployRuntime, actual: DeployRuntime);
69
61
  }
70
62
  /** Options a target's schema rejected. */
71
- declare class InvalidTargetOptions extends Error {
63
+ declare class InvalidTargetOptions extends GkmError {
72
64
  readonly target: string;
73
65
  readonly issues: readonly TargetOptionsIssue[];
74
66
  constructor(target: string, issues: readonly TargetOptionsIssue[]);
@@ -76,7 +68,7 @@ declare class InvalidTargetOptions extends Error {
76
68
  //#endregion
77
69
  //#region src/target/runtime.d.ts
78
70
  /** A target package whose `package.json` does not say where it runs. */
79
- declare class TargetRuntimeUndeclared extends Error {
71
+ declare class TargetRuntimeUndeclared extends GkmError {
80
72
  readonly target: string;
81
73
  readonly packageName: string;
82
74
  /** What `gkm.runtime` held instead, when it held anything. */
@@ -87,4 +79,4 @@ declare class TargetRuntimeUndeclared extends Error {
87
79
  }
88
80
  //#endregion
89
81
  export { TargetRuntimeMismatch as a, DeployTargetNotYetSupported as c, TargetPackageInvalid as i, UnknownDeployTarget as l, InvalidTargetOptions as n, ProviderRemoved as o, TargetEntryInvalid as r, TargetPackageNotFound as s, TargetRuntimeUndeclared as t };
90
- //# sourceMappingURL=runtime-CN_kmqxo.d.cts.map
82
+ //# sourceMappingURL=runtime-D_J3ExJn.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-D_J3ExJn.d.cts","names":[],"sources":["../src/target/builtins.ts","../src/target/package.ts","../src/target/provider.ts","../src/target/resolve.ts","../src/target/runtime.ts"],"mappings":";;;cAgEa,4BAA4B;WAE9B;;WAEA;EAHV,YACU,gBAEA;;EAAA;;;cAUE,oCAAoC;WAEtC;;WAEA;EAHV,YACU,gBAEA;;EAAA;;;;;cCrDE,8BAA8B;WAEhC;WACA;WACA;EAHV,YACU,gBACA,qBACA;;;;;cCZE,wBAAwB;WAE1B;;WAEA;EAHV,YACU,kBAEA;;EAAA;;;;;cCoCE,6BAA6B;WAE/B;WACA;EAFV,YACU,gBACA;;;cAUE,2BAA2B;WAClB;EAArB,YAAqB;;;cAST,8BAA8B;WAEhC;WACA;WACA,UAAU;WACV,QAAQ;EAJlB,YACU,gBACA,qBACA,UAAU,eACV,QAAQ;;;cAUN,6BAA6B;WAE/B;WACA,iBAAiB;EAF3B,YACU,gBACA,iBAAiB;;;;;cC1Ef,gCAAgC;WAElC;WACA;;WAEA;EAJV,YACU,gBACA,qBAEA;;EAAA"}
@@ -1,7 +1,7 @@
1
- import { K as DeployRuntime, et as TargetOptionsIssue } from "./types-ZHuZ89hv.mjs";
1
+ import { K as DeployRuntime, et as TargetOptionsIssue, jt as GkmError } from "./types-B6lmD3en.mjs";
2
2
  //#region src/target/builtins.d.ts
3
3
  /** A target name that is neither built in nor in `deploy.targets`. */
4
- declare class UnknownDeployTarget extends Error {
4
+ declare class UnknownDeployTarget extends GkmError {
5
5
  readonly target: string;
6
6
  /** The names that would have resolved. */
7
7
  readonly known: readonly string[];
@@ -10,7 +10,7 @@ declare class UnknownDeployTarget extends Error {
10
10
  known: readonly string[]);
11
11
  }
12
12
  /** A built-in target `gkm deploy` cannot deploy through yet. */
13
- declare class DeployTargetNotYetSupported extends Error {
13
+ declare class DeployTargetNotYetSupported extends GkmError {
14
14
  readonly target: string;
15
15
  /** What to do instead, when there is something. */
16
16
  readonly instead?: string | undefined;
@@ -21,7 +21,7 @@ declare class DeployTargetNotYetSupported extends Error {
21
21
  //#endregion
22
22
  //#region src/target/package.d.ts
23
23
  /** A target package the project does not have installed. */
24
- declare class TargetPackageNotFound extends Error {
24
+ declare class TargetPackageNotFound extends GkmError {
25
25
  readonly target: string;
26
26
  readonly packageName: string;
27
27
  readonly from: string;
@@ -29,16 +29,8 @@ declare class TargetPackageNotFound extends Error {
29
29
  }
30
30
  //#endregion
31
31
  //#region src/target/provider.d.ts
32
- /**
33
- * `gkm deploy --provider`, from before there were targets.
34
- *
35
- * It named three things, and only one of them ever deployed a workspace:
36
- * `dokploy` is now the target of that name; `docker` and `aws-lambda` were
37
- * accepted and always failed, so they are gone with a pointer to what does
38
- * the job.
39
- */
40
32
  /** A `--provider` that no longer exists. */
41
- declare class ProviderRemoved extends Error {
33
+ declare class ProviderRemoved extends GkmError {
42
34
  readonly provider: string;
43
35
  /** What to use instead. */
44
36
  readonly instead: string;
@@ -49,18 +41,18 @@ declare class ProviderRemoved extends Error {
49
41
  //#endregion
50
42
  //#region src/target/resolve.d.ts
51
43
  /** A target package whose default export is not a target. */
52
- declare class TargetPackageInvalid extends Error {
44
+ declare class TargetPackageInvalid extends GkmError {
53
45
  readonly target: string;
54
46
  readonly packageName: string;
55
47
  constructor(target: string, packageName: string);
56
48
  }
57
49
  /** A `deploy.targets` entry that is not a target, a package name or a pair. */
58
- declare class TargetEntryInvalid extends Error {
50
+ declare class TargetEntryInvalid extends GkmError {
59
51
  readonly target: string;
60
52
  constructor(target: string);
61
53
  }
62
54
  /** A target whose `runtime` is not the one its package declares. */
63
- declare class TargetRuntimeMismatch extends Error {
55
+ declare class TargetRuntimeMismatch extends GkmError {
64
56
  readonly target: string;
65
57
  readonly packageName: string;
66
58
  readonly declared: DeployRuntime;
@@ -68,7 +60,7 @@ declare class TargetRuntimeMismatch extends Error {
68
60
  constructor(target: string, packageName: string, declared: DeployRuntime, actual: DeployRuntime);
69
61
  }
70
62
  /** Options a target's schema rejected. */
71
- declare class InvalidTargetOptions extends Error {
63
+ declare class InvalidTargetOptions extends GkmError {
72
64
  readonly target: string;
73
65
  readonly issues: readonly TargetOptionsIssue[];
74
66
  constructor(target: string, issues: readonly TargetOptionsIssue[]);
@@ -76,7 +68,7 @@ declare class InvalidTargetOptions extends Error {
76
68
  //#endregion
77
69
  //#region src/target/runtime.d.ts
78
70
  /** A target package whose `package.json` does not say where it runs. */
79
- declare class TargetRuntimeUndeclared extends Error {
71
+ declare class TargetRuntimeUndeclared extends GkmError {
80
72
  readonly target: string;
81
73
  readonly packageName: string;
82
74
  /** What `gkm.runtime` held instead, when it held anything. */
@@ -87,4 +79,4 @@ declare class TargetRuntimeUndeclared extends Error {
87
79
  }
88
80
  //#endregion
89
81
  export { TargetRuntimeMismatch as a, DeployTargetNotYetSupported as c, TargetPackageInvalid as i, UnknownDeployTarget as l, InvalidTargetOptions as n, ProviderRemoved as o, TargetEntryInvalid as r, TargetPackageNotFound as s, TargetRuntimeUndeclared as t };
90
- //# sourceMappingURL=runtime-Cjvon3oj.d.mts.map
82
+ //# sourceMappingURL=runtime-_wEVtshH.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-_wEVtshH.d.mts","names":[],"sources":["../src/target/builtins.ts","../src/target/package.ts","../src/target/provider.ts","../src/target/resolve.ts","../src/target/runtime.ts"],"mappings":";;;cAgEa,4BAA4B;WAE9B;;WAEA;EAHV,YACU,gBAEA;;EAAA;;;cAUE,oCAAoC;WAEtC;;WAEA;EAHV,YACU,gBAEA;;EAAA;;;;;cCrDE,8BAA8B;WAEhC;WACA;WACA;EAHV,YACU,gBACA,qBACA;;;;;cCZE,wBAAwB;WAE1B;;WAEA;EAHV,YACU,kBAEA;;EAAA;;;;;cCoCE,6BAA6B;WAE/B;WACA;EAFV,YACU,gBACA;;;cAUE,2BAA2B;WAClB;EAArB,YAAqB;;;cAST,8BAA8B;WAEhC;WACA;WACA,UAAU;WACV,QAAQ;EAJlB,YACU,gBACA,qBACA,UAAU,eACV,QAAQ;;;cAUN,6BAA6B;WAE/B;WACA,iBAAiB;EAF3B,YACU,gBACA,iBAAiB;;;;;cC1Ef,gCAAgC;WAElC;WACA;;WAEA;EAJV,YACU,gBACA,qBAEA;;EAAA"}
@@ -1,7 +1,7 @@
1
- const require_discover = require("../discover-D1It5r_h.cjs");
2
- const require_sandbox = require("../sandbox-CL--ZDui.cjs");
1
+ const require_discover = require("../discover-DPgu-ScS.cjs");
2
+ const require_sandbox = require("../sandbox-CHv3OYXg.cjs");
3
3
  const require_workerRuntime = require("../workerRuntime-BXfhbe13.cjs");
4
- const require_credentialSchemas = require("../credentialSchemas-DCR4Wd1W.cjs");
4
+ const require_credentialSchemas = require("../credentialSchemas-CAPKFkrG.cjs");
5
5
  let node_path = require("node:path");
6
6
  let node_fs_promises = require("node:fs/promises");
7
7
  //#region src/sandbox/credentials-worker.ts
@@ -1,7 +1,7 @@
1
- import { r as discover } from "../discover-BPelzeGW.mjs";
2
- import { t as SECRETS_DIR_ENV } from "../sandbox-Dm247NGx.mjs";
1
+ import { r as discover } from "../discover-qjFapetL.mjs";
2
+ import { t as SECRETS_DIR_ENV } from "../sandbox-CbVB7uOD.mjs";
3
3
  import { a as registerAdjacentTsconfig, n as answer, r as errorData } from "../workerRuntime-CsOyBRx2.mjs";
4
- import { a as liveCredentials, r as inspectLive } from "../credentialSchemas-BJqRJNK4.mjs";
4
+ import { a as liveCredentials, r as inspectLive } from "../credentialSchemas-BJFvfkaz.mjs";
5
5
  import { join } from "node:path";
6
6
  import { readFile, readdir } from "node:fs/promises";
7
7
  //#region src/sandbox/credentials-worker.ts
@@ -1,4 +1,4 @@
1
- const require_discover = require("../discover-D1It5r_h.cjs");
1
+ const require_discover = require("../discover-DPgu-ScS.cjs");
2
2
  const require_workerRuntime = require("../workerRuntime-BXfhbe13.cjs");
3
3
  //#region src/sandbox/discover-worker.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { r as discover } from "../discover-BPelzeGW.mjs";
1
+ import { r as discover } from "../discover-qjFapetL.mjs";
2
2
  import { a as registerAdjacentTsconfig, i as liveValuePaths, n as answer, r as errorData } from "../workerRuntime-CsOyBRx2.mjs";
3
3
  //#region src/sandbox/discover-worker.ts
4
4
  /**
@@ -1,7 +1,7 @@
1
- const require_discover = require("../discover-D1It5r_h.cjs");
2
- const require_sandbox = require("../sandbox-CL--ZDui.cjs");
1
+ const require_discover = require("../discover-DPgu-ScS.cjs");
2
+ const require_sandbox = require("../sandbox-CHv3OYXg.cjs");
3
3
  const require_workerRuntime = require("../workerRuntime-BXfhbe13.cjs");
4
- const require_databases = require("../databases-BY-pEImp.cjs");
4
+ const require_databases = require("../databases-DGALFDG3.cjs");
5
5
  let node_path = require("node:path");
6
6
  let node_fs_promises = require("node:fs/promises");
7
7
  //#region src/sandbox/migrate-worker.ts
@@ -1,7 +1,7 @@
1
- import { r as discover } from "../discover-BPelzeGW.mjs";
2
- import { t as SECRETS_DIR_ENV } from "../sandbox-Dm247NGx.mjs";
1
+ import { r as discover } from "../discover-qjFapetL.mjs";
2
+ import { t as SECRETS_DIR_ENV } from "../sandbox-CbVB7uOD.mjs";
3
3
  import { a as registerAdjacentTsconfig, n as answer, r as errorData } from "../workerRuntime-CsOyBRx2.mjs";
4
- import { o as SeedFailed, p as seedDatabases, u as migrateDatabases } from "../databases-CzszQV0N.mjs";
4
+ import { o as SeedFailed, p as seedDatabases, u as migrateDatabases } from "../databases-BeGP5eDh.mjs";
5
5
  import { join } from "node:path";
6
6
  import { readFile, readdir } from "node:fs/promises";
7
7
  //#region src/sandbox/migrate-worker.ts
@@ -1,3 +1,4 @@
1
+ const require_errors = require("./errors-DMC4Umsb.cjs");
1
2
  let node_path = require("node:path");
2
3
  let node_fs = require("node:fs");
3
4
  let node_async_hooks = require("node:async_hooks");
@@ -28,7 +29,7 @@ let node_async_hooks = require("node:async_hooks");
28
29
  /** The variable naming the directory a command's secrets are mounted in. */
29
30
  const SECRETS_DIR_ENV = "GKM_SECRETS_DIR";
30
31
  /** A command was asked to run outside the project. */
31
- var SandboxCwdEscape = class extends Error {
32
+ var SandboxCwdEscape = class extends require_errors.GkmError {
32
33
  cwd;
33
34
  root;
34
35
  constructor(cwd, root) {
@@ -57,7 +58,7 @@ function confineCwd(root, cwd) {
57
58
  return absolute;
58
59
  }
59
60
  /** A secret's file name: one path segment, so it cannot be written elsewhere. */
60
- var SecretNameInvalid = class extends Error {
61
+ var SecretNameInvalid = class extends require_errors.GkmError {
61
62
  secretName;
62
63
  constructor(secretName) {
63
64
  super(`'${secretName}' cannot be a secret's name: it becomes a file name in the secrets directory, so it must be one segment of letters, digits, '.', '-' or '_' and not start with '.'.`);
@@ -161,4 +162,4 @@ Object.defineProperty(exports, "withSandbox", {
161
162
  }
162
163
  });
163
164
 
164
- //# sourceMappingURL=sandbox-CL--ZDui.cjs.map
165
+ //# sourceMappingURL=sandbox-CHv3OYXg.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-CHv3OYXg.cjs","names":["GkmError","existsSync","realpathSync","resolve","relative","sep","isAbsolute","AsyncLocalStorage"],"sources":["../src/sandbox/sandbox.ts"],"sourcesContent":["/**\n * Where a deploy runs the project's own code.\n *\n * A deploy holds credentials — Dokploy's token, a registry login, an AWS key —\n * and loading `gkm.config.ts`, sniffing an app's environment and building it\n * all execute code from the repository being deployed. On a developer's own\n * laptop that is the developer's code. On a CI job for a fork, or a shared\n * build runner, it is not, and that code should not be able to read the\n * credentials used to deploy it, hang the deploy, or reach outside the\n * checkout.\n *\n * So every step that runs project code goes through a `Sandbox`: one call,\n * with an argument array rather than a shell line, the complete environment\n * the step needs rather than the host's, a timeout it cannot outlive, secrets\n * as files rather than variables, and a working directory inside the project.\n * The steps that need credentials — provisioning, pushing, releasing — are\n * the deploy's own code and never run in one.\n *\n * `LocalSandbox` is the default: a child process on this machine with an\n * allowlisted environment. A host that builds repositories it does not trust\n * passes its own — a container per build, a VM — through `deploy()`'s\n * `sandbox`.\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport { existsSync, realpathSync } from 'node:fs';\nimport { isAbsolute, relative, resolve, sep } from 'node:path';\nimport { GkmError } from '../errors';\n\n/** Where a command's output goes. */\nexport type SandboxOutput = 'capture' | 'inherit' | 'stderr' | 'ignore';\n\nexport interface SandboxExecOptions {\n\t/**\n\t * Where the command runs: the project root or a directory below it, as an\n\t * absolute path or relative to the root. Anywhere else is refused with\n\t * {@link SandboxCwdEscape}.\n\t */\n\tcwd: string;\n\t/**\n\t * The command's whole environment. Nothing of the host's is added to it:\n\t * start from {@link Sandbox.env} and add what the step needs.\n\t */\n\tenv: Readonly<Record<string, string>>;\n\t/**\n\t * How long the command may run before it is killed. Required: a step that\n\t * waits forever — a sniffed entry that opens a server, a build stuck on a\n\t * prompt — would otherwise hold the deploy, and its lock, forever.\n\t */\n\ttimeoutMs: number;\n\t/**\n\t * Files the command can read, by name. Mounted in a directory of their own\n\t * — named by `GKM_SECRETS_DIR` in the command's environment — and removed\n\t * when it exits. Never set as variables, which every child inherits, a\n\t * crash report prints and `/proc/<pid>/environ` shows.\n\t */\n\tsecrets?: Readonly<Record<string, string>>;\n\t/**\n\t * `capture` (the default) returns stdout and stderr in the result;\n\t * `inherit` gives the command the host's terminal; `stderr` sends both\n\t * streams to the host's stderr; `ignore` discards them.\n\t */\n\toutput?: SandboxOutput;\n\t/** Kills the command when aborted; `exec` rejects with the signal's reason. */\n\tsignal?: AbortSignal;\n}\n\n/** How a command ended. A non-zero exit is a result, not an error. */\nexport interface SandboxResult {\n\texitCode: number | null;\n\tsignal: string | null;\n\t/** What it wrote to stdout, when its output was captured. */\n\tstdout: string;\n\t/** What it wrote to stderr, when its output was captured. */\n\tstderr: string;\n}\n\n/**\n * Runs a command against the project, and nothing else of the host's.\n *\n * `exec` resolves with the result however the command exited. It rejects\n * with {@link CommandTimedOut} once the timeout passes — after the command is\n * gone — with {@link SandboxCwdEscape} for a directory outside the project,\n * with the signal's reason when aborted, and with the spawn error when the\n * program cannot be started.\n */\nexport interface Sandbox {\n\t/** The project: the directory every command runs at or below. */\n\treadonly root: string;\n\t/**\n\t * Whether the code it runs is kept from the host: its files, its\n\t * processes, its memory.\n\t *\n\t * An isolating sandbox shares nothing but what crosses `exec`, so a config\n\t * reaches the deploy as data — a live object in it (a custom state store,\n\t * an inline target) cannot cross, and is refused with\n\t * `ConfigObjectNotSerializable`. A non-isolating one, like\n\t * {@link LocalSandbox}, runs on the host as the host's user; a project\n\t * whose config holds live objects is then loaded in-process as before,\n\t * because a project trusted to run there is trusted to do that.\n\t */\n\treadonly isolating: boolean;\n\t/**\n\t * The environment a command starts from: what any program needs to run\n\t * here — `PATH`, `HOME`, the locale — and no credential.\n\t */\n\treadonly env: Readonly<Record<string, string>>;\n\texec(\n\t\tcommand: string,\n\t\targs: readonly string[],\n\t\toptions: SandboxExecOptions,\n\t): Promise<SandboxResult>;\n}\n\n/** The variable naming the directory a command's secrets are mounted in. */\nexport const SECRETS_DIR_ENV = 'GKM_SECRETS_DIR';\n\n/** A command was asked to run outside the project. */\nexport class SandboxCwdEscape extends GkmError {\n\tconstructor(\n\t\treadonly cwd: string,\n\t\treadonly root: string,\n\t) {\n\t\tsuper(\n\t\t\t`Refusing to run in '${cwd}': it is outside the project at '${root}'. ` +\n\t\t\t\t'A sandboxed step only runs inside the project it was given — check ' +\n\t\t\t\t'the app paths in gkm.config.ts for `..` or an absolute path.',\n\t\t);\n\t\tthis.name = 'SandboxCwdEscape';\n\t}\n}\n\n/** A path with its symlinks resolved where it exists — `/tmp` is `/private/tmp`. */\nfunction real(path: string): string {\n\treturn existsSync(path) ? realpathSync(path) : path;\n}\n\n/**\n * `cwd` as an absolute directory inside `root`, or {@link SandboxCwdEscape}.\n *\n * Symlinks are resolved on both sides first, so a link inside the project\n * that points out of it is an escape, and a project reached through a link\n * (`/tmp` on macOS) is still itself. For a sandbox of a host's own to call\n * before it runs anything.\n */\nexport function confineCwd(root: string, cwd: string): string {\n\tconst absolute = resolve(root, cwd);\n\tconst from = relative(real(resolve(root)), real(absolute));\n\tif (from === '..' || from.startsWith(`..${sep}`) || isAbsolute(from)) {\n\t\tthrow new SandboxCwdEscape(cwd, root);\n\t}\n\treturn absolute;\n}\n\n/** A secret's file name: one path segment, so it cannot be written elsewhere. */\nexport class SecretNameInvalid extends GkmError {\n\tconstructor(readonly secretName: string) {\n\t\tsuper(\n\t\t\t`'${secretName}' cannot be a secret's name: it becomes a file name in ` +\n\t\t\t\t'the secrets directory, so it must be one segment of letters, digits, ' +\n\t\t\t\t\"'.', '-' or '_' and not start with '.'.\",\n\t\t);\n\t\tthis.name = 'SecretNameInvalid';\n\t}\n}\n\nconst SECRET_NAME = /^[A-Za-z0-9_-][A-Za-z0-9._-]*$/;\n\n/** Every secret name, checked before anything is written. */\nexport function assertSecretNames(\n\tsecrets: Readonly<Record<string, string>> | undefined,\n): void {\n\tfor (const name of Object.keys(secrets ?? {})) {\n\t\tif (!SECRET_NAME.test(name)) throw new SecretNameInvalid(name);\n\t}\n}\n\n/** A run's sandbox, and what its workers already answered. */\ninterface SandboxRun {\n\tsandbox: Sandbox;\n\tanswers: Map<string, Promise<unknown>>;\n}\n\nconst active = new AsyncLocalStorage<SandboxRun>();\n\n/**\n * Run `fn` with `sandbox` as the one its steps use.\n *\n * Per run rather than global, as `withOutput` routes a run's lines: two\n * deploys in one host process each build in their own sandbox. A step deep in\n * the engine — discovering constructs, sniffing an app — asks\n * {@link activeSandbox} rather than every function between `deploy()` and it\n * taking one more parameter.\n */\nexport function withSandbox<T>(sandbox: Sandbox, fn: () => T): T {\n\treturn active.run({ sandbox, answers: new Map() }, fn);\n}\n\n/** The sandbox of the run this is part of, if it was started with one. */\nexport function activeSandbox(): Sandbox | undefined {\n\treturn active.getStore()?.sandbox;\n}\n\n/**\n * `ask()`'s answer, asked once per run.\n *\n * A deploy loads its config and discovers its constructs from several places\n * — the first load, the engine, the Dockerfile generator — and in a sandbox\n * each was a child process of its own, for the same answer: the checkout does\n * not change while it deploys. Within a run in `sandbox`, the first answer\n * for `key` is the one every later ask gets. Outside one, or for another\n * sandbox, `ask()` runs each time.\n */\nexport function oncePerRun<T>(\n\tsandbox: Sandbox,\n\tkey: string,\n\task: () => Promise<T>,\n): Promise<T> {\n\tconst run = active.getStore();\n\tif (!run || run.sandbox !== sandbox) return ask();\n\n\tlet answer = run.answers.get(key) as Promise<T> | undefined;\n\tif (!answer) {\n\t\tanswer = ask();\n\t\trun.answers.set(key, answer);\n\t\t// A failure is not remembered: the next ask tries again.\n\t\tanswer.catch(() => run.answers.delete(key));\n\t}\n\treturn answer;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmHA,MAAa,kBAAkB;;AAG/B,IAAa,mBAAb,cAAsCA,eAAAA,SAAS;CAEpC;CACA;CAFV,YACC,KACA,MACC;EACD,MACC,uBAAuB,IAAI,mCAAmC,KAAK,qIAGpE;EAPS,KAAA,MAAA;EACA,KAAA,OAAA;EAOT,KAAK,OAAO;CACb;AACD;;AAGA,SAAS,KAAK,MAAsB;CACnC,QAAA,GAAOC,QAAAA,WAAAA,CAAW,IAAI,KAAA,GAAIC,QAAAA,aAAAA,CAAa,IAAI,IAAI;AAChD;;;;;;;;;AAUA,SAAgB,WAAW,MAAc,KAAqB;CAC7D,MAAM,YAAA,GAAWC,UAAAA,QAAAA,CAAQ,MAAM,GAAG;CAClC,MAAM,QAAA,GAAOC,UAAAA,SAAAA,CAAS,MAAA,GAAKD,UAAAA,QAAAA,CAAQ,IAAI,CAAC,GAAG,KAAK,QAAQ,CAAC;CACzD,IAAI,SAAS,QAAQ,KAAK,WAAW,KAAKE,UAAAA,KAAK,MAAA,GAAKC,UAAAA,WAAAA,CAAW,IAAI,GAClE,MAAM,IAAI,iBAAiB,KAAK,IAAI;CAErC,OAAO;AACR;;AAGA,IAAa,oBAAb,cAAuCN,eAAAA,SAAS;CAC1B;CAArB,YAAY,YAA6B;EACxC,MACC,IAAI,WAAW,oKAGhB;EALoB,KAAA,aAAA;EAMpB,KAAK,OAAO;CACb;AACD;AAEA,MAAM,cAAc;;AAGpB,SAAgB,kBACf,SACO;CACP,KAAK,MAAM,QAAQ,OAAO,KAAK,WAAW,CAAC,CAAC,GAC3C,IAAI,CAAC,YAAY,KAAK,IAAI,GAAG,MAAM,IAAI,kBAAkB,IAAI;AAE/D;AAQA,MAAM,SAAS,IAAIO,iBAAAA,kBAA8B;;;;;;;;;;AAWjD,SAAgB,YAAe,SAAkB,IAAgB;CAChE,OAAO,OAAO,IAAI;EAAE;EAAS,yBAAS,IAAI,IAAI;CAAE,GAAG,EAAE;AACtD;;AAGA,SAAgB,gBAAqC;CACpD,OAAO,OAAO,SAAS,CAAC,EAAE;AAC3B;;;;;;;;;;;AAYA,SAAgB,WACf,SACA,KACA,KACa;CACb,MAAM,MAAM,OAAO,SAAS;CAC5B,IAAI,CAAC,OAAO,IAAI,YAAY,SAAS,OAAO,IAAI;CAEhD,IAAI,SAAS,IAAI,QAAQ,IAAI,GAAG;CAChC,IAAI,CAAC,QAAQ;EACZ,SAAS,IAAI;EACb,IAAI,QAAQ,IAAI,KAAK,MAAM;EAE3B,OAAO,YAAY,IAAI,QAAQ,OAAO,GAAG,CAAC;CAC3C;CACA,OAAO;AACR"}
@@ -1,27 +1,5 @@
1
+ import { jt as GkmError } from "./types-B6lmD3en.mjs";
1
2
  //#region src/sandbox/sandbox.d.ts
2
- /**
3
- * Where a deploy runs the project's own code.
4
- *
5
- * A deploy holds credentials — Dokploy's token, a registry login, an AWS key —
6
- * and loading `gkm.config.ts`, sniffing an app's environment and building it
7
- * all execute code from the repository being deployed. On a developer's own
8
- * laptop that is the developer's code. On a CI job for a fork, or a shared
9
- * build runner, it is not, and that code should not be able to read the
10
- * credentials used to deploy it, hang the deploy, or reach outside the
11
- * checkout.
12
- *
13
- * So every step that runs project code goes through a `Sandbox`: one call,
14
- * with an argument array rather than a shell line, the complete environment
15
- * the step needs rather than the host's, a timeout it cannot outlive, secrets
16
- * as files rather than variables, and a working directory inside the project.
17
- * The steps that need credentials — provisioning, pushing, releasing — are
18
- * the deploy's own code and never run in one.
19
- *
20
- * `LocalSandbox` is the default: a child process on this machine with an
21
- * allowlisted environment. A host that builds repositories it does not trust
22
- * passes its own — a container per build, a VM — through `deploy()`'s
23
- * `sandbox`.
24
- */
25
3
  /** Where a command's output goes. */
26
4
  type SandboxOutput = 'capture' | 'inherit' | 'stderr' | 'ignore';
27
5
  interface SandboxExecOptions {
@@ -102,7 +80,7 @@ interface Sandbox {
102
80
  /** The variable naming the directory a command's secrets are mounted in. */
103
81
  declare const SECRETS_DIR_ENV = "GKM_SECRETS_DIR";
104
82
  /** A command was asked to run outside the project. */
105
- declare class SandboxCwdEscape extends Error {
83
+ declare class SandboxCwdEscape extends GkmError {
106
84
  readonly cwd: string;
107
85
  readonly root: string;
108
86
  constructor(cwd: string, root: string);
@@ -117,10 +95,10 @@ declare class SandboxCwdEscape extends Error {
117
95
  */
118
96
  declare function confineCwd(root: string, cwd: string): string;
119
97
  /** A secret's file name: one path segment, so it cannot be written elsewhere. */
120
- declare class SecretNameInvalid extends Error {
98
+ declare class SecretNameInvalid extends GkmError {
121
99
  readonly secretName: string;
122
100
  constructor(secretName: string);
123
101
  }
124
102
  //#endregion
125
103
  export { SandboxOutput as a, confineCwd as c, SandboxExecOptions as i, Sandbox as n, SandboxResult as o, SandboxCwdEscape as r, SecretNameInvalid as s, SECRETS_DIR_ENV as t };
126
- //# sourceMappingURL=sandbox-M8UnLhXE.d.cts.map
104
+ //# sourceMappingURL=sandbox-CPJq1Kia.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-CPJq1Kia.d.mts","names":[],"sources":["../src/sandbox/sandbox.ts"],"mappings":";;;KA8BY;UAEK;;;;;;EAMhB;;;;;EAKA,KAAK,SAAS;;;;;;EAMd;;;;;;;EAOA,UAAU,SAAS;;;;;;EAMnB,SAAS;;EAET,SAAS;;;UAIO;EAChB;EACA;;EAEA;;EAEA;;;;;;;;;;;UAYgB;;WAEP;;;;;;;;;;;;;WAaA;;;;;WAKA,KAAK,SAAS;EACvB,KACC,iBACA,yBACA,SAAS,qBACP,QAAQ;;;cAIC;;cAGA,yBAAyB;WAE3B;WACA;EAFV,YACU,aACA;;;;;;;;;;iBAwBK,WAAW,cAAc;;cAU5B,0BAA0B;WACjB;EAArB,YAAqB"}
@@ -1,3 +1,4 @@
1
+ import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
1
2
  import { isAbsolute, relative, resolve, sep } from "node:path";
2
3
  import { existsSync, realpathSync } from "node:fs";
3
4
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -28,7 +29,7 @@ import { AsyncLocalStorage } from "node:async_hooks";
28
29
  /** The variable naming the directory a command's secrets are mounted in. */
29
30
  const SECRETS_DIR_ENV = "GKM_SECRETS_DIR";
30
31
  /** A command was asked to run outside the project. */
31
- var SandboxCwdEscape = class extends Error {
32
+ var SandboxCwdEscape = class extends GkmError {
32
33
  cwd;
33
34
  root;
34
35
  constructor(cwd, root) {
@@ -57,7 +58,7 @@ function confineCwd(root, cwd) {
57
58
  return absolute;
58
59
  }
59
60
  /** A secret's file name: one path segment, so it cannot be written elsewhere. */
60
- var SecretNameInvalid = class extends Error {
61
+ var SecretNameInvalid = class extends GkmError {
61
62
  secretName;
62
63
  constructor(secretName) {
63
64
  super(`'${secretName}' cannot be a secret's name: it becomes a file name in the secrets directory, so it must be one segment of letters, digits, '.', '-' or '_' and not start with '.'.`);
@@ -114,4 +115,4 @@ function oncePerRun(sandbox, key, ask) {
114
115
  //#endregion
115
116
  export { assertSecretNames as a, withSandbox as c, activeSandbox as i, SandboxCwdEscape as n, confineCwd as o, SecretNameInvalid as r, oncePerRun as s, SECRETS_DIR_ENV as t };
116
117
 
117
- //# sourceMappingURL=sandbox-Dm247NGx.mjs.map
118
+ //# sourceMappingURL=sandbox-CbVB7uOD.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-CbVB7uOD.mjs","names":[],"sources":["../src/sandbox/sandbox.ts"],"sourcesContent":["/**\n * Where a deploy runs the project's own code.\n *\n * A deploy holds credentials — Dokploy's token, a registry login, an AWS key —\n * and loading `gkm.config.ts`, sniffing an app's environment and building it\n * all execute code from the repository being deployed. On a developer's own\n * laptop that is the developer's code. On a CI job for a fork, or a shared\n * build runner, it is not, and that code should not be able to read the\n * credentials used to deploy it, hang the deploy, or reach outside the\n * checkout.\n *\n * So every step that runs project code goes through a `Sandbox`: one call,\n * with an argument array rather than a shell line, the complete environment\n * the step needs rather than the host's, a timeout it cannot outlive, secrets\n * as files rather than variables, and a working directory inside the project.\n * The steps that need credentials — provisioning, pushing, releasing — are\n * the deploy's own code and never run in one.\n *\n * `LocalSandbox` is the default: a child process on this machine with an\n * allowlisted environment. A host that builds repositories it does not trust\n * passes its own — a container per build, a VM — through `deploy()`'s\n * `sandbox`.\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport { existsSync, realpathSync } from 'node:fs';\nimport { isAbsolute, relative, resolve, sep } from 'node:path';\nimport { GkmError } from '../errors';\n\n/** Where a command's output goes. */\nexport type SandboxOutput = 'capture' | 'inherit' | 'stderr' | 'ignore';\n\nexport interface SandboxExecOptions {\n\t/**\n\t * Where the command runs: the project root or a directory below it, as an\n\t * absolute path or relative to the root. Anywhere else is refused with\n\t * {@link SandboxCwdEscape}.\n\t */\n\tcwd: string;\n\t/**\n\t * The command's whole environment. Nothing of the host's is added to it:\n\t * start from {@link Sandbox.env} and add what the step needs.\n\t */\n\tenv: Readonly<Record<string, string>>;\n\t/**\n\t * How long the command may run before it is killed. Required: a step that\n\t * waits forever — a sniffed entry that opens a server, a build stuck on a\n\t * prompt — would otherwise hold the deploy, and its lock, forever.\n\t */\n\ttimeoutMs: number;\n\t/**\n\t * Files the command can read, by name. Mounted in a directory of their own\n\t * — named by `GKM_SECRETS_DIR` in the command's environment — and removed\n\t * when it exits. Never set as variables, which every child inherits, a\n\t * crash report prints and `/proc/<pid>/environ` shows.\n\t */\n\tsecrets?: Readonly<Record<string, string>>;\n\t/**\n\t * `capture` (the default) returns stdout and stderr in the result;\n\t * `inherit` gives the command the host's terminal; `stderr` sends both\n\t * streams to the host's stderr; `ignore` discards them.\n\t */\n\toutput?: SandboxOutput;\n\t/** Kills the command when aborted; `exec` rejects with the signal's reason. */\n\tsignal?: AbortSignal;\n}\n\n/** How a command ended. A non-zero exit is a result, not an error. */\nexport interface SandboxResult {\n\texitCode: number | null;\n\tsignal: string | null;\n\t/** What it wrote to stdout, when its output was captured. */\n\tstdout: string;\n\t/** What it wrote to stderr, when its output was captured. */\n\tstderr: string;\n}\n\n/**\n * Runs a command against the project, and nothing else of the host's.\n *\n * `exec` resolves with the result however the command exited. It rejects\n * with {@link CommandTimedOut} once the timeout passes — after the command is\n * gone — with {@link SandboxCwdEscape} for a directory outside the project,\n * with the signal's reason when aborted, and with the spawn error when the\n * program cannot be started.\n */\nexport interface Sandbox {\n\t/** The project: the directory every command runs at or below. */\n\treadonly root: string;\n\t/**\n\t * Whether the code it runs is kept from the host: its files, its\n\t * processes, its memory.\n\t *\n\t * An isolating sandbox shares nothing but what crosses `exec`, so a config\n\t * reaches the deploy as data — a live object in it (a custom state store,\n\t * an inline target) cannot cross, and is refused with\n\t * `ConfigObjectNotSerializable`. A non-isolating one, like\n\t * {@link LocalSandbox}, runs on the host as the host's user; a project\n\t * whose config holds live objects is then loaded in-process as before,\n\t * because a project trusted to run there is trusted to do that.\n\t */\n\treadonly isolating: boolean;\n\t/**\n\t * The environment a command starts from: what any program needs to run\n\t * here — `PATH`, `HOME`, the locale — and no credential.\n\t */\n\treadonly env: Readonly<Record<string, string>>;\n\texec(\n\t\tcommand: string,\n\t\targs: readonly string[],\n\t\toptions: SandboxExecOptions,\n\t): Promise<SandboxResult>;\n}\n\n/** The variable naming the directory a command's secrets are mounted in. */\nexport const SECRETS_DIR_ENV = 'GKM_SECRETS_DIR';\n\n/** A command was asked to run outside the project. */\nexport class SandboxCwdEscape extends GkmError {\n\tconstructor(\n\t\treadonly cwd: string,\n\t\treadonly root: string,\n\t) {\n\t\tsuper(\n\t\t\t`Refusing to run in '${cwd}': it is outside the project at '${root}'. ` +\n\t\t\t\t'A sandboxed step only runs inside the project it was given — check ' +\n\t\t\t\t'the app paths in gkm.config.ts for `..` or an absolute path.',\n\t\t);\n\t\tthis.name = 'SandboxCwdEscape';\n\t}\n}\n\n/** A path with its symlinks resolved where it exists — `/tmp` is `/private/tmp`. */\nfunction real(path: string): string {\n\treturn existsSync(path) ? realpathSync(path) : path;\n}\n\n/**\n * `cwd` as an absolute directory inside `root`, or {@link SandboxCwdEscape}.\n *\n * Symlinks are resolved on both sides first, so a link inside the project\n * that points out of it is an escape, and a project reached through a link\n * (`/tmp` on macOS) is still itself. For a sandbox of a host's own to call\n * before it runs anything.\n */\nexport function confineCwd(root: string, cwd: string): string {\n\tconst absolute = resolve(root, cwd);\n\tconst from = relative(real(resolve(root)), real(absolute));\n\tif (from === '..' || from.startsWith(`..${sep}`) || isAbsolute(from)) {\n\t\tthrow new SandboxCwdEscape(cwd, root);\n\t}\n\treturn absolute;\n}\n\n/** A secret's file name: one path segment, so it cannot be written elsewhere. */\nexport class SecretNameInvalid extends GkmError {\n\tconstructor(readonly secretName: string) {\n\t\tsuper(\n\t\t\t`'${secretName}' cannot be a secret's name: it becomes a file name in ` +\n\t\t\t\t'the secrets directory, so it must be one segment of letters, digits, ' +\n\t\t\t\t\"'.', '-' or '_' and not start with '.'.\",\n\t\t);\n\t\tthis.name = 'SecretNameInvalid';\n\t}\n}\n\nconst SECRET_NAME = /^[A-Za-z0-9_-][A-Za-z0-9._-]*$/;\n\n/** Every secret name, checked before anything is written. */\nexport function assertSecretNames(\n\tsecrets: Readonly<Record<string, string>> | undefined,\n): void {\n\tfor (const name of Object.keys(secrets ?? {})) {\n\t\tif (!SECRET_NAME.test(name)) throw new SecretNameInvalid(name);\n\t}\n}\n\n/** A run's sandbox, and what its workers already answered. */\ninterface SandboxRun {\n\tsandbox: Sandbox;\n\tanswers: Map<string, Promise<unknown>>;\n}\n\nconst active = new AsyncLocalStorage<SandboxRun>();\n\n/**\n * Run `fn` with `sandbox` as the one its steps use.\n *\n * Per run rather than global, as `withOutput` routes a run's lines: two\n * deploys in one host process each build in their own sandbox. A step deep in\n * the engine — discovering constructs, sniffing an app — asks\n * {@link activeSandbox} rather than every function between `deploy()` and it\n * taking one more parameter.\n */\nexport function withSandbox<T>(sandbox: Sandbox, fn: () => T): T {\n\treturn active.run({ sandbox, answers: new Map() }, fn);\n}\n\n/** The sandbox of the run this is part of, if it was started with one. */\nexport function activeSandbox(): Sandbox | undefined {\n\treturn active.getStore()?.sandbox;\n}\n\n/**\n * `ask()`'s answer, asked once per run.\n *\n * A deploy loads its config and discovers its constructs from several places\n * — the first load, the engine, the Dockerfile generator — and in a sandbox\n * each was a child process of its own, for the same answer: the checkout does\n * not change while it deploys. Within a run in `sandbox`, the first answer\n * for `key` is the one every later ask gets. Outside one, or for another\n * sandbox, `ask()` runs each time.\n */\nexport function oncePerRun<T>(\n\tsandbox: Sandbox,\n\tkey: string,\n\task: () => Promise<T>,\n): Promise<T> {\n\tconst run = active.getStore();\n\tif (!run || run.sandbox !== sandbox) return ask();\n\n\tlet answer = run.answers.get(key) as Promise<T> | undefined;\n\tif (!answer) {\n\t\tanswer = ask();\n\t\trun.answers.set(key, answer);\n\t\t// A failure is not remembered: the next ask tries again.\n\t\tanswer.catch(() => run.answers.delete(key));\n\t}\n\treturn answer;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmHA,MAAa,kBAAkB;;AAG/B,IAAa,mBAAb,cAAsC,SAAS;CAEpC;CACA;CAFV,YACC,KACA,MACC;EACD,MACC,uBAAuB,IAAI,mCAAmC,KAAK,qIAGpE;EAPS,KAAA,MAAA;EACA,KAAA,OAAA;EAOT,KAAK,OAAO;CACb;AACD;;AAGA,SAAS,KAAK,MAAsB;CACnC,OAAO,WAAW,IAAI,IAAI,aAAa,IAAI,IAAI;AAChD;;;;;;;;;AAUA,SAAgB,WAAW,MAAc,KAAqB;CAC7D,MAAM,WAAW,QAAQ,MAAM,GAAG;CAClC,MAAM,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,GAAG,KAAK,QAAQ,CAAC;CACzD,IAAI,SAAS,QAAQ,KAAK,WAAW,KAAK,KAAK,KAAK,WAAW,IAAI,GAClE,MAAM,IAAI,iBAAiB,KAAK,IAAI;CAErC,OAAO;AACR;;AAGA,IAAa,oBAAb,cAAuC,SAAS;CAC1B;CAArB,YAAY,YAA6B;EACxC,MACC,IAAI,WAAW,oKAGhB;EALoB,KAAA,aAAA;EAMpB,KAAK,OAAO;CACb;AACD;AAEA,MAAM,cAAc;;AAGpB,SAAgB,kBACf,SACO;CACP,KAAK,MAAM,QAAQ,OAAO,KAAK,WAAW,CAAC,CAAC,GAC3C,IAAI,CAAC,YAAY,KAAK,IAAI,GAAG,MAAM,IAAI,kBAAkB,IAAI;AAE/D;AAQA,MAAM,SAAS,IAAI,kBAA8B;;;;;;;;;;AAWjD,SAAgB,YAAe,SAAkB,IAAgB;CAChE,OAAO,OAAO,IAAI;EAAE;EAAS,yBAAS,IAAI,IAAI;CAAE,GAAG,EAAE;AACtD;;AAGA,SAAgB,gBAAqC;CACpD,OAAO,OAAO,SAAS,CAAC,EAAE;AAC3B;;;;;;;;;;;AAYA,SAAgB,WACf,SACA,KACA,KACa;CACb,MAAM,MAAM,OAAO,SAAS;CAC5B,IAAI,CAAC,OAAO,IAAI,YAAY,SAAS,OAAO,IAAI;CAEhD,IAAI,SAAS,IAAI,QAAQ,IAAI,GAAG;CAChC,IAAI,CAAC,QAAQ;EACZ,SAAS,IAAI;EACb,IAAI,QAAQ,IAAI,KAAK,MAAM;EAE3B,OAAO,YAAY,IAAI,QAAQ,OAAO,GAAG,CAAC;CAC3C;CACA,OAAO;AACR"}