@ankhorage/infra 4.1.12 → 5.1.0

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 (528) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +21 -32
  3. package/dist/cli/bin.d.ts +1 -8
  4. package/dist/cli/bin.d.ts.map +1 -1
  5. package/dist/cli/bin.js +2 -34
  6. package/dist/cli/bin.js.map +1 -1
  7. package/dist/cli/commands/destroy.d.ts +11 -0
  8. package/dist/cli/commands/destroy.d.ts.map +1 -0
  9. package/dist/cli/commands/destroy.js +51 -0
  10. package/dist/cli/commands/destroy.js.map +1 -0
  11. package/dist/cli/commands/down.d.ts +11 -0
  12. package/dist/cli/commands/down.d.ts.map +1 -0
  13. package/dist/cli/commands/down.js +27 -0
  14. package/dist/cli/commands/down.js.map +1 -0
  15. package/dist/cli/commands/generate.d.ts +11 -0
  16. package/dist/cli/commands/generate.d.ts.map +1 -0
  17. package/dist/cli/commands/generate.js +29 -0
  18. package/dist/cli/commands/generate.js.map +1 -0
  19. package/dist/cli/commands/outputs.d.ts +11 -0
  20. package/dist/cli/commands/outputs.d.ts.map +1 -0
  21. package/dist/cli/commands/outputs.js +25 -0
  22. package/dist/cli/commands/outputs.js.map +1 -0
  23. package/dist/cli/commands/plan.d.ts +11 -0
  24. package/dist/cli/commands/plan.d.ts.map +1 -0
  25. package/dist/cli/commands/plan.js +19 -0
  26. package/dist/cli/commands/plan.js.map +1 -0
  27. package/dist/cli/commands/status.d.ts +11 -0
  28. package/dist/cli/commands/status.d.ts.map +1 -0
  29. package/dist/cli/commands/status.js +19 -0
  30. package/dist/cli/commands/status.js.map +1 -0
  31. package/dist/cli/commands/up.d.ts +11 -0
  32. package/dist/cli/commands/up.d.ts.map +1 -0
  33. package/dist/cli/commands/up.js +28 -0
  34. package/dist/cli/commands/up.js.map +1 -0
  35. package/dist/cli/commands/validate.d.ts +11 -0
  36. package/dist/cli/commands/validate.d.ts.map +1 -0
  37. package/dist/cli/commands/validate.js +19 -0
  38. package/dist/cli/commands/validate.js.map +1 -0
  39. package/dist/cli/constants.d.ts +66 -0
  40. package/dist/cli/constants.d.ts.map +1 -0
  41. package/dist/cli/constants.js +19 -0
  42. package/dist/cli/constants.js.map +1 -0
  43. package/dist/cli/createDefaultInfraCommandContext.d.ts +4 -0
  44. package/dist/cli/createDefaultInfraCommandContext.d.ts.map +1 -0
  45. package/dist/{commandContext.js → cli/createDefaultInfraCommandContext.js} +4 -3
  46. package/dist/cli/createDefaultInfraCommandContext.js.map +1 -0
  47. package/dist/cli/createInfraRuntimeProvider.d.ts +5 -0
  48. package/dist/cli/createInfraRuntimeProvider.d.ts.map +1 -0
  49. package/dist/cli/createInfraRuntimeProvider.js +22 -0
  50. package/dist/cli/createInfraRuntimeProvider.js.map +1 -0
  51. package/dist/cli/createProviderCommandDescriptors.d.ts +4 -0
  52. package/dist/cli/createProviderCommandDescriptors.d.ts.map +1 -0
  53. package/dist/cli/createProviderCommandDescriptors.js +6 -0
  54. package/dist/cli/createProviderCommandDescriptors.js.map +1 -0
  55. package/dist/cli/findInfraCommand.d.ts +4 -0
  56. package/dist/cli/findInfraCommand.d.ts.map +1 -0
  57. package/dist/cli/findInfraCommand.js +6 -0
  58. package/dist/cli/findInfraCommand.js.map +1 -0
  59. package/dist/cli/index.d.ts +3 -8
  60. package/dist/cli/index.d.ts.map +1 -1
  61. package/dist/cli/index.js +2 -24
  62. package/dist/cli/index.js.map +1 -1
  63. package/dist/cli/renderInfraRootHelp.d.ts +3 -0
  64. package/dist/cli/renderInfraRootHelp.d.ts.map +1 -0
  65. package/dist/cli/renderInfraRootHelp.js +21 -0
  66. package/dist/cli/renderInfraRootHelp.js.map +1 -0
  67. package/dist/cli/renderUnknownInfraCommand.d.ts +3 -0
  68. package/dist/cli/renderUnknownInfraCommand.d.ts.map +1 -0
  69. package/dist/cli/renderUnknownInfraCommand.js +5 -0
  70. package/dist/cli/renderUnknownInfraCommand.js.map +1 -0
  71. package/dist/cli/runInfraCliAsync.d.ts +10 -0
  72. package/dist/cli/runInfraCliAsync.d.ts.map +1 -0
  73. package/dist/cli/runInfraCliAsync.js +34 -0
  74. package/dist/cli/runInfraCliAsync.js.map +1 -0
  75. package/dist/cli/runInfraCommandAsync.d.ts +4 -0
  76. package/dist/cli/runInfraCommandAsync.d.ts.map +1 -0
  77. package/dist/cli/runInfraCommandAsync.js +100 -0
  78. package/dist/cli/runInfraCommandAsync.js.map +1 -0
  79. package/dist/cli/utils/prepareInfraCommandOperationAsync.d.ts +4 -0
  80. package/dist/cli/utils/prepareInfraCommandOperationAsync.d.ts.map +1 -0
  81. package/dist/cli/utils/prepareInfraCommandOperationAsync.js +45 -0
  82. package/dist/cli/utils/prepareInfraCommandOperationAsync.js.map +1 -0
  83. package/dist/cli/utils/requireInfraSuccess.d.ts +7 -0
  84. package/dist/cli/utils/requireInfraSuccess.d.ts.map +1 -0
  85. package/dist/cli/utils/requireInfraSuccess.js +17 -0
  86. package/dist/cli/utils/requireInfraSuccess.js.map +1 -0
  87. package/dist/cli/utils/resolveInfraPersistence.d.ts +4 -0
  88. package/dist/cli/utils/resolveInfraPersistence.d.ts.map +1 -0
  89. package/dist/cli/utils/resolveInfraPersistence.js +17 -0
  90. package/dist/cli/utils/resolveInfraPersistence.js.map +1 -0
  91. package/dist/cli/utils/writeInfraEnvironmentOutputs.d.ts +5 -0
  92. package/dist/cli/utils/writeInfraEnvironmentOutputs.d.ts.map +1 -0
  93. package/dist/cli/utils/writeInfraEnvironmentOutputs.js +16 -0
  94. package/dist/cli/utils/writeInfraEnvironmentOutputs.js.map +1 -0
  95. package/dist/cli/utils/writeInfraStructured.d.ts +4 -0
  96. package/dist/cli/utils/writeInfraStructured.d.ts.map +1 -0
  97. package/dist/cli/utils/writeInfraStructured.js +8 -0
  98. package/dist/cli/utils/writeInfraStructured.js.map +1 -0
  99. package/dist/constants.d.ts +10 -0
  100. package/dist/constants.d.ts.map +1 -0
  101. package/dist/{packageMetadata.js → constants.js} +6 -3
  102. package/dist/constants.js.map +1 -0
  103. package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.d.ts +4 -0
  104. package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.d.ts.map +1 -0
  105. package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.js +35 -0
  106. package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.js.map +1 -0
  107. package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.d.ts +4 -0
  108. package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.d.ts.map +1 -0
  109. package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.js +23 -0
  110. package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.js.map +1 -0
  111. package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.d.ts +4 -0
  112. package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.d.ts.map +1 -0
  113. package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.js +9 -0
  114. package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.js.map +1 -0
  115. package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.d.ts +5 -0
  116. package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.d.ts.map +1 -0
  117. package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.js +28 -0
  118. package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.js.map +1 -0
  119. package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.d.ts +4 -0
  120. package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.d.ts.map +1 -0
  121. package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.js +7 -0
  122. package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.js.map +1 -0
  123. package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.d.ts +7 -0
  124. package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.d.ts.map +1 -0
  125. package/dist/{project.js → features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.js} +10 -34
  126. package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.js.map +1 -0
  127. package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.d.ts +5 -0
  128. package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.d.ts.map +1 -0
  129. package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.js +28 -0
  130. package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.js.map +1 -0
  131. package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.d.ts +4 -0
  132. package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.d.ts.map +1 -0
  133. package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.js +16 -0
  134. package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.js.map +1 -0
  135. package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.d.ts +9 -0
  136. package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.d.ts.map +1 -0
  137. package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.js +2 -0
  138. package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.js.map +1 -0
  139. package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.d.ts +4 -0
  140. package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.d.ts.map +1 -0
  141. package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.js +15 -0
  142. package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.js.map +1 -0
  143. package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.d.ts +4 -0
  144. package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.d.ts.map +1 -0
  145. package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.js +84 -0
  146. package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.js.map +1 -0
  147. package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.d.ts +4 -0
  148. package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.d.ts.map +1 -0
  149. package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.js +55 -0
  150. package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.js.map +1 -0
  151. package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.d.ts +4 -0
  152. package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.d.ts.map +1 -0
  153. package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.js +38 -0
  154. package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.js.map +1 -0
  155. package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.d.ts +4 -0
  156. package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.d.ts.map +1 -0
  157. package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.js +34 -0
  158. package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.js.map +1 -0
  159. package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.d.ts +4 -0
  160. package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.d.ts.map +1 -0
  161. package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.js +57 -0
  162. package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.js.map +1 -0
  163. package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.d.ts +5 -0
  164. package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.d.ts.map +1 -0
  165. package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.js +109 -0
  166. package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.js.map +1 -0
  167. package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.d.ts +6 -0
  168. package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.d.ts.map +1 -0
  169. package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.js +181 -0
  170. package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.js.map +1 -0
  171. package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.d.ts +4 -0
  172. package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.d.ts.map +1 -0
  173. package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.js +68 -0
  174. package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.js.map +1 -0
  175. package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.d.ts +4 -0
  176. package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.d.ts.map +1 -0
  177. package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.js +98 -0
  178. package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.js.map +1 -0
  179. package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.d.ts +5 -0
  180. package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.d.ts.map +1 -0
  181. package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.js +17 -0
  182. package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.js.map +1 -0
  183. package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.d.ts +4 -0
  184. package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.d.ts.map +1 -0
  185. package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.js +13 -0
  186. package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.js.map +1 -0
  187. package/dist/features/environment-lifecycle/composition/createInfraCommandServices.d.ts +4 -0
  188. package/dist/features/environment-lifecycle/composition/createInfraCommandServices.d.ts.map +1 -0
  189. package/dist/features/environment-lifecycle/composition/createInfraCommandServices.js +43 -0
  190. package/dist/features/environment-lifecycle/composition/createInfraCommandServices.js.map +1 -0
  191. package/dist/features/environment-lifecycle/composition/createProjectInfraLifecycle.d.ts +4 -0
  192. package/dist/features/environment-lifecycle/composition/createProjectInfraLifecycle.d.ts.map +1 -0
  193. package/dist/features/environment-lifecycle/composition/createProjectInfraLifecycle.js +123 -0
  194. package/dist/features/environment-lifecycle/composition/createProjectInfraLifecycle.js.map +1 -0
  195. package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.d.ts +4 -0
  196. package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.d.ts.map +1 -0
  197. package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.js +54 -0
  198. package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.js.map +1 -0
  199. package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.d.ts +5 -0
  200. package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.d.ts.map +1 -0
  201. package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.js +39 -0
  202. package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.js.map +1 -0
  203. package/dist/features/environment-lifecycle/utils/appendInfraFailure.d.ts +7 -0
  204. package/dist/features/environment-lifecycle/utils/appendInfraFailure.d.ts.map +1 -0
  205. package/dist/features/environment-lifecycle/utils/appendInfraFailure.js +5 -0
  206. package/dist/features/environment-lifecycle/utils/appendInfraFailure.js.map +1 -0
  207. package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.d.ts +5 -0
  208. package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.d.ts.map +1 -0
  209. package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.js +13 -0
  210. package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.js.map +1 -0
  211. package/dist/features/environment-lifecycle/utils/createInfraFailure.d.ts +4 -0
  212. package/dist/features/environment-lifecycle/utils/createInfraFailure.d.ts.map +1 -0
  213. package/dist/features/environment-lifecycle/utils/createInfraFailure.js +5 -0
  214. package/dist/features/environment-lifecycle/utils/createInfraFailure.js.map +1 -0
  215. package/dist/features/environment-lifecycle/utils/createInfraLedger.d.ts +12 -0
  216. package/dist/features/environment-lifecycle/utils/createInfraLedger.d.ts.map +1 -0
  217. package/dist/features/environment-lifecycle/utils/createInfraLedger.js +14 -0
  218. package/dist/features/environment-lifecycle/utils/createInfraLedger.js.map +1 -0
  219. package/dist/features/environment-lifecycle/utils/infraIdentityKey.d.ts +4 -0
  220. package/dist/features/environment-lifecycle/utils/infraIdentityKey.d.ts.map +1 -0
  221. package/dist/features/environment-lifecycle/utils/infraIdentityKey.js +5 -0
  222. package/dist/features/environment-lifecycle/utils/infraIdentityKey.js.map +1 -0
  223. package/dist/features/environment-lifecycle/utils/isInfraStoredState.d.ts +4 -0
  224. package/dist/features/environment-lifecycle/utils/isInfraStoredState.d.ts.map +1 -0
  225. package/dist/features/environment-lifecycle/utils/isInfraStoredState.js +103 -0
  226. package/dist/features/environment-lifecycle/utils/isInfraStoredState.js.map +1 -0
  227. package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.d.ts +4 -0
  228. package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.d.ts.map +1 -0
  229. package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.js +10 -0
  230. package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.js.map +1 -0
  231. package/dist/features/environment-lifecycle/utils/mergeInfraResources.d.ts +4 -0
  232. package/dist/features/environment-lifecycle/utils/mergeInfraResources.d.ts.map +1 -0
  233. package/dist/features/environment-lifecycle/utils/mergeInfraResources.js +10 -0
  234. package/dist/features/environment-lifecycle/utils/mergeInfraResources.js.map +1 -0
  235. package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.d.ts +3 -0
  236. package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.d.ts.map +1 -0
  237. package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.js +8 -0
  238. package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.js.map +1 -0
  239. package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.d.ts +4 -0
  240. package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.d.ts.map +1 -0
  241. package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.js +11 -0
  242. package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.js.map +1 -0
  243. package/dist/features/environment-lifecycle/utils/resolveProjectFile.d.ts +3 -0
  244. package/dist/features/environment-lifecycle/utils/resolveProjectFile.d.ts.map +1 -0
  245. package/dist/features/environment-lifecycle/utils/resolveProjectFile.js +19 -0
  246. package/dist/features/environment-lifecycle/utils/resolveProjectFile.js.map +1 -0
  247. package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.d.ts +4 -0
  248. package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.d.ts.map +1 -0
  249. package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.js +6 -0
  250. package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.js.map +1 -0
  251. package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.d.ts +4 -0
  252. package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.d.ts.map +1 -0
  253. package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.js +6 -0
  254. package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.js.map +1 -0
  255. package/dist/index.d.ts +16 -6
  256. package/dist/index.d.ts.map +1 -1
  257. package/dist/index.js +14 -15
  258. package/dist/index.js.map +1 -1
  259. package/dist/metadata/index.d.ts +1 -1
  260. package/dist/metadata/index.d.ts.map +1 -1
  261. package/dist/metadata/index.js +1 -1
  262. package/dist/metadata/index.js.map +1 -1
  263. package/dist/project/index.d.ts +8 -5
  264. package/dist/project/index.d.ts.map +1 -1
  265. package/dist/project/index.js +7 -5
  266. package/dist/project/index.js.map +1 -1
  267. package/dist/readme-usage.js +17 -26
  268. package/dist/readme-usage.js.map +1 -1
  269. package/dist/testSupport.d.ts +1 -1
  270. package/dist/testSupport.d.ts.map +1 -1
  271. package/dist/testSupport.js +11 -1
  272. package/dist/testSupport.js.map +1 -1
  273. package/dist/types/infraCli.d.ts +91 -0
  274. package/dist/types/infraCli.d.ts.map +1 -0
  275. package/dist/types/infraCli.js +2 -0
  276. package/dist/types/infraCli.js.map +1 -0
  277. package/dist/types/infraOrchestration.d.ts +84 -0
  278. package/dist/types/infraOrchestration.d.ts.map +1 -0
  279. package/dist/types/infraOrchestration.js +2 -0
  280. package/dist/types/infraOrchestration.js.map +1 -0
  281. package/dist/types/infraProject.d.ts +43 -0
  282. package/dist/types/infraProject.d.ts.map +1 -0
  283. package/dist/types/infraProject.js +2 -0
  284. package/dist/types/infraProject.js.map +1 -0
  285. package/package.json +20 -10
  286. package/src/adapterPackages.integration.test.ts +79 -0
  287. package/src/cli/bin.ts +2 -61
  288. package/src/cli/cli.test.ts +35 -126
  289. package/src/cli/commands/destroy.ts +57 -0
  290. package/src/cli/commands/down.ts +28 -0
  291. package/src/cli/commands/generate.ts +34 -0
  292. package/src/cli/commands/outputs.ts +25 -0
  293. package/src/cli/commands/plan.ts +20 -0
  294. package/src/cli/commands/status.ts +20 -0
  295. package/src/cli/commands/up.ts +29 -0
  296. package/src/cli/commands/validate.ts +20 -0
  297. package/src/cli/constants.ts +19 -0
  298. package/src/cli/createDefaultInfraCommandContext.ts +17 -0
  299. package/src/cli/createInfraRuntimeProvider.ts +35 -0
  300. package/src/cli/createProviderCommandDescriptors.ts +8 -0
  301. package/src/cli/findInfraCommand.ts +7 -0
  302. package/src/cli/index.test.ts +12 -20
  303. package/src/cli/index.ts +7 -49
  304. package/src/cli/renderInfraRootHelp.ts +23 -0
  305. package/src/cli/renderUnknownInfraCommand.ts +4 -0
  306. package/src/cli/runInfraCliAsync.ts +51 -0
  307. package/src/cli/runInfraCommandAsync.ts +114 -0
  308. package/src/cli/utils/prepareInfraCommandOperationAsync.ts +64 -0
  309. package/src/cli/utils/requireInfraSuccess.ts +24 -0
  310. package/src/cli/utils/resolveInfraPersistence.ts +22 -0
  311. package/src/cli/utils/writeInfraEnvironmentOutputs.ts +24 -0
  312. package/src/cli/utils/writeInfraStructured.ts +11 -0
  313. package/src/commands.test.ts +198 -196
  314. package/src/{packageMetadata.ts → constants.ts} +5 -2
  315. package/src/environmentLifecycle.test.ts +193 -0
  316. package/src/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.ts +52 -0
  317. package/src/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.ts +32 -0
  318. package/src/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.ts +10 -0
  319. package/src/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.ts +34 -0
  320. package/src/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.ts +12 -0
  321. package/src/{project.ts → features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.ts} +10 -45
  322. package/src/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.ts +34 -0
  323. package/src/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.ts +21 -0
  324. package/src/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.ts +10 -0
  325. package/src/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.ts +25 -0
  326. package/src/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.ts +119 -0
  327. package/src/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.ts +65 -0
  328. package/src/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.ts +51 -0
  329. package/src/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.ts +41 -0
  330. package/src/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.ts +67 -0
  331. package/src/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.ts +137 -0
  332. package/src/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.ts +257 -0
  333. package/src/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.ts +80 -0
  334. package/src/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.ts +126 -0
  335. package/src/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.ts +25 -0
  336. package/src/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.ts +21 -0
  337. package/src/features/environment-lifecycle/composition/createInfraCommandServices.ts +47 -0
  338. package/src/features/environment-lifecycle/composition/createProjectInfraLifecycle.ts +157 -0
  339. package/src/features/environment-lifecycle/domain/orderInfraPlanActions.ts +64 -0
  340. package/src/features/environment-lifecycle/domain/resolveInfraEnvironment.ts +62 -0
  341. package/src/features/environment-lifecycle/utils/appendInfraFailure.ts +9 -0
  342. package/src/features/environment-lifecycle/utils/createInfraExecutionContext.ts +24 -0
  343. package/src/features/environment-lifecycle/utils/createInfraFailure.ts +6 -0
  344. package/src/features/environment-lifecycle/utils/createInfraLedger.ts +30 -0
  345. package/src/features/environment-lifecycle/utils/infraIdentityKey.ts +6 -0
  346. package/src/features/environment-lifecycle/utils/isInfraStoredState.ts +141 -0
  347. package/src/features/environment-lifecycle/utils/mergeInfraOutputs.ts +14 -0
  348. package/src/features/environment-lifecycle/utils/mergeInfraResources.ts +14 -0
  349. package/src/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.ts +7 -0
  350. package/src/features/environment-lifecycle/utils/resolveInfraStatePath.ts +12 -0
  351. package/src/features/environment-lifecycle/utils/resolveProjectFile.ts +22 -0
  352. package/src/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.ts +15 -0
  353. package/src/features/environment-lifecycle/utils/retainUnchangedAdapterResources.ts +15 -0
  354. package/src/index.test.ts +22 -315
  355. package/src/index.ts +41 -53
  356. package/src/infraComposition.integration.test.ts +128 -0
  357. package/src/infraOperations.test.ts +386 -0
  358. package/src/infraUp.test.ts +260 -0
  359. package/src/metadata/index.ts +1 -1
  360. package/src/package.test.ts +4 -2
  361. package/src/project/index.test.ts +10 -188
  362. package/src/project/index.ts +15 -22
  363. package/src/project.test.ts +39 -189
  364. package/src/projectContractsParser.test.ts +2 -2
  365. package/src/projectInfrastructure.test.ts +121 -167
  366. package/src/projectLifecycle.test.ts +136 -0
  367. package/src/readme-usage.ts +17 -26
  368. package/src/testSupport.ts +12 -2
  369. package/src/types/infraCli.ts +115 -0
  370. package/src/types/infraOrchestration.ts +126 -0
  371. package/src/types/infraProject.ts +58 -0
  372. package/dist/adapters/minikube/auth/index.d.ts +0 -8
  373. package/dist/adapters/minikube/auth/index.d.ts.map +0 -1
  374. package/dist/adapters/minikube/auth/index.js +0 -29
  375. package/dist/adapters/minikube/auth/index.js.map +0 -1
  376. package/dist/adapters/minikube/auth/oauthRuntime.d.ts +0 -4
  377. package/dist/adapters/minikube/auth/oauthRuntime.d.ts.map +0 -1
  378. package/dist/adapters/minikube/auth/oauthRuntime.js +0 -138
  379. package/dist/adapters/minikube/auth/oauthRuntime.js.map +0 -1
  380. package/dist/adapters/minikube/auth/supabase/index.d.ts +0 -7
  381. package/dist/adapters/minikube/auth/supabase/index.d.ts.map +0 -1
  382. package/dist/adapters/minikube/auth/supabase/index.js +0 -232
  383. package/dist/adapters/minikube/auth/supabase/index.js.map +0 -1
  384. package/dist/adapters/minikube/auth/supabase/profile.d.ts +0 -20
  385. package/dist/adapters/minikube/auth/supabase/profile.d.ts.map +0 -1
  386. package/dist/adapters/minikube/auth/supabase/profile.js +0 -452
  387. package/dist/adapters/minikube/auth/supabase/profile.js.map +0 -1
  388. package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.d.ts +0 -7
  389. package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.d.ts.map +0 -1
  390. package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.js +0 -104
  391. package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.js.map +0 -1
  392. package/dist/adapters/minikube/authz/cerbos/index.d.ts +0 -13
  393. package/dist/adapters/minikube/authz/cerbos/index.d.ts.map +0 -1
  394. package/dist/adapters/minikube/authz/cerbos/index.js +0 -382
  395. package/dist/adapters/minikube/authz/cerbos/index.js.map +0 -1
  396. package/dist/adapters/minikube/authz/index.d.ts +0 -9
  397. package/dist/adapters/minikube/authz/index.d.ts.map +0 -1
  398. package/dist/adapters/minikube/authz/index.js +0 -23
  399. package/dist/adapters/minikube/authz/index.js.map +0 -1
  400. package/dist/adapters/minikube/base/index.d.ts +0 -14
  401. package/dist/adapters/minikube/base/index.d.ts.map +0 -1
  402. package/dist/adapters/minikube/base/index.js +0 -3433
  403. package/dist/adapters/minikube/base/index.js.map +0 -1
  404. package/dist/adapters/minikube/base/supabaseMigrations.d.ts +0 -2
  405. package/dist/adapters/minikube/base/supabaseMigrations.d.ts.map +0 -1
  406. package/dist/adapters/minikube/base/supabaseMigrations.js +0 -6
  407. package/dist/adapters/minikube/base/supabaseMigrations.js.map +0 -1
  408. package/dist/adapters/minikube/contracts.d.ts +0 -34
  409. package/dist/adapters/minikube/contracts.d.ts.map +0 -1
  410. package/dist/adapters/minikube/contracts.js +0 -10
  411. package/dist/adapters/minikube/contracts.js.map +0 -1
  412. package/dist/adapters/minikube/index.d.ts +0 -3
  413. package/dist/adapters/minikube/index.d.ts.map +0 -1
  414. package/dist/adapters/minikube/index.js +0 -136
  415. package/dist/adapters/minikube/index.js.map +0 -1
  416. package/dist/adapters/minikube/secrets/index.d.ts +0 -7
  417. package/dist/adapters/minikube/secrets/index.d.ts.map +0 -1
  418. package/dist/adapters/minikube/secrets/index.js +0 -13
  419. package/dist/adapters/minikube/secrets/index.js.map +0 -1
  420. package/dist/adapters/minikube/secrets/supabase-vault/index.d.ts +0 -8
  421. package/dist/adapters/minikube/secrets/supabase-vault/index.d.ts.map +0 -1
  422. package/dist/adapters/minikube/secrets/supabase-vault/index.js +0 -118
  423. package/dist/adapters/minikube/secrets/supabase-vault/index.js.map +0 -1
  424. package/dist/adapters/minikube/storage/index.d.ts +0 -7
  425. package/dist/adapters/minikube/storage/index.d.ts.map +0 -1
  426. package/dist/adapters/minikube/storage/index.js +0 -77
  427. package/dist/adapters/minikube/storage/index.js.map +0 -1
  428. package/dist/adapters/minikube/storage/supabase/index.d.ts +0 -7
  429. package/dist/adapters/minikube/storage/supabase/index.d.ts.map +0 -1
  430. package/dist/adapters/minikube/storage/supabase/index.js +0 -82
  431. package/dist/adapters/minikube/storage/supabase/index.js.map +0 -1
  432. package/dist/authRedirects.d.ts +0 -19
  433. package/dist/authRedirects.d.ts.map +0 -1
  434. package/dist/authRedirects.js +0 -80
  435. package/dist/authRedirects.js.map +0 -1
  436. package/dist/authTargetRedirects.d.ts +0 -12
  437. package/dist/authTargetRedirects.d.ts.map +0 -1
  438. package/dist/authTargetRedirects.js +0 -32
  439. package/dist/authTargetRedirects.js.map +0 -1
  440. package/dist/commandContext.d.ts +0 -12
  441. package/dist/commandContext.d.ts.map +0 -1
  442. package/dist/commandContext.js.map +0 -1
  443. package/dist/commands.d.ts +0 -95
  444. package/dist/commands.d.ts.map +0 -1
  445. package/dist/commands.js +0 -256
  446. package/dist/commands.js.map +0 -1
  447. package/dist/infraValidation.d.ts +0 -4
  448. package/dist/infraValidation.d.ts.map +0 -1
  449. package/dist/infraValidation.js +0 -63
  450. package/dist/infraValidation.js.map +0 -1
  451. package/dist/packageMetadata.d.ts +0 -10
  452. package/dist/packageMetadata.d.ts.map +0 -1
  453. package/dist/packageMetadata.js.map +0 -1
  454. package/dist/project.d.ts +0 -14
  455. package/dist/project.d.ts.map +0 -1
  456. package/dist/project.js.map +0 -1
  457. package/dist/projectDatabase.d.ts +0 -5
  458. package/dist/projectDatabase.d.ts.map +0 -1
  459. package/dist/projectDatabase.js +0 -22
  460. package/dist/projectDatabase.js.map +0 -1
  461. package/dist/projectEnvironment.d.ts +0 -6
  462. package/dist/projectEnvironment.d.ts.map +0 -1
  463. package/dist/projectEnvironment.js +0 -45
  464. package/dist/projectEnvironment.js.map +0 -1
  465. package/dist/projectInfrastructure.d.ts +0 -38
  466. package/dist/projectInfrastructure.d.ts.map +0 -1
  467. package/dist/projectInfrastructure.js +0 -145
  468. package/dist/projectInfrastructure.js.map +0 -1
  469. package/dist/runtime.d.ts +0 -54
  470. package/dist/runtime.d.ts.map +0 -1
  471. package/dist/runtime.js +0 -151
  472. package/dist/runtime.js.map +0 -1
  473. package/dist/secretStore.d.ts +0 -19
  474. package/dist/secretStore.d.ts.map +0 -1
  475. package/dist/secretStore.js +0 -22
  476. package/dist/secretStore.js.map +0 -1
  477. package/dist/types.d.ts +0 -70
  478. package/dist/types.d.ts.map +0 -1
  479. package/dist/types.js +0 -2
  480. package/dist/types.js.map +0 -1
  481. package/src/adapters/minikube/README.md +0 -115
  482. package/src/adapters/minikube/appRuntimeServing.test.ts +0 -28
  483. package/src/adapters/minikube/auth/index.ts +0 -40
  484. package/src/adapters/minikube/auth/oauthRuntime.ts +0 -163
  485. package/src/adapters/minikube/auth/supabase/index.test.ts +0 -227
  486. package/src/adapters/minikube/auth/supabase/index.ts +0 -293
  487. package/src/adapters/minikube/auth/supabase/oauthRuntime.test.ts +0 -154
  488. package/src/adapters/minikube/auth/supabase/profile.integration.test.ts +0 -1028
  489. package/src/adapters/minikube/auth/supabase/profile.ts +0 -526
  490. package/src/adapters/minikube/auth/supabase/providerAssignments.test.ts +0 -36
  491. package/src/adapters/minikube/auth/targetAwareOAuthRuntime.test.ts +0 -83
  492. package/src/adapters/minikube/auth/targetAwareOAuthRuntime.ts +0 -136
  493. package/src/adapters/minikube/authz/cerbos/index.ts +0 -486
  494. package/src/adapters/minikube/authz/index.ts +0 -32
  495. package/src/adapters/minikube/base/appImageBuild.test.ts +0 -352
  496. package/src/adapters/minikube/base/index.test.ts +0 -693
  497. package/src/adapters/minikube/base/index.ts +0 -3763
  498. package/src/adapters/minikube/base/portForwardRuntime.test.ts +0 -624
  499. package/src/adapters/minikube/base/supabaseMigrations.test.ts +0 -168
  500. package/src/adapters/minikube/base/supabaseMigrations.ts +0 -5
  501. package/src/adapters/minikube/base/twoAppIsolation.integration.test.ts +0 -898
  502. package/src/adapters/minikube/base/upgradeReconciliation.test.ts +0 -135
  503. package/src/adapters/minikube/contracts.ts +0 -46
  504. package/src/adapters/minikube/index.ts +0 -172
  505. package/src/adapters/minikube/secrets/index.test.ts +0 -147
  506. package/src/adapters/minikube/secrets/index.ts +0 -19
  507. package/src/adapters/minikube/secrets/supabase-vault/index.ts +0 -139
  508. package/src/adapters/minikube/storage/index.ts +0 -91
  509. package/src/adapters/minikube/storage/supabase/index.ts +0 -108
  510. package/src/apiInfrastructure.test.ts +0 -69
  511. package/src/authRedirects.test.ts +0 -63
  512. package/src/authRedirects.ts +0 -113
  513. package/src/authTargetRedirects.test.ts +0 -62
  514. package/src/authTargetRedirects.ts +0 -46
  515. package/src/commandContext.ts +0 -27
  516. package/src/commands.ts +0 -404
  517. package/src/generatedApiLedgerCleanup.test.ts +0 -72
  518. package/src/infraApiValidation.test.ts +0 -42
  519. package/src/infraValidation.ts +0 -99
  520. package/src/minikubeImageLifecycle.test.ts +0 -35
  521. package/src/projectDatabase.ts +0 -27
  522. package/src/projectEnvironment.ts +0 -51
  523. package/src/projectInfrastructure.ts +0 -221
  524. package/src/runtime.test.ts +0 -124
  525. package/src/runtime.ts +0 -234
  526. package/src/secretStore.test.ts +0 -76
  527. package/src/secretStore.ts +0 -44
  528. package/src/types.ts +0 -82
