@geekmidas/cli 10.0.0-alpha.16 → 10.0.0-alpha.160

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 (438) hide show
  1. package/README.md +323 -380
  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-B5BKAoLz.mjs +1039 -0
  7. package/dist/EndpointGenerator-B5BKAoLz.mjs.map +1 -0
  8. package/dist/EndpointGenerator-DxrRqfJ3.cjs +1098 -0
  9. package/dist/EndpointGenerator-DxrRqfJ3.cjs.map +1 -0
  10. package/dist/GoDaddyProvider-C9dDlH9I.mjs +412 -0
  11. package/dist/GoDaddyProvider-C9dDlH9I.mjs.map +1 -0
  12. package/dist/GoDaddyProvider-DkUMcMYy.cjs +412 -0
  13. package/dist/GoDaddyProvider-DkUMcMYy.cjs.map +1 -0
  14. package/dist/{HostingerProvider-BZFGYYVA.cjs → HostingerProvider-9faYOQnQ.cjs} +23 -9
  15. package/dist/HostingerProvider-9faYOQnQ.cjs.map +1 -0
  16. package/dist/{HostingerProvider-BY26bWwB.mjs → HostingerProvider-BEuKG2gz.mjs} +23 -9
  17. package/dist/HostingerProvider-BEuKG2gz.mjs.map +1 -0
  18. package/dist/LegacyStateStore-C44jUnMH.cjs +124 -0
  19. package/dist/LegacyStateStore-C44jUnMH.cjs.map +1 -0
  20. package/dist/LegacyStateStore-DPKhjUR6.mjs +124 -0
  21. package/dist/LegacyStateStore-DPKhjUR6.mjs.map +1 -0
  22. package/dist/LocalStateStore-B95WE99i.cjs +178 -0
  23. package/dist/LocalStateStore-B95WE99i.cjs.map +1 -0
  24. package/dist/LocalStateStore-BU3fWkcT.mjs +167 -0
  25. package/dist/LocalStateStore-BU3fWkcT.mjs.map +1 -0
  26. package/dist/OpenApiTsGenerator-DOTLKBFf.cjs +539 -0
  27. package/dist/OpenApiTsGenerator-DOTLKBFf.cjs.map +1 -0
  28. package/dist/OpenApiTsGenerator-Vaf0pI8u.mjs +534 -0
  29. package/dist/OpenApiTsGenerator-Vaf0pI8u.mjs.map +1 -0
  30. package/dist/{Route53Provider-Cvj40A8I.mjs → Route53Provider-Di_SD9CF.mjs} +3 -3
  31. package/dist/Route53Provider-Di_SD9CF.mjs.map +1 -0
  32. package/dist/{Route53Provider-DVILBsvV.cjs → Route53Provider-emLuQHVw.cjs} +3 -3
  33. package/dist/Route53Provider-emLuQHVw.cjs.map +1 -0
  34. package/dist/S3StateStore-Cpbeijr5.mjs +223 -0
  35. package/dist/S3StateStore-Cpbeijr5.mjs.map +1 -0
  36. package/dist/S3StateStore-zU5kClhd.cjs +222 -0
  37. package/dist/S3StateStore-zU5kClhd.cjs.map +1 -0
  38. package/dist/SSMStateStore-BxkKMBi_.mjs +205 -0
  39. package/dist/SSMStateStore-BxkKMBi_.mjs.map +1 -0
  40. package/dist/SSMStateStore-D9uviQ3T.cjs +204 -0
  41. package/dist/SSMStateStore-D9uviQ3T.cjs.map +1 -0
  42. package/dist/SubscriberGenerator-BybB6uez.mjs +783 -0
  43. package/dist/SubscriberGenerator-BybB6uez.mjs.map +1 -0
  44. package/dist/SubscriberGenerator-mZpSuSU7.cjs +848 -0
  45. package/dist/SubscriberGenerator-mZpSuSU7.cjs.map +1 -0
  46. package/dist/add-Bb2IL3Yq.cjs +713 -0
  47. package/dist/add-Bb2IL3Yq.cjs.map +1 -0
  48. package/dist/add-Dj-gtqTO.mjs +711 -0
  49. package/dist/add-Dj-gtqTO.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/apps-0vc4Oz9_.cjs +6247 -0
  55. package/dist/apps-0vc4Oz9_.cjs.map +1 -0
  56. package/dist/apps-FRNlECwi.mjs +5621 -0
  57. package/dist/apps-FRNlECwi.mjs.map +1 -0
  58. package/dist/aws-8QQ8n-t6.mjs +89 -0
  59. package/dist/aws-8QQ8n-t6.mjs.map +1 -0
  60. package/dist/aws-DY9NqQIT.cjs +100 -0
  61. package/dist/aws-DY9NqQIT.cjs.map +1 -0
  62. package/dist/awsStore-Bx5nCFnS.mjs +121 -0
  63. package/dist/awsStore-Bx5nCFnS.mjs.map +1 -0
  64. package/dist/awsStore-u3ehhMoY.cjs +138 -0
  65. package/dist/awsStore-u3ehhMoY.cjs.map +1 -0
  66. package/dist/{backup-provisioner-DIVCbfee.mjs → backup-provisioner-C8DnCmxK.mjs} +2 -2
  67. package/dist/backup-provisioner-C8DnCmxK.mjs.map +1 -0
  68. package/dist/{backup-provisioner-BmhIO_Yr.cjs → backup-provisioner-oDEsPj02.cjs} +2 -2
  69. package/dist/backup-provisioner-oDEsPj02.cjs.map +1 -0
  70. package/dist/backups/runner.cjs +519 -0
  71. package/dist/backups/runner.cjs.map +1 -0
  72. package/dist/backups/runner.d.cts +102 -0
  73. package/dist/backups/runner.d.cts.map +1 -0
  74. package/dist/backups/runner.d.mts +102 -0
  75. package/dist/backups/runner.d.mts.map +1 -0
  76. package/dist/backups/runner.mjs +506 -0
  77. package/dist/backups/runner.mjs.map +1 -0
  78. package/dist/{bundler-BodTL4kf.mjs → bundler-9EM4ZHcu.mjs} +59 -14
  79. package/dist/bundler-9EM4ZHcu.mjs.map +1 -0
  80. package/dist/{bundler-BeNDZdHQ.cjs → bundler-Bg2eEFEh.cjs} +59 -14
  81. package/dist/bundler-Bg2eEFEh.cjs.map +1 -0
  82. package/dist/cli-CmoSOzNq.mjs +80 -0
  83. package/dist/cli-CmoSOzNq.mjs.map +1 -0
  84. package/dist/cli-YtLjcAZT.cjs +80 -0
  85. package/dist/cli-YtLjcAZT.cjs.map +1 -0
  86. package/dist/compose-3AtZF7ul.mjs +1560 -0
  87. package/dist/compose-3AtZF7ul.mjs.map +1 -0
  88. package/dist/compose-CW1DGfYc.cjs +1919 -0
  89. package/dist/compose-CW1DGfYc.cjs.map +1 -0
  90. package/dist/compose-CnXZAYNM.mjs +3068 -0
  91. package/dist/compose-CnXZAYNM.mjs.map +1 -0
  92. package/dist/compose-D7gOSspy.cjs +3157 -0
  93. package/dist/compose-D7gOSspy.cjs.map +1 -0
  94. package/dist/config-B5Hi3mLK.cjs +821 -0
  95. package/dist/config-B5Hi3mLK.cjs.map +1 -0
  96. package/dist/config-BNmLn0dw.d.mts +291 -0
  97. package/dist/config-BNmLn0dw.d.mts.map +1 -0
  98. package/dist/config-CkuiD9Jv.d.cts +291 -0
  99. package/dist/config-CkuiD9Jv.d.cts.map +1 -0
  100. package/dist/config-DWTUVGRE.mjs +696 -0
  101. package/dist/config-DWTUVGRE.mjs.map +1 -0
  102. package/dist/config.cjs +13 -3
  103. package/dist/config.d.cts +4 -117
  104. package/dist/config.d.mts +4 -117
  105. package/dist/config.mjs +3 -3
  106. package/dist/credentialSchemas-BAklWDna.cjs +271 -0
  107. package/dist/credentialSchemas-BAklWDna.cjs.map +1 -0
  108. package/dist/credentialSchemas-mz9QZTYh.mjs +236 -0
  109. package/dist/credentialSchemas-mz9QZTYh.mjs.map +1 -0
  110. package/dist/credentials-CjFtNBVH.mjs +1834 -0
  111. package/dist/credentials-CjFtNBVH.mjs.map +1 -0
  112. package/dist/credentials-DwIRfeBL.cjs +2289 -0
  113. package/dist/credentials-DwIRfeBL.cjs.map +1 -0
  114. package/dist/databases-C1qqNxTu.mjs +588 -0
  115. package/dist/databases-C1qqNxTu.mjs.map +1 -0
  116. package/dist/databases-CrKh5jw6.cjs +703 -0
  117. package/dist/databases-CrKh5jw6.cjs.map +1 -0
  118. package/dist/define-6poNqm5O.mjs +106 -0
  119. package/dist/define-6poNqm5O.mjs.map +1 -0
  120. package/dist/define-crmMcXFS.cjs +153 -0
  121. package/dist/define-crmMcXFS.cjs.map +1 -0
  122. package/dist/deploy/public.cjs +211 -0
  123. package/dist/deploy/public.cjs.map +1 -0
  124. package/dist/deploy/public.d.cts +658 -0
  125. package/dist/deploy/public.d.cts.map +1 -0
  126. package/dist/deploy/public.d.mts +658 -0
  127. package/dist/deploy/public.d.mts.map +1 -0
  128. package/dist/deploy/public.mjs +144 -0
  129. package/dist/deploy/public.mjs.map +1 -0
  130. package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
  131. package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
  132. package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
  133. package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
  134. package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
  135. package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
  136. package/dist/deploy/sniffer-hooks.cjs +1 -1
  137. package/dist/deploy/sniffer-hooks.mjs +1 -1
  138. package/dist/deploy/sniffer-loader.cjs +2 -2
  139. package/dist/deploy/sniffer-loader.mjs +1 -1
  140. package/dist/deploy/sniffer-routes-worker.cjs +2 -2
  141. package/dist/deploy/sniffer-routes-worker.mjs +1 -1
  142. package/dist/deploy-3bsiWJxj.cjs +3925 -0
  143. package/dist/deploy-3bsiWJxj.cjs.map +1 -0
  144. package/dist/deploy-BI3fHnyb.mjs +3869 -0
  145. package/dist/deploy-BI3fHnyb.mjs.map +1 -0
  146. package/dist/discover-CRywE7yc.cjs +1085 -0
  147. package/dist/discover-CRywE7yc.cjs.map +1 -0
  148. package/dist/discover-DbDrCQ8h.mjs +940 -0
  149. package/dist/discover-DbDrCQ8h.mjs.map +1 -0
  150. package/dist/docker-CwayjAF2.cjs +1515 -0
  151. package/dist/docker-CwayjAF2.cjs.map +1 -0
  152. package/dist/docker-DPdn7tYJ.mjs +1408 -0
  153. package/dist/docker-DPdn7tYJ.mjs.map +1 -0
  154. package/dist/dokploy-BMBL-_Xu.cjs +38 -0
  155. package/dist/dokploy-BMBL-_Xu.cjs.map +1 -0
  156. package/dist/dokploy-tmnH0Du_.mjs +38 -0
  157. package/dist/dokploy-tmnH0Du_.mjs.map +1 -0
  158. package/dist/drivers-BhdC9Efj.cjs +248 -0
  159. package/dist/drivers-BhdC9Efj.cjs.map +1 -0
  160. package/dist/drivers-wcDnzf7l.mjs +213 -0
  161. package/dist/drivers-wcDnzf7l.mjs.map +1 -0
  162. package/dist/eas-BVGQAUDc.mjs +334 -0
  163. package/dist/eas-BVGQAUDc.mjs.map +1 -0
  164. package/dist/eas-meN1xady.cjs +337 -0
  165. package/dist/eas-meN1xady.cjs.map +1 -0
  166. package/dist/emit-C4KSXOeS.mjs +153 -0
  167. package/dist/emit-C4KSXOeS.mjs.map +1 -0
  168. package/dist/emit-DiW0kbue.cjs +164 -0
  169. package/dist/emit-DiW0kbue.cjs.map +1 -0
  170. package/dist/encryption-C8AMbomA.mjs +89 -0
  171. package/dist/encryption-C8AMbomA.mjs.map +1 -0
  172. package/dist/encryption-DvFVZdGz.cjs +90 -0
  173. package/dist/encryption-DvFVZdGz.cjs.map +1 -0
  174. package/dist/engine-BbWj0w3F.mjs +3217 -0
  175. package/dist/engine-BbWj0w3F.mjs.map +1 -0
  176. package/dist/engine-BmiIUVWa.cjs +3330 -0
  177. package/dist/engine-BmiIUVWa.cjs.map +1 -0
  178. package/dist/errors-D8Gwp5kU.mjs +23 -0
  179. package/dist/errors-D8Gwp5kU.mjs.map +1 -0
  180. package/dist/errors-DMC4Umsb.cjs +34 -0
  181. package/dist/errors-DMC4Umsb.cjs.map +1 -0
  182. package/dist/github-BWqQr8q6.cjs +901 -0
  183. package/dist/github-BWqQr8q6.cjs.map +1 -0
  184. package/dist/github-Dc1daUbH.mjs +900 -0
  185. package/dist/github-Dc1daUbH.mjs.map +1 -0
  186. package/dist/googlePlay-ByaFUly7.mjs +931 -0
  187. package/dist/googlePlay-ByaFUly7.mjs.map +1 -0
  188. package/dist/googlePlay-CdVCdfU8.cjs +931 -0
  189. package/dist/googlePlay-CdVCdfU8.cjs.map +1 -0
  190. package/dist/{index-C-VLwB_Y.d.mts → index-B35vTdAW.d.cts} +38 -14
  191. package/dist/index-B35vTdAW.d.cts.map +1 -0
  192. package/dist/{index-C-HkOEBt.d.cts → index-Dv1Zj86i.d.mts} +38 -14
  193. package/dist/index-Dv1Zj86i.d.mts.map +1 -0
  194. package/dist/index.cjs +13730 -12325
  195. package/dist/index.cjs.map +1 -1
  196. package/dist/index.mjs +13771 -12364
  197. package/dist/index.mjs.map +1 -1
  198. package/dist/local-CnVFHJjS.mjs +224 -0
  199. package/dist/local-CnVFHJjS.mjs.map +1 -0
  200. package/dist/local-qevrV6dZ.cjs +241 -0
  201. package/dist/local-qevrV6dZ.cjs.map +1 -0
  202. package/dist/migrate-BEuCcCwN.mjs +267 -0
  203. package/dist/migrate-BEuCcCwN.mjs.map +1 -0
  204. package/dist/migrate-CRRps1i6.cjs +272 -0
  205. package/dist/migrate-CRRps1i6.cjs.map +1 -0
  206. package/dist/migrate-CU8_ZWP1.cjs +181 -0
  207. package/dist/migrate-CU8_ZWP1.cjs.map +1 -0
  208. package/dist/migrate-DgfKZB41.mjs +181 -0
  209. package/dist/migrate-DgfKZB41.mjs.map +1 -0
  210. package/dist/notes-BrBnyZz5.cjs +500 -0
  211. package/dist/notes-BrBnyZz5.cjs.map +1 -0
  212. package/dist/notes-CIzrdBKE.mjs +399 -0
  213. package/dist/notes-CIzrdBKE.mjs.map +1 -0
  214. package/dist/openapi.cjs +213 -7
  215. package/dist/openapi.cjs.map +1 -0
  216. package/dist/openapi.d.cts +32 -8
  217. package/dist/openapi.d.cts.map +1 -1
  218. package/dist/openapi.d.mts +32 -8
  219. package/dist/openapi.d.mts.map +1 -1
  220. package/dist/openapi.mjs +208 -2
  221. package/dist/openapi.mjs.map +1 -0
  222. package/dist/projectBucket-CDJd3prK.mjs +222 -0
  223. package/dist/projectBucket-CDJd3prK.mjs.map +1 -0
  224. package/dist/projectBucket-CKr_zObJ.cjs +263 -0
  225. package/dist/projectBucket-CKr_zObJ.cjs.map +1 -0
  226. package/dist/provider-BqpjG9QM.cjs +57 -0
  227. package/dist/provider-BqpjG9QM.cjs.map +1 -0
  228. package/dist/provider-CEOKk8NS.mjs +46 -0
  229. package/dist/provider-CEOKk8NS.mjs.map +1 -0
  230. package/dist/publish-Bq96_QnK.mjs +123 -0
  231. package/dist/publish-Bq96_QnK.mjs.map +1 -0
  232. package/dist/publish-DMKXh1Tb.cjs +124 -0
  233. package/dist/publish-DMKXh1Tb.cjs.map +1 -0
  234. package/dist/ready-BjFMu_1J.mjs +375 -0
  235. package/dist/ready-BjFMu_1J.mjs.map +1 -0
  236. package/dist/ready-eVMJIcWn.cjs +404 -0
  237. package/dist/ready-eVMJIcWn.cjs.map +1 -0
  238. package/dist/reconcile/public.cjs +3 -5
  239. package/dist/reconcile/public.d.cts +33 -89
  240. package/dist/reconcile/public.d.cts.map +1 -1
  241. package/dist/reconcile/public.d.mts +33 -89
  242. package/dist/reconcile/public.d.mts.map +1 -1
  243. package/dist/reconcile/public.mjs +3 -3
  244. package/dist/{reconcile-DhQ00DpU.mjs → reconcile--I7V4Klj.mjs} +2 -2
  245. package/dist/{reconcile-DhQ00DpU.mjs.map → reconcile--I7V4Klj.mjs.map} +1 -1
  246. package/dist/{reconcile-Dd2iyILf.cjs → reconcile-CuCQBa5-.cjs} +3 -3
  247. package/dist/{reconcile-Dd2iyILf.cjs.map → reconcile-CuCQBa5-.cjs.map} +1 -1
  248. package/dist/resolve-CSsE7frp.mjs +263 -0
  249. package/dist/resolve-CSsE7frp.mjs.map +1 -0
  250. package/dist/resolve-DF9GrosZ.cjs +316 -0
  251. package/dist/resolve-DF9GrosZ.cjs.map +1 -0
  252. package/dist/rollback-BBFGGmMa.cjs +165 -0
  253. package/dist/rollback-BBFGGmMa.cjs.map +1 -0
  254. package/dist/rollback-CZthwqus.mjs +136 -0
  255. package/dist/rollback-CZthwqus.mjs.map +1 -0
  256. package/dist/runtime-CFvcLEJW.d.cts +82 -0
  257. package/dist/runtime-CFvcLEJW.d.cts.map +1 -0
  258. package/dist/runtime-dwsH6ddo.d.mts +82 -0
  259. package/dist/runtime-dwsH6ddo.d.mts.map +1 -0
  260. package/dist/s3-BBRkezf7.mjs +215 -0
  261. package/dist/s3-BBRkezf7.mjs.map +1 -0
  262. package/dist/s3-CI2QYgXH.cjs +215 -0
  263. package/dist/s3-CI2QYgXH.cjs.map +1 -0
  264. package/dist/sandbox/config-worker.cjs +43 -0
  265. package/dist/sandbox/config-worker.cjs.map +1 -0
  266. package/dist/sandbox/config-worker.d.cts +1 -0
  267. package/dist/sandbox/config-worker.d.mts +1 -0
  268. package/dist/sandbox/config-worker.mjs +44 -0
  269. package/dist/sandbox/config-worker.mjs.map +1 -0
  270. package/dist/sandbox/credentials-worker.cjs +53 -0
  271. package/dist/sandbox/credentials-worker.cjs.map +1 -0
  272. package/dist/sandbox/credentials-worker.d.cts +1 -0
  273. package/dist/sandbox/credentials-worker.d.mts +1 -0
  274. package/dist/sandbox/credentials-worker.mjs +54 -0
  275. package/dist/sandbox/credentials-worker.mjs.map +1 -0
  276. package/dist/sandbox/discover-worker.cjs +47 -0
  277. package/dist/sandbox/discover-worker.cjs.map +1 -0
  278. package/dist/sandbox/discover-worker.d.cts +1 -0
  279. package/dist/sandbox/discover-worker.d.mts +1 -0
  280. package/dist/sandbox/discover-worker.mjs +48 -0
  281. package/dist/sandbox/discover-worker.mjs.map +1 -0
  282. package/dist/sandbox/migrate-worker.cjs +75 -0
  283. package/dist/sandbox/migrate-worker.cjs.map +1 -0
  284. package/dist/sandbox/migrate-worker.d.cts +1 -0
  285. package/dist/sandbox/migrate-worker.d.mts +1 -0
  286. package/dist/sandbox/migrate-worker.mjs +76 -0
  287. package/dist/sandbox/migrate-worker.mjs.map +1 -0
  288. package/dist/{workspace-mFpI_ky_.cjs → schemas-BCwKKA42.mjs} +399 -1162
  289. package/dist/schemas-BCwKKA42.mjs.map +1 -0
  290. package/dist/{workspace-CgwmXEtc.mjs → schemas-BQ_v0lEX.cjs} +487 -971
  291. package/dist/schemas-BQ_v0lEX.cjs.map +1 -0
  292. package/dist/secretsManager-CQORubp9.mjs +97 -0
  293. package/dist/secretsManager-CQORubp9.mjs.map +1 -0
  294. package/dist/secretsManager-RAGcEDX1.cjs +108 -0
  295. package/dist/secretsManager-RAGcEDX1.cjs.map +1 -0
  296. package/dist/seeds-B3xvUAQf.cjs +363 -0
  297. package/dist/seeds-B3xvUAQf.cjs.map +1 -0
  298. package/dist/seeds-BCC8vAXR.mjs +298 -0
  299. package/dist/seeds-BCC8vAXR.mjs.map +1 -0
  300. package/dist/serverSetup-C4iAABtI.mjs +685 -0
  301. package/dist/serverSetup-C4iAABtI.mjs.map +1 -0
  302. package/dist/serverSetup-Dt2DTlwa.cjs +685 -0
  303. package/dist/serverSetup-Dt2DTlwa.cjs.map +1 -0
  304. package/dist/sniffer-C2Ot1IbK.mjs +1824 -0
  305. package/dist/sniffer-C2Ot1IbK.mjs.map +1 -0
  306. package/dist/sniffer-bTrGuu9z.cjs +1997 -0
  307. package/dist/sniffer-bTrGuu9z.cjs.map +1 -0
  308. package/dist/snsSubscriptions-CFKb7fv0.cjs +1173 -0
  309. package/dist/snsSubscriptions-CFKb7fv0.cjs.map +1 -0
  310. package/dist/snsSubscriptions-QDDDn9Qi.mjs +1048 -0
  311. package/dist/snsSubscriptions-QDDDn9Qi.mjs.map +1 -0
  312. package/dist/sst-DDRWlXdv.mjs +478 -0
  313. package/dist/sst-DDRWlXdv.mjs.map +1 -0
  314. package/dist/sst-iRdMlGKd.cjs +501 -0
  315. package/dist/sst-iRdMlGKd.cjs.map +1 -0
  316. package/dist/stack-B9iDYMrq.cjs +2431 -0
  317. package/dist/stack-B9iDYMrq.cjs.map +1 -0
  318. package/dist/stack-CIOY44aC.mjs +2256 -0
  319. package/dist/stack-CIOY44aC.mjs.map +1 -0
  320. package/dist/stage-DA74aD_V.mjs +302 -0
  321. package/dist/stage-DA74aD_V.mjs.map +1 -0
  322. package/dist/stage-ycFS9mVn.cjs +313 -0
  323. package/dist/stage-ycFS9mVn.cjs.map +1 -0
  324. package/dist/stages-B0yOikgt.cjs +190 -0
  325. package/dist/stages-B0yOikgt.cjs.map +1 -0
  326. package/dist/stages-yA9bhStl.mjs +190 -0
  327. package/dist/stages-yA9bhStl.mjs.map +1 -0
  328. package/dist/target/public.cjs +15 -0
  329. package/dist/target/public.d.cts +28 -0
  330. package/dist/target/public.d.cts.map +1 -0
  331. package/dist/target/public.d.mts +28 -0
  332. package/dist/target/public.d.mts.map +1 -0
  333. package/dist/target/public.mjs +4 -0
  334. package/dist/terminal-DX22WLvT.mjs +85 -0
  335. package/dist/terminal-DX22WLvT.mjs.map +1 -0
  336. package/dist/terminal-RxfbNUwl.cjs +85 -0
  337. package/dist/terminal-RxfbNUwl.cjs.map +1 -0
  338. package/dist/types-Bl_CwZC9.cjs +90 -0
  339. package/dist/types-Bl_CwZC9.cjs.map +1 -0
  340. package/dist/{types-kvBQjpPo.d.mts → types-Dk--xVOT.d.cts} +2159 -364
  341. package/dist/types-Dk--xVOT.d.cts.map +1 -0
  342. package/dist/{types-RhXmHR-e.d.cts → types-DwQYpd_0.d.mts} +2157 -364
  343. package/dist/types-DwQYpd_0.d.mts.map +1 -0
  344. package/dist/types-Y1NfWlyG.mjs +61 -0
  345. package/dist/types-Y1NfWlyG.mjs.map +1 -0
  346. package/dist/utils-D2Nk1Nv2.cjs +205 -0
  347. package/dist/utils-D2Nk1Nv2.cjs.map +1 -0
  348. package/dist/utils-D_fxUqvU.mjs +156 -0
  349. package/dist/utils-D_fxUqvU.mjs.map +1 -0
  350. package/dist/vitest.cjs +65 -0
  351. package/dist/vitest.cjs.map +1 -0
  352. package/dist/vitest.d.cts +29 -0
  353. package/dist/vitest.d.cts.map +1 -0
  354. package/dist/vitest.d.mts +29 -0
  355. package/dist/vitest.d.mts.map +1 -0
  356. package/dist/vitest.mjs +65 -0
  357. package/dist/vitest.mjs.map +1 -0
  358. package/dist/workerRuntime-BXfhbe13.cjs +108 -0
  359. package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
  360. package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
  361. package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
  362. package/dist/workspace/index.cjs +6 -2
  363. package/dist/workspace/index.d.cts +3 -3
  364. package/dist/workspace/index.d.mts +3 -3
  365. package/dist/workspace/index.mjs +2 -2
  366. package/dist/workspace-1szcahj9.cjs +2916 -0
  367. package/dist/workspace-1szcahj9.cjs.map +1 -0
  368. package/dist/workspace-DFGsrjGD.mjs +2480 -0
  369. package/dist/workspace-DFGsrjGD.mjs.map +1 -0
  370. package/package.json +65 -13
  371. package/dist/HostingerProvider-BY26bWwB.mjs.map +0 -1
  372. package/dist/HostingerProvider-BZFGYYVA.cjs.map +0 -1
  373. package/dist/LocalStateProvider-7HR6SS2t.cjs +0 -48
  374. package/dist/LocalStateProvider-7HR6SS2t.cjs.map +0 -1
  375. package/dist/LocalStateProvider-D7QyJoLM.mjs +0 -48
  376. package/dist/LocalStateProvider-D7QyJoLM.mjs.map +0 -1
  377. package/dist/Route53Provider-Cvj40A8I.mjs.map +0 -1
  378. package/dist/Route53Provider-DVILBsvV.cjs.map +0 -1
  379. package/dist/SSMStateProvider-B0Hu1MKZ.mjs +0 -75
  380. package/dist/SSMStateProvider-B0Hu1MKZ.mjs.map +0 -1
  381. package/dist/SSMStateProvider-VrQ-yeqd.cjs +0 -74
  382. package/dist/SSMStateProvider-VrQ-yeqd.cjs.map +0 -1
  383. package/dist/backup-provisioner-BmhIO_Yr.cjs.map +0 -1
  384. package/dist/backup-provisioner-DIVCbfee.mjs.map +0 -1
  385. package/dist/bundler-BeNDZdHQ.cjs.map +0 -1
  386. package/dist/bundler-BodTL4kf.mjs.map +0 -1
  387. package/dist/config-Q1rvKHvw.cjs +0 -467
  388. package/dist/config-Q1rvKHvw.cjs.map +0 -1
  389. package/dist/config-pqGD3hF9.mjs +0 -414
  390. package/dist/config-pqGD3hF9.mjs.map +0 -1
  391. package/dist/config.d.cts.map +0 -1
  392. package/dist/config.d.mts.map +0 -1
  393. package/dist/credentials-BekkKtY_.mjs +0 -2780
  394. package/dist/credentials-BekkKtY_.mjs.map +0 -1
  395. package/dist/credentials-Q6F0uqJq.cjs +0 -2917
  396. package/dist/credentials-Q6F0uqJq.cjs.map +0 -1
  397. package/dist/discover-BERGFg8v.cjs +0 -288
  398. package/dist/discover-BERGFg8v.cjs.map +0 -1
  399. package/dist/discover-CK-n3w6b.mjs +0 -244
  400. package/dist/discover-CK-n3w6b.mjs.map +0 -1
  401. package/dist/emit-BdoPFjZf.cjs +0 -253
  402. package/dist/emit-BdoPFjZf.cjs.map +0 -1
  403. package/dist/emit-Bzq7JsMP.mjs +0 -224
  404. package/dist/emit-Bzq7JsMP.mjs.map +0 -1
  405. package/dist/fullstack-secrets-BET8gqwK.mjs +0 -81
  406. package/dist/fullstack-secrets-BET8gqwK.mjs.map +0 -1
  407. package/dist/fullstack-secrets-DXsWO-5m.cjs +0 -92
  408. package/dist/fullstack-secrets-DXsWO-5m.cjs.map +0 -1
  409. package/dist/generator-LfZU7NlU.mjs +0 -247
  410. package/dist/generator-LfZU7NlU.mjs.map +0 -1
  411. package/dist/generator-Wdfp0jCS.cjs +0 -282
  412. package/dist/generator-Wdfp0jCS.cjs.map +0 -1
  413. package/dist/github-BfflNPVe.cjs +0 -203
  414. package/dist/github-BfflNPVe.cjs.map +0 -1
  415. package/dist/github-CRwnxKmD.mjs +0 -203
  416. package/dist/github-CRwnxKmD.mjs.map +0 -1
  417. package/dist/index-C-HkOEBt.d.cts.map +0 -1
  418. package/dist/index-C-VLwB_Y.d.mts.map +0 -1
  419. package/dist/keystore-B4PRlbgE.mjs +0 -81
  420. package/dist/keystore-B4PRlbgE.mjs.map +0 -1
  421. package/dist/keystore-DgGRj2Yy.cjs +0 -98
  422. package/dist/keystore-DgGRj2Yy.cjs.map +0 -1
  423. package/dist/openapi-Dcbme-Us.cjs +0 -2038
  424. package/dist/openapi-Dcbme-Us.cjs.map +0 -1
  425. package/dist/openapi-vy4JzhUv.mjs +0 -1991
  426. package/dist/openapi-vy4JzhUv.mjs.map +0 -1
  427. package/dist/storage-C-30BD1e.cjs +0 -272
  428. package/dist/storage-C-30BD1e.cjs.map +0 -1
  429. package/dist/storage-P_b3w7uj.mjs +0 -231
  430. package/dist/storage-P_b3w7uj.mjs.map +0 -1
  431. package/dist/sync-B3xxXtJT.mjs +0 -88
  432. package/dist/sync-B3xxXtJT.mjs.map +0 -1
  433. package/dist/sync-D7uTIIEi.cjs +0 -111
  434. package/dist/sync-D7uTIIEi.cjs.map +0 -1
  435. package/dist/types-RhXmHR-e.d.cts.map +0 -1
  436. package/dist/types-kvBQjpPo.d.mts.map +0 -1
  437. package/dist/workspace-CgwmXEtc.mjs.map +0 -1
  438. package/dist/workspace-mFpI_ky_.cjs.map +0 -1
