@geekmidas/cli 10.0.0-alpha.12 → 10.0.0-alpha.121

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 (517) hide show
  1. package/README.md +310 -377
  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-BDa6pPgE.cjs +1090 -0
  7. package/dist/EndpointGenerator-BDa6pPgE.cjs.map +1 -0
  8. package/dist/EndpointGenerator-CP_z_E3e.mjs +1031 -0
  9. package/dist/EndpointGenerator-CP_z_E3e.mjs.map +1 -0
  10. package/dist/GoDaddyProvider-3C8U_tVu.cjs +388 -0
  11. package/dist/GoDaddyProvider-3C8U_tVu.cjs.map +1 -0
  12. package/dist/GoDaddyProvider-D0MQoOM4.mjs +388 -0
  13. package/dist/GoDaddyProvider-D0MQoOM4.mjs.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-CRi7TosX.mjs +124 -0
  19. package/dist/LegacyStateStore-CRi7TosX.mjs.map +1 -0
  20. package/dist/LegacyStateStore-DHsoQGOo.cjs +124 -0
  21. package/dist/LegacyStateStore-DHsoQGOo.cjs.map +1 -0
  22. package/dist/LocalStateStore-BQXTkeoS.cjs +178 -0
  23. package/dist/LocalStateStore-BQXTkeoS.cjs.map +1 -0
  24. package/dist/LocalStateStore-Dkth0jXX.mjs +167 -0
  25. package/dist/LocalStateStore-Dkth0jXX.mjs.map +1 -0
  26. package/dist/OpenApiTsGenerator-CsrukCE-.mjs +536 -0
  27. package/dist/OpenApiTsGenerator-CsrukCE-.mjs.map +1 -0
  28. package/dist/OpenApiTsGenerator-FNhY7Ssz.cjs +541 -0
  29. package/dist/OpenApiTsGenerator-FNhY7Ssz.cjs.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-DGKZgyKz.cjs +222 -0
  35. package/dist/S3StateStore-DGKZgyKz.cjs.map +1 -0
  36. package/dist/S3StateStore-pZZnLLBd.mjs +223 -0
  37. package/dist/S3StateStore-pZZnLLBd.mjs.map +1 -0
  38. package/dist/SSMStateStore-CZRMERDA.mjs +205 -0
  39. package/dist/SSMStateStore-CZRMERDA.mjs.map +1 -0
  40. package/dist/SSMStateStore-DzkyjQ5D.cjs +204 -0
  41. package/dist/SSMStateStore-DzkyjQ5D.cjs.map +1 -0
  42. package/dist/SubscriberGenerator-C8CPxrCK.cjs +592 -0
  43. package/dist/SubscriberGenerator-C8CPxrCK.cjs.map +1 -0
  44. package/dist/SubscriberGenerator-y3pncae_.mjs +533 -0
  45. package/dist/SubscriberGenerator-y3pncae_.mjs.map +1 -0
  46. package/dist/add-C0kXOsWS.mjs +717 -0
  47. package/dist/add-C0kXOsWS.mjs.map +1 -0
  48. package/dist/add-Df8cmz0H.cjs +719 -0
  49. package/dist/add-Df8cmz0H.cjs.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-Bux2iF-v.mjs → bundler-B-I4Du99.mjs} +35 -16
  75. package/dist/bundler-B-I4Du99.mjs.map +1 -0
  76. package/dist/{bundler-BMekgx7a.cjs → bundler-Dx_grUmc.cjs} +37 -19
  77. package/dist/bundler-Dx_grUmc.cjs.map +1 -0
  78. package/dist/cli-Cd9exatJ.cjs +71 -0
  79. package/dist/cli-Cd9exatJ.cjs.map +1 -0
  80. package/dist/cli-DL7GxGAe.mjs +71 -0
  81. package/dist/cli-DL7GxGAe.mjs.map +1 -0
  82. package/dist/compose-C43c03WZ.mjs +3284 -0
  83. package/dist/compose-C43c03WZ.mjs.map +1 -0
  84. package/dist/compose-Mdgea4Yt.cjs +3427 -0
  85. package/dist/compose-Mdgea4Yt.cjs.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-B67WJOOm.cjs +272 -0
  97. package/dist/credentialSchemas-B67WJOOm.cjs.map +1 -0
  98. package/dist/credentialSchemas-DDOLRCLF.mjs +237 -0
  99. package/dist/credentialSchemas-DDOLRCLF.mjs.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-BPOgTn1u.mjs +522 -0
  105. package/dist/databases-BPOgTn1u.mjs.map +1 -0
  106. package/dist/databases-fOaoBInm.cjs +625 -0
  107. package/dist/databases-fOaoBInm.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 +654 -0
  115. package/dist/deploy/public.d.cts.map +1 -0
  116. package/dist/deploy/public.d.mts +654 -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-BMM2hx-K.cjs +2401 -0
  163. package/dist/deploy-BMM2hx-K.cjs.map +1 -0
  164. package/dist/deploy-D5YhwDng.mjs +2328 -0
  165. package/dist/deploy-D5YhwDng.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-C5roJuc9.mjs +560 -0
  171. package/dist/discover-C5roJuc9.mjs.map +1 -0
  172. package/dist/discover-CSW_BMWa.d.cts +125 -0
  173. package/dist/discover-CSW_BMWa.d.cts.map +1 -0
  174. package/dist/discover-DozUKs8f.cjs +639 -0
  175. package/dist/discover-DozUKs8f.cjs.map +1 -0
  176. package/dist/discover-xtT7fgWg.d.mts +125 -0
  177. package/dist/discover-xtT7fgWg.d.mts.map +1 -0
  178. package/dist/dns-BIYf20p7.cjs +1057 -0
  179. package/dist/dns-BIYf20p7.cjs.map +1 -0
  180. package/dist/dns-agf2VCdV.mjs +926 -0
  181. package/dist/dns-agf2VCdV.mjs.map +1 -0
  182. package/dist/dokploy-2p4PK6ej.mjs +38 -0
  183. package/dist/dokploy-2p4PK6ej.mjs.map +1 -0
  184. package/dist/dokploy-BANMTroy.cjs +38 -0
  185. package/dist/dokploy-BANMTroy.cjs.map +1 -0
  186. package/dist/drivers-BjGDYfnC.mjs +195 -0
  187. package/dist/drivers-BjGDYfnC.mjs.map +1 -0
  188. package/dist/drivers-DbjiYpW6.cjs +224 -0
  189. package/dist/drivers-DbjiYpW6.cjs.map +1 -0
  190. package/dist/eas-CNi16SoO.cjs +337 -0
  191. package/dist/eas-CNi16SoO.cjs.map +1 -0
  192. package/dist/eas-iT2JDHCh.mjs +334 -0
  193. package/dist/eas-iT2JDHCh.mjs.map +1 -0
  194. package/dist/{emit-CIlvnDvV.mjs → emit-C1e8qD08.mjs} +13 -26
  195. package/dist/emit-C1e8qD08.mjs.map +1 -0
  196. package/dist/{emit-CUD1BWls.cjs → emit-Dmc1nvdS.cjs} +31 -57
  197. package/dist/emit-Dmc1nvdS.cjs.map +1 -0
  198. package/dist/encryption-DkXVbyZc.mjs +89 -0
  199. package/dist/encryption-DkXVbyZc.mjs.map +1 -0
  200. package/dist/encryption-d2lLtkYx.cjs +90 -0
  201. package/dist/encryption-d2lLtkYx.cjs.map +1 -0
  202. package/dist/engine-CatKW6E-.mjs +3089 -0
  203. package/dist/engine-CatKW6E-.mjs.map +1 -0
  204. package/dist/engine-DlEHexED.cjs +3202 -0
  205. package/dist/engine-DlEHexED.cjs.map +1 -0
  206. package/dist/errors-D8Gwp5kU.mjs +23 -0
  207. package/dist/errors-D8Gwp5kU.mjs.map +1 -0
  208. package/dist/errors-DMC4Umsb.cjs +34 -0
  209. package/dist/errors-DMC4Umsb.cjs.map +1 -0
  210. package/dist/github-BAeaC1Pl.cjs +833 -0
  211. package/dist/github-BAeaC1Pl.cjs.map +1 -0
  212. package/dist/github-DErsqKGN.mjs +832 -0
  213. package/dist/github-DErsqKGN.mjs.map +1 -0
  214. package/dist/googlePlay-BVcfFWRO.cjs +931 -0
  215. package/dist/googlePlay-BVcfFWRO.cjs.map +1 -0
  216. package/dist/googlePlay-BXJ5ZjMK.mjs +931 -0
  217. package/dist/googlePlay-BXJ5ZjMK.mjs.map +1 -0
  218. package/dist/identity-CBXr4wNi.mjs +129 -0
  219. package/dist/identity-CBXr4wNi.mjs.map +1 -0
  220. package/dist/identity-CbLfgQNT.cjs +182 -0
  221. package/dist/identity-CbLfgQNT.cjs.map +1 -0
  222. package/dist/{index-BzJ7QJ9c.d.mts → index-8OfpOtSI.d.cts} +39 -20
  223. package/dist/index-8OfpOtSI.d.cts.map +1 -0
  224. package/dist/{index-CfMjtdVC.d.cts → index-Dpji6Bxq.d.mts} +39 -20
  225. package/dist/index-Dpji6Bxq.d.mts.map +1 -0
  226. package/dist/index.cjs +14291 -11898
  227. package/dist/index.cjs.map +1 -1
  228. package/dist/index.d.cts +1 -1
  229. package/dist/index.d.mts +1 -1
  230. package/dist/index.mjs +13938 -11560
  231. package/dist/index.mjs.map +1 -1
  232. package/dist/local-BwC2v2Y8.mjs +224 -0
  233. package/dist/local-BwC2v2Y8.mjs.map +1 -0
  234. package/dist/local-DNhnkugT.cjs +241 -0
  235. package/dist/local-DNhnkugT.cjs.map +1 -0
  236. package/dist/migrate-Bb1MmGHl.mjs +181 -0
  237. package/dist/migrate-Bb1MmGHl.mjs.map +1 -0
  238. package/dist/migrate-D79GI0XM.cjs +271 -0
  239. package/dist/migrate-D79GI0XM.cjs.map +1 -0
  240. package/dist/migrate-L4a273dY.cjs +181 -0
  241. package/dist/migrate-L4a273dY.cjs.map +1 -0
  242. package/dist/migrate-s4QizIoM.mjs +266 -0
  243. package/dist/migrate-s4QizIoM.mjs.map +1 -0
  244. package/dist/openapi.cjs +214 -10
  245. package/dist/openapi.cjs.map +1 -0
  246. package/dist/openapi.d.cts +38 -17
  247. package/dist/openapi.d.cts.map +1 -1
  248. package/dist/openapi.d.mts +38 -17
  249. package/dist/openapi.d.mts.map +1 -1
  250. package/dist/openapi.mjs +208 -5
  251. package/dist/openapi.mjs.map +1 -0
  252. package/dist/projectBucket-BBbQ1lHF.cjs +263 -0
  253. package/dist/projectBucket-BBbQ1lHF.cjs.map +1 -0
  254. package/dist/projectBucket-C_DN4WzF.mjs +222 -0
  255. package/dist/projectBucket-C_DN4WzF.mjs.map +1 -0
  256. package/dist/provider-BqpjG9QM.cjs +57 -0
  257. package/dist/provider-BqpjG9QM.cjs.map +1 -0
  258. package/dist/provider-CEOKk8NS.mjs +46 -0
  259. package/dist/provider-CEOKk8NS.mjs.map +1 -0
  260. package/dist/publish-CcTlmJT6.mjs +123 -0
  261. package/dist/publish-CcTlmJT6.mjs.map +1 -0
  262. package/dist/publish-ydscCYsW.cjs +124 -0
  263. package/dist/publish-ydscCYsW.cjs.map +1 -0
  264. package/dist/ready-BFFP838V.cjs +404 -0
  265. package/dist/ready-BFFP838V.cjs.map +1 -0
  266. package/dist/ready-BOfogqzr.mjs +375 -0
  267. package/dist/ready-BOfogqzr.mjs.map +1 -0
  268. package/dist/reconcile/public.cjs +3 -5
  269. package/dist/reconcile/public.d.cts +11 -87
  270. package/dist/reconcile/public.d.cts.map +1 -1
  271. package/dist/reconcile/public.d.mts +11 -87
  272. package/dist/reconcile/public.d.mts.map +1 -1
  273. package/dist/reconcile/public.mjs +3 -4
  274. package/dist/{reconcile-BI0tWkwz.mjs → reconcile--I7V4Klj.mjs} +4 -7
  275. package/dist/reconcile--I7V4Klj.mjs.map +1 -0
  276. package/dist/{reconcile-Bhw5fmKu.cjs → reconcile-CuCQBa5-.cjs} +5 -8
  277. package/dist/reconcile-CuCQBa5-.cjs.map +1 -0
  278. package/dist/resolve-BLp2trep.mjs +263 -0
  279. package/dist/resolve-BLp2trep.mjs.map +1 -0
  280. package/dist/resolve-BgL-brF9.cjs +316 -0
  281. package/dist/resolve-BgL-brF9.cjs.map +1 -0
  282. package/dist/rollback-2cyLXEH1.cjs +165 -0
  283. package/dist/rollback-2cyLXEH1.cjs.map +1 -0
  284. package/dist/rollback-DwqZ8zzj.mjs +136 -0
  285. package/dist/rollback-DwqZ8zzj.mjs.map +1 -0
  286. package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
  287. package/dist/{chunk-CUT6urMc.cjs → rolldown-runtime-C0BPl7ul.cjs} +23 -10
  288. package/dist/run-BJLIerMM.mjs +133 -0
  289. package/dist/run-BJLIerMM.mjs.map +1 -0
  290. package/dist/run-fVZ-rLnc.cjs +174 -0
  291. package/dist/run-fVZ-rLnc.cjs.map +1 -0
  292. package/dist/runtime-ACdfK59n.d.cts +82 -0
  293. package/dist/runtime-ACdfK59n.d.cts.map +1 -0
  294. package/dist/runtime-YyQuekxi.d.mts +82 -0
  295. package/dist/runtime-YyQuekxi.d.mts.map +1 -0
  296. package/dist/s3-CrPoA89T.cjs +215 -0
  297. package/dist/s3-CrPoA89T.cjs.map +1 -0
  298. package/dist/s3-DQXZdmCM.mjs +215 -0
  299. package/dist/s3-DQXZdmCM.mjs.map +1 -0
  300. package/dist/sandbox/config-worker.cjs +43 -0
  301. package/dist/sandbox/config-worker.cjs.map +1 -0
  302. package/dist/sandbox/config-worker.d.cts +1 -0
  303. package/dist/sandbox/config-worker.d.mts +1 -0
  304. package/dist/sandbox/config-worker.mjs +44 -0
  305. package/dist/sandbox/config-worker.mjs.map +1 -0
  306. package/dist/sandbox/credentials-worker.cjs +54 -0
  307. package/dist/sandbox/credentials-worker.cjs.map +1 -0
  308. package/dist/sandbox/credentials-worker.d.cts +1 -0
  309. package/dist/sandbox/credentials-worker.d.mts +1 -0
  310. package/dist/sandbox/credentials-worker.mjs +55 -0
  311. package/dist/sandbox/credentials-worker.mjs.map +1 -0
  312. package/dist/sandbox/discover-worker.cjs +50 -0
  313. package/dist/sandbox/discover-worker.cjs.map +1 -0
  314. package/dist/sandbox/discover-worker.d.cts +1 -0
  315. package/dist/sandbox/discover-worker.d.mts +1 -0
  316. package/dist/sandbox/discover-worker.mjs +51 -0
  317. package/dist/sandbox/discover-worker.mjs.map +1 -0
  318. package/dist/sandbox/migrate-worker.cjs +75 -0
  319. package/dist/sandbox/migrate-worker.cjs.map +1 -0
  320. package/dist/sandbox/migrate-worker.d.cts +1 -0
  321. package/dist/sandbox/migrate-worker.d.mts +1 -0
  322. package/dist/sandbox/migrate-worker.mjs +76 -0
  323. package/dist/sandbox/migrate-worker.mjs.map +1 -0
  324. package/dist/sandbox-C4g1eG31.d.mts +104 -0
  325. package/dist/sandbox-C4g1eG31.d.mts.map +1 -0
  326. package/dist/sandbox-CHv3OYXg.cjs +165 -0
  327. package/dist/sandbox-CHv3OYXg.cjs.map +1 -0
  328. package/dist/sandbox-CbVB7uOD.mjs +118 -0
  329. package/dist/sandbox-CbVB7uOD.mjs.map +1 -0
  330. package/dist/sandbox-CdKgQ3XU.d.cts +104 -0
  331. package/dist/sandbox-CdKgQ3XU.d.cts.map +1 -0
  332. package/dist/{workspace-DPV7FtAv.cjs → schemas-BCwKKA42.mjs} +958 -1816
  333. package/dist/schemas-BCwKKA42.mjs.map +1 -0
  334. package/dist/{workspace-CtnZnWsa.mjs → schemas-BQ_v0lEX.cjs} +1048 -1626
  335. package/dist/schemas-BQ_v0lEX.cjs.map +1 -0
  336. package/dist/secretsManager-CQORubp9.mjs +97 -0
  337. package/dist/secretsManager-CQORubp9.mjs.map +1 -0
  338. package/dist/secretsManager-RAGcEDX1.cjs +108 -0
  339. package/dist/secretsManager-RAGcEDX1.cjs.map +1 -0
  340. package/dist/seeds-C2w4UqVP.cjs +9347 -0
  341. package/dist/seeds-C2w4UqVP.cjs.map +1 -0
  342. package/dist/seeds-Cwtv-U9-.mjs +8350 -0
  343. package/dist/seeds-Cwtv-U9-.mjs.map +1 -0
  344. package/dist/serverSetup-BdFOD93s.cjs +631 -0
  345. package/dist/serverSetup-BdFOD93s.cjs.map +1 -0
  346. package/dist/serverSetup-utKsoyGH.mjs +631 -0
  347. package/dist/serverSetup-utKsoyGH.mjs.map +1 -0
  348. package/dist/sniffer-8C4q6Szd.mjs +1825 -0
  349. package/dist/sniffer-8C4q6Szd.mjs.map +1 -0
  350. package/dist/sniffer-CF7wNxMo.cjs +1998 -0
  351. package/dist/sniffer-CF7wNxMo.cjs.map +1 -0
  352. package/dist/sst-B-Uz4cvm.cjs +464 -0
  353. package/dist/sst-B-Uz4cvm.cjs.map +1 -0
  354. package/dist/sst-C1pxbFEd.mjs +441 -0
  355. package/dist/sst-C1pxbFEd.mjs.map +1 -0
  356. package/dist/stage-BvM_u2z4.mjs +302 -0
  357. package/dist/stage-BvM_u2z4.mjs.map +1 -0
  358. package/dist/stage-DEQJGW3r.cjs +313 -0
  359. package/dist/stage-DEQJGW3r.cjs.map +1 -0
  360. package/dist/stages-Cb9rqRbN.mjs +190 -0
  361. package/dist/stages-Cb9rqRbN.mjs.map +1 -0
  362. package/dist/stages-D4SnG5yl.cjs +190 -0
  363. package/dist/stages-D4SnG5yl.cjs.map +1 -0
  364. package/dist/target/public.cjs +15 -0
  365. package/dist/target/public.d.cts +28 -0
  366. package/dist/target/public.d.cts.map +1 -0
  367. package/dist/target/public.d.mts +28 -0
  368. package/dist/target/public.d.mts.map +1 -0
  369. package/dist/target/public.mjs +4 -0
  370. package/dist/terminal-CW_dWeTe.mjs +85 -0
  371. package/dist/terminal-CW_dWeTe.mjs.map +1 -0
  372. package/dist/terminal-DJlqcW_U.cjs +85 -0
  373. package/dist/terminal-DJlqcW_U.cjs.map +1 -0
  374. package/dist/types-B6UXlEkf.d.cts +7650 -0
  375. package/dist/types-B6UXlEkf.d.cts.map +1 -0
  376. package/dist/types-HqVPddRK.d.mts +7649 -0
  377. package/dist/types-HqVPddRK.d.mts.map +1 -0
  378. package/dist/utils-D2Nk1Nv2.cjs +205 -0
  379. package/dist/utils-D2Nk1Nv2.cjs.map +1 -0
  380. package/dist/utils-D_fxUqvU.mjs +156 -0
  381. package/dist/utils-D_fxUqvU.mjs.map +1 -0
  382. package/dist/vitest.cjs +65 -0
  383. package/dist/vitest.cjs.map +1 -0
  384. package/dist/vitest.d.cts +29 -0
  385. package/dist/vitest.d.cts.map +1 -0
  386. package/dist/vitest.d.mts +29 -0
  387. package/dist/vitest.d.mts.map +1 -0
  388. package/dist/vitest.mjs +65 -0
  389. package/dist/vitest.mjs.map +1 -0
  390. package/dist/workerRuntime-BXfhbe13.cjs +108 -0
  391. package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
  392. package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
  393. package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
  394. package/dist/workspace/index.cjs +8 -4
  395. package/dist/workspace/index.d.cts +3 -3
  396. package/dist/workspace/index.d.mts +3 -3
  397. package/dist/workspace/index.mjs +2 -3
  398. package/dist/workspace-BwqQnool.cjs +2806 -0
  399. package/dist/workspace-BwqQnool.cjs.map +1 -0
  400. package/dist/workspace-D1QbNd55.mjs +2394 -0
  401. package/dist/workspace-D1QbNd55.mjs.map +1 -0
  402. package/package.json +54 -22
  403. package/dist/CachedStateProvider-BEBl2wQT.cjs +0 -60
  404. package/dist/CachedStateProvider-BEBl2wQT.cjs.map +0 -1
  405. package/dist/CachedStateProvider-C-8wtlto.mjs +0 -3
  406. package/dist/CachedStateProvider-Co4n5Wvs.mjs +0 -54
  407. package/dist/CachedStateProvider-Co4n5Wvs.mjs.map +0 -1
  408. package/dist/CachedStateProvider-DqhGpzsm.cjs +0 -3
  409. package/dist/HostingerProvider-BOvsgATO.cjs.map +0 -1
  410. package/dist/HostingerProvider-BcyFRbqV.mjs.map +0 -1
  411. package/dist/LocalStateProvider-Bq-0C0sg.mjs +0 -42
  412. package/dist/LocalStateProvider-Bq-0C0sg.mjs.map +0 -1
  413. package/dist/LocalStateProvider-yjXZXZDM.cjs +0 -43
  414. package/dist/LocalStateProvider-yjXZXZDM.cjs.map +0 -1
  415. package/dist/Route53Provider-C0xmer8U.mjs.map +0 -1
  416. package/dist/Route53Provider-CH9XH7bz.cjs.map +0 -1
  417. package/dist/SSMStateProvider-CXtNgPfy.cjs +0 -66
  418. package/dist/SSMStateProvider-CXtNgPfy.cjs.map +0 -1
  419. package/dist/SSMStateProvider-DOZifZfE.mjs +0 -66
  420. package/dist/SSMStateProvider-DOZifZfE.mjs.map +0 -1
  421. package/dist/backup-provisioner-DXXg6FIL.mjs.map +0 -1
  422. package/dist/backup-provisioner-cE2PuCTb.cjs.map +0 -1
  423. package/dist/bundler-BMekgx7a.cjs.map +0 -1
  424. package/dist/bundler-Bux2iF-v.mjs.map +0 -1
  425. package/dist/chunk-Duj1WY3L.mjs +0 -7
  426. package/dist/config-DTsVjKZD.mjs +0 -402
  427. package/dist/config-DTsVjKZD.mjs.map +0 -1
  428. package/dist/config-RYR9j6EF.cjs +0 -462
  429. package/dist/config-RYR9j6EF.cjs.map +0 -1
  430. package/dist/config.d.cts.map +0 -1
  431. package/dist/config.d.mts.map +0 -1
  432. package/dist/credentials-B5zRHdAl.mjs +0 -141
  433. package/dist/credentials-B5zRHdAl.mjs.map +0 -1
  434. package/dist/credentials-BapzjyV5.cjs +0 -195
  435. package/dist/credentials-BapzjyV5.cjs.map +0 -1
  436. package/dist/credentials-DQRvPz2S.cjs +0 -2769
  437. package/dist/credentials-DQRvPz2S.cjs.map +0 -1
  438. package/dist/credentials-jMJC63qs.mjs +0 -2625
  439. package/dist/credentials-jMJC63qs.mjs.map +0 -1
  440. package/dist/discover-BYHQwQqu.mjs +0 -242
  441. package/dist/discover-BYHQwQqu.mjs.map +0 -1
  442. package/dist/discover-DmW9Bscc.cjs +0 -290
  443. package/dist/discover-DmW9Bscc.cjs.map +0 -1
  444. package/dist/dokploy-api-5cK2InBm.cjs +0 -3
  445. package/dist/dokploy-api-D2Ny4Jrc.mjs +0 -3
  446. package/dist/dokploy-api-pdaBryoY.mjs +0 -706
  447. package/dist/dokploy-api-pdaBryoY.mjs.map +0 -1
  448. package/dist/dokploy-api-zqKe9lHH.cjs +0 -718
  449. package/dist/dokploy-api-zqKe9lHH.cjs.map +0 -1
  450. package/dist/emit-CIlvnDvV.mjs.map +0 -1
  451. package/dist/emit-CUD1BWls.cjs.map +0 -1
  452. package/dist/encryption-D2pL3tHH.cjs +0 -54
  453. package/dist/encryption-D2pL3tHH.cjs.map +0 -1
  454. package/dist/encryption-YDsXXi6w.mjs +0 -3
  455. package/dist/encryption-_4zwjOAR.mjs +0 -42
  456. package/dist/encryption-_4zwjOAR.mjs.map +0 -1
  457. package/dist/encryption-sQ2Oxx0d.cjs +0 -4
  458. package/dist/fullstack-secrets-B6KBHf-g.mjs +0 -87
  459. package/dist/fullstack-secrets-B6KBHf-g.mjs.map +0 -1
  460. package/dist/fullstack-secrets-DL8v0y4D.cjs +0 -99
  461. package/dist/fullstack-secrets-DL8v0y4D.cjs.map +0 -1
  462. package/dist/generator-CNzBw7g5.cjs +0 -289
  463. package/dist/generator-CNzBw7g5.cjs.map +0 -1
  464. package/dist/generator-VE2JrFlY.mjs +0 -253
  465. package/dist/generator-VE2JrFlY.mjs.map +0 -1
  466. package/dist/github-BThvbf2W.cjs +0 -197
  467. package/dist/github-BThvbf2W.cjs.map +0 -1
  468. package/dist/github-DpMZurEK.mjs +0 -196
  469. package/dist/github-DpMZurEK.mjs.map +0 -1
  470. package/dist/index-BzJ7QJ9c.d.mts.map +0 -1
  471. package/dist/index-CfMjtdVC.d.cts.map +0 -1
  472. package/dist/keystore-C9rint2E.cjs +0 -101
  473. package/dist/keystore-C9rint2E.cjs.map +0 -1
  474. package/dist/keystore-TxeYM7an.mjs +0 -83
  475. package/dist/keystore-TxeYM7an.mjs.map +0 -1
  476. package/dist/openapi-Bs3-5q_r.mjs +0 -2021
  477. package/dist/openapi-Bs3-5q_r.mjs.map +0 -1
  478. package/dist/openapi-DWLTsYLL.cjs +0 -2075
  479. package/dist/openapi-DWLTsYLL.cjs.map +0 -1
  480. package/dist/openapi-react-query-Byltvm_7.mjs +0 -167
  481. package/dist/openapi-react-query-Byltvm_7.mjs.map +0 -1
  482. package/dist/openapi-react-query-CmJ1xDbn.cjs +0 -173
  483. package/dist/openapi-react-query-CmJ1xDbn.cjs.map +0 -1
  484. package/dist/openapi-react-query.cjs +0 -4
  485. package/dist/openapi-react-query.d.cts +0 -11
  486. package/dist/openapi-react-query.d.cts.map +0 -1
  487. package/dist/openapi-react-query.d.mts +0 -11
  488. package/dist/openapi-react-query.d.mts.map +0 -1
  489. package/dist/openapi-react-query.mjs +0 -4
  490. package/dist/reconcile-BI0tWkwz.mjs.map +0 -1
  491. package/dist/reconcile-Bhw5fmKu.cjs.map +0 -1
  492. package/dist/setup-BmLoNrDX.mjs +0 -12
  493. package/dist/setup-BrR1_xGy.cjs +0 -12
  494. package/dist/setup-BsNR2LBG.cjs +0 -467
  495. package/dist/setup-BsNR2LBG.cjs.map +0 -1
  496. package/dist/setup-D5-JMknk.mjs +0 -437
  497. package/dist/setup-D5-JMknk.mjs.map +0 -1
  498. package/dist/storage-B020InPW.mjs +0 -222
  499. package/dist/storage-B020InPW.mjs.map +0 -1
  500. package/dist/storage-CSNplaJn.cjs +0 -282
  501. package/dist/storage-CSNplaJn.cjs.map +0 -1
  502. package/dist/storage-DGBzMLZa.mjs +0 -4
  503. package/dist/storage-DlVol_oj.cjs +0 -8
  504. package/dist/sync-0ILCb-1S.cjs +0 -93
  505. package/dist/sync-0ILCb-1S.cjs.map +0 -1
  506. package/dist/sync-CzHXiR9c.mjs +0 -76
  507. package/dist/sync-CzHXiR9c.mjs.map +0 -1
  508. package/dist/sync-DYENfOt4.cjs +0 -4
  509. package/dist/sync-HAau6h_R.mjs +0 -3
  510. package/dist/types-DVIx8I1N.d.mts +0 -1950
  511. package/dist/types-DVIx8I1N.d.mts.map +0 -1
  512. package/dist/types-PMP_qXRY.d.cts +0 -1950
  513. package/dist/types-PMP_qXRY.d.cts.map +0 -1
  514. package/dist/workspace-Cji6lE8E.cjs +0 -10
  515. package/dist/workspace-CkJAtRIX.mjs +0 -9
  516. package/dist/workspace-CtnZnWsa.mjs.map +0 -1
  517. package/dist/workspace-DPV7FtAv.cjs.map +0 -1
