@geekmidas/cli 10.0.0-alpha.11 → 10.0.0-alpha.111

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 (513) 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-BwbYTMtB.cjs +1090 -0
  7. package/dist/EndpointGenerator-BwbYTMtB.cjs.map +1 -0
  8. package/dist/EndpointGenerator-CvLX8bpx.mjs +1031 -0
  9. package/dist/EndpointGenerator-CvLX8bpx.mjs.map +1 -0
  10. package/dist/GoDaddyProvider-CPabc3XW.mjs +388 -0
  11. package/dist/GoDaddyProvider-CPabc3XW.mjs.map +1 -0
  12. package/dist/GoDaddyProvider-DWrDIXzQ.cjs +388 -0
  13. package/dist/GoDaddyProvider-DWrDIXzQ.cjs.map +1 -0
  14. package/dist/{HostingerProvider-BcyFRbqV.mjs → HostingerProvider-BNpS9aRJ.mjs} +29 -25
  15. package/dist/HostingerProvider-BNpS9aRJ.mjs.map +1 -0
  16. package/dist/{HostingerProvider-BOvsgATO.cjs → HostingerProvider-DR1iws1P.cjs} +29 -25
  17. package/dist/HostingerProvider-DR1iws1P.cjs.map +1 -0
  18. package/dist/LegacyStateStore-BdXoAlYY.mjs +124 -0
  19. package/dist/LegacyStateStore-BdXoAlYY.mjs.map +1 -0
  20. package/dist/LegacyStateStore-fsyPGBWu.cjs +124 -0
  21. package/dist/LegacyStateStore-fsyPGBWu.cjs.map +1 -0
  22. package/dist/LocalStateStore-AtviUBky.cjs +178 -0
  23. package/dist/LocalStateStore-AtviUBky.cjs.map +1 -0
  24. package/dist/LocalStateStore-BrAX5yy7.mjs +167 -0
  25. package/dist/LocalStateStore-BrAX5yy7.mjs.map +1 -0
  26. package/dist/OpenApiTsGenerator-BD6ZOQ51.cjs +541 -0
  27. package/dist/OpenApiTsGenerator-BD6ZOQ51.cjs.map +1 -0
  28. package/dist/OpenApiTsGenerator-DXXFXSbO.mjs +536 -0
  29. package/dist/OpenApiTsGenerator-DXXFXSbO.mjs.map +1 -0
  30. package/dist/{Route53Provider-CH9XH7bz.cjs → Route53Provider-Bllus2NR.cjs} +21 -22
  31. package/dist/Route53Provider-Bllus2NR.cjs.map +1 -0
  32. package/dist/{Route53Provider-C0xmer8U.mjs → Route53Provider-QXxjkZO1.mjs} +13 -13
  33. package/dist/Route53Provider-QXxjkZO1.mjs.map +1 -0
  34. package/dist/S3StateStore-Cx7njkBz.mjs +223 -0
  35. package/dist/S3StateStore-Cx7njkBz.mjs.map +1 -0
  36. package/dist/S3StateStore-tn5g80Sx.cjs +222 -0
  37. package/dist/S3StateStore-tn5g80Sx.cjs.map +1 -0
  38. package/dist/SSMStateStore-CAFde-Fq.cjs +204 -0
  39. package/dist/SSMStateStore-CAFde-Fq.cjs.map +1 -0
  40. package/dist/SSMStateStore-sqZ3oDmn.mjs +205 -0
  41. package/dist/SSMStateStore-sqZ3oDmn.mjs.map +1 -0
  42. package/dist/SubscriberGenerator-CeH7wbYt.cjs +571 -0
  43. package/dist/SubscriberGenerator-CeH7wbYt.cjs.map +1 -0
  44. package/dist/SubscriberGenerator-DHnIYwUU.mjs +518 -0
  45. package/dist/SubscriberGenerator-DHnIYwUU.mjs.map +1 -0
  46. package/dist/add-Cs8yT5iH.cjs +719 -0
  47. package/dist/add-Cs8yT5iH.cjs.map +1 -0
  48. package/dist/add-DJE7zqJ4.mjs +717 -0
  49. package/dist/add-DJE7zqJ4.mjs.map +1 -0
  50. package/dist/appPorts-BoXMwolc.mjs +249 -0
  51. package/dist/appPorts-BoXMwolc.mjs.map +1 -0
  52. package/dist/appPorts-IW-OZmRi.cjs +296 -0
  53. package/dist/appPorts-IW-OZmRi.cjs.map +1 -0
  54. package/dist/aws-8QQ8n-t6.mjs +89 -0
  55. package/dist/aws-8QQ8n-t6.mjs.map +1 -0
  56. package/dist/aws-DY9NqQIT.cjs +100 -0
  57. package/dist/aws-DY9NqQIT.cjs.map +1 -0
  58. package/dist/awsStore-Bx5nCFnS.mjs +121 -0
  59. package/dist/awsStore-Bx5nCFnS.mjs.map +1 -0
  60. package/dist/awsStore-u3ehhMoY.cjs +138 -0
  61. package/dist/awsStore-u3ehhMoY.cjs.map +1 -0
  62. package/dist/{backup-provisioner-DXXg6FIL.mjs → backup-provisioner-C8DnCmxK.mjs} +11 -8
  63. package/dist/backup-provisioner-C8DnCmxK.mjs.map +1 -0
  64. package/dist/{backup-provisioner-cE2PuCTb.cjs → backup-provisioner-oDEsPj02.cjs} +22 -20
  65. package/dist/backup-provisioner-oDEsPj02.cjs.map +1 -0
  66. package/dist/backups/runner.cjs +519 -0
  67. package/dist/backups/runner.cjs.map +1 -0
  68. package/dist/backups/runner.d.cts +102 -0
  69. package/dist/backups/runner.d.cts.map +1 -0
  70. package/dist/backups/runner.d.mts +102 -0
  71. package/dist/backups/runner.d.mts.map +1 -0
  72. package/dist/backups/runner.mjs +506 -0
  73. package/dist/backups/runner.mjs.map +1 -0
  74. package/dist/{bundler-S3ek7ea-.mjs → bundler-DrySVbXF.mjs} +36 -32
  75. package/dist/bundler-DrySVbXF.mjs.map +1 -0
  76. package/dist/{bundler-CaTGtiaO.cjs → bundler-NrtItVBp.cjs} +38 -35
  77. package/dist/bundler-NrtItVBp.cjs.map +1 -0
  78. package/dist/cli-Br5ApIgR.mjs +71 -0
  79. package/dist/cli-Br5ApIgR.mjs.map +1 -0
  80. package/dist/cli-CHzpFBh-.cjs +71 -0
  81. package/dist/cli-CHzpFBh-.cjs.map +1 -0
  82. package/dist/compose-ByIbIrzs.cjs +3345 -0
  83. package/dist/compose-ByIbIrzs.cjs.map +1 -0
  84. package/dist/compose-CDC2bCme.mjs +3202 -0
  85. package/dist/compose-CDC2bCme.mjs.map +1 -0
  86. package/dist/config-D48erO2j.d.mts +269 -0
  87. package/dist/config-D48erO2j.d.mts.map +1 -0
  88. package/dist/config-DHDtsQrB.d.cts +269 -0
  89. package/dist/config-DHDtsQrB.d.cts.map +1 -0
  90. package/dist/config.cjs +421 -11
  91. package/dist/config.cjs.map +1 -0
  92. package/dist/config.d.cts +4 -120
  93. package/dist/config.d.mts +4 -120
  94. package/dist/config.mjs +405 -4
  95. package/dist/config.mjs.map +1 -0
  96. package/dist/credentialSchemas-Cf5Pf8VE.mjs +237 -0
  97. package/dist/credentialSchemas-Cf5Pf8VE.mjs.map +1 -0
  98. package/dist/credentialSchemas-D_VUCDUh.cjs +272 -0
  99. package/dist/credentialSchemas-D_VUCDUh.cjs.map +1 -0
  100. package/dist/credentials-B5N5yKk6.mjs +267 -0
  101. package/dist/credentials-B5N5yKk6.mjs.map +1 -0
  102. package/dist/credentials-Zqr3QQYB.cjs +350 -0
  103. package/dist/credentials-Zqr3QQYB.cjs.map +1 -0
  104. package/dist/databases-BeGP5eDh.mjs +495 -0
  105. package/dist/databases-BeGP5eDh.mjs.map +1 -0
  106. package/dist/databases-DGALFDG3.cjs +598 -0
  107. package/dist/databases-DGALFDG3.cjs.map +1 -0
  108. package/dist/define-6poNqm5O.mjs +106 -0
  109. package/dist/define-6poNqm5O.mjs.map +1 -0
  110. package/dist/define-crmMcXFS.cjs +153 -0
  111. package/dist/define-crmMcXFS.cjs.map +1 -0
  112. package/dist/deploy/public.cjs +212 -0
  113. package/dist/deploy/public.cjs.map +1 -0
  114. package/dist/deploy/public.d.cts +653 -0
  115. package/dist/deploy/public.d.cts.map +1 -0
  116. package/dist/deploy/public.d.mts +653 -0
  117. package/dist/deploy/public.d.mts.map +1 -0
  118. package/dist/deploy/public.mjs +145 -0
  119. package/dist/deploy/public.mjs.map +1 -0
  120. package/dist/deploy/sniffer-envkit-patch.cjs +18 -10
  121. package/dist/deploy/sniffer-envkit-patch.cjs.map +1 -1
  122. package/dist/deploy/sniffer-envkit-patch.d.cts +0 -2
  123. package/dist/deploy/sniffer-envkit-patch.d.cts.map +1 -1
  124. package/dist/deploy/sniffer-envkit-patch.d.mts +0 -2
  125. package/dist/deploy/sniffer-envkit-patch.d.mts.map +1 -1
  126. package/dist/deploy/sniffer-envkit-patch.mjs +10 -2
  127. package/dist/deploy/sniffer-envkit-patch.mjs.map +1 -1
  128. package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
  129. package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
  130. package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
  131. package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
  132. package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
  133. package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
  134. package/dist/deploy/sniffer-hooks.cjs +13 -7
  135. package/dist/deploy/sniffer-hooks.cjs.map +1 -1
  136. package/dist/deploy/sniffer-hooks.d.cts +1 -2
  137. package/dist/deploy/sniffer-hooks.d.cts.map +1 -1
  138. package/dist/deploy/sniffer-hooks.d.mts +1 -2
  139. package/dist/deploy/sniffer-hooks.d.mts.map +1 -1
  140. package/dist/deploy/sniffer-hooks.mjs +10 -3
  141. package/dist/deploy/sniffer-hooks.mjs.map +1 -1
  142. package/dist/deploy/sniffer-loader.cjs +16 -7
  143. package/dist/deploy/sniffer-loader.cjs.map +1 -1
  144. package/dist/deploy/sniffer-loader.d.cts +1 -1
  145. package/dist/deploy/sniffer-loader.d.mts +1 -1
  146. package/dist/deploy/sniffer-loader.mjs +14 -3
  147. package/dist/deploy/sniffer-loader.mjs.map +1 -1
  148. package/dist/deploy/sniffer-routes-worker.cjs +11 -11
  149. package/dist/deploy/sniffer-routes-worker.cjs.map +1 -1
  150. package/dist/deploy/sniffer-routes-worker.d.cts +1 -1
  151. package/dist/deploy/sniffer-routes-worker.d.mts +1 -1
  152. package/dist/deploy/sniffer-routes-worker.mjs +4 -4
  153. package/dist/deploy/sniffer-routes-worker.mjs.map +1 -1
  154. package/dist/deploy/sniffer-worker.cjs +15 -6
  155. package/dist/deploy/sniffer-worker.cjs.map +1 -1
  156. package/dist/deploy/sniffer-worker.d.cts +1 -3
  157. package/dist/deploy/sniffer-worker.d.cts.map +1 -1
  158. package/dist/deploy/sniffer-worker.d.mts +1 -3
  159. package/dist/deploy/sniffer-worker.d.mts.map +1 -1
  160. package/dist/deploy/sniffer-worker.mjs +15 -4
  161. package/dist/deploy/sniffer-worker.mjs.map +1 -1
  162. package/dist/deploy-DLq9-m6H.mjs +2317 -0
  163. package/dist/deploy-DLq9-m6H.mjs.map +1 -0
  164. package/dist/deploy-Dl_NavYE.cjs +2390 -0
  165. package/dist/deploy-Dl_NavYE.cjs.map +1 -0
  166. package/dist/derive-B4vDpzgP.mjs +150 -0
  167. package/dist/derive-B4vDpzgP.mjs.map +1 -0
  168. package/dist/derive-DAbo49sm.cjs +161 -0
  169. package/dist/derive-DAbo49sm.cjs.map +1 -0
  170. package/dist/discover-Bsr7HjqJ.cjs +616 -0
  171. package/dist/discover-Bsr7HjqJ.cjs.map +1 -0
  172. package/dist/discover-Ca8U75dl.mjs +537 -0
  173. package/dist/discover-Ca8U75dl.mjs.map +1 -0
  174. package/dist/discover-CvTtV5ZD.d.cts +108 -0
  175. package/dist/discover-CvTtV5ZD.d.cts.map +1 -0
  176. package/dist/discover-W2kab9Lc.d.mts +108 -0
  177. package/dist/discover-W2kab9Lc.d.mts.map +1 -0
  178. package/dist/dns-C2TGXUF4.cjs +1057 -0
  179. package/dist/dns-C2TGXUF4.cjs.map +1 -0
  180. package/dist/dns-pzftumxg.mjs +926 -0
  181. package/dist/dns-pzftumxg.mjs.map +1 -0
  182. package/dist/dokploy-B7-OwY2s.mjs +38 -0
  183. package/dist/dokploy-B7-OwY2s.mjs.map +1 -0
  184. package/dist/dokploy-OqBh8G4g.cjs +38 -0
  185. package/dist/dokploy-OqBh8G4g.cjs.map +1 -0
  186. package/dist/drivers-D11JHxrD.mjs +177 -0
  187. package/dist/drivers-D11JHxrD.mjs.map +1 -0
  188. package/dist/drivers-GKaA6ITM.cjs +200 -0
  189. package/dist/drivers-GKaA6ITM.cjs.map +1 -0
  190. package/dist/eas-6ezdJtry.mjs +316 -0
  191. package/dist/eas-6ezdJtry.mjs.map +1 -0
  192. package/dist/eas-BkLA60P2.cjs +319 -0
  193. package/dist/eas-BkLA60P2.cjs.map +1 -0
  194. package/dist/{emit-CIlvnDvV.mjs → emit-C1e8qD08.mjs} +13 -26
  195. package/dist/emit-C1e8qD08.mjs.map +1 -0
  196. package/dist/{emit-CUD1BWls.cjs → emit-Dmc1nvdS.cjs} +31 -57
  197. package/dist/emit-Dmc1nvdS.cjs.map +1 -0
  198. package/dist/encryption-DJv_jEXi.mjs +89 -0
  199. package/dist/encryption-DJv_jEXi.mjs.map +1 -0
  200. package/dist/encryption-DoVnVU82.cjs +90 -0
  201. package/dist/encryption-DoVnVU82.cjs.map +1 -0
  202. package/dist/engine-CJhQb50j.cjs +3196 -0
  203. package/dist/engine-CJhQb50j.cjs.map +1 -0
  204. package/dist/engine-Db71-OZL.mjs +3083 -0
  205. package/dist/engine-Db71-OZL.mjs.map +1 -0
  206. package/dist/errors-D8Gwp5kU.mjs +23 -0
  207. package/dist/errors-D8Gwp5kU.mjs.map +1 -0
  208. package/dist/errors-DMC4Umsb.cjs +34 -0
  209. package/dist/errors-DMC4Umsb.cjs.map +1 -0
  210. package/dist/github-D2eABlxM.mjs +829 -0
  211. package/dist/github-D2eABlxM.mjs.map +1 -0
  212. package/dist/github-DDOHjdS9.cjs +829 -0
  213. package/dist/github-DDOHjdS9.cjs.map +1 -0
  214. package/dist/googlePlay-DNgybe5t.cjs +931 -0
  215. package/dist/googlePlay-DNgybe5t.cjs.map +1 -0
  216. package/dist/googlePlay-DY9vZQ1p.mjs +931 -0
  217. package/dist/googlePlay-DY9vZQ1p.mjs.map +1 -0
  218. package/dist/identity-CBXr4wNi.mjs +129 -0
  219. package/dist/identity-CBXr4wNi.mjs.map +1 -0
  220. package/dist/identity-CbLfgQNT.cjs +182 -0
  221. package/dist/identity-CbLfgQNT.cjs.map +1 -0
  222. package/dist/{index-Ayxg_DQY.d.mts → index-8OfpOtSI.d.cts} +39 -24
  223. package/dist/index-8OfpOtSI.d.cts.map +1 -0
  224. package/dist/{index-CR5urhWX.d.cts → index-Dpji6Bxq.d.mts} +39 -24
  225. package/dist/index-Dpji6Bxq.d.mts.map +1 -0
  226. package/dist/index.cjs +13571 -12366
  227. package/dist/index.cjs.map +1 -1
  228. package/dist/index.d.cts +1 -1
  229. package/dist/index.d.mts +1 -1
  230. package/dist/index.mjs +14106 -12914
  231. package/dist/index.mjs.map +1 -1
  232. package/dist/local-BwC2v2Y8.mjs +224 -0
  233. package/dist/local-BwC2v2Y8.mjs.map +1 -0
  234. package/dist/local-DNhnkugT.cjs +241 -0
  235. package/dist/local-DNhnkugT.cjs.map +1 -0
  236. package/dist/migrate-B9GswIAr.mjs +266 -0
  237. package/dist/migrate-B9GswIAr.mjs.map +1 -0
  238. package/dist/migrate-CQUGbptv.mjs +181 -0
  239. package/dist/migrate-CQUGbptv.mjs.map +1 -0
  240. package/dist/migrate-GLBZlrlJ.cjs +181 -0
  241. package/dist/migrate-GLBZlrlJ.cjs.map +1 -0
  242. package/dist/migrate-bDQzFvBN.cjs +271 -0
  243. package/dist/migrate-bDQzFvBN.cjs.map +1 -0
  244. package/dist/openapi.cjs +214 -10
  245. package/dist/openapi.cjs.map +1 -0
  246. package/dist/openapi.d.cts +38 -17
  247. package/dist/openapi.d.cts.map +1 -1
  248. package/dist/openapi.d.mts +38 -17
  249. package/dist/openapi.d.mts.map +1 -1
  250. package/dist/openapi.mjs +208 -5
  251. package/dist/openapi.mjs.map +1 -0
  252. package/dist/projectBucket-BBbQ1lHF.cjs +263 -0
  253. package/dist/projectBucket-BBbQ1lHF.cjs.map +1 -0
  254. package/dist/projectBucket-C_DN4WzF.mjs +222 -0
  255. package/dist/projectBucket-C_DN4WzF.mjs.map +1 -0
  256. package/dist/provider-BqpjG9QM.cjs +57 -0
  257. package/dist/provider-BqpjG9QM.cjs.map +1 -0
  258. package/dist/provider-CEOKk8NS.mjs +46 -0
  259. package/dist/provider-CEOKk8NS.mjs.map +1 -0
  260. package/dist/publish-B-EIjfQ0.mjs +123 -0
  261. package/dist/publish-B-EIjfQ0.mjs.map +1 -0
  262. package/dist/publish-CPgSbtcs.cjs +124 -0
  263. package/dist/publish-CPgSbtcs.cjs.map +1 -0
  264. package/dist/ready-BMFjxBYA.cjs +404 -0
  265. package/dist/ready-BMFjxBYA.cjs.map +1 -0
  266. package/dist/ready-CIt5SOtg.mjs +375 -0
  267. package/dist/ready-CIt5SOtg.mjs.map +1 -0
  268. package/dist/reconcile/public.cjs +3 -5
  269. package/dist/reconcile/public.d.cts +11 -87
  270. package/dist/reconcile/public.d.cts.map +1 -1
  271. package/dist/reconcile/public.d.mts +11 -87
  272. package/dist/reconcile/public.d.mts.map +1 -1
  273. package/dist/reconcile/public.mjs +3 -4
  274. package/dist/{reconcile-C13ERt1U.mjs → reconcile--I7V4Klj.mjs} +4 -7
  275. package/dist/reconcile--I7V4Klj.mjs.map +1 -0
  276. package/dist/{reconcile-CYMhFSYy.cjs → reconcile-CuCQBa5-.cjs} +5 -8
  277. package/dist/reconcile-CuCQBa5-.cjs.map +1 -0
  278. package/dist/resolve-CxDqDmCD.mjs +263 -0
  279. package/dist/resolve-CxDqDmCD.mjs.map +1 -0
  280. package/dist/resolve-wG49Woex.cjs +316 -0
  281. package/dist/resolve-wG49Woex.cjs.map +1 -0
  282. package/dist/rollback-BQgEdr_p.mjs +136 -0
  283. package/dist/rollback-BQgEdr_p.mjs.map +1 -0
  284. package/dist/rollback-Cw-Z0mWn.cjs +165 -0
  285. package/dist/rollback-Cw-Z0mWn.cjs.map +1 -0
  286. package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
  287. package/dist/{chunk-CUT6urMc.cjs → rolldown-runtime-C0BPl7ul.cjs} +23 -10
  288. package/dist/run-BJLIerMM.mjs +133 -0
  289. package/dist/run-BJLIerMM.mjs.map +1 -0
  290. package/dist/run-fVZ-rLnc.cjs +174 -0
  291. package/dist/run-fVZ-rLnc.cjs.map +1 -0
  292. package/dist/runtime-ACdfK59n.d.cts +82 -0
  293. package/dist/runtime-ACdfK59n.d.cts.map +1 -0
  294. package/dist/runtime-YyQuekxi.d.mts +82 -0
  295. package/dist/runtime-YyQuekxi.d.mts.map +1 -0
  296. package/dist/s3-CrPoA89T.cjs +215 -0
  297. package/dist/s3-CrPoA89T.cjs.map +1 -0
  298. package/dist/s3-DQXZdmCM.mjs +215 -0
  299. package/dist/s3-DQXZdmCM.mjs.map +1 -0
  300. package/dist/sandbox/config-worker.cjs +43 -0
  301. package/dist/sandbox/config-worker.cjs.map +1 -0
  302. package/dist/sandbox/config-worker.d.cts +1 -0
  303. package/dist/sandbox/config-worker.d.mts +1 -0
  304. package/dist/sandbox/config-worker.mjs +44 -0
  305. package/dist/sandbox/config-worker.mjs.map +1 -0
  306. package/dist/sandbox/credentials-worker.cjs +54 -0
  307. package/dist/sandbox/credentials-worker.cjs.map +1 -0
  308. package/dist/sandbox/credentials-worker.d.cts +1 -0
  309. package/dist/sandbox/credentials-worker.d.mts +1 -0
  310. package/dist/sandbox/credentials-worker.mjs +55 -0
  311. package/dist/sandbox/credentials-worker.mjs.map +1 -0
  312. package/dist/sandbox/discover-worker.cjs +47 -0
  313. package/dist/sandbox/discover-worker.cjs.map +1 -0
  314. package/dist/sandbox/discover-worker.d.cts +1 -0
  315. package/dist/sandbox/discover-worker.d.mts +1 -0
  316. package/dist/sandbox/discover-worker.mjs +48 -0
  317. package/dist/sandbox/discover-worker.mjs.map +1 -0
  318. package/dist/sandbox/migrate-worker.cjs +75 -0
  319. package/dist/sandbox/migrate-worker.cjs.map +1 -0
  320. package/dist/sandbox/migrate-worker.d.cts +1 -0
  321. package/dist/sandbox/migrate-worker.d.mts +1 -0
  322. package/dist/sandbox/migrate-worker.mjs +76 -0
  323. package/dist/sandbox/migrate-worker.mjs.map +1 -0
  324. package/dist/sandbox-C4g1eG31.d.mts +104 -0
  325. package/dist/sandbox-C4g1eG31.d.mts.map +1 -0
  326. package/dist/sandbox-CHv3OYXg.cjs +165 -0
  327. package/dist/sandbox-CHv3OYXg.cjs.map +1 -0
  328. package/dist/sandbox-CbVB7uOD.mjs +118 -0
  329. package/dist/sandbox-CbVB7uOD.mjs.map +1 -0
  330. package/dist/sandbox-CdKgQ3XU.d.cts +104 -0
  331. package/dist/sandbox-CdKgQ3XU.d.cts.map +1 -0
  332. package/dist/{workspace-C-a3G_U0.cjs → schemas-BCwKKA42.mjs} +958 -1868
  333. package/dist/schemas-BCwKKA42.mjs.map +1 -0
  334. package/dist/{workspace-DaEX7FEg.mjs → schemas-BQ_v0lEX.cjs} +1048 -1678
  335. package/dist/schemas-BQ_v0lEX.cjs.map +1 -0
  336. package/dist/secretsManager-CQORubp9.mjs +97 -0
  337. package/dist/secretsManager-CQORubp9.mjs.map +1 -0
  338. package/dist/secretsManager-RAGcEDX1.cjs +108 -0
  339. package/dist/secretsManager-RAGcEDX1.cjs.map +1 -0
  340. package/dist/seeds-CIk0l4SC.mjs +8197 -0
  341. package/dist/seeds-CIk0l4SC.mjs.map +1 -0
  342. package/dist/seeds-Dk8YkLkM.cjs +9176 -0
  343. package/dist/seeds-Dk8YkLkM.cjs.map +1 -0
  344. package/dist/sniffer-2aK7cB2u.cjs +1998 -0
  345. package/dist/sniffer-2aK7cB2u.cjs.map +1 -0
  346. package/dist/sniffer-CABMO-Bh.mjs +1825 -0
  347. package/dist/sniffer-CABMO-Bh.mjs.map +1 -0
  348. package/dist/sst-B-Uz4cvm.cjs +464 -0
  349. package/dist/sst-B-Uz4cvm.cjs.map +1 -0
  350. package/dist/sst-C1pxbFEd.mjs +441 -0
  351. package/dist/sst-C1pxbFEd.mjs.map +1 -0
  352. package/dist/stage-DjxR_7C0.mjs +302 -0
  353. package/dist/stage-DjxR_7C0.mjs.map +1 -0
  354. package/dist/stage-DrCS0vKD.cjs +313 -0
  355. package/dist/stage-DrCS0vKD.cjs.map +1 -0
  356. package/dist/stages-DJrOYLZ-.mjs +176 -0
  357. package/dist/stages-DJrOYLZ-.mjs.map +1 -0
  358. package/dist/stages-_3RVNG83.cjs +176 -0
  359. package/dist/stages-_3RVNG83.cjs.map +1 -0
  360. package/dist/target/public.cjs +15 -0
  361. package/dist/target/public.d.cts +28 -0
  362. package/dist/target/public.d.cts.map +1 -0
  363. package/dist/target/public.d.mts +28 -0
  364. package/dist/target/public.d.mts.map +1 -0
  365. package/dist/target/public.mjs +4 -0
  366. package/dist/terminal-D_NRPW4W.cjs +85 -0
  367. package/dist/terminal-D_NRPW4W.cjs.map +1 -0
  368. package/dist/terminal-mXM-Lqc6.mjs +85 -0
  369. package/dist/terminal-mXM-Lqc6.mjs.map +1 -0
  370. package/dist/types-B6UXlEkf.d.cts +7650 -0
  371. package/dist/types-B6UXlEkf.d.cts.map +1 -0
  372. package/dist/types-HqVPddRK.d.mts +7649 -0
  373. package/dist/types-HqVPddRK.d.mts.map +1 -0
  374. package/dist/utils-D2Nk1Nv2.cjs +205 -0
  375. package/dist/utils-D2Nk1Nv2.cjs.map +1 -0
  376. package/dist/utils-D_fxUqvU.mjs +156 -0
  377. package/dist/utils-D_fxUqvU.mjs.map +1 -0
  378. package/dist/vitest.cjs +65 -0
  379. package/dist/vitest.cjs.map +1 -0
  380. package/dist/vitest.d.cts +29 -0
  381. package/dist/vitest.d.cts.map +1 -0
  382. package/dist/vitest.d.mts +29 -0
  383. package/dist/vitest.d.mts.map +1 -0
  384. package/dist/vitest.mjs +65 -0
  385. package/dist/vitest.mjs.map +1 -0
  386. package/dist/workerRuntime-BXfhbe13.cjs +108 -0
  387. package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
  388. package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
  389. package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
  390. package/dist/workspace/index.cjs +8 -4
  391. package/dist/workspace/index.d.cts +3 -3
  392. package/dist/workspace/index.d.mts +3 -3
  393. package/dist/workspace/index.mjs +2 -3
  394. package/dist/workspace-BwqQnool.cjs +2806 -0
  395. package/dist/workspace-BwqQnool.cjs.map +1 -0
  396. package/dist/workspace-D1QbNd55.mjs +2394 -0
  397. package/dist/workspace-D1QbNd55.mjs.map +1 -0
  398. package/package.json +54 -22
  399. package/dist/CachedStateProvider-BEBl2wQT.cjs +0 -60
  400. package/dist/CachedStateProvider-BEBl2wQT.cjs.map +0 -1
  401. package/dist/CachedStateProvider-C-8wtlto.mjs +0 -3
  402. package/dist/CachedStateProvider-Co4n5Wvs.mjs +0 -54
  403. package/dist/CachedStateProvider-Co4n5Wvs.mjs.map +0 -1
  404. package/dist/CachedStateProvider-DqhGpzsm.cjs +0 -3
  405. package/dist/HostingerProvider-BOvsgATO.cjs.map +0 -1
  406. package/dist/HostingerProvider-BcyFRbqV.mjs.map +0 -1
  407. package/dist/LocalStateProvider-Bq-0C0sg.mjs +0 -42
  408. package/dist/LocalStateProvider-Bq-0C0sg.mjs.map +0 -1
  409. package/dist/LocalStateProvider-yjXZXZDM.cjs +0 -43
  410. package/dist/LocalStateProvider-yjXZXZDM.cjs.map +0 -1
  411. package/dist/Route53Provider-C0xmer8U.mjs.map +0 -1
  412. package/dist/Route53Provider-CH9XH7bz.cjs.map +0 -1
  413. package/dist/SSMStateProvider-CXtNgPfy.cjs +0 -66
  414. package/dist/SSMStateProvider-CXtNgPfy.cjs.map +0 -1
  415. package/dist/SSMStateProvider-DOZifZfE.mjs +0 -66
  416. package/dist/SSMStateProvider-DOZifZfE.mjs.map +0 -1
  417. package/dist/backup-provisioner-DXXg6FIL.mjs.map +0 -1
  418. package/dist/backup-provisioner-cE2PuCTb.cjs.map +0 -1
  419. package/dist/bundler-CaTGtiaO.cjs.map +0 -1
  420. package/dist/bundler-S3ek7ea-.mjs.map +0 -1
  421. package/dist/chunk-Duj1WY3L.mjs +0 -7
  422. package/dist/config-B0L2tvvC.mjs +0 -402
  423. package/dist/config-B0L2tvvC.mjs.map +0 -1
  424. package/dist/config-HhDpJmLO.cjs +0 -462
  425. package/dist/config-HhDpJmLO.cjs.map +0 -1
  426. package/dist/config.d.cts.map +0 -1
  427. package/dist/config.d.mts.map +0 -1
  428. package/dist/credentials-B2Pyh3bJ.cjs +0 -2681
  429. package/dist/credentials-B2Pyh3bJ.cjs.map +0 -1
  430. package/dist/credentials-B5zRHdAl.mjs +0 -141
  431. package/dist/credentials-B5zRHdAl.mjs.map +0 -1
  432. package/dist/credentials-BapzjyV5.cjs +0 -195
  433. package/dist/credentials-BapzjyV5.cjs.map +0 -1
  434. package/dist/credentials-CZrys9C5.mjs +0 -2549
  435. package/dist/credentials-CZrys9C5.mjs.map +0 -1
  436. package/dist/discover-CAlFgYec.mjs +0 -229
  437. package/dist/discover-CAlFgYec.mjs.map +0 -1
  438. package/dist/discover-DTmFeloL.cjs +0 -271
  439. package/dist/discover-DTmFeloL.cjs.map +0 -1
  440. package/dist/dokploy-api-5cK2InBm.cjs +0 -3
  441. package/dist/dokploy-api-D2Ny4Jrc.mjs +0 -3
  442. package/dist/dokploy-api-pdaBryoY.mjs +0 -706
  443. package/dist/dokploy-api-pdaBryoY.mjs.map +0 -1
  444. package/dist/dokploy-api-zqKe9lHH.cjs +0 -718
  445. package/dist/dokploy-api-zqKe9lHH.cjs.map +0 -1
  446. package/dist/emit-CIlvnDvV.mjs.map +0 -1
  447. package/dist/emit-CUD1BWls.cjs.map +0 -1
  448. package/dist/encryption-D2pL3tHH.cjs +0 -54
  449. package/dist/encryption-D2pL3tHH.cjs.map +0 -1
  450. package/dist/encryption-YDsXXi6w.mjs +0 -3
  451. package/dist/encryption-_4zwjOAR.mjs +0 -42
  452. package/dist/encryption-_4zwjOAR.mjs.map +0 -1
  453. package/dist/encryption-sQ2Oxx0d.cjs +0 -4
  454. package/dist/fullstack-secrets-D6MyHhQP.cjs +0 -111
  455. package/dist/fullstack-secrets-D6MyHhQP.cjs.map +0 -1
  456. package/dist/fullstack-secrets-METaRLS1.mjs +0 -87
  457. package/dist/fullstack-secrets-METaRLS1.mjs.map +0 -1
  458. package/dist/generator-CNzBw7g5.cjs +0 -289
  459. package/dist/generator-CNzBw7g5.cjs.map +0 -1
  460. package/dist/generator-VE2JrFlY.mjs +0 -253
  461. package/dist/generator-VE2JrFlY.mjs.map +0 -1
  462. package/dist/github-BrvaPkFf.cjs +0 -197
  463. package/dist/github-BrvaPkFf.cjs.map +0 -1
  464. package/dist/github-CrpsXSfV.mjs +0 -196
  465. package/dist/github-CrpsXSfV.mjs.map +0 -1
  466. package/dist/index-Ayxg_DQY.d.mts.map +0 -1
  467. package/dist/index-CR5urhWX.d.cts.map +0 -1
  468. package/dist/keystore-C9rint2E.cjs +0 -101
  469. package/dist/keystore-C9rint2E.cjs.map +0 -1
  470. package/dist/keystore-TxeYM7an.mjs +0 -83
  471. package/dist/keystore-TxeYM7an.mjs.map +0 -1
  472. package/dist/openapi-DaKlTKxz.cjs +0 -2075
  473. package/dist/openapi-DaKlTKxz.cjs.map +0 -1
  474. package/dist/openapi-react-query-BKH334Ug.cjs +0 -173
  475. package/dist/openapi-react-query-BKH334Ug.cjs.map +0 -1
  476. package/dist/openapi-react-query-DoR5CmzQ.mjs +0 -167
  477. package/dist/openapi-react-query-DoR5CmzQ.mjs.map +0 -1
  478. package/dist/openapi-react-query.cjs +0 -4
  479. package/dist/openapi-react-query.d.cts +0 -11
  480. package/dist/openapi-react-query.d.cts.map +0 -1
  481. package/dist/openapi-react-query.d.mts +0 -11
  482. package/dist/openapi-react-query.d.mts.map +0 -1
  483. package/dist/openapi-react-query.mjs +0 -4
  484. package/dist/openapi-y1d7Kalt.mjs +0 -2021
  485. package/dist/openapi-y1d7Kalt.mjs.map +0 -1
  486. package/dist/reconcile-C13ERt1U.mjs.map +0 -1
  487. package/dist/reconcile-CYMhFSYy.cjs.map +0 -1
  488. package/dist/setup-BWgMs4gg.mjs +0 -12
  489. package/dist/setup-DOv92pIu.cjs +0 -473
  490. package/dist/setup-DOv92pIu.cjs.map +0 -1
  491. package/dist/setup-DQo_h_yK.mjs +0 -443
  492. package/dist/setup-DQo_h_yK.mjs.map +0 -1
  493. package/dist/setup-lCx_DcUo.cjs +0 -12
  494. package/dist/storage-B020InPW.mjs +0 -222
  495. package/dist/storage-B020InPW.mjs.map +0 -1
  496. package/dist/storage-CSNplaJn.cjs +0 -282
  497. package/dist/storage-CSNplaJn.cjs.map +0 -1
  498. package/dist/storage-DGBzMLZa.mjs +0 -4
  499. package/dist/storage-DlVol_oj.cjs +0 -8
  500. package/dist/sync-0ILCb-1S.cjs +0 -93
  501. package/dist/sync-0ILCb-1S.cjs.map +0 -1
  502. package/dist/sync-CzHXiR9c.mjs +0 -76
  503. package/dist/sync-CzHXiR9c.mjs.map +0 -1
  504. package/dist/sync-DYENfOt4.cjs +0 -4
  505. package/dist/sync-HAau6h_R.mjs +0 -3
  506. package/dist/types-CL7jPFM2.d.mts +0 -2220
  507. package/dist/types-CL7jPFM2.d.mts.map +0 -1
  508. package/dist/types-Y3fKQSAK.d.cts +0 -2220
  509. package/dist/types-Y3fKQSAK.d.cts.map +0 -1
  510. package/dist/workspace-C-a3G_U0.cjs.map +0 -1
  511. package/dist/workspace-DQxxs7Jk.cjs +0 -10
  512. package/dist/workspace-DaEX7FEg.mjs.map +0 -1
  513. package/dist/workspace-DbI580qS.mjs +0 -9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discover-Bsr7HjqJ.cjs","names":["AsyncLocalStorage","format","fg","kebabCase","relative","dirname","fileURLToPath","join","existsSync","pathToFileURL","dirname","fileURLToPath","join","existsSync","pathToFileURL","createRequire","oncePerRun","WORKER_RESULT_MARKER","activeSandbox","fg","canonicalId","relative","Cron","Queue","Subscriber","GkmError"],"sources":["../src/output.ts","../src/generators/Generator.ts","../src/owningTsconfigJsx.ts","../src/sandbox/worker.ts","../src/reconcile/discover.ts"],"sourcesContent":["/**\n * Where the CLI's progress lines go.\n *\n * Commands write their progress through `output` rather than `console`. Run\n * from the terminal that is the same thing. Run inside `deploy()`, each line\n * goes to the run that wrote it instead — as an event its caller can iterate,\n * and to the logger it was handed — so a deploy embedded in another program\n * does not print over that program's own output.\n *\n * Carried by `AsyncLocalStorage` rather than passed down, because the lines\n * come from everywhere a deploy reaches — the Dockerfile generator, the env\n * sniffer, construct discovery — and two deploys running in one process must\n * not hear each other.\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport { format } from 'node:util';\n\n/** How loud a line is. */\nexport type OutputLevel = 'info' | 'warn' | 'error';\n\n/** Receives each line written while it is the current sink. */\nexport type OutputSink = (level: OutputLevel, message: string) => void;\n\nconst current = new AsyncLocalStorage<OutputSink>();\n\n/** Runs `fn` with every line written through `output` sent to `sink`. */\nexport function withOutput<T>(sink: OutputSink, fn: () => T): T {\n\treturn current.run(sink, fn);\n}\n\nfunction write(\n\tlevel: OutputLevel,\n\tfallback: (...args: unknown[]) => void,\n): (...args: unknown[]) => void {\n\treturn (...args) => {\n\t\tconst sink = current.getStore();\n\t\tif (sink) sink(level, format(...args));\n\t\telse fallback(...args);\n\t};\n}\n\n/**\n * `console`, for the methods the CLI logs through — routed to the current\n * run's sink when there is one.\n */\nexport const output = {\n\tlog: write('info', (...args) => console.log(...args)),\n\tinfo: write('info', (...args) => console.info(...args)),\n\twarn: write('warn', (...args) => console.warn(...args)),\n\terror: write('error', (...args) => console.error(...args)),\n};\n","import { relative } from 'node:path';\nimport type { Construct } from '@geekmidas/constructs';\nimport fg from 'fast-glob';\nimport kebabCase from 'lodash.kebabcase';\nimport type { BuildContext } from '../build/types';\nimport type { MainProvider, Routes } from '../types';\n\n/**\n * Zod v4 maintains a process-wide registry of schemas registered via\n * `.meta({ id })`. When we cache-bust user module imports (by appending a\n * `?t=timestamp` query), those modules re-execute and try to register the\n * same ids again, which throws `ID X already exists in the registry`.\n *\n * Clearing the registry in the CLI process is safe: the user's running\n * server lives in a subprocess and has its own isolated registry.\n *\n * Exported for tests.\n */\nexport function clearZodGlobalRegistry(): void {\n\tconst registry = (\n\t\tglobalThis as { __zod_globalRegistry?: { clear?: () => void } }\n\t).__zod_globalRegistry;\n\tif (registry && typeof registry.clear === 'function') {\n\t\tregistry.clear();\n\t}\n}\n\nexport interface GeneratorOptions {\n\t/** Where the build deploys: one Lambda per construct, or one process. */\n\ttarget?: MainProvider;\n\t/**\n\t * What a handler path in the manifest is relative to — the workspace root,\n\t * which is where `sst.config.ts` runs and resolves it from.\n\t */\n\troot?: string;\n\t[key: string]: any;\n}\n\nexport abstract class ConstructGenerator<T extends Construct, R = void> {\n\tabstract isConstruct(value: any): value is T;\n\n\tstatic async build<T extends Construct, R = void>(\n\t\tcontext: BuildContext,\n\t\toutputDir: string,\n\t\tgenerator: ConstructGenerator<T, R>,\n\t\tpatterns?: Routes,\n\t\toptions?: GeneratorOptions,\n\t): Promise<R> {\n\t\tconst constructs = await generator.load(patterns);\n\t\treturn generator.build(context, constructs, outputDir, options);\n\t}\n\n\tabstract build(\n\t\tcontext: BuildContext,\n\t\tconstructs: GeneratedConstruct<T>[],\n\t\toutputDir: string,\n\t\toptions?: GeneratorOptions,\n\t): Promise<R>;\n\n\tasync load(\n\t\tpatterns?: Routes,\n\t\tcwd = process.cwd(),\n\t\tbustCache = false,\n\t): Promise<GeneratedConstruct<T>[]> {\n\t\tconst logger = console;\n\n\t\tconst globPatterns = Array.isArray(patterns)\n\t\t\t? patterns\n\t\t\t: patterns\n\t\t\t\t? [patterns]\n\t\t\t\t: [];\n\n\t\t// Find all files\n\t\tconst files = fg.stream(globPatterns, {\n\t\t\tcwd,\n\t\t\tabsolute: true,\n\t\t});\n\n\t\t// Cache-busted re-imports re-execute user modules, which would try to\n\t\t// re-register Zod schemas with the same `.meta({ id })`. Clear the\n\t\t// global registry once per load to prevent duplicate-id errors.\n\t\tif (bustCache) {\n\t\t\tclearZodGlobalRegistry();\n\t\t}\n\n\t\t// Load constructs\n\t\tconst constructs: GeneratedConstruct<T>[] = [];\n\n\t\tfor await (const f of files) {\n\t\t\ttry {\n\t\t\t\tconst file = f.toString();\n\t\t\t\t// Append cache-busting query param to force re-import of changed modules\n\t\t\t\tconst importPath = bustCache ? `${file}?t=${Date.now()}` : file;\n\t\t\t\tconst module = await import(importPath);\n\n\t\t\t\t// Check all exports for constructs\n\t\t\t\tfor (const [key, construct] of Object.entries(module)) {\n\t\t\t\t\tif (this.isConstruct(construct)) {\n\t\t\t\t\t\tconstructs.push({\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tname: kebabCase(key),\n\t\t\t\t\t\t\tconstruct,\n\t\t\t\t\t\t\tpath: {\n\t\t\t\t\t\t\t\tabsolute: file,\n\t\t\t\t\t\t\t\trelative: relative(process.cwd(), file),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tconst err = error as Error;\n\t\t\t\tlogger.error(`Failed to load ${f}: ${err.message}`);\n\t\t\t\tif (err.stack) {\n\t\t\t\t\tlogger.error(err.stack);\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\n\t\treturn constructs;\n\t}\n}\n\nexport interface GeneratedConstruct<T extends Construct> {\n\tkey: string;\n\tname: string;\n\tconstruct: T;\n\tpath: {\n\t\tabsolute: string;\n\t\trelative: string;\n\t};\n}\n","import { existsSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\n\nconst REGISTER = 'owning-tsconfig-jsx-register.mjs';\n\n/** The CLI's `bin/` was not found above the module looking for it. */\nexport class OwningTsconfigJsxHookMissing extends Error {\n\tconstructor(readonly from: string) {\n\t\tsuper(\n\t\t\t`Could not find bin/${REGISTER} in any directory above '${from}'. ` +\n\t\t\t\t'It ships with @geekmidas/cli beside bin/gkm.mjs; reinstall the ' +\n\t\t\t\t'package if it is missing.',\n\t\t);\n\t\tthis.name = 'OwningTsconfigJsxHookMissing';\n\t}\n}\n\n/**\n * The CLI's `bin/owning-tsconfig-jsx-register.mjs`, as a file URL. Searched\n * upward because this module runs from `src/` in the repo and from a chunk in\n * `dist/` once built, and `bin/` sits beside both.\n */\nfunction registerUrl(): string {\n\tconst from = dirname(fileURLToPath(import.meta.url));\n\tfor (let dir = from; ; dir = dirname(dir)) {\n\t\tconst candidate = join(dir, 'bin', REGISTER);\n\t\tif (existsSync(candidate)) return pathToFileURL(candidate).href;\n\t\tif (dirname(dir) === dir) throw new OwningTsconfigJsxHookMissing(from);\n\t}\n}\n\n/**\n * `NODE_OPTIONS` for a process that runs app code through tsx, with the hook\n * that compiles each `.tsx` with its own tsconfig's JSX settings (see\n * `bin/owning-tsconfig-jsx.mjs`) put in front of every other `--import`, so it\n * is registered before tsx and reads the source on tsx's behalf.\n *\n * `bin/gkm.mjs` already starts the CLI this way, and its children inherit it;\n * this is for those that set `NODE_OPTIONS` themselves, or whose CLI was\n * started with tsx already imported.\n */\nexport function withOwningTsconfigJsx(nodeOptions = ''): string {\n\tif (nodeOptions.includes(REGISTER)) return nodeOptions;\n\treturn [`--import=${registerUrl()}`, nodeOptions].filter(Boolean).join(' ');\n}\n","/**\n * Running one of the CLI's own worker scripts inside a sandbox, and reading\n * back the one JSON value it answers with.\n *\n * The worker imports the project's TypeScript — `gkm.config.ts`, construct\n * modules, an app's entry — so it starts with the CLI's own tsx and the two\n * hooks `gkm` itself runs with (JSX by the owning tsconfig, path aliases by\n * the adjacent one). The host process needs none of them loaded: a program\n * calling `deploy()` without `--import tsx` still loads a TypeScript config.\n */\n\nimport { existsSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath, pathToFileURL } from 'node:url';\nimport type { z } from 'zod';\nimport { withOwningTsconfigJsx } from '../owningTsconfigJsx';\nimport { oncePerRun, type Sandbox } from './sandbox';\nimport { WORKER_RESULT_MARKER } from './workerRuntime';\n\nconst here = dirname(fileURLToPath(import.meta.url));\n\n/**\n * A worker's file: `dist/sandbox/<name>.mjs` once built — whether this module\n * was bundled into `dist/` or sits beside it — or the `.ts` source under tsx.\n */\nexport function workerFile(name: string): string {\n\tconst candidates = [\n\t\tjoin(here, 'sandbox', `${name}.mjs`),\n\t\tjoin(here, `${name}.mjs`),\n\t\tjoin(here, '..', 'sandbox', `${name}.mjs`),\n\t\tjoin(here, `${name}.ts`),\n\t];\n\treturn (\n\t\tcandidates.find((path) => existsSync(path)) ?? join(here, `${name}.ts`)\n\t);\n}\n\n/** tsx, from the CLI's own dependencies — never the project's. */\nexport function tsxUrl(): string {\n\treturn pathToFileURL(createRequire(import.meta.url).resolve('tsx')).href;\n}\n\n/**\n * `node`'s arguments for `script`: the CLI's TypeScript loaders, then any\n * further `imports`, then the script and its `args` — an argument array, so\n * nothing about a path is read by a shell.\n */\nexport function nodeWithTsx(\n\tscript: string,\n\targs: readonly string[],\n\timports: readonly string[] = [],\n): string[] {\n\treturn [\n\t\t...withOwningTsconfigJsx(`--import=${tsxUrl()}`).split(' '),\n\t\t...imports.map((path) => `--import=${pathToFileURL(path).href}`),\n\t\tscript,\n\t\t...args,\n\t];\n}\n\n/** A worker ended without the answer it exists to give. */\nexport class SandboxWorkerFailed extends Error {\n\tconstructor(\n\t\treadonly step: string,\n\t\treadonly exitCode: number | null,\n\t\treadonly stderr: string,\n\t) {\n\t\tsuper(\n\t\t\t`The sandboxed ${step} ended (exit code ${exitCode}) without an ` +\n\t\t\t\t`answer.${stderr.trim() ? `\\n${stderr.trim()}` : ''}\\nIts output ` +\n\t\t\t\t'above says why; the sandbox must be able to run `node` with the ' +\n\t\t\t\t\"CLI's own files at the paths they have here.\",\n\t\t);\n\t\tthis.name = 'SandboxWorkerFailed';\n\t}\n}\n\nexport interface WorkerRun<T> {\n\t/** What the worker answered, as the schema reads it. */\n\tvalue: T;\n\t/** What it wrote to stderr: warnings a caller may pass on. */\n\tstderr: string;\n}\n\n/**\n * Run worker `name` in `sandbox`, and parse its answer with `schema`.\n *\n * The answer is the last marked line on stdout. Anything else the project's\n * code printed is ignored, and an answer the schema refuses is a failure\n * rather than data — a worker in an isolating sandbox runs code the host does\n * not trust.\n *\n * Within a run (`withSandbox`), the same worker asked the same question is\n * started once; every ask gets its own copy of the answer, and its stderr, as\n * though it had run again.\n */\nexport async function runWorker<S extends z.ZodType>(\n\tsandbox: Sandbox,\n\tstep: string,\n\toptions: WorkerOptions<S>,\n): Promise<WorkerRun<z.infer<S>>> {\n\t// A step handed secrets acts on something — a database it migrates — and\n\t// is not a question whose answer can be reused; nor do its secrets belong\n\t// in a cache key.\n\tif (options.secrets) return startWorker(sandbox, step, options);\n\n\tconst key = JSON.stringify([\n\t\toptions.name,\n\t\toptions.cwd,\n\t\toptions.args,\n\t\toptions.env ?? {},\n\t]);\n\tconst answer = await oncePerRun(sandbox, key, () =>\n\t\tstartWorker(sandbox, step, options),\n\t);\n\treturn structuredClone(answer);\n}\n\ninterface WorkerOptions<S extends z.ZodType> {\n\tname: string;\n\targs: readonly string[];\n\tcwd: string;\n\ttimeoutMs: number;\n\tenv?: Readonly<Record<string, string>>;\n\t/** Mounted as files, named by `GKM_SECRETS_DIR` — never variables. */\n\tsecrets?: Readonly<Record<string, string>>;\n\tsignal?: AbortSignal;\n\tschema: S;\n}\n\nasync function startWorker<S extends z.ZodType>(\n\tsandbox: Sandbox,\n\tstep: string,\n\toptions: WorkerOptions<S>,\n): Promise<WorkerRun<z.infer<S>>> {\n\tconst result = await sandbox.exec(\n\t\t'node',\n\t\tnodeWithTsx(workerFile(options.name), options.args),\n\t\t{\n\t\t\tcwd: options.cwd,\n\t\t\tenv: { ...sandbox.env, ...options.env },\n\t\t\ttimeoutMs: options.timeoutMs,\n\t\t\toutput: 'capture',\n\t\t\t...(options.secrets ? { secrets: options.secrets } : {}),\n\t\t\t...(options.signal ? { signal: options.signal } : {}),\n\t\t},\n\t);\n\n\tconst line = result.stdout\n\t\t.split('\\n')\n\t\t.reverse()\n\t\t.find((l) => l.startsWith(WORKER_RESULT_MARKER));\n\tif (line) {\n\t\ttry {\n\t\t\tconst parsed = options.schema.safeParse(\n\t\t\t\tJSON.parse(line.slice(WORKER_RESULT_MARKER.length)),\n\t\t\t);\n\t\t\tif (parsed.success) return { value: parsed.data, stderr: result.stderr };\n\t\t} catch {\n\t\t\t// Not JSON: as good as no answer.\n\t\t}\n\t}\n\n\tthrow new SandboxWorkerFailed(step, result.exitCode, result.stderr);\n}\n","/**\n * Discovery — one glob, one structural test.\n *\n * A glob per kind is the same specialness the construct model removes, and\n * resources have no kind to be listed under: a declared `ObjectStorage` would\n * never be found by `routes:` or `crons:`. So there is one `constructs` glob,\n * every export of every matching module is inspected, and the per-kind\n * `isConstruct` checks collapse into a single question — does it have an id and\n * can it declare?\n *\n * Structural rather than `instanceof` on purpose. A construct from a different\n * copy of `@geekmidas/constructs` — a linked workspace, two versions in a\n * lockfile — is still a construct, and `instanceof` is exactly the check that\n * says otherwise.\n */\n\nimport { relative } from 'node:path';\nimport { Cron } from '@geekmidas/constructs/crons';\nimport { Queue } from '@geekmidas/constructs/queue';\nimport { Subscriber } from '@geekmidas/constructs/subscribers';\nimport {\n\tassertDerivations,\n\ttype ConstructManifest,\n\tcanonicalId,\n\ttype Declaration,\n} from '@geekmidas/manifest';\nimport fg from 'fast-glob';\nimport { z } from 'zod';\nimport { GkmError } from '../errors';\nimport { clearZodGlobalRegistry } from '../generators/Generator';\nimport { output } from '../output';\nimport { activeSandbox, type Sandbox } from '../sandbox/sandbox';\nimport { runWorker } from '../sandbox/worker';\n\n/** `console`, or the deploy run discovering the manifest. */\nconst logger = output;\n\n/** The construct face discovery needs: an id, and the ability to declare. */\ninterface Declarable {\n\tid: string;\n\tdeclare(): Declaration[];\n}\n\n/**\n * Whether a module export is a construct.\n *\n * Deliberately loose about what else it carries — a construct that also has a\n * `service` is still a construct, and requiring one would exclude the kinds that\n * own no address.\n */\nexport function isDeclarable(value: unknown): value is Declarable {\n\tif (typeof value !== 'object' || value === null) return false;\n\n\tconst candidate = value as Partial<Declarable>;\n\n\treturn (\n\t\ttypeof candidate.id === 'string' &&\n\t\tcandidate.id.length > 0 &&\n\t\ttypeof candidate.declare === 'function'\n\t);\n}\n\nexport interface DiscoverOptions {\n\t/** The glob(s) to search. One pattern, not one per kind. */\n\tpatterns: string | readonly string[];\n\tcwd?: string;\n\t/**\n\t * Re-import changed modules, for the dev watcher.\n\t *\n\t * A single glob makes discovery more central, not less: a new construct file\n\t * has to be picked up on `add`, not only on `change`.\n\t */\n\tbustCache?: boolean;\n\t/**\n\t * Filled in with where each construct was found, when provided.\n\t *\n\t * Discovery is the only thing that knows: it globbed the files and imported\n\t * them. Everything downstream that needs to *write* an import — the build,\n\t * generating a server entry that reads a surface's logger — would otherwise\n\t * have to be told the path in config, which is the string this removes.\n\t *\n\t * An out-parameter rather than a second return value so that every existing\n\t * caller, which wants the manifest and nothing else, is unchanged.\n\t */\n\tsources?: Record<string, ConstructSource>;\n\t/**\n\t * Filled in, when provided, with the ids each owner's runnables declared an\n\t * edge to — keyed by the surface an endpoint was built from, or the worker\n\t * a cron or subscriber was.\n\t *\n\t * A runnable is not a declaration: a surface's endpoints are found by the\n\t * glob, not listed by the surface, so its node says `endpoints: []` until a\n\t * build folds the routes in. Anything deciding what an app's process reaches\n\t * — which keys its container is given — needs those edges before any build,\n\t * and discovery is already importing the files they are in.\n\t */\n\trunnables?: Record<string, string[]>;\n\t/**\n\t * Filled in, when provided, with the files each worker's background work is\n\t * declared in — its crons, queue consumers and topic subscribers — keyed by\n\t * the worker.\n\t *\n\t * What says which app's build carries a worker's entry: the one whose\n\t * directory holds its work. A worker declares no path of its own.\n\t */\n\tbackground?: Record<string, string[]>;\n\t/**\n\t * Import the construct modules in this sandbox rather than in this\n\t * process. Defaults to the run's own (`withSandbox`), so a deploy's every\n\t * discovery — the engine's included — happens there; with neither, they\n\t * are imported here, as before.\n\t */\n\tsandbox?: Sandbox;\n}\n\n/** What the discovery worker answers. Checked: the worker ran project code. */\nconst DiscoverAnswer = z.discriminatedUnion('reason', [\n\tz.object({\n\t\treason: z.literal('discovered'),\n\t\tmanifest: z.record(\n\t\t\tz.string(),\n\t\t\tz.object({ id: z.string(), kind: z.string() }).loose(),\n\t\t),\n\t\trunnables: z.record(z.string(), z.array(z.string())),\n\t\tbackground: z.record(z.string(), z.array(z.string())).optional(),\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\n\t\t\t.object({\n\t\t\t\tname: z.string(),\n\t\t\t\tmessage: z.string(),\n\t\t\t\tid: z.string().optional(),\n\t\t\t\tsources: z.array(z.string()).optional(),\n\t\t\t})\n\t\t\t.loose(),\n\t}),\n]);\n\n/**\n * The manifest, discovered in `sandbox` and handed back as JSON — or\n * `undefined` when it holds something JSON cannot carry and the sandbox is\n * not isolating, for the caller to discover here as before.\n */\nasync function discoverInSandbox(\n\tsandbox: Sandbox,\n\toptions: DiscoverOptions,\n): Promise<ConstructManifest | undefined> {\n\tconst cwd = options.cwd ?? sandbox.root;\n\tconst patterns =\n\t\ttypeof options.patterns === 'string'\n\t\t\t? [options.patterns]\n\t\t\t: [...options.patterns];\n\n\tconst { value, stderr } = await runWorker(sandbox, 'construct discovery', {\n\t\tname: 'discover-worker',\n\t\targs: [JSON.stringify({ patterns, cwd })],\n\t\tcwd,\n\t\ttimeoutMs: DISCOVER_TIMEOUT_MS,\n\t\tschema: DiscoverAnswer,\n\t});\n\n\t// Discovery's own warnings — a glob that matched nothing — are the\n\t// run's, as they would be had it discovered in-process: as written, one\n\t// message, less the newline the worker's `console.warn` ended it with.\n\tif (stderr.trim()) logger.warn(stderr.replace(/\\n$/, ''));\n\n\tswitch (value.reason) {\n\t\tcase 'discovered':\n\t\t\tif (options.runnables) {\n\t\t\t\tfor (const [owner, edges] of Object.entries(value.runnables)) {\n\t\t\t\t\toptions.runnables[owner] = edges;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (options.background) {\n\t\t\t\tfor (const [owner, files] of Object.entries(value.background ?? {})) {\n\t\t\t\t\toptions.background[owner] = files;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn value.manifest as unknown as ConstructManifest;\n\t\tcase 'failed':\n\t\t\tif (value.error.name === 'DuplicateConstruct' && value.error.id) {\n\t\t\t\tthrow new DuplicateConstruct(value.error.id, value.error.sources ?? []);\n\t\t\t}\n\t\t\tthrow new ConstructDiscoveryFailed(value.error.name, value.error.message);\n\t\tcase 'live':\n\t\t\tif (sandbox.isolating) throw new ConstructsNotSerializable(value.paths);\n\t\t\treturn undefined;\n\t}\n}\n\n/**\n * A caller asked for the construct objects (`sources`) or a watcher's\n * re-import under an isolating sandbox, where only data comes back.\n */\nexport class LiveConstructsUnavailable extends Error {\n\tconstructor() {\n\t\tsuper(\n\t\t\t'Discovery was asked for the construct objects themselves under an ' +\n\t\t\t\t'isolating sandbox, which hands back only data. Run this step ' +\n\t\t\t\t'without one, or ask only for the manifest.',\n\t\t);\n\t\tthis.name = 'LiveConstructsUnavailable';\n\t}\n}\n\n/** How long discovering a project's constructs may take in a sandbox. */\nconst DISCOVER_TIMEOUT_MS = 60_000;\n\n/** Importing a construct module, or declaring one, threw in the sandbox. */\nexport class ConstructDiscoveryFailed extends Error {\n\tconstructor(\n\t\treadonly errorName: string,\n\t\treadonly detail: string,\n\t) {\n\t\tsuper(`Discovering constructs failed (${errorName}): ${detail}`);\n\t\tthis.name = 'ConstructDiscoveryFailed';\n\t}\n}\n\n/**\n * The constructs' declarations hold something that is not data, and the\n * sandbox they were discovered in hands the deploy nothing but data.\n */\nexport class ConstructsNotSerializable extends Error {\n\tconstructor(readonly paths: readonly string[]) {\n\t\tsuper(\n\t\t\t`The construct manifest holds values that are not plain data at: ` +\n\t\t\t\t`${paths.join(', ')}. Under an isolating sandbox the deploy only ` +\n\t\t\t\t'receives what JSON can carry; deploy with a sandbox that is not ' +\n\t\t\t\t'isolating if the host trusts this project.',\n\t\t);\n\t\tthis.name = 'ConstructsNotSerializable';\n\t}\n}\n\n/** Where a construct was declared, and under what name. */\nexport interface ConstructSource {\n\t/** Absolute path to the module that exported it. */\n\tfile: string;\n\t/** The name it was exported as — what an import statement has to say. */\n\texportName: string;\n\t/**\n\t * The exported construct itself.\n\t *\n\t * What a declaration cannot say — whether it serves itself — the object can\n\t * be asked, and discovery already imported it.\n\t */\n\tconstruct: unknown;\n}\n\n/**\n * Build the construct manifest for a project.\n *\n * Runs the manifest's own validation before returning, so an app is wrong here\n * — where the error names a file — rather than at deploy.\n *\n * @throws {DuplicateConstruct} when two exports claim one id.\n */\nexport async function discover(\n\toptions: DiscoverOptions,\n): Promise<ConstructManifest> {\n\tconst sandbox = options.sandbox ?? activeSandbox();\n\tif (sandbox) {\n\t\tif (!options.sources && !options.bustCache) {\n\t\t\tconst sandboxed = await discoverInSandbox(sandbox, options);\n\t\t\tif (sandboxed) return sandboxed;\n\t\t} else if (sandbox.isolating) {\n\t\t\t// The construct objects themselves, or a re-import for the watcher:\n\t\t\t// neither can cross a sandbox that hands back only data.\n\t\t\tthrow new LiveConstructsUnavailable();\n\t\t}\n\t}\n\n\tconst {\n\t\tpatterns,\n\t\tcwd = process.cwd(),\n\t\tbustCache = false,\n\t\tsources: out,\n\t} = options;\n\n\t// Re-importing user modules re-executes them, and Zod v4 throws on a\n\t// re-registered `.meta({ id })`. Same reason the generators clear it.\n\tif (bustCache) clearZodGlobalRegistry();\n\n\tconst manifest: Record<string, Declaration> = {};\n\t/** Which file declared each id, for the error when two of them do. */\n\tconst sources: Record<string, string> = {};\n\t/**\n\t * Constructs already seen, by identity.\n\t *\n\t * A re-export is the *same object* reached through a second file — ESM\n\t * bindings are live, so `export * from './database.js'` hands back the\n\t * binding rather than a copy. Without this, a barrel file made every\n\t * construct in it appear declared twice, and `constructs/index.ts` is the\n\t * first thing anyone writes in a shared folder.\n\t *\n\t * Identity rather than file is also the more honest rule: what may not\n\t * happen twice is two *different* constructs claiming one id, and that is\n\t * still an error below.\n\t */\n\tconst seen = new WeakSet<object>();\n\n\tconst globs = Array.isArray(patterns) ? [...patterns] : [patterns as string];\n\tconst files = fg.stream(globs, { cwd, absolute: true });\n\n\t/** Matched files, for the diagnostic below. */\n\tlet matched = 0;\n\n\tfor await (const found of files) {\n\t\tmatched++;\n\t\tconst file = found.toString();\n\t\tconst module = await import(bustCache ? `${file}?t=${Date.now()}` : file);\n\n\t\tfor (const [exportName, exported] of Object.entries(module)) {\n\t\t\tif (options.background)\n\t\t\t\trecordBackground(options.background, exported, file);\n\t\t\tif (!isDeclarable(exported)) {\n\t\t\t\tif (options.runnables) recordRunnable(options.runnables, exported);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// The same construct, reached again through a re-export. Skipped\n\t\t\t// rather than re-declared: it has already claimed its id, from the\n\t\t\t// file that defined it.\n\t\t\tif (seen.has(exported as object)) continue;\n\t\t\tseen.add(exported as object);\n\n\t\t\t// A construct that is also something a process runs — a queue and its\n\t\t\t// consumer, built from a worker — reaches what it depends on through\n\t\t\t// that process, exactly as an endpoint or a cron does.\n\t\t\tif (\n\t\t\t\toptions.runnables &&\n\t\t\t\ttypeof (exported as { owner?: unknown }).owner === 'string'\n\t\t\t) {\n\t\t\t\trecordRunnable(options.runnables, exported);\n\t\t\t}\n\n\t\t\tfor (const declaration of exported.declare()) {\n\t\t\t\t// Canonicalise here too: a construct built by hand rather than through\n\t\t\t\t// a constructor is still subject to the same identity rule.\n\t\t\t\tconst id = canonicalId(declaration.id);\n\t\t\t\tconst source = relative(cwd, file);\n\n\t\t\t\tconst claimed = sources[id];\n\t\t\t\tif (claimed !== undefined && claimed !== source) {\n\t\t\t\t\tthrow new DuplicateConstruct(id, [claimed, source]);\n\t\t\t\t}\n\n\t\t\t\tmanifest[id] = { ...declaration, id };\n\t\t\t\tsources[id] = source;\n\t\t\t\tif (out) out[id] = { file, exportName, construct: exported };\n\t\t\t}\n\t\t}\n\t}\n\n\t// Reference integrity before anyone reads it — a schema tenant naming a\n\t// database that was deleted is a manifest error, not a reconcile failure.\n\tassertDerivations(manifest);\n\n\twarnIfNothingFound(globs, matched, Object.keys(manifest).length);\n\n\treturn manifest;\n}\n\n/**\n * Record where a worker's background work is declared: a cron, a queue\n * consumer or a topic subscriber, under the worker that owns it.\n */\nfunction recordBackground(\n\tbackground: Record<string, string[]>,\n\texported: unknown,\n\tfile: string,\n): void {\n\tif (\n\t\t!Cron.isCron(exported) &&\n\t\t!Queue.isQueue(exported) &&\n\t\t!Subscriber.isSubscriber(exported)\n\t) {\n\t\treturn;\n\t}\n\tconst owner = (exported as { owner?: unknown }).owner;\n\tif (typeof owner !== 'string') return;\n\n\tconst key = canonicalId(owner);\n\tconst files = background[key] ?? [];\n\tbackground[key] = files;\n\tif (!files.includes(file)) files.push(file);\n}\n\n/**\n * What a runnable consumes, by id: a queue's consumer drains that queue, a\n * subscriber its topic. Nothing for anything else.\n */\nexport function consumedBy(runnable: unknown): string[] {\n\tif (Queue.isQueue(runnable)) return [runnable.id];\n\tif (Subscriber.isSubscriber(runnable) && runnable.topicName) {\n\t\treturn [canonicalId(runnable.topicName)];\n\t}\n\treturn [];\n}\n\n/**\n * Record a runnable's edges under the construct that owns it — the surface an\n * endpoint was built from, or the worker a cron or subscriber was. Anything\n * with no owner, or that is not a runnable at all, is left alone.\n */\nfunction recordRunnable(\n\trunnables: Record<string, string[]>,\n\texported: unknown,\n): void {\n\tif (typeof exported !== 'object' || exported === null) return;\n\n\tconst runnable = exported as {\n\t\tsurface?: { id?: unknown };\n\t\towner?: unknown;\n\t\tconstructs?: unknown;\n\t};\n\tconst owner =\n\t\ttypeof runnable.surface?.id === 'string'\n\t\t\t? runnable.surface.id\n\t\t\t: typeof runnable.owner === 'string'\n\t\t\t\t? runnable.owner\n\t\t\t\t: undefined;\n\tif (!owner || !Array.isArray(runnable.constructs)) return;\n\n\tconst key = canonicalId(owner);\n\tconst edges = runnables[key] ?? [];\n\trunnables[key] = edges;\n\t// What it consumes is an edge of its process too, so a worker is handed\n\t// the carriers its own work is bound to and no other.\n\tfor (const id of [...runnable.constructs, ...consumedBy(exported)]) {\n\t\tif (typeof id !== 'string') continue;\n\t\tconst target = canonicalId(id);\n\t\tif (!edges.includes(target)) edges.push(target);\n\t}\n}\n\n/**\n * Say so when a glob was configured and found nothing.\n *\n * The glob is not a filter over declarations already known — it is *how they\n * are found*, by importing what it matches. So a file it misses is a\n * declaration that does not exist, and every symptom of that appears somewhere\n * other than the cause: no container starts, no env key is written, and the\n * application fails on first use against a resource it can see in its own\n * source.\n *\n * Nothing reported it before, because an unmatched file is indistinguishable\n * from a file nobody wrote. These two cases are the ones that are *not*\n * ambiguous — a glob was configured, so something was expected.\n *\n * Silent when no glob is configured at all: that is a project which has not\n * adopted constructs, and has nothing to be missing.\n */\nfunction warnIfNothingFound(\n\tglobs: readonly string[],\n\tmatched: number,\n\tdeclared: number,\n): void {\n\tif (globs.length === 0) return;\n\n\tif (matched === 0) {\n\t\tlogger.warn(\n\t\t\t`\\n⚠️ The constructs glob matched no files, so nothing was declared.\\n` +\n\t\t\t\t` Patterns: ${globs.join(', ')}\\n` +\n\t\t\t\t` Nothing will be provisioned — no containers, no env keys, no ` +\n\t\t\t\t`resources.\\n` +\n\t\t\t\t` A common cause is depth: '*.ts' matches one level, '**/*.ts' ` +\n\t\t\t\t`matches any.`,\n\t\t);\n\t\treturn;\n\t}\n\n\tif (declared === 0) {\n\t\tlogger.warn(\n\t\t\t`\\n⚠️ The constructs glob matched ${matched} file(s) but none declared ` +\n\t\t\t\t`anything.\\n` +\n\t\t\t\t` Patterns: ${globs.join(', ')}\\n` +\n\t\t\t\t` Discovery keeps exports with an 'id' that can 'declare()'. A ` +\n\t\t\t\t`construct that is\\n` +\n\t\t\t\t` built but never exported is invisible to it.`,\n\t\t);\n\t}\n}\n\n/** Two constructs claiming one id. */\nexport class DuplicateConstruct extends GkmError {\n\t/** The id claimed twice. */\n\treadonly id: string;\n\t/** The files that claimed it. */\n\treadonly sources: readonly string[];\n\n\tconstructor(id: string, sources: readonly string[]) {\n\t\tsuper('Two constructs declare the same id');\n\t\tthis.name = 'DuplicateConstruct';\n\t\tthis.id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hDjJH2R.mjs";
2
+ import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
3
+ import { a as discriminatedUnion, c as literal, d as object, f as record, n as array, p as string } from "./schemas-BCwKKA42.mjs";
4
+ import { i as activeSandbox, s as oncePerRun } from "./sandbox-CbVB7uOD.mjs";
5
+ import { t as WORKER_RESULT_MARKER } from "./workerRuntime-CsOyBRx2.mjs";
6
+ import { createRequire } from "node:module";
7
+ import { dirname, join, relative } from "node:path";
8
+ import { existsSync } from "node:fs";
9
+ import { assertDerivations, canonicalId } from "@geekmidas/manifest";
10
+ import { fileURLToPath, pathToFileURL } from "node:url";
11
+ import { AsyncLocalStorage } from "node:async_hooks";
12
+ import { format } from "node:util";
13
+ import { Cron } from "@geekmidas/constructs/crons";
14
+ import { Queue } from "@geekmidas/constructs/queue";
15
+ import { Subscriber } from "@geekmidas/constructs/subscribers";
16
+ import fg from "fast-glob";
17
+ import kebabCase$1 from "lodash.kebabcase";
18
+ //#region src/output.ts
19
+ /**
20
+ * Where the CLI's progress lines go.
21
+ *
22
+ * Commands write their progress through `output` rather than `console`. Run
23
+ * from the terminal that is the same thing. Run inside `deploy()`, each line
24
+ * goes to the run that wrote it instead — as an event its caller can iterate,
25
+ * and to the logger it was handed — so a deploy embedded in another program
26
+ * does not print over that program's own output.
27
+ *
28
+ * Carried by `AsyncLocalStorage` rather than passed down, because the lines
29
+ * come from everywhere a deploy reaches — the Dockerfile generator, the env
30
+ * sniffer, construct discovery — and two deploys running in one process must
31
+ * not hear each other.
32
+ */
33
+ const current = new AsyncLocalStorage();
34
+ /** Runs `fn` with every line written through `output` sent to `sink`. */
35
+ function withOutput(sink, fn) {
36
+ return current.run(sink, fn);
37
+ }
38
+ function write(level, fallback) {
39
+ return (...args) => {
40
+ const sink = current.getStore();
41
+ if (sink) sink(level, format(...args));
42
+ else fallback(...args);
43
+ };
44
+ }
45
+ /**
46
+ * `console`, for the methods the CLI logs through — routed to the current
47
+ * run's sink when there is one.
48
+ */
49
+ const output = {
50
+ log: write("info", (...args) => console.log(...args)),
51
+ info: write("info", (...args) => console.info(...args)),
52
+ warn: write("warn", (...args) => console.warn(...args)),
53
+ error: write("error", (...args) => console.error(...args))
54
+ };
55
+ //#endregion
56
+ //#region src/generators/Generator.ts
57
+ /**
58
+ * Zod v4 maintains a process-wide registry of schemas registered via
59
+ * `.meta({ id })`. When we cache-bust user module imports (by appending a
60
+ * `?t=timestamp` query), those modules re-execute and try to register the
61
+ * same ids again, which throws `ID X already exists in the registry`.
62
+ *
63
+ * Clearing the registry in the CLI process is safe: the user's running
64
+ * server lives in a subprocess and has its own isolated registry.
65
+ *
66
+ * Exported for tests.
67
+ */
68
+ function clearZodGlobalRegistry() {
69
+ const registry = globalThis.__zod_globalRegistry;
70
+ if (registry && typeof registry.clear === "function") registry.clear();
71
+ }
72
+ var ConstructGenerator = class {
73
+ static async build(context, outputDir, generator, patterns, options) {
74
+ const constructs = await generator.load(patterns);
75
+ return generator.build(context, constructs, outputDir, options);
76
+ }
77
+ async load(patterns, cwd = process.cwd(), bustCache = false) {
78
+ const logger = console;
79
+ const globPatterns = Array.isArray(patterns) ? patterns : patterns ? [patterns] : [];
80
+ const files = fg.stream(globPatterns, {
81
+ cwd,
82
+ absolute: true
83
+ });
84
+ if (bustCache) clearZodGlobalRegistry();
85
+ const constructs = [];
86
+ for await (const f of files) try {
87
+ const file = f.toString();
88
+ const module = await (bustCache ? import(`${file}?t=${Date.now()}`) : import(file));
89
+ for (const [key, construct] of Object.entries(module)) if (this.isConstruct(construct)) constructs.push({
90
+ key,
91
+ name: kebabCase$1(key),
92
+ construct,
93
+ path: {
94
+ absolute: file,
95
+ relative: relative(process.cwd(), file)
96
+ }
97
+ });
98
+ } catch (error) {
99
+ const err = error;
100
+ logger.error(`Failed to load ${f}: ${err.message}`);
101
+ if (err.stack) logger.error(err.stack);
102
+ throw error;
103
+ }
104
+ return constructs;
105
+ }
106
+ };
107
+ //#endregion
108
+ //#region src/owningTsconfigJsx.ts
109
+ const REGISTER = "owning-tsconfig-jsx-register.mjs";
110
+ /** The CLI's `bin/` was not found above the module looking for it. */
111
+ var OwningTsconfigJsxHookMissing = class extends Error {
112
+ from;
113
+ constructor(from) {
114
+ super(`Could not find bin/${REGISTER} in any directory above '${from}'. It ships with @geekmidas/cli beside bin/gkm.mjs; reinstall the package if it is missing.`);
115
+ this.from = from;
116
+ this.name = "OwningTsconfigJsxHookMissing";
117
+ }
118
+ };
119
+ /**
120
+ * The CLI's `bin/owning-tsconfig-jsx-register.mjs`, as a file URL. Searched
121
+ * upward because this module runs from `src/` in the repo and from a chunk in
122
+ * `dist/` once built, and `bin/` sits beside both.
123
+ */
124
+ function registerUrl() {
125
+ const from = dirname(fileURLToPath(import.meta.url));
126
+ for (let dir = from;; dir = dirname(dir)) {
127
+ const candidate = join(dir, "bin", REGISTER);
128
+ if (existsSync(candidate)) return pathToFileURL(candidate).href;
129
+ if (dirname(dir) === dir) throw new OwningTsconfigJsxHookMissing(from);
130
+ }
131
+ }
132
+ /**
133
+ * `NODE_OPTIONS` for a process that runs app code through tsx, with the hook
134
+ * that compiles each `.tsx` with its own tsconfig's JSX settings (see
135
+ * `bin/owning-tsconfig-jsx.mjs`) put in front of every other `--import`, so it
136
+ * is registered before tsx and reads the source on tsx's behalf.
137
+ *
138
+ * `bin/gkm.mjs` already starts the CLI this way, and its children inherit it;
139
+ * this is for those that set `NODE_OPTIONS` themselves, or whose CLI was
140
+ * started with tsx already imported.
141
+ */
142
+ function withOwningTsconfigJsx(nodeOptions = "") {
143
+ if (nodeOptions.includes(REGISTER)) return nodeOptions;
144
+ return [`--import=${registerUrl()}`, nodeOptions].filter(Boolean).join(" ");
145
+ }
146
+ //#endregion
147
+ //#region src/sandbox/worker.ts
148
+ /**
149
+ * Running one of the CLI's own worker scripts inside a sandbox, and reading
150
+ * back the one JSON value it answers with.
151
+ *
152
+ * The worker imports the project's TypeScript — `gkm.config.ts`, construct
153
+ * modules, an app's entry — so it starts with the CLI's own tsx and the two
154
+ * hooks `gkm` itself runs with (JSX by the owning tsconfig, path aliases by
155
+ * the adjacent one). The host process needs none of them loaded: a program
156
+ * calling `deploy()` without `--import tsx` still loads a TypeScript config.
157
+ */
158
+ const here = dirname(fileURLToPath(import.meta.url));
159
+ /**
160
+ * A worker's file: `dist/sandbox/<name>.mjs` once built — whether this module
161
+ * was bundled into `dist/` or sits beside it — or the `.ts` source under tsx.
162
+ */
163
+ function workerFile(name) {
164
+ return [
165
+ join(here, "sandbox", `${name}.mjs`),
166
+ join(here, `${name}.mjs`),
167
+ join(here, "..", "sandbox", `${name}.mjs`),
168
+ join(here, `${name}.ts`)
169
+ ].find((path) => existsSync(path)) ?? join(here, `${name}.ts`);
170
+ }
171
+ /** tsx, from the CLI's own dependencies — never the project's. */
172
+ function tsxUrl() {
173
+ return pathToFileURL(createRequire(import.meta.url).resolve("tsx")).href;
174
+ }
175
+ /**
176
+ * `node`'s arguments for `script`: the CLI's TypeScript loaders, then any
177
+ * further `imports`, then the script and its `args` — an argument array, so
178
+ * nothing about a path is read by a shell.
179
+ */
180
+ function nodeWithTsx(script, args, imports = []) {
181
+ return [
182
+ ...withOwningTsconfigJsx(`--import=${tsxUrl()}`).split(" "),
183
+ ...imports.map((path) => `--import=${pathToFileURL(path).href}`),
184
+ script,
185
+ ...args
186
+ ];
187
+ }
188
+ /** A worker ended without the answer it exists to give. */
189
+ var SandboxWorkerFailed = class extends Error {
190
+ step;
191
+ exitCode;
192
+ stderr;
193
+ constructor(step, exitCode, stderr) {
194
+ super(`The sandboxed ${step} ended (exit code ${exitCode}) without an answer.${stderr.trim() ? `\n${stderr.trim()}` : ""}\nIts output above says why; the sandbox must be able to run \`node\` with the CLI's own files at the paths they have here.`);
195
+ this.step = step;
196
+ this.exitCode = exitCode;
197
+ this.stderr = stderr;
198
+ this.name = "SandboxWorkerFailed";
199
+ }
200
+ };
201
+ /**
202
+ * Run worker `name` in `sandbox`, and parse its answer with `schema`.
203
+ *
204
+ * The answer is the last marked line on stdout. Anything else the project's
205
+ * code printed is ignored, and an answer the schema refuses is a failure
206
+ * rather than data — a worker in an isolating sandbox runs code the host does
207
+ * not trust.
208
+ *
209
+ * Within a run (`withSandbox`), the same worker asked the same question is
210
+ * started once; every ask gets its own copy of the answer, and its stderr, as
211
+ * though it had run again.
212
+ */
213
+ async function runWorker(sandbox, step, options) {
214
+ if (options.secrets) return startWorker(sandbox, step, options);
215
+ const key = JSON.stringify([
216
+ options.name,
217
+ options.cwd,
218
+ options.args,
219
+ options.env ?? {}
220
+ ]);
221
+ const answer = await oncePerRun(sandbox, key, () => startWorker(sandbox, step, options));
222
+ return structuredClone(answer);
223
+ }
224
+ async function startWorker(sandbox, step, options) {
225
+ const result = await sandbox.exec("node", nodeWithTsx(workerFile(options.name), options.args), {
226
+ cwd: options.cwd,
227
+ env: {
228
+ ...sandbox.env,
229
+ ...options.env
230
+ },
231
+ timeoutMs: options.timeoutMs,
232
+ output: "capture",
233
+ ...options.secrets ? { secrets: options.secrets } : {},
234
+ ...options.signal ? { signal: options.signal } : {}
235
+ });
236
+ const line = result.stdout.split("\n").reverse().find((l) => l.startsWith(WORKER_RESULT_MARKER));
237
+ if (line) try {
238
+ const parsed = options.schema.safeParse(JSON.parse(line.slice(WORKER_RESULT_MARKER.length)));
239
+ if (parsed.success) return {
240
+ value: parsed.data,
241
+ stderr: result.stderr
242
+ };
243
+ } catch {}
244
+ throw new SandboxWorkerFailed(step, result.exitCode, result.stderr);
245
+ }
246
+ //#endregion
247
+ //#region src/reconcile/discover.ts
248
+ /**
249
+ * Discovery — one glob, one structural test.
250
+ *
251
+ * A glob per kind is the same specialness the construct model removes, and
252
+ * resources have no kind to be listed under: a declared `ObjectStorage` would
253
+ * never be found by `routes:` or `crons:`. So there is one `constructs` glob,
254
+ * every export of every matching module is inspected, and the per-kind
255
+ * `isConstruct` checks collapse into a single question — does it have an id and
256
+ * can it declare?
257
+ *
258
+ * Structural rather than `instanceof` on purpose. A construct from a different
259
+ * copy of `@geekmidas/constructs` — a linked workspace, two versions in a
260
+ * lockfile — is still a construct, and `instanceof` is exactly the check that
261
+ * says otherwise.
262
+ */
263
+ var discover_exports = /* @__PURE__ */ __exportAll({
264
+ ConstructDiscoveryFailed: () => ConstructDiscoveryFailed,
265
+ ConstructsNotSerializable: () => ConstructsNotSerializable,
266
+ DuplicateConstruct: () => DuplicateConstruct,
267
+ LiveConstructsUnavailable: () => LiveConstructsUnavailable,
268
+ consumedBy: () => consumedBy,
269
+ discover: () => discover,
270
+ isDeclarable: () => isDeclarable
271
+ });
272
+ /** `console`, or the deploy run discovering the manifest. */
273
+ const logger = output;
274
+ /**
275
+ * Whether a module export is a construct.
276
+ *
277
+ * Deliberately loose about what else it carries — a construct that also has a
278
+ * `service` is still a construct, and requiring one would exclude the kinds that
279
+ * own no address.
280
+ */
281
+ function isDeclarable(value) {
282
+ if (typeof value !== "object" || value === null) return false;
283
+ const candidate = value;
284
+ return typeof candidate.id === "string" && candidate.id.length > 0 && typeof candidate.declare === "function";
285
+ }
286
+ /** What the discovery worker answers. Checked: the worker ran project code. */
287
+ const DiscoverAnswer = discriminatedUnion("reason", [
288
+ object({
289
+ reason: literal("discovered"),
290
+ manifest: record(string(), object({
291
+ id: string(),
292
+ kind: string()
293
+ }).loose()),
294
+ runnables: record(string(), array(string())),
295
+ background: record(string(), array(string())).optional()
296
+ }),
297
+ object({
298
+ reason: literal("live"),
299
+ paths: array(string())
300
+ }),
301
+ object({
302
+ reason: literal("failed"),
303
+ error: object({
304
+ name: string(),
305
+ message: string(),
306
+ id: string().optional(),
307
+ sources: array(string()).optional()
308
+ }).loose()
309
+ })
310
+ ]);
311
+ /**
312
+ * The manifest, discovered in `sandbox` and handed back as JSON — or
313
+ * `undefined` when it holds something JSON cannot carry and the sandbox is
314
+ * not isolating, for the caller to discover here as before.
315
+ */
316
+ async function discoverInSandbox(sandbox, options) {
317
+ const cwd = options.cwd ?? sandbox.root;
318
+ const patterns = typeof options.patterns === "string" ? [options.patterns] : [...options.patterns];
319
+ const { value, stderr } = await runWorker(sandbox, "construct discovery", {
320
+ name: "discover-worker",
321
+ args: [JSON.stringify({
322
+ patterns,
323
+ cwd
324
+ })],
325
+ cwd,
326
+ timeoutMs: DISCOVER_TIMEOUT_MS,
327
+ schema: DiscoverAnswer
328
+ });
329
+ if (stderr.trim()) logger.warn(stderr.replace(/\n$/, ""));
330
+ switch (value.reason) {
331
+ case "discovered":
332
+ if (options.runnables) for (const [owner, edges] of Object.entries(value.runnables)) options.runnables[owner] = edges;
333
+ if (options.background) for (const [owner, files] of Object.entries(value.background ?? {})) options.background[owner] = files;
334
+ return value.manifest;
335
+ case "failed":
336
+ if (value.error.name === "DuplicateConstruct" && value.error.id) throw new DuplicateConstruct(value.error.id, value.error.sources ?? []);
337
+ throw new ConstructDiscoveryFailed(value.error.name, value.error.message);
338
+ case "live":
339
+ if (sandbox.isolating) throw new ConstructsNotSerializable(value.paths);
340
+ return;
341
+ }
342
+ }
343
+ /**
344
+ * A caller asked for the construct objects (`sources`) or a watcher's
345
+ * re-import under an isolating sandbox, where only data comes back.
346
+ */
347
+ var LiveConstructsUnavailable = class extends Error {
348
+ constructor() {
349
+ super("Discovery was asked for the construct objects themselves under an isolating sandbox, which hands back only data. Run this step without one, or ask only for the manifest.");
350
+ this.name = "LiveConstructsUnavailable";
351
+ }
352
+ };
353
+ /** How long discovering a project's constructs may take in a sandbox. */
354
+ const DISCOVER_TIMEOUT_MS = 6e4;
355
+ /** Importing a construct module, or declaring one, threw in the sandbox. */
356
+ var ConstructDiscoveryFailed = class extends Error {
357
+ errorName;
358
+ detail;
359
+ constructor(errorName, detail) {
360
+ super(`Discovering constructs failed (${errorName}): ${detail}`);
361
+ this.errorName = errorName;
362
+ this.detail = detail;
363
+ this.name = "ConstructDiscoveryFailed";
364
+ }
365
+ };
366
+ /**
367
+ * The constructs' declarations hold something that is not data, and the
368
+ * sandbox they were discovered in hands the deploy nothing but data.
369
+ */
370
+ var ConstructsNotSerializable = class extends Error {
371
+ paths;
372
+ constructor(paths) {
373
+ super(`The construct manifest holds values that are not plain data at: ${paths.join(", ")}. Under an isolating sandbox the deploy only receives what JSON can carry; deploy with a sandbox that is not isolating if the host trusts this project.`);
374
+ this.paths = paths;
375
+ this.name = "ConstructsNotSerializable";
376
+ }
377
+ };
378
+ /**
379
+ * Build the construct manifest for a project.
380
+ *
381
+ * Runs the manifest's own validation before returning, so an app is wrong here
382
+ * — where the error names a file — rather than at deploy.
383
+ *
384
+ * @throws {DuplicateConstruct} when two exports claim one id.
385
+ */
386
+ async function discover(options) {
387
+ const sandbox = options.sandbox ?? activeSandbox();
388
+ if (sandbox) {
389
+ if (!options.sources && !options.bustCache) {
390
+ const sandboxed = await discoverInSandbox(sandbox, options);
391
+ if (sandboxed) return sandboxed;
392
+ } else if (sandbox.isolating) throw new LiveConstructsUnavailable();
393
+ }
394
+ const { patterns, cwd = process.cwd(), bustCache = false, sources: out } = options;
395
+ if (bustCache) clearZodGlobalRegistry();
396
+ const manifest = {};
397
+ /** Which file declared each id, for the error when two of them do. */
398
+ const sources = {};
399
+ /**
400
+ * Constructs already seen, by identity.
401
+ *
402
+ * A re-export is the *same object* reached through a second file — ESM
403
+ * bindings are live, so `export * from './database.js'` hands back the
404
+ * binding rather than a copy. Without this, a barrel file made every
405
+ * construct in it appear declared twice, and `constructs/index.ts` is the
406
+ * first thing anyone writes in a shared folder.
407
+ *
408
+ * Identity rather than file is also the more honest rule: what may not
409
+ * happen twice is two *different* constructs claiming one id, and that is
410
+ * still an error below.
411
+ */
412
+ const seen = /* @__PURE__ */ new WeakSet();
413
+ const globs = Array.isArray(patterns) ? [...patterns] : [patterns];
414
+ const files = fg.stream(globs, {
415
+ cwd,
416
+ absolute: true
417
+ });
418
+ /** Matched files, for the diagnostic below. */
419
+ let matched = 0;
420
+ for await (const found of files) {
421
+ matched++;
422
+ const file = found.toString();
423
+ const module = await (bustCache ? import(`${file}?t=${Date.now()}`) : import(file));
424
+ for (const [exportName, exported] of Object.entries(module)) {
425
+ if (options.background) recordBackground(options.background, exported, file);
426
+ if (!isDeclarable(exported)) {
427
+ if (options.runnables) recordRunnable(options.runnables, exported);
428
+ continue;
429
+ }
430
+ if (seen.has(exported)) continue;
431
+ seen.add(exported);
432
+ if (options.runnables && typeof exported.owner === "string") recordRunnable(options.runnables, exported);
433
+ for (const declaration of exported.declare()) {
434
+ const id = canonicalId(declaration.id);
435
+ const source = relative(cwd, file);
436
+ const claimed = sources[id];
437
+ if (claimed !== void 0 && claimed !== source) throw new DuplicateConstruct(id, [claimed, source]);
438
+ manifest[id] = {
439
+ ...declaration,
440
+ id
441
+ };
442
+ sources[id] = source;
443
+ if (out) out[id] = {
444
+ file,
445
+ exportName,
446
+ construct: exported
447
+ };
448
+ }
449
+ }
450
+ }
451
+ assertDerivations(manifest);
452
+ warnIfNothingFound(globs, matched, Object.keys(manifest).length);
453
+ return manifest;
454
+ }
455
+ /**
456
+ * Record where a worker's background work is declared: a cron, a queue
457
+ * consumer or a topic subscriber, under the worker that owns it.
458
+ */
459
+ function recordBackground(background, exported, file) {
460
+ if (!Cron.isCron(exported) && !Queue.isQueue(exported) && !Subscriber.isSubscriber(exported)) return;
461
+ const owner = exported.owner;
462
+ if (typeof owner !== "string") return;
463
+ const key = canonicalId(owner);
464
+ const files = background[key] ?? [];
465
+ background[key] = files;
466
+ if (!files.includes(file)) files.push(file);
467
+ }
468
+ /**
469
+ * What a runnable consumes, by id: a queue's consumer drains that queue, a
470
+ * subscriber its topic. Nothing for anything else.
471
+ */
472
+ function consumedBy(runnable) {
473
+ if (Queue.isQueue(runnable)) return [runnable.id];
474
+ if (Subscriber.isSubscriber(runnable) && runnable.topicName) return [canonicalId(runnable.topicName)];
475
+ return [];
476
+ }
477
+ /**
478
+ * Record a runnable's edges under the construct that owns it — the surface an
479
+ * endpoint was built from, or the worker a cron or subscriber was. Anything
480
+ * with no owner, or that is not a runnable at all, is left alone.
481
+ */
482
+ function recordRunnable(runnables, exported) {
483
+ if (typeof exported !== "object" || exported === null) return;
484
+ const runnable = exported;
485
+ const owner = typeof runnable.surface?.id === "string" ? runnable.surface.id : typeof runnable.owner === "string" ? runnable.owner : void 0;
486
+ if (!owner || !Array.isArray(runnable.constructs)) return;
487
+ const key = canonicalId(owner);
488
+ const edges = runnables[key] ?? [];
489
+ runnables[key] = edges;
490
+ for (const id of [...runnable.constructs, ...consumedBy(exported)]) {
491
+ if (typeof id !== "string") continue;
492
+ const target = canonicalId(id);
493
+ if (!edges.includes(target)) edges.push(target);
494
+ }
495
+ }
496
+ /**
497
+ * Say so when a glob was configured and found nothing.
498
+ *
499
+ * The glob is not a filter over declarations already known — it is *how they
500
+ * are found*, by importing what it matches. So a file it misses is a
501
+ * declaration that does not exist, and every symptom of that appears somewhere
502
+ * other than the cause: no container starts, no env key is written, and the
503
+ * application fails on first use against a resource it can see in its own
504
+ * source.
505
+ *
506
+ * Nothing reported it before, because an unmatched file is indistinguishable
507
+ * from a file nobody wrote. These two cases are the ones that are *not*
508
+ * ambiguous — a glob was configured, so something was expected.
509
+ *
510
+ * Silent when no glob is configured at all: that is a project which has not
511
+ * adopted constructs, and has nothing to be missing.
512
+ */
513
+ function warnIfNothingFound(globs, matched, declared) {
514
+ if (globs.length === 0) return;
515
+ if (matched === 0) {
516
+ logger.warn(`\n⚠️ The constructs glob matched no files, so nothing was declared.\n Patterns: ${globs.join(", ")}\n Nothing will be provisioned — no containers, no env keys, no resources.\n A common cause is depth: '*.ts' matches one level, '**/*.ts' matches any.`);
517
+ return;
518
+ }
519
+ if (declared === 0) logger.warn(`\n⚠️ The constructs glob matched ${matched} file(s) but none declared anything.\n Patterns: ${globs.join(", ")}\n Discovery keeps exports with an 'id' that can 'declare()'. A construct that is\n built but never exported is invisible to it.`);
520
+ }
521
+ /** Two constructs claiming one id. */
522
+ var DuplicateConstruct = class extends GkmError {
523
+ /** The id claimed twice. */
524
+ id;
525
+ /** The files that claimed it. */
526
+ sources;
527
+ constructor(id, sources) {
528
+ super("Two constructs declare the same id");
529
+ this.name = "DuplicateConstruct";
530
+ this.id = id;
531
+ this.sources = sources;
532
+ }
533
+ };
534
+ //#endregion
535
+ export { discover_exports as a, nodeWithTsx as c, ConstructGenerator as d, output as f, discover as i, runWorker as l, ConstructsNotSerializable as n, isDeclarable as o, withOutput as p, consumedBy as r, SandboxWorkerFailed as s, ConstructDiscoveryFailed as t, withOwningTsconfigJsx as u };
536
+
537
+ //# sourceMappingURL=discover-Ca8U75dl.mjs.map