@geekmidas/cli 10.0.0-alpha.9 → 10.0.0-alpha.91

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 (457) hide show
  1. package/README.md +315 -414
  2. package/bin/adjacent-tsconfig.mjs +46 -8
  3. package/bin/gkm.mjs +11 -3
  4. package/bin/owning-tsconfig-jsx-register.mjs +18 -0
  5. package/bin/owning-tsconfig-jsx.mjs +108 -0
  6. package/dist/EndpointGenerator-CVc6Oi1Y.mjs +1021 -0
  7. package/dist/EndpointGenerator-CVc6Oi1Y.mjs.map +1 -0
  8. package/dist/EndpointGenerator-CwLjBCFE.cjs +1080 -0
  9. package/dist/EndpointGenerator-CwLjBCFE.cjs.map +1 -0
  10. package/dist/GoDaddyProvider-DSStJVAv.mjs +387 -0
  11. package/dist/GoDaddyProvider-DSStJVAv.mjs.map +1 -0
  12. package/dist/GoDaddyProvider-DqZ1qD_F.cjs +387 -0
  13. package/dist/GoDaddyProvider-DqZ1qD_F.cjs.map +1 -0
  14. package/dist/{HostingerProvider-Cft7lEYr.mjs → HostingerProvider-BI6J7oJr.mjs} +22 -23
  15. package/dist/HostingerProvider-BI6J7oJr.mjs.map +1 -0
  16. package/dist/{HostingerProvider-h3EbEp-Z.cjs → HostingerProvider-CyTpG_jy.cjs} +22 -23
  17. package/dist/HostingerProvider-CyTpG_jy.cjs.map +1 -0
  18. package/dist/LegacyStateStore-DXmNA7hy.cjs +89 -0
  19. package/dist/LegacyStateStore-DXmNA7hy.cjs.map +1 -0
  20. package/dist/LegacyStateStore-ZkdmiUFZ.mjs +89 -0
  21. package/dist/LegacyStateStore-ZkdmiUFZ.mjs.map +1 -0
  22. package/dist/LocalStateStore-BBeTlRTH.cjs +178 -0
  23. package/dist/LocalStateStore-BBeTlRTH.cjs.map +1 -0
  24. package/dist/LocalStateStore-CU-O0SBp.mjs +167 -0
  25. package/dist/LocalStateStore-CU-O0SBp.mjs.map +1 -0
  26. package/dist/OpenApiTsGenerator-B--HV-sW.cjs +541 -0
  27. package/dist/OpenApiTsGenerator-B--HV-sW.cjs.map +1 -0
  28. package/dist/OpenApiTsGenerator-CkvsPdgg.mjs +536 -0
  29. package/dist/OpenApiTsGenerator-CkvsPdgg.mjs.map +1 -0
  30. package/dist/{Route53Provider-di2fMM5N.cjs → Route53Provider-Bllus2NR.cjs} +21 -22
  31. package/dist/Route53Provider-Bllus2NR.cjs.map +1 -0
  32. package/dist/{Route53Provider-RdpUDJQk.mjs → Route53Provider-QXxjkZO1.mjs} +13 -13
  33. package/dist/Route53Provider-QXxjkZO1.mjs.map +1 -0
  34. package/dist/S3StateStore-Br8VMY22.cjs +160 -0
  35. package/dist/S3StateStore-Br8VMY22.cjs.map +1 -0
  36. package/dist/S3StateStore-bwxcI_wQ.mjs +161 -0
  37. package/dist/S3StateStore-bwxcI_wQ.mjs.map +1 -0
  38. package/dist/SSMStateStore-CsOS0W1y.mjs +154 -0
  39. package/dist/SSMStateStore-CsOS0W1y.mjs.map +1 -0
  40. package/dist/SSMStateStore-DoZE1Wi1.cjs +153 -0
  41. package/dist/SSMStateStore-DoZE1Wi1.cjs.map +1 -0
  42. package/dist/SubscriberGenerator-BPqQf8fB.mjs +448 -0
  43. package/dist/SubscriberGenerator-BPqQf8fB.mjs.map +1 -0
  44. package/dist/SubscriberGenerator-BVn7cQ-2.cjs +489 -0
  45. package/dist/SubscriberGenerator-BVn7cQ-2.cjs.map +1 -0
  46. package/dist/add-BSHk5Ngn.mjs +747 -0
  47. package/dist/add-BSHk5Ngn.mjs.map +1 -0
  48. package/dist/add-DmmBDV2e.cjs +749 -0
  49. package/dist/add-DmmBDV2e.cjs.map +1 -0
  50. package/dist/appPorts-C9z9Pzn9.mjs +223 -0
  51. package/dist/appPorts-C9z9Pzn9.mjs.map +1 -0
  52. package/dist/appPorts-Cu79hJF6.cjs +264 -0
  53. package/dist/appPorts-Cu79hJF6.cjs.map +1 -0
  54. package/dist/aws-B-6uEhgP.mjs +71 -0
  55. package/dist/aws-B-6uEhgP.mjs.map +1 -0
  56. package/dist/aws-BTawF0F-.cjs +82 -0
  57. package/dist/aws-BTawF0F-.cjs.map +1 -0
  58. package/dist/awsStore-7VmS_cZR.cjs +54 -0
  59. package/dist/awsStore-7VmS_cZR.cjs.map +1 -0
  60. package/dist/awsStore-B529csle.mjs +43 -0
  61. package/dist/awsStore-B529csle.mjs.map +1 -0
  62. package/dist/{backup-provisioner-Bgj5Vi_L.mjs → backup-provisioner-C8DnCmxK.mjs} +11 -8
  63. package/dist/backup-provisioner-C8DnCmxK.mjs.map +1 -0
  64. package/dist/{backup-provisioner-BrsHwYG0.cjs → backup-provisioner-oDEsPj02.cjs} +22 -20
  65. package/dist/backup-provisioner-oDEsPj02.cjs.map +1 -0
  66. package/dist/{bundler-BY1OmV1e.cjs → bundler-BQJiB7Ub.cjs} +38 -35
  67. package/dist/bundler-BQJiB7Ub.cjs.map +1 -0
  68. package/dist/{bundler-Be8Zg4Wd.mjs → bundler-D6eBfVkl.mjs} +36 -32
  69. package/dist/bundler-D6eBfVkl.mjs.map +1 -0
  70. package/dist/cli-BE9mqeX8.cjs +69 -0
  71. package/dist/cli-BE9mqeX8.cjs.map +1 -0
  72. package/dist/cli-DD-Yk-I5.mjs +69 -0
  73. package/dist/cli-DD-Yk-I5.mjs.map +1 -0
  74. package/dist/compose-Bhmf0n4o.mjs +3140 -0
  75. package/dist/compose-Bhmf0n4o.mjs.map +1 -0
  76. package/dist/compose-CvpU6ooi.cjs +3265 -0
  77. package/dist/compose-CvpU6ooi.cjs.map +1 -0
  78. package/dist/config-CdEcTrjG.d.mts +269 -0
  79. package/dist/config-CdEcTrjG.d.mts.map +1 -0
  80. package/dist/config-pST7E0CS.d.cts +269 -0
  81. package/dist/config-pST7E0CS.d.cts.map +1 -0
  82. package/dist/config.cjs +420 -11
  83. package/dist/config.cjs.map +1 -0
  84. package/dist/config.d.cts +4 -120
  85. package/dist/config.d.mts +4 -120
  86. package/dist/config.mjs +404 -4
  87. package/dist/config.mjs.map +1 -0
  88. package/dist/credentialSchemas-BJqRJNK4.mjs +236 -0
  89. package/dist/credentialSchemas-BJqRJNK4.mjs.map +1 -0
  90. package/dist/credentialSchemas-DCR4Wd1W.cjs +271 -0
  91. package/dist/credentialSchemas-DCR4Wd1W.cjs.map +1 -0
  92. package/dist/credentials-BKfIugu2.cjs +513 -0
  93. package/dist/credentials-BKfIugu2.cjs.map +1 -0
  94. package/dist/credentials-CnVqoXMb.mjs +388 -0
  95. package/dist/credentials-CnVqoXMb.mjs.map +1 -0
  96. package/dist/databases-BY-pEImp.cjs +597 -0
  97. package/dist/databases-BY-pEImp.cjs.map +1 -0
  98. package/dist/databases-CzszQV0N.mjs +494 -0
  99. package/dist/databases-CzszQV0N.mjs.map +1 -0
  100. package/dist/define-DR8xGYfL.mjs +97 -0
  101. package/dist/define-DR8xGYfL.mjs.map +1 -0
  102. package/dist/define-DzRz8FgH.cjs +144 -0
  103. package/dist/define-DzRz8FgH.cjs.map +1 -0
  104. package/dist/deploy/public.cjs +208 -0
  105. package/dist/deploy/public.cjs.map +1 -0
  106. package/dist/deploy/public.d.cts +649 -0
  107. package/dist/deploy/public.d.cts.map +1 -0
  108. package/dist/deploy/public.d.mts +649 -0
  109. package/dist/deploy/public.d.mts.map +1 -0
  110. package/dist/deploy/public.mjs +142 -0
  111. package/dist/deploy/public.mjs.map +1 -0
  112. package/dist/deploy/sniffer-envkit-patch.cjs +18 -10
  113. package/dist/deploy/sniffer-envkit-patch.cjs.map +1 -1
  114. package/dist/deploy/sniffer-envkit-patch.d.cts +0 -2
  115. package/dist/deploy/sniffer-envkit-patch.d.cts.map +1 -1
  116. package/dist/deploy/sniffer-envkit-patch.d.mts +0 -2
  117. package/dist/deploy/sniffer-envkit-patch.d.mts.map +1 -1
  118. package/dist/deploy/sniffer-envkit-patch.mjs +10 -2
  119. package/dist/deploy/sniffer-envkit-patch.mjs.map +1 -1
  120. package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
  121. package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
  122. package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
  123. package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
  124. package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
  125. package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
  126. package/dist/deploy/sniffer-hooks.cjs +13 -7
  127. package/dist/deploy/sniffer-hooks.cjs.map +1 -1
  128. package/dist/deploy/sniffer-hooks.d.cts +1 -2
  129. package/dist/deploy/sniffer-hooks.d.cts.map +1 -1
  130. package/dist/deploy/sniffer-hooks.d.mts +1 -2
  131. package/dist/deploy/sniffer-hooks.d.mts.map +1 -1
  132. package/dist/deploy/sniffer-hooks.mjs +10 -3
  133. package/dist/deploy/sniffer-hooks.mjs.map +1 -1
  134. package/dist/deploy/sniffer-loader.cjs +16 -7
  135. package/dist/deploy/sniffer-loader.cjs.map +1 -1
  136. package/dist/deploy/sniffer-loader.d.cts +1 -1
  137. package/dist/deploy/sniffer-loader.d.mts +1 -1
  138. package/dist/deploy/sniffer-loader.mjs +14 -3
  139. package/dist/deploy/sniffer-loader.mjs.map +1 -1
  140. package/dist/deploy/sniffer-routes-worker.cjs +11 -11
  141. package/dist/deploy/sniffer-routes-worker.cjs.map +1 -1
  142. package/dist/deploy/sniffer-routes-worker.d.cts +1 -1
  143. package/dist/deploy/sniffer-routes-worker.d.mts +1 -1
  144. package/dist/deploy/sniffer-routes-worker.mjs +4 -4
  145. package/dist/deploy/sniffer-routes-worker.mjs.map +1 -1
  146. package/dist/deploy/sniffer-worker.cjs +15 -6
  147. package/dist/deploy/sniffer-worker.cjs.map +1 -1
  148. package/dist/deploy/sniffer-worker.d.cts +1 -3
  149. package/dist/deploy/sniffer-worker.d.cts.map +1 -1
  150. package/dist/deploy/sniffer-worker.d.mts +1 -3
  151. package/dist/deploy/sniffer-worker.d.mts.map +1 -1
  152. package/dist/deploy/sniffer-worker.mjs +15 -4
  153. package/dist/deploy/sniffer-worker.mjs.map +1 -1
  154. package/dist/deploy-CuHasEA4.cjs +554 -0
  155. package/dist/deploy-CuHasEA4.cjs.map +1 -0
  156. package/dist/deploy-QNtx_eWR.mjs +525 -0
  157. package/dist/deploy-QNtx_eWR.mjs.map +1 -0
  158. package/dist/derive-B4vDpzgP.mjs +150 -0
  159. package/dist/derive-B4vDpzgP.mjs.map +1 -0
  160. package/dist/derive-DAbo49sm.cjs +161 -0
  161. package/dist/derive-DAbo49sm.cjs.map +1 -0
  162. package/dist/discover-BPelzeGW.mjs +526 -0
  163. package/dist/discover-BPelzeGW.mjs.map +1 -0
  164. package/dist/discover-CU0paUyH.d.cts +108 -0
  165. package/dist/discover-CU0paUyH.d.cts.map +1 -0
  166. package/dist/discover-D1It5r_h.cjs +599 -0
  167. package/dist/discover-D1It5r_h.cjs.map +1 -0
  168. package/dist/discover-DFiJxwfv.d.mts +108 -0
  169. package/dist/discover-DFiJxwfv.d.mts.map +1 -0
  170. package/dist/dokploy-CYcMLh9-.mjs +38 -0
  171. package/dist/dokploy-CYcMLh9-.mjs.map +1 -0
  172. package/dist/dokploy-DIowwyIB.cjs +38 -0
  173. package/dist/dokploy-DIowwyIB.cjs.map +1 -0
  174. package/dist/drivers-DTZzxeIl.mjs +177 -0
  175. package/dist/drivers-DTZzxeIl.mjs.map +1 -0
  176. package/dist/drivers-LYSdQDmd.cjs +200 -0
  177. package/dist/drivers-LYSdQDmd.cjs.map +1 -0
  178. package/dist/{emit-CiZS_5Ub.mjs → emit-C1e8qD08.mjs} +13 -26
  179. package/dist/emit-C1e8qD08.mjs.map +1 -0
  180. package/dist/{emit-CbcRolsa.cjs → emit-Dmc1nvdS.cjs} +31 -57
  181. package/dist/emit-Dmc1nvdS.cjs.map +1 -0
  182. package/dist/encryption-BrEef7Jk.mjs +88 -0
  183. package/dist/encryption-BrEef7Jk.mjs.map +1 -0
  184. package/dist/encryption-CjYdUb2s.cjs +89 -0
  185. package/dist/encryption-CjYdUb2s.cjs.map +1 -0
  186. package/dist/engine-2h4k5ICq.mjs +3085 -0
  187. package/dist/engine-2h4k5ICq.mjs.map +1 -0
  188. package/dist/engine-BhJ7ZP9K.cjs +3198 -0
  189. package/dist/engine-BhJ7ZP9K.cjs.map +1 -0
  190. package/dist/github-B5Bw4HIu.cjs +669 -0
  191. package/dist/github-B5Bw4HIu.cjs.map +1 -0
  192. package/dist/github-BCDF6xVH.mjs +669 -0
  193. package/dist/github-BCDF6xVH.mjs.map +1 -0
  194. package/dist/{index-C6e-ULLx.d.mts → index-D-F_hTDz.d.cts} +39 -24
  195. package/dist/index-D-F_hTDz.d.cts.map +1 -0
  196. package/dist/{index-CR5urhWX.d.cts → index-YFNxR5Ns.d.mts} +39 -24
  197. package/dist/index-YFNxR5Ns.d.mts.map +1 -0
  198. package/dist/index.cjs +9487 -12080
  199. package/dist/index.cjs.map +1 -1
  200. package/dist/index.d.cts +1 -1
  201. package/dist/index.d.mts +1 -1
  202. package/dist/index.mjs +9420 -12026
  203. package/dist/index.mjs.map +1 -1
  204. package/dist/local-BjxDfPvy.cjs +241 -0
  205. package/dist/local-BjxDfPvy.cjs.map +1 -0
  206. package/dist/local-IuoIF3CT.mjs +224 -0
  207. package/dist/local-IuoIF3CT.mjs.map +1 -0
  208. package/dist/migrate-CGaancHY.cjs +93 -0
  209. package/dist/migrate-CGaancHY.cjs.map +1 -0
  210. package/dist/migrate-DWZz9kah.mjs +93 -0
  211. package/dist/migrate-DWZz9kah.mjs.map +1 -0
  212. package/dist/migrate-DbtcuOr_.mjs +265 -0
  213. package/dist/migrate-DbtcuOr_.mjs.map +1 -0
  214. package/dist/migrate-q2YYLJLE.cjs +270 -0
  215. package/dist/migrate-q2YYLJLE.cjs.map +1 -0
  216. package/dist/openapi.cjs +214 -10
  217. package/dist/openapi.cjs.map +1 -0
  218. package/dist/openapi.d.cts +47 -17
  219. package/dist/openapi.d.cts.map +1 -1
  220. package/dist/openapi.d.mts +47 -17
  221. package/dist/openapi.d.mts.map +1 -1
  222. package/dist/openapi.mjs +208 -5
  223. package/dist/openapi.mjs.map +1 -0
  224. package/dist/provider-C9_-45d5.cjs +56 -0
  225. package/dist/provider-C9_-45d5.cjs.map +1 -0
  226. package/dist/provider-q4lsYzYG.mjs +45 -0
  227. package/dist/provider-q4lsYzYG.mjs.map +1 -0
  228. package/dist/ready-BpNbORRB.cjs +402 -0
  229. package/dist/ready-BpNbORRB.cjs.map +1 -0
  230. package/dist/ready-b6vm0-W-.mjs +373 -0
  231. package/dist/ready-b6vm0-W-.mjs.map +1 -0
  232. package/dist/reconcile/public.cjs +3 -5
  233. package/dist/reconcile/public.d.cts +11 -87
  234. package/dist/reconcile/public.d.cts.map +1 -1
  235. package/dist/reconcile/public.d.mts +11 -87
  236. package/dist/reconcile/public.d.mts.map +1 -1
  237. package/dist/reconcile/public.mjs +3 -4
  238. package/dist/{reconcile-D0pimNiy.cjs → reconcile-CuCQBa5-.cjs} +5 -8
  239. package/dist/reconcile-CuCQBa5-.cjs.map +1 -0
  240. package/dist/{reconcile-CFs8C_1a.mjs → reconcile-Dh1Jk7WE.mjs} +4 -7
  241. package/dist/reconcile-Dh1Jk7WE.mjs.map +1 -0
  242. package/dist/resolve-Cns0v6dN.cjs +315 -0
  243. package/dist/resolve-Cns0v6dN.cjs.map +1 -0
  244. package/dist/resolve-DNg0icnh.mjs +262 -0
  245. package/dist/resolve-DNg0icnh.mjs.map +1 -0
  246. package/dist/rollback-CFrNLmxs.mjs +132 -0
  247. package/dist/rollback-CFrNLmxs.mjs.map +1 -0
  248. package/dist/rollback-UIjS25F1.cjs +161 -0
  249. package/dist/rollback-UIjS25F1.cjs.map +1 -0
  250. package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
  251. package/dist/{chunk-CUT6urMc.cjs → rolldown-runtime-C0BPl7ul.cjs} +23 -10
  252. package/dist/runtime-CN_kmqxo.d.cts +90 -0
  253. package/dist/runtime-CN_kmqxo.d.cts.map +1 -0
  254. package/dist/runtime-Cjvon3oj.d.mts +90 -0
  255. package/dist/runtime-Cjvon3oj.d.mts.map +1 -0
  256. package/dist/sandbox/config-worker.cjs +43 -0
  257. package/dist/sandbox/config-worker.cjs.map +1 -0
  258. package/dist/sandbox/config-worker.d.cts +1 -0
  259. package/dist/sandbox/config-worker.d.mts +1 -0
  260. package/dist/sandbox/config-worker.mjs +44 -0
  261. package/dist/sandbox/config-worker.mjs.map +1 -0
  262. package/dist/sandbox/credentials-worker.cjs +54 -0
  263. package/dist/sandbox/credentials-worker.cjs.map +1 -0
  264. package/dist/sandbox/credentials-worker.d.cts +1 -0
  265. package/dist/sandbox/credentials-worker.d.mts +1 -0
  266. package/dist/sandbox/credentials-worker.mjs +55 -0
  267. package/dist/sandbox/credentials-worker.mjs.map +1 -0
  268. package/dist/sandbox/discover-worker.cjs +47 -0
  269. package/dist/sandbox/discover-worker.cjs.map +1 -0
  270. package/dist/sandbox/discover-worker.d.cts +1 -0
  271. package/dist/sandbox/discover-worker.d.mts +1 -0
  272. package/dist/sandbox/discover-worker.mjs +48 -0
  273. package/dist/sandbox/discover-worker.mjs.map +1 -0
  274. package/dist/sandbox/migrate-worker.cjs +75 -0
  275. package/dist/sandbox/migrate-worker.cjs.map +1 -0
  276. package/dist/sandbox/migrate-worker.d.cts +1 -0
  277. package/dist/sandbox/migrate-worker.d.mts +1 -0
  278. package/dist/sandbox/migrate-worker.mjs +76 -0
  279. package/dist/sandbox/migrate-worker.mjs.map +1 -0
  280. package/dist/sandbox-CL--ZDui.cjs +164 -0
  281. package/dist/sandbox-CL--ZDui.cjs.map +1 -0
  282. package/dist/sandbox-Dm247NGx.mjs +117 -0
  283. package/dist/sandbox-Dm247NGx.mjs.map +1 -0
  284. package/dist/sandbox-M8UnLhXE.d.cts +126 -0
  285. package/dist/sandbox-M8UnLhXE.d.cts.map +1 -0
  286. package/dist/sandbox-M8UnLhXE.d.mts +126 -0
  287. package/dist/sandbox-M8UnLhXE.d.mts.map +1 -0
  288. package/dist/{workspace-zoqRbihZ.mjs → schemas-BObwxB_t.cjs} +998 -1659
  289. package/dist/schemas-BObwxB_t.cjs.map +1 -0
  290. package/dist/{workspace-C6VJQVtG.cjs → schemas-D-xeKJDD.mjs} +913 -1842
  291. package/dist/schemas-D-xeKJDD.mjs.map +1 -0
  292. package/dist/secretsManager-Chs9VV2r.mjs +76 -0
  293. package/dist/secretsManager-Chs9VV2r.mjs.map +1 -0
  294. package/dist/secretsManager-DcMlHnRC.cjs +87 -0
  295. package/dist/secretsManager-DcMlHnRC.cjs.map +1 -0
  296. package/dist/seeds-CkIPFGNO.cjs +10560 -0
  297. package/dist/seeds-CkIPFGNO.cjs.map +1 -0
  298. package/dist/seeds-odfgSCmu.mjs +9538 -0
  299. package/dist/seeds-odfgSCmu.mjs.map +1 -0
  300. package/dist/sniffer-BTtX3NUM.mjs +1262 -0
  301. package/dist/sniffer-BTtX3NUM.mjs.map +1 -0
  302. package/dist/sniffer-IAQEpsQb.cjs +1333 -0
  303. package/dist/sniffer-IAQEpsQb.cjs.map +1 -0
  304. package/dist/sst-BgcOsaBi.cjs +453 -0
  305. package/dist/sst-BgcOsaBi.cjs.map +1 -0
  306. package/dist/sst-CJzvyrEz.mjs +430 -0
  307. package/dist/sst-CJzvyrEz.mjs.map +1 -0
  308. package/dist/stages-CUn6gvXL.cjs +174 -0
  309. package/dist/stages-CUn6gvXL.cjs.map +1 -0
  310. package/dist/stages-CnZRYmkI.mjs +174 -0
  311. package/dist/stages-CnZRYmkI.mjs.map +1 -0
  312. package/dist/target/public.cjs +15 -0
  313. package/dist/target/public.d.cts +28 -0
  314. package/dist/target/public.d.cts.map +1 -0
  315. package/dist/target/public.d.mts +28 -0
  316. package/dist/target/public.d.mts.map +1 -0
  317. package/dist/target/public.mjs +4 -0
  318. package/dist/terminal-D8TPK7o9.mjs +84 -0
  319. package/dist/terminal-D8TPK7o9.mjs.map +1 -0
  320. package/dist/terminal-DuapRxh6.cjs +84 -0
  321. package/dist/terminal-DuapRxh6.cjs.map +1 -0
  322. package/dist/types-NqX1Hz4P.d.cts +7454 -0
  323. package/dist/types-NqX1Hz4P.d.cts.map +1 -0
  324. package/dist/types-ZHuZ89hv.d.mts +7453 -0
  325. package/dist/types-ZHuZ89hv.d.mts.map +1 -0
  326. package/dist/utils-D2Nk1Nv2.cjs +205 -0
  327. package/dist/utils-D2Nk1Nv2.cjs.map +1 -0
  328. package/dist/utils-D_fxUqvU.mjs +156 -0
  329. package/dist/utils-D_fxUqvU.mjs.map +1 -0
  330. package/dist/vitest.cjs +65 -0
  331. package/dist/vitest.cjs.map +1 -0
  332. package/dist/vitest.d.cts +29 -0
  333. package/dist/vitest.d.cts.map +1 -0
  334. package/dist/vitest.d.mts +29 -0
  335. package/dist/vitest.d.mts.map +1 -0
  336. package/dist/vitest.mjs +65 -0
  337. package/dist/vitest.mjs.map +1 -0
  338. package/dist/workerRuntime-BXfhbe13.cjs +108 -0
  339. package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
  340. package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
  341. package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
  342. package/dist/workspace/index.cjs +8 -4
  343. package/dist/workspace/index.d.cts +3 -3
  344. package/dist/workspace/index.d.mts +3 -3
  345. package/dist/workspace/index.mjs +2 -3
  346. package/dist/workspace-CJ0lKFq-.mjs +1979 -0
  347. package/dist/workspace-CJ0lKFq-.mjs.map +1 -0
  348. package/dist/workspace-CwW3Gkru.cjs +2355 -0
  349. package/dist/workspace-CwW3Gkru.cjs.map +1 -0
  350. package/package.json +53 -22
  351. package/dist/CachedStateProvider-BLo7zv7S.cjs +0 -3
  352. package/dist/CachedStateProvider-BxoAm-B2.mjs +0 -3
  353. package/dist/CachedStateProvider-CqPdW7CB.cjs +0 -60
  354. package/dist/CachedStateProvider-CqPdW7CB.cjs.map +0 -1
  355. package/dist/CachedStateProvider-DTniehMP.mjs +0 -54
  356. package/dist/CachedStateProvider-DTniehMP.mjs.map +0 -1
  357. package/dist/HostingerProvider-Cft7lEYr.mjs.map +0 -1
  358. package/dist/HostingerProvider-h3EbEp-Z.cjs.map +0 -1
  359. package/dist/LocalStateProvider-Bn6tS-oL.mjs +0 -42
  360. package/dist/LocalStateProvider-Bn6tS-oL.mjs.map +0 -1
  361. package/dist/LocalStateProvider-Db9SEjyH.cjs +0 -43
  362. package/dist/LocalStateProvider-Db9SEjyH.cjs.map +0 -1
  363. package/dist/Route53Provider-RdpUDJQk.mjs.map +0 -1
  364. package/dist/Route53Provider-di2fMM5N.cjs.map +0 -1
  365. package/dist/SSMStateProvider-BRt2py-A.mjs +0 -66
  366. package/dist/SSMStateProvider-BRt2py-A.mjs.map +0 -1
  367. package/dist/SSMStateProvider-DyX8s9HI.cjs +0 -66
  368. package/dist/SSMStateProvider-DyX8s9HI.cjs.map +0 -1
  369. package/dist/backup-provisioner-Bgj5Vi_L.mjs.map +0 -1
  370. package/dist/backup-provisioner-BrsHwYG0.cjs.map +0 -1
  371. package/dist/bundler-BY1OmV1e.cjs.map +0 -1
  372. package/dist/bundler-Be8Zg4Wd.mjs.map +0 -1
  373. package/dist/chunk-Duj1WY3L.mjs +0 -7
  374. package/dist/config-BZ1F0WuA.cjs +0 -462
  375. package/dist/config-BZ1F0WuA.cjs.map +0 -1
  376. package/dist/config-DVVph9yz.mjs +0 -402
  377. package/dist/config-DVVph9yz.mjs.map +0 -1
  378. package/dist/config.d.cts.map +0 -1
  379. package/dist/config.d.mts.map +0 -1
  380. package/dist/credentials-B5zRHdAl.mjs +0 -141
  381. package/dist/credentials-B5zRHdAl.mjs.map +0 -1
  382. package/dist/credentials-BapzjyV5.cjs +0 -195
  383. package/dist/credentials-BapzjyV5.cjs.map +0 -1
  384. package/dist/credentials-Xamqe_NJ.cjs +0 -2681
  385. package/dist/credentials-Xamqe_NJ.cjs.map +0 -1
  386. package/dist/credentials-dP8vRVRv.mjs +0 -2549
  387. package/dist/credentials-dP8vRVRv.mjs.map +0 -1
  388. package/dist/discover-CAlFgYec.mjs +0 -229
  389. package/dist/discover-CAlFgYec.mjs.map +0 -1
  390. package/dist/discover-DTmFeloL.cjs +0 -271
  391. package/dist/discover-DTmFeloL.cjs.map +0 -1
  392. package/dist/dokploy-api-BS2xnJLZ.mjs +0 -3
  393. package/dist/dokploy-api-BsVH0y_s.cjs +0 -718
  394. package/dist/dokploy-api-BsVH0y_s.cjs.map +0 -1
  395. package/dist/dokploy-api-BuxDRo3l.cjs +0 -3
  396. package/dist/dokploy-api-aTFPz7_4.mjs +0 -706
  397. package/dist/dokploy-api-aTFPz7_4.mjs.map +0 -1
  398. package/dist/emit-CbcRolsa.cjs.map +0 -1
  399. package/dist/emit-CiZS_5Ub.mjs.map +0 -1
  400. package/dist/encryption-C6jaU0hE.cjs +0 -54
  401. package/dist/encryption-C6jaU0hE.cjs.map +0 -1
  402. package/dist/encryption-CHzzeR8a.cjs +0 -4
  403. package/dist/encryption-CQUncu7v.mjs +0 -3
  404. package/dist/encryption-D-abyhZx.mjs +0 -42
  405. package/dist/encryption-D-abyhZx.mjs.map +0 -1
  406. package/dist/fullstack-secrets-C-GGohke.cjs +0 -111
  407. package/dist/fullstack-secrets-C-GGohke.cjs.map +0 -1
  408. package/dist/fullstack-secrets-D1o9-G5l.mjs +0 -87
  409. package/dist/fullstack-secrets-D1o9-G5l.mjs.map +0 -1
  410. package/dist/generator-CNzBw7g5.cjs +0 -289
  411. package/dist/generator-CNzBw7g5.cjs.map +0 -1
  412. package/dist/generator-VE2JrFlY.mjs +0 -253
  413. package/dist/generator-VE2JrFlY.mjs.map +0 -1
  414. package/dist/index-C6e-ULLx.d.mts.map +0 -1
  415. package/dist/index-CR5urhWX.d.cts.map +0 -1
  416. package/dist/openapi-SjsgARie.cjs +0 -2075
  417. package/dist/openapi-SjsgARie.cjs.map +0 -1
  418. package/dist/openapi-Xx0A7Wg0.mjs +0 -2021
  419. package/dist/openapi-Xx0A7Wg0.mjs.map +0 -1
  420. package/dist/openapi-react-query-Byltvm_7.mjs +0 -167
  421. package/dist/openapi-react-query-Byltvm_7.mjs.map +0 -1
  422. package/dist/openapi-react-query-CmJ1xDbn.cjs +0 -173
  423. package/dist/openapi-react-query-CmJ1xDbn.cjs.map +0 -1
  424. package/dist/openapi-react-query.cjs +0 -4
  425. package/dist/openapi-react-query.d.cts +0 -11
  426. package/dist/openapi-react-query.d.cts.map +0 -1
  427. package/dist/openapi-react-query.d.mts +0 -11
  428. package/dist/openapi-react-query.d.mts.map +0 -1
  429. package/dist/openapi-react-query.mjs +0 -4
  430. package/dist/reconcile-CFs8C_1a.mjs.map +0 -1
  431. package/dist/reconcile-D0pimNiy.cjs.map +0 -1
  432. package/dist/setup-BA8ciTPU.mjs +0 -11
  433. package/dist/setup-BsZvZP6f.cjs +0 -11
  434. package/dist/setup-C8KOx8_8.mjs +0 -443
  435. package/dist/setup-C8KOx8_8.mjs.map +0 -1
  436. package/dist/setup-hC6hI86f.cjs +0 -473
  437. package/dist/setup-hC6hI86f.cjs.map +0 -1
  438. package/dist/storage-BJmzYxt8.cjs +0 -363
  439. package/dist/storage-BJmzYxt8.cjs.map +0 -1
  440. package/dist/storage-BM9hGpgv.cjs +0 -7
  441. package/dist/storage-Bi24WfoW.mjs +0 -297
  442. package/dist/storage-Bi24WfoW.mjs.map +0 -1
  443. package/dist/storage-CYlGwWTj.mjs +0 -3
  444. package/dist/sync-CmEuNZsB.mjs +0 -76
  445. package/dist/sync-CmEuNZsB.mjs.map +0 -1
  446. package/dist/sync-D306yOWu.cjs +0 -4
  447. package/dist/sync-SizaChmC.cjs +0 -93
  448. package/dist/sync-SizaChmC.cjs.map +0 -1
  449. package/dist/sync-hOqAWHR6.mjs +0 -3
  450. package/dist/types-6pkp2RRj.d.mts +0 -2220
  451. package/dist/types-6pkp2RRj.d.mts.map +0 -1
  452. package/dist/types-Y3fKQSAK.d.cts +0 -2220
  453. package/dist/types-Y3fKQSAK.d.cts.map +0 -1
  454. package/dist/workspace-BzrG_2SI.mjs +0 -8
  455. package/dist/workspace-C6VJQVtG.cjs.map +0 -1
  456. package/dist/workspace-XXtNhqJl.cjs +0 -9
  457. package/dist/workspace-zoqRbihZ.mjs.map +0 -1
