@intentius/chant-lexicon-aws 0.124.98 → 0.124.99

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 (856) hide show
  1. package/dist/actions/dynamodb.d.ts +0 -1
  2. package/dist/actions/ecr.d.ts +0 -1
  3. package/dist/actions/ecs.d.ts +0 -1
  4. package/dist/actions/iam.d.ts +0 -1
  5. package/dist/actions/index.d.ts +0 -1
  6. package/dist/actions/lambda.d.ts +0 -1
  7. package/dist/actions/logs.d.ts +0 -1
  8. package/dist/actions/s3.d.ts +0 -1
  9. package/dist/actions/sns.d.ts +0 -1
  10. package/dist/actions/sqs.d.ts +0 -1
  11. package/dist/agentcore/trace-fetch.d.ts +0 -1
  12. package/dist/agentcore/trace-render.d.ts +0 -1
  13. package/dist/ambient.d.ts +0 -1
  14. package/dist/api/credential-chain.d.ts +0 -1
  15. package/dist/api/read-client.d.ts +0 -1
  16. package/dist/api/signing.d.ts +0 -1
  17. package/dist/behaviour-kinds.d.ts +0 -1
  18. package/dist/caller-identity.d.ts +0 -1
  19. package/dist/capabilities/mapping.json +148 -148
  20. package/dist/capabilities/pack.d.ts +0 -1
  21. package/dist/codegen/docs-cli.d.ts +0 -1
  22. package/dist/codegen/docs.d.ts +0 -1
  23. package/dist/codegen/enum-overlay.d.ts +0 -1
  24. package/dist/codegen/enum-overlay.json +1841 -1841
  25. package/dist/codegen/extensions.d.ts +0 -1
  26. package/dist/codegen/fallback.d.ts +0 -1
  27. package/dist/codegen/generate-cli.d.ts +0 -1
  28. package/dist/codegen/generate-lexicon.d.ts +0 -1
  29. package/dist/codegen/generate-typescript.d.ts +0 -1
  30. package/dist/codegen/generate.d.ts +0 -1
  31. package/dist/codegen/naming.d.ts +0 -1
  32. package/dist/codegen/package.d.ts +0 -1
  33. package/dist/codegen/patches.d.ts +0 -1
  34. package/dist/codegen/property-overlay.d.ts +0 -1
  35. package/dist/codegen/property-overlay.json +2 -2
  36. package/dist/codegen/sam.d.ts +0 -1
  37. package/dist/codegen/typecheck.d.ts +0 -1
  38. package/dist/codegen/versions.d.ts +0 -1
  39. package/dist/components/__tests__/mock-cloud-executor.d.ts +0 -1
  40. package/dist/components/apply.d.ts +0 -1
  41. package/dist/components/builders.d.ts +0 -1
  42. package/dist/components/capability-plugin.d.ts +0 -1
  43. package/dist/components/cfn-adopt-run.d.ts +0 -1
  44. package/dist/components/cfn-adopt.d.ts +0 -1
  45. package/dist/components/cfn-imports.d.ts +0 -1
  46. package/dist/components/cloud-executor.d.ts +0 -1
  47. package/dist/components/config-bom.d.ts +0 -1
  48. package/dist/components/host-delivery.d.ts +0 -1
  49. package/dist/components/index.d.ts +0 -1
  50. package/dist/components/job-submission.d.ts +0 -1
  51. package/dist/components/publish.d.ts +0 -1
  52. package/dist/components/safety.d.ts +0 -1
  53. package/dist/components/wait-aws.d.ts +0 -1
  54. package/dist/composites/agentcore-agent.d.ts +0 -1
  55. package/dist/composites/agentcore-trust-policy.d.ts +0 -1
  56. package/dist/composites/alb-shared.d.ts +0 -1
  57. package/dist/composites/bucket-deployment.d.ts +0 -1
  58. package/dist/composites/catalog.d.ts +0 -1
  59. package/dist/composites/dynamodb-table.d.ts +0 -1
  60. package/dist/composites/ec2-instance-bundle.d.ts +0 -1
  61. package/dist/composites/ec2-instance-role.d.ts +0 -1
  62. package/dist/composites/ecr-repository.d.ts +0 -1
  63. package/dist/composites/ecs-trust-policy.d.ts +0 -1
  64. package/dist/composites/efs-with-access-point.d.ts +0 -1
  65. package/dist/composites/eks-cluster.d.ts +0 -1
  66. package/dist/composites/fargate-alb.d.ts +0 -1
  67. package/dist/composites/fargate-service.d.ts +0 -1
  68. package/dist/composites/index.d.ts +0 -1
  69. package/dist/composites/lambda-api.d.ts +0 -1
  70. package/dist/composites/lambda-dynamodb.d.ts +0 -1
  71. package/dist/composites/lambda-eventbridge.d.ts +0 -1
  72. package/dist/composites/lambda-function.d.ts +0 -1
  73. package/dist/composites/lambda-s3.d.ts +0 -1
  74. package/dist/composites/lambda-sns.d.ts +0 -1
  75. package/dist/composites/lambda-sqs.d.ts +0 -1
  76. package/dist/composites/landing-zone.d.ts +0 -1
  77. package/dist/composites/latency-entry.d.ts +0 -1
  78. package/dist/composites/microvm-app.d.ts +0 -1
  79. package/dist/composites/minimal-vpc.d.ts +0 -1
  80. package/dist/composites/monitoring-stack.d.ts +0 -1
  81. package/dist/composites/nlb-service.d.ts +0 -1
  82. package/dist/composites/rds-instance.d.ts +0 -1
  83. package/dist/composites/scheduled-lambda.d.ts +0 -1
  84. package/dist/composites/solr-fargate-service.d.ts +0 -1
  85. package/dist/composites/step-functions-workflow.d.ts +0 -1
  86. package/dist/composites/vpc-default.d.ts +0 -1
  87. package/dist/condition.d.ts +0 -1
  88. package/dist/coverage.d.ts +0 -1
  89. package/dist/deep-observe.d.ts +0 -1
  90. package/dist/deep-topology.d.ts +0 -1
  91. package/dist/default-tags.d.ts +0 -1
  92. package/dist/defaults.d.ts +0 -1
  93. package/dist/dependencies.d.ts +0 -1
  94. package/dist/detect.d.ts +0 -1
  95. package/dist/disruption.d.ts +0 -1
  96. package/dist/effect-receipt-row.d.ts +0 -1
  97. package/dist/generated/index.d.ts +0 -1
  98. package/dist/generated/runtime.d.ts +0 -1
  99. package/dist/governance.d.ts +0 -1
  100. package/dist/health.d.ts +0 -1
  101. package/dist/identity-observe.d.ts +0 -1
  102. package/dist/import/generator.d.ts +0 -1
  103. package/dist/import/live-export.d.ts +0 -1
  104. package/dist/import/parser.d.ts +0 -1
  105. package/dist/importable.d.ts +0 -1
  106. package/dist/index-identity.d.ts +0 -1
  107. package/dist/index-import.d.ts +0 -1
  108. package/dist/index.d.ts +0 -1
  109. package/dist/integrity.json +2 -2
  110. package/dist/intrinsics.d.ts +0 -1
  111. package/dist/lint/audit-catalog.d.ts +0 -1
  112. package/dist/lint/audit-lineage.d.ts +0 -1
  113. package/dist/lint/post-synth/cf-refs.d.ts +0 -1
  114. package/dist/lint/post-synth/cor020.d.ts +0 -1
  115. package/dist/lint/post-synth/ext001.d.ts +0 -1
  116. package/dist/lint/post-synth/index.d.ts +0 -1
  117. package/dist/lint/post-synth/waw010.d.ts +0 -1
  118. package/dist/lint/post-synth/waw011.d.ts +0 -1
  119. package/dist/lint/post-synth/waw013.d.ts +0 -1
  120. package/dist/lint/post-synth/waw014.d.ts +0 -1
  121. package/dist/lint/post-synth/waw015.d.ts +0 -1
  122. package/dist/lint/post-synth/waw016.d.ts +0 -1
  123. package/dist/lint/post-synth/waw017.d.ts +0 -1
  124. package/dist/lint/post-synth/waw018.d.ts +0 -1
  125. package/dist/lint/post-synth/waw019.d.ts +0 -1
  126. package/dist/lint/post-synth/waw020.d.ts +0 -1
  127. package/dist/lint/post-synth/waw021.d.ts +0 -1
  128. package/dist/lint/post-synth/waw022.d.ts +0 -1
  129. package/dist/lint/post-synth/waw023.d.ts +0 -1
  130. package/dist/lint/post-synth/waw024.d.ts +0 -1
  131. package/dist/lint/post-synth/waw025.d.ts +0 -1
  132. package/dist/lint/post-synth/waw026.d.ts +0 -1
  133. package/dist/lint/post-synth/waw027.d.ts +0 -1
  134. package/dist/lint/post-synth/waw028.d.ts +0 -1
  135. package/dist/lint/post-synth/waw029.d.ts +0 -1
  136. package/dist/lint/post-synth/waw030.d.ts +0 -1
  137. package/dist/lint/post-synth/waw031.d.ts +0 -1
  138. package/dist/lint/post-synth/waw032.d.ts +0 -1
  139. package/dist/lint/post-synth/waw033.d.ts +0 -1
  140. package/dist/lint/post-synth/waw034.d.ts +0 -1
  141. package/dist/lint/post-synth/waw035.d.ts +0 -1
  142. package/dist/lint/post-synth/waw036.d.ts +0 -1
  143. package/dist/lint/post-synth/waw037.d.ts +0 -1
  144. package/dist/lint/post-synth/waw038.d.ts +0 -1
  145. package/dist/lint/post-synth/waw039.d.ts +0 -1
  146. package/dist/lint/post-synth/waw040.d.ts +0 -1
  147. package/dist/lint/post-synth/waw041.d.ts +0 -1
  148. package/dist/lint/post-synth/waw042.d.ts +0 -1
  149. package/dist/lint/post-synth/waw043.d.ts +0 -1
  150. package/dist/lint/post-synth/waw044.d.ts +0 -1
  151. package/dist/lint/post-synth/waw045.d.ts +0 -1
  152. package/dist/lint/post-synth/waw046.d.ts +0 -1
  153. package/dist/lint/post-synth/waw047.d.ts +0 -1
  154. package/dist/lint/post-synth/waw048.d.ts +0 -1
  155. package/dist/lint/post-synth/waw049.d.ts +0 -1
  156. package/dist/lint/post-synth/waw050.d.ts +0 -1
  157. package/dist/lint/post-synth/waw051.d.ts +0 -1
  158. package/dist/lint/post-synth/waw052.d.ts +0 -1
  159. package/dist/lint/post-synth/waw053.d.ts +0 -1
  160. package/dist/lint/post-synth/waw054.d.ts +0 -1
  161. package/dist/lint/post-synth/waw055.d.ts +0 -1
  162. package/dist/lint/post-synth/waw056.d.ts +0 -1
  163. package/dist/lint/post-synth/waw057.d.ts +0 -1
  164. package/dist/lint/post-synth/waw058.d.ts +0 -1
  165. package/dist/lint/post-synth/waw059.d.ts +0 -1
  166. package/dist/lint/post-synth/waw060.d.ts +0 -1
  167. package/dist/lint/post-synth/waw061.d.ts +0 -1
  168. package/dist/lint/post-synth/waw062.d.ts +0 -1
  169. package/dist/lint/post-synth/waw063.d.ts +0 -1
  170. package/dist/lint/post-synth/waw064.d.ts +0 -1
  171. package/dist/lint/post-synth/waw065.d.ts +0 -1
  172. package/dist/lint/post-synth/waw066.d.ts +0 -1
  173. package/dist/lint/post-synth/waw067.d.ts +0 -1
  174. package/dist/lint/post-synth/waw068.d.ts +0 -1
  175. package/dist/lint/post-synth/waw069.d.ts +0 -1
  176. package/dist/lint/post-synth/waw070.d.ts +0 -1
  177. package/dist/lint/post-synth/waw071.d.ts +0 -1
  178. package/dist/lint/rules/hardcoded-region.d.ts +0 -1
  179. package/dist/lint/rules/iam-wildcard.d.ts +0 -1
  180. package/dist/lint/rules/index.d.ts +0 -1
  181. package/dist/lint/rules/s3-encryption.d.ts +0 -1
  182. package/dist/listed-types.d.ts +0 -1
  183. package/dist/live-attrs.d.ts +0 -1
  184. package/dist/lsp/completions.d.ts +0 -1
  185. package/dist/lsp/hover.d.ts +0 -1
  186. package/dist/manifest.json +1 -1
  187. package/dist/mapping.d.ts +0 -1
  188. package/dist/nested-stack.d.ts +0 -1
  189. package/dist/op/activities/aws-apply.d.ts +0 -1
  190. package/dist/op/activities/floci.d.ts +0 -1
  191. package/dist/op/activities/index.d.ts +0 -1
  192. package/dist/op/builders.d.ts +0 -1
  193. package/dist/ownership.d.ts +0 -1
  194. package/dist/package-cli.d.ts +0 -1
  195. package/dist/parameter.d.ts +0 -1
  196. package/dist/plugin.d.ts +0 -1
  197. package/dist/properties.d.ts +0 -1
  198. package/dist/pseudo.d.ts +0 -1
  199. package/dist/receipt-store.d.ts +0 -1
  200. package/dist/reference-catalog.d.ts +0 -1
  201. package/dist/serializer.d.ts +0 -1
  202. package/dist/spec/fetch.d.ts +0 -1
  203. package/dist/spec/parse.d.ts +0 -1
  204. package/dist/spec/pin.d.ts +0 -1
  205. package/dist/spec/pinned-types.json +1856 -1856
  206. package/dist/stack-errors.d.ts +0 -1
  207. package/dist/taggable.d.ts +0 -1
  208. package/dist/teardown.d.ts +0 -1
  209. package/dist/template-sections.d.ts +0 -1
  210. package/dist/template-transform.d.ts +0 -1
  211. package/dist/validate-cli.d.ts +0 -1
  212. package/dist/validate.d.ts +0 -1
  213. package/dist/workspace-member.d.ts +0 -1
  214. package/package.json +3 -4
  215. package/dist/actions/dynamodb.d.ts.map +0 -1
  216. package/dist/actions/ecr.d.ts.map +0 -1
  217. package/dist/actions/ecs.d.ts.map +0 -1
  218. package/dist/actions/iam.d.ts.map +0 -1
  219. package/dist/actions/index.d.ts.map +0 -1
  220. package/dist/actions/lambda.d.ts.map +0 -1
  221. package/dist/actions/logs.d.ts.map +0 -1
  222. package/dist/actions/s3.d.ts.map +0 -1
  223. package/dist/actions/sns.d.ts.map +0 -1
  224. package/dist/actions/sqs.d.ts.map +0 -1
  225. package/dist/agentcore/trace-fetch.d.ts.map +0 -1
  226. package/dist/agentcore/trace-render.d.ts.map +0 -1
  227. package/dist/ambient.d.ts.map +0 -1
  228. package/dist/api/credential-chain.d.ts.map +0 -1
  229. package/dist/api/read-client.d.ts.map +0 -1
  230. package/dist/api/signing.d.ts.map +0 -1
  231. package/dist/behaviour-kinds.d.ts.map +0 -1
  232. package/dist/caller-identity.d.ts.map +0 -1
  233. package/dist/capabilities/pack.d.ts.map +0 -1
  234. package/dist/codegen/docs-cli.d.ts.map +0 -1
  235. package/dist/codegen/docs.d.ts.map +0 -1
  236. package/dist/codegen/enum-overlay.d.ts.map +0 -1
  237. package/dist/codegen/extensions.d.ts.map +0 -1
  238. package/dist/codegen/fallback.d.ts.map +0 -1
  239. package/dist/codegen/generate-cli.d.ts.map +0 -1
  240. package/dist/codegen/generate-lexicon.d.ts.map +0 -1
  241. package/dist/codegen/generate-typescript.d.ts.map +0 -1
  242. package/dist/codegen/generate.d.ts.map +0 -1
  243. package/dist/codegen/naming.d.ts.map +0 -1
  244. package/dist/codegen/package.d.ts.map +0 -1
  245. package/dist/codegen/patches.d.ts.map +0 -1
  246. package/dist/codegen/property-overlay.d.ts.map +0 -1
  247. package/dist/codegen/sam.d.ts.map +0 -1
  248. package/dist/codegen/typecheck.d.ts.map +0 -1
  249. package/dist/codegen/versions.d.ts.map +0 -1
  250. package/dist/components/__tests__/mock-cloud-executor.d.ts.map +0 -1
  251. package/dist/components/apply.d.ts.map +0 -1
  252. package/dist/components/builders.d.ts.map +0 -1
  253. package/dist/components/capability-plugin.d.ts.map +0 -1
  254. package/dist/components/cfn-adopt-run.d.ts.map +0 -1
  255. package/dist/components/cfn-adopt.d.ts.map +0 -1
  256. package/dist/components/cfn-imports.d.ts.map +0 -1
  257. package/dist/components/cloud-executor.d.ts.map +0 -1
  258. package/dist/components/config-bom.d.ts.map +0 -1
  259. package/dist/components/host-delivery.d.ts.map +0 -1
  260. package/dist/components/index.d.ts.map +0 -1
  261. package/dist/components/job-submission.d.ts.map +0 -1
  262. package/dist/components/publish.d.ts.map +0 -1
  263. package/dist/components/safety.d.ts.map +0 -1
  264. package/dist/components/wait-aws.d.ts.map +0 -1
  265. package/dist/composites/agentcore-agent.d.ts.map +0 -1
  266. package/dist/composites/agentcore-trust-policy.d.ts.map +0 -1
  267. package/dist/composites/alb-shared.d.ts.map +0 -1
  268. package/dist/composites/bucket-deployment.d.ts.map +0 -1
  269. package/dist/composites/catalog.d.ts.map +0 -1
  270. package/dist/composites/dynamodb-table.d.ts.map +0 -1
  271. package/dist/composites/ec2-instance-bundle.d.ts.map +0 -1
  272. package/dist/composites/ec2-instance-role.d.ts.map +0 -1
  273. package/dist/composites/ecr-repository.d.ts.map +0 -1
  274. package/dist/composites/ecs-trust-policy.d.ts.map +0 -1
  275. package/dist/composites/efs-with-access-point.d.ts.map +0 -1
  276. package/dist/composites/eks-cluster.d.ts.map +0 -1
  277. package/dist/composites/fargate-alb.d.ts.map +0 -1
  278. package/dist/composites/fargate-service.d.ts.map +0 -1
  279. package/dist/composites/index.d.ts.map +0 -1
  280. package/dist/composites/lambda-api.d.ts.map +0 -1
  281. package/dist/composites/lambda-dynamodb.d.ts.map +0 -1
  282. package/dist/composites/lambda-eventbridge.d.ts.map +0 -1
  283. package/dist/composites/lambda-function.d.ts.map +0 -1
  284. package/dist/composites/lambda-s3.d.ts.map +0 -1
  285. package/dist/composites/lambda-sns.d.ts.map +0 -1
  286. package/dist/composites/lambda-sqs.d.ts.map +0 -1
  287. package/dist/composites/landing-zone.d.ts.map +0 -1
  288. package/dist/composites/latency-entry.d.ts.map +0 -1
  289. package/dist/composites/microvm-app.d.ts.map +0 -1
  290. package/dist/composites/minimal-vpc.d.ts.map +0 -1
  291. package/dist/composites/monitoring-stack.d.ts.map +0 -1
  292. package/dist/composites/nlb-service.d.ts.map +0 -1
  293. package/dist/composites/rds-instance.d.ts.map +0 -1
  294. package/dist/composites/scheduled-lambda.d.ts.map +0 -1
  295. package/dist/composites/solr-fargate-service.d.ts.map +0 -1
  296. package/dist/composites/step-functions-workflow.d.ts.map +0 -1
  297. package/dist/composites/vpc-default.d.ts.map +0 -1
  298. package/dist/condition.d.ts.map +0 -1
  299. package/dist/coverage.d.ts.map +0 -1
  300. package/dist/deep-observe.d.ts.map +0 -1
  301. package/dist/deep-topology.d.ts.map +0 -1
  302. package/dist/default-tags.d.ts.map +0 -1
  303. package/dist/defaults.d.ts.map +0 -1
  304. package/dist/dependencies.d.ts.map +0 -1
  305. package/dist/detect.d.ts.map +0 -1
  306. package/dist/disruption.d.ts.map +0 -1
  307. package/dist/effect-receipt-row.d.ts.map +0 -1
  308. package/dist/generated/index.d.ts.map +0 -1
  309. package/dist/generated/runtime.d.ts.map +0 -1
  310. package/dist/governance.d.ts.map +0 -1
  311. package/dist/health.d.ts.map +0 -1
  312. package/dist/identity-observe.d.ts.map +0 -1
  313. package/dist/import/generator.d.ts.map +0 -1
  314. package/dist/import/live-export.d.ts.map +0 -1
  315. package/dist/import/parser.d.ts.map +0 -1
  316. package/dist/importable.d.ts.map +0 -1
  317. package/dist/index-identity.d.ts.map +0 -1
  318. package/dist/index-import.d.ts.map +0 -1
  319. package/dist/index.d.ts.map +0 -1
  320. package/dist/intrinsics.d.ts.map +0 -1
  321. package/dist/lint/audit-catalog.d.ts.map +0 -1
  322. package/dist/lint/audit-lineage.d.ts.map +0 -1
  323. package/dist/lint/post-synth/cf-refs.d.ts.map +0 -1
  324. package/dist/lint/post-synth/cor020.d.ts.map +0 -1
  325. package/dist/lint/post-synth/ext001.d.ts.map +0 -1
  326. package/dist/lint/post-synth/index.d.ts.map +0 -1
  327. package/dist/lint/post-synth/waw010.d.ts.map +0 -1
  328. package/dist/lint/post-synth/waw011.d.ts.map +0 -1
  329. package/dist/lint/post-synth/waw013.d.ts.map +0 -1
  330. package/dist/lint/post-synth/waw014.d.ts.map +0 -1
  331. package/dist/lint/post-synth/waw015.d.ts.map +0 -1
  332. package/dist/lint/post-synth/waw016.d.ts.map +0 -1
  333. package/dist/lint/post-synth/waw017.d.ts.map +0 -1
  334. package/dist/lint/post-synth/waw018.d.ts.map +0 -1
  335. package/dist/lint/post-synth/waw019.d.ts.map +0 -1
  336. package/dist/lint/post-synth/waw020.d.ts.map +0 -1
  337. package/dist/lint/post-synth/waw021.d.ts.map +0 -1
  338. package/dist/lint/post-synth/waw022.d.ts.map +0 -1
  339. package/dist/lint/post-synth/waw023.d.ts.map +0 -1
  340. package/dist/lint/post-synth/waw024.d.ts.map +0 -1
  341. package/dist/lint/post-synth/waw025.d.ts.map +0 -1
  342. package/dist/lint/post-synth/waw026.d.ts.map +0 -1
  343. package/dist/lint/post-synth/waw027.d.ts.map +0 -1
  344. package/dist/lint/post-synth/waw028.d.ts.map +0 -1
  345. package/dist/lint/post-synth/waw029.d.ts.map +0 -1
  346. package/dist/lint/post-synth/waw030.d.ts.map +0 -1
  347. package/dist/lint/post-synth/waw031.d.ts.map +0 -1
  348. package/dist/lint/post-synth/waw032.d.ts.map +0 -1
  349. package/dist/lint/post-synth/waw033.d.ts.map +0 -1
  350. package/dist/lint/post-synth/waw034.d.ts.map +0 -1
  351. package/dist/lint/post-synth/waw035.d.ts.map +0 -1
  352. package/dist/lint/post-synth/waw036.d.ts.map +0 -1
  353. package/dist/lint/post-synth/waw037.d.ts.map +0 -1
  354. package/dist/lint/post-synth/waw038.d.ts.map +0 -1
  355. package/dist/lint/post-synth/waw039.d.ts.map +0 -1
  356. package/dist/lint/post-synth/waw040.d.ts.map +0 -1
  357. package/dist/lint/post-synth/waw041.d.ts.map +0 -1
  358. package/dist/lint/post-synth/waw042.d.ts.map +0 -1
  359. package/dist/lint/post-synth/waw043.d.ts.map +0 -1
  360. package/dist/lint/post-synth/waw044.d.ts.map +0 -1
  361. package/dist/lint/post-synth/waw045.d.ts.map +0 -1
  362. package/dist/lint/post-synth/waw046.d.ts.map +0 -1
  363. package/dist/lint/post-synth/waw047.d.ts.map +0 -1
  364. package/dist/lint/post-synth/waw048.d.ts.map +0 -1
  365. package/dist/lint/post-synth/waw049.d.ts.map +0 -1
  366. package/dist/lint/post-synth/waw050.d.ts.map +0 -1
  367. package/dist/lint/post-synth/waw051.d.ts.map +0 -1
  368. package/dist/lint/post-synth/waw052.d.ts.map +0 -1
  369. package/dist/lint/post-synth/waw053.d.ts.map +0 -1
  370. package/dist/lint/post-synth/waw054.d.ts.map +0 -1
  371. package/dist/lint/post-synth/waw055.d.ts.map +0 -1
  372. package/dist/lint/post-synth/waw056.d.ts.map +0 -1
  373. package/dist/lint/post-synth/waw057.d.ts.map +0 -1
  374. package/dist/lint/post-synth/waw058.d.ts.map +0 -1
  375. package/dist/lint/post-synth/waw059.d.ts.map +0 -1
  376. package/dist/lint/post-synth/waw060.d.ts.map +0 -1
  377. package/dist/lint/post-synth/waw061.d.ts.map +0 -1
  378. package/dist/lint/post-synth/waw062.d.ts.map +0 -1
  379. package/dist/lint/post-synth/waw063.d.ts.map +0 -1
  380. package/dist/lint/post-synth/waw064.d.ts.map +0 -1
  381. package/dist/lint/post-synth/waw065.d.ts.map +0 -1
  382. package/dist/lint/post-synth/waw066.d.ts.map +0 -1
  383. package/dist/lint/post-synth/waw067.d.ts.map +0 -1
  384. package/dist/lint/post-synth/waw068.d.ts.map +0 -1
  385. package/dist/lint/post-synth/waw069.d.ts.map +0 -1
  386. package/dist/lint/post-synth/waw070.d.ts.map +0 -1
  387. package/dist/lint/post-synth/waw071.d.ts.map +0 -1
  388. package/dist/lint/rules/hardcoded-region.d.ts.map +0 -1
  389. package/dist/lint/rules/iam-wildcard.d.ts.map +0 -1
  390. package/dist/lint/rules/index.d.ts.map +0 -1
  391. package/dist/lint/rules/s3-encryption.d.ts.map +0 -1
  392. package/dist/listed-types.d.ts.map +0 -1
  393. package/dist/live-attrs.d.ts.map +0 -1
  394. package/dist/lsp/completions.d.ts.map +0 -1
  395. package/dist/lsp/hover.d.ts.map +0 -1
  396. package/dist/mapping.d.ts.map +0 -1
  397. package/dist/nested-stack.d.ts.map +0 -1
  398. package/dist/op/activities/aws-apply.d.ts.map +0 -1
  399. package/dist/op/activities/floci.d.ts.map +0 -1
  400. package/dist/op/activities/index.d.ts.map +0 -1
  401. package/dist/op/builders.d.ts.map +0 -1
  402. package/dist/ownership.d.ts.map +0 -1
  403. package/dist/package-cli.d.ts.map +0 -1
  404. package/dist/parameter.d.ts.map +0 -1
  405. package/dist/plugin.d.ts.map +0 -1
  406. package/dist/properties.d.ts.map +0 -1
  407. package/dist/pseudo.d.ts.map +0 -1
  408. package/dist/receipt-store.d.ts.map +0 -1
  409. package/dist/reference-catalog.d.ts.map +0 -1
  410. package/dist/serializer.d.ts.map +0 -1
  411. package/dist/spec/fetch.d.ts.map +0 -1
  412. package/dist/spec/parse.d.ts.map +0 -1
  413. package/dist/spec/pin.d.ts.map +0 -1
  414. package/dist/stack-errors.d.ts.map +0 -1
  415. package/dist/taggable.d.ts.map +0 -1
  416. package/dist/teardown.d.ts.map +0 -1
  417. package/dist/template-sections.d.ts.map +0 -1
  418. package/dist/template-transform.d.ts.map +0 -1
  419. package/dist/validate-cli.d.ts.map +0 -1
  420. package/dist/validate.d.ts.map +0 -1
  421. package/dist/workspace-member.d.ts.map +0 -1
  422. package/src/actions/actions.test.ts +0 -89
  423. package/src/actions/dynamodb.ts +0 -47
  424. package/src/actions/ecr.ts +0 -9
  425. package/src/actions/ecs.ts +0 -5
  426. package/src/actions/iam.ts +0 -3
  427. package/src/actions/index.ts +0 -9
  428. package/src/actions/lambda.ts +0 -11
  429. package/src/actions/logs.ts +0 -4
  430. package/src/actions/s3.ts +0 -46
  431. package/src/actions/sns.ts +0 -5
  432. package/src/actions/sqs.ts +0 -15
  433. package/src/agentcore/trace-fetch.test.ts +0 -605
  434. package/src/agentcore/trace-fetch.ts +0 -761
  435. package/src/agentcore/trace-render.test.ts +0 -366
  436. package/src/agentcore/trace-render.ts +0 -589
  437. package/src/ambient.test.ts +0 -92
  438. package/src/ambient.ts +0 -163
  439. package/src/api/credential-chain.test.ts +0 -70
  440. package/src/api/credential-chain.ts +0 -646
  441. package/src/api/credential-isolation.test.ts +0 -72
  442. package/src/api/read-client-chain.test.ts +0 -159
  443. package/src/api/read-client.test.ts +0 -413
  444. package/src/api/read-client.ts +0 -632
  445. package/src/api/signing.test.ts +0 -248
  446. package/src/api/signing.ts +0 -130
  447. package/src/behaviour-kinds.ts +0 -121
  448. package/src/caller-identity.test.ts +0 -476
  449. package/src/caller-identity.ts +0 -169
  450. package/src/capabilities/mapping.json +0 -150
  451. package/src/capabilities/pack.ts +0 -9
  452. package/src/capabilities.test.ts +0 -182
  453. package/src/codegen/__snapshots__/snapshot.test.ts.snap +0 -196
  454. package/src/codegen/any-budget.test.ts +0 -76
  455. package/src/codegen/docs-cli.ts +0 -3
  456. package/src/codegen/docs-links.test.ts +0 -158
  457. package/src/codegen/docs.ts +0 -133
  458. package/src/codegen/enum-overlay.json +0 -1843
  459. package/src/codegen/enum-overlay.test.ts +0 -298
  460. package/src/codegen/enum-overlay.ts +0 -245
  461. package/src/codegen/extensions.ts +0 -171
  462. package/src/codegen/fallback.ts +0 -36
  463. package/src/codegen/generate-cli.ts +0 -17
  464. package/src/codegen/generate-lexicon.ts +0 -115
  465. package/src/codegen/generate-typescript.ts +0 -281
  466. package/src/codegen/generate.test.ts +0 -125
  467. package/src/codegen/generate.ts +0 -298
  468. package/src/codegen/idempotency.test.ts +0 -28
  469. package/src/codegen/naming.ts +0 -149
  470. package/src/codegen/package.e2e.test.ts +0 -78
  471. package/src/codegen/package.ts +0 -90
  472. package/src/codegen/patches.test.ts +0 -95
  473. package/src/codegen/patches.ts +0 -142
  474. package/src/codegen/property-overlay.json +0 -4
  475. package/src/codegen/property-overlay.test.ts +0 -61
  476. package/src/codegen/property-overlay.ts +0 -125
  477. package/src/codegen/sam.ts +0 -414
  478. package/src/codegen/snapshot.test.ts +0 -84
  479. package/src/codegen/typecheck.test.ts +0 -50
  480. package/src/codegen/typecheck.ts +0 -4
  481. package/src/codegen/versions.ts +0 -41
  482. package/src/components/__fixtures__/schemas/cyclonedx-1.5.schema.json +0 -3800
  483. package/src/components/__fixtures__/schemas/cyclonedx-spdx-license.schema.json +0 -621
  484. package/src/components/__fixtures__/schemas/jsf-0.82.schema.json +0 -240
  485. package/src/components/__fixtures__/schemas/spdx-2.3.schema.json +0 -740
  486. package/src/components/__fixtures__/synthesized-template.json +0 -53
  487. package/src/components/__tests__/mock-cloud-executor.ts +0 -487
  488. package/src/components/apply.test.ts +0 -474
  489. package/src/components/apply.ts +0 -1495
  490. package/src/components/builders.test.ts +0 -49
  491. package/src/components/builders.ts +0 -59
  492. package/src/components/capability-plugin.test.ts +0 -19
  493. package/src/components/capability-plugin.ts +0 -81
  494. package/src/components/cfn-adopt-run.test.ts +0 -227
  495. package/src/components/cfn-adopt-run.ts +0 -141
  496. package/src/components/cfn-adopt.test.ts +0 -284
  497. package/src/components/cfn-adopt.ts +0 -340
  498. package/src/components/cfn-exports-in-use.test.ts +0 -146
  499. package/src/components/cfn-imports-preview.test.ts +0 -178
  500. package/src/components/cfn-imports-three-stacks.test.ts +0 -107
  501. package/src/components/cfn-imports.test.ts +0 -213
  502. package/src/components/cfn-imports.ts +0 -246
  503. package/src/components/cfn-plan-floci.e2e.test.ts +0 -129
  504. package/src/components/cfn-plan-shape-conformance.test.ts +0 -83
  505. package/src/components/cfn-plan.test.ts +0 -760
  506. package/src/components/cloud-executor.test.ts +0 -105
  507. package/src/components/cloud-executor.ts +0 -1136
  508. package/src/components/config-bom.test.ts +0 -273
  509. package/src/components/config-bom.ts +0 -310
  510. package/src/components/demo-composed-stacks-floci.e2e.test.ts +0 -235
  511. package/src/components/ecs-rollback-real-executor.test.ts +0 -135
  512. package/src/components/host-delivery.test.ts +0 -141
  513. package/src/components/host-delivery.ts +0 -199
  514. package/src/components/index.ts +0 -19
  515. package/src/components/job-submission.test.ts +0 -97
  516. package/src/components/job-submission.ts +0 -138
  517. package/src/components/pilots-e2e.test.ts +0 -468
  518. package/src/components/presets-e2e.test.ts +0 -204
  519. package/src/components/publish.test.ts +0 -318
  520. package/src/components/publish.ts +0 -224
  521. package/src/components/safety.test.ts +0 -75
  522. package/src/components/safety.ts +0 -119
  523. package/src/components/wait-aws.test.ts +0 -79
  524. package/src/components/wait-aws.ts +0 -132
  525. package/src/composites/agentcore-agent.test.ts +0 -315
  526. package/src/composites/agentcore-agent.ts +0 -327
  527. package/src/composites/agentcore-trust-policy.ts +0 -13
  528. package/src/composites/alb-shared.ts +0 -123
  529. package/src/composites/barrel.test.ts +0 -32
  530. package/src/composites/bucket-deployment.test.ts +0 -84
  531. package/src/composites/bucket-deployment.ts +0 -153
  532. package/src/composites/catalog.test.ts +0 -39
  533. package/src/composites/catalog.ts +0 -2851
  534. package/src/composites/composites.test.ts +0 -1257
  535. package/src/composites/dynamodb-table.test.ts +0 -154
  536. package/src/composites/dynamodb-table.ts +0 -125
  537. package/src/composites/ec2-instance-bundle.ts +0 -134
  538. package/src/composites/ec2-instance-role.ts +0 -40
  539. package/src/composites/ecr-repository.test.ts +0 -118
  540. package/src/composites/ecr-repository.ts +0 -118
  541. package/src/composites/ecs-trust-policy.ts +0 -10
  542. package/src/composites/efs-with-access-point.ts +0 -81
  543. package/src/composites/eks-cluster.test.ts +0 -73
  544. package/src/composites/eks-cluster.ts +0 -164
  545. package/src/composites/fargate-alb.ts +0 -309
  546. package/src/composites/fargate-service.ts +0 -353
  547. package/src/composites/index.ts +0 -68
  548. package/src/composites/lambda-api.ts +0 -30
  549. package/src/composites/lambda-dynamodb.ts +0 -109
  550. package/src/composites/lambda-eventbridge.ts +0 -43
  551. package/src/composites/lambda-function.ts +0 -88
  552. package/src/composites/lambda-s3.ts +0 -135
  553. package/src/composites/lambda-sns.ts +0 -38
  554. package/src/composites/lambda-sqs.ts +0 -52
  555. package/src/composites/landing-zone.test.ts +0 -53
  556. package/src/composites/landing-zone.ts +0 -152
  557. package/src/composites/latency-entry.test.ts +0 -99
  558. package/src/composites/latency-entry.ts +0 -121
  559. package/src/composites/microvm-app.test.ts +0 -272
  560. package/src/composites/microvm-app.ts +0 -463
  561. package/src/composites/minimal-vpc.ts +0 -72
  562. package/src/composites/monitoring-stack.test.ts +0 -130
  563. package/src/composites/monitoring-stack.ts +0 -164
  564. package/src/composites/nlb-service.ts +0 -118
  565. package/src/composites/rds-instance.ts +0 -168
  566. package/src/composites/scheduled-lambda.ts +0 -44
  567. package/src/composites/solr-fargate-service.ts +0 -50
  568. package/src/composites/step-functions-workflow.ts +0 -128
  569. package/src/composites/vpc-default.ts +0 -217
  570. package/src/condition.test.ts +0 -160
  571. package/src/condition.ts +0 -54
  572. package/src/coverage.test.ts +0 -31
  573. package/src/coverage.ts +0 -14
  574. package/src/deep-observe.test.ts +0 -1063
  575. package/src/deep-observe.ts +0 -881
  576. package/src/deep-topology.test.ts +0 -396
  577. package/src/deep-topology.ts +0 -237
  578. package/src/default-tags.test.ts +0 -38
  579. package/src/default-tags.ts +0 -77
  580. package/src/defaults.test.ts +0 -73
  581. package/src/defaults.ts +0 -97
  582. package/src/dependencies.test.ts +0 -208
  583. package/src/dependencies.ts +0 -328
  584. package/src/derived-edges.test.ts +0 -142
  585. package/src/detect.ts +0 -19
  586. package/src/disruption.test.ts +0 -198
  587. package/src/disruption.ts +0 -155
  588. package/src/effect-receipt-row.test.ts +0 -164
  589. package/src/effect-receipt-row.ts +0 -147
  590. package/src/generated/index.d.ts +0 -158317
  591. package/src/generated/index.ts +0 -12385
  592. package/src/generated/runtime.ts +0 -4
  593. package/src/governance.test.ts +0 -81
  594. package/src/governance.ts +0 -249
  595. package/src/graph-sub-edges.test.ts +0 -101
  596. package/src/health.test.ts +0 -136
  597. package/src/health.ts +0 -281
  598. package/src/identity-observe.test.ts +0 -146
  599. package/src/identity-observe.ts +0 -138
  600. package/src/import/generator.test.ts +0 -313
  601. package/src/import/generator.ts +0 -820
  602. package/src/import/live-export-io.test.ts +0 -79
  603. package/src/import/live-export.test.ts +0 -96
  604. package/src/import/live-export.ts +0 -43
  605. package/src/import/parser.test.ts +0 -330
  606. package/src/import/parser.ts +0 -502
  607. package/src/import/roundtrip-build.test.ts +0 -388
  608. package/src/import/roundtrip-fixtures.test.ts +0 -190
  609. package/src/import/roundtrip.test.ts +0 -196
  610. package/src/importable.test.ts +0 -86
  611. package/src/importable.ts +0 -83
  612. package/src/index-identity.test.ts +0 -134
  613. package/src/index-identity.ts +0 -98
  614. package/src/index-import.test.ts +0 -257
  615. package/src/index-import.ts +0 -158
  616. package/src/index-search.test.ts +0 -87
  617. package/src/index.ts +0 -223
  618. package/src/integration.test.ts +0 -200
  619. package/src/intrinsics.test.ts +0 -188
  620. package/src/intrinsics.ts +0 -488
  621. package/src/lifecycle-integration.test.ts +0 -621
  622. package/src/lint/audit-catalog.ts +0 -98
  623. package/src/lint/audit-lineage.ts +0 -167
  624. package/src/lint/post-synth/cf-refs.ts +0 -285
  625. package/src/lint/post-synth/cor020.ts +0 -72
  626. package/src/lint/post-synth/ext001.test.ts +0 -365
  627. package/src/lint/post-synth/ext001.ts +0 -388
  628. package/src/lint/post-synth/index.ts +0 -131
  629. package/src/lint/post-synth/post-synth.test.ts +0 -280
  630. package/src/lint/post-synth/waw010.ts +0 -49
  631. package/src/lint/post-synth/waw011.ts +0 -49
  632. package/src/lint/post-synth/waw013.test.ts +0 -120
  633. package/src/lint/post-synth/waw013.ts +0 -45
  634. package/src/lint/post-synth/waw014.test.ts +0 -121
  635. package/src/lint/post-synth/waw014.ts +0 -50
  636. package/src/lint/post-synth/waw015.test.ts +0 -147
  637. package/src/lint/post-synth/waw015.ts +0 -100
  638. package/src/lint/post-synth/waw016.test.ts +0 -348
  639. package/src/lint/post-synth/waw016.ts +0 -135
  640. package/src/lint/post-synth/waw017.test.ts +0 -130
  641. package/src/lint/post-synth/waw017.ts +0 -54
  642. package/src/lint/post-synth/waw018.test.ts +0 -109
  643. package/src/lint/post-synth/waw018.ts +0 -71
  644. package/src/lint/post-synth/waw019.test.ts +0 -170
  645. package/src/lint/post-synth/waw019.ts +0 -82
  646. package/src/lint/post-synth/waw020.test.ts +0 -125
  647. package/src/lint/post-synth/waw020.ts +0 -64
  648. package/src/lint/post-synth/waw021.test.ts +0 -81
  649. package/src/lint/post-synth/waw021.ts +0 -53
  650. package/src/lint/post-synth/waw022.test.ts +0 -54
  651. package/src/lint/post-synth/waw022.ts +0 -43
  652. package/src/lint/post-synth/waw023.test.ts +0 -53
  653. package/src/lint/post-synth/waw023.ts +0 -47
  654. package/src/lint/post-synth/waw024.test.ts +0 -64
  655. package/src/lint/post-synth/waw024.ts +0 -54
  656. package/src/lint/post-synth/waw025.test.ts +0 -42
  657. package/src/lint/post-synth/waw025.ts +0 -43
  658. package/src/lint/post-synth/waw026.test.ts +0 -54
  659. package/src/lint/post-synth/waw026.ts +0 -46
  660. package/src/lint/post-synth/waw027.test.ts +0 -63
  661. package/src/lint/post-synth/waw027.ts +0 -50
  662. package/src/lint/post-synth/waw028.test.ts +0 -68
  663. package/src/lint/post-synth/waw028.ts +0 -47
  664. package/src/lint/post-synth/waw029.test.ts +0 -179
  665. package/src/lint/post-synth/waw029.ts +0 -62
  666. package/src/lint/post-synth/waw030.test.ts +0 -1008
  667. package/src/lint/post-synth/waw030.ts +0 -301
  668. package/src/lint/post-synth/waw031.test.ts +0 -273
  669. package/src/lint/post-synth/waw031.ts +0 -66
  670. package/src/lint/post-synth/waw032.test.ts +0 -83
  671. package/src/lint/post-synth/waw032.ts +0 -52
  672. package/src/lint/post-synth/waw033.test.ts +0 -68
  673. package/src/lint/post-synth/waw033.ts +0 -86
  674. package/src/lint/post-synth/waw034.test.ts +0 -54
  675. package/src/lint/post-synth/waw034.ts +0 -63
  676. package/src/lint/post-synth/waw035.test.ts +0 -74
  677. package/src/lint/post-synth/waw035.ts +0 -71
  678. package/src/lint/post-synth/waw036.test.ts +0 -217
  679. package/src/lint/post-synth/waw036.ts +0 -88
  680. package/src/lint/post-synth/waw037.test.ts +0 -155
  681. package/src/lint/post-synth/waw037.ts +0 -81
  682. package/src/lint/post-synth/waw038.test.ts +0 -78
  683. package/src/lint/post-synth/waw038.ts +0 -50
  684. package/src/lint/post-synth/waw039.test.ts +0 -72
  685. package/src/lint/post-synth/waw039.ts +0 -51
  686. package/src/lint/post-synth/waw040.test.ts +0 -71
  687. package/src/lint/post-synth/waw040.ts +0 -54
  688. package/src/lint/post-synth/waw041.test.ts +0 -72
  689. package/src/lint/post-synth/waw041.ts +0 -48
  690. package/src/lint/post-synth/waw042.test.ts +0 -166
  691. package/src/lint/post-synth/waw042.ts +0 -108
  692. package/src/lint/post-synth/waw043.test.ts +0 -84
  693. package/src/lint/post-synth/waw043.ts +0 -57
  694. package/src/lint/post-synth/waw044.test.ts +0 -112
  695. package/src/lint/post-synth/waw044.ts +0 -68
  696. package/src/lint/post-synth/waw045.test.ts +0 -101
  697. package/src/lint/post-synth/waw045.ts +0 -58
  698. package/src/lint/post-synth/waw046.test.ts +0 -112
  699. package/src/lint/post-synth/waw046.ts +0 -59
  700. package/src/lint/post-synth/waw047.test.ts +0 -64
  701. package/src/lint/post-synth/waw047.ts +0 -50
  702. package/src/lint/post-synth/waw048.test.ts +0 -77
  703. package/src/lint/post-synth/waw048.ts +0 -47
  704. package/src/lint/post-synth/waw049.test.ts +0 -139
  705. package/src/lint/post-synth/waw049.ts +0 -100
  706. package/src/lint/post-synth/waw050.test.ts +0 -75
  707. package/src/lint/post-synth/waw050.ts +0 -54
  708. package/src/lint/post-synth/waw051.test.ts +0 -78
  709. package/src/lint/post-synth/waw051.ts +0 -49
  710. package/src/lint/post-synth/waw052.test.ts +0 -54
  711. package/src/lint/post-synth/waw052.ts +0 -51
  712. package/src/lint/post-synth/waw053.test.ts +0 -59
  713. package/src/lint/post-synth/waw053.ts +0 -53
  714. package/src/lint/post-synth/waw054.test.ts +0 -49
  715. package/src/lint/post-synth/waw054.ts +0 -49
  716. package/src/lint/post-synth/waw055.test.ts +0 -43
  717. package/src/lint/post-synth/waw055.ts +0 -49
  718. package/src/lint/post-synth/waw056.test.ts +0 -78
  719. package/src/lint/post-synth/waw056.ts +0 -67
  720. package/src/lint/post-synth/waw057.test.ts +0 -65
  721. package/src/lint/post-synth/waw057.ts +0 -48
  722. package/src/lint/post-synth/waw058.test.ts +0 -82
  723. package/src/lint/post-synth/waw058.ts +0 -71
  724. package/src/lint/post-synth/waw059.test.ts +0 -309
  725. package/src/lint/post-synth/waw059.ts +0 -353
  726. package/src/lint/post-synth/waw060.test.ts +0 -131
  727. package/src/lint/post-synth/waw060.ts +0 -91
  728. package/src/lint/post-synth/waw061.test.ts +0 -99
  729. package/src/lint/post-synth/waw061.ts +0 -67
  730. package/src/lint/post-synth/waw062.test.ts +0 -109
  731. package/src/lint/post-synth/waw062.ts +0 -0
  732. package/src/lint/post-synth/waw063.test.ts +0 -220
  733. package/src/lint/post-synth/waw063.ts +0 -0
  734. package/src/lint/post-synth/waw064.test.ts +0 -79
  735. package/src/lint/post-synth/waw064.ts +0 -52
  736. package/src/lint/post-synth/waw065.test.ts +0 -90
  737. package/src/lint/post-synth/waw065.ts +0 -110
  738. package/src/lint/post-synth/waw066.test.ts +0 -108
  739. package/src/lint/post-synth/waw066.ts +0 -155
  740. package/src/lint/post-synth/waw067.test.ts +0 -79
  741. package/src/lint/post-synth/waw067.ts +0 -114
  742. package/src/lint/post-synth/waw068.test.ts +0 -74
  743. package/src/lint/post-synth/waw068.ts +0 -78
  744. package/src/lint/post-synth/waw069.test.ts +0 -94
  745. package/src/lint/post-synth/waw069.ts +0 -0
  746. package/src/lint/post-synth/waw070.test.ts +0 -59
  747. package/src/lint/post-synth/waw070.ts +0 -89
  748. package/src/lint/post-synth/waw071.test.ts +0 -50
  749. package/src/lint/post-synth/waw071.ts +0 -85
  750. package/src/lint/rules/hardcoded-region.ts +0 -44
  751. package/src/lint/rules/iam-wildcard.ts +0 -67
  752. package/src/lint/rules/index.ts +0 -7
  753. package/src/lint/rules/rules.test.ts +0 -175
  754. package/src/lint/rules/s3-encryption.ts +0 -69
  755. package/src/listed-types.test.ts +0 -97
  756. package/src/listed-types.ts +0 -56
  757. package/src/live-attrs.test.ts +0 -54
  758. package/src/live-attrs.ts +0 -40
  759. package/src/lsp/completions.test.ts +0 -74
  760. package/src/lsp/completions.ts +0 -21
  761. package/src/lsp/hover.test.ts +0 -53
  762. package/src/lsp/hover.ts +0 -83
  763. package/src/mapping.test.ts +0 -64
  764. package/src/mapping.ts +0 -41
  765. package/src/nested-stack-integration.test.ts +0 -100
  766. package/src/nested-stack.test.ts +0 -83
  767. package/src/nested-stack.ts +0 -125
  768. package/src/op/activities/aws-apply.test.ts +0 -290
  769. package/src/op/activities/aws-apply.ts +0 -302
  770. package/src/op/activities/floci.test.ts +0 -119
  771. package/src/op/activities/floci.ts +0 -145
  772. package/src/op/activities/index.ts +0 -69
  773. package/src/op/builders.test.ts +0 -61
  774. package/src/op/builders.ts +0 -72
  775. package/src/ownership.test.ts +0 -41
  776. package/src/ownership.ts +0 -52
  777. package/src/package-cli.ts +0 -30
  778. package/src/parameter.ts +0 -37
  779. package/src/plugin.test.ts +0 -341
  780. package/src/plugin.ts +0 -1179
  781. package/src/properties.test.ts +0 -146
  782. package/src/properties.ts +0 -193
  783. package/src/pseudo.test.ts +0 -55
  784. package/src/pseudo.ts +0 -29
  785. package/src/receipt-store.test.ts +0 -204
  786. package/src/receipt-store.ts +0 -316
  787. package/src/reference-catalog.test.ts +0 -102
  788. package/src/reference-catalog.ts +0 -153
  789. package/src/serializer-foreign-attr.test.ts +0 -43
  790. package/src/serializer-ownership.test.ts +0 -55
  791. package/src/serializer-tag-shapes.test.ts +0 -83
  792. package/src/serializer.test.ts +0 -1011
  793. package/src/serializer.ts +0 -757
  794. package/src/skills/chant-aws-carve-terraform.md +0 -115
  795. package/src/skills/chant-aws-eks.md +0 -178
  796. package/src/skills/chant-aws.md +0 -430
  797. package/src/spec/fetch.test.ts +0 -167
  798. package/src/spec/fetch.ts +0 -286
  799. package/src/spec/parse.test.ts +0 -552
  800. package/src/spec/parse.ts +0 -458
  801. package/src/spec/pin.test.ts +0 -263
  802. package/src/spec/pin.ts +0 -254
  803. package/src/spec/pinned-types.json +0 -1858
  804. package/src/stack-errors.ts +0 -15
  805. package/src/taggable.ts +0 -111
  806. package/src/teardown.test.ts +0 -258
  807. package/src/teardown.ts +0 -276
  808. package/src/template-sections.ts +0 -71
  809. package/src/template-transform.ts +0 -68
  810. package/src/testdata/capabilities-ledger/estate.ts +0 -161
  811. package/src/testdata/cdk-member/cdk.json +0 -1
  812. package/src/testdata/cdk-member/cdk.out/AppStack.template.json +0 -20
  813. package/src/testdata/cdk-member/cdk.out/manifest.json +0 -1
  814. package/src/testdata/cdk-unsynthesized/cdk.json +0 -1
  815. package/src/testdata/cfn-member/README.txt +0 -1
  816. package/src/testdata/cfn-member/stack.yaml +0 -36
  817. package/src/testdata/indexed/identity.listing.json +0 -65
  818. package/src/testdata/indexed/import.listing.json +0 -126
  819. package/src/testdata/indexed/listing.json +0 -69
  820. package/src/testdata/indexed/topology.listing.json +0 -350
  821. package/src/testdata/load-fixtures.ts +0 -17
  822. package/src/testdata/nested-stacks/app.ts +0 -26
  823. package/src/testdata/nested-stacks/network/outputs.ts +0 -17
  824. package/src/testdata/nested-stacks/network/security.ts +0 -17
  825. package/src/testdata/nested-stacks/network/vpc.ts +0 -54
  826. package/src/testdata/roundtrip/conditions.json +0 -21
  827. package/src/testdata/roundtrip/intrinsic-calls.json +0 -31
  828. package/src/testdata/roundtrip/intrinsics.json +0 -18
  829. package/src/testdata/roundtrip/multi-resource.json +0 -37
  830. package/src/testdata/roundtrip/parameters.json +0 -23
  831. package/src/testdata/roundtrip/simple.json +0 -12
  832. package/src/testdata/roundtrip/with-conditions.json +0 -16
  833. package/src/testdata/sam-fixtures/api.yaml +0 -14
  834. package/src/testdata/sam-fixtures/application.yaml +0 -13
  835. package/src/testdata/sam-fixtures/function.yaml +0 -22
  836. package/src/testdata/sam-fixtures/graphql-api.yaml +0 -13
  837. package/src/testdata/sam-fixtures/http-api.yaml +0 -15
  838. package/src/testdata/sam-fixtures/layer-version.yaml +0 -15
  839. package/src/testdata/sam-fixtures/multi-type-a.yaml +0 -23
  840. package/src/testdata/sam-fixtures/multi-type-b.yaml +0 -29
  841. package/src/testdata/sam-fixtures/simple-table.yaml +0 -12
  842. package/src/testdata/sam-fixtures/state-machine.yaml +0 -14
  843. package/src/testdata/schemas/aws-dynamodb-table.json +0 -126
  844. package/src/testdata/schemas/aws-iam-role.json +0 -85
  845. package/src/testdata/schemas/aws-lambda-function.json +0 -90
  846. package/src/testdata/schemas/aws-s3-bucket.json +0 -83
  847. package/src/testdata/schemas/aws-sns-topic.json +0 -71
  848. package/src/testdata/three-cloud/dns.graph.json +0 -336
  849. package/src/three-cloud-parity.test.ts +0 -49
  850. package/src/validate-cli.ts +0 -19
  851. package/src/validate.e2e.test.ts +0 -34
  852. package/src/validate.ts +0 -39
  853. package/src/workspace-kinds.test.ts +0 -47
  854. package/src/workspace-member.test.ts +0 -94
  855. package/src/workspace-member.ts +0 -197
  856. /package/{src → dist}/generated/lexicon-aws.json +0 -0
