@geekmidas/cli 10.0.0-alpha.11 → 10.0.0-alpha.110

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 (501) hide show
  1. package/README.md +315 -414
  2. package/bin/adjacent-tsconfig.mjs +46 -8
  3. package/bin/gkm.mjs +11 -3
  4. package/bin/owning-tsconfig-jsx-register.mjs +18 -0
  5. package/bin/owning-tsconfig-jsx.mjs +108 -0
  6. package/dist/EndpointGenerator-BwbYTMtB.cjs +1090 -0
  7. package/dist/EndpointGenerator-BwbYTMtB.cjs.map +1 -0
  8. package/dist/EndpointGenerator-CvLX8bpx.mjs +1031 -0
  9. package/dist/EndpointGenerator-CvLX8bpx.mjs.map +1 -0
  10. package/dist/GoDaddyProvider-CjeOduia.mjs +388 -0
  11. package/dist/GoDaddyProvider-CjeOduia.mjs.map +1 -0
  12. package/dist/GoDaddyProvider-qNUzTXI7.cjs +388 -0
  13. package/dist/GoDaddyProvider-qNUzTXI7.cjs.map +1 -0
  14. package/dist/{HostingerProvider-BcyFRbqV.mjs → HostingerProvider-BNpS9aRJ.mjs} +29 -25
  15. package/dist/HostingerProvider-BNpS9aRJ.mjs.map +1 -0
  16. package/dist/{HostingerProvider-BOvsgATO.cjs → HostingerProvider-DR1iws1P.cjs} +29 -25
  17. package/dist/HostingerProvider-DR1iws1P.cjs.map +1 -0
  18. package/dist/LegacyStateStore-MxiSu7KJ.cjs +124 -0
  19. package/dist/LegacyStateStore-MxiSu7KJ.cjs.map +1 -0
  20. package/dist/LegacyStateStore-pgscYsiG.mjs +124 -0
  21. package/dist/LegacyStateStore-pgscYsiG.mjs.map +1 -0
  22. package/dist/LocalStateStore-BcvyKbAw.mjs +167 -0
  23. package/dist/LocalStateStore-BcvyKbAw.mjs.map +1 -0
  24. package/dist/LocalStateStore-Bm8Vmwjb.cjs +178 -0
  25. package/dist/LocalStateStore-Bm8Vmwjb.cjs.map +1 -0
  26. package/dist/OpenApiTsGenerator-BD6ZOQ51.cjs +541 -0
  27. package/dist/OpenApiTsGenerator-BD6ZOQ51.cjs.map +1 -0
  28. package/dist/OpenApiTsGenerator-DXXFXSbO.mjs +536 -0
  29. package/dist/OpenApiTsGenerator-DXXFXSbO.mjs.map +1 -0
  30. package/dist/{Route53Provider-CH9XH7bz.cjs → Route53Provider-Bllus2NR.cjs} +21 -22
  31. package/dist/Route53Provider-Bllus2NR.cjs.map +1 -0
  32. package/dist/{Route53Provider-C0xmer8U.mjs → Route53Provider-QXxjkZO1.mjs} +13 -13
  33. package/dist/Route53Provider-QXxjkZO1.mjs.map +1 -0
  34. package/dist/S3StateStore-DXHSBVsV.cjs +222 -0
  35. package/dist/S3StateStore-DXHSBVsV.cjs.map +1 -0
  36. package/dist/S3StateStore-H2XsAzpJ.mjs +223 -0
  37. package/dist/S3StateStore-H2XsAzpJ.mjs.map +1 -0
  38. package/dist/SSMStateStore-BLPSNl-U.cjs +204 -0
  39. package/dist/SSMStateStore-BLPSNl-U.cjs.map +1 -0
  40. package/dist/SSMStateStore-CENciQEM.mjs +205 -0
  41. package/dist/SSMStateStore-CENciQEM.mjs.map +1 -0
  42. package/dist/SubscriberGenerator-CeH7wbYt.cjs +571 -0
  43. package/dist/SubscriberGenerator-CeH7wbYt.cjs.map +1 -0
  44. package/dist/SubscriberGenerator-DHnIYwUU.mjs +518 -0
  45. package/dist/SubscriberGenerator-DHnIYwUU.mjs.map +1 -0
  46. package/dist/add-Cdg1kEqN.cjs +719 -0
  47. package/dist/add-Cdg1kEqN.cjs.map +1 -0
  48. package/dist/add-snhdVmR-.mjs +717 -0
  49. package/dist/add-snhdVmR-.mjs.map +1 -0
  50. package/dist/appPorts-BoXMwolc.mjs +249 -0
  51. package/dist/appPorts-BoXMwolc.mjs.map +1 -0
  52. package/dist/appPorts-IW-OZmRi.cjs +296 -0
  53. package/dist/appPorts-IW-OZmRi.cjs.map +1 -0
  54. package/dist/aws-8QQ8n-t6.mjs +89 -0
  55. package/dist/aws-8QQ8n-t6.mjs.map +1 -0
  56. package/dist/aws-DY9NqQIT.cjs +100 -0
  57. package/dist/aws-DY9NqQIT.cjs.map +1 -0
  58. package/dist/awsStore-Bx5nCFnS.mjs +121 -0
  59. package/dist/awsStore-Bx5nCFnS.mjs.map +1 -0
  60. package/dist/awsStore-u3ehhMoY.cjs +138 -0
  61. package/dist/awsStore-u3ehhMoY.cjs.map +1 -0
  62. package/dist/{backup-provisioner-DXXg6FIL.mjs → backup-provisioner-C8DnCmxK.mjs} +11 -8
  63. package/dist/backup-provisioner-C8DnCmxK.mjs.map +1 -0
  64. package/dist/{backup-provisioner-cE2PuCTb.cjs → backup-provisioner-oDEsPj02.cjs} +22 -20
  65. package/dist/backup-provisioner-oDEsPj02.cjs.map +1 -0
  66. package/dist/backups/runner.cjs +519 -0
  67. package/dist/backups/runner.cjs.map +1 -0
  68. package/dist/backups/runner.d.cts +102 -0
  69. package/dist/backups/runner.d.cts.map +1 -0
  70. package/dist/backups/runner.d.mts +102 -0
  71. package/dist/backups/runner.d.mts.map +1 -0
  72. package/dist/backups/runner.mjs +506 -0
  73. package/dist/backups/runner.mjs.map +1 -0
  74. package/dist/{bundler-CaTGtiaO.cjs → bundler-B4GDxImV.cjs} +38 -35
  75. package/dist/bundler-B4GDxImV.cjs.map +1 -0
  76. package/dist/{bundler-S3ek7ea-.mjs → bundler-Wd9H4QLJ.mjs} +36 -32
  77. package/dist/bundler-Wd9H4QLJ.mjs.map +1 -0
  78. package/dist/cli-BZYz55tO.cjs +71 -0
  79. package/dist/cli-BZYz55tO.cjs.map +1 -0
  80. package/dist/cli-BzrDSNSg.mjs +71 -0
  81. package/dist/cli-BzrDSNSg.mjs.map +1 -0
  82. package/dist/compose-DN9zySvQ.cjs +3330 -0
  83. package/dist/compose-DN9zySvQ.cjs.map +1 -0
  84. package/dist/compose-Gsd1Nq7R.mjs +3187 -0
  85. package/dist/compose-Gsd1Nq7R.mjs.map +1 -0
  86. package/dist/config-D48erO2j.d.mts +269 -0
  87. package/dist/config-D48erO2j.d.mts.map +1 -0
  88. package/dist/config-DHDtsQrB.d.cts +269 -0
  89. package/dist/config-DHDtsQrB.d.cts.map +1 -0
  90. package/dist/config.cjs +421 -11
  91. package/dist/config.cjs.map +1 -0
  92. package/dist/config.d.cts +4 -120
  93. package/dist/config.d.mts +4 -120
  94. package/dist/config.mjs +405 -4
  95. package/dist/config.mjs.map +1 -0
  96. package/dist/credentialSchemas-Cf5Pf8VE.mjs +237 -0
  97. package/dist/credentialSchemas-Cf5Pf8VE.mjs.map +1 -0
  98. package/dist/credentialSchemas-D_VUCDUh.cjs +272 -0
  99. package/dist/credentialSchemas-D_VUCDUh.cjs.map +1 -0
  100. package/dist/credentials-B5N5yKk6.mjs +267 -0
  101. package/dist/credentials-B5N5yKk6.mjs.map +1 -0
  102. package/dist/credentials-Zqr3QQYB.cjs +350 -0
  103. package/dist/credentials-Zqr3QQYB.cjs.map +1 -0
  104. package/dist/databases-BeGP5eDh.mjs +495 -0
  105. package/dist/databases-BeGP5eDh.mjs.map +1 -0
  106. package/dist/databases-DGALFDG3.cjs +598 -0
  107. package/dist/databases-DGALFDG3.cjs.map +1 -0
  108. package/dist/define-6poNqm5O.mjs +106 -0
  109. package/dist/define-6poNqm5O.mjs.map +1 -0
  110. package/dist/define-crmMcXFS.cjs +153 -0
  111. package/dist/define-crmMcXFS.cjs.map +1 -0
  112. package/dist/deploy/public.cjs +212 -0
  113. package/dist/deploy/public.cjs.map +1 -0
  114. package/dist/deploy/public.d.cts +653 -0
  115. package/dist/deploy/public.d.cts.map +1 -0
  116. package/dist/deploy/public.d.mts +653 -0
  117. package/dist/deploy/public.d.mts.map +1 -0
  118. package/dist/deploy/public.mjs +145 -0
  119. package/dist/deploy/public.mjs.map +1 -0
  120. package/dist/deploy/sniffer-envkit-patch.cjs +18 -10
  121. package/dist/deploy/sniffer-envkit-patch.cjs.map +1 -1
  122. package/dist/deploy/sniffer-envkit-patch.d.cts +0 -2
  123. package/dist/deploy/sniffer-envkit-patch.d.cts.map +1 -1
  124. package/dist/deploy/sniffer-envkit-patch.d.mts +0 -2
  125. package/dist/deploy/sniffer-envkit-patch.d.mts.map +1 -1
  126. package/dist/deploy/sniffer-envkit-patch.mjs +10 -2
  127. package/dist/deploy/sniffer-envkit-patch.mjs.map +1 -1
  128. package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
  129. package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
  130. package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
  131. package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
  132. package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
  133. package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
  134. package/dist/deploy/sniffer-hooks.cjs +13 -7
  135. package/dist/deploy/sniffer-hooks.cjs.map +1 -1
  136. package/dist/deploy/sniffer-hooks.d.cts +1 -2
  137. package/dist/deploy/sniffer-hooks.d.cts.map +1 -1
  138. package/dist/deploy/sniffer-hooks.d.mts +1 -2
  139. package/dist/deploy/sniffer-hooks.d.mts.map +1 -1
  140. package/dist/deploy/sniffer-hooks.mjs +10 -3
  141. package/dist/deploy/sniffer-hooks.mjs.map +1 -1
  142. package/dist/deploy/sniffer-loader.cjs +16 -7
  143. package/dist/deploy/sniffer-loader.cjs.map +1 -1
  144. package/dist/deploy/sniffer-loader.d.cts +1 -1
  145. package/dist/deploy/sniffer-loader.d.mts +1 -1
  146. package/dist/deploy/sniffer-loader.mjs +14 -3
  147. package/dist/deploy/sniffer-loader.mjs.map +1 -1
  148. package/dist/deploy/sniffer-routes-worker.cjs +11 -11
  149. package/dist/deploy/sniffer-routes-worker.cjs.map +1 -1
  150. package/dist/deploy/sniffer-routes-worker.d.cts +1 -1
  151. package/dist/deploy/sniffer-routes-worker.d.mts +1 -1
  152. package/dist/deploy/sniffer-routes-worker.mjs +4 -4
  153. package/dist/deploy/sniffer-routes-worker.mjs.map +1 -1
  154. package/dist/deploy/sniffer-worker.cjs +15 -6
  155. package/dist/deploy/sniffer-worker.cjs.map +1 -1
  156. package/dist/deploy/sniffer-worker.d.cts +1 -3
  157. package/dist/deploy/sniffer-worker.d.cts.map +1 -1
  158. package/dist/deploy/sniffer-worker.d.mts +1 -3
  159. package/dist/deploy/sniffer-worker.d.mts.map +1 -1
  160. package/dist/deploy/sniffer-worker.mjs +15 -4
  161. package/dist/deploy/sniffer-worker.mjs.map +1 -1
  162. package/dist/deploy-CFvq8daZ.cjs +2390 -0
  163. package/dist/deploy-CFvq8daZ.cjs.map +1 -0
  164. package/dist/deploy-H2S8_mTx.mjs +2317 -0
  165. package/dist/deploy-H2S8_mTx.mjs.map +1 -0
  166. package/dist/derive-B4vDpzgP.mjs +150 -0
  167. package/dist/derive-B4vDpzgP.mjs.map +1 -0
  168. package/dist/derive-DAbo49sm.cjs +161 -0
  169. package/dist/derive-DAbo49sm.cjs.map +1 -0
  170. package/dist/discover-Bsr7HjqJ.cjs +616 -0
  171. package/dist/discover-Bsr7HjqJ.cjs.map +1 -0
  172. package/dist/discover-Ca8U75dl.mjs +537 -0
  173. package/dist/discover-Ca8U75dl.mjs.map +1 -0
  174. package/dist/discover-CvTtV5ZD.d.cts +108 -0
  175. package/dist/discover-CvTtV5ZD.d.cts.map +1 -0
  176. package/dist/discover-W2kab9Lc.d.mts +108 -0
  177. package/dist/discover-W2kab9Lc.d.mts.map +1 -0
  178. package/dist/dns-BdETzP10.cjs +1057 -0
  179. package/dist/dns-BdETzP10.cjs.map +1 -0
  180. package/dist/dns-pFMShDqW.mjs +926 -0
  181. package/dist/dns-pFMShDqW.mjs.map +1 -0
  182. package/dist/dokploy-HioAjP7K.cjs +38 -0
  183. package/dist/dokploy-HioAjP7K.cjs.map +1 -0
  184. package/dist/dokploy-oDJbnvCb.mjs +38 -0
  185. package/dist/dokploy-oDJbnvCb.mjs.map +1 -0
  186. package/dist/drivers-D11JHxrD.mjs +177 -0
  187. package/dist/drivers-D11JHxrD.mjs.map +1 -0
  188. package/dist/drivers-GKaA6ITM.cjs +200 -0
  189. package/dist/drivers-GKaA6ITM.cjs.map +1 -0
  190. package/dist/{emit-CIlvnDvV.mjs → emit-C1e8qD08.mjs} +13 -26
  191. package/dist/emit-C1e8qD08.mjs.map +1 -0
  192. package/dist/{emit-CUD1BWls.cjs → emit-Dmc1nvdS.cjs} +31 -57
  193. package/dist/emit-Dmc1nvdS.cjs.map +1 -0
  194. package/dist/encryption-D5pDJyp2.mjs +89 -0
  195. package/dist/encryption-D5pDJyp2.mjs.map +1 -0
  196. package/dist/encryption-DVCxD-gV.cjs +90 -0
  197. package/dist/encryption-DVCxD-gV.cjs.map +1 -0
  198. package/dist/engine-BaJGPzte.cjs +3196 -0
  199. package/dist/engine-BaJGPzte.cjs.map +1 -0
  200. package/dist/engine-CfAKgr2_.mjs +3083 -0
  201. package/dist/engine-CfAKgr2_.mjs.map +1 -0
  202. package/dist/errors-D8Gwp5kU.mjs +23 -0
  203. package/dist/errors-D8Gwp5kU.mjs.map +1 -0
  204. package/dist/errors-DMC4Umsb.cjs +34 -0
  205. package/dist/errors-DMC4Umsb.cjs.map +1 -0
  206. package/dist/github-D902Vwr9.cjs +829 -0
  207. package/dist/github-D902Vwr9.cjs.map +1 -0
  208. package/dist/github-E-ZxqFPq.mjs +829 -0
  209. package/dist/github-E-ZxqFPq.mjs.map +1 -0
  210. package/dist/identity-CBXr4wNi.mjs +129 -0
  211. package/dist/identity-CBXr4wNi.mjs.map +1 -0
  212. package/dist/identity-CbLfgQNT.cjs +182 -0
  213. package/dist/identity-CbLfgQNT.cjs.map +1 -0
  214. package/dist/{index-Ayxg_DQY.d.mts → index-8OfpOtSI.d.cts} +39 -24
  215. package/dist/index-8OfpOtSI.d.cts.map +1 -0
  216. package/dist/{index-CR5urhWX.d.cts → index-Dpji6Bxq.d.mts} +39 -24
  217. package/dist/index-Dpji6Bxq.d.mts.map +1 -0
  218. package/dist/index.cjs +13764 -12651
  219. package/dist/index.cjs.map +1 -1
  220. package/dist/index.d.cts +1 -1
  221. package/dist/index.d.mts +1 -1
  222. package/dist/index.mjs +13654 -12553
  223. package/dist/index.mjs.map +1 -1
  224. package/dist/local-BwC2v2Y8.mjs +224 -0
  225. package/dist/local-BwC2v2Y8.mjs.map +1 -0
  226. package/dist/local-DNhnkugT.cjs +241 -0
  227. package/dist/local-DNhnkugT.cjs.map +1 -0
  228. package/dist/migrate-BZ0GnSZQ.mjs +181 -0
  229. package/dist/migrate-BZ0GnSZQ.mjs.map +1 -0
  230. package/dist/migrate-CTqhWtev.cjs +271 -0
  231. package/dist/migrate-CTqhWtev.cjs.map +1 -0
  232. package/dist/migrate-DCXwHcWX.mjs +266 -0
  233. package/dist/migrate-DCXwHcWX.mjs.map +1 -0
  234. package/dist/migrate-Df81ew0k.cjs +181 -0
  235. package/dist/migrate-Df81ew0k.cjs.map +1 -0
  236. package/dist/openapi.cjs +214 -10
  237. package/dist/openapi.cjs.map +1 -0
  238. package/dist/openapi.d.cts +38 -17
  239. package/dist/openapi.d.cts.map +1 -1
  240. package/dist/openapi.d.mts +38 -17
  241. package/dist/openapi.d.mts.map +1 -1
  242. package/dist/openapi.mjs +208 -5
  243. package/dist/openapi.mjs.map +1 -0
  244. package/dist/projectBucket-BBbQ1lHF.cjs +263 -0
  245. package/dist/projectBucket-BBbQ1lHF.cjs.map +1 -0
  246. package/dist/projectBucket-C_DN4WzF.mjs +222 -0
  247. package/dist/projectBucket-C_DN4WzF.mjs.map +1 -0
  248. package/dist/provider-BqpjG9QM.cjs +57 -0
  249. package/dist/provider-BqpjG9QM.cjs.map +1 -0
  250. package/dist/provider-CEOKk8NS.mjs +46 -0
  251. package/dist/provider-CEOKk8NS.mjs.map +1 -0
  252. package/dist/ready-BMFjxBYA.cjs +404 -0
  253. package/dist/ready-BMFjxBYA.cjs.map +1 -0
  254. package/dist/ready-CIt5SOtg.mjs +375 -0
  255. package/dist/ready-CIt5SOtg.mjs.map +1 -0
  256. package/dist/reconcile/public.cjs +3 -5
  257. package/dist/reconcile/public.d.cts +11 -87
  258. package/dist/reconcile/public.d.cts.map +1 -1
  259. package/dist/reconcile/public.d.mts +11 -87
  260. package/dist/reconcile/public.d.mts.map +1 -1
  261. package/dist/reconcile/public.mjs +3 -4
  262. package/dist/{reconcile-C13ERt1U.mjs → reconcile--I7V4Klj.mjs} +4 -7
  263. package/dist/reconcile--I7V4Klj.mjs.map +1 -0
  264. package/dist/{reconcile-CYMhFSYy.cjs → reconcile-CuCQBa5-.cjs} +5 -8
  265. package/dist/reconcile-CuCQBa5-.cjs.map +1 -0
  266. package/dist/resolve-BMpPd8x3.mjs +263 -0
  267. package/dist/resolve-BMpPd8x3.mjs.map +1 -0
  268. package/dist/resolve-D043YmW9.cjs +316 -0
  269. package/dist/resolve-D043YmW9.cjs.map +1 -0
  270. package/dist/rollback-CBiYsQ3T.cjs +165 -0
  271. package/dist/rollback-CBiYsQ3T.cjs.map +1 -0
  272. package/dist/rollback-CDs_XNb0.mjs +136 -0
  273. package/dist/rollback-CDs_XNb0.mjs.map +1 -0
  274. package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
  275. package/dist/{chunk-CUT6urMc.cjs → rolldown-runtime-C0BPl7ul.cjs} +23 -10
  276. package/dist/run-BJLIerMM.mjs +133 -0
  277. package/dist/run-BJLIerMM.mjs.map +1 -0
  278. package/dist/run-fVZ-rLnc.cjs +174 -0
  279. package/dist/run-fVZ-rLnc.cjs.map +1 -0
  280. package/dist/runtime-ACdfK59n.d.cts +82 -0
  281. package/dist/runtime-ACdfK59n.d.cts.map +1 -0
  282. package/dist/runtime-YyQuekxi.d.mts +82 -0
  283. package/dist/runtime-YyQuekxi.d.mts.map +1 -0
  284. package/dist/s3-CrPoA89T.cjs +215 -0
  285. package/dist/s3-CrPoA89T.cjs.map +1 -0
  286. package/dist/s3-DQXZdmCM.mjs +215 -0
  287. package/dist/s3-DQXZdmCM.mjs.map +1 -0
  288. package/dist/sandbox/config-worker.cjs +43 -0
  289. package/dist/sandbox/config-worker.cjs.map +1 -0
  290. package/dist/sandbox/config-worker.d.cts +1 -0
  291. package/dist/sandbox/config-worker.d.mts +1 -0
  292. package/dist/sandbox/config-worker.mjs +44 -0
  293. package/dist/sandbox/config-worker.mjs.map +1 -0
  294. package/dist/sandbox/credentials-worker.cjs +54 -0
  295. package/dist/sandbox/credentials-worker.cjs.map +1 -0
  296. package/dist/sandbox/credentials-worker.d.cts +1 -0
  297. package/dist/sandbox/credentials-worker.d.mts +1 -0
  298. package/dist/sandbox/credentials-worker.mjs +55 -0
  299. package/dist/sandbox/credentials-worker.mjs.map +1 -0
  300. package/dist/sandbox/discover-worker.cjs +47 -0
  301. package/dist/sandbox/discover-worker.cjs.map +1 -0
  302. package/dist/sandbox/discover-worker.d.cts +1 -0
  303. package/dist/sandbox/discover-worker.d.mts +1 -0
  304. package/dist/sandbox/discover-worker.mjs +48 -0
  305. package/dist/sandbox/discover-worker.mjs.map +1 -0
  306. package/dist/sandbox/migrate-worker.cjs +75 -0
  307. package/dist/sandbox/migrate-worker.cjs.map +1 -0
  308. package/dist/sandbox/migrate-worker.d.cts +1 -0
  309. package/dist/sandbox/migrate-worker.d.mts +1 -0
  310. package/dist/sandbox/migrate-worker.mjs +76 -0
  311. package/dist/sandbox/migrate-worker.mjs.map +1 -0
  312. package/dist/sandbox-C4g1eG31.d.mts +104 -0
  313. package/dist/sandbox-C4g1eG31.d.mts.map +1 -0
  314. package/dist/sandbox-CHv3OYXg.cjs +165 -0
  315. package/dist/sandbox-CHv3OYXg.cjs.map +1 -0
  316. package/dist/sandbox-CbVB7uOD.mjs +118 -0
  317. package/dist/sandbox-CbVB7uOD.mjs.map +1 -0
  318. package/dist/sandbox-CdKgQ3XU.d.cts +104 -0
  319. package/dist/sandbox-CdKgQ3XU.d.cts.map +1 -0
  320. package/dist/{workspace-C-a3G_U0.cjs → schemas-BCwKKA42.mjs} +958 -1868
  321. package/dist/schemas-BCwKKA42.mjs.map +1 -0
  322. package/dist/{workspace-DaEX7FEg.mjs → schemas-BQ_v0lEX.cjs} +1048 -1678
  323. package/dist/schemas-BQ_v0lEX.cjs.map +1 -0
  324. package/dist/secretsManager-CQORubp9.mjs +97 -0
  325. package/dist/secretsManager-CQORubp9.mjs.map +1 -0
  326. package/dist/secretsManager-RAGcEDX1.cjs +108 -0
  327. package/dist/secretsManager-RAGcEDX1.cjs.map +1 -0
  328. package/dist/seeds-BjcO4DDa.mjs +8194 -0
  329. package/dist/seeds-BjcO4DDa.mjs.map +1 -0
  330. package/dist/seeds-DNqRA1aQ.cjs +9173 -0
  331. package/dist/seeds-DNqRA1aQ.cjs.map +1 -0
  332. package/dist/sniffer-DipSS8r8.cjs +1998 -0
  333. package/dist/sniffer-DipSS8r8.cjs.map +1 -0
  334. package/dist/sniffer-b0XPmSyT.mjs +1825 -0
  335. package/dist/sniffer-b0XPmSyT.mjs.map +1 -0
  336. package/dist/sst-B-Uz4cvm.cjs +464 -0
  337. package/dist/sst-B-Uz4cvm.cjs.map +1 -0
  338. package/dist/sst-C1pxbFEd.mjs +441 -0
  339. package/dist/sst-C1pxbFEd.mjs.map +1 -0
  340. package/dist/stage-C_y2UovO.cjs +266 -0
  341. package/dist/stage-C_y2UovO.cjs.map +1 -0
  342. package/dist/stage-DrDmZusd.mjs +266 -0
  343. package/dist/stage-DrDmZusd.mjs.map +1 -0
  344. package/dist/stages-DJrOYLZ-.mjs +176 -0
  345. package/dist/stages-DJrOYLZ-.mjs.map +1 -0
  346. package/dist/stages-_3RVNG83.cjs +176 -0
  347. package/dist/stages-_3RVNG83.cjs.map +1 -0
  348. package/dist/target/public.cjs +15 -0
  349. package/dist/target/public.d.cts +28 -0
  350. package/dist/target/public.d.cts.map +1 -0
  351. package/dist/target/public.d.mts +28 -0
  352. package/dist/target/public.d.mts.map +1 -0
  353. package/dist/target/public.mjs +4 -0
  354. package/dist/terminal-CvRLxz6g.mjs +85 -0
  355. package/dist/terminal-CvRLxz6g.mjs.map +1 -0
  356. package/dist/terminal-D_NRPW4W.cjs +85 -0
  357. package/dist/terminal-D_NRPW4W.cjs.map +1 -0
  358. package/dist/types-B6UXlEkf.d.cts +7650 -0
  359. package/dist/types-B6UXlEkf.d.cts.map +1 -0
  360. package/dist/types-HqVPddRK.d.mts +7649 -0
  361. package/dist/types-HqVPddRK.d.mts.map +1 -0
  362. package/dist/utils-D2Nk1Nv2.cjs +205 -0
  363. package/dist/utils-D2Nk1Nv2.cjs.map +1 -0
  364. package/dist/utils-D_fxUqvU.mjs +156 -0
  365. package/dist/utils-D_fxUqvU.mjs.map +1 -0
  366. package/dist/vitest.cjs +65 -0
  367. package/dist/vitest.cjs.map +1 -0
  368. package/dist/vitest.d.cts +29 -0
  369. package/dist/vitest.d.cts.map +1 -0
  370. package/dist/vitest.d.mts +29 -0
  371. package/dist/vitest.d.mts.map +1 -0
  372. package/dist/vitest.mjs +65 -0
  373. package/dist/vitest.mjs.map +1 -0
  374. package/dist/workerRuntime-BXfhbe13.cjs +108 -0
  375. package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
  376. package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
  377. package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
  378. package/dist/workspace/index.cjs +8 -4
  379. package/dist/workspace/index.d.cts +3 -3
  380. package/dist/workspace/index.d.mts +3 -3
  381. package/dist/workspace/index.mjs +2 -3
  382. package/dist/workspace-BwqQnool.cjs +2806 -0
  383. package/dist/workspace-BwqQnool.cjs.map +1 -0
  384. package/dist/workspace-D1QbNd55.mjs +2394 -0
  385. package/dist/workspace-D1QbNd55.mjs.map +1 -0
  386. package/package.json +54 -22
  387. package/dist/CachedStateProvider-BEBl2wQT.cjs +0 -60
  388. package/dist/CachedStateProvider-BEBl2wQT.cjs.map +0 -1
  389. package/dist/CachedStateProvider-C-8wtlto.mjs +0 -3
  390. package/dist/CachedStateProvider-Co4n5Wvs.mjs +0 -54
  391. package/dist/CachedStateProvider-Co4n5Wvs.mjs.map +0 -1
  392. package/dist/CachedStateProvider-DqhGpzsm.cjs +0 -3
  393. package/dist/HostingerProvider-BOvsgATO.cjs.map +0 -1
  394. package/dist/HostingerProvider-BcyFRbqV.mjs.map +0 -1
  395. package/dist/LocalStateProvider-Bq-0C0sg.mjs +0 -42
  396. package/dist/LocalStateProvider-Bq-0C0sg.mjs.map +0 -1
  397. package/dist/LocalStateProvider-yjXZXZDM.cjs +0 -43
  398. package/dist/LocalStateProvider-yjXZXZDM.cjs.map +0 -1
  399. package/dist/Route53Provider-C0xmer8U.mjs.map +0 -1
  400. package/dist/Route53Provider-CH9XH7bz.cjs.map +0 -1
  401. package/dist/SSMStateProvider-CXtNgPfy.cjs +0 -66
  402. package/dist/SSMStateProvider-CXtNgPfy.cjs.map +0 -1
  403. package/dist/SSMStateProvider-DOZifZfE.mjs +0 -66
  404. package/dist/SSMStateProvider-DOZifZfE.mjs.map +0 -1
  405. package/dist/backup-provisioner-DXXg6FIL.mjs.map +0 -1
  406. package/dist/backup-provisioner-cE2PuCTb.cjs.map +0 -1
  407. package/dist/bundler-CaTGtiaO.cjs.map +0 -1
  408. package/dist/bundler-S3ek7ea-.mjs.map +0 -1
  409. package/dist/chunk-Duj1WY3L.mjs +0 -7
  410. package/dist/config-B0L2tvvC.mjs +0 -402
  411. package/dist/config-B0L2tvvC.mjs.map +0 -1
  412. package/dist/config-HhDpJmLO.cjs +0 -462
  413. package/dist/config-HhDpJmLO.cjs.map +0 -1
  414. package/dist/config.d.cts.map +0 -1
  415. package/dist/config.d.mts.map +0 -1
  416. package/dist/credentials-B2Pyh3bJ.cjs +0 -2681
  417. package/dist/credentials-B2Pyh3bJ.cjs.map +0 -1
  418. package/dist/credentials-B5zRHdAl.mjs +0 -141
  419. package/dist/credentials-B5zRHdAl.mjs.map +0 -1
  420. package/dist/credentials-BapzjyV5.cjs +0 -195
  421. package/dist/credentials-BapzjyV5.cjs.map +0 -1
  422. package/dist/credentials-CZrys9C5.mjs +0 -2549
  423. package/dist/credentials-CZrys9C5.mjs.map +0 -1
  424. package/dist/discover-CAlFgYec.mjs +0 -229
  425. package/dist/discover-CAlFgYec.mjs.map +0 -1
  426. package/dist/discover-DTmFeloL.cjs +0 -271
  427. package/dist/discover-DTmFeloL.cjs.map +0 -1
  428. package/dist/dokploy-api-5cK2InBm.cjs +0 -3
  429. package/dist/dokploy-api-D2Ny4Jrc.mjs +0 -3
  430. package/dist/dokploy-api-pdaBryoY.mjs +0 -706
  431. package/dist/dokploy-api-pdaBryoY.mjs.map +0 -1
  432. package/dist/dokploy-api-zqKe9lHH.cjs +0 -718
  433. package/dist/dokploy-api-zqKe9lHH.cjs.map +0 -1
  434. package/dist/emit-CIlvnDvV.mjs.map +0 -1
  435. package/dist/emit-CUD1BWls.cjs.map +0 -1
  436. package/dist/encryption-D2pL3tHH.cjs +0 -54
  437. package/dist/encryption-D2pL3tHH.cjs.map +0 -1
  438. package/dist/encryption-YDsXXi6w.mjs +0 -3
  439. package/dist/encryption-_4zwjOAR.mjs +0 -42
  440. package/dist/encryption-_4zwjOAR.mjs.map +0 -1
  441. package/dist/encryption-sQ2Oxx0d.cjs +0 -4
  442. package/dist/fullstack-secrets-D6MyHhQP.cjs +0 -111
  443. package/dist/fullstack-secrets-D6MyHhQP.cjs.map +0 -1
  444. package/dist/fullstack-secrets-METaRLS1.mjs +0 -87
  445. package/dist/fullstack-secrets-METaRLS1.mjs.map +0 -1
  446. package/dist/generator-CNzBw7g5.cjs +0 -289
  447. package/dist/generator-CNzBw7g5.cjs.map +0 -1
  448. package/dist/generator-VE2JrFlY.mjs +0 -253
  449. package/dist/generator-VE2JrFlY.mjs.map +0 -1
  450. package/dist/github-BrvaPkFf.cjs +0 -197
  451. package/dist/github-BrvaPkFf.cjs.map +0 -1
  452. package/dist/github-CrpsXSfV.mjs +0 -196
  453. package/dist/github-CrpsXSfV.mjs.map +0 -1
  454. package/dist/index-Ayxg_DQY.d.mts.map +0 -1
  455. package/dist/index-CR5urhWX.d.cts.map +0 -1
  456. package/dist/keystore-C9rint2E.cjs +0 -101
  457. package/dist/keystore-C9rint2E.cjs.map +0 -1
  458. package/dist/keystore-TxeYM7an.mjs +0 -83
  459. package/dist/keystore-TxeYM7an.mjs.map +0 -1
  460. package/dist/openapi-DaKlTKxz.cjs +0 -2075
  461. package/dist/openapi-DaKlTKxz.cjs.map +0 -1
  462. package/dist/openapi-react-query-BKH334Ug.cjs +0 -173
  463. package/dist/openapi-react-query-BKH334Ug.cjs.map +0 -1
  464. package/dist/openapi-react-query-DoR5CmzQ.mjs +0 -167
  465. package/dist/openapi-react-query-DoR5CmzQ.mjs.map +0 -1
  466. package/dist/openapi-react-query.cjs +0 -4
  467. package/dist/openapi-react-query.d.cts +0 -11
  468. package/dist/openapi-react-query.d.cts.map +0 -1
  469. package/dist/openapi-react-query.d.mts +0 -11
  470. package/dist/openapi-react-query.d.mts.map +0 -1
  471. package/dist/openapi-react-query.mjs +0 -4
  472. package/dist/openapi-y1d7Kalt.mjs +0 -2021
  473. package/dist/openapi-y1d7Kalt.mjs.map +0 -1
  474. package/dist/reconcile-C13ERt1U.mjs.map +0 -1
  475. package/dist/reconcile-CYMhFSYy.cjs.map +0 -1
  476. package/dist/setup-BWgMs4gg.mjs +0 -12
  477. package/dist/setup-DOv92pIu.cjs +0 -473
  478. package/dist/setup-DOv92pIu.cjs.map +0 -1
  479. package/dist/setup-DQo_h_yK.mjs +0 -443
  480. package/dist/setup-DQo_h_yK.mjs.map +0 -1
  481. package/dist/setup-lCx_DcUo.cjs +0 -12
  482. package/dist/storage-B020InPW.mjs +0 -222
  483. package/dist/storage-B020InPW.mjs.map +0 -1
  484. package/dist/storage-CSNplaJn.cjs +0 -282
  485. package/dist/storage-CSNplaJn.cjs.map +0 -1
  486. package/dist/storage-DGBzMLZa.mjs +0 -4
  487. package/dist/storage-DlVol_oj.cjs +0 -8
  488. package/dist/sync-0ILCb-1S.cjs +0 -93
  489. package/dist/sync-0ILCb-1S.cjs.map +0 -1
  490. package/dist/sync-CzHXiR9c.mjs +0 -76
  491. package/dist/sync-CzHXiR9c.mjs.map +0 -1
  492. package/dist/sync-DYENfOt4.cjs +0 -4
  493. package/dist/sync-HAau6h_R.mjs +0 -3
  494. package/dist/types-CL7jPFM2.d.mts +0 -2220
  495. package/dist/types-CL7jPFM2.d.mts.map +0 -1
  496. package/dist/types-Y3fKQSAK.d.cts +0 -2220
  497. package/dist/types-Y3fKQSAK.d.cts.map +0 -1
  498. package/dist/workspace-C-a3G_U0.cjs.map +0 -1
  499. package/dist/workspace-DQxxs7Jk.cjs +0 -10
  500. package/dist/workspace-DaEX7FEg.mjs.map +0 -1
  501. package/dist/workspace-DbI580qS.mjs +0 -9