@@ -0,0 +1,1333 @@
1
+ const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
+ const require_discover = require("./discover-D1It5r_h.cjs");
3
+ const require_sandbox = require("./sandbox-CL--ZDui.cjs");
4
+ const require_workspace = require("./workspace-CwW3Gkru.cjs");
5
+ const require_local = require("./local-BjxDfPvy.cjs");
6
+ let node_path = require("node:path");
7
+ let node_fs = require("node:fs");
8
+ let node_url = require("node:url");
9
+ let node_crypto = require("node:crypto");
10
+ //#region src/secrets/encryption.ts
11
+ var encryption_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
12
+ encryptSecrets: () => encryptSecrets,
13
+ generateDefineOptions: () => generateDefineOptions,
14
+ keyFingerprint: () => keyFingerprint
15
+ });
16
+ /** AES-256-GCM configuration */
17
+ const ALGORITHM = "aes-256-gcm";
18
+ const KEY_LENGTH = 32;
19
+ const IV_LENGTH = 12;
20
+ /**
21
+ * Encrypt secrets for embedding in a bundle.
22
+ * Uses AES-256-GCM with a randomly generated ephemeral key.
23
+ *
24
+ * @param secrets - Key-value pairs to encrypt
25
+ * @returns Encrypted payload with ephemeral master key
26
+ */
27
+ function encryptSecrets(secrets) {
28
+ const masterKey = (0, node_crypto.randomBytes)(KEY_LENGTH);
29
+ const iv = (0, node_crypto.randomBytes)(IV_LENGTH);
30
+ const plaintext = JSON.stringify(secrets);
31
+ const cipher = (0, node_crypto.createCipheriv)(ALGORITHM, masterKey, iv);
32
+ const ciphertext = Buffer.concat([cipher.update(plaintext, "utf-8"), cipher.final()]);
33
+ const authTag = cipher.getAuthTag();
34
+ return {
35
+ encrypted: Buffer.concat([ciphertext, authTag]).toString("base64"),
36
+ iv: iv.toString("hex"),
37
+ masterKey: masterKey.toString("hex")
38
+ };
39
+ }
40
+ /**
41
+ * Generate the define options for tsdown/esbuild.
42
+ * These will be injected at build time.
43
+ */
44
+ function generateDefineOptions(payload) {
45
+ return {
46
+ __GKM_ENCRYPTED_CREDENTIALS__: JSON.stringify(payload.encrypted),
47
+ __GKM_CREDENTIALS_IV__: JSON.stringify(payload.iv)
48
+ };
49
+ }
50
+ /**
51
+ * A short, one-way name for a master key: the first 8 hex characters of its
52
+ * SHA-256.
53
+ *
54
+ * Printed where the key itself used to be, so a person can tell which key a
55
+ * build used — and match it against the one they hold — without the output
56
+ * carrying a value that decrypts every secret of the stage.
57
+ */
58
+ function keyFingerprint(masterKey) {
59
+ return (0, node_crypto.createHash)("sha256").update(masterKey).digest("hex").slice(0, 8);
60
+ }
61
+ //#endregion
62
+ //#region src/deploy/events.ts
63
+ /** An error as an event carries it: its name and message, nothing else. */
64
+ function eventError(error) {
65
+ if (error instanceof Error) return {
66
+ name: error.name,
67
+ message: error.message
68
+ };
69
+ return {
70
+ name: "Error",
71
+ message: String(error)
72
+ };
73
+ }
74
+ //#endregion
75
+ //#region src/target/dokploy/dokploy-api.ts
76
+ var dokploy_api_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
77
+ DEFAULT_DEPLOYMENT_TIMEOUT_MS: () => DEFAULT_DEPLOYMENT_TIMEOUT_MS,
78
+ DEFAULT_DOKPLOY_TIMEOUT_MS: () => DEFAULT_DOKPLOY_TIMEOUT_MS,
79
+ DeploymentFailed: () => DeploymentFailed,
80
+ DeploymentTimedOut: () => DeploymentTimedOut,
81
+ DokployApi: () => DokployApi,
82
+ DokployApiError: () => DokployApiError,
83
+ DokployRequestTimedOut: () => DokployRequestTimedOut
84
+ });
85
+ /** Per request, so a stalled server fails the deploy, not the CI job. */
86
+ const DEFAULT_DOKPLOY_TIMEOUT_MS = 3e4;
87
+ /**
88
+ * Dokploy accepted the connection but did not answer in time.
89
+ *
90
+ * Not retried: a request that arrived and stalled may still be acted on, and
91
+ * sending it again could repeat a deploy or a create the server is already
92
+ * doing.
93
+ */
94
+ var DokployRequestTimedOut = class extends Error {
95
+ baseUrl;
96
+ endpoint;
97
+ timeoutMs;
98
+ constructor(baseUrl, endpoint, timeoutMs) {
99
+ super(`Dokploy at ${baseUrl} did not answer ${endpoint} within ${timeoutMs}ms. Check that the Dokploy server is healthy, or raise \`timeoutMs\` if this call is known to be slow.`);
100
+ this.baseUrl = baseUrl;
101
+ this.endpoint = endpoint;
102
+ this.timeoutMs = timeoutMs;
103
+ this.name = "DokployRequestTimedOut";
104
+ }
105
+ };
106
+ /**
107
+ * Waits `ms` between retries, or rejects with the signal's reason the moment
108
+ * it aborts — a caller who gave up should not sit through the backoff.
109
+ */
110
+ function pause(ms, signal) {
111
+ return new Promise((resolve, reject) => {
112
+ if (signal?.aborted) {
113
+ reject(signal.reason);
114
+ return;
115
+ }
116
+ const onAbort = () => {
117
+ clearTimeout(timer);
118
+ reject(signal?.reason);
119
+ };
120
+ const timer = setTimeout(() => {
121
+ signal?.removeEventListener("abort", onAbort);
122
+ resolve();
123
+ }, ms);
124
+ signal?.addEventListener("abort", onAbort, { once: true });
125
+ });
126
+ }
127
+ /** How long a deployment may take to finish before a deploy gives up on it. */
128
+ const DEFAULT_DEPLOYMENT_TIMEOUT_MS = 6e5;
129
+ /** A deployment Dokploy ran and reported as failed. */
130
+ var DeploymentFailed = class extends Error {
131
+ applicationId;
132
+ deployment;
133
+ constructor(applicationId, deployment) {
134
+ super(`Dokploy's deployment ${deployment.deploymentId} of application ${applicationId} ended in "${deployment.status}"${deployment.errorMessage ? `: ${deployment.errorMessage}` : ""}. Its log in Dokploy says why — usually an image the server could not pull, or a container that exited on start.`);
135
+ this.applicationId = applicationId;
136
+ this.deployment = deployment;
137
+ this.name = "DeploymentFailed";
138
+ }
139
+ };
140
+ /** A deployment that had not finished when the deploy stopped waiting. */
141
+ var DeploymentTimedOut = class extends Error {
142
+ applicationId;
143
+ timeoutMs;
144
+ lastStatus;
145
+ constructor(applicationId, timeoutMs, lastStatus) {
146
+ super(`Application ${applicationId} did not finish deploying within ${Math.round(timeoutMs / 1e3)}s (${lastStatus ? `last status "${lastStatus}"` : "no deployment started"}). Check its deployment log in Dokploy, or raise deploy.dokploy.verify.deploymentTimeoutMs for an image that is slow to pull.`);
147
+ this.applicationId = applicationId;
148
+ this.timeoutMs = timeoutMs;
149
+ this.lastStatus = lastStatus;
150
+ this.name = "DeploymentTimedOut";
151
+ }
152
+ };
153
+ var DokployApiError = class extends Error {
154
+ status;
155
+ statusText;
156
+ issues;
157
+ constructor(message, status, statusText, issues) {
158
+ super(message);
159
+ this.status = status;
160
+ this.statusText = statusText;
161
+ this.issues = issues;
162
+ this.name = "DokployApiError";
163
+ }
164
+ };
165
+ /**
166
+ * Dokploy API client
167
+ */
168
+ var DokployApi = class {
169
+ baseUrl;
170
+ token;
171
+ timeoutMs;
172
+ signal;
173
+ constructor(options) {
174
+ this.baseUrl = options.baseUrl.replace(/\/$/, "");
175
+ this.token = options.token;
176
+ this.timeoutMs = options.timeoutMs ?? 3e4;
177
+ this.signal = options.signal;
178
+ }
179
+ /**
180
+ * Make a GET request to the Dokploy API
181
+ */
182
+ async get(endpoint) {
183
+ return this.request("GET", endpoint);
184
+ }
185
+ /**
186
+ * Make a POST request to the Dokploy API
187
+ */
188
+ async post(endpoint, body) {
189
+ return this.request("POST", endpoint, body);
190
+ }
191
+ /**
192
+ * Make a request to the Dokploy API
193
+ */
194
+ async request(method, endpoint, body) {
195
+ const url = `${this.baseUrl}/api/${endpoint}`;
196
+ let response;
197
+ let timeout;
198
+ let lastError;
199
+ for (let attempt = 1; attempt <= 3; attempt++) {
200
+ this.signal?.throwIfAborted();
201
+ timeout = AbortSignal.timeout(this.timeoutMs);
202
+ try {
203
+ response = await fetch(url, {
204
+ method,
205
+ headers: {
206
+ "Content-Type": "application/json",
207
+ "x-api-key": this.token
208
+ },
209
+ body: body ? JSON.stringify(body) : void 0,
210
+ signal: this.signal ? AbortSignal.any([this.signal, timeout]) : timeout
211
+ });
212
+ break;
213
+ } catch (error) {
214
+ const stopped = this.stopped(timeout, endpoint);
215
+ if (stopped) throw stopped;
216
+ lastError = error;
217
+ if (attempt === 3) break;
218
+ await pause(attempt * 750, this.signal);
219
+ }
220
+ }
221
+ if (!response || !timeout) {
222
+ const detail = lastError instanceof Error ? lastError.message : String(lastError);
223
+ throw new DokployApiError(`Could not reach Dokploy at ${this.baseUrl} (${endpoint}): ${detail}`, 0, "Network error");
224
+ }
225
+ try {
226
+ return await this.read(response);
227
+ } catch (error) {
228
+ throw this.stopped(timeout, endpoint) ?? error;
229
+ }
230
+ }
231
+ /**
232
+ * What a request cut short should reject with: the caller's own reason
233
+ * when they aborted, `DokployRequestTimedOut` when the deadline passed,
234
+ * nothing when it was neither.
235
+ */
236
+ stopped(timeout, endpoint) {
237
+ if (this.signal?.aborted) return this.signal.reason;
238
+ if (timeout.aborted) return new DokployRequestTimedOut(this.baseUrl, endpoint, this.timeoutMs);
239
+ }
240
+ /** Turns a response into its JSON body, or a `DokployApiError`. */
241
+ async read(response) {
242
+ if (!response.ok) {
243
+ let errorMessage = `Dokploy API error: ${response.status} ${response.statusText}`;
244
+ let issues;
245
+ try {
246
+ const errorBody = await response.json();
247
+ if (errorBody.message) errorMessage = `Dokploy API error: ${errorBody.message}`;
248
+ if (errorBody.issues?.length) {
249
+ issues = errorBody.issues;
250
+ errorMessage += `\n Issues: ${errorBody.issues.map((i) => i.message).join(", ")}`;
251
+ }
252
+ } catch {}
253
+ throw new DokployApiError(errorMessage, response.status, response.statusText, issues);
254
+ }
255
+ const text = await response.text();
256
+ if (!text || text.trim() === "") return;
257
+ return JSON.parse(text);
258
+ }
259
+ /**
260
+ * Every external port published on this server, across every project.
261
+ *
262
+ * Dokploy knows what it has bound; guessing does not. A port that looks free
263
+ * from here can be held by a service in a project this deploy has never
264
+ * heard of — which surfaces as `Port 5432 is already in use by container
265
+ * "…"`, naming something the caller cannot see.
266
+ *
267
+ * `project.all` is a summary, so each project is fetched: the per-service
268
+ * `externalPort` only appears on `project.one`.
269
+ */
270
+ async publishedPorts() {
271
+ const ports = /* @__PURE__ */ new Set();
272
+ const projects = await this.listProjects();
273
+ for (const project of projects) {
274
+ const details = await this.getProject(project.projectId);
275
+ for (const environment of details.environments ?? []) {
276
+ const resources = [
277
+ ...environment.postgres ?? [],
278
+ ...environment.redis ?? [],
279
+ ...environment.applications ?? []
280
+ ];
281
+ for (const resource of resources) if (typeof resource.externalPort === "number") ports.add(resource.externalPort);
282
+ }
283
+ }
284
+ return ports;
285
+ }
286
+ /**
287
+ * Validate the API token by making a test request
288
+ */
289
+ async validateToken() {
290
+ try {
291
+ await this.get("project.all");
292
+ return true;
293
+ } catch {
294
+ return false;
295
+ }
296
+ }
297
+ /**
298
+ * List all projects
299
+ */
300
+ async listProjects() {
301
+ return this.get("project.all");
302
+ }
303
+ /**
304
+ * Get a single project by ID
305
+ */
306
+ async getProject(projectId) {
307
+ return this.get(`project.one?projectId=${projectId}`);
308
+ }
309
+ /**
310
+ * Create a new project
311
+ */
312
+ async createProject(name, description) {
313
+ return this.post("project.create", {
314
+ name,
315
+ description: description ?? `Created by gkm CLI`
316
+ });
317
+ }
318
+ /**
319
+ * Change a project's name or description.
320
+ *
321
+ * The name is sent with the description because `project.update` validates
322
+ * the whole project on some Dokploy versions, and a missing name fails it.
323
+ */
324
+ async updateProject(projectId, updates) {
325
+ await this.post("project.update", {
326
+ projectId,
327
+ ...updates
328
+ });
329
+ }
330
+ /**
331
+ * Delete a project and all its resources
332
+ */
333
+ async deleteProject(projectId) {
334
+ await this.post("project.remove", { projectId });
335
+ }
336
+ /**
337
+ * Create an environment in a project
338
+ */
339
+ async createEnvironment(projectId, name, description) {
340
+ return this.post("environment.create", {
341
+ projectId,
342
+ name,
343
+ description: description ?? `${name} environment`
344
+ });
345
+ }
346
+ /**
347
+ * List all applications in a project
348
+ */
349
+ async listApplications(projectId) {
350
+ return this.listInProject(projectId, (env) => env.applications);
351
+ }
352
+ /**
353
+ * Everything of one kind in a project, across its environments.
354
+ *
355
+ * From `project.one`, because the per-kind `*.all?projectId=` endpoints
356
+ * return **404** on current Dokploy: resources live under environments now.
357
+ * Those calls used to be wrapped in `catch { return [] }`, which turned "I
358
+ * could not ask" into "there are none" — and for a find-or-create that is
359
+ * the worst available answer. Every deploy created a second application, a
360
+ * second Postgres and a second Redis, silently, for as long as the project
361
+ * existed.
362
+ *
363
+ * A failure here is not swallowed: creating a duplicate is worse than
364
+ * stopping.
365
+ */
366
+ async listInProject(projectId, pick) {
367
+ return ((await this.getProject(projectId)).environments ?? []).flatMap((environment) => (pick(environment) ?? []).map((resource) => ({
368
+ ...resource,
369
+ environmentId: environment.environmentId
370
+ })));
371
+ }
372
+ /**
373
+ * Find an application by name in a project
374
+ */
375
+ async findApplicationByName(projectId, name, environmentId) {
376
+ const applications = await this.listApplications(projectId);
377
+ const normalizedName = name.toLowerCase().replace(/[^a-z0-9-]/g, "-");
378
+ return applications.find((app) => (!environmentId || app.environmentId === environmentId) && (app.name === name || app.appName === normalizedName));
379
+ }
380
+ /**
381
+ * Create a new application
382
+ */
383
+ async createApplication(name, projectId, environmentId) {
384
+ return this.post("application.create", {
385
+ name,
386
+ projectId,
387
+ environmentId,
388
+ appName: name.toLowerCase().replace(/[^a-z0-9-]/g, "-")
389
+ });
390
+ }
391
+ /**
392
+ * Find or create an application by name
393
+ */
394
+ async findOrCreateApplication(name, projectId, environmentId) {
395
+ const existing = await this.findApplicationByName(projectId, name, environmentId);
396
+ if (existing) return {
397
+ application: existing,
398
+ created: false
399
+ };
400
+ return {
401
+ application: await this.createApplication(name, projectId, environmentId),
402
+ created: true
403
+ };
404
+ }
405
+ /**
406
+ * Get an application by ID
407
+ */
408
+ async getApplication(applicationId) {
409
+ try {
410
+ return await this.get(`application.one?applicationId=${applicationId}`);
411
+ } catch {
412
+ return null;
413
+ }
414
+ }
415
+ /**
416
+ * Update an application
417
+ */
418
+ async updateApplication(applicationId, updates) {
419
+ await this.post("application.update", {
420
+ applicationId,
421
+ ...updates
422
+ });
423
+ }
424
+ /**
425
+ * Save environment variables for an application
426
+ */
427
+ async saveApplicationEnv(applicationId, env, options) {
428
+ await this.post("application.saveEnvironment", {
429
+ applicationId,
430
+ env,
431
+ buildArgs: options?.buildArgs ?? null,
432
+ buildSecrets: options?.buildSecrets ?? null,
433
+ createEnvFile: false
434
+ });
435
+ }
436
+ /**
437
+ * Configure application to use Docker provider (pull from registry)
438
+ *
439
+ * For private registries, either:
440
+ * - Use `registryId` if the registry is configured in Dokploy
441
+ * - Or provide `username`, `password`, and `registryUrl` directly
442
+ */
443
+ async saveDockerProvider(applicationId, dockerImage, options) {
444
+ await this.post("application.saveDockerProvider", {
445
+ applicationId,
446
+ dockerImage,
447
+ ...options,
448
+ username: options?.username ?? null,
449
+ password: options?.password ?? null,
450
+ registryUrl: options?.registryUrl ?? null
451
+ });
452
+ }
453
+ /**
454
+ * Deploy an application
455
+ */
456
+ async deployApplication(applicationId) {
457
+ await this.post("application.deploy", { applicationId });
458
+ }
459
+ /**
460
+ * An application's deployments, newest first.
461
+ *
462
+ * Sorted here rather than trusted to arrive sorted: which deployment is
463
+ * the latest is the whole question `waitForDeployment` asks.
464
+ */
465
+ async listDeployments(applicationId) {
466
+ return [...await this.get(`deployment.all?applicationId=${encodeURIComponent(applicationId)}`)].sort((a, b) => Date.parse(b.createdAt) - Date.parse(a.createdAt));
467
+ }
468
+ /**
469
+ * When the application's latest deployment was created, by Dokploy's own
470
+ * clock — what `waitForDeployment`'s `since` is measured against. Epoch
471
+ * when it has none.
472
+ */
473
+ async latestDeploymentAt(applicationId) {
474
+ const [latest] = await this.listDeployments(applicationId);
475
+ return new Date(latest ? Date.parse(latest.createdAt) : 0);
476
+ }
477
+ /**
478
+ * Wait for the deployment `application.deploy` queued to finish.
479
+ *
480
+ * `application.deploy` only queues one: it answers before the image is
481
+ * pulled, let alone running, so a deploy that stopped there reported
482
+ * success for containers that had not started. This polls the latest
483
+ * deployment created after `since` — Dokploy's clock, from
484
+ * `latestDeploymentAt` before deploying, so a laptop's skew cannot pick an
485
+ * older one — and the application's own status, backing off from
486
+ * `intervalMs` to `maxIntervalMs`.
487
+ *
488
+ * @throws {DeploymentFailed} when the deployment ends in `error` or is
489
+ * cancelled, or the application reports `error` once it has finished.
490
+ * @throws {DeploymentTimedOut} when it has not finished within `timeoutMs`.
491
+ */
492
+ async waitForDeployment(applicationId, options) {
493
+ const { since, timeoutMs = DEFAULT_DEPLOYMENT_TIMEOUT_MS, signal, intervalMs = 2e3, maxIntervalMs = 15e3 } = options;
494
+ const after = since.getTime();
495
+ const deadline = Date.now() + timeoutMs;
496
+ let interval = intervalMs;
497
+ let last;
498
+ while (true) {
499
+ signal?.throwIfAborted();
500
+ const deployment = (await this.listDeployments(applicationId)).find((d) => Date.parse(d.createdAt) > after);
501
+ last = deployment ?? last;
502
+ if (deployment) {
503
+ if (deployment.status === "error" || deployment.status === "cancelled") throw new DeploymentFailed(applicationId, deployment);
504
+ if (deployment.status === "done") {
505
+ const { applicationStatus } = await this.get(`application.one?applicationId=${encodeURIComponent(applicationId)}`);
506
+ if (applicationStatus === "error") throw new DeploymentFailed(applicationId, deployment);
507
+ if (applicationStatus !== "running") return deployment;
508
+ }
509
+ }
510
+ const left = deadline - Date.now();
511
+ if (left <= 0) throw new DeploymentTimedOut(applicationId, timeoutMs, last?.status);
512
+ await pause(Math.min(interval, left), signal);
513
+ interval = Math.min(interval * 2, maxIntervalMs);
514
+ }
515
+ }
516
+ /**
517
+ * Delete an application
518
+ */
519
+ async deleteApplication(applicationId) {
520
+ await this.post("application.remove", { applicationId });
521
+ }
522
+ /**
523
+ * List all registries
524
+ */
525
+ async listRegistries() {
526
+ return this.get("registry.all");
527
+ }
528
+ /**
529
+ * Create a new registry
530
+ */
531
+ async createRegistry(registryName, registryUrl, username, password, options) {
532
+ return this.post("registry.create", {
533
+ registryName,
534
+ registryUrl,
535
+ username,
536
+ password,
537
+ imagePrefix: options?.imagePrefix
538
+ });
539
+ }
540
+ /**
541
+ * Get a registry by ID
542
+ */
543
+ async getRegistry(registryId) {
544
+ return this.get(`registry.one?registryId=${registryId}`);
545
+ }
546
+ /**
547
+ * Update a registry
548
+ */
549
+ async updateRegistry(registryId, updates) {
550
+ await this.post("registry.update", {
551
+ registryId,
552
+ ...updates
553
+ });
554
+ }
555
+ /**
556
+ * Delete a registry
557
+ */
558
+ async deleteRegistry(registryId) {
559
+ await this.post("registry.remove", { registryId });
560
+ }
561
+ /**
562
+ * List all Postgres databases in a project
563
+ */
564
+ async listPostgres(projectId) {
565
+ return this.listInProject(projectId, (env) => env.postgres);
566
+ }
567
+ /**
568
+ * Find a Postgres database by name in a project
569
+ */
570
+ async findPostgresByName(projectId, name) {
571
+ const databases = await this.listPostgres(projectId);
572
+ const normalizedName = name.toLowerCase().replace(/[^a-z0-9-]/g, "-");
573
+ const match = databases.find((db) => db.name === name || db.appName === normalizedName);
574
+ if (!match) return void 0;
575
+ return this.getPostgres(match.postgresId);
576
+ }
577
+ /**
578
+ * Create a new Postgres database
579
+ */
580
+ async createPostgres(name, projectId, environmentId, options) {
581
+ return this.post("postgres.create", {
582
+ name,
583
+ projectId,
584
+ environmentId,
585
+ appName: options?.appName ?? name.toLowerCase().replace(/[^a-z0-9-]/g, "-"),
586
+ databaseName: options?.databaseName,
587
+ databaseUser: options?.databaseUser ?? "postgres",
588
+ databasePassword: options?.databasePassword,
589
+ dockerImage: options?.dockerImage ?? "postgres:18",
590
+ description: options?.description ?? `Postgres database for ${name}`
591
+ });
592
+ }
593
+ /**
594
+ * Find or create a Postgres database by name
595
+ */
596
+ async findOrCreatePostgres(name, projectId, environmentId, options) {
597
+ const existing = await this.findPostgresByName(projectId, name);
598
+ if (existing) return {
599
+ postgres: existing,
600
+ created: false
601
+ };
602
+ return {
603
+ postgres: await this.createPostgres(name, projectId, environmentId, options),
604
+ created: true
605
+ };
606
+ }
607
+ /**
608
+ * Get a Postgres database by ID
609
+ */
610
+ async getPostgres(postgresId) {
611
+ return this.get(`postgres.one?postgresId=${postgresId}`);
612
+ }
613
+ /**
614
+ * Deploy a Postgres database
615
+ */
616
+ async deployPostgres(postgresId) {
617
+ await this.post("postgres.deploy", { postgresId });
618
+ }
619
+ /**
620
+ * Save environment variables for Postgres
621
+ */
622
+ async savePostgresEnv(postgresId, env) {
623
+ await this.post("postgres.saveEnvironment", {
624
+ postgresId,
625
+ env
626
+ });
627
+ }
628
+ /**
629
+ * Set external port for Postgres (for external access)
630
+ */
631
+ async savePostgresExternalPort(postgresId, externalPort) {
632
+ await this.post("postgres.saveExternalPort", {
633
+ postgresId,
634
+ externalPort
635
+ });
636
+ }
637
+ /**
638
+ * Update Postgres configuration
639
+ */
640
+ async updatePostgres(postgresId, updates) {
641
+ await this.post("postgres.update", {
642
+ postgresId,
643
+ ...updates
644
+ });
645
+ }
646
+ /**
647
+ * Delete a Postgres database
648
+ */
649
+ async deletePostgres(postgresId) {
650
+ await this.post("postgres.remove", { postgresId });
651
+ }
652
+ /**
653
+ * The compose stacks in a project.
654
+ *
655
+ * Dokploy has first-class primitives for Postgres and Redis and none for
656
+ * MinIO, so an object store is a compose stack — the one kind whose contents
657
+ * this target writes rather than configures.
658
+ */
659
+ async listCompose(projectId) {
660
+ return this.listInProject(projectId, (env) => env.compose);
661
+ }
662
+ /** A compose stack by name, hydrated — `project.one` returns summaries. */
663
+ async findComposeByName(projectId, name) {
664
+ const summary = (await this.listCompose(projectId)).find((compose) => compose.name === name);
665
+ return summary ? this.getCompose(summary.composeId) : void 0;
666
+ }
667
+ async getCompose(composeId) {
668
+ return this.get(`compose.one?composeId=${composeId}`);
669
+ }
670
+ /**
671
+ * A compose stack carrying the file this target wrote.
672
+ *
673
+ * Created empty and then updated, because `compose.create` takes no file:
674
+ * it defaults to `sourceType: 'github'` and expects a repository. `raw` is
675
+ * what makes the file ours.
676
+ */
677
+ async findOrCreateCompose(name, projectId, environmentId, composeFile) {
678
+ const existing = await this.findComposeByName(projectId, name);
679
+ const compose = existing ?? await this.post("compose.create", {
680
+ name,
681
+ environmentId,
682
+ composeType: "docker-compose"
683
+ });
684
+ await this.post("compose.update", {
685
+ composeId: compose.composeId,
686
+ sourceType: "raw",
687
+ composeFile
688
+ });
689
+ return {
690
+ compose,
691
+ created: !existing
692
+ };
693
+ }
694
+ async deployCompose(composeId) {
695
+ await this.post("compose.deploy", { composeId });
696
+ }
697
+ async deleteCompose(composeId) {
698
+ await this.post("compose.delete", {
699
+ composeId,
700
+ deleteVolumes: false
701
+ });
702
+ }
703
+ /**
704
+ * List all Redis instances in a project
705
+ */
706
+ async listRedis(projectId) {
707
+ return this.listInProject(projectId, (env) => env.redis);
708
+ }
709
+ /**
710
+ * Find a Redis instance by name in a project
711
+ */
712
+ async findRedisByName(projectId, name) {
713
+ const instances = await this.listRedis(projectId);
714
+ const normalizedName = name.toLowerCase().replace(/[^a-z0-9-]/g, "-");
715
+ const match = instances.find((redis) => redis.name === name || redis.appName === normalizedName);
716
+ return match ? this.getRedis(match.redisId) : void 0;
717
+ }
718
+ /**
719
+ * Create a new Redis instance
720
+ */
721
+ async createRedis(name, projectId, environmentId, options) {
722
+ return this.post("redis.create", {
723
+ name,
724
+ projectId,
725
+ environmentId,
726
+ appName: options?.appName ?? name.toLowerCase().replace(/[^a-z0-9-]/g, "-"),
727
+ databasePassword: options?.databasePassword,
728
+ dockerImage: options?.dockerImage ?? "redis:8",
729
+ description: options?.description ?? `Redis instance for ${name}`
730
+ });
731
+ }
732
+ /**
733
+ * Find or create a Redis instance by name
734
+ */
735
+ async findOrCreateRedis(name, projectId, environmentId, options) {
736
+ const existing = await this.findRedisByName(projectId, name);
737
+ if (existing) return {
738
+ redis: existing,
739
+ created: false
740
+ };
741
+ return {
742
+ redis: await this.createRedis(name, projectId, environmentId, options),
743
+ created: true
744
+ };
745
+ }
746
+ /**
747
+ * Get a Redis instance by ID
748
+ */
749
+ async getRedis(redisId) {
750
+ return this.get(`redis.one?redisId=${redisId}`);
751
+ }
752
+ /**
753
+ * Deploy a Redis instance
754
+ */
755
+ async deployRedis(redisId) {
756
+ await this.post("redis.deploy", { redisId });
757
+ }
758
+ /**
759
+ * Save environment variables for Redis
760
+ */
761
+ async saveRedisEnv(redisId, env) {
762
+ await this.post("redis.saveEnvironment", {
763
+ redisId,
764
+ env
765
+ });
766
+ }
767
+ /**
768
+ * Set external port for Redis (for external access)
769
+ */
770
+ async saveRedisExternalPort(redisId, externalPort) {
771
+ await this.post("redis.saveExternalPort", {
772
+ redisId,
773
+ externalPort
774
+ });
775
+ }
776
+ /**
777
+ * Update Redis configuration
778
+ */
779
+ async updateRedis(redisId, updates) {
780
+ await this.post("redis.update", {
781
+ redisId,
782
+ ...updates
783
+ });
784
+ }
785
+ /**
786
+ * Delete a Redis instance
787
+ */
788
+ async deleteRedis(redisId) {
789
+ await this.post("redis.remove", { redisId });
790
+ }
791
+ /**
792
+ * Create a new domain for an application
793
+ */
794
+ async createDomain(options) {
795
+ return this.post("domain.create", options);
796
+ }
797
+ /**
798
+ * Update an existing domain
799
+ */
800
+ async updateDomain(domainId, updates) {
801
+ await this.post("domain.update", {
802
+ domainId,
803
+ ...updates
804
+ });
805
+ }
806
+ /**
807
+ * Delete a domain
808
+ */
809
+ async deleteDomain(domainId) {
810
+ await this.post("domain.delete", { domainId });
811
+ }
812
+ /**
813
+ * Get a domain by ID
814
+ */
815
+ async getDomain(domainId) {
816
+ return this.get(`domain.one?domainId=${domainId}`);
817
+ }
818
+ /**
819
+ * Get all domains for an application
820
+ */
821
+ async getDomainsByApplicationId(applicationId) {
822
+ return this.get(`domain.byApplicationId?applicationId=${applicationId}`);
823
+ }
824
+ /**
825
+ * Validate a domain and trigger SSL certificate generation
826
+ *
827
+ * This should be called after DNS records are created and propagated.
828
+ * It triggers Let's Encrypt certificate generation for HTTPS domains.
829
+ *
830
+ * @param domain - The domain hostname to validate (e.g., 'api.example.com')
831
+ */
832
+ async validateDomain(domain) {
833
+ return this.post("domain.validateDomain", { domain });
834
+ }
835
+ /**
836
+ * Auto-generate a domain name for an application
837
+ */
838
+ async generateDomain(appName, serverId) {
839
+ return this.post("domain.generateDomain", {
840
+ appName,
841
+ serverId
842
+ });
843
+ }
844
+ /**
845
+ * List all backup destinations
846
+ */
847
+ async listDestinations() {
848
+ return this.get("destination.all");
849
+ }
850
+ /**
851
+ * Get a destination by ID
852
+ */
853
+ async getDestination(destinationId) {
854
+ return this.get(`destination.one?destinationId=${destinationId}`);
855
+ }
856
+ /**
857
+ * Create a new S3 backup destination
858
+ */
859
+ async createDestination(options) {
860
+ return this.post("destination.create", { ...options });
861
+ }
862
+ /**
863
+ * Find a destination by name
864
+ */
865
+ async findDestinationByName(name) {
866
+ return (await this.listDestinations()).find((d) => d.name === name);
867
+ }
868
+ /**
869
+ * Find or create a destination by name
870
+ */
871
+ async findOrCreateDestination(name, options) {
872
+ const existing = await this.findDestinationByName(name);
873
+ if (existing) return {
874
+ destination: existing,
875
+ created: false
876
+ };
877
+ return {
878
+ destination: await this.createDestination({
879
+ name,
880
+ ...options
881
+ }),
882
+ created: true
883
+ };
884
+ }
885
+ /**
886
+ * Update a destination
887
+ */
888
+ async updateDestination(destinationId, updates) {
889
+ await this.post("destination.update", {
890
+ destinationId,
891
+ ...updates
892
+ });
893
+ }
894
+ /**
895
+ * Delete a destination
896
+ */
897
+ async deleteDestination(destinationId) {
898
+ await this.post("destination.remove", { destinationId });
899
+ }
900
+ /**
901
+ * Test connection to a destination
902
+ */
903
+ async testDestinationConnection(destinationId) {
904
+ return this.post("destination.testConnection", { destinationId });
905
+ }
906
+ /**
907
+ * Create a backup schedule for postgres
908
+ */
909
+ async createPostgresBackup(options) {
910
+ return this.post("backup.create", {
911
+ ...options,
912
+ databaseType: "postgres"
913
+ });
914
+ }
915
+ /**
916
+ * List backups for a postgres database
917
+ */
918
+ async listPostgresBackups(postgresId) {
919
+ return this.get(`backup.all?postgresId=${postgresId}&databaseType=postgres`);
920
+ }
921
+ /**
922
+ * Get a backup by ID
923
+ */
924
+ async getBackup(backupId) {
925
+ return this.get(`backup.one?backupId=${backupId}`);
926
+ }
927
+ /**
928
+ * Update a backup schedule
929
+ */
930
+ async updateBackup(backupId, updates) {
931
+ await this.post("backup.update", {
932
+ backupId,
933
+ ...updates
934
+ });
935
+ }
936
+ /**
937
+ * Delete a backup schedule
938
+ */
939
+ async deleteBackup(backupId) {
940
+ await this.post("backup.remove", { backupId });
941
+ }
942
+ /**
943
+ * Trigger a manual backup run
944
+ */
945
+ async runBackupManually(backupId) {
946
+ await this.post("backup.manualBackup", { backupId });
947
+ }
948
+ };
949
+ //#endregion
950
+ //#region src/workspace/client-generator.ts
951
+ /**
952
+ * Normalize routes to an array of patterns.
953
+ * Handles a glob or a list of them.
954
+ * @internal Exported for use in dev command
955
+ */
956
+ function normalizeRoutes(routes) {
957
+ if (!routes) return [];
958
+ return Array.isArray(routes) ? routes : [routes];
959
+ }
960
+ //#endregion
961
+ //#region src/deploy/sniffer.ts
962
+ const __filename$1 = (0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href);
963
+ const __dirname$1 = (0, node_path.dirname)(__filename$1);
964
+ /**
965
+ * Resolve the path to a sniffer helper file.
966
+ * Handles both dev (.ts with tsx) and production (.mjs from dist).
967
+ *
968
+ * In production: sniffer.ts is bundled into dist/index.mjs, but sniffer helper
969
+ * files are output to dist/deploy/ as standalone modules for subprocess loading.
970
+ *
971
+ * In development: All files are in src/deploy/ and loaded via tsx.
972
+ */
973
+ function resolveSnifferFile(baseName) {
974
+ const deployMjsPath = (0, node_path.resolve)(__dirname$1, "deploy", `${baseName}.mjs`);
975
+ if ((0, node_fs.existsSync)(deployMjsPath)) return deployMjsPath;
976
+ const mjsPath = (0, node_path.resolve)(__dirname$1, `${baseName}.mjs`);
977
+ if ((0, node_fs.existsSync)(mjsPath)) return mjsPath;
978
+ const tsPath = (0, node_path.resolve)(__dirname$1, `${baseName}.ts`);
979
+ if ((0, node_fs.existsSync)(tsPath)) return tsPath;
980
+ return tsPath;
981
+ }
982
+ /**
983
+ * Run a sniffer worker in the sandbox, with the sandbox's environment and
984
+ * nothing of the deploy's: the deploy's Dokploy token, registry login and AWS
985
+ * keys stay where they are. A worker that outlives the timeout is killed, and
986
+ * comes back as the error the caller reports.
987
+ */
988
+ async function runSniffer(run, workspacePath, cwd, nodeArgs) {
989
+ const sandbox = run.sandbox ?? require_sandbox.activeSandbox() ?? new require_local.LocalSandbox({ root: (0, node_path.resolve)(workspacePath) });
990
+ try {
991
+ const result = await sandbox.exec("node", nodeArgs, {
992
+ cwd,
993
+ env: { ...sandbox.env },
994
+ timeoutMs: run.timeoutMs ?? 3e4,
995
+ output: "capture"
996
+ });
997
+ return {
998
+ stdout: result.stdout,
999
+ stderr: result.stderr,
1000
+ code: result.exitCode
1001
+ };
1002
+ } catch (error) {
1003
+ return { error: error instanceof Error ? error : new Error(String(error)) };
1004
+ }
1005
+ }
1006
+ /** The worker's JSON answer: the last object on stdout naming `envVars`. */
1007
+ function snifferAnswer(stdout) {
1008
+ try {
1009
+ const jsonMatch = stdout.match(/\{[^{}]*"envVars"[^{}]*\}[^{]*$/);
1010
+ return jsonMatch ? JSON.parse(jsonMatch[0]) : void 0;
1011
+ } catch {
1012
+ return;
1013
+ }
1014
+ }
1015
+ /**
1016
+ * Get required environment variables for an app.
1017
+ *
1018
+ * Detection strategy (in order):
1019
+ * 1. Frontend apps: Returns empty (no server secrets)
1020
+ * 2. Apps with `requiredEnv`: Uses explicit list from config
1021
+ * 3. Entry apps: Imports entry file in subprocess to capture config.parse() calls
1022
+ * 4. Route-based apps: Loads route files and calls getEnvironment() on each construct
1023
+ * 5. Apps with `envParser` (no routes): Runs SnifferEnvironmentParser to detect usage
1024
+ * 6. Apps with neither: Returns empty
1025
+ *
1026
+ * This function handles "fire and forget" async operations gracefully,
1027
+ * capturing errors and unhandled rejections without failing the build.
1028
+ *
1029
+ * @param app - The normalized app configuration
1030
+ * @param appName - The name of the app
1031
+ * @param workspacePath - Absolute path to the workspace root
1032
+ * @param options - Optional configuration for sniffing behavior
1033
+ * @returns The sniffed environment with required variables
1034
+ */
1035
+ async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
1036
+ const { logWarnings = true, markOptional = false } = options;
1037
+ const run = {
1038
+ ...options.sandbox ? { sandbox: options.sandbox } : {},
1039
+ ...options.timeoutMs ? { timeoutMs: options.timeoutMs } : {}
1040
+ };
1041
+ if (app.type === "web" || app.type === "mobile") {
1042
+ const publicPrefix = require_workspace.getPublicEnvPrefix(app.framework);
1043
+ const depVars = publicPrefix ? (app.dependencies ?? []).map((dep) => `${publicPrefix}${dep.toUpperCase()}_URL`) : [];
1044
+ if (app.config) {
1045
+ const sniffedVars = [];
1046
+ const sniffedOptional = [];
1047
+ const configPaths = [];
1048
+ if (app.config.client) configPaths.push(app.config.client);
1049
+ if (app.config.server) configPaths.push(app.config.server);
1050
+ for (const configPath of configPaths) {
1051
+ const result = await sniffEntryFile(configPath, app.path, workspacePath, run);
1052
+ if (logWarnings && result.error) require_discover.output.warn(`[sniffer] ${appName}: Config file "${configPath}" threw error during sniffing (env vars still captured): ${result.error.message}`);
1053
+ sniffedVars.push(...result.envVars);
1054
+ sniffedOptional.push(...result.optionalEnvVars);
1055
+ }
1056
+ const optionalEnvVars = [...new Set(sniffedOptional)];
1057
+ return {
1058
+ appName,
1059
+ requiredEnvVars: applyMarkOptional([.../* @__PURE__ */ new Set([...depVars, ...sniffedVars])], optionalEnvVars, markOptional),
1060
+ optionalEnvVars
1061
+ };
1062
+ }
1063
+ return {
1064
+ appName,
1065
+ requiredEnvVars: depVars,
1066
+ optionalEnvVars: []
1067
+ };
1068
+ }
1069
+ if (app.entry) {
1070
+ const result = await sniffEntryFile(app.entry, app.path, workspacePath, run);
1071
+ if (logWarnings && result.error) require_discover.output.warn(`[sniffer] ${appName}: Entry file threw error during sniffing (env vars still captured): ${result.error.message}`);
1072
+ return {
1073
+ appName,
1074
+ requiredEnvVars: applyMarkOptional(result.envVars, result.optionalEnvVars, markOptional),
1075
+ optionalEnvVars: result.optionalEnvVars
1076
+ };
1077
+ }
1078
+ if (app.routes) {
1079
+ const result = await sniffRouteFiles(normalizeRoutes(app.routes), app.path, workspacePath, run);
1080
+ if (logWarnings && result.error) require_discover.output.warn(`[sniffer] ${appName}: Route sniffing threw error (env vars still captured): ${result.error.message}`);
1081
+ return {
1082
+ appName,
1083
+ requiredEnvVars: applyMarkOptional(result.envVars, result.optionalEnvVars, markOptional),
1084
+ optionalEnvVars: result.optionalEnvVars
1085
+ };
1086
+ }
1087
+ if (app.envParser) {
1088
+ const result = await sniffEnvParser(app.envParser, app.path, workspacePath, run);
1089
+ if (logWarnings) {
1090
+ if (result.error) require_discover.output.warn(`[sniffer] ${appName}: envParser threw error during sniffing (env vars still captured): ${result.error.message}`);
1091
+ if (result.unhandledRejections.length > 0) require_discover.output.warn(`[sniffer] ${appName}: Fire-and-forget rejections during sniffing (suppressed): ${result.unhandledRejections.map((e) => e.message).join(", ")}`);
1092
+ }
1093
+ return {
1094
+ appName,
1095
+ requiredEnvVars: applyMarkOptional(result.envVars, result.optionalEnvVars, markOptional),
1096
+ optionalEnvVars: result.optionalEnvVars
1097
+ };
1098
+ }
1099
+ return {
1100
+ appName,
1101
+ requiredEnvVars: [],
1102
+ optionalEnvVars: []
1103
+ };
1104
+ }
1105
+ /**
1106
+ * Apply the `?` suffix to optional variables in an env var list.
1107
+ * Only modifies the list when `markOptional` is true and there are optional vars.
1108
+ */
1109
+ function applyMarkOptional(envVars, optionalEnvVars, markOptional) {
1110
+ if (!markOptional || optionalEnvVars.length === 0) return envVars;
1111
+ const optionalSet = new Set(optionalEnvVars);
1112
+ return envVars.map((v) => optionalSet.has(v) ? `${v}?` : v);
1113
+ }
1114
+ /**
1115
+ * Sniff an entry file by importing it in a subprocess.
1116
+ *
1117
+ * Entry apps call `config.parse()` at module load time. To capture which
1118
+ * env vars are accessed, we:
1119
+ * 1. Spawn a subprocess with a module loader hook
1120
+ * 2. The loader intercepts `@geekmidas/envkit` and replaces EnvironmentParser
1121
+ * with SnifferEnvironmentParser
1122
+ * 3. Import the entry file (triggers config.parse())
1123
+ * 4. Capture and return the accessed env var names
1124
+ *
1125
+ * This approach provides process isolation - each app is sniffed in its own
1126
+ * subprocess, preventing module cache pollution.
1127
+ *
1128
+ * @param entryPath - Relative path to the entry file (e.g., './src/index.ts')
1129
+ * @param appPath - The app's path relative to workspace (e.g., 'apps/auth')
1130
+ * @param workspacePath - Absolute path to workspace root
1131
+ * @returns EntrySniffResult with env vars and optional error
1132
+ */
1133
+ async function sniffEntryFile(entryPath, appPath, workspacePath, run = {}) {
1134
+ const fullEntryPath = (0, node_path.resolve)(workspacePath, appPath, entryPath);
1135
+ const loaderPath = resolveSnifferFile("sniffer-loader");
1136
+ const workerPath = resolveSnifferFile("sniffer-worker");
1137
+ const ran = await runSniffer(run, workspacePath, (0, node_path.resolve)(workspacePath, appPath), require_discover.nodeWithTsx(workerPath, [fullEntryPath], [loaderPath]));
1138
+ if ("error" in ran) return {
1139
+ envVars: [],
1140
+ optionalEnvVars: [],
1141
+ error: ran.error
1142
+ };
1143
+ const answer = snifferAnswer(ran.stdout);
1144
+ if (answer) return {
1145
+ envVars: answer.envVars || [],
1146
+ optionalEnvVars: answer.optionalEnvVars || [],
1147
+ error: answer.error ? new Error(answer.error) : void 0
1148
+ };
1149
+ return {
1150
+ envVars: [],
1151
+ optionalEnvVars: [],
1152
+ error: /* @__PURE__ */ new Error(`Failed to sniff entry file (exit code ${ran.code}): ${ran.stderr || ran.stdout || "No output"}`)
1153
+ };
1154
+ }
1155
+ /**
1156
+ * Sniff route files by loading constructs and calling getEnvironment().
1157
+ *
1158
+ * Route-based apps have endpoints, functions, crons, and subscribers that
1159
+ * use services. Each service's register() method accesses environment variables.
1160
+ *
1161
+ * This runs in a subprocess with tsx loader to properly handle TypeScript
1162
+ * compilation and path alias resolution (e.g., `src/...` imports).
1163
+ *
1164
+ * @param routes - Glob pattern(s) for route files
1165
+ * @param appPath - The app's path relative to workspace (e.g., 'apps/api')
1166
+ * @param workspacePath - Absolute path to workspace root
1167
+ * @returns EntrySniffResult with env vars and optional error
1168
+ */
1169
+ async function sniffRouteFiles(routes, appPath, workspacePath, run = {}) {
1170
+ const fullAppPath = (0, node_path.resolve)(workspacePath, appPath);
1171
+ const workerPath = resolveSnifferFile("sniffer-routes-worker");
1172
+ const pattern = (Array.isArray(routes) ? routes : [routes])[0];
1173
+ if (!pattern) return {
1174
+ envVars: [],
1175
+ optionalEnvVars: [],
1176
+ error: /* @__PURE__ */ new Error("No route patterns provided")
1177
+ };
1178
+ const ran = await runSniffer(run, workspacePath, fullAppPath, require_discover.nodeWithTsx(workerPath, [fullAppPath, pattern]));
1179
+ if ("error" in ran) return {
1180
+ envVars: [],
1181
+ optionalEnvVars: [],
1182
+ error: ran.error
1183
+ };
1184
+ if (ran.stderr) ran.stderr.split("\n").filter((line) => line.trim()).forEach((line) => require_discover.output.warn(line));
1185
+ const answer = snifferAnswer(ran.stdout);
1186
+ if (answer) return {
1187
+ envVars: answer.envVars || [],
1188
+ optionalEnvVars: answer.optionalEnvVars || [],
1189
+ error: answer.error ? new Error(answer.error) : void 0
1190
+ };
1191
+ return {
1192
+ envVars: [],
1193
+ optionalEnvVars: [],
1194
+ error: /* @__PURE__ */ new Error(`Failed to sniff route files (exit code ${ran.code}): ${ran.stderr || ran.stdout || "No output"}`)
1195
+ };
1196
+ }
1197
+ /**
1198
+ * Run the SnifferEnvironmentParser on an envParser module to detect
1199
+ * which environment variables it accesses.
1200
+ *
1201
+ * In a subprocess, like the entry and route sniffers: the module is the
1202
+ * project's code, and it was imported into the deploy itself before — with
1203
+ * every credential the deploy held in reach. Fire-and-forget rejections are
1204
+ * collected there with the shared `sniffWithFireAndForget`.
1205
+ *
1206
+ * @param envParserPath - The envParser config (e.g., './src/config/env#envParser')
1207
+ * @param appPath - The app's path relative to workspace
1208
+ * @param workspacePath - Absolute path to workspace root
1209
+ * @returns SniffResult with env vars and any errors encountered
1210
+ */
1211
+ async function sniffEnvParser(envParserPath, appPath, workspacePath, run = {}) {
1212
+ const [modulePath, exportName = "default"] = envParserPath.split("#");
1213
+ if (!modulePath) return {
1214
+ envVars: [],
1215
+ optionalEnvVars: [],
1216
+ unhandledRejections: []
1217
+ };
1218
+ const appRoot = (0, node_path.resolve)(workspacePath, appPath);
1219
+ const fullPath = (0, node_path.resolve)(appRoot, modulePath);
1220
+ const workerPath = resolveSnifferFile("sniffer-envparser-worker");
1221
+ const ran = await runSniffer(run, workspacePath, appRoot, require_discover.nodeWithTsx(workerPath, [fullPath, exportName]));
1222
+ if ("error" in ran) return {
1223
+ envVars: [],
1224
+ optionalEnvVars: [],
1225
+ unhandledRejections: [],
1226
+ error: ran.error
1227
+ };
1228
+ const answer = snifferAnswer(ran.stdout);
1229
+ if (!answer) return {
1230
+ envVars: [],
1231
+ optionalEnvVars: [],
1232
+ unhandledRejections: [],
1233
+ error: /* @__PURE__ */ new Error(`Failed to sniff envParser (exit code ${ran.code}): ${ran.stderr || ran.stdout || "No output"}`)
1234
+ };
1235
+ for (const warning of answer.warnings ?? []) require_discover.output.warn(warning);
1236
+ return {
1237
+ envVars: answer.envVars ?? [],
1238
+ optionalEnvVars: answer.optionalEnvVars ?? [],
1239
+ unhandledRejections: (answer.unhandledRejections ?? []).map((message) => new Error(message)),
1240
+ ...answer.error ? { error: new Error(answer.error) } : {}
1241
+ };
1242
+ }
1243
+ /**
1244
+ * Sniff environment requirements for multiple apps.
1245
+ *
1246
+ * @param apps - Map of app name to app config
1247
+ * @param workspacePath - Absolute path to workspace root
1248
+ * @param options - Optional configuration for sniffing behavior
1249
+ * @returns Map of app name to sniffed environment
1250
+ */
1251
+ async function sniffAllApps(apps, workspacePath, options = {}) {
1252
+ const results = /* @__PURE__ */ new Map();
1253
+ for (const [appName, app] of Object.entries(apps)) {
1254
+ const sniffed = await sniffAppEnvironment(app, appName, workspacePath, options);
1255
+ results.set(appName, sniffed);
1256
+ }
1257
+ return results;
1258
+ }
1259
+ //#endregion
1260
+ Object.defineProperty(exports, "DEFAULT_DEPLOYMENT_TIMEOUT_MS", {
1261
+ enumerable: true,
1262
+ get: function() {
1263
+ return DEFAULT_DEPLOYMENT_TIMEOUT_MS;
1264
+ }
1265
+ });
1266
+ Object.defineProperty(exports, "DeploymentFailed", {
1267
+ enumerable: true,
1268
+ get: function() {
1269
+ return DeploymentFailed;
1270
+ }
1271
+ });
1272
+ Object.defineProperty(exports, "DeploymentTimedOut", {
1273
+ enumerable: true,
1274
+ get: function() {
1275
+ return DeploymentTimedOut;
1276
+ }
1277
+ });
1278
+ Object.defineProperty(exports, "DokployApi", {
1279
+ enumerable: true,
1280
+ get: function() {
1281
+ return DokployApi;
1282
+ }
1283
+ });
1284
+ Object.defineProperty(exports, "DokployApiError", {
1285
+ enumerable: true,
1286
+ get: function() {
1287
+ return DokployApiError;
1288
+ }
1289
+ });
1290
+ Object.defineProperty(exports, "dokploy_api_exports", {
1291
+ enumerable: true,
1292
+ get: function() {
1293
+ return dokploy_api_exports;
1294
+ }
1295
+ });
1296
+ Object.defineProperty(exports, "encryptSecrets", {
1297
+ enumerable: true,
1298
+ get: function() {
1299
+ return encryptSecrets;
1300
+ }
1301
+ });
1302
+ Object.defineProperty(exports, "encryption_exports", {
1303
+ enumerable: true,
1304
+ get: function() {
1305
+ return encryption_exports;
1306
+ }
1307
+ });
1308
+ Object.defineProperty(exports, "eventError", {
1309
+ enumerable: true,
1310
+ get: function() {
1311
+ return eventError;
1312
+ }
1313
+ });
1314
+ Object.defineProperty(exports, "keyFingerprint", {
1315
+ enumerable: true,
1316
+ get: function() {
1317
+ return keyFingerprint;
1318
+ }
1319
+ });
1320
+ Object.defineProperty(exports, "sniffAllApps", {
1321
+ enumerable: true,
1322
+ get: function() {
1323
+ return sniffAllApps;
1324
+ }
1325
+ });
1326
+ Object.defineProperty(exports, "sniffAppEnvironment", {
1327
+ enumerable: true,
1328
+ get: function() {
1329
+ return sniffAppEnvironment;
1330
+ }
1331
+ });
1332
+
1333
+ //# sourceMappingURL=sniffer-IAQEpsQb.cjs.map