@ankhorage/infra 4.1.10 → 5.0.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.
- package/CHANGELOG.md +24 -0
- package/README.md +21 -32
- package/dist/cli/bin.d.ts +1 -8
- package/dist/cli/bin.d.ts.map +1 -1
- package/dist/cli/bin.js +2 -34
- package/dist/cli/bin.js.map +1 -1
- package/dist/cli/commands/destroy.d.ts +11 -0
- package/dist/cli/commands/destroy.d.ts.map +1 -0
- package/dist/cli/commands/destroy.js +51 -0
- package/dist/cli/commands/destroy.js.map +1 -0
- package/dist/cli/commands/down.d.ts +11 -0
- package/dist/cli/commands/down.d.ts.map +1 -0
- package/dist/cli/commands/down.js +27 -0
- package/dist/cli/commands/down.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +11 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +29 -0
- package/dist/cli/commands/generate.js.map +1 -0
- package/dist/cli/commands/outputs.d.ts +11 -0
- package/dist/cli/commands/outputs.d.ts.map +1 -0
- package/dist/cli/commands/outputs.js +25 -0
- package/dist/cli/commands/outputs.js.map +1 -0
- package/dist/cli/commands/plan.d.ts +11 -0
- package/dist/cli/commands/plan.d.ts.map +1 -0
- package/dist/cli/commands/plan.js +19 -0
- package/dist/cli/commands/plan.js.map +1 -0
- package/dist/cli/commands/status.d.ts +11 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +19 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/up.d.ts +11 -0
- package/dist/cli/commands/up.d.ts.map +1 -0
- package/dist/cli/commands/up.js +28 -0
- package/dist/cli/commands/up.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +11 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +19 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/constants.d.ts +66 -0
- package/dist/cli/constants.d.ts.map +1 -0
- package/dist/cli/constants.js +19 -0
- package/dist/cli/constants.js.map +1 -0
- package/dist/cli/createDefaultInfraCommandContext.d.ts +4 -0
- package/dist/cli/createDefaultInfraCommandContext.d.ts.map +1 -0
- package/dist/{commandContext.js → cli/createDefaultInfraCommandContext.js} +4 -3
- package/dist/cli/createDefaultInfraCommandContext.js.map +1 -0
- package/dist/cli/createInfraRuntimeProvider.d.ts +5 -0
- package/dist/cli/createInfraRuntimeProvider.d.ts.map +1 -0
- package/dist/cli/createInfraRuntimeProvider.js +22 -0
- package/dist/cli/createInfraRuntimeProvider.js.map +1 -0
- package/dist/cli/createProviderCommandDescriptors.d.ts +4 -0
- package/dist/cli/createProviderCommandDescriptors.d.ts.map +1 -0
- package/dist/cli/createProviderCommandDescriptors.js +6 -0
- package/dist/cli/createProviderCommandDescriptors.js.map +1 -0
- package/dist/cli/findInfraCommand.d.ts +4 -0
- package/dist/cli/findInfraCommand.d.ts.map +1 -0
- package/dist/cli/findInfraCommand.js +6 -0
- package/dist/cli/findInfraCommand.js.map +1 -0
- package/dist/cli/index.d.ts +3 -8
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -24
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/renderInfraRootHelp.d.ts +3 -0
- package/dist/cli/renderInfraRootHelp.d.ts.map +1 -0
- package/dist/cli/renderInfraRootHelp.js +21 -0
- package/dist/cli/renderInfraRootHelp.js.map +1 -0
- package/dist/cli/renderUnknownInfraCommand.d.ts +3 -0
- package/dist/cli/renderUnknownInfraCommand.d.ts.map +1 -0
- package/dist/cli/renderUnknownInfraCommand.js +5 -0
- package/dist/cli/renderUnknownInfraCommand.js.map +1 -0
- package/dist/cli/runInfraCliAsync.d.ts +10 -0
- package/dist/cli/runInfraCliAsync.d.ts.map +1 -0
- package/dist/cli/runInfraCliAsync.js +34 -0
- package/dist/cli/runInfraCliAsync.js.map +1 -0
- package/dist/cli/runInfraCommandAsync.d.ts +4 -0
- package/dist/cli/runInfraCommandAsync.d.ts.map +1 -0
- package/dist/cli/runInfraCommandAsync.js +100 -0
- package/dist/cli/runInfraCommandAsync.js.map +1 -0
- package/dist/cli/utils/prepareInfraCommandOperationAsync.d.ts +4 -0
- package/dist/cli/utils/prepareInfraCommandOperationAsync.d.ts.map +1 -0
- package/dist/cli/utils/prepareInfraCommandOperationAsync.js +45 -0
- package/dist/cli/utils/prepareInfraCommandOperationAsync.js.map +1 -0
- package/dist/cli/utils/requireInfraSuccess.d.ts +7 -0
- package/dist/cli/utils/requireInfraSuccess.d.ts.map +1 -0
- package/dist/cli/utils/requireInfraSuccess.js +17 -0
- package/dist/cli/utils/requireInfraSuccess.js.map +1 -0
- package/dist/cli/utils/resolveInfraPersistence.d.ts +4 -0
- package/dist/cli/utils/resolveInfraPersistence.d.ts.map +1 -0
- package/dist/cli/utils/resolveInfraPersistence.js +17 -0
- package/dist/cli/utils/resolveInfraPersistence.js.map +1 -0
- package/dist/cli/utils/writeInfraEnvironmentOutputs.d.ts +5 -0
- package/dist/cli/utils/writeInfraEnvironmentOutputs.d.ts.map +1 -0
- package/dist/cli/utils/writeInfraEnvironmentOutputs.js +16 -0
- package/dist/cli/utils/writeInfraEnvironmentOutputs.js.map +1 -0
- package/dist/cli/utils/writeInfraStructured.d.ts +4 -0
- package/dist/cli/utils/writeInfraStructured.d.ts.map +1 -0
- package/dist/cli/utils/writeInfraStructured.js +8 -0
- package/dist/cli/utils/writeInfraStructured.js.map +1 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/{packageMetadata.js → constants.js} +6 -3
- package/dist/constants.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.js +35 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.js +23 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.js +9 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.d.ts +5 -0
- package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.js +28 -0
- package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.js +7 -0
- package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.d.ts +7 -0
- package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.d.ts.map +1 -0
- package/dist/{project.js → features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.js} +10 -34
- package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.d.ts +5 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.js +28 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.js +16 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.d.ts +9 -0
- package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.js +2 -0
- package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.js +15 -0
- package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.js +84 -0
- package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.js +55 -0
- package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.js +38 -0
- package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.js +34 -0
- package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.js +57 -0
- package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.d.ts +5 -0
- package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.js +109 -0
- package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.d.ts +6 -0
- package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.js +181 -0
- package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.js +68 -0
- package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.js +98 -0
- package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.d.ts +5 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.js +17 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.js +13 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/composition/createInfraCommandServices.d.ts +4 -0
- package/dist/features/environment-lifecycle/composition/createInfraCommandServices.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/composition/createInfraCommandServices.js +43 -0
- package/dist/features/environment-lifecycle/composition/createInfraCommandServices.js.map +1 -0
- package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.d.ts +4 -0
- package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.js +54 -0
- package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.js.map +1 -0
- package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.d.ts +5 -0
- package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.js +39 -0
- package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/appendInfraFailure.d.ts +7 -0
- package/dist/features/environment-lifecycle/utils/appendInfraFailure.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/appendInfraFailure.js +5 -0
- package/dist/features/environment-lifecycle/utils/appendInfraFailure.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.d.ts +5 -0
- package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.js +13 -0
- package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraFailure.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/createInfraFailure.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraFailure.js +5 -0
- package/dist/features/environment-lifecycle/utils/createInfraFailure.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraLedger.d.ts +12 -0
- package/dist/features/environment-lifecycle/utils/createInfraLedger.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraLedger.js +14 -0
- package/dist/features/environment-lifecycle/utils/createInfraLedger.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/infraIdentityKey.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/infraIdentityKey.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/infraIdentityKey.js +5 -0
- package/dist/features/environment-lifecycle/utils/infraIdentityKey.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/isInfraStoredState.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/isInfraStoredState.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/isInfraStoredState.js +103 -0
- package/dist/features/environment-lifecycle/utils/isInfraStoredState.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.js +10 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraResources.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraResources.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraResources.js +10 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraResources.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.d.ts +3 -0
- package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.js +8 -0
- package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.js +11 -0
- package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/resolveProjectFile.d.ts +3 -0
- package/dist/features/environment-lifecycle/utils/resolveProjectFile.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/resolveProjectFile.js +19 -0
- package/dist/features/environment-lifecycle/utils/resolveProjectFile.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.js +6 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.js +6 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.js.map +1 -0
- package/dist/index.d.ts +16 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -15
- package/dist/index.js.map +1 -1
- package/dist/metadata/index.d.ts +1 -1
- package/dist/metadata/index.d.ts.map +1 -1
- package/dist/metadata/index.js +1 -1
- package/dist/metadata/index.js.map +1 -1
- package/dist/project/index.d.ts +7 -5
- package/dist/project/index.d.ts.map +1 -1
- package/dist/project/index.js +6 -5
- package/dist/project/index.js.map +1 -1
- package/dist/readme-usage.js +17 -26
- package/dist/readme-usage.js.map +1 -1
- package/dist/testSupport.d.ts +1 -1
- package/dist/testSupport.d.ts.map +1 -1
- package/dist/testSupport.js +11 -1
- package/dist/testSupport.js.map +1 -1
- package/dist/types/infraCli.d.ts +91 -0
- package/dist/types/infraCli.d.ts.map +1 -0
- package/dist/types/infraCli.js +2 -0
- package/dist/types/infraCli.js.map +1 -0
- package/dist/types/infraOrchestration.d.ts +84 -0
- package/dist/types/infraOrchestration.d.ts.map +1 -0
- package/dist/types/infraOrchestration.js +2 -0
- package/dist/types/infraOrchestration.js.map +1 -0
- package/dist/{project.d.ts → types/infraProject.d.ts} +6 -6
- package/dist/types/infraProject.d.ts.map +1 -0
- package/dist/types/infraProject.js +2 -0
- package/dist/types/infraProject.js.map +1 -0
- package/package.json +21 -11
- package/src/adapterPackages.integration.test.ts +79 -0
- package/src/cli/bin.ts +2 -61
- package/src/cli/cli.test.ts +35 -126
- package/src/cli/commands/destroy.ts +57 -0
- package/src/cli/commands/down.ts +28 -0
- package/src/cli/commands/generate.ts +34 -0
- package/src/cli/commands/outputs.ts +25 -0
- package/src/cli/commands/plan.ts +20 -0
- package/src/cli/commands/status.ts +20 -0
- package/src/cli/commands/up.ts +29 -0
- package/src/cli/commands/validate.ts +20 -0
- package/src/cli/constants.ts +19 -0
- package/src/cli/createDefaultInfraCommandContext.ts +17 -0
- package/src/cli/createInfraRuntimeProvider.ts +35 -0
- package/src/cli/createProviderCommandDescriptors.ts +8 -0
- package/src/cli/findInfraCommand.ts +7 -0
- package/src/cli/index.test.ts +12 -20
- package/src/cli/index.ts +7 -49
- package/src/cli/renderInfraRootHelp.ts +23 -0
- package/src/cli/renderUnknownInfraCommand.ts +4 -0
- package/src/cli/runInfraCliAsync.ts +51 -0
- package/src/cli/runInfraCommandAsync.ts +114 -0
- package/src/cli/utils/prepareInfraCommandOperationAsync.ts +64 -0
- package/src/cli/utils/requireInfraSuccess.ts +24 -0
- package/src/cli/utils/resolveInfraPersistence.ts +22 -0
- package/src/cli/utils/writeInfraEnvironmentOutputs.ts +24 -0
- package/src/cli/utils/writeInfraStructured.ts +11 -0
- package/src/commands.test.ts +198 -196
- package/src/{packageMetadata.ts → constants.ts} +5 -2
- package/src/environmentLifecycle.test.ts +193 -0
- package/src/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.ts +52 -0
- package/src/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.ts +32 -0
- package/src/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.ts +10 -0
- package/src/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.ts +34 -0
- package/src/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.ts +12 -0
- package/src/{project.ts → features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.ts} +10 -45
- package/src/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.ts +34 -0
- package/src/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.ts +21 -0
- package/src/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.ts +10 -0
- package/src/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.ts +25 -0
- package/src/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.ts +119 -0
- package/src/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.ts +65 -0
- package/src/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.ts +51 -0
- package/src/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.ts +41 -0
- package/src/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.ts +67 -0
- package/src/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.ts +137 -0
- package/src/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.ts +257 -0
- package/src/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.ts +80 -0
- package/src/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.ts +126 -0
- package/src/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.ts +25 -0
- package/src/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.ts +21 -0
- package/src/features/environment-lifecycle/composition/createInfraCommandServices.ts +47 -0
- package/src/features/environment-lifecycle/domain/orderInfraPlanActions.ts +64 -0
- package/src/features/environment-lifecycle/domain/resolveInfraEnvironment.ts +62 -0
- package/src/features/environment-lifecycle/utils/appendInfraFailure.ts +9 -0
- package/src/features/environment-lifecycle/utils/createInfraExecutionContext.ts +24 -0
- package/src/features/environment-lifecycle/utils/createInfraFailure.ts +6 -0
- package/src/features/environment-lifecycle/utils/createInfraLedger.ts +30 -0
- package/src/features/environment-lifecycle/utils/infraIdentityKey.ts +6 -0
- package/src/features/environment-lifecycle/utils/isInfraStoredState.ts +141 -0
- package/src/features/environment-lifecycle/utils/mergeInfraOutputs.ts +14 -0
- package/src/features/environment-lifecycle/utils/mergeInfraResources.ts +14 -0
- package/src/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.ts +7 -0
- package/src/features/environment-lifecycle/utils/resolveInfraStatePath.ts +12 -0
- package/src/features/environment-lifecycle/utils/resolveProjectFile.ts +22 -0
- package/src/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.ts +15 -0
- package/src/features/environment-lifecycle/utils/retainUnchangedAdapterResources.ts +15 -0
- package/src/index.test.ts +22 -315
- package/src/index.ts +41 -53
- package/src/infraComposition.integration.test.ts +128 -0
- package/src/infraOperations.test.ts +386 -0
- package/src/infraUp.test.ts +260 -0
- package/src/metadata/index.ts +1 -1
- package/src/package.test.ts +4 -2
- package/src/project/index.test.ts +8 -188
- package/src/project/index.ts +7 -22
- package/src/project.test.ts +39 -189
- package/src/projectContractsParser.test.ts +2 -2
- package/src/projectInfrastructure.test.ts +121 -167
- package/src/readme-usage.ts +17 -26
- package/src/testSupport.ts +12 -2
- package/src/types/infraCli.ts +115 -0
- package/src/types/infraOrchestration.ts +126 -0
- package/src/types/infraProject.ts +15 -0
- package/dist/adapters/minikube/auth/index.d.ts +0 -8
- package/dist/adapters/minikube/auth/index.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/index.js +0 -29
- package/dist/adapters/minikube/auth/index.js.map +0 -1
- package/dist/adapters/minikube/auth/oauthRuntime.d.ts +0 -4
- package/dist/adapters/minikube/auth/oauthRuntime.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/oauthRuntime.js +0 -138
- package/dist/adapters/minikube/auth/oauthRuntime.js.map +0 -1
- package/dist/adapters/minikube/auth/supabase/index.d.ts +0 -7
- package/dist/adapters/minikube/auth/supabase/index.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/supabase/index.js +0 -232
- package/dist/adapters/minikube/auth/supabase/index.js.map +0 -1
- package/dist/adapters/minikube/auth/supabase/profile.d.ts +0 -20
- package/dist/adapters/minikube/auth/supabase/profile.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/supabase/profile.js +0 -452
- package/dist/adapters/minikube/auth/supabase/profile.js.map +0 -1
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.d.ts +0 -7
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.js +0 -104
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.js.map +0 -1
- package/dist/adapters/minikube/authz/cerbos/index.d.ts +0 -13
- package/dist/adapters/minikube/authz/cerbos/index.d.ts.map +0 -1
- package/dist/adapters/minikube/authz/cerbos/index.js +0 -382
- package/dist/adapters/minikube/authz/cerbos/index.js.map +0 -1
- package/dist/adapters/minikube/authz/index.d.ts +0 -9
- package/dist/adapters/minikube/authz/index.d.ts.map +0 -1
- package/dist/adapters/minikube/authz/index.js +0 -23
- package/dist/adapters/minikube/authz/index.js.map +0 -1
- package/dist/adapters/minikube/base/index.d.ts +0 -14
- package/dist/adapters/minikube/base/index.d.ts.map +0 -1
- package/dist/adapters/minikube/base/index.js +0 -3433
- package/dist/adapters/minikube/base/index.js.map +0 -1
- package/dist/adapters/minikube/base/supabaseMigrations.d.ts +0 -2
- package/dist/adapters/minikube/base/supabaseMigrations.d.ts.map +0 -1
- package/dist/adapters/minikube/base/supabaseMigrations.js +0 -6
- package/dist/adapters/minikube/base/supabaseMigrations.js.map +0 -1
- package/dist/adapters/minikube/contracts.d.ts +0 -34
- package/dist/adapters/minikube/contracts.d.ts.map +0 -1
- package/dist/adapters/minikube/contracts.js +0 -10
- package/dist/adapters/minikube/contracts.js.map +0 -1
- package/dist/adapters/minikube/index.d.ts +0 -3
- package/dist/adapters/minikube/index.d.ts.map +0 -1
- package/dist/adapters/minikube/index.js +0 -136
- package/dist/adapters/minikube/index.js.map +0 -1
- package/dist/adapters/minikube/secrets/index.d.ts +0 -7
- package/dist/adapters/minikube/secrets/index.d.ts.map +0 -1
- package/dist/adapters/minikube/secrets/index.js +0 -13
- package/dist/adapters/minikube/secrets/index.js.map +0 -1
- package/dist/adapters/minikube/secrets/supabase-vault/index.d.ts +0 -8
- package/dist/adapters/minikube/secrets/supabase-vault/index.d.ts.map +0 -1
- package/dist/adapters/minikube/secrets/supabase-vault/index.js +0 -118
- package/dist/adapters/minikube/secrets/supabase-vault/index.js.map +0 -1
- package/dist/adapters/minikube/storage/index.d.ts +0 -7
- package/dist/adapters/minikube/storage/index.d.ts.map +0 -1
- package/dist/adapters/minikube/storage/index.js +0 -77
- package/dist/adapters/minikube/storage/index.js.map +0 -1
- package/dist/adapters/minikube/storage/supabase/index.d.ts +0 -7
- package/dist/adapters/minikube/storage/supabase/index.d.ts.map +0 -1
- package/dist/adapters/minikube/storage/supabase/index.js +0 -82
- package/dist/adapters/minikube/storage/supabase/index.js.map +0 -1
- package/dist/authRedirects.d.ts +0 -19
- package/dist/authRedirects.d.ts.map +0 -1
- package/dist/authRedirects.js +0 -80
- package/dist/authRedirects.js.map +0 -1
- package/dist/authTargetRedirects.d.ts +0 -12
- package/dist/authTargetRedirects.d.ts.map +0 -1
- package/dist/authTargetRedirects.js +0 -32
- package/dist/authTargetRedirects.js.map +0 -1
- package/dist/commandContext.d.ts +0 -12
- package/dist/commandContext.d.ts.map +0 -1
- package/dist/commandContext.js.map +0 -1
- package/dist/commands.d.ts +0 -95
- package/dist/commands.d.ts.map +0 -1
- package/dist/commands.js +0 -256
- package/dist/commands.js.map +0 -1
- package/dist/infraValidation.d.ts +0 -4
- package/dist/infraValidation.d.ts.map +0 -1
- package/dist/infraValidation.js +0 -63
- package/dist/infraValidation.js.map +0 -1
- package/dist/packageMetadata.d.ts +0 -10
- package/dist/packageMetadata.d.ts.map +0 -1
- package/dist/packageMetadata.js.map +0 -1
- package/dist/project.d.ts.map +0 -1
- package/dist/project.js.map +0 -1
- package/dist/projectDatabase.d.ts +0 -5
- package/dist/projectDatabase.d.ts.map +0 -1
- package/dist/projectDatabase.js +0 -22
- package/dist/projectDatabase.js.map +0 -1
- package/dist/projectEnvironment.d.ts +0 -6
- package/dist/projectEnvironment.d.ts.map +0 -1
- package/dist/projectEnvironment.js +0 -45
- package/dist/projectEnvironment.js.map +0 -1
- package/dist/projectInfrastructure.d.ts +0 -38
- package/dist/projectInfrastructure.d.ts.map +0 -1
- package/dist/projectInfrastructure.js +0 -145
- package/dist/projectInfrastructure.js.map +0 -1
- package/dist/runtime.d.ts +0 -54
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -151
- package/dist/runtime.js.map +0 -1
- package/dist/secretStore.d.ts +0 -19
- package/dist/secretStore.d.ts.map +0 -1
- package/dist/secretStore.js +0 -22
- package/dist/secretStore.js.map +0 -1
- package/dist/types.d.ts +0 -70
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/src/adapters/minikube/README.md +0 -115
- package/src/adapters/minikube/appRuntimeServing.test.ts +0 -28
- package/src/adapters/minikube/auth/index.ts +0 -40
- package/src/adapters/minikube/auth/oauthRuntime.ts +0 -163
- package/src/adapters/minikube/auth/supabase/index.test.ts +0 -227
- package/src/adapters/minikube/auth/supabase/index.ts +0 -293
- package/src/adapters/minikube/auth/supabase/oauthRuntime.test.ts +0 -154
- package/src/adapters/minikube/auth/supabase/profile.integration.test.ts +0 -1028
- package/src/adapters/minikube/auth/supabase/profile.ts +0 -526
- package/src/adapters/minikube/auth/supabase/providerAssignments.test.ts +0 -36
- package/src/adapters/minikube/auth/targetAwareOAuthRuntime.test.ts +0 -83
- package/src/adapters/minikube/auth/targetAwareOAuthRuntime.ts +0 -136
- package/src/adapters/minikube/authz/cerbos/index.ts +0 -486
- package/src/adapters/minikube/authz/index.ts +0 -32
- package/src/adapters/minikube/base/appImageBuild.test.ts +0 -352
- package/src/adapters/minikube/base/index.test.ts +0 -693
- package/src/adapters/minikube/base/index.ts +0 -3763
- package/src/adapters/minikube/base/portForwardRuntime.test.ts +0 -624
- package/src/adapters/minikube/base/supabaseMigrations.test.ts +0 -168
- package/src/adapters/minikube/base/supabaseMigrations.ts +0 -5
- package/src/adapters/minikube/base/twoAppIsolation.integration.test.ts +0 -898
- package/src/adapters/minikube/base/upgradeReconciliation.test.ts +0 -135
- package/src/adapters/minikube/contracts.ts +0 -46
- package/src/adapters/minikube/index.ts +0 -172
- package/src/adapters/minikube/secrets/index.test.ts +0 -147
- package/src/adapters/minikube/secrets/index.ts +0 -19
- package/src/adapters/minikube/secrets/supabase-vault/index.ts +0 -139
- package/src/adapters/minikube/storage/index.ts +0 -91
- package/src/adapters/minikube/storage/supabase/index.ts +0 -108
- package/src/apiInfrastructure.test.ts +0 -69
- package/src/authRedirects.test.ts +0 -63
- package/src/authRedirects.ts +0 -113
- package/src/authTargetRedirects.test.ts +0 -62
- package/src/authTargetRedirects.ts +0 -46
- package/src/commandContext.ts +0 -27
- package/src/commands.ts +0 -404
- package/src/generatedApiLedgerCleanup.test.ts +0 -72
- package/src/infraApiValidation.test.ts +0 -42
- package/src/infraValidation.ts +0 -99
- package/src/minikubeImageLifecycle.test.ts +0 -35
- package/src/projectDatabase.ts +0 -27
- package/src/projectEnvironment.ts +0 -51
- package/src/projectInfrastructure.ts +0 -221
- package/src/runtime.test.ts +0 -124
- package/src/runtime.ts +0 -234
- package/src/secretStore.test.ts +0 -76
- package/src/secretStore.ts +0 -44
- package/src/types.ts +0 -82
|
@@ -1,195 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { promises as fs } from 'fs';
|
|
3
|
-
import os from 'os';
|
|
4
|
-
import path from 'path';
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
5
2
|
|
|
6
|
-
import { createAppManifest } from '../testSupport.js';
|
|
7
3
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
resolveProjectInfrastructureDatabaseUrl,
|
|
12
|
-
resolveProjectInfrastructurePortForward,
|
|
13
|
-
runProjectInfrastructureLifecycle,
|
|
4
|
+
readStoredInfraStateAsync,
|
|
5
|
+
resolveInfraProjectAsync,
|
|
6
|
+
writeInfraGeneratedArtifactsAsync,
|
|
14
7
|
} from './index.js';
|
|
15
8
|
|
|
16
|
-
const temporaryPaths: string[] = [];
|
|
17
|
-
|
|
18
|
-
afterEach(async () => {
|
|
19
|
-
await Promise.all(
|
|
20
|
-
temporaryPaths.splice(0).map((entry) => fs.rm(entry, { force: true, recursive: true })),
|
|
21
|
-
);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
async function createProjectFixture(): Promise<string> {
|
|
25
|
-
const projectPath = await fs.mkdtemp(path.join(os.tmpdir(), 'ankh-infra-project-'));
|
|
26
|
-
temporaryPaths.push(projectPath);
|
|
27
|
-
const infraRoot = path.join(projectPath, 'infra', 'minikube');
|
|
28
|
-
const scriptsRoot = path.join(infraRoot, 'scripts');
|
|
29
|
-
await fs.mkdir(scriptsRoot, { recursive: true });
|
|
30
|
-
await fs.writeFile(
|
|
31
|
-
path.join(scriptsRoot, 'status.sh'),
|
|
32
|
-
"#!/usr/bin/env bash\nprintf 'status-ok'\nprintf 'status-warning' >&2\n",
|
|
33
|
-
'utf8',
|
|
34
|
-
);
|
|
35
|
-
await fs.writeFile(
|
|
36
|
-
path.join(infraRoot, '.env.example'),
|
|
37
|
-
[
|
|
38
|
-
'APP_PORT_FORWARD_LOCAL_PORT=48123',
|
|
39
|
-
'SITE_URL=http://example.local',
|
|
40
|
-
'DATABASE_URL=postgres://example',
|
|
41
|
-
'PRIVATE_VALUE=not-selected',
|
|
42
|
-
'',
|
|
43
|
-
].join('\n'),
|
|
44
|
-
'utf8',
|
|
45
|
-
);
|
|
46
|
-
return projectPath;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
9
|
describe('@ankhorage/infra/project', () => {
|
|
50
|
-
test('
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const result = await runProjectInfrastructureLifecycle({
|
|
56
|
-
projectId: 'example',
|
|
57
|
-
projectPath,
|
|
58
|
-
script: 'status',
|
|
59
|
-
target: 'minikube',
|
|
60
|
-
onStdout: (chunk) => stdout.push(chunk),
|
|
61
|
-
onStderr: (chunk) => stderr.push(chunk),
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
expect(result).toEqual({ stdout: 'status-ok', stderr: 'status-warning' });
|
|
65
|
-
expect(stdout.join('')).toBe('status-ok');
|
|
66
|
-
expect(stderr.join('')).toBe('status-warning');
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('resolves the generated app port-forward endpoint through the owner API', async () => {
|
|
70
|
-
const projectPath = await createProjectFixture();
|
|
71
|
-
const result = await resolveProjectInfrastructurePortForward({
|
|
72
|
-
projectPath,
|
|
73
|
-
target: 'minikube',
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
expect(result).toEqual({
|
|
77
|
-
localPort: 48123,
|
|
78
|
-
url: 'http://127.0.0.1:48123',
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
test('ensures the generated runtime port-forward group through the owner API', async () => {
|
|
83
|
-
const projectPath = await createProjectFixture();
|
|
84
|
-
const scriptPath = path.join(projectPath, 'infra', 'minikube', 'scripts', 'port-forward.sh');
|
|
85
|
-
await fs.writeFile(scriptPath, '#!/usr/bin/env bash\nprintf \'%s\' "$*"\n', 'utf8');
|
|
86
|
-
|
|
87
|
-
const result = await ensureProjectInfrastructureRuntime({
|
|
88
|
-
projectId: 'example',
|
|
89
|
-
projectPath,
|
|
90
|
-
target: 'minikube',
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
expect(result).toEqual({ stdout: 'start runtime', stderr: '' });
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
test('reports actionable runtime-forward failures without reconciling infrastructure', async () => {
|
|
97
|
-
const projectPath = await createProjectFixture();
|
|
98
|
-
const scriptPath = path.join(projectPath, 'infra', 'minikube', 'scripts', 'port-forward.sh');
|
|
99
|
-
await fs.writeFile(
|
|
100
|
-
scriptPath,
|
|
101
|
-
'#!/usr/bin/env bash\necho "app: target app/service/app-runtime not found"\nexit 1\n',
|
|
102
|
-
'utf8',
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
await expectRejectMessage(
|
|
106
|
-
ensureProjectInfrastructureRuntime({
|
|
107
|
-
projectId: 'example',
|
|
108
|
-
projectPath,
|
|
109
|
-
target: 'minikube',
|
|
110
|
-
}),
|
|
111
|
-
"Failed to ensure infrastructure runtime for project 'example': app: target app/service/app-runtime not found",
|
|
112
|
-
);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
test('reads only requested runtime environment values from the generated fallback', async () => {
|
|
116
|
-
const projectPath = await createProjectFixture();
|
|
117
|
-
const result = await readProjectInfrastructureEnvironment({
|
|
118
|
-
keys: ['SITE_URL', 'MISSING_VALUE'],
|
|
119
|
-
projectPath,
|
|
120
|
-
target: 'minikube',
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
expect(result).toEqual({ SITE_URL: 'http://example.local' });
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
test('prefers generated runtime environment and resolves the trusted database URL', async () => {
|
|
127
|
-
const projectPath = await createProjectFixture();
|
|
128
|
-
const envPath = path.join(projectPath, 'infra', 'minikube', '.env');
|
|
129
|
-
await fs.writeFile(
|
|
130
|
-
envPath,
|
|
131
|
-
'SITE_URL=http://runtime.local\nDATABASE_URL=postgres://runtime\n',
|
|
132
|
-
'utf8',
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
const environment = await readProjectInfrastructureEnvironment({
|
|
136
|
-
keys: ['SITE_URL'],
|
|
137
|
-
projectPath,
|
|
138
|
-
target: 'minikube',
|
|
139
|
-
});
|
|
140
|
-
const databaseUrl = await resolveProjectInfrastructureDatabaseUrl({
|
|
141
|
-
projectPath,
|
|
142
|
-
target: 'minikube',
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
expect(environment).toEqual({ SITE_URL: 'http://runtime.local' });
|
|
146
|
-
expect(databaseUrl).toBe('postgres://runtime');
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
test('inspects deployment and generated state through the owner ledger', async () => {
|
|
150
|
-
const projectPath = await createProjectFixture();
|
|
151
|
-
await fs.mkdir(path.join(projectPath, '.ankh'), { recursive: true });
|
|
152
|
-
await fs.writeFile(
|
|
153
|
-
path.join(projectPath, '.ankh', 'infra-ledger.json'),
|
|
154
|
-
JSON.stringify({
|
|
155
|
-
schemaVersion: 1,
|
|
156
|
-
generatedAt: '2026-08-12T04:00:00.000Z',
|
|
157
|
-
target: 'minikube',
|
|
158
|
-
files: ['infra/minikube/.env.example', 'infra/minikube/scripts/status.sh'],
|
|
159
|
-
warnings: ['generated warning'],
|
|
160
|
-
}),
|
|
161
|
-
'utf8',
|
|
162
|
-
);
|
|
163
|
-
const manifest = createAppManifest('example', {
|
|
164
|
-
deployment: { monitoring: false, target: 'minikube' },
|
|
165
|
-
modules: [],
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
const result = await inspectProjectInfrastructure({
|
|
169
|
-
manifest,
|
|
170
|
-
projectId: 'example',
|
|
171
|
-
projectPath,
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
expect(result).toEqual({
|
|
175
|
-
generated: true,
|
|
176
|
-
generatedAt: '2026-08-12T04:00:00.000Z',
|
|
177
|
-
hasDeployment: true,
|
|
178
|
-
target: 'minikube',
|
|
179
|
-
trackedFiles: 2,
|
|
180
|
-
warnings: ['generated warning'],
|
|
181
|
-
});
|
|
10
|
+
test('exports project resolution, safe state and artifact owner APIs', () => {
|
|
11
|
+
expect(resolveInfraProjectAsync).toBeFunction();
|
|
12
|
+
expect(readStoredInfraStateAsync).toBeFunction();
|
|
13
|
+
expect(writeInfraGeneratedArtifactsAsync).toBeFunction();
|
|
182
14
|
});
|
|
183
15
|
});
|
|
184
|
-
|
|
185
|
-
async function expectRejectMessage(
|
|
186
|
-
promise: Promise<unknown>,
|
|
187
|
-
expectedMessage: string,
|
|
188
|
-
): Promise<void> {
|
|
189
|
-
try {
|
|
190
|
-
await promise;
|
|
191
|
-
throw new Error('Expected operation to reject.');
|
|
192
|
-
} catch (error) {
|
|
193
|
-
expect(error instanceof Error ? error.message : String(error)).toContain(expectedMessage);
|
|
194
|
-
}
|
|
195
|
-
}
|
package/src/project/index.ts
CHANGED
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from '../
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
type InfraProjectInspection,
|
|
9
|
-
type InfraSyncResult,
|
|
10
|
-
inspectProjectInfrastructure,
|
|
11
|
-
resolveProjectInfrastructureTarget,
|
|
12
|
-
syncProjectInfrastructure,
|
|
13
|
-
} from '../projectInfrastructure.js';
|
|
14
|
-
export {
|
|
15
|
-
ensureProjectInfrastructureRuntime,
|
|
16
|
-
type InfraLifecycleScript,
|
|
17
|
-
type InfraPortForwardInfo,
|
|
18
|
-
InfraScriptExecutionError,
|
|
19
|
-
type InfraScriptOutput,
|
|
20
|
-
resolveProjectInfrastructurePortForward,
|
|
21
|
-
runProjectInfrastructureLifecycle,
|
|
22
|
-
} from '../runtime.js';
|
|
1
|
+
export { readStoredInfraStateAsync } from '../features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.js';
|
|
2
|
+
export { removeStoredInfraStateAsync } from '../features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.js';
|
|
3
|
+
export { resolveInfraProjectAsync } from '../features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.js';
|
|
4
|
+
export { writeInfraGeneratedArtifactsAsync } from '../features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.js';
|
|
5
|
+
export { writeStoredInfraStateAsync } from '../features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.js';
|
|
6
|
+
export { resolveProjectFile } from '../features/environment-lifecycle/utils/resolveProjectFile.js';
|
|
7
|
+
export type { InfraArtifactWriteResult, ResolvedInfraProject } from '../types/infraProject.js';
|
package/src/project.test.ts
CHANGED
|
@@ -3,216 +3,66 @@ import { promises as fs } from 'fs';
|
|
|
3
3
|
import os from 'os';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { resolveInfraProjectAsync } from './features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.js';
|
|
7
|
+
import { createWorkspaceFixture } from './testSupport.js';
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const temporaryPaths = new Set<string>();
|
|
10
10
|
|
|
11
11
|
afterEach(async () => {
|
|
12
12
|
await Promise.all(
|
|
13
|
-
[...
|
|
13
|
+
[...temporaryPaths].map((entry) => fs.rm(entry, { force: true, recursive: true })),
|
|
14
14
|
);
|
|
15
|
-
|
|
15
|
+
temporaryPaths.clear();
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
describe('
|
|
19
|
-
test('resolves
|
|
18
|
+
describe('project resolution', () => {
|
|
19
|
+
test('resolves explicit and cwd-inferred projects with canonical manifests', async () => {
|
|
20
20
|
const fixture = await createWorkspaceFixture();
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const project = await resolveInfraProject({
|
|
21
|
+
temporaryPaths.add(fixture.rootPath);
|
|
22
|
+
const explicit = await resolveInfraProjectAsync({
|
|
24
23
|
cwd: fixture.rootPath,
|
|
25
24
|
projectId: fixture.projectId,
|
|
26
25
|
});
|
|
27
|
-
|
|
28
|
-
expect(
|
|
29
|
-
expect(
|
|
30
|
-
expect(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
test('infers the project id from cwd inside apps/<project>', async () => {
|
|
34
|
-
const fixture = await createWorkspaceFixture();
|
|
35
|
-
tempRoots.add(fixture.rootPath);
|
|
36
|
-
|
|
37
|
-
const nestedPath = path.join(fixture.projectPath, 'src', 'modules');
|
|
38
|
-
await fs.mkdir(nestedPath, { recursive: true });
|
|
39
|
-
|
|
40
|
-
const project = await resolveInfraProject({
|
|
41
|
-
cwd: nestedPath,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
expect(project.projectId).toBe('shop');
|
|
45
|
-
expect(project.projectPath).toBe(fixture.projectPath);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test('loads the fallback manifest when ankh.config.json is missing', async () => {
|
|
49
|
-
const fixture = await createWorkspaceFixture({
|
|
50
|
-
manifestFile: 'missing',
|
|
51
|
-
});
|
|
52
|
-
tempRoots.add(fixture.rootPath);
|
|
53
|
-
|
|
54
|
-
const project = await resolveInfraProject({
|
|
55
|
-
cwd: fixture.rootPath,
|
|
56
|
-
projectId: fixture.projectId,
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
expect(project.manifest.metadata.name).toBe('shop');
|
|
60
|
-
expect(project.manifest.metadata.slug).toBe('shop');
|
|
61
|
-
expect(project.manifest.infra.modules).toEqual([]);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
test('rejects malformed manifest JSON', async () => {
|
|
65
|
-
const fixture = await createWorkspaceFixture({
|
|
66
|
-
manifestFile: 'invalid-json',
|
|
67
|
-
});
|
|
68
|
-
tempRoots.add(fixture.rootPath);
|
|
69
|
-
|
|
70
|
-
await expectRejectMessage(
|
|
71
|
-
resolveInfraProject({
|
|
72
|
-
cwd: fixture.rootPath,
|
|
73
|
-
projectId: fixture.projectId,
|
|
74
|
-
}),
|
|
75
|
-
'Project manifest is not valid JSON',
|
|
76
|
-
);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
test('rejects traversal project ids', async () => {
|
|
80
|
-
const fixture = await createWorkspaceFixture();
|
|
81
|
-
tempRoots.add(fixture.rootPath);
|
|
82
|
-
|
|
83
|
-
await expectRejectMessage(
|
|
84
|
-
resolveInfraProject({
|
|
85
|
-
cwd: fixture.rootPath,
|
|
86
|
-
projectId: '../shop',
|
|
87
|
-
}),
|
|
88
|
-
'Invalid project id:',
|
|
26
|
+
const inferred = await resolveInfraProjectAsync({ cwd: fixture.projectPath });
|
|
27
|
+
expect(explicit.projectPath).toBe(fixture.projectPath);
|
|
28
|
+
expect(inferred.projectId).toBe(fixture.projectId);
|
|
29
|
+
expect(explicit.manifest.infra.environments.local.deployment.runtime.provider).toBe(
|
|
30
|
+
'docker-compose',
|
|
89
31
|
);
|
|
90
32
|
});
|
|
91
33
|
|
|
92
|
-
test('
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
);
|
|
34
|
+
test('requires a real manifest and rejects malformed JSON', async () => {
|
|
35
|
+
const missing = await createWorkspaceFixture({ manifestFile: 'missing' });
|
|
36
|
+
const invalid = await createWorkspaceFixture({ manifestFile: 'invalid-json' });
|
|
37
|
+
temporaryPaths.add(missing.rootPath);
|
|
38
|
+
temporaryPaths.add(invalid.rootPath);
|
|
39
|
+
expect(
|
|
40
|
+
await captureError(resolveInfraProjectAsync({ cwd: missing.rootPath, projectId: 'shop' })),
|
|
41
|
+
).toContain('Project manifest not found');
|
|
42
|
+
expect(
|
|
43
|
+
await captureError(resolveInfraProjectAsync({ cwd: invalid.rootPath, projectId: 'shop' })),
|
|
44
|
+
).toContain('Project manifest is not valid JSON');
|
|
103
45
|
});
|
|
104
46
|
|
|
105
|
-
test('rejects
|
|
47
|
+
test('rejects traversal and projects outside an Ankh workspace', async () => {
|
|
106
48
|
const fixture = await createWorkspaceFixture();
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
test('rejects explicit dot project ids', async () => {
|
|
119
|
-
const fixture = await createWorkspaceFixture();
|
|
120
|
-
tempRoots.add(fixture.rootPath);
|
|
121
|
-
|
|
122
|
-
await expectRejectMessage(
|
|
123
|
-
resolveInfraProject({
|
|
124
|
-
cwd: fixture.rootPath,
|
|
125
|
-
projectId: '.',
|
|
126
|
-
}),
|
|
127
|
-
'Invalid project id:',
|
|
128
|
-
);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
test('rejects explicit dot-dot project ids', async () => {
|
|
132
|
-
const fixture = await createWorkspaceFixture();
|
|
133
|
-
tempRoots.add(fixture.rootPath);
|
|
134
|
-
|
|
135
|
-
await expectRejectMessage(
|
|
136
|
-
resolveInfraProject({
|
|
137
|
-
cwd: fixture.rootPath,
|
|
138
|
-
projectId: '..',
|
|
139
|
-
}),
|
|
140
|
-
'Invalid project id:',
|
|
141
|
-
);
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
test('rejects explicit empty project ids', async () => {
|
|
145
|
-
const fixture = await createWorkspaceFixture();
|
|
146
|
-
tempRoots.add(fixture.rootPath);
|
|
147
|
-
|
|
148
|
-
await expectRejectMessage(
|
|
149
|
-
resolveInfraProject({
|
|
150
|
-
cwd: fixture.rootPath,
|
|
151
|
-
projectId: '',
|
|
152
|
-
}),
|
|
153
|
-
'Invalid project id:',
|
|
154
|
-
);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
test('rejects explicit blank project ids', async () => {
|
|
158
|
-
const fixture = await createWorkspaceFixture();
|
|
159
|
-
tempRoots.add(fixture.rootPath);
|
|
160
|
-
|
|
161
|
-
await expectRejectMessage(
|
|
162
|
-
resolveInfraProject({
|
|
163
|
-
cwd: fixture.rootPath,
|
|
164
|
-
projectId: ' ',
|
|
165
|
-
}),
|
|
166
|
-
'Invalid project id:',
|
|
167
|
-
);
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
test('fails when no workspace root can be found', async () => {
|
|
171
|
-
const rootPath = await fs.mkdtemp(path.join(os.tmpdir(), 'infra-no-root-'));
|
|
172
|
-
tempRoots.add(rootPath);
|
|
173
|
-
|
|
174
|
-
await expectRejectMessage(
|
|
175
|
-
resolveInfraProject({
|
|
176
|
-
cwd: rootPath,
|
|
177
|
-
projectId: 'shop',
|
|
178
|
-
}),
|
|
179
|
-
'Could not find an Ankh workspace root',
|
|
180
|
-
);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
test('reads a valid project manifest', async () => {
|
|
184
|
-
const manifest = createAppManifest('cards', {
|
|
185
|
-
deployment: {
|
|
186
|
-
monitoring: false,
|
|
187
|
-
target: 'minikube',
|
|
188
|
-
},
|
|
189
|
-
modules: [],
|
|
190
|
-
});
|
|
191
|
-
const fixture = await createWorkspaceFixture({
|
|
192
|
-
manifest,
|
|
193
|
-
projectId: 'cards',
|
|
194
|
-
});
|
|
195
|
-
tempRoots.add(fixture.rootPath);
|
|
196
|
-
|
|
197
|
-
const project = await resolveInfraProject({
|
|
198
|
-
cwd: fixture.rootPath,
|
|
199
|
-
projectId: 'cards',
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
expect(project.manifest.metadata.name).toBe('cards');
|
|
203
|
-
expect(project.manifest.infra.deployment?.target).toBe('minikube');
|
|
49
|
+
const outside = await fs.mkdtemp(path.join(os.tmpdir(), 'infra-outside-'));
|
|
50
|
+
temporaryPaths.add(fixture.rootPath);
|
|
51
|
+
temporaryPaths.add(outside);
|
|
52
|
+
expect(
|
|
53
|
+
await captureError(resolveInfraProjectAsync({ cwd: fixture.rootPath, projectId: '../shop' })),
|
|
54
|
+
).toContain('Invalid project id');
|
|
55
|
+
expect(
|
|
56
|
+
await captureError(resolveInfraProjectAsync({ cwd: outside, projectId: 'shop' })),
|
|
57
|
+
).toContain('Could not find an Ankh workspace root');
|
|
204
58
|
});
|
|
205
59
|
});
|
|
206
60
|
|
|
207
|
-
async function
|
|
208
|
-
let didReject = false;
|
|
209
|
-
|
|
61
|
+
async function captureError(operation: Promise<unknown>): Promise<string> {
|
|
210
62
|
try {
|
|
211
|
-
await
|
|
63
|
+
await operation;
|
|
212
64
|
} catch (error) {
|
|
213
|
-
|
|
214
|
-
expect(error instanceof Error ? error.message : String(error)).toContain(text);
|
|
65
|
+
return error instanceof Error ? error.message : String(error);
|
|
215
66
|
}
|
|
216
|
-
|
|
217
|
-
expect(didReject).toBe(true);
|
|
67
|
+
throw new Error('Expected operation to fail.');
|
|
218
68
|
}
|
|
@@ -2,7 +2,7 @@ import { afterEach, expect, test } from 'bun:test';
|
|
|
2
2
|
import { promises as fs } from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { resolveInfraProjectAsync } from './features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.js';
|
|
6
6
|
import { createAppManifest, createWorkspaceFixture } from './testSupport.js';
|
|
7
7
|
|
|
8
8
|
const tempRoots = new Set<string>();
|
|
@@ -33,7 +33,7 @@ test('Infra rejects nested manifest shapes rejected by Contracts', async () => {
|
|
|
33
33
|
);
|
|
34
34
|
|
|
35
35
|
const error = await captureError(
|
|
36
|
-
|
|
36
|
+
resolveInfraProjectAsync({ cwd: fixture.rootPath, projectId: fixture.projectId }),
|
|
37
37
|
);
|
|
38
38
|
expect(error.message).toContain('Project manifest has an invalid shape');
|
|
39
39
|
});
|