@@ -0,0 +1,181 @@
1
+ import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
2
+ import { N as assertDeployedStage, ct as UnknownSecretsStoreProvider, st as SECRETS_STORE_PROVIDERS, ut as s3SecretsLocation } from "./workspace-D1QbNd55.mjs";
3
+ import { It as secretsStoreFor, Lt as storeFromConfig } from "./seeds-BjcO4DDa.mjs";
4
+ import { loadWorkspaceSettings } from "./config.mjs";
5
+ import { n as secretsParameterName } from "./aws-8QQ8n-t6.mjs";
6
+ import { t as secretsManagerSecretName } from "./secretsManager-CQORubp9.mjs";
7
+ import { isDeepStrictEqual } from "node:util";
8
+ //#region src/secrets/migrate.ts
9
+ /**
10
+ * `gkm secrets:migrate` — copy a deployed stage's secrets from the store
11
+ * `secrets.store` names to another one, whole: service passwords, URLs and
12
+ * custom keys alike, so nothing is regenerated and running services keep
13
+ * their credentials.
14
+ *
15
+ * It copies, reads the copy back and compares it, and nothing more. The source
16
+ * is never deleted, and gkm.config.ts is not edited: pointing `secrets.store`
17
+ * at the new store is the switch, and the old copy is deleted by hand — with
18
+ * the command this prints — once deploys read from the new one. Run again, a
19
+ * target already holding the same secrets is verified and left alone.
20
+ */
21
+ const logger = console;
22
+ /** An AWS store to copy to, with no region given and none configured. */
23
+ var MigrateTargetNeedsRegion = class extends GkmError {
24
+ to;
25
+ constructor(to) {
26
+ super(`Copying to ${to} needs a region, and secrets.store has none to reuse. Pass it: gkm secrets:migrate --to ${to} --region <region> --stage <stage>.`);
27
+ this.to = to;
28
+ this.name = "MigrateTargetNeedsRegion";
29
+ }
30
+ };
31
+ /** The target is the store the stage is already read from. */
32
+ var MigrateTargetIsSource = class extends GkmError {
33
+ stage;
34
+ to;
35
+ constructor(stage, to) {
36
+ super(`Stage "${stage}" is already kept in ${to}, so there is nothing to copy. Name a different store with --to, or a different region with --region.`);
37
+ this.stage = stage;
38
+ this.to = to;
39
+ this.name = "MigrateTargetIsSource";
40
+ }
41
+ };
42
+ /** The configured store holds nothing for the stage. */
43
+ var NoSecretsToMigrate = class extends GkmError {
44
+ stage;
45
+ store;
46
+ constructor(stage, store) {
47
+ super(`The ${store} store holds no secrets for stage "${stage}", so there is nothing to copy. Check secrets.store in gkm.config.ts still names the store the stage is in, or create the stage there with gkm secrets:init --stage ${stage}.`);
48
+ this.stage = stage;
49
+ this.store = store;
50
+ this.name = "NoSecretsToMigrate";
51
+ }
52
+ };
53
+ /**
54
+ * The target already holds different secrets for the stage, and `--force` was
55
+ * not given.
56
+ */
57
+ var MigrateTargetHoldsStage = class extends GkmError {
58
+ stage;
59
+ to;
60
+ constructor(stage, to) {
61
+ super(`The ${to} store already holds different secrets for stage "${stage}". Pass --force to replace them with the ones being copied.`);
62
+ this.stage = stage;
63
+ this.to = to;
64
+ this.name = "MigrateTargetHoldsStage";
65
+ }
66
+ };
67
+ /** The copy read back from the target is not what was copied. */
68
+ var MigratedSecretsDiffer = class extends GkmError {
69
+ stage;
70
+ to;
71
+ keys;
72
+ constructor(stage, to, keys) {
73
+ super(`The secrets for stage "${stage}" read back from ${to} differ from the ones copied` + (keys.length ? ` (${keys.join(", ")})` : "") + ". The source is untouched and secrets.store still names it; run the migration again, or with --force if something else is writing to the target.");
74
+ this.stage = stage;
75
+ this.to = to;
76
+ this.keys = keys;
77
+ this.name = "MigratedSecretsDiffer";
78
+ }
79
+ };
80
+ /** The region the configured store is in, where it is an AWS one. */
81
+ function configuredRegion(configured, state) {
82
+ if (typeof configured !== "object") return void 0;
83
+ if (configured.provider === "s3") return s3SecretsLocation(configured, state).region;
84
+ return "region" in configured ? configured.region : void 0;
85
+ }
86
+ /** The store a `--to` name and region describe. */
87
+ function targetConfig(to, region, configured, state) {
88
+ if (!SECRETS_STORE_PROVIDERS.includes(to)) throw new UnknownSecretsStoreProvider(to);
89
+ const provider = to;
90
+ if (provider === "file") return "file";
91
+ const fallback = configuredRegion(configured, state);
92
+ if (provider === "s3") {
93
+ const inherits = typeof state === "object" && state !== null && state.provider === "s3";
94
+ const resolved = region ?? (inherits ? void 0 : fallback);
95
+ if (!resolved && !inherits) throw new MigrateTargetNeedsRegion(provider);
96
+ return {
97
+ provider,
98
+ ...resolved ? { region: resolved } : {}
99
+ };
100
+ }
101
+ const resolved = region ?? fallback;
102
+ if (!resolved) throw new MigrateTargetNeedsRegion(provider);
103
+ return {
104
+ provider,
105
+ region: resolved
106
+ };
107
+ }
108
+ /** Whether two configs name the same place. */
109
+ function samePlace(a, b, state) {
110
+ if (typeof a === "string" || typeof b === "string") return a === b;
111
+ if (a.provider !== b.provider) return false;
112
+ if (a.provider === "s3" && b.provider === "s3") return isDeepStrictEqual(s3SecretsLocation(a, state), s3SecretsLocation(b, state));
113
+ return "region" in a && "region" in b && a.region === b.region;
114
+ }
115
+ /** The `secrets.store` value to write in gkm.config.ts. */
116
+ function configLine(target) {
117
+ if (typeof target === "string") return `'${target}'`;
118
+ const region = "region" in target && target.region ? `, region: '${target.region}'` : "";
119
+ return `{ provider: '${String(target.provider)}'${region} }`;
120
+ }
121
+ /** The keys whose values differ between two documents, as `section.KEY`. */
122
+ function differingKeys(a, b) {
123
+ const keys = [];
124
+ for (const section of [
125
+ "custom",
126
+ "urls",
127
+ "services"
128
+ ]) {
129
+ const left = a[section];
130
+ const right = b?.[section] ?? {};
131
+ for (const key of /* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)])) if (!isDeepStrictEqual(left[key], right[key])) keys.push(`${section}.${key}`);
132
+ }
133
+ return keys.sort();
134
+ }
135
+ /**
136
+ * The command that deletes the stage's copy in the source store, for the
137
+ * person to run once deploys read from the target — gkm never runs it.
138
+ */
139
+ function deleteSourceCommand(workspace, configured, source, stage, profile) {
140
+ const as = profile ? ` --profile ${profile}` : "";
141
+ if (configured === "file") return `rm .gkm/secrets/${stage}.json`;
142
+ switch (configured.provider) {
143
+ case "ssm": return `aws ssm delete-parameter --name ${secretsParameterName(workspace.name, stage)} --region ${configured.region}${as}`;
144
+ case "secrets-manager": return `aws secretsmanager delete-secret --secret-id ${secretsManagerSecretName(workspace.name, stage)} --region ${configured.region}${as}`;
145
+ case "s3": {
146
+ const location = source.location?.(stage);
147
+ if (!location) return null;
148
+ return `aws s3 rm ${location}${as}`;
149
+ }
150
+ default: return null;
151
+ }
152
+ }
153
+ async function secretsMigrateCommand(options) {
154
+ const { stage, to } = options;
155
+ const workspace = await loadWorkspaceSettings();
156
+ assertDeployedStage(workspace.stages, stage);
157
+ const configured = workspace.secrets.store ?? "file";
158
+ const target = targetConfig(to, options.region, configured, workspace.state);
159
+ if (samePlace(configured, target, workspace.state)) throw new MigrateTargetIsSource(stage, to);
160
+ const storeOptions = options.profile ? { profile: options.profile } : {};
161
+ const source = await secretsStoreFor(workspace, stage, storeOptions);
162
+ const destination = await storeFromConfig(workspace, target, storeOptions);
163
+ const secrets = await source.read(stage);
164
+ if (!secrets) throw new NoSecretsToMigrate(stage, source.name);
165
+ const held = await destination.read(stage);
166
+ const already = held !== null && isDeepStrictEqual(held, secrets);
167
+ if (held && !already && !options.force) throw new MigrateTargetHoldsStage(stage, destination.name);
168
+ if (!already) await destination.write(stage, secrets);
169
+ const copied = await (await storeFromConfig(workspace, target, storeOptions)).read(stage);
170
+ if (!isDeepStrictEqual(copied, secrets)) throw new MigratedSecretsDiffer(stage, destination.name, differingKeys(secrets, copied));
171
+ const count = Object.keys(secrets.custom).length + Object.keys(secrets.urls).length + Object.keys(secrets.services).length;
172
+ logger.log(already ? `\n✓ ${destination.name} already holds the same secrets for stage "${stage}" as ${source.name}; nothing copied` : `\n✓ Copied the secrets for stage "${stage}" from ${source.name} to ${destination.name}`);
173
+ logger.log(` Verified: ${count} keys read back from ${destination.name}, equal.`);
174
+ logger.log(`\n Next: set secrets.store to ${configLine(target)} in gkm.config.ts, so commands and deploys read from ${destination.name}.`);
175
+ const remove = deleteSourceCommand(workspace, configured, source, stage, options.profile);
176
+ logger.log(` The copy in ${source.name} is left as it was. Once deploys read from ${destination.name}, delete it` + (remove ? ` with:\n\n ${remove}\n` : "."));
177
+ }
178
+ //#endregion
179
+ export { secretsMigrateCommand };
180
+
181
+ //# sourceMappingURL=migrate-BZ0GnSZQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-BZ0GnSZQ.mjs","names":[],"sources":["../src/secrets/migrate.ts"],"sourcesContent":["/**\n * `gkm secrets:migrate` — copy a deployed stage's secrets from the store\n * `secrets.store` names to another one, whole: service passwords, URLs and\n * custom keys alike, so nothing is regenerated and running services keep\n * their credentials.\n *\n * It copies, reads the copy back and compares it, and nothing more. The source\n * is never deleted, and gkm.config.ts is not edited: pointing `secrets.store`\n * at the new store is the switch, and the old copy is deleted by hand — with\n * the command this prints — once deploys read from the new one. Run again, a\n * target already holding the same secrets is verified and left alone.\n */\n\nimport { isDeepStrictEqual } from 'node:util';\n\nimport { loadWorkspaceSettings } from '../config.js';\nimport { GkmError } from '../errors';\nimport { assertDeployedStage } from '../workspace/stages.js';\nimport { secretsParameterName } from './aws.js';\nimport { secretsManagerSecretName } from './secretsManager.js';\nimport {\n\tSECRETS_STORE_PROVIDERS,\n\ttype SecretsStore,\n\ttype SecretsStoreConfig,\n\ttype SecretsStoreOptions,\n\ttype SecretsStoreProvider,\n\ts3SecretsLocation,\n\tsecretsStoreFor,\n\tstoreFromConfig,\n\tUnknownSecretsStoreProvider,\n} from './store.js';\nimport type { StageSecrets } from './types.js';\n\nconst logger = console;\n\nexport interface SecretsMigrateOptions {\n\tstage: string;\n\t/** The store to copy to: `'file'`, `'s3'`, `'ssm'` or `'secrets-manager'`. */\n\tto: string;\n\t/**\n\t * The target's AWS region; defaults to the configured store's — for `s3`,\n\t * to the S3 state's first.\n\t */\n\tregion?: string;\n\t/** Overwrite a stage the target already holds different secrets for. */\n\tforce?: boolean;\n\t/** The AWS profile for the stage's account, for both stores. */\n\tprofile?: string;\n}\n\n/** An AWS store to copy to, with no region given and none configured. */\nexport class MigrateTargetNeedsRegion extends GkmError {\n\tconstructor(readonly to: string) {\n\t\tsuper(\n\t\t\t`Copying to ${to} needs a region, and secrets.store has none to reuse. ` +\n\t\t\t\t`Pass it: gkm secrets:migrate --to ${to} --region <region> --stage <stage>.`,\n\t\t);\n\t\tthis.name = 'MigrateTargetNeedsRegion';\n\t}\n}\n\n/** The target is the store the stage is already read from. */\nexport class MigrateTargetIsSource extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly to: string,\n\t) {\n\t\tsuper(\n\t\t\t`Stage \"${stage}\" is already kept in ${to}, so there is nothing to copy. ` +\n\t\t\t\t'Name a different store with --to, or a different region with --region.',\n\t\t);\n\t\tthis.name = 'MigrateTargetIsSource';\n\t}\n}\n\n/** The configured store holds nothing for the stage. */\nexport class NoSecretsToMigrate extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly store: string,\n\t) {\n\t\tsuper(\n\t\t\t`The ${store} store holds no secrets for stage \"${stage}\", so there is nothing to copy. ` +\n\t\t\t\t`Check secrets.store in gkm.config.ts still names the store the stage is in, ` +\n\t\t\t\t`or create the stage there with gkm secrets:init --stage ${stage}.`,\n\t\t);\n\t\tthis.name = 'NoSecretsToMigrate';\n\t}\n}\n\n/**\n * The target already holds different secrets for the stage, and `--force` was\n * not given.\n */\nexport class MigrateTargetHoldsStage extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly to: string,\n\t) {\n\t\tsuper(\n\t\t\t`The ${to} store already holds different secrets for stage \"${stage}\". ` +\n\t\t\t\t'Pass --force to replace them with the ones being copied.',\n\t\t);\n\t\tthis.name = 'MigrateTargetHoldsStage';\n\t}\n}\n\n/** The copy read back from the target is not what was copied. */\nexport class MigratedSecretsDiffer extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly to: string,\n\t\t/** The keys whose values differ, or that only one side has. */\n\t\treadonly keys: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`The secrets for stage \"${stage}\" read back from ${to} differ from the ones copied` +\n\t\t\t\t(keys.length ? ` (${keys.join(', ')})` : '') +\n\t\t\t\t'. The source is untouched and secrets.store still names it; run the migration again, ' +\n\t\t\t\t'or with --force if something else is writing to the target.',\n\t\t);\n\t\tthis.name = 'MigratedSecretsDiffer';\n\t}\n}\n\n/** The region the configured store is in, where it is an AWS one. */\nfunction configuredRegion(\n\tconfigured: SecretsStoreConfig,\n\tstate: unknown,\n): string | undefined {\n\tif (typeof configured !== 'object') return undefined;\n\tif (configured.provider === 's3') {\n\t\treturn s3SecretsLocation(configured, state).region;\n\t}\n\t// A custom store has no region to reuse.\n\treturn 'region' in configured ? configured.region : undefined;\n}\n\n/** The store a `--to` name and region describe. */\nfunction targetConfig(\n\tto: string,\n\tregion: string | undefined,\n\tconfigured: SecretsStoreConfig,\n\tstate: unknown,\n): SecretsStoreConfig {\n\tif (!(SECRETS_STORE_PROVIDERS as readonly string[]).includes(to)) {\n\t\tthrow new UnknownSecretsStoreProvider(to);\n\t}\n\tconst provider = to as SecretsStoreProvider;\n\tif (provider === 'file') return 'file';\n\n\tconst fallback = configuredRegion(configured, state);\n\n\tif (provider === 's3') {\n\t\t// The project bucket beside an S3 state is in the state's region.\n\t\tconst inherits =\n\t\t\ttypeof state === 'object' &&\n\t\t\tstate !== null &&\n\t\t\t(state as { provider?: unknown }).provider === 's3';\n\t\tconst resolved = region ?? (inherits ? undefined : fallback);\n\t\tif (!resolved && !inherits) throw new MigrateTargetNeedsRegion(provider);\n\t\treturn { provider, ...(resolved ? { region: resolved } : {}) };\n\t}\n\n\tconst resolved = region ?? fallback;\n\tif (!resolved) throw new MigrateTargetNeedsRegion(provider);\n\treturn { provider, region: resolved };\n}\n\n/** Whether two configs name the same place. */\nfunction samePlace(\n\ta: SecretsStoreConfig,\n\tb: SecretsStoreConfig,\n\tstate: unknown,\n): boolean {\n\tif (typeof a === 'string' || typeof b === 'string') return a === b;\n\tif (a.provider !== b.provider) return false;\n\tif (a.provider === 's3' && b.provider === 's3') {\n\t\treturn isDeepStrictEqual(\n\t\t\ts3SecretsLocation(a, state),\n\t\t\ts3SecretsLocation(b, state),\n\t\t);\n\t}\n\treturn 'region' in a && 'region' in b && a.region === b.region;\n}\n\n/** The `secrets.store` value to write in gkm.config.ts. */\nfunction configLine(target: SecretsStoreConfig): string {\n\tif (typeof target === 'string') return `'${target}'`;\n\tconst region =\n\t\t'region' in target && target.region ? `, region: '${target.region}'` : '';\n\treturn `{ provider: '${String(target.provider)}'${region} }`;\n}\n\n/** The keys whose values differ between two documents, as `section.KEY`. */\nexport function differingKeys(\n\ta: StageSecrets,\n\tb: StageSecrets | null,\n): string[] {\n\tconst keys: string[] = [];\n\tfor (const section of ['custom', 'urls', 'services'] as const) {\n\t\tconst left = a[section] as Record<string, unknown>;\n\t\tconst right = (b?.[section] ?? {}) as Record<string, unknown>;\n\t\tfor (const key of new Set([...Object.keys(left), ...Object.keys(right)])) {\n\t\t\tif (!isDeepStrictEqual(left[key], right[key])) {\n\t\t\t\tkeys.push(`${section}.${key}`);\n\t\t\t}\n\t\t}\n\t}\n\treturn keys.sort();\n}\n\n/**\n * The command that deletes the stage's copy in the source store, for the\n * person to run once deploys read from the target — gkm never runs it.\n */\nexport function deleteSourceCommand(\n\tworkspace: { name: string },\n\tconfigured: SecretsStoreConfig,\n\tsource: SecretsStore,\n\tstage: string,\n\tprofile: string | undefined,\n): string | null {\n\tconst as = profile ? ` --profile ${profile}` : '';\n\tif (configured === 'file') return `rm .gkm/secrets/${stage}.json`;\n\tswitch (configured.provider) {\n\t\tcase 'ssm':\n\t\t\treturn `aws ssm delete-parameter --name ${secretsParameterName(workspace.name, stage)} --region ${configured.region}${as}`;\n\t\tcase 'secrets-manager':\n\t\t\treturn `aws secretsmanager delete-secret --secret-id ${secretsManagerSecretName(workspace.name, stage)} --region ${configured.region}${as}`;\n\t\tcase 's3': {\n\t\t\tconst location = (\n\t\t\t\tsource as { location?(stage: string): string }\n\t\t\t).location?.(stage);\n\t\t\tif (!location) return null;\n\t\t\t// Every version, as the bucket keeps them: only a delete marker is added.\n\t\t\treturn `aws s3 rm ${location}${as}`;\n\t\t}\n\t\tdefault:\n\t\t\treturn null;\n\t}\n}\n\nexport async function secretsMigrateCommand(\n\toptions: SecretsMigrateOptions,\n): Promise<void> {\n\tconst { stage, to } = options;\n\tconst workspace = await loadWorkspaceSettings();\n\tassertDeployedStage(workspace.stages, stage);\n\n\tconst configured = workspace.secrets.store ?? 'file';\n\tconst target = targetConfig(to, options.region, configured, workspace.state);\n\tif (samePlace(configured, target, workspace.state)) {\n\t\tthrow new MigrateTargetIsSource(stage, to);\n\t}\n\n\tconst storeOptions: SecretsStoreOptions = options.profile\n\t\t? { profile: options.profile }\n\t\t: {};\n\tconst source = await secretsStoreFor(workspace, stage, storeOptions);\n\tconst destination = await storeFromConfig(workspace, target, storeOptions);\n\n\tconst secrets = await source.read(stage);\n\tif (!secrets) throw new NoSecretsToMigrate(stage, source.name);\n\n\tconst held = await destination.read(stage);\n\tconst already = held !== null && isDeepStrictEqual(held, secrets);\n\tif (held && !already && !options.force) {\n\t\tthrow new MigrateTargetHoldsStage(stage, destination.name);\n\t}\n\tif (!already) await destination.write(stage, secrets);\n\n\t// Read back through a store of its own, so nothing cached answers.\n\tconst copied = await (\n\t\tawait storeFromConfig(workspace, target, storeOptions)\n\t).read(stage);\n\tif (!isDeepStrictEqual(copied, secrets)) {\n\t\tthrow new MigratedSecretsDiffer(\n\t\t\tstage,\n\t\t\tdestination.name,\n\t\t\tdifferingKeys(secrets, copied),\n\t\t);\n\t}\n\n\tconst count =\n\t\tObject.keys(secrets.custom).length +\n\t\tObject.keys(secrets.urls).length +\n\t\tObject.keys(secrets.services).length;\n\tlogger.log(\n\t\talready\n\t\t\t? `\\n✓ ${destination.name} already holds the same secrets for stage \"${stage}\" as ${source.name}; nothing copied`\n\t\t\t: `\\n✓ Copied the secrets for stage \"${stage}\" from ${source.name} to ${destination.name}`,\n\t);\n\tlogger.log(\n\t\t` Verified: ${count} keys read back from ${destination.name}, equal.`,\n\t);\n\tlogger.log(\n\t\t`\\n Next: set secrets.store to ${configLine(target)} in gkm.config.ts, so commands and deploys read from ${destination.name}.`,\n\t);\n\tconst remove = deleteSourceCommand(\n\t\tworkspace,\n\t\tconfigured,\n\t\tsource,\n\t\tstage,\n\t\toptions.profile,\n\t);\n\tlogger.log(\n\t\t` The copy in ${source.name} is left as it was. Once deploys read from ${destination.name}, delete it` +\n\t\t\t(remove ? ` with:\\n\\n ${remove}\\n` : '.'),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,SAAS;;AAkBf,IAAa,2BAAb,cAA8C,SAAS;CACjC;CAArB,YAAY,IAAqB;EAChC,MACC,cAAc,GAAG,0FACqB,GAAG,oCAC1C;EAJoB,KAAA,KAAA;EAKpB,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,wBAAb,cAA2C,SAAS;CAEzC;CACA;CAFV,YACC,OACA,IACC;EACD,MACC,UAAU,MAAM,uBAAuB,GAAG,sGAE3C;EANS,KAAA,QAAA;EACA,KAAA,KAAA;EAMT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,qBAAb,cAAwC,SAAS;CAEtC;CACA;CAFV,YACC,OACA,OACC;EACD,MACC,OAAO,MAAM,qCAAqC,MAAM,sKAEI,MAAM,EACnE;EAPS,KAAA,QAAA;EACA,KAAA,QAAA;EAOT,KAAK,OAAO;CACb;AACD;;;;;AAMA,IAAa,0BAAb,cAA6C,SAAS;CAE3C;CACA;CAFV,YACC,OACA,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Q,CAAC,CAAC;CAC/B,OAAO,IACN,UACG,OAAO,YAAY,KAAK,6CAA6C,MAAM,OAAO,OAAO,KAAK,oBAC9F,qCAAqC,MAAM,SAAS,OAAO,KAAK,MAAM,YAAY,MACtF;CACA,OAAO,IACN,eAAe,MAAM,uBAAuB,YAAY,KAAK,SAC9D;CACA,OAAO,IACN,kCAAkC,WAAW,MAAM,EAAE,uDAAuD,YAAY,KAAK,EAC9H;CACA,MAAM,SAAS,oBACd,WACA,YACA,QACA,OACA,QAAQ,OACT;CACA,OAAO,IACN,iBAAiB,OAAO,KAAK,6CAA6C,YAAY,KAAK,gBACzF,SAAS,iBAAiB,OAAO,MAAM,IAC1C;AACD"}
@@ -0,0 +1,271 @@
1
+ const require_errors = require("./errors-DMC4Umsb.cjs");
2
+ const require_workspace = require("./workspace-BwqQnool.cjs");
3
+ const require_seeds = require("./seeds-DNqRA1aQ.cjs");
4
+ const require_discover = require("./discover-Bsr7HjqJ.cjs");
5
+ const require_config = require("./config.cjs");
6
+ const require_databases = require("./databases-DGALFDG3.cjs");
7
+ const require_index = require("./index.cjs");
8
+ let node_path = require("node:path");
9
+ let node_fs_promises = require("node:fs/promises");
10
+ let _geekmidas_manifest = require("@geekmidas/manifest");
11
+ let _geekmidas_envkit = require("@geekmidas/envkit");
12
+ let _geekmidas_services = require("@geekmidas/services");
13
+ //#region src/migrate/index.ts
14
+ /**
15
+ * `gkm migrate`, `gkm seed` and `gkm migration` — applying a construct's
16
+ * migrations, running its seeds, and writing its next migration.
17
+ *
18
+ * Both work on a stage this machine reconciles: its containers up, its roles
19
+ * provisioned, its owner URLs resolved. A deployed stage is migrated by the
20
+ * deploy that ships it, which is the one thing that can reach its database.
21
+ */
22
+ const logger = console;
23
+ /** `gkm migrate --stage` named a stage only a deploy can reach. */
24
+ var MigrateDeployedStage = class extends require_errors.GkmError {
25
+ stage;
26
+ local;
27
+ constructor(stage, local) {
28
+ super(`'${stage}' is a deployed stage, and its database is migrated by \`gkm deploy --stage ${stage}\`, which is what can reach it. \`gkm migrate\` runs against '${local}' or '${require_workspace.TEST_STAGE}'.`);
29
+ this.stage = stage;
30
+ this.local = local;
31
+ this.name = "MigrateDeployedStage";
32
+ }
33
+ };
34
+ /** `gkm migration` for a Kysely database, with no name for the file. */
35
+ var MigrationNeedsName = class extends require_errors.GkmError {
36
+ construct;
37
+ constructor(construct) {
38
+ super(`Name the migration: \`gkm migration ${construct} add_workouts\`. The name is what the file — and the history — calls it.`);
39
+ this.construct = construct;
40
+ this.name = "MigrationNeedsName";
41
+ }
42
+ };
43
+ /**
44
+ * Reconcile a stage so it can be migrated: containers up, databases, schemas,
45
+ * roles and grants in place, owner URLs resolved.
46
+ *
47
+ * Migrating assumes the roles exist, and this is what makes that true rather
48
+ * than something a developer has to have run first.
49
+ */
50
+ async function readyStage(cwd, stage) {
51
+ const { workspace } = await require_config.loadWorkspaceConfig(cwd);
52
+ const local = workspace.stages.local;
53
+ const target = stage ?? local;
54
+ if (target !== local && target !== "test") throw new MigrateDeployedStage(target, local);
55
+ const sources = {};
56
+ const manifest = await require_discover.discover({
57
+ patterns: require_seeds.constructGlobs(workspace),
58
+ cwd: workspace.root,
59
+ sources
60
+ });
61
+ return {
62
+ workspace,
63
+ manifest,
64
+ sources,
65
+ env: { ...(await require_seeds.reconcileWorkspace(workspace, {
66
+ stage: target,
67
+ manifest,
68
+ start: true
69
+ })).env },
70
+ stage: target
71
+ };
72
+ }
73
+ /** `gkm migrate [construct]`. */
74
+ async function migrateCommand(options = {}) {
75
+ const ready = await readyStage(process.cwd(), options.stage);
76
+ const runs = await require_databases.migrateDatabases({
77
+ root: ready.workspace.root,
78
+ manifest: ready.manifest,
79
+ sources: ready.sources,
80
+ env: ready.env,
81
+ ...options.construct ? { only: options.construct } : {}
82
+ });
83
+ if (runs.length === 0) {
84
+ logger.log("🗄️ No database constructs to migrate.");
85
+ return;
86
+ }
87
+ logMigrations(runs);
88
+ }
89
+ /**
90
+ * `gkm seed [construct]` — migrate, then run the seeds.
91
+ *
92
+ * Always migrates first: a seed is written against the schema its migrations
93
+ * build, and against an older one it fails on a table that is not there yet.
94
+ */
95
+ async function seedCommand(options = {}) {
96
+ const ready = await readyStage(process.cwd(), options.stage);
97
+ const { migrations, seeds } = await require_databases.migrateAndSeed({
98
+ root: ready.workspace.root,
99
+ manifest: ready.manifest,
100
+ sources: ready.sources,
101
+ env: ready.env,
102
+ stage: ready.stage,
103
+ ...options.construct ? { only: options.construct } : {}
104
+ });
105
+ if (migrations.length === 0) {
106
+ logger.log("🗄️ No database constructs to seed.");
107
+ return;
108
+ }
109
+ logMigrations(migrations);
110
+ logSeeds(seeds);
111
+ }
112
+ /** One line per construct: up to date, or what was applied. */
113
+ function logMigrations(runs, log = logger.log) {
114
+ for (const { target, applied } of runs) {
115
+ if (applied.length === 0) {
116
+ log(`🗄️ ${target.migrations}: up to date`);
117
+ continue;
118
+ }
119
+ log(`🗄️ ${target.migrations}: applied ${applied.length}`);
120
+ for (const name of applied) log(` ✓ ${name}`);
121
+ }
122
+ }
123
+ /** One line per construct that has seeds, and each seed it ran. */
124
+ function logSeeds(runs, log = logger.log) {
125
+ for (const { target, seeded } of runs) {
126
+ if (seeded.length === 0) continue;
127
+ log(`🌱 ${target.seeds}: ran ${seeded.length}`);
128
+ for (const name of seeded) log(` ✓ ${name}`);
129
+ }
130
+ }
131
+ /**
132
+ * What `gkm dev` prints: one line per construct whose folder is ahead of its
133
+ * history, and nothing when every folder is applied.
134
+ *
135
+ * Reported, never applied. A migration being written would otherwise run the
136
+ * moment its file is saved, half-finished, against the database the developer
137
+ * is working in.
138
+ */
139
+ async function reportPendingMigrations(workspace, env) {
140
+ const sources = {};
141
+ const manifest = await require_discover.discover({
142
+ patterns: require_seeds.constructGlobs(workspace),
143
+ cwd: workspace.root,
144
+ sources
145
+ });
146
+ const pending = await require_databases.pendingMigrations({
147
+ root: workspace.root,
148
+ manifest,
149
+ sources,
150
+ env
151
+ });
152
+ for (const { target, pending: names } of pending) logger.log(`⚠️ ${target.migrations}: ${names.length} pending (${names.join(", ")}) — run gkm migrate`);
153
+ }
154
+ /**
155
+ * What `gkm dev --migrate` and `gkm dev --seed` do before the apps start:
156
+ * migrate, and with `seed`, run the seeds after — once, at startup, never on a
157
+ * save, for the reason {@link reportPendingMigrations} gives.
158
+ *
159
+ * A failure here is thrown, unlike the report's: the developer asked for the
160
+ * database to be brought up to date, and apps started against one in an
161
+ * unknown state would fail somewhere less obvious.
162
+ */
163
+ async function prepareDevDatabases(workspace, env, { seed = false } = {}) {
164
+ const sources = {};
165
+ const manifest = await require_discover.discover({
166
+ patterns: require_seeds.constructGlobs(workspace),
167
+ cwd: workspace.root,
168
+ sources
169
+ });
170
+ const options = {
171
+ root: workspace.root,
172
+ manifest,
173
+ sources,
174
+ env
175
+ };
176
+ if (!seed) {
177
+ logMigrations(await require_databases.migrateDatabases(options));
178
+ return;
179
+ }
180
+ const { migrations, seeds } = await require_databases.migrateAndSeed({
181
+ ...options,
182
+ stage: workspace.stages.local
183
+ });
184
+ logMigrations(migrations);
185
+ logSeeds(seeds);
186
+ }
187
+ /**
188
+ * `gkm migration <construct> [name]` — write the construct's next migration.
189
+ *
190
+ * For a database, an empty `up`/`down` to fill in. For an auth server, what
191
+ * its schema is missing, computed against its tenant once every committed
192
+ * migration has been applied — so the file is only the change, and is
193
+ * reviewed and committed like any other.
194
+ */
195
+ async function migrationCommand(options) {
196
+ const ready = await readyStage(process.cwd());
197
+ const targets = (0, _geekmidas_manifest.migrationTargets)(ready.manifest);
198
+ const id = (0, _geekmidas_manifest.canonicalId)(options.construct);
199
+ const auth = authConstruct(ready.sources, id);
200
+ if (auth) {
201
+ const target = targets.find((t) => t.id === auth.databaseId);
202
+ if (!target) throw new require_databases.NoSuchMigrationTarget(auth.databaseId, ids(targets));
203
+ return writeAuthMigration(ready, auth, target, options);
204
+ }
205
+ const target = targets.find((t) => t.id === id);
206
+ if (!target) throw new require_databases.NoSuchMigrationTarget(options.construct, [...ids(targets), ...authIds(ready.sources)]);
207
+ if (!options.name) throw new MigrationNeedsName(options.construct);
208
+ const file = await write(ready.workspace.root, target, `${require_index.stamp(options.now)}_${require_index.slug(options.name)}.ts`, STUB);
209
+ logger.log(`📝 ${file}`);
210
+ return file;
211
+ }
212
+ function authConstruct(sources, id) {
213
+ const construct = sources[id]?.construct;
214
+ return construct && typeof construct.pendingMigration === "function" && typeof construct.databaseId === "string" ? construct : void 0;
215
+ }
216
+ function authIds(sources) {
217
+ return Object.keys(sources).filter((id) => authConstruct(sources, id));
218
+ }
219
+ async function writeAuthMigration(ready, auth, target, options) {
220
+ await require_databases.migrateDatabases({
221
+ root: ready.workspace.root,
222
+ manifest: ready.manifest,
223
+ sources: ready.sources,
224
+ env: ready.env,
225
+ only: target.id
226
+ });
227
+ const stage = ready.workspace.stages.local;
228
+ const secrets = await require_seeds.loadSecretsForApp(await require_seeds.secretsStoreFor(ready.workspace, stage), stage);
229
+ const pending = await auth.pendingMigration({
230
+ envParser: new _geekmidas_envkit.EnvironmentParser({
231
+ ...secrets,
232
+ ...ready.env
233
+ }),
234
+ context: _geekmidas_services.serviceContext
235
+ });
236
+ if (!pending) {
237
+ logger.log(`✓ ${target.migrations}: ${auth.id} is up to date`);
238
+ return;
239
+ }
240
+ const file = await write(ready.workspace.root, target, `${require_index.stamp(options.now)}_${require_index.slug(options.name ?? "better_auth")}.sql`, `${pending.trim()}\n`);
241
+ logger.log(`📝 ${file}`);
242
+ return file;
243
+ }
244
+ const STUB = `import type { Kysely } from 'kysely';
245
+
246
+ export async function up(db: Kysely<unknown>): Promise<void> {
247
+ // await db.schema.createTable('…').addColumn(…).execute();
248
+ }
249
+
250
+ export async function down(db: Kysely<unknown>): Promise<void> {
251
+ // await db.schema.dropTable('…').execute();
252
+ }
253
+ `;
254
+ async function write(root, target, file, content) {
255
+ const folder = (0, node_path.join)(root, target.migrations);
256
+ await (0, node_fs_promises.mkdir)(folder, { recursive: true });
257
+ await (0, node_fs_promises.writeFile)((0, node_path.join)(folder, file), content, { flag: "wx" });
258
+ return `${target.migrations}/${file}`;
259
+ }
260
+ function ids(targets) {
261
+ return targets.map((target) => target.id);
262
+ }
263
+ //#endregion
264
+ exports.migrateAndSeed = require_databases.migrateAndSeed;
265
+ exports.migrateCommand = migrateCommand;
266
+ exports.migrationCommand = migrationCommand;
267
+ exports.prepareDevDatabases = prepareDevDatabases;
268
+ exports.reportPendingMigrations = reportPendingMigrations;
269
+ exports.seedCommand = seedCommand;
270
+
271
+ //# sourceMappingURL=migrate-CTqhWtev.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-CTqhWtev.cjs","names":["GkmError","TEST_STAGE","loadWorkspaceConfig","discover","constructGlobs","reconcileWorkspace","migrateDatabases","migrateAndSeed","pendingMigrations","migrationTargets","canonicalId","NoSuchMigrationTarget","stamp","slug","loadSecretsForApp","secretsStoreFor","EnvironmentParser","serviceContext","join","mkdir","writeFile"],"sources":["../src/migrate/index.ts"],"sourcesContent":["/**\n * `gkm migrate`, `gkm seed` and `gkm migration` — applying a construct's\n * migrations, running its seeds, and writing its next migration.\n *\n * Both work on a stage this machine reconciles: its containers up, its roles\n * provisioned, its owner URLs resolved. A deployed stage is migrated by the\n * deploy that ships it, which is the one thing that can reach its database.\n */\n\nimport { mkdir, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { EnvironmentParser } from '@geekmidas/envkit';\nimport {\n\ttype ConstructManifest,\n\tcanonicalId,\n\ttype MigrationTarget,\n\tmigrationTargets,\n} from '@geekmidas/manifest';\nimport {\n\ttype ServiceRegisterOptions,\n\tserviceContext,\n} from '@geekmidas/services';\nimport { loadWorkspaceConfig } from '../config';\nimport { loadSecretsForApp } from '../credentials';\nimport { GkmError } from '../errors';\nimport { type ConstructSource, discover } from '../reconcile/discover';\nimport { constructGlobs, reconcileWorkspace } from '../reconcile/workspace.js';\nimport { secretsStoreFor } from '../secrets/store.js';\nimport { TEST_STAGE } from '../workspace/stages';\nimport type { NormalizedWorkspace } from '../workspace/types.js';\nimport {\n\ttype MigrationRun,\n\tmigrateAndSeed,\n\tmigrateDatabases,\n\tNoSuchMigrationTarget,\n\tpendingMigrations,\n\ttype SeedRun,\n} from './databases';\nimport { slug, stamp } from './names';\n\nexport {\n\tKyselyNotFound,\n\tMigrationFailed,\n\ttype MigrationRun,\n\tMigrationsOutsideFolder,\n\tmigrateAndSeed,\n\tmigrateDatabases,\n\tNoOwnerCredential,\n\tNoSuchMigrationTarget,\n\ttype PendingMigrations,\n\tpendingMigrations,\n\tSeedFailed,\n\ttype SeedOptions,\n\ttype SeedRun,\n\tseedDatabases,\n\tUnknownDatabaseFolder,\n\tUnknownMigrationFolder,\n} from './databases';\nexport { slug, stamp } from './names';\nexport {\n\tDuplicateMigration,\n\tMigrationHasNoUp,\n\tSeedHasNoSeed,\n} from './provider';\n\nconst logger = console;\n\n/** `gkm migrate --stage` named a stage only a deploy can reach. */\nexport class MigrateDeployedStage extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly local: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' is a deployed stage, and its database is migrated by ` +\n\t\t\t\t`\\`gkm deploy --stage ${stage}\\`, which is what can reach it. ` +\n\t\t\t\t`\\`gkm migrate\\` runs against '${local}' or '${TEST_STAGE}'.`,\n\t\t);\n\t\tthis.name = 'MigrateDeployedStage';\n\t}\n}\n\n/** `gkm migration` for a Kysely database, with no name for the file. */\nexport class MigrationNeedsName extends GkmError {\n\tconstructor(readonly construct: string) {\n\t\tsuper(\n\t\t\t`Name the migration: \\`gkm migration ${construct} add_workouts\\`. ` +\n\t\t\t\t`The name is what the file — and the history — calls it.`,\n\t\t);\n\t\tthis.name = 'MigrationNeedsName';\n\t}\n}\n\nexport interface MigrateOptions {\n\t/** The stage to migrate: the project's local one, or `test`. */\n\tstage?: string;\n\t/** One construct, by name. All of them when absent. */\n\tconstruct?: string;\n}\n\n/** A workspace's stage, reconciled and ready to migrate. */\nexport interface ReadyStage {\n\tworkspace: NormalizedWorkspace;\n\tmanifest: ConstructManifest;\n\tsources: Record<string, ConstructSource>;\n\t/** Every URL the stage resolved — the owner URLs among them. */\n\tenv: Record<string, string>;\n\t/** The stage it is: the local one, or `test`. */\n\tstage: string;\n}\n\n/**\n * Reconcile a stage so it can be migrated: containers up, databases, schemas,\n * roles and grants in place, owner URLs resolved.\n *\n * Migrating assumes the roles exist, and this is what makes that true rather\n * than something a developer has to have run first.\n */\nexport async function readyStage(\n\tcwd: string,\n\tstage?: string,\n): Promise<ReadyStage> {\n\tconst { workspace } = await loadWorkspaceConfig(cwd);\n\tconst local = workspace.stages.local;\n\tconst target = stage ?? local;\n\tif (target !== local && target !== TEST_STAGE) {\n\t\tthrow new MigrateDeployedStage(target, local);\n\t}\n\n\tconst sources: Record<string, ConstructSource> = {};\n\tconst manifest = await discover({\n\t\tpatterns: constructGlobs(workspace),\n\t\tcwd: workspace.root,\n\t\tsources,\n\t});\n\n\tconst reconciled = await reconcileWorkspace(workspace, {\n\t\tstage: target,\n\t\tmanifest,\n\t\tstart: true,\n\t});\n\n\treturn {\n\t\tworkspace,\n\t\tmanifest,\n\t\tsources,\n\t\tenv: { ...reconciled.env },\n\t\tstage: target,\n\t};\n}\n\n/** `gkm migrate [construct]`. */\nexport async function migrateCommand(\n\toptions: MigrateOptions = {},\n): Promise<void> {\n\tconst ready = await readyStage(process.cwd(), options.stage);\n\n\tconst runs = await migrateDatabases({\n\t\troot: ready.workspace.root,\n\t\tmanifest: ready.manifest,\n\t\tsources: ready.sources,\n\t\tenv: ready.env,\n\t\t...(options.construct ? { only: options.construct } : {}),\n\t});\n\n\tif (runs.length === 0) {\n\t\tlogger.log('🗄️ No database constructs to migrate.');\n\t\treturn;\n\t}\n\n\tlogMigrations(runs);\n}\n\n/**\n * `gkm seed [construct]` — migrate, then run the seeds.\n *\n * Always migrates first: a seed is written against the schema its migrations\n * build, and against an older one it fails on a table that is not there yet.\n */\nexport async function seedCommand(options: MigrateOptions = {}): Promise<void> {\n\tconst ready = await readyStage(process.cwd(), options.stage);\n\n\tconst { migrations, seeds } = await migrateAndSeed({\n\t\troot: ready.workspace.root,\n\t\tmanifest: ready.manifest,\n\t\tsources: ready.sources,\n\t\tenv: ready.env,\n\t\tstage: ready.stage,\n\t\t...(options.construct ? { only: options.construct } : {}),\n\t});\n\n\tif (migrations.length === 0) {\n\t\tlogger.log('🗄️ No database constructs to seed.');\n\t\treturn;\n\t}\n\n\tlogMigrations(migrations);\n\tlogSeeds(seeds);\n}\n\n/** One line per construct: up to date, or what was applied. */\nexport function logMigrations(\n\truns: readonly MigrationRun[],\n\tlog: (line: string) => void = logger.log,\n): void {\n\tfor (const { target, applied } of runs) {\n\t\tif (applied.length === 0) {\n\t\t\tlog(`🗄️ ${target.migrations}: up to date`);\n\t\t\tcontinue;\n\t\t}\n\t\tlog(`🗄️ ${target.migrations}: applied ${applied.length}`);\n\t\tfor (const name of applied) log(` ✓ ${name}`);\n\t}\n}\n\n/** One line per construct that has seeds, and each seed it ran. */\nexport function logSeeds(\n\truns: readonly SeedRun[],\n\tlog: (line: string) => void = logger.log,\n): void {\n\tfor (const { target, seeded } of runs) {\n\t\tif (seeded.length === 0) continue;\n\t\tlog(`🌱 ${target.seeds}: ran ${seeded.length}`);\n\t\tfor (const name of seeded) log(` ✓ ${name}`);\n\t}\n}\n\n/**\n * What `gkm dev` prints: one line per construct whose folder is ahead of its\n * history, and nothing when every folder is applied.\n *\n * Reported, never applied. A migration being written would otherwise run the\n * moment its file is saved, half-finished, against the database the developer\n * is working in.\n */\nexport async function reportPendingMigrations(\n\tworkspace: NormalizedWorkspace,\n\tenv: Readonly<Record<string, string>>,\n): Promise<void> {\n\tconst sources: Record<string, ConstructSource> = {};\n\tconst manifest = await discover({\n\t\tpatterns: constructGlobs(workspace),\n\t\tcwd: workspace.root,\n\t\tsources,\n\t});\n\n\tconst pending = await pendingMigrations({\n\t\troot: workspace.root,\n\t\tmanifest,\n\t\tsources,\n\t\tenv,\n\t});\n\n\tfor (const { target, pending: names } of pending) {\n\t\tlogger.log(\n\t\t\t`⚠️ ${target.migrations}: ${names.length} pending (${names.join(', ')}) — run gkm migrate`,\n\t\t);\n\t}\n}\n\n/**\n * What `gkm dev --migrate` and `gkm dev --seed` do before the apps start:\n * migrate, and with `seed`, run the seeds after — once, at startup, never on a\n * save, for the reason {@link reportPendingMigrations} gives.\n *\n * A failure here is thrown, unlike the report's: the developer asked for the\n * database to be brought up to date, and apps started against one in an\n * unknown state would fail somewhere less obvious.\n */\nexport async function prepareDevDatabases(\n\tworkspace: NormalizedWorkspace,\n\tenv: Readonly<Record<string, string>>,\n\t{ seed = false }: { seed?: boolean } = {},\n): Promise<void> {\n\tconst sources: Record<string, ConstructSource> = {};\n\tconst manifest = await discover({\n\t\tpatterns: constructGlobs(workspace),\n\t\tcwd: workspace.root,\n\t\tsources,\n\t});\n\tconst options = { root: workspace.root, manifest, sources, env };\n\n\tif (!seed) {\n\t\tlogMigrations(await migrateDatabases(options));\n\t\treturn;\n\t}\n\n\tconst { migrations, seeds } = await migrateAndSeed({\n\t\t...options,\n\t\tstage: workspace.stages.local,\n\t});\n\tlogMigrations(migrations);\n\tlogSeeds(seeds);\n}\n\nexport interface MigrationOptions {\n\t/** The construct the migration is for, by name. */\n\tconstruct: string;\n\t/** What the file is called, after its timestamp. */\n\tname?: string;\n\t/** The file's timestamp; the current time when absent. */\n\tnow?: Date;\n}\n\n/**\n * `gkm migration <construct> [name]` — write the construct's next migration.\n *\n * For a database, an empty `up`/`down` to fill in. For an auth server, what\n * its schema is missing, computed against its tenant once every committed\n * migration has been applied — so the file is only the change, and is\n * reviewed and committed like any other.\n */\nexport async function migrationCommand(\n\toptions: MigrationOptions,\n): Promise<string | undefined> {\n\tconst ready = await readyStage(process.cwd());\n\tconst targets = migrationTargets(ready.manifest);\n\tconst id = canonicalId(options.construct);\n\n\tconst auth = authConstruct(ready.sources, id);\n\tif (auth) {\n\t\tconst target = targets.find((t) => t.id === auth.databaseId);\n\t\tif (!target) {\n\t\t\tthrow new NoSuchMigrationTarget(auth.databaseId, ids(targets));\n\t\t}\n\t\treturn writeAuthMigration(ready, auth, target, options);\n\t}\n\n\tconst target = targets.find((t) => t.id === id);\n\tif (!target) {\n\t\tthrow new NoSuchMigrationTarget(options.construct, [\n\t\t\t...ids(targets),\n\t\t\t...authIds(ready.sources),\n\t\t]);\n\t}\n\tif (!options.name) throw new MigrationNeedsName(options.construct);\n\n\tconst file = await write(\n\t\tready.workspace.root,\n\t\ttarget,\n\t\t`${stamp(options.now)}_${slug(options.name)}.ts`,\n\t\tSTUB,\n\t);\n\tlogger.log(`📝 ${file}`);\n\treturn file;\n}\n\n/** What an auth construct offers `gkm migration`, duck-typed across copies. */\ninterface AuthConstruct {\n\tid: string;\n\tdatabaseId: string;\n\tpendingMigration(\n\t\toptions: ServiceRegisterOptions,\n\t): Promise<string | undefined>;\n}\n\nfunction authConstruct(\n\tsources: Readonly<Record<string, ConstructSource>>,\n\tid: string,\n): AuthConstruct | undefined {\n\tconst construct = sources[id]?.construct as\n\t\t| Partial<AuthConstruct>\n\t\t| undefined;\n\treturn construct &&\n\t\ttypeof construct.pendingMigration === 'function' &&\n\t\ttypeof construct.databaseId === 'string'\n\t\t? (construct as AuthConstruct)\n\t\t: undefined;\n}\n\nfunction authIds(sources: Readonly<Record<string, ConstructSource>>): string[] {\n\treturn Object.keys(sources).filter((id) => authConstruct(sources, id));\n}\n\nasync function writeAuthMigration(\n\tready: ReadyStage,\n\tauth: AuthConstruct,\n\ttarget: MigrationTarget,\n\toptions: MigrationOptions,\n): Promise<string | undefined> {\n\t// Against a tenant already at its committed migrations, so the comparison\n\t// finds only what the files do not yet say.\n\tawait migrateDatabases({\n\t\troot: ready.workspace.root,\n\t\tmanifest: ready.manifest,\n\t\tsources: ready.sources,\n\t\tenv: ready.env,\n\t\tonly: target.id,\n\t});\n\n\t// Its secret and URL come from the stage's secrets; the tenant's owner URL\n\t// from the reconcile above, which wins.\n\tconst stage = ready.workspace.stages.local;\n\tconst secrets = await loadSecretsForApp(\n\t\tawait secretsStoreFor(ready.workspace, stage),\n\t\tstage,\n\t);\n\tconst pending = await auth.pendingMigration({\n\t\tenvParser: new EnvironmentParser({ ...secrets, ...ready.env }),\n\t\tcontext: serviceContext,\n\t});\n\n\tif (!pending) {\n\t\tlogger.log(`✓ ${target.migrations}: ${auth.id} is up to date`);\n\t\treturn undefined;\n\t}\n\n\tconst file = await write(\n\t\tready.workspace.root,\n\t\ttarget,\n\t\t`${stamp(options.now)}_${slug(options.name ?? 'better_auth')}.sql`,\n\t\t`${pending.trim()}\\n`,\n\t);\n\tlogger.log(`📝 ${file}`);\n\treturn file;\n}\n\nconst STUB = `import type { Kysely } from 'kysely';\n\nexport async function up(db: Kysely<unknown>): Promise<void> {\n // await db.schema.createTable('…').addColumn(…).execute();\n}\n\nexport async function down(db: Kysely<unknown>): Promise<void> {\n // await db.schema.dropTable('…').execute();\n}\n`;\n\nasync function write(\n\troot: string,\n\ttarget: MigrationTarget,\n\tfile: string,\n\tcontent: string,\n): Promise<string> {\n\tconst folder = join(root, target.migrations);\n\tawait mkdir(folder, { recursive: true });\n\tawait writeFile(join(folder, file), content, { flag: 'wx' });\n\treturn `${target.migrations}/${file}`;\n}\n\nfunction ids(targets: readonly MigrationTarget[]): string[] {\n\treturn targets.map((target) => target.id);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiEA,MAAM,SAAS;;AAGf,IAAa,uBAAb,cAA0CA,eAAAA,SAAS;CAExC;CACA;CAFV,YACC,OACA,OACC;EACD,MACC,IAAI,MAAM,8EACe,MAAM,gEACG,MAAM,QAAQC,kBAAAA,WAAW,GAC5D;EAPS,KAAA,QAAA;EACA,KAAA,QAAA;EAOT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,qBAAb,cAAwCD,eAAAA,SAAS;CAC3B;CAArB,YAAY,WAA4B;EACvC,MACC,uCAAuC,UAAU,yEAElD;EAJoB,KAAA,YAAA;EAKpB,KAAK,OAAO;CACb;AAC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