@qpqjs/cli 0.0.0-stage → 0.2.1

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 (549) hide show
  1. package/README.md +92 -2
  2. package/docker/cdk-deployer/Dockerfile +13 -0
  3. package/docker/dev-server/Dockerfile +47 -0
  4. package/lib/commonjs/bin/qpq.d.ts +2 -0
  5. package/lib/commonjs/bin/qpq.js +6 -0
  6. package/lib/commonjs/bin/qpq.js.map +1 -0
  7. package/lib/commonjs/bin/qpqCdkApp.d.ts +1 -0
  8. package/lib/commonjs/bin/qpqCdkApp.js +8 -0
  9. package/lib/commonjs/bin/qpqCdkApp.js.map +1 -0
  10. package/lib/commonjs/cli/commandMenu.d.ts +2 -0
  11. package/lib/commonjs/cli/commandMenu.js +81 -0
  12. package/lib/commonjs/cli/commandMenu.js.map +1 -0
  13. package/lib/commonjs/cli/commandRegistry.d.ts +10 -0
  14. package/lib/commonjs/cli/commandRegistry.js +177 -0
  15. package/lib/commonjs/cli/commandRegistry.js.map +1 -0
  16. package/lib/commonjs/cli/index.d.ts +1 -0
  17. package/lib/commonjs/cli/index.js +18 -0
  18. package/lib/commonjs/cli/index.js.map +1 -0
  19. package/lib/commonjs/cli/runCli.d.ts +1 -0
  20. package/lib/commonjs/cli/runCli.js +86 -0
  21. package/lib/commonjs/cli/runCli.js.map +1 -0
  22. package/lib/commonjs/commands/checkCircular.d.ts +1 -0
  23. package/lib/commonjs/commands/checkCircular.js +70 -0
  24. package/lib/commonjs/commands/checkCircular.js.map +1 -0
  25. package/lib/commonjs/commands/clearResources.d.ts +1 -0
  26. package/lib/commonjs/commands/clearResources.js +36 -0
  27. package/lib/commonjs/commands/clearResources.js.map +1 -0
  28. package/lib/commonjs/commands/go.d.ts +1 -0
  29. package/lib/commonjs/commands/go.js +30 -0
  30. package/lib/commonjs/commands/go.js.map +1 -0
  31. package/lib/commonjs/commands/goDev.d.ts +1 -0
  32. package/lib/commonjs/commands/goDev.js +46 -0
  33. package/lib/commonjs/commands/goDev.js.map +1 -0
  34. package/lib/commonjs/commands/goDevApi.d.ts +1 -0
  35. package/lib/commonjs/commands/goDevApi.js +158 -0
  36. package/lib/commonjs/commands/goDevApi.js.map +1 -0
  37. package/lib/commonjs/commands/goDevWeb.d.ts +4 -0
  38. package/lib/commonjs/commands/goDevWeb.js +144 -0
  39. package/lib/commonjs/commands/goDevWeb.js.map +1 -0
  40. package/lib/commonjs/commands/goDocker.d.ts +1 -0
  41. package/lib/commonjs/commands/goDocker.js +43 -0
  42. package/lib/commonjs/commands/goDocker.js.map +1 -0
  43. package/lib/commonjs/commands/hooks.d.ts +1 -0
  44. package/lib/commonjs/commands/hooks.js +39 -0
  45. package/lib/commonjs/commands/hooks.js.map +1 -0
  46. package/lib/commonjs/commands/migrate.d.ts +1 -0
  47. package/lib/commonjs/commands/migrate.js +70 -0
  48. package/lib/commonjs/commands/migrate.js.map +1 -0
  49. package/lib/commonjs/commands/prep.d.ts +1 -0
  50. package/lib/commonjs/commands/prep.js +28 -0
  51. package/lib/commonjs/commands/prep.js.map +1 -0
  52. package/lib/commonjs/commands/publish.d.ts +4 -0
  53. package/lib/commonjs/commands/publish.js +54 -0
  54. package/lib/commonjs/commands/publish.js.map +1 -0
  55. package/lib/commonjs/commands/scriptBuild.d.ts +1 -0
  56. package/lib/commonjs/commands/scriptBuild.js +46 -0
  57. package/lib/commonjs/commands/scriptBuild.js.map +1 -0
  58. package/lib/commonjs/commands/scriptBuilderLayer.d.ts +1 -0
  59. package/lib/commonjs/commands/scriptBuilderLayer.js +48 -0
  60. package/lib/commonjs/commands/scriptBuilderLayer.js.map +1 -0
  61. package/lib/commonjs/commands/scriptNew.d.ts +1 -0
  62. package/lib/commonjs/commands/scriptNew.js +35 -0
  63. package/lib/commonjs/commands/scriptNew.js.map +1 -0
  64. package/lib/commonjs/commands/setup.d.ts +1 -0
  65. package/lib/commonjs/commands/setup.js +102 -0
  66. package/lib/commonjs/commands/setup.js.map +1 -0
  67. package/lib/commonjs/commands/synth.d.ts +1 -0
  68. package/lib/commonjs/commands/synth.js +89 -0
  69. package/lib/commonjs/commands/synth.js.map +1 -0
  70. package/lib/commonjs/commands/teardown.d.ts +1 -0
  71. package/lib/commonjs/commands/teardown.js +33 -0
  72. package/lib/commonjs/commands/teardown.js.map +1 -0
  73. package/lib/commonjs/index.d.ts +1 -0
  74. package/lib/commonjs/index.js +18 -0
  75. package/lib/commonjs/index.js.map +1 -0
  76. package/lib/commonjs/lib/args.d.ts +3 -0
  77. package/lib/commonjs/lib/args.js +31 -0
  78. package/lib/commonjs/lib/args.js.map +1 -0
  79. package/lib/commonjs/lib/circularImports.d.ts +3 -0
  80. package/lib/commonjs/lib/circularImports.js +79 -0
  81. package/lib/commonjs/lib/circularImports.js.map +1 -0
  82. package/lib/commonjs/lib/clearResourcesPlan.d.ts +15 -0
  83. package/lib/commonjs/lib/clearResourcesPlan.js +79 -0
  84. package/lib/commonjs/lib/clearResourcesPlan.js.map +1 -0
  85. package/lib/commonjs/lib/deployPrompts.d.ts +26 -0
  86. package/lib/commonjs/lib/deployPrompts.js +118 -0
  87. package/lib/commonjs/lib/deployPrompts.js.map +1 -0
  88. package/lib/commonjs/lib/devServerEntry.d.ts +22 -0
  89. package/lib/commonjs/lib/devServerEntry.js +135 -0
  90. package/lib/commonjs/lib/devServerEntry.js.map +1 -0
  91. package/lib/commonjs/lib/devServerPorts.d.ts +13 -0
  92. package/lib/commonjs/lib/devServerPorts.js +36 -0
  93. package/lib/commonjs/lib/devServerPorts.js.map +1 -0
  94. package/lib/commonjs/lib/discovery.d.ts +10 -0
  95. package/lib/commonjs/lib/discovery.js +56 -0
  96. package/lib/commonjs/lib/discovery.js.map +1 -0
  97. package/lib/commonjs/lib/getDefaultHookJobs.d.ts +2 -0
  98. package/lib/commonjs/lib/getDefaultHookJobs.js +11 -0
  99. package/lib/commonjs/lib/getDefaultHookJobs.js.map +1 -0
  100. package/lib/commonjs/lib/getDeployTargetLabel.d.ts +2 -0
  101. package/lib/commonjs/lib/getDeployTargetLabel.js +12 -0
  102. package/lib/commonjs/lib/getDeployTargetLabel.js.map +1 -0
  103. package/lib/commonjs/lib/goDockerMode.d.ts +6 -0
  104. package/lib/commonjs/lib/goDockerMode.js +23 -0
  105. package/lib/commonjs/lib/goDockerMode.js.map +1 -0
  106. package/lib/commonjs/lib/hooks.d.ts +9 -0
  107. package/lib/commonjs/lib/hooks.js +178 -0
  108. package/lib/commonjs/lib/hooks.js.map +1 -0
  109. package/lib/commonjs/lib/keepOtherDevServersFlag.d.ts +1 -0
  110. package/lib/commonjs/lib/keepOtherDevServersFlag.js +11 -0
  111. package/lib/commonjs/lib/keepOtherDevServersFlag.js.map +1 -0
  112. package/lib/commonjs/lib/killChildWithEscalation.d.ts +10 -0
  113. package/lib/commonjs/lib/killChildWithEscalation.js +33 -0
  114. package/lib/commonjs/lib/killChildWithEscalation.js.map +1 -0
  115. package/lib/commonjs/lib/killStaleListeners.d.ts +17 -0
  116. package/lib/commonjs/lib/killStaleListeners.js +220 -0
  117. package/lib/commonjs/lib/killStaleListeners.js.map +1 -0
  118. package/lib/commonjs/lib/packageRoot.d.ts +1 -0
  119. package/lib/commonjs/lib/packageRoot.js +21 -0
  120. package/lib/commonjs/lib/packageRoot.js.map +1 -0
  121. package/lib/commonjs/lib/prompts.d.ts +15 -0
  122. package/lib/commonjs/lib/prompts.js +78 -0
  123. package/lib/commonjs/lib/prompts.js.map +1 -0
  124. package/lib/commonjs/lib/qpqConfigs.d.ts +4 -0
  125. package/lib/commonjs/lib/qpqConfigs.js +27 -0
  126. package/lib/commonjs/lib/qpqConfigs.js.map +1 -0
  127. package/lib/commonjs/lib/resolveAppSelection.d.ts +6 -0
  128. package/lib/commonjs/lib/resolveAppSelection.js +58 -0
  129. package/lib/commonjs/lib/resolveAppSelection.js.map +1 -0
  130. package/lib/commonjs/lib/resolveDeployment.d.ts +14 -0
  131. package/lib/commonjs/lib/resolveDeployment.js +58 -0
  132. package/lib/commonjs/lib/resolveDeployment.js.map +1 -0
  133. package/lib/commonjs/lib/runCommand.d.ts +14 -0
  134. package/lib/commonjs/lib/runCommand.js +103 -0
  135. package/lib/commonjs/lib/runCommand.js.map +1 -0
  136. package/lib/commonjs/lib/runTasks.d.ts +15 -0
  137. package/lib/commonjs/lib/runTasks.js +123 -0
  138. package/lib/commonjs/lib/runTasks.js.map +1 -0
  139. package/lib/commonjs/lib/setupStep.d.ts +16 -0
  140. package/lib/commonjs/lib/setupStep.js +3 -0
  141. package/lib/commonjs/lib/setupStep.js.map +1 -0
  142. package/lib/commonjs/lib/timing.d.ts +2 -0
  143. package/lib/commonjs/lib/timing.js +11 -0
  144. package/lib/commonjs/lib/timing.js.map +1 -0
  145. package/lib/commonjs/lib/typeWatcher.d.ts +2 -0
  146. package/lib/commonjs/lib/typeWatcher.js +59 -0
  147. package/lib/commonjs/lib/typeWatcher.js.map +1 -0
  148. package/lib/commonjs/lib/userScriptBuilderLayer.d.ts +23 -0
  149. package/lib/commonjs/lib/userScriptBuilderLayer.js +74 -0
  150. package/lib/commonjs/lib/userScriptBuilderLayer.js.map +1 -0
  151. package/lib/commonjs/lib/userScriptTemplate.d.ts +6 -0
  152. package/lib/commonjs/lib/userScriptTemplate.js +47 -0
  153. package/lib/commonjs/lib/userScriptTemplate.js.map +1 -0
  154. package/lib/commonjs/lib/views.d.ts +2 -0
  155. package/lib/commonjs/lib/views.js +31 -0
  156. package/lib/commonjs/lib/views.js.map +1 -0
  157. package/lib/commonjs/lib/webAddressingEnv.d.ts +7 -0
  158. package/lib/commonjs/lib/webAddressingEnv.js +16 -0
  159. package/lib/commonjs/lib/webAddressingEnv.js.map +1 -0
  160. package/lib/commonjs/platforms/aws/awsCredentials.d.ts +1 -0
  161. package/lib/commonjs/platforms/aws/awsCredentials.js +28 -0
  162. package/lib/commonjs/platforms/aws/awsCredentials.js.map +1 -0
  163. package/lib/commonjs/platforms/aws/cdkApp.d.ts +3 -0
  164. package/lib/commonjs/platforms/aws/cdkApp.js +31 -0
  165. package/lib/commonjs/platforms/aws/cdkApp.js.map +1 -0
  166. package/lib/commonjs/platforms/aws/clearResources.d.ts +2 -0
  167. package/lib/commonjs/platforms/aws/clearResources.js +167 -0
  168. package/lib/commonjs/platforms/aws/clearResources.js.map +1 -0
  169. package/lib/commonjs/platforms/aws/go.d.ts +2 -0
  170. package/lib/commonjs/platforms/aws/go.js +131 -0
  171. package/lib/commonjs/platforms/aws/go.js.map +1 -0
  172. package/lib/commonjs/platforms/aws/goDocker.d.ts +3 -0
  173. package/lib/commonjs/platforms/aws/goDocker.js +457 -0
  174. package/lib/commonjs/platforms/aws/goDocker.js.map +1 -0
  175. package/lib/commonjs/platforms/aws/goDockerManifest.d.ts +44 -0
  176. package/lib/commonjs/platforms/aws/goDockerManifest.js +38 -0
  177. package/lib/commonjs/platforms/aws/goDockerManifest.js.map +1 -0
  178. package/lib/commonjs/platforms/aws/index.d.ts +2 -0
  179. package/lib/commonjs/platforms/aws/index.js +23 -0
  180. package/lib/commonjs/platforms/aws/index.js.map +1 -0
  181. package/lib/commonjs/platforms/aws/prepareDeployment.d.ts +3 -0
  182. package/lib/commonjs/platforms/aws/prepareDeployment.js +10 -0
  183. package/lib/commonjs/platforms/aws/prepareDeployment.js.map +1 -0
  184. package/lib/commonjs/platforms/aws/publish.d.ts +4 -0
  185. package/lib/commonjs/platforms/aws/publish.js +66 -0
  186. package/lib/commonjs/platforms/aws/publish.js.map +1 -0
  187. package/lib/commonjs/platforms/aws/remote.d.ts +11 -0
  188. package/lib/commonjs/platforms/aws/remote.js +105 -0
  189. package/lib/commonjs/platforms/aws/remote.js.map +1 -0
  190. package/lib/commonjs/platforms/aws/setup/awsSetupContext.d.ts +12 -0
  191. package/lib/commonjs/platforms/aws/setup/awsSetupContext.js +20 -0
  192. package/lib/commonjs/platforms/aws/setup/awsSetupContext.js.map +1 -0
  193. package/lib/commonjs/platforms/aws/setup/awsSetupSteps.d.ts +8 -0
  194. package/lib/commonjs/platforms/aws/setup/awsSetupSteps.js +44 -0
  195. package/lib/commonjs/platforms/aws/setup/awsSetupSteps.js.map +1 -0
  196. package/lib/commonjs/platforms/aws/setup/buildBucketNamesStep.d.ts +4 -0
  197. package/lib/commonjs/platforms/aws/setup/buildBucketNamesStep.js +77 -0
  198. package/lib/commonjs/platforms/aws/setup/buildBucketNamesStep.js.map +1 -0
  199. package/lib/commonjs/platforms/aws/setup/buildCdkBootstrapSteps.d.ts +5 -0
  200. package/lib/commonjs/platforms/aws/setup/buildCdkBootstrapSteps.js +38 -0
  201. package/lib/commonjs/platforms/aws/setup/buildCdkBootstrapSteps.js.map +1 -0
  202. package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.d.ts +4 -0
  203. package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.js +55 -0
  204. package/lib/commonjs/platforms/aws/setup/buildGithubDeployRoleStep.js.map +1 -0
  205. package/lib/commonjs/platforms/aws/setup/buildGithubOidcProviderStep.d.ts +4 -0
  206. package/lib/commonjs/platforms/aws/setup/buildGithubOidcProviderStep.js +54 -0
  207. package/lib/commonjs/platforms/aws/setup/buildGithubOidcProviderStep.js.map +1 -0
  208. package/lib/commonjs/platforms/aws/setup/buildHostedZonesStep.d.ts +4 -0
  209. package/lib/commonjs/platforms/aws/setup/buildHostedZonesStep.js +63 -0
  210. package/lib/commonjs/platforms/aws/setup/buildHostedZonesStep.js.map +1 -0
  211. package/lib/commonjs/platforms/aws/setup/buildIamCapabilityStep.d.ts +4 -0
  212. package/lib/commonjs/platforms/aws/setup/buildIamCapabilityStep.js +48 -0
  213. package/lib/commonjs/platforms/aws/setup/buildIamCapabilityStep.js.map +1 -0
  214. package/lib/commonjs/platforms/aws/setup/buildIdentityStep.d.ts +4 -0
  215. package/lib/commonjs/platforms/aws/setup/buildIdentityStep.js +39 -0
  216. package/lib/commonjs/platforms/aws/setup/buildIdentityStep.js.map +1 -0
  217. package/lib/commonjs/platforms/aws/setup/buildStackSteps.d.ts +5 -0
  218. package/lib/commonjs/platforms/aws/setup/buildStackSteps.js +32 -0
  219. package/lib/commonjs/platforms/aws/setup/buildStackSteps.js.map +1 -0
  220. package/lib/commonjs/platforms/aws/setup/describeStackStatus.d.ts +4 -0
  221. package/lib/commonjs/platforms/aws/setup/describeStackStatus.js +32 -0
  222. package/lib/commonjs/platforms/aws/setup/describeStackStatus.js.map +1 -0
  223. package/lib/commonjs/platforms/aws/setup/index.d.ts +1 -0
  224. package/lib/commonjs/platforms/aws/setup/index.js +18 -0
  225. package/lib/commonjs/platforms/aws/setup/index.js.map +1 -0
  226. package/lib/commonjs/platforms/aws/stacks.d.ts +7 -0
  227. package/lib/commonjs/platforms/aws/stacks.js +94 -0
  228. package/lib/commonjs/platforms/aws/stacks.js.map +1 -0
  229. package/lib/commonjs/platforms/aws/teardown.d.ts +2 -0
  230. package/lib/commonjs/platforms/aws/teardown.js +59 -0
  231. package/lib/commonjs/platforms/aws/teardown.js.map +1 -0
  232. package/lib/commonjs/platforms/aws/viewsSync.d.ts +3 -0
  233. package/lib/commonjs/platforms/aws/viewsSync.js +77 -0
  234. package/lib/commonjs/platforms/aws/viewsSync.js.map +1 -0
  235. package/lib/commonjs/platforms/docker/QpqDockerPlatformSettings.d.ts +10 -0
  236. package/lib/commonjs/platforms/docker/QpqDockerPlatformSettings.js +3 -0
  237. package/lib/commonjs/platforms/docker/QpqDockerPlatformSettings.js.map +1 -0
  238. package/lib/commonjs/platforms/docker/getContainerPorts.d.ts +4 -0
  239. package/lib/commonjs/platforms/docker/getContainerPorts.js +12 -0
  240. package/lib/commonjs/platforms/docker/getContainerPorts.js.map +1 -0
  241. package/lib/commonjs/platforms/docker/getDefaultPortMappings.d.ts +3 -0
  242. package/lib/commonjs/platforms/docker/getDefaultPortMappings.js +10 -0
  243. package/lib/commonjs/platforms/docker/getDefaultPortMappings.js.map +1 -0
  244. package/lib/commonjs/platforms/docker/getDockerPlatformSettings.d.ts +14 -0
  245. package/lib/commonjs/platforms/docker/getDockerPlatformSettings.js +39 -0
  246. package/lib/commonjs/platforms/docker/getDockerPlatformSettings.js.map +1 -0
  247. package/lib/commonjs/platforms/docker/getImageName.d.ts +6 -0
  248. package/lib/commonjs/platforms/docker/getImageName.js +10 -0
  249. package/lib/commonjs/platforms/docker/getImageName.js.map +1 -0
  250. package/lib/commonjs/platforms/docker/go.d.ts +2 -0
  251. package/lib/commonjs/platforms/docker/go.js +261 -0
  252. package/lib/commonjs/platforms/docker/go.js.map +1 -0
  253. package/lib/commonjs/platforms/docker/index.d.ts +2 -0
  254. package/lib/commonjs/platforms/docker/index.js +43 -0
  255. package/lib/commonjs/platforms/docker/index.js.map +1 -0
  256. package/lib/commonjs/platforms/docker/parseMounts.d.ts +7 -0
  257. package/lib/commonjs/platforms/docker/parseMounts.js +27 -0
  258. package/lib/commonjs/platforms/docker/parseMounts.js.map +1 -0
  259. package/lib/commonjs/platforms/docker/parsePortMappings.d.ts +8 -0
  260. package/lib/commonjs/platforms/docker/parsePortMappings.js +26 -0
  261. package/lib/commonjs/platforms/docker/parsePortMappings.js.map +1 -0
  262. package/lib/commonjs/platforms/docker/resolvePortMappings.d.ts +8 -0
  263. package/lib/commonjs/platforms/docker/resolvePortMappings.js +23 -0
  264. package/lib/commonjs/platforms/docker/resolvePortMappings.js.map +1 -0
  265. package/lib/commonjs/platforms/docker/writeComposeFile.d.ts +20 -0
  266. package/lib/commonjs/platforms/docker/writeComposeFile.js +44 -0
  267. package/lib/commonjs/platforms/docker/writeComposeFile.js.map +1 -0
  268. package/lib/commonjs/platforms/index.d.ts +3 -0
  269. package/lib/commonjs/platforms/index.js +35 -0
  270. package/lib/commonjs/platforms/index.js.map +1 -0
  271. package/lib/commonjs/platforms/types.d.ts +21 -0
  272. package/lib/commonjs/platforms/types.js +9 -0
  273. package/lib/commonjs/platforms/types.js.map +1 -0
  274. package/lib/esm/bin/qpq.d.ts +2 -0
  275. package/lib/esm/bin/qpq.js +4 -0
  276. package/lib/esm/bin/qpq.js.map +1 -0
  277. package/lib/esm/bin/qpqCdkApp.d.ts +1 -0
  278. package/lib/esm/bin/qpqCdkApp.js +6 -0
  279. package/lib/esm/bin/qpqCdkApp.js.map +1 -0
  280. package/lib/esm/cli/commandMenu.d.ts +2 -0
  281. package/lib/esm/cli/commandMenu.js +67 -0
  282. package/lib/esm/cli/commandMenu.js.map +1 -0
  283. package/lib/esm/cli/commandRegistry.d.ts +10 -0
  284. package/lib/esm/cli/commandRegistry.js +161 -0
  285. package/lib/esm/cli/commandRegistry.js.map +1 -0
  286. package/lib/esm/cli/index.d.ts +1 -0
  287. package/lib/esm/cli/index.js +2 -0
  288. package/lib/esm/cli/index.js.map +1 -0
  289. package/lib/esm/cli/runCli.d.ts +1 -0
  290. package/lib/esm/cli/runCli.js +73 -0
  291. package/lib/esm/cli/runCli.js.map +1 -0
  292. package/lib/esm/commands/checkCircular.d.ts +1 -0
  293. package/lib/esm/commands/checkCircular.js +55 -0
  294. package/lib/esm/commands/checkCircular.js.map +1 -0
  295. package/lib/esm/commands/clearResources.d.ts +1 -0
  296. package/lib/esm/commands/clearResources.js +23 -0
  297. package/lib/esm/commands/clearResources.js.map +1 -0
  298. package/lib/esm/commands/go.d.ts +1 -0
  299. package/lib/esm/commands/go.js +16 -0
  300. package/lib/esm/commands/go.js.map +1 -0
  301. package/lib/esm/commands/goDev.d.ts +1 -0
  302. package/lib/esm/commands/goDev.js +33 -0
  303. package/lib/esm/commands/goDev.js.map +1 -0
  304. package/lib/esm/commands/goDevApi.d.ts +1 -0
  305. package/lib/esm/commands/goDevApi.js +142 -0
  306. package/lib/esm/commands/goDevApi.js.map +1 -0
  307. package/lib/esm/commands/goDevWeb.d.ts +4 -0
  308. package/lib/esm/commands/goDevWeb.js +129 -0
  309. package/lib/esm/commands/goDevWeb.js.map +1 -0
  310. package/lib/esm/commands/goDocker.d.ts +1 -0
  311. package/lib/esm/commands/goDocker.js +29 -0
  312. package/lib/esm/commands/goDocker.js.map +1 -0
  313. package/lib/esm/commands/hooks.d.ts +1 -0
  314. package/lib/esm/commands/hooks.js +26 -0
  315. package/lib/esm/commands/hooks.js.map +1 -0
  316. package/lib/esm/commands/migrate.d.ts +1 -0
  317. package/lib/esm/commands/migrate.js +57 -0
  318. package/lib/esm/commands/migrate.js.map +1 -0
  319. package/lib/esm/commands/prep.d.ts +1 -0
  320. package/lib/esm/commands/prep.js +15 -0
  321. package/lib/esm/commands/prep.js.map +1 -0
  322. package/lib/esm/commands/publish.d.ts +4 -0
  323. package/lib/esm/commands/publish.js +38 -0
  324. package/lib/esm/commands/publish.js.map +1 -0
  325. package/lib/esm/commands/scriptBuild.d.ts +1 -0
  326. package/lib/esm/commands/scriptBuild.js +29 -0
  327. package/lib/esm/commands/scriptBuild.js.map +1 -0
  328. package/lib/esm/commands/scriptBuilderLayer.d.ts +1 -0
  329. package/lib/esm/commands/scriptBuilderLayer.js +34 -0
  330. package/lib/esm/commands/scriptBuilderLayer.js.map +1 -0
  331. package/lib/esm/commands/scriptNew.d.ts +1 -0
  332. package/lib/esm/commands/scriptNew.js +19 -0
  333. package/lib/esm/commands/scriptNew.js.map +1 -0
  334. package/lib/esm/commands/setup.d.ts +1 -0
  335. package/lib/esm/commands/setup.js +88 -0
  336. package/lib/esm/commands/setup.js.map +1 -0
  337. package/lib/esm/commands/synth.d.ts +1 -0
  338. package/lib/esm/commands/synth.js +73 -0
  339. package/lib/esm/commands/synth.js.map +1 -0
  340. package/lib/esm/commands/teardown.d.ts +1 -0
  341. package/lib/esm/commands/teardown.js +20 -0
  342. package/lib/esm/commands/teardown.js.map +1 -0
  343. package/lib/esm/index.d.ts +1 -0
  344. package/lib/esm/index.js +2 -0
  345. package/lib/esm/index.js.map +1 -0
  346. package/lib/esm/lib/args.d.ts +3 -0
  347. package/lib/esm/lib/args.js +25 -0
  348. package/lib/esm/lib/args.js.map +1 -0
  349. package/lib/esm/lib/circularImports.d.ts +3 -0
  350. package/lib/esm/lib/circularImports.js +61 -0
  351. package/lib/esm/lib/circularImports.js.map +1 -0
  352. package/lib/esm/lib/clearResourcesPlan.d.ts +15 -0
  353. package/lib/esm/lib/clearResourcesPlan.js +65 -0
  354. package/lib/esm/lib/clearResourcesPlan.js.map +1 -0
  355. package/lib/esm/lib/deployPrompts.d.ts +26 -0
  356. package/lib/esm/lib/deployPrompts.js +103 -0
  357. package/lib/esm/lib/deployPrompts.js.map +1 -0
  358. package/lib/esm/lib/devServerEntry.d.ts +22 -0
  359. package/lib/esm/lib/devServerEntry.js +127 -0
  360. package/lib/esm/lib/devServerEntry.js.map +1 -0
  361. package/lib/esm/lib/devServerPorts.d.ts +13 -0
  362. package/lib/esm/lib/devServerPorts.js +27 -0
  363. package/lib/esm/lib/devServerPorts.js.map +1 -0
  364. package/lib/esm/lib/discovery.d.ts +10 -0
  365. package/lib/esm/lib/discovery.js +40 -0
  366. package/lib/esm/lib/discovery.js.map +1 -0
  367. package/lib/esm/lib/getDefaultHookJobs.d.ts +2 -0
  368. package/lib/esm/lib/getDefaultHookJobs.js +4 -0
  369. package/lib/esm/lib/getDefaultHookJobs.js.map +1 -0
  370. package/lib/esm/lib/getDeployTargetLabel.d.ts +2 -0
  371. package/lib/esm/lib/getDeployTargetLabel.js +8 -0
  372. package/lib/esm/lib/getDeployTargetLabel.js.map +1 -0
  373. package/lib/esm/lib/goDockerMode.d.ts +6 -0
  374. package/lib/esm/lib/goDockerMode.js +19 -0
  375. package/lib/esm/lib/goDockerMode.js.map +1 -0
  376. package/lib/esm/lib/hooks.d.ts +9 -0
  377. package/lib/esm/lib/hooks.js +154 -0
  378. package/lib/esm/lib/hooks.js.map +1 -0
  379. package/lib/esm/lib/keepOtherDevServersFlag.d.ts +1 -0
  380. package/lib/esm/lib/keepOtherDevServersFlag.js +8 -0
  381. package/lib/esm/lib/keepOtherDevServersFlag.js.map +1 -0
  382. package/lib/esm/lib/killChildWithEscalation.d.ts +10 -0
  383. package/lib/esm/lib/killChildWithEscalation.js +29 -0
  384. package/lib/esm/lib/killChildWithEscalation.js.map +1 -0
  385. package/lib/esm/lib/killStaleListeners.d.ts +17 -0
  386. package/lib/esm/lib/killStaleListeners.js +210 -0
  387. package/lib/esm/lib/killStaleListeners.js.map +1 -0
  388. package/lib/esm/lib/packageRoot.d.ts +1 -0
  389. package/lib/esm/lib/packageRoot.js +14 -0
  390. package/lib/esm/lib/packageRoot.js.map +1 -0
  391. package/lib/esm/lib/prompts.d.ts +15 -0
  392. package/lib/esm/lib/prompts.js +28 -0
  393. package/lib/esm/lib/prompts.js.map +1 -0
  394. package/lib/esm/lib/qpqConfigs.d.ts +4 -0
  395. package/lib/esm/lib/qpqConfigs.js +21 -0
  396. package/lib/esm/lib/qpqConfigs.js.map +1 -0
  397. package/lib/esm/lib/resolveAppSelection.d.ts +6 -0
  398. package/lib/esm/lib/resolveAppSelection.js +45 -0
  399. package/lib/esm/lib/resolveAppSelection.js.map +1 -0
  400. package/lib/esm/lib/resolveDeployment.d.ts +14 -0
  401. package/lib/esm/lib/resolveDeployment.js +45 -0
  402. package/lib/esm/lib/resolveDeployment.js.map +1 -0
  403. package/lib/esm/lib/runCommand.d.ts +14 -0
  404. package/lib/esm/lib/runCommand.js +92 -0
  405. package/lib/esm/lib/runCommand.js.map +1 -0
  406. package/lib/esm/lib/runTasks.d.ts +15 -0
  407. package/lib/esm/lib/runTasks.js +108 -0
  408. package/lib/esm/lib/runTasks.js.map +1 -0
  409. package/lib/esm/lib/setupStep.d.ts +16 -0
  410. package/lib/esm/lib/setupStep.js +2 -0
  411. package/lib/esm/lib/setupStep.js.map +1 -0
  412. package/lib/esm/lib/timing.d.ts +2 -0
  413. package/lib/esm/lib/timing.js +6 -0
  414. package/lib/esm/lib/timing.js.map +1 -0
  415. package/lib/esm/lib/typeWatcher.d.ts +2 -0
  416. package/lib/esm/lib/typeWatcher.js +51 -0
  417. package/lib/esm/lib/typeWatcher.js.map +1 -0
  418. package/lib/esm/lib/userScriptBuilderLayer.d.ts +23 -0
  419. package/lib/esm/lib/userScriptBuilderLayer.js +65 -0
  420. package/lib/esm/lib/userScriptBuilderLayer.js.map +1 -0
  421. package/lib/esm/lib/userScriptTemplate.d.ts +6 -0
  422. package/lib/esm/lib/userScriptTemplate.js +39 -0
  423. package/lib/esm/lib/userScriptTemplate.js.map +1 -0
  424. package/lib/esm/lib/views.d.ts +2 -0
  425. package/lib/esm/lib/views.js +14 -0
  426. package/lib/esm/lib/views.js.map +1 -0
  427. package/lib/esm/lib/webAddressingEnv.d.ts +7 -0
  428. package/lib/esm/lib/webAddressingEnv.js +11 -0
  429. package/lib/esm/lib/webAddressingEnv.js.map +1 -0
  430. package/lib/esm/platforms/aws/awsCredentials.d.ts +1 -0
  431. package/lib/esm/platforms/aws/awsCredentials.js +15 -0
  432. package/lib/esm/platforms/aws/awsCredentials.js.map +1 -0
  433. package/lib/esm/platforms/aws/cdkApp.d.ts +3 -0
  434. package/lib/esm/platforms/aws/cdkApp.js +22 -0
  435. package/lib/esm/platforms/aws/cdkApp.js.map +1 -0
  436. package/lib/esm/platforms/aws/clearResources.d.ts +2 -0
  437. package/lib/esm/platforms/aws/clearResources.js +151 -0
  438. package/lib/esm/platforms/aws/clearResources.js.map +1 -0
  439. package/lib/esm/platforms/aws/go.d.ts +2 -0
  440. package/lib/esm/platforms/aws/go.js +115 -0
  441. package/lib/esm/platforms/aws/go.js.map +1 -0
  442. package/lib/esm/platforms/aws/goDocker.d.ts +3 -0
  443. package/lib/esm/platforms/aws/goDocker.js +441 -0
  444. package/lib/esm/platforms/aws/goDocker.js.map +1 -0
  445. package/lib/esm/platforms/aws/goDockerManifest.d.ts +44 -0
  446. package/lib/esm/platforms/aws/goDockerManifest.js +26 -0
  447. package/lib/esm/platforms/aws/goDockerManifest.js.map +1 -0
  448. package/lib/esm/platforms/aws/index.d.ts +2 -0
  449. package/lib/esm/platforms/aws/index.js +20 -0
  450. package/lib/esm/platforms/aws/index.js.map +1 -0
  451. package/lib/esm/platforms/aws/prepareDeployment.d.ts +3 -0
  452. package/lib/esm/platforms/aws/prepareDeployment.js +6 -0
  453. package/lib/esm/platforms/aws/prepareDeployment.js.map +1 -0
  454. package/lib/esm/platforms/aws/publish.d.ts +4 -0
  455. package/lib/esm/platforms/aws/publish.js +50 -0
  456. package/lib/esm/platforms/aws/publish.js.map +1 -0
  457. package/lib/esm/platforms/aws/remote.d.ts +11 -0
  458. package/lib/esm/platforms/aws/remote.js +89 -0
  459. package/lib/esm/platforms/aws/remote.js.map +1 -0
  460. package/lib/esm/platforms/aws/setup/awsSetupContext.d.ts +12 -0
  461. package/lib/esm/platforms/aws/setup/awsSetupContext.js +16 -0
  462. package/lib/esm/platforms/aws/setup/awsSetupContext.js.map +1 -0
  463. package/lib/esm/platforms/aws/setup/awsSetupSteps.d.ts +8 -0
  464. package/lib/esm/platforms/aws/setup/awsSetupSteps.js +31 -0
  465. package/lib/esm/platforms/aws/setup/awsSetupSteps.js.map +1 -0
  466. package/lib/esm/platforms/aws/setup/buildBucketNamesStep.d.ts +4 -0
  467. package/lib/esm/platforms/aws/setup/buildBucketNamesStep.js +62 -0
  468. package/lib/esm/platforms/aws/setup/buildBucketNamesStep.js.map +1 -0
  469. package/lib/esm/platforms/aws/setup/buildCdkBootstrapSteps.d.ts +5 -0
  470. package/lib/esm/platforms/aws/setup/buildCdkBootstrapSteps.js +24 -0
  471. package/lib/esm/platforms/aws/setup/buildCdkBootstrapSteps.js.map +1 -0
  472. package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.d.ts +4 -0
  473. package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.js +40 -0
  474. package/lib/esm/platforms/aws/setup/buildGithubDeployRoleStep.js.map +1 -0
  475. package/lib/esm/platforms/aws/setup/buildGithubOidcProviderStep.d.ts +4 -0
  476. package/lib/esm/platforms/aws/setup/buildGithubOidcProviderStep.js +40 -0
  477. package/lib/esm/platforms/aws/setup/buildGithubOidcProviderStep.js.map +1 -0
  478. package/lib/esm/platforms/aws/setup/buildHostedZonesStep.d.ts +4 -0
  479. package/lib/esm/platforms/aws/setup/buildHostedZonesStep.js +49 -0
  480. package/lib/esm/platforms/aws/setup/buildHostedZonesStep.js.map +1 -0
  481. package/lib/esm/platforms/aws/setup/buildIamCapabilityStep.d.ts +4 -0
  482. package/lib/esm/platforms/aws/setup/buildIamCapabilityStep.js +34 -0
  483. package/lib/esm/platforms/aws/setup/buildIamCapabilityStep.js.map +1 -0
  484. package/lib/esm/platforms/aws/setup/buildIdentityStep.d.ts +4 -0
  485. package/lib/esm/platforms/aws/setup/buildIdentityStep.js +26 -0
  486. package/lib/esm/platforms/aws/setup/buildIdentityStep.js.map +1 -0
  487. package/lib/esm/platforms/aws/setup/buildStackSteps.d.ts +5 -0
  488. package/lib/esm/platforms/aws/setup/buildStackSteps.js +17 -0
  489. package/lib/esm/platforms/aws/setup/buildStackSteps.js.map +1 -0
  490. package/lib/esm/platforms/aws/setup/describeStackStatus.d.ts +4 -0
  491. package/lib/esm/platforms/aws/setup/describeStackStatus.js +17 -0
  492. package/lib/esm/platforms/aws/setup/describeStackStatus.js.map +1 -0
  493. package/lib/esm/platforms/aws/setup/index.d.ts +1 -0
  494. package/lib/esm/platforms/aws/setup/index.js +2 -0
  495. package/lib/esm/platforms/aws/setup/index.js.map +1 -0
  496. package/lib/esm/platforms/aws/stacks.d.ts +7 -0
  497. package/lib/esm/platforms/aws/stacks.js +72 -0
  498. package/lib/esm/platforms/aws/stacks.js.map +1 -0
  499. package/lib/esm/platforms/aws/teardown.d.ts +2 -0
  500. package/lib/esm/platforms/aws/teardown.js +46 -0
  501. package/lib/esm/platforms/aws/teardown.js.map +1 -0
  502. package/lib/esm/platforms/aws/viewsSync.d.ts +3 -0
  503. package/lib/esm/platforms/aws/viewsSync.js +60 -0
  504. package/lib/esm/platforms/aws/viewsSync.js.map +1 -0
  505. package/lib/esm/platforms/docker/QpqDockerPlatformSettings.d.ts +10 -0
  506. package/lib/esm/platforms/docker/QpqDockerPlatformSettings.js +2 -0
  507. package/lib/esm/platforms/docker/QpqDockerPlatformSettings.js.map +1 -0
  508. package/lib/esm/platforms/docker/getContainerPorts.d.ts +4 -0
  509. package/lib/esm/platforms/docker/getContainerPorts.js +8 -0
  510. package/lib/esm/platforms/docker/getContainerPorts.js.map +1 -0
  511. package/lib/esm/platforms/docker/getDefaultPortMappings.d.ts +3 -0
  512. package/lib/esm/platforms/docker/getDefaultPortMappings.js +6 -0
  513. package/lib/esm/platforms/docker/getDefaultPortMappings.js.map +1 -0
  514. package/lib/esm/platforms/docker/getDockerPlatformSettings.d.ts +14 -0
  515. package/lib/esm/platforms/docker/getDockerPlatformSettings.js +34 -0
  516. package/lib/esm/platforms/docker/getDockerPlatformSettings.js.map +1 -0
  517. package/lib/esm/platforms/docker/getImageName.d.ts +6 -0
  518. package/lib/esm/platforms/docker/getImageName.js +6 -0
  519. package/lib/esm/platforms/docker/getImageName.js.map +1 -0
  520. package/lib/esm/platforms/docker/go.d.ts +2 -0
  521. package/lib/esm/platforms/docker/go.js +242 -0
  522. package/lib/esm/platforms/docker/go.js.map +1 -0
  523. package/lib/esm/platforms/docker/index.d.ts +2 -0
  524. package/lib/esm/platforms/docker/index.js +31 -0
  525. package/lib/esm/platforms/docker/index.js.map +1 -0
  526. package/lib/esm/platforms/docker/parseMounts.d.ts +7 -0
  527. package/lib/esm/platforms/docker/parseMounts.js +23 -0
  528. package/lib/esm/platforms/docker/parseMounts.js.map +1 -0
  529. package/lib/esm/platforms/docker/parsePortMappings.d.ts +8 -0
  530. package/lib/esm/platforms/docker/parsePortMappings.js +21 -0
  531. package/lib/esm/platforms/docker/parsePortMappings.js.map +1 -0
  532. package/lib/esm/platforms/docker/resolvePortMappings.d.ts +8 -0
  533. package/lib/esm/platforms/docker/resolvePortMappings.js +18 -0
  534. package/lib/esm/platforms/docker/resolvePortMappings.js.map +1 -0
  535. package/lib/esm/platforms/docker/writeComposeFile.d.ts +20 -0
  536. package/lib/esm/platforms/docker/writeComposeFile.js +37 -0
  537. package/lib/esm/platforms/docker/writeComposeFile.js.map +1 -0
  538. package/lib/esm/platforms/index.d.ts +3 -0
  539. package/lib/esm/platforms/index.js +17 -0
  540. package/lib/esm/platforms/index.js.map +1 -0
  541. package/lib/esm/platforms/types.d.ts +21 -0
  542. package/lib/esm/platforms/types.js +6 -0
  543. package/lib/esm/platforms/types.js.map +1 -0
  544. package/package.json +71 -3
  545. package/templates/user-script/README.md +28 -0
  546. package/templates/user-script/gitignore +2 -0
  547. package/templates/user-script/package.json +16 -0
  548. package/templates/user-script/src/main.ts +15 -0
  549. package/templates/user-script/tsconfig.json +12 -0
