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

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-BJddaEFo.mjs} +2 -3
  6. package/dist/{GoDaddyProvider-DxFAueU4.mjs.map → GoDaddyProvider-BJddaEFo.mjs.map} +1 -1
  7. package/dist/{GoDaddyProvider-hAc0q5s-.cjs → GoDaddyProvider-D-QrclQ0.cjs} +5 -6
  8. package/dist/{GoDaddyProvider-hAc0q5s-.cjs.map → GoDaddyProvider-D-QrclQ0.cjs.map} +1 -1
  9. package/dist/{HostingerProvider-DEqpvoiD.cjs → HostingerProvider-CUtGkwa8.cjs} +2 -2
  10. package/dist/{HostingerProvider-DEqpvoiD.cjs.map → HostingerProvider-CUtGkwa8.cjs.map} +1 -1
  11. package/dist/{HostingerProvider-CgMuKgO_.mjs → HostingerProvider-DilTLFtw.mjs} +2 -2
  12. package/dist/{HostingerProvider-CgMuKgO_.mjs.map → HostingerProvider-DilTLFtw.mjs.map} +1 -1
  13. package/dist/{LegacyStateStore-BPY8Acgs.mjs → LegacyStateStore-lZn6yeNb.mjs} +3 -3
  14. package/dist/{LegacyStateStore-BPY8Acgs.mjs.map → LegacyStateStore-lZn6yeNb.mjs.map} +1 -1
  15. package/dist/{LegacyStateStore-BqSVgWi1.cjs → LegacyStateStore-ohe95jlu.cjs} +3 -3
  16. package/dist/{LegacyStateStore-BqSVgWi1.cjs.map → LegacyStateStore-ohe95jlu.cjs.map} +1 -1
  17. package/dist/{LocalStateStore-Df4RyGi2.cjs → LocalStateStore-Bs2Yl8IB.cjs} +2 -2
  18. package/dist/{LocalStateStore-Df4RyGi2.cjs.map → LocalStateStore-Bs2Yl8IB.cjs.map} +1 -1
  19. package/dist/{LocalStateStore-5pVR26KA.mjs → LocalStateStore-CkpQ3sNu.mjs} +2 -2
  20. package/dist/{LocalStateStore-5pVR26KA.mjs.map → LocalStateStore-CkpQ3sNu.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-BO-TXIC9.mjs} +4 -4
  26. package/dist/{S3StateStore-Do1DwEMX.mjs.map → S3StateStore-BO-TXIC9.mjs.map} +1 -1
  27. package/dist/{S3StateStore-uykstvZI.cjs → S3StateStore-CsxqGwKX.cjs} +5 -5
  28. package/dist/{S3StateStore-uykstvZI.cjs.map → S3StateStore-CsxqGwKX.cjs.map} +1 -1
  29. package/dist/{SSMStateStore-DQXFWqkE.cjs → SSMStateStore-D85DzsxJ.cjs} +2 -2
  30. package/dist/{SSMStateStore-DQXFWqkE.cjs.map → SSMStateStore-D85DzsxJ.cjs.map} +1 -1
  31. package/dist/{SSMStateStore-xQ-Ce91W.mjs → SSMStateStore-DDNpIVIc.mjs} +2 -2
  32. package/dist/{SSMStateStore-xQ-Ce91W.mjs.map → SSMStateStore-DDNpIVIc.mjs.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-DLkN488n.mjs → add-CRAhswLe.mjs} +8 -7
  38. package/dist/{add-DLkN488n.mjs.map → add-CRAhswLe.mjs.map} +1 -1
  39. package/dist/{add-Y_nPkjIf.cjs → add-DiFv_IWD.cjs} +18 -17
  40. package/dist/{add-Y_nPkjIf.cjs.map → add-DiFv_IWD.cjs.map} +1 -1
  41. package/dist/apps-CA-048eZ.cjs +5008 -0
  42. package/dist/apps-CA-048eZ.cjs.map +1 -0
  43. package/dist/apps-CZ0ydmPQ.mjs +4593 -0
  44. package/dist/apps-CZ0ydmPQ.mjs.map +1 -0
  45. package/dist/{bundler-DFyrGST-.mjs → bundler-BIsNVJnB.mjs} +6 -6
  46. package/dist/{bundler-DFyrGST-.mjs.map → bundler-BIsNVJnB.mjs.map} +1 -1
  47. package/dist/{bundler-COOvv27I.cjs → bundler-D6Y2bucc.cjs} +9 -9
  48. package/dist/{bundler-COOvv27I.cjs.map → bundler-D6Y2bucc.cjs.map} +1 -1
  49. package/dist/{cli-DKsV-Myw.cjs → cli-6xibALWU.cjs} +4 -4
  50. package/dist/{cli-DKsV-Myw.cjs.map → cli-6xibALWU.cjs.map} +1 -1
  51. package/dist/{cli-iAX4BQ3t.mjs → cli-QwhW-X12.mjs} +4 -4
  52. package/dist/{cli-iAX4BQ3t.mjs.map → cli-QwhW-X12.mjs.map} +1 -1
  53. package/dist/compose-BHsW5nDE.mjs +1554 -0
  54. package/dist/compose-BHsW5nDE.mjs.map +1 -0
  55. package/dist/compose-C4kCN2tl.cjs +1895 -0
  56. package/dist/compose-C4kCN2tl.cjs.map +1 -0
  57. package/dist/{compose-ofZIpp2q.mjs → compose-E4-ZiWev.mjs} +17 -1828
  58. package/dist/compose-E4-ZiWev.mjs.map +1 -0
  59. package/dist/{compose-CGXx22Wy.cjs → compose-S_MY__b2.cjs} +102 -1967
  60. package/dist/compose-S_MY__b2.cjs.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-BnpIwWCS.cjs +2336 -0
  72. package/dist/credentials-BnpIwWCS.cjs.map +1 -0
  73. package/dist/credentials-zlJPxBWn.mjs +1851 -0
  74. package/dist/credentials-zlJPxBWn.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-0XI_bemB.cjs} +73 -72
  85. package/dist/{deploy-BibGpDAz.cjs.map → deploy-0XI_bemB.cjs.map} +1 -1
  86. package/dist/{deploy-C4QQkHK7.mjs → deploy-DJcEAscO.mjs} +16 -15
  87. package/dist/{deploy-C4QQkHK7.mjs.map → deploy-DJcEAscO.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-8gbw63RW.cjs +1514 -0
  93. package/dist/docker-8gbw63RW.cjs.map +1 -0
  94. package/dist/docker-C5w9_bWP.mjs +1407 -0
  95. package/dist/docker-C5w9_bWP.mjs.map +1 -0
  96. package/dist/{dokploy-pSrsileA.mjs → dokploy-BAjJ7MPB.mjs} +2 -2
  97. package/dist/{dokploy-pSrsileA.mjs.map → dokploy-BAjJ7MPB.mjs.map} +1 -1
  98. package/dist/{dokploy-B_VX3nLM.cjs → dokploy-DOYsnbiK.cjs} +2 -2
  99. package/dist/{dokploy-B_VX3nLM.cjs.map → dokploy-DOYsnbiK.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-Aaj9nbNp.cjs} +6 -6
  105. package/dist/{eas-cSSc8Lex.cjs.map → eas-Aaj9nbNp.cjs.map} +1 -1
  106. package/dist/{eas-Bou-_M76.mjs → eas-BpyYdquY.mjs} +3 -3
  107. package/dist/{eas-Bou-_M76.mjs.map → eas-BpyYdquY.mjs.map} +1 -1
  108. package/dist/{encryption-Bps9As2D.mjs → encryption-DYFTQaZ3.mjs} +3 -3
  109. package/dist/{encryption-Bps9As2D.mjs.map → encryption-DYFTQaZ3.mjs.map} +1 -1
  110. package/dist/{encryption-CElaAwJs.cjs → encryption-K2-9Ei8q.cjs} +6 -6
  111. package/dist/{encryption-CElaAwJs.cjs.map → encryption-K2-9Ei8q.cjs.map} +1 -1
  112. package/dist/{engine-CiG7Wfyc.cjs → engine-097i9gWA.cjs} +99 -97
  113. package/dist/{engine-CiG7Wfyc.cjs.map → engine-097i9gWA.cjs.map} +1 -1
  114. package/dist/{engine-CXE4UOHj.mjs → engine-CuFkswUS.mjs} +12 -10
  115. package/dist/{engine-CXE4UOHj.mjs.map → engine-CuFkswUS.mjs.map} +1 -1
  116. package/dist/{github-CvFJlFWA.mjs → github-DGaK_ulS.mjs} +9 -8
  117. package/dist/{github-CvFJlFWA.mjs.map → github-DGaK_ulS.mjs.map} +1 -1
  118. package/dist/{github-BzppIvpw.cjs → github-ZoKihAlP.cjs} +18 -17
  119. package/dist/{github-BzppIvpw.cjs.map → github-ZoKihAlP.cjs.map} +1 -1
  120. package/dist/{googlePlay-BJnMCWoa.cjs → googlePlay-BQ-62vre.cjs} +5 -5
  121. package/dist/{googlePlay-BJnMCWoa.cjs.map → googlePlay-BQ-62vre.cjs.map} +1 -1
  122. package/dist/{googlePlay-RSe9wOfZ.mjs → googlePlay-hw7Ej5yT.mjs} +5 -5
  123. package/dist/{googlePlay-RSe9wOfZ.mjs.map → googlePlay-hw7Ej5yT.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-B7Zv1NoA.mjs → local-CiJfYdrA.mjs} +3 -3
  129. package/dist/{local-B7Zv1NoA.mjs.map → local-CiJfYdrA.mjs.map} +1 -1
  130. package/dist/{local-OPC9BCZt.cjs → local-iC7qJkPl.cjs} +6 -6
  131. package/dist/{local-OPC9BCZt.cjs.map → local-iC7qJkPl.cjs.map} +1 -1
  132. package/dist/{migrate-B0nQra2W.mjs → migrate-CbjB-uxl.mjs} +3 -3
  133. package/dist/{migrate-B0nQra2W.mjs.map → migrate-CbjB-uxl.mjs.map} +1 -1
  134. package/dist/{migrate-BPCJBL7_.mjs → migrate-DTTn8YcN.mjs} +7 -5
  135. package/dist/{migrate-BPCJBL7_.mjs.map → migrate-DTTn8YcN.mjs.map} +1 -1
  136. package/dist/{migrate-BCBs0BMn.cjs → migrate-p1R0CSRw.cjs} +6 -6
  137. package/dist/{migrate-BCBs0BMn.cjs.map → migrate-p1R0CSRw.cjs.map} +1 -1
  138. package/dist/{migrate-Dmh5Dbcr.cjs → migrate-wH1DmtjX.cjs} +15 -13
  139. package/dist/{migrate-Dmh5Dbcr.cjs.map → migrate-wH1DmtjX.cjs.map} +1 -1
  140. package/dist/notes-CedXKWnt.mjs +399 -0
  141. package/dist/notes-CedXKWnt.mjs.map +1 -0
  142. package/dist/notes-ChbE7v2l.cjs +500 -0
  143. package/dist/notes-ChbE7v2l.cjs.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-C_DN4WzF.mjs → projectBucket-2Bw-Qy8D.mjs} +2 -2
  149. package/dist/{projectBucket-C_DN4WzF.mjs.map → projectBucket-2Bw-Qy8D.mjs.map} +1 -1
  150. package/dist/{projectBucket-BBbQ1lHF.cjs → projectBucket-CUJYUmt2.cjs} +2 -2
  151. package/dist/{projectBucket-BBbQ1lHF.cjs.map → projectBucket-CUJYUmt2.cjs.map} +1 -1
  152. package/dist/{publish-DKy3hn8a.cjs → publish-Byi0cB2N.cjs} +2 -2
  153. package/dist/{publish-DKy3hn8a.cjs.map → publish-Byi0cB2N.cjs.map} +1 -1
  154. package/dist/{publish-cthyGGQt.mjs → publish-DDsmxwl-.mjs} +2 -2
  155. package/dist/{publish-cthyGGQt.mjs.map → publish-DDsmxwl-.mjs.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-AYtMIgoq.cjs → resolve-CT6P86p3.cjs} +4 -4
  163. package/dist/{resolve-AYtMIgoq.cjs.map → resolve-CT6P86p3.cjs.map} +1 -1
  164. package/dist/{resolve-BaRqJlqV.mjs → resolve-zHOTcPk4.mjs} +4 -4
  165. package/dist/{resolve-BaRqJlqV.mjs.map → resolve-zHOTcPk4.mjs.map} +1 -1
  166. package/dist/{rollback-DqV6t9oo.mjs → rollback-CFowte36.mjs} +8 -8
  167. package/dist/{rollback-DqV6t9oo.mjs.map → rollback-CFowte36.mjs.map} +1 -1
  168. package/dist/{rollback-CQ184yFu.cjs → rollback-CYnroE_3.cjs} +11 -11
  169. package/dist/{rollback-CQ184yFu.cjs.map → rollback-CYnroE_3.cjs.map} +1 -1
  170. package/dist/{s3-BKnL6YGQ.cjs → s3-82kaV_R0.cjs} +2 -2
  171. package/dist/{s3-BKnL6YGQ.cjs.map → s3-82kaV_R0.cjs.map} +1 -1
  172. package/dist/{s3-DW7SLsb8.mjs → s3-D8u9j2C5.mjs} +2 -2
  173. package/dist/{s3-DW7SLsb8.mjs.map → s3-D8u9j2C5.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-AfG0-at8.mjs → serverSetup-B621zgYj.mjs} +7 -6
  189. package/dist/{serverSetup-AfG0-at8.mjs.map → serverSetup-B621zgYj.mjs.map} +1 -1
  190. package/dist/{serverSetup-Dnw9Kdel.cjs → serverSetup-Cip3ZWdi.cjs} +9 -8
  191. package/dist/{serverSetup-Dnw9Kdel.cjs.map → serverSetup-Cip3ZWdi.cjs.map} +1 -1
  192. package/dist/{sniffer-BHhJ8DiC.mjs → sniffer-BO7tNCDc.mjs} +8 -9
  193. package/dist/{sniffer-BHhJ8DiC.mjs.map → sniffer-BO7tNCDc.mjs.map} +1 -1
  194. package/dist/{sniffer-taO-AXSk.cjs → sniffer-Dxwe2yS0.cjs} +9 -10
  195. package/dist/{sniffer-taO-AXSk.cjs.map → sniffer-Dxwe2yS0.cjs.map} +1 -1
  196. package/dist/{snsSubscriptions-D_IBKhni.mjs → snsSubscriptions-CZlHrll5.mjs} +4 -453
  197. package/dist/snsSubscriptions-CZlHrll5.mjs.map +1 -0
  198. package/dist/{snsSubscriptions-CC-WM1zC.cjs → snsSubscriptions-CgWY_alK.cjs} +12 -559
  199. package/dist/snsSubscriptions-CgWY_alK.cjs.map +1 -0
  200. package/dist/{sst-Bz2HJlqc.mjs → sst-CnSAHj6j.mjs} +27 -5
  201. package/dist/sst-CnSAHj6j.mjs.map +1 -0
  202. package/dist/{sst-lvCHdYsY.cjs → sst-CtOI68mi.cjs} +29 -7
  203. package/dist/sst-CtOI68mi.cjs.map +1 -0
  204. package/dist/stack-BCHFuiWH.cjs +2577 -0
  205. package/dist/stack-BCHFuiWH.cjs.map +1 -0
  206. package/dist/stack-BrcNDH_E.mjs +2348 -0
  207. package/dist/stack-BrcNDH_E.mjs.map +1 -0
  208. package/dist/{stage-dd9dtLfh.mjs → stage-BhjwFQrw.mjs} +7 -7
  209. package/dist/{stage-dd9dtLfh.mjs.map → stage-BhjwFQrw.mjs.map} +1 -1
  210. package/dist/{stage-CTibxcpA.cjs → stage-DzH_iWgO.cjs} +13 -13
  211. package/dist/{stage-CTibxcpA.cjs.map → stage-DzH_iWgO.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-455ZtUjl.cjs} +3 -3
  219. package/dist/{terminal-DURcYlVX.cjs.map → terminal-455ZtUjl.cjs.map} +1 -1
  220. package/dist/{terminal-yOZ7kKF9.mjs → terminal-iEkwo0Bq.mjs} +3 -3
  221. package/dist/{terminal-yOZ7kKF9.mjs.map → terminal-iEkwo0Bq.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 +0,0 @@
1
- {"version":3,"file":"config.cjs","names":["existsSync","dirname","parse","join","GkmError","runWorker","activeSandbox","isWorkspaceConfig","processConfig","allConstructGlobs","discover","derivedApps","sep","resolve","realpathSync","getAppGkmConfig"],"sources":["../src/config.ts"],"sourcesContent":["import { existsSync, realpathSync } from 'node:fs';\nimport { dirname, join, parse, resolve, sep } from 'node:path';\nimport { z } from 'zod';\nimport { GkmError } from './errors';\nimport { output } from './output.js';\nimport { discover } from './reconcile/discover.js';\nimport { activeSandbox, type Sandbox } from './sandbox/sandbox.js';\nimport { runWorker } from './sandbox/worker.js';\nimport type { GkmConfig } from './types.js';\nimport { derivedApps } from './workspace/derive.js';\nimport {\n\tallConstructGlobs,\n\tgetAppGkmConfig,\n\tisWorkspaceConfig,\n\ttype LoadedConfig,\n\ttype NormalizedAppConfig,\n\ttype NormalizedWorkspace,\n\tprocessConfig,\n\ttype WorkspaceConfig,\n} from './workspace/index.js';\n\n// What `gkm dev`'s discovery endpoint answers, for the tools that read it.\nexport type {\n\tAppStatus,\n\tDataApiKind,\n\tDiscoveredApp,\n\tDiscoveredDataApi,\n\tDiscoveredWorkspace,\n\tDiscoveryEvent,\n\tDiscoveryResponse,\n} from './dev/discovery.js';\nexport type { GkmConfig } from './types.js';\nexport type { LoadedConfig, WorkspaceConfig } from './workspace/index.js';\nexport { defineWorkspace } from './workspace/index.js';\nexport type { DevConfig } from './workspace/types.js';\n/**\n * Define GKM configuration with full TypeScript support.\n * This is an identity function that provides type safety and autocomplete.\n *\n * @example\n * ```ts\n * // gkm.config.ts\n * import { defineConfig } from '@geekmidas/cli/config';\n *\n * export default defineConfig({\n * routes: './src/endpoints/**\\/*.ts',\n * envParser: './src/config/env',\n * logger: './src/config/logger',\n * telescope: true,\n * });\n * ```\n */\nexport function defineConfig(config: GkmConfig): GkmConfig {\n\treturn config;\n}\n\nexport interface ParsedModuleConfig {\n\tpath: string;\n\timportPattern: string;\n}\n\n/**\n * Parse a module config string into path and import pattern.\n *\n * @param configString - Config string in format \"./path/to/module\" or \"./path/to/module#exportName\"\n * @param defaultAlias - The default alias name to use if no export name specified\n * @returns Object with path and import pattern\n *\n * @example\n * parseModuleConfig('./src/config/env', 'envParser')\n * // { path: './src/config/env', importPattern: 'envParser' }\n *\n * parseModuleConfig('./src/config/env#envParser', 'envParser')\n * // { path: './src/config/env', importPattern: '{ envParser }' }\n *\n * parseModuleConfig('./src/config/env#myEnv', 'envParser')\n * // { path: './src/config/env', importPattern: '{ myEnv as envParser }' }\n */\nexport function parseModuleConfig(\n\tconfigString: string,\n\tdefaultAlias: string,\n): ParsedModuleConfig {\n\tconst parts = configString.split('#');\n\tconst path = parts[0] ?? configString;\n\tconst exportName = parts[1];\n\tconst importPattern = !exportName\n\t\t? defaultAlias\n\t\t: exportName === defaultAlias\n\t\t\t? `{ ${defaultAlias} }`\n\t\t\t: `{ ${exportName} as ${defaultAlias} }`;\n\n\treturn { path, importPattern };\n}\n\nexport interface ConfigDiscoveryResult {\n\tconfigPath: string;\n\tworkspaceRoot: string;\n}\n\n/**\n * Find and return the path to the config file.\n *\n * Resolution order:\n * 1. GKM_CONFIG_PATH env var (set by workspace dev command)\n * 2. Walk up directory tree from cwd\n */\nfunction findConfigPath(cwd: string): ConfigDiscoveryResult {\n\tconst files = ['gkm.config.json', 'gkm.config.ts', 'gkm.config.js'];\n\n\t// Check GKM_CONFIG_PATH env var first (set by workspace dev command)\n\tconst envConfigPath = process.env.GKM_CONFIG_PATH;\n\tif (envConfigPath && existsSync(envConfigPath)) {\n\t\treturn {\n\t\t\tconfigPath: envConfigPath,\n\t\t\tworkspaceRoot: dirname(envConfigPath),\n\t\t};\n\t}\n\n\t// Walk up directory tree to find config\n\tlet currentDir = cwd;\n\tconst { root } = parse(currentDir);\n\n\twhile (currentDir !== root) {\n\t\tfor (const file of files) {\n\t\t\tconst configPath = join(currentDir, file);\n\t\t\tif (existsSync(configPath)) {\n\t\t\t\treturn {\n\t\t\t\t\tconfigPath,\n\t\t\t\t\tworkspaceRoot: currentDir,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tcurrentDir = dirname(currentDir);\n\t}\n\n\tthrow new ConfigNotFound(cwd);\n}\n\n/**\n * The directory holding the gkm config that `cwd` belongs to — the project a\n * sandbox for it is confined to.\n *\n * @throws {ConfigNotFound} when neither `cwd` nor any parent has one.\n */\nexport function findWorkspaceRoot(cwd: string): string {\n\treturn findConfigPath(cwd).workspaceRoot;\n}\n\n/** No gkm config in a directory or any of its parents. */\nexport class ConfigNotFound extends GkmError {\n\tconstructor(readonly cwd: string) {\n\t\tsuper(\n\t\t\t'Configuration file not found. Please create gkm.config.json, gkm.config.ts, or gkm.config.js in the project root.',\n\t\t);\n\t\tthis.name = 'ConfigNotFound';\n\t}\n}\n\ninterface RawConfigResult {\n\tconfig: GkmConfig | WorkspaceConfig;\n\tworkspaceRoot: string;\n}\n\nexport interface LoadConfigOptions {\n\t/**\n\t * Load the config — and discover the constructs it names — in this\n\t * sandbox rather than in this process. The config then arrives as data;\n\t * see {@link Sandbox.isolating} for what happens to one holding live\n\t * objects. Defaults to the run's own (`withSandbox`); with neither, the\n\t * config is imported here, as `gkm` always has.\n\t */\n\tsandbox?: Sandbox;\n\t/**\n\t * How long the sandboxed config load may run. Defaults to\n\t * {@link CONFIG_LOAD_TIMEOUT_MS}.\n\t */\n\ttimeoutMs?: number;\n}\n\n/**\n * How long loading a config, or discovering its constructs, may take in a\n * sandbox: room for tsx to compile a large project cold, and not a deploy\n * held open by a config that never finishes importing.\n */\nexport const CONFIG_LOAD_TIMEOUT_MS = 60_000;\n\n/** The config failed to import, or threw while it ran. */\nexport class ConfigLoadFailed extends Error {\n\tconstructor(\n\t\treadonly configPath: string,\n\t\treadonly detail: string,\n\t) {\n\t\tsuper(`Failed to load config: ${detail}`);\n\t\tthis.name = 'ConfigLoadFailed';\n\t}\n}\n\n/**\n * The config holds something that is not data — a custom state store, an\n * inline deploy target, a function — and the sandbox it was loaded in hands\n * the deploy nothing but data.\n */\nexport class ConfigObjectNotSerializable extends Error {\n\tconstructor(\n\t\treadonly configPath: string,\n\t\treadonly paths: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`${configPath} holds values that are not plain data at: ` +\n\t\t\t\t`${paths.join(', ')}. It was loaded in an isolating sandbox, which ` +\n\t\t\t\t'hands the deploy the config as JSON, so a live object — a custom ' +\n\t\t\t\t'store, an inline target, a function — cannot reach it. Configure ' +\n\t\t\t\t'these with plain values instead, or deploy this project with a ' +\n\t\t\t\t'sandbox that is not isolating (the default) if the host trusts it.',\n\t\t);\n\t\tthis.name = 'ConfigObjectNotSerializable';\n\t}\n}\n\n/** What the config worker answers. Checked: the worker ran project code. */\nconst ConfigAnswer = z.discriminatedUnion('reason', [\n\tz.object({\n\t\treason: z.literal('loaded'),\n\t\tconfig: z.record(z.string(), z.unknown()),\n\t}),\n\tz.object({ reason: z.literal('live'), paths: z.array(z.string()) }),\n\tz.object({\n\t\treason: z.literal('failed'),\n\t\terror: z.object({ name: z.string(), message: z.string() }),\n\t}),\n]);\n\n/** Import the config in this process — live objects and all. */\nasync function importConfig(\n\tconfigPath: string,\n): Promise<GkmConfig | WorkspaceConfig> {\n\ttry {\n\t\tconst config = await import(configPath);\n\t\treturn config.default;\n\t} catch (error) {\n\t\tthrow new ConfigLoadFailed(configPath, (error as Error).message);\n\t}\n}\n\n/**\n * The config, loaded in `sandbox` and handed back as JSON.\n *\n * A config holding live objects cannot come back that way. An isolating\n * sandbox refuses it with {@link ConfigObjectNotSerializable}; any other\n * imports it here as well, as before, since the host already runs this\n * project's code as its own.\n */\nasync function loadConfigInSandbox(\n\tsandbox: Sandbox,\n\tconfigPath: string,\n\tworkspaceRoot: string,\n\ttimeoutMs = CONFIG_LOAD_TIMEOUT_MS,\n): Promise<GkmConfig | WorkspaceConfig> {\n\tconst { value } = await runWorker(sandbox, 'config load', {\n\t\tname: 'config-worker',\n\t\targs: [configPath],\n\t\tcwd: workspaceRoot,\n\t\ttimeoutMs,\n\t\tschema: ConfigAnswer,\n\t});\n\n\tswitch (value.reason) {\n\t\tcase 'loaded':\n\t\t\t// Its shape is `processConfig`'s to check, against the workspace\n\t\t\t// schema, exactly as for a config imported here.\n\t\t\treturn value.config as unknown as GkmConfig | WorkspaceConfig;\n\t\tcase 'failed':\n\t\t\tthrow new ConfigLoadFailed(configPath, value.error.message);\n\t\tcase 'live':\n\t\t\tif (sandbox.isolating) {\n\t\t\t\tthrow new ConfigObjectNotSerializable(configPath, value.paths);\n\t\t\t}\n\t\t\treturn importConfig(configPath);\n\t}\n}\n\n/**\n * Load raw configuration from file.\n */\nasync function loadRawConfig(\n\tcwd: string,\n\toptions: LoadConfigOptions = {},\n): Promise<RawConfigResult> {\n\tconst { configPath, workspaceRoot } = findConfigPath(cwd);\n\t// The run's own sandbox when none is given: a deploy reloads the config\n\t// deep in the engine (generating Dockerfiles), and that load is the\n\t// project's code as much as the first.\n\tconst sandbox = options.sandbox ?? activeSandbox();\n\tconst config = sandbox\n\t\t? await loadConfigInSandbox(\n\t\t\t\tsandbox,\n\t\t\t\tconfigPath,\n\t\t\t\tworkspaceRoot,\n\t\t\t\toptions.timeoutMs,\n\t\t\t)\n\t\t: await importConfig(configPath);\n\n\treturn { config, workspaceRoot };\n}\n\n/**\n * Load configuration file (single-app format).\n * For backwards compatibility with existing code.\n *\n * @deprecated Use loadWorkspaceConfig for new code\n */\nexport async function loadConfig(\n\tcwd: string = process.cwd(),\n): Promise<GkmConfig> {\n\tconst { config } = await loadRawConfig(cwd);\n\n\t// If it's a workspace config, throw an error\n\tif (isWorkspaceConfig(config)) {\n\t\tthrow new Error(\n\t\t\t'Workspace configuration detected. Use loadWorkspaceConfig() instead.',\n\t\t);\n\t}\n\n\treturn config;\n}\n\n/**\n * Load configuration file and process it as a workspace.\n * Works with both single-app and workspace configurations.\n *\n * Single-app configs are automatically wrapped as a workspace with one app.\n *\n * @example\n * ```ts\n * const { type, workspace } = await loadWorkspaceConfig();\n *\n * if (type === 'workspace') {\n * console.log('Multi-app workspace:', workspace.apps);\n * } else {\n * console.log('Single app wrapped as workspace');\n * }\n * ```\n */\n/**\n * The workspace a directory belongs to, as its config states it — without\n * discovering its constructs.\n *\n * For callers that need a fact the config holds (where a stage's secrets are\n * stored) and nothing the graph adds. `loadWorkspaceConfig` imports every\n * construct module to derive the apps, which is a cost a secrets read should\n * not pay.\n */\nexport async function loadWorkspaceSettings(\n\tcwd: string = process.cwd(),\n\toptions: LoadConfigOptions = {},\n): Promise<LoadedConfig['workspace']> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd, options);\n\treturn processConfig(config, workspaceRoot).workspace;\n}\n\nexport async function loadWorkspaceConfig(\n\tcwd: string = process.cwd(),\n\toptions: LoadConfigOptions = {},\n): Promise<LoadedConfig> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd, options);\n\treturn withDerivedApps(processConfig(config, workspaceRoot), options.sandbox);\n}\n\n/**\n * The loaded config, with its apps read off the graph.\n *\n * Here rather than at each call site because every command needs the same\n * answer, and the ones that forgot to ask were exactly the bugs: a site that\n * never deployed, a surface that could not be its own process. `gkm dev`,\n * `gkm build`, `gkm docker` and `gkm deploy` now all see the same apps without\n * any of them knowing a derivation happened.\n *\n * Discovery imports the construct modules — declarations only, not endpoints —\n * which is the same import the reconciler and the build already do. A workspace\n * with no `constructs` glob discovers nothing and keeps whatever its config\n * said, so nothing that worked before changes.\n *\n * A construct file that throws is reported and skipped rather than taking the\n * command down: `gkm dev` failing to start because a half-written declaration\n * cannot be imported is a worse failure than starting with the app it does not\n * describe yet.\n */\nasync function withDerivedApps(\n\tloaded: LoadedConfig,\n\tsandbox?: Sandbox,\n): Promise<LoadedConfig> {\n\tconst globs = allConstructGlobs(loaded.workspace);\n\tif (globs.length === 0) {\n\t\tthrow new WorkspaceDeclaresNoConstructs(loaded.workspace.root);\n\t}\n\n\ttry {\n\t\tconst background: Record<string, string[]> = {};\n\t\tconst manifest = await discover({\n\t\t\tpatterns: globs,\n\t\t\tcwd: loaded.workspace.root,\n\t\t\tbackground,\n\t\t\t...(sandbox ? { sandbox } : {}),\n\t\t});\n\n\t\treturn {\n\t\t\t...loaded,\n\t\t\tmanifest,\n\t\t\tbackground,\n\t\t\tworkspace: {\n\t\t\t\t...loaded.workspace,\n\t\t\t\tapps: derivedApps(manifest, loaded.workspace),\n\t\t\t},\n\t\t};\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\toutput.warn(\n\t\t\t`⚠️ Could not read constructs, so apps come from config alone: ${message}`,\n\t\t);\n\t\treturn loaded;\n\t}\n}\n\n/**\n * A workspace with no `constructs` glob.\n *\n * In v10 every address, container and app comes from what the workspace\n * declares — there is no second path that reads a hand-written compose file or\n * an `apps` block's ports. A config that declares nothing has nothing to run.\n */\nexport class WorkspaceDeclaresNoConstructs extends GkmError {\n\tconstructor(readonly root: string) {\n\t\tsuper(\n\t\t\t`The workspace at ${root} declares no constructs. Every workspace names ` +\n\t\t\t\t\"where its constructs live — `constructs: ['./constructs/**/*.ts', \" +\n\t\t\t\t\"'./apps/*/endpoints/**/*.ts']` in gkm.config.ts — and its apps, \" +\n\t\t\t\t'containers and URLs are derived from them.',\n\t\t);\n\t\tthis.name = 'WorkspaceDeclaresNoConstructs';\n\t}\n}\n\nexport interface AppConfigResult {\n\tappName: string;\n\tapp: NormalizedAppConfig;\n\tgkmConfig: GkmConfig;\n\tworkspace: NormalizedWorkspace;\n\tworkspaceRoot: string;\n\tappRoot: string;\n}\n\n/**\n * The app a directory is part of: the one whose `path` contains it.\n *\n * An app's path is the one its construct declares — `new RestApi('Api',\n * { path: 'apps/api' })` — read off the workspace the constructs were derived\n * into, never off the filesystem's package names. The deepest match wins, so\n * an app inside another app's folder is its own; the workspace root belongs to\n * no app unless one lives there.\n */\nfunction resolveWorkspaceApp(\n\tloadedConfig: LoadedConfig,\n\tcwd: string,\n): { key: string; app: NormalizedAppConfig } | undefined {\n\tconst here = real(cwd);\n\tlet found: { key: string; app: NormalizedAppConfig; dir: string } | undefined;\n\n\tfor (const [key, app] of Object.entries(loadedConfig.workspace.apps)) {\n\t\tconst dir = real(join(loadedConfig.workspace.root, app.path));\n\t\tconst inside = here === dir || here.startsWith(`${dir}${sep}`);\n\t\tif (inside && (!found || dir.length > found.dir.length)) {\n\t\t\tfound = { key, app, dir };\n\t\t}\n\t}\n\n\treturn found && { key: found.key, app: found.app };\n}\n\n/** A path with its symlinks resolved, where it exists — `/tmp` is `/private/tmp`. */\nfunction real(path: string): string {\n\tconst absolute = resolve(path);\n\treturn existsSync(absolute) ? realpathSync(absolute) : absolute;\n}\n\n/** A directory that no app in the workspace lives in. */\nexport class NotInAnApp extends GkmError {\n\tconstructor(\n\t\treadonly cwd: string,\n\t\treadonly apps: Readonly<Record<string, string>>,\n\t) {\n\t\tsuper(\n\t\t\t`${cwd} is not inside any app's path. Apps: ` +\n\t\t\t\tObject.entries(apps)\n\t\t\t\t\t.map(([key, path]) => `${key} (${path})`)\n\t\t\t\t\t.join(', ') +\n\t\t\t\t'.',\n\t\t);\n\t\tthis.name = 'NotInAnApp';\n\t}\n}\n\n/** Every app's path, by key — what `NotInAnApp` lists. */\nfunction appPaths(loadedConfig: LoadedConfig): Record<string, string> {\n\treturn Object.fromEntries(\n\t\tObject.entries(loadedConfig.workspace.apps).map(([key, app]) => [\n\t\t\tkey,\n\t\t\tapp.path,\n\t\t]),\n\t);\n}\n\n/**\n * The backend app a directory is part of, with its gkm config — found by the\n * `path` its construct declares.\n *\n * @example\n * ```ts\n * // From apps/api, where a construct declares `path: 'apps/api'`\n * const { app, workspace, workspaceRoot } = await loadAppConfig();\n * ```\n *\n * @throws {NotInAnApp} when no app's path contains the directory.\n * @throws {NotABackendApp} when the app it is in has no gkm config to run.\n */\nexport async function loadAppConfig(\n\tcwd: string = process.cwd(),\n): Promise<AppConfigResult> {\n\tconst { appName, app, workspace, workspaceRoot } =\n\t\tawait loadWorkspaceAppInfo(cwd);\n\n\tconst gkmConfig = getAppGkmConfig(workspace, appName);\n\tif (!gkmConfig) throw new NotABackendApp(appName);\n\n\treturn {\n\t\tappName,\n\t\tapp,\n\t\tgkmConfig,\n\t\tworkspace,\n\t\tworkspaceRoot,\n\t\tappRoot: join(workspaceRoot, app.path),\n\t};\n}\n\n/** The app a directory is in has no gkm config — a site, or an entry app. */\nexport class NotABackendApp extends GkmError {\n\tconstructor(readonly appName: string) {\n\t\tsuper(\n\t\t\t`App \"${appName}\" is not a backend app and cannot be run with gkm dev.`,\n\t\t);\n\t\tthis.name = 'NotABackendApp';\n\t}\n}\n\nexport interface WorkspaceAppInfo {\n\t/** The app's key in the workspace. */\n\tappName: string;\n\tapp: NormalizedAppConfig;\n\tworkspace: NormalizedWorkspace;\n\tworkspaceRoot: string;\n}\n\n/**\n * The app a directory is part of, frontend or backend — found by the `path`\n * its construct declares. Unlike `loadAppConfig`, the app need not have a\n * gkm config, which is what `gkm exec` and `gkm test` from a site need.\n *\n * @throws {NotInAnApp} when no app's path contains the directory.\n */\nexport async function loadWorkspaceAppInfo(\n\tcwd: string = process.cwd(),\n): Promise<WorkspaceAppInfo> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd);\n\tconst loadedConfig = await withDerivedApps(\n\t\tprocessConfig(config, workspaceRoot),\n\t);\n\n\tconst resolved = resolveWorkspaceApp(loadedConfig, cwd);\n\tif (!resolved) throw new NotInAnApp(cwd, appPaths(loadedConfig));\n\n\treturn {\n\t\tappName: resolved.key,\n\t\tapp: resolved.app,\n\t\tworkspace: loadedConfig.workspace,\n\t\tworkspaceRoot,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,SAAgB,aAAa,QAA8B;CAC1D,OAAO;AACR;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,kBACf,cACA,cACqB;CACrB,MAAM,QAAQ,aAAa,MAAM,GAAG;CACpC,MAAM,OAAO,MAAM,MAAM;CACzB,MAAM,aAAa,MAAM;CAOzB,OAAO;EAAE;EAAM,eANO,CAAC,aACpB,eACA,eAAe,eACd,KAAK,aAAa,MAClB,KAAK,WAAW,MAAM,aAAa;CAEV;AAC9B;;;;;;;;AAcA,SAAS,eA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SAAS,KAAK,WAAW,kBAChC,MAAM,qBAAqB,GAAG;CAE/B,MAAM,YAAYW,kBAAAA,gBAAgB,WAAW,OAAO;CACpD,IAAI,CAAC,WAAW,MAAM,IAAI,eAAe,OAAO;CAEhD,OAAO;EACN;EACA;EACA;EACA;EACA;EACA,UAAA,GAASZ,UAAAA,KAAAA,CAAK,eAAe,IAAI,IAAI;CACtC;AACD;;AAGA,IAAa,iBAAb,cAAoCC,eAAAA,SAAS;CACvB;CAArB,YAAY,SAA0B;EACrC,MACC,QAAQ,QAAQ,uDACjB;EAHoB,KAAA,UAAA;EAIpB,KAAK,OAAO;CACb;AACD;;;;;;;;AAiBA,eAAsB,qBACrB,MAAc,QAAQ,IAAI,GACE;CAC5B,MAAM,EAAE,QAAQ,kBAAkB,MAAM,cAAc,GAAG;CACzD,MAAM,eAAe,MAAM,gBAC1BI,kBAAAA,cAAc,QAAQ,aAAa,CACpC;CAEA,MAAM,WAAW,oBAAoB,cAAc,GAAG;CACtD,IAAI,CAAC,UAAU,MAAM,IAAI,WAAW,KAAK,SAAS,YAAY,CAAC;CAE/D,OAAO;EACN,SAAS,SAAS;EAClB,KAAK,SAAS;EACd,WAAW,aAAa;EACxB;CACD;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.mjs","names":["z.discriminatedUnion","z.object","z.literal","z.record","z.string","z.unknown","z.array"],"sources":["../src/config.ts"],"sourcesContent":["import { existsSync, realpathSync } from 'node:fs';\nimport { dirname, join, parse, resolve, sep } from 'node:path';\nimport { z } from 'zod';\nimport { GkmError } from './errors';\nimport { output } from './output.js';\nimport { discover } from './reconcile/discover.js';\nimport { activeSandbox, type Sandbox } from './sandbox/sandbox.js';\nimport { runWorker } from './sandbox/worker.js';\nimport type { GkmConfig } from './types.js';\nimport { derivedApps } from './workspace/derive.js';\nimport {\n\tallConstructGlobs,\n\tgetAppGkmConfig,\n\tisWorkspaceConfig,\n\ttype LoadedConfig,\n\ttype NormalizedAppConfig,\n\ttype NormalizedWorkspace,\n\tprocessConfig,\n\ttype WorkspaceConfig,\n} from './workspace/index.js';\n\n// What `gkm dev`'s discovery endpoint answers, for the tools that read it.\nexport type {\n\tAppStatus,\n\tDataApiKind,\n\tDiscoveredApp,\n\tDiscoveredDataApi,\n\tDiscoveredWorkspace,\n\tDiscoveryEvent,\n\tDiscoveryResponse,\n} from './dev/discovery.js';\nexport type { GkmConfig } from './types.js';\nexport type { LoadedConfig, WorkspaceConfig } from './workspace/index.js';\nexport { defineWorkspace } from './workspace/index.js';\nexport type { DevConfig } from './workspace/types.js';\n/**\n * Define GKM configuration with full TypeScript support.\n * This is an identity function that provides type safety and autocomplete.\n *\n * @example\n * ```ts\n * // gkm.config.ts\n * import { defineConfig } from '@geekmidas/cli/config';\n *\n * export default defineConfig({\n * routes: './src/endpoints/**\\/*.ts',\n * envParser: './src/config/env',\n * logger: './src/config/logger',\n * telescope: true,\n * });\n * ```\n */\nexport function defineConfig(config: GkmConfig): GkmConfig {\n\treturn config;\n}\n\nexport interface ParsedModuleConfig {\n\tpath: string;\n\timportPattern: string;\n}\n\n/**\n * Parse a module config string into path and import pattern.\n *\n * @param configString - Config string in format \"./path/to/module\" or \"./path/to/module#exportName\"\n * @param defaultAlias - The default alias name to use if no export name specified\n * @returns Object with path and import pattern\n *\n * @example\n * parseModuleConfig('./src/config/env', 'envParser')\n * // { path: './src/config/env', importPattern: 'envParser' }\n *\n * parseModuleConfig('./src/config/env#envParser', 'envParser')\n * // { path: './src/config/env', importPattern: '{ envParser }' }\n *\n * parseModuleConfig('./src/config/env#myEnv', 'envParser')\n * // { path: './src/config/env', importPattern: '{ myEnv as envParser }' }\n */\nexport function parseModuleConfig(\n\tconfigString: string,\n\tdefaultAlias: string,\n): ParsedModuleConfig {\n\tconst parts = configString.split('#');\n\tconst path = parts[0] ?? configString;\n\tconst exportName = parts[1];\n\tconst importPattern = !exportName\n\t\t? defaultAlias\n\t\t: exportName === defaultAlias\n\t\t\t? `{ ${defaultAlias} }`\n\t\t\t: `{ ${exportName} as ${defaultAlias} }`;\n\n\treturn { path, importPattern };\n}\n\nexport interface ConfigDiscoveryResult {\n\tconfigPath: string;\n\tworkspaceRoot: string;\n}\n\n/**\n * Find and return the path to the config file.\n *\n * Resolution order:\n * 1. GKM_CONFIG_PATH env var (set by workspace dev command)\n * 2. Walk up directory tree from cwd\n */\nfunction findConfigPath(cwd: string): ConfigDiscoveryResult {\n\tconst files = ['gkm.config.json', 'gkm.config.ts', 'gkm.config.js'];\n\n\t// Check GKM_CONFIG_PATH env var first (set by workspace dev command)\n\tconst envConfigPath = process.env.GKM_CONFIG_PATH;\n\tif (envConfigPath && existsSync(envConfigPath)) {\n\t\treturn {\n\t\t\tconfigPath: envConfigPath,\n\t\t\tworkspaceRoot: dirname(envConfigPath),\n\t\t};\n\t}\n\n\t// Walk up directory tree to find config\n\tlet currentDir = cwd;\n\tconst { root } = parse(currentDir);\n\n\twhile (currentDir !== root) {\n\t\tfor (const file of files) {\n\t\t\tconst configPath = join(currentDir, file);\n\t\t\tif (existsSync(configPath)) {\n\t\t\t\treturn {\n\t\t\t\t\tconfigPath,\n\t\t\t\t\tworkspaceRoot: currentDir,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tcurrentDir = dirname(currentDir);\n\t}\n\n\tthrow new ConfigNotFound(cwd);\n}\n\n/**\n * The directory holding the gkm config that `cwd` belongs to — the project a\n * sandbox for it is confined to.\n *\n * @throws {ConfigNotFound} when neither `cwd` nor any parent has one.\n */\nexport function findWorkspaceRoot(cwd: string): string {\n\treturn findConfigPath(cwd).workspaceRoot;\n}\n\n/** No gkm config in a directory or any of its parents. */\nexport class ConfigNotFound extends GkmError {\n\tconstructor(readonly cwd: string) {\n\t\tsuper(\n\t\t\t'Configuration file not found. Please create gkm.config.json, gkm.config.ts, or gkm.config.js in the project root.',\n\t\t);\n\t\tthis.name = 'ConfigNotFound';\n\t}\n}\n\ninterface RawConfigResult {\n\tconfig: GkmConfig | WorkspaceConfig;\n\tworkspaceRoot: string;\n}\n\nexport interface LoadConfigOptions {\n\t/**\n\t * Load the config — and discover the constructs it names — in this\n\t * sandbox rather than in this process. The config then arrives as data;\n\t * see {@link Sandbox.isolating} for what happens to one holding live\n\t * objects. Defaults to the run's own (`withSandbox`); with neither, the\n\t * config is imported here, as `gkm` always has.\n\t */\n\tsandbox?: Sandbox;\n\t/**\n\t * How long the sandboxed config load may run. Defaults to\n\t * {@link CONFIG_LOAD_TIMEOUT_MS}.\n\t */\n\ttimeoutMs?: number;\n}\n\n/**\n * How long loading a config, or discovering its constructs, may take in a\n * sandbox: room for tsx to compile a large project cold, and not a deploy\n * held open by a config that never finishes importing.\n */\nexport const CONFIG_LOAD_TIMEOUT_MS = 60_000;\n\n/** The config failed to import, or threw while it ran. */\nexport class ConfigLoadFailed extends Error {\n\tconstructor(\n\t\treadonly configPath: string,\n\t\treadonly detail: string,\n\t) {\n\t\tsuper(`Failed to load config: ${detail}`);\n\t\tthis.name = 'ConfigLoadFailed';\n\t}\n}\n\n/**\n * The config holds something that is not data — a custom state store, an\n * inline deploy target, a function — and the sandbox it was loaded in hands\n * the deploy nothing but data.\n */\nexport class ConfigObjectNotSerializable extends Error {\n\tconstructor(\n\t\treadonly configPath: string,\n\t\treadonly paths: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`${configPath} holds values that are not plain data at: ` +\n\t\t\t\t`${paths.join(', ')}. It was loaded in an isolating sandbox, which ` +\n\t\t\t\t'hands the deploy the config as JSON, so a live object — a custom ' +\n\t\t\t\t'store, an inline target, a function — cannot reach it. Configure ' +\n\t\t\t\t'these with plain values instead, or deploy this project with a ' +\n\t\t\t\t'sandbox that is not isolating (the default) if the host trusts it.',\n\t\t);\n\t\tthis.name = 'ConfigObjectNotSerializable';\n\t}\n}\n\n/** What the config worker answers. Checked: the worker ran project code. */\nconst ConfigAnswer = z.discriminatedUnion('reason', [\n\tz.object({\n\t\treason: z.literal('loaded'),\n\t\tconfig: z.record(z.string(), z.unknown()),\n\t}),\n\tz.object({ reason: z.literal('live'), paths: z.array(z.string()) }),\n\tz.object({\n\t\treason: z.literal('failed'),\n\t\terror: z.object({ name: z.string(), message: z.string() }),\n\t}),\n]);\n\n/** Import the config in this process — live objects and all. */\nasync function importConfig(\n\tconfigPath: string,\n): Promise<GkmConfig | WorkspaceConfig> {\n\ttry {\n\t\tconst config = await import(configPath);\n\t\treturn config.default;\n\t} catch (error) {\n\t\tthrow new ConfigLoadFailed(configPath, (error as Error).message);\n\t}\n}\n\n/**\n * The config, loaded in `sandbox` and handed back as JSON.\n *\n * A config holding live objects cannot come back that way. An isolating\n * sandbox refuses it with {@link ConfigObjectNotSerializable}; any other\n * imports it here as well, as before, since the host already runs this\n * project's code as its own.\n */\nasync function loadConfigInSandbox(\n\tsandbox: Sandbox,\n\tconfigPath: string,\n\tworkspaceRoot: string,\n\ttimeoutMs = CONFIG_LOAD_TIMEOUT_MS,\n): Promise<GkmConfig | WorkspaceConfig> {\n\tconst { value } = await runWorker(sandbox, 'config load', {\n\t\tname: 'config-worker',\n\t\targs: [configPath],\n\t\tcwd: workspaceRoot,\n\t\ttimeoutMs,\n\t\tschema: ConfigAnswer,\n\t});\n\n\tswitch (value.reason) {\n\t\tcase 'loaded':\n\t\t\t// Its shape is `processConfig`'s to check, against the workspace\n\t\t\t// schema, exactly as for a config imported here.\n\t\t\treturn value.config as unknown as GkmConfig | WorkspaceConfig;\n\t\tcase 'failed':\n\t\t\tthrow new ConfigLoadFailed(configPath, value.error.message);\n\t\tcase 'live':\n\t\t\tif (sandbox.isolating) {\n\t\t\t\tthrow new ConfigObjectNotSerializable(configPath, value.paths);\n\t\t\t}\n\t\t\treturn importConfig(configPath);\n\t}\n}\n\n/**\n * Load raw configuration from file.\n */\nasync function loadRawConfig(\n\tcwd: string,\n\toptions: LoadConfigOptions = {},\n): Promise<RawConfigResult> {\n\tconst { configPath, workspaceRoot } = findConfigPath(cwd);\n\t// The run's own sandbox when none is given: a deploy reloads the config\n\t// deep in the engine (generating Dockerfiles), and that load is the\n\t// project's code as much as the first.\n\tconst sandbox = options.sandbox ?? activeSandbox();\n\tconst config = sandbox\n\t\t? await loadConfigInSandbox(\n\t\t\t\tsandbox,\n\t\t\t\tconfigPath,\n\t\t\t\tworkspaceRoot,\n\t\t\t\toptions.timeoutMs,\n\t\t\t)\n\t\t: await importConfig(configPath);\n\n\treturn { config, workspaceRoot };\n}\n\n/**\n * Load configuration file (single-app format).\n * For backwards compatibility with existing code.\n *\n * @deprecated Use loadWorkspaceConfig for new code\n */\nexport async function loadConfig(\n\tcwd: string = process.cwd(),\n): Promise<GkmConfig> {\n\tconst { config } = await loadRawConfig(cwd);\n\n\t// If it's a workspace config, throw an error\n\tif (isWorkspaceConfig(config)) {\n\t\tthrow new Error(\n\t\t\t'Workspace configuration detected. Use loadWorkspaceConfig() instead.',\n\t\t);\n\t}\n\n\treturn config;\n}\n\n/**\n * Load configuration file and process it as a workspace.\n * Works with both single-app and workspace configurations.\n *\n * Single-app configs are automatically wrapped as a workspace with one app.\n *\n * @example\n * ```ts\n * const { type, workspace } = await loadWorkspaceConfig();\n *\n * if (type === 'workspace') {\n * console.log('Multi-app workspace:', workspace.apps);\n * } else {\n * console.log('Single app wrapped as workspace');\n * }\n * ```\n */\n/**\n * The workspace a directory belongs to, as its config states it — without\n * discovering its constructs.\n *\n * For callers that need a fact the config holds (where a stage's secrets are\n * stored) and nothing the graph adds. `loadWorkspaceConfig` imports every\n * construct module to derive the apps, which is a cost a secrets read should\n * not pay.\n */\nexport async function loadWorkspaceSettings(\n\tcwd: string = process.cwd(),\n\toptions: LoadConfigOptions = {},\n): Promise<LoadedConfig['workspace']> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd, options);\n\treturn processConfig(config, workspaceRoot).workspace;\n}\n\nexport async function loadWorkspaceConfig(\n\tcwd: string = process.cwd(),\n\toptions: LoadConfigOptions = {},\n): Promise<LoadedConfig> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd, options);\n\treturn withDerivedApps(processConfig(config, workspaceRoot), options.sandbox);\n}\n\n/**\n * The loaded config, with its apps read off the graph.\n *\n * Here rather than at each call site because every command needs the same\n * answer, and the ones that forgot to ask were exactly the bugs: a site that\n * never deployed, a surface that could not be its own process. `gkm dev`,\n * `gkm build`, `gkm docker` and `gkm deploy` now all see the same apps without\n * any of them knowing a derivation happened.\n *\n * Discovery imports the construct modules — declarations only, not endpoints —\n * which is the same import the reconciler and the build already do. A workspace\n * with no `constructs` glob discovers nothing and keeps whatever its config\n * said, so nothing that worked before changes.\n *\n * A construct file that throws is reported and skipped rather than taking the\n * command down: `gkm dev` failing to start because a half-written declaration\n * cannot be imported is a worse failure than starting with the app it does not\n * describe yet.\n */\nasync function withDerivedApps(\n\tloaded: LoadedConfig,\n\tsandbox?: Sandbox,\n): Promise<LoadedConfig> {\n\tconst globs = allConstructGlobs(loaded.workspace);\n\tif (globs.length === 0) {\n\t\tthrow new WorkspaceDeclaresNoConstructs(loaded.workspace.root);\n\t}\n\n\ttry {\n\t\tconst background: Record<string, string[]> = {};\n\t\tconst manifest = await discover({\n\t\t\tpatterns: globs,\n\t\t\tcwd: loaded.workspace.root,\n\t\t\tbackground,\n\t\t\t...(sandbox ? { sandbox } : {}),\n\t\t});\n\n\t\treturn {\n\t\t\t...loaded,\n\t\t\tmanifest,\n\t\t\tbackground,\n\t\t\tworkspace: {\n\t\t\t\t...loaded.workspace,\n\t\t\t\tapps: derivedApps(manifest, loaded.workspace),\n\t\t\t},\n\t\t};\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\toutput.warn(\n\t\t\t`⚠️ Could not read constructs, so apps come from config alone: ${message}`,\n\t\t);\n\t\treturn loaded;\n\t}\n}\n\n/**\n * A workspace with no `constructs` glob.\n *\n * In v10 every address, container and app comes from what the workspace\n * declares — there is no second path that reads a hand-written compose file or\n * an `apps` block's ports. A config that declares nothing has nothing to run.\n */\nexport class WorkspaceDeclaresNoConstructs extends GkmError {\n\tconstructor(readonly root: string) {\n\t\tsuper(\n\t\t\t`The workspace at ${root} declares no constructs. Every workspace names ` +\n\t\t\t\t\"where its constructs live — `constructs: ['./constructs/**/*.ts', \" +\n\t\t\t\t\"'./apps/*/endpoints/**/*.ts']` in gkm.config.ts — and its apps, \" +\n\t\t\t\t'containers and URLs are derived from them.',\n\t\t);\n\t\tthis.name = 'WorkspaceDeclaresNoConstructs';\n\t}\n}\n\nexport interface AppConfigResult {\n\tappName: string;\n\tapp: NormalizedAppConfig;\n\tgkmConfig: GkmConfig;\n\tworkspace: NormalizedWorkspace;\n\tworkspaceRoot: string;\n\tappRoot: string;\n}\n\n/**\n * The app a directory is part of: the one whose `path` contains it.\n *\n * An app's path is the one its construct declares — `new RestApi('Api',\n * { path: 'apps/api' })` — read off the workspace the constructs were derived\n * into, never off the filesystem's package names. The deepest match wins, so\n * an app inside another app's folder is its own; the workspace root belongs to\n * no app unless one lives there.\n */\nfunction resolveWorkspaceApp(\n\tloadedConfig: LoadedConfig,\n\tcwd: string,\n): { key: string; app: NormalizedAppConfig } | undefined {\n\tconst here = real(cwd);\n\tlet found: { key: string; app: NormalizedAppConfig; dir: string } | undefined;\n\n\tfor (const [key, app] of Object.entries(loadedConfig.workspace.apps)) {\n\t\tconst dir = real(join(loadedConfig.workspace.root, app.path));\n\t\tconst inside = here === dir || here.startsWith(`${dir}${sep}`);\n\t\tif (inside && (!found || dir.length > found.dir.length)) {\n\t\t\tfound = { key, app, dir };\n\t\t}\n\t}\n\n\treturn found && { key: found.key, app: found.app };\n}\n\n/** A path with its symlinks resolved, where it exists — `/tmp` is `/private/tmp`. */\nfunction real(path: string): string {\n\tconst absolute = resolve(path);\n\treturn existsSync(absolute) ? realpathSync(absolute) : absolute;\n}\n\n/** A directory that no app in the workspace lives in. */\nexport class NotInAnApp extends GkmError {\n\tconstructor(\n\t\treadonly cwd: string,\n\t\treadonly apps: Readonly<Record<string, string>>,\n\t) {\n\t\tsuper(\n\t\t\t`${cwd} is not inside any app's path. Apps: ` +\n\t\t\t\tObject.entries(apps)\n\t\t\t\t\t.map(([key, path]) => `${key} (${path})`)\n\t\t\t\t\t.join(', ') +\n\t\t\t\t'.',\n\t\t);\n\t\tthis.name = 'NotInAnApp';\n\t}\n}\n\n/** Every app's path, by key — what `NotInAnApp` lists. */\nfunction appPaths(loadedConfig: LoadedConfig): Record<string, string> {\n\treturn Object.fromEntries(\n\t\tObject.entries(loadedConfig.workspace.apps).map(([key, app]) => [\n\t\t\tkey,\n\t\t\tapp.path,\n\t\t]),\n\t);\n}\n\n/**\n * The backend app a directory is part of, with its gkm config — found by the\n * `path` its construct declares.\n *\n * @example\n * ```ts\n * // From apps/api, where a construct declares `path: 'apps/api'`\n * const { app, workspace, workspaceRoot } = await loadAppConfig();\n * ```\n *\n * @throws {NotInAnApp} when no app's path contains the directory.\n * @throws {NotABackendApp} when the app it is in has no gkm config to run.\n */\nexport async function loadAppConfig(\n\tcwd: string = process.cwd(),\n): Promise<AppConfigResult> {\n\tconst { appName, app, workspace, workspaceRoot } =\n\t\tawait loadWorkspaceAppInfo(cwd);\n\n\tconst gkmConfig = getAppGkmConfig(workspace, appName);\n\tif (!gkmConfig) throw new NotABackendApp(appName);\n\n\treturn {\n\t\tappName,\n\t\tapp,\n\t\tgkmConfig,\n\t\tworkspace,\n\t\tworkspaceRoot,\n\t\tappRoot: join(workspaceRoot, app.path),\n\t};\n}\n\n/** The app a directory is in has no gkm config — a site, or an entry app. */\nexport class NotABackendApp extends GkmError {\n\tconstructor(readonly appName: string) {\n\t\tsuper(\n\t\t\t`App \"${appName}\" is not a backend app and cannot be run with gkm dev.`,\n\t\t);\n\t\tthis.name = 'NotABackendApp';\n\t}\n}\n\nexport interface WorkspaceAppInfo {\n\t/** The app's key in the workspace. */\n\tappName: string;\n\tapp: NormalizedAppConfig;\n\tworkspace: NormalizedWorkspace;\n\tworkspaceRoot: string;\n}\n\n/**\n * The app a directory is part of, frontend or backend — found by the `path`\n * its construct declares. Unlike `loadAppConfig`, the app need not have a\n * gkm config, which is what `gkm exec` and `gkm test` from a site need.\n *\n * @throws {NotInAnApp} when no app's path contains the directory.\n */\nexport async function loadWorkspaceAppInfo(\n\tcwd: string = process.cwd(),\n): Promise<WorkspaceAppInfo> {\n\tconst { config, workspaceRoot } = await loadRawConfig(cwd);\n\tconst loadedConfig = await withDerivedApps(\n\t\tprocessConfig(config, workspaceRoot),\n\t);\n\n\tconst resolved = resolveWorkspaceApp(loadedConfig, cwd);\n\tif (!resolved) throw new NotInAnApp(cwd, appPaths(loadedConfig));\n\n\treturn {\n\t\tappName: resolved.key,\n\t\tapp: resolved.app,\n\t\tworkspace: loadedConfig.workspace,\n\t\tworkspaceRoot,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,SAAgB,aAAa,QAA8B;CAC1D,OAAO;AACR;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,kBACf,cACA,cACqB;CACrB,MAAM,QAAQ,aAAa,MAAM,GAAG;CACpC,MAAM,OAAO,MAAM,MAAM;CACzB,MAAM,aAAa,MAAM;CAOzB,OAAO;EAAE;EAAM,eANO,CAAC,aACpB,eACA,eAAe,eACd,KAAK,aAAa,MAClB,KAAK,WAAW,MAAM,aAAa;CAEV;AAC9B;;;;;;;;AAcA,SAAS,eAAe,KAAoC;CAC3D,MAAM,QAAQ;EAAC;EAAmB;EAAiB;CAAe;CAGlE,MAAM,gBAAgB,QAAQ,IAAI;CAClC,IAAI,iBAAiB,WAAW,aAAa,GAC5C,OAAO;EACN,YAAY;EACZ,eAAe,QAAQ,aAAa;CACrC;CAID,IAAI,aAAa;CACjB,MAAM,EAAE,SAAS,MAAM,UAAU;CAEjC,OAAO,eAAe,MAAM;EAC3B,KAAK,MAAM,QAAQ,OAAO;GACzB,MAAM,aAAa,KAAK,YAAY,IAAI;GACxC,IAAI,WAAW,UAAU,GACxB,OAAO;IACN;IACA,eAAe;GAChB;EAEF;EACA,aAAa,QAAQ,UAAU;CAChC;CAEA,MAAM,IAAI,eAA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AG,IAAI,IAAI,KAAK,EAAE,CAAC,CACxC,KAAK,IAAI,IACX,GACF;EATS,KAAA,MAAA;EACA,KAAA,OAAA;EAST,KAAK,OAAO;CACb;AACD;;AAGA,SAAS,SAAS,cAAoD;CACrE,OAAO,OAAO,YACb,OAAO,QAAQ,aAAa,UAAU,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,SAAS,CAC/D,KACA,IAAI,IACL,CAAC,CACF;AACD;;;;;;;;;;;;;;AAeA,eAAsB,cACrB,MAAc,QAAQ,IAAI,GACC;CAC3B,MAAM,EAAE,SAAS,KAAK,WAAW,kBAChC,MAAM,qBAAqB,GAAG;CAE/B,MAAM,YAAY,gBAAgB,WAAW,OAAO;CACpD,IAAI,CAAC,WAAW,MAAM,IAAI,eAAe,OAAO;CAEhD,OAAO;EACN;EACA;EACA;EACA;EACA;EACA,SAAS,KAAK,eAAe,IAAI,IAAI;CACtC;AACD;;AAGA,IAAa,iBAAb,cAAoC,SAAS;CACvB;CAArB,YAAY,SAA0B;EACrC,MACC,QAAQ,QAAQ,uDACjB;EAHoB,KAAA,UAAA;EAIpB,KAAK,OAAO;CACb;AACD;;;;;;;;AAiBA,eAAsB,qBACrB,MAAc,QAAQ,IAAI,GACE;CAC5B,MAAM,EAAE,QAAQ,kBAAkB,MAAM,cAAc,GAAG;CACzD,MAAM,eAAe,MAAM,gBAC1B,cAAc,QAAQ,aAAa,CACpC;CAEA,MAAM,WAAW,oBAAoB,cAAc,GAAG;CACtD,IAAI,CAAC,UAAU,MAAM,IAAI,WAAW,KAAK,SAAS,YAAY,CAAC;CAE/D,OAAO;EACN,SAAS,SAAS;EAClB,KAAK,SAAS;EACd,WAAW,aAAa;EACxB;CACD;AACD"}
@@ -1,520 +0,0 @@
1
- const require_errors = require("./errors-DMC4Umsb.cjs");
2
- let node_path = require("node:path");
3
- let node_fs = require("node:fs");
4
- let node_fs_promises = require("node:fs/promises");
5
- let node_os = require("node:os");
6
- let node_child_process = require("node:child_process");
7
- //#region src/home.ts
8
- /**
9
- * Where the CLI keeps what belongs to a person rather than a project: stage
10
- * keys and stored provider credentials.
11
- *
12
- * `GKM_HOME` names it, so a CI job, a shared build runner or a test can give
13
- * every run its own instead of reaching into whoever's home directory the
14
- * process happens to have. Unset, it is `~/.gkm`, where it has always been.
15
- */
16
- /** The environment variable that moves the CLI's home. */
17
- const GKM_HOME_ENV = "GKM_HOME";
18
- /** The CLI's home: `GKM_HOME` if set, else `~/.gkm`. */
19
- function gkmHome(env = process.env) {
20
- const configured = env[GKM_HOME_ENV];
21
- return configured ? (0, node_path.resolve)(configured) : (0, node_path.join)((0, node_os.homedir)(), ".gkm");
22
- }
23
- //#endregion
24
- //#region src/auth/credentials.ts
25
- /**
26
- * Get the path to the credentials directory
27
- */
28
- function getCredentialsDir(options) {
29
- if (options?.home) return options.home;
30
- return options?.root ? (0, node_path.join)(options.root, ".gkm") : gkmHome();
31
- }
32
- /**
33
- * Get the path to the credentials file
34
- */
35
- function getCredentialsPath(options) {
36
- return (0, node_path.join)(getCredentialsDir(options), "credentials.json");
37
- }
38
- /**
39
- * Ensure the credentials directory exists
40
- */
41
- function ensureCredentialsDir(options) {
42
- const dir = getCredentialsDir(options);
43
- if (!(0, node_fs.existsSync)(dir)) (0, node_fs.mkdirSync)(dir, {
44
- recursive: true,
45
- mode: 448
46
- });
47
- }
48
- /**
49
- * Read stored credentials from disk
50
- */
51
- async function readCredentials(options) {
52
- const path = getCredentialsPath(options);
53
- if (!(0, node_fs.existsSync)(path)) return {};
54
- try {
55
- const content = await (0, node_fs_promises.readFile)(path, "utf-8");
56
- return JSON.parse(content);
57
- } catch {
58
- return {};
59
- }
60
- }
61
- /**
62
- * Write credentials to disk
63
- */
64
- async function writeCredentials(credentials, options) {
65
- ensureCredentialsDir(options);
66
- const path = getCredentialsPath(options);
67
- await (0, node_fs_promises.writeFile)(path, JSON.stringify(credentials, null, 2), { mode: 384 });
68
- }
69
- /**
70
- * Store Dokploy credentials
71
- */
72
- async function storeDokployCredentials(token, endpoint, options) {
73
- const credentials = await readCredentials(options);
74
- credentials.dokploy = {
75
- token,
76
- endpoint,
77
- storedAt: (/* @__PURE__ */ new Date()).toISOString()
78
- };
79
- await writeCredentials(credentials, options);
80
- }
81
- /**
82
- * Get stored Dokploy credentials
83
- */
84
- async function getDokployCredentials(options) {
85
- const credentials = await readCredentials(options);
86
- const token = process.env.DOKPLOY_API_TOKEN ?? credentials.dokploy?.token;
87
- const endpoint = process.env.DOKPLOY_ENDPOINT ?? credentials.dokploy?.endpoint;
88
- if (!token || !endpoint) return null;
89
- return {
90
- token,
91
- endpoint: endpoint.replace(/\/$/, ""),
92
- ...credentials.dokploy?.registryId ? { registryId: credentials.dokploy.registryId } : {}
93
- };
94
- }
95
- /**
96
- * Remove Dokploy credentials
97
- */
98
- async function removeDokployCredentials(options) {
99
- const credentials = await readCredentials(options);
100
- if (!credentials.dokploy) return false;
101
- delete credentials.dokploy;
102
- await writeCredentials(credentials, options);
103
- return true;
104
- }
105
- /**
106
- * Get Dokploy API token, checking stored credentials first, then environment
107
- */
108
- async function getDokployToken(options) {
109
- const envToken = process.env.DOKPLOY_API_TOKEN;
110
- if (envToken) return envToken;
111
- const stored = await getDokployCredentials(options);
112
- if (stored) return stored.token;
113
- return null;
114
- }
115
- /**
116
- * Get Dokploy registry ID from stored credentials
117
- */
118
- async function getDokployRegistryId(options) {
119
- return (await getDokployCredentials(options))?.registryId ?? void 0;
120
- }
121
- /**
122
- * Store Hostinger API token
123
- *
124
- * @param token - API token from hpanel.hostinger.com/profile/api
125
- */
126
- async function storeHostingerToken(token, options) {
127
- const credentials = await readCredentials(options);
128
- credentials.hostinger = {
129
- token,
130
- storedAt: (/* @__PURE__ */ new Date()).toISOString()
131
- };
132
- await writeCredentials(credentials, options);
133
- }
134
- /**
135
- * Get stored Hostinger API token
136
- *
137
- * Checks environment variable first (HOSTINGER_API_TOKEN),
138
- * then falls back to stored credentials.
139
- */
140
- async function getHostingerToken(options) {
141
- const envToken = process.env.HOSTINGER_API_TOKEN;
142
- if (envToken) return envToken;
143
- return (await readCredentials(options)).hostinger?.token ?? null;
144
- }
145
- /**
146
- * Store a GoDaddy Personal Access Token.
147
- */
148
- async function storeGoDaddyToken(token, options) {
149
- const credentials = await readCredentials(options);
150
- credentials.godaddy = {
151
- token,
152
- storedAt: (/* @__PURE__ */ new Date()).toISOString()
153
- };
154
- await writeCredentials(credentials, options);
155
- }
156
- /**
157
- * Remove GoDaddy credentials
158
- */
159
- async function removeGoDaddyCredentials(options) {
160
- const credentials = await readCredentials(options);
161
- if (!credentials.godaddy) return false;
162
- delete credentials.godaddy;
163
- await writeCredentials(credentials, options);
164
- return true;
165
- }
166
- //#endregion
167
- //#region src/run.ts
168
- /**
169
- * Start a program with an argument array, never a shell string.
170
- *
171
- * `gkm build`, `gkm docker` and `gkm deploy` pass values that come from the
172
- * workspace — image refs, tags, build args, package names — to `docker` and
173
- * `turbo`. Joined into a string and handed to a shell, a package named
174
- * `x;curl …|sh` or a tag holding `$(…)` became part of the command line, which
175
- * matters most where the CLI builds a repository it didn't write: a CI job for a
176
- * fork, a shared build runner. Here every value reaches the program as one
177
- * `argv` element, whatever it contains.
178
- */
179
- /** Long enough for a cold image build; short enough that a hung one ends. */
180
- const DEFAULT_TIMEOUT_MS = 18e5;
181
- /** How long a timed-out child has to exit on SIGTERM before it is killed. */
182
- const KILL_GRACE_MS = 5e3;
183
- /** The command line as a person would read it — for messages, never to run. */
184
- function display(command, args) {
185
- return [command, ...args].join(" ");
186
- }
187
- /** The program ran and exited unsuccessfully; its own output said why. */
188
- var CommandFailed = class extends Error {
189
- command;
190
- args;
191
- exitCode;
192
- signal;
193
- constructor(command, args, exitCode, signal) {
194
- super(`\`${display(command, args)}\` ${exitCode === null ? `was stopped by ${signal ?? "a signal"}` : `exited with code ${exitCode}`}. Its output above says why; run it by hand to see it again.`);
195
- this.command = command;
196
- this.args = args;
197
- this.exitCode = exitCode;
198
- this.signal = signal;
199
- this.name = "CommandFailed";
200
- }
201
- };
202
- /** The program ran past its timeout and was killed. */
203
- var CommandTimedOut = class extends Error {
204
- command;
205
- args;
206
- timeoutMs;
207
- constructor(command, args, timeoutMs) {
208
- super(`\`${display(command, args)}\` was still running after ${Math.round(timeoutMs / 1e3)}s and was stopped. Check what it was waiting on — a registry, the Docker daemon, a prompt — and run it again.`);
209
- this.command = command;
210
- this.args = args;
211
- this.timeoutMs = timeoutMs;
212
- this.name = "CommandTimedOut";
213
- }
214
- };
215
- /**
216
- * Run `command` with `args`, resolving when it exits 0.
217
- *
218
- * Rejects with {@link CommandFailed} on any other exit, {@link CommandTimedOut}
219
- * once `timeoutMs` passes (after the child is gone), and with the spawn error
220
- * itself when the program cannot be started at all — `ENOENT` already names it.
221
- */
222
- async function run(command, args, options = {}) {
223
- await spawnChild(command, args, options, false);
224
- }
225
- /**
226
- * {@link run}, resolving with what the program wrote to stdout — for a value
227
- * the CLI reads back, such as the digest `docker inspect` reports. stderr still
228
- * reaches the terminal, so a failure explains itself the same way.
229
- */
230
- function runOutput(command, args, options = {}) {
231
- return spawnChild(command, args, options, true);
232
- }
233
- function spawnChild(command, args, options, capture) {
234
- const { timeoutMs = DEFAULT_TIMEOUT_MS, ...spawnOptions } = options;
235
- return new Promise((resolve, reject) => {
236
- const child = (0, node_child_process.spawn)(command, [...args], {
237
- stdio: "inherit",
238
- ...spawnOptions,
239
- ...capture ? { stdio: [
240
- "ignore",
241
- "pipe",
242
- "inherit"
243
- ] } : {},
244
- shell: false
245
- });
246
- let stdout = "";
247
- child.stdout?.on("data", (chunk) => {
248
- stdout += chunk.toString();
249
- });
250
- let timedOut = false;
251
- let killer;
252
- const timer = setTimeout(() => {
253
- timedOut = true;
254
- child.kill("SIGTERM");
255
- killer = setTimeout(() => child.kill("SIGKILL"), KILL_GRACE_MS);
256
- killer.unref?.();
257
- }, timeoutMs);
258
- timer.unref?.();
259
- const settle = () => {
260
- clearTimeout(timer);
261
- if (killer) clearTimeout(killer);
262
- };
263
- child.on("error", (error) => {
264
- settle();
265
- reject(spawnOptions.signal?.aborted ? spawnOptions.signal.reason : error);
266
- });
267
- child.on("close", (code, signal) => {
268
- settle();
269
- if (spawnOptions.signal?.aborted) reject(spawnOptions.signal.reason);
270
- else if (timedOut) reject(new CommandTimedOut(command, args, timeoutMs));
271
- else if (code === 0) resolve(stdout);
272
- else reject(new CommandFailed(command, args, code, signal));
273
- });
274
- });
275
- }
276
- //#endregion
277
- //#region src/deploy/credentials.ts
278
- /**
279
- * How a deploy gets the credentials it acts with.
280
- *
281
- * `deploy()` never prompts and never reads a terminal: it asks a
282
- * `CredentialProvider` and, when the provider has nothing, stops with
283
- * `MissingCredential` naming what it needed and how to supply it. Whether to
284
- * ask a person, read a vault or fail is the caller's decision — `gkm deploy`
285
- * prompts at a terminal and stores what was typed; a CI job sets the
286
- * environment; a host passes its own provider.
287
- */
288
- /**
289
- * How to supply each kind the CLI knows, for the error that says it is
290
- * missing. A target's own kinds are its to explain.
291
- */
292
- const HOW_TO_PROVIDE = {
293
- dokploy: "Set DOKPLOY_API_TOKEN (and DOKPLOY_ENDPOINT, or deploy.dokploy.endpoint in gkm.config.ts), run `gkm login --provider dokploy`, or pass them through the deploy's CredentialProvider.",
294
- registry: "Add the registry in Dokploy (Settings → Docker Registry) and set deploy.dokploy.registryId, set DOCKER_REGISTRY_USERNAME and DOCKER_REGISTRY_PASSWORD, or run `gkm deploy` at a terminal to be asked for them.",
295
- godaddy: "Set GODADDY_API_TOKEN to a Personal Access Token scoped to domains.dns:update (create one in the GoDaddy developer dashboard), or run `gkm login --provider godaddy`.",
296
- hostinger: "Set HOSTINGER_API_TOKEN to a token from hpanel.hostinger.com/profile/api, or run `gkm login --provider hostinger`.",
297
- aws: "Set AWS_PROFILE to the stage account's profile, or AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY (and AWS_SESSION_TOKEN) — in CI, the keys aws-actions/configure-aws-credentials exports — or pass them through the deploy's CredentialProvider."
298
- };
299
- /** A deploy needed a credential, and its provider had none. */
300
- var MissingCredential = class extends require_errors.GkmError {
301
- kind;
302
- target;
303
- howToProvide;
304
- constructor(kind, target, howToProvide = HOW_TO_PROVIDE[kind] ?? "Pass it through the deploy's CredentialProvider.") {
305
- const what = kind === "dokploy" ? `No Dokploy credentials${target ? ` for ${target}` : ""}.` : kind === "registry" ? `Dokploy has no registry for ${target ?? "the configured registry"}, and there are no credentials to create one with.` : kind === "aws" ? `No AWS credentials${target ? ` for the "${target}" stage` : ""}.` : kind === "godaddy" ? `No GoDaddy API token${target ? ` for ${target}` : ""}.` : kind === "hostinger" ? `No Hostinger API token${target ? ` for ${target}` : ""}.` : `No "${String(kind)}" credentials${target ? ` for ${target}` : ""}.`;
306
- super(`${what} ${howToProvide}`);
307
- this.kind = kind;
308
- this.target = target;
309
- this.howToProvide = howToProvide;
310
- this.name = "MissingCredential";
311
- }
312
- };
313
- /** Whatever was asked for, from the first provider that has it. */
314
- function chainCredentials(...providers) {
315
- return { async get(request, options) {
316
- for (const provider of providers) {
317
- const found = await provider.get(request, options);
318
- if (found) return found;
319
- }
320
- } };
321
- }
322
- /**
323
- * Credentials from the environment, then from what `gkm login` stored. What
324
- * `deploy()` uses when it is handed no provider.
325
- *
326
- * - Dokploy: `DOKPLOY_API_TOKEN` / `DOKPLOY_ENDPOINT`, each falling back to
327
- * the stored login, and the endpoint finally to `deploy.dokploy.endpoint`.
328
- * Each half is read on its own: a token is a secret and belongs in the
329
- * environment, an endpoint is configuration and belongs in the config.
330
- * - Registry: `DOCKER_REGISTRY_USERNAME` / `DOCKER_REGISTRY_PASSWORD`.
331
- * - AWS: `AWS_PROFILE` when it is set, and then nothing else; otherwise
332
- * `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` / `AWS_SESSION_TOKEN`. The
333
- * profile winning is `secretsStoreFor`'s rule: a profile is a choice of
334
- * account someone made, exported keys may be left over from another.
335
- * Read here, by name, and handed only to the command that deploys — the
336
- * sandbox every other step runs in passes no `AWS_*` on.
337
- */
338
- function storedCredentials(options = {}) {
339
- const env = options.env ?? process.env;
340
- return { async get(asked) {
341
- const request = asked;
342
- switch (request.kind) {
343
- case "dokploy": {
344
- const stored = (await readCredentials(options.home ? { home: options.home } : void 0)).dokploy;
345
- const token = env.DOKPLOY_API_TOKEN ?? stored?.token;
346
- const endpoint = env.DOKPLOY_ENDPOINT ?? stored?.endpoint ?? request.endpoint;
347
- if (!token || !endpoint) return void 0;
348
- return {
349
- endpoint: endpoint.replace(/\/$/, ""),
350
- token
351
- };
352
- }
353
- case "registry": {
354
- const username = env.DOCKER_REGISTRY_USERNAME;
355
- const password = env.DOCKER_REGISTRY_PASSWORD;
356
- if (!username || !password) return void 0;
357
- return {
358
- username,
359
- password
360
- };
361
- }
362
- case "godaddy": {
363
- const token = env.GODADDY_API_TOKEN || (await readCredentials(options.home ? { home: options.home } : void 0)).godaddy?.token;
364
- if (!token) return void 0;
365
- return { token };
366
- }
367
- case "hostinger": {
368
- const token = env.HOSTINGER_API_TOKEN || (await readCredentials(options.home ? { home: options.home } : void 0)).hostinger?.token;
369
- if (!token) return void 0;
370
- return { token };
371
- }
372
- case "aws": {
373
- const region = env.AWS_REGION ?? env.AWS_DEFAULT_REGION;
374
- const where = region ? { region } : {};
375
- if (env.AWS_PROFILE) return {
376
- profile: env.AWS_PROFILE,
377
- ...where
378
- };
379
- const accessKeyId = env.AWS_ACCESS_KEY_ID;
380
- const secretAccessKey = env.AWS_SECRET_ACCESS_KEY;
381
- if (!accessKeyId || !secretAccessKey) return void 0;
382
- return {
383
- accessKeyId,
384
- secretAccessKey,
385
- ...env.AWS_SESSION_TOKEN ? { sessionToken: env.AWS_SESSION_TOKEN } : {},
386
- ...where
387
- };
388
- }
389
- }
390
- } };
391
- }
392
- //#endregion
393
- Object.defineProperty(exports, "CommandFailed", {
394
- enumerable: true,
395
- get: function() {
396
- return CommandFailed;
397
- }
398
- });
399
- Object.defineProperty(exports, "CommandTimedOut", {
400
- enumerable: true,
401
- get: function() {
402
- return CommandTimedOut;
403
- }
404
- });
405
- Object.defineProperty(exports, "DEFAULT_TIMEOUT_MS", {
406
- enumerable: true,
407
- get: function() {
408
- return DEFAULT_TIMEOUT_MS;
409
- }
410
- });
411
- Object.defineProperty(exports, "GKM_HOME_ENV", {
412
- enumerable: true,
413
- get: function() {
414
- return GKM_HOME_ENV;
415
- }
416
- });
417
- Object.defineProperty(exports, "MissingCredential", {
418
- enumerable: true,
419
- get: function() {
420
- return MissingCredential;
421
- }
422
- });
423
- Object.defineProperty(exports, "chainCredentials", {
424
- enumerable: true,
425
- get: function() {
426
- return chainCredentials;
427
- }
428
- });
429
- Object.defineProperty(exports, "getCredentialsPath", {
430
- enumerable: true,
431
- get: function() {
432
- return getCredentialsPath;
433
- }
434
- });
435
- Object.defineProperty(exports, "getDokployCredentials", {
436
- enumerable: true,
437
- get: function() {
438
- return getDokployCredentials;
439
- }
440
- });
441
- Object.defineProperty(exports, "getDokployRegistryId", {
442
- enumerable: true,
443
- get: function() {
444
- return getDokployRegistryId;
445
- }
446
- });
447
- Object.defineProperty(exports, "getDokployToken", {
448
- enumerable: true,
449
- get: function() {
450
- return getDokployToken;
451
- }
452
- });
453
- Object.defineProperty(exports, "getHostingerToken", {
454
- enumerable: true,
455
- get: function() {
456
- return getHostingerToken;
457
- }
458
- });
459
- Object.defineProperty(exports, "gkmHome", {
460
- enumerable: true,
461
- get: function() {
462
- return gkmHome;
463
- }
464
- });
465
- Object.defineProperty(exports, "readCredentials", {
466
- enumerable: true,
467
- get: function() {
468
- return readCredentials;
469
- }
470
- });
471
- Object.defineProperty(exports, "removeDokployCredentials", {
472
- enumerable: true,
473
- get: function() {
474
- return removeDokployCredentials;
475
- }
476
- });
477
- Object.defineProperty(exports, "removeGoDaddyCredentials", {
478
- enumerable: true,
479
- get: function() {
480
- return removeGoDaddyCredentials;
481
- }
482
- });
483
- Object.defineProperty(exports, "run", {
484
- enumerable: true,
485
- get: function() {
486
- return run;
487
- }
488
- });
489
- Object.defineProperty(exports, "runOutput", {
490
- enumerable: true,
491
- get: function() {
492
- return runOutput;
493
- }
494
- });
495
- Object.defineProperty(exports, "storeDokployCredentials", {
496
- enumerable: true,
497
- get: function() {
498
- return storeDokployCredentials;
499
- }
500
- });
501
- Object.defineProperty(exports, "storeGoDaddyToken", {
502
- enumerable: true,
503
- get: function() {
504
- return storeGoDaddyToken;
505
- }
506
- });
507
- Object.defineProperty(exports, "storeHostingerToken", {
508
- enumerable: true,
509
- get: function() {
510
- return storeHostingerToken;
511
- }
512
- });
513
- Object.defineProperty(exports, "storedCredentials", {
514
- enumerable: true,
515
- get: function() {
516
- return storedCredentials;
517
- }
518
- });
519
-
520
- //# sourceMappingURL=credentials-D7XJypNd.cjs.map