@@ -1,1495 +0,0 @@
1
- /**
2
- * apply family — the most cloud-shaped family (see docs/components/cloud-boundary).
3
- * AWS leaves for this starter set: cfn-deploy, ecs-update-service,
4
- * lambda-deploy, s3-sync, cdn-invalidate, run-migration.
5
- *
6
- * `cfn-deploy` carries declarative safety options (changeset preview,
7
- * `onReplace`, `stageGsi`) — sticky per-resource knowledge (a DynamoDB GSI
8
- * updates one at a time; a key-schema change forces replacement) lives inside
9
- * the capability, configured by options, never scripted per component. See
10
- * docs/components/capabilities.mdx#stickiness-lives-in-the-capability.
11
- *
12
- * `cfn-deploy` and `ecs-update-service` are real implementations (#557, epic
13
- * #551) over the injectable `CloudExecutor` (./cloud-executor.ts).
14
- * `lambda-deploy` gained a real implementation in #558 (epic #551) — the one
15
- * new capability the fourth, genuinely different validation component
16
- * (image-processor-lambda) needed; see ../SPRAWL-VALIDATION.md. `s3-sync`,
17
- * `cdn-invalidate`, and `run-migration` are also real over the same executor —
18
- * `run-migration` dispatches on its target transport (ECS one-off task, Lambda
19
- * invoke, or SSM host command).
20
- */
21
-
22
- import { createHash } from "node:crypto";
23
- import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
24
- import { tmpdir } from "node:os";
25
- import { join } from "node:path";
26
- import type { Capability, CapabilityPlan, DeclaredRead, DeployContext, PlannedOutputs } from "@intentius/chant/components/capability";
27
- import type { ChangeSetEntry, ChangeSetHole, ChangeSetPart } from "@intentius/chant/change-set";
28
- import { computePlanDigest } from "@intentius/chant/lifecycle/plan-digest";
29
- import {
30
- normalizePlanShape,
31
- PlanShapeMovedError,
32
- planShapeDifferences,
33
- planShapeDigest,
34
- type PlanShape,
35
- type PlanShapeArtifact,
36
- type PlanShapeEntry,
37
- type ShapeReplacement,
38
- } from "@intentius/chant/components/covered-round";
39
- import { defaultCloudExecutor, type CfnChange, type CfnChangeSet, type CfnStackStatus, type CloudExecutor } from "./cloud-executor";
40
- import { cfnExports, cfnImportPointer, cfnImports, cfnKnownValues, cfnTemplateWithStandIns, readCfnTemplate, resolveCfnName } from "./cfn-imports";
41
-
42
- /** CloudFormation's wording when a change set has nothing to apply — the stack
43
- * is already current. AWS phrases it "The submitted information didn't contain
44
- * changes."; `aws cloudformation deploy` reports "No updates are to be
45
- * performed."; keep both plus a bare "no changes" for other backends/Floci. */
46
- const NO_CHANGE_REASON = /(did ?n['’]?t|does ?n['’]?t|did not|does not) contain changes|no updates are to be performed|no changes/i;
47
-
48
- /**
49
- * True when CloudFormation reports the change set has nothing to apply. AWS
50
- * surfaces this as a FAILED change set whose `StatusReason` names the empty
51
- * diff (executing it then errors); when no reason is available, a FAILED set
52
- * with zero proposed changes is the same no-op. A FAILED set with any other
53
- * reason is a genuine create failure and must NOT be treated as a no-op.
54
- */
55
- export function isNoopChangeSet(changeSet: CfnChangeSet): boolean {
56
- if (changeSet.status !== "FAILED") return false;
57
- return changeSet.statusReason
58
- ? NO_CHANGE_REASON.test(changeSet.statusReason)
59
- : changeSet.changes.length === 0;
60
- }
61
-
62
- // ── cfn-deploy ───────────────────────────────────────────────────────────────
63
-
64
- /**
65
- * Whether a proposed change replaces its resource. CloudFormation's
66
- * `Replacement: Conditional` counts: the replacement depends on a value it
67
- * resolves only while applying, so a reviewer has to read it as one (#4084).
68
- */
69
- export function cfnChangeReplaces(change: CfnChange): boolean {
70
- return change.replacement || change.replacementMode === "Conditional";
71
- }
72
-
73
- /**
74
- * One CloudFormation resource change as a change-set entry (#4084). The
75
- * address is the logical id, which is also the entity name the aws
76
- * lexicon's graph IR gives the resource, so the entry maps onto its node
77
- * (#4022). `Add` is a create, `Modify` an update or (when it replaces) a
78
- * replace, `Remove` a delete, `Import` an import that changes nothing else,
79
- * and `Dynamic` an update CloudFormation could not describe further.
80
- */
81
- export function cfnChangeEntry(member: string, change: CfnChange, unknown: readonly string[] = []): ChangeSetEntry {
82
- // A property an unknown input drives is known after apply (#4419); one the
83
- // change set did not list (a create names no properties) is added for it.
84
- const paths = [...new Set([...(change.details ?? []), ...unknown])].sort();
85
- const attributes = paths.map((path) => (unknown.includes(path) ? { path, unknown: true as const } : { path }));
86
- // A change inside a nested stack (#3997) sits under the nested stacks'
87
- // logical ids, the way a terraform address sits under its module.
88
- const module = change.nestedStack?.length ? change.nestedStack.join("/") : undefined;
89
- const base = {
90
- member,
91
- lexicon: "aws",
92
- planner: "chant" as const,
93
- address: module ? `${module}/${change.logicalResourceId}` : change.logicalResourceId,
94
- type: change.resourceType,
95
- name: change.logicalResourceId,
96
- ...(module ? { module } : {}),
97
- attributes,
98
- };
99
- switch (change.action) {
100
- case "Add":
101
- return { ...base, action: "create" };
102
- case "Remove":
103
- return { ...base, action: "delete", disruption: "destroy" };
104
- case "Import":
105
- return { ...base, action: "no-op", importing: true };
106
- case "Dynamic":
107
- return { ...base, action: cfnChangeReplaces(change) ? "replace" : "update", disruption: cfnChangeReplaces(change) ? "replace" : "unknown" };
108
- default:
109
- return cfnChangeReplaces(change)
110
- ? { ...base, action: "replace", disruption: "replace" }
111
- : { ...base, action: "update", disruption: "in-place" };
112
- }
113
- }
114
-
115
- /**
116
- * The changes `onReplace: "block"` refuses: those CloudFormation says replace
117
- * their resource (`Replacement: True`). `run` and `plan` refuse on the same
118
- * set, so a plan that passes is one `run` would not block (#3997).
119
- */
120
- function blockedReplacements(changes: CfnChange[]): CfnChange[] {
121
- return changes.filter((c) => c.replacement);
122
- }
123
-
124
- /**
125
- * What a `cfn-deploy` plan hands `run` through `DeployContext.plans[stack]`
126
- * (#3997): the stack and a digest over the changes the plan's change set
127
- * proposed. `run` creates its change set, and executes it only when its
128
- * changes have the same digest.
129
- */
130
- export interface CfnPlanArtifact {
131
- kind: "cfn-deploy-plan";
132
- stack: string;
133
- /** {@link cfnChangesDigest} of the planned change set's changes. */
134
- changesDigest: string;
135
- }
136
-
137
- function isCfnPlanArtifact(value: unknown): value is CfnPlanArtifact {
138
- const v = value as Partial<CfnPlanArtifact> | undefined;
139
- return v?.kind === "cfn-deploy-plan" && typeof v.stack === "string" && typeof v.changesDigest === "string";
140
- }
141
-
142
- /**
143
- * A digest over a change set's changes as entries, independent of the change
144
- * set's name and of the order CloudFormation lists them in. A change set with
145
- * nothing to apply digests as no entries.
146
- */
147
- export function cfnChangesDigest(stack: string, changeSet: CfnChangeSet): string {
148
- const entries = isNoopChangeSet(changeSet) ? [] : changeSet.changes.map((c) => cfnChangeEntry(stack, c));
149
- entries.sort((a, b) => a.address.localeCompare(b.address) || a.action.localeCompare(b.action));
150
- return computePlanDigest("cfn-deploy-changes", { stack, entries });
151
- }
152
-
153
- /**
154
- * Thrown by `run` when the change set it created proposes other changes than
155
- * the change set its plan read (#3997): the stack, the template or the
156
- * parameters moved between the plan and the apply. The change set is deleted
157
- * unexecuted. `planMoved` is core's mark for a moved plan
158
- * (`isPlanMovedError`), so the command that applied it exits 3.
159
- */
160
- export class CfnPlanMovedError extends Error {
161
- readonly planMoved = true;
162
- constructor(
163
- public readonly stack: string,
164
- public readonly planned: string,
165
- public readonly now: string,
166
- ) {
167
- super(
168
- `cfn-deploy "${stack}": refusing to apply. The change set proposes other changes than the plan that was approved ` +
169
- `(planned ${planned}, now ${now}); the stack, its template or its parameters changed since. Plan it again.`,
170
- );
171
- this.name = "CfnPlanMovedError";
172
- }
173
- }
174
-
175
- /** The template's bytes as a digest, or `null` when it cannot be read here (the change set then reports why). */
176
- function templateDigest(path: string): string | null {
177
- try {
178
- return `sha256:${createHash("sha256").update(readFileSync(path)).digest("hex")}`;
179
- } catch {
180
- return null;
181
- }
182
- }
183
-
184
- /**
185
- * What a `cfn-deploy` plan binds: the environment, the stack, the template's
186
- * bytes and the parameters as resolved, and the stacks whose outputs were
187
- * not known yet. The proposed changes are not in it; they are the member's
188
- * entries, which the change-set document's digest binds (#4084).
189
- */
190
- function cfnPlanDigest(
191
- ctx: DeployContext,
192
- stack: string,
193
- input: CfnDeployInput,
194
- parameters: Record<string, string | null>,
195
- unresolved: string[],
196
- /** The digest of the preview's shape (#4423), so an approval binds what the reviewer saw of a member planned before its inputs were known. */
197
- preview?: string,
198
- ): string {
199
- return computePlanDigest("cfn-deploy-plan", {
200
- env: ctx.env,
201
- stack,
202
- template: input.template,
203
- templateDigest: templateDigest(input.template),
204
- parameters,
205
- unresolved,
206
- // #4466: the exports the template imports from stacks in the change, as resolved.
207
- ...(input.imports && Object.keys(input.imports).length > 0 ? { imports: importValues(input.imports) } : {}),
208
- ...(preview ? { preview } : {}),
209
- });
210
- }
211
-
212
- /**
213
- * Plan a `cfn-deploy` step without changing the stack (#4084): create a
214
- * change set for the template and the resolved parameters, read the changes
215
- * it proposes, and delete it without executing it. A stack that does not
216
- * exist yet gets a CREATE change set, so every resource reads as a create,
217
- * and the empty `REVIEW_IN_PROGRESS` stack CloudFormation made to hold it is
218
- * deleted too. A change set with nothing to apply (`isNoopChangeSet`) gives
219
- * a member with no entries. A step whose parameters or imports read outputs
220
- * that are not known yet, from a stack the same run applies first, is
221
- * previewed: its change set is made against a stand-in for each unknown
222
- * value (#4423), an import standing in as a parameter of a template copy
223
- * (#4466b), and `run` checks the real change set's shape against the
224
- * preview's before it executes. When no preview can be made, its member gets
225
- * a hole saying whose outputs it waits on, and no artifact, so `run` plans
226
- * it afresh.
227
- *
228
- * With `onReplace: "block"` (the default), a change set that replaces a
229
- * resource fails the plan with {@link CfnReplacementBlockedError}, so the
230
- * refusal shows in the pull request's plan rather than at apply (#3997).
231
- * Otherwise the result carries a {@link CfnPlanArtifact} that `run` checks
232
- * its own change set against.
233
- *
234
- * The plan answers the outputs the stack will have (#3999), from the
235
- * outputs it has now (`DescribeStacks`) and the change set: an output keeps
236
- * its value when every resource its template `Value` reads keeps its
237
- * physical resource, which an in-place `Modify` does and an `Add`, a
238
- * `Remove` or a replacement does not ({@link cfnPlannedOutputs}). An output
239
- * that reads a parameter, an import or a condition is known only after
240
- * apply. A wrong guess costs a round, never a wrong apply: a dependent whose
241
- * input applies as another value is held back and planned again.
242
- */
243
- async function planCfnDeploy(executor: CloudExecutor, ctx: DeployContext, input: CfnDeployInput): Promise<CapabilityPlan> {
244
- const stack = input.stack ?? ctx.component;
245
- const raw: Record<string, unknown> = { ...(input.inputs ?? {}), ...(input.imageRef !== undefined ? { ImageRef: input.imageRef } : {}) };
246
- const parameters: Record<string, string | null> = {};
247
- const missing: string[] = [];
248
- for (const [key, value] of Object.entries(raw)) {
249
- if (value === undefined || value === null) {
250
- parameters[key] = null;
251
- missing.push(key);
252
- } else parameters[key] = typeof value === "string" ? value : JSON.stringify(value);
253
- }
254
- const unresolved = [...(ctx.unresolvedInputs ?? [])].sort();
255
- let planDigest = cfnPlanDigest(ctx, stack, input, parameters, unresolved);
256
- // #4466: an import whose name the plan cannot resolve is a hole that says why.
257
- const importHoles = unresolvedImportHoles(stack, input, knownParameters(parameters));
258
- // #4466c: an export another stack imports that the plan may change, said where it cannot tell.
259
- const exportHoles: ChangeSetHole[] = [];
260
- const member = (holes: ChangeSetHole[]): ChangeSetPart["member"] => ({
261
- member: stack,
262
- lexicon: "aws",
263
- planner: "chant",
264
- status: "planned",
265
- planDigest,
266
- holes: [...holes, ...importHoles, ...exportHoles],
267
- });
268
- const standing = standingReader(executor, stack);
269
-
270
- if (unresolved.length > 0 || missing.length > 0) {
271
- const hole = (why: string): CapabilityPlan => ({
272
- member: stack,
273
- planDigest,
274
- changeSet: { member: member([{ address: stack, type: "AWS::CloudFormation::Stack", reason: why }]), entries: [] },
275
- });
276
- const waiting = unknownImports(input);
277
- const fallback =
278
- unresolved.length > 0
279
- ? missing.length === 0 && waiting.length > 0
280
- ? `imports ${waiting.join(", ")}, exported by ${unresolved.join(", ")}, which apply first; re-checked on apply`
281
- : `inputs from ${unresolved.join(", ")}; re-checked on apply`
282
- : `inputs ${[...missing].sort().join(", ")} are known only at apply; re-checked on apply`;
283
- // Which parameters are unknown: the inputs that hold nothing yet, and a
284
- // stand-in for each import of an export not known yet (#4466b). When the
285
- // upstream is unresolved but neither says which, nothing can be previewed.
286
- if (missing.length === 0 && waiting.length === 0) return hole(fallback);
287
- const copy = waiting.length > 0 ? standInTemplate(stack, input, waiting, knownParameters(parameters)) : undefined;
288
- if (typeof copy === "string") return hole(`${fallback}; no preview: ${copy}`);
289
- let preview: Awaited<ReturnType<typeof previewCfnDeploy>>;
290
- try {
291
- const previewed = copy ? { ...input, template: copy.path } : input;
292
- preview = await previewCfnDeploy(executor, stack, previewed, [...missing, ...(copy?.parameters ?? [])].sort(), unresolved.length > 0 ? unresolved : undefined);
293
- } finally {
294
- copy?.remove();
295
- }
296
- if (typeof preview === "string") return hole(`${fallback}; no preview: ${preview}`);
297
- const { entries, shape, outputs } = preview;
298
- exportHoles.push(...(await exportsInUse(executor, stack, input, knownParameters(parameters), outputs, standing)));
299
- const artifact: CfnShapeArtifact = { kind: "cfn-deploy-shape", member: stack, shape, digest: planShapeDigest(shape) };
300
- // The preview's shape enters the digest (#4423); `member` reads it when called below.
301
- planDigest = cfnPlanDigest(ctx, stack, input, parameters, unresolved, artifact.digest);
302
- return { member: stack, planDigest, artifact, shape, changeSet: { member: member([]), entries }, ...(outputs ? { outputs } : {}) };
303
- }
304
-
305
- const changeSet = await executor.cloudformation.createChangeSet({
306
- stackName: stack,
307
- templatePath: input.template,
308
- parameters: flattenCfnInputs(input),
309
- });
310
- try {
311
- if (isNoopChangeSet(changeSet)) {
312
- const artifact: CfnPlanArtifact = { kind: "cfn-deploy-plan", stack, changesDigest: cfnChangesDigest(stack, changeSet) };
313
- // Nothing to apply, so the outputs the stack has are the ones it will have (#3999).
314
- const now = await standing();
315
- const outputs = now ? { known: { ...now.outputs }, unknown: [] } : undefined;
316
- return { member: stack, planDigest, artifact, changeSet: { member: member([]), entries: [] }, ...(outputs ? { outputs } : {}) };
317
- }
318
- if (changeSet.status === "FAILED") {
319
- throw new Error(
320
- `cfn-deploy "${stack}": CloudFormation could not create a change set to plan it${changeSet.statusReason ? `: ${changeSet.statusReason}` : ""}`,
321
- );
322
- }
323
- const blocked = blockedReplacements(changeSet.changes);
324
- if (blocked.length > 0 && (input.onReplace ?? "block") === "block") throw new CfnReplacementBlockedError(stack, blocked);
325
- const entries = changeSet.changes.map((c) => cfnChangeEntry(stack, c));
326
- const artifact: CfnPlanArtifact = { kind: "cfn-deploy-plan", stack, changesDigest: cfnChangesDigest(stack, changeSet) };
327
- const outputs = changeSet.stackCreated
328
- ? undefined
329
- : await plannedStackOutputs(standing, input.template, changeSet.changes, knownParameters(parameters), importValues(input.imports ?? {}));
330
- // #4466c: CloudFormation refuses to change or remove an export another stack imports; say so now, not at apply.
331
- if (!changeSet.stackCreated) exportHoles.push(...(await exportsInUse(executor, stack, input, knownParameters(parameters), outputs, standing)));
332
- // The real change set's shape, with the replacement CloudFormation reports,
333
- // for a round that checks it against a preview (#4419).
334
- const shape = cfnPlanShape(stack, changeSet, []);
335
- return { member: stack, planDigest, artifact, shape, changeSet: { member: member([]), entries }, ...(outputs ? { outputs } : {}) };
336
- } finally {
337
- await cleanUpPlanChangeSet(executor, changeSet);
338
- }
339
- }
340
-
341
- // ── preview of a member whose inputs are unknown (#4419) ────────────────────
342
-
343
- /** What a previewed member hands `run`: the shape its change set had against stand-in values. */
344
- export interface CfnShapeArtifact extends PlanShapeArtifact {
345
- kind: "cfn-deploy-shape";
346
- }
347
-
348
- function isCfnShapeArtifact(value: unknown): value is CfnShapeArtifact {
349
- const v = value as Partial<CfnShapeArtifact> | undefined;
350
- return v?.kind === "cfn-deploy-shape" && typeof v.digest === "string" && typeof v.shape === "object" && v.shape !== null;
351
- }
352
-
353
- /** The marker every stand-in carries, so a reader of a change set can tell it from a real value. */
354
- export const CFN_UNKNOWN_MARK = "known-after-apply";
355
-
356
- const ID_PREFIX: Record<string, string> = {
357
- "AWS::EC2::Subnet::Id": "subnet",
358
- "AWS::EC2::VPC::Id": "vpc",
359
- "AWS::EC2::SecurityGroup::Id": "sg",
360
- "AWS::EC2::Instance::Id": "i",
361
- "AWS::EC2::Image::Id": "ami",
362
- "AWS::EC2::Volume::Id": "vol",
363
- };
364
-
365
- /**
366
- * A stand-in for a parameter whose value is not known yet: valid for the
367
- * parameter's type and recognisable. An EC2 id type gets the id's prefix
368
- * (`subnet-00000000known-after-apply`), a number gets 0, anything else gets
369
- * `known-after-apply`. Real CloudFormation checks the AWS-specific types
370
- * against the account and refuses an id that does not exist; the preview
371
- * then falls back to a hole. Floci does not check.
372
- */
373
- export function cfnPlaceholder(type: string | undefined): string {
374
- if (type && ID_PREFIX[type]) return `${ID_PREFIX[type]}-00000000${CFN_UNKNOWN_MARK}`;
375
- if (type === "Number") return "0";
376
- if (type?.startsWith("AWS::SSM::Parameter::Value<")) return `/${CFN_UNKNOWN_MARK}`;
377
- return CFN_UNKNOWN_MARK;
378
- }
379
-
380
- interface TemplateFacts {
381
- parameterTypes: Record<string, string>;
382
- /** Per logical id, the top-level properties whose value reads one of the keys. */
383
- driven: Map<string, Set<string>>;
384
- }
385
-
386
- function readsParameter(value: unknown, key: string): boolean {
387
- if (typeof value === "string") return false;
388
- if (Array.isArray(value)) return value.some((v) => readsParameter(v, key));
389
- if (value && typeof value === "object") {
390
- const obj = value as Record<string, unknown>;
391
- if (obj.Ref === key) return true;
392
- const sub = obj["Fn::Sub"];
393
- const text = typeof sub === "string" ? sub : Array.isArray(sub) && typeof sub[0] === "string" ? sub[0] : undefined;
394
- if (text !== undefined && (text.includes("${" + key + "}") || text.includes("${" + key + "."))) return true;
395
- return Object.values(obj).some((v) => readsParameter(v, key));
396
- }
397
- return false;
398
- }
399
-
400
- /** The parameter types and the properties that read `keys`, from the template. A template that cannot be read gives no facts. */
401
- function templateFacts(path: string, keys: string[]): TemplateFacts {
402
- const facts: TemplateFacts = { parameterTypes: {}, driven: new Map() };
403
- try {
404
- const t = JSON.parse(readFileSync(path, "utf8")) as {
405
- Parameters?: Record<string, { Type?: string }>;
406
- Resources?: Record<string, { Properties?: Record<string, unknown> }>;
407
- };
408
- for (const k of keys) if (t.Parameters?.[k]?.Type) facts.parameterTypes[k] = t.Parameters[k].Type!;
409
- for (const [id, r] of Object.entries(t.Resources ?? {})) {
410
- for (const [prop, value] of Object.entries(r.Properties ?? {})) {
411
- if (keys.some((k) => readsParameter(value, k))) (facts.driven.get(id) ?? facts.driven.set(id, new Set()).get(id)!).add(prop);
412
- }
413
- }
414
- } catch {
415
- /* unreadable or not JSON: the change set reports why, and no property is attributed */
416
- }
417
- return facts;
418
- }
419
-
420
- /** The properties of one change that the unknown parameters drive. */
421
- function drivenProperties(change: CfnChange, keys: string[], facts: TemplateFacts): string[] {
422
- const out = new Set<string>();
423
- for (const d of change.drivers ?? []) {
424
- if (d.changeSource === "ParameterReference" && d.causingEntity && keys.some((k) => d.causingEntity === k || d.causingEntity!.startsWith(`${k}.`))) {
425
- out.add(d.property);
426
- }
427
- }
428
- const scanned = facts.driven.get(change.logicalResourceId);
429
- if (scanned && change.action !== "Remove") {
430
- const listed = change.details ?? [];
431
- for (const p of scanned) if (change.action === "Add" || listed.length === 0 || listed.includes(p)) out.add(p);
432
- }
433
- return [...out].sort();
434
- }
435
-
436
- function shapeReplacement(change: CfnChange): ShapeReplacement {
437
- if (change.replacementMode === "True" || change.replacement) return "true";
438
- return change.replacementMode === "Conditional" ? "conditional" : "false";
439
- }
440
-
441
- /**
442
- * A change set's shape: each change's resource, action, replacement and
443
- * properties, with the ones the `unknown` parameters drive marked. `unknown`
444
- * is empty for the change set made against real values. `refs` are the
445
- * inputs the shape names as unknown (`<component>.<output>`), the parameters
446
- * themselves when nothing says better.
447
- */
448
- export function cfnPlanShape(stack: string, changeSet: CfnChangeSet, unknown: string[], templatePath?: string, refs: string[] = unknown): PlanShape {
449
- const facts = unknown.length > 0 && templatePath ? templateFacts(templatePath, unknown) : { parameterTypes: {}, driven: new Map() };
450
- const entries: PlanShapeEntry[] = isNoopChangeSet(changeSet)
451
- ? []
452
- : changeSet.changes.map((c) => {
453
- const e = cfnChangeEntry(stack, c);
454
- return {
455
- logicalId: e.address,
456
- action: e.action,
457
- replacement: shapeReplacement(c),
458
- type: c.resourceType,
459
- properties: [...new Set(c.details ?? [])],
460
- unknown: drivenProperties(c, unknown, facts),
461
- };
462
- });
463
- return normalizePlanShape({ member: stack, unknownInputs: refs, entries });
464
- }
465
-
466
- /**
467
- * Preview a stack whose parameters `unknown` are not known yet: create its
468
- * change set with a stand-in for each, read the changes into entries that
469
- * mark the properties those parameters drive as known after apply, take the
470
- * shape, and delete the change set. Returns why instead when CloudFormation
471
- * would not make the change set (real CloudFormation refuses an id that does
472
- * not exist), so the caller plans a hole.
473
- *
474
- * Floci accepts a change set that real CloudFormation refuses (a missing
475
- * export, an id that does not exist), reports `Parameters: null`, and says
476
- * `Replacement: False` for a change that replaces. So a cross-stack value
477
- * goes through a parameter here, never an export: an import of an export
478
- * not known yet is planned from a copy of the template in which it is a
479
- * stand-in parameter (#4466b, `cfnTemplateWithStandIns`). The replacement a
480
- * preview reports is whatever the backend says; the shape check at apply
481
- * compares like with like.
482
- */
483
- async function previewCfnDeploy(
484
- executor: CloudExecutor,
485
- stack: string,
486
- input: CfnDeployInput,
487
- unknown: string[],
488
- refs: string[] = unknown,
489
- ): Promise<{ entries: ChangeSetEntry[]; shape: PlanShape; outputs?: PlannedOutputs } | string> {
490
- const facts = templateFacts(input.template, unknown);
491
- const parameters: Record<string, string> = { ...(flattenCfnInputs(input) ?? {}) };
492
- for (const k of unknown) parameters[k] = cfnPlaceholder(facts.parameterTypes[k]);
493
- let changeSet: CfnChangeSet;
494
- try {
495
- changeSet = await executor.cloudformation.createChangeSet({ stackName: stack, templatePath: input.template, parameters });
496
- } catch (err) {
497
- return `CloudFormation refused the change set with stand-in values: ${err instanceof Error ? err.message : String(err)}`;
498
- }
499
- try {
500
- if (changeSet.status === "FAILED" && !isNoopChangeSet(changeSet)) {
501
- return `CloudFormation could not create the change set with stand-in values${changeSet.statusReason ? `: ${changeSet.statusReason}` : ""}`;
502
- }
503
- const noop = isNoopChangeSet(changeSet);
504
- const entries = noop ? [] : changeSet.changes.map((c) => cfnChangeEntry(stack, c, drivenProperties(c, unknown, facts)));
505
- // What the stack's outputs will be, for the members that read them: an
506
- // output that reads one of the unknown parameters is unknown, one that
507
- // reads a known parameter or states its value is not (#4419).
508
- const given = Object.fromEntries(Object.entries(parameters).filter(([k]) => !unknown.includes(k)));
509
- const outputs = noop || changeSet.stackCreated ? undefined : await plannedStackOutputs(standingReader(executor, stack), input.template, changeSet.changes, given);
510
- return { entries, shape: cfnPlanShape(stack, changeSet, unknown, input.template, refs), ...(outputs ? { outputs } : {}) };
511
- } finally {
512
- await cleanUpPlanChangeSet(executor, changeSet);
513
- }
514
- }
515
-
516
- /**
517
- * Delete a plan's change set, and the empty stack a CREATE change set made
518
- * when no stack existed before. A failure to clean up does not fail the
519
- * plan: the change set holds nothing that applies, and the next CREATE
520
- * change set reuses an empty stack left behind.
521
- */
522
- async function cleanUpPlanChangeSet(executor: CloudExecutor, changeSet: CfnChangeSet): Promise<void> {
523
- try {
524
- await executor.cloudformation.deleteChangeSet({ stackName: changeSet.stackName, changeSetName: changeSet.changeSetName });
525
- } catch (err) {
526
- console.error(`cfn-deploy plan "${changeSet.stackName}": could not delete change set ${changeSet.changeSetName}: ${err instanceof Error ? err.message : String(err)}`);
527
- }
528
- if (changeSet.stackCreated && executor.cloudformation.deleteStackShell) {
529
- try {
530
- await executor.cloudformation.deleteStackShell(changeSet.stackName);
531
- } catch (err) {
532
- console.error(`cfn-deploy plan "${changeSet.stackName}": could not delete the empty stack its CREATE change set made: ${err instanceof Error ? err.message : String(err)}`);
533
- }
534
- }
535
- }
536
-
537
- /** The stack as it stands, read once however often it is asked for, or `undefined` when it cannot be read. */
538
- function standingReader(executor: CloudExecutor, stack: string): () => Promise<CfnStackStatus | undefined> {
539
- let read: Promise<CfnStackStatus | undefined> | undefined;
540
- return () =>
541
- (read ??= executor.cloudformation.describeStack(stack).then(
542
- (s) => s,
543
- () => undefined,
544
- ));
545
- }
546
-
547
- /**
548
- * What the plan says of the stack's outputs once `changes` apply: none to
549
- * say for a template with no `Outputs`, which needs no `DescribeStacks`.
550
- */
551
- async function plannedStackOutputs(
552
- standing: () => Promise<CfnStackStatus | undefined>,
553
- templatePath: string,
554
- changes: readonly CfnChange[],
555
- parameters: Record<string, string> = {},
556
- imports: Record<string, string> = {},
557
- ): Promise<PlannedOutputs | undefined> {
558
- const template = readTemplate(templatePath) as { Outputs?: Record<string, unknown> } | undefined;
559
- if (!template || typeof template !== "object") return undefined;
560
- if (Object.keys(template.Outputs ?? {}).length === 0) return { known: {}, unknown: [] };
561
- const now = await standing();
562
- return cfnPlannedOutputs(template, changes, now ? { ...now.outputs } : undefined, parameters, imports);
563
- }
564
-
565
- /** The template at `path` as JSON, or `undefined` when it cannot be read or parsed here. */
566
- function readTemplate(path: string): unknown {
567
- try {
568
- return JSON.parse(readFileSync(path, "utf8"));
569
- } catch {
570
- return undefined;
571
- }
572
- }
573
-
574
- /**
575
- * What a template's `Value` reads (#3999): the logical ids it names through
576
- * `Ref`, `Fn::GetAtt` and `Fn::Sub`, and whether it reads anything this plan
577
- * cannot follow (`Fn::ImportValue`, a condition's `Fn::If`, or an intrinsic
578
- * it does not know).
579
- */
580
- function valueReads(value: unknown): { ids: Set<string>; opaque: boolean } {
581
- const ids = new Set<string>();
582
- let opaque = false;
583
- const sub = (text: string): void => {
584
- for (const m of text.matchAll(/\$\{([^}!][^}]*)\}/g)) ids.add(m[1]!.split(".")[0]!);
585
- };
586
- const walk = (v: unknown): void => {
587
- if (Array.isArray(v)) return v.forEach(walk);
588
- if (v === null || typeof v !== "object") return;
589
- const entries = Object.entries(v as Record<string, unknown>);
590
- if (entries.length === 1) {
591
- const [key, arg] = entries[0]!;
592
- if (key === "Ref") {
593
- if (typeof arg === "string") ids.add(arg);
594
- else opaque = true;
595
- return;
596
- }
597
- if (key === "Fn::GetAtt") {
598
- if (Array.isArray(arg) && typeof arg[0] === "string") ids.add(arg[0]);
599
- else if (typeof arg === "string") ids.add(arg.split(".")[0]!);
600
- else opaque = true;
601
- return;
602
- }
603
- if (key === "Fn::Sub") {
604
- if (typeof arg === "string") sub(arg);
605
- else if (Array.isArray(arg) && typeof arg[0] === "string") {
606
- const vars = (arg[1] ?? {}) as Record<string, unknown>;
607
- for (const m of arg[0].matchAll(/\$\{([^}!][^}]*)\}/g)) if (!(m[1]! in vars)) ids.add(m[1]!.split(".")[0]!);
608
- walk(vars);
609
- } else opaque = true;
610
- return;
611
- }
612
- if (key === "Fn::Join" || key === "Fn::Select" || key === "Fn::Split" || key === "Fn::Base64") return walk(arg);
613
- if (key.startsWith("Fn::") || key === "Condition") {
614
- opaque = true;
615
- return;
616
- }
617
- }
618
- entries.forEach(([, x]) => walk(x));
619
- };
620
- walk(value);
621
- return { ids, opaque };
622
- }
623
-
624
- /**
625
- * The outputs a stack will have once `changes` apply (#3999), from its
626
- * template and the outputs it has now. An output is known, at the value it
627
- * has now, when its `Value` reads only pseudo parameters and resources whose
628
- * physical resource the change set keeps (no `Add`, `Remove`, `Import` or
629
- * `Dynamic`, no replacement, no change in a nested stack under it). One
630
- * that reads a parameter, an import or a condition, one the stack does not
631
- * have yet, and every output of a template this cannot read, is unknown.
632
- *
633
- * Two kinds of output need no standing value. An output whose `Value` is a
634
- * plain string is known at that string, changed or new: the template says it.
635
- * An output that is a `Ref` to a parameter the plan was given a value for is
636
- * known at that value (`given`, the inputs of this plan). Both are what
637
- * the stack's outputs will be, whatever they are now.
638
- *
639
- * An output that passes an import through (`Fn::ImportValue` of a name
640
- * `imports` holds, #4466) is known at the value the exporting stack's plan
641
- * gave it, which is the value core read for the import.
642
- *
643
- * `undefined` when there is no template or no standing stack to read from.
644
- */
645
- export function cfnPlannedOutputs(
646
- template: unknown,
647
- changes: readonly CfnChange[],
648
- standing: Record<string, string> | undefined,
649
- given: Record<string, string> = {},
650
- imports: Record<string, string> = {},
651
- ): PlannedOutputs | undefined {
652
- if (!standing || template === null || typeof template !== "object") return undefined;
653
- const t = template as { Outputs?: Record<string, { Value?: unknown; Condition?: unknown }>; Parameters?: Record<string, unknown> };
654
- const parameters = new Set(Object.keys(t.Parameters ?? {}));
655
- const moved = new Set<string>();
656
- for (const c of changes) {
657
- const id = c.nestedStack?.[0] ?? c.logicalResourceId;
658
- const keeps = !c.nestedStack && c.action === "Modify" && !c.replacement && c.replacementMode !== "True" && c.replacementMode !== "Conditional";
659
- if (!keeps) moved.add(id);
660
- }
661
- const known: Record<string, unknown> = {};
662
- const unknown: string[] = [];
663
- for (const [name, output] of Object.entries(t.Outputs ?? {}).sort(([a], [b]) => a.localeCompare(b))) {
664
- const stated = statedOutput(output, given, t.Parameters, imports);
665
- if (stated !== undefined) {
666
- known[name] = stated;
667
- continue;
668
- }
669
- const { ids, opaque } = valueReads(output?.Value);
670
- const stays =
671
- !opaque && output?.Condition === undefined && name in standing &&
672
- [...ids].every((id) => id.startsWith("AWS::") || (!parameters.has(id) && !moved.has(id)));
673
- if (stays) known[name] = standing[name];
674
- else unknown.push(name);
675
- }
676
- return { known, unknown };
677
- }
678
-
679
- /** The inputs a plan was given a value for: every parameter that is not null. */
680
- function knownParameters(parameters: Record<string, string | null>): Record<string, string> {
681
- return Object.fromEntries(Object.entries(parameters).filter((e): e is [string, string] => e[1] !== null));
682
- }
683
-
684
- /**
685
- * What an output's `Value` says outright: a plain string, or a `Ref` to a
686
- * parameter this plan has a value for. `undefined` for anything that reads a
687
- * resource, an import or a condition, which the standing outputs speak for.
688
- */
689
- function statedOutput(
690
- output: { Value?: unknown; Condition?: unknown } | undefined,
691
- parameters: Record<string, string>,
692
- declared: Record<string, unknown> | undefined,
693
- imports: Record<string, string> = {},
694
- ): string | undefined {
695
- if (output?.Condition !== undefined) return undefined;
696
- const value = output?.Value;
697
- if (typeof value === "string") return value;
698
- if (value !== null && typeof value === "object") {
699
- const entries = Object.entries(value as Record<string, unknown>);
700
- const [key, arg] = entries[0] ?? [];
701
- if (entries.length === 1 && key === "Ref" && typeof arg === "string" && declared && arg in declared && arg in parameters) return parameters[arg];
702
- if (entries.length === 1 && key === "Fn::ImportValue") {
703
- const name = resolveCfnName(arg, parameters);
704
- if ("name" in name && name.name in imports) return imports[name.name];
705
- }
706
- }
707
- return undefined;
708
- }
709
-
710
- // ── Fn::ImportValue between stacks (#4466) ──────────────────────────────────
711
-
712
- /** The imports core read a value for, as strings; one still unknown is left out. */
713
- function importValues(imports: Record<string, unknown>): Record<string, string> {
714
- const out: Record<string, string> = {};
715
- for (const [name, v] of Object.entries(imports).sort(([a], [b]) => a.localeCompare(b))) {
716
- if (v === undefined || v === null) continue;
717
- out[name] = typeof v === "string" ? v : JSON.stringify(v);
718
- }
719
- return out;
720
- }
721
-
722
- /** The export names the step imports from a stack in the change whose value is not known yet, sorted. */
723
- function unknownImports(input: CfnDeployInput): string[] {
724
- return Object.entries(input.imports ?? {})
725
- .filter(([, v]) => v === undefined || v === null)
726
- .map(([name]) => name)
727
- .sort();
728
- }
729
-
730
- /**
731
- * A hole for each `Fn::ImportValue` in the template whose name the plan
732
- * cannot resolve (#4466): it may name an export of a stack in this change,
733
- * and then nothing orders the two, so the plan says it cannot tell.
734
- */
735
- function unresolvedImportHoles(stack: string, input: CfnDeployInput, parameters: Record<string, string>): ChangeSetHole[] {
736
- const template = readCfnTemplate(input.template);
737
- if (!template) return [];
738
- const resources = (template.Resources ?? {}) as Record<string, { Type?: unknown } | undefined>;
739
- const holes: ChangeSetHole[] = [];
740
- for (const i of cfnImports(template, cfnKnownValues(template, stack, parameters))) {
741
- if (!("unresolved" in i)) continue;
742
- const type = typeof resources[i.logicalId]?.Type === "string" ? (resources[i.logicalId]!.Type as string) : undefined;
743
- holes.push({
744
- address: i.logicalId,
745
- ...(type ? { type } : {}),
746
- reason: `the Fn::ImportValue at ${i.at} ${i.unresolved}, so the plan cannot say which export it reads or whether a stack in this change exports it`,
747
- });
748
- }
749
- return holes;
750
- }
751
-
752
- /**
753
- * The importer's template with each import of `names` as a stand-in
754
- * parameter (#4466b), written to a scratch file the preview creates its
755
- * change set from; or why there is none. `remove` deletes the file.
756
- */
757
- function standInTemplate(
758
- stack: string,
759
- input: CfnDeployInput,
760
- names: readonly string[],
761
- parameters: Record<string, string>,
762
- ): { path: string; parameters: string[]; remove: () => void } | string {
763
- const template = readCfnTemplate(input.template);
764
- if (!template) return "the template could not be read as JSON to stand in for its imports";
765
- const { template: copy, standIns } = cfnTemplateWithStandIns(template, names, cfnKnownValues(template, stack, parameters));
766
- const params = Object.keys(standIns).sort();
767
- if (params.length === 0) return `the template imports none of ${names.join(", ")} by a name the plan resolves`;
768
- const dir = mkdtempSync(join(tmpdir(), "chant-cfn-preview-"));
769
- const path = join(dir, `${stack}.preview.template.json`);
770
- writeFileSync(path, JSON.stringify(copy, null, 2));
771
- return { path, parameters: params, remove: () => rmSync(dir, { recursive: true, force: true }) };
772
- }
773
-
774
- /**
775
- * `cfn-deploy`'s `declaredReads` (#4466): each `Fn::ImportValue` of a name
776
- * exactly one other `cfn-deploy` step's template exports is a read of that
777
- * component's output, placed under the step's `imports`. A name two steps
778
- * export is left alone (CloudFormation refuses the second export), and so
779
- * is a name no step in the project exports: it reads a stack outside it.
780
- */
781
- export function cfnDeclaredReads(root: string, members: readonly { component: string; index: number; step: Record<string, unknown> }[]): DeclaredRead[] {
782
- const seen = members.map((m) => {
783
- const template = readCfnTemplate(m.step.template, root);
784
- const stack = typeof m.step.stack === "string" ? m.step.stack : m.component;
785
- const inputs = (m.step.inputs ?? {}) as Record<string, unknown>;
786
- const known = cfnKnownValues(template, stack, typeof m.step.imageRef === "string" ? { ...inputs, ImageRef: m.step.imageRef } : inputs);
787
- return { member: m, template, known };
788
- });
789
- const exporters = new Map<string, Array<{ component: string; output: string }>>();
790
- for (const { member, template, known } of seen) {
791
- for (const e of cfnExports(template, known)) {
792
- if (!("name" in e)) continue;
793
- (exporters.get(e.name) ?? exporters.set(e.name, []).get(e.name)!).push({ component: member.component, output: e.output });
794
- }
795
- }
796
- const out: DeclaredRead[] = [];
797
- for (const { member, template, known } of seen) {
798
- const done = new Set<string>();
799
- for (const i of cfnImports(template, known)) {
800
- if (!("name" in i) || done.has(i.name)) continue;
801
- done.add(i.name);
802
- const owners = (exporters.get(i.name) ?? []).filter((o) => o.component !== member.component);
803
- if (owners.length !== 1 || (exporters.get(i.name) ?? []).length !== 1) continue;
804
- out.push({ reader: member.component, index: member.index, upstream: owners[0]!.component, output: owners[0]!.output, at: cfnImportPointer(i.name) });
805
- }
806
- }
807
- return out;
808
- }
809
-
810
- /** Whether a CloudFormation error says the stack does not exist. */
811
- const STACK_MISSING = /does not exist/i;
812
-
813
- /**
814
- * How `cfn-deploy` handles a changeset that requires resource replacement.
815
- * - `block`: refuse to apply; surface the changeset for human review.
816
- * - `allow`: apply the replacement as CloudFormation proposes it.
817
- * - `snapshot-first`: take a `snapshot-before` capture, then allow the replacement.
818
- */
819
- export type CfnReplacePolicy = "block" | "allow" | "snapshot-first";
820
-
821
- export interface CfnDeployInput {
822
- /**
823
- * Stack name. Optional because an `infra`-archetype component with a single
824
- * stack per component (e.g. the DynamoDB pilot) may omit it and let it
825
- * default to `ctx.component` — the component name doubles as the stack
826
- * name, the same identifier the sibling `wait-for-stack` step in that
827
- * pilot's Verify phase references explicitly.
828
- */
829
- stack?: string;
830
- /** Path to the template, or an archive-relative reference (`archive:search.template.json`). */
831
- template: string;
832
- /** Template parameters, including wired references (e.g. `imageRef: "@Publish.digest"`). */
833
- inputs?: Record<string, string>;
834
- /** Image reference wired from a `docker-build`/`publish-image` step (e.g. `"@Publish.digest"`, already resolved by the driver). Passed through as the `ImageRef` template parameter. */
835
- imageRef?: string;
836
- /** Preview the changeset before applying. Default: true. */
837
- previewChangeset?: boolean;
838
- /** Replacement safety policy. Default: "block". */
839
- onReplace?: CfnReplacePolicy;
840
- /** Stage DynamoDB GSI changes (add-then-backfill-then-remove) instead of an in-place replace. Default: false. */
841
- stageGsi?: boolean;
842
- /**
843
- * The exports the template imports (`Fn::ImportValue`) from another
844
- * `cfn-deploy` step of the project, by export name (#4466). Core fills it
845
- * from `declaredReads` with a `stackOutput()` of the exporting component's
846
- * output, so a value is `undefined` while that stack's plan cannot say it.
847
- * Never passed to CloudFormation: the template imports the export itself.
848
- */
849
- imports?: Record<string, string | undefined>;
850
- }
851
-
852
- export interface CfnDeployOutput {
853
- /** Final stack status (`CREATE_COMPLETE`, `UPDATE_COMPLETE`, ...). */
854
- stackStatus: string;
855
- /** Stack outputs, available to downstream steps/components. */
856
- outputs: Record<string, string>;
857
- /** Snapshot id captured before an `onReplace: "snapshot-first"` replacement, if one was taken. */
858
- snapshotId?: string;
859
- }
860
-
861
- /** One export a plan changes or removes while other stacks import it (#4466c). */
862
- export interface CfnExportInUse {
863
- exportName: string;
864
- /** What the plan does to it, as the refusal says it: "removes", or "changes ... from A to B". */
865
- change: string;
866
- /** The stacks that import it now, sorted. */
867
- importers: string[];
868
- }
869
-
870
- /**
871
- * Thrown at plan time when a change set would change or remove an export
872
- * that another stack still imports (#4466c). CloudFormation refuses that
873
- * update at apply; the plan refuses it first, naming both stacks.
874
- */
875
- export class CfnExportInUseError extends Error {
876
- constructor(
877
- public readonly stack: string,
878
- public readonly uses: CfnExportInUse[],
879
- ) {
880
- const importers = [...new Set(uses.flatMap((u) => u.importers))].sort();
881
- super(
882
- `cfn-deploy "${stack}": refusing the plan: ` +
883
- uses
884
- .map((u) => `it ${u.change.replace("{export}", `export ${u.exportName}`)}, which ${u.importers.length === 1 ? "stack" : "stacks"} ${u.importers.join(", ")} still ${u.importers.length === 1 ? "imports" : "import"}`)
885
- .join("; ") +
886
- `. CloudFormation refuses to change or remove an export another stack imports. Change ${importers.join(", ")} to stop importing it first, then change ${stack}.`,
887
- );
888
- this.name = "CfnExportInUseError";
889
- }
890
- }
891
-
892
- /**
893
- * The exports `stack` has now that this plan changes or removes while
894
- * another stack imports them (#4466c). An export the new template no longer
895
- * declares is removed; one whose planned value differs from the value it
896
- * has is changed: both throw {@link CfnExportInUseError}. One the plan
897
- * cannot say about (its output's value is known only after apply, or an
898
- * export name in the new template does not resolve) is a hole naming the
899
- * importers. Asks `ListImports` only for exports at stake, and nothing at
900
- * all when the executor cannot list imports or the stack exports nothing.
901
- */
902
- async function exportsInUse(
903
- executor: CloudExecutor,
904
- stack: string,
905
- input: CfnDeployInput,
906
- parameters: Record<string, string>,
907
- planned: PlannedOutputs | undefined,
908
- standing: () => Promise<CfnStackStatus | undefined>,
909
- ): Promise<ChangeSetHole[]> {
910
- const listImports = executor.cloudformation.listImports?.bind(executor.cloudformation);
911
- if (!listImports) return [];
912
- const was = (await standing())?.exports;
913
- if (!was || Object.keys(was).length === 0) return [];
914
- const template = readCfnTemplate(input.template);
915
- if (!template) return [];
916
- const declared = cfnExports(template, cfnKnownValues(template, stack, parameters));
917
- const now = new Map(declared.filter((e): e is { output: string; name: string } => "name" in e).map((e) => [e.name, e.output]));
918
- const unresolvedNow = declared.some((e) => "unresolved" in e);
919
- const refused: CfnExportInUse[] = [];
920
- const holes: ChangeSetHole[] = [];
921
- for (const [exportName, { output, value }] of Object.entries(was).sort(([a], [b]) => a.localeCompare(b))) {
922
- const at = now.get(exportName);
923
- let change: string | undefined;
924
- let maybe: string | undefined;
925
- if (at === undefined) {
926
- if (unresolvedNow) maybe = `may remove export ${exportName}: an export name the template declares does not resolve at plan`;
927
- else change = "removes {export}";
928
- } else {
929
- const next = planned?.known[at];
930
- if (next === undefined) maybe = `may change export ${exportName}: the value of output ${at} is known only after apply`;
931
- else if ((typeof next === "string" ? next : JSON.stringify(next)) !== value) change = `changes {export} from ${value} to ${typeof next === "string" ? next : JSON.stringify(next)}`;
932
- }
933
- if (change === undefined && maybe === undefined) continue;
934
- let importers: string[];
935
- try {
936
- importers = (await listImports(exportName)).filter((s) => s !== stack);
937
- } catch (err) {
938
- // A backend without ListImports (an emulator, say) cannot say who imports it; the plan says so instead of failing.
939
- holes.push({
940
- address: `Outputs.${at ?? output}`,
941
- reason: `the plan ${change?.replace("{export}", `export ${exportName}`) ?? maybe}, and the stacks that import it could not be listed: ${err instanceof Error ? err.message : String(err)}`,
942
- });
943
- continue;
944
- }
945
- if (importers.length === 0) continue;
946
- if (change !== undefined) refused.push({ exportName, change, importers });
947
- else {
948
- holes.push({
949
- address: `Outputs.${at ?? output}`,
950
- reason: `the plan ${maybe}, and ${importers.join(", ")} still ${importers.length === 1 ? "imports" : "import"} it; CloudFormation refuses the apply if it changes`,
951
- });
952
- }
953
- }
954
- if (refused.length > 0) throw new CfnExportInUseError(stack, refused);
955
- return holes;
956
- }
957
-
958
- /**
959
- * Thrown when a changeset proposes a resource replacement and `onReplace` is
960
- * `"block"` (the default) — refusing to apply rather than silently destroying
961
- * and recreating a resource, which for a stateful resource (a DynamoDB table,
962
- * an RDS instance) means data loss. Carries the specific resources CloudFormation
963
- * proposed replacing, so the caller/human reviewing the changeset knows exactly
964
- * what was refused.
965
- */
966
- export class CfnReplacementBlockedError extends Error {
967
- constructor(
968
- public readonly stack: string,
969
- public readonly replacements: CfnChange[],
970
- ) {
971
- super(
972
- `cfn-deploy "${stack}": refusing changeset — it would replace ${replacements.length} resource(s) ` +
973
- `(${replacements.map((r) => r.logicalResourceId).join(", ")}) and onReplace is "block". ` +
974
- `Re-run with onReplace: "allow" or "snapshot-first" to proceed.`,
975
- );
976
- this.name = "CfnReplacementBlockedError";
977
- }
978
- }
979
-
980
- /**
981
- * Deploy a CloudFormation stack: create a changeset, apply the declarative
982
- * safety policy against its proposed changes, then execute (or refuse) it and
983
- * wait for the stack to reach a terminal status.
984
- *
985
- * - `onReplace: "block"` (default) — `CfnReplacementBlockedError` if any
986
- * change requires replacement; the changeset is left/deleted unexecuted.
987
- * - `onReplace: "allow"` — executes regardless of replacement.
988
- * - `onReplace: "snapshot-first"` — takes a `snapshot-before`-style capture
989
- * (via `executor.cloudformation`'s DynamoDB/RDS-aware snapshot, when the
990
- * replaced resource is a stateful type) before executing.
991
- * - `stageGsi` records intent only in this phase (the real add→backfill→remove
992
- * staging is DynamoDB-specific choreography layered on top of the plain
993
- * changeset apply; Phase 1 surfaces the option and passes it through
994
- * uninterpreted rather than half-implementing GSI staging, since staging
995
- * requires a second follow-up deploy the single-step `cfn-deploy` capability
996
- * does not orchestrate on its own).
997
- *
998
- * Rollback: trigger CloudFormation's native `rollback-stack` — the stack's own
999
- * automatic-rollback mechanism restores the last known-good state.
1000
- */
1001
- export function createCfnDeployCapability(
1002
- executor: CloudExecutor = defaultCloudExecutor(),
1003
- ): Capability<CfnDeployInput, CfnDeployOutput> {
1004
- return {
1005
- kind: "cfn-deploy",
1006
- // #4300: a change set covers the whole template, so there is nothing to narrow.
1007
- targets: { refuse: "a CloudFormation change set covers the whole stack, so cfn-deploy can't narrow to some of its resources" },
1008
- plan(ctx, input) {
1009
- return planCfnDeploy(executor, ctx, input);
1010
- },
1011
- declaredReads(ctx, members) {
1012
- return cfnDeclaredReads(ctx.root, members);
1013
- },
1014
- async outputs(ctx, input) {
1015
- // The outputs the stack has now, for a dependent planned before it
1016
- // applies (#3183). A stack that does not exist yet has none.
1017
- try {
1018
- return (await executor.cloudformation.describeStack(input.stack ?? ctx.component)).outputs;
1019
- } catch (err) {
1020
- if (STACK_MISSING.test(err instanceof Error ? err.message : String(err))) return {};
1021
- throw err;
1022
- }
1023
- },
1024
- async run(ctx, input) {
1025
- // #4537: `run --components <name> --adopt <file>` adopts into this stack instead of a plain deploy.
1026
- if (ctx.adoption) {
1027
- const { runCfnAdoption } = await import("./cfn-adopt-run");
1028
- return runCfnAdoption(executor, ctx, input, ctx.adoption);
1029
- }
1030
- const stack = input.stack ?? ctx.component;
1031
- const onReplace = input.onReplace ?? "block";
1032
- const changeSet = await executor.cloudformation.createChangeSet({
1033
- stackName: stack,
1034
- templatePath: input.template,
1035
- parameters: flattenCfnInputs(input),
1036
- });
1037
-
1038
- // Handed the plan the approver approved (#3997), apply only a change
1039
- // set that proposes the same changes. Anything else means the stack,
1040
- // the template or the parameters moved since the plan.
1041
- const planned = ctx.plans?.[stack];
1042
- if (isCfnShapeArtifact(planned)) {
1043
- // A member planned before its inputs were known (#4419): the change
1044
- // set made now is against the real values. It must have the shape the
1045
- // preview had, differing only in what the unknown inputs drive.
1046
- const differences = planShapeDifferences(planned.shape, cfnPlanShape(stack, changeSet, []));
1047
- if (differences.length > 0) {
1048
- await cleanUpPlanChangeSet(executor, changeSet);
1049
- throw new PlanShapeMovedError(stack, differences);
1050
- }
1051
- } else if (isCfnPlanArtifact(planned)) {
1052
- const now = cfnChangesDigest(stack, changeSet);
1053
- if (now !== planned.changesDigest) {
1054
- await cleanUpPlanChangeSet(executor, changeSet);
1055
- throw new CfnPlanMovedError(stack, planned.changesDigest, now);
1056
- }
1057
- }
1058
-
1059
- // An unchanged stack yields a change set with nothing to apply.
1060
- // `execute-change-set` rejects it ("The submitted information didn't
1061
- // contain changes"), which would fail this component and stop the whole
1062
- // run — so a re-run of `--components all` dies on the first already-current
1063
- // stack. Treat it as an idempotent no-op success instead: delete the empty
1064
- // change set and report the stack's current status/outputs so downstream
1065
- // steps still get real outputs and the run proceeds (#960).
1066
- if (isNoopChangeSet(changeSet)) {
1067
- await executor.cloudformation.deleteChangeSet({
1068
- stackName: stack,
1069
- changeSetName: changeSet.changeSetName,
1070
- });
1071
- const { stackStatus, outputs } = await executor.cloudformation.describeStack(stack);
1072
- return { stackStatus, outputs };
1073
- }
1074
-
1075
- const replacements = blockedReplacements(changeSet.changes);
1076
- let snapshotId: string | undefined;
1077
-
1078
- if (replacements.length > 0 && onReplace === "block") {
1079
- await executor.cloudformation.deleteChangeSet({
1080
- stackName: stack,
1081
- changeSetName: changeSet.changeSetName,
1082
- });
1083
- throw new CfnReplacementBlockedError(stack, replacements);
1084
- }
1085
-
1086
- if (replacements.length > 0 && onReplace === "snapshot-first") {
1087
- // Phase 1: record which resources were replaced so the caller/audit
1088
- // trail has the fact captured; a dedicated `snapshot-before` capability
1089
- // handles resource-specific (DynamoDB/RDS/OpenSearch) capture and is
1090
- // composed ahead of `cfn-deploy` in the component's own phase list
1091
- // when the sticky resource needs a real point-in-time backup.
1092
- snapshotId = `pending-snapshot:${stack}:${replacements.map((r) => r.logicalResourceId).join(",")}`;
1093
- }
1094
-
1095
- await executor.cloudformation.executeChangeSet({
1096
- stackName: stack,
1097
- changeSetName: changeSet.changeSetName,
1098
- });
1099
- const { stackStatus, outputs } = await executor.cloudformation.waitForStack(stack);
1100
- // `waitForStack` returns on any terminal (`*_COMPLETE`/`*_FAILED`) status,
1101
- // including the failure ones: a create that fails rolls back to
1102
- // `ROLLBACK_COMPLETE`, an update to `UPDATE_ROLLBACK_COMPLETE`, and hard
1103
- // failures end in `*_FAILED`. Treating those as success would report a
1104
- // failed deploy as green (and hand downstream steps an empty `outputs`),
1105
- // so throw — the same fail-closed contract the rest of the release model
1106
- // relies on.
1107
- // A missing status is fail-closed too: Floci's describe-stacks can omit
1108
- // StackStatus mid-rollback, and `undefined.includes` would throw a TypeError
1109
- // that masks the real deploy failure (#947).
1110
- if (!stackStatus || stackStatus.includes("ROLLBACK") || stackStatus.endsWith("_FAILED")) {
1111
- throw new Error(
1112
- `cfn-deploy "${stack}": stack reached ${stackStatus ?? "an indeterminate status"} — the deploy failed and was rolled back. Inspect the stack events for the resource that failed to create/update.`,
1113
- );
1114
- }
1115
- return { stackStatus, outputs, ...(snapshotId ? { snapshotId } : {}) };
1116
- },
1117
- async rollback(ctx, input) {
1118
- const stack = input.stack ?? ctx.component;
1119
- try {
1120
- await executor.cloudformation.rollbackStack(stack);
1121
- } catch (err) {
1122
- const message = err instanceof Error ? err.message : String(err);
1123
- // Local emulators (Floci) don't implement RollbackStack → `UnknownAction`.
1124
- // The stack is already in a terminal failed state; degrade to a clear
1125
- // message instead of crashing the compensation phase (#947).
1126
- if (/UnknownAction|not supported/i.test(message)) {
1127
- console.error(
1128
- `cfn-deploy rollback "${stack}": the target doesn't support RollbackStack (a local emulator such as Floci) — skipping automated rollback. Original: ${message}`,
1129
- );
1130
- return;
1131
- }
1132
- throw err;
1133
- }
1134
- },
1135
- };
1136
- }
1137
-
1138
- /** Flatten the wired `inputs` map plus `imageRef` (already resolved by the driver) to plain string CloudFormation parameters. */
1139
- export function flattenCfnInputs(input: CfnDeployInput): Record<string, string> | undefined {
1140
- const params: Record<string, string> = {};
1141
- for (const [key, value] of Object.entries(input.inputs ?? {})) {
1142
- params[key] = typeof value === "string" ? value : JSON.stringify(value);
1143
- }
1144
- if (input.imageRef) params.ImageRef = input.imageRef;
1145
- return Object.keys(params).length > 0 ? params : undefined;
1146
- }
1147
-
1148
- /** Default `cfn-deploy` capability, backed by the real `CloudExecutor`. */
1149
- export const cfnDeployCapability: Capability<CfnDeployInput, CfnDeployOutput> = createCfnDeployCapability();
1150
-
1151
- // ── ecs-update-service ──────────────────────────────────────────────────────
1152
-
1153
- export interface EcsUpdateServiceInput {
1154
- /** ECS cluster name or ARN. */
1155
- cluster: string;
1156
- /** ECS service name. */
1157
- service: string;
1158
- /** Task definition/image reference to roll out (e.g. `"@Publish.digest"`). */
1159
- imageRef?: string;
1160
- /** Desired task count. Omit to leave unchanged. */
1161
- desiredCount?: number;
1162
- /** Force a new deployment even if the task definition is unchanged. Default: false. */
1163
- forceNewDeployment?: boolean;
1164
- }
1165
-
1166
- export interface EcsUpdateServiceOutput {
1167
- /** ARN of the new/updated service deployment. */
1168
- deploymentId: string;
1169
- /**
1170
- * The task definition the service ran before this step updated it, read with
1171
- * `describe-services` ahead of `update-service`. The rollback sends it back.
1172
- * Absent when the service could not be described or reported none (#2609).
1173
- */
1174
- previousTaskDefinition?: string;
1175
- /** The service's desired count before this step, recorded only when the step sets `desiredCount`. */
1176
- previousDesiredCount?: number;
1177
- }
1178
-
1179
- /**
1180
- * Roll a new task definition/image out to an ECS service via `UpdateService`.
1181
- * Before the update, `run` reads the service with `describe-services` and
1182
- * records the task definition it was running in its output. The rollback sends
1183
- * that previous task definition back (and the previous desired count, when the
1184
- * step changed it). The step's own `imageRef` is never the rollback target:
1185
- * it is the revision the step just rolled out, so re-sending it restores
1186
- * nothing (#2609). When the previous task definition could not be read, the
1187
- * rollback fails with a message naming the service rather than report a
1188
- * restore that changed nothing (#2605). A component that needs a specific
1189
- * task definition restored can still give itself an explicit rollback phase,
1190
- * such as `rollback-previous` with that `taskDefinition`.
1191
- */
1192
- export function createEcsUpdateServiceCapability(
1193
- executor: CloudExecutor = defaultCloudExecutor(),
1194
- ): Capability<EcsUpdateServiceInput, EcsUpdateServiceOutput> {
1195
- return {
1196
- kind: "ecs-update-service",
1197
- async run(_ctx, input) {
1198
- // A failed read only costs the rollback its target; the forward update
1199
- // still runs, and the rollback then fails saying it has nothing to restore.
1200
- const before = await executor.ecs.describeService(input.cluster, input.service).catch(() => undefined);
1201
- const { deploymentId } = await executor.ecs.updateService({
1202
- cluster: input.cluster,
1203
- service: input.service,
1204
- taskDefinition: input.imageRef,
1205
- desiredCount: input.desiredCount,
1206
- forceNewDeployment: input.forceNewDeployment,
1207
- });
1208
- return {
1209
- deploymentId,
1210
- ...(before?.taskDefinition ? { previousTaskDefinition: before.taskDefinition } : {}),
1211
- ...(before && input.desiredCount !== undefined ? { previousDesiredCount: before.desiredCount } : {}),
1212
- };
1213
- },
1214
- async rollback(_ctx, input, output) {
1215
- const previous = output?.previousTaskDefinition;
1216
- if (!previous) {
1217
- throw new Error(
1218
- `ecs-update-service rollback: the task definition service "${input.service}" ran before the step ` +
1219
- `was not recorded, so there is nothing to roll back to; ` +
1220
- `give the component a rollback phase that names the taskDefinition`,
1221
- );
1222
- }
1223
- await executor.ecs.rollbackService({
1224
- cluster: input.cluster,
1225
- service: input.service,
1226
- taskDefinition: previous,
1227
- desiredCount: output?.previousDesiredCount,
1228
- });
1229
- },
1230
- };
1231
- }
1232
-
1233
- /** Default `ecs-update-service` capability, backed by the real `CloudExecutor`. */
1234
- export const ecsUpdateServiceCapability: Capability<EcsUpdateServiceInput, EcsUpdateServiceOutput> =
1235
- createEcsUpdateServiceCapability();
1236
-
1237
- // ── lambda-deploy ────────────────────────────────────────────────────────────
1238
-
1239
- export interface LambdaDeployInput {
1240
- /** Function name or ARN. */
1241
- functionName: string;
1242
- /** Reference to the packaged code — an image URI (e.g. `"@Publish.uri"` from `publish-image`) for a container-image function. */
1243
- codeRef: string;
1244
- /** Publish a new immutable version after updating code. Default: true. */
1245
- publish?: boolean;
1246
- /** Alias to repoint at the new version (e.g. "live"). */
1247
- alias?: string;
1248
- }
1249
-
1250
- export interface LambdaDeployOutput {
1251
- /** Published function version. */
1252
- version: string;
1253
- /** Function ARN (version-qualified if `publish` was true). */
1254
- functionArn: string;
1255
- }
1256
-
1257
- /**
1258
- * Update a Lambda function's code to a new container image, wait for the
1259
- * update to apply, and (by default) publish an immutable version and repoint
1260
- * `alias` at it — the same digest-promotion invariant every other apply verb
1261
- * follows (`imageRef`/`codeRef` is a resolved `publish-image` digest, never a
1262
- * rebuild). Rollback restores whatever version `alias` pointed at before this
1263
- * step ran (captured up front), repointing the alias back — mirroring
1264
- * `ecs-update-service`'s best-effort re-apply style rather than a native
1265
- * automatic rollback (Lambda has none for code updates).
1266
- */
1267
- export function createLambdaDeployCapability(
1268
- executor: CloudExecutor = defaultCloudExecutor(),
1269
- ): Capability<LambdaDeployInput, LambdaDeployOutput> {
1270
- const previousVersionByTarget = new Map<string, string | undefined>();
1271
-
1272
- return {
1273
- kind: "lambda-deploy",
1274
- async run(_ctx, input) {
1275
- const alias = input.alias ?? "live";
1276
- if (!previousVersionByTarget.has(input.functionName)) {
1277
- previousVersionByTarget.set(
1278
- input.functionName,
1279
- await executor.lambda.getAliasVersion(input.functionName, alias),
1280
- );
1281
- }
1282
-
1283
- const { functionArn } = await executor.lambda.updateFunctionCode({
1284
- functionName: input.functionName,
1285
- imageUri: input.codeRef,
1286
- });
1287
- const { status } = await executor.lambda.waitForUpdate(input.functionName);
1288
- if (status !== "Successful") {
1289
- throw new Error(`lambda-deploy "${input.functionName}": code update ended "${status}"`);
1290
- }
1291
-
1292
- if (input.publish === false) {
1293
- return { version: "$LATEST", functionArn };
1294
- }
1295
- const published = await executor.lambda.publishVersion({ functionName: input.functionName });
1296
- await executor.lambda.updateAlias({ functionName: input.functionName, alias, version: published.version });
1297
- return { version: published.version, functionArn: published.functionArn };
1298
- },
1299
- async rollback(_ctx, input) {
1300
- const alias = input.alias ?? "live";
1301
- const previousVersion = previousVersionByTarget.get(input.functionName);
1302
- if (!previousVersion) return; // no prior alias version recorded — nothing to restore.
1303
- await executor.lambda.updateAlias({ functionName: input.functionName, alias, version: previousVersion });
1304
- },
1305
- };
1306
- }
1307
-
1308
- /** Default `lambda-deploy` capability, backed by the real `CloudExecutor`. */
1309
- export const lambdaDeployCapability: Capability<LambdaDeployInput, LambdaDeployOutput> = createLambdaDeployCapability();
1310
-
1311
- // ── s3-sync ──────────────────────────────────────────────────────────────────
1312
-
1313
- export interface S3SyncInput {
1314
- /** Local path or archive-relative path to sync from. */
1315
- from: string;
1316
- /** Destination S3 URI (e.g. `s3://bucket/prefix`). */
1317
- to: string;
1318
- /** Delete destination keys not present in the source. Default: false. */
1319
- delete?: boolean;
1320
- }
1321
-
1322
- export interface S3SyncOutput {
1323
- /** Number of objects uploaded. */
1324
- uploaded: number;
1325
- /** Number of objects deleted (when `delete: true`). */
1326
- deleted: number;
1327
- }
1328
-
1329
- /** Sync a directory of static assets to an S3 bucket via `aws s3 sync` (endpoint-aware through the `CloudExecutor`). */
1330
- export function createS3SyncCapability(executor: CloudExecutor = defaultCloudExecutor()): Capability<S3SyncInput, S3SyncOutput> {
1331
- return {
1332
- kind: "s3-sync",
1333
- rollbackPolicy: "needs-opt-out",
1334
- async run(_ctx, input) {
1335
- return executor.s3.sync({ from: input.from, to: input.to, delete: input.delete });
1336
- },
1337
- };
1338
- }
1339
-
1340
- /** Default `s3-sync` capability, backed by the real `CloudExecutor`. */
1341
- export const s3SyncCapability: Capability<S3SyncInput, S3SyncOutput> = createS3SyncCapability();
1342
-
1343
- // ── cdn-invalidate ───────────────────────────────────────────────────────────
1344
-
1345
- export interface CdnInvalidateInput {
1346
- /** CloudFront distribution id. */
1347
- distributionId: string;
1348
- /** Path patterns to invalidate. Default: `["/*"]`. */
1349
- paths?: string[];
1350
- }
1351
-
1352
- export interface CdnInvalidateOutput {
1353
- /** Invalidation batch id, for polling completion. */
1354
- invalidationId: string;
1355
- }
1356
-
1357
- /** Invalidate CDN cache paths after a content update (e.g. following `s3-sync`), via `aws cloudfront create-invalidation`. */
1358
- export function createCdnInvalidateCapability(executor: CloudExecutor = defaultCloudExecutor()): Capability<CdnInvalidateInput, CdnInvalidateOutput> {
1359
- return {
1360
- kind: "cdn-invalidate",
1361
- rollbackPolicy: "needs-opt-out",
1362
- async run(_ctx, input) {
1363
- return executor.cloudfront.createInvalidation({
1364
- distributionId: input.distributionId,
1365
- paths: input.paths ?? ["/*"],
1366
- });
1367
- },
1368
- };
1369
- }
1370
-
1371
- /** Default `cdn-invalidate` capability, backed by the real `CloudExecutor`. */
1372
- export const cdnInvalidateCapability: Capability<CdnInvalidateInput, CdnInvalidateOutput> = createCdnInvalidateCapability();
1373
-
1374
- // ── run-migration ────────────────────────────────────────────────────────────
1375
-
1376
- /**
1377
- * Where a migration runs. Discriminated on `via` so the composition grammar
1378
- * stays honest about the transport (each is a different AWS surface), while the
1379
- * verb reports a single `{applied, version}` regardless.
1380
- * - `ecs-task`: run the migration image as a one-off ECS/Fargate task (the most
1381
- * common DB-migration transport — a Rails/Django/Flyway `migrate` container).
1382
- * - `lambda`: synchronously invoke a migration function.
1383
- * - `host`: run a migration command on an SSM-managed host (reuses the same
1384
- * transport as `remote-exec`).
1385
- */
1386
- export type MigrationTarget =
1387
- | {
1388
- via: "ecs-task";
1389
- cluster: string;
1390
- taskDefinition: string;
1391
- /** Container to override the command on; defaults to the task def's single container. */
1392
- container?: string;
1393
- /** Command (argv) the migration runs; omit to use the task def's own command. */
1394
- command?: string[];
1395
- launchType?: "FARGATE" | "EC2";
1396
- subnets?: string[];
1397
- securityGroups?: string[];
1398
- assignPublicIp?: boolean;
1399
- }
1400
- | { via: "lambda"; function: string; payload?: string }
1401
- | { via: "host"; host: string; command: string; cwd?: string };
1402
-
1403
- export interface RunMigrationInput {
1404
- /** Migration tool/runner identifier (e.g. "flyway", "prisma", "custom"). Informational — recorded for provenance, does not change the transport. */
1405
- tool: string;
1406
- /** Where the migration runs. */
1407
- target: MigrationTarget;
1408
- /** Reference to the migration artifact (e.g. `"@Publish.digest"` for a migration image). Informational. */
1409
- artifactRef?: string;
1410
- }
1411
-
1412
- export interface RunMigrationOutput {
1413
- /** True if any migrations were applied (false if already up to date, when the runner reports it). */
1414
- applied: boolean;
1415
- /** Migration version/checksum reached, when the runner reports one (empty string otherwise). */
1416
- version: string;
1417
- }
1418
-
1419
- /**
1420
- * A runner that reports its outcome does so as a trailing JSON object
1421
- * `{"applied":bool,"version":"..."}` — on stdout (host) or in the Lambda
1422
- * response payload. Parse the last such line; when the runner emits nothing
1423
- * parseable, fall back to `applied` = "the process exited cleanly" and an empty
1424
- * version (an ECS task exposes only its exit code — no captured stdout — so it
1425
- * always takes this fallback).
1426
- */
1427
- function parseMigrationReport(text: string, appliedFallback: boolean): RunMigrationOutput {
1428
- for (const line of text.split("\n").map((l) => l.trim()).reverse()) {
1429
- if (!line.startsWith("{")) continue;
1430
- try {
1431
- const parsed = JSON.parse(line) as { applied?: boolean; version?: string };
1432
- if (typeof parsed.applied === "boolean" || typeof parsed.version === "string") {
1433
- return { applied: parsed.applied ?? appliedFallback, version: parsed.version ?? "" };
1434
- }
1435
- } catch {
1436
- // not the report line — keep scanning older lines.
1437
- }
1438
- }
1439
- return { applied: appliedFallback, version: "" };
1440
- }
1441
-
1442
- /**
1443
- * Run a database/schema migration against a target as a deploy step, dispatching
1444
- * on the target transport (ECS one-off task, Lambda invoke, or SSM host command)
1445
- * through the injectable `CloudExecutor`. A non-clean outcome (non-zero exit, a
1446
- * Lambda `FunctionError`) throws so the phase fails rather than proceeding on an
1447
- * unmigrated schema.
1448
- */
1449
- export function createRunMigrationCapability(executor: CloudExecutor = defaultCloudExecutor()): Capability<RunMigrationInput, RunMigrationOutput> {
1450
- return {
1451
- kind: "run-migration",
1452
- rollbackPolicy: "needs-opt-out",
1453
- async run(_ctx, input) {
1454
- const target = input.target;
1455
- switch (target.via) {
1456
- case "ecs-task": {
1457
- const { taskArn } = await executor.ecs.runTask({
1458
- cluster: target.cluster,
1459
- taskDefinition: target.taskDefinition,
1460
- container: target.container,
1461
- command: target.command,
1462
- launchType: target.launchType,
1463
- subnets: target.subnets,
1464
- securityGroups: target.securityGroups,
1465
- assignPublicIp: target.assignPublicIp,
1466
- });
1467
- const result = await executor.ecs.waitForTask(target.cluster, taskArn);
1468
- if (result.exitCode !== 0) {
1469
- throw new Error(
1470
- `run-migration (ecs-task ${target.cluster}): task ${result.lastStatus} with exit ${result.exitCode ?? "none"}${result.stoppedReason ? ` (${result.stoppedReason})` : ""}`,
1471
- );
1472
- }
1473
- return { applied: true, version: "" };
1474
- }
1475
- case "lambda": {
1476
- const res = await executor.lambda.invoke({ functionName: target.function, payload: target.payload });
1477
- if (res.functionError) {
1478
- throw new Error(`run-migration (lambda ${target.function}): ${res.functionError} — ${res.payload.trim()}`);
1479
- }
1480
- return parseMigrationReport(res.payload, true);
1481
- }
1482
- case "host": {
1483
- const { stdout, exitCode } = await executor.host.exec({ host: target.host, command: target.command, cwd: target.cwd });
1484
- if (exitCode !== 0) {
1485
- throw new Error(`run-migration (host ${target.host}): command exited ${exitCode}`);
1486
- }
1487
- return parseMigrationReport(stdout, true);
1488
- }
1489
- }
1490
- },
1491
- };
1492
- }
1493
-
1494
- /** Default `run-migration` capability, backed by the real `CloudExecutor`. */
1495
- export const runMigrationCapability: Capability<RunMigrationInput, RunMigrationOutput> = createRunMigrationCapability();