@ankhorage/infra 4.1.12 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -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/composition/createProjectInfraLifecycle.d.ts +4 -0
- package/dist/features/environment-lifecycle/composition/createProjectInfraLifecycle.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/composition/createProjectInfraLifecycle.js +123 -0
- package/dist/features/environment-lifecycle/composition/createProjectInfraLifecycle.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 +8 -5
- package/dist/project/index.d.ts.map +1 -1
- package/dist/project/index.js +7 -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/types/infraProject.d.ts +43 -0
- 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/composition/createProjectInfraLifecycle.ts +157 -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 +10 -188
- package/src/project/index.ts +15 -22
- package/src/project.test.ts +39 -189
- package/src/projectContractsParser.test.ts +2 -2
- package/src/projectInfrastructure.test.ts +121 -167
- package/src/projectLifecycle.test.ts +136 -0
- 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 +58 -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 +0 -14
- 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
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { INFRA_PACKAGE_VERSION } from '../../../constants.js';
|
|
2
|
+
import { createInfraCommandServices } from './createInfraCommandServices.js';
|
|
3
|
+
/*** Create the typed project-facing Infra lifecycle backed by canonical use cases and ownership state. */
|
|
4
|
+
export function createProjectInfraLifecycle(options = {}) {
|
|
5
|
+
const services = createInfraCommandServices(options.services);
|
|
6
|
+
return {
|
|
7
|
+
async validateAsync(request) {
|
|
8
|
+
const prepared = await prepareProjectOperationAsync(request, services);
|
|
9
|
+
return services.operations.validate(prepared.operation, prepared.dependencies);
|
|
10
|
+
},
|
|
11
|
+
async planAsync(request) {
|
|
12
|
+
const prepared = await prepareProjectOperationAsync(request, services);
|
|
13
|
+
return services.operations.plan(prepared.operation, prepared.dependencies);
|
|
14
|
+
},
|
|
15
|
+
async generateAsync(request) {
|
|
16
|
+
const prepared = await prepareProjectOperationAsync(request, services);
|
|
17
|
+
const result = await services.operations.generate(prepared.operation, prepared.dependencies);
|
|
18
|
+
if (!result.ok)
|
|
19
|
+
return result;
|
|
20
|
+
await services.writeArtifacts(request.projectPath, result.value.artifacts, prepared.state?.ledger);
|
|
21
|
+
await services.writeState(request.projectPath, {
|
|
22
|
+
schemaVersion: 1,
|
|
23
|
+
desired: prepared.desired,
|
|
24
|
+
ledger: result.value.ledger,
|
|
25
|
+
});
|
|
26
|
+
return result;
|
|
27
|
+
},
|
|
28
|
+
async upAsync(request) {
|
|
29
|
+
const prepared = await prepareProjectOperationAsync(request, services);
|
|
30
|
+
const result = await services.operations.up(prepared.operation, prepared.dependencies);
|
|
31
|
+
if (!result.ok)
|
|
32
|
+
return result;
|
|
33
|
+
await services.writeState(request.projectPath, {
|
|
34
|
+
schemaVersion: 1,
|
|
35
|
+
desired: prepared.desired,
|
|
36
|
+
ledger: result.value.ledger,
|
|
37
|
+
});
|
|
38
|
+
return result;
|
|
39
|
+
},
|
|
40
|
+
async statusAsync(request) {
|
|
41
|
+
const prepared = await prepareProjectOperationAsync(request, services);
|
|
42
|
+
return services.operations.status(prepared.operation, prepared.dependencies);
|
|
43
|
+
},
|
|
44
|
+
async outputsAsync(request) {
|
|
45
|
+
const prepared = await prepareProjectOperationAsync(request, services);
|
|
46
|
+
return services.operations.outputs(prepared.operation);
|
|
47
|
+
},
|
|
48
|
+
async downAsync(request) {
|
|
49
|
+
const prepared = await prepareProjectOperationAsync(request, services);
|
|
50
|
+
const result = await services.operations.down(prepared.operation, prepared.dependencies);
|
|
51
|
+
if (!result.ok)
|
|
52
|
+
return result;
|
|
53
|
+
await services.writeState(request.projectPath, {
|
|
54
|
+
schemaVersion: 1,
|
|
55
|
+
desired: prepared.desired,
|
|
56
|
+
ledger: result.value.ledger,
|
|
57
|
+
});
|
|
58
|
+
return result;
|
|
59
|
+
},
|
|
60
|
+
async destroyAsync(request) {
|
|
61
|
+
const prepared = await prepareProjectOperationAsync(request, services, true);
|
|
62
|
+
const result = await services.operations.destroy({
|
|
63
|
+
...prepared.operation,
|
|
64
|
+
confirmation: request.confirmation,
|
|
65
|
+
persistence: request.persistence,
|
|
66
|
+
}, prepared.dependencies);
|
|
67
|
+
if (!result.ok)
|
|
68
|
+
return result;
|
|
69
|
+
await services.writeArtifacts(request.projectPath, [], prepared.state?.ledger);
|
|
70
|
+
if (result.value.ledger === null)
|
|
71
|
+
await services.removeState(request.projectPath, request.environment);
|
|
72
|
+
else {
|
|
73
|
+
await services.writeState(request.projectPath, {
|
|
74
|
+
schemaVersion: 1,
|
|
75
|
+
desired: prepared.desired,
|
|
76
|
+
ledger: result.value.ledger,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/*** Resolve one explicit project/environment request with its prior ownership state and dependencies. */
|
|
84
|
+
async function prepareProjectOperationAsync(request, services, useStoredDesired = false) {
|
|
85
|
+
const state = await services.readState(request.projectPath, request.environment);
|
|
86
|
+
const currentDesired = readEnvironment(request.manifest, request.environment);
|
|
87
|
+
const desired = useStoredDesired && state !== null ? state.desired : currentDesired;
|
|
88
|
+
if (desired === undefined) {
|
|
89
|
+
throw new Error(`Infra environment "${request.environment}" is not configured.`);
|
|
90
|
+
}
|
|
91
|
+
const context = {
|
|
92
|
+
cwd: request.projectPath,
|
|
93
|
+
env: request.executionEnvironment ?? process.env,
|
|
94
|
+
version: INFRA_PACKAGE_VERSION,
|
|
95
|
+
writeStdout: () => undefined,
|
|
96
|
+
writeStderr: () => undefined,
|
|
97
|
+
};
|
|
98
|
+
return {
|
|
99
|
+
state,
|
|
100
|
+
desired,
|
|
101
|
+
operation: {
|
|
102
|
+
projectId: request.projectId,
|
|
103
|
+
manifest: replaceEnvironment(request.manifest, request.environment, desired),
|
|
104
|
+
environment: request.environment,
|
|
105
|
+
...(state === null ? {} : { previous: state.ledger, previousDesired: state.desired }),
|
|
106
|
+
...(request.signal === undefined ? {} : { signal: request.signal }),
|
|
107
|
+
},
|
|
108
|
+
dependencies: services.createDependencies(context),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/*** Read one exact environment without inventing a fallback. */
|
|
112
|
+
function readEnvironment(manifest, environment) {
|
|
113
|
+
if (environment === 'local')
|
|
114
|
+
return manifest.environments.local;
|
|
115
|
+
if (environment === 'preview')
|
|
116
|
+
return manifest.environments.preview;
|
|
117
|
+
return manifest.environments.production;
|
|
118
|
+
}
|
|
119
|
+
/*** Replace one selected environment while preserving all other manifest state. */
|
|
120
|
+
function replaceEnvironment(manifest, environment, desired) {
|
|
121
|
+
return { ...manifest, environments: { ...manifest.environments, [environment]: desired } };
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=createProjectInfraLifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createProjectInfraLifecycle.js","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/composition/createProjectInfraLifecycle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAO9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAA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AAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;SACpE;QACD,YAAY,EAAE,QAAQ,CAAC,kBAAkB,CAAC,OAAO,CAAC;KACnD,CAAC;AACJ,CAAC;AAED,gEAAgE;AAChE,SAAS,eAAe,CACtB,QAAuB,EACvB,WAAwD;IAExD,IAAI,WAAW,KAAK,OAAO;QAAE,OAAO,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC;IAChE,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC;IACpE,OAAO,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC;AAC1C,CAAC;AAED,mFAAmF;AACnF,SAAS,kBAAkB,CACzB,QAAuB,EACvB,WAAwD,EACxD,OAA6B;IAE7B,OAAO,EAAE,GAAG,QAAQ,EAAE,YAAY,EAAE,EAAE,GAAG,QAAQ,CAAC,YAAY,EAAE,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC;AAC7F,CAAC","sourcesContent":["import type { InfraEnvironmentSpec, InfraManifest } from '@ankhorage/contracts/infra';\n\nimport { INFRA_PACKAGE_VERSION } from '../../../constants.js';\nimport type { InfraOperationRequest, InfraStoredState } from '../../../types/infraOrchestration.js';\nimport type {\n CreateProjectInfraLifecycleOptions,\n ProjectInfraLifecycle,\n ProjectInfraOperationRequest,\n} from '../../../types/infraProject.js';\nimport { createInfraCommandServices } from './createInfraCommandServices.js';\n\n/*** Create the typed project-facing Infra lifecycle backed by canonical use cases and ownership state. */\nexport function createProjectInfraLifecycle(\n options: CreateProjectInfraLifecycleOptions = {},\n): ProjectInfraLifecycle {\n const services = createInfraCommandServices(options.services);\n return {\n async validateAsync(request) {\n const prepared = await prepareProjectOperationAsync(request, services);\n return services.operations.validate(prepared.operation, prepared.dependencies);\n },\n async planAsync(request) {\n const prepared = await prepareProjectOperationAsync(request, services);\n return services.operations.plan(prepared.operation, prepared.dependencies);\n },\n async generateAsync(request) {\n const prepared = await prepareProjectOperationAsync(request, services);\n const result = await services.operations.generate(prepared.operation, prepared.dependencies);\n if (!result.ok) return result;\n await services.writeArtifacts(\n request.projectPath,\n result.value.artifacts,\n prepared.state?.ledger,\n );\n await services.writeState(request.projectPath, {\n schemaVersion: 1,\n desired: prepared.desired,\n ledger: result.value.ledger,\n });\n return result;\n },\n async upAsync(request) {\n const prepared = await prepareProjectOperationAsync(request, services);\n const result = await services.operations.up(prepared.operation, prepared.dependencies);\n if (!result.ok) return result;\n await services.writeState(request.projectPath, {\n schemaVersion: 1,\n desired: prepared.desired,\n ledger: result.value.ledger,\n });\n return result;\n },\n async statusAsync(request) {\n const prepared = await prepareProjectOperationAsync(request, services);\n return services.operations.status(prepared.operation, prepared.dependencies);\n },\n async outputsAsync(request) {\n const prepared = await prepareProjectOperationAsync(request, services);\n return services.operations.outputs(prepared.operation);\n },\n async downAsync(request) {\n const prepared = await prepareProjectOperationAsync(request, services);\n const result = await services.operations.down(prepared.operation, prepared.dependencies);\n if (!result.ok) return result;\n await services.writeState(request.projectPath, {\n schemaVersion: 1,\n desired: prepared.desired,\n ledger: result.value.ledger,\n });\n return result;\n },\n async destroyAsync(request) {\n const prepared = await prepareProjectOperationAsync(request, services, true);\n const result = await services.operations.destroy(\n {\n ...prepared.operation,\n confirmation: request.confirmation,\n persistence: request.persistence,\n },\n prepared.dependencies,\n );\n if (!result.ok) return result;\n await services.writeArtifacts(request.projectPath, [], prepared.state?.ledger);\n if (result.value.ledger === null)\n await services.removeState(request.projectPath, request.environment);\n else {\n await services.writeState(request.projectPath, {\n schemaVersion: 1,\n desired: prepared.desired,\n ledger: result.value.ledger,\n });\n }\n return result;\n },\n };\n}\n\ninterface PreparedProjectOperation {\n readonly operation: InfraOperationRequest;\n readonly desired: InfraEnvironmentSpec;\n readonly state: InfraStoredState | null;\n readonly dependencies: ReturnType<\n ReturnType<typeof createInfraCommandServices>['createDependencies']\n >;\n}\n\n/*** Resolve one explicit project/environment request with its prior ownership state and dependencies. */\nasync function prepareProjectOperationAsync(\n request: ProjectInfraOperationRequest,\n services: ReturnType<typeof createInfraCommandServices>,\n useStoredDesired = false,\n): Promise<PreparedProjectOperation> {\n const state = await services.readState(request.projectPath, request.environment);\n const currentDesired = readEnvironment(request.manifest, request.environment);\n const desired = useStoredDesired && state !== null ? state.desired : currentDesired;\n if (desired === undefined) {\n throw new Error(`Infra environment \"${request.environment}\" is not configured.`);\n }\n const context = {\n cwd: request.projectPath,\n env: request.executionEnvironment ?? process.env,\n version: INFRA_PACKAGE_VERSION,\n writeStdout: () => undefined,\n writeStderr: () => undefined,\n };\n return {\n state,\n desired,\n operation: {\n projectId: request.projectId,\n manifest: replaceEnvironment(request.manifest, request.environment, desired),\n environment: request.environment,\n ...(state === null ? {} : { previous: state.ledger, previousDesired: state.desired }),\n ...(request.signal === undefined ? {} : { signal: request.signal }),\n },\n dependencies: services.createDependencies(context),\n };\n}\n\n/*** Read one exact environment without inventing a fallback. */\nfunction readEnvironment(\n manifest: InfraManifest,\n environment: ProjectInfraOperationRequest['environment'],\n): InfraEnvironmentSpec | undefined {\n if (environment === 'local') return manifest.environments.local;\n if (environment === 'preview') return manifest.environments.preview;\n return manifest.environments.production;\n}\n\n/*** Replace one selected environment while preserving all other manifest state. */\nfunction replaceEnvironment(\n manifest: InfraManifest,\n environment: ProjectInfraOperationRequest['environment'],\n desired: InfraEnvironmentSpec,\n): InfraManifest {\n return { ...manifest, environments: { ...manifest.environments, [environment]: desired } };\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InfraPlanAction, InfraResult } from '@ankhorage/contracts/infra';
|
|
2
|
+
/*** Order plan actions dependency-first and reject duplicate owners or dependency cycles. */
|
|
3
|
+
export declare function orderInfraPlanActions(actions: readonly InfraPlanAction[]): InfraResult<readonly InfraPlanAction[]>;
|
|
4
|
+
//# sourceMappingURL=orderInfraPlanActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orderInfraPlanActions.d.ts","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/domain/orderInfraPlanActions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAEf,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAEpC,6FAA6F;AAC7F,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,SAAS,eAAe,EAAE,GAClC,WAAW,CAAC,SAAS,eAAe,EAAE,CAAC,CAWzC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*** Order plan actions dependency-first and reject duplicate owners or dependency cycles. */
|
|
2
|
+
export function orderInfraPlanActions(actions) {
|
|
3
|
+
const byOwner = new Map(actions.map((action) => [identityKey(action.owner), action]));
|
|
4
|
+
if (byOwner.size !== actions.length)
|
|
5
|
+
return invalidPlan('duplicate resource actions');
|
|
6
|
+
const ordered = [];
|
|
7
|
+
const complete = new Set();
|
|
8
|
+
const active = new Set();
|
|
9
|
+
for (const action of actions) {
|
|
10
|
+
const result = visitAction(action, byOwner, ordered, complete, active);
|
|
11
|
+
if (!result.ok)
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
return { ok: true, value: ordered, diagnostics: [] };
|
|
15
|
+
}
|
|
16
|
+
/*** Visit one plan node and its in-plan dependencies exactly once. */
|
|
17
|
+
function visitAction(action, byOwner, ordered, complete, active) {
|
|
18
|
+
const key = identityKey(action.owner);
|
|
19
|
+
if (complete.has(key))
|
|
20
|
+
return { ok: true, value: null, diagnostics: [] };
|
|
21
|
+
if (active.has(key))
|
|
22
|
+
return invalidPlan('a dependency cycle');
|
|
23
|
+
active.add(key);
|
|
24
|
+
for (const dependency of action.dependsOn) {
|
|
25
|
+
const dependencyAction = byOwner.get(identityKey(dependency));
|
|
26
|
+
if (dependencyAction === undefined)
|
|
27
|
+
continue;
|
|
28
|
+
const result = visitAction(dependencyAction, byOwner, ordered, complete, active);
|
|
29
|
+
if (!result.ok)
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
active.delete(key);
|
|
33
|
+
complete.add(key);
|
|
34
|
+
ordered.push(action);
|
|
35
|
+
return { ok: true, value: null, diagnostics: [] };
|
|
36
|
+
}
|
|
37
|
+
/*** Create a collision-safe key for one provider-owned resource identity. */
|
|
38
|
+
function identityKey(identity) {
|
|
39
|
+
return `${identity.projectId}\0${identity.environment}\0${identity.adapter}\0${identity.resourceId}`;
|
|
40
|
+
}
|
|
41
|
+
/*** Reject an invalid aggregated plan without exposing provider internals. */
|
|
42
|
+
function invalidPlan(detail) {
|
|
43
|
+
return {
|
|
44
|
+
ok: false,
|
|
45
|
+
diagnostics: [
|
|
46
|
+
{
|
|
47
|
+
severity: 'error',
|
|
48
|
+
code: 'infra-plan-invalid',
|
|
49
|
+
message: `The aggregated infrastructure plan contains ${detail}.`,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=orderInfraPlanActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orderInfraPlanActions.js","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/domain/orderInfraPlanActions.ts"],"names":[],"mappings":"AAMA,6FAA6F;AAC7F,MAAM,UAAU,qBAAqB,CACnC,OAAmC;IAEnC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACtF,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM;QAAE,OAAO,WAAW,CAAC,4BAA4B,CAAC,CAAC;IACtF,MAAM,OAAO,GAAsB,EAAE,CAAC;IACtC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,MAAM,MAAM,GAA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;IACnB,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrB,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;AACpD,CAAC;AAED,6EAA6E;AAC7E,SAAS,WAAW,CAAC,QAA+B;IAClD,OAAO,GAAG,QAAQ,CAAC,SAAS,KAAK,QAAQ,CAAC,WAAW,KAAK,QAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC;AACvG,CAAC;AAED,8EAA8E;AAC9E,SAAS,WAAW,CAAC,MAAc;IACjC,OAAO;QACL,EAAE,EAAE,KAAK;QACT,WAAW,EAAE;YACX;gBACE,QAAQ,EAAE,OAAO;gBACjB,IAAI,EAAE,oBAAoB;gBAC1B,OAAO,EAAE,+CAA+C,MAAM,GAAG;aAClE;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type {\n InfraPlanAction,\n InfraResourceIdentity,\n InfraResult,\n} from '@ankhorage/contracts/infra';\n\n/*** Order plan actions dependency-first and reject duplicate owners or dependency cycles. */\nexport function orderInfraPlanActions(\n actions: readonly InfraPlanAction[],\n): InfraResult<readonly InfraPlanAction[]> {\n const byOwner = new Map(actions.map((action) => [identityKey(action.owner), action]));\n if (byOwner.size !== actions.length) return invalidPlan('duplicate resource actions');\n const ordered: InfraPlanAction[] = [];\n const complete = new Set<string>();\n const active = new Set<string>();\n for (const action of actions) {\n const result = visitAction(action, byOwner, ordered, complete, active);\n if (!result.ok) return result;\n }\n return { ok: true, value: ordered, diagnostics: [] };\n}\n\n/*** Visit one plan node and its in-plan dependencies exactly once. */\nfunction visitAction(\n action: InfraPlanAction,\n byOwner: ReadonlyMap<string, InfraPlanAction>,\n ordered: InfraPlanAction[],\n complete: Set<string>,\n active: Set<string>,\n): InfraResult<null> {\n const key = identityKey(action.owner);\n if (complete.has(key)) return { ok: true, value: null, diagnostics: [] };\n if (active.has(key)) return invalidPlan('a dependency cycle');\n active.add(key);\n for (const dependency of action.dependsOn) {\n const dependencyAction = byOwner.get(identityKey(dependency));\n if (dependencyAction === undefined) continue;\n const result = visitAction(dependencyAction, byOwner, ordered, complete, active);\n if (!result.ok) return result;\n }\n active.delete(key);\n complete.add(key);\n ordered.push(action);\n return { ok: true, value: null, diagnostics: [] };\n}\n\n/*** Create a collision-safe key for one provider-owned resource identity. */\nfunction identityKey(identity: InfraResourceIdentity): string {\n return `${identity.projectId}\\0${identity.environment}\\0${identity.adapter}\\0${identity.resourceId}`;\n}\n\n/*** Reject an invalid aggregated plan without exposing provider internals. */\nfunction invalidPlan(detail: string): InfraResult<never> {\n return {\n ok: false,\n diagnostics: [\n {\n severity: 'error',\n code: 'infra-plan-invalid',\n message: `The aggregated infrastructure plan contains ${detail}.`,\n },\n ],\n };\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { InfraResult } from '@ankhorage/contracts/infra';
|
|
2
|
+
import type { InfraEnvironmentResolutionRequest, ResolvedInfraEnvironment } from '../../../types/infraOrchestration.js';
|
|
3
|
+
/*** Resolve one explicitly configured environment while keeping local as the only safe default. */
|
|
4
|
+
export declare function resolveInfraEnvironment(request: InfraEnvironmentResolutionRequest): InfraResult<ResolvedInfraEnvironment>;
|
|
5
|
+
//# sourceMappingURL=resolveInfraEnvironment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveInfraEnvironment.d.ts","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/domain/resolveInfraEnvironment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,KAAK,EACV,iCAAiC,EACjC,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAE9C,mGAAmG;AACnG,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,iCAAiC,GACzC,WAAW,CAAC,wBAAwB,CAAC,CAyBvC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { APP_ENVIRONMENT_IDS } from '@ankhorage/contracts/environments';
|
|
2
|
+
/*** Resolve one explicitly configured environment while keeping local as the only safe default. */
|
|
3
|
+
export function resolveInfraEnvironment(request) {
|
|
4
|
+
if (request.operation === 'destroy' && request.environment === undefined) {
|
|
5
|
+
return failure('infra-environment-required', 'Infra destroy requires an explicit --environment selection.');
|
|
6
|
+
}
|
|
7
|
+
const environment = request.environment ?? 'local';
|
|
8
|
+
if (!isAppEnvironmentId(environment)) {
|
|
9
|
+
return failure('infra-environment-invalid', `Unknown Infra environment "${environment}". Expected local, preview, or production.`);
|
|
10
|
+
}
|
|
11
|
+
const desired = getEnvironment(request.manifest, environment);
|
|
12
|
+
return desired === undefined
|
|
13
|
+
? failure('infra-environment-unconfigured', `Infra environment "${environment}" is not configured.`)
|
|
14
|
+
: {
|
|
15
|
+
ok: true,
|
|
16
|
+
value: { id: environment, desired, manifest: request.manifest },
|
|
17
|
+
diagnostics: [],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/*** Read a closed environment key without an open object-injection boundary. */
|
|
21
|
+
function getEnvironment(manifest, environment) {
|
|
22
|
+
switch (environment) {
|
|
23
|
+
case 'local':
|
|
24
|
+
return manifest.environments.local;
|
|
25
|
+
case 'preview':
|
|
26
|
+
return manifest.environments.preview;
|
|
27
|
+
case 'production':
|
|
28
|
+
return manifest.environments.production;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/*** Narrow a CLI environment string through the canonical Contracts vocabulary. */
|
|
32
|
+
function isAppEnvironmentId(value) {
|
|
33
|
+
return APP_ENVIRONMENT_IDS.some((environment) => environment === value);
|
|
34
|
+
}
|
|
35
|
+
/*** Create a stable environment-resolution diagnostic. */
|
|
36
|
+
function failure(code, message) {
|
|
37
|
+
return { ok: false, diagnostics: [{ severity: 'error', code, message }] };
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=resolveInfraEnvironment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveInfraEnvironment.js","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/domain/resolveInfraEnvironment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAyB,MAAM,mCAAmC,CAAC;AAQ/F,mGAAmG;AACnG,MAAM,UAAU,uBAAuB,CACrC,OAA0C;IAE1C,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACzE,OAAO,OAAO,CACZ,4BAA4B,EAC5B,6DAA6D,CAC9D,CAAC;IACJ,CAAC;IACD,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC;IACnD,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,EAAE,CAAC;QACrC,OAAO,OAAO,CACZ,2BAA2B,EAC3B,8BAA8B,WAAW,4CAA4C,CACtF,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC9D,OAAO,OAAO,KAAK,SAAS;QAC1B,CAAC,CAAC,OAAO,CACL,gCAAgC,EAChC,sBAAsB,WAAW,sBAAsB,CACxD;QACH,CAAC,CAAC;YACE,EAAE,EAAE,IAAI;YACR,KAAK,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE;YAC/D,WAAW,EAAE,EAAE;SAChB,CAAC;AACR,CAAC;AAED,gFAAgF;AAChF,SAAS,cAAc,CACrB,QAAuD,EACvD,WAA6B;IAE7B,QAAQ,WAAW,EAAE,CAAC;QACpB,KAAK,OAAO;YACV,OAAO,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC;QACrC,KAAK,SAAS;YACZ,OAAO,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC;QACvC,KAAK,YAAY;YACf,OAAO,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC;IAC5C,CAAC;AACH,CAAC;AAED,mFAAmF;AACnF,SAAS,kBAAkB,CAAC,KAAa;IACvC,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,KAAK,KAAK,CAAC,CAAC;AAC1E,CAAC;AAED,0DAA0D;AAC1D,SAAS,OAAO,CAAC,IAAY,EAAE,OAAe;IAC5C,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AAC5E,CAAC","sourcesContent":["import { APP_ENVIRONMENT_IDS, type AppEnvironmentId } from '@ankhorage/contracts/environments';\nimport type { InfraResult } from '@ankhorage/contracts/infra';\n\nimport type {\n InfraEnvironmentResolutionRequest,\n ResolvedInfraEnvironment,\n} from '../../../types/infraOrchestration.js';\n\n/*** Resolve one explicitly configured environment while keeping local as the only safe default. */\nexport function resolveInfraEnvironment(\n request: InfraEnvironmentResolutionRequest,\n): InfraResult<ResolvedInfraEnvironment> {\n if (request.operation === 'destroy' && request.environment === undefined) {\n return failure(\n 'infra-environment-required',\n 'Infra destroy requires an explicit --environment selection.',\n );\n }\n const environment = request.environment ?? 'local';\n if (!isAppEnvironmentId(environment)) {\n return failure(\n 'infra-environment-invalid',\n `Unknown Infra environment \"${environment}\". Expected local, preview, or production.`,\n );\n }\n const desired = getEnvironment(request.manifest, environment);\n return desired === undefined\n ? failure(\n 'infra-environment-unconfigured',\n `Infra environment \"${environment}\" is not configured.`,\n )\n : {\n ok: true,\n value: { id: environment, desired, manifest: request.manifest },\n diagnostics: [],\n };\n}\n\n/*** Read a closed environment key without an open object-injection boundary. */\nfunction getEnvironment(\n manifest: InfraEnvironmentResolutionRequest['manifest'],\n environment: AppEnvironmentId,\n) {\n switch (environment) {\n case 'local':\n return manifest.environments.local;\n case 'preview':\n return manifest.environments.preview;\n case 'production':\n return manifest.environments.production;\n }\n}\n\n/*** Narrow a CLI environment string through the canonical Contracts vocabulary. */\nfunction isAppEnvironmentId(value: string): value is AppEnvironmentId {\n return APP_ENVIRONMENT_IDS.some((environment) => environment === value);\n}\n\n/*** Create a stable environment-resolution diagnostic. */\nfunction failure(code: string, message: string): InfraResult<never> {\n return { ok: false, diagnostics: [{ severity: 'error', code, message }] };\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { InfraDiagnostic, InfraResult } from '@ankhorage/contracts/infra';
|
|
2
|
+
/*** Preserve earlier safe diagnostics when a later lifecycle stage fails. */
|
|
3
|
+
export declare function appendInfraFailure(previous: readonly InfraDiagnostic[], failure: {
|
|
4
|
+
readonly ok: false;
|
|
5
|
+
readonly diagnostics: readonly InfraDiagnostic[];
|
|
6
|
+
}): InfraResult<never>;
|
|
7
|
+
//# sourceMappingURL=appendInfraFailure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appendInfraFailure.d.ts","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/utils/appendInfraFailure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE/E,6EAA6E;AAC7E,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,SAAS,eAAe,EAAE,EACpC,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,SAAS,eAAe,EAAE,CAAA;CAAE,GAChF,WAAW,CAAC,KAAK,CAAC,CAEpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appendInfraFailure.js","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/utils/appendInfraFailure.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,MAAM,UAAU,kBAAkB,CAChC,QAAoC,EACpC,OAAiF;IAEjF,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;AAC3E,CAAC","sourcesContent":["import type { InfraDiagnostic, InfraResult } from '@ankhorage/contracts/infra';\n\n/*** Preserve earlier safe diagnostics when a later lifecycle stage fails. */\nexport function appendInfraFailure(\n previous: readonly InfraDiagnostic[],\n failure: { readonly ok: false; readonly diagnostics: readonly InfraDiagnostic[] },\n): InfraResult<never> {\n return { ok: false, diagnostics: [...previous, ...failure.diagnostics] };\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { InfraExecutionContext } from '@ankhorage/contracts/infra';
|
|
2
|
+
import type { InfraOperationRequest, InfraOrchestrationDependencies, ResolvedInfraEnvironment } from '../../../types/infraOrchestration.js';
|
|
3
|
+
/*** Create one execution context without copying resolved secret values into serializable state. */
|
|
4
|
+
export declare function createInfraExecutionContext(request: InfraOperationRequest, environment: ResolvedInfraEnvironment, dependencies: InfraOrchestrationDependencies): InfraExecutionContext;
|
|
5
|
+
//# sourceMappingURL=createInfraExecutionContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createInfraExecutionContext.d.ts","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/utils/createInfraExecutionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,KAAK,EACV,qBAAqB,EACrB,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAE9C,oGAAoG;AACpG,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,qBAAqB,EAC9B,WAAW,EAAE,wBAAwB,EACrC,YAAY,EAAE,8BAA8B,GAC3C,qBAAqB,CAUvB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*** Create one execution context without copying resolved secret values into serializable state. */
|
|
2
|
+
export function createInfraExecutionContext(request, environment, dependencies) {
|
|
3
|
+
return {
|
|
4
|
+
projectId: request.projectId,
|
|
5
|
+
environment: environment.id,
|
|
6
|
+
desired: environment.desired,
|
|
7
|
+
...(request.previous === undefined ? {} : { previous: request.previous }),
|
|
8
|
+
...(request.signal === undefined ? {} : { signal: request.signal }),
|
|
9
|
+
credentials: dependencies.credentials,
|
|
10
|
+
secrets: dependencies.secrets,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=createInfraExecutionContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createInfraExecutionContext.js","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/utils/createInfraExecutionContext.ts"],"names":[],"mappings":"AAQA,oGAAoG;AACpG,MAAM,UAAU,2BAA2B,CACzC,OAA8B,EAC9B,WAAqC,EACrC,YAA4C;IAE5C,OAAO;QACL,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,WAAW,EAAE,WAAW,CAAC,EAAE;QAC3B,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzE,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;QACnE,WAAW,EAAE,YAAY,CAAC,WAAW;QACrC,OAAO,EAAE,YAAY,CAAC,OAAO;KAC9B,CAAC;AACJ,CAAC","sourcesContent":["import type { InfraExecutionContext } from '@ankhorage/contracts/infra';\n\nimport type {\n InfraOperationRequest,\n InfraOrchestrationDependencies,\n ResolvedInfraEnvironment,\n} from '../../../types/infraOrchestration.js';\n\n/*** Create one execution context without copying resolved secret values into serializable state. */\nexport function createInfraExecutionContext(\n request: InfraOperationRequest,\n environment: ResolvedInfraEnvironment,\n dependencies: InfraOrchestrationDependencies,\n): InfraExecutionContext {\n return {\n projectId: request.projectId,\n environment: environment.id,\n desired: environment.desired,\n ...(request.previous === undefined ? {} : { previous: request.previous }),\n ...(request.signal === undefined ? {} : { signal: request.signal }),\n credentials: dependencies.credentials,\n secrets: dependencies.secrets,\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createInfraFailure.d.ts","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/utils/createInfraFailure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,4DAA4D;AAC5D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAEpF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createInfraFailure.js","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/utils/createInfraFailure.ts"],"names":[],"mappings":"AAEA,4DAA4D;AAC5D,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,OAAe;IAC9D,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AAC5E,CAAC","sourcesContent":["import type { InfraResult } from '@ankhorage/contracts/infra';\n\n/*** Create one sanitized provider-neutral Infra failure. */\nexport function createInfraFailure(code: string, message: string): InfraResult<never> {\n return { ok: false, diagnostics: [{ severity: 'error', code, message }] };\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { InfraComputeTarget, InfraGeneratedArtifact, InfraLedger, InfraOutput, InfraOwnedResource } from '@ankhorage/contracts/infra';
|
|
2
|
+
/*** Create deterministic serializable lifecycle state without resolved credential or secret values. */
|
|
3
|
+
export declare function createInfraLedger(input: {
|
|
4
|
+
readonly projectId: string;
|
|
5
|
+
readonly environment: InfraLedger['environment'];
|
|
6
|
+
readonly targets: readonly InfraComputeTarget[];
|
|
7
|
+
readonly resources: readonly InfraOwnedResource[];
|
|
8
|
+
readonly outputs: readonly InfraOutput[];
|
|
9
|
+
readonly artifacts?: readonly InfraGeneratedArtifact[];
|
|
10
|
+
readonly previous?: InfraLedger;
|
|
11
|
+
}): InfraLedger;
|
|
12
|
+
//# sourceMappingURL=createInfraLedger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createInfraLedger.d.ts","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/utils/createInfraLedger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,WAAW,EACX,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAEpC,uGAAuG;AACvG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;IACjD,QAAQ,CAAC,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAChD,QAAQ,CAAC,SAAS,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACvD,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC;CACjC,GAAG,WAAW,CAYd"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*** Create deterministic serializable lifecycle state without resolved credential or secret values. */
|
|
2
|
+
export function createInfraLedger(input) {
|
|
3
|
+
const artifacts = input.artifacts?.map(({ owner, path }) => ({ owner, path })) ?? input.previous?.artifacts ?? [];
|
|
4
|
+
return {
|
|
5
|
+
schemaVersion: 1,
|
|
6
|
+
projectId: input.projectId,
|
|
7
|
+
environment: input.environment,
|
|
8
|
+
targets: input.targets,
|
|
9
|
+
resources: input.resources,
|
|
10
|
+
outputs: input.outputs,
|
|
11
|
+
artifacts,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=createInfraLedger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createInfraLedger.js","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/utils/createInfraLedger.ts"],"names":[],"mappings":"AAQA,uGAAuG;AACvG,MAAM,UAAU,iBAAiB,CAAC,KAQjC;IACC,MAAM,SAAS,GACb,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,SAAS,IAAI,EAAE,CAAC;IAClG,OAAO;QACL,aAAa,EAAE,CAAC;QAChB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,SAAS;KACV,CAAC;AACJ,CAAC","sourcesContent":["import type {\n InfraComputeTarget,\n InfraGeneratedArtifact,\n InfraLedger,\n InfraOutput,\n InfraOwnedResource,\n} from '@ankhorage/contracts/infra';\n\n/*** Create deterministic serializable lifecycle state without resolved credential or secret values. */\nexport function createInfraLedger(input: {\n readonly projectId: string;\n readonly environment: InfraLedger['environment'];\n readonly targets: readonly InfraComputeTarget[];\n readonly resources: readonly InfraOwnedResource[];\n readonly outputs: readonly InfraOutput[];\n readonly artifacts?: readonly InfraGeneratedArtifact[];\n readonly previous?: InfraLedger;\n}): InfraLedger {\n const artifacts =\n input.artifacts?.map(({ owner, path }) => ({ owner, path })) ?? input.previous?.artifacts ?? [];\n return {\n schemaVersion: 1,\n projectId: input.projectId,\n environment: input.environment,\n targets: input.targets,\n resources: input.resources,\n outputs: input.outputs,\n artifacts,\n };\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InfraResourceIdentity } from '@ankhorage/contracts/infra';
|
|
2
|
+
/*** Create a stable collision-safe key for an Infra-owned resource. */
|
|
3
|
+
export declare function infraIdentityKey(identity: InfraResourceIdentity): string;
|
|
4
|
+
//# sourceMappingURL=infraIdentityKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infraIdentityKey.d.ts","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/utils/infraIdentityKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE,uEAAuE;AACvE,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,MAAM,CAExE"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*** Create a stable collision-safe key for an Infra-owned resource. */
|
|
2
|
+
export function infraIdentityKey(identity) {
|
|
3
|
+
return `${identity.projectId}\0${identity.environment}\0${identity.adapter}\0${identity.resourceId}`;
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=infraIdentityKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infraIdentityKey.js","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/utils/infraIdentityKey.ts"],"names":[],"mappings":"AAEA,uEAAuE;AACvE,MAAM,UAAU,gBAAgB,CAAC,QAA+B;IAC9D,OAAO,GAAG,QAAQ,CAAC,SAAS,KAAK,QAAQ,CAAC,WAAW,KAAK,QAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC;AACvG,CAAC","sourcesContent":["import type { InfraResourceIdentity } from '@ankhorage/contracts/infra';\n\n/*** Create a stable collision-safe key for an Infra-owned resource. */\nexport function infraIdentityKey(identity: InfraResourceIdentity): string {\n return `${identity.projectId}\\0${identity.environment}\\0${identity.adapter}\\0${identity.resourceId}`;\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InfraStoredState } from '../../../types/infraOrchestration.js';
|
|
2
|
+
/*** Validate persisted ownership state before any provider receives it. */
|
|
3
|
+
export declare function isInfraStoredState(value: unknown): value is InfraStoredState;
|
|
4
|
+
//# sourceMappingURL=isInfraStoredState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isInfraStoredState.d.ts","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/utils/isInfraStoredState.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAO5E"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { APP_ENVIRONMENT_IDS } from '@ankhorage/contracts/environments';
|
|
2
|
+
import { INFRA_ADAPTER_CATALOG, isInfraEnvironmentSpec, } from '@ankhorage/contracts/infra';
|
|
3
|
+
/*** Validate persisted ownership state before any provider receives it. */
|
|
4
|
+
export function isInfraStoredState(value) {
|
|
5
|
+
return (isRecord(value) &&
|
|
6
|
+
value.schemaVersion === 1 &&
|
|
7
|
+
isInfraEnvironmentSpec(value.desired) &&
|
|
8
|
+
isInfraLedger(value.ledger));
|
|
9
|
+
}
|
|
10
|
+
/*** Validate the canonical ledger's serializable outer boundary. */
|
|
11
|
+
function isInfraLedger(value) {
|
|
12
|
+
if (isRecord(value) &&
|
|
13
|
+
value.schemaVersion === 1 &&
|
|
14
|
+
typeof value.projectId === 'string' &&
|
|
15
|
+
typeof value.environment === 'string' &&
|
|
16
|
+
APP_ENVIRONMENT_IDS.some((environment) => environment === value.environment) &&
|
|
17
|
+
Array.isArray(value.targets) &&
|
|
18
|
+
Array.isArray(value.resources) &&
|
|
19
|
+
Array.isArray(value.outputs) &&
|
|
20
|
+
Array.isArray(value.artifacts)) {
|
|
21
|
+
const { environment, projectId } = value;
|
|
22
|
+
return (value.targets.every(isComputeTarget) &&
|
|
23
|
+
value.resources.every((resource) => isOwnedResource(resource, projectId, environment)) &&
|
|
24
|
+
value.outputs.every((output) => isOutput(output, projectId, environment)) &&
|
|
25
|
+
value.artifacts.every((artifact) => isArtifactIdentity(artifact, projectId, environment)));
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
/*** Validate portable compute targets without accepting resolved credential payloads. */
|
|
30
|
+
function isComputeTarget(value) {
|
|
31
|
+
if (!isRecord(value) ||
|
|
32
|
+
typeof value.id !== 'string' ||
|
|
33
|
+
!['linux', 'darwin', 'windows'].includes(String(value.os)) ||
|
|
34
|
+
!['amd64', 'arm64'].includes(String(value.architecture))) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if (value.kind === 'local-host')
|
|
38
|
+
return true;
|
|
39
|
+
return (value.kind === 'ssh-host' &&
|
|
40
|
+
typeof value.host === 'string' &&
|
|
41
|
+
typeof value.port === 'number' &&
|
|
42
|
+
typeof value.user === 'string' &&
|
|
43
|
+
typeof value.hostKeyFingerprint === 'string' &&
|
|
44
|
+
isControlPlaneReference(value.credential));
|
|
45
|
+
}
|
|
46
|
+
/*** Validate one exact resource plus its dependency identities. */
|
|
47
|
+
function isOwnedResource(value, projectId, environment) {
|
|
48
|
+
return (isRecord(value) &&
|
|
49
|
+
isScopedIdentity(value.identity, projectId, environment) &&
|
|
50
|
+
typeof value.persistent === 'boolean' &&
|
|
51
|
+
(value.retention === 'retain' || value.retention === 'delete-on-destroy') &&
|
|
52
|
+
Array.isArray(value.dependsOn) &&
|
|
53
|
+
value.dependsOn.every((identity) => isScopedIdentity(identity, projectId, environment)));
|
|
54
|
+
}
|
|
55
|
+
/*** Enforce the public-value versus secret-reference output union at rest. */
|
|
56
|
+
function isOutput(value, projectId, environment) {
|
|
57
|
+
if (!isRecord(value) ||
|
|
58
|
+
!isScopedIdentity(value.owner, projectId, environment) ||
|
|
59
|
+
typeof value.name !== 'string') {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
if (value.visibility === 'public') {
|
|
63
|
+
return (['string', 'number', 'boolean'].includes(typeof value.value) &&
|
|
64
|
+
value.reference === undefined &&
|
|
65
|
+
(value.environmentVariable === undefined || typeof value.environmentVariable === 'string'));
|
|
66
|
+
}
|
|
67
|
+
return (value.visibility === 'secret' &&
|
|
68
|
+
value.value === undefined &&
|
|
69
|
+
value.environmentVariable === undefined &&
|
|
70
|
+
isSecretReference(value.reference, projectId, environment));
|
|
71
|
+
}
|
|
72
|
+
/*** Validate one generated-artifact ledger identity without accepting file content. */
|
|
73
|
+
function isArtifactIdentity(value, projectId, environment) {
|
|
74
|
+
return (isRecord(value) &&
|
|
75
|
+
isScopedIdentity(value.owner, projectId, environment) &&
|
|
76
|
+
typeof value.path === 'string');
|
|
77
|
+
}
|
|
78
|
+
/*** Validate scope, adapter catalog identity, and resource ID. */
|
|
79
|
+
function isScopedIdentity(value, projectId, environment) {
|
|
80
|
+
return (isRecord(value) &&
|
|
81
|
+
value.projectId === projectId &&
|
|
82
|
+
value.environment === environment &&
|
|
83
|
+
Object.values(INFRA_ADAPTER_CATALOG).some(({ id }) => id === value.adapter) &&
|
|
84
|
+
typeof value.resourceId === 'string');
|
|
85
|
+
}
|
|
86
|
+
/*** Validate an unresolved control-plane credential identity. */
|
|
87
|
+
function isControlPlaneReference(value) {
|
|
88
|
+
return isRecord(value) && value.source === 'control-plane' && typeof value.name === 'string';
|
|
89
|
+
}
|
|
90
|
+
/*** Validate an unresolved secret reference scoped to this exact ledger. */
|
|
91
|
+
function isSecretReference(value, projectId, environment) {
|
|
92
|
+
return (isRecord(value) &&
|
|
93
|
+
value.source === 'secret-store' &&
|
|
94
|
+
value.projectId === projectId &&
|
|
95
|
+
value.environment === environment &&
|
|
96
|
+
typeof value.ref === 'string' &&
|
|
97
|
+
typeof value.key === 'string');
|
|
98
|
+
}
|
|
99
|
+
/*** Narrow parsed values. */
|
|
100
|
+
function isRecord(value) {
|
|
101
|
+
return typeof value === 'object' && value !== null;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=isInfraStoredState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isInfraStoredState.js","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/utils/isInfraStoredState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EACL,qBAAqB,EAErB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AAIpC,2EAA2E;AAC3E,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,CACL,QAAQ,CAAC,KAAK,CAAC;QACf,KAAK,CAAC,aAAa,KAAK,CAAC;QACzB,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC;QACrC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAC5B,CAAC;AACJ,CAAC;AAED,oEAAoE;AACpE,SAAS,aAAa,CAAC,KAAc;IACnC,IACE,QAAQ,CAAC,KAAK,CAAC;QACf,KAAK,CAAC,aAAa,KAAK,CAAC;QACzB,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ;QACnC,OAAO,KAAK,CAAC,WAAW,KAAK,QAAQ;QACrC,mBAAmB,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,KAAK,KAAK,CAAC,WAAW,CAAC;QAC5E,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;QAC5B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,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AE,WAAmB;IAC/E,OAAO,CACL,QAAQ,CAAC,KAAK,CAAC;QACf,KAAK,CAAC,MAAM,KAAK,cAAc;QAC/B,KAAK,CAAC,SAAS,KAAK,SAAS;QAC7B,KAAK,CAAC,WAAW,KAAK,WAAW;QACjC,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ;QAC7B,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,CAC9B,CAAC;AACJ,CAAC;AAED,6BAA6B;AAC7B,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC","sourcesContent":["import { APP_ENVIRONMENT_IDS } from '@ankhorage/contracts/environments';\nimport {\n INFRA_ADAPTER_CATALOG,\n type InfraLedger,\n isInfraEnvironmentSpec,\n} from '@ankhorage/contracts/infra';\n\nimport type { InfraStoredState } from '../../../types/infraOrchestration.js';\n\n/*** Validate persisted ownership state before any provider receives it. */\nexport function isInfraStoredState(value: unknown): value is InfraStoredState {\n return (\n isRecord(value) &&\n value.schemaVersion === 1 &&\n isInfraEnvironmentSpec(value.desired) &&\n isInfraLedger(value.ledger)\n );\n}\n\n/*** Validate the canonical ledger's serializable outer boundary. */\nfunction isInfraLedger(value: unknown): value is InfraLedger {\n if (\n isRecord(value) &&\n value.schemaVersion === 1 &&\n typeof value.projectId === 'string' &&\n typeof value.environment === 'string' &&\n APP_ENVIRONMENT_IDS.some((environment) => environment === value.environment) &&\n Array.isArray(value.targets) &&\n Array.isArray(value.resources) &&\n Array.isArray(value.outputs) &&\n Array.isArray(value.artifacts)\n ) {\n const { environment, projectId } = value;\n return (\n value.targets.every(isComputeTarget) &&\n value.resources.every((resource) => isOwnedResource(resource, projectId, environment)) &&\n value.outputs.every((output) => isOutput(output, projectId, environment)) &&\n value.artifacts.every((artifact) => isArtifactIdentity(artifact, projectId, environment))\n );\n }\n return false;\n}\n\n/*** Validate portable compute targets without accepting resolved credential payloads. */\nfunction isComputeTarget(value: unknown): boolean {\n if (\n !isRecord(value) ||\n typeof value.id !== 'string' ||\n !['linux', 'darwin', 'windows'].includes(String(value.os)) ||\n !['amd64', 'arm64'].includes(String(value.architecture))\n ) {\n return false;\n }\n if (value.kind === 'local-host') return true;\n return (\n value.kind === 'ssh-host' &&\n typeof value.host === 'string' &&\n typeof value.port === 'number' &&\n typeof value.user === 'string' &&\n typeof value.hostKeyFingerprint === 'string' &&\n isControlPlaneReference(value.credential)\n );\n}\n\n/*** Validate one exact resource plus its dependency identities. */\nfunction isOwnedResource(value: unknown, projectId: string, environment: string): boolean {\n return (\n isRecord(value) &&\n isScopedIdentity(value.identity, projectId, environment) &&\n typeof value.persistent === 'boolean' &&\n (value.retention === 'retain' || value.retention === 'delete-on-destroy') &&\n Array.isArray(value.dependsOn) &&\n value.dependsOn.every((identity) => isScopedIdentity(identity, projectId, environment))\n );\n}\n\n/*** Enforce the public-value versus secret-reference output union at rest. */\nfunction isOutput(value: unknown, projectId: string, environment: string): boolean {\n if (\n !isRecord(value) ||\n !isScopedIdentity(value.owner, projectId, environment) ||\n typeof value.name !== 'string'\n ) {\n return false;\n }\n if (value.visibility === 'public') {\n return (\n ['string', 'number', 'boolean'].includes(typeof value.value) &&\n value.reference === undefined &&\n (value.environmentVariable === undefined || typeof value.environmentVariable === 'string')\n );\n }\n return (\n value.visibility === 'secret' &&\n value.value === undefined &&\n value.environmentVariable === undefined &&\n isSecretReference(value.reference, projectId, environment)\n );\n}\n\n/*** Validate one generated-artifact ledger identity without accepting file content. */\nfunction isArtifactIdentity(value: unknown, projectId: string, environment: string): boolean {\n return (\n isRecord(value) &&\n isScopedIdentity(value.owner, projectId, environment) &&\n typeof value.path === 'string'\n );\n}\n\n/*** Validate scope, adapter catalog identity, and resource ID. */\nfunction isScopedIdentity(value: unknown, projectId: string, environment: string): boolean {\n return (\n isRecord(value) &&\n value.projectId === projectId &&\n value.environment === environment &&\n Object.values(INFRA_ADAPTER_CATALOG).some(({ id }) => id === value.adapter) &&\n typeof value.resourceId === 'string'\n );\n}\n\n/*** Validate an unresolved control-plane credential identity. */\nfunction isControlPlaneReference(value: unknown): boolean {\n return isRecord(value) && value.source === 'control-plane' && typeof value.name === 'string';\n}\n\n/*** Validate an unresolved secret reference scoped to this exact ledger. */\nfunction isSecretReference(value: unknown, projectId: string, environment: string): boolean {\n return (\n isRecord(value) &&\n value.source === 'secret-store' &&\n value.projectId === projectId &&\n value.environment === environment &&\n typeof value.ref === 'string' &&\n typeof value.key === 'string'\n );\n}\n\n/*** Narrow parsed values. */\nfunction isRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n return typeof value === 'object' && value !== null;\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InfraOutput } from '@ankhorage/contracts/infra';
|
|
2
|
+
/*** Merge output identities while preferring the last adapter result for each owner and name. */
|
|
3
|
+
export declare function mergeInfraOutputs(...groups: readonly (readonly InfraOutput[])[]): readonly InfraOutput[];
|
|
4
|
+
//# sourceMappingURL=mergeInfraOutputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeInfraOutputs.d.ts","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/utils/mergeInfraOutputs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAI9D,iGAAiG;AACjG,wBAAgB,iBAAiB,CAC/B,GAAG,MAAM,EAAE,SAAS,CAAC,SAAS,WAAW,EAAE,CAAC,EAAE,GAC7C,SAAS,WAAW,EAAE,CAMxB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { infraIdentityKey } from './infraIdentityKey.js';
|
|
2
|
+
/*** Merge output identities while preferring the last adapter result for each owner and name. */
|
|
3
|
+
export function mergeInfraOutputs(...groups) {
|
|
4
|
+
const outputs = new Map();
|
|
5
|
+
for (const output of groups.flat()) {
|
|
6
|
+
outputs.set(`${infraIdentityKey(output.owner)}\0${output.name}`, output);
|
|
7
|
+
}
|
|
8
|
+
return [...outputs.values()];
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=mergeInfraOutputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeInfraOutputs.js","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/utils/mergeInfraOutputs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,iGAAiG;AACjG,MAAM,UAAU,iBAAiB,CAC/B,GAAG,MAA2C;IAE9C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC/C,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QACnC,OAAO,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["import type { InfraOutput } from '@ankhorage/contracts/infra';\n\nimport { infraIdentityKey } from './infraIdentityKey.js';\n\n/*** Merge output identities while preferring the last adapter result for each owner and name. */\nexport function mergeInfraOutputs(\n ...groups: readonly (readonly InfraOutput[])[]\n): readonly InfraOutput[] {\n const outputs = new Map<string, InfraOutput>();\n for (const output of groups.flat()) {\n outputs.set(`${infraIdentityKey(output.owner)}\\0${output.name}`, output);\n }\n return [...outputs.values()];\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InfraOwnedResource } from '@ankhorage/contracts/infra';
|
|
2
|
+
/*** Merge resource identities while preferring the last adapter result for each owner. */
|
|
3
|
+
export declare function mergeInfraResources(...groups: readonly (readonly InfraOwnedResource[])[]): readonly InfraOwnedResource[];
|
|
4
|
+
//# sourceMappingURL=mergeInfraResources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeInfraResources.d.ts","sourceRoot":"","sources":["../../../../src/features/environment-lifecycle/utils/mergeInfraResources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIrE,0FAA0F;AAC1F,wBAAgB,mBAAmB,CACjC,GAAG,MAAM,EAAE,SAAS,CAAC,SAAS,kBAAkB,EAAE,CAAC,EAAE,GACpD,SAAS,kBAAkB,EAAE,CAM/B"}
|