@@ -0,0 +1,20 @@
1
+ import { awsClearResources } from './clearResources';
2
+ import { awsGo } from './go';
3
+ import { awsGoDocker } from './goDocker';
4
+ import { awsPrepareDeployment } from './prepareDeployment';
5
+ import { awsPublish, awsPublishBuild, awsPublishDeploy, awsPublishUpload } from './publish';
6
+ import { awsSetupSteps } from './setup';
7
+ import { awsTeardown } from './teardown';
8
+ export const awsPlatformDriver = {
9
+ prepareDeployment: awsPrepareDeployment,
10
+ go: awsGo,
11
+ goDocker: awsGoDocker,
12
+ teardown: awsTeardown,
13
+ clearResources: awsClearResources,
14
+ setupSteps: awsSetupSteps,
15
+ publish: awsPublish,
16
+ publishBuild: awsPublishBuild,
17
+ publishUpload: awsPublishUpload,
18
+ publishDeploy: awsPublishDeploy,
19
+ };
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/platforms/aws/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,CAAC,MAAM,iBAAiB,GAAsB;IAClD,iBAAiB,EAAE,oBAAoB;IAEvC,EAAE,EAAE,KAAK;IACT,QAAQ,EAAE,WAAW;IACrB,QAAQ,EAAE,WAAW;IACrB,cAAc,EAAE,iBAAiB;IACjC,UAAU,EAAE,aAAa;IAEzB,OAAO,EAAE,UAAU;IACnB,YAAY,EAAE,eAAe;IAC7B,aAAa,EAAE,gBAAgB;IAC/B,aAAa,EAAE,gBAAgB;CAChC,CAAC","sourcesContent":["import { QpqPlatformDriver } from '../types';\nimport { awsClearResources } from './clearResources';\nimport { awsGo } from './go';\nimport { awsGoDocker } from './goDocker';\nimport { awsPrepareDeployment } from './prepareDeployment';\nimport { awsPublish, awsPublishBuild, awsPublishDeploy, awsPublishUpload } from './publish';\nimport { awsSetupSteps } from './setup';\nimport { awsTeardown } from './teardown';\n\nexport const awsPlatformDriver: QpqPlatformDriver = {\n prepareDeployment: awsPrepareDeployment,\n\n go: awsGo,\n goDocker: awsGoDocker,\n teardown: awsTeardown,\n clearResources: awsClearResources,\n setupSteps: awsSetupSteps,\n\n publish: awsPublish,\n publishBuild: awsPublishBuild,\n publishUpload: awsPublishUpload,\n publishDeploy: awsPublishDeploy,\n};\n"]}
@@ -0,0 +1,3 @@
1
+ import { QpqAppDeployment } from '@qpqjs/core';
2
+ /** Checks the entry has an account and region, then primes AWS_DEFAULT_ACCOUNT / AWS_DEFAULT_REGION from it. */
3
+ export declare const awsPrepareDeployment: (deploymentName: string, deployment: QpqAppDeployment) => void;
@@ -0,0 +1,6 @@
1
+ import { primeAwsDeploymentEnv, validateAwsDeployment } from '@qpqjs/config-aws';
2
+ /** Checks the entry has an account and region, then primes AWS_DEFAULT_ACCOUNT / AWS_DEFAULT_REGION from it. */
3
+ export const awsPrepareDeployment = (deploymentName, deployment) => {
4
+ primeAwsDeploymentEnv(validateAwsDeployment(deploymentName, deployment));
5
+ };
6
+ //# sourceMappingURL=prepareDeployment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareDeployment.js","sourceRoot":"","sources":["../../../../src/platforms/aws/prepareDeployment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAGjF,gHAAgH;AAChH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,cAAsB,EAAE,UAA4B,EAAQ,EAAE;IACjG,qBAAqB,CAAC,qBAAqB,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;AAC3E,CAAC,CAAC","sourcesContent":["import { primeAwsDeploymentEnv, validateAwsDeployment } from '@qpqjs/config-aws';\nimport { QpqAppDeployment } from '@qpqjs/core';\n\n/** Checks the entry has an account and region, then primes AWS_DEFAULT_ACCOUNT / AWS_DEFAULT_REGION from it. */\nexport const awsPrepareDeployment = (deploymentName: string, deployment: QpqAppDeployment): void => {\n primeAwsDeploymentEnv(validateAwsDeployment(deploymentName, deployment));\n};\n"]}
@@ -0,0 +1,4 @@
1
+ export declare const awsPublishBuild: (appName: string, serviceNames: string[]) => Promise<void>;
2
+ export declare const awsPublishUpload: (appName: string, serviceNames: string[]) => Promise<void>;
3
+ export declare const awsPublishDeploy: (appName: string, serviceNames: string[]) => Promise<void>;
4
+ export declare const awsPublish: (appName: string, serviceNames: string[]) => Promise<void>;
@@ -0,0 +1,50 @@
1
+ // AWS federated remote publishing — build each backend service as a
2
+ // module-federation remote and publish it into that service's federated code
3
+ // bucket (see ./remote for the three-phase mechanics).
4
+ import { isAwsCredentialsValid } from './awsCredentials';
5
+ import { buildRemote, deployRemoteManifest, resolvePublishTarget, uploadRemoteVersion } from './remote';
6
+ const requireAwsCredentials = async () => {
7
+ if (!(await isAwsCredentialsValid())) {
8
+ console.error('AWS credentials are not valid. Configure them and retry.');
9
+ process.exit(1);
10
+ }
11
+ };
12
+ export const awsPublishBuild = async (appName, serviceNames) => {
13
+ console.log(`Building federated remotes for [${appName}]: ${serviceNames.join(', ')}`);
14
+ for (const serviceName of serviceNames) {
15
+ await buildRemote(appName, serviceName);
16
+ }
17
+ console.log('Done. Next: qpq publish:upload, then qpq publish:deploy.');
18
+ };
19
+ export const awsPublishUpload = async (appName, serviceNames) => {
20
+ await requireAwsCredentials();
21
+ // Resolve every target up front - a missing build fails the whole step
22
+ // before a single byte is uploaded.
23
+ const targets = serviceNames.map((serviceName) => resolvePublishTarget(appName, serviceName));
24
+ console.log(`Uploading federated remotes for [${appName}]: ${serviceNames.join(', ')}`);
25
+ await Promise.all(targets.map((target) => uploadRemoteVersion(target)));
26
+ console.log('Done. Run qpq publish:deploy to flip lambdas to the new versions.');
27
+ };
28
+ export const awsPublishDeploy = async (appName, serviceNames) => {
29
+ await requireAwsCredentials();
30
+ const targets = serviceNames.map((serviceName) => resolvePublishTarget(appName, serviceName));
31
+ console.log(`Deploying federated remote manifests for [${appName}]: ${serviceNames.join(', ')}`);
32
+ await Promise.all(targets.map((target) => deployRemoteManifest(target)));
33
+ console.log('Done. New lambda cold starts will federate these services from S3.');
34
+ };
35
+ export const awsPublish = async (appName, serviceNames) => {
36
+ await requireAwsCredentials();
37
+ console.log(`Publishing federated remotes for [${appName}]: ${serviceNames.join(', ')}`);
38
+ // 1. Build everything first - any build failure bails before any upload,
39
+ // so the buckets never end up with a half-published set of services.
40
+ for (const serviceName of serviceNames) {
41
+ await buildRemote(appName, serviceName);
42
+ }
43
+ const targets = serviceNames.map((serviceName) => resolvePublishTarget(appName, serviceName));
44
+ // 2. Upload all version dirs in parallel - manifests untouched, nothing live yet.
45
+ await Promise.all(targets.map((target) => uploadRemoteVersion(target)));
46
+ // 3. Every version dir is fully uploaded - flip the manifests, in parallel.
47
+ await Promise.all(targets.map((target) => deployRemoteManifest(target)));
48
+ console.log('Done. New lambda cold starts will federate these services from S3.');
49
+ };
50
+ //# sourceMappingURL=publish.js.map
@@ -0,0 +1 @@
1
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AAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;IAE9F,kFAAkF;IAClF,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAExE,4EAA4E;IAC5E,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAEzE,OAAO,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC;AACpF,CAAC,CAAC","sourcesContent":["// AWS federated remote publishing — build each backend service as a\n// module-federation remote and publish it into that service's federated code\n// bucket (see ./remote for the three-phase mechanics).\nimport { isAwsCredentialsValid } from './awsCredentials';\nimport { buildRemote, deployRemoteManifest, resolvePublishTarget, uploadRemoteVersion } from './remote';\n\nconst requireAwsCredentials = async (): Promise<void> => {\n if (!(await isAwsCredentialsValid())) {\n console.error('AWS credentials are not valid. Configure them and retry.');\n process.exit(1);\n }\n};\n\nexport const awsPublishBuild = async (appName: string, serviceNames: string[]): Promise<void> => {\n console.log(`Building federated remotes for [${appName}]: ${serviceNames.join(', ')}`);\n\n for (const serviceName of serviceNames) {\n await buildRemote(appName, serviceName);\n }\n\n console.log('Done. Next: qpq publish:upload, then qpq publish:deploy.');\n};\n\nexport const awsPublishUpload = async (appName: string, serviceNames: string[]): Promise<void> => {\n await requireAwsCredentials();\n\n // Resolve every target up front - a missing build fails the whole step\n // before a single byte is uploaded.\n const targets = serviceNames.map((serviceName) => resolvePublishTarget(appName, serviceName));\n\n console.log(`Uploading federated remotes for [${appName}]: ${serviceNames.join(', ')}`);\n await Promise.all(targets.map((target) => uploadRemoteVersion(target)));\n\n console.log('Done. Run qpq publish:deploy to flip lambdas to the new versions.');\n};\n\nexport const awsPublishDeploy = async (appName: string, serviceNames: string[]): Promise<void> => {\n await requireAwsCredentials();\n\n const targets = serviceNames.map((serviceName) => resolvePublishTarget(appName, serviceName));\n\n console.log(`Deploying federated remote manifests for [${appName}]: ${serviceNames.join(', ')}`);\n await Promise.all(targets.map((target) => deployRemoteManifest(target)));\n\n console.log('Done. New lambda cold starts will federate these services from S3.');\n};\n\nexport const awsPublish = async (appName: string, serviceNames: string[]): Promise<void> => {\n await requireAwsCredentials();\n\n console.log(`Publishing federated remotes for [${appName}]: ${serviceNames.join(', ')}`);\n\n // 1. Build everything first - any build failure bails before any upload,\n // so the buckets never end up with a half-published set of services.\n for (const serviceName of serviceNames) {\n await buildRemote(appName, serviceName);\n }\n const targets = serviceNames.map((serviceName) => resolvePublishTarget(appName, serviceName));\n\n // 2. Upload all version dirs in parallel - manifests untouched, nothing live yet.\n await Promise.all(targets.map((target) => uploadRemoteVersion(target)));\n\n // 3. Every version dir is fully uploaded - flip the manifests, in parallel.\n await Promise.all(targets.map((target) => deployRemoteManifest(target)));\n\n console.log('Done. New lambda cold starts will federate these services from S3.');\n};\n"]}
@@ -0,0 +1,11 @@
1
+ export type RemotePublishTarget = {
2
+ serviceName: string;
3
+ publishPath: string;
4
+ manifestHash: string;
5
+ bucketName: string;
6
+ servicePrefix: string;
7
+ };
8
+ export declare const buildRemote: (appName: string, serviceName: string) => Promise<void>;
9
+ export declare const resolvePublishTarget: (appName: string, serviceName: string) => RemotePublishTarget;
10
+ export declare const uploadRemoteVersion: (target: RemotePublishTarget) => Promise<void>;
11
+ export declare const deployRemoteManifest: (target: RemotePublishTarget) => Promise<void>;
@@ -0,0 +1,89 @@
1
+ // Build a backend service as a module-federation remote and publish it into the
2
+ // shared federated-code storage drive, under the service's own prefix. After this
3
+ // runs, the already-deployed lambdas load their stories from the bucket (quidproquo's
4
+ // dynamicModuleLoader tries the federated store first, falls back to the bundled
5
+ // code when nothing's published).
6
+ //
7
+ // The store is one storage drive shared across services (via `owner`). Each service
8
+ // opts in with defineFederatedModuleStore(<driveName>) and its lambdas read from
9
+ // s3://<bucket>/<service>. Read access comes from the storage drive's own grants, so
10
+ // the drive + a deploy of each service must exist before publishing. The bucket name
11
+ // resolves from the same service config the deploy used, so it always matches.
12
+ //
13
+ // Publishing is split into three phases so they can run as separate commands
14
+ // (publish:build / publish:upload / publish:deploy) or chained by `qpq publish`:
15
+ // buildRemote - rspack the remote + lay out service-remote-published/
16
+ // uploadRemoteVersion - sync the hashed version dir (everything BUT manifest.json)
17
+ // deployRemoteManifest - upload manifest.json, atomically flipping lambdas over
18
+ // Version files always land before the manifest that references them, so a reading
19
+ // lambda never sees a manifest whose files aren't all present yet.
20
+ import { awsNamingUtils } from '@qpqjs/actionprocessor-aws';
21
+ import { qpqCoreUtils } from '@qpqjs/core';
22
+ import { getServiceRemoteRspackConfig, publishFederatedRemote, runRspack } from '@qpqjs/deploy-rspack';
23
+ import fs from 'fs';
24
+ import path from 'path';
25
+ import { getRoot, getServiceDirectory } from '../../lib/discovery';
26
+ import { loadServiceQpqConfig } from '../../lib/qpqConfigs';
27
+ import { runCommand } from '../../lib/runCommand';
28
+ const getPublishPath = (appName, serviceName) => path.join(getRoot(), 'dist', 'apps', appName, 'services', serviceName, 'service-remote-published');
29
+ // Resolve the shared store bucket from the service's defineFederatedModuleStore
30
+ // setting (same derivation the lambda env var uses) and the per-service prefix
31
+ // so many services share one bucket.
32
+ const resolveRemoteStore = (appName, serviceName) => {
33
+ const qpqConfig = loadServiceQpqConfig(appName, serviceName);
34
+ const federatedStore = qpqCoreUtils.getFederatedModuleStore(qpqConfig);
35
+ if (!federatedStore) {
36
+ throw new Error(`service [${serviceName}] has no defineFederatedModuleStore(...) - add it (and the matching storage drive) to opt into federation`);
37
+ }
38
+ const storageDrive = qpqCoreUtils.getStorageDriveByName(federatedStore.storageDrive, qpqConfig);
39
+ if (!storageDrive) {
40
+ throw new Error(`defineFederatedModuleStore references storage drive [${federatedStore.storageDrive}] which service [${serviceName}] does not declare`);
41
+ }
42
+ const bucketName = awsNamingUtils.resolveConfigRuntimeResourceNameFromConfig(storageDrive.owner?.resourceNameOverride || storageDrive.storageDrive, qpqConfig, storageDrive.owner);
43
+ const servicePrefix = qpqCoreUtils.getApplicationModuleName(qpqConfig);
44
+ return { bucketName, servicePrefix };
45
+ };
46
+ // Phase 1: rspack the federated remote container and lay out the publishable
47
+ // version dir + manifest.json under service-remote-published/. Validates the
48
+ // federation config up front so a misconfigured service fails before the build.
49
+ export const buildRemote = async (appName, serviceName) => {
50
+ resolveRemoteStore(appName, serviceName);
51
+ const serviceDir = path.join(getServiceDirectory(appName, serviceName), 'service');
52
+ const qpqConfig = loadServiceQpqConfig(appName, serviceName);
53
+ console.log(`Building federated remote: [${serviceName}]`);
54
+ const config = getServiceRemoteRspackConfig(qpqConfig, serviceDir);
55
+ await runRspack(config);
56
+ const remoteBuildPath = config.output.path;
57
+ publishFederatedRemote(qpqConfig, remoteBuildPath, getPublishPath(appName, serviceName));
58
+ };
59
+ // Resolve a publish target from a prior buildRemote's on-disk output.
60
+ export const resolvePublishTarget = (appName, serviceName) => {
61
+ const publishPath = getPublishPath(appName, serviceName);
62
+ const manifestPath = path.join(publishPath, 'manifest.json');
63
+ if (!fs.existsSync(manifestPath)) {
64
+ throw new Error(`no built remote found for [${serviceName}] (missing ${manifestPath}) - run \`qpq publish:build --app ${appName}\` first`);
65
+ }
66
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
67
+ return {
68
+ serviceName,
69
+ publishPath,
70
+ manifestHash: manifest.hash,
71
+ ...resolveRemoteStore(appName, serviceName),
72
+ };
73
+ };
74
+ // Phase 2: upload the hashed version dir - everything EXCEPT manifest.json, so
75
+ // nothing referenced by a live manifest changes. Safe to run concurrently across
76
+ // services - each writes only under its own prefix.
77
+ export const uploadRemoteVersion = async (target) => {
78
+ const { serviceName, publishPath, manifestHash, bucketName, servicePrefix } = target;
79
+ console.log(`Uploading [${serviceName}] version [${manifestHash}] to [s3://${bucketName}/${servicePrefix}/${manifestHash}]`);
80
+ await runCommand('aws', ['s3', 'sync', path.join(publishPath, manifestHash), `s3://${bucketName}/${servicePrefix}/${manifestHash}`]);
81
+ };
82
+ // Phase 3: upload manifest.json, the pointer lambdas read - this is the moment
83
+ // the new version goes live. Only run once the version dir is fully uploaded.
84
+ export const deployRemoteManifest = async (target) => {
85
+ const { serviceName, publishPath, manifestHash, bucketName, servicePrefix } = target;
86
+ console.log(`Deploying [${serviceName}] manifest for version [${manifestHash}] to [s3://${bucketName}/${servicePrefix}/manifest.json]`);
87
+ await runCommand('aws', ['s3', 'cp', path.join(publishPath, 'manifest.json'), `s3://${bucketName}/${servicePrefix}/manifest.json`]);
88
+ };
89
+ //# sourceMappingURL=remote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote.js","sourceRoot":"","sources":["../../../../src/platforms/aws/remote.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,kFAAkF;AAClF,sFAAsF;AACtF,iFAAiF;AACjF,kCAAkC;AAClC,EAAE;AACF,oFAAoF;AACpF,iFAAiF;AACjF,qFAAqF;AACrF,qFAAqF;AACrF,+EAA+E;AAC/E,EAAE;AACF,6EAA6E;AAC7E,iFAAiF;AACjF,iFAAiF;AACjF,sFAAsF;AACtF,kFAAkF;AAClF,mFAAmF;AACnF,mEAAmE;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEvG,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAalD,MAAM,cAAc,GAAG,CAAC,OAAe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C,MAAM,mBAAmB,GAAG,KAAK,EAAE,MAA2B,EAAiB,EAAE;IACtF,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC;IAErF,OAAO,CAAC,GAAG,CAAC,cAAc,WAAW,cAAc,YAAY,cAAc,UAAU,IAAI,aAAa,IAAI,YAAY,GAAG,CAAC,CAAC;IAC7H,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,QAAQ,UAAU,IAAI,aAAa,IAAI,YAAY,EAAE,CAAC,CAAC,CAAC;AACvI,CAAC,CAAC;AAEF,+EAA+E;AAC/E,8EAA8E;AAC9E,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,MAA2B,EAAiB,EAAE;IACvF,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC;IAErF,OAAO,CAAC,GAAG,CAAC,cAAc,WAAW,2BAA2B,YAAY,cAAc,UAAU,IAAI,aAAa,iBAAiB,CAAC,CAAC;IACxI,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,EAAE,QAAQ,UAAU,IAAI,aAAa,gBAAgB,CAAC,CAAC,CAAC;AACtI,CAAC,CAAC","sourcesContent":["// Build a backend service as a module-federation remote and publish it into the\n// shared federated-code storage drive, under the service's own prefix. After this\n// runs, the already-deployed lambdas load their stories from the bucket (quidproquo's\n// dynamicModuleLoader tries the federated store first, falls back to the bundled\n// code when nothing's published).\n//\n// The store is one storage drive shared across services (via `owner`). Each service\n// opts in with defineFederatedModuleStore(<driveName>) and its lambdas read from\n// s3://<bucket>/<service>. Read access comes from the storage drive's own grants, so\n// the drive + a deploy of each service must exist before publishing. The bucket name\n// resolves from the same service config the deploy used, so it always matches.\n//\n// Publishing is split into three phases so they can run as separate commands\n// (publish:build / publish:upload / publish:deploy) or chained by `qpq publish`:\n// buildRemote - rspack the remote + lay out service-remote-published/\n// uploadRemoteVersion - sync the hashed version dir (everything BUT manifest.json)\n// deployRemoteManifest - upload manifest.json, atomically flipping lambdas over\n// Version files always land before the manifest that references them, so a reading\n// lambda never sees a manifest whose files aren't all present yet.\nimport { awsNamingUtils } from '@qpqjs/actionprocessor-aws';\nimport { qpqCoreUtils } from '@qpqjs/core';\nimport { getServiceRemoteRspackConfig, publishFederatedRemote, runRspack } from '@qpqjs/deploy-rspack';\n\nimport fs from 'fs';\nimport path from 'path';\n\nimport { getRoot, getServiceDirectory } from '../../lib/discovery';\nimport { loadServiceQpqConfig } from '../../lib/qpqConfigs';\nimport { runCommand } from '../../lib/runCommand';\n\n// Everything the upload/deploy phases need to publish a built remote. Resolved\n// from the on-disk build output + service config, so each phase can run in its\n// own process without handing state between commands.\nexport type RemotePublishTarget = {\n serviceName: string;\n publishPath: string;\n manifestHash: string;\n bucketName: string;\n servicePrefix: string;\n};\n\nconst getPublishPath = (appName: string, serviceName: string): string =>\n path.join(getRoot(), 'dist', 'apps', appName, 'services', serviceName, 'service-remote-published');\n\n// Resolve the shared store bucket from the service's defineFederatedModuleStore\n// setting (same derivation the lambda env var uses) and the per-service prefix\n// so many services share one bucket.\nconst resolveRemoteStore = (appName: string, serviceName: string): { bucketName: string; servicePrefix: string } => {\n const qpqConfig = loadServiceQpqConfig(appName, serviceName);\n\n const federatedStore = qpqCoreUtils.getFederatedModuleStore(qpqConfig);\n if (!federatedStore) {\n throw new Error(\n `service [${serviceName}] has no defineFederatedModuleStore(...) - add it (and the matching storage drive) to opt into federation`,\n );\n }\n const storageDrive = qpqCoreUtils.getStorageDriveByName(federatedStore.storageDrive, qpqConfig);\n if (!storageDrive) {\n throw new Error(\n `defineFederatedModuleStore references storage drive [${federatedStore.storageDrive}] which service [${serviceName}] does not declare`,\n );\n }\n const bucketName = awsNamingUtils.resolveConfigRuntimeResourceNameFromConfig(\n storageDrive.owner?.resourceNameOverride || storageDrive.storageDrive,\n qpqConfig,\n storageDrive.owner,\n );\n const servicePrefix = qpqCoreUtils.getApplicationModuleName(qpqConfig);\n\n return { bucketName, servicePrefix };\n};\n\n// Phase 1: rspack the federated remote container and lay out the publishable\n// version dir + manifest.json under service-remote-published/. Validates the\n// federation config up front so a misconfigured service fails before the build.\nexport const buildRemote = async (appName: string, serviceName: string): Promise<void> => {\n resolveRemoteStore(appName, serviceName);\n\n const serviceDir = path.join(getServiceDirectory(appName, serviceName), 'service');\n const qpqConfig = loadServiceQpqConfig(appName, serviceName);\n\n console.log(`Building federated remote: [${serviceName}]`);\n const config = getServiceRemoteRspackConfig(qpqConfig, serviceDir);\n await runRspack(config);\n\n const remoteBuildPath = config.output!.path as string;\n publishFederatedRemote(qpqConfig, remoteBuildPath, getPublishPath(appName, serviceName));\n};\n\n// Resolve a publish target from a prior buildRemote's on-disk output.\nexport const resolvePublishTarget = (appName: string, serviceName: string): RemotePublishTarget => {\n const publishPath = getPublishPath(appName, serviceName);\n const manifestPath = path.join(publishPath, 'manifest.json');\n\n if (!fs.existsSync(manifestPath)) {\n throw new Error(`no built remote found for [${serviceName}] (missing ${manifestPath}) - run \\`qpq publish:build --app ${appName}\\` first`);\n }\n const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8')) as {\n hash: string;\n };\n\n return {\n serviceName,\n publishPath,\n manifestHash: manifest.hash,\n ...resolveRemoteStore(appName, serviceName),\n };\n};\n\n// Phase 2: upload the hashed version dir - everything EXCEPT manifest.json, so\n// nothing referenced by a live manifest changes. Safe to run concurrently across\n// services - each writes only under its own prefix.\nexport const uploadRemoteVersion = async (target: RemotePublishTarget): Promise<void> => {\n const { serviceName, publishPath, manifestHash, bucketName, servicePrefix } = target;\n\n console.log(`Uploading [${serviceName}] version [${manifestHash}] to [s3://${bucketName}/${servicePrefix}/${manifestHash}]`);\n await runCommand('aws', ['s3', 'sync', path.join(publishPath, manifestHash), `s3://${bucketName}/${servicePrefix}/${manifestHash}`]);\n};\n\n// Phase 3: upload manifest.json, the pointer lambdas read - this is the moment\n// the new version goes live. Only run once the version dir is fully uploaded.\nexport const deployRemoteManifest = async (target: RemotePublishTarget): Promise<void> => {\n const { serviceName, publishPath, manifestHash, bucketName, servicePrefix } = target;\n\n console.log(`Deploying [${serviceName}] manifest for version [${manifestHash}] to [s3://${bucketName}/${servicePrefix}/manifest.json]`);\n await runCommand('aws', ['s3', 'cp', path.join(publishPath, 'manifest.json'), `s3://${bucketName}/${servicePrefix}/manifest.json`]);\n};\n"]}
@@ -0,0 +1,12 @@
1
+ import { QPQConfig } from '@qpqjs/core';
2
+ /** Everything the AWS setup steps share: the target account/region and the app's configs. */
3
+ export type AwsSetupContext = {
4
+ appName: string;
5
+ environment: string;
6
+ accountId: string;
7
+ region: string;
8
+ accountQpqConfig: QPQConfig;
9
+ bootstrapQpqConfig: QPQConfig;
10
+ serviceQpqConfigs: QPQConfig[];
11
+ };
12
+ export declare const buildAwsSetupContext: (appName: string, deploymentName: string) => AwsSetupContext;
@@ -0,0 +1,16 @@
1
+ import { getQpqAppDeployContext, getWorkspaceAccountQpqConfig, getWorkspaceBootstrapQpqConfig } from '@qpqjs/deploy-aws';
2
+ import { getRoot, getServiceNames } from '../../../lib/discovery';
3
+ import { loadServiceQpqConfig } from '../../../lib/qpqConfigs';
4
+ export const buildAwsSetupContext = (appName, deploymentName) => {
5
+ const ctx = getQpqAppDeployContext(getRoot(), appName, deploymentName);
6
+ return {
7
+ appName,
8
+ environment: ctx.environment,
9
+ accountId: ctx.accountId,
10
+ region: ctx.region,
11
+ accountQpqConfig: getWorkspaceAccountQpqConfig(ctx),
12
+ bootstrapQpqConfig: getWorkspaceBootstrapQpqConfig(ctx),
13
+ serviceQpqConfigs: getServiceNames(appName).map((service) => loadServiceQpqConfig(appName, service)),
14
+ };
15
+ };
16
+ //# sourceMappingURL=awsSetupContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"awsSetupContext.js","sourceRoot":"","sources":["../../../../../src/platforms/aws/setup/awsSetupContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AAEzH,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAa/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,cAAsB,EAAmB,EAAE;IAC/F,MAAM,GAAG,GAAG,sBAAsB,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;IAEvE,OAAO;QACL,OAAO;QACP,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,gBAAgB,EAAE,4BAA4B,CAAC,GAAG,CAAC;QACnD,kBAAkB,EAAE,8BAA8B,CAAC,GAAG,CAAC;QACvD,iBAAiB,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KACrG,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { QPQConfig } from '@qpqjs/core';\nimport { getQpqAppDeployContext, getWorkspaceAccountQpqConfig, getWorkspaceBootstrapQpqConfig } from '@qpqjs/deploy-aws';\n\nimport { getRoot, getServiceNames } from '../../../lib/discovery';\nimport { loadServiceQpqConfig } from '../../../lib/qpqConfigs';\n\n/** Everything the AWS setup steps share: the target account/region and the app's configs. */\nexport type AwsSetupContext = {\n appName: string;\n environment: string;\n accountId: string;\n region: string;\n accountQpqConfig: QPQConfig;\n bootstrapQpqConfig: QPQConfig;\n serviceQpqConfigs: QPQConfig[];\n};\n\nexport const buildAwsSetupContext = (appName: string, deploymentName: string): AwsSetupContext => {\n const ctx = getQpqAppDeployContext(getRoot(), appName, deploymentName);\n\n return {\n appName,\n environment: ctx.environment,\n accountId: ctx.accountId,\n region: ctx.region,\n accountQpqConfig: getWorkspaceAccountQpqConfig(ctx),\n bootstrapQpqConfig: getWorkspaceBootstrapQpqConfig(ctx),\n serviceQpqConfigs: getServiceNames(appName).map((service) => loadServiceQpqConfig(appName, service)),\n };\n};\n"]}
@@ -0,0 +1,8 @@
1
+ import { SetupStep } from '../../../lib/setupStep';
2
+ /**
3
+ * The AWS checklist, in the order it must run: prerequisites that only check, the CDK
4
+ * toolkit per region, then the app-wide stacks (the account stack creates the GitHub OIDC
5
+ * provider, the bootstrap stack the GitHub deploy role). Services are deployed separately
6
+ * with `qpq go` / `qpq go:docker`, which is where the time goes and where parallelism lives.
7
+ */
8
+ export declare const awsSetupSteps: (appName: string, deploymentName: string) => Promise<SetupStep[]>;
@@ -0,0 +1,31 @@
1
+ import { buildAwsSetupContext } from './awsSetupContext';
2
+ import { buildBucketNamesStep } from './buildBucketNamesStep';
3
+ import { buildCdkBootstrapSteps } from './buildCdkBootstrapSteps';
4
+ import { buildGithubDeployRoleStep } from './buildGithubDeployRoleStep';
5
+ import { buildGithubOidcProviderStep } from './buildGithubOidcProviderStep';
6
+ import { buildHostedZonesStep } from './buildHostedZonesStep';
7
+ import { buildIamCapabilityStep } from './buildIamCapabilityStep';
8
+ import { buildIdentityStep } from './buildIdentityStep';
9
+ import { buildAccountStackStep, buildBootstrapStackStep, buildDomainStackStep } from './buildStackSteps';
10
+ /**
11
+ * The AWS checklist, in the order it must run: prerequisites that only check, the CDK
12
+ * toolkit per region, then the app-wide stacks (the account stack creates the GitHub OIDC
13
+ * provider, the bootstrap stack the GitHub deploy role). Services are deployed separately
14
+ * with `qpq go` / `qpq go:docker`, which is where the time goes and where parallelism lives.
15
+ */
16
+ export const awsSetupSteps = async (appName, deploymentName) => {
17
+ const ctx = buildAwsSetupContext(appName, deploymentName);
18
+ return [
19
+ buildIdentityStep(ctx),
20
+ buildIamCapabilityStep(ctx),
21
+ buildHostedZonesStep(ctx),
22
+ buildBucketNamesStep(ctx),
23
+ ...buildCdkBootstrapSteps(ctx),
24
+ buildAccountStackStep(ctx),
25
+ buildGithubOidcProviderStep(ctx),
26
+ buildDomainStackStep(ctx),
27
+ buildBootstrapStackStep(ctx),
28
+ buildGithubDeployRoleStep(ctx),
29
+ ];
30
+ };
31
+ //# sourceMappingURL=awsSetupSteps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"awsSetupSteps.js","sourceRoot":"","sources":["../../../../../src/platforms/aws/setup/awsSetupSteps.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,OAAe,EAAE,cAAsB,EAAwB,EAAE;IACnG,MAAM,GAAG,GAAG,oBAAoB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAE1D,OAAO;QACL,iBAAiB,CAAC,GAAG,CAAC;QACtB,sBAAsB,CAAC,GAAG,CAAC;QAC3B,oBAAoB,CAAC,GAAG,CAAC;QACzB,oBAAoB,CAAC,GAAG,CAAC;QACzB,GAAG,sBAAsB,CAAC,GAAG,CAAC;QAC9B,qBAAqB,CAAC,GAAG,CAAC;QAC1B,2BAA2B,CAAC,GAAG,CAAC;QAChC,oBAAoB,CAAC,GAAG,CAAC;QACzB,uBAAuB,CAAC,GAAG,CAAC;QAC5B,yBAAyB,CAAC,GAAG,CAAC;KAC/B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { SetupStep } from '../../../lib/setupStep';\nimport { buildAwsSetupContext } from './awsSetupContext';\nimport { buildBucketNamesStep } from './buildBucketNamesStep';\nimport { buildCdkBootstrapSteps } from './buildCdkBootstrapSteps';\nimport { buildGithubDeployRoleStep } from './buildGithubDeployRoleStep';\nimport { buildGithubOidcProviderStep } from './buildGithubOidcProviderStep';\nimport { buildHostedZonesStep } from './buildHostedZonesStep';\nimport { buildIamCapabilityStep } from './buildIamCapabilityStep';\nimport { buildIdentityStep } from './buildIdentityStep';\nimport { buildAccountStackStep, buildBootstrapStackStep, buildDomainStackStep } from './buildStackSteps';\n\n/**\n * The AWS checklist, in the order it must run: prerequisites that only check, the CDK\n * toolkit per region, then the app-wide stacks (the account stack creates the GitHub OIDC\n * provider, the bootstrap stack the GitHub deploy role). Services are deployed separately\n * with `qpq go` / `qpq go:docker`, which is where the time goes and where parallelism lives.\n */\nexport const awsSetupSteps = async (appName: string, deploymentName: string): Promise<SetupStep[]> => {\n const ctx = buildAwsSetupContext(appName, deploymentName);\n\n return [\n buildIdentityStep(ctx),\n buildIamCapabilityStep(ctx),\n buildHostedZonesStep(ctx),\n buildBucketNamesStep(ctx),\n ...buildCdkBootstrapSteps(ctx),\n buildAccountStackStep(ctx),\n buildGithubOidcProviderStep(ctx),\n buildDomainStackStep(ctx),\n buildBootstrapStackStep(ctx),\n buildGithubDeployRoleStep(ctx),\n ];\n};\n"]}
@@ -0,0 +1,4 @@
1
+ import { SetupStep } from '../../../lib/setupStep';
2
+ import { AwsSetupContext } from './awsSetupContext';
3
+ /** Check-only: no bucket the deploy will create is already taken by another AWS account. */
4
+ export declare const buildBucketNamesStep: (ctx: AwsSetupContext) => SetupStep;
@@ -0,0 +1,62 @@
1
+ import { awsNamingUtils } from '@qpqjs/actionprocessor-aws';
2
+ import { qpqCoreUtils } from '@qpqjs/core';
3
+ import { qpqWebServerUtils } from '@qpqjs/webserver';
4
+ import { HeadBucketCommand, S3Client } from '@aws-sdk/client-s3';
5
+ // Every bucket a service deploy creates, named the way the constructs name them.
6
+ const getServiceBucketNames = (qpqConfig) => [
7
+ ...qpqCoreUtils
8
+ .getOwnedItems(qpqCoreUtils.getStorageDrives(qpqConfig), qpqConfig)
9
+ .map((drive) => awsNamingUtils.getConfigRuntimeResourceNameFromConfig(drive.storageDrive, qpqConfig)),
10
+ ...qpqWebServerUtils
11
+ .getWebEntryConfigs(qpqConfig)
12
+ .filter((webEntry) => !webEntry.storageDrive.sourceStorageDrive)
13
+ .map((webEntry) => awsNamingUtils.getQpqRuntimeResourceNameFromConfig(webEntry.name, qpqConfig, 'we')),
14
+ ];
15
+ // HeadBucket: 404 means free, 200 ours, 403 exists in another account.
16
+ const getBucketOwner = async (client, bucketName) => {
17
+ try {
18
+ await client.send(new HeadBucketCommand({ Bucket: bucketName }));
19
+ return 'ours';
20
+ }
21
+ catch (error) {
22
+ const status = error.$metadata?.httpStatusCode;
23
+ if (status === 404) {
24
+ return 'free';
25
+ }
26
+ if (status === 403 || status === 301) {
27
+ return 'other';
28
+ }
29
+ throw error;
30
+ }
31
+ };
32
+ // S3 bucket names are global and the framework names them from app, service and
33
+ // environment alone, so a second account cannot reuse a name the first still holds.
34
+ const checkBucketNames = async (ctx) => {
35
+ const names = [...new Set(ctx.serviceQpqConfigs.flatMap(getServiceBucketNames))];
36
+ const client = new S3Client({ region: ctx.region });
37
+ const taken = [];
38
+ let ours = 0;
39
+ for (const name of names) {
40
+ const owner = await getBucketOwner(client, name);
41
+ if (owner === 'other')
42
+ taken.push(name);
43
+ if (owner === 'ours')
44
+ ours += 1;
45
+ }
46
+ return taken.length === 0
47
+ ? { done: true, detail: `${names.length} bucket name(s) available or already ours (${ours} existing)` }
48
+ : { done: false, detail: `held by another account: ${taken.join(', ')}; delete them there or change the app prefix` };
49
+ };
50
+ /** Check-only: no bucket the deploy will create is already taken by another AWS account. */
51
+ export const buildBucketNamesStep = (ctx) => ({
52
+ id: 'bucket-names',
53
+ name: 'S3 bucket names available',
54
+ check: () => checkBucketNames(ctx),
55
+ run: async () => {
56
+ const result = await checkBucketNames(ctx);
57
+ if (!result.done) {
58
+ throw new Error(result.detail ?? 'bucket names taken');
59
+ }
60
+ },
61
+ });
62
+ //# sourceMappingURL=buildBucketNamesStep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildBucketNamesStep.js","sourceRoot":"","sources":["../../../../../src/platforms/aws/setup/buildBucketNamesStep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAa,YAAY,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAKjE,iFAAiF;AACjF,MAAM,qBAAqB,GAAG,CAAC,SAAoB,EAAY,EAAE,CAAC;IAChE,GAAG,YAAY;SACZ,aAAa,CAAC,YAAY,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;SAClE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,sCAAsC,CAAC,KAAK,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACvG,GAAG,iBAAiB;SACjB,kBAAkB,CAAC,SAAS,CAAC;SAC7B,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,kBAAkB,CAAC;SAC/D,GAAG,CAAC,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K,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,KAAK,KAAK,MAAM;YAAE,IAAI,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;QACvB,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,8CAA8C,IAAI,YAAY,EAAE;QACvG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,4BAA4B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,8CAA8C,EAAE,CAAC;AAC1H,CAAC,CAAC;AAEF,4FAA4F;AAC5F,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAoB,EAAa,EAAE,CAAC,CAAC;IACxE,EAAE,EAAE,cAAc;IAClB,IAAI,EAAE,2BAA2B;IACjC,KAAK,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC;IAClC,GAAG,EAAE,KAAK,IAAI,EAAE;QACd,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,oBAAoB,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { awsNamingUtils } from '@qpqjs/actionprocessor-aws';\nimport { QPQConfig, qpqCoreUtils } from '@qpqjs/core';\nimport { qpqWebServerUtils } from '@qpqjs/webserver';\n\nimport { HeadBucketCommand, S3Client } from '@aws-sdk/client-s3';\n\nimport { SetupCheckResult, SetupStep } from '../../../lib/setupStep';\nimport { AwsSetupContext } from './awsSetupContext';\n\n// Every bucket a service deploy creates, named the way the constructs name them.\nconst getServiceBucketNames = (qpqConfig: QPQConfig): string[] => [\n ...qpqCoreUtils\n .getOwnedItems(qpqCoreUtils.getStorageDrives(qpqConfig), qpqConfig)\n .map((drive) => awsNamingUtils.getConfigRuntimeResourceNameFromConfig(drive.storageDrive, qpqConfig)),\n ...qpqWebServerUtils\n .getWebEntryConfigs(qpqConfig)\n .filter((webEntry) => !webEntry.storageDrive.sourceStorageDrive)\n .map((webEntry) => awsNamingUtils.getQpqRuntimeResourceNameFromConfig(webEntry.name, qpqConfig, 'we')),\n];\n\ntype BucketOwner = 'free' | 'ours' | 'other';\n\n// HeadBucket: 404 means free, 200 ours, 403 exists in another account.\nconst getBucketOwner = async (client: S3Client, bucketName: string): Promise<BucketOwner> => {\n try {\n await client.send(new HeadBucketCommand({ Bucket: bucketName }));\n return 'ours';\n } catch (error) {\n const status = (error as { $metadata?: { httpStatusCode?: number } }).$metadata?.httpStatusCode;\n if (status === 404) {\n return 'free';\n }\n if (status === 403 || status === 301) {\n return 'other';\n }\n throw error;\n }\n};\n\n// S3 bucket names are global and the framework names them from app, service and\n// environment alone, so a second account cannot reuse a name the first still holds.\nconst checkBucketNames = async (ctx: AwsSetupContext): Promise<SetupCheckResult> => {\n const names = [...new Set(ctx.serviceQpqConfigs.flatMap(getServiceBucketNames))];\n const client = new S3Client({ region: ctx.region });\n\n const taken: string[] = [];\n let ours = 0;\n for (const name of names) {\n const owner = await getBucketOwner(client, name);\n if (owner === 'other') taken.push(name);\n if (owner === 'ours') ours += 1;\n }\n\n return taken.length === 0\n ? { done: true, detail: `${names.length} bucket name(s) available or already ours (${ours} existing)` }\n : { done: false, detail: `held by another account: ${taken.join(', ')}; delete them there or change the app prefix` };\n};\n\n/** Check-only: no bucket the deploy will create is already taken by another AWS account. */\nexport const buildBucketNamesStep = (ctx: AwsSetupContext): SetupStep => ({\n id: 'bucket-names',\n name: 'S3 bucket names available',\n check: () => checkBucketNames(ctx),\n run: async () => {\n const result = await checkBucketNames(ctx);\n if (!result.done) {\n throw new Error(result.detail ?? 'bucket names taken');\n }\n },\n});\n"]}
@@ -0,0 +1,5 @@
1
+ import { SetupStep } from '../../../lib/setupStep';
2
+ import { AwsSetupContext } from './awsSetupContext';
3
+ /** Every region the app deploys into: the deploy region plus each certificate region (us-east-1 for CloudFront). */
4
+ export declare const getSetupRegions: (ctx: AwsSetupContext) => string[];
5
+ export declare const buildCdkBootstrapSteps: (ctx: AwsSetupContext) => SetupStep[];
@@ -0,0 +1,24 @@
1
+ import { qpqConfigAwsUtils } from '@qpqjs/config-aws';
2
+ import { getRoot } from '../../../lib/discovery';
3
+ import { runCommand } from '../../../lib/runCommand';
4
+ import { describeStackStatus, isStackHealthy } from './describeStackStatus';
5
+ /** Every region the app deploys into: the deploy region plus each certificate region (us-east-1 for CloudFront). */
6
+ export const getSetupRegions = (ctx) => [
7
+ ...new Set([ctx.region, ...qpqConfigAwsUtils.getDomainCertificateConfigs(ctx.bootstrapQpqConfig).map((cert) => cert.region)]),
8
+ ];
9
+ const buildCdkBootstrapStep = (ctx, region) => ({
10
+ id: `cdk-bootstrap-${region}`,
11
+ name: `CDK bootstrap ${region}`,
12
+ check: async () => {
13
+ const status = await describeStackStatus('CDKToolkit', region);
14
+ if (status === null) {
15
+ return { done: false, detail: 'no CDKToolkit stack' };
16
+ }
17
+ return isStackHealthy(status)
18
+ ? { done: true, detail: `CDKToolkit ${status}` }
19
+ : { done: false, detail: `CDKToolkit is ${status}; delete the stack in ${region} before retrying` };
20
+ },
21
+ run: () => runCommand('npx', ['cdk', 'bootstrap', `aws://${ctx.accountId}/${region}`], { cwd: getRoot() }),
22
+ });
23
+ export const buildCdkBootstrapSteps = (ctx) => getSetupRegions(ctx).map((region) => buildCdkBootstrapStep(ctx, region));
24
+ //# sourceMappingURL=buildCdkBootstrapSteps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildCdkBootstrapSteps.js","sourceRoot":"","sources":["../../../../../src/platforms/aws/setup/buildCdkBootstrapSteps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,OAAO,EAA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G,EAAE,OAAO,EAAE,EAAE,CAAC;CAC3G,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAoB,EAAe,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC","sourcesContent":["import { qpqConfigAwsUtils } from '@qpqjs/config-aws';\n\nimport { getRoot } from '../../../lib/discovery';\nimport { runCommand } from '../../../lib/runCommand';\nimport { SetupStep } from '../../../lib/setupStep';\nimport { AwsSetupContext } from './awsSetupContext';\nimport { describeStackStatus, isStackHealthy } from './describeStackStatus';\n\n/** Every region the app deploys into: the deploy region plus each certificate region (us-east-1 for CloudFront). */\nexport const getSetupRegions = (ctx: AwsSetupContext): string[] => [\n ...new Set([ctx.region, ...qpqConfigAwsUtils.getDomainCertificateConfigs(ctx.bootstrapQpqConfig).map((cert) => cert.region)]),\n];\n\nconst buildCdkBootstrapStep = (ctx: AwsSetupContext, region: string): SetupStep => ({\n id: `cdk-bootstrap-${region}`,\n name: `CDK bootstrap ${region}`,\n check: async () => {\n const status = await describeStackStatus('CDKToolkit', region);\n if (status === null) {\n return { done: false, detail: 'no CDKToolkit stack' };\n }\n return isStackHealthy(status)\n ? { done: true, detail: `CDKToolkit ${status}` }\n : { done: false, detail: `CDKToolkit is ${status}; delete the stack in ${region} before retrying` };\n },\n run: () => runCommand('npx', ['cdk', 'bootstrap', `aws://${ctx.accountId}/${region}`], { cwd: getRoot() }),\n});\n\nexport const buildCdkBootstrapSteps = (ctx: AwsSetupContext): SetupStep[] => getSetupRegions(ctx).map((region) => buildCdkBootstrapStep(ctx, region));\n"]}
@@ -0,0 +1,4 @@
1
+ import { SetupStep } from '../../../lib/setupStep';
2
+ import { AwsSetupContext } from './awsSetupContext';
3
+ /** Check-only: the GitHub Actions deploy role is declared and deployed, with the values the GitHub Environment needs. */
4
+ export declare const buildGithubDeployRoleStep: (ctx: AwsSetupContext) => SetupStep;
@@ -0,0 +1,40 @@
1
+ import { awsNamingUtils } from '@qpqjs/actionprocessor-aws';
2
+ import { qpqConfigAwsUtils } from '@qpqjs/config-aws';
3
+ import { GetRoleCommand, IAMClient } from '@aws-sdk/client-iam';
4
+ // The role itself is deployed by the bootstrap stack; this step tells you whether the config
5
+ // declares it, whether it exists yet, and what to put in the GitHub Environment once it does.
6
+ const checkDeployRole = async (ctx) => {
7
+ const config = qpqConfigAwsUtils.getAwsGithubDeployRoleConfig(ctx.bootstrapQpqConfig);
8
+ if (!config) {
9
+ return { done: false, detail: 'not declared: add defineAwsGithubDeployRole("owner/repo", { ownerId, repositoryId }) to bootstrap.qpq.ts' };
10
+ }
11
+ const roleName = awsNamingUtils.getGithubDeployRoleNameFromConfig(ctx.bootstrapQpqConfig);
12
+ const githubEnvironment = config.githubEnvironment ?? ctx.environment;
13
+ try {
14
+ const { Role } = await new IAMClient({ region: ctx.region }).send(new GetRoleCommand({ RoleName: roleName }));
15
+ return {
16
+ done: true,
17
+ detail: `${Role?.Arn}; GitHub Environment '${githubEnvironment}' needs DEPLOY_ROLE_ARN=<that arn> and AWS_REGION=${ctx.region}`,
18
+ };
19
+ }
20
+ catch (error) {
21
+ if (error instanceof Error && error.name === 'NoSuchEntityException') {
22
+ return { done: false, detail: `${roleName} not deployed yet (the bootstrap stack creates it)` };
23
+ }
24
+ throw error;
25
+ }
26
+ };
27
+ /** Check-only: the GitHub Actions deploy role is declared and deployed, with the values the GitHub Environment needs. */
28
+ export const buildGithubDeployRoleStep = (ctx) => ({
29
+ id: 'github-deploy-role',
30
+ name: 'GitHub Actions deploy role',
31
+ check: () => checkDeployRole(ctx),
32
+ run: async () => {
33
+ const result = await checkDeployRole(ctx);
34
+ if (!result.done) {
35
+ throw new Error(result.detail ?? 'deploy role missing');
36
+ }
37
+ console.log(result.detail);
38
+ },
39
+ });
40
+ //# sourceMappingURL=buildGithubDeployRoleStep.js.map
@@ -0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AE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,QAAQ,oDAAoD,EAAE,CAAC;QAClG,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF,yHAAyH;AACzH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,GAAoB,EAAa,EAAE,CAAC,CAAC;IAC7E,EAAE,EAAE,oBAAoB;IACxB,IAAI,EAAE,4BAA4B;IAClC,KAAK,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC;IACjC,GAAG,EAAE,KAAK,IAAI,EAAE;QACd,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,GAAG,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,qBAAqB,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { awsNamingUtils } from '@qpqjs/actionprocessor-aws';\nimport { qpqConfigAwsUtils } from '@qpqjs/config-aws';\n\nimport { GetRoleCommand, IAMClient } from '@aws-sdk/client-iam';\n\nimport { SetupCheckResult, SetupStep } from '../../../lib/setupStep';\nimport { AwsSetupContext } from './awsSetupContext';\n\n// The role itself is deployed by the bootstrap stack; this step tells you whether the config\n// declares it, whether it exists yet, and what to put in the GitHub Environment once it does.\nconst checkDeployRole = async (ctx: AwsSetupContext): Promise<SetupCheckResult> => {\n const config = qpqConfigAwsUtils.getAwsGithubDeployRoleConfig(ctx.bootstrapQpqConfig);\n if (!config) {\n return { done: false, detail: 'not declared: add defineAwsGithubDeployRole(\"owner/repo\", { ownerId, repositoryId }) to bootstrap.qpq.ts' };\n }\n\n const roleName = awsNamingUtils.getGithubDeployRoleNameFromConfig(ctx.bootstrapQpqConfig);\n const githubEnvironment = config.githubEnvironment ?? ctx.environment;\n try {\n const { Role } = await new IAMClient({ region: ctx.region }).send(new GetRoleCommand({ RoleName: roleName }));\n return {\n done: true,\n detail: `${Role?.Arn}; GitHub Environment '${githubEnvironment}' needs DEPLOY_ROLE_ARN=<that arn> and AWS_REGION=${ctx.region}`,\n };\n } catch (error) {\n if (error instanceof Error && error.name === 'NoSuchEntityException') {\n return { done: false, detail: `${roleName} not deployed yet (the bootstrap stack creates it)` };\n }\n throw error;\n }\n};\n\n/** Check-only: the GitHub Actions deploy role is declared and deployed, with the values the GitHub Environment needs. */\nexport const buildGithubDeployRoleStep = (ctx: AwsSetupContext): SetupStep => ({\n id: 'github-deploy-role',\n name: 'GitHub Actions deploy role',\n check: () => checkDeployRole(ctx),\n run: async () => {\n const result = await checkDeployRole(ctx);\n if (!result.done) {\n throw new Error(result.detail ?? 'deploy role missing');\n }\n console.log(result.detail);\n },\n});\n"]}
@@ -0,0 +1,4 @@
1
+ import { SetupStep } from '../../../lib/setupStep';
2
+ import { AwsSetupContext } from './awsSetupContext';
3
+ /** Check-only: the account's GitHub Actions OIDC provider is declared in account.qpq.ts and deployed. */
4
+ export declare const buildGithubOidcProviderStep: (ctx: AwsSetupContext) => SetupStep;
@@ -0,0 +1,40 @@
1
+ import { qpqConfigAwsUtils } from '@qpqjs/config-aws';
2
+ import { GetOpenIDConnectProviderCommand, IAMClient } from '@aws-sdk/client-iam';
3
+ // The provider is created by the account stack (defineAccountGithubOidcProvider in
4
+ // account.qpq.ts), so this only reports: declared or not, present or not.
5
+ const checkProvider = async (ctx) => {
6
+ const declared = qpqConfigAwsUtils.isAccountGithubOidcProviderDeclared(ctx.accountQpqConfig);
7
+ const arn = qpqConfigAwsUtils.getGithubOidcProviderArn(ctx.accountId);
8
+ let exists = false;
9
+ try {
10
+ await new IAMClient({ region: ctx.region }).send(new GetOpenIDConnectProviderCommand({ OpenIDConnectProviderArn: arn }));
11
+ exists = true;
12
+ }
13
+ catch (error) {
14
+ if (!(error instanceof Error && error.name === 'NoSuchEntityException')) {
15
+ throw error;
16
+ }
17
+ }
18
+ if (!declared) {
19
+ return {
20
+ done: false,
21
+ detail: exists
22
+ ? `${arn} exists but account.qpq.ts does not declare it: add defineAccountGithubOidcProvider() and delete the hand-made provider before deploying the account stack`
23
+ : 'not declared: add defineAccountGithubOidcProvider() to account.qpq.ts (the account stack creates it)',
24
+ };
25
+ }
26
+ return exists ? { done: true, detail: arn } : { done: false, detail: 'declared, not deployed yet (the account stack creates it)' };
27
+ };
28
+ /** Check-only: the account's GitHub Actions OIDC provider is declared in account.qpq.ts and deployed. */
29
+ export const buildGithubOidcProviderStep = (ctx) => ({
30
+ id: 'github-oidc-provider',
31
+ name: 'GitHub Actions OIDC provider',
32
+ check: () => checkProvider(ctx),
33
+ run: async () => {
34
+ const result = await checkProvider(ctx);
35
+ if (!result.done) {
36
+ throw new Error(result.detail ?? 'provider missing');
37
+ }
38
+ },
39
+ });
40
+ //# sourceMappingURL=buildGithubOidcProviderStep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildGithubOidcProviderStep.js","sourceRoot":"","sources":["../../../../../src/platforms/aws/setup/buildGithubOidcProviderStep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,+BAA+B,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKjF,mFAAmF;AACnF,0EAA0E;AAC1E,MAAM,aAAa,GAAG,KAAK,EAAE,GAAoB,EAA6B,EAAE;IAC9E,MAAM,QAAQ,GAAG,iBAAiB,CAAC,mCAAmC,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC7F,MAAM,GAAG,GAAG,iBAAiB,CAAC,wBAAwB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAEtE,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,CAAC;QACH,MAAM,IAAI,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MA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AMClient } from '@aws-sdk/client-iam';\n\nimport { SetupCheckResult, SetupStep } from '../../../lib/setupStep';\nimport { AwsSetupContext } from './awsSetupContext';\n\n// The provider is created by the account stack (defineAccountGithubOidcProvider in\n// account.qpq.ts), so this only reports: declared or not, present or not.\nconst checkProvider = async (ctx: AwsSetupContext): Promise<SetupCheckResult> => {\n const declared = qpqConfigAwsUtils.isAccountGithubOidcProviderDeclared(ctx.accountQpqConfig);\n const arn = qpqConfigAwsUtils.getGithubOidcProviderArn(ctx.accountId);\n\n let exists = false;\n try {\n await new IAMClient({ region: ctx.region }).send(new GetOpenIDConnectProviderCommand({ OpenIDConnectProviderArn: arn }));\n exists = true;\n } catch (error) {\n if (!(error instanceof Error && error.name === 'NoSuchEntityException')) {\n throw error;\n }\n }\n\n if (!declared) {\n return {\n done: false,\n detail: exists\n ? `${arn} exists but account.qpq.ts does not declare it: add defineAccountGithubOidcProvider() and delete the hand-made provider before deploying the account stack`\n : 'not declared: add defineAccountGithubOidcProvider() to account.qpq.ts (the account stack creates it)',\n };\n }\n\n return exists ? { done: true, detail: arn } : { done: false, detail: 'declared, not deployed yet (the account stack creates it)' };\n};\n\n/** Check-only: the account's GitHub Actions OIDC provider is declared in account.qpq.ts and deployed. */\nexport const buildGithubOidcProviderStep = (ctx: AwsSetupContext): SetupStep => ({\n id: 'github-oidc-provider',\n name: 'GitHub Actions OIDC provider',\n check: () => checkProvider(ctx),\n run: async () => {\n const result = await checkProvider(ctx);\n if (!result.done) {\n throw new Error(result.detail ?? 'provider missing');\n }\n },\n});\n"]}
@@ -0,0 +1,4 @@
1
+ import { SetupStep } from '../../../lib/setupStep';
2
+ import { AwsSetupContext } from './awsSetupContext';
3
+ /** Check-only: the Route53 zones the deploy will write records into exist in this account. */
4
+ export declare const buildHostedZonesStep: (ctx: AwsSetupContext) => SetupStep;