@geekmidas/cli 10.0.0-alpha.141 → 10.0.0-alpha.142

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 (260) hide show
  1. package/dist/{EndpointGenerator-BMRL04ic.mjs → EndpointGenerator-CusLH-9S.mjs} +2 -2
  2. package/dist/{EndpointGenerator-BMRL04ic.mjs.map → EndpointGenerator-CusLH-9S.mjs.map} +1 -1
  3. package/dist/{EndpointGenerator-ePscnbwB.cjs → EndpointGenerator-DyLMYClE.cjs} +2 -2
  4. package/dist/{EndpointGenerator-ePscnbwB.cjs.map → EndpointGenerator-DyLMYClE.cjs.map} +1 -1
  5. package/dist/{GoDaddyProvider-DxFAueU4.mjs → GoDaddyProvider-BIibcRG4.mjs} +2 -3
  6. package/dist/{GoDaddyProvider-DxFAueU4.mjs.map → GoDaddyProvider-BIibcRG4.mjs.map} +1 -1
  7. package/dist/{GoDaddyProvider-hAc0q5s-.cjs → GoDaddyProvider-C7Zt4dVy.cjs} +5 -6
  8. package/dist/{GoDaddyProvider-hAc0q5s-.cjs.map → GoDaddyProvider-C7Zt4dVy.cjs.map} +1 -1
  9. package/dist/{HostingerProvider-DEqpvoiD.cjs → HostingerProvider-BVhFhzCW.cjs} +2 -2
  10. package/dist/{HostingerProvider-DEqpvoiD.cjs.map → HostingerProvider-BVhFhzCW.cjs.map} +1 -1
  11. package/dist/{HostingerProvider-CgMuKgO_.mjs → HostingerProvider-DSHpNBim.mjs} +2 -2
  12. package/dist/{HostingerProvider-CgMuKgO_.mjs.map → HostingerProvider-DSHpNBim.mjs.map} +1 -1
  13. package/dist/{LegacyStateStore-BPY8Acgs.mjs → LegacyStateStore-Bd2I3zz7.mjs} +3 -3
  14. package/dist/{LegacyStateStore-BPY8Acgs.mjs.map → LegacyStateStore-Bd2I3zz7.mjs.map} +1 -1
  15. package/dist/{LegacyStateStore-BqSVgWi1.cjs → LegacyStateStore-DzRGMFhs.cjs} +3 -3
  16. package/dist/{LegacyStateStore-BqSVgWi1.cjs.map → LegacyStateStore-DzRGMFhs.cjs.map} +1 -1
  17. package/dist/{LocalStateStore-Df4RyGi2.cjs → LocalStateStore-Ci_tzIfp.cjs} +2 -2
  18. package/dist/{LocalStateStore-Df4RyGi2.cjs.map → LocalStateStore-Ci_tzIfp.cjs.map} +1 -1
  19. package/dist/{LocalStateStore-5pVR26KA.mjs → LocalStateStore-CzNrVQd2.mjs} +2 -2
  20. package/dist/{LocalStateStore-5pVR26KA.mjs.map → LocalStateStore-CzNrVQd2.mjs.map} +1 -1
  21. package/dist/{OpenApiTsGenerator-B-PQLx8X.mjs → OpenApiTsGenerator-BTMuu1WS.mjs} +2 -2
  22. package/dist/{OpenApiTsGenerator-B-PQLx8X.mjs.map → OpenApiTsGenerator-BTMuu1WS.mjs.map} +1 -1
  23. package/dist/{OpenApiTsGenerator-BvacdbiG.cjs → OpenApiTsGenerator-CI-tceXV.cjs} +2 -2
  24. package/dist/{OpenApiTsGenerator-BvacdbiG.cjs.map → OpenApiTsGenerator-CI-tceXV.cjs.map} +1 -1
  25. package/dist/{S3StateStore-Do1DwEMX.mjs → S3StateStore-DVtcCMEc.mjs} +4 -4
  26. package/dist/{S3StateStore-Do1DwEMX.mjs.map → S3StateStore-DVtcCMEc.mjs.map} +1 -1
  27. package/dist/{S3StateStore-uykstvZI.cjs → S3StateStore-LrKb9lH7.cjs} +5 -5
  28. package/dist/{S3StateStore-uykstvZI.cjs.map → S3StateStore-LrKb9lH7.cjs.map} +1 -1
  29. package/dist/{SSMStateStore-xQ-Ce91W.mjs → SSMStateStore-CNHYH6g7.mjs} +2 -2
  30. package/dist/{SSMStateStore-xQ-Ce91W.mjs.map → SSMStateStore-CNHYH6g7.mjs.map} +1 -1
  31. package/dist/{SSMStateStore-DQXFWqkE.cjs → SSMStateStore-CpkvL95K.cjs} +2 -2
  32. package/dist/{SSMStateStore-DQXFWqkE.cjs.map → SSMStateStore-CpkvL95K.cjs.map} +1 -1
  33. package/dist/{SubscriberGenerator-DR4Y7ihK.cjs → SubscriberGenerator-BNJyPmXJ.cjs} +3 -3
  34. package/dist/{SubscriberGenerator-DR4Y7ihK.cjs.map → SubscriberGenerator-BNJyPmXJ.cjs.map} +1 -1
  35. package/dist/{SubscriberGenerator-DLPH-ynS.mjs → SubscriberGenerator-CzPrixYu.mjs} +3 -3
  36. package/dist/{SubscriberGenerator-DLPH-ynS.mjs.map → SubscriberGenerator-CzPrixYu.mjs.map} +1 -1
  37. package/dist/{add-Y_nPkjIf.cjs → add-AlV6_ljM.cjs} +18 -17
  38. package/dist/{add-Y_nPkjIf.cjs.map → add-AlV6_ljM.cjs.map} +1 -1
  39. package/dist/{add-DLkN488n.mjs → add-B51nMuUd.mjs} +8 -7
  40. package/dist/{add-DLkN488n.mjs.map → add-B51nMuUd.mjs.map} +1 -1
  41. package/dist/apps-C1KiJqth.mjs +4593 -0
  42. package/dist/apps-C1KiJqth.mjs.map +1 -0
  43. package/dist/apps-CPdR2pYw.cjs +5002 -0
  44. package/dist/apps-CPdR2pYw.cjs.map +1 -0
  45. package/dist/{bundler-COOvv27I.cjs → bundler-B-hw8rJi.cjs} +9 -9
  46. package/dist/{bundler-COOvv27I.cjs.map → bundler-B-hw8rJi.cjs.map} +1 -1
  47. package/dist/{bundler-DFyrGST-.mjs → bundler-DbIt3a6I.mjs} +6 -6
  48. package/dist/{bundler-DFyrGST-.mjs.map → bundler-DbIt3a6I.mjs.map} +1 -1
  49. package/dist/{cli-DKsV-Myw.cjs → cli-6eYxU_Q2.cjs} +4 -4
  50. package/dist/{cli-DKsV-Myw.cjs.map → cli-6eYxU_Q2.cjs.map} +1 -1
  51. package/dist/{cli-iAX4BQ3t.mjs → cli-CmmrPCM_.mjs} +4 -4
  52. package/dist/{cli-iAX4BQ3t.mjs.map → cli-CmmrPCM_.mjs.map} +1 -1
  53. package/dist/compose-B2dCLbrc.cjs +1895 -0
  54. package/dist/compose-B2dCLbrc.cjs.map +1 -0
  55. package/dist/{compose-ofZIpp2q.mjs → compose-DVARqEeR.mjs} +16 -1828
  56. package/dist/compose-DVARqEeR.mjs.map +1 -0
  57. package/dist/{compose-CGXx22Wy.cjs → compose-D_fNsrkx.cjs} +101 -1967
  58. package/dist/compose-D_fNsrkx.cjs.map +1 -0
  59. package/dist/compose-kOpW9Pa1.mjs +1554 -0
  60. package/dist/compose-kOpW9Pa1.mjs.map +1 -0
  61. package/dist/config-BKpzKP6W.mjs +659 -0
  62. package/dist/config-BKpzKP6W.mjs.map +1 -0
  63. package/dist/config-QAqAEgb0.cjs +772 -0
  64. package/dist/config-QAqAEgb0.cjs.map +1 -0
  65. package/dist/config.cjs +16 -419
  66. package/dist/config.mjs +2 -405
  67. package/dist/{credentialSchemas-DZ2Nh5li.cjs → credentialSchemas-BAklWDna.cjs} +4 -5
  68. package/dist/{credentialSchemas-DZ2Nh5li.cjs.map → credentialSchemas-BAklWDna.cjs.map} +1 -1
  69. package/dist/{credentialSchemas-DUCSYl9a.mjs → credentialSchemas-mz9QZTYh.mjs} +2 -3
  70. package/dist/{credentialSchemas-DUCSYl9a.mjs.map → credentialSchemas-mz9QZTYh.mjs.map} +1 -1
  71. package/dist/credentials-CIpa4Hgs.cjs +2336 -0
  72. package/dist/credentials-CIpa4Hgs.cjs.map +1 -0
  73. package/dist/credentials-CWa7hRXd.mjs +1851 -0
  74. package/dist/credentials-CWa7hRXd.mjs.map +1 -0
  75. package/dist/{databases-P824RTnx.cjs → databases-DawSdqBI.cjs} +2 -2
  76. package/dist/{databases-P824RTnx.cjs.map → databases-DawSdqBI.cjs.map} +1 -1
  77. package/dist/{databases-Db48ZIXL.mjs → databases-mzSUFBTw.mjs} +2 -2
  78. package/dist/{databases-Db48ZIXL.mjs.map → databases-mzSUFBTw.mjs.map} +1 -1
  79. package/dist/deploy/public.cjs +24 -24
  80. package/dist/deploy/public.cjs.map +1 -1
  81. package/dist/deploy/public.d.cts.map +1 -1
  82. package/dist/deploy/public.d.mts.map +1 -1
  83. package/dist/deploy/public.mjs +13 -13
  84. package/dist/{deploy-BibGpDAz.cjs → deploy-CjJ447kd.cjs} +73 -72
  85. package/dist/{deploy-BibGpDAz.cjs.map → deploy-CjJ447kd.cjs.map} +1 -1
  86. package/dist/{deploy-C4QQkHK7.mjs → deploy-DqJiCwI9.mjs} +16 -15
  87. package/dist/{deploy-C4QQkHK7.mjs.map → deploy-DqJiCwI9.mjs.map} +1 -1
  88. package/dist/{discover-yqeJ2Bx7.cjs → discover-CRywE7yc.cjs} +157 -6
  89. package/dist/discover-CRywE7yc.cjs.map +1 -0
  90. package/dist/{discover-B2m8ytyq.mjs → discover-DbDrCQ8h.mjs} +117 -8
  91. package/dist/discover-DbDrCQ8h.mjs.map +1 -0
  92. package/dist/docker-CCzFCus7.mjs +1407 -0
  93. package/dist/docker-CCzFCus7.mjs.map +1 -0
  94. package/dist/docker-DK4rmb0u.cjs +1514 -0
  95. package/dist/docker-DK4rmb0u.cjs.map +1 -0
  96. package/dist/{dokploy-pSrsileA.mjs → dokploy-B5_Y5wf0.mjs} +2 -2
  97. package/dist/{dokploy-pSrsileA.mjs.map → dokploy-B5_Y5wf0.mjs.map} +1 -1
  98. package/dist/{dokploy-B_VX3nLM.cjs → dokploy-EJKX2T7M.cjs} +2 -2
  99. package/dist/{dokploy-B_VX3nLM.cjs.map → dokploy-EJKX2T7M.cjs.map} +1 -1
  100. package/dist/{drivers-C47nm-wB.cjs → drivers-aM87NQJi.cjs} +4 -91
  101. package/dist/drivers-aM87NQJi.cjs.map +1 -0
  102. package/dist/{drivers-CDjpjakg.mjs → drivers-uxLBq3e3.mjs} +3 -60
  103. package/dist/drivers-uxLBq3e3.mjs.map +1 -0
  104. package/dist/{eas-cSSc8Lex.cjs → eas-AqSay-vE.cjs} +6 -6
  105. package/dist/{eas-cSSc8Lex.cjs.map → eas-AqSay-vE.cjs.map} +1 -1
  106. package/dist/{eas-Bou-_M76.mjs → eas-BQlD6Z-u.mjs} +3 -3
  107. package/dist/{eas-Bou-_M76.mjs.map → eas-BQlD6Z-u.mjs.map} +1 -1
  108. package/dist/{encryption-CElaAwJs.cjs → encryption-B6_aL5d-.cjs} +6 -6
  109. package/dist/{encryption-CElaAwJs.cjs.map → encryption-B6_aL5d-.cjs.map} +1 -1
  110. package/dist/{encryption-Bps9As2D.mjs → encryption-Dlh5mcE1.mjs} +3 -3
  111. package/dist/{encryption-Bps9As2D.mjs.map → encryption-Dlh5mcE1.mjs.map} +1 -1
  112. package/dist/{engine-CiG7Wfyc.cjs → engine-BAkmPI2z.cjs} +99 -97
  113. package/dist/{engine-CiG7Wfyc.cjs.map → engine-BAkmPI2z.cjs.map} +1 -1
  114. package/dist/{engine-CXE4UOHj.mjs → engine-D3P2P6RK.mjs} +12 -10
  115. package/dist/{engine-CXE4UOHj.mjs.map → engine-D3P2P6RK.mjs.map} +1 -1
  116. package/dist/{github-BzppIvpw.cjs → github-DokGIXT-.cjs} +18 -17
  117. package/dist/{github-BzppIvpw.cjs.map → github-DokGIXT-.cjs.map} +1 -1
  118. package/dist/{github-CvFJlFWA.mjs → github-STWxD6cu.mjs} +9 -8
  119. package/dist/{github-CvFJlFWA.mjs.map → github-STWxD6cu.mjs.map} +1 -1
  120. package/dist/{googlePlay-BJnMCWoa.cjs → googlePlay-DL0htRJD.cjs} +5 -5
  121. package/dist/{googlePlay-BJnMCWoa.cjs.map → googlePlay-DL0htRJD.cjs.map} +1 -1
  122. package/dist/{googlePlay-RSe9wOfZ.mjs → googlePlay-uAyXzxlu.mjs} +5 -5
  123. package/dist/{googlePlay-RSe9wOfZ.mjs.map → googlePlay-uAyXzxlu.mjs.map} +1 -1
  124. package/dist/index.cjs +196 -192
  125. package/dist/index.cjs.map +1 -1
  126. package/dist/index.mjs +70 -66
  127. package/dist/index.mjs.map +1 -1
  128. package/dist/{local-OPC9BCZt.cjs → local-C6ndR_Wx.cjs} +6 -6
  129. package/dist/{local-OPC9BCZt.cjs.map → local-C6ndR_Wx.cjs.map} +1 -1
  130. package/dist/{local-B7Zv1NoA.mjs → local-CC7rdmgg.mjs} +3 -3
  131. package/dist/{local-B7Zv1NoA.mjs.map → local-CC7rdmgg.mjs.map} +1 -1
  132. package/dist/{migrate-BCBs0BMn.cjs → migrate-BbJUJ4CY.cjs} +6 -6
  133. package/dist/{migrate-BCBs0BMn.cjs.map → migrate-BbJUJ4CY.cjs.map} +1 -1
  134. package/dist/{migrate-Dmh5Dbcr.cjs → migrate-CMurhHuj.cjs} +15 -13
  135. package/dist/{migrate-Dmh5Dbcr.cjs.map → migrate-CMurhHuj.cjs.map} +1 -1
  136. package/dist/{migrate-B0nQra2W.mjs → migrate-D079sADO.mjs} +3 -3
  137. package/dist/{migrate-B0nQra2W.mjs.map → migrate-D079sADO.mjs.map} +1 -1
  138. package/dist/{migrate-BPCJBL7_.mjs → migrate-D27h4H79.mjs} +7 -5
  139. package/dist/{migrate-BPCJBL7_.mjs.map → migrate-D27h4H79.mjs.map} +1 -1
  140. package/dist/notes-B655tUny.cjs +500 -0
  141. package/dist/notes-B655tUny.cjs.map +1 -0
  142. package/dist/notes-wPJlNUj7.mjs +399 -0
  143. package/dist/notes-wPJlNUj7.mjs.map +1 -0
  144. package/dist/openapi.cjs +4 -5
  145. package/dist/openapi.cjs.map +1 -1
  146. package/dist/openapi.mjs +3 -4
  147. package/dist/openapi.mjs.map +1 -1
  148. package/dist/{projectBucket-BBbQ1lHF.cjs → projectBucket-Bs8ftcgB.cjs} +2 -2
  149. package/dist/{projectBucket-BBbQ1lHF.cjs.map → projectBucket-Bs8ftcgB.cjs.map} +1 -1
  150. package/dist/{projectBucket-C_DN4WzF.mjs → projectBucket-XVxyvW1y.mjs} +2 -2
  151. package/dist/{projectBucket-C_DN4WzF.mjs.map → projectBucket-XVxyvW1y.mjs.map} +1 -1
  152. package/dist/{publish-cthyGGQt.mjs → publish-B9BNIaf2.mjs} +2 -2
  153. package/dist/{publish-cthyGGQt.mjs.map → publish-B9BNIaf2.mjs.map} +1 -1
  154. package/dist/{publish-DKy3hn8a.cjs → publish-Bwgb-1JN.cjs} +2 -2
  155. package/dist/{publish-DKy3hn8a.cjs.map → publish-Bwgb-1JN.cjs.map} +1 -1
  156. package/dist/{ready-DuU0FXSj.cjs → ready-BNh3zsSn.cjs} +6 -6
  157. package/dist/{ready-DuU0FXSj.cjs.map → ready-BNh3zsSn.cjs.map} +1 -1
  158. package/dist/{ready-CGqJ74Kt.mjs → ready-g25dcGzK.mjs} +6 -6
  159. package/dist/{ready-CGqJ74Kt.mjs.map → ready-g25dcGzK.mjs.map} +1 -1
  160. package/dist/reconcile/public.cjs +1 -1
  161. package/dist/reconcile/public.mjs +1 -1
  162. package/dist/{resolve-BaRqJlqV.mjs → resolve-DheFxtmy.mjs} +4 -4
  163. package/dist/{resolve-BaRqJlqV.mjs.map → resolve-DheFxtmy.mjs.map} +1 -1
  164. package/dist/{resolve-AYtMIgoq.cjs → resolve-Dir9EjMu.cjs} +4 -4
  165. package/dist/{resolve-AYtMIgoq.cjs.map → resolve-Dir9EjMu.cjs.map} +1 -1
  166. package/dist/{rollback-DqV6t9oo.mjs → rollback-BWAB77F9.mjs} +8 -8
  167. package/dist/{rollback-DqV6t9oo.mjs.map → rollback-BWAB77F9.mjs.map} +1 -1
  168. package/dist/{rollback-CQ184yFu.cjs → rollback-CrtuUKqe.cjs} +11 -11
  169. package/dist/{rollback-CQ184yFu.cjs.map → rollback-CrtuUKqe.cjs.map} +1 -1
  170. package/dist/{s3-BKnL6YGQ.cjs → s3-DKJfDHUQ.cjs} +2 -2
  171. package/dist/{s3-BKnL6YGQ.cjs.map → s3-DKJfDHUQ.cjs.map} +1 -1
  172. package/dist/{s3-DW7SLsb8.mjs → s3-DNp8U0Ea.mjs} +2 -2
  173. package/dist/{s3-DW7SLsb8.mjs.map → s3-DNp8U0Ea.mjs.map} +1 -1
  174. package/dist/sandbox/credentials-worker.cjs +3 -4
  175. package/dist/sandbox/credentials-worker.cjs.map +1 -1
  176. package/dist/sandbox/credentials-worker.mjs +2 -3
  177. package/dist/sandbox/credentials-worker.mjs.map +1 -1
  178. package/dist/sandbox/discover-worker.cjs +1 -1
  179. package/dist/sandbox/discover-worker.mjs +1 -1
  180. package/dist/sandbox/migrate-worker.cjs +3 -4
  181. package/dist/sandbox/migrate-worker.cjs.map +1 -1
  182. package/dist/sandbox/migrate-worker.mjs +2 -3
  183. package/dist/sandbox/migrate-worker.mjs.map +1 -1
  184. package/dist/seeds-B3xvUAQf.cjs +363 -0
  185. package/dist/seeds-B3xvUAQf.cjs.map +1 -0
  186. package/dist/seeds-BCC8vAXR.mjs +298 -0
  187. package/dist/seeds-BCC8vAXR.mjs.map +1 -0
  188. package/dist/{serverSetup-Dnw9Kdel.cjs → serverSetup-BVL9HhNE.cjs} +9 -8
  189. package/dist/{serverSetup-Dnw9Kdel.cjs.map → serverSetup-BVL9HhNE.cjs.map} +1 -1
  190. package/dist/{serverSetup-AfG0-at8.mjs → serverSetup-D---hcyW.mjs} +7 -6
  191. package/dist/{serverSetup-AfG0-at8.mjs.map → serverSetup-D---hcyW.mjs.map} +1 -1
  192. package/dist/{sniffer-taO-AXSk.cjs → sniffer-BjHnOaCe.cjs} +9 -10
  193. package/dist/{sniffer-taO-AXSk.cjs.map → sniffer-BjHnOaCe.cjs.map} +1 -1
  194. package/dist/{sniffer-BHhJ8DiC.mjs → sniffer-DOyzfgPF.mjs} +8 -9
  195. package/dist/{sniffer-BHhJ8DiC.mjs.map → sniffer-DOyzfgPF.mjs.map} +1 -1
  196. package/dist/{snsSubscriptions-D_IBKhni.mjs → snsSubscriptions-Cf5DZfO5.mjs} +4 -453
  197. package/dist/snsSubscriptions-Cf5DZfO5.mjs.map +1 -0
  198. package/dist/{snsSubscriptions-CC-WM1zC.cjs → snsSubscriptions-DB0iRByH.cjs} +12 -559
  199. package/dist/snsSubscriptions-DB0iRByH.cjs.map +1 -0
  200. package/dist/{sst-Bz2HJlqc.mjs → sst-3V-rcKcw.mjs} +27 -5
  201. package/dist/sst-3V-rcKcw.mjs.map +1 -0
  202. package/dist/{sst-lvCHdYsY.cjs → sst-DuU7Ju0c.cjs} +29 -7
  203. package/dist/sst-DuU7Ju0c.cjs.map +1 -0
  204. package/dist/stack-BRKZ69bf.mjs +2307 -0
  205. package/dist/stack-BRKZ69bf.mjs.map +1 -0
  206. package/dist/stack-CmHjkg7D.cjs +2536 -0
  207. package/dist/stack-CmHjkg7D.cjs.map +1 -0
  208. package/dist/{stage-dd9dtLfh.mjs → stage-CTq3Gjsx.mjs} +7 -7
  209. package/dist/{stage-dd9dtLfh.mjs.map → stage-CTq3Gjsx.mjs.map} +1 -1
  210. package/dist/{stage-CTibxcpA.cjs → stage-s_8HOsH0.cjs} +13 -13
  211. package/dist/{stage-CTibxcpA.cjs.map → stage-s_8HOsH0.cjs.map} +1 -1
  212. package/dist/{stages--icWbhPy.cjs → stages-CFI0OiLj.cjs} +2 -2
  213. package/dist/{stages--icWbhPy.cjs.map → stages-CFI0OiLj.cjs.map} +1 -1
  214. package/dist/{stages-CUwSy39f.mjs → stages-DoYa81kN.mjs} +2 -2
  215. package/dist/{stages-CUwSy39f.mjs.map → stages-DoYa81kN.mjs.map} +1 -1
  216. package/dist/target/public.cjs +1 -1
  217. package/dist/target/public.mjs +1 -1
  218. package/dist/{terminal-DURcYlVX.cjs → terminal-ChxtuTYJ.cjs} +3 -3
  219. package/dist/{terminal-DURcYlVX.cjs.map → terminal-ChxtuTYJ.cjs.map} +1 -1
  220. package/dist/{terminal-yOZ7kKF9.mjs → terminal-oHKnZHkT.mjs} +3 -3
  221. package/dist/{terminal-yOZ7kKF9.mjs.map → terminal-oHKnZHkT.mjs.map} +1 -1
  222. package/dist/types-Bl_CwZC9.cjs +90 -0
  223. package/dist/types-Bl_CwZC9.cjs.map +1 -0
  224. package/dist/types-Y1NfWlyG.mjs +61 -0
  225. package/dist/types-Y1NfWlyG.mjs.map +1 -0
  226. package/dist/vitest.cjs +1 -1
  227. package/dist/vitest.mjs +1 -1
  228. package/package.json +15 -15
  229. package/dist/compose-CGXx22Wy.cjs.map +0 -1
  230. package/dist/compose-ofZIpp2q.mjs.map +0 -1
  231. package/dist/config.cjs.map +0 -1
  232. package/dist/config.mjs.map +0 -1
  233. package/dist/credentials-D7XJypNd.cjs +0 -520
  234. package/dist/credentials-D7XJypNd.cjs.map +0 -1
  235. package/dist/credentials-DpfnUvIR.mjs +0 -395
  236. package/dist/credentials-DpfnUvIR.mjs.map +0 -1
  237. package/dist/derive-Cd7Hl3r2.mjs +0 -259
  238. package/dist/derive-Cd7Hl3r2.mjs.map +0 -1
  239. package/dist/derive-CgZfoBU2.cjs +0 -282
  240. package/dist/derive-CgZfoBU2.cjs.map +0 -1
  241. package/dist/discover-B2m8ytyq.mjs.map +0 -1
  242. package/dist/discover-yqeJ2Bx7.cjs.map +0 -1
  243. package/dist/drivers-C47nm-wB.cjs.map +0 -1
  244. package/dist/drivers-CDjpjakg.mjs.map +0 -1
  245. package/dist/identity-CBXr4wNi.mjs +0 -129
  246. package/dist/identity-CBXr4wNi.mjs.map +0 -1
  247. package/dist/identity-CbLfgQNT.cjs +0 -182
  248. package/dist/identity-CbLfgQNT.cjs.map +0 -1
  249. package/dist/sandbox-CHv3OYXg.cjs +0 -165
  250. package/dist/sandbox-CHv3OYXg.cjs.map +0 -1
  251. package/dist/sandbox-CbVB7uOD.mjs +0 -118
  252. package/dist/sandbox-CbVB7uOD.mjs.map +0 -1
  253. package/dist/seeds-DndMeyzm.cjs +0 -10669
  254. package/dist/seeds-DndMeyzm.cjs.map +0 -1
  255. package/dist/seeds-o6x6BTRo.mjs +0 -9534
  256. package/dist/seeds-o6x6BTRo.mjs.map +0 -1
  257. package/dist/snsSubscriptions-CC-WM1zC.cjs.map +0 -1
  258. package/dist/snsSubscriptions-D_IBKhni.mjs.map +0 -1
  259. package/dist/sst-Bz2HJlqc.mjs.map +0 -1
  260. package/dist/sst-lvCHdYsY.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-BPCJBL7_.mjs","names":[],"sources":["../src/migrate/index.ts"],"sourcesContent":["/**\n * `gkm migrate`, `gkm seed` and `gkm migration` — applying a construct's\n * migrations, running its seeds, and writing its next migration.\n *\n * Both work on a stage this machine reconciles: its containers up, its roles\n * provisioned, its owner URLs resolved. A deployed stage is migrated by the\n * deploy that ships it, which is the one thing that can reach its database.\n */\n\nimport { mkdir, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { EnvironmentParser } from '@geekmidas/envkit';\nimport {\n\ttype ConstructManifest,\n\tcanonicalId,\n\ttype MigrationTarget,\n\tmigrationTargets,\n} from '@geekmidas/manifest';\nimport {\n\ttype ServiceRegisterOptions,\n\tserviceContext,\n} from '@geekmidas/services';\nimport { loadWorkspaceConfig } from '../config';\nimport { loadSecretsForApp } from '../credentials';\nimport { GkmError } from '../errors';\nimport { type ConstructSource, discover } from '../reconcile/discover';\nimport { stageEnv } from '../reconcile/env.js';\nimport {\n\tbackendsOf,\n\tconstructGlobs,\n\treconcileWorkspace,\n} from '../reconcile/workspace.js';\nimport { secretsStoreFor } from '../secrets/store.js';\nimport { TEST_STAGE } from '../workspace/stages';\nimport type { NormalizedWorkspace } from '../workspace/types.js';\nimport {\n\ttype MigrationRun,\n\tmigrateAndSeed,\n\tmigrateDatabases,\n\tNoSuchMigrationTarget,\n\tpendingMigrations,\n\ttype SeedRun,\n} from './databases';\nimport { slug, stamp } from './names';\n\nexport {\n\tKyselyNotFound,\n\tMigrationFailed,\n\ttype MigrationRun,\n\tMigrationsOutsideFolder,\n\tmigrateAndSeed,\n\tmigrateDatabases,\n\tNoOwnerCredential,\n\tNoSuchMigrationTarget,\n\ttype PendingMigrations,\n\tpendingMigrations,\n\tSeedFailed,\n\ttype SeedOptions,\n\ttype SeedRun,\n\tseedDatabases,\n\tUnknownDatabaseFolder,\n\tUnknownMigrationFolder,\n} from './databases';\nexport { slug, stamp } from './names';\nexport {\n\tDuplicateMigration,\n\tMigrationHasNoUp,\n\tSeedHasNoSeed,\n} from './provider';\nexport {\n\tregisterSeedDrivers,\n\ttype SeedBackends,\n\tSeedDriversUnresolved,\n} from './seedDrivers';\n\nconst logger = console;\n\n/** `gkm migrate --stage` named a stage only a deploy can reach. */\nexport class MigrateDeployedStage extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly local: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' is a deployed stage, and its database is migrated by ` +\n\t\t\t\t`\\`gkm deploy --stage ${stage}\\`, which is what can reach it. ` +\n\t\t\t\t`\\`gkm migrate\\` runs against '${local}' or '${TEST_STAGE}'.`,\n\t\t);\n\t\tthis.name = 'MigrateDeployedStage';\n\t}\n}\n\n/** `gkm migration` for a Kysely database, with no name for the file. */\nexport class MigrationNeedsName extends GkmError {\n\tconstructor(readonly construct: string) {\n\t\tsuper(\n\t\t\t`Name the migration: \\`gkm migration ${construct} add_workouts\\`. ` +\n\t\t\t\t`The name is what the file — and the history — calls it.`,\n\t\t);\n\t\tthis.name = 'MigrationNeedsName';\n\t}\n}\n\nexport interface MigrateOptions {\n\t/** The stage to migrate: the project's local one, or `test`. */\n\tstage?: string;\n\t/** One construct, by name. All of them when absent. */\n\tconstruct?: string;\n}\n\n/** A workspace's stage, reconciled and ready to migrate. */\nexport interface ReadyStage {\n\tworkspace: NormalizedWorkspace;\n\tmanifest: ConstructManifest;\n\tsources: Record<string, ConstructSource>;\n\t/**\n\t * What the stage's apps are given: its stored secrets — a third party's\n\t * key, an admin's email — under every URL it resolved, the owner URLs\n\t * among them.\n\t */\n\tenv: Record<string, string>;\n\t/** The stage it is: the local one, or `test`. */\n\tstage: string;\n}\n\n/**\n * Reconcile a stage so it can be migrated: containers up, databases, schemas,\n * roles and grants in place, owner URLs resolved.\n *\n * Migrating assumes the roles exist, and this is what makes that true rather\n * than something a developer has to have run first.\n */\nexport async function readyStage(\n\tcwd: string,\n\tstage?: string,\n): Promise<ReadyStage> {\n\tconst { workspace } = await loadWorkspaceConfig(cwd);\n\tconst local = workspace.stages.local;\n\tconst target = stage ?? local;\n\tif (target !== local && target !== TEST_STAGE) {\n\t\tthrow new MigrateDeployedStage(target, local);\n\t}\n\n\tconst sources: Record<string, ConstructSource> = {};\n\tconst manifest = await discover({\n\t\tpatterns: constructGlobs(workspace),\n\t\tcwd: workspace.root,\n\t\tsources,\n\t});\n\n\tconst reconciled = await reconcileWorkspace(workspace, {\n\t\tstage: target,\n\t\tmanifest,\n\t\tstart: true,\n\t});\n\n\t// The local stage's store for `test` too, as `gkm test` reads it: one store\n\t// serves both, and only the resources reconcile names differ.\n\tconst secrets = await loadSecretsForApp(\n\t\tawait secretsStoreFor(workspace, local),\n\t\tlocal,\n\t);\n\n\treturn {\n\t\tworkspace,\n\t\tmanifest,\n\t\tsources,\n\t\tenv: stageEnv(secrets, reconciled.env),\n\t\tstage: target,\n\t};\n}\n\n/** `gkm migrate [construct]`. */\nexport async function migrateCommand(\n\toptions: MigrateOptions = {},\n): Promise<void> {\n\tconst ready = await readyStage(process.cwd(), options.stage);\n\n\tconst runs = await migrateDatabases({\n\t\troot: ready.workspace.root,\n\t\tmanifest: ready.manifest,\n\t\tsources: ready.sources,\n\t\tenv: ready.env,\n\t\t...(options.construct ? { only: options.construct } : {}),\n\t});\n\n\tif (runs.length === 0) {\n\t\tlogger.log('🗄️ No database constructs to migrate.');\n\t\treturn;\n\t}\n\n\tlogMigrations(runs);\n}\n\n/**\n * `gkm seed [construct]` — migrate, then run the seeds.\n *\n * Always migrates first: a seed is written against the schema its migrations\n * build, and against an older one it fails on a table that is not there yet.\n */\nexport async function seedCommand(options: MigrateOptions = {}): Promise<void> {\n\tconst ready = await readyStage(process.cwd(), options.stage);\n\n\tconst { migrations, seeds } = await migrateAndSeed({\n\t\troot: ready.workspace.root,\n\t\tmanifest: ready.manifest,\n\t\tsources: ready.sources,\n\t\tenv: ready.env,\n\t\tstage: ready.stage,\n\t\tbackends: backendsOf(ready.workspace),\n\t\t...(options.construct ? { only: options.construct } : {}),\n\t});\n\n\tif (migrations.length === 0) {\n\t\tlogger.log('🗄️ No database constructs to seed.');\n\t\treturn;\n\t}\n\n\tlogMigrations(migrations);\n\tlogSeeds(seeds);\n}\n\n/** One line per construct: up to date, or what was applied. */\nexport function logMigrations(\n\truns: readonly MigrationRun[],\n\tlog: (line: string) => void = logger.log,\n): void {\n\tfor (const { target, applied } of runs) {\n\t\tif (applied.length === 0) {\n\t\t\tlog(`🗄️ ${target.migrations}: up to date`);\n\t\t\tcontinue;\n\t\t}\n\t\tlog(`🗄️ ${target.migrations}: applied ${applied.length}`);\n\t\tfor (const name of applied) log(` ✓ ${name}`);\n\t}\n}\n\n/** One line per construct that has seeds, and each seed it ran. */\nexport function logSeeds(\n\truns: readonly SeedRun[],\n\tlog: (line: string) => void = logger.log,\n): void {\n\tfor (const { target, seeded } of runs) {\n\t\tif (seeded.length === 0) continue;\n\t\tlog(`🌱 ${target.seeds}: ran ${seeded.length}`);\n\t\tfor (const name of seeded) log(` ✓ ${name}`);\n\t}\n}\n\n/**\n * What `gkm dev` prints: one line per construct whose folder is ahead of its\n * history, and nothing when every folder is applied.\n *\n * Reported, never applied. A migration being written would otherwise run the\n * moment its file is saved, half-finished, against the database the developer\n * is working in.\n */\nexport async function reportPendingMigrations(\n\tworkspace: NormalizedWorkspace,\n\tenv: Readonly<Record<string, string>>,\n): Promise<void> {\n\tconst sources: Record<string, ConstructSource> = {};\n\tconst manifest = await discover({\n\t\tpatterns: constructGlobs(workspace),\n\t\tcwd: workspace.root,\n\t\tsources,\n\t});\n\n\tconst pending = await pendingMigrations({\n\t\troot: workspace.root,\n\t\tmanifest,\n\t\tsources,\n\t\tenv,\n\t});\n\n\tfor (const { target, pending: names } of pending) {\n\t\tlogger.log(\n\t\t\t`⚠️ ${target.migrations}: ${names.length} pending (${names.join(', ')}) — run gkm migrate`,\n\t\t);\n\t}\n}\n\n/**\n * What `gkm dev --migrate` and `gkm dev --seed` do before the apps start:\n * migrate, and with `seed`, run the seeds after — once, at startup, never on a\n * save, for the reason {@link reportPendingMigrations} gives.\n *\n * A failure here is thrown, unlike the report's: the developer asked for the\n * database to be brought up to date, and apps started against one in an\n * unknown state would fail somewhere less obvious.\n */\nexport async function prepareDevDatabases(\n\tworkspace: NormalizedWorkspace,\n\tenv: Readonly<Record<string, string>>,\n\t{ seed = false }: { seed?: boolean } = {},\n): Promise<void> {\n\tconst sources: Record<string, ConstructSource> = {};\n\tconst manifest = await discover({\n\t\tpatterns: constructGlobs(workspace),\n\t\tcwd: workspace.root,\n\t\tsources,\n\t});\n\tconst options = { root: workspace.root, manifest, sources, env };\n\n\tif (!seed) {\n\t\tlogMigrations(await migrateDatabases(options));\n\t\treturn;\n\t}\n\n\tconst { migrations, seeds } = await migrateAndSeed({\n\t\t...options,\n\t\tstage: workspace.stages.local,\n\t\tbackends: backendsOf(workspace),\n\t});\n\tlogMigrations(migrations);\n\tlogSeeds(seeds);\n}\n\nexport interface MigrationOptions {\n\t/** The construct the migration is for, by name. */\n\tconstruct: string;\n\t/** What the file is called, after its timestamp. */\n\tname?: string;\n\t/** The file's timestamp; the current time when absent. */\n\tnow?: Date;\n}\n\n/**\n * `gkm migration <construct> [name]` — write the construct's next migration.\n *\n * For a database, an empty `up`/`down` to fill in. For an auth server, what\n * its schema is missing, computed against its tenant once every committed\n * migration has been applied — so the file is only the change, and is\n * reviewed and committed like any other.\n */\nexport async function migrationCommand(\n\toptions: MigrationOptions,\n): Promise<string | undefined> {\n\tconst ready = await readyStage(process.cwd());\n\tconst targets = migrationTargets(ready.manifest);\n\tconst id = canonicalId(options.construct);\n\n\tconst auth = authConstruct(ready.sources, id);\n\tif (auth) {\n\t\tconst target = targets.find((t) => t.id === auth.databaseId);\n\t\tif (!target) {\n\t\t\tthrow new NoSuchMigrationTarget(auth.databaseId, ids(targets));\n\t\t}\n\t\treturn writeAuthMigration(ready, auth, target, options);\n\t}\n\n\tconst target = targets.find((t) => t.id === id);\n\tif (!target) {\n\t\tthrow new NoSuchMigrationTarget(options.construct, [\n\t\t\t...ids(targets),\n\t\t\t...authIds(ready.sources),\n\t\t]);\n\t}\n\tif (!options.name) throw new MigrationNeedsName(options.construct);\n\n\tconst file = await write(\n\t\tready.workspace.root,\n\t\ttarget,\n\t\t`${stamp(options.now)}_${slug(options.name)}.ts`,\n\t\tSTUB,\n\t);\n\tlogger.log(`📝 ${file}`);\n\treturn file;\n}\n\n/** What an auth construct offers `gkm migration`, duck-typed across copies. */\ninterface AuthConstruct {\n\tid: string;\n\tdatabaseId: string;\n\tpendingMigration(\n\t\toptions: ServiceRegisterOptions,\n\t): Promise<string | undefined>;\n}\n\nfunction authConstruct(\n\tsources: Readonly<Record<string, ConstructSource>>,\n\tid: string,\n): AuthConstruct | undefined {\n\tconst construct = sources[id]?.construct as\n\t\t| Partial<AuthConstruct>\n\t\t| undefined;\n\treturn construct &&\n\t\ttypeof construct.pendingMigration === 'function' &&\n\t\ttypeof construct.databaseId === 'string'\n\t\t? (construct as AuthConstruct)\n\t\t: undefined;\n}\n\nfunction authIds(sources: Readonly<Record<string, ConstructSource>>): string[] {\n\treturn Object.keys(sources).filter((id) => authConstruct(sources, id));\n}\n\nasync function writeAuthMigration(\n\tready: ReadyStage,\n\tauth: AuthConstruct,\n\ttarget: MigrationTarget,\n\toptions: MigrationOptions,\n): Promise<string | undefined> {\n\t// Against a tenant already at its committed migrations, so the comparison\n\t// finds only what the files do not yet say.\n\tawait migrateDatabases({\n\t\troot: ready.workspace.root,\n\t\tmanifest: ready.manifest,\n\t\tsources: ready.sources,\n\t\tenv: ready.env,\n\t\tonly: target.id,\n\t});\n\n\t// Its secret and URL come from the stage's secrets; the tenant's owner URL\n\t// from the reconcile, which wins.\n\tconst pending = await auth.pendingMigration({\n\t\tenvParser: new EnvironmentParser(ready.env),\n\t\tcontext: serviceContext,\n\t});\n\n\tif (!pending) {\n\t\tlogger.log(`✓ ${target.migrations}: ${auth.id} is up to date`);\n\t\treturn undefined;\n\t}\n\n\tconst file = await write(\n\t\tready.workspace.root,\n\t\ttarget,\n\t\t`${stamp(options.now)}_${slug(options.name ?? 'better_auth')}.sql`,\n\t\t`${pending.trim()}\\n`,\n\t);\n\tlogger.log(`📝 ${file}`);\n\treturn file;\n}\n\nconst STUB = `import type { Kysely } from 'kysely';\n\nexport async function up(db: Kysely<unknown>): Promise<void> {\n // await db.schema.createTable('…').addColumn(…).execute();\n}\n\nexport async function down(db: Kysely<unknown>): Promise<void> {\n // await db.schema.dropTable('…').execute();\n}\n`;\n\nasync function write(\n\troot: string,\n\ttarget: MigrationTarget,\n\tfile: string,\n\tcontent: string,\n): Promise<string> {\n\tconst folder = join(root, target.migrations);\n\tawait mkdir(folder, { recursive: true });\n\tawait writeFile(join(folder, file), content, { flag: 'wx' });\n\treturn `${target.migrations}/${file}`;\n}\n\nfunction ids(targets: readonly MigrationTarget[]): string[] {\n\treturn targets.map((target) => target.id);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2EA,MAAM,SAAS;;AAGf,IAAa,uBAAb,cAA0C,SAAS;CAExC;CACA;CAFV,YACC,OACA,OACC;EACD,MACC,IAAI,MAAM,8EACe,MAAM,gEACG,MAAM,QAAQ,WAAW,GAC5D;EAPS,KAAA,QAAA;EACA,KAAA,QAAA;EAOT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,qBAAb,cAAwC,SAAS;CAC3B;CAArB,YAAY,WAA4B;EACvC,MACC,uCAAuC,UAAU,yEAElD;EAJoB,KAAA,YAAA;EAKpB,KAAK,OAAO;CACb;AACD;;;;;;;;AA+BA,eAAsB,WACrB,KACA,OACsB;CACtB,MAAM,EAAE,cAAc,MAAM,oBAAoB,GAAG;CACnD,MAAM,QAAQ,UAAU,OAAO;CAC/B,MAAM,SAAS,SAAS;CACxB,IAAI,WAAW,SAAS,WAAA,QACvB,MAAM,IAAI,qBAAqB,QAAQ,KAAK;CAG7C,MAAM,UAA2C,CAAC;CAClD,MAAM,WAAW,MAAM,SAAS;EAC/B,UAAU,eAAe,SAAS;EAClC,KAAK,UAAU;EACf;CACD,CAAC;CAED,MAAM,aAAa,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AM,KAAK,iBAAiB;EAC3C,WAAW,IAAI,kBAAkB,MAAM,GAAG;EAC1C,SAAS;CACV,CAAC;CAED,IAAI,CAAC,SAAS;EACb,OAAO,IAAI,KAAK,OAAO,WAAW,IAAI,KAAK,GAAG,eAAe;EAC7D;CACD;CAEA,MAAM,OAAO,MAAM,MAClB,MAAM,UAAU,MAChB,QACA,GAAG,MAAM,QAAQ,GAAG,EAAE,GAAG,KAAK,QAAQ,QAAQ,aAAa,EAAE,OAC7D,GAAG,QAAQ,KAAK,EAAE,GACnB;CACA,OAAO,IAAI,MAAM,MAAM;CACvB,OAAO;AACR;AAEA,MAAM,OAAO;;;;;;;;;;AAWb,eAAe,MACd,MACA,QACA,MACA,SACkB;CAClB,MAAM,SAAS,KAAK,MAAM,OAAO,UAAU;CAC3C,MAAM,MAAM,QAAQ,EAAE,WAAW,KAAK,CAAC;CACvC,MAAM,UAAU,KAAK,QAAQ,IAAI,GAAG,SAAS,EAAE,MAAM,KAAK,CAAC;CAC3D,OAAO,GAAG,OAAO,WAAW,GAAG;AAChC;AAEA,SAAS,IAAI,SAA+C;CAC3D,OAAO,QAAQ,KAAK,WAAW,OAAO,EAAE;AACzC"}
1
+ {"version":3,"file":"migrate-D27h4H79.mjs","names":[],"sources":["../src/migrate/index.ts"],"sourcesContent":["/**\n * `gkm migrate`, `gkm seed` and `gkm migration` — applying a construct's\n * migrations, running its seeds, and writing its next migration.\n *\n * Both work on a stage this machine reconciles: its containers up, its roles\n * provisioned, its owner URLs resolved. A deployed stage is migrated by the\n * deploy that ships it, which is the one thing that can reach its database.\n */\n\nimport { mkdir, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { EnvironmentParser } from '@geekmidas/envkit';\nimport {\n\ttype ConstructManifest,\n\tcanonicalId,\n\ttype MigrationTarget,\n\tmigrationTargets,\n} from '@geekmidas/manifest';\nimport {\n\ttype ServiceRegisterOptions,\n\tserviceContext,\n} from '@geekmidas/services';\nimport { loadWorkspaceConfig } from '../config';\nimport { loadSecretsForApp } from '../credentials';\nimport { GkmError } from '../errors';\nimport { type ConstructSource, discover } from '../reconcile/discover';\nimport { stageEnv } from '../reconcile/env.js';\nimport {\n\tbackendsOf,\n\tconstructGlobs,\n\treconcileWorkspace,\n} from '../reconcile/workspace.js';\nimport { secretsStoreFor } from '../secrets/store.js';\nimport { TEST_STAGE } from '../workspace/stages';\nimport type { NormalizedWorkspace } from '../workspace/types.js';\nimport {\n\ttype MigrationRun,\n\tmigrateAndSeed,\n\tmigrateDatabases,\n\tNoSuchMigrationTarget,\n\tpendingMigrations,\n\ttype SeedRun,\n} from './databases';\nimport { slug, stamp } from './names';\n\nexport {\n\tKyselyNotFound,\n\tMigrationFailed,\n\ttype MigrationRun,\n\tMigrationsOutsideFolder,\n\tmigrateAndSeed,\n\tmigrateDatabases,\n\tNoOwnerCredential,\n\tNoSuchMigrationTarget,\n\ttype PendingMigrations,\n\tpendingMigrations,\n\tSeedFailed,\n\ttype SeedOptions,\n\ttype SeedRun,\n\tseedDatabases,\n\tUnknownDatabaseFolder,\n\tUnknownMigrationFolder,\n} from './databases';\nexport { slug, stamp } from './names';\nexport {\n\tDuplicateMigration,\n\tMigrationHasNoUp,\n\tSeedHasNoSeed,\n} from './provider';\nexport {\n\tregisterSeedDrivers,\n\ttype SeedBackends,\n\tSeedDriversUnresolved,\n} from './seedDrivers';\n\nconst logger = console;\n\n/** `gkm migrate --stage` named a stage only a deploy can reach. */\nexport class MigrateDeployedStage extends GkmError {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly local: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' is a deployed stage, and its database is migrated by ` +\n\t\t\t\t`\\`gkm deploy --stage ${stage}\\`, which is what can reach it. ` +\n\t\t\t\t`\\`gkm migrate\\` runs against '${local}' or '${TEST_STAGE}'.`,\n\t\t);\n\t\tthis.name = 'MigrateDeployedStage';\n\t}\n}\n\n/** `gkm migration` for a Kysely database, with no name for the file. */\nexport class MigrationNeedsName extends GkmError {\n\tconstructor(readonly construct: string) {\n\t\tsuper(\n\t\t\t`Name the migration: \\`gkm migration ${construct} add_workouts\\`. ` +\n\t\t\t\t`The name is what the file — and the history — calls it.`,\n\t\t);\n\t\tthis.name = 'MigrationNeedsName';\n\t}\n}\n\nexport interface MigrateOptions {\n\t/** The stage to migrate: the project's local one, or `test`. */\n\tstage?: string;\n\t/** One construct, by name. All of them when absent. */\n\tconstruct?: string;\n}\n\n/** A workspace's stage, reconciled and ready to migrate. */\nexport interface ReadyStage {\n\tworkspace: NormalizedWorkspace;\n\tmanifest: ConstructManifest;\n\tsources: Record<string, ConstructSource>;\n\t/**\n\t * What the stage's apps are given: its stored secrets — a third party's\n\t * key, an admin's email — under every URL it resolved, the owner URLs\n\t * among them.\n\t */\n\tenv: Record<string, string>;\n\t/** The stage it is: the local one, or `test`. */\n\tstage: string;\n}\n\n/**\n * Reconcile a stage so it can be migrated: containers up, databases, schemas,\n * roles and grants in place, owner URLs resolved.\n *\n * Migrating assumes the roles exist, and this is what makes that true rather\n * than something a developer has to have run first.\n */\nexport async function readyStage(\n\tcwd: string,\n\tstage?: string,\n): Promise<ReadyStage> {\n\tconst { workspace } = await loadWorkspaceConfig(cwd);\n\tconst local = workspace.stages.local;\n\tconst target = stage ?? local;\n\tif (target !== local && target !== TEST_STAGE) {\n\t\tthrow new MigrateDeployedStage(target, local);\n\t}\n\n\tconst sources: Record<string, ConstructSource> = {};\n\tconst manifest = await discover({\n\t\tpatterns: constructGlobs(workspace),\n\t\tcwd: workspace.root,\n\t\tsources,\n\t});\n\n\tconst reconciled = await reconcileWorkspace(workspace, {\n\t\tstage: target,\n\t\tmanifest,\n\t\tstart: true,\n\t});\n\n\t// The local stage's store for `test` too, as `gkm test` reads it: one store\n\t// serves both, and only the resources reconcile names differ.\n\tconst secrets = await loadSecretsForApp(\n\t\tawait secretsStoreFor(workspace, local),\n\t\tlocal,\n\t);\n\n\treturn {\n\t\tworkspace,\n\t\tmanifest,\n\t\tsources,\n\t\tenv: stageEnv(secrets, reconciled.env),\n\t\tstage: target,\n\t};\n}\n\n/** `gkm migrate [construct]`. */\nexport async function migrateCommand(\n\toptions: MigrateOptions = {},\n): Promise<void> {\n\tconst ready = await readyStage(process.cwd(), options.stage);\n\n\tconst runs = await migrateDatabases({\n\t\troot: ready.workspace.root,\n\t\tmanifest: ready.manifest,\n\t\tsources: ready.sources,\n\t\tenv: ready.env,\n\t\t...(options.construct ? { only: options.construct } : {}),\n\t});\n\n\tif (runs.length === 0) {\n\t\tlogger.log('🗄️ No database constructs to migrate.');\n\t\treturn;\n\t}\n\n\tlogMigrations(runs);\n}\n\n/**\n * `gkm seed [construct]` — migrate, then run the seeds.\n *\n * Always migrates first: a seed is written against the schema its migrations\n * build, and against an older one it fails on a table that is not there yet.\n */\nexport async function seedCommand(options: MigrateOptions = {}): Promise<void> {\n\tconst ready = await readyStage(process.cwd(), options.stage);\n\n\tconst { migrations, seeds } = await migrateAndSeed({\n\t\troot: ready.workspace.root,\n\t\tmanifest: ready.manifest,\n\t\tsources: ready.sources,\n\t\tenv: ready.env,\n\t\tstage: ready.stage,\n\t\tbackends: backendsOf(ready.workspace),\n\t\t...(options.construct ? { only: options.construct } : {}),\n\t});\n\n\tif (migrations.length === 0) {\n\t\tlogger.log('🗄️ No database constructs to seed.');\n\t\treturn;\n\t}\n\n\tlogMigrations(migrations);\n\tlogSeeds(seeds);\n}\n\n/** One line per construct: up to date, or what was applied. */\nexport function logMigrations(\n\truns: readonly MigrationRun[],\n\tlog: (line: string) => void = logger.log,\n): void {\n\tfor (const { target, applied } of runs) {\n\t\tif (applied.length === 0) {\n\t\t\tlog(`🗄️ ${target.migrations}: up to date`);\n\t\t\tcontinue;\n\t\t}\n\t\tlog(`🗄️ ${target.migrations}: applied ${applied.length}`);\n\t\tfor (const name of applied) log(` ✓ ${name}`);\n\t}\n}\n\n/** One line per construct that has seeds, and each seed it ran. */\nexport function logSeeds(\n\truns: readonly SeedRun[],\n\tlog: (line: string) => void = logger.log,\n): void {\n\tfor (const { target, seeded } of runs) {\n\t\tif (seeded.length === 0) continue;\n\t\tlog(`🌱 ${target.seeds}: ran ${seeded.length}`);\n\t\tfor (const name of seeded) log(` ✓ ${name}`);\n\t}\n}\n\n/**\n * What `gkm dev` prints: one line per construct whose folder is ahead of its\n * history, and nothing when every folder is applied.\n *\n * Reported, never applied. A migration being written would otherwise run the\n * moment its file is saved, half-finished, against the database the developer\n * is working in.\n */\nexport async function reportPendingMigrations(\n\tworkspace: NormalizedWorkspace,\n\tenv: Readonly<Record<string, string>>,\n): Promise<void> {\n\tconst sources: Record<string, ConstructSource> = {};\n\tconst manifest = await discover({\n\t\tpatterns: constructGlobs(workspace),\n\t\tcwd: workspace.root,\n\t\tsources,\n\t});\n\n\tconst pending = await pendingMigrations({\n\t\troot: workspace.root,\n\t\tmanifest,\n\t\tsources,\n\t\tenv,\n\t});\n\n\tfor (const { target, pending: names } of pending) {\n\t\tlogger.log(\n\t\t\t`⚠️ ${target.migrations}: ${names.length} pending (${names.join(', ')}) — run gkm migrate`,\n\t\t);\n\t}\n}\n\n/**\n * What `gkm dev --migrate` and `gkm dev --seed` do before the apps start:\n * migrate, and with `seed`, run the seeds after — once, at startup, never on a\n * save, for the reason {@link reportPendingMigrations} gives.\n *\n * A failure here is thrown, unlike the report's: the developer asked for the\n * database to be brought up to date, and apps started against one in an\n * unknown state would fail somewhere less obvious.\n */\nexport async function prepareDevDatabases(\n\tworkspace: NormalizedWorkspace,\n\tenv: Readonly<Record<string, string>>,\n\t{ seed = false }: { seed?: boolean } = {},\n): Promise<void> {\n\tconst sources: Record<string, ConstructSource> = {};\n\tconst manifest = await discover({\n\t\tpatterns: constructGlobs(workspace),\n\t\tcwd: workspace.root,\n\t\tsources,\n\t});\n\tconst options = { root: workspace.root, manifest, sources, env };\n\n\tif (!seed) {\n\t\tlogMigrations(await migrateDatabases(options));\n\t\treturn;\n\t}\n\n\tconst { migrations, seeds } = await migrateAndSeed({\n\t\t...options,\n\t\tstage: workspace.stages.local,\n\t\tbackends: backendsOf(workspace),\n\t});\n\tlogMigrations(migrations);\n\tlogSeeds(seeds);\n}\n\nexport interface MigrationOptions {\n\t/** The construct the migration is for, by name. */\n\tconstruct: string;\n\t/** What the file is called, after its timestamp. */\n\tname?: string;\n\t/** The file's timestamp; the current time when absent. */\n\tnow?: Date;\n}\n\n/**\n * `gkm migration <construct> [name]` — write the construct's next migration.\n *\n * For a database, an empty `up`/`down` to fill in. For an auth server, what\n * its schema is missing, computed against its tenant once every committed\n * migration has been applied — so the file is only the change, and is\n * reviewed and committed like any other.\n */\nexport async function migrationCommand(\n\toptions: MigrationOptions,\n): Promise<string | undefined> {\n\tconst ready = await readyStage(process.cwd());\n\tconst targets = migrationTargets(ready.manifest);\n\tconst id = canonicalId(options.construct);\n\n\tconst auth = authConstruct(ready.sources, id);\n\tif (auth) {\n\t\tconst target = targets.find((t) => t.id === auth.databaseId);\n\t\tif (!target) {\n\t\t\tthrow new NoSuchMigrationTarget(auth.databaseId, ids(targets));\n\t\t}\n\t\treturn writeAuthMigration(ready, auth, target, options);\n\t}\n\n\tconst target = targets.find((t) => t.id === id);\n\tif (!target) {\n\t\tthrow new NoSuchMigrationTarget(options.construct, [\n\t\t\t...ids(targets),\n\t\t\t...authIds(ready.sources),\n\t\t]);\n\t}\n\tif (!options.name) throw new MigrationNeedsName(options.construct);\n\n\tconst file = await write(\n\t\tready.workspace.root,\n\t\ttarget,\n\t\t`${stamp(options.now)}_${slug(options.name)}.ts`,\n\t\tSTUB,\n\t);\n\tlogger.log(`📝 ${file}`);\n\treturn file;\n}\n\n/** What an auth construct offers `gkm migration`, duck-typed across copies. */\ninterface AuthConstruct {\n\tid: string;\n\tdatabaseId: string;\n\tpendingMigration(\n\t\toptions: ServiceRegisterOptions,\n\t): Promise<string | undefined>;\n}\n\nfunction authConstruct(\n\tsources: Readonly<Record<string, ConstructSource>>,\n\tid: string,\n): AuthConstruct | undefined {\n\tconst construct = sources[id]?.construct as\n\t\t| Partial<AuthConstruct>\n\t\t| undefined;\n\treturn construct &&\n\t\ttypeof construct.pendingMigration === 'function' &&\n\t\ttypeof construct.databaseId === 'string'\n\t\t? (construct as AuthConstruct)\n\t\t: undefined;\n}\n\nfunction authIds(sources: Readonly<Record<string, ConstructSource>>): string[] {\n\treturn Object.keys(sources).filter((id) => authConstruct(sources, id));\n}\n\nasync function writeAuthMigration(\n\tready: ReadyStage,\n\tauth: AuthConstruct,\n\ttarget: MigrationTarget,\n\toptions: MigrationOptions,\n): Promise<string | undefined> {\n\t// Against a tenant already at its committed migrations, so the comparison\n\t// finds only what the files do not yet say.\n\tawait migrateDatabases({\n\t\troot: ready.workspace.root,\n\t\tmanifest: ready.manifest,\n\t\tsources: ready.sources,\n\t\tenv: ready.env,\n\t\tonly: target.id,\n\t});\n\n\t// Its secret and URL come from the stage's secrets; the tenant's owner URL\n\t// from the reconcile, which wins.\n\tconst pending = await auth.pendingMigration({\n\t\tenvParser: new EnvironmentParser(ready.env),\n\t\tcontext: serviceContext,\n\t});\n\n\tif (!pending) {\n\t\tlogger.log(`✓ ${target.migrations}: ${auth.id} is up to date`);\n\t\treturn undefined;\n\t}\n\n\tconst file = await write(\n\t\tready.workspace.root,\n\t\ttarget,\n\t\t`${stamp(options.now)}_${slug(options.name ?? 'better_auth')}.sql`,\n\t\t`${pending.trim()}\\n`,\n\t);\n\tlogger.log(`📝 ${file}`);\n\treturn file;\n}\n\nconst STUB = `import type { Kysely } from 'kysely';\n\nexport async function up(db: Kysely<unknown>): Promise<void> {\n // await db.schema.createTable('…').addColumn(…).execute();\n}\n\nexport async function down(db: Kysely<unknown>): Promise<void> {\n // await db.schema.dropTable('…').execute();\n}\n`;\n\nasync function write(\n\troot: string,\n\ttarget: MigrationTarget,\n\tfile: string,\n\tcontent: string,\n): Promise<string> {\n\tconst folder = join(root, target.migrations);\n\tawait mkdir(folder, { recursive: true });\n\tawait writeFile(join(folder, file), content, { flag: 'wx' });\n\treturn `${target.migrations}/${file}`;\n}\n\nfunction ids(targets: readonly MigrationTarget[]): string[] {\n\treturn targets.map((target) => target.id);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA2EA,MAAM,SAAS;;AAGf,IAAa,uBAAb,cAA0C,SAAS;CAExC;CACA;CAFV,YACC,OACA,OACC;EACD,MACC,IAAI,MAAM,8EACe,MAAM,gEACG,MAAM,QAAQ,WAAW,GAC5D;EAPS,KAAA,QAAA;EACA,KAAA,QAAA;EAOT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,qBAAb,cAAwC,SAAS;CAC3B;CAArB,YAAY,WAA4B;EACvC,MACC,uCAAuC,UAAU,yEAElD;EAJoB,KAAA,YAAA;EAKpB,KAAK,OAAO;CACb;AACD;;;;;;;;AA+BA,eAAsB,WACrB,KACA,OACsB;CACtB,MAAM,EAAE,cAAc,MAAM,oBAAoB,GAAG;CACnD,MAAM,QAAQ,UAAU,OAAO;CAC/B,MAAM,SAAS,SAAS;CACxB,IAAI,WAAW,SAAS,WAAA,QACvB,MAAM,IAAI,qBAAqB,QAAQ,KAAK;CAG7C,MAAM,UAA2C,CAAC;CAClD,MAAM,WAAW,MAAM,SAAS;EAC/B,UAAU,eAAe,SAAS;EAClC,KAAK,UAAU;EACf;CACD,CAAC;CAED,MAAM,aAAa,MAAM,mBAAmB,WAAW;EACtD,OAAO;EACP;EACA,OAAO;CACR,CAAC;CAID,MAAM,UAAU,MAAM,kBACrB,MAAM,gBAAgB,WAAW,KAAK,GACtC,KACD;CAEA,OAAO;EACN;EACA;EACA;EACA,KAAK,SAAS,SAAS,WAAW,GAAG;EACrC,OAAO;CACR;AACD;;AAGA,eAAsB,eACrB,UAA0B,CAAC,GACX;CAChB,MAAM,QAAQ,MAAM,WAAW,QAAQ,IAAI,GAAG,QAAQ,KAAK;CAE3D,MAAM,OAAO,MAAM,iBAAiB;EACnC,MAAM,MAAM,UAAU;EACtB,UAAU,MAAM;EAChB,SAAS,MAAM;EACf,KAAK,MAAM;EACX,GAAI,QA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A,MACA,SACkB;CAClB,MAAM,SAAS,KAAK,MAAM,OAAO,UAAU;CAC3C,MAAM,MAAM,QAAQ,EAAE,WAAW,KAAK,CAAC;CACvC,MAAM,UAAU,KAAK,QAAQ,IAAI,GAAG,SAAS,EAAE,MAAM,KAAK,CAAC;CAC3D,OAAO,GAAG,OAAO,WAAW,GAAG;AAChC;AAEA,SAAS,IAAI,SAA+C;CAC3D,OAAO,QAAQ,KAAK,WAAW,OAAO,EAAE;AACzC"}
@@ -0,0 +1,500 @@
1
+ const require_errors = require("./errors-DMC4Umsb.cjs");
2
+ const require_workspace = require("./workspace-Dkm3HL9e.cjs");
3
+ const require_apps = require("./apps-CPdR2pYw.cjs");
4
+ const require_config = require("./config-QAqAEgb0.cjs");
5
+ let _geekmidas_manifest = require("@geekmidas/manifest");
6
+ //#region src/deploy/devServices.ts
7
+ /**
8
+ * Mail and object storage on a deployed stage: real ones, or — only when
9
+ * someone asked — the dev services the local stage runs.
10
+ *
11
+ * Locally a declared `Email` is Mailpit and a declared bucket is MinIO, and
12
+ * nobody has to configure either. Deployed, the same two containers would be
13
+ * a stage that silently delivers no mail and keeps its files on one
14
+ * container's disk. So a deployed stage on a server target takes both from
15
+ * its secrets — the mail server's URL and sending address, and each bucket's
16
+ * URL — and a stage missing any of them fails before anything is built,
17
+ * provisioned or written, naming every key at once.
18
+ *
19
+ * A bucket's credentials are not checked: they are optional, and come from
20
+ * either of two places. The bucket's URL may carry a key of its own
21
+ * (`s3://KEY:SECRET@uploads`), which wins; otherwise the S3 client's default
22
+ * chain applies — the stage's shared `AWS_ACCESS_KEY_ID`/
23
+ * `AWS_SECRET_ACCESS_KEY` when it set them, or a role.
24
+ *
25
+ * `--allow-dev-services` is the way out for a stage that is not production —
26
+ * a preview, a demo: every construct the stage does not account for gets the
27
+ * dev service the local stage runs for it — a bucket MinIO, mail Mailpit —
28
+ * and the target derives the keys from it. What the stage does account for
29
+ * still wins: a key set in its secrets, or a provider (`deploy.objects`)
30
+ * that backs the kind. Every run that uses one says so, loudly.
31
+ *
32
+ * Pure: what each target runs is decided here from declarations and the
33
+ * stage's values, and the targets do the running.
34
+ */
35
+ /**
36
+ * The dev services a deployed stage can run — one per kind that has one on
37
+ * every server target: a bucket's MinIO and mail's Mailpit. A cache or a
38
+ * database is not here because a server stage runs its own anyway.
39
+ */
40
+ const DEV_SERVICES = ["minio", "mailpit"];
41
+ /**
42
+ * The S3 client's shared key pair. Optional: a bucket whose URL carries its own
43
+ * key (`s3://KEY:SECRET@bucket`) signs with that, and one without signs with
44
+ * this pair when the stage set it, or with whatever else the SDK's default
45
+ * chain finds — a role.
46
+ */
47
+ const STORAGE_KEY_PAIR = ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY"];
48
+ /** Dev services asked of a target that runs no containers. */
49
+ var DevServicesNeedServerTarget = class extends require_errors.GkmError {
50
+ target;
51
+ constructor(target) {
52
+ super(`--allow-dev-services applies to server targets only, and '${target}' deploys to AWS, where a bucket is S3 and mail is the stage's own. Drop --allow-dev-services.`);
53
+ this.target = target;
54
+ this.name = "DevServicesNeedServerTarget";
55
+ }
56
+ };
57
+ /**
58
+ * `--allow-dev-services` given a value — the list it used to take. It is a
59
+ * switch now: every construct the stage does not account for gets its dev
60
+ * service.
61
+ */
62
+ var AllowDevServicesTakesNoValue = class extends require_errors.GkmError {
63
+ value;
64
+ constructor(value) {
65
+ super(`--allow-dev-services takes no value (it was given '${value}'). It runs the dev service for every bucket and mail the stage does not account for — no key in its secrets, no provider in deploy.<kind>.<stage> — so there is nothing to list. Pass --allow-dev-services on its own.`);
66
+ this.value = value;
67
+ this.name = "AllowDevServicesTakesNoValue";
68
+ }
69
+ };
70
+ /**
71
+ * Refuses `--allow-dev-services <value>` and `--allow-dev-services=<value>` on
72
+ * a command line, with the reason, before the parser calls the value an
73
+ * excess argument. `gkm deploy` and `gkm compose` take no positional
74
+ * argument, so whatever follows the flag and is not a flag was meant for it.
75
+ *
76
+ * @throws {AllowDevServicesTakesNoValue}
77
+ */
78
+ function assertDevServicesFlag(argv) {
79
+ for (let i = 0; i < argv.length; i++) {
80
+ const arg = argv[i];
81
+ if (arg.startsWith("--allow-dev-services=")) throw new AllowDevServicesTakesNoValue(arg.slice(arg.indexOf("=") + 1));
82
+ const next = argv[i + 1];
83
+ if (arg === "--allow-dev-services" && next && !next.startsWith("-")) throw new AllowDevServicesTakesNoValue(next);
84
+ }
85
+ }
86
+ /**
87
+ * A deployed stage with mail or object storage that its secrets do not
88
+ * configure — every missing key, across every app, at once.
89
+ */
90
+ var ExternalServicesNotConfigured = class extends require_errors.GkmError {
91
+ stage;
92
+ missing;
93
+ constructor(stage, missing) {
94
+ const standIns = missing.some((m) => m.service !== void 0);
95
+ const lines = missing.map((m) => {
96
+ const by = m.apps?.length ? `, read by ${m.apps.join(", ")}` : "";
97
+ return ` gkm secrets:set ${m.key} '${m.example}' --stage ${stage}\n ${m.what}${by}` + (m.note ? `\n ${m.note}` : "") + (m.hint ? `\n ${m.hint}` : "");
98
+ });
99
+ super(`The stage '${stage}' is deployed, and a deployed stage's mail and object storage are real services: gkm runs no Mailpit or MinIO for it. Set ${missing.length === 1 ? "this key" : `these ${missing.length} keys`} in the stage's secrets:\n\n${lines.join("\n")}\n\n` + (standIns ? "For a stage that is not production — a preview, a demo — the dev services can run instead, with --allow-dev-services. Mailpit delivers no mail, and MinIO keeps every object on one container's disk.\n\n" : "") + `Or run: gkm secrets:add --stage ${stage}`);
100
+ this.stage = stage;
101
+ this.missing = missing;
102
+ this.name = "ExternalServicesNotConfigured";
103
+ }
104
+ };
105
+ /** The kinds a deployed stage takes from its secrets, or a dev service. */
106
+ const SERVICE_KINDS = {
107
+ email: "email",
108
+ objects: "objects",
109
+ "file-server": "file-server"
110
+ };
111
+ /**
112
+ * Every mail and storage construct a manifest declares, each with the apps
113
+ * and workers that read it — a process's environment, a site's build args. A
114
+ * file server's reader reads its bucket too.
115
+ *
116
+ * The one list a deploy's readiness check refuses a stage by, every server
117
+ * target decides its dev services from, and `gkm secrets:add` offers — so
118
+ * none of them can disagree.
119
+ */
120
+ function stageServiceDeclarations(input) {
121
+ const { manifest } = input;
122
+ const owners = /* @__PURE__ */ new Map();
123
+ for (const [id, declaration] of Object.entries(manifest)) {
124
+ if (!SERVICE_KINDS[declaration.kind]) continue;
125
+ owners.set((0, _geekmidas_manifest.provideKey)(id, "url"), id);
126
+ if (declaration.kind === "email") owners.set((0, _geekmidas_manifest.provideKey)(id, "from"), id);
127
+ }
128
+ const readers = /* @__PURE__ */ new Map();
129
+ const read = (process, keys) => {
130
+ for (const key of keys) {
131
+ const id = owners.get(key);
132
+ if (!id) continue;
133
+ const declaration = manifest[id];
134
+ const of = declaration?.kind === "file-server" ? declaration.of : void 0;
135
+ for (const owner of of ? [id, of] : [id]) {
136
+ const set = readers.get(owner) ?? /* @__PURE__ */ new Set();
137
+ set.add(process);
138
+ readers.set(owner, set);
139
+ }
140
+ }
141
+ };
142
+ for (const [id, declaration] of Object.entries(manifest)) {
143
+ const name = require_config.appKey(id);
144
+ if (declaration.kind === "rest-api" || declaration.kind === "websocket-api" || declaration.kind === "site" || declaration.kind === "mobile-app") read(name, require_apps.appEnvKeys(manifest, name) ?? []);
145
+ if (declaration.kind === "site") read(name, Object.values((0, _geekmidas_manifest.publicEnvFor)(declaration, manifest)));
146
+ if (declaration.kind === "worker") read(name, require_apps.workerEnvKeys(manifest, id) ?? []);
147
+ }
148
+ return Object.entries(manifest).flatMap(([id, declaration]) => {
149
+ const kind = SERVICE_KINDS[declaration.kind];
150
+ if (!kind) return [];
151
+ const apps = [...readers.get(id) ?? []].sort();
152
+ return [{
153
+ id,
154
+ kind,
155
+ ...declaration.kind === "file-server" && declaration.of ? { of: declaration.of } : {},
156
+ ...apps.length ? { apps } : {}
157
+ }];
158
+ });
159
+ }
160
+ /**
161
+ * Every key a stage must be given rather than derive — the one list both a
162
+ * deploy's checks and `gkm secrets:add` read, so what a deploy refuses and
163
+ * what the builder offers cannot drift.
164
+ *
165
+ * - Deployed, mail is its URL and its sending address, a bucket its URL, and
166
+ * a file server its public URL. Locally all of it is Mailpit and MinIO.
167
+ * - On every stage, a third party's credentials: nobody but the third party
168
+ * can issue them.
169
+ *
170
+ * Never a derived value: a database URL, a generated secret, the seed.
171
+ */
172
+ function requiredStageKeys(input) {
173
+ const domain = input.domain ?? "example.com";
174
+ const keys = [];
175
+ const add = (entry) => {
176
+ if (!keys.some((k) => k.key === entry.key)) keys.push(entry);
177
+ };
178
+ const byId = (list) => [...list ?? []].sort((a, b) => a.id.localeCompare(b.id));
179
+ const apps = (d) => d.apps?.length ? { apps: [...d.apps].sort() } : {};
180
+ if (!input.local) {
181
+ const services = byId(input.services);
182
+ const objects = input.providers?.objects;
183
+ const storage = objects?.accounted ? objects.hint ? { hint: objects.hint } : {} : { service: "minio" };
184
+ for (const d of services.filter((d) => d.kind === "email")) {
185
+ add({
186
+ key: (0, _geekmidas_manifest.provideKey)(d.id, "url"),
187
+ id: d.id,
188
+ kind: "email",
189
+ what: `where '${d.id}' sends mail — any SMTP server`,
190
+ example: `smtp://user:password@smtp.${domain}:587`,
191
+ service: "mailpit",
192
+ ...apps(d)
193
+ });
194
+ add({
195
+ key: (0, _geekmidas_manifest.provideKey)(d.id, "from"),
196
+ id: d.id,
197
+ kind: "email",
198
+ what: `the address '${d.id}' sends from, on a domain the mail server has verified`,
199
+ example: `noreply@${domain}`,
200
+ service: "mailpit",
201
+ ...apps(d)
202
+ });
203
+ }
204
+ for (const d of services.filter((d) => d.kind === "objects")) add({
205
+ key: (0, _geekmidas_manifest.provideKey)(d.id, "url"),
206
+ id: d.id,
207
+ kind: "bucket",
208
+ what: `the bucket '${d.id}' — S3, R2, or any S3-compatible store (add &endpoint=… for one that is not S3)`,
209
+ note: `credentials are optional: a key for this bucket alone in the URL (s3://KEY:SECRET@${require_config.appKey(d.id)}?…) wins; without one, the shared AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY or a role signs`,
210
+ example: `s3://${require_config.appKey(d.id)}?region=eu-west-1`,
211
+ ...storage,
212
+ ...apps(d)
213
+ });
214
+ for (const d of services.filter((d) => d.kind === "file-server")) add({
215
+ key: (0, _geekmidas_manifest.provideKey)(d.id, "url"),
216
+ id: d.id,
217
+ kind: "file-server",
218
+ what: `the public address '${d.id}' serves its bucket on — a CDN or the bucket's own domain`,
219
+ example: `https://${require_config.appKey(d.id)}.${domain}`,
220
+ ...storage,
221
+ ...d.of ? { of: d.of } : {},
222
+ ...apps(d)
223
+ });
224
+ }
225
+ if (!input.local && input.server) add({
226
+ key: require_workspace.SERVER_IPV4_KEY,
227
+ id: "server",
228
+ kind: "server",
229
+ what: "the public IPv4 address of the server the stage's stack runs on — its hosts' DNS records point at it, and every deploy checks they do",
230
+ note: `${require_workspace.SERVER_IPV6_KEY} adds its IPv6 address (AAAA records); neither is ever handed to an app`,
231
+ example: "203.0.113.10"
232
+ });
233
+ for (const d of byId(input.credentials)) add({
234
+ key: (0, _geekmidas_manifest.provideKey)(d.id, "credentials"),
235
+ id: d.id,
236
+ kind: d.kind,
237
+ what: d.kind === "external-api" ? `the credentials '${d.id}' was issued for this stage, as its schema describes them` : `the credential '${d.id}', as its schema describes it`,
238
+ example: "{\"apiKey\":\"…\"}",
239
+ ...apps(d)
240
+ });
241
+ return keys;
242
+ }
243
+ /**
244
+ * Whether only the stage's secrets can supply `key` to a construct of `kind`
245
+ * — what nothing on the stage derives.
246
+ *
247
+ * A third party's credentials, always. Deployed, also each generated secret
248
+ * and keyring: the stage generated each one once, and every run reads the
249
+ * same value back.
250
+ */
251
+ function suppliedOnly(kind, id, key, local) {
252
+ if (kind === "credential") return true;
253
+ if (kind === "external-api") return key === (0, _geekmidas_manifest.provideKey)(id, "credentials");
254
+ if (local) return false;
255
+ return kind === "secret" || kind === "encryption";
256
+ }
257
+ /**
258
+ * Where a deployed stage's mail and storage come from, and what it lacks.
259
+ *
260
+ * - Mail is external once its URL is set, and then needs its sending
261
+ * address too. Unset, it is Mailpit where allowed — the address derived
262
+ * unless set — and missing otherwise.
263
+ * - A bucket is external once its URL is set; its credentials, in the URL or
264
+ * the shared pair, are optional. Unset, it is MinIO where allowed, and
265
+ * missing otherwise.
266
+ * - A file server's URL is derived where its bucket is MinIO, unless set;
267
+ * over an external bucket the stage must set it.
268
+ *
269
+ * The keys themselves are {@link requiredStageKeys}'s.
270
+ */
271
+ function externalServices(input) {
272
+ const { supplied, allow } = input;
273
+ const has = (key) => supplied[key] !== void 0;
274
+ const required = requiredStageKeys({
275
+ local: false,
276
+ services: input.declarations,
277
+ ...input.domain ? { domain: input.domain } : {},
278
+ ...input.providers ? { providers: input.providers } : {}
279
+ });
280
+ const standIn = (k) => allow && k.service !== void 0 && !has(k.key);
281
+ const mailpit = required.filter((k) => k.kind === "email" && k.key === (0, _geekmidas_manifest.provideKey)(k.id, "url")).filter(standIn).map((k) => k.id);
282
+ const minio = required.filter((k) => k.kind === "bucket").filter(standIn).map((k) => k.id);
283
+ const covered = (k) => k.kind === "email" && mailpit.includes(k.id) || k.kind === "bucket" && minio.includes(k.id) || k.kind === "file-server" && k.of !== void 0 && minio.includes(k.of);
284
+ return {
285
+ missing: required.filter((k) => !has(k.key) && !covered(k)).map(({ key, id, what, note, example, service, apps, hint }) => ({
286
+ key,
287
+ id,
288
+ what,
289
+ ...note ? { note } : {},
290
+ example,
291
+ ...service ? { service } : {},
292
+ ...apps ? { apps } : {},
293
+ ...hint ? { hint } : {}
294
+ })),
295
+ minio,
296
+ mailpit
297
+ };
298
+ }
299
+ /** The dev services a run uses, one entry per service it runs. */
300
+ function devServicesUsed(services) {
301
+ const used = [];
302
+ if (services.mailpit.length > 0) used.push({
303
+ service: "mailpit",
304
+ ids: services.mailpit
305
+ });
306
+ if (services.minio.length > 0) used.push({
307
+ service: "minio",
308
+ ids: services.minio
309
+ });
310
+ return used;
311
+ }
312
+ /** The line a run prints for each dev service a deployed stage uses. */
313
+ function devServiceWarning(stage, use) {
314
+ return `⚠️ DEV SERVICE ON A DEPLOYED STAGE (${stage}): ${use.service === "mailpit" ? `Mailpit is catching mail for ${use.ids.join(", ")}. It delivers NO mail: nobody receives a sign-in link, a receipt or a reset` : `MinIO is storing ${use.ids.join(", ")}. Every object is on one container's disk, with no replication and no backup`}. It is not production-grade — set the stage's own keys in its secrets for that.`;
315
+ }
316
+ /**
317
+ * Report each dev service a run uses: a loud line, and a `dev-service.used`
318
+ * event a host can act on.
319
+ */
320
+ function reportDevServices(ctx, uses) {
321
+ for (const use of uses) {
322
+ ctx.logger.warn(`\n${devServiceWarning(ctx.stage, use)}`);
323
+ ctx.emit({
324
+ type: "dev-service.used",
325
+ service: use.service,
326
+ stage: ctx.stage,
327
+ constructs: use.ids
328
+ });
329
+ }
330
+ }
331
+ //#endregion
332
+ //#region src/providers/types.ts
333
+ /** The manifest kinds a stage can name a provider for. */
334
+ const PROVIDER_KINDS = ["objects", "inbox"];
335
+ //#endregion
336
+ //#region src/providers/notes.ts
337
+ /** The constructs of a kind: `objects` is every bucket. */
338
+ function constructsOf(manifest, kind) {
339
+ return Object.entries(manifest).filter(([, d]) => d.kind === kind).map(([id]) => id).sort();
340
+ }
341
+ /** A stage that names `false` for a kind, and declares constructs of it. */
342
+ var StageProviderDisabled = class extends require_errors.GkmError {
343
+ kind;
344
+ stage;
345
+ ids;
346
+ constructor(kind, stage, ids) {
347
+ super(`deploy.${kind}.${stage} is false — the stage has no ${kind} — and ${ids.join(", ")} ${ids.length === 1 ? "is" : "are"} declared. Name what backs ${ids.length === 1 ? "it" : "them"} on '${stage}' (deploy.${kind}.${stage}: 'external', or a provider), or remove the ${ids.length === 1 ? "construct" : "constructs"}.`);
348
+ this.kind = kind;
349
+ this.stage = stage;
350
+ this.ids = ids;
351
+ this.name = "StageProviderDisabled";
352
+ }
353
+ };
354
+ /** The command a stage's providers are run with: every deploy runs them. */
355
+ function provisionCommand(stage) {
356
+ return `gkm deploy --stage ${stage}`;
357
+ }
358
+ /**
359
+ * The line a stage missing a key a provider would write is given: what
360
+ * creates it, and with which credentials. Undefined when no provider backs
361
+ * the kind on the stage.
362
+ */
363
+ function provisionHint(workspace, kind, stage) {
364
+ const choice = require_workspace.stageProvider(workspace, kind, stage);
365
+ if (choice.mode !== "provider") return void 0;
366
+ const provisioning = require_workspace.provisioningOf(kind, choice.name);
367
+ if (!provisioning) return void 0;
368
+ return `deploy.${kind}.${stage} is ${choice.name}: the deploy (${provisionCommand(stage)}) creates it and writes this key, with ${provisioning.describe}` + (provisioning.login ? `, or gkm login --provider ${provisioning.login}` : "");
369
+ }
370
+ /**
371
+ * What a deploy's checks read off the stage's providers: whether each kind is
372
+ * accounted for — a provider, or `false` — so no dev service stands in for
373
+ * it, and what creates a missing key of it.
374
+ */
375
+ function stageProviderNotes(workspace, stage) {
376
+ if (require_workspace.stageProvider(workspace, "objects", stage).mode === "external") return {};
377
+ const hint = provisionHint(workspace, "objects", stage);
378
+ return { objects: {
379
+ accounted: true,
380
+ ...hint ? { hint } : {}
381
+ } };
382
+ }
383
+ /**
384
+ * A kind the stage set to `false`, declared anyway — refused before anything
385
+ * else is checked. Pure: what a stack is composed from.
386
+ *
387
+ * @throws {StageProviderDisabled}
388
+ */
389
+ function assertStageProvidersEnabled(workspace, manifest, stage) {
390
+ for (const kind of PROVIDER_KINDS) {
391
+ const ids = constructsOf(manifest, kind);
392
+ if (ids.length === 0) continue;
393
+ if (require_workspace.stageProvider(workspace, kind, stage).mode === "none") throw new StageProviderDisabled(kind, stage, ids);
394
+ }
395
+ }
396
+ //#endregion
397
+ Object.defineProperty(exports, "AllowDevServicesTakesNoValue", {
398
+ enumerable: true,
399
+ get: function() {
400
+ return AllowDevServicesTakesNoValue;
401
+ }
402
+ });
403
+ Object.defineProperty(exports, "DEV_SERVICES", {
404
+ enumerable: true,
405
+ get: function() {
406
+ return DEV_SERVICES;
407
+ }
408
+ });
409
+ Object.defineProperty(exports, "DevServicesNeedServerTarget", {
410
+ enumerable: true,
411
+ get: function() {
412
+ return DevServicesNeedServerTarget;
413
+ }
414
+ });
415
+ Object.defineProperty(exports, "ExternalServicesNotConfigured", {
416
+ enumerable: true,
417
+ get: function() {
418
+ return ExternalServicesNotConfigured;
419
+ }
420
+ });
421
+ Object.defineProperty(exports, "PROVIDER_KINDS", {
422
+ enumerable: true,
423
+ get: function() {
424
+ return PROVIDER_KINDS;
425
+ }
426
+ });
427
+ Object.defineProperty(exports, "STORAGE_KEY_PAIR", {
428
+ enumerable: true,
429
+ get: function() {
430
+ return STORAGE_KEY_PAIR;
431
+ }
432
+ });
433
+ Object.defineProperty(exports, "StageProviderDisabled", {
434
+ enumerable: true,
435
+ get: function() {
436
+ return StageProviderDisabled;
437
+ }
438
+ });
439
+ Object.defineProperty(exports, "assertDevServicesFlag", {
440
+ enumerable: true,
441
+ get: function() {
442
+ return assertDevServicesFlag;
443
+ }
444
+ });
445
+ Object.defineProperty(exports, "assertStageProvidersEnabled", {
446
+ enumerable: true,
447
+ get: function() {
448
+ return assertStageProvidersEnabled;
449
+ }
450
+ });
451
+ Object.defineProperty(exports, "devServicesUsed", {
452
+ enumerable: true,
453
+ get: function() {
454
+ return devServicesUsed;
455
+ }
456
+ });
457
+ Object.defineProperty(exports, "externalServices", {
458
+ enumerable: true,
459
+ get: function() {
460
+ return externalServices;
461
+ }
462
+ });
463
+ Object.defineProperty(exports, "provisionCommand", {
464
+ enumerable: true,
465
+ get: function() {
466
+ return provisionCommand;
467
+ }
468
+ });
469
+ Object.defineProperty(exports, "reportDevServices", {
470
+ enumerable: true,
471
+ get: function() {
472
+ return reportDevServices;
473
+ }
474
+ });
475
+ Object.defineProperty(exports, "requiredStageKeys", {
476
+ enumerable: true,
477
+ get: function() {
478
+ return requiredStageKeys;
479
+ }
480
+ });
481
+ Object.defineProperty(exports, "stageProviderNotes", {
482
+ enumerable: true,
483
+ get: function() {
484
+ return stageProviderNotes;
485
+ }
486
+ });
487
+ Object.defineProperty(exports, "stageServiceDeclarations", {
488
+ enumerable: true,
489
+ get: function() {
490
+ return stageServiceDeclarations;
491
+ }
492
+ });
493
+ Object.defineProperty(exports, "suppliedOnly", {
494
+ enumerable: true,
495
+ get: function() {
496
+ return suppliedOnly;
497
+ }
498
+ });
499
+
500
+ //# sourceMappingURL=notes-B655tUny.cjs.map