@@ -1,51 +0,0 @@
1
- import { promises as fs } from 'fs';
2
- import path from 'path';
3
-
4
- export async function readProjectInfrastructureEnvironment(args: {
5
- readonly keys: readonly string[];
6
- readonly projectPath: string;
7
- readonly target: string;
8
- }): Promise<Readonly<Record<string, string>>> {
9
- const infraRoot = path.join(args.projectPath, 'infra', args.target);
10
- const envPath = path.join(infraRoot, '.env');
11
- const fallbackPath = path.join(infraRoot, '.env.example');
12
- const sourcePath = (await pathExists(envPath)) ? envPath : fallbackPath;
13
- const environment = await readEnvironmentFile(sourcePath);
14
- const selected: Record<string, string> = {};
15
-
16
- for (const key of new Set(args.keys)) {
17
- const value = environment.get(key);
18
- if (value !== undefined) selected[key] = value;
19
- }
20
-
21
- return selected;
22
- }
23
-
24
- async function readEnvironmentFile(filePath: string): Promise<Map<string, string>> {
25
- const out = new Map<string, string>();
26
- const content = await fs.readFile(filePath, 'utf8');
27
-
28
- for (const line of content.split(/\r?\n/u)) {
29
- const trimmed = line.trim();
30
- if (!trimmed || trimmed.startsWith('#')) continue;
31
- const separator = trimmed.indexOf('=');
32
- if (separator <= 0) continue;
33
- const key = trimmed.slice(0, separator).trim();
34
- const value = trimmed
35
- .slice(separator + 1)
36
- .trim()
37
- .replace(/^['"]|['"]$/g, '');
38
- out.set(key, value);
39
- }
40
-
41
- return out;
42
- }
43
-
44
- async function pathExists(filePath: string): Promise<boolean> {
45
- try {
46
- await fs.access(filePath);
47
- return true;
48
- } catch {
49
- return false;
50
- }
51
- }
@@ -1,221 +0,0 @@
1
- import type { AppManifest } from '@ankhorage/contracts';
2
- import { promises as fs } from 'fs';
3
- import path from 'path';
4
-
5
- import { generateInfrastructure } from './index.js';
6
- import { validateInfraSupport } from './infraValidation.js';
7
-
8
- const INFRA_LEDGER_RELATIVE_PATH = '.ankh/infra-ledger.json';
9
- const STUDIO_PROJECT_ID = 'studio';
10
-
11
- interface InfraLedger {
12
- readonly schemaVersion: 1;
13
- readonly generatedAt: string;
14
- readonly target: string;
15
- readonly files: readonly string[];
16
- readonly warnings: readonly string[];
17
- }
18
-
19
- export interface InfraSyncResult {
20
- readonly generated: number;
21
- readonly removed: number;
22
- readonly warnings: readonly string[];
23
- readonly skipped?: {
24
- readonly reason: string;
25
- };
26
- }
27
-
28
- export interface InfraProjectInspection {
29
- readonly generated: boolean;
30
- readonly generatedAt: string | null;
31
- readonly hasDeployment: boolean;
32
- readonly target: string | null;
33
- readonly trackedFiles: number;
34
- readonly warnings: readonly string[];
35
- readonly skipped?: {
36
- readonly reason: string;
37
- };
38
- }
39
-
40
- export async function syncProjectInfrastructure(args: {
41
- readonly generateInfrastructureImpl?: typeof generateInfrastructure;
42
- readonly manifest: AppManifest;
43
- readonly projectId: string;
44
- readonly projectPath: string;
45
- }): Promise<InfraSyncResult> {
46
- const supportWarnings = validateInfraSupport(args.manifest.infra);
47
-
48
- if (args.projectId === STUDIO_PROJECT_ID) {
49
- return {
50
- generated: 0,
51
- removed: 0,
52
- warnings: supportWarnings,
53
- skipped: {
54
- reason: 'apps/studio is the dashboard and is not a generated app target.',
55
- },
56
- };
57
- }
58
-
59
- const previousLedger = await readInfraLedger(args.projectPath);
60
- const previousFiles = new Set(previousLedger?.files ?? []);
61
-
62
- if (args.manifest.infra.deployment === undefined) {
63
- const removed = await removeFiles(args.projectPath, previousFiles);
64
- await removeInfraLedger(args.projectPath);
65
- return {
66
- generated: 0,
67
- removed,
68
- warnings: supportWarnings,
69
- };
70
- }
71
-
72
- const generated = (args.generateInfrastructureImpl ?? generateInfrastructure)(
73
- args.manifest.infra,
74
- {
75
- namespaceHint: args.projectId,
76
- appManifest: args.manifest,
77
- },
78
- );
79
- const combinedWarnings = uniqueStrings([...supportWarnings, ...generated.warnings]);
80
- const nextFiles = new Set<string>();
81
-
82
- for (const file of generated.files) {
83
- const outputPath = resolveProjectFile(args.projectPath, file.path);
84
- await fs.mkdir(path.dirname(outputPath), { recursive: true });
85
- await fs.writeFile(outputPath, file.content, 'utf8');
86
-
87
- if (file.executable === true) {
88
- await fs.chmod(outputPath, 0o755);
89
- }
90
-
91
- nextFiles.add(file.path);
92
- }
93
-
94
- const staleFiles = new Set([...previousFiles].filter((filePath) => !nextFiles.has(filePath)));
95
- const removed = await removeFiles(args.projectPath, staleFiles);
96
-
97
- await writeInfraLedger(args.projectPath, {
98
- schemaVersion: 1,
99
- generatedAt: new Date().toISOString(),
100
- target: generated.meta.target,
101
- files: [...nextFiles].sort(),
102
- warnings: combinedWarnings,
103
- });
104
-
105
- return {
106
- generated: generated.files.length,
107
- removed,
108
- warnings: combinedWarnings,
109
- };
110
- }
111
-
112
- export async function inspectProjectInfrastructure(args: {
113
- readonly manifest: AppManifest;
114
- readonly projectId: string;
115
- readonly projectPath: string;
116
- }): Promise<InfraProjectInspection> {
117
- const supportWarnings = validateInfraSupport(args.manifest.infra);
118
-
119
- if (args.projectId === STUDIO_PROJECT_ID) {
120
- return {
121
- generated: false,
122
- generatedAt: null,
123
- hasDeployment: false,
124
- target: null,
125
- trackedFiles: 0,
126
- warnings: supportWarnings,
127
- skipped: {
128
- reason: 'apps/studio is the dashboard and is not a generated app target.',
129
- },
130
- };
131
- }
132
-
133
- const ledger = await readInfraLedger(args.projectPath);
134
- return {
135
- generated: ledger !== null,
136
- generatedAt: ledger?.generatedAt ?? null,
137
- hasDeployment: args.manifest.infra.deployment !== undefined,
138
- target: args.manifest.infra.deployment?.target ?? ledger?.target ?? null,
139
- trackedFiles: ledger?.files.length ?? 0,
140
- warnings: uniqueStrings([...supportWarnings, ...(ledger?.warnings ?? [])]),
141
- };
142
- }
143
-
144
- export async function resolveProjectInfrastructureTarget(args: {
145
- readonly manifest: AppManifest;
146
- readonly projectPath: string;
147
- }): Promise<string | null> {
148
- const manifestTarget = args.manifest.infra.deployment?.target;
149
- if (manifestTarget !== undefined) {
150
- return manifestTarget;
151
- }
152
-
153
- const ledger = await readInfraLedger(args.projectPath);
154
- return ledger?.target ?? null;
155
- }
156
-
157
- export function resolveProjectFile(projectPath: string, filePath: string): string {
158
- const rootPath = path.resolve(projectPath);
159
- const resolvedPath = path.resolve(rootPath, filePath);
160
- const relativePath = path.relative(rootPath, resolvedPath);
161
-
162
- if (relativePath.startsWith('..') || path.isAbsolute(relativePath)) {
163
- throw new Error(`Invalid infra output path outside project root: ${filePath}`);
164
- }
165
-
166
- return resolvedPath;
167
- }
168
-
169
- async function readInfraLedger(projectPath: string): Promise<InfraLedger | null> {
170
- const ledgerPath = path.join(projectPath, INFRA_LEDGER_RELATIVE_PATH);
171
-
172
- try {
173
- const rawLedger = await fs.readFile(ledgerPath, 'utf8');
174
- const parsedLedger: unknown = JSON.parse(rawLedger);
175
- return isInfraLedger(parsedLedger) ? parsedLedger : null;
176
- } catch {
177
- return null;
178
- }
179
- }
180
-
181
- async function writeInfraLedger(projectPath: string, ledger: InfraLedger): Promise<void> {
182
- const ledgerPath = path.join(projectPath, INFRA_LEDGER_RELATIVE_PATH);
183
- await fs.mkdir(path.dirname(ledgerPath), { recursive: true });
184
- await fs.writeFile(ledgerPath, `${JSON.stringify(ledger, null, 2)}\n`, 'utf8');
185
- }
186
-
187
- async function removeInfraLedger(projectPath: string): Promise<void> {
188
- await fs.rm(path.join(projectPath, INFRA_LEDGER_RELATIVE_PATH), { force: true });
189
- }
190
-
191
- async function removeFiles(projectPath: string, files: ReadonlySet<string>): Promise<number> {
192
- let removedFiles = 0;
193
-
194
- for (const filePath of files) {
195
- await fs.rm(resolveProjectFile(projectPath, filePath), { force: true });
196
- removedFiles += 1;
197
- }
198
-
199
- return removedFiles;
200
- }
201
-
202
- function isInfraLedger(value: unknown): value is InfraLedger {
203
- return (
204
- isRecord(value) &&
205
- value.schemaVersion === 1 &&
206
- typeof value.generatedAt === 'string' &&
207
- typeof value.target === 'string' &&
208
- Array.isArray(value.files) &&
209
- value.files.every((filePath) => typeof filePath === 'string') &&
210
- Array.isArray(value.warnings) &&
211
- value.warnings.every((warning) => typeof warning === 'string')
212
- );
213
- }
214
-
215
- function isRecord(value: unknown): value is Record<string, unknown> {
216
- return typeof value === 'object' && value !== null;
217
- }
218
-
219
- function uniqueStrings(values: readonly string[]): readonly string[] {
220
- return [...new Set(values)];
221
- }
@@ -1,124 +0,0 @@
1
- import { afterEach, describe, expect, test } from 'bun:test';
2
- import { promises as fs } from 'fs';
3
- import os from 'os';
4
- import path from 'path';
5
-
6
- import {
7
- InfraScriptExecutionError,
8
- resolveProjectInfraScriptPath,
9
- runProjectInfraScript,
10
- } from './runtime.js';
11
- import { createCapturedCommandContext } from './testSupport.js';
12
-
13
- const tempRoots = new Set<string>();
14
-
15
- afterEach(async () => {
16
- await Promise.all(
17
- [...tempRoots].map((rootPath) => fs.rm(rootPath, { force: true, recursive: true })),
18
- );
19
- tempRoots.clear();
20
- });
21
-
22
- describe('runtime scripts', () => {
23
- test('resolves minikube lifecycle scripts under the project infra directory', () => {
24
- expect(
25
- resolveProjectInfraScriptPath({
26
- projectPath: '/workspace/apps/shop',
27
- script: 'status',
28
- target: 'minikube',
29
- }),
30
- ).toBe('/workspace/apps/shop/infra/minikube/scripts/status.sh');
31
- });
32
-
33
- test('streams script output to the command context', async () => {
34
- const projectPath = await fs.mkdtemp(path.join(os.tmpdir(), 'infra-runtime-'));
35
- tempRoots.add(projectPath);
36
- const scriptDir = path.join(projectPath, 'infra/minikube/scripts');
37
- await fs.mkdir(scriptDir, { recursive: true });
38
- await fs.writeFile(
39
- path.join(scriptDir, 'status.sh'),
40
- '#!/usr/bin/env bash\necho status-ok\necho status-warn 1>&2\n',
41
- 'utf8',
42
- );
43
-
44
- const captured = createCapturedCommandContext(projectPath);
45
-
46
- await runProjectInfraScript({
47
- context: captured.context,
48
- projectId: 'shop',
49
- projectPath,
50
- script: 'status',
51
- target: 'minikube',
52
- });
53
-
54
- expect(captured.stdout.value).toContain('status-ok');
55
- expect(captured.stderr.value).toContain('status-warn');
56
- });
57
-
58
- test('reports missing scripts clearly', async () => {
59
- const projectPath = await fs.mkdtemp(path.join(os.tmpdir(), 'infra-missing-'));
60
- tempRoots.add(projectPath);
61
- const captured = createCapturedCommandContext(projectPath);
62
-
63
- await expectRejectMessage(
64
- runProjectInfraScript({
65
- context: captured.context,
66
- projectId: 'shop',
67
- projectPath,
68
- script: 'up',
69
- target: 'minikube',
70
- }),
71
- 'Run infra generate for project',
72
- );
73
- });
74
-
75
- test('wraps non-zero script exits in InfraScriptExecutionError', async () => {
76
- const projectPath = await fs.mkdtemp(path.join(os.tmpdir(), 'infra-error-'));
77
- tempRoots.add(projectPath);
78
- const scriptDir = path.join(projectPath, 'infra/minikube/scripts');
79
- await fs.mkdir(scriptDir, { recursive: true });
80
- await fs.writeFile(
81
- path.join(scriptDir, 'down.sh'),
82
- '#!/usr/bin/env bash\necho boom 1>&2\nexit 7\n',
83
- 'utf8',
84
- );
85
-
86
- const captured = createCapturedCommandContext(projectPath);
87
-
88
- try {
89
- await runProjectInfraScript({
90
- context: captured.context,
91
- projectId: 'shop',
92
- projectPath,
93
- script: 'down',
94
- target: 'minikube',
95
- });
96
- throw new Error('Expected runtime script to fail.');
97
- } catch (error) {
98
- expect(error).toBeInstanceOf(InfraScriptExecutionError);
99
- }
100
- });
101
-
102
- test('rejects unsupported deployment targets', () => {
103
- expect(() =>
104
- resolveProjectInfraScriptPath({
105
- projectPath: '/workspace/apps/shop',
106
- script: 'status',
107
- target: 'aws',
108
- }),
109
- ).toThrow('Unsupported deployment target for infra scripts');
110
- });
111
- });
112
-
113
- async function expectRejectMessage(promise: Promise<unknown>, text: string): Promise<void> {
114
- let didReject = false;
115
-
116
- try {
117
- await promise;
118
- } catch (error) {
119
- didReject = true;
120
- expect(error instanceof Error ? error.message : String(error)).toContain(text);
121
- }
122
-
123
- expect(didReject).toBe(true);
124
- }
package/src/runtime.ts DELETED
@@ -1,234 +0,0 @@
1
- import { spawn } from 'child_process';
2
- import { promises as fs } from 'fs';
3
- import path from 'path';
4
-
5
- import type { InfraCommandContext } from './commandContext.js';
6
- import { readProjectInfrastructureEnvironment } from './projectEnvironment.js';
7
-
8
- export type InfraLifecycleScript = 'destroy' | 'down' | 'port-forward' | 'reset' | 'status' | 'up';
9
-
10
- export interface InfraScriptOutput {
11
- readonly stderr: string;
12
- readonly stdout: string;
13
- }
14
-
15
- export interface InfraPortForwardInfo {
16
- readonly localPort: number;
17
- readonly url: string;
18
- }
19
-
20
- export class InfraScriptExecutionError extends Error {
21
- readonly exitCode: number | null;
22
- readonly stderr: string;
23
- readonly stdout: string;
24
-
25
- constructor(args: {
26
- readonly exitCode: number | null;
27
- readonly message: string;
28
- readonly stderr: string;
29
- readonly stdout: string;
30
- }) {
31
- super(args.message);
32
- this.name = 'InfraScriptExecutionError';
33
- this.exitCode = args.exitCode;
34
- this.stderr = args.stderr;
35
- this.stdout = args.stdout;
36
- }
37
- }
38
-
39
- export async function runProjectInfrastructureLifecycle(args: {
40
- readonly args?: readonly string[];
41
- readonly env?: Readonly<Record<string, string | undefined>>;
42
- readonly onStderr?: (chunk: string) => void;
43
- readonly onStdout?: (chunk: string) => void;
44
- readonly projectId: string;
45
- readonly projectPath: string;
46
- readonly script: InfraLifecycleScript;
47
- readonly target: string;
48
- }): Promise<InfraScriptOutput> {
49
- const scriptPath = resolveProjectInfraScriptPath(args);
50
- if (!(await pathExists(scriptPath))) {
51
- throw new Error(
52
- `Infra script not found: ${scriptPath}. Run infra generate for project '${args.projectId}' first.`,
53
- );
54
- }
55
-
56
- return runShellScript({
57
- args: args.args ?? [],
58
- env: args.env ?? process.env,
59
- onStderr: args.onStderr,
60
- onStdout: args.onStdout,
61
- scriptPath,
62
- });
63
- }
64
-
65
- export async function resolveProjectInfrastructurePortForward(args: {
66
- readonly projectPath: string;
67
- readonly target: string;
68
- }): Promise<InfraPortForwardInfo> {
69
- const environment = await readProjectInfrastructureEnvironment({
70
- keys: ['APP_PORT_FORWARD_LOCAL_PORT'],
71
- projectPath: args.projectPath,
72
- target: args.target,
73
- });
74
- const localPort = parsePositivePort(environment.APP_PORT_FORWARD_LOCAL_PORT);
75
-
76
- if (localPort === null) {
77
- throw new Error(
78
- 'Generated Infra did not provide a valid APP_PORT_FORWARD_LOCAL_PORT. Regenerate infrastructure first.',
79
- );
80
- }
81
-
82
- return {
83
- localPort,
84
- url: `http://127.0.0.1:${localPort}`,
85
- };
86
- }
87
-
88
- /** Ensures the generated host forwards required by a running application are active. */
89
- export async function ensureProjectInfrastructureRuntime(args: {
90
- readonly projectId: string;
91
- readonly projectPath: string;
92
- readonly target: string;
93
- }): Promise<InfraScriptOutput> {
94
- try {
95
- return await runProjectInfrastructureLifecycle({
96
- args: ['start', 'runtime'],
97
- projectId: args.projectId,
98
- projectPath: args.projectPath,
99
- script: 'port-forward',
100
- target: args.target,
101
- });
102
- } catch (error) {
103
- if (!(error instanceof InfraScriptExecutionError)) {
104
- throw error;
105
- }
106
-
107
- const detail = error.stderr.trim() || error.stdout.trim();
108
- throw new InfraScriptExecutionError({
109
- exitCode: error.exitCode,
110
- message: `Failed to ensure infrastructure runtime for project '${args.projectId}'${
111
- detail.length > 0 ? `: ${detail}` : '.'
112
- }`,
113
- stderr: error.stderr,
114
- stdout: error.stdout,
115
- });
116
- }
117
- }
118
-
119
- export async function runProjectInfraScript(args: {
120
- readonly context: InfraCommandContext;
121
- readonly projectId: string;
122
- readonly projectPath: string;
123
- readonly script: InfraLifecycleScript;
124
- readonly target: string;
125
- }): Promise<void> {
126
- await runProjectInfrastructureLifecycle({
127
- env: args.context.env,
128
- onStderr: (chunk) => args.context.writeStderr(chunk),
129
- onStdout: (chunk) => args.context.writeStdout(chunk),
130
- projectId: args.projectId,
131
- projectPath: args.projectPath,
132
- script: args.script,
133
- target: args.target,
134
- });
135
- }
136
-
137
- export function resolveProjectInfraScriptPath(args: {
138
- readonly projectPath: string;
139
- readonly script: InfraLifecycleScript;
140
- readonly target: string;
141
- }): string {
142
- return path.join(args.projectPath, getInfraScriptsDirectory(args.target), `${args.script}.sh`);
143
- }
144
-
145
- function getInfraScriptsDirectory(target: string): string {
146
- switch (target) {
147
- case 'minikube':
148
- return 'infra/minikube/scripts';
149
- default:
150
- throw new Error(`Unsupported deployment target for infra scripts: ${target}`);
151
- }
152
- }
153
-
154
- async function runShellScript(args: {
155
- readonly args: readonly string[];
156
- readonly env: Readonly<Record<string, string | undefined>>;
157
- readonly onStderr?: (chunk: string) => void;
158
- readonly onStdout?: (chunk: string) => void;
159
- readonly scriptPath: string;
160
- }): Promise<InfraScriptOutput> {
161
- return new Promise<InfraScriptOutput>((resolve, reject) => {
162
- const child = spawn('bash', [args.scriptPath, ...args.args], {
163
- cwd: path.dirname(args.scriptPath),
164
- env: { ...args.env },
165
- stdio: ['ignore', 'pipe', 'pipe'],
166
- });
167
-
168
- let stdout = '';
169
- let stderr = '';
170
- child.stdout.setEncoding('utf8');
171
- child.stderr.setEncoding('utf8');
172
- child.stdout.on('data', (chunk: string) => {
173
- stdout += chunk;
174
- args.onStdout?.(chunk);
175
- });
176
- child.stderr.on('data', (chunk: string) => {
177
- stderr += chunk;
178
- args.onStderr?.(chunk);
179
- });
180
- child.once('error', (error) =>
181
- reject(createStartError(args.scriptPath, error, stdout, stderr)),
182
- );
183
- child.once('close', (exitCode) => {
184
- if (exitCode === 0) {
185
- resolve({ stderr, stdout });
186
- return;
187
- }
188
- reject(createExitError(args.scriptPath, exitCode, stdout, stderr));
189
- });
190
- });
191
- }
192
-
193
- function createStartError(
194
- scriptPath: string,
195
- error: Error,
196
- stdout: string,
197
- stderr: string,
198
- ): InfraScriptExecutionError {
199
- return new InfraScriptExecutionError({
200
- exitCode: null,
201
- message: `Failed to start infra script '${scriptPath}': ${error.message}`,
202
- stderr,
203
- stdout,
204
- });
205
- }
206
-
207
- function createExitError(
208
- scriptPath: string,
209
- exitCode: number | null,
210
- stdout: string,
211
- stderr: string,
212
- ): InfraScriptExecutionError {
213
- return new InfraScriptExecutionError({
214
- exitCode,
215
- message: `Infra script '${scriptPath}' exited with code ${exitCode ?? 'unknown'}.`,
216
- stderr,
217
- stdout,
218
- });
219
- }
220
-
221
- function parsePositivePort(value: string | undefined): number | null {
222
- if (value === undefined) return null;
223
- const parsed = Number.parseInt(value.trim(), 10);
224
- return Number.isInteger(parsed) && parsed >= 1 && parsed <= 65_535 ? parsed : null;
225
- }
226
-
227
- async function pathExists(filePath: string): Promise<boolean> {
228
- try {
229
- await fs.access(filePath);
230
- return true;
231
- } catch {
232
- return false;
233
- }
234
- }
@@ -1,76 +0,0 @@
1
- import type {
2
- SupabaseVaultQueryResult,
3
- SupabaseVaultSqlClient,
4
- SupabaseVaultSqlExecutor,
5
- } from '@ankhorage/supabase-vault';
6
- import { describe, expect, test } from 'bun:test';
7
-
8
- import { createInfraSecretStoreAdapter } from './secretStore';
9
-
10
- class FakeSupabaseVaultClient implements SupabaseVaultSqlClient {
11
- query<TRow extends Record<string, unknown>>(): Promise<SupabaseVaultQueryResult<TRow>> {
12
- return Promise.resolve({ rows: [] });
13
- }
14
-
15
- transaction<TResult>(
16
- operation: (executor: SupabaseVaultSqlExecutor) => Promise<TResult>,
17
- ): Promise<TResult> {
18
- return operation(this);
19
- }
20
- }
21
-
22
- describe('createInfraSecretStoreAdapter', () => {
23
- test('returns null when the manifest does not select a secret store', () => {
24
- expect(
25
- createInfraSecretStoreAdapter({
26
- manifest: {},
27
- providers: {},
28
- }),
29
- ).toBeNull();
30
- });
31
-
32
- test('creates the released Supabase Vault adapter from trusted options', () => {
33
- const adapter = createInfraSecretStoreAdapter({
34
- manifest: {
35
- secretStore: {
36
- provider: 'supabase-vault',
37
- },
38
- },
39
- providers: {
40
- supabaseVault: {
41
- client: new FakeSupabaseVaultClient(),
42
- },
43
- },
44
- });
45
-
46
- expect(adapter).not.toBeNull();
47
- expect(typeof adapter?.list).toBe('function');
48
- expect(typeof adapter?.resolve).toBe('function');
49
- });
50
-
51
- test('requires trusted provider bootstrap options', () => {
52
- expect(() =>
53
- createInfraSecretStoreAdapter({
54
- manifest: {
55
- secretStore: {
56
- provider: 'supabase-vault',
57
- },
58
- },
59
- providers: {},
60
- }),
61
- ).toThrow('requires trusted Supabase Vault adapter options');
62
- });
63
-
64
- test('rejects unknown providers instead of silently falling back', () => {
65
- expect(() =>
66
- createInfraSecretStoreAdapter({
67
- manifest: {
68
- secretStore: {
69
- provider: 'aws-secrets-manager',
70
- },
71
- },
72
- providers: {},
73
- }),
74
- ).toThrow('Unsupported secret-store provider');
75
- });
76
- });