@geekmidas/cli 10.0.0-alpha.10 → 10.0.0-alpha.101

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 (489) 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-Br97xgs_.mjs +1031 -0
  7. package/dist/EndpointGenerator-Br97xgs_.mjs.map +1 -0
  8. package/dist/EndpointGenerator-By5_tYE9.cjs +1090 -0
  9. package/dist/EndpointGenerator-By5_tYE9.cjs.map +1 -0
  10. package/dist/GoDaddyProvider-BOuLf_Py.cjs +388 -0
  11. package/dist/GoDaddyProvider-BOuLf_Py.cjs.map +1 -0
  12. package/dist/GoDaddyProvider-u9MF-Dqk.mjs +388 -0
  13. package/dist/GoDaddyProvider-u9MF-Dqk.mjs.map +1 -0
  14. package/dist/{HostingerProvider-Cft7lEYr.mjs → HostingerProvider-BNpS9aRJ.mjs} +29 -25
  15. package/dist/HostingerProvider-BNpS9aRJ.mjs.map +1 -0
  16. package/dist/{HostingerProvider-h3EbEp-Z.cjs → HostingerProvider-DR1iws1P.cjs} +29 -25
  17. package/dist/HostingerProvider-DR1iws1P.cjs.map +1 -0
  18. package/dist/LegacyStateStore-DWmHGNgH.cjs +124 -0
  19. package/dist/LegacyStateStore-DWmHGNgH.cjs.map +1 -0
  20. package/dist/LegacyStateStore-vhkx7Bbq.mjs +124 -0
  21. package/dist/LegacyStateStore-vhkx7Bbq.mjs.map +1 -0
  22. package/dist/LocalStateStore-BVKDADoG.cjs +178 -0
  23. package/dist/LocalStateStore-BVKDADoG.cjs.map +1 -0
  24. package/dist/LocalStateStore-FVsg0UoM.mjs +167 -0
  25. package/dist/LocalStateStore-FVsg0UoM.mjs.map +1 -0
  26. package/dist/OpenApiTsGenerator-BgSX_Z-e.cjs +541 -0
  27. package/dist/OpenApiTsGenerator-BgSX_Z-e.cjs.map +1 -0
  28. package/dist/OpenApiTsGenerator-C8aTX--y.mjs +536 -0
  29. package/dist/OpenApiTsGenerator-C8aTX--y.mjs.map +1 -0
  30. package/dist/{Route53Provider-di2fMM5N.cjs → Route53Provider-Bllus2NR.cjs} +21 -22
  31. package/dist/Route53Provider-Bllus2NR.cjs.map +1 -0
  32. package/dist/{Route53Provider-RdpUDJQk.mjs → Route53Provider-QXxjkZO1.mjs} +13 -13
  33. package/dist/Route53Provider-QXxjkZO1.mjs.map +1 -0
  34. package/dist/S3StateStore-B8seZUsw.mjs +223 -0
  35. package/dist/S3StateStore-B8seZUsw.mjs.map +1 -0
  36. package/dist/S3StateStore-B_2gE9Un.cjs +222 -0
  37. package/dist/S3StateStore-B_2gE9Un.cjs.map +1 -0
  38. package/dist/SSMStateStore-CTDEI5Bi.cjs +204 -0
  39. package/dist/SSMStateStore-CTDEI5Bi.cjs.map +1 -0
  40. package/dist/SSMStateStore-DGTbBomw.mjs +205 -0
  41. package/dist/SSMStateStore-DGTbBomw.mjs.map +1 -0
  42. package/dist/SubscriberGenerator-1-IsjIwF.mjs +449 -0
  43. package/dist/SubscriberGenerator-1-IsjIwF.mjs.map +1 -0
  44. package/dist/SubscriberGenerator-BlIOdbi-.cjs +490 -0
  45. package/dist/SubscriberGenerator-BlIOdbi-.cjs.map +1 -0
  46. package/dist/add-BB2tLVc2.cjs +720 -0
  47. package/dist/add-BB2tLVc2.cjs.map +1 -0
  48. package/dist/add-CIbhGE5v.mjs +718 -0
  49. package/dist/add-CIbhGE5v.mjs.map +1 -0
  50. package/dist/appPorts-C9z9Pzn9.mjs +223 -0
  51. package/dist/appPorts-C9z9Pzn9.mjs.map +1 -0
  52. package/dist/appPorts-Cu79hJF6.cjs +264 -0
  53. package/dist/appPorts-Cu79hJF6.cjs.map +1 -0
  54. package/dist/aws-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-Bgj5Vi_L.mjs → backup-provisioner-C8DnCmxK.mjs} +11 -8
  63. package/dist/backup-provisioner-C8DnCmxK.mjs.map +1 -0
  64. package/dist/{backup-provisioner-BrsHwYG0.cjs → backup-provisioner-oDEsPj02.cjs} +22 -20
  65. package/dist/backup-provisioner-oDEsPj02.cjs.map +1 -0
  66. package/dist/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-BY1OmV1e.cjs → bundler-Ba6BER3w.cjs} +38 -35
  75. package/dist/bundler-Ba6BER3w.cjs.map +1 -0
  76. package/dist/{bundler-Be8Zg4Wd.mjs → bundler-CHjRYVKh.mjs} +36 -32
  77. package/dist/bundler-CHjRYVKh.mjs.map +1 -0
  78. package/dist/cli-CtlqYRlN.cjs +71 -0
  79. package/dist/cli-CtlqYRlN.cjs.map +1 -0
  80. package/dist/cli-DOlkhrsh.mjs +71 -0
  81. package/dist/cli-DOlkhrsh.mjs.map +1 -0
  82. package/dist/compose-FDP_TaFt.mjs +3154 -0
  83. package/dist/compose-FDP_TaFt.mjs.map +1 -0
  84. package/dist/compose-uAWLy-nR.cjs +3267 -0
  85. package/dist/compose-uAWLy-nR.cjs.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-DDda4Mmm.cjs +272 -0
  97. package/dist/credentialSchemas-DDda4Mmm.cjs.map +1 -0
  98. package/dist/credentialSchemas-DvitraL-.mjs +237 -0
  99. package/dist/credentialSchemas-DvitraL-.mjs.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-DUUc3jV9.cjs +2390 -0
  163. package/dist/deploy-DUUc3jV9.cjs.map +1 -0
  164. package/dist/deploy-DgZxTnGS.mjs +2317 -0
  165. package/dist/deploy-DgZxTnGS.mjs.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-BfhVW_kT.cjs +600 -0
  171. package/dist/discover-BfhVW_kT.cjs.map +1 -0
  172. package/dist/discover-CvTtV5ZD.d.cts +108 -0
  173. package/dist/discover-CvTtV5ZD.d.cts.map +1 -0
  174. package/dist/discover-W2kab9Lc.d.mts +108 -0
  175. package/dist/discover-W2kab9Lc.d.mts.map +1 -0
  176. package/dist/discover-kziEht4W.mjs +527 -0
  177. package/dist/discover-kziEht4W.mjs.map +1 -0
  178. package/dist/dns-DDDCfj75.mjs +926 -0
  179. package/dist/dns-DDDCfj75.mjs.map +1 -0
  180. package/dist/dns-DnE_02tB.cjs +1057 -0
  181. package/dist/dns-DnE_02tB.cjs.map +1 -0
  182. package/dist/dokploy-BrfdeVEu.cjs +38 -0
  183. package/dist/dokploy-BrfdeVEu.cjs.map +1 -0
  184. package/dist/dokploy-DBlGSdnb.mjs +38 -0
  185. package/dist/dokploy-DBlGSdnb.mjs.map +1 -0
  186. package/dist/drivers-BLU1fNs_.cjs +200 -0
  187. package/dist/drivers-BLU1fNs_.cjs.map +1 -0
  188. package/dist/drivers-C08LL4E8.mjs +177 -0
  189. package/dist/drivers-C08LL4E8.mjs.map +1 -0
  190. package/dist/{emit-CiZS_5Ub.mjs → emit-C1e8qD08.mjs} +13 -26
  191. package/dist/emit-C1e8qD08.mjs.map +1 -0
  192. package/dist/{emit-CbcRolsa.cjs → emit-Dmc1nvdS.cjs} +31 -57
  193. package/dist/emit-Dmc1nvdS.cjs.map +1 -0
  194. package/dist/encryption-CeW3xpE1.cjs +90 -0
  195. package/dist/encryption-CeW3xpE1.cjs.map +1 -0
  196. package/dist/encryption-DC8zsh2s.mjs +89 -0
  197. package/dist/encryption-DC8zsh2s.mjs.map +1 -0
  198. package/dist/engine-BXxvcxVq.cjs +3195 -0
  199. package/dist/engine-BXxvcxVq.cjs.map +1 -0
  200. package/dist/engine-z0UClzE9.mjs +3082 -0
  201. package/dist/engine-z0UClzE9.mjs.map +1 -0
  202. package/dist/errors-D8Gwp5kU.mjs +23 -0
  203. package/dist/errors-D8Gwp5kU.mjs.map +1 -0
  204. package/dist/errors-DMC4Umsb.cjs +34 -0
  205. package/dist/errors-DMC4Umsb.cjs.map +1 -0
  206. package/dist/github-DJgO5z37.mjs +829 -0
  207. package/dist/github-DJgO5z37.mjs.map +1 -0
  208. package/dist/github-DWoFgxtl.cjs +829 -0
  209. package/dist/github-DWoFgxtl.cjs.map +1 -0
  210. package/dist/identity-CBXr4wNi.mjs +129 -0
  211. package/dist/identity-CBXr4wNi.mjs.map +1 -0
  212. package/dist/identity-CbLfgQNT.cjs +182 -0
  213. package/dist/identity-CbLfgQNT.cjs.map +1 -0
  214. package/dist/{index-C6e-ULLx.d.mts → index-8OfpOtSI.d.cts} +39 -24
  215. package/dist/index-8OfpOtSI.d.cts.map +1 -0
  216. package/dist/{index-CR5urhWX.d.cts → index-Dpji6Bxq.d.mts} +39 -24
  217. package/dist/index-Dpji6Bxq.d.mts.map +1 -0
  218. package/dist/index.cjs +10022 -12718
  219. package/dist/index.cjs.map +1 -1
  220. package/dist/index.d.cts +1 -1
  221. package/dist/index.d.mts +1 -1
  222. package/dist/index.mjs +10648 -13356
  223. package/dist/index.mjs.map +1 -1
  224. package/dist/local-BwC2v2Y8.mjs +224 -0
  225. package/dist/local-BwC2v2Y8.mjs.map +1 -0
  226. package/dist/local-DNhnkugT.cjs +241 -0
  227. package/dist/local-DNhnkugT.cjs.map +1 -0
  228. package/dist/migrate-B1OjPwUY.cjs +181 -0
  229. package/dist/migrate-B1OjPwUY.cjs.map +1 -0
  230. package/dist/migrate-CWSCkzu3.cjs +271 -0
  231. package/dist/migrate-CWSCkzu3.cjs.map +1 -0
  232. package/dist/migrate-DIVxoju6.mjs +266 -0
  233. package/dist/migrate-DIVxoju6.mjs.map +1 -0
  234. package/dist/migrate-DoI2hWNH.mjs +181 -0
  235. package/dist/migrate-DoI2hWNH.mjs.map +1 -0
  236. package/dist/openapi.cjs +214 -10
  237. package/dist/openapi.cjs.map +1 -0
  238. package/dist/openapi.d.cts +38 -17
  239. package/dist/openapi.d.cts.map +1 -1
  240. package/dist/openapi.d.mts +38 -17
  241. package/dist/openapi.d.mts.map +1 -1
  242. package/dist/openapi.mjs +208 -5
  243. package/dist/openapi.mjs.map +1 -0
  244. package/dist/projectBucket-BBbQ1lHF.cjs +263 -0
  245. package/dist/projectBucket-BBbQ1lHF.cjs.map +1 -0
  246. package/dist/projectBucket-C_DN4WzF.mjs +222 -0
  247. package/dist/projectBucket-C_DN4WzF.mjs.map +1 -0
  248. package/dist/provider-BqpjG9QM.cjs +57 -0
  249. package/dist/provider-BqpjG9QM.cjs.map +1 -0
  250. package/dist/provider-CEOKk8NS.mjs +46 -0
  251. package/dist/provider-CEOKk8NS.mjs.map +1 -0
  252. package/dist/ready-BtxiI7Qb.cjs +403 -0
  253. package/dist/ready-BtxiI7Qb.cjs.map +1 -0
  254. package/dist/ready-CzHNHhI6.mjs +374 -0
  255. package/dist/ready-CzHNHhI6.mjs.map +1 -0
  256. package/dist/reconcile/public.cjs +3 -5
  257. package/dist/reconcile/public.d.cts +11 -87
  258. package/dist/reconcile/public.d.cts.map +1 -1
  259. package/dist/reconcile/public.d.mts +11 -87
  260. package/dist/reconcile/public.d.mts.map +1 -1
  261. package/dist/reconcile/public.mjs +3 -4
  262. package/dist/{reconcile-CFs8C_1a.mjs → reconcile--I7V4Klj.mjs} +4 -7
  263. package/dist/reconcile--I7V4Klj.mjs.map +1 -0
  264. package/dist/{reconcile-D0pimNiy.cjs → reconcile-CuCQBa5-.cjs} +5 -8
  265. package/dist/reconcile-CuCQBa5-.cjs.map +1 -0
  266. package/dist/resolve-WAwYMN6q.cjs +316 -0
  267. package/dist/resolve-WAwYMN6q.cjs.map +1 -0
  268. package/dist/resolve-pmXIdi9j.mjs +263 -0
  269. package/dist/resolve-pmXIdi9j.mjs.map +1 -0
  270. package/dist/rollback-CLtwbByg.mjs +136 -0
  271. package/dist/rollback-CLtwbByg.mjs.map +1 -0
  272. package/dist/rollback-Cz8F9xSB.cjs +165 -0
  273. package/dist/rollback-Cz8F9xSB.cjs.map +1 -0
  274. package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
  275. package/dist/{chunk-CUT6urMc.cjs → rolldown-runtime-C0BPl7ul.cjs} +23 -10
  276. package/dist/run-BJLIerMM.mjs +133 -0
  277. package/dist/run-BJLIerMM.mjs.map +1 -0
  278. package/dist/run-fVZ-rLnc.cjs +174 -0
  279. package/dist/run-fVZ-rLnc.cjs.map +1 -0
  280. package/dist/runtime-ACdfK59n.d.cts +82 -0
  281. package/dist/runtime-ACdfK59n.d.cts.map +1 -0
  282. package/dist/runtime-YyQuekxi.d.mts +82 -0
  283. package/dist/runtime-YyQuekxi.d.mts.map +1 -0
  284. package/dist/s3-CrPoA89T.cjs +215 -0
  285. package/dist/s3-CrPoA89T.cjs.map +1 -0
  286. package/dist/s3-DQXZdmCM.mjs +215 -0
  287. package/dist/s3-DQXZdmCM.mjs.map +1 -0
  288. package/dist/sandbox/config-worker.cjs +43 -0
  289. package/dist/sandbox/config-worker.cjs.map +1 -0
  290. package/dist/sandbox/config-worker.d.cts +1 -0
  291. package/dist/sandbox/config-worker.d.mts +1 -0
  292. package/dist/sandbox/config-worker.mjs +44 -0
  293. package/dist/sandbox/config-worker.mjs.map +1 -0
  294. package/dist/sandbox/credentials-worker.cjs +54 -0
  295. package/dist/sandbox/credentials-worker.cjs.map +1 -0
  296. package/dist/sandbox/credentials-worker.d.cts +1 -0
  297. package/dist/sandbox/credentials-worker.d.mts +1 -0
  298. package/dist/sandbox/credentials-worker.mjs +55 -0
  299. package/dist/sandbox/credentials-worker.mjs.map +1 -0
  300. package/dist/sandbox/discover-worker.cjs +47 -0
  301. package/dist/sandbox/discover-worker.cjs.map +1 -0
  302. package/dist/sandbox/discover-worker.d.cts +1 -0
  303. package/dist/sandbox/discover-worker.d.mts +1 -0
  304. package/dist/sandbox/discover-worker.mjs +48 -0
  305. package/dist/sandbox/discover-worker.mjs.map +1 -0
  306. package/dist/sandbox/migrate-worker.cjs +75 -0
  307. package/dist/sandbox/migrate-worker.cjs.map +1 -0
  308. package/dist/sandbox/migrate-worker.d.cts +1 -0
  309. package/dist/sandbox/migrate-worker.d.mts +1 -0
  310. package/dist/sandbox/migrate-worker.mjs +76 -0
  311. package/dist/sandbox/migrate-worker.mjs.map +1 -0
  312. package/dist/sandbox-C4g1eG31.d.mts +104 -0
  313. package/dist/sandbox-C4g1eG31.d.mts.map +1 -0
  314. package/dist/sandbox-CHv3OYXg.cjs +165 -0
  315. package/dist/sandbox-CHv3OYXg.cjs.map +1 -0
  316. package/dist/sandbox-CbVB7uOD.mjs +118 -0
  317. package/dist/sandbox-CbVB7uOD.mjs.map +1 -0
  318. package/dist/sandbox-CdKgQ3XU.d.cts +104 -0
  319. package/dist/sandbox-CdKgQ3XU.d.cts.map +1 -0
  320. package/dist/{workspace-C6VJQVtG.cjs → schemas-BCwKKA42.mjs} +958 -1842
  321. package/dist/schemas-BCwKKA42.mjs.map +1 -0
  322. package/dist/{workspace-zoqRbihZ.mjs → schemas-BQ_v0lEX.cjs} +1048 -1658
  323. package/dist/schemas-BQ_v0lEX.cjs.map +1 -0
  324. package/dist/secretsManager-CQORubp9.mjs +97 -0
  325. package/dist/secretsManager-CQORubp9.mjs.map +1 -0
  326. package/dist/secretsManager-RAGcEDX1.cjs +108 -0
  327. package/dist/secretsManager-RAGcEDX1.cjs.map +1 -0
  328. package/dist/seeds-BHKUAExH.mjs +8148 -0
  329. package/dist/seeds-BHKUAExH.mjs.map +1 -0
  330. package/dist/seeds-Dk4WHhjU.cjs +9115 -0
  331. package/dist/seeds-Dk4WHhjU.cjs.map +1 -0
  332. package/dist/sniffer-BjBZ01PE.cjs +1998 -0
  333. package/dist/sniffer-BjBZ01PE.cjs.map +1 -0
  334. package/dist/sniffer-CaXl51vO.mjs +1825 -0
  335. package/dist/sniffer-CaXl51vO.mjs.map +1 -0
  336. package/dist/sst-B-Uz4cvm.cjs +464 -0
  337. package/dist/sst-B-Uz4cvm.cjs.map +1 -0
  338. package/dist/sst-C1pxbFEd.mjs +441 -0
  339. package/dist/sst-C1pxbFEd.mjs.map +1 -0
  340. package/dist/stages-DJrOYLZ-.mjs +176 -0
  341. package/dist/stages-DJrOYLZ-.mjs.map +1 -0
  342. package/dist/stages-_3RVNG83.cjs +176 -0
  343. package/dist/stages-_3RVNG83.cjs.map +1 -0
  344. package/dist/target/public.cjs +15 -0
  345. package/dist/target/public.d.cts +28 -0
  346. package/dist/target/public.d.cts.map +1 -0
  347. package/dist/target/public.d.mts +28 -0
  348. package/dist/target/public.d.mts.map +1 -0
  349. package/dist/target/public.mjs +4 -0
  350. package/dist/terminal-Bs_lNQhL.mjs +85 -0
  351. package/dist/terminal-Bs_lNQhL.mjs.map +1 -0
  352. package/dist/terminal-CsQz4oT0.cjs +85 -0
  353. package/dist/terminal-CsQz4oT0.cjs.map +1 -0
  354. package/dist/types-B6UXlEkf.d.cts +7650 -0
  355. package/dist/types-B6UXlEkf.d.cts.map +1 -0
  356. package/dist/types-HqVPddRK.d.mts +7649 -0
  357. package/dist/types-HqVPddRK.d.mts.map +1 -0
  358. package/dist/utils-D2Nk1Nv2.cjs +205 -0
  359. package/dist/utils-D2Nk1Nv2.cjs.map +1 -0
  360. package/dist/utils-D_fxUqvU.mjs +156 -0
  361. package/dist/utils-D_fxUqvU.mjs.map +1 -0
  362. package/dist/vitest.cjs +65 -0
  363. package/dist/vitest.cjs.map +1 -0
  364. package/dist/vitest.d.cts +29 -0
  365. package/dist/vitest.d.cts.map +1 -0
  366. package/dist/vitest.d.mts +29 -0
  367. package/dist/vitest.d.mts.map +1 -0
  368. package/dist/vitest.mjs +65 -0
  369. package/dist/vitest.mjs.map +1 -0
  370. package/dist/workerRuntime-BXfhbe13.cjs +108 -0
  371. package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
  372. package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
  373. package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
  374. package/dist/workspace/index.cjs +8 -4
  375. package/dist/workspace/index.d.cts +3 -3
  376. package/dist/workspace/index.d.mts +3 -3
  377. package/dist/workspace/index.mjs +2 -3
  378. package/dist/workspace-BwqQnool.cjs +2806 -0
  379. package/dist/workspace-BwqQnool.cjs.map +1 -0
  380. package/dist/workspace-D1QbNd55.mjs +2394 -0
  381. package/dist/workspace-D1QbNd55.mjs.map +1 -0
  382. package/package.json +54 -22
  383. package/dist/CachedStateProvider-BLo7zv7S.cjs +0 -3
  384. package/dist/CachedStateProvider-BxoAm-B2.mjs +0 -3
  385. package/dist/CachedStateProvider-CqPdW7CB.cjs +0 -60
  386. package/dist/CachedStateProvider-CqPdW7CB.cjs.map +0 -1
  387. package/dist/CachedStateProvider-DTniehMP.mjs +0 -54
  388. package/dist/CachedStateProvider-DTniehMP.mjs.map +0 -1
  389. package/dist/HostingerProvider-Cft7lEYr.mjs.map +0 -1
  390. package/dist/HostingerProvider-h3EbEp-Z.cjs.map +0 -1
  391. package/dist/LocalStateProvider-Bn6tS-oL.mjs +0 -42
  392. package/dist/LocalStateProvider-Bn6tS-oL.mjs.map +0 -1
  393. package/dist/LocalStateProvider-Db9SEjyH.cjs +0 -43
  394. package/dist/LocalStateProvider-Db9SEjyH.cjs.map +0 -1
  395. package/dist/Route53Provider-RdpUDJQk.mjs.map +0 -1
  396. package/dist/Route53Provider-di2fMM5N.cjs.map +0 -1
  397. package/dist/SSMStateProvider-BRt2py-A.mjs +0 -66
  398. package/dist/SSMStateProvider-BRt2py-A.mjs.map +0 -1
  399. package/dist/SSMStateProvider-DyX8s9HI.cjs +0 -66
  400. package/dist/SSMStateProvider-DyX8s9HI.cjs.map +0 -1
  401. package/dist/backup-provisioner-Bgj5Vi_L.mjs.map +0 -1
  402. package/dist/backup-provisioner-BrsHwYG0.cjs.map +0 -1
  403. package/dist/bundler-BY1OmV1e.cjs.map +0 -1
  404. package/dist/bundler-Be8Zg4Wd.mjs.map +0 -1
  405. package/dist/chunk-Duj1WY3L.mjs +0 -7
  406. package/dist/config-BZ1F0WuA.cjs +0 -462
  407. package/dist/config-BZ1F0WuA.cjs.map +0 -1
  408. package/dist/config-DVVph9yz.mjs +0 -402
  409. package/dist/config-DVVph9yz.mjs.map +0 -1
  410. package/dist/config.d.cts.map +0 -1
  411. package/dist/config.d.mts.map +0 -1
  412. package/dist/credentials-B5zRHdAl.mjs +0 -141
  413. package/dist/credentials-B5zRHdAl.mjs.map +0 -1
  414. package/dist/credentials-BapzjyV5.cjs +0 -195
  415. package/dist/credentials-BapzjyV5.cjs.map +0 -1
  416. package/dist/credentials-Xamqe_NJ.cjs +0 -2681
  417. package/dist/credentials-Xamqe_NJ.cjs.map +0 -1
  418. package/dist/credentials-dP8vRVRv.mjs +0 -2549
  419. package/dist/credentials-dP8vRVRv.mjs.map +0 -1
  420. package/dist/discover-CAlFgYec.mjs +0 -229
  421. package/dist/discover-CAlFgYec.mjs.map +0 -1
  422. package/dist/discover-DTmFeloL.cjs +0 -271
  423. package/dist/discover-DTmFeloL.cjs.map +0 -1
  424. package/dist/dokploy-api-BS2xnJLZ.mjs +0 -3
  425. package/dist/dokploy-api-BsVH0y_s.cjs +0 -718
  426. package/dist/dokploy-api-BsVH0y_s.cjs.map +0 -1
  427. package/dist/dokploy-api-BuxDRo3l.cjs +0 -3
  428. package/dist/dokploy-api-aTFPz7_4.mjs +0 -706
  429. package/dist/dokploy-api-aTFPz7_4.mjs.map +0 -1
  430. package/dist/emit-CbcRolsa.cjs.map +0 -1
  431. package/dist/emit-CiZS_5Ub.mjs.map +0 -1
  432. package/dist/encryption-C6jaU0hE.cjs +0 -54
  433. package/dist/encryption-C6jaU0hE.cjs.map +0 -1
  434. package/dist/encryption-CHzzeR8a.cjs +0 -4
  435. package/dist/encryption-CQUncu7v.mjs +0 -3
  436. package/dist/encryption-D-abyhZx.mjs +0 -42
  437. package/dist/encryption-D-abyhZx.mjs.map +0 -1
  438. package/dist/fullstack-secrets-C-GGohke.cjs +0 -111
  439. package/dist/fullstack-secrets-C-GGohke.cjs.map +0 -1
  440. package/dist/fullstack-secrets-D1o9-G5l.mjs +0 -87
  441. package/dist/fullstack-secrets-D1o9-G5l.mjs.map +0 -1
  442. package/dist/generator-CNzBw7g5.cjs +0 -289
  443. package/dist/generator-CNzBw7g5.cjs.map +0 -1
  444. package/dist/generator-VE2JrFlY.mjs +0 -253
  445. package/dist/generator-VE2JrFlY.mjs.map +0 -1
  446. package/dist/index-C6e-ULLx.d.mts.map +0 -1
  447. package/dist/index-CR5urhWX.d.cts.map +0 -1
  448. package/dist/openapi-SjsgARie.cjs +0 -2075
  449. package/dist/openapi-SjsgARie.cjs.map +0 -1
  450. package/dist/openapi-Xx0A7Wg0.mjs +0 -2021
  451. package/dist/openapi-Xx0A7Wg0.mjs.map +0 -1
  452. package/dist/openapi-react-query-Byltvm_7.mjs +0 -167
  453. package/dist/openapi-react-query-Byltvm_7.mjs.map +0 -1
  454. package/dist/openapi-react-query-CmJ1xDbn.cjs +0 -173
  455. package/dist/openapi-react-query-CmJ1xDbn.cjs.map +0 -1
  456. package/dist/openapi-react-query.cjs +0 -4
  457. package/dist/openapi-react-query.d.cts +0 -11
  458. package/dist/openapi-react-query.d.cts.map +0 -1
  459. package/dist/openapi-react-query.d.mts +0 -11
  460. package/dist/openapi-react-query.d.mts.map +0 -1
  461. package/dist/openapi-react-query.mjs +0 -4
  462. package/dist/reconcile-CFs8C_1a.mjs.map +0 -1
  463. package/dist/reconcile-D0pimNiy.cjs.map +0 -1
  464. package/dist/setup-BA8ciTPU.mjs +0 -11
  465. package/dist/setup-BsZvZP6f.cjs +0 -11
  466. package/dist/setup-C8KOx8_8.mjs +0 -443
  467. package/dist/setup-C8KOx8_8.mjs.map +0 -1
  468. package/dist/setup-hC6hI86f.cjs +0 -473
  469. package/dist/setup-hC6hI86f.cjs.map +0 -1
  470. package/dist/storage-BJmzYxt8.cjs +0 -363
  471. package/dist/storage-BJmzYxt8.cjs.map +0 -1
  472. package/dist/storage-BM9hGpgv.cjs +0 -7
  473. package/dist/storage-Bi24WfoW.mjs +0 -297
  474. package/dist/storage-Bi24WfoW.mjs.map +0 -1
  475. package/dist/storage-CYlGwWTj.mjs +0 -3
  476. package/dist/sync-CmEuNZsB.mjs +0 -76
  477. package/dist/sync-CmEuNZsB.mjs.map +0 -1
  478. package/dist/sync-D306yOWu.cjs +0 -4
  479. package/dist/sync-SizaChmC.cjs +0 -93
  480. package/dist/sync-SizaChmC.cjs.map +0 -1
  481. package/dist/sync-hOqAWHR6.mjs +0 -3
  482. package/dist/types-6pkp2RRj.d.mts +0 -2220
  483. package/dist/types-6pkp2RRj.d.mts.map +0 -1
  484. package/dist/types-Y3fKQSAK.d.cts +0 -2220
  485. package/dist/types-Y3fKQSAK.d.cts.map +0 -1
  486. package/dist/workspace-BzrG_2SI.mjs +0 -8
  487. package/dist/workspace-C6VJQVtG.cjs.map +0 -1
  488. package/dist/workspace-XXtNhqJl.cjs +0 -9
  489. package/dist/workspace-zoqRbihZ.mjs.map +0 -1
