@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":"emit-Dmc1nvdS.cjs","names":["provideKey","canonicalId"],"sources":["../src/reconcile/emit.ts"],"sourcesContent":["/**\n * The manifest, written out as a module.\n *\n * Discovery imports the application's own code — that is how it finds\n * constructs — so anything calling it evaluates the whole runtime graph: React\n * email templates, database clients, modules that read env at import time. That\n * is fine inside `gkm dev`, which is already running the app. It is not fine\n * inside a deploy config, where it fails on the first thing the deploy toolchain\n * does not expect and would keep failing on the next.\n *\n * So discovery happens once, in the build, and everything downstream reads what\n * it wrote. The same split `RestApi` makes by naming a routes glob rather than\n * importing route modules.\n *\n * A module rather than JSON, because a manifest is not just data to this\n * codebase — `as const satisfies ConstructManifest` is what keeps every id,\n * kind and provided key a *literal*, so `IdsOf`, `ProvidedKeys` and the rest\n * can select out of it. `JSON.parse` returns `any` and gives all of that up.\n */\n\nimport type {\n\tConstructManifest,\n\tCronInfo,\n\tDeclaration,\n\tDependency,\n\tFunctionInfo,\n\tQueueInfo,\n\tRestApiEndpoint,\n\tRouteInfo,\n\tSubscriberInfo,\n} from '@geekmidas/manifest';\nimport { canonicalId, provideKey } from '@geekmidas/manifest';\nimport type { CacheBackend, EmailBackend } from '../types.js';\n\n/**\n * Fold the build's generated routes into the surface that serves them.\n *\n * The routes already exist: `gkm build` generates one handler per endpoint and\n * records its path, method and environment. What was missing is that the\n * *construct* manifest never learned about them, so a `rest-api` node said\n * `endpoints: []` while five handlers sat in `.gkm/`. Two documents describing\n * the same routes, one of them wrong.\n *\n * Merging here rather than making the construct name a glob or import its\n * endpoints: the build is the thing that already walked the filesystem and\n * already knows where it wrote each handler. Asking the declaration to restate\n * any of that is how the two come to disagree.\n *\n * Attribution is to the surface the build served — the one whose `path` is\n * the app being built. Without one, routes go to the surface that declared none\n * of its own; a surface with static endpoints (an auth server's single\n * wildcard) keeps them.\n *\n * **Only from a provider that generates one handler per route.** The `server`\n * provider generates a single catch-all — `ALL *` pointing at the Hono app that\n * routes in-process — which is a true description of that build and a false\n * description of the application. Merging it wrote `endpoints: [{ method:\n * 'ALL', path: '*' }]` into a manifest for an app with five routes, and made the\n * document's contents depend on which `--provider` ran last. A manifest must not\n * do that.\n */\nexport function withRoutes(\n\tmanifest: ConstructManifest,\n\troutes: readonly RouteInfo[],\n\toptions: { perRoute: boolean; surface?: string },\n): ConstructManifest {\n\tif (routes.length === 0 || !options.perRoute) return manifest;\n\n\tconst target = Object.entries(manifest).find(([id, declaration]) =>\n\t\toptions.surface\n\t\t\t? id === options.surface\n\t\t\t: declaration.kind === 'rest-api' && declaration.endpoints.length === 0,\n\t);\n\n\tif (!target) return manifest;\n\n\tconst [id, declaration] = target;\n\tif (declaration.kind !== 'rest-api') return manifest;\n\n\treturn {\n\t\t...manifest,\n\t\t[id]: {\n\t\t\t...declaration,\n\t\t\tendpoints: routes.map((route) => asEndpoint(manifest, id, route)),\n\t\t},\n\t};\n}\n\n/**\n * Fold in the compute the build generated: functions, crons, queue workers and\n * topic subscribers.\n *\n * All four are named by their *export*, the same way an endpoint's handler is —\n * `CronGenerator` uses the export key as the name — so none of them can declare\n * themselves and all of them are the build's to add. That is why a `Function`\n * has no `declare()` and never will.\n *\n * A worker and a subscriber **nest** inside the queue or topic that triggers\n * them, because position carries the trigger. A function and a cron are\n * top-level, because nothing triggers them but a caller or a clock.\n */\nexport function withCompute(\n\tmanifest: ConstructManifest,\n\tcompute: {\n\t\tfunctions?: readonly FunctionInfo[];\n\t\tcrons?: readonly CronInfo[];\n\t\tqueues?: readonly QueueInfo[];\n\t\tsubscribers?: readonly SubscriberInfo[];\n\t},\n): ConstructManifest {\n\tconst next: Record<string, Declaration> = { ...manifest };\n\n\tfor (const fn of compute.functions ?? []) {\n\t\tnext[fn.name] = {\n\t\t\tkind: 'function',\n\t\t\tid: fn.name,\n\t\t\thandler: fn.handler,\n\t\t\tdependencies: edgesTo(manifest, fn.dependencies),\n\t\t\tprovides: [provideKey(fn.name, 'url')],\n\t\t};\n\t}\n\n\tfor (const cron of compute.crons ?? []) {\n\t\tnext[cron.name] = {\n\t\t\tkind: 'cron',\n\t\t\tid: cron.name,\n\t\t\thandler: cron.handler,\n\t\t\tschedule: cron.schedule,\n\t\t\tdependencies: edgesTo(manifest, cron.dependencies),\n\t\t};\n\t}\n\n\t// A worker drains exactly one queue, so it is matched by the queue it names\n\t// rather than by anything about the handler.\n\tfor (const worker of compute.queues ?? []) {\n\t\tconst queue = next[canonicalId(worker.name)];\n\t\tif (queue?.kind !== 'queue') continue;\n\n\t\tnext[queue.id] = {\n\t\t\t...queue,\n\t\t\tworker: {\n\t\t\t\tid: `${queue.id}Worker`,\n\t\t\t\thandler: worker.handler,\n\t\t\t\tdependencies: edgesTo(manifest, worker.dependencies),\n\t\t\t},\n\t\t};\n\t}\n\n\tfor (const subscriber of compute.subscribers ?? []) {\n\t\tconst topicId = subscriber.topic && canonicalId(subscriber.topic);\n\t\tconst topic = topicId ? next[topicId] : undefined;\n\t\tif (topic?.kind !== 'topic') continue;\n\n\t\tnext[topic.id] = {\n\t\t\t...topic,\n\t\t\tsubscribers: [\n\t\t\t\t...topic.subscribers,\n\t\t\t\t{\n\t\t\t\t\tid: subscriber.name,\n\t\t\t\t\thandler: subscriber.handler,\n\t\t\t\t\tevents: subscriber.subscribedEvents,\n\t\t\t\t\tdependencies: edgesTo(manifest, subscriber.dependencies),\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t}\n\n\treturn next;\n}\n\n/**\n * Construct ids as manifest edges.\n *\n * A `Dependency` carries the target's kind as well as its id, and the kind is\n * read off the manifest rather than recorded beside the edge — the same rule\n * `edgeTo` follows, for the same reason: a hand-written kind is one fact stated\n * twice, and the copy is what goes stale.\n *\n * An id that names nothing is dropped rather than thrown on. A handler can\n * depend on a construct that declares no node of its own — a lifted `Service`\n * is exactly that — and a build is the wrong place to refuse it; what a target\n * needs from this list is the subset it can actually grant.\n */\nfunction edgesTo(\n\tmanifest: ConstructManifest,\n\tids: readonly string[] = [],\n): Dependency[] {\n\treturn ids.flatMap((target) => {\n\t\tconst declaration = manifest[target];\n\n\t\treturn declaration ? [{ target, kind: declaration.kind }] : [];\n\t});\n}\n\n/** One generated route as the manifest's shape. */\nfunction asEndpoint(\n\tmanifest: ConstructManifest,\n\tsurface: string,\n\troute: RouteInfo,\n): RestApiEndpoint {\n\treturn {\n\t\t// The handler path is already unique per route and is what a target needs\n\t\t// to point a function at, so it is also the natural id.\n\t\tid: `${surface}${route.method}${route.path}`,\n\t\thandler: route.handler,\n\t\tmethod: route.method,\n\t\tpath: route.path,\n\t\t// The edges the handler declared, which is what a target reads to grant\n\t\t// this one function access to exactly those constructs. `environment` is\n\t\t// the same edges' shadow — the keys read — and cannot be turned back into\n\t\t// them, which is why the ids are carried rather than inferred.\n\t\tdependencies: edgesTo(manifest, route.dependencies),\n\t\t...(route.authorizer ? { authorizer: route.authorizer } : {}),\n\t};\n}\n\n/**\n * The manifest as TypeScript source.\n *\n * Pure, so what gets written can be asserted without touching a filesystem.\n */\nexport function manifestModule(\n\tmanifest: ConstructManifest,\n\tbackends: Backends = {},\n): string {\n\treturn `${HEADER}\nexport const constructs = ${serialise(manifest)} as const satisfies ConstructManifest;\n\n/**\n * Where the backends that are *config* rather than declaration resolved to.\n *\n * Recorded because they were being answered twice: once by the build, which\n * registers exactly one cache driver, and once by a deploy config, which told\n * the provisioner something else. The result was a deployed URL the running code\n * had no driver for — two documents disagreeing about one fact, which is what\n * this manifest exists to stop.\n */\nexport const backends = ${serialise(backends)} as const;\n\n// Derived types\nexport type Ids = IdsOf<typeof constructs>;\nexport type Construct<Id extends Ids> = DeclarationOf<typeof constructs, Id>;\nexport type Kind = Construct<Ids>['kind'];\n\n// Useful union types\nexport type ProvidedKeys = AllProvidedKeys<typeof constructs>;\nexport type Surfaces = IdsOfKind<typeof constructs, 'rest-api'>;\nexport type CacheBackend = (typeof backends)['cache'];\nexport type EmailBackend = (typeof backends)['email'];\n`;\n}\n\n/** The choices that are deployment config rather than declaration. */\nexport interface Backends {\n\tcache?: CacheBackend;\n\temail?: EmailBackend;\n}\n\nconst HEADER = `// Generated by \\`gkm build\\`. Do not edit.\n//\n// Discovery imports application code, so it runs once here rather than in every\n// consumer — a deploy config that discovered for itself would evaluate the whole\n// runtime graph inside its own toolchain. This is the result, as literals.\n\nimport type {\n\tAllProvidedKeys,\n\tConstructManifest,\n\tDeclarationOf,\n\tIdsOf,\n\tIdsOfKind,\n} from '@geekmidas/manifest';\n`;\n\n/**\n * JSON, re-indented with tabs and with keys left unquoted where they can be.\n *\n * Cosmetic, and worth it: this file is read by people trying to work out what\n * their app declares, and a wall of quoted keys reads as output rather than as\n * something anyone is expected to understand.\n */\nfunction serialise(value: object): string {\n\treturn JSON.stringify(value, null, '\\t')\n\t\t.replace(/^(\\t*)\"([A-Za-z_$][\\w$]*)\":/gm, '$1$2:')\n\t\t.replace(/\"/g, \"'\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,SAAgB,WACf,UACA,QACA,SACoB;CACpB,IAAI,OAAO,WAAW,KAAK,CAAC,QAAQ,UAAU,OAAO;CAErD,MAAM,SAAS,OAAO,QAAQ,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,iBAClD,QAAQ,UACL,OAAO,QAAQ,UACf,YAAY,SAAS,cAAc,YAAY,UAAU,WAAW,CACxE;CAEA,IAAI,CAAC,QAAQ,OAAO;CAEpB,MAAM,CAAC,IAAI,eAAe;CAC1B,IAAI,YAAY,SAAS,YAAY,OAAO;CAE5C,OAAO;EACN,GAAG;GACF,KAAK;GACL,GAAG;GACH,WAAW,OAAO,KAAK,UAAU,WAAW,UAAU,IAAI,KAAK,CAAC;EACjE;CACD;AACD;;;;;;;;;;;;;;AAeA,SAAgB,YACf,UACA,SAMoB;CACpB,MAAM,OAAoC,EAAE,GAAG,SAAS;CAExD,KAAK,MAAM,MAAM,QAAQ,aAAa,CAAC,GACtC,KAAK,GAAG,QAAQ;EACf,MAAM;EACN,IAAI,GAAG;EACP,SAAS,GAAG;EACZ,cAAc,QAAQ,UAAU,GAAG,YAAY;EAC/C,UAAU,EAAA,GAACA,oBAAAA,WAAAA,CAAW,GAAG,MAAM,KAAK,CAAC;CACtC;CAGD,KAAK,MAAM,QAAQ,QAAQ,SAAS,CAAC,GACpC,KAAK,KAAK,QAAQ;EACjB,MAAM;EACN,IAAI,KAAK;EACT,SAAS,KAAK;EACd,UAAU,KAAK;EACf,cAAc,QAAQ,UAAU,KAAK,YAAY;CAClD;CAKD,KAAK,MAAM,UAAU,QAAQ,UAAU,CAAC,GAAG;EAC1C,MAAM,QAAQ,MAAA,GAAKC,oBAAAA,YAAAA,CAAY,OAAO,IAAI;EAC1C,IAAI,OAAO,SAAS,SAAS;EAE7B,KAAK,MAAM,MAAM;GAChB,GAAG;GACH,QAAQ;IACP,IAAI,GAAG,MAAM,GAAG;IAChB,SAAS,OAAO;IAChB,cAAc,QAAQ,UAAU,OAAO,YAAY;GACpD;EACD;CACD;CAEA,KAAK,MAAM,cAAc,QAAQ,eAAe,CAAC,GAAG;EACnD,MAAM,UAAU,WAAW,UAAA,GAASA,oBAAAA,YAAAA,CAAY,WAAW,KAAK;EAChE,MAAM,QAAQ,UAAU,KAAK,WAAW,KAAA;EACxC,IAAI,OAAO,SAAS,SAAS;EAE7B,KAAK,MAAM,MAAM;GAChB,GAAG;GACH,aAAa,CACZ,GAAG,MAAM,aACT;IACC,IAAI,WAAW;IACf,SAAS,WAAW;IACpB,QAAQ,WAAW;IACnB,cAAc,QAAQ,UAAU,WAAW,YAAY;GACxD,CACD;EACD;CACD;CAEA,OAAO;AACR;;;;;;;;;;;;;;AAeA,SAAS,QACR,UACA,MAAyB,CAAC,GACX;CACf,OAAO,IAAI,SAAS,WAAW;EAC9B,MAAM,cAAc,SAAS;EAE7B,OAAO,cAAc,CAAC;GAAE;GAAQ,MAAM,YAAY;EAAK,CAAC,IAAI,CAAC;CAC9D,CAAC;AACF;;AAGA,SAAS,WACR,UACA,SACA,OACkB;CAClB,OAAO;EAGN,IAAI,GAAG,UAAU,MAAM,SAAS,MAAM;EACtC,SAAS,MAAM;EACf,QAAQ,MAAM;EACd,MAAM,MAAM;EAKZ,cAAc,QAAQ,UAAU,MAAM,YAAY;EAClD,GAAI,MAAM,aAAa,EAAE,YAAY,MAAM,WAAW,IAAI,CAAC;CAC5D;AACD;;;;;;AAOA,SAAgB,eACf,UACA,WAAqB,CAAC,GACb;CACT,OAAO,GAAG,OAAO;4BACU,UAAU,QAAQ,EAAE;;;;;;;;;;;0BAWtB,UAAU,QAAQ,EAAE;;;;;;;;;;;;;AAa9C;AAQA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;AAsBf,SAAS,UAAU,OAAuB;CACzC,OAAO,KAAK,UAAU,OAAO,MAAM,GAAI,CAAC,CACtC,QAAQ,iCAAiC,OAAO,CAAC,CACjD,QAAQ,MAAM,GAAG;AACpB"}
@@ -0,0 +1,89 @@
1
+ import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
2
+ import { N as assertDeployedStage } from "./workspace-D1QbNd55.mjs";
3
+ import { It as secretsStoreFor, Tt as providerOf, Ut as withCustomSecret } from "./seeds-CIk0l4SC.mjs";
4
+ import { loadWorkspaceSettings } from "./config.mjs";
5
+ import { canonicalId, provideKey } from "@geekmidas/manifest";
6
+ import { parseKeyring, retireKey, rotateKeyring } from "@geekmidas/constructs/encryption";
7
+ //#region src/encryption/index.ts
8
+ /**
9
+ * `gkm encryption:rotate` and `gkm encryption:retire` — the keyring of an
10
+ * `Encryption` construct on a server stage.
11
+ *
12
+ * Rotating adds a key in front and keeps every older one, so what they wrote
13
+ * still opens. Retiring removes one, and is the half that makes rotating worth
14
+ * doing: until a key is gone, it still opens everything it ever wrote. It is
15
+ * never automatic, because the only thing that knows nothing is left under a
16
+ * key is the sweep that re-encrypted the column — so it is done after one,
17
+ * deliberately, by name.
18
+ *
19
+ * Neither applies everywhere, and each says so rather than doing something
20
+ * that looks right: a local stage's keyring is derived and would be replaced on
21
+ * the next `gkm dev`, and on AWS the key is KMS's, which rotates it itself and
22
+ * never strands a value.
23
+ */
24
+ const logger = console;
25
+ var LocalKeyringIsDerived = class extends GkmError {
26
+ construct;
27
+ stage;
28
+ constructor(construct, stage) {
29
+ super(`'${stage}' is the local stage, where ${construct}'s keyring is derived from the project and stage — nothing stored there would be read. Rotate a deployed stage: gkm encryption:rotate ${construct} --stage <stage>.`);
30
+ this.construct = construct;
31
+ this.stage = stage;
32
+ this.name = "LocalKeyringIsDerived";
33
+ }
34
+ };
35
+ var KmsRotatesItself = class extends GkmError {
36
+ construct;
37
+ constructor(construct) {
38
+ super(`${construct} is a KMS key on AWS: KMS rotates it yearly and keeps every version, so no value is ever stranded and there is no key to retire. Nothing to do here.`);
39
+ this.construct = construct;
40
+ this.name = "KmsRotatesItself";
41
+ }
42
+ };
43
+ var NoKeyringYet = class extends GkmError {
44
+ construct;
45
+ stage;
46
+ key;
47
+ constructor(construct, stage, key) {
48
+ super(`'${stage}' has no ${key} yet. The first deploy generates ${construct}'s keyring: gkm deploy --stage ${stage}.`);
49
+ this.construct = construct;
50
+ this.stage = stage;
51
+ this.key = key;
52
+ this.name = "NoKeyringYet";
53
+ }
54
+ };
55
+ async function encryptionRotateCommand(construct, options, context = {}) {
56
+ return updateKeyring(construct, options, context, (id, url) => {
57
+ const next = rotateKeyring(id, url);
58
+ const [current, ...older] = parseKeyring(id, next).keys.map(({ id }) => id);
59
+ logger.log(`\n✓ ${id} on '${options.stage}' now writes with '${current}'.`);
60
+ logger.log(` Still opening: ${older.join(", ")}. Redeploy to start writing with '${current}', reencrypt what is stored, then: gkm encryption:retire ${id} <key> --stage ${options.stage}`);
61
+ return next;
62
+ });
63
+ }
64
+ async function encryptionRetireCommand(construct, keyId, options, context = {}) {
65
+ return updateKeyring(construct, options, context, (id, url) => {
66
+ const next = retireKey(id, url, keyId);
67
+ logger.log(`\n✓ ${id} on '${options.stage}' no longer holds '${keyId}'. Anything still under it cannot be read after the next deploy.`);
68
+ return next;
69
+ });
70
+ }
71
+ async function updateKeyring(construct, { stage }, context, update) {
72
+ const workspace = context.workspace ?? await loadWorkspaceSettings();
73
+ const id = canonicalId(construct);
74
+ if (stage === workspace.stages.local) throw new LocalKeyringIsDerived(id, stage);
75
+ assertDeployedStage(workspace.stages, stage);
76
+ if (providerOf(workspace) === "aws") throw new KmsRotatesItself(id);
77
+ const store = context.store ?? await secretsStoreFor(workspace, stage);
78
+ const key = provideKey(id, "url");
79
+ const secrets = await store.read(stage);
80
+ const url = secrets?.custom[key];
81
+ if (!secrets || !url) throw new NoKeyringYet(id, stage, key);
82
+ const next = update(id, url);
83
+ await store.write(stage, withCustomSecret(secrets, key, next));
84
+ return next;
85
+ }
86
+ //#endregion
87
+ export { encryptionRetireCommand, encryptionRotateCommand };
88
+
89
+ //# sourceMappingURL=encryption-DJv_jEXi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encryption-DJv_jEXi.mjs","names":[],"sources":["../src/encryption/index.ts"],"sourcesContent":["/**\n * `gkm encryption:rotate` and `gkm encryption:retire` — the keyring of an\n * `Encryption` construct on a server stage.\n *\n * Rotating adds a key in front and keeps every older one, so what they wrote\n * still opens. Retiring removes one, and is the half that makes rotating worth\n * doing: until a key is gone, it still opens everything it ever wrote. It is\n * never automatic, because the only thing that knows nothing is left under a\n * key is the sweep that re-encrypted the column — so it is done after one,\n * deliberately, by name.\n *\n * Neither applies everywhere, and each says so rather than doing something\n * that looks right: a local stage's keyring is derived and would be replaced on\n * the next `gkm dev`, and on AWS the key is KMS's, which rotates it itself and\n * never strands a value.\n */\n\nimport {\n\tparseKeyring,\n\tretireKey,\n\trotateKeyring,\n} from '@geekmidas/constructs/encryption';\nimport { canonicalId, provideKey } from '@geekmidas/manifest';\nimport { loadWorkspaceSettings } from '../config';\nimport { GkmError } from '../errors';\nimport { withCustomSecret } from '../secrets/storage.js';\nimport { type SecretsStore, secretsStoreFor } from '../secrets/store.js';\nimport { providerOf } from '../workspace/backends.js';\nimport { assertDeployedStage } from '../workspace/stages.js';\nimport type { NormalizedWorkspace } from '../workspace/types.js';\n\nconst logger = console;\n\nexport class LocalKeyringIsDerived extends GkmError {\n\tconstructor(\n\t\treadonly construct: string,\n\t\treadonly stage: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' is the local stage, where ${construct}'s keyring is derived from the project and stage — nothing stored there would be read. Rotate a deployed stage: gkm encryption:rotate ${construct} --stage <stage>.`,\n\t\t);\n\t\tthis.name = 'LocalKeyringIsDerived';\n\t}\n}\n\nexport class KmsRotatesItself extends GkmError {\n\tconstructor(readonly construct: string) {\n\t\tsuper(\n\t\t\t`${construct} is a KMS key on AWS: KMS rotates it yearly and keeps every version, so no value is ever stranded and there is no key to retire. Nothing to do here.`,\n\t\t);\n\t\tthis.name = 'KmsRotatesItself';\n\t}\n}\n\nexport class NoKeyringYet extends GkmError {\n\tconstructor(\n\t\treadonly construct: string,\n\t\treadonly stage: string,\n\t\treadonly key: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' has no ${key} yet. The first deploy generates ${construct}'s keyring: gkm deploy --stage ${stage}.`,\n\t\t);\n\t\tthis.name = 'NoKeyringYet';\n\t}\n}\n\nexport interface EncryptionCommandOptions {\n\tstage: string;\n}\n\n/** Where a command reads and writes; the real ones unless a test says. */\nexport interface EncryptionCommandContext {\n\tworkspace?: NormalizedWorkspace;\n\tstore?: SecretsStore;\n}\n\nexport async function encryptionRotateCommand(\n\tconstruct: string,\n\toptions: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext = {},\n): Promise<string> {\n\treturn updateKeyring(construct, options, context, (id, url) => {\n\t\tconst next = rotateKeyring(id, url);\n\t\tconst [current, ...older] = parseKeyring(id, next).keys.map(({ id }) => id);\n\n\t\tlogger.log(`\\n✓ ${id} on '${options.stage}' now writes with '${current}'.`);\n\t\tlogger.log(\n\t\t\t` Still opening: ${older.join(', ')}. Redeploy to start writing with '${current}', reencrypt what is stored, then: gkm encryption:retire ${id} <key> --stage ${options.stage}`,\n\t\t);\n\t\treturn next;\n\t});\n}\n\nexport async function encryptionRetireCommand(\n\tconstruct: string,\n\tkeyId: string,\n\toptions: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext = {},\n): Promise<string> {\n\treturn updateKeyring(construct, options, context, (id, url) => {\n\t\tconst next = retireKey(id, url, keyId);\n\n\t\tlogger.log(\n\t\t\t`\\n✓ ${id} on '${options.stage}' no longer holds '${keyId}'. Anything still under it cannot be read after the next deploy.`,\n\t\t);\n\t\treturn next;\n\t});\n}\n\nasync function updateKeyring(\n\tconstruct: string,\n\t{ stage }: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext,\n\tupdate: (id: string, url: string) => string,\n): Promise<string> {\n\tconst workspace = context.workspace ?? (await loadWorkspaceSettings());\n\tconst id = canonicalId(construct);\n\n\tif (stage === workspace.stages.local) {\n\t\tthrow new LocalKeyringIsDerived(id, stage);\n\t}\n\tassertDeployedStage(workspace.stages, stage);\n\tif (providerOf(workspace) === 'aws') throw new KmsRotatesItself(id);\n\n\tconst store = context.store ?? (await secretsStoreFor(workspace, stage));\n\tconst key = provideKey(id, 'url');\n\tconst secrets = await store.read(stage);\n\tconst url = secrets?.custom[key];\n\tif (!secrets || !url) throw new NoKeyringYet(id, stage, key);\n\n\tconst next = update(id, url);\n\tawait store.write(stage, withCustomSecret(secrets, key, next));\n\treturn next;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,SAAS;AAEf,IAAa,wBAAb,cAA2C,SAAS;CAEzC;CACA;CAFV,YACC,WACA,OACC;EACD,MACC,IAAI,MAAM,8BAA8B,UAAU,wIAAwI,UAAU,kBACrM;EALS,KAAA,YAAA;EACA,KAAA,QAAA;EAKT,KAAK,OAAO;CACb;AACD;AAEA,IAAa,mBAAb,cAAsC,SAAS;CACzB;CAArB,YAAY,WAA4B;EACvC,MACC,GAAG,UAAU,qJACd;EAHoB,KAAA,YAAA;EAIpB,KAAK,OAAO;CACb;AACD;AAEA,IAAa,eAAb,cAAkC,SAAS;CAEhC;CACA;CACA;CAHV,YACC,WACA,OACA,KACC;EACD,MACC,IAAI,MAAM,WAAW,IAAI,mCAAmC,UAAU,iCAAiC,MAAM,EAC9G;EANS,KAAA,YAAA;EACA,KAAA,QAAA;EACA,KAAA,MAAA;EAKT,KAAK,OAAO;CACb;AACD;AAYA,eAAsB,wBACrB,WACA,SACA,UAAoC,CAAC,GACnB;CAClB,OAAO,cAAc,WAAW,SAAS,UAAU,IAAI,QAAQ;EAC9D,MAAM,OAAO,cAAc,IAAI,GAAG;EAClC,MAAM,CAAC,SAAS,GAAG,SAAS,aAAa,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,EAAE,SAAS,EAAE;EAE1E,OAAO,IAAI,OAAO,GAAG,OAAO,QAAQ,MAAM,qBAAqB,QAAQ,GAAG;EAC1E,OAAO,IACN,oBAAoB,MAAM,KAAK,IAAI,EAAE,oCAAoC,QAAQ,2DAA2D,GAAG,iBAAiB,QAAQ,OACzK;EACA,OAAO;CACR,CAAC;AACF;AAEA,eAAsB,wBACrB,WACA,OACA,SACA,UAAoC,CAAC,GACnB;CAClB,OAAO,cAAc,WAAW,SAAS,UAAU,IAAI,QAAQ;EAC9D,MAAM,OAAO,UAAU,IAAI,KAAK,KAAK;EAErC,OAAO,IACN,OAAO,GAAG,OAAO,QAAQ,MAAM,qBAAqB,MAAM,iEAC3D;EACA,OAAO;CACR,CAAC;AACF;AAEA,eAAe,cACd,WACA,EAAE,SACF,SACA,QACkB;CAClB,MAAM,YAAY,QAAQ,aAAc,MAAM,sBAAsB;CACpE,MAAM,KAAK,YAAY,SAAS;CAEhC,IAAI,UAAU,UAAU,OAAO,OAC9B,MAAM,IAAI,sBAAsB,IAAI,KAAK;CAE1C,oBAAoB,UAAU,QAAQ,KAAK;CAC3C,IAAI,WAAW,SAAS,MAAM,OAAO,MAAM,IAAI,iBAAiB,EAAE;CAElE,MAAM,QAAQ,QAAQ,SAAU,MAAM,gBAAgB,WAAW,KAAK;CACtE,MAAM,MAAM,WAAW,IAAI,KAAK;CAChC,MAAM,UAAU,MAAM,MAAM,KAAK,KAAK;CACtC,MAAM,MAAM,SAAS,OAAO;CAC5B,IAAI,CAAC,WAAW,CAAC,KAAK,MAAM,IAAI,aAAa,IAAI,OAAO,GAAG;CAE3D,MAAM,OAAO,OAAO,IAAI,GAAG;CAC3B,MAAM,MAAM,MAAM,OAAO,iBAAiB,SAAS,KAAK,IAAI,CAAC;CAC7D,OAAO;AACR"}
@@ -0,0 +1,90 @@
1
+ const require_errors = require("./errors-DMC4Umsb.cjs");
2
+ const require_workspace = require("./workspace-BwqQnool.cjs");
3
+ const require_seeds = require("./seeds-Dk8YkLkM.cjs");
4
+ const require_config = require("./config.cjs");
5
+ let _geekmidas_manifest = require("@geekmidas/manifest");
6
+ let _geekmidas_constructs_encryption = require("@geekmidas/constructs/encryption");
7
+ //#region src/encryption/index.ts
8
+ /**
9
+ * `gkm encryption:rotate` and `gkm encryption:retire` — the keyring of an
10
+ * `Encryption` construct on a server stage.
11
+ *
12
+ * Rotating adds a key in front and keeps every older one, so what they wrote
13
+ * still opens. Retiring removes one, and is the half that makes rotating worth
14
+ * doing: until a key is gone, it still opens everything it ever wrote. It is
15
+ * never automatic, because the only thing that knows nothing is left under a
16
+ * key is the sweep that re-encrypted the column — so it is done after one,
17
+ * deliberately, by name.
18
+ *
19
+ * Neither applies everywhere, and each says so rather than doing something
20
+ * that looks right: a local stage's keyring is derived and would be replaced on
21
+ * the next `gkm dev`, and on AWS the key is KMS's, which rotates it itself and
22
+ * never strands a value.
23
+ */
24
+ const logger = console;
25
+ var LocalKeyringIsDerived = class extends require_errors.GkmError {
26
+ construct;
27
+ stage;
28
+ constructor(construct, stage) {
29
+ super(`'${stage}' is the local stage, where ${construct}'s keyring is derived from the project and stage — nothing stored there would be read. Rotate a deployed stage: gkm encryption:rotate ${construct} --stage <stage>.`);
30
+ this.construct = construct;
31
+ this.stage = stage;
32
+ this.name = "LocalKeyringIsDerived";
33
+ }
34
+ };
35
+ var KmsRotatesItself = class extends require_errors.GkmError {
36
+ construct;
37
+ constructor(construct) {
38
+ super(`${construct} is a KMS key on AWS: KMS rotates it yearly and keeps every version, so no value is ever stranded and there is no key to retire. Nothing to do here.`);
39
+ this.construct = construct;
40
+ this.name = "KmsRotatesItself";
41
+ }
42
+ };
43
+ var NoKeyringYet = class extends require_errors.GkmError {
44
+ construct;
45
+ stage;
46
+ key;
47
+ constructor(construct, stage, key) {
48
+ super(`'${stage}' has no ${key} yet. The first deploy generates ${construct}'s keyring: gkm deploy --stage ${stage}.`);
49
+ this.construct = construct;
50
+ this.stage = stage;
51
+ this.key = key;
52
+ this.name = "NoKeyringYet";
53
+ }
54
+ };
55
+ async function encryptionRotateCommand(construct, options, context = {}) {
56
+ return updateKeyring(construct, options, context, (id, url) => {
57
+ const next = (0, _geekmidas_constructs_encryption.rotateKeyring)(id, url);
58
+ const [current, ...older] = (0, _geekmidas_constructs_encryption.parseKeyring)(id, next).keys.map(({ id }) => id);
59
+ logger.log(`\n✓ ${id} on '${options.stage}' now writes with '${current}'.`);
60
+ logger.log(` Still opening: ${older.join(", ")}. Redeploy to start writing with '${current}', reencrypt what is stored, then: gkm encryption:retire ${id} <key> --stage ${options.stage}`);
61
+ return next;
62
+ });
63
+ }
64
+ async function encryptionRetireCommand(construct, keyId, options, context = {}) {
65
+ return updateKeyring(construct, options, context, (id, url) => {
66
+ const next = (0, _geekmidas_constructs_encryption.retireKey)(id, url, keyId);
67
+ logger.log(`\n✓ ${id} on '${options.stage}' no longer holds '${keyId}'. Anything still under it cannot be read after the next deploy.`);
68
+ return next;
69
+ });
70
+ }
71
+ async function updateKeyring(construct, { stage }, context, update) {
72
+ const workspace = context.workspace ?? await require_config.loadWorkspaceSettings();
73
+ const id = (0, _geekmidas_manifest.canonicalId)(construct);
74
+ if (stage === workspace.stages.local) throw new LocalKeyringIsDerived(id, stage);
75
+ require_workspace.assertDeployedStage(workspace.stages, stage);
76
+ if (require_seeds.providerOf(workspace) === "aws") throw new KmsRotatesItself(id);
77
+ const store = context.store ?? await require_seeds.secretsStoreFor(workspace, stage);
78
+ const key = (0, _geekmidas_manifest.provideKey)(id, "url");
79
+ const secrets = await store.read(stage);
80
+ const url = secrets?.custom[key];
81
+ if (!secrets || !url) throw new NoKeyringYet(id, stage, key);
82
+ const next = update(id, url);
83
+ await store.write(stage, require_seeds.withCustomSecret(secrets, key, next));
84
+ return next;
85
+ }
86
+ //#endregion
87
+ exports.encryptionRetireCommand = encryptionRetireCommand;
88
+ exports.encryptionRotateCommand = encryptionRotateCommand;
89
+
90
+ //# sourceMappingURL=encryption-DoVnVU82.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encryption-DoVnVU82.cjs","names":["GkmError","rotateKeyring","parseKeyring","retireKey","loadWorkspaceSettings","canonicalId","providerOf","secretsStoreFor","provideKey","withCustomSecret"],"sources":["../src/encryption/index.ts"],"sourcesContent":["/**\n * `gkm encryption:rotate` and `gkm encryption:retire` — the keyring of an\n * `Encryption` construct on a server stage.\n *\n * Rotating adds a key in front and keeps every older one, so what they wrote\n * still opens. Retiring removes one, and is the half that makes rotating worth\n * doing: until a key is gone, it still opens everything it ever wrote. It is\n * never automatic, because the only thing that knows nothing is left under a\n * key is the sweep that re-encrypted the column — so it is done after one,\n * deliberately, by name.\n *\n * Neither applies everywhere, and each says so rather than doing something\n * that looks right: a local stage's keyring is derived and would be replaced on\n * the next `gkm dev`, and on AWS the key is KMS's, which rotates it itself and\n * never strands a value.\n */\n\nimport {\n\tparseKeyring,\n\tretireKey,\n\trotateKeyring,\n} from '@geekmidas/constructs/encryption';\nimport { canonicalId, provideKey } from '@geekmidas/manifest';\nimport { loadWorkspaceSettings } from '../config';\nimport { GkmError } from '../errors';\nimport { withCustomSecret } from '../secrets/storage.js';\nimport { type SecretsStore, secretsStoreFor } from '../secrets/store.js';\nimport { providerOf } from '../workspace/backends.js';\nimport { assertDeployedStage } from '../workspace/stages.js';\nimport type { NormalizedWorkspace } from '../workspace/types.js';\n\nconst logger = console;\n\nexport class LocalKeyringIsDerived extends GkmError {\n\tconstructor(\n\t\treadonly construct: string,\n\t\treadonly stage: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' is the local stage, where ${construct}'s keyring is derived from the project and stage — nothing stored there would be read. Rotate a deployed stage: gkm encryption:rotate ${construct} --stage <stage>.`,\n\t\t);\n\t\tthis.name = 'LocalKeyringIsDerived';\n\t}\n}\n\nexport class KmsRotatesItself extends GkmError {\n\tconstructor(readonly construct: string) {\n\t\tsuper(\n\t\t\t`${construct} is a KMS key on AWS: KMS rotates it yearly and keeps every version, so no value is ever stranded and there is no key to retire. Nothing to do here.`,\n\t\t);\n\t\tthis.name = 'KmsRotatesItself';\n\t}\n}\n\nexport class NoKeyringYet extends GkmError {\n\tconstructor(\n\t\treadonly construct: string,\n\t\treadonly stage: string,\n\t\treadonly key: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' has no ${key} yet. The first deploy generates ${construct}'s keyring: gkm deploy --stage ${stage}.`,\n\t\t);\n\t\tthis.name = 'NoKeyringYet';\n\t}\n}\n\nexport interface EncryptionCommandOptions {\n\tstage: string;\n}\n\n/** Where a command reads and writes; the real ones unless a test says. */\nexport interface EncryptionCommandContext {\n\tworkspace?: NormalizedWorkspace;\n\tstore?: SecretsStore;\n}\n\nexport async function encryptionRotateCommand(\n\tconstruct: string,\n\toptions: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext = {},\n): Promise<string> {\n\treturn updateKeyring(construct, options, context, (id, url) => {\n\t\tconst next = rotateKeyring(id, url);\n\t\tconst [current, ...older] = parseKeyring(id, next).keys.map(({ id }) => id);\n\n\t\tlogger.log(`\\n✓ ${id} on '${options.stage}' now writes with '${current}'.`);\n\t\tlogger.log(\n\t\t\t` Still opening: ${older.join(', ')}. Redeploy to start writing with '${current}', reencrypt what is stored, then: gkm encryption:retire ${id} <key> --stage ${options.stage}`,\n\t\t);\n\t\treturn next;\n\t});\n}\n\nexport async function encryptionRetireCommand(\n\tconstruct: string,\n\tkeyId: string,\n\toptions: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext = {},\n): Promise<string> {\n\treturn updateKeyring(construct, options, context, (id, url) => {\n\t\tconst next = retireKey(id, url, keyId);\n\n\t\tlogger.log(\n\t\t\t`\\n✓ ${id} on '${options.stage}' no longer holds '${keyId}'. Anything still under it cannot be read after the next deploy.`,\n\t\t);\n\t\treturn next;\n\t});\n}\n\nasync function updateKeyring(\n\tconstruct: string,\n\t{ stage }: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext,\n\tupdate: (id: string, url: string) => string,\n): Promise<string> {\n\tconst workspace = context.workspace ?? (await loadWorkspaceSettings());\n\tconst id = canonicalId(construct);\n\n\tif (stage === workspace.stages.local) {\n\t\tthrow new LocalKeyringIsDerived(id, stage);\n\t}\n\tassertDeployedStage(workspace.stages, stage);\n\tif (providerOf(workspace) === 'aws') throw new KmsRotatesItself(id);\n\n\tconst store = context.store ?? (await secretsStoreFor(workspace, stage));\n\tconst key = provideKey(id, 'url');\n\tconst secrets = await store.read(stage);\n\tconst url = secrets?.custom[key];\n\tif (!secrets || !url) throw new NoKeyringYet(id, stage, key);\n\n\tconst next = update(id, url);\n\tawait store.write(stage, withCustomSecret(secrets, key, next));\n\treturn next;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,SAAS;AAEf,IAAa,wBAAb,cAA2CA,eAAAA,SAAS;CAEzC;CACA;CAFV,YACC,WACA,OACC;EACD,MACC,IAAI,MAAM,8BAA8B,UAAU,wIAAwI,UAAU,kBACrM;EALS,KAAA,YAAA;EACA,KAAA,QAAA;EAKT,KAAK,OAAO;CACb;AACD;AAEA,IAAa,mBAAb,cAAsCA,eAAAA,SAAS;CACzB;CAArB,YAAY,WAA4B;EACvC,MACC,GAAG,UAAU,qJACd;EAHoB,KAAA,YAAA;EAIpB,KAAK,OAAO;CACb;AACD;AAEA,IAAa,eAAb,cAAkCA,eAAAA,SAAS;CAEhC;CACA;CACA;CAHV,YACC,WACA,OACA,KACC;EACD,MACC,IAAI,MAAM,WAAW,IAAI,mCAAmC,UAAU,iCAAiC,MAAM,EAC9G;EANS,KAAA,YAAA;EACA,KAAA,QAAA;EACA,KAAA,MAAA;EAKT,KAAK,OAAO;CACb;AACD;AAYA,eAAsB,wBACrB,WACA,SACA,UAAoC,CAAC,GACnB;CAClB,OAAO,cAAc,WAAW,SAAS,UAAU,IAAI,QAAQ;EAC9D,MAAM,QAAA,GAAOC,iCAAAA,cAAAA,CAAc,IAAI,GAAG;EAClC,MAAM,CAAC,SAAS,GAAG,UAAA,GAASC,iCAAAA,aAAAA,CAAa,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,EAAE,SAAS,EAAE;EAE1E,OAAO,IAAI,OAAO,GAAG,OAAO,QAAQ,MAAM,qBAAqB,QAAQ,GAAG;EAC1E,OAAO,IACN,oBAAoB,MAAM,KAAK,IAAI,EAAE,oCAAoC,QAAQ,2DAA2D,GAAG,iBAAiB,QAAQ,OACzK;EACA,OAAO;CACR,CAAC;AACF;AAEA,eAAsB,wBACrB,WACA,OACA,SACA,UAAoC,CAAC,GACnB;CAClB,OAAO,cAAc,WAAW,SAAS,UAAU,IAAI,QAAQ;EAC9D,MAAM,QAAA,GAAOC,iCAAAA,UAAAA,CAAU,IAAI,KAAK,KAAK;EAErC,OAAO,IACN,OAAO,GAAG,OAAO,QAAQ,MAAM,qBAAqB,MAAM,iEAC3D;EACA,OAAO;CACR,CAAC;AACF;AAEA,eAAe,cACd,WACA,EAAE,SACF,SACA,QACkB;CAClB,MAAM,YAAY,QAAQ,aAAc,MAAMC,eAAAA,sBAAsB;CACpE,MAAM,MAAA,GAAKC,oBAAAA,YAAAA,CAAY,SAAS;CAEhC,IAAI,UAAU,UAAU,OAAO,OAC9B,MAAM,IAAI,sBAAsB,IAAI,KAAK;CAE1C,kBAAA,oBAAoB,UAAU,QAAQ,KAAK;CAC3C,IAAIC,cAAAA,WAAW,SAAS,MAAM,OAAO,MAAM,IAAI,iBAAiB,EAAE;CAElE,MAAM,QAAQ,QAAQ,SAAU,MAAMC,cAAAA,gBAAgB,WAAW,KAAK;CACtE,MAAM,OAAA,GAAMC,oBAAAA,WAAAA,CAAW,IAAI,KAAK;CAChC,MAAM,UAAU,MAAM,MAAM,KAAK,KAAK;CACtC,MAAM,MAAM,SAAS,OAAO;CAC5B,IAAI,CAAC,WAAW,CAAC,KAAK,MAAM,IAAI,aAAa,IAAI,OAAO,GAAG;CAE3D,MAAM,OAAO,OAAO,IAAI,GAAG;CAC3B,MAAM,MAAM,MAAM,OAAOC,cAAAA,iBAAiB,SAAS,KAAK,IAAI,CAAC;CAC7D,OAAO;AACR"}