@ankhorage/infra 4.1.12 → 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 +10 -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 +20 -10
- 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.ts
DELETED
|
@@ -1,404 +0,0 @@
|
|
|
1
|
-
import type { AnkhCapabilityId, AnkhCommandDescriptor } from '@ankhorage/contracts/cli';
|
|
2
|
-
|
|
3
|
-
import type { InfraCommandContext, InfraCommandRunResult } from './commandContext.js';
|
|
4
|
-
import { validateInfraSupport } from './infraValidation.js';
|
|
5
|
-
import { INFRA_CAPABILITIES, INFRA_COMMAND_CATEGORY } from './packageMetadata.js';
|
|
6
|
-
import type { ResolvedInfraProject } from './project.js';
|
|
7
|
-
import { resolveInfraProject } from './project.js';
|
|
8
|
-
import type { InfraSyncResult } from './projectInfrastructure.js';
|
|
9
|
-
import {
|
|
10
|
-
resolveProjectInfrastructureTarget,
|
|
11
|
-
syncProjectInfrastructure,
|
|
12
|
-
} from './projectInfrastructure.js';
|
|
13
|
-
import type { InfraLifecycleScript } from './runtime.js';
|
|
14
|
-
import { runProjectInfraScript } from './runtime.js';
|
|
15
|
-
|
|
16
|
-
type InfraCommandName = 'down' | 'generate' | 'status' | 'up' | 'validate';
|
|
17
|
-
|
|
18
|
-
interface InfraCommandRunRequest {
|
|
19
|
-
readonly context: InfraCommandContext;
|
|
20
|
-
readonly projectId?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
type InfraCommandImplementation = (
|
|
24
|
-
request: InfraCommandRunRequest,
|
|
25
|
-
services: InfraCommandServices,
|
|
26
|
-
) => Promise<InfraCommandRunResult>;
|
|
27
|
-
|
|
28
|
-
export interface InfraCommandDefinition {
|
|
29
|
-
readonly capability: AnkhCapabilityId;
|
|
30
|
-
readonly path: readonly [InfraCommandName];
|
|
31
|
-
readonly standaloneName: InfraCommandName;
|
|
32
|
-
readonly summary: string;
|
|
33
|
-
readonly run: InfraCommandImplementation;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface InfraCommandInvocation {
|
|
37
|
-
readonly argv: readonly string[];
|
|
38
|
-
readonly command: InfraCommandDefinition;
|
|
39
|
-
readonly context: InfraCommandContext;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface InfraCommandServices {
|
|
43
|
-
readonly resolveProject: (options: {
|
|
44
|
-
readonly cwd: string;
|
|
45
|
-
readonly projectId?: string;
|
|
46
|
-
}) => Promise<ResolvedInfraProject>;
|
|
47
|
-
readonly resolveProjectInfrastructureTarget: (args: {
|
|
48
|
-
readonly manifest: ResolvedInfraProject['manifest'];
|
|
49
|
-
readonly projectPath: string;
|
|
50
|
-
}) => Promise<string | null>;
|
|
51
|
-
readonly runProjectInfraScript: (args: {
|
|
52
|
-
readonly context: InfraCommandContext;
|
|
53
|
-
readonly projectId: string;
|
|
54
|
-
readonly projectPath: string;
|
|
55
|
-
readonly script: InfraLifecycleScript;
|
|
56
|
-
readonly target: string;
|
|
57
|
-
}) => Promise<void>;
|
|
58
|
-
readonly syncProjectInfrastructure: (args: {
|
|
59
|
-
readonly manifest: ResolvedInfraProject['manifest'];
|
|
60
|
-
readonly projectId: string;
|
|
61
|
-
readonly projectPath: string;
|
|
62
|
-
}) => Promise<InfraSyncResult>;
|
|
63
|
-
readonly validateInfraSupport: typeof validateInfraSupport;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export interface RunInfraCommandOptions {
|
|
67
|
-
readonly runCommandImpl?: RunInfraCommandImpl;
|
|
68
|
-
readonly services?: Partial<InfraCommandServices>;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export type RunInfraCommandImpl = (
|
|
72
|
-
request: InfraCommandInvocation,
|
|
73
|
-
options?: RunInfraCommandOptions,
|
|
74
|
-
) => Promise<InfraCommandRunResult>;
|
|
75
|
-
|
|
76
|
-
const COMMAND_CAPABILITIES = {
|
|
77
|
-
validate: INFRA_CAPABILITIES[0],
|
|
78
|
-
generate: INFRA_CAPABILITIES[1],
|
|
79
|
-
status: INFRA_CAPABILITIES[2],
|
|
80
|
-
up: INFRA_CAPABILITIES[3],
|
|
81
|
-
down: INFRA_CAPABILITIES[4],
|
|
82
|
-
} as const satisfies Record<InfraCommandName, AnkhCapabilityId>;
|
|
83
|
-
|
|
84
|
-
export const INFRA_COMMANDS = [
|
|
85
|
-
{
|
|
86
|
-
standaloneName: 'validate',
|
|
87
|
-
path: ['validate'],
|
|
88
|
-
capability: COMMAND_CAPABILITIES.validate,
|
|
89
|
-
summary: 'Validate infra support for a project manifest.',
|
|
90
|
-
run: runValidateCommand,
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
standaloneName: 'generate',
|
|
94
|
-
path: ['generate'],
|
|
95
|
-
capability: COMMAND_CAPABILITIES.generate,
|
|
96
|
-
summary: 'Generate infra artifacts and update the infra ledger for a project.',
|
|
97
|
-
run: runGenerateCommand,
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
standaloneName: 'status',
|
|
101
|
-
path: ['status'],
|
|
102
|
-
capability: COMMAND_CAPABILITIES.status,
|
|
103
|
-
summary: 'Run the generated runtime status script for a project.',
|
|
104
|
-
run: runStatusCommand,
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
standaloneName: 'up',
|
|
108
|
-
path: ['up'],
|
|
109
|
-
capability: COMMAND_CAPABILITIES.up,
|
|
110
|
-
summary: 'Generate infra artifacts, then run the generated up script.',
|
|
111
|
-
run: runUpCommand,
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
standaloneName: 'down',
|
|
115
|
-
path: ['down'],
|
|
116
|
-
capability: COMMAND_CAPABILITIES.down,
|
|
117
|
-
summary: 'Run the generated down script for a project.',
|
|
118
|
-
run: runDownCommand,
|
|
119
|
-
},
|
|
120
|
-
] as const satisfies readonly InfraCommandDefinition[];
|
|
121
|
-
|
|
122
|
-
export async function runInfraCommand(
|
|
123
|
-
request: InfraCommandInvocation,
|
|
124
|
-
options: RunInfraCommandOptions = {},
|
|
125
|
-
): Promise<InfraCommandRunResult> {
|
|
126
|
-
const services = createInfraCommandServices(options.services);
|
|
127
|
-
|
|
128
|
-
try {
|
|
129
|
-
const parsedArgs = parseCommandArguments(request.command, request.argv);
|
|
130
|
-
if (parsedArgs.kind === 'help') {
|
|
131
|
-
request.context.writeStdout(renderCommandHelp(request.command));
|
|
132
|
-
return { exitCode: 0 };
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return await request.command.run(
|
|
136
|
-
{
|
|
137
|
-
context: request.context,
|
|
138
|
-
projectId: parsedArgs.projectId,
|
|
139
|
-
},
|
|
140
|
-
services,
|
|
141
|
-
);
|
|
142
|
-
} catch (error) {
|
|
143
|
-
request.context.writeStderr(renderCommandFailure(request.command.standaloneName, error));
|
|
144
|
-
return { exitCode: 1 };
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export function createProviderCommandDescriptors(): readonly AnkhCommandDescriptor[] {
|
|
149
|
-
return INFRA_COMMANDS.map((command) => ({
|
|
150
|
-
capability: command.capability,
|
|
151
|
-
path: command.path,
|
|
152
|
-
summary: command.summary,
|
|
153
|
-
}));
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export function findInfraCommandByStandaloneName(value: string): InfraCommandDefinition | null {
|
|
157
|
-
return INFRA_COMMANDS.find((command) => command.standaloneName === value) ?? null;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export function renderRootHelp(version: string): string {
|
|
161
|
-
const commandLines = INFRA_COMMANDS.map(
|
|
162
|
-
(command) => ` ${command.standaloneName.padEnd(8, ' ')} ${command.summary}`,
|
|
163
|
-
).join('\n');
|
|
164
|
-
|
|
165
|
-
return [
|
|
166
|
-
`@ankhorage/infra v${version}`,
|
|
167
|
-
'',
|
|
168
|
-
'Usage:',
|
|
169
|
-
` ankhorage-infra <command> [project]`,
|
|
170
|
-
` ankh ${INFRA_COMMAND_CATEGORY} <command> [project]`,
|
|
171
|
-
'',
|
|
172
|
-
'Commands:',
|
|
173
|
-
commandLines,
|
|
174
|
-
'',
|
|
175
|
-
'Project resolution:',
|
|
176
|
-
' Pass [project], or omit it when cwd is inside apps/<project>.',
|
|
177
|
-
'',
|
|
178
|
-
].join('\n');
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
export function renderUnknownCommand(value: string): string {
|
|
182
|
-
return [`Unknown infra command: ${value}`, '', 'Run ankhorage-infra --help', ''].join('\n');
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function renderCommandHelp(command: InfraCommandDefinition): string {
|
|
186
|
-
return [
|
|
187
|
-
`${command.summary}`,
|
|
188
|
-
'',
|
|
189
|
-
'Usage:',
|
|
190
|
-
` ankhorage-infra ${command.standaloneName} [project]`,
|
|
191
|
-
` ankh ${INFRA_COMMAND_CATEGORY} ${command.path.join(' ')} [project]`,
|
|
192
|
-
'',
|
|
193
|
-
'Project resolution:',
|
|
194
|
-
' Pass [project], or omit it when cwd is inside apps/<project>.',
|
|
195
|
-
'',
|
|
196
|
-
].join('\n');
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
function createInfraCommandServices(
|
|
200
|
-
overrides: Partial<InfraCommandServices> = {},
|
|
201
|
-
): InfraCommandServices {
|
|
202
|
-
return {
|
|
203
|
-
resolveProject: overrides.resolveProject ?? resolveInfraProject,
|
|
204
|
-
resolveProjectInfrastructureTarget:
|
|
205
|
-
overrides.resolveProjectInfrastructureTarget ?? resolveProjectInfrastructureTarget,
|
|
206
|
-
runProjectInfraScript: overrides.runProjectInfraScript ?? runProjectInfraScript,
|
|
207
|
-
syncProjectInfrastructure: overrides.syncProjectInfrastructure ?? syncProjectInfrastructure,
|
|
208
|
-
validateInfraSupport: overrides.validateInfraSupport ?? validateInfraSupport,
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function parseCommandArguments(
|
|
213
|
-
command: InfraCommandDefinition,
|
|
214
|
-
argv: readonly string[],
|
|
215
|
-
): { readonly kind: 'help' } | { readonly kind: 'run'; readonly projectId?: string } {
|
|
216
|
-
if (argv.length === 1 && isHelpToken(argv[0])) {
|
|
217
|
-
return { kind: 'help' };
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (argv.length > 1) {
|
|
221
|
-
throw new Error(`Infra ${command.standaloneName} accepts at most one project argument.`);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
return {
|
|
225
|
-
kind: 'run',
|
|
226
|
-
projectId: argv[0],
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
async function runValidateCommand(
|
|
231
|
-
request: InfraCommandRunRequest,
|
|
232
|
-
services: InfraCommandServices,
|
|
233
|
-
): Promise<InfraCommandRunResult> {
|
|
234
|
-
const project = await services.resolveProject({
|
|
235
|
-
cwd: request.context.cwd,
|
|
236
|
-
projectId: request.projectId,
|
|
237
|
-
});
|
|
238
|
-
const warnings = [...services.validateInfraSupport(project.manifest.infra)];
|
|
239
|
-
|
|
240
|
-
request.context.writeStdout(`projectId: ${project.projectId}\n`);
|
|
241
|
-
request.context.writeStdout(`infraConfigSupport: ${warnings.length === 0 ? 'ok' : 'warnings'}\n`);
|
|
242
|
-
writeWarnings(request.context, warnings);
|
|
243
|
-
|
|
244
|
-
return { exitCode: 0 };
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
async function runGenerateCommand(
|
|
248
|
-
request: InfraCommandRunRequest,
|
|
249
|
-
services: InfraCommandServices,
|
|
250
|
-
): Promise<InfraCommandRunResult> {
|
|
251
|
-
const project = await services.resolveProject({
|
|
252
|
-
cwd: request.context.cwd,
|
|
253
|
-
projectId: request.projectId,
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
request.context.writeStdout(`Regenerating infrastructure for project: ${project.projectId}...\n`);
|
|
257
|
-
|
|
258
|
-
const result = await services.syncProjectInfrastructure({
|
|
259
|
-
manifest: project.manifest,
|
|
260
|
-
projectId: project.projectId,
|
|
261
|
-
projectPath: project.projectPath,
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
if (result.skipped !== undefined) {
|
|
265
|
-
request.context.writeStdout(`Skipped: ${result.skipped.reason}\n`);
|
|
266
|
-
return { exitCode: 0 };
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
request.context.writeStdout(`Generated: ${result.generated}, removed stale: ${result.removed}\n`);
|
|
270
|
-
writeWarnings(request.context, result.warnings);
|
|
271
|
-
|
|
272
|
-
return { exitCode: 0 };
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
async function runStatusCommand(
|
|
276
|
-
request: InfraCommandRunRequest,
|
|
277
|
-
services: InfraCommandServices,
|
|
278
|
-
): Promise<InfraCommandRunResult> {
|
|
279
|
-
const project = await services.resolveProject({
|
|
280
|
-
cwd: request.context.cwd,
|
|
281
|
-
projectId: request.projectId,
|
|
282
|
-
});
|
|
283
|
-
const target = await services.resolveProjectInfrastructureTarget({
|
|
284
|
-
manifest: project.manifest,
|
|
285
|
-
projectPath: project.projectPath,
|
|
286
|
-
});
|
|
287
|
-
|
|
288
|
-
if (target === null) {
|
|
289
|
-
throw new Error(
|
|
290
|
-
`Project '${project.projectId}' has no infrastructure target. Run infra generation first.`,
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
await services.runProjectInfraScript({
|
|
295
|
-
context: request.context,
|
|
296
|
-
projectId: project.projectId,
|
|
297
|
-
projectPath: project.projectPath,
|
|
298
|
-
script: 'status',
|
|
299
|
-
target,
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
return { exitCode: 0 };
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
async function runUpCommand(
|
|
306
|
-
request: InfraCommandRunRequest,
|
|
307
|
-
services: InfraCommandServices,
|
|
308
|
-
): Promise<InfraCommandRunResult> {
|
|
309
|
-
const project = await services.resolveProject({
|
|
310
|
-
cwd: request.context.cwd,
|
|
311
|
-
projectId: request.projectId,
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
request.context.writeStdout(`Preparing infrastructure for project: ${project.projectId}...\n`);
|
|
315
|
-
|
|
316
|
-
const generateResult = await services.syncProjectInfrastructure({
|
|
317
|
-
manifest: project.manifest,
|
|
318
|
-
projectId: project.projectId,
|
|
319
|
-
projectPath: project.projectPath,
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
if (generateResult.skipped !== undefined) {
|
|
323
|
-
request.context.writeStdout(`Skipped: ${generateResult.skipped.reason}\n`);
|
|
324
|
-
return { exitCode: 0 };
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
writeWarnings(request.context, generateResult.warnings);
|
|
328
|
-
|
|
329
|
-
const target = await services.resolveProjectInfrastructureTarget({
|
|
330
|
-
manifest: project.manifest,
|
|
331
|
-
projectPath: project.projectPath,
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
if (project.manifest.infra.deployment === undefined || target === null) {
|
|
335
|
-
throw new Error(
|
|
336
|
-
`Project '${project.projectId}' has no infra.deployment target configured in ankh.config.json.`,
|
|
337
|
-
);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
await services.runProjectInfraScript({
|
|
341
|
-
context: request.context,
|
|
342
|
-
projectId: project.projectId,
|
|
343
|
-
projectPath: project.projectPath,
|
|
344
|
-
script: 'up',
|
|
345
|
-
target,
|
|
346
|
-
});
|
|
347
|
-
request.context.writeStdout('Infrastructure is up.\n');
|
|
348
|
-
|
|
349
|
-
return { exitCode: 0 };
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
async function runDownCommand(
|
|
353
|
-
request: InfraCommandRunRequest,
|
|
354
|
-
services: InfraCommandServices,
|
|
355
|
-
): Promise<InfraCommandRunResult> {
|
|
356
|
-
const project = await services.resolveProject({
|
|
357
|
-
cwd: request.context.cwd,
|
|
358
|
-
projectId: request.projectId,
|
|
359
|
-
});
|
|
360
|
-
const target = await services.resolveProjectInfrastructureTarget({
|
|
361
|
-
manifest: project.manifest,
|
|
362
|
-
projectPath: project.projectPath,
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
if (target === null) {
|
|
366
|
-
throw new Error(
|
|
367
|
-
`Project '${project.projectId}' has no infrastructure target. Run infra generation first.`,
|
|
368
|
-
);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
await services.runProjectInfraScript({
|
|
372
|
-
context: request.context,
|
|
373
|
-
projectId: project.projectId,
|
|
374
|
-
projectPath: project.projectPath,
|
|
375
|
-
script: 'down',
|
|
376
|
-
target,
|
|
377
|
-
});
|
|
378
|
-
request.context.writeStdout('Infrastructure is down.\n');
|
|
379
|
-
|
|
380
|
-
return { exitCode: 0 };
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
function writeWarnings(context: InfraCommandContext, warnings: readonly string[]): void {
|
|
384
|
-
if (warnings.length === 0) {
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
context.writeStderr('Warnings:\n');
|
|
389
|
-
for (const warning of warnings) {
|
|
390
|
-
context.writeStderr(`- ${warning}\n`);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
function renderCommandFailure(commandName: InfraCommandName, error: unknown): string {
|
|
395
|
-
return `Infra ${commandName} failed: ${getErrorMessage(error)}\n`;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
function getErrorMessage(error: unknown): string {
|
|
399
|
-
return error instanceof Error ? error.message : String(error);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
function isHelpToken(value: string | undefined): boolean {
|
|
403
|
-
return value === '--help' || value === '-h' || value === 'help';
|
|
404
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { expect, test } from 'bun:test';
|
|
2
|
-
import { promises as fs } from 'fs';
|
|
3
|
-
import os from 'os';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
|
|
6
|
-
import { syncProjectInfrastructure } from './projectInfrastructure';
|
|
7
|
-
import { createAppManifest } from './testSupport';
|
|
8
|
-
|
|
9
|
-
const OBSOLETE_FILES = [
|
|
10
|
-
'infra/minikube/db/generated-api-resources.json',
|
|
11
|
-
'infra/minikube/db/migrations/001_generated_api_resources.sql',
|
|
12
|
-
] as const;
|
|
13
|
-
|
|
14
|
-
test('removes obsolete generated API database artifacts tracked by the infra ledger', async () => {
|
|
15
|
-
const projectPath = await fs.mkdtemp(path.join(os.tmpdir(), 'infra-api-cleanup-'));
|
|
16
|
-
|
|
17
|
-
try {
|
|
18
|
-
await writeObsoleteArtifacts(projectPath);
|
|
19
|
-
const manifest = createAppManifest('shop', {
|
|
20
|
-
deployment: { target: 'minikube', monitoring: false },
|
|
21
|
-
modules: [],
|
|
22
|
-
});
|
|
23
|
-
const result = await syncProjectInfrastructure({
|
|
24
|
-
projectId: 'shop',
|
|
25
|
-
projectPath,
|
|
26
|
-
manifest,
|
|
27
|
-
generateInfrastructureImpl: () => ({
|
|
28
|
-
files: [],
|
|
29
|
-
warnings: [],
|
|
30
|
-
meta: { target: 'minikube', providers: [] },
|
|
31
|
-
dependencies: [],
|
|
32
|
-
}),
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
expect(result.removed).toBe(OBSOLETE_FILES.length);
|
|
36
|
-
for (const filePath of OBSOLETE_FILES) {
|
|
37
|
-
expect(await pathExists(path.join(projectPath, filePath))).toBe(false);
|
|
38
|
-
}
|
|
39
|
-
} finally {
|
|
40
|
-
await fs.rm(projectPath, { force: true, recursive: true });
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
async function writeObsoleteArtifacts(projectPath: string): Promise<void> {
|
|
45
|
-
for (const filePath of OBSOLETE_FILES) {
|
|
46
|
-
const absolutePath = path.join(projectPath, filePath);
|
|
47
|
-
await fs.mkdir(path.dirname(absolutePath), { recursive: true });
|
|
48
|
-
await fs.writeFile(absolutePath, 'obsolete', 'utf8');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
await fs.mkdir(path.join(projectPath, '.ankh'), { recursive: true });
|
|
52
|
-
await fs.writeFile(
|
|
53
|
-
path.join(projectPath, '.ankh/infra-ledger.json'),
|
|
54
|
-
JSON.stringify({
|
|
55
|
-
schemaVersion: 1,
|
|
56
|
-
generatedAt: new Date().toISOString(),
|
|
57
|
-
target: 'minikube',
|
|
58
|
-
files: OBSOLETE_FILES,
|
|
59
|
-
warnings: [],
|
|
60
|
-
}),
|
|
61
|
-
'utf8',
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
async function pathExists(filePath: string): Promise<boolean> {
|
|
66
|
-
try {
|
|
67
|
-
await fs.access(filePath);
|
|
68
|
-
return true;
|
|
69
|
-
} catch {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
|
|
3
|
-
import { validateInfraSupport } from './infraValidation';
|
|
4
|
-
import type { InfraManifestInput } from './types';
|
|
5
|
-
|
|
6
|
-
describe('canonical API support validation', () => {
|
|
7
|
-
test('does not warn for external APIs', () => {
|
|
8
|
-
const manifest: InfraManifestInput = {
|
|
9
|
-
modules: [],
|
|
10
|
-
apis: [
|
|
11
|
-
{
|
|
12
|
-
id: 'nutrition',
|
|
13
|
-
origin: 'external',
|
|
14
|
-
protocol: 'rest',
|
|
15
|
-
baseUrl: 'https://api.ankhorage.com/v1/nutrition',
|
|
16
|
-
endpoints: {},
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
expect(validateInfraSupport(manifest)).toEqual([]);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test('reports every internal API as unsupported without treating it as invalid', () => {
|
|
25
|
-
const manifest: InfraManifestInput = {
|
|
26
|
-
modules: [],
|
|
27
|
-
apis: [
|
|
28
|
-
{
|
|
29
|
-
id: 'orders',
|
|
30
|
-
origin: 'internal',
|
|
31
|
-
protocol: 'rest',
|
|
32
|
-
basePath: '/api/orders',
|
|
33
|
-
endpoints: {},
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
expect(validateInfraSupport(manifest)).toEqual([
|
|
39
|
-
'infra.apis.orders has origin "internal", but internal API provisioning is not supported in Phase 1; no API infrastructure will be generated.',
|
|
40
|
-
]);
|
|
41
|
-
});
|
|
42
|
-
});
|
package/src/infraValidation.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AUTH_PROVIDERS,
|
|
3
|
-
AUTH_SCOPES,
|
|
4
|
-
AUTHZ_ENGINES,
|
|
5
|
-
DATABASE_PROVIDERS,
|
|
6
|
-
DEPLOYMENT_TARGETS,
|
|
7
|
-
} from '@ankhorage/contracts';
|
|
8
|
-
|
|
9
|
-
import type { InfraManifestInput } from './types.js';
|
|
10
|
-
|
|
11
|
-
export function validateInfraSupport(manifest: InfraManifestInput): readonly string[] {
|
|
12
|
-
const warnings: string[] = [...validateInfraApiSupport(manifest)];
|
|
13
|
-
|
|
14
|
-
const deploymentTarget = manifest.deployment?.target;
|
|
15
|
-
if (deploymentTarget !== undefined && !isSupported(deploymentTarget, DEPLOYMENT_TARGETS)) {
|
|
16
|
-
warnings.push(
|
|
17
|
-
warningForUnsupportedValue({
|
|
18
|
-
path: 'infra.deployment.target',
|
|
19
|
-
value: deploymentTarget,
|
|
20
|
-
supported: DEPLOYMENT_TARGETS,
|
|
21
|
-
}),
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const databaseProvider = manifest.database?.provider;
|
|
26
|
-
if (databaseProvider !== undefined && !isSupported(databaseProvider, DATABASE_PROVIDERS)) {
|
|
27
|
-
warnings.push(
|
|
28
|
-
warningForUnsupportedValue({
|
|
29
|
-
path: 'infra.database.provider',
|
|
30
|
-
value: databaseProvider,
|
|
31
|
-
supported: DATABASE_PROVIDERS,
|
|
32
|
-
}),
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const authProvider = manifest.auth?.provider;
|
|
37
|
-
if (authProvider !== undefined && !isSupported(authProvider, AUTH_PROVIDERS)) {
|
|
38
|
-
warnings.push(
|
|
39
|
-
warningForUnsupportedValue({
|
|
40
|
-
path: 'infra.auth.provider',
|
|
41
|
-
value: authProvider,
|
|
42
|
-
supported: AUTH_PROVIDERS,
|
|
43
|
-
}),
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const authScope = manifest.auth?.scope;
|
|
48
|
-
if (authScope !== undefined && !isSupported(authScope, AUTH_SCOPES)) {
|
|
49
|
-
warnings.push(
|
|
50
|
-
warningForUnsupportedValue({
|
|
51
|
-
path: 'infra.auth.scope',
|
|
52
|
-
value: authScope,
|
|
53
|
-
supported: AUTH_SCOPES,
|
|
54
|
-
}),
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const authzEngine = manifest.auth?.authorization?.engine;
|
|
59
|
-
if (authzEngine !== undefined && !isSupported(authzEngine, AUTHZ_ENGINES)) {
|
|
60
|
-
warnings.push(
|
|
61
|
-
warningForUnsupportedValue({
|
|
62
|
-
path: 'infra.auth.authorization.engine',
|
|
63
|
-
value: authzEngine,
|
|
64
|
-
supported: AUTHZ_ENGINES,
|
|
65
|
-
}),
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return warnings;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function validateInfraApiSupport(manifest: InfraManifestInput): readonly string[] {
|
|
73
|
-
return (manifest.apis ?? [])
|
|
74
|
-
.filter((api) => api.origin === 'internal')
|
|
75
|
-
.map(
|
|
76
|
-
(api) =>
|
|
77
|
-
`infra.apis.${api.id} has origin "internal", but internal API provisioning is not supported in Phase 1; no API infrastructure will be generated.`,
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function warningForUnsupportedValue(args: {
|
|
82
|
-
readonly path: string;
|
|
83
|
-
readonly value: string;
|
|
84
|
-
readonly supported: readonly string[];
|
|
85
|
-
}): string {
|
|
86
|
-
return `${args.path} "${args.value}" is not currently supported by implemented generators. Supported values: ${formatSupportedValues(args.supported)}.`;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function formatSupportedValues(values: readonly string[]): string {
|
|
90
|
-
if (values.length === 0) {
|
|
91
|
-
return '(none)';
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return values.join(', ');
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function isSupported(value: string, supported: readonly string[]): boolean {
|
|
98
|
-
return supported.includes(value);
|
|
99
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
|
|
3
|
-
import { generateInfrastructure } from './index';
|
|
4
|
-
import { createAppManifest } from './testSupport';
|
|
5
|
-
import type { InfraManifestInput } from './types';
|
|
6
|
-
|
|
7
|
-
describe('minikube generated app image lifecycle', () => {
|
|
8
|
-
test('exposes generated cleanup flags and Docker image labels', () => {
|
|
9
|
-
const manifest: InfraManifestInput = {
|
|
10
|
-
deployment: {
|
|
11
|
-
target: 'minikube',
|
|
12
|
-
monitoring: false,
|
|
13
|
-
},
|
|
14
|
-
modules: [],
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const result = generateInfrastructure(manifest, { appManifest: createAppManifest('shop') });
|
|
18
|
-
|
|
19
|
-
const envExample = result.files.find((file) => file.path === 'infra/minikube/.env.example');
|
|
20
|
-
expect(envExample?.content).toContain('APP_IMAGE=ankh/shop:dev');
|
|
21
|
-
expect(envExample?.content).toContain('APP_IMAGE_CLEANUP_ON_DESTROY=true');
|
|
22
|
-
expect(envExample?.content).toContain('APP_IMAGE_CLEANUP_MINIKUBE=true');
|
|
23
|
-
expect(envExample?.content).toContain('APP_IMAGE_CLEANUP_DOCKER=true');
|
|
24
|
-
|
|
25
|
-
const appBuildScript = result.files.find(
|
|
26
|
-
(file) => file.path === 'infra/minikube/scripts/build-app-image.sh',
|
|
27
|
-
);
|
|
28
|
-
expect(appBuildScript?.content).toContain('docker build');
|
|
29
|
-
expect(appBuildScript?.content).toContain('--label "ankhorage.kind=generated-app"');
|
|
30
|
-
expect(appBuildScript?.content).toContain('--label "ankhorage.app_slug=${PROFILE}"');
|
|
31
|
-
expect(appBuildScript?.content).toContain('--label "ankhorage.image=${APP_IMAGE}"');
|
|
32
|
-
expect(appBuildScript?.content).toContain('-t "${APP_IMAGE}"');
|
|
33
|
-
expect(appBuildScript?.content).toContain('-f "${DOCKERFILE_PATH}"');
|
|
34
|
-
});
|
|
35
|
-
});
|
package/src/projectDatabase.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { readProjectInfrastructureEnvironment } from './projectEnvironment.js';
|
|
2
|
-
|
|
3
|
-
const DATABASE_URL_KEYS = [
|
|
4
|
-
'ANKH_SECRET_STORE_DATABASE_URL',
|
|
5
|
-
'SUPABASE_DB_URL',
|
|
6
|
-
'POSTGRES_URL',
|
|
7
|
-
'DB_URL',
|
|
8
|
-
'DATABASE_URL',
|
|
9
|
-
] as const;
|
|
10
|
-
|
|
11
|
-
export async function resolveProjectInfrastructureDatabaseUrl(args: {
|
|
12
|
-
readonly projectPath: string;
|
|
13
|
-
readonly target: string;
|
|
14
|
-
}): Promise<string | null> {
|
|
15
|
-
const environment = await readProjectInfrastructureEnvironment({
|
|
16
|
-
keys: DATABASE_URL_KEYS,
|
|
17
|
-
projectPath: args.projectPath,
|
|
18
|
-
target: args.target,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
for (const key of DATABASE_URL_KEYS) {
|
|
22
|
-
const value = environment[key]?.trim();
|
|
23
|
-
if (value) return value;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return null;
|
|
27
|
-
}
|