@@ -0,0 +1,703 @@
1
+ const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
+ const require_errors = require("./errors-DMC4Umsb.cjs");
3
+ const require_drivers = require("./drivers-BhdC9Efj.cjs");
4
+ let node_path = require("node:path");
5
+ let node_fs_promises = require("node:fs/promises");
6
+ let node_crypto = require("node:crypto");
7
+ let _geekmidas_manifest = require("@geekmidas/manifest");
8
+ let node_module = require("node:module");
9
+ let node_url = require("node:url");
10
+ let pg = require("pg");
11
+ pg = require_rolldown_runtime.__toESM(pg, 1);
12
+ //#region src/migrate/provider.ts
13
+ /**
14
+ * One construct's migrations and seeds, read from its folders.
15
+ *
16
+ * Two kinds of file, told apart by extension rather than by configuration: a
17
+ * script exports `up` (and may export `down`) — or `seed(db, { stage })`, in
18
+ * `seeds/` — and a
19
+ * `.sql` file is run whole. The second is what makes a folder independent of
20
+ * the client the app uses — Better Auth's schema is SQL whatever the
21
+ * application queries with.
22
+ */
23
+ const SCRIPTS = /* @__PURE__ */ new Set([
24
+ ".ts",
25
+ ".mts",
26
+ ".js",
27
+ ".mjs"
28
+ ]);
29
+ /** Two files in one folder that would be one migration. */
30
+ var DuplicateMigration = class extends require_errors.GkmError {
31
+ folder;
32
+ migration;
33
+ constructor(folder, migration) {
34
+ 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.`);
35
+ this.folder = folder;
36
+ this.migration = migration;
37
+ this.name = "DuplicateMigration";
38
+ }
39
+ };
40
+ /** A script in a migrations folder that exports no `up`. */
41
+ var MigrationHasNoUp = class extends require_errors.GkmError {
42
+ file;
43
+ constructor(file) {
44
+ 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.`);
45
+ this.file = file;
46
+ this.name = "MigrationHasNoUp";
47
+ }
48
+ };
49
+ /** A script in a seeds folder that exports no `seed`. */
50
+ var SeedHasNoSeed = class extends require_errors.GkmError {
51
+ file;
52
+ constructor(file) {
53
+ 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.`);
54
+ this.file = file;
55
+ this.name = "SeedHasNoSeed";
56
+ }
57
+ };
58
+ /**
59
+ * The migration files in a folder, by name, without reading them.
60
+ *
61
+ * Also what `gkm dev` compares against a construct's history to report what
62
+ * is pending, which is why it is separate from loading them.
63
+ */
64
+ async function migrationFiles(folder) {
65
+ const entries = await (0, node_fs_promises.readdir)(folder, { withFileTypes: true }).catch((error) => {
66
+ if (error.code === "ENOENT") return [];
67
+ throw error;
68
+ });
69
+ const files = /* @__PURE__ */ new Map();
70
+ for (const entry of entries) {
71
+ if (!entry.isFile() || !isMigration(entry.name)) continue;
72
+ const name = entry.name.slice(0, -(0, node_path.extname)(entry.name).length);
73
+ if (files.has(name)) throw new DuplicateMigration(folder, name);
74
+ files.set(name, (0, node_path.join)(folder, entry.name));
75
+ }
76
+ return files;
77
+ }
78
+ /** A Kysely provider over one construct's folder. */
79
+ function folderProvider(folder, raw) {
80
+ return { async getMigrations() {
81
+ const migrations = {};
82
+ for (const [name, file] of await migrationFiles(folder)) migrations[name] = (0, node_path.extname)(file) === ".sql" ? await sqlMigration(file, raw) : await scriptMigration(file);
83
+ return migrations;
84
+ } };
85
+ }
86
+ /**
87
+ * The seeds in a folder, loaded, in name order.
88
+ *
89
+ * Every one runs on every pass — there is no history to consult — so the order
90
+ * is the only thing between two seeds where one reads what another writes.
91
+ * Name them to sort that way.
92
+ */
93
+ async function loadSeeds(folder, raw) {
94
+ const files = [...await migrationFiles(folder)].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
95
+ const seeds = [];
96
+ for (const [name, file] of files) seeds.push({
97
+ name,
98
+ run: (0, node_path.extname)(file) === ".sql" ? (await sqlMigration(file, raw)).up : await scriptSeed(file)
99
+ });
100
+ return seeds;
101
+ }
102
+ /**
103
+ * A seed script, imported as it is on disk now.
104
+ *
105
+ * Keyed by its modification time: a seed is run again after it is edited, and
106
+ * a process that has imported it once would otherwise run the old one.
107
+ */
108
+ async function scriptSeed(file) {
109
+ const url = (0, node_url.pathToFileURL)(file);
110
+ url.searchParams.set("mtime", String((await (0, node_fs_promises.stat)(file)).mtimeMs));
111
+ const module = await import(url.href);
112
+ if (typeof module.seed !== "function") throw new SeedHasNoSeed(file);
113
+ return module.seed;
114
+ }
115
+ function isMigration(file) {
116
+ if (file.endsWith(".d.ts")) return false;
117
+ if (/\.(spec|test)\.[cm]?[jt]s$/.test(file)) return false;
118
+ const extension = (0, node_path.extname)(file);
119
+ return extension === ".sql" || SCRIPTS.has(extension);
120
+ }
121
+ async function scriptMigration(file) {
122
+ const module = await import((0, node_url.pathToFileURL)(file).href);
123
+ if (typeof module.up !== "function") throw new MigrationHasNoUp(file);
124
+ return {
125
+ up: module.up,
126
+ ...typeof module.down === "function" ? { down: module.down } : {}
127
+ };
128
+ }
129
+ /**
130
+ * A `.sql` file, run whole.
131
+ *
132
+ * One query rather than split on `;`: with no parameters, Postgres takes
133
+ * several statements in one message, and splitting by hand breaks on the first
134
+ * `;` inside a string or a function body. There is no `down` — a generated
135
+ * schema is rolled back by a migration that says how, not by guessing.
136
+ */
137
+ async function sqlMigration(file, raw) {
138
+ const statements = await (0, node_fs_promises.readFile)(file, "utf-8");
139
+ return { up: async (db) => {
140
+ await raw.raw(statements).execute(db);
141
+ } };
142
+ }
143
+ //#endregion
144
+ //#region src/migrate/seedDrivers.ts
145
+ /**
146
+ * The drivers a seed run registers before any seed runs.
147
+ *
148
+ * The seed runner is an entry point gkm owns, like the generated server and
149
+ * the test harness, so it registers what they register — from the same
150
+ * {@link driversFor}, so the two cannot drift. A seed then reaches a bucket or
151
+ * a cache through the construct's service, exactly as a handler does, and no
152
+ * application code names a provider.
153
+ *
154
+ * The registrations are written to a module under `.gkm/` and imported from
155
+ * there, rather than imported by gkm itself: a registry is a module-level map,
156
+ * so it has to be the copy the app's constructs resolve — which is the one a
157
+ * bare specifier finds from the project root, not the one beside gkm.
158
+ */
159
+ /** The drivers a seed run needs could not be loaded from the project. */
160
+ var SeedDriversUnresolved = class extends require_errors.GkmError {
161
+ root;
162
+ cause;
163
+ constructor(root, cause) {
164
+ super(`Could not load the drivers seeds run with from ${root} — ${cause instanceof Error ? cause.message : String(cause)}. They are the ones the app's own entry registers; install the package it names where the project's constructs are declared.`);
165
+ this.root = root;
166
+ this.cause = cause;
167
+ this.name = "SeedDriversUnresolved";
168
+ }
169
+ };
170
+ /**
171
+ * Register the drivers a generated entry for this project would: storage when
172
+ * it installs `@geekmidas/storage`, the cache backend its caches resolve to,
173
+ * and the broker its topics and queues do. Nothing when it declares none.
174
+ */
175
+ async function registerSeedDrivers(options) {
176
+ const drivers = require_drivers.driversFor({
177
+ appRoot: options.root,
178
+ cache: require_drivers.cacheBackendsIn(options.manifest, options.backends.cache),
179
+ events: require_drivers.eventsBackendsIn(options.manifest, options.backends.events)
180
+ });
181
+ if (!drivers.setup) return;
182
+ const content = `${drivers.imports}\n\n${drivers.setup}\n`;
183
+ const dir = (0, node_path.join)(options.root, ".gkm");
184
+ const file = (0, node_path.join)(dir, "seed-drivers.mjs");
185
+ await (0, node_fs_promises.mkdir)(dir, { recursive: true });
186
+ await (0, node_fs_promises.writeFile)(file, content);
187
+ const url = (0, node_url.pathToFileURL)(file);
188
+ url.searchParams.set("v", (0, node_crypto.createHash)("sha256").update(content).digest("hex").slice(0, 12));
189
+ try {
190
+ await import(url.href);
191
+ } catch (error) {
192
+ throw new SeedDriversUnresolved(options.root, error);
193
+ }
194
+ }
195
+ //#endregion
196
+ //#region src/migrate/databases.ts
197
+ /**
198
+ * Bring each construct's schema up to its migrations folder.
199
+ *
200
+ * Which constructs, in what order, from which folder, is `migrationTargets`'
201
+ * answer and nobody else's. What is decided here is only how one target is
202
+ * run: as its owner, in its own schema, with a history of its own.
203
+ */
204
+ /** A folder under `db/` that names no construct. */
205
+ var UnknownMigrationFolder = class extends require_errors.GkmError {
206
+ folder;
207
+ known;
208
+ constructor(folder, known) {
209
+ 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.`);
210
+ this.folder = folder;
211
+ this.known = known;
212
+ this.name = "UnknownMigrationFolder";
213
+ }
214
+ };
215
+ /** A construct was asked for by a name that takes no migrations. */
216
+ var NoSuchMigrationTarget = class extends require_errors.GkmError {
217
+ construct;
218
+ known;
219
+ constructor(construct, known) {
220
+ super(`'${construct}' is not a database construct. ` + (known.length > 0 ? `The ones with migrations: ${known.join(", ")}.` : "This project declares no database."));
221
+ this.construct = construct;
222
+ this.known = known;
223
+ this.name = "NoSuchMigrationTarget";
224
+ }
225
+ };
226
+ /**
227
+ * A migration left directly in a construct's folder, where nothing reads it.
228
+ *
229
+ * Migrations moved into `migrations/` so seeds could sit beside them. A file
230
+ * still at the old level would otherwise never run, and nothing would say so.
231
+ */
232
+ var MigrationsOutsideFolder = class extends require_errors.GkmError {
233
+ folder;
234
+ files;
235
+ constructor(folder, files) {
236
+ 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.`);
237
+ this.folder = folder;
238
+ this.files = files;
239
+ this.name = "MigrationsOutsideFolder";
240
+ }
241
+ };
242
+ /** A folder inside a construct's folder that is neither `migrations` nor `seeds`. */
243
+ var UnknownDatabaseFolder = class extends require_errors.GkmError {
244
+ folder;
245
+ constructor(folder) {
246
+ 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.`);
247
+ this.folder = folder;
248
+ this.name = "UnknownDatabaseFolder";
249
+ }
250
+ };
251
+ /** A seed failed; its own writes are rolled back, the ones before it stay. */
252
+ var SeedFailed = class extends Error {
253
+ construct;
254
+ seed;
255
+ cause;
256
+ constructor(construct, seed, cause) {
257
+ super(`${construct}: seed '${seed}' failed — ${cause instanceof Error ? cause.message : String(cause)}. Its writes were rolled back; fix it and run it again.`);
258
+ this.construct = construct;
259
+ this.seed = seed;
260
+ this.cause = cause;
261
+ this.name = "SeedFailed";
262
+ }
263
+ };
264
+ /** A construct with roles has no owner URL to migrate with. */
265
+ var NoOwnerCredential = class extends require_errors.GkmError {
266
+ construct;
267
+ key;
268
+ constructor(construct, key) {
269
+ 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?`);
270
+ this.construct = construct;
271
+ this.key = key;
272
+ this.name = "NoOwnerCredential";
273
+ }
274
+ };
275
+ /** A migration failed; the ones before it in the run stay applied. */
276
+ var MigrationFailed = class extends Error {
277
+ construct;
278
+ migration;
279
+ cause;
280
+ constructor(construct, migration, cause) {
281
+ super(`${construct}: migration ${migration ? `'${migration}' ` : ""}failed — ${cause instanceof Error ? cause.message : String(cause)}`);
282
+ this.construct = construct;
283
+ this.migration = migration;
284
+ this.cause = cause;
285
+ this.name = "MigrationFailed";
286
+ }
287
+ };
288
+ /** The project's Kysely could not be found from where a database is declared. */
289
+ var KyselyNotFound = class extends require_errors.GkmError {
290
+ from;
291
+ constructor(from) {
292
+ super(`Could not resolve 'kysely' from ${from}. Migrations run with the project's own Kysely — install it where the database is declared.`);
293
+ this.from = from;
294
+ this.name = "KyselyNotFound";
295
+ }
296
+ };
297
+ /** Apply every pending migration, construct by construct, parents first. */
298
+ async function migrateDatabases(options) {
299
+ const runs = [];
300
+ for (const target of await targetsFor(options)) {
301
+ if ((await migrationFiles((0, node_path.join)(options.root, target.migrations))).size === 0) {
302
+ runs.push({
303
+ target,
304
+ applied: []
305
+ });
306
+ continue;
307
+ }
308
+ const applied = await withMigrator(options, target, async (migrator) => {
309
+ const { error, results = [] } = await migrator.migrateToLatest();
310
+ if (error) {
311
+ const failed = results.find((result) => result.status === "Error");
312
+ throw new MigrationFailed(target.id, failed?.migrationName, error);
313
+ }
314
+ return results.filter((result) => result.status === "Success").map((result) => result.migrationName);
315
+ });
316
+ runs.push({
317
+ target,
318
+ applied
319
+ });
320
+ }
321
+ return runs;
322
+ }
323
+ /**
324
+ * Run every construct's seeds, parents first — each one, every time, on every
325
+ * stage, production included. Each is handed the stage, so a seed decides
326
+ * what belongs where.
327
+ *
328
+ * Seeds are reference data kept up to date by being run again, so there is no
329
+ * history: a seed is an upsert, and a changed one is applied by the next run.
330
+ * Each runs in its own transaction, as the construct's owner, so a failure
331
+ * leaves nothing half-written. Assumes the schema is migrated —
332
+ * {@link migrateAndSeed} is what makes that true.
333
+ *
334
+ * A seed is handed the client the app gets — the construct's `clientConfig`,
335
+ * plugins included — on the owner's connection. One written against
336
+ * `Kysely<DB>` with a `CamelCasePlugin` writes `isEditable` here as it does in
337
+ * a handler or a test.
338
+ *
339
+ * And with the drivers the stage's entry registers, and the stage's `env`, so
340
+ * a seed reaching a bucket or a cache through its construct gets the client a
341
+ * handler would.
342
+ */
343
+ async function seedDatabases(options) {
344
+ const runs = [];
345
+ let registered = false;
346
+ for (const target of await targetsFor(options)) {
347
+ const folder = (0, node_path.join)(options.root, target.seeds);
348
+ if ((await migrationFiles(folder)).size === 0) {
349
+ runs.push({
350
+ target,
351
+ seeded: []
352
+ });
353
+ continue;
354
+ }
355
+ if (!registered) {
356
+ await registerSeedDrivers(options);
357
+ registered = true;
358
+ }
359
+ const seeded = await withOwner(options, target, clientConfigOf(options, target), async (db, kysely) => {
360
+ const names = [];
361
+ for (const seed of await loadSeeds(folder, kysely.sql)) {
362
+ try {
363
+ await db.transaction().execute((trx) => seed.run(trx, {
364
+ stage: options.stage,
365
+ env: options.env
366
+ }));
367
+ } catch (error) {
368
+ throw new SeedFailed(target.id, seed.name, error);
369
+ }
370
+ names.push(seed.name);
371
+ }
372
+ return names;
373
+ });
374
+ runs.push({
375
+ target,
376
+ seeded
377
+ });
378
+ }
379
+ return runs;
380
+ }
381
+ /**
382
+ * The seeds {@link seedDatabases} would run, construct by construct, parents
383
+ * first, in the order it would run them — read from the folders alone, with
384
+ * no connection. What a dry run lists. Constructs with none are left out.
385
+ */
386
+ async function plannedSeeds(options) {
387
+ const planned = [];
388
+ for (const target of await targetsFor(options)) {
389
+ const files = await migrationFiles((0, node_path.join)(options.root, target.seeds));
390
+ if (files.size === 0) continue;
391
+ planned.push({
392
+ target,
393
+ seeds: [...files.keys()].sort()
394
+ });
395
+ }
396
+ return planned;
397
+ }
398
+ /**
399
+ * Migrate, then seed: a seed only ever runs against the schema it was written
400
+ * for.
401
+ *
402
+ * With `only`, the constructs it lives in are migrated too — a tenant's seed
403
+ * cannot run before the database that owns its schema exists — and only it is
404
+ * seeded.
405
+ */
406
+ async function migrateAndSeed(options) {
407
+ const migrations = [];
408
+ for (const target of await withParents(options)) migrations.push(...await migrateDatabases({
409
+ ...options,
410
+ only: target.id
411
+ }));
412
+ return {
413
+ migrations,
414
+ seeds: await seedDatabases(options)
415
+ };
416
+ }
417
+ /** The targets `only` names, after the ones it lives in; all without it. */
418
+ async function withParents(options) {
419
+ const chosen = await targetsFor(options);
420
+ if (!options.only) return chosen;
421
+ const all = (0, _geekmidas_manifest.migrationTargets)(options.manifest);
422
+ const ids = /* @__PURE__ */ new Set();
423
+ for (const target of chosen) {
424
+ let current = target;
425
+ while (current) {
426
+ ids.add(current.id);
427
+ const parent = current.of;
428
+ current = parent ? all.find((t) => t.id === parent) : void 0;
429
+ }
430
+ }
431
+ return all.filter((target) => ids.has(target.id));
432
+ }
433
+ /**
434
+ * What each construct's folder has that its history does not — without
435
+ * applying any of it. What `gkm dev` reports.
436
+ */
437
+ async function pendingMigrations(options) {
438
+ const found = [];
439
+ for (const target of await targetsFor(options)) {
440
+ if ((await migrationFiles((0, node_path.join)(options.root, target.migrations))).size === 0) continue;
441
+ const pending = await withMigrator(options, target, async (migrator) => (await migrator.getMigrations()).filter((migration) => migration.executedAt === void 0).map((migration) => migration.name));
442
+ if (pending.length > 0) found.push({
443
+ target,
444
+ pending
445
+ });
446
+ }
447
+ return found;
448
+ }
449
+ /**
450
+ * The targets this run covers, with every folder under `db/` accounted for.
451
+ *
452
+ * A folder that names no construct is an error rather than something to skip:
453
+ * a typo in its name is otherwise a migration that silently never runs.
454
+ */
455
+ async function targetsFor(options) {
456
+ const targets = (0, _geekmidas_manifest.migrationTargets)(options.manifest);
457
+ const folders = targets.map((target) => target.folder);
458
+ for (const folder of await foldersIn((0, node_path.join)(options.root, _geekmidas_manifest.MIGRATIONS_ROOT))) {
459
+ const relative = `${_geekmidas_manifest.MIGRATIONS_ROOT}/${folder}`;
460
+ if (!folders.includes(relative)) throw new UnknownMigrationFolder(relative, folders);
461
+ await checkLayout(options.root, relative);
462
+ }
463
+ if (!options.only) return targets;
464
+ const id = (0, _geekmidas_manifest.canonicalId)(options.only);
465
+ const chosen = targets.filter((target) => target.id === id);
466
+ if (chosen.length === 0) throw new NoSuchMigrationTarget(options.only, targets.map((target) => target.id));
467
+ return chosen;
468
+ }
469
+ /**
470
+ * A construct's folder holds `migrations/` and `seeds/`, and nothing else —
471
+ * anything beside them is a file or folder nothing would ever run.
472
+ */
473
+ async function checkLayout(root, folder) {
474
+ const entries = await (0, node_fs_promises.readdir)((0, node_path.join)(root, folder), { withFileTypes: true });
475
+ const loose = entries.filter((entry) => entry.isFile() && !entry.name.startsWith(".")).map((entry) => entry.name);
476
+ if (loose.length > 0) throw new MigrationsOutsideFolder(folder, loose);
477
+ for (const entry of entries) if (entry.isDirectory() && !_geekmidas_manifest.DATABASE_FOLDERS.includes(entry.name)) throw new UnknownDatabaseFolder(`${folder}/${entry.name}`);
478
+ }
479
+ async function foldersIn(dir) {
480
+ return (await (0, node_fs_promises.readdir)(dir, { withFileTypes: true }).catch((error) => {
481
+ if (error.code === "ENOENT") return [];
482
+ throw error;
483
+ })).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
484
+ }
485
+ /**
486
+ * A migrator for one target, connected as its owner.
487
+ *
488
+ * No `migrationTableSchema`: the owner role's `search_path` is pinned to the
489
+ * construct's schema, so the history lands there — `app.kysely_migration` for
490
+ * the database, `auth_database.kysely_migration` for its tenant — and two
491
+ * constructs in one Postgres never share one.
492
+ *
493
+ * Unordered migrations are allowed. Files are timestamped, so a branch merged
494
+ * after another's migration ran carries an older one; refusing it would make
495
+ * every such merge a manual repair.
496
+ *
497
+ * The client is bare — none of the construct's plugins. A casing plugin
498
+ * rewrites identifiers in schema-builder DDL too, and a migration must do the
499
+ * same thing forever after it has run, so it cannot depend on configuration
500
+ * that may change.
501
+ */
502
+ async function withMigrator(options, target, run) {
503
+ return withOwner(options, target, {}, (db, { Migrator, sql }) => run(new Migrator({
504
+ db,
505
+ provider: folderProvider((0, node_path.join)(options.root, target.migrations), sql),
506
+ allowUnorderedMigrations: true
507
+ })));
508
+ }
509
+ /**
510
+ * One target's database, connected as its owner and closed afterwards — what
511
+ * migrations and seeds both run as, each with the client config it needs.
512
+ */
513
+ async function withOwner(options, target, config, run) {
514
+ 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"));
515
+ const db = new kysely.Kysely({
516
+ ...config,
517
+ dialect: new kysely.PostgresDialect({ pool: new pg.default.Pool(poolConfig(ownerUrl(options, target))) })
518
+ });
519
+ try {
520
+ return await run(db, kysely);
521
+ } finally {
522
+ await db.destroy();
523
+ }
524
+ }
525
+ /**
526
+ * What the construct builds its clients with besides a dialect — its plugins
527
+ * and logging — read from the construct discovery already imported.
528
+ *
529
+ * A tenant's is its own: `database.schema('Auth', { plugins })` declares the
530
+ * client for its tables, not the parent's. With no construct to ask (a
531
+ * manifest without sources), the client is bare.
532
+ */
533
+ function clientConfigOf(options, target) {
534
+ const construct = options.sources?.[target.id]?.construct;
535
+ if (typeof construct !== "object" || construct === null) return {};
536
+ if (!("clientConfig" in construct)) return {};
537
+ return construct.clientConfig ?? {};
538
+ }
539
+ /**
540
+ * The owner's URL, with no fallback to the runtime one.
541
+ *
542
+ * The runtime role can create nothing, so falling back would only move the
543
+ * failure to the first `CREATE TABLE` and make it read like a permissions
544
+ * bug. The one exception is a database declared `roles: false`, where there is
545
+ * no owner — both URLs are the master credential by design.
546
+ */
547
+ function ownerUrl(options, target) {
548
+ const key = (0, _geekmidas_manifest.provideKey)(target.id, "ownerUrl");
549
+ const owner = options.env[key];
550
+ if (owner) return owner;
551
+ const database = options.manifest[target.of ?? target.id];
552
+ if (database?.kind === "database" && database.roles === false) {
553
+ const url = options.env[(0, _geekmidas_manifest.provideKey)(target.id, "url")];
554
+ if (url) return url;
555
+ }
556
+ throw new NoOwnerCredential(target.id, key);
557
+ }
558
+ /**
559
+ * Pool settings for a URL, with `?search_path=` as the startup option Postgres
560
+ * reads. Only a `roles: false` URL carries it — a role pins its own.
561
+ */
562
+ function poolConfig(url) {
563
+ const parsed = new URL(url);
564
+ const searchPath = parsed.searchParams.get("search_path");
565
+ if (!searchPath) return { connectionString: url };
566
+ parsed.searchParams.delete("search_path");
567
+ return {
568
+ connectionString: parsed.toString(),
569
+ options: `-c search_path=${searchPath}`
570
+ };
571
+ }
572
+ /** Kysely as the project resolves it from `from`. */
573
+ async function kyselyFrom(from) {
574
+ const require$1 = (0, node_module.createRequire)(from);
575
+ try {
576
+ 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)]);
577
+ return {
578
+ Kysely: main.Kysely,
579
+ PostgresDialect: main.PostgresDialect,
580
+ sql: main.sql,
581
+ Migrator: migration.Migrator
582
+ };
583
+ } catch {
584
+ throw new KyselyNotFound(from);
585
+ }
586
+ }
587
+ //#endregion
588
+ Object.defineProperty(exports, "DuplicateMigration", {
589
+ enumerable: true,
590
+ get: function() {
591
+ return DuplicateMigration;
592
+ }
593
+ });
594
+ Object.defineProperty(exports, "KyselyNotFound", {
595
+ enumerable: true,
596
+ get: function() {
597
+ return KyselyNotFound;
598
+ }
599
+ });
600
+ Object.defineProperty(exports, "MigrationFailed", {
601
+ enumerable: true,
602
+ get: function() {
603
+ return MigrationFailed;
604
+ }
605
+ });
606
+ Object.defineProperty(exports, "MigrationHasNoUp", {
607
+ enumerable: true,
608
+ get: function() {
609
+ return MigrationHasNoUp;
610
+ }
611
+ });
612
+ Object.defineProperty(exports, "MigrationsOutsideFolder", {
613
+ enumerable: true,
614
+ get: function() {
615
+ return MigrationsOutsideFolder;
616
+ }
617
+ });
618
+ Object.defineProperty(exports, "NoOwnerCredential", {
619
+ enumerable: true,
620
+ get: function() {
621
+ return NoOwnerCredential;
622
+ }
623
+ });
624
+ Object.defineProperty(exports, "NoSuchMigrationTarget", {
625
+ enumerable: true,
626
+ get: function() {
627
+ return NoSuchMigrationTarget;
628
+ }
629
+ });
630
+ Object.defineProperty(exports, "SeedDriversUnresolved", {
631
+ enumerable: true,
632
+ get: function() {
633
+ return SeedDriversUnresolved;
634
+ }
635
+ });
636
+ Object.defineProperty(exports, "SeedFailed", {
637
+ enumerable: true,
638
+ get: function() {
639
+ return SeedFailed;
640
+ }
641
+ });
642
+ Object.defineProperty(exports, "SeedHasNoSeed", {
643
+ enumerable: true,
644
+ get: function() {
645
+ return SeedHasNoSeed;
646
+ }
647
+ });
648
+ Object.defineProperty(exports, "UnknownDatabaseFolder", {
649
+ enumerable: true,
650
+ get: function() {
651
+ return UnknownDatabaseFolder;
652
+ }
653
+ });
654
+ Object.defineProperty(exports, "UnknownMigrationFolder", {
655
+ enumerable: true,
656
+ get: function() {
657
+ return UnknownMigrationFolder;
658
+ }
659
+ });
660
+ Object.defineProperty(exports, "migrateAndSeed", {
661
+ enumerable: true,
662
+ get: function() {
663
+ return migrateAndSeed;
664
+ }
665
+ });
666
+ Object.defineProperty(exports, "migrateDatabases", {
667
+ enumerable: true,
668
+ get: function() {
669
+ return migrateDatabases;
670
+ }
671
+ });
672
+ Object.defineProperty(exports, "migrationFiles", {
673
+ enumerable: true,
674
+ get: function() {
675
+ return migrationFiles;
676
+ }
677
+ });
678
+ Object.defineProperty(exports, "pendingMigrations", {
679
+ enumerable: true,
680
+ get: function() {
681
+ return pendingMigrations;
682
+ }
683
+ });
684
+ Object.defineProperty(exports, "plannedSeeds", {
685
+ enumerable: true,
686
+ get: function() {
687
+ return plannedSeeds;
688
+ }
689
+ });
690
+ Object.defineProperty(exports, "registerSeedDrivers", {
691
+ enumerable: true,
692
+ get: function() {
693
+ return registerSeedDrivers;
694
+ }
695
+ });
696
+ Object.defineProperty(exports, "seedDatabases", {
697
+ enumerable: true,
698
+ get: function() {
699
+ return seedDatabases;
700
+ }
701
+ });
702
+
703
+ //# sourceMappingURL=databases-CrKh5jw6.cjs.map