@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
package/src/commands.test.ts
CHANGED
|
@@ -1,219 +1,221 @@
|
|
|
1
|
+
import type { AppManifest } from '@ankhorage/contracts';
|
|
2
|
+
import type { InfraEnvironmentSpec, InfraLedger, InfraResult } from '@ankhorage/contracts/infra';
|
|
1
3
|
import { describe, expect, test } from 'bun:test';
|
|
2
4
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from './
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
'generate',
|
|
20
|
-
'status',
|
|
21
|
-
'up',
|
|
22
|
-
'down',
|
|
23
|
-
]);
|
|
24
|
-
expect(providerDescriptors.map((command) => command.path.join(' '))).toEqual([
|
|
25
|
-
'validate',
|
|
26
|
-
'generate',
|
|
27
|
-
'status',
|
|
28
|
-
'up',
|
|
29
|
-
'down',
|
|
30
|
-
]);
|
|
31
|
-
expect(JSON.stringify(providerDescriptors)).not.toContain('port-forward');
|
|
32
|
-
expect(JSON.stringify(providerDescriptors)).not.toContain('portForward');
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
test('root help only exposes the locked command surface', () => {
|
|
36
|
-
const help = renderRootHelp('0.2.1');
|
|
37
|
-
|
|
38
|
-
expect(help).toContain('validate');
|
|
39
|
-
expect(help).toContain('generate');
|
|
40
|
-
expect(help).toContain('status');
|
|
41
|
-
expect(help).toContain('up');
|
|
42
|
-
expect(help).toContain('down');
|
|
5
|
+
import { INFRA_COMMANDS } from './cli/constants.js';
|
|
6
|
+
import { createProviderCommandDescriptors } from './cli/createProviderCommandDescriptors.js';
|
|
7
|
+
import { findInfraCommand } from './cli/findInfraCommand.js';
|
|
8
|
+
import { renderInfraRootHelp } from './cli/renderInfraRootHelp.js';
|
|
9
|
+
import { runInfraCommandAsync } from './cli/runInfraCommandAsync.js';
|
|
10
|
+
import { createAppManifest, createCapturedCommandContext } from './testSupport.js';
|
|
11
|
+
import type { InfraCommandServices, InfraLifecycleOperations } from './types/infraCli.js';
|
|
12
|
+
import type { InfraDestroyOperationRequest } from './types/infraOrchestration.js';
|
|
13
|
+
|
|
14
|
+
describe('canonical Infra commands', () => {
|
|
15
|
+
test('exposes the same locked eight-command surface everywhere', () => {
|
|
16
|
+
const names = ['validate', 'plan', 'generate', 'up', 'status', 'outputs', 'down', 'destroy'];
|
|
17
|
+
expect(INFRA_COMMANDS.map(({ standaloneName }) => standaloneName)).toEqual(names);
|
|
18
|
+
expect(createProviderCommandDescriptors().map(({ path }) => path.join(' '))).toEqual(names);
|
|
19
|
+
const help = renderInfraRootHelp('9.9.9');
|
|
20
|
+
for (const name of names) expect(help).toContain(name);
|
|
43
21
|
expect(help).not.toContain('port-forward');
|
|
22
|
+
expect(help).not.toContain('reset');
|
|
44
23
|
});
|
|
45
24
|
|
|
46
|
-
test('
|
|
47
|
-
const command = findInfraCommandByStandaloneName('validate');
|
|
25
|
+
test('prints environment output format without resolving or exposing secret values', async () => {
|
|
48
26
|
const captured = createCapturedCommandContext('/workspace');
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const result = await runInfraCommand(
|
|
55
|
-
{
|
|
56
|
-
argv: ['shop'],
|
|
57
|
-
command,
|
|
58
|
-
context: captured.context,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
services: {
|
|
62
|
-
resolveProject() {
|
|
63
|
-
return Promise.resolve({
|
|
64
|
-
appsRoot: '/workspace/apps',
|
|
65
|
-
workspaceRoot: '/workspace',
|
|
66
|
-
manifestPath: '/workspace/apps/shop/ankh.config.json',
|
|
67
|
-
projectId: 'shop',
|
|
68
|
-
projectPath: '/workspace/apps/shop',
|
|
69
|
-
manifest: createAppManifest('shop', { modules: [] }),
|
|
70
|
-
});
|
|
71
|
-
},
|
|
72
|
-
validateInfraSupport() {
|
|
73
|
-
return ['warning-1'];
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
27
|
+
const command = requireCommand('outputs');
|
|
28
|
+
const result = await runInfraCommandAsync(
|
|
29
|
+
{ argv: ['shop', '--format', 'env'], command, context: captured.context },
|
|
30
|
+
{ services: createServices() },
|
|
77
31
|
);
|
|
78
|
-
|
|
79
32
|
expect(result.exitCode).toBe(0);
|
|
80
|
-
expect(captured.stdout.value).
|
|
81
|
-
expect(captured.stderr.value).toContain('
|
|
33
|
+
expect(captured.stdout.value).toBe("PUBLIC_URL='https://example.test'\n");
|
|
34
|
+
expect(captured.stderr.value).toContain('remains a reference and was not printed');
|
|
35
|
+
expect(`${captured.stdout.value}${captured.stderr.value}`).not.toContain('resolved-secret');
|
|
82
36
|
});
|
|
83
37
|
|
|
84
|
-
test('
|
|
85
|
-
const command =
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
38
|
+
test('requires explicit destroy environment and exact project confirmation', async () => {
|
|
39
|
+
const command = requireCommand('destroy');
|
|
40
|
+
const missingEnvironment = createCapturedCommandContext('/workspace');
|
|
41
|
+
expect(
|
|
42
|
+
(
|
|
43
|
+
await runInfraCommandAsync(
|
|
44
|
+
{ argv: ['shop'], command, context: missingEnvironment.context },
|
|
45
|
+
{ services: createServices() },
|
|
46
|
+
)
|
|
47
|
+
).exitCode,
|
|
48
|
+
).toBe(1);
|
|
49
|
+
expect(missingEnvironment.stderr.value).toContain('requires --environment');
|
|
50
|
+
|
|
51
|
+
const wrongConfirmation = createCapturedCommandContext('/workspace');
|
|
52
|
+
expect(
|
|
53
|
+
(
|
|
54
|
+
await runInfraCommandAsync(
|
|
55
|
+
{
|
|
56
|
+
argv: ['shop', '--environment', 'local', '--confirm', 'other:local'],
|
|
57
|
+
command,
|
|
58
|
+
context: wrongConfirmation.context,
|
|
59
|
+
},
|
|
60
|
+
{ services: createServices() },
|
|
61
|
+
)
|
|
62
|
+
).exitCode,
|
|
63
|
+
).toBe(1);
|
|
64
|
+
expect(wrongConfirmation.stderr.value).toContain('--confirm shop:local');
|
|
65
|
+
});
|
|
91
66
|
|
|
92
|
-
|
|
67
|
+
test('maps explicit persistent deletion only to an owned persistent resource', async () => {
|
|
68
|
+
const requests: InfraDestroyOperationRequest[] = [];
|
|
69
|
+
const captured = createCapturedCommandContext('/workspace');
|
|
70
|
+
const result = await runInfraCommandAsync(
|
|
93
71
|
{
|
|
94
|
-
argv: [
|
|
95
|
-
|
|
72
|
+
argv: [
|
|
73
|
+
'shop',
|
|
74
|
+
'--environment',
|
|
75
|
+
'local',
|
|
76
|
+
'--confirm',
|
|
77
|
+
'shop:local',
|
|
78
|
+
'--delete-resource',
|
|
79
|
+
'supabase:database',
|
|
80
|
+
],
|
|
81
|
+
command: requireCommand('destroy'),
|
|
96
82
|
context: captured.context,
|
|
97
83
|
},
|
|
98
|
-
{
|
|
99
|
-
services: {
|
|
100
|
-
resolveProject() {
|
|
101
|
-
return Promise.resolve({
|
|
102
|
-
appsRoot: '/workspace/apps',
|
|
103
|
-
workspaceRoot: '/workspace',
|
|
104
|
-
manifestPath: '/workspace/apps/studio/ankh.config.json',
|
|
105
|
-
projectId: 'studio',
|
|
106
|
-
projectPath: '/workspace/apps/studio',
|
|
107
|
-
manifest: createAppManifest('studio', { modules: [] }),
|
|
108
|
-
});
|
|
109
|
-
},
|
|
110
|
-
syncProjectInfrastructure() {
|
|
111
|
-
return Promise.resolve({
|
|
112
|
-
generated: 0,
|
|
113
|
-
removed: 0,
|
|
114
|
-
warnings: [],
|
|
115
|
-
skipped: {
|
|
116
|
-
reason: 'apps/studio is the dashboard and is not a generated app target.',
|
|
117
|
-
},
|
|
118
|
-
});
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
},
|
|
84
|
+
{ services: createServices(requests) },
|
|
122
85
|
);
|
|
123
|
-
|
|
124
86
|
expect(result.exitCode).toBe(0);
|
|
125
|
-
expect(
|
|
87
|
+
expect(requests[0]?.persistence).toEqual({
|
|
88
|
+
policy: 'delete',
|
|
89
|
+
confirmedResources: [ledger.resources[0].identity],
|
|
90
|
+
});
|
|
126
91
|
});
|
|
92
|
+
});
|
|
127
93
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
manifest: createAppManifest('shop', {
|
|
148
|
-
deployment: { target: 'minikube', monitoring: false },
|
|
149
|
-
modules: [],
|
|
150
|
-
}),
|
|
151
|
-
});
|
|
94
|
+
const desired = {
|
|
95
|
+
deployment: {
|
|
96
|
+
compute: { provider: 'local' },
|
|
97
|
+
runtime: { provider: 'docker-compose' },
|
|
98
|
+
},
|
|
99
|
+
} as const satisfies InfraEnvironmentSpec;
|
|
100
|
+
|
|
101
|
+
const ledger = {
|
|
102
|
+
schemaVersion: 1,
|
|
103
|
+
projectId: 'shop',
|
|
104
|
+
environment: 'local',
|
|
105
|
+
targets: [],
|
|
106
|
+
resources: [
|
|
107
|
+
{
|
|
108
|
+
identity: {
|
|
109
|
+
projectId: 'shop',
|
|
110
|
+
environment: 'local',
|
|
111
|
+
adapter: 'supabase',
|
|
112
|
+
resourceId: 'database',
|
|
152
113
|
},
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
114
|
+
persistent: true,
|
|
115
|
+
retention: 'retain',
|
|
116
|
+
dependsOn: [],
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
outputs: [
|
|
120
|
+
{
|
|
121
|
+
owner: {
|
|
122
|
+
projectId: 'shop',
|
|
123
|
+
environment: 'local',
|
|
124
|
+
adapter: 'docker-compose',
|
|
125
|
+
resourceId: 'runtime',
|
|
156
126
|
},
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
127
|
+
name: 'url',
|
|
128
|
+
visibility: 'public',
|
|
129
|
+
value: 'https://example.test',
|
|
130
|
+
environmentVariable: 'PUBLIC_URL',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
owner: {
|
|
134
|
+
projectId: 'shop',
|
|
135
|
+
environment: 'local',
|
|
136
|
+
adapter: 'supabase-vault',
|
|
137
|
+
resourceId: 'vault',
|
|
160
138
|
},
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
139
|
+
name: 'password',
|
|
140
|
+
visibility: 'secret',
|
|
141
|
+
reference: {
|
|
142
|
+
source: 'secret-store',
|
|
143
|
+
projectId: 'shop',
|
|
144
|
+
environment: 'local',
|
|
145
|
+
ref: 'database',
|
|
146
|
+
key: 'password',
|
|
164
147
|
},
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
{ argv: ['shop'], command: up, context: createCapturedCommandContext('/workspace').context },
|
|
177
|
-
{ services },
|
|
178
|
-
);
|
|
179
|
-
await runInfraCommand(
|
|
180
|
-
{
|
|
181
|
-
argv: ['shop'],
|
|
182
|
-
command: down,
|
|
183
|
-
context: createCapturedCommandContext('/workspace').context,
|
|
184
|
-
},
|
|
185
|
-
{ services },
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
expect(events).toEqual([
|
|
189
|
-
'resolve-project',
|
|
190
|
-
'resolve-target',
|
|
191
|
-
'script:status',
|
|
192
|
-
'resolve-project',
|
|
193
|
-
'generate',
|
|
194
|
-
'resolve-target',
|
|
195
|
-
'script:up',
|
|
196
|
-
'resolve-project',
|
|
197
|
-
'resolve-target',
|
|
198
|
-
'script:down',
|
|
199
|
-
]);
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
artifacts: [],
|
|
151
|
+
} as const satisfies InfraLedger;
|
|
152
|
+
|
|
153
|
+
function createServices(
|
|
154
|
+
destroyRequests: InfraDestroyOperationRequest[] = [],
|
|
155
|
+
): Partial<InfraCommandServices> {
|
|
156
|
+
const manifest: AppManifest = createAppManifest('shop', {
|
|
157
|
+
environments: { local: desired },
|
|
158
|
+
modules: [],
|
|
200
159
|
});
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
})
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
})
|
|
160
|
+
return {
|
|
161
|
+
resolveProject: () =>
|
|
162
|
+
Promise.resolve({
|
|
163
|
+
appsRoot: '/workspace/apps',
|
|
164
|
+
workspaceRoot: '/workspace',
|
|
165
|
+
manifestPath: '/workspace/apps/shop/ankh.config.json',
|
|
166
|
+
projectId: 'shop',
|
|
167
|
+
projectPath: '/workspace/apps/shop',
|
|
168
|
+
manifest,
|
|
169
|
+
}),
|
|
170
|
+
readState: () => Promise.resolve({ schemaVersion: 1, desired, ledger }),
|
|
171
|
+
writeState: () => Promise.resolve(),
|
|
172
|
+
removeState: () => Promise.resolve(),
|
|
173
|
+
writeArtifacts: () => Promise.resolve({ written: 0, removed: 0 }),
|
|
174
|
+
createDependencies: () => ({
|
|
175
|
+
adapterResolver: { loadAsync: () => Promise.resolve({}) },
|
|
176
|
+
credentials: { resolveAsync: () => Promise.resolve(success({})) },
|
|
177
|
+
secrets: { resolveAsync: () => Promise.resolve(success('resolved-secret')) },
|
|
178
|
+
}),
|
|
179
|
+
operations: createOperations(destroyRequests),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function createOperations(
|
|
184
|
+
destroyRequests: InfraDestroyOperationRequest[],
|
|
185
|
+
): InfraLifecycleOperations {
|
|
186
|
+
return {
|
|
187
|
+
validate: () => Promise.resolve(success({ environment: 'local' })),
|
|
188
|
+
plan: (request) =>
|
|
189
|
+
Promise.resolve(success({ projectId: request.projectId, environment: 'local', actions: [] })),
|
|
190
|
+
generate: () => Promise.resolve(success({ environment: 'local', artifacts: [], ledger })),
|
|
191
|
+
up: () =>
|
|
192
|
+
Promise.resolve(
|
|
193
|
+
success({ environment: 'local', targets: [], resources: [], outputs: [], ledger }),
|
|
194
|
+
),
|
|
195
|
+
status: (request) =>
|
|
196
|
+
Promise.resolve(
|
|
197
|
+
success({
|
|
198
|
+
projectId: request.projectId,
|
|
199
|
+
environment: 'local',
|
|
200
|
+
state: 'ready',
|
|
201
|
+
resources: [],
|
|
202
|
+
}),
|
|
203
|
+
),
|
|
204
|
+
outputs: () => success({ environment: 'local', outputs: ledger.outputs }),
|
|
205
|
+
down: () => Promise.resolve(success({ environment: 'local', ledger })),
|
|
206
|
+
destroy: (request) => {
|
|
207
|
+
destroyRequests.push(request);
|
|
208
|
+
return Promise.resolve(success({ environment: 'local', ledger: null }));
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function requireCommand(name: string) {
|
|
214
|
+
const command = findInfraCommand(name);
|
|
215
|
+
if (command === null) throw new Error(`Missing command: ${name}`);
|
|
216
|
+
return command;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function success<T>(value: T): InfraResult<T> {
|
|
220
|
+
return { ok: true, value, diagnostics: [] };
|
|
221
|
+
}
|
|
@@ -11,14 +11,17 @@ export const INFRA_PACKAGE_VERSION = packageJson.version;
|
|
|
11
11
|
export const INFRA_COMMAND_CATEGORY = 'infra' as const satisfies AnkhCommandCategory;
|
|
12
12
|
export const INFRA_CAPABILITIES = [
|
|
13
13
|
'infra.validate',
|
|
14
|
+
'infra.plan',
|
|
14
15
|
'infra.generate',
|
|
15
|
-
'infra.status',
|
|
16
16
|
'infra.up',
|
|
17
|
+
'infra.status',
|
|
18
|
+
'infra.outputs',
|
|
17
19
|
'infra.down',
|
|
20
|
+
'infra.destroy',
|
|
18
21
|
] as const satisfies readonly AnkhCapabilityId[];
|
|
19
22
|
|
|
20
23
|
export const INFRA_PACKAGE_METADATA = {
|
|
21
24
|
category: INFRA_COMMAND_CATEGORY,
|
|
22
|
-
provider: './dist/
|
|
25
|
+
provider: './dist/cli/index.js',
|
|
23
26
|
capabilities: INFRA_CAPABILITIES,
|
|
24
27
|
} as const satisfies AnkhPackageMetadata;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
InfraAdapterDescriptor,
|
|
3
|
+
InfraComputeAdapter,
|
|
4
|
+
InfraEnvironmentSpec,
|
|
5
|
+
InfraResult,
|
|
6
|
+
InfraRuntimeAdapter,
|
|
7
|
+
InfraServiceAdapter,
|
|
8
|
+
} from '@ankhorage/contracts/infra';
|
|
9
|
+
import { INFRA_ADAPTER_CATALOG } from '@ankhorage/contracts/infra';
|
|
10
|
+
import { describe, expect, it } from 'bun:test';
|
|
11
|
+
|
|
12
|
+
import type { InfraAdapterPackageResolver } from './features/environment-lifecycle/application/ports/outbound/infraAdapterPackage';
|
|
13
|
+
import { resolveInfraAdaptersAsync } from './features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync';
|
|
14
|
+
import { resolveInfraEnvironment } from './features/environment-lifecycle/domain/resolveInfraEnvironment';
|
|
15
|
+
|
|
16
|
+
const local = {
|
|
17
|
+
deployment: { compute: { provider: 'local' }, runtime: { provider: 'docker-compose' } },
|
|
18
|
+
database: { provider: 'supabase' },
|
|
19
|
+
auth: { provider: 'supabase' },
|
|
20
|
+
authz: { provider: 'cerbos', kind: 'ABAC' },
|
|
21
|
+
} as const satisfies InfraEnvironmentSpec;
|
|
22
|
+
const manifest = { environments: { local, preview: local }, modules: [] } as const;
|
|
23
|
+
|
|
24
|
+
describe('environment safety', () => {
|
|
25
|
+
it('defaults only to local and requires explicit destroy selection', () => {
|
|
26
|
+
expect(resolveInfraEnvironment({ manifest, operation: 'up' })).toMatchObject({
|
|
27
|
+
ok: true,
|
|
28
|
+
value: { id: 'local' },
|
|
29
|
+
});
|
|
30
|
+
expect(resolveInfraEnvironment({ manifest, operation: 'destroy' })).toMatchObject({
|
|
31
|
+
ok: false,
|
|
32
|
+
diagnostics: [{ code: 'infra-environment-required' }],
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('accepts configured explicit environments and rejects unknown or absent ones', () => {
|
|
37
|
+
expect(
|
|
38
|
+
resolveInfraEnvironment({ manifest, operation: 'up', environment: 'preview' }),
|
|
39
|
+
).toMatchObject({ ok: true, value: { id: 'preview' } });
|
|
40
|
+
expect(
|
|
41
|
+
resolveInfraEnvironment({ manifest, operation: 'status', environment: 'production' }),
|
|
42
|
+
).toMatchObject({ ok: false, diagnostics: [{ code: 'infra-environment-unconfigured' }] });
|
|
43
|
+
expect(
|
|
44
|
+
resolveInfraEnvironment({ manifest, operation: 'status', environment: 'staging' }),
|
|
45
|
+
).toMatchObject({ ok: false, diagnostics: [{ code: 'infra-environment-invalid' }] });
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
describe('selected adapter resolution', () => {
|
|
50
|
+
it('loads only selected packages and deduplicates the Supabase platform', async () => {
|
|
51
|
+
const requested: string[] = [];
|
|
52
|
+
const resolver = createResolver(requested);
|
|
53
|
+
const result = await resolveInfraAdaptersAsync(local, resolver);
|
|
54
|
+
|
|
55
|
+
expect(result.ok).toBe(true);
|
|
56
|
+
expect(requested).toEqual([
|
|
57
|
+
'@ankhorage/local',
|
|
58
|
+
'@ankhorage/docker-compose',
|
|
59
|
+
'@ankhorage/supabase',
|
|
60
|
+
'@ankhorage/cerbos',
|
|
61
|
+
]);
|
|
62
|
+
if (!result.ok) throw new Error('Expected adapters.');
|
|
63
|
+
expect(result.value.services.map(({ descriptor }) => descriptor.id)).toEqual([
|
|
64
|
+
'supabase',
|
|
65
|
+
'cerbos',
|
|
66
|
+
]);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('fails closed for unavailable and malformed selected packages', async () => {
|
|
70
|
+
const missing = await resolveInfraAdaptersAsync(local, {
|
|
71
|
+
loadAsync: () => Promise.reject(new Error('missing')),
|
|
72
|
+
});
|
|
73
|
+
expect(missing.ok).toBe(false);
|
|
74
|
+
expect(
|
|
75
|
+
missing.diagnostics.every(({ code }) => code === 'infra-adapter-package-unavailable'),
|
|
76
|
+
).toBe(true);
|
|
77
|
+
|
|
78
|
+
const malformed = await resolveInfraAdaptersAsync(local, {
|
|
79
|
+
loadAsync: () => Promise.resolve({ createInfraAdapter: () => ({}) }),
|
|
80
|
+
});
|
|
81
|
+
expect(malformed.ok).toBe(false);
|
|
82
|
+
expect(malformed.diagnostics.every(({ code }) => code === 'infra-adapter-module-invalid')).toBe(
|
|
83
|
+
true,
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('rejects a factory that throws or returns another valid adapter identity', async () => {
|
|
88
|
+
const throwing = await resolveInfraAdaptersAsync(local, {
|
|
89
|
+
loadAsync(packageName) {
|
|
90
|
+
const descriptor = descriptorForPackage(packageName);
|
|
91
|
+
return Promise.resolve({
|
|
92
|
+
infraAdapterDescriptor: descriptor,
|
|
93
|
+
createInfraAdapter: () => {
|
|
94
|
+
throw new Error('secret provider detail');
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
expect(throwing.ok).toBe(false);
|
|
100
|
+
expect(throwing.diagnostics[0]).toMatchObject({ code: 'infra-local-adapter-invalid' });
|
|
101
|
+
expect(throwing.diagnostics[0]?.message).not.toContain('secret provider detail');
|
|
102
|
+
|
|
103
|
+
const mismatched = await resolveInfraAdaptersAsync(local, {
|
|
104
|
+
loadAsync(packageName) {
|
|
105
|
+
const descriptor = descriptorForPackage(packageName);
|
|
106
|
+
return Promise.resolve({
|
|
107
|
+
infraAdapterDescriptor: descriptor,
|
|
108
|
+
createInfraAdapter: () =>
|
|
109
|
+
descriptor.id === 'local'
|
|
110
|
+
? createComputeAdapter(INFRA_ADAPTER_CATALOG.hetzner)
|
|
111
|
+
: createAdapter(descriptor),
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
expect(mismatched.ok).toBe(false);
|
|
116
|
+
expect(mismatched.diagnostics[0]).toMatchObject({ code: 'infra-local-adapter-invalid' });
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
function createResolver(requested: string[]): InfraAdapterPackageResolver {
|
|
121
|
+
return {
|
|
122
|
+
loadAsync(packageName) {
|
|
123
|
+
requested.push(packageName);
|
|
124
|
+
const descriptor = descriptorForPackage(packageName);
|
|
125
|
+
return Promise.resolve({
|
|
126
|
+
infraAdapterDescriptor: descriptor,
|
|
127
|
+
createInfraAdapter: () => createAdapter(descriptor),
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function descriptorForPackage(packageName: string): InfraAdapterDescriptor {
|
|
134
|
+
const descriptor = Object.values(INFRA_ADAPTER_CATALOG).find(
|
|
135
|
+
({ package: candidate }) => candidate === packageName,
|
|
136
|
+
);
|
|
137
|
+
if (descriptor === undefined) throw new Error('Unexpected package.');
|
|
138
|
+
return descriptor;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function createAdapter(descriptor: InfraAdapterDescriptor): unknown {
|
|
142
|
+
if (descriptor.kind === 'compute') return createComputeAdapter(descriptor);
|
|
143
|
+
if (descriptor.kind === 'runtime') return createRuntimeAdapter(descriptor);
|
|
144
|
+
return createServiceAdapter(descriptor);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function createComputeAdapter(descriptor: InfraAdapterDescriptor): InfraComputeAdapter {
|
|
148
|
+
return {
|
|
149
|
+
descriptor: descriptor as InfraComputeAdapter['descriptor'],
|
|
150
|
+
validateAsync: successNull,
|
|
151
|
+
inspectAsync: () => Promise.resolve(success({ resources: [], outputs: [], targets: [] })),
|
|
152
|
+
planAsync: successEmpty,
|
|
153
|
+
ensureAsync: () => Promise.resolve(success({ resources: [], outputs: [], targets: [] })),
|
|
154
|
+
statusAsync: successEmpty,
|
|
155
|
+
destroyAsync: () => Promise.resolve(success({ resources: [], outputs: [] })),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function createRuntimeAdapter(descriptor: InfraAdapterDescriptor): InfraRuntimeAdapter {
|
|
160
|
+
return {
|
|
161
|
+
descriptor: descriptor as InfraRuntimeAdapter['descriptor'],
|
|
162
|
+
validateAsync: successNull,
|
|
163
|
+
planAsync: successEmpty,
|
|
164
|
+
ensureAsync: () => Promise.resolve(success({ resources: [], outputs: [] })),
|
|
165
|
+
statusAsync: successEmpty,
|
|
166
|
+
suspendAsync: () => Promise.resolve(success({ resources: [], outputs: [] })),
|
|
167
|
+
destroyAsync: () => Promise.resolve(success({ resources: [], outputs: [] })),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function createServiceAdapter(descriptor: InfraAdapterDescriptor): InfraServiceAdapter {
|
|
172
|
+
return {
|
|
173
|
+
descriptor: descriptor as InfraServiceAdapter['descriptor'],
|
|
174
|
+
validateAsync: successNull,
|
|
175
|
+
planAsync: successEmpty,
|
|
176
|
+
desiredWorkloadsAsync: successEmpty,
|
|
177
|
+
reconcileAsync: () => Promise.resolve(success({ resources: [], outputs: [] })),
|
|
178
|
+
statusAsync: successEmpty,
|
|
179
|
+
destroyAsync: () => Promise.resolve(success({ resources: [], outputs: [] })),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function successNull(): Promise<InfraResult<null>> {
|
|
184
|
+
return Promise.resolve(success(null));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function successEmpty<T>(): Promise<InfraResult<readonly T[]>> {
|
|
188
|
+
return Promise.resolve(success([]));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function success<T>(value: T): InfraResult<T> {
|
|
192
|
+
return { ok: true, value, diagnostics: [] };
|
|
193
|
+
}
|