@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireInfraSuccess.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/requireInfraSuccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,iGAAiG;AACjG,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EACtB,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAA;CAAE,CAAC,CAGlE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*** Emit diagnostics and narrow a provider-neutral result before command rendering continues. */
|
|
2
|
+
export function requireInfraSuccess(result, context) {
|
|
3
|
+
writeDiagnostics(context, result.diagnostics);
|
|
4
|
+
if (!result.ok)
|
|
5
|
+
throw new Error(result.diagnostics.map(({ message }) => message).join(' '));
|
|
6
|
+
}
|
|
7
|
+
/*** Render diagnostics to the matching process channel without provider-specific formatting. */
|
|
8
|
+
function writeDiagnostics(context, diagnostics) {
|
|
9
|
+
for (const diagnostic of diagnostics) {
|
|
10
|
+
const line = `${diagnostic.severity}: ${diagnostic.code}: ${diagnostic.message}\n`;
|
|
11
|
+
if (diagnostic.severity === 'info')
|
|
12
|
+
context.writeStdout(line);
|
|
13
|
+
else
|
|
14
|
+
context.writeStderr(line);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=requireInfraSuccess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requireInfraSuccess.js","sourceRoot":"","sources":["../../../src/cli/utils/requireInfraSuccess.ts"],"names":[],"mappings":"AAIA,iGAAiG;AACjG,MAAM,UAAU,mBAAmB,CACjC,MAAsB,EACtB,OAA4B;IAE5B,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAC9C,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9F,CAAC;AAED,gGAAgG;AAChG,SAAS,gBAAgB,CACvB,OAA4B,EAC5B,WAAuC;IAEvC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,GAAG,UAAU,CAAC,QAAQ,KAAK,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,OAAO,IAAI,CAAC;QACnF,IAAI,UAAU,CAAC,QAAQ,KAAK,MAAM;YAAE,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;;YACzD,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;AACH,CAAC","sourcesContent":["import type { InfraDiagnostic, InfraResult } from '@ankhorage/contracts/infra';\n\nimport type { InfraCommandContext } from '../../types/infraCli.js';\n\n/*** Emit diagnostics and narrow a provider-neutral result before command rendering continues. */\nexport function requireInfraSuccess<T>(\n result: InfraResult<T>,\n context: InfraCommandContext,\n): asserts result is Extract<InfraResult<T>, { readonly ok: true }> {\n writeDiagnostics(context, result.diagnostics);\n if (!result.ok) throw new Error(result.diagnostics.map(({ message }) => message).join(' '));\n}\n\n/*** Render diagnostics to the matching process channel without provider-specific formatting. */\nfunction writeDiagnostics(\n context: InfraCommandContext,\n diagnostics: readonly InfraDiagnostic[],\n): void {\n for (const diagnostic of diagnostics) {\n const line = `${diagnostic.severity}: ${diagnostic.code}: ${diagnostic.message}\\n`;\n if (diagnostic.severity === 'info') context.writeStdout(line);\n else context.writeStderr(line);\n }\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InfraDestroyRequest, InfraLedger } from '@ankhorage/contracts/infra';
|
|
2
|
+
/*** Convert explicit owned-resource selectors into the canonical persistent deletion policy. */
|
|
3
|
+
export declare function resolveInfraPersistence(ledger: InfraLedger | undefined, resourceSelectors: readonly string[]): InfraDestroyRequest['persistence'];
|
|
4
|
+
//# sourceMappingURL=resolveInfraPersistence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveInfraPersistence.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/resolveInfraPersistence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEnF,gGAAgG;AAChG,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,iBAAiB,EAAE,SAAS,MAAM,EAAE,GACnC,mBAAmB,CAAC,aAAa,CAAC,CAepC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*** Convert explicit owned-resource selectors into the canonical persistent deletion policy. */
|
|
2
|
+
export function resolveInfraPersistence(ledger, resourceSelectors) {
|
|
3
|
+
if (resourceSelectors.length === 0)
|
|
4
|
+
return { policy: 'retain' };
|
|
5
|
+
if (ledger === undefined) {
|
|
6
|
+
throw new Error('Persistent deletion requires stored Infra ownership state.');
|
|
7
|
+
}
|
|
8
|
+
const confirmedResources = resourceSelectors.map((selector) => {
|
|
9
|
+
const resource = ledger.resources.find(({ identity }) => `${identity.adapter}:${identity.resourceId}` === selector);
|
|
10
|
+
if (!resource?.persistent) {
|
|
11
|
+
throw new Error(`Persistent resource is not owned by this environment: ${selector}`);
|
|
12
|
+
}
|
|
13
|
+
return resource.identity;
|
|
14
|
+
});
|
|
15
|
+
return { policy: 'delete', confirmedResources };
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=resolveInfraPersistence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveInfraPersistence.js","sourceRoot":"","sources":["../../../src/cli/utils/resolveInfraPersistence.ts"],"names":[],"mappings":"AAEA,gGAAgG;AAChG,MAAM,UAAU,uBAAuB,CACrC,MAA+B,EAC/B,iBAAoC;IAEpC,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAChE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;IACD,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC5D,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CACpC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,UAAU,EAAE,KAAK,QAAQ,CAC5E,CAAC;QACF,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,yDAAyD,QAAQ,EAAE,CAAC,CAAC;QACvF,CAAC;QACD,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC3B,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,CAAC;AAClD,CAAC","sourcesContent":["import type { InfraDestroyRequest, InfraLedger } from '@ankhorage/contracts/infra';\n\n/*** Convert explicit owned-resource selectors into the canonical persistent deletion policy. */\nexport function resolveInfraPersistence(\n ledger: InfraLedger | undefined,\n resourceSelectors: readonly string[],\n): InfraDestroyRequest['persistence'] {\n if (resourceSelectors.length === 0) return { policy: 'retain' };\n if (ledger === undefined) {\n throw new Error('Persistent deletion requires stored Infra ownership state.');\n }\n const confirmedResources = resourceSelectors.map((selector) => {\n const resource = ledger.resources.find(\n ({ identity }) => `${identity.adapter}:${identity.resourceId}` === selector,\n );\n if (!resource?.persistent) {\n throw new Error(`Persistent resource is not owned by this environment: ${selector}`);\n }\n return resource.identity;\n });\n return { policy: 'delete', confirmedResources };\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { InfraOutput } from '@ankhorage/contracts/infra';
|
|
2
|
+
import type { InfraCommandContext } from '../../types/infraCli.js';
|
|
3
|
+
/*** Print public environment-variable outputs while keeping secret values as references. */
|
|
4
|
+
export declare function writeInfraEnvironmentOutputs(context: InfraCommandContext, outputs: readonly InfraOutput[]): void;
|
|
5
|
+
//# sourceMappingURL=writeInfraEnvironmentOutputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeInfraEnvironmentOutputs.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/writeInfraEnvironmentOutputs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,4FAA4F;AAC5F,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,SAAS,WAAW,EAAE,GAC9B,IAAI,CAUN"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*** Print public environment-variable outputs while keeping secret values as references. */
|
|
2
|
+
export function writeInfraEnvironmentOutputs(context, outputs) {
|
|
3
|
+
for (const output of outputs) {
|
|
4
|
+
if (output.visibility === 'public' && output.environmentVariable !== undefined) {
|
|
5
|
+
context.writeStdout(`${output.environmentVariable}=${quoteEnvironmentValue(output.value)}\n`);
|
|
6
|
+
}
|
|
7
|
+
else if (output.visibility === 'secret') {
|
|
8
|
+
context.writeStderr(`Secret output ${output.owner.adapter}/${output.owner.resourceId}/${output.name} remains a reference and was not printed.\n`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/*** Quote one scalar value for portable shell environment consumption. */
|
|
13
|
+
function quoteEnvironmentValue(value) {
|
|
14
|
+
return `'${String(value).replaceAll("'", "'\\''")}'`;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=writeInfraEnvironmentOutputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeInfraEnvironmentOutputs.js","sourceRoot":"","sources":["../../../src/cli/utils/writeInfraEnvironmentOutputs.ts"],"names":[],"mappings":"AAIA,4FAA4F;AAC5F,MAAM,UAAU,4BAA4B,CAC1C,OAA4B,EAC5B,OAA+B;IAE/B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,UAAU,KAAK,QAAQ,IAAI,MAAM,CAAC,mBAAmB,KAAK,SAAS,EAAE,CAAC;YAC/E,OAAO,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,mBAAmB,IAAI,qBAAqB,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChG,CAAC;aAAM,IAAI,MAAM,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;YAC1C,OAAO,CAAC,WAAW,CACjB,iBAAiB,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,6CAA6C,CAC7H,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED,0EAA0E;AAC1E,SAAS,qBAAqB,CAAC,KAAgC;IAC7D,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC;AACvD,CAAC","sourcesContent":["import type { InfraOutput } from '@ankhorage/contracts/infra';\n\nimport type { InfraCommandContext } from '../../types/infraCli.js';\n\n/*** Print public environment-variable outputs while keeping secret values as references. */\nexport function writeInfraEnvironmentOutputs(\n context: InfraCommandContext,\n outputs: readonly InfraOutput[],\n): void {\n for (const output of outputs) {\n if (output.visibility === 'public' && output.environmentVariable !== undefined) {\n context.writeStdout(`${output.environmentVariable}=${quoteEnvironmentValue(output.value)}\\n`);\n } else if (output.visibility === 'secret') {\n context.writeStderr(\n `Secret output ${output.owner.adapter}/${output.owner.resourceId}/${output.name} remains a reference and was not printed.\\n`,\n );\n }\n }\n}\n\n/*** Quote one scalar value for portable shell environment consumption. */\nfunction quoteEnvironmentValue(value: string | number | boolean): string {\n return `'${String(value).replaceAll(\"'\", \"'\\\\''\")}'`;\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InfraCommandContext, ParsedInfraArguments } from '../../types/infraCli.js';
|
|
2
|
+
/*** Render one serializable command result in the requested human or compact JSON form. */
|
|
3
|
+
export declare function writeInfraStructured(context: InfraCommandContext, format: ParsedInfraArguments['format'], value: unknown): void;
|
|
4
|
+
//# sourceMappingURL=writeInfraStructured.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeInfraStructured.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/writeInfraStructured.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEzF,2FAA2F;AAC3F,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,EACtC,KAAK,EAAE,OAAO,GACb,IAAI,CAGN"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*** Render one serializable command result in the requested human or compact JSON form. */
|
|
2
|
+
export function writeInfraStructured(context, format, value) {
|
|
3
|
+
if (format === 'json')
|
|
4
|
+
context.writeStdout(`${JSON.stringify(value)}\n`);
|
|
5
|
+
else
|
|
6
|
+
context.writeStdout(`${JSON.stringify(value, null, 2)}\n`);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=writeInfraStructured.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeInfraStructured.js","sourceRoot":"","sources":["../../../src/cli/utils/writeInfraStructured.ts"],"names":[],"mappings":"AAEA,2FAA2F;AAC3F,MAAM,UAAU,oBAAoB,CAClC,OAA4B,EAC5B,MAAsC,EACtC,KAAc;IAEd,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;;QACpE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import type { InfraCommandContext, ParsedInfraArguments } from '../../types/infraCli.js';\n\n/*** Render one serializable command result in the requested human or compact JSON form. */\nexport function writeInfraStructured(\n context: InfraCommandContext,\n format: ParsedInfraArguments['format'],\n value: unknown,\n): void {\n if (format === 'json') context.writeStdout(`${JSON.stringify(value)}\\n`);\n else context.writeStdout(`${JSON.stringify(value, null, 2)}\\n`);\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const INFRA_PACKAGE_NAME: string;
|
|
2
|
+
export declare const INFRA_PACKAGE_VERSION: string;
|
|
3
|
+
export declare const INFRA_COMMAND_CATEGORY: "infra";
|
|
4
|
+
export declare const INFRA_CAPABILITIES: readonly ["infra.validate", "infra.plan", "infra.generate", "infra.up", "infra.status", "infra.outputs", "infra.down", "infra.destroy"];
|
|
5
|
+
export declare const INFRA_PACKAGE_METADATA: {
|
|
6
|
+
readonly category: "infra";
|
|
7
|
+
readonly provider: "./dist/cli/index.js";
|
|
8
|
+
readonly capabilities: readonly ["infra.validate", "infra.plan", "infra.generate", "infra.up", "infra.status", "infra.outputs", "infra.down", "infra.destroy"];
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,kBAAkB,QAAmB,CAAC;AACnD,eAAO,MAAM,qBAAqB,QAAsB,CAAC;AACzD,eAAO,MAAM,sBAAsB,SAAiD,CAAC;AACrF,eAAO,MAAM,kBAAkB,yIASiB,CAAC;AAEjD,eAAO,MAAM,sBAAsB;;;;CAIK,CAAC"}
|
|
@@ -4,14 +4,17 @@ export const INFRA_PACKAGE_VERSION = packageJson.version;
|
|
|
4
4
|
export const INFRA_COMMAND_CATEGORY = 'infra';
|
|
5
5
|
export const INFRA_CAPABILITIES = [
|
|
6
6
|
'infra.validate',
|
|
7
|
+
'infra.plan',
|
|
7
8
|
'infra.generate',
|
|
8
|
-
'infra.status',
|
|
9
9
|
'infra.up',
|
|
10
|
+
'infra.status',
|
|
11
|
+
'infra.outputs',
|
|
10
12
|
'infra.down',
|
|
13
|
+
'infra.destroy',
|
|
11
14
|
];
|
|
12
15
|
export const INFRA_PACKAGE_METADATA = {
|
|
13
16
|
category: INFRA_COMMAND_CATEGORY,
|
|
14
|
-
provider: './dist/
|
|
17
|
+
provider: './dist/cli/index.js',
|
|
15
18
|
capabilities: INFRA_CAPABILITIES,
|
|
16
19
|
};
|
|
17
|
-
//# sourceMappingURL=
|
|
20
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAMA,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC,IAAI,CAAC;AACnD,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAC,OAAO,CAAC;AACzD,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAA8C,CAAC;AACrF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,gBAAgB;IAChB,YAAY;IACZ,gBAAgB;IAChB,UAAU;IACV,cAAc;IACd,eAAe;IACf,YAAY;IACZ,eAAe;CAC+B,CAAC;AAEjD,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,QAAQ,EAAE,sBAAsB;IAChC,QAAQ,EAAE,qBAAqB;IAC/B,YAAY,EAAE,kBAAkB;CACM,CAAC","sourcesContent":["import type {\n AnkhCapabilityId,\n AnkhCommandCategory,\n AnkhPackageMetadata,\n} from '@ankhorage/contracts/cli';\n\nimport packageJson from '../package.json';\n\nexport const INFRA_PACKAGE_NAME = packageJson.name;\nexport const INFRA_PACKAGE_VERSION = packageJson.version;\nexport const INFRA_COMMAND_CATEGORY = 'infra' as const satisfies AnkhCommandCategory;\nexport const INFRA_CAPABILITIES = [\n 'infra.validate',\n 'infra.plan',\n 'infra.generate',\n 'infra.up',\n 'infra.status',\n 'infra.outputs',\n 'infra.down',\n 'infra.destroy',\n] as const satisfies readonly AnkhCapabilityId[];\n\nexport const INFRA_PACKAGE_METADATA = {\n category: INFRA_COMMAND_CATEGORY,\n provider: './dist/cli/index.js',\n capabilities: INFRA_CAPABILITIES,\n} as const satisfies AnkhPackageMetadata;\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InfraExecutionContext } from '@ankhorage/contracts/infra';
|
|
2
|
+
/*** Resolve execution-only control-plane credentials from exact-name or prefixed environment data. */
|
|
3
|
+
export declare function createEnvironmentInfraCredentialPort(environment: Readonly<Record<string, string | undefined>>): InfraExecutionContext['credentials'];
|
|
4
|
+
//# sourceMappingURL=createEnvironmentInfraCredentialPort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createEnvironmentInfraCredentialPort.d.ts","sourceRoot":"","sources":["../../../../../src/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAe,MAAM,4BAA4B,CAAC;AAKrF,sGAAsG;AACtG,wBAAgB,oCAAoC,CAClD,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GACxD,qBAAqB,CAAC,aAAa,CAAC,CAiBtC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createInfraFailure } from '../../utils/createInfraFailure.js';
|
|
2
|
+
import { normalizeInfraEnvironmentKey } from '../../utils/normalizeInfraEnvironmentKey.js';
|
|
3
|
+
/*** Resolve execution-only control-plane credentials from exact-name or prefixed environment data. */
|
|
4
|
+
export function createEnvironmentInfraCredentialPort(environment) {
|
|
5
|
+
return {
|
|
6
|
+
resolveAsync(reference) {
|
|
7
|
+
const prefixedName = `ANKH_INFRA_CREDENTIAL_${normalizeInfraEnvironmentKey(reference.name)}`;
|
|
8
|
+
const rawValue = Reflect.get(environment, reference.name) ?? Reflect.get(environment, prefixedName);
|
|
9
|
+
if (rawValue === undefined || rawValue.length === 0) {
|
|
10
|
+
return Promise.resolve(createInfraFailure('infra-control-plane-credential-missing', `Control-plane credential ${reference.name} is unavailable. Set ${reference.name} or ${prefixedName}.`));
|
|
11
|
+
}
|
|
12
|
+
return Promise.resolve(parseCredentialBundle(reference.name, rawValue));
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/*** Parse JSON credential bundles; token variables also support their conventional scalar form. */
|
|
17
|
+
function parseCredentialBundle(name, rawValue) {
|
|
18
|
+
try {
|
|
19
|
+
const parsed = JSON.parse(rawValue);
|
|
20
|
+
if (isRecord(parsed) && Object.values(parsed).every((value) => typeof value === 'string')) {
|
|
21
|
+
return { ok: true, value: parsed, diagnostics: [] };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
if (name.endsWith('_TOKEN')) {
|
|
26
|
+
return { ok: true, value: { token: rawValue, apiToken: rawValue }, diagnostics: [] };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return createInfraFailure('infra-control-plane-credential-invalid', `Control-plane credential ${name} must be a JSON object containing string fields.`);
|
|
30
|
+
}
|
|
31
|
+
/*** Narrow JSON credential bundles. */
|
|
32
|
+
function isRecord(value) {
|
|
33
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=createEnvironmentInfraCredentialPort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createEnvironmentInfraCredentialPort.js","sourceRoot":"","sources":["../../../../../src/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAE3F,sGAAsG;AACtG,MAAM,UAAU,oCAAoC,CAClD,WAAyD;IAEzD,OAAO;QACL,YAAY,CAAC,SAAS;YACpB,MAAM,YAAY,GAAG,yBAAyB,4BAA4B,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7F,MAAM,QAAQ,GACZ,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;YACrF,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACpD,OAAO,OAAO,CAAC,OAAO,CACpB,kBAAkB,CAChB,wCAAwC,EACxC,4BAA4B,SAAS,CAAC,IAAI,wBAAwB,SAAS,CAAC,IAAI,OAAO,YAAY,GAAG,CACvG,CACF,CAAC;YACJ,CAAC;YACD,OAAO,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC1E,CAAC;KACF,CAAC;AACJ,CAAC;AAED,mGAAmG;AACnG,SAAS,qBAAqB,CAC5B,IAAY,EACZ,QAAgB;IAEhB,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC7C,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,EAAE,CAAC;YAC1F,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAA0C,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;QAC1F,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;QACvF,CAAC;IACH,CAAC;IACD,OAAO,kBAAkB,CACvB,wCAAwC,EACxC,4BAA4B,IAAI,kDAAkD,CACnF,CAAC;AACJ,CAAC;AAED,uCAAuC;AACvC,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["import type { InfraExecutionContext, InfraResult } from '@ankhorage/contracts/infra';\n\nimport { createInfraFailure } from '../../utils/createInfraFailure.js';\nimport { normalizeInfraEnvironmentKey } from '../../utils/normalizeInfraEnvironmentKey.js';\n\n/*** Resolve execution-only control-plane credentials from exact-name or prefixed environment data. */\nexport function createEnvironmentInfraCredentialPort(\n environment: Readonly<Record<string, string | undefined>>,\n): InfraExecutionContext['credentials'] {\n return {\n resolveAsync(reference) {\n const prefixedName = `ANKH_INFRA_CREDENTIAL_${normalizeInfraEnvironmentKey(reference.name)}`;\n const rawValue =\n Reflect.get(environment, reference.name) ?? Reflect.get(environment, prefixedName);\n if (rawValue === undefined || rawValue.length === 0) {\n return Promise.resolve(\n createInfraFailure(\n 'infra-control-plane-credential-missing',\n `Control-plane credential ${reference.name} is unavailable. Set ${reference.name} or ${prefixedName}.`,\n ),\n );\n }\n return Promise.resolve(parseCredentialBundle(reference.name, rawValue));\n },\n };\n}\n\n/*** Parse JSON credential bundles; token variables also support their conventional scalar form. */\nfunction parseCredentialBundle(\n name: string,\n rawValue: string,\n): InfraResult<Readonly<Record<string, string>>> {\n try {\n const parsed: unknown = JSON.parse(rawValue);\n if (isRecord(parsed) && Object.values(parsed).every((value) => typeof value === 'string')) {\n return { ok: true, value: parsed as Readonly<Record<string, string>>, diagnostics: [] };\n }\n } catch {\n if (name.endsWith('_TOKEN')) {\n return { ok: true, value: { token: rawValue, apiToken: rawValue }, diagnostics: [] };\n }\n }\n return createInfraFailure(\n 'infra-control-plane-credential-invalid',\n `Control-plane credential ${name} must be a JSON object containing string fields.`,\n );\n}\n\n/*** Narrow JSON credential bundles. */\nfunction isRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n"]}
|
package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InfraExecutionContext } from '@ankhorage/contracts/infra';
|
|
2
|
+
/*** Resolve explicitly addressed secret values from environment data without serializing them. */
|
|
3
|
+
export declare function createEnvironmentInfraSecretPort(environment: Readonly<Record<string, string | undefined>>): InfraExecutionContext['secrets'];
|
|
4
|
+
//# sourceMappingURL=createEnvironmentInfraSecretPort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createEnvironmentInfraSecretPort.d.ts","sourceRoot":"","sources":["../../../../../src/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAKxE,kGAAkG;AAClG,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GACxD,qBAAqB,CAAC,SAAS,CAAC,CAuBlC"}
|
package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createInfraFailure } from '../../utils/createInfraFailure.js';
|
|
2
|
+
import { normalizeInfraEnvironmentKey } from '../../utils/normalizeInfraEnvironmentKey.js';
|
|
3
|
+
/*** Resolve explicitly addressed secret values from environment data without serializing them. */
|
|
4
|
+
export function createEnvironmentInfraSecretPort(environment) {
|
|
5
|
+
return {
|
|
6
|
+
resolveAsync(reference) {
|
|
7
|
+
const variable = [
|
|
8
|
+
'ANKH_INFRA_SECRET',
|
|
9
|
+
reference.projectId,
|
|
10
|
+
reference.environment,
|
|
11
|
+
reference.ref,
|
|
12
|
+
reference.key,
|
|
13
|
+
]
|
|
14
|
+
.map(normalizeInfraEnvironmentKey)
|
|
15
|
+
.join('_');
|
|
16
|
+
const value = Reflect.get(environment, variable);
|
|
17
|
+
return Promise.resolve(typeof value !== 'string' || value.length === 0
|
|
18
|
+
? createInfraFailure('infra-secret-unavailable', `Secret reference ${reference.ref}/${reference.key} is unavailable. Set ${variable}.`)
|
|
19
|
+
: { ok: true, value, diagnostics: [] });
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=createEnvironmentInfraSecretPort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createEnvironmentInfraSecretPort.js","sourceRoot":"","sources":["../../../../../src/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAE3F,kGAAkG;AAClG,MAAM,UAAU,gCAAgC,CAC9C,WAAyD;IAEzD,OAAO;QACL,YAAY,CAAC,SAAS;YACpB,MAAM,QAAQ,GAAG;gBACf,mBAAmB;gBACnB,SAAS,CAAC,SAAS;gBACnB,SAAS,CAAC,WAAW;gBACrB,SAAS,CAAC,GAAG;gBACb,SAAS,CAAC,GAAG;aACd;iBACE,GAAG,CAAC,4BAA4B,CAAC;iBACjC,IAAI,CAAC,GAAG,CAAC,CAAC;YACb,MAAM,KAAK,GAAY,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YAC1D,OAAO,OAAO,CAAC,OAAO,CACpB,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;gBAC7C,CAAC,CAAC,kBAAkB,CAChB,0BAA0B,EAC1B,oBAAoB,SAAS,CAAC,GAAG,IAAI,SAAS,CAAC,GAAG,wBAAwB,QAAQ,GAAG,CACtF;gBACH,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,CACzC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { InfraExecutionContext } from '@ankhorage/contracts/infra';\n\nimport { createInfraFailure } from '../../utils/createInfraFailure.js';\nimport { normalizeInfraEnvironmentKey } from '../../utils/normalizeInfraEnvironmentKey.js';\n\n/*** Resolve explicitly addressed secret values from environment data without serializing them. */\nexport function createEnvironmentInfraSecretPort(\n environment: Readonly<Record<string, string | undefined>>,\n): InfraExecutionContext['secrets'] {\n return {\n resolveAsync(reference) {\n const variable = [\n 'ANKH_INFRA_SECRET',\n reference.projectId,\n reference.environment,\n reference.ref,\n reference.key,\n ]\n .map(normalizeInfraEnvironmentKey)\n .join('_');\n const value: unknown = Reflect.get(environment, variable);\n return Promise.resolve(\n typeof value !== 'string' || value.length === 0\n ? createInfraFailure(\n 'infra-secret-unavailable',\n `Secret reference ${reference.ref}/${reference.key} is unavailable. Set ${variable}.`,\n )\n : { ok: true, value, diagnostics: [] },\n );\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InfraAdapterPackageResolver } from '../../application/ports/outbound/infraAdapterPackage.js';
|
|
2
|
+
/*** Load only a catalog-selected package through the host module resolver. */
|
|
3
|
+
export declare function createNodeInfraAdapterPackageResolver(): InfraAdapterPackageResolver;
|
|
4
|
+
//# sourceMappingURL=createNodeInfraAdapterPackageResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createNodeInfraAdapterPackageResolver.d.ts","sourceRoot":"","sources":["../../../../../src/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yDAAyD,CAAC;AAE3G,8EAA8E;AAC9E,wBAAgB,qCAAqC,IAAI,2BAA2B,CAMnF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*** Load only a catalog-selected package through the host module resolver. */
|
|
2
|
+
export function createNodeInfraAdapterPackageResolver() {
|
|
3
|
+
return {
|
|
4
|
+
loadAsync(packageName) {
|
|
5
|
+
return import(packageName);
|
|
6
|
+
},
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=createNodeInfraAdapterPackageResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createNodeInfraAdapterPackageResolver.js","sourceRoot":"","sources":["../../../../../src/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.ts"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,MAAM,UAAU,qCAAqC;IACnD,OAAO;QACL,SAAS,CAAC,WAAW;YACnB,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC;QAC7B,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { InfraAdapterPackageResolver } from '../../application/ports/outbound/infraAdapterPackage.js';\n\n/*** Load only a catalog-selected package through the host module resolver. */\nexport function createNodeInfraAdapterPackageResolver(): InfraAdapterPackageResolver {\n return {\n loadAsync(packageName) {\n return import(packageName);\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AppEnvironmentId } from '@ankhorage/contracts/environments';
|
|
2
|
+
import type { InfraStoredState } from '../../../../types/infraOrchestration.js';
|
|
3
|
+
/*** Read exact environment state; malformed ownership state fails closed rather than disappearing. */
|
|
4
|
+
export declare function readStoredInfraStateAsync(projectPath: string, environment: AppEnvironmentId): Promise<InfraStoredState | null>;
|
|
5
|
+
//# sourceMappingURL=readStoredInfraStateAsync.d.ts.map
|
package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readStoredInfraStateAsync.d.ts","sourceRoot":"","sources":["../../../../../src/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAG1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAIhF,sGAAsG;AACtG,wBAAsB,yBAAyB,CAC7C,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,gBAAgB,GAC5B,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAYlC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import { isInfraStoredState } from '../../utils/isInfraStoredState.js';
|
|
3
|
+
import { resolveInfraStatePath } from '../../utils/resolveInfraStatePath.js';
|
|
4
|
+
/*** Read exact environment state; malformed ownership state fails closed rather than disappearing. */
|
|
5
|
+
export async function readStoredInfraStateAsync(projectPath, environment) {
|
|
6
|
+
const statePath = resolveInfraStatePath(projectPath, environment);
|
|
7
|
+
try {
|
|
8
|
+
const parsed = JSON.parse(await fs.readFile(statePath, 'utf8'));
|
|
9
|
+
if (!isInfraStoredState(parsed)) {
|
|
10
|
+
throw new Error(`Stored Infra state has an invalid shape: ${statePath}`);
|
|
11
|
+
}
|
|
12
|
+
return parsed;
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
if (isMissingFile(error))
|
|
16
|
+
return null;
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/*** Recognize only the filesystem's absent-file failure. */
|
|
21
|
+
function isMissingFile(error) {
|
|
22
|
+
return isRecord(error) && error.code === 'ENOENT';
|
|
23
|
+
}
|
|
24
|
+
/*** Narrow filesystem error values. */
|
|
25
|
+
function isRecord(value) {
|
|
26
|
+
return typeof value === 'object' && value !== null;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=readStoredInfraStateAsync.js.map
|
package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readStoredInfraStateAsync.js","sourceRoot":"","sources":["../../../../../src/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AAGpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,sGAAsG;AACtG,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,WAAmB,EACnB,WAA6B;IAE7B,MAAM,SAAS,GAAG,qBAAqB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAClE,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;QACzE,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,4CAA4C,SAAS,EAAE,CAAC,CAAC;QAC3E,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,aAAa,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACtC,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,4DAA4D;AAC5D,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AACpD,CAAC;AAED,uCAAuC;AACvC,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC","sourcesContent":["import type { AppEnvironmentId } from '@ankhorage/contracts/environments';\nimport { promises as fs } from 'fs';\n\nimport type { InfraStoredState } from '../../../../types/infraOrchestration.js';\nimport { isInfraStoredState } from '../../utils/isInfraStoredState.js';\nimport { resolveInfraStatePath } from '../../utils/resolveInfraStatePath.js';\n\n/*** Read exact environment state; malformed ownership state fails closed rather than disappearing. */\nexport async function readStoredInfraStateAsync(\n projectPath: string,\n environment: AppEnvironmentId,\n): Promise<InfraStoredState | null> {\n const statePath = resolveInfraStatePath(projectPath, environment);\n try {\n const parsed: unknown = JSON.parse(await fs.readFile(statePath, 'utf8'));\n if (!isInfraStoredState(parsed)) {\n throw new Error(`Stored Infra state has an invalid shape: ${statePath}`);\n }\n return parsed;\n } catch (error) {\n if (isMissingFile(error)) return null;\n throw error;\n }\n}\n\n/*** Recognize only the filesystem's absent-file failure. */\nfunction isMissingFile(error: unknown): boolean {\n return isRecord(error) && error.code === 'ENOENT';\n}\n\n/*** Narrow filesystem error values. */\nfunction isRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n return typeof value === 'object' && value !== null;\n}\n"]}
|
package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AppEnvironmentId } from '@ankhorage/contracts/environments';
|
|
2
|
+
/*** Remove only the exact selected environment state after a complete destroy. */
|
|
3
|
+
export declare function removeStoredInfraStateAsync(projectPath: string, environment: AppEnvironmentId): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=removeStoredInfraStateAsync.d.ts.map
|
package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeStoredInfraStateAsync.d.ts","sourceRoot":"","sources":["../../../../../src/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAK1E,kFAAkF;AAClF,wBAAsB,2BAA2B,CAC/C,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,gBAAgB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAEf"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import { resolveInfraStatePath } from '../../utils/resolveInfraStatePath.js';
|
|
3
|
+
/*** Remove only the exact selected environment state after a complete destroy. */
|
|
4
|
+
export async function removeStoredInfraStateAsync(projectPath, environment) {
|
|
5
|
+
await fs.rm(resolveInfraStatePath(projectPath, environment), { force: true });
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=removeStoredInfraStateAsync.js.map
|
package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeStoredInfraStateAsync.js","sourceRoot":"","sources":["../../../../../src/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AAEpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,kFAAkF;AAClF,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,WAAmB,EACnB,WAA6B;IAE7B,MAAM,EAAE,CAAC,EAAE,CAAC,qBAAqB,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAChF,CAAC","sourcesContent":["import type { AppEnvironmentId } from '@ankhorage/contracts/environments';\nimport { promises as fs } from 'fs';\n\nimport { resolveInfraStatePath } from '../../utils/resolveInfraStatePath.js';\n\n/*** Remove only the exact selected environment state after a complete destroy. */\nexport async function removeStoredInfraStateAsync(\n projectPath: string,\n environment: AppEnvironmentId,\n): Promise<void> {\n await fs.rm(resolveInfraStatePath(projectPath, environment), { force: true });\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ResolvedInfraProject } from '../../../../types/infraProject.js';
|
|
2
|
+
/*** Resolve one manifest-backed Infra project from the workspace and optional project selector. */
|
|
3
|
+
export declare function resolveInfraProjectAsync(options: {
|
|
4
|
+
readonly cwd: string;
|
|
5
|
+
readonly projectId?: string;
|
|
6
|
+
}): Promise<ResolvedInfraProject>;
|
|
7
|
+
//# sourceMappingURL=resolveInfraProjectAsync.d.ts.map
|
package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveInfraProjectAsync.d.ts","sourceRoot":"","sources":["../../../../../src/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,mGAAmG;AACnG,wBAAsB,wBAAwB,CAAC,OAAO,EAAE;IACtD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAiChC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { isAppManifest } from '@ankhorage/contracts';
|
|
2
2
|
import { promises as fs } from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
|
-
|
|
4
|
+
/*** Resolve one manifest-backed Infra project from the workspace and optional project selector. */
|
|
5
|
+
export async function resolveInfraProjectAsync(options) {
|
|
5
6
|
const workspaceRoot = await findWorkspaceRoot(options.cwd);
|
|
6
7
|
if (workspaceRoot === null) {
|
|
7
8
|
throw new Error(`Could not find an Ankh workspace root from cwd: ${options.cwd}`);
|
|
@@ -18,7 +19,7 @@ export async function resolveInfraProject(options) {
|
|
|
18
19
|
throw new Error(`Project '${projectId}' not found.`);
|
|
19
20
|
}
|
|
20
21
|
const manifestPath = path.join(projectPath, 'ankh.config.json');
|
|
21
|
-
const manifest = await readProjectManifest(
|
|
22
|
+
const manifest = await readProjectManifest(manifestPath);
|
|
22
23
|
return {
|
|
23
24
|
appsRoot,
|
|
24
25
|
manifest,
|
|
@@ -36,45 +37,20 @@ function resolveProjectPath(appsRoot, projectId) {
|
|
|
36
37
|
}
|
|
37
38
|
return projectPath;
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
name: projectId,
|
|
43
|
-
slug: projectId,
|
|
44
|
-
version: '0.0.0',
|
|
45
|
-
category: 'developer_tools',
|
|
46
|
-
themeId: 'default',
|
|
47
|
-
},
|
|
48
|
-
themes: [],
|
|
49
|
-
activeThemeId: 'default',
|
|
50
|
-
infra: { modules: [] },
|
|
51
|
-
navigator: {
|
|
52
|
-
type: 'stack',
|
|
53
|
-
routes: [{ name: 'index', screenId: 'index' }],
|
|
54
|
-
},
|
|
55
|
-
screens: {},
|
|
56
|
-
settings: {
|
|
57
|
-
localization: {
|
|
58
|
-
defaultLocale: 'en',
|
|
59
|
-
locales: ['en'],
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
async function readProjectManifest(args) {
|
|
65
|
-
if (!(await pathExists(args.manifestPath))) {
|
|
66
|
-
return createFallbackManifest(args.projectId);
|
|
40
|
+
async function readProjectManifest(manifestPath) {
|
|
41
|
+
if (!(await pathExists(manifestPath))) {
|
|
42
|
+
throw new Error(`Project manifest not found: ${manifestPath}`);
|
|
67
43
|
}
|
|
68
|
-
const rawManifest = await fs.readFile(
|
|
44
|
+
const rawManifest = await fs.readFile(manifestPath, 'utf8');
|
|
69
45
|
let parsed;
|
|
70
46
|
try {
|
|
71
47
|
parsed = JSON.parse(rawManifest);
|
|
72
48
|
}
|
|
73
49
|
catch (error) {
|
|
74
|
-
throw new Error(`Project manifest is not valid JSON: ${
|
|
50
|
+
throw new Error(`Project manifest is not valid JSON: ${manifestPath}: ${getErrorMessage(error)}`, { cause: error });
|
|
75
51
|
}
|
|
76
52
|
if (!isAppManifest(parsed)) {
|
|
77
|
-
throw new Error(`Project manifest has an invalid shape: ${
|
|
53
|
+
throw new Error(`Project manifest has an invalid shape: ${manifestPath}`);
|
|
78
54
|
}
|
|
79
55
|
return parsed;
|
|
80
56
|
}
|
|
@@ -132,4 +108,4 @@ async function pathExists(filePath) {
|
|
|
132
108
|
function getErrorMessage(error) {
|
|
133
109
|
return error instanceof Error ? error.message : String(error);
|
|
134
110
|
}
|
|
135
|
-
//# sourceMappingURL=
|
|
111
|
+
//# sourceMappingURL=resolveInfraProjectAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveInfraProjectAsync.js","sourceRoot":"","sources":["../../../../../src/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,mGAAmG;AACnG,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,OAG9C;IACC,MAAM,aAAa,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3D,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,mDAAmD,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACpF,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IAClD,MAAM,SAAS,GACb,OAAO,CAAC,SAAS,KAAK,SAAS;QAC7B,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC;QACvC,CAAC,CAAC,yBAAyB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACnD,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,iGAAiG,CAClG,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC5D,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,YAAY,SAAS,cAAc,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;IAChE,MAAM,QAAQ,GAAG,MAAM,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAEzD,OAAO;QACL,QAAQ;QACR,QAAQ;QACR,YAAY;QACZ,SAAS;QACT,WAAW;QACX,aAAa;KACd,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,QAAgB,EAAE,SAAiB;IAC7D,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACtD,MAAM,YAAY,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE5D,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,KAAK,UAAU,mBAAmB,CAAC,YAAoB;IACrD,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,+BAA+B,YAAY,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC5D,IAAI,MAAe,CAAC;IAEpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,uCAAuC,YAAY,KAAK,eAAe,CAAC,KAAK,CAAC,EAAE,EAChF,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,0CAA0C,YAAY,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,iBAAiB,CAAC,SAAiB;IAChD,IAAI,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAE1C,SAAS,CAAC;QACR,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAChD,IAAI,MAAM,WAAW,CAAC,QAAQ,CAAC;YAAE,OAAO,WAAW,CAAC;QAEpD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC7C,IAAI,UAAU,KAAK,WAAW;YAAE,OAAO,IAAI,CAAC;QAC5C,WAAW,GAAG,UAAU,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,GAAW,EAAE,QAAgB;IACnD,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9E,IAAI,YAAY,KAAK,EAAE,IAAI,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC1F,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjD,OAAO,SAAS,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAC7F,CAAC;AAED,SAAS,yBAAyB,CAAC,SAAiB;IAClD,IAAI,SAAS,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACjF,CAAC;IAED,IACE,SAAS,KAAK,GAAG;QACjB,SAAS,KAAK,IAAI;QAClB,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QAC1B,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC;QACvB,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EACxB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,uBAAuB,SAAS,2CAA2C,CAAC,CAAC;IAC/F,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,QAAgB;IACzC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,QAAgB;IACxC,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC","sourcesContent":["import { type AppManifest, isAppManifest } from '@ankhorage/contracts';\nimport { promises as fs } from 'fs';\nimport path from 'path';\n\nimport type { ResolvedInfraProject } from '../../../../types/infraProject.js';\n\n/*** Resolve one manifest-backed Infra project from the workspace and optional project selector. */\nexport async function resolveInfraProjectAsync(options: {\n readonly cwd: string;\n readonly projectId?: string;\n}): Promise<ResolvedInfraProject> {\n const workspaceRoot = await findWorkspaceRoot(options.cwd);\n if (workspaceRoot === null) {\n throw new Error(`Could not find an Ankh workspace root from cwd: ${options.cwd}`);\n }\n\n const appsRoot = path.join(workspaceRoot, 'apps');\n const projectId =\n options.projectId === undefined\n ? inferProjectId(options.cwd, appsRoot)\n : validateExplicitProjectId(options.projectId);\n if (projectId === null) {\n throw new Error(\n 'Could not infer a project from cwd. Pass a project id or run the command inside apps/<project>.',\n );\n }\n\n const projectPath = resolveProjectPath(appsRoot, projectId);\n if (!(await pathExists(projectPath))) {\n throw new Error(`Project '${projectId}' not found.`);\n }\n\n const manifestPath = path.join(projectPath, 'ankh.config.json');\n const manifest = await readProjectManifest(manifestPath);\n\n return {\n appsRoot,\n manifest,\n manifestPath,\n projectId,\n projectPath,\n workspaceRoot,\n };\n}\n\nfunction resolveProjectPath(appsRoot: string, projectId: string): string {\n const projectPath = path.resolve(appsRoot, projectId);\n const appsRootPath = `${path.resolve(appsRoot)}${path.sep}`;\n\n if (!projectPath.startsWith(appsRootPath)) {\n throw new Error('Security check failed while resolving the project path.');\n }\n\n return projectPath;\n}\n\nasync function readProjectManifest(manifestPath: string): Promise<AppManifest> {\n if (!(await pathExists(manifestPath))) {\n throw new Error(`Project manifest not found: ${manifestPath}`);\n }\n\n const rawManifest = await fs.readFile(manifestPath, 'utf8');\n let parsed: unknown;\n\n try {\n parsed = JSON.parse(rawManifest);\n } catch (error) {\n throw new Error(\n `Project manifest is not valid JSON: ${manifestPath}: ${getErrorMessage(error)}`,\n { cause: error },\n );\n }\n\n if (!isAppManifest(parsed)) {\n throw new Error(`Project manifest has an invalid shape: ${manifestPath}`);\n }\n\n return parsed;\n}\n\nasync function findWorkspaceRoot(startPath: string): Promise<string | null> {\n let currentPath = path.resolve(startPath);\n\n for (;;) {\n const appsRoot = path.join(currentPath, 'apps');\n if (await isDirectory(appsRoot)) return currentPath;\n\n const parentPath = path.dirname(currentPath);\n if (parentPath === currentPath) return null;\n currentPath = parentPath;\n }\n}\n\nfunction inferProjectId(cwd: string, appsRoot: string): string | null {\n const relativePath = path.relative(path.resolve(appsRoot), path.resolve(cwd));\n if (relativePath === '' || relativePath.startsWith('..') || path.isAbsolute(relativePath)) {\n return null;\n }\n\n const [projectId] = relativePath.split(path.sep);\n return projectId === undefined || projectId.length === 0 ? null : path.basename(projectId);\n}\n\nfunction validateExplicitProjectId(projectId: string): string {\n if (projectId.trim().length === 0) {\n throw new Error('Invalid project id: expected a single safe project segment.');\n }\n\n if (\n projectId === '.' ||\n projectId === '..' ||\n path.isAbsolute(projectId) ||\n projectId.includes('/') ||\n projectId.includes('\\\\')\n ) {\n throw new Error(`Invalid project id: ${projectId}. Expected a single safe project segment.`);\n }\n\n return projectId;\n}\n\nasync function isDirectory(filePath: string): Promise<boolean> {\n try {\n const stat = await fs.stat(filePath);\n return stat.isDirectory();\n } catch {\n return false;\n }\n}\n\nasync function pathExists(filePath: string): Promise<boolean> {\n try {\n await fs.access(filePath);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction getErrorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n"]}
|
package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { InfraGeneratedArtifact, InfraLedger } from '@ankhorage/contracts/infra';
|
|
2
|
+
import type { InfraArtifactWriteResult } from '../../../../types/infraProject.js';
|
|
3
|
+
/*** Write validated generated artifacts and remove only stale paths from the prior ledger. */
|
|
4
|
+
export declare function writeInfraGeneratedArtifactsAsync(projectPath: string, artifacts: readonly InfraGeneratedArtifact[], previous: InfraLedger | undefined): Promise<InfraArtifactWriteResult>;
|
|
5
|
+
//# sourceMappingURL=writeInfraGeneratedArtifactsAsync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeInfraGeneratedArtifactsAsync.d.ts","sourceRoot":"","sources":["../../../../../src/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAItF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAGlF,8FAA8F;AAC9F,wBAAsB,iCAAiC,CACrD,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,SAAS,sBAAsB,EAAE,EAC5C,QAAQ,EAAE,WAAW,GAAG,SAAS,GAChC,OAAO,CAAC,wBAAwB,CAAC,CAqBnC"}
|
package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { resolveProjectFile } from '../../utils/resolveProjectFile.js';
|
|
4
|
+
/*** Write validated generated artifacts and remove only stale paths from the prior ledger. */
|
|
5
|
+
export async function writeInfraGeneratedArtifactsAsync(projectPath, artifacts, previous) {
|
|
6
|
+
const nextPaths = new Set();
|
|
7
|
+
const validated = artifacts.map((artifact) => {
|
|
8
|
+
if (nextPaths.has(artifact.path)) {
|
|
9
|
+
throw new Error(`Duplicate generated Infra artifact path: ${artifact.path}`);
|
|
10
|
+
}
|
|
11
|
+
nextPaths.add(artifact.path);
|
|
12
|
+
return { artifact, outputPath: resolveProjectFile(projectPath, artifact.path) };
|
|
13
|
+
});
|
|
14
|
+
for (const { artifact, outputPath } of validated) {
|
|
15
|
+
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
|
16
|
+
await fs.writeFile(outputPath, artifact.content, 'utf8');
|
|
17
|
+
if (artifact.executable === true)
|
|
18
|
+
await fs.chmod(outputPath, 0o755);
|
|
19
|
+
}
|
|
20
|
+
const stalePaths = (previous?.artifacts ?? [])
|
|
21
|
+
.map(({ path: artifactPath }) => artifactPath)
|
|
22
|
+
.filter((artifactPath) => !nextPaths.has(artifactPath));
|
|
23
|
+
for (const stalePath of stalePaths) {
|
|
24
|
+
await fs.rm(resolveProjectFile(projectPath, stalePath), { force: true });
|
|
25
|
+
}
|
|
26
|
+
return { written: validated.length, removed: stalePaths.length };
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=writeInfraGeneratedArtifactsAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeInfraGeneratedArtifactsAsync.js","sourceRoot":"","sources":["../../../../../src/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,8FAA8F;AAC9F,MAAM,CAAC,KAAK,UAAU,iCAAiC,CACrD,WAAmB,EACnB,SAA4C,EAC5C,QAAiC;IAEjC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IACpC,MAAM,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC3C,IAAI,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,4CAA4C,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QAC/E,CAAC;QACD,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC7B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,CAAC,WAAW,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IAClF,CAAC,CAAC,CAAC;IACH,KAAK,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,SAAS,EAAE,CAAC;QACjD,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9D,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACzD,IAAI,QAAQ,CAAC,UAAU,KAAK,IAAI;YAAE,MAAM,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IACD,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,SAAS,IAAI,EAAE,CAAC;SAC3C,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC;SAC7C,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;IAC1D,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,EAAE,CAAC,EAAE,CAAC,kBAAkB,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC;AACnE,CAAC","sourcesContent":["import type { InfraGeneratedArtifact, InfraLedger } from '@ankhorage/contracts/infra';\nimport { promises as fs } from 'fs';\nimport path from 'path';\n\nimport type { InfraArtifactWriteResult } from '../../../../types/infraProject.js';\nimport { resolveProjectFile } from '../../utils/resolveProjectFile.js';\n\n/*** Write validated generated artifacts and remove only stale paths from the prior ledger. */\nexport async function writeInfraGeneratedArtifactsAsync(\n projectPath: string,\n artifacts: readonly InfraGeneratedArtifact[],\n previous: InfraLedger | undefined,\n): Promise<InfraArtifactWriteResult> {\n const nextPaths = new Set<string>();\n const validated = artifacts.map((artifact) => {\n if (nextPaths.has(artifact.path)) {\n throw new Error(`Duplicate generated Infra artifact path: ${artifact.path}`);\n }\n nextPaths.add(artifact.path);\n return { artifact, outputPath: resolveProjectFile(projectPath, artifact.path) };\n });\n for (const { artifact, outputPath } of validated) {\n await fs.mkdir(path.dirname(outputPath), { recursive: true });\n await fs.writeFile(outputPath, artifact.content, 'utf8');\n if (artifact.executable === true) await fs.chmod(outputPath, 0o755);\n }\n const stalePaths = (previous?.artifacts ?? [])\n .map(({ path: artifactPath }) => artifactPath)\n .filter((artifactPath) => !nextPaths.has(artifactPath));\n for (const stalePath of stalePaths) {\n await fs.rm(resolveProjectFile(projectPath, stalePath), { force: true });\n }\n return { written: validated.length, removed: stalePaths.length };\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InfraStoredState } from '../../../../types/infraOrchestration.js';
|
|
2
|
+
/*** Persist serializable desired identity plus a secret-safe canonical ledger atomically. */
|
|
3
|
+
export declare function writeStoredInfraStateAsync(projectPath: string, state: InfraStoredState): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=writeStoredInfraStateAsync.d.ts.map
|
package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeStoredInfraStateAsync.d.ts","sourceRoot":"","sources":["../../../../../src/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAIhF,6FAA6F;AAC7F,wBAAsB,0BAA0B,CAC9C,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,IAAI,CAAC,CASf"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { isInfraStoredState } from '../../utils/isInfraStoredState.js';
|
|
4
|
+
import { resolveInfraStatePath } from '../../utils/resolveInfraStatePath.js';
|
|
5
|
+
/*** Persist serializable desired identity plus a secret-safe canonical ledger atomically. */
|
|
6
|
+
export async function writeStoredInfraStateAsync(projectPath, state) {
|
|
7
|
+
if (!isInfraStoredState(state)) {
|
|
8
|
+
throw new Error('Refusing to persist invalid or cross-scoped Infra ownership state.');
|
|
9
|
+
}
|
|
10
|
+
const statePath = resolveInfraStatePath(projectPath, state.ledger.environment);
|
|
11
|
+
const temporaryPath = `${statePath}.tmp`;
|
|
12
|
+
await fs.mkdir(path.dirname(statePath), { recursive: true });
|
|
13
|
+
await fs.writeFile(temporaryPath, `${JSON.stringify(state, null, 2)}\n`, 'utf8');
|
|
14
|
+
await fs.rename(temporaryPath, statePath);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=writeStoredInfraStateAsync.js.map
|
package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeStoredInfraStateAsync.js","sourceRoot":"","sources":["../../../../../src/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,6FAA6F;AAC7F,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,WAAmB,EACnB,KAAuB;IAEvB,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;IACxF,CAAC;IACD,MAAM,SAAS,GAAG,qBAAqB,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC/E,MAAM,aAAa,GAAG,GAAG,SAAS,MAAM,CAAC;IACzC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,MAAM,EAAE,CAAC,SAAS,CAAC,aAAa,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACjF,MAAM,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import { promises as fs } from 'fs';\nimport path from 'path';\n\nimport type { InfraStoredState } from '../../../../types/infraOrchestration.js';\nimport { isInfraStoredState } from '../../utils/isInfraStoredState.js';\nimport { resolveInfraStatePath } from '../../utils/resolveInfraStatePath.js';\n\n/*** Persist serializable desired identity plus a secret-safe canonical ledger atomically. */\nexport async function writeStoredInfraStateAsync(\n projectPath: string,\n state: InfraStoredState,\n): Promise<void> {\n if (!isInfraStoredState(state)) {\n throw new Error('Refusing to persist invalid or cross-scoped Infra ownership state.');\n }\n const statePath = resolveInfraStatePath(projectPath, state.ledger.environment);\n const temporaryPath = `${statePath}.tmp`;\n await fs.mkdir(path.dirname(statePath), { recursive: true });\n await fs.writeFile(temporaryPath, `${JSON.stringify(state, null, 2)}\\n`, 'utf8');\n await fs.rename(temporaryPath, statePath);\n}\n"]}
|
package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { InfraAdapterDescriptor } from '@ankhorage/contracts/infra';
|
|
2
|
+
export interface InfraAdapterPackageResolver {
|
|
3
|
+
loadAsync(packageName: string): Promise<unknown>;
|
|
4
|
+
}
|
|
5
|
+
export interface InfraAdapterPackageModule {
|
|
6
|
+
readonly infraAdapterDescriptor: InfraAdapterDescriptor;
|
|
7
|
+
readonly createInfraAdapter: () => unknown;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=infraAdapterPackage.d.ts.map
|
package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infraAdapterPackage.d.ts","sourceRoot":"","sources":["../../../../../../src/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEzE,MAAM,WAAW,2BAA2B;IAC1C,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAClD;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IACxD,QAAQ,CAAC,kBAAkB,EAAE,MAAM,OAAO,CAAC;CAC5C"}
|
package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infraAdapterPackage.js","sourceRoot":"","sources":["../../../../../../src/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.ts"],"names":[],"mappings":"","sourcesContent":["import type { InfraAdapterDescriptor } from '@ankhorage/contracts/infra';\n\nexport interface InfraAdapterPackageResolver {\n loadAsync(packageName: string): Promise<unknown>;\n}\n\nexport interface InfraAdapterPackageModule {\n readonly infraAdapterDescriptor: InfraAdapterDescriptor;\n readonly createInfraAdapter: () => unknown;\n}\n"]}
|