@@ -0,0 +1,625 @@
1
+ const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
+ const require_errors = require("./errors-DMC4Umsb.cjs");
3
+ let node_path = require("node:path");
4
+ let node_fs_promises = require("node:fs/promises");
5
+ let _geekmidas_manifest = require("@geekmidas/manifest");
6
+ let node_module = require("node:module");
7
+ let node_url = require("node:url");
8
+ let pg = require("pg");
9
+ pg = require_rolldown_runtime.__toESM(pg, 1);
10
+ //#region src/migrate/provider.ts
11
+ /**
12
+ * One construct's migrations and seeds, read from its folders.
13
+ *
14
+ * Two kinds of file, told apart by extension rather than by configuration: a
15
+ * script exports `up` (and may export `down`) — or `seed(db, { stage })`, in
16
+ * `seeds/` — and a
17
+ * `.sql` file is run whole. The second is what makes a folder independent of
18
+ * the client the app uses — Better Auth's schema is SQL whatever the
19
+ * application queries with.
20
+ */
21
+ const SCRIPTS = /* @__PURE__ */ new Set([
22
+ ".ts",
23
+ ".mts",
24
+ ".js",
25
+ ".mjs"
26
+ ]);
27
+ /** Two files in one folder that would be one migration. */
28
+ var DuplicateMigration = class extends require_errors.GkmError {
29
+ folder;
30
+ migration;
31
+ constructor(folder, migration) {
32
+ super(`${folder} has two migrations named '${migration}' — a script and a .sql file with the same name. A migration is recorded by name, so only one of them could ever run; rename or remove the other.`);
33
+ this.folder = folder;
34
+ this.migration = migration;
35
+ this.name = "DuplicateMigration";
36
+ }
37
+ };
38
+ /** A script in a migrations folder that exports no `up`. */
39
+ var MigrationHasNoUp = class extends require_errors.GkmError {
40
+ file;
41
+ constructor(file) {
42
+ super(`${file} is in a migrations folder but exports no \`up\` function. Export \`async function up(db: Kysely<unknown>)\`, or move the file out of the folder if it is not a migration.`);
43
+ this.file = file;
44
+ this.name = "MigrationHasNoUp";
45
+ }
46
+ };
47
+ /** A script in a seeds folder that exports no `seed`. */
48
+ var SeedHasNoSeed = class extends require_errors.GkmError {
49
+ file;
50
+ constructor(file) {
51
+ super(`${file} is in a seeds folder but exports no \`seed\` function. Export \`async function seed(db, { stage })\`, or move the file out of the folder if it is not a seed.`);
52
+ this.file = file;
53
+ this.name = "SeedHasNoSeed";
54
+ }
55
+ };
56
+ /**
57
+ * The migration files in a folder, by name, without reading them.
58
+ *
59
+ * Also what `gkm dev` compares against a construct's history to report what
60
+ * is pending, which is why it is separate from loading them.
61
+ */
62
+ async function migrationFiles(folder) {
63
+ const entries = await (0, node_fs_promises.readdir)(folder, { withFileTypes: true }).catch((error) => {
64
+ if (error.code === "ENOENT") return [];
65
+ throw error;
66
+ });
67
+ const files = /* @__PURE__ */ new Map();
68
+ for (const entry of entries) {
69
+ if (!entry.isFile() || !isMigration(entry.name)) continue;
70
+ const name = entry.name.slice(0, -(0, node_path.extname)(entry.name).length);
71
+ if (files.has(name)) throw new DuplicateMigration(folder, name);
72
+ files.set(name, (0, node_path.join)(folder, entry.name));
73
+ }
74
+ return files;
75
+ }
76
+ /** A Kysely provider over one construct's folder. */
77
+ function folderProvider(folder, raw) {
78
+ return { async getMigrations() {
79
+ const migrations = {};
80
+ for (const [name, file] of await migrationFiles(folder)) migrations[name] = (0, node_path.extname)(file) === ".sql" ? await sqlMigration(file, raw) : await scriptMigration(file);
81
+ return migrations;
82
+ } };
83
+ }
84
+ /**
85
+ * The seeds in a folder, loaded, in name order.
86
+ *
87
+ * Every one runs on every pass — there is no history to consult — so the order
88
+ * is the only thing between two seeds where one reads what another writes.
89
+ * Name them to sort that way.
90
+ */
91
+ async function loadSeeds(folder, raw) {
92
+ const files = [...await migrationFiles(folder)].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
93
+ const seeds = [];
94
+ for (const [name, file] of files) seeds.push({
95
+ name,
96
+ run: (0, node_path.extname)(file) === ".sql" ? (await sqlMigration(file, raw)).up : await scriptSeed(file)
97
+ });
98
+ return seeds;
99
+ }
100
+ /**
101
+ * A seed script, imported as it is on disk now.
102
+ *
103
+ * Keyed by its modification time: a seed is run again after it is edited, and
104
+ * a process that has imported it once would otherwise run the old one.
105
+ */
106
+ async function scriptSeed(file) {
107
+ const url = (0, node_url.pathToFileURL)(file);
108
+ url.searchParams.set("mtime", String((await (0, node_fs_promises.stat)(file)).mtimeMs));
109
+ const module = await import(url.href);
110
+ if (typeof module.seed !== "function") throw new SeedHasNoSeed(file);
111
+ return module.seed;
112
+ }
113
+ function isMigration(file) {
114
+ if (file.endsWith(".d.ts")) return false;
115
+ if (/\.(spec|test)\.[cm]?[jt]s$/.test(file)) return false;
116
+ const extension = (0, node_path.extname)(file);
117
+ return extension === ".sql" || SCRIPTS.has(extension);
118
+ }
119
+ async function scriptMigration(file) {
120
+ const module = await import((0, node_url.pathToFileURL)(file).href);
121
+ if (typeof module.up !== "function") throw new MigrationHasNoUp(file);
122
+ return {
123
+ up: module.up,
124
+ ...typeof module.down === "function" ? { down: module.down } : {}
125
+ };
126
+ }
127
+ /**
128
+ * A `.sql` file, run whole.
129
+ *
130
+ * One query rather than split on `;`: with no parameters, Postgres takes
131
+ * several statements in one message, and splitting by hand breaks on the first
132
+ * `;` inside a string or a function body. There is no `down` — a generated
133
+ * schema is rolled back by a migration that says how, not by guessing.
134
+ */
135
+ async function sqlMigration(file, raw) {
136
+ const statements = await (0, node_fs_promises.readFile)(file, "utf-8");
137
+ return { up: async (db) => {
138
+ await raw.raw(statements).execute(db);
139
+ } };
140
+ }
141
+ //#endregion
142
+ //#region src/migrate/databases.ts
143
+ /**
144
+ * Bring each construct's schema up to its migrations folder.
145
+ *
146
+ * Which constructs, in what order, from which folder, is `migrationTargets`'
147
+ * answer and nobody else's. What is decided here is only how one target is
148
+ * run: as its owner, in its own schema, with a history of its own.
149
+ */
150
+ /** A folder under `db/` that names no construct. */
151
+ var UnknownMigrationFolder = class extends require_errors.GkmError {
152
+ folder;
153
+ known;
154
+ constructor(folder, known) {
155
+ super(`${folder} names no database construct, so its migrations would never run. ${known.length > 0 ? `The folders that do: ${known.join(", ")}.` : "This project declares no database."} Rename the folder after the construct it belongs to.`);
156
+ this.folder = folder;
157
+ this.known = known;
158
+ this.name = "UnknownMigrationFolder";
159
+ }
160
+ };
161
+ /** A construct was asked for by a name that takes no migrations. */
162
+ var NoSuchMigrationTarget = class extends require_errors.GkmError {
163
+ construct;
164
+ known;
165
+ constructor(construct, known) {
166
+ super(`'${construct}' is not a database construct. ` + (known.length > 0 ? `The ones with migrations: ${known.join(", ")}.` : "This project declares no database."));
167
+ this.construct = construct;
168
+ this.known = known;
169
+ this.name = "NoSuchMigrationTarget";
170
+ }
171
+ };
172
+ /**
173
+ * A migration left directly in a construct's folder, where nothing reads it.
174
+ *
175
+ * Migrations moved into `migrations/` so seeds could sit beside them. A file
176
+ * still at the old level would otherwise never run, and nothing would say so.
177
+ */
178
+ var MigrationsOutsideFolder = class extends require_errors.GkmError {
179
+ folder;
180
+ files;
181
+ constructor(folder, files) {
182
+ super(`${folder} has ${files.join(", ")} directly inside it, where nothing runs them. Migrations live in ${folder}/migrations/ and seeds in ${folder}/seeds/ — move ${files.length === 1 ? "it" : "them"} there.`);
183
+ this.folder = folder;
184
+ this.files = files;
185
+ this.name = "MigrationsOutsideFolder";
186
+ }
187
+ };
188
+ /** A folder inside a construct's folder that is neither `migrations` nor `seeds`. */
189
+ var UnknownDatabaseFolder = class extends require_errors.GkmError {
190
+ folder;
191
+ constructor(folder) {
192
+ super(`${folder} is neither migrations/ nor seeds/, so nothing in it would ever run. A construct's folder holds those two; rename or remove it.`);
193
+ this.folder = folder;
194
+ this.name = "UnknownDatabaseFolder";
195
+ }
196
+ };
197
+ /** A seed failed; its own writes are rolled back, the ones before it stay. */
198
+ var SeedFailed = class extends Error {
199
+ construct;
200
+ seed;
201
+ cause;
202
+ constructor(construct, seed, cause) {
203
+ super(`${construct}: seed '${seed}' failed — ${cause instanceof Error ? cause.message : String(cause)}. Its writes were rolled back; fix it and run it again.`);
204
+ this.construct = construct;
205
+ this.seed = seed;
206
+ this.cause = cause;
207
+ this.name = "SeedFailed";
208
+ }
209
+ };
210
+ /** A construct with roles has no owner URL to migrate with. */
211
+ var NoOwnerCredential = class extends require_errors.GkmError {
212
+ construct;
213
+ key;
214
+ constructor(construct, key) {
215
+ super(`${construct} has no ${key} to migrate with. Migrations run as the owner role — the runtime one cannot create a table — and nothing resolved its URL. Is the stage reconciled?`);
216
+ this.construct = construct;
217
+ this.key = key;
218
+ this.name = "NoOwnerCredential";
219
+ }
220
+ };
221
+ /** A migration failed; the ones before it in the run stay applied. */
222
+ var MigrationFailed = class extends Error {
223
+ construct;
224
+ migration;
225
+ cause;
226
+ constructor(construct, migration, cause) {
227
+ super(`${construct}: migration ${migration ? `'${migration}' ` : ""}failed — ${cause instanceof Error ? cause.message : String(cause)}`);
228
+ this.construct = construct;
229
+ this.migration = migration;
230
+ this.cause = cause;
231
+ this.name = "MigrationFailed";
232
+ }
233
+ };
234
+ /** The project's Kysely could not be found from where a database is declared. */
235
+ var KyselyNotFound = class extends require_errors.GkmError {
236
+ from;
237
+ constructor(from) {
238
+ super(`Could not resolve 'kysely' from ${from}. Migrations run with the project's own Kysely — install it where the database is declared.`);
239
+ this.from = from;
240
+ this.name = "KyselyNotFound";
241
+ }
242
+ };
243
+ /** Apply every pending migration, construct by construct, parents first. */
244
+ async function migrateDatabases(options) {
245
+ const runs = [];
246
+ for (const target of await targetsFor(options)) {
247
+ if ((await migrationFiles((0, node_path.join)(options.root, target.migrations))).size === 0) {
248
+ runs.push({
249
+ target,
250
+ applied: []
251
+ });
252
+ continue;
253
+ }
254
+ const applied = await withMigrator(options, target, async (migrator) => {
255
+ const { error, results = [] } = await migrator.migrateToLatest();
256
+ if (error) {
257
+ const failed = results.find((result) => result.status === "Error");
258
+ throw new MigrationFailed(target.id, failed?.migrationName, error);
259
+ }
260
+ return results.filter((result) => result.status === "Success").map((result) => result.migrationName);
261
+ });
262
+ runs.push({
263
+ target,
264
+ applied
265
+ });
266
+ }
267
+ return runs;
268
+ }
269
+ /**
270
+ * Run every construct's seeds, parents first — each one, every time, on every
271
+ * stage, production included. Each is handed the stage, so a seed decides
272
+ * what belongs where.
273
+ *
274
+ * Seeds are reference data kept up to date by being run again, so there is no
275
+ * history: a seed is an upsert, and a changed one is applied by the next run.
276
+ * Each runs in its own transaction, as the construct's owner, so a failure
277
+ * leaves nothing half-written. Assumes the schema is migrated —
278
+ * {@link migrateAndSeed} is what makes that true.
279
+ *
280
+ * A seed is handed the client the app gets — the construct's `clientConfig`,
281
+ * plugins included — on the owner's connection. One written against
282
+ * `Kysely<DB>` with a `CamelCasePlugin` writes `isEditable` here as it does in
283
+ * a handler or a test.
284
+ */
285
+ async function seedDatabases(options) {
286
+ const runs = [];
287
+ for (const target of await targetsFor(options)) {
288
+ const folder = (0, node_path.join)(options.root, target.seeds);
289
+ if ((await migrationFiles(folder)).size === 0) {
290
+ runs.push({
291
+ target,
292
+ seeded: []
293
+ });
294
+ continue;
295
+ }
296
+ const seeded = await withOwner(options, target, clientConfigOf(options, target), async (db, kysely) => {
297
+ const names = [];
298
+ for (const seed of await loadSeeds(folder, kysely.sql)) {
299
+ try {
300
+ await db.transaction().execute((trx) => seed.run(trx, { stage: options.stage }));
301
+ } catch (error) {
302
+ throw new SeedFailed(target.id, seed.name, error);
303
+ }
304
+ names.push(seed.name);
305
+ }
306
+ return names;
307
+ });
308
+ runs.push({
309
+ target,
310
+ seeded
311
+ });
312
+ }
313
+ return runs;
314
+ }
315
+ /**
316
+ * The seeds {@link seedDatabases} would run, construct by construct, parents
317
+ * first, in the order it would run them — read from the folders alone, with
318
+ * no connection. What a dry run lists. Constructs with none are left out.
319
+ */
320
+ async function plannedSeeds(options) {
321
+ const planned = [];
322
+ for (const target of await targetsFor(options)) {
323
+ const files = await migrationFiles((0, node_path.join)(options.root, target.seeds));
324
+ if (files.size === 0) continue;
325
+ planned.push({
326
+ target,
327
+ seeds: [...files.keys()].sort()
328
+ });
329
+ }
330
+ return planned;
331
+ }
332
+ /**
333
+ * Migrate, then seed: a seed only ever runs against the schema it was written
334
+ * for.
335
+ *
336
+ * With `only`, the constructs it lives in are migrated too — a tenant's seed
337
+ * cannot run before the database that owns its schema exists — and only it is
338
+ * seeded.
339
+ */
340
+ async function migrateAndSeed(options) {
341
+ const migrations = [];
342
+ for (const target of await withParents(options)) migrations.push(...await migrateDatabases({
343
+ ...options,
344
+ only: target.id
345
+ }));
346
+ return {
347
+ migrations,
348
+ seeds: await seedDatabases(options)
349
+ };
350
+ }
351
+ /** The targets `only` names, after the ones it lives in; all without it. */
352
+ async function withParents(options) {
353
+ const chosen = await targetsFor(options);
354
+ if (!options.only) return chosen;
355
+ const all = (0, _geekmidas_manifest.migrationTargets)(options.manifest);
356
+ const ids = /* @__PURE__ */ new Set();
357
+ for (const target of chosen) {
358
+ let current = target;
359
+ while (current) {
360
+ ids.add(current.id);
361
+ const parent = current.of;
362
+ current = parent ? all.find((t) => t.id === parent) : void 0;
363
+ }
364
+ }
365
+ return all.filter((target) => ids.has(target.id));
366
+ }
367
+ /**
368
+ * What each construct's folder has that its history does not — without
369
+ * applying any of it. What `gkm dev` reports.
370
+ */
371
+ async function pendingMigrations(options) {
372
+ const found = [];
373
+ for (const target of await targetsFor(options)) {
374
+ if ((await migrationFiles((0, node_path.join)(options.root, target.migrations))).size === 0) continue;
375
+ const pending = await withMigrator(options, target, async (migrator) => (await migrator.getMigrations()).filter((migration) => migration.executedAt === void 0).map((migration) => migration.name));
376
+ if (pending.length > 0) found.push({
377
+ target,
378
+ pending
379
+ });
380
+ }
381
+ return found;
382
+ }
383
+ /**
384
+ * The targets this run covers, with every folder under `db/` accounted for.
385
+ *
386
+ * A folder that names no construct is an error rather than something to skip:
387
+ * a typo in its name is otherwise a migration that silently never runs.
388
+ */
389
+ async function targetsFor(options) {
390
+ const targets = (0, _geekmidas_manifest.migrationTargets)(options.manifest);
391
+ const folders = targets.map((target) => target.folder);
392
+ for (const folder of await foldersIn((0, node_path.join)(options.root, _geekmidas_manifest.MIGRATIONS_ROOT))) {
393
+ const relative = `${_geekmidas_manifest.MIGRATIONS_ROOT}/${folder}`;
394
+ if (!folders.includes(relative)) throw new UnknownMigrationFolder(relative, folders);
395
+ await checkLayout(options.root, relative);
396
+ }
397
+ if (!options.only) return targets;
398
+ const id = (0, _geekmidas_manifest.canonicalId)(options.only);
399
+ const chosen = targets.filter((target) => target.id === id);
400
+ if (chosen.length === 0) throw new NoSuchMigrationTarget(options.only, targets.map((target) => target.id));
401
+ return chosen;
402
+ }
403
+ /**
404
+ * A construct's folder holds `migrations/` and `seeds/`, and nothing else —
405
+ * anything beside them is a file or folder nothing would ever run.
406
+ */
407
+ async function checkLayout(root, folder) {
408
+ const entries = await (0, node_fs_promises.readdir)((0, node_path.join)(root, folder), { withFileTypes: true });
409
+ const loose = entries.filter((entry) => entry.isFile() && !entry.name.startsWith(".")).map((entry) => entry.name);
410
+ if (loose.length > 0) throw new MigrationsOutsideFolder(folder, loose);
411
+ for (const entry of entries) if (entry.isDirectory() && !_geekmidas_manifest.DATABASE_FOLDERS.includes(entry.name)) throw new UnknownDatabaseFolder(`${folder}/${entry.name}`);
412
+ }
413
+ async function foldersIn(dir) {
414
+ return (await (0, node_fs_promises.readdir)(dir, { withFileTypes: true }).catch((error) => {
415
+ if (error.code === "ENOENT") return [];
416
+ throw error;
417
+ })).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
418
+ }
419
+ /**
420
+ * A migrator for one target, connected as its owner.
421
+ *
422
+ * No `migrationTableSchema`: the owner role's `search_path` is pinned to the
423
+ * construct's schema, so the history lands there — `app.kysely_migration` for
424
+ * the database, `auth_database.kysely_migration` for its tenant — and two
425
+ * constructs in one Postgres never share one.
426
+ *
427
+ * Unordered migrations are allowed. Files are timestamped, so a branch merged
428
+ * after another's migration ran carries an older one; refusing it would make
429
+ * every such merge a manual repair.
430
+ *
431
+ * The client is bare — none of the construct's plugins. A casing plugin
432
+ * rewrites identifiers in schema-builder DDL too, and a migration must do the
433
+ * same thing forever after it has run, so it cannot depend on configuration
434
+ * that may change.
435
+ */
436
+ async function withMigrator(options, target, run) {
437
+ return withOwner(options, target, {}, (db, { Migrator, sql }) => run(new Migrator({
438
+ db,
439
+ provider: folderProvider((0, node_path.join)(options.root, target.migrations), sql),
440
+ allowUnorderedMigrations: true
441
+ })));
442
+ }
443
+ /**
444
+ * One target's database, connected as its owner and closed afterwards — what
445
+ * migrations and seeds both run as, each with the client config it needs.
446
+ */
447
+ async function withOwner(options, target, config, run) {
448
+ const kysely = await kyselyFrom(options.sources?.[target.id]?.file ?? (target.of ? options.sources?.[target.of]?.file : void 0) ?? (0, node_path.join)(options.root, "package.json"));
449
+ const db = new kysely.Kysely({
450
+ ...config,
451
+ dialect: new kysely.PostgresDialect({ pool: new pg.default.Pool(poolConfig(ownerUrl(options, target))) })
452
+ });
453
+ try {
454
+ return await run(db, kysely);
455
+ } finally {
456
+ await db.destroy();
457
+ }
458
+ }
459
+ /**
460
+ * What the construct builds its clients with besides a dialect — its plugins
461
+ * and logging — read from the construct discovery already imported.
462
+ *
463
+ * A tenant's is its own: `database.schema('Auth', { plugins })` declares the
464
+ * client for its tables, not the parent's. With no construct to ask (a
465
+ * manifest without sources), the client is bare.
466
+ */
467
+ function clientConfigOf(options, target) {
468
+ const construct = options.sources?.[target.id]?.construct;
469
+ if (typeof construct !== "object" || construct === null) return {};
470
+ if (!("clientConfig" in construct)) return {};
471
+ return construct.clientConfig ?? {};
472
+ }
473
+ /**
474
+ * The owner's URL, with no fallback to the runtime one.
475
+ *
476
+ * The runtime role can create nothing, so falling back would only move the
477
+ * failure to the first `CREATE TABLE` and make it read like a permissions
478
+ * bug. The one exception is a database declared `roles: false`, where there is
479
+ * no owner — both URLs are the master credential by design.
480
+ */
481
+ function ownerUrl(options, target) {
482
+ const key = (0, _geekmidas_manifest.provideKey)(target.id, "ownerUrl");
483
+ const owner = options.env[key];
484
+ if (owner) return owner;
485
+ const database = options.manifest[target.of ?? target.id];
486
+ if (database?.kind === "database" && database.roles === false) {
487
+ const url = options.env[(0, _geekmidas_manifest.provideKey)(target.id, "url")];
488
+ if (url) return url;
489
+ }
490
+ throw new NoOwnerCredential(target.id, key);
491
+ }
492
+ /**
493
+ * Pool settings for a URL, with `?search_path=` as the startup option Postgres
494
+ * reads. Only a `roles: false` URL carries it — a role pins its own.
495
+ */
496
+ function poolConfig(url) {
497
+ const parsed = new URL(url);
498
+ const searchPath = parsed.searchParams.get("search_path");
499
+ if (!searchPath) return { connectionString: url };
500
+ parsed.searchParams.delete("search_path");
501
+ return {
502
+ connectionString: parsed.toString(),
503
+ options: `-c search_path=${searchPath}`
504
+ };
505
+ }
506
+ /** Kysely as the project resolves it from `from`. */
507
+ async function kyselyFrom(from) {
508
+ const require$1 = (0, node_module.createRequire)(from);
509
+ try {
510
+ const [main, migration] = await Promise.all([import((0, node_url.pathToFileURL)(require$1.resolve("kysely")).href), import((0, node_url.pathToFileURL)(require$1.resolve("kysely/migration")).href)]);
511
+ return {
512
+ Kysely: main.Kysely,
513
+ PostgresDialect: main.PostgresDialect,
514
+ sql: main.sql,
515
+ Migrator: migration.Migrator
516
+ };
517
+ } catch {
518
+ throw new KyselyNotFound(from);
519
+ }
520
+ }
521
+ //#endregion
522
+ Object.defineProperty(exports, "DuplicateMigration", {
523
+ enumerable: true,
524
+ get: function() {
525
+ return DuplicateMigration;
526
+ }
527
+ });
528
+ Object.defineProperty(exports, "KyselyNotFound", {
529
+ enumerable: true,
530
+ get: function() {
531
+ return KyselyNotFound;
532
+ }
533
+ });
534
+ Object.defineProperty(exports, "MigrationFailed", {
535
+ enumerable: true,
536
+ get: function() {
537
+ return MigrationFailed;
538
+ }
539
+ });
540
+ Object.defineProperty(exports, "MigrationHasNoUp", {
541
+ enumerable: true,
542
+ get: function() {
543
+ return MigrationHasNoUp;
544
+ }
545
+ });
546
+ Object.defineProperty(exports, "MigrationsOutsideFolder", {
547
+ enumerable: true,
548
+ get: function() {
549
+ return MigrationsOutsideFolder;
550
+ }
551
+ });
552
+ Object.defineProperty(exports, "NoOwnerCredential", {
553
+ enumerable: true,
554
+ get: function() {
555
+ return NoOwnerCredential;
556
+ }
557
+ });
558
+ Object.defineProperty(exports, "NoSuchMigrationTarget", {
559
+ enumerable: true,
560
+ get: function() {
561
+ return NoSuchMigrationTarget;
562
+ }
563
+ });
564
+ Object.defineProperty(exports, "SeedFailed", {
565
+ enumerable: true,
566
+ get: function() {
567
+ return SeedFailed;
568
+ }
569
+ });
570
+ Object.defineProperty(exports, "SeedHasNoSeed", {
571
+ enumerable: true,
572
+ get: function() {
573
+ return SeedHasNoSeed;
574
+ }
575
+ });
576
+ Object.defineProperty(exports, "UnknownDatabaseFolder", {
577
+ enumerable: true,
578
+ get: function() {
579
+ return UnknownDatabaseFolder;
580
+ }
581
+ });
582
+ Object.defineProperty(exports, "UnknownMigrationFolder", {
583
+ enumerable: true,
584
+ get: function() {
585
+ return UnknownMigrationFolder;
586
+ }
587
+ });
588
+ Object.defineProperty(exports, "migrateAndSeed", {
589
+ enumerable: true,
590
+ get: function() {
591
+ return migrateAndSeed;
592
+ }
593
+ });
594
+ Object.defineProperty(exports, "migrateDatabases", {
595
+ enumerable: true,
596
+ get: function() {
597
+ return migrateDatabases;
598
+ }
599
+ });
600
+ Object.defineProperty(exports, "migrationFiles", {
601
+ enumerable: true,
602
+ get: function() {
603
+ return migrationFiles;
604
+ }
605
+ });
606
+ Object.defineProperty(exports, "pendingMigrations", {
607
+ enumerable: true,
608
+ get: function() {
609
+ return pendingMigrations;
610
+ }
611
+ });
612
+ Object.defineProperty(exports, "plannedSeeds", {
613
+ enumerable: true,
614
+ get: function() {
615
+ return plannedSeeds;
616
+ }
617
+ });
618
+ Object.defineProperty(exports, "seedDatabases", {
619
+ enumerable: true,
620
+ get: function() {
621
+ return seedDatabases;
622
+ }
623
+ });
624
+
625
+ //# sourceMappingURL=databases-fOaoBInm.cjs.map