@@ -0,0 +1,222 @@
1
+ const require_identity = require("./identity-CbLfgQNT.cjs");
2
+ const require_sniffer = require("./sniffer-BjBZ01PE.cjs");
3
+ const require_projectBucket = require("./projectBucket-BBbQ1lHF.cjs");
4
+ let _aws_sdk_client_s3 = require("@aws-sdk/client-s3");
5
+ let _aws_sdk_client_sts = require("@aws-sdk/client-sts");
6
+ //#region src/deploy/S3StateStore.ts
7
+ /**
8
+ * Amazon S3 state store.
9
+ *
10
+ * In the bucket the config names, which must exist — or, with none named, in
11
+ * the project bucket (`providers/projectBucket.ts`): found by its name, which
12
+ * is worked out from the project and the account, and created by the first
13
+ * write (a deploy's lock, `state:push`). A read of a project bucket that does
14
+ * not exist yet is a stage with no state; it creates nothing.
15
+ *
16
+ * - `<prefix>/<workspace>/<stage>/state.json`: the state.
17
+ * - `<prefix>/<workspace>/<stage>/lock.json`: the lock.
18
+ * - `<prefix>/<workspace>/<stage>/state.v1.json`: the v1 state, kept on
19
+ * migration.
20
+ *
21
+ * Every write is conditional on the server: `If-None-Match: *` to create,
22
+ * `If-Match: <etag>` to replace. S3 answers a lost race with 412 (or 409 when
23
+ * two conditional writes are in flight at once), so there is no window
24
+ * between a check and a write for another run to slip into.
25
+ */
26
+ /** A conditional write that lost: the object is not what the write assumed. */
27
+ function lostRace(error) {
28
+ const { name, $metadata } = error;
29
+ return name === "PreconditionFailed" || name === "ConditionalRequestConflict" || $metadata?.httpStatusCode === 412 || $metadata?.httpStatusCode === 409;
30
+ }
31
+ function notFound(error) {
32
+ const { name, $metadata } = error;
33
+ return name === "NoSuchKey" || name === "NotFound" || $metadata?.httpStatusCode === 404;
34
+ }
35
+ var S3StateStore = class S3StateStore extends require_sniffer.DocumentStateStore {
36
+ workspaceName;
37
+ source;
38
+ client;
39
+ prefix;
40
+ /** The bucket's name, once known. */
41
+ name;
42
+ /** Whether the bucket is known to exist. */
43
+ exists = false;
44
+ constructor(workspaceName, source, client, prefix = "gkm") {
45
+ super();
46
+ this.workspaceName = workspaceName;
47
+ this.source = source;
48
+ this.client = client;
49
+ this.prefix = prefix.replace(/\/+$/, "");
50
+ if (typeof source === "string") {
51
+ this.name = source;
52
+ this.exists = true;
53
+ }
54
+ }
55
+ /** The bucket's name; a project bucket's is known after the first call. */
56
+ get bucket() {
57
+ if (this.name) return this.name;
58
+ const { identity } = this.source;
59
+ return require_projectBucket.projectBucketName(identity.scope, "<account id>");
60
+ }
61
+ /**
62
+ * The bucket, or `null` for a project bucket that does not exist yet and
63
+ * is not to be created (`create: false`, a read).
64
+ */
65
+ async use(create) {
66
+ if (this.exists) return this.name;
67
+ const source = this.source;
68
+ this.name ??= require_projectBucket.projectBucketName(source.identity.scope, await require_projectBucket.callerAccountId(source.sts));
69
+ if (create) await require_projectBucket.ensureProjectBucket(this.client, {
70
+ bucket: this.name,
71
+ region: source.region,
72
+ identity: source.identity
73
+ });
74
+ else if (await require_projectBucket.findProjectBucket(this.client, this.name) === "none") return null;
75
+ this.exists = true;
76
+ return this.name;
77
+ }
78
+ static create(options) {
79
+ const endpoint = options.endpoint ?? process.env.AWS_ENDPOINT_URL_S3 ?? process.env.AWS_ENDPOINT_URL;
80
+ const region = options.region ?? process.env.AWS_REGION ?? "us-east-1";
81
+ const config = {
82
+ region,
83
+ endpoint,
84
+ forcePathStyle: endpoint ? true : void 0
85
+ };
86
+ if (options.profile) {
87
+ const { fromIni } = require("@aws-sdk/credential-providers");
88
+ config.credentials = fromIni({ profile: options.profile });
89
+ } else if (options.credentials) config.credentials = options.credentials;
90
+ let source;
91
+ if (options.bucket) source = options.bucket;
92
+ else source = {
93
+ identity: require_identity.deployIdentity({
94
+ name: options.workspaceName,
95
+ ...options.namespace ? { deploy: { namespace: options.namespace } } : {}
96
+ }, ""),
97
+ region,
98
+ sts: new _aws_sdk_client_sts.STSClient({
99
+ region,
100
+ ...options.endpoint ? { endpoint: options.endpoint } : {},
101
+ ...config.credentials ? { credentials: config.credentials } : {}
102
+ })
103
+ };
104
+ return new S3StateStore(options.workspaceName, source, new _aws_sdk_client_s3.S3Client(config), options.prefix);
105
+ }
106
+ key(stage, leaf) {
107
+ const path = `${this.workspaceName}/${stage}/${leaf}`;
108
+ return this.prefix ? `${this.prefix}/${path}` : path;
109
+ }
110
+ location(stage) {
111
+ return `s3://${this.bucket}/${this.key(stage, "state.json")}`;
112
+ }
113
+ async readRaw(stage) {
114
+ if (!await this.use(false)) return null;
115
+ const object = await this.get(this.key(stage, "state.json"));
116
+ if (!object) return null;
117
+ return {
118
+ body: object.body,
119
+ version: object.etag
120
+ };
121
+ }
122
+ async writeRaw(stage, body, expectedVersion) {
123
+ await this.use(true);
124
+ const Key = this.key(stage, "state.json");
125
+ try {
126
+ const { ETag } = await this.client.send(new _aws_sdk_client_s3.PutObjectCommand({
127
+ Bucket: this.bucket,
128
+ Key,
129
+ Body: body,
130
+ ContentType: "application/json",
131
+ ...expectedVersion === null ? { IfNoneMatch: "*" } : { IfMatch: expectedVersion }
132
+ }));
133
+ if (ETag) return ETag;
134
+ return (await this.get(Key))?.etag ?? "";
135
+ } catch (error) {
136
+ if (lostRace(error)) {
137
+ const current = await this.get(Key);
138
+ throw new require_sniffer.StateVersionConflict(stage, expectedVersion, current?.etag ?? null);
139
+ }
140
+ throw error;
141
+ }
142
+ }
143
+ async writeV1Backup(stage, body) {
144
+ await this.use(true);
145
+ try {
146
+ await this.client.send(new _aws_sdk_client_s3.PutObjectCommand({
147
+ Bucket: this.bucket,
148
+ Key: this.key(stage, "state.v1.json"),
149
+ Body: body,
150
+ ContentType: "application/json",
151
+ IfNoneMatch: "*"
152
+ }));
153
+ } catch (error) {
154
+ if (!lostRace(error)) throw error;
155
+ }
156
+ }
157
+ async createLock(stage, holder) {
158
+ await this.use(true);
159
+ const Key = this.key(stage, "lock.json");
160
+ try {
161
+ await this.client.send(new _aws_sdk_client_s3.PutObjectCommand({
162
+ Bucket: this.bucket,
163
+ Key,
164
+ Body: JSON.stringify(holder),
165
+ ContentType: "application/json",
166
+ IfNoneMatch: "*"
167
+ }));
168
+ } catch (error) {
169
+ if (lostRace(error)) throw new require_sniffer.StateLocked(stage, await this.readLock(stage), `s3://${this.bucket}/${Key}`);
170
+ throw error;
171
+ }
172
+ }
173
+ async readLock(stage) {
174
+ if (!await this.use(false)) return null;
175
+ const object = await this.get(this.key(stage, "lock.json"));
176
+ if (!object) return null;
177
+ try {
178
+ return JSON.parse(object.body);
179
+ } catch {
180
+ return null;
181
+ }
182
+ }
183
+ async removeLock(stage, holder) {
184
+ if (!await this.use(false)) return;
185
+ const Key = this.key(stage, "lock.json");
186
+ const object = await this.get(Key);
187
+ if (!object) return;
188
+ if (holder) try {
189
+ if (JSON.parse(object.body).id !== holder.id) return;
190
+ } catch {
191
+ return;
192
+ }
193
+ try {
194
+ await this.client.send(new _aws_sdk_client_s3.DeleteObjectCommand({
195
+ Bucket: this.bucket,
196
+ Key,
197
+ IfMatch: object.etag
198
+ }));
199
+ } catch (error) {
200
+ if (!lostRace(error) && !notFound(error)) throw error;
201
+ }
202
+ }
203
+ async get(Key) {
204
+ try {
205
+ const response = await this.client.send(new _aws_sdk_client_s3.GetObjectCommand({
206
+ Bucket: this.bucket,
207
+ Key
208
+ }));
209
+ return {
210
+ body: await response.Body?.transformToString("utf-8") ?? "",
211
+ etag: response.ETag ?? ""
212
+ };
213
+ } catch (error) {
214
+ if (notFound(error)) return null;
215
+ throw error;
216
+ }
217
+ }
218
+ };
219
+ //#endregion
220
+ exports.S3StateStore = S3StateStore;
221
+
222
+ //# sourceMappingURL=S3StateStore-B_2gE9Un.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"S3StateStore-B_2gE9Un.cjs","names":["DocumentStateStore","projectBucketName","callerAccountId","ensureProjectBucket","findProjectBucket","deployIdentity","STSClient","S3Client","PutObjectCommand","StateVersionConflict","StateLocked","DeleteObjectCommand","GetObjectCommand"],"sources":["../src/deploy/S3StateStore.ts"],"sourcesContent":["/**\n * Amazon S3 state store.\n *\n * In the bucket the config names, which must exist — or, with none named, in\n * the project bucket (`providers/projectBucket.ts`): found by its name, which\n * is worked out from the project and the account, and created by the first\n * write (a deploy's lock, `state:push`). A read of a project bucket that does\n * not exist yet is a stage with no state; it creates nothing.\n *\n * - `<prefix>/<workspace>/<stage>/state.json`: the state.\n * - `<prefix>/<workspace>/<stage>/lock.json`: the lock.\n * - `<prefix>/<workspace>/<stage>/state.v1.json`: the v1 state, kept on\n * migration.\n *\n * Every write is conditional on the server: `If-None-Match: *` to create,\n * `If-Match: <etag>` to replace. S3 answers a lost race with 412 (or 409 when\n * two conditional writes are in flight at once), so there is no window\n * between a check and a write for another run to slip into.\n */\n\nimport {\n\tDeleteObjectCommand,\n\tGetObjectCommand,\n\tPutObjectCommand,\n\tS3Client,\n\ttype S3ClientConfig,\n} from '@aws-sdk/client-s3';\nimport { STSClient } from '@aws-sdk/client-sts';\nimport {\n\tcallerAccountId,\n\tensureProjectBucket,\n\tfindProjectBucket,\n\tprojectBucketName,\n} from '../providers/projectBucket';\nimport { type DeployIdentity, deployIdentity } from './identity';\nimport type { AwsRegion } from './StateProvider';\nimport {\n\tDocumentStateStore,\n\ttype LockHolder,\n\ttype RawState,\n\tStateLocked,\n\ttype StateVersion,\n\tStateVersionConflict,\n} from './StateStore';\n\nexport interface S3StateStoreOptions {\n\tworkspaceName: string;\n\t/** Omitted, the project bucket — created by the first write. */\n\tbucket?: string;\n\t/** `deploy.namespace`, for the project bucket's name. */\n\tnamespace?: string;\n\t/** Key prefix inside the bucket; `gkm` by default. */\n\tprefix?: string;\n\tregion?: AwsRegion;\n\t/** Uses the default credential chain when omitted. */\n\tprofile?: string;\n\tcredentials?: S3ClientConfig['credentials'];\n\t/** For the local AWS emulator. */\n\tendpoint?: string;\n}\n\ninterface S3Failure {\n\tname?: string;\n\t$metadata?: { httpStatusCode?: number };\n}\n\n/** A conditional write that lost: the object is not what the write assumed. */\nfunction lostRace(error: unknown): boolean {\n\tconst { name, $metadata } = error as S3Failure;\n\treturn (\n\t\tname === 'PreconditionFailed' ||\n\t\tname === 'ConditionalRequestConflict' ||\n\t\t$metadata?.httpStatusCode === 412 ||\n\t\t$metadata?.httpStatusCode === 409\n\t);\n}\n\nfunction notFound(error: unknown): boolean {\n\tconst { name, $metadata } = error as S3Failure;\n\treturn (\n\t\tname === 'NoSuchKey' ||\n\t\tname === 'NotFound' ||\n\t\t$metadata?.httpStatusCode === 404\n\t);\n}\n\n/** The project bucket, for a store that names no bucket of its own. */\nexport interface ProjectBucketSource {\n\tidentity: Pick<DeployIdentity, 'scope' | 'key'>;\n\tregion: string;\n\t/** What the account id — and so the bucket's name — is read with. */\n\tsts: STSClient;\n}\n\nexport class S3StateStore extends DocumentStateStore {\n\tprivate readonly prefix: string;\n\t/** The bucket's name, once known. */\n\tprivate name?: string;\n\t/** Whether the bucket is known to exist. */\n\tprivate exists = false;\n\n\tconstructor(\n\t\treadonly workspaceName: string,\n\t\tprivate readonly source: string | ProjectBucketSource,\n\t\tprivate readonly client: S3Client,\n\t\tprefix = 'gkm',\n\t) {\n\t\tsuper();\n\t\tthis.prefix = prefix.replace(/\\/+$/, '');\n\t\tif (typeof source === 'string') {\n\t\t\tthis.name = source;\n\t\t\tthis.exists = true;\n\t\t}\n\t}\n\n\t/** The bucket's name; a project bucket's is known after the first call. */\n\tget bucket(): string {\n\t\tif (this.name) return this.name;\n\t\tconst { identity } = this.source as ProjectBucketSource;\n\t\treturn projectBucketName(identity.scope, '<account id>');\n\t}\n\n\t/**\n\t * The bucket, or `null` for a project bucket that does not exist yet and\n\t * is not to be created (`create: false`, a read).\n\t */\n\tprivate async use(create: boolean): Promise<string | null> {\n\t\tif (this.exists) return this.name!;\n\t\tconst source = this.source as ProjectBucketSource;\n\t\tthis.name ??= projectBucketName(\n\t\t\tsource.identity.scope,\n\t\t\tawait callerAccountId(source.sts),\n\t\t);\n\t\tif (create) {\n\t\t\tawait ensureProjectBucket(this.client, {\n\t\t\t\tbucket: this.name,\n\t\t\t\tregion: source.region,\n\t\t\t\tidentity: source.identity,\n\t\t\t});\n\t\t} else if ((await findProjectBucket(this.client, this.name)) === 'none') {\n\t\t\treturn null;\n\t\t}\n\t\tthis.exists = true;\n\t\treturn this.name;\n\t}\n\n\tstatic create(options: S3StateStoreOptions): S3StateStore {\n\t\tconst endpoint =\n\t\t\toptions.endpoint ??\n\t\t\tprocess.env.AWS_ENDPOINT_URL_S3 ??\n\t\t\tprocess.env.AWS_ENDPOINT_URL;\n\t\t// The region the project bucket is created in is the one it is reached in.\n\t\tconst region = options.region ?? process.env.AWS_REGION ?? 'us-east-1';\n\t\tconst config: S3ClientConfig = {\n\t\t\tregion,\n\t\t\tendpoint,\n\t\t\t// The emulator serves buckets by path, not by subdomain.\n\t\t\tforcePathStyle: endpoint ? true : undefined,\n\t\t};\n\t\tif (options.profile) {\n\t\t\t// Required lazily: only a profile needs the credential providers.\n\t\t\tconst { fromIni } = require('@aws-sdk/credential-providers');\n\t\t\tconfig.credentials = fromIni({ profile: options.profile });\n\t\t} else if (options.credentials) {\n\t\t\tconfig.credentials = options.credentials;\n\t\t}\n\t\tlet source: string | ProjectBucketSource;\n\t\tif (options.bucket) {\n\t\t\tsource = options.bucket;\n\t\t} else {\n\t\t\tsource = {\n\t\t\t\tidentity: deployIdentity(\n\t\t\t\t\t{\n\t\t\t\t\t\tname: options.workspaceName,\n\t\t\t\t\t\t...(options.namespace\n\t\t\t\t\t\t\t? { deploy: { namespace: options.namespace } }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t},\n\t\t\t\t\t'',\n\t\t\t\t),\n\t\t\t\tregion,\n\t\t\t\tsts: new STSClient({\n\t\t\t\t\tregion,\n\t\t\t\t\t...(options.endpoint ? { endpoint: options.endpoint } : {}),\n\t\t\t\t\t...(config.credentials ? { credentials: config.credentials } : {}),\n\t\t\t\t}),\n\t\t\t};\n\t\t}\n\t\treturn new S3StateStore(\n\t\t\toptions.workspaceName,\n\t\t\tsource,\n\t\t\tnew S3Client(config),\n\t\t\toptions.prefix,\n\t\t);\n\t}\n\n\tprivate key(stage: string, leaf: string): string {\n\t\tconst path = `${this.workspaceName}/${stage}/${leaf}`;\n\t\treturn this.prefix ? `${this.prefix}/${path}` : path;\n\t}\n\n\tprotected location(stage: string): string {\n\t\treturn `s3://${this.bucket}/${this.key(stage, 'state.json')}`;\n\t}\n\n\tprotected async readRaw(stage: string): Promise<RawState | null> {\n\t\tif (!(await this.use(false))) return null;\n\t\tconst object = await this.get(this.key(stage, 'state.json'));\n\t\tif (!object) return null;\n\t\treturn { body: object.body, version: object.etag };\n\t}\n\n\tprotected async writeRaw(\n\t\tstage: string,\n\t\tbody: string,\n\t\texpectedVersion: StateVersion | null,\n\t): Promise<StateVersion> {\n\t\tawait this.use(true);\n\t\tconst Key = this.key(stage, 'state.json');\n\t\ttry {\n\t\t\tconst { ETag } = await this.client.send(\n\t\t\t\tnew PutObjectCommand({\n\t\t\t\t\tBucket: this.bucket,\n\t\t\t\t\tKey,\n\t\t\t\t\tBody: body,\n\t\t\t\t\tContentType: 'application/json',\n\t\t\t\t\t...(expectedVersion === null\n\t\t\t\t\t\t? { IfNoneMatch: '*' }\n\t\t\t\t\t\t: { IfMatch: expectedVersion }),\n\t\t\t\t}),\n\t\t\t);\n\t\t\tif (ETag) return ETag;\n\t\t\t// Some S3-compatible servers omit the ETag on a conditional put.\n\t\t\treturn (await this.get(Key))?.etag ?? '';\n\t\t} catch (error) {\n\t\t\tif (lostRace(error)) {\n\t\t\t\tconst current = await this.get(Key);\n\t\t\t\tthrow new StateVersionConflict(\n\t\t\t\t\tstage,\n\t\t\t\t\texpectedVersion,\n\t\t\t\t\tcurrent?.etag ?? null,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprotected async writeV1Backup(stage: string, body: string): Promise<void> {\n\t\tawait this.use(true);\n\t\ttry {\n\t\t\tawait this.client.send(\n\t\t\t\tnew PutObjectCommand({\n\t\t\t\t\tBucket: this.bucket,\n\t\t\t\t\tKey: this.key(stage, 'state.v1.json'),\n\t\t\t\t\tBody: body,\n\t\t\t\t\tContentType: 'application/json',\n\t\t\t\t\tIfNoneMatch: '*',\n\t\t\t\t}),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\t// The first migration's backup is the one worth keeping.\n\t\t\tif (!lostRace(error)) throw error;\n\t\t}\n\t}\n\n\tprotected async createLock(stage: string, holder: LockHolder): Promise<void> {\n\t\tawait this.use(true);\n\t\tconst Key = this.key(stage, 'lock.json');\n\t\ttry {\n\t\t\tawait this.client.send(\n\t\t\t\tnew PutObjectCommand({\n\t\t\t\t\tBucket: this.bucket,\n\t\t\t\t\tKey,\n\t\t\t\t\tBody: JSON.stringify(holder),\n\t\t\t\t\tContentType: 'application/json',\n\t\t\t\t\tIfNoneMatch: '*',\n\t\t\t\t}),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tif (lostRace(error)) {\n\t\t\t\tthrow new StateLocked(\n\t\t\t\t\tstage,\n\t\t\t\t\tawait this.readLock(stage),\n\t\t\t\t\t`s3://${this.bucket}/${Key}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprotected async readLock(stage: string): Promise<LockHolder | null> {\n\t\tif (!(await this.use(false))) return null;\n\t\tconst object = await this.get(this.key(stage, 'lock.json'));\n\t\tif (!object) return null;\n\t\ttry {\n\t\t\treturn JSON.parse(object.body) as LockHolder;\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tprotected async removeLock(\n\t\tstage: string,\n\t\tholder: LockHolder | null,\n\t): Promise<void> {\n\t\tif (!(await this.use(false))) return;\n\t\tconst Key = this.key(stage, 'lock.json');\n\t\tconst object = await this.get(Key);\n\t\tif (!object) return;\n\t\tif (holder) {\n\t\t\ttry {\n\t\t\t\tif ((JSON.parse(object.body) as LockHolder).id !== holder.id) return;\n\t\t\t} catch {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\ttry {\n\t\t\t// Conditional on the lock read above, so a lock taken by another\n\t\t\t// run in the meantime survives.\n\t\t\tawait this.client.send(\n\t\t\t\tnew DeleteObjectCommand({\n\t\t\t\t\tBucket: this.bucket,\n\t\t\t\t\tKey,\n\t\t\t\t\tIfMatch: object.etag,\n\t\t\t\t}),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tif (!lostRace(error) && !notFound(error)) throw error;\n\t\t}\n\t}\n\n\tprivate async get(\n\t\tKey: string,\n\t): Promise<{ body: string; etag: string } | null> {\n\t\ttry {\n\t\t\tconst response = await this.client.send(\n\t\t\t\tnew GetObjectCommand({ Bucket: this.bucket, Key }),\n\t\t\t);\n\t\t\tconst body = (await response.Body?.transformToString('utf-8')) ?? '';\n\t\t\treturn { body, etag: response.ETag ?? '' };\n\t\t} catch (error) {\n\t\t\tif (notFound(error)) return null;\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,SAAS,SAAS,OAAyB;CAC1C,MAAM,EAAE,MAAM,cAAc;CAC5B,OACC,SAAS,wBACT,SAAS,gCACT,WAAW,mBAAmB,OAC9B,WAAW,mBAAmB;AAEhC;AAEA,SAAS,SAAS,OAAyB;CAC1C,MAAM,EAAE,MAAM,cAAc;CAC5B,OACC,SAAS,eACT,SAAS,cACT,WAAW,mBAAmB;AAEhC;AAUA,IAAa,eAAb,MAAa,qBAAqBA,gBAAAA,mBAAmB;CAQ1C;CACQ;CACA;CATlB;;CAEA;;CAEA,SAAiB;CAEjB,YACC,eACA,QACA,QACA,SAAS,OACR;EACD,MAAM;EALG,KAAA,gBAAA;EACQ,KAAA,SAAA;EACA,KAAA,SAAA;EAIjB,KAAK,SAAS,OAAO,QAAQ,QAAQ,EAAE;EACvC,IAAI,OAAO,WAAW,UAAU;GAC/B,KAAK,OAAO;GACZ,KAAK,SAAS;EACf;CACD;;CAGA,IAAI,SAAiB;EACpB,IAAI,KAAK,MAAM,OAAO,KAAK;EAC3B,MAAM,EAAE,aAAa,KAAK;EAC1B,OAAOC,sBAAAA,kBAAkB,SAAS,OAAO,cAAc;CACxD;;;;;CAMA,MAAc,IAAI,QAAyC;EAC1D,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,CACF;EACD,SAAS,OAAO;GACf,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS,KAAK,GAAG,MAAM;EACjD;CACD;CAEA,MAAc,IACb,KACiD;EACjD,IAAI;GACH,MAAM,WAAW,MAAM,KAAK,OAAO,KAClC,IAAIC,mBAAAA,iBAAiB;IAAE,QAAQ,KAAK;IAAQ;GAAI,CAAC,CAClD;GAEA,OAAO;IAAE,MADK,MAAM,SAAS,MAAM,kBAAkB,OAAO,KAAM;IACnD,MAAM,SAAS,QAAQ;GAAG;EAC1C,SAAS,OAAO;GACf,IAAI,SAAS,KAAK,GAAG,OAAO;GAC5B,MAAM;EACP;CACD;AACD"}
@@ -0,0 +1,204 @@
1
+ const require_sniffer = require("./sniffer-BjBZ01PE.cjs");
2
+ let _aws_sdk_client_ssm = require("@aws-sdk/client-ssm");
3
+ //#region src/deploy/SSMStateStore.ts
4
+ /**
5
+ * AWS SSM Parameter Store state store.
6
+ *
7
+ * - `/gkm/<workspace>/<stage>/state`: the state, a SecureString.
8
+ * - `/gkm/<workspace>/<stage>/lock`: the lock, created only if absent.
9
+ * - `/gkm/<workspace>/<stage>/state.v1`: the v1 state, kept on migration.
10
+ *
11
+ * SSM has no conditional put, so a write checks the parameter's version
12
+ * before it puts, and checks the version the put returns after: a put that
13
+ * did not land exactly one version above the one it was based on raced
14
+ * another writer, and raises `StateVersionConflict` rather than reporting
15
+ * success. Both writes stay in the parameter's history.
16
+ *
17
+ * Size: the state is written with the Intelligent-Tiering tier, so SSM picks
18
+ * the advanced tier (8 KB) once a value passes the standard tier's 4 KB, and a
19
+ * document over {@link SSM_COMPRESS_OVER} bytes is stored gzipped, as `gz:`
20
+ * and base64. Both forms are read, so a document written before either is
21
+ * read as it was. A deploy checks before it starts that the stage's document
22
+ * leaves room under {@link SSM_MAX_BYTES} (`assertStateRoom`); a write SSM
23
+ * refuses anyway raises `StateRejectedBySsm` rather than the SDK's error.
24
+ */
25
+ /** The most an advanced-tier parameter holds — what the state must fit. */
26
+ const SSM_MAX_BYTES = 8192;
27
+ /**
28
+ * `body` as the state parameter stores it: past the threshold, without its
29
+ * indentation and compressed.
30
+ */
31
+ function packSsmBody(body) {
32
+ if (Buffer.byteLength(body) <= 3072) return body;
33
+ let compact = body;
34
+ try {
35
+ compact = JSON.stringify(JSON.parse(body));
36
+ } catch {}
37
+ return require_sniffer.compressBody(compact);
38
+ }
39
+ /** A refusal of the value itself — its size, past the tier's limit. */
40
+ function refusedValue(error) {
41
+ return error?.name === "ValidationException";
42
+ }
43
+ var SSMStateStore = class SSMStateStore extends require_sniffer.DocumentStateStore {
44
+ workspaceName;
45
+ client;
46
+ region;
47
+ constructor(workspaceName, client, region = "<region>") {
48
+ super();
49
+ this.workspaceName = workspaceName;
50
+ this.client = client;
51
+ this.region = region;
52
+ }
53
+ static create(options) {
54
+ const config = {
55
+ region: options.region,
56
+ endpoint: options.endpoint
57
+ };
58
+ if (options.profile) {
59
+ const { fromIni } = require("@aws-sdk/credential-providers");
60
+ config.credentials = fromIni({ profile: options.profile });
61
+ } else if (options.credentials) config.credentials = options.credentials;
62
+ return new SSMStateStore(options.workspaceName, new _aws_sdk_client_ssm.SSMClient(config), options.region);
63
+ }
64
+ name(stage, leaf) {
65
+ return `/gkm/${this.workspaceName}/${stage}/${leaf}`;
66
+ }
67
+ location(stage) {
68
+ return `ssm:${this.name(stage, "state")}`;
69
+ }
70
+ async readRaw(stage) {
71
+ const parameter = await this.get(this.name(stage, "state"));
72
+ if (!parameter) return null;
73
+ return {
74
+ body: require_sniffer.decompressBody(parameter.value),
75
+ version: String(parameter.version)
76
+ };
77
+ }
78
+ /** The stage's document as the next write would store it. */
79
+ async capacity(stage) {
80
+ const raw = await this.readRaw(stage);
81
+ if (!raw) return null;
82
+ return {
83
+ bytes: Buffer.byteLength(packSsmBody(raw.body)),
84
+ limit: SSM_MAX_BYTES,
85
+ location: this.location(stage),
86
+ region: this.region
87
+ };
88
+ }
89
+ async writeRaw(stage, document, expectedVersion) {
90
+ try {
91
+ return await this.put(stage, packSsmBody(document), expectedVersion);
92
+ } catch (error) {
93
+ if (!refusedValue(error)) throw error;
94
+ throw new require_sniffer.StateRejectedBySsm(stage, Buffer.byteLength(packSsmBody(document)), this.location(stage), this.region, error);
95
+ }
96
+ }
97
+ /** The conditional put of `body`, stored as it is given. */
98
+ async put(stage, body, expectedVersion) {
99
+ const Name = this.name(stage, "state");
100
+ const Description = `GKM deployment state for ${this.workspaceName}/${stage}`;
101
+ if (expectedVersion === null) try {
102
+ const { Version } = await this.client.send(new _aws_sdk_client_ssm.PutParameterCommand({
103
+ Name,
104
+ Value: body,
105
+ Type: "SecureString",
106
+ Tier: "Intelligent-Tiering",
107
+ Description
108
+ }));
109
+ return String(Version);
110
+ } catch (error) {
111
+ if (error instanceof _aws_sdk_client_ssm.ParameterAlreadyExists) {
112
+ const current = await this.get(Name);
113
+ throw new require_sniffer.StateVersionConflict(stage, null, current ? String(current.version) : null);
114
+ }
115
+ throw error;
116
+ }
117
+ const current = await this.get(Name);
118
+ const actual = current ? String(current.version) : null;
119
+ if (actual !== expectedVersion) throw new require_sniffer.StateVersionConflict(stage, expectedVersion, actual);
120
+ const { Version } = await this.client.send(new _aws_sdk_client_ssm.PutParameterCommand({
121
+ Name,
122
+ Value: body,
123
+ Type: "SecureString",
124
+ Tier: "Intelligent-Tiering",
125
+ Overwrite: true,
126
+ Description
127
+ }));
128
+ if (Version !== Number(expectedVersion) + 1) throw new require_sniffer.StateVersionConflict(stage, expectedVersion, String((Version ?? 1) - 1));
129
+ const landed = await this.get(Name);
130
+ if (landed && landed.version === Version && landed.value !== body) throw new require_sniffer.StateVersionConflict(stage, expectedVersion, String(Version));
131
+ return String(Version);
132
+ }
133
+ async writeV1Backup(stage, body) {
134
+ try {
135
+ await this.client.send(new _aws_sdk_client_ssm.PutParameterCommand({
136
+ Name: this.name(stage, "state.v1"),
137
+ Value: packSsmBody(body),
138
+ Type: "SecureString",
139
+ Tier: "Intelligent-Tiering",
140
+ Description: `GKM v1 deployment state for ${this.workspaceName}/${stage}, kept on migration`
141
+ }));
142
+ } catch (error) {
143
+ if (!(error instanceof _aws_sdk_client_ssm.ParameterAlreadyExists)) throw error;
144
+ }
145
+ }
146
+ async createLock(stage, holder) {
147
+ const Name = this.name(stage, "lock");
148
+ try {
149
+ await this.client.send(new _aws_sdk_client_ssm.PutParameterCommand({
150
+ Name,
151
+ Value: JSON.stringify(holder),
152
+ Type: "String",
153
+ Description: `GKM deploy lock for ${this.workspaceName}/${stage}`
154
+ }));
155
+ } catch (error) {
156
+ if (error instanceof _aws_sdk_client_ssm.ParameterAlreadyExists) throw new require_sniffer.StateLocked(stage, await this.readLock(stage), `ssm:${Name}`);
157
+ throw error;
158
+ }
159
+ const created = await this.get(Name);
160
+ const recorded = created ? parseHolder(created.value) : null;
161
+ if (created?.version !== 1 || recorded?.id !== holder.id) throw new require_sniffer.StateLocked(stage, recorded, `ssm:${Name}`);
162
+ }
163
+ async readLock(stage) {
164
+ const parameter = await this.get(this.name(stage, "lock"));
165
+ return parameter ? parseHolder(parameter.value) : null;
166
+ }
167
+ async removeLock(stage, holder) {
168
+ if (holder) {
169
+ if ((await this.readLock(stage))?.id !== holder.id) return;
170
+ }
171
+ try {
172
+ await this.client.send(new _aws_sdk_client_ssm.DeleteParameterCommand({ Name: this.name(stage, "lock") }));
173
+ } catch (error) {
174
+ if (!(error instanceof _aws_sdk_client_ssm.ParameterNotFound)) throw error;
175
+ }
176
+ }
177
+ async get(Name) {
178
+ try {
179
+ const { Parameter } = await this.client.send(new _aws_sdk_client_ssm.GetParameterCommand({
180
+ Name,
181
+ WithDecryption: true
182
+ }));
183
+ if (Parameter?.Value === void 0) return null;
184
+ return {
185
+ value: Parameter.Value,
186
+ version: Parameter.Version ?? 1
187
+ };
188
+ } catch (error) {
189
+ if (error instanceof _aws_sdk_client_ssm.ParameterNotFound) return null;
190
+ throw error;
191
+ }
192
+ }
193
+ };
194
+ function parseHolder(value) {
195
+ try {
196
+ return JSON.parse(value);
197
+ } catch {
198
+ return null;
199
+ }
200
+ }
201
+ //#endregion
202
+ exports.SSMStateStore = SSMStateStore;
203
+
204
+ //# sourceMappingURL=SSMStateStore-CTDEI5Bi.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SSMStateStore-CTDEI5Bi.cjs","names":["compressBody","DocumentStateStore","SSMClient","decompressBody","StateRejectedBySsm","PutParameterCommand","ParameterAlreadyExists","StateVersionConflict","StateLocked","DeleteParameterCommand","ParameterNotFound","GetParameterCommand"],"sources":["../src/deploy/SSMStateStore.ts"],"sourcesContent":["/**\n * AWS SSM Parameter Store state store.\n *\n * - `/gkm/<workspace>/<stage>/state`: the state, a SecureString.\n * - `/gkm/<workspace>/<stage>/lock`: the lock, created only if absent.\n * - `/gkm/<workspace>/<stage>/state.v1`: the v1 state, kept on migration.\n *\n * SSM has no conditional put, so a write checks the parameter's version\n * before it puts, and checks the version the put returns after: a put that\n * did not land exactly one version above the one it was based on raced\n * another writer, and raises `StateVersionConflict` rather than reporting\n * success. Both writes stay in the parameter's history.\n *\n * Size: the state is written with the Intelligent-Tiering tier, so SSM picks\n * the advanced tier (8 KB) once a value passes the standard tier's 4 KB, and a\n * document over {@link SSM_COMPRESS_OVER} bytes is stored gzipped, as `gz:`\n * and base64. Both forms are read, so a document written before either is\n * read as it was. A deploy checks before it starts that the stage's document\n * leaves room under {@link SSM_MAX_BYTES} (`assertStateRoom`); a write SSM\n * refuses anyway raises `StateRejectedBySsm` rather than the SDK's error.\n */\n\nimport {\n\tDeleteParameterCommand,\n\tGetParameterCommand,\n\tParameterAlreadyExists,\n\tParameterNotFound,\n\tPutParameterCommand,\n\tSSMClient,\n\ttype SSMClientConfig,\n} from '@aws-sdk/client-ssm';\nimport type { AwsRegion } from './StateProvider';\nimport {\n\tcompressBody,\n\tDocumentStateStore,\n\tdecompressBody,\n\ttype LockHolder,\n\ttype RawState,\n\ttype StateCapacity,\n\tStateLocked,\n\tStateRejectedBySsm,\n\ttype StateVersion,\n\tStateVersionConflict,\n} from './StateStore';\n\n/** The most an advanced-tier parameter holds — what the state must fit. */\nexport const SSM_MAX_BYTES = 8192;\n/** A body past this is stored compressed: well under the standard 4 KB. */\nexport const SSM_COMPRESS_OVER = 3072;\n\n/**\n * `body` as the state parameter stores it: past the threshold, without its\n * indentation and compressed.\n */\nexport function packSsmBody(body: string): string {\n\tif (Buffer.byteLength(body) <= SSM_COMPRESS_OVER) return body;\n\tlet compact = body;\n\ttry {\n\t\tcompact = JSON.stringify(JSON.parse(body));\n\t} catch {\n\t\t// Not JSON: stored as it was given, compressed.\n\t}\n\treturn compressBody(compact);\n}\n\n/** A refusal of the value itself — its size, past the tier's limit. */\nfunction refusedValue(error: unknown): boolean {\n\treturn (error as { name?: string })?.name === 'ValidationException';\n}\n\nexport interface SSMStateStoreOptions {\n\tworkspaceName: string;\n\tregion?: AwsRegion;\n\t/** Uses the default credential chain when omitted. */\n\tprofile?: string;\n\tcredentials?: SSMClientConfig['credentials'];\n\t/** For the local AWS emulator. */\n\tendpoint?: string;\n}\n\nexport class SSMStateStore extends DocumentStateStore {\n\tconstructor(\n\t\treadonly workspaceName: string,\n\t\tprivate readonly client: SSMClient,\n\t\t/** For messages; the client's own region is used for every call. */\n\t\treadonly region = '<region>',\n\t) {\n\t\tsuper();\n\t}\n\n\tstatic create(options: SSMStateStoreOptions): SSMStateStore {\n\t\tconst config: SSMClientConfig = {\n\t\t\tregion: options.region,\n\t\t\tendpoint: options.endpoint,\n\t\t};\n\t\tif (options.profile) {\n\t\t\t// Required lazily: only a profile needs the credential providers.\n\t\t\tconst { fromIni } = require('@aws-sdk/credential-providers');\n\t\t\tconfig.credentials = fromIni({ profile: options.profile });\n\t\t} else if (options.credentials) {\n\t\t\tconfig.credentials = options.credentials;\n\t\t}\n\t\treturn new SSMStateStore(\n\t\t\toptions.workspaceName,\n\t\t\tnew SSMClient(config),\n\t\t\toptions.region,\n\t\t);\n\t}\n\n\tprivate name(stage: string, leaf: string): string {\n\t\treturn `/gkm/${this.workspaceName}/${stage}/${leaf}`;\n\t}\n\n\tprotected location(stage: string): string {\n\t\treturn `ssm:${this.name(stage, 'state')}`;\n\t}\n\n\tprotected async readRaw(stage: string): Promise<RawState | null> {\n\t\tconst parameter = await this.get(this.name(stage, 'state'));\n\t\tif (!parameter) return null;\n\t\treturn {\n\t\t\tbody: decompressBody(parameter.value),\n\t\t\tversion: String(parameter.version),\n\t\t};\n\t}\n\n\t/** The stage's document as the next write would store it. */\n\tasync capacity(stage: string): Promise<StateCapacity | null> {\n\t\tconst raw = await this.readRaw(stage);\n\t\tif (!raw) return null;\n\t\treturn {\n\t\t\tbytes: Buffer.byteLength(packSsmBody(raw.body)),\n\t\t\tlimit: SSM_MAX_BYTES,\n\t\t\tlocation: this.location(stage),\n\t\t\tregion: this.region,\n\t\t};\n\t}\n\n\tprotected async writeRaw(\n\t\tstage: string,\n\t\tdocument: string,\n\t\texpectedVersion: StateVersion | null,\n\t): Promise<StateVersion> {\n\t\ttry {\n\t\t\treturn await this.put(stage, packSsmBody(document), expectedVersion);\n\t\t} catch (error) {\n\t\t\tif (!refusedValue(error)) throw error;\n\t\t\tthrow new StateRejectedBySsm(\n\t\t\t\tstage,\n\t\t\t\tBuffer.byteLength(packSsmBody(document)),\n\t\t\t\tthis.location(stage),\n\t\t\t\tthis.region,\n\t\t\t\terror,\n\t\t\t);\n\t\t}\n\t}\n\n\t/** The conditional put of `body`, stored as it is given. */\n\tprivate async put(\n\t\tstage: string,\n\t\tbody: string,\n\t\texpectedVersion: StateVersion | null,\n\t): Promise<StateVersion> {\n\t\tconst Name = this.name(stage, 'state');\n\t\tconst Description = `GKM deployment state for ${this.workspaceName}/${stage}`;\n\n\t\tif (expectedVersion === null) {\n\t\t\ttry {\n\t\t\t\tconst { Version } = await this.client.send(\n\t\t\t\t\tnew PutParameterCommand({\n\t\t\t\t\t\tName,\n\t\t\t\t\t\tValue: body,\n\t\t\t\t\t\tType: 'SecureString',\n\t\t\t\t\t\tTier: 'Intelligent-Tiering',\n\t\t\t\t\t\tDescription,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\treturn String(Version);\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof ParameterAlreadyExists) {\n\t\t\t\t\tconst current = await this.get(Name);\n\t\t\t\t\tthrow new StateVersionConflict(\n\t\t\t\t\t\tstage,\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tcurrent ? String(current.version) : null,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\n\t\tconst current = await this.get(Name);\n\t\tconst actual = current ? String(current.version) : null;\n\t\tif (actual !== expectedVersion) {\n\t\t\tthrow new StateVersionConflict(stage, expectedVersion, actual);\n\t\t}\n\n\t\tconst { Version } = await this.client.send(\n\t\t\tnew PutParameterCommand({\n\t\t\t\tName,\n\t\t\t\tValue: body,\n\t\t\t\tType: 'SecureString',\n\t\t\t\tTier: 'Intelligent-Tiering',\n\t\t\t\tOverwrite: true,\n\t\t\t\tDescription,\n\t\t\t}),\n\t\t);\n\t\tif (Version !== Number(expectedVersion) + 1) {\n\t\t\t// Another put landed between the check and this one. Ours is now\n\t\t\t// on top, but the caller that wrote the other believes its write\n\t\t\t// is current — its next write will conflict too, so neither is\n\t\t\t// lost silently.\n\t\t\tthrow new StateVersionConflict(\n\t\t\t\tstage,\n\t\t\t\texpectedVersion,\n\t\t\t\tString((Version ?? 1) - 1),\n\t\t\t);\n\t\t}\n\n\t\t// The version alone is not enough under an emulator, and need not be\n\t\t// on SSM either: two overwrites that raced can both be answered with\n\t\t// the same version, and both would report success. If the parameter is\n\t\t// still at the version this put returned, it has to hold this body —\n\t\t// otherwise the other put is the one that stuck.\n\t\tconst landed = await this.get(Name);\n\t\tif (landed && landed.version === Version && landed.value !== body) {\n\t\t\tthrow new StateVersionConflict(stage, expectedVersion, String(Version));\n\t\t}\n\t\treturn String(Version);\n\t}\n\n\tprotected async writeV1Backup(stage: string, body: string): Promise<void> {\n\t\ttry {\n\t\t\tawait this.client.send(\n\t\t\t\tnew PutParameterCommand({\n\t\t\t\t\tName: this.name(stage, 'state.v1'),\n\t\t\t\t\t// Kept as it was — the v1 state a person restores by hand —\n\t\t\t\t\t// unless it is too big to store that way.\n\t\t\t\t\tValue: packSsmBody(body),\n\t\t\t\t\tType: 'SecureString',\n\t\t\t\t\tTier: 'Intelligent-Tiering',\n\t\t\t\t\tDescription: `GKM v1 deployment state for ${this.workspaceName}/${stage}, kept on migration`,\n\t\t\t\t}),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\t// The first migration's backup is the one worth keeping.\n\t\t\tif (!(error instanceof ParameterAlreadyExists)) throw error;\n\t\t}\n\t}\n\n\tprotected async createLock(stage: string, holder: LockHolder): Promise<void> {\n\t\tconst Name = this.name(stage, 'lock');\n\t\ttry {\n\t\t\tawait this.client.send(\n\t\t\t\tnew PutParameterCommand({\n\t\t\t\t\tName,\n\t\t\t\t\tValue: JSON.stringify(holder),\n\t\t\t\t\t// A few hundred bytes: the standard tier, which costs nothing.\n\t\t\t\t\tType: 'String',\n\t\t\t\t\tDescription: `GKM deploy lock for ${this.workspaceName}/${stage}`,\n\t\t\t\t}),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tif (error instanceof ParameterAlreadyExists) {\n\t\t\t\tthrow new StateLocked(stage, await this.readLock(stage), `ssm:${Name}`);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\n\t\t// A create-only put is atomic on SSM, so the lock is ours. Read it back\n\t\t// anyway: on a store where two racing creates can both succeed (the\n\t\t// local emulator does, a few times in a hundred) the later one has\n\t\t// overwritten the earlier — version 2, someone else's holder — and\n\t\t// taking the lock regardless would give the stage two deploys.\n\t\tconst created = await this.get(Name);\n\t\tconst recorded = created ? parseHolder(created.value) : null;\n\t\tif (created?.version !== 1 || recorded?.id !== holder.id) {\n\t\t\tthrow new StateLocked(stage, recorded, `ssm:${Name}`);\n\t\t}\n\t}\n\n\tprotected async readLock(stage: string): Promise<LockHolder | null> {\n\t\tconst parameter = await this.get(this.name(stage, 'lock'));\n\t\treturn parameter ? parseHolder(parameter.value) : null;\n\t}\n\n\tprotected async removeLock(\n\t\tstage: string,\n\t\tholder: LockHolder | null,\n\t): Promise<void> {\n\t\tif (holder) {\n\t\t\tconst current = await this.readLock(stage);\n\t\t\tif (current?.id !== holder.id) return;\n\t\t}\n\t\ttry {\n\t\t\tawait this.client.send(\n\t\t\t\tnew DeleteParameterCommand({ Name: this.name(stage, 'lock') }),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tif (!(error instanceof ParameterNotFound)) throw error;\n\t\t}\n\t}\n\n\tprivate async get(\n\t\tName: string,\n\t): Promise<{ value: string; version: number } | null> {\n\t\ttry {\n\t\t\tconst { Parameter } = await this.client.send(\n\t\t\t\tnew GetParameterCommand({ Name, WithDecryption: true }),\n\t\t\t);\n\t\t\tif (Parameter?.Value === undefined) return null;\n\t\t\treturn { value: Parameter.Value, version: Parameter.Version ?? 1 };\n\t\t} catch (error) {\n\t\t\tif (error instanceof ParameterNotFound) return null;\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\nfunction parseHolder(value: string): LockHolder | null {\n\ttry {\n\t\treturn JSON.parse(value) as LockHolder;\n\t} catch {\n\t\treturn null;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAa,gBAAgB;;;;;AAQ7B,SAAgB,YAAY,MAAsB;CACjD,IAAI,OAAO,WAAW,IAAI,KAAA,MAAwB,OAAO;CACzD,IAAI,UAAU;CACd,IAAI;EACH,UAAU,KAAK,UAAU,KAAK,MAAM,IAAI,CAAC;CAC1C,QAAQ,CAER;CACA,OAAOA,gBAAAA,aAAa,OAAO;AAC5B;;AAGA,SAAS,aAAa,OAAyB;CAC9C,OAAQ,OAA6B,SAAS;AAC/C;AAYA,IAAa,gBAAb,MAAa,sBAAsBC,gBAAAA,mBAAmB;CAE3C;CACQ;CAER;CAJV,YACC,eACA,QAEA,SAAkB,Y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