@ankhorage/infra 4.1.12 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +21 -32
- package/dist/cli/bin.d.ts +1 -8
- package/dist/cli/bin.d.ts.map +1 -1
- package/dist/cli/bin.js +2 -34
- package/dist/cli/bin.js.map +1 -1
- package/dist/cli/commands/destroy.d.ts +11 -0
- package/dist/cli/commands/destroy.d.ts.map +1 -0
- package/dist/cli/commands/destroy.js +51 -0
- package/dist/cli/commands/destroy.js.map +1 -0
- package/dist/cli/commands/down.d.ts +11 -0
- package/dist/cli/commands/down.d.ts.map +1 -0
- package/dist/cli/commands/down.js +27 -0
- package/dist/cli/commands/down.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +11 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +29 -0
- package/dist/cli/commands/generate.js.map +1 -0
- package/dist/cli/commands/outputs.d.ts +11 -0
- package/dist/cli/commands/outputs.d.ts.map +1 -0
- package/dist/cli/commands/outputs.js +25 -0
- package/dist/cli/commands/outputs.js.map +1 -0
- package/dist/cli/commands/plan.d.ts +11 -0
- package/dist/cli/commands/plan.d.ts.map +1 -0
- package/dist/cli/commands/plan.js +19 -0
- package/dist/cli/commands/plan.js.map +1 -0
- package/dist/cli/commands/status.d.ts +11 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +19 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/up.d.ts +11 -0
- package/dist/cli/commands/up.d.ts.map +1 -0
- package/dist/cli/commands/up.js +28 -0
- package/dist/cli/commands/up.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +11 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +19 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/constants.d.ts +66 -0
- package/dist/cli/constants.d.ts.map +1 -0
- package/dist/cli/constants.js +19 -0
- package/dist/cli/constants.js.map +1 -0
- package/dist/cli/createDefaultInfraCommandContext.d.ts +4 -0
- package/dist/cli/createDefaultInfraCommandContext.d.ts.map +1 -0
- package/dist/{commandContext.js → cli/createDefaultInfraCommandContext.js} +4 -3
- package/dist/cli/createDefaultInfraCommandContext.js.map +1 -0
- package/dist/cli/createInfraRuntimeProvider.d.ts +5 -0
- package/dist/cli/createInfraRuntimeProvider.d.ts.map +1 -0
- package/dist/cli/createInfraRuntimeProvider.js +22 -0
- package/dist/cli/createInfraRuntimeProvider.js.map +1 -0
- package/dist/cli/createProviderCommandDescriptors.d.ts +4 -0
- package/dist/cli/createProviderCommandDescriptors.d.ts.map +1 -0
- package/dist/cli/createProviderCommandDescriptors.js +6 -0
- package/dist/cli/createProviderCommandDescriptors.js.map +1 -0
- package/dist/cli/findInfraCommand.d.ts +4 -0
- package/dist/cli/findInfraCommand.d.ts.map +1 -0
- package/dist/cli/findInfraCommand.js +6 -0
- package/dist/cli/findInfraCommand.js.map +1 -0
- package/dist/cli/index.d.ts +3 -8
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -24
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/renderInfraRootHelp.d.ts +3 -0
- package/dist/cli/renderInfraRootHelp.d.ts.map +1 -0
- package/dist/cli/renderInfraRootHelp.js +21 -0
- package/dist/cli/renderInfraRootHelp.js.map +1 -0
- package/dist/cli/renderUnknownInfraCommand.d.ts +3 -0
- package/dist/cli/renderUnknownInfraCommand.d.ts.map +1 -0
- package/dist/cli/renderUnknownInfraCommand.js +5 -0
- package/dist/cli/renderUnknownInfraCommand.js.map +1 -0
- package/dist/cli/runInfraCliAsync.d.ts +10 -0
- package/dist/cli/runInfraCliAsync.d.ts.map +1 -0
- package/dist/cli/runInfraCliAsync.js +34 -0
- package/dist/cli/runInfraCliAsync.js.map +1 -0
- package/dist/cli/runInfraCommandAsync.d.ts +4 -0
- package/dist/cli/runInfraCommandAsync.d.ts.map +1 -0
- package/dist/cli/runInfraCommandAsync.js +100 -0
- package/dist/cli/runInfraCommandAsync.js.map +1 -0
- package/dist/cli/utils/prepareInfraCommandOperationAsync.d.ts +4 -0
- package/dist/cli/utils/prepareInfraCommandOperationAsync.d.ts.map +1 -0
- package/dist/cli/utils/prepareInfraCommandOperationAsync.js +45 -0
- package/dist/cli/utils/prepareInfraCommandOperationAsync.js.map +1 -0
- package/dist/cli/utils/requireInfraSuccess.d.ts +7 -0
- package/dist/cli/utils/requireInfraSuccess.d.ts.map +1 -0
- package/dist/cli/utils/requireInfraSuccess.js +17 -0
- package/dist/cli/utils/requireInfraSuccess.js.map +1 -0
- package/dist/cli/utils/resolveInfraPersistence.d.ts +4 -0
- package/dist/cli/utils/resolveInfraPersistence.d.ts.map +1 -0
- package/dist/cli/utils/resolveInfraPersistence.js +17 -0
- package/dist/cli/utils/resolveInfraPersistence.js.map +1 -0
- package/dist/cli/utils/writeInfraEnvironmentOutputs.d.ts +5 -0
- package/dist/cli/utils/writeInfraEnvironmentOutputs.d.ts.map +1 -0
- package/dist/cli/utils/writeInfraEnvironmentOutputs.js +16 -0
- package/dist/cli/utils/writeInfraEnvironmentOutputs.js.map +1 -0
- package/dist/cli/utils/writeInfraStructured.d.ts +4 -0
- package/dist/cli/utils/writeInfraStructured.d.ts.map +1 -0
- package/dist/cli/utils/writeInfraStructured.js +8 -0
- package/dist/cli/utils/writeInfraStructured.js.map +1 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/{packageMetadata.js → constants.js} +6 -3
- package/dist/constants.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.js +35 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.js +23 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.js +9 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.d.ts +5 -0
- package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.js +28 -0
- package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.js +7 -0
- package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.d.ts +7 -0
- package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.d.ts.map +1 -0
- package/dist/{project.js → features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.js} +10 -34
- package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.d.ts +5 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.js +28 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.js +16 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.d.ts +9 -0
- package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.js +2 -0
- package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.js +15 -0
- package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.js +84 -0
- package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.js +55 -0
- package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.js +38 -0
- package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.js +34 -0
- package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.js +57 -0
- package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.d.ts +5 -0
- package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.js +109 -0
- package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.d.ts +6 -0
- package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.js +181 -0
- package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.js +68 -0
- package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.js +98 -0
- package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.d.ts +5 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.js +17 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.js +13 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/composition/createInfraCommandServices.d.ts +4 -0
- package/dist/features/environment-lifecycle/composition/createInfraCommandServices.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/composition/createInfraCommandServices.js +43 -0
- package/dist/features/environment-lifecycle/composition/createInfraCommandServices.js.map +1 -0
- package/dist/features/environment-lifecycle/composition/createProjectInfraLifecycle.d.ts +4 -0
- package/dist/features/environment-lifecycle/composition/createProjectInfraLifecycle.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/composition/createProjectInfraLifecycle.js +123 -0
- package/dist/features/environment-lifecycle/composition/createProjectInfraLifecycle.js.map +1 -0
- package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.d.ts +4 -0
- package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.js +54 -0
- package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.js.map +1 -0
- package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.d.ts +5 -0
- package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.js +39 -0
- package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/appendInfraFailure.d.ts +7 -0
- package/dist/features/environment-lifecycle/utils/appendInfraFailure.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/appendInfraFailure.js +5 -0
- package/dist/features/environment-lifecycle/utils/appendInfraFailure.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.d.ts +5 -0
- package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.js +13 -0
- package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraFailure.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/createInfraFailure.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraFailure.js +5 -0
- package/dist/features/environment-lifecycle/utils/createInfraFailure.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraLedger.d.ts +12 -0
- package/dist/features/environment-lifecycle/utils/createInfraLedger.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraLedger.js +14 -0
- package/dist/features/environment-lifecycle/utils/createInfraLedger.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/infraIdentityKey.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/infraIdentityKey.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/infraIdentityKey.js +5 -0
- package/dist/features/environment-lifecycle/utils/infraIdentityKey.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/isInfraStoredState.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/isInfraStoredState.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/isInfraStoredState.js +103 -0
- package/dist/features/environment-lifecycle/utils/isInfraStoredState.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.js +10 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraResources.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraResources.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraResources.js +10 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraResources.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.d.ts +3 -0
- package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.js +8 -0
- package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.js +11 -0
- package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/resolveProjectFile.d.ts +3 -0
- package/dist/features/environment-lifecycle/utils/resolveProjectFile.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/resolveProjectFile.js +19 -0
- package/dist/features/environment-lifecycle/utils/resolveProjectFile.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.js +6 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.js +6 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.js.map +1 -0
- package/dist/index.d.ts +16 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -15
- package/dist/index.js.map +1 -1
- package/dist/metadata/index.d.ts +1 -1
- package/dist/metadata/index.d.ts.map +1 -1
- package/dist/metadata/index.js +1 -1
- package/dist/metadata/index.js.map +1 -1
- package/dist/project/index.d.ts +8 -5
- package/dist/project/index.d.ts.map +1 -1
- package/dist/project/index.js +7 -5
- package/dist/project/index.js.map +1 -1
- package/dist/readme-usage.js +17 -26
- package/dist/readme-usage.js.map +1 -1
- package/dist/testSupport.d.ts +1 -1
- package/dist/testSupport.d.ts.map +1 -1
- package/dist/testSupport.js +11 -1
- package/dist/testSupport.js.map +1 -1
- package/dist/types/infraCli.d.ts +91 -0
- package/dist/types/infraCli.d.ts.map +1 -0
- package/dist/types/infraCli.js +2 -0
- package/dist/types/infraCli.js.map +1 -0
- package/dist/types/infraOrchestration.d.ts +84 -0
- package/dist/types/infraOrchestration.d.ts.map +1 -0
- package/dist/types/infraOrchestration.js +2 -0
- package/dist/types/infraOrchestration.js.map +1 -0
- package/dist/types/infraProject.d.ts +43 -0
- package/dist/types/infraProject.d.ts.map +1 -0
- package/dist/types/infraProject.js +2 -0
- package/dist/types/infraProject.js.map +1 -0
- package/package.json +20 -10
- package/src/adapterPackages.integration.test.ts +79 -0
- package/src/cli/bin.ts +2 -61
- package/src/cli/cli.test.ts +35 -126
- package/src/cli/commands/destroy.ts +57 -0
- package/src/cli/commands/down.ts +28 -0
- package/src/cli/commands/generate.ts +34 -0
- package/src/cli/commands/outputs.ts +25 -0
- package/src/cli/commands/plan.ts +20 -0
- package/src/cli/commands/status.ts +20 -0
- package/src/cli/commands/up.ts +29 -0
- package/src/cli/commands/validate.ts +20 -0
- package/src/cli/constants.ts +19 -0
- package/src/cli/createDefaultInfraCommandContext.ts +17 -0
- package/src/cli/createInfraRuntimeProvider.ts +35 -0
- package/src/cli/createProviderCommandDescriptors.ts +8 -0
- package/src/cli/findInfraCommand.ts +7 -0
- package/src/cli/index.test.ts +12 -20
- package/src/cli/index.ts +7 -49
- package/src/cli/renderInfraRootHelp.ts +23 -0
- package/src/cli/renderUnknownInfraCommand.ts +4 -0
- package/src/cli/runInfraCliAsync.ts +51 -0
- package/src/cli/runInfraCommandAsync.ts +114 -0
- package/src/cli/utils/prepareInfraCommandOperationAsync.ts +64 -0
- package/src/cli/utils/requireInfraSuccess.ts +24 -0
- package/src/cli/utils/resolveInfraPersistence.ts +22 -0
- package/src/cli/utils/writeInfraEnvironmentOutputs.ts +24 -0
- package/src/cli/utils/writeInfraStructured.ts +11 -0
- package/src/commands.test.ts +198 -196
- package/src/{packageMetadata.ts → constants.ts} +5 -2
- package/src/environmentLifecycle.test.ts +193 -0
- package/src/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.ts +52 -0
- package/src/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.ts +32 -0
- package/src/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.ts +10 -0
- package/src/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.ts +34 -0
- package/src/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.ts +12 -0
- package/src/{project.ts → features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.ts} +10 -45
- package/src/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.ts +34 -0
- package/src/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.ts +21 -0
- package/src/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.ts +10 -0
- package/src/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.ts +25 -0
- package/src/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.ts +119 -0
- package/src/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.ts +65 -0
- package/src/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.ts +51 -0
- package/src/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.ts +41 -0
- package/src/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.ts +67 -0
- package/src/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.ts +137 -0
- package/src/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.ts +257 -0
- package/src/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.ts +80 -0
- package/src/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.ts +126 -0
- package/src/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.ts +25 -0
- package/src/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.ts +21 -0
- package/src/features/environment-lifecycle/composition/createInfraCommandServices.ts +47 -0
- package/src/features/environment-lifecycle/composition/createProjectInfraLifecycle.ts +157 -0
- package/src/features/environment-lifecycle/domain/orderInfraPlanActions.ts +64 -0
- package/src/features/environment-lifecycle/domain/resolveInfraEnvironment.ts +62 -0
- package/src/features/environment-lifecycle/utils/appendInfraFailure.ts +9 -0
- package/src/features/environment-lifecycle/utils/createInfraExecutionContext.ts +24 -0
- package/src/features/environment-lifecycle/utils/createInfraFailure.ts +6 -0
- package/src/features/environment-lifecycle/utils/createInfraLedger.ts +30 -0
- package/src/features/environment-lifecycle/utils/infraIdentityKey.ts +6 -0
- package/src/features/environment-lifecycle/utils/isInfraStoredState.ts +141 -0
- package/src/features/environment-lifecycle/utils/mergeInfraOutputs.ts +14 -0
- package/src/features/environment-lifecycle/utils/mergeInfraResources.ts +14 -0
- package/src/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.ts +7 -0
- package/src/features/environment-lifecycle/utils/resolveInfraStatePath.ts +12 -0
- package/src/features/environment-lifecycle/utils/resolveProjectFile.ts +22 -0
- package/src/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.ts +15 -0
- package/src/features/environment-lifecycle/utils/retainUnchangedAdapterResources.ts +15 -0
- package/src/index.test.ts +22 -315
- package/src/index.ts +41 -53
- package/src/infraComposition.integration.test.ts +128 -0
- package/src/infraOperations.test.ts +386 -0
- package/src/infraUp.test.ts +260 -0
- package/src/metadata/index.ts +1 -1
- package/src/package.test.ts +4 -2
- package/src/project/index.test.ts +10 -188
- package/src/project/index.ts +15 -22
- package/src/project.test.ts +39 -189
- package/src/projectContractsParser.test.ts +2 -2
- package/src/projectInfrastructure.test.ts +121 -167
- package/src/projectLifecycle.test.ts +136 -0
- package/src/readme-usage.ts +17 -26
- package/src/testSupport.ts +12 -2
- package/src/types/infraCli.ts +115 -0
- package/src/types/infraOrchestration.ts +126 -0
- package/src/types/infraProject.ts +58 -0
- package/dist/adapters/minikube/auth/index.d.ts +0 -8
- package/dist/adapters/minikube/auth/index.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/index.js +0 -29
- package/dist/adapters/minikube/auth/index.js.map +0 -1
- package/dist/adapters/minikube/auth/oauthRuntime.d.ts +0 -4
- package/dist/adapters/minikube/auth/oauthRuntime.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/oauthRuntime.js +0 -138
- package/dist/adapters/minikube/auth/oauthRuntime.js.map +0 -1
- package/dist/adapters/minikube/auth/supabase/index.d.ts +0 -7
- package/dist/adapters/minikube/auth/supabase/index.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/supabase/index.js +0 -232
- package/dist/adapters/minikube/auth/supabase/index.js.map +0 -1
- package/dist/adapters/minikube/auth/supabase/profile.d.ts +0 -20
- package/dist/adapters/minikube/auth/supabase/profile.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/supabase/profile.js +0 -452
- package/dist/adapters/minikube/auth/supabase/profile.js.map +0 -1
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.d.ts +0 -7
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.js +0 -104
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.js.map +0 -1
- package/dist/adapters/minikube/authz/cerbos/index.d.ts +0 -13
- package/dist/adapters/minikube/authz/cerbos/index.d.ts.map +0 -1
- package/dist/adapters/minikube/authz/cerbos/index.js +0 -382
- package/dist/adapters/minikube/authz/cerbos/index.js.map +0 -1
- package/dist/adapters/minikube/authz/index.d.ts +0 -9
- package/dist/adapters/minikube/authz/index.d.ts.map +0 -1
- package/dist/adapters/minikube/authz/index.js +0 -23
- package/dist/adapters/minikube/authz/index.js.map +0 -1
- package/dist/adapters/minikube/base/index.d.ts +0 -14
- package/dist/adapters/minikube/base/index.d.ts.map +0 -1
- package/dist/adapters/minikube/base/index.js +0 -3433
- package/dist/adapters/minikube/base/index.js.map +0 -1
- package/dist/adapters/minikube/base/supabaseMigrations.d.ts +0 -2
- package/dist/adapters/minikube/base/supabaseMigrations.d.ts.map +0 -1
- package/dist/adapters/minikube/base/supabaseMigrations.js +0 -6
- package/dist/adapters/minikube/base/supabaseMigrations.js.map +0 -1
- package/dist/adapters/minikube/contracts.d.ts +0 -34
- package/dist/adapters/minikube/contracts.d.ts.map +0 -1
- package/dist/adapters/minikube/contracts.js +0 -10
- package/dist/adapters/minikube/contracts.js.map +0 -1
- package/dist/adapters/minikube/index.d.ts +0 -3
- package/dist/adapters/minikube/index.d.ts.map +0 -1
- package/dist/adapters/minikube/index.js +0 -136
- package/dist/adapters/minikube/index.js.map +0 -1
- package/dist/adapters/minikube/secrets/index.d.ts +0 -7
- package/dist/adapters/minikube/secrets/index.d.ts.map +0 -1
- package/dist/adapters/minikube/secrets/index.js +0 -13
- package/dist/adapters/minikube/secrets/index.js.map +0 -1
- package/dist/adapters/minikube/secrets/supabase-vault/index.d.ts +0 -8
- package/dist/adapters/minikube/secrets/supabase-vault/index.d.ts.map +0 -1
- package/dist/adapters/minikube/secrets/supabase-vault/index.js +0 -118
- package/dist/adapters/minikube/secrets/supabase-vault/index.js.map +0 -1
- package/dist/adapters/minikube/storage/index.d.ts +0 -7
- package/dist/adapters/minikube/storage/index.d.ts.map +0 -1
- package/dist/adapters/minikube/storage/index.js +0 -77
- package/dist/adapters/minikube/storage/index.js.map +0 -1
- package/dist/adapters/minikube/storage/supabase/index.d.ts +0 -7
- package/dist/adapters/minikube/storage/supabase/index.d.ts.map +0 -1
- package/dist/adapters/minikube/storage/supabase/index.js +0 -82
- package/dist/adapters/minikube/storage/supabase/index.js.map +0 -1
- package/dist/authRedirects.d.ts +0 -19
- package/dist/authRedirects.d.ts.map +0 -1
- package/dist/authRedirects.js +0 -80
- package/dist/authRedirects.js.map +0 -1
- package/dist/authTargetRedirects.d.ts +0 -12
- package/dist/authTargetRedirects.d.ts.map +0 -1
- package/dist/authTargetRedirects.js +0 -32
- package/dist/authTargetRedirects.js.map +0 -1
- package/dist/commandContext.d.ts +0 -12
- package/dist/commandContext.d.ts.map +0 -1
- package/dist/commandContext.js.map +0 -1
- package/dist/commands.d.ts +0 -95
- package/dist/commands.d.ts.map +0 -1
- package/dist/commands.js +0 -256
- package/dist/commands.js.map +0 -1
- package/dist/infraValidation.d.ts +0 -4
- package/dist/infraValidation.d.ts.map +0 -1
- package/dist/infraValidation.js +0 -63
- package/dist/infraValidation.js.map +0 -1
- package/dist/packageMetadata.d.ts +0 -10
- package/dist/packageMetadata.d.ts.map +0 -1
- package/dist/packageMetadata.js.map +0 -1
- package/dist/project.d.ts +0 -14
- package/dist/project.d.ts.map +0 -1
- package/dist/project.js.map +0 -1
- package/dist/projectDatabase.d.ts +0 -5
- package/dist/projectDatabase.d.ts.map +0 -1
- package/dist/projectDatabase.js +0 -22
- package/dist/projectDatabase.js.map +0 -1
- package/dist/projectEnvironment.d.ts +0 -6
- package/dist/projectEnvironment.d.ts.map +0 -1
- package/dist/projectEnvironment.js +0 -45
- package/dist/projectEnvironment.js.map +0 -1
- package/dist/projectInfrastructure.d.ts +0 -38
- package/dist/projectInfrastructure.d.ts.map +0 -1
- package/dist/projectInfrastructure.js +0 -145
- package/dist/projectInfrastructure.js.map +0 -1
- package/dist/runtime.d.ts +0 -54
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -151
- package/dist/runtime.js.map +0 -1
- package/dist/secretStore.d.ts +0 -19
- package/dist/secretStore.d.ts.map +0 -1
- package/dist/secretStore.js +0 -22
- package/dist/secretStore.js.map +0 -1
- package/dist/types.d.ts +0 -70
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/src/adapters/minikube/README.md +0 -115
- package/src/adapters/minikube/appRuntimeServing.test.ts +0 -28
- package/src/adapters/minikube/auth/index.ts +0 -40
- package/src/adapters/minikube/auth/oauthRuntime.ts +0 -163
- package/src/adapters/minikube/auth/supabase/index.test.ts +0 -227
- package/src/adapters/minikube/auth/supabase/index.ts +0 -293
- package/src/adapters/minikube/auth/supabase/oauthRuntime.test.ts +0 -154
- package/src/adapters/minikube/auth/supabase/profile.integration.test.ts +0 -1028
- package/src/adapters/minikube/auth/supabase/profile.ts +0 -526
- package/src/adapters/minikube/auth/supabase/providerAssignments.test.ts +0 -36
- package/src/adapters/minikube/auth/targetAwareOAuthRuntime.test.ts +0 -83
- package/src/adapters/minikube/auth/targetAwareOAuthRuntime.ts +0 -136
- package/src/adapters/minikube/authz/cerbos/index.ts +0 -486
- package/src/adapters/minikube/authz/index.ts +0 -32
- package/src/adapters/minikube/base/appImageBuild.test.ts +0 -352
- package/src/adapters/minikube/base/index.test.ts +0 -693
- package/src/adapters/minikube/base/index.ts +0 -3763
- package/src/adapters/minikube/base/portForwardRuntime.test.ts +0 -624
- package/src/adapters/minikube/base/supabaseMigrations.test.ts +0 -168
- package/src/adapters/minikube/base/supabaseMigrations.ts +0 -5
- package/src/adapters/minikube/base/twoAppIsolation.integration.test.ts +0 -898
- package/src/adapters/minikube/base/upgradeReconciliation.test.ts +0 -135
- package/src/adapters/minikube/contracts.ts +0 -46
- package/src/adapters/minikube/index.ts +0 -172
- package/src/adapters/minikube/secrets/index.test.ts +0 -147
- package/src/adapters/minikube/secrets/index.ts +0 -19
- package/src/adapters/minikube/secrets/supabase-vault/index.ts +0 -139
- package/src/adapters/minikube/storage/index.ts +0 -91
- package/src/adapters/minikube/storage/supabase/index.ts +0 -108
- package/src/apiInfrastructure.test.ts +0 -69
- package/src/authRedirects.test.ts +0 -63
- package/src/authRedirects.ts +0 -113
- package/src/authTargetRedirects.test.ts +0 -62
- package/src/authTargetRedirects.ts +0 -46
- package/src/commandContext.ts +0 -27
- package/src/commands.ts +0 -404
- package/src/generatedApiLedgerCleanup.test.ts +0 -72
- package/src/infraApiValidation.test.ts +0 -42
- package/src/infraValidation.ts +0 -99
- package/src/minikubeImageLifecycle.test.ts +0 -35
- package/src/projectDatabase.ts +0 -27
- package/src/projectEnvironment.ts +0 -51
- package/src/projectInfrastructure.ts +0 -221
- package/src/runtime.test.ts +0 -124
- package/src/runtime.ts +0 -234
- package/src/secretStore.test.ts +0 -76
- package/src/secretStore.ts +0 -44
- package/src/types.ts +0 -82
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { afterEach, describe, expect, test } from 'bun:test';
|
|
2
|
-
import { promises as fs } from 'fs';
|
|
3
|
-
import os from 'os';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
|
|
6
|
-
import { generateInfrastructure } from '../../../index.js';
|
|
7
|
-
import { createAppManifest } from '../../../testSupport.js';
|
|
8
|
-
|
|
9
|
-
const temporaryPaths = new Set<string>();
|
|
10
|
-
|
|
11
|
-
afterEach(async () => {
|
|
12
|
-
await Promise.all(
|
|
13
|
-
[...temporaryPaths].map((rootPath) => fs.rm(rootPath, { force: true, recursive: true })),
|
|
14
|
-
);
|
|
15
|
-
temporaryPaths.clear();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
describe('generated native-only Minikube upgrade reconciliation', () => {
|
|
19
|
-
test('deletes exact stale app resources idempotently after applying desired topology', async () => {
|
|
20
|
-
const profile = 'native-upgrade-reconcile';
|
|
21
|
-
const rootPath = await fs.mkdtemp(path.join(os.tmpdir(), 'infra-native-upgrade-'));
|
|
22
|
-
temporaryPaths.add(rootPath);
|
|
23
|
-
const generated = generateInfrastructure(
|
|
24
|
-
{ deployment: { target: 'minikube', monitoring: false }, modules: [] },
|
|
25
|
-
{
|
|
26
|
-
appManifest: {
|
|
27
|
-
...createAppManifest(profile),
|
|
28
|
-
deploy: {
|
|
29
|
-
targets: {
|
|
30
|
-
android: { enabled: true, package: 'com.ankh.nativeupgradereconcile' },
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
for (const file of generated.files) {
|
|
38
|
-
const filePath = path.join(rootPath, file.path);
|
|
39
|
-
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
40
|
-
await fs.writeFile(filePath, file.content, 'utf8');
|
|
41
|
-
if (file.executable === true) await fs.chmod(filePath, 0o755);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const fakeBin = path.join(rootPath, 'fake-bin');
|
|
45
|
-
const kubectlLog = path.join(rootPath, 'kubectl.log');
|
|
46
|
-
const resourceState = path.join(rootPath, 'app-runtime-resources');
|
|
47
|
-
await fs.mkdir(fakeBin, { recursive: true });
|
|
48
|
-
await fs.writeFile(
|
|
49
|
-
resourceState,
|
|
50
|
-
['deployment/app-runtime', 'service/app-runtime', 'configmap/app-infra-config', ''].join(
|
|
51
|
-
'\n',
|
|
52
|
-
),
|
|
53
|
-
'utf8',
|
|
54
|
-
);
|
|
55
|
-
await writeExecutable(
|
|
56
|
-
path.join(fakeBin, 'minikube'),
|
|
57
|
-
`#!/usr/bin/env bash
|
|
58
|
-
set -euo pipefail
|
|
59
|
-
if [[ " $* " == *" status "* ]]; then
|
|
60
|
-
echo Running
|
|
61
|
-
exit 0
|
|
62
|
-
fi
|
|
63
|
-
exit 1
|
|
64
|
-
`,
|
|
65
|
-
);
|
|
66
|
-
await writeExecutable(
|
|
67
|
-
path.join(fakeBin, 'kubectl'),
|
|
68
|
-
`#!/usr/bin/env bash
|
|
69
|
-
set -euo pipefail
|
|
70
|
-
printf '%s\n' "$*" >> "\${FAKE_KUBECTL_LOG}"
|
|
71
|
-
if [[ " $* " == *" apply -k "* ]]; then
|
|
72
|
-
exit 0
|
|
73
|
-
fi
|
|
74
|
-
if [[ " $* " == *" delete "* ]]; then
|
|
75
|
-
expected='delete deployment/app-runtime service/app-runtime configmap/app-infra-config --ignore-not-found'
|
|
76
|
-
if [[ " $* " != *" \${expected} "* ]]; then
|
|
77
|
-
echo "unexpected cleanup identity: $*" >&2
|
|
78
|
-
exit 1
|
|
79
|
-
fi
|
|
80
|
-
: > "\${FAKE_RESOURCE_STATE}"
|
|
81
|
-
exit 0
|
|
82
|
-
fi
|
|
83
|
-
exit 1
|
|
84
|
-
`,
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
const upScript = path.join(rootPath, 'infra/minikube/scripts/up.sh');
|
|
88
|
-
const env = {
|
|
89
|
-
...process.env,
|
|
90
|
-
ANKH_APP_SLUG: profile,
|
|
91
|
-
FAKE_KUBECTL_LOG: kubectlLog,
|
|
92
|
-
FAKE_RESOURCE_STATE: resourceState,
|
|
93
|
-
PATH: `${fakeBin}:${process.env.PATH ?? ''}`,
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
const first = await runScript(upScript, env);
|
|
97
|
-
const second = await runScript(upScript, env);
|
|
98
|
-
const commands = (await fs.readFile(kubectlLog, 'utf8')).trim().split('\n');
|
|
99
|
-
const exactDelete = `--context ${profile} -n app delete deployment/app-runtime service/app-runtime configmap/app-infra-config --ignore-not-found`;
|
|
100
|
-
|
|
101
|
-
expect(first.stdout).toContain(`Minikube infrastructure for '${profile}' is running.`);
|
|
102
|
-
expect(second.stdout).toContain(`Minikube infrastructure for '${profile}' is running.`);
|
|
103
|
-
expect(commands).toHaveLength(4);
|
|
104
|
-
expect(commands[0]).toContain(`--context ${profile} apply -k `);
|
|
105
|
-
expect(commands[1]).toBe(exactDelete);
|
|
106
|
-
expect(commands[2]).toContain(`--context ${profile} apply -k `);
|
|
107
|
-
expect(commands[3]).toBe(exactDelete);
|
|
108
|
-
expect(await fs.readFile(resourceState, 'utf8')).toBe('');
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
async function runScript(
|
|
113
|
-
scriptPath: string,
|
|
114
|
-
env: Record<string, string | undefined>,
|
|
115
|
-
): Promise<{ readonly stderr: string; readonly stdout: string }> {
|
|
116
|
-
const process = Bun.spawn(['bash', scriptPath], {
|
|
117
|
-
env,
|
|
118
|
-
stderr: 'pipe',
|
|
119
|
-
stdout: 'pipe',
|
|
120
|
-
});
|
|
121
|
-
const [exitCode, stdout, stderr] = await Promise.all([
|
|
122
|
-
process.exited,
|
|
123
|
-
new Response(process.stdout).text(),
|
|
124
|
-
new Response(process.stderr).text(),
|
|
125
|
-
]);
|
|
126
|
-
if (exitCode !== 0) {
|
|
127
|
-
throw new Error(`Generated up.sh failed (${exitCode}): ${stdout}${stderr}`);
|
|
128
|
-
}
|
|
129
|
-
return { stderr, stdout };
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
async function writeExecutable(filePath: string, content: string): Promise<void> {
|
|
133
|
-
await fs.writeFile(filePath, content, 'utf8');
|
|
134
|
-
await fs.chmod(filePath, 0o755);
|
|
135
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { GeneratedInfrastructureFile } from '../../types';
|
|
2
|
-
|
|
3
|
-
interface MinikubeProviderEndpoint {
|
|
4
|
-
name: string;
|
|
5
|
-
url: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
interface MinikubeProviderReadinessCheck {
|
|
9
|
-
label: string;
|
|
10
|
-
namespace: string;
|
|
11
|
-
resource: string;
|
|
12
|
-
timeoutSeconds: number;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface MinikubeProviderLifecycleCommand {
|
|
16
|
-
label: string;
|
|
17
|
-
command: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface MinikubeProviderLifecycle {
|
|
21
|
-
id: string;
|
|
22
|
-
namespace: string;
|
|
23
|
-
endpoints: MinikubeProviderEndpoint[];
|
|
24
|
-
readinessChecks: MinikubeProviderReadinessCheck[];
|
|
25
|
-
migrationCommands: MinikubeProviderLifecycleCommand[];
|
|
26
|
-
reconciliationCommands: MinikubeProviderLifecycleCommand[];
|
|
27
|
-
statusChecks: MinikubeProviderLifecycleCommand[];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface MinikubeAdapterArtifacts {
|
|
31
|
-
files: GeneratedInfrastructureFile[];
|
|
32
|
-
resources: string[];
|
|
33
|
-
providerLifecycle: MinikubeProviderLifecycle[];
|
|
34
|
-
envEntries: string[];
|
|
35
|
-
warnings: string[];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function emptyMinikubeArtifacts(): MinikubeAdapterArtifacts {
|
|
39
|
-
return {
|
|
40
|
-
files: [],
|
|
41
|
-
resources: [],
|
|
42
|
-
providerLifecycle: [],
|
|
43
|
-
envEntries: [],
|
|
44
|
-
warnings: [],
|
|
45
|
-
};
|
|
46
|
-
}
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { validateInfraApiSupport } from '../../infraValidation';
|
|
2
|
-
import type {
|
|
3
|
-
GeneratedPackageDependency,
|
|
4
|
-
InfraManifestInput,
|
|
5
|
-
InfrastructureGenerationOptions,
|
|
6
|
-
InfrastructureGenerationResult,
|
|
7
|
-
} from '../../types';
|
|
8
|
-
import { generateAuthProviderArtifacts } from './auth';
|
|
9
|
-
import { generateAuthorizationArtifacts } from './authz';
|
|
10
|
-
import { APP_NAMESPACE, generateMinikubeBaseArtifacts } from './base';
|
|
11
|
-
import { generateSecretStoreArtifacts } from './secrets';
|
|
12
|
-
import { generateStorageArtifacts } from './storage';
|
|
13
|
-
|
|
14
|
-
const CANONICAL_PROJECT_SLUG_RE = /^[a-z0-9](?:[a-z0-9-]{0,38}[a-z0-9])?$/;
|
|
15
|
-
const BUILT_IN_NAMESPACES = new Set([APP_NAMESPACE, 'supabase']);
|
|
16
|
-
|
|
17
|
-
export function generateMinikubeInfra(
|
|
18
|
-
manifest: InfraManifestInput,
|
|
19
|
-
options: InfrastructureGenerationOptions = {},
|
|
20
|
-
): InfrastructureGenerationResult {
|
|
21
|
-
if (manifest.deployment?.target !== 'minikube') {
|
|
22
|
-
throw new Error(
|
|
23
|
-
`Minikube adapter only supports deployment target "minikube" (received "${manifest.deployment?.target ?? 'undefined'}").`,
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (manifest.database?.provider && manifest.database.provider !== 'supabase') {
|
|
28
|
-
throw new Error(
|
|
29
|
-
`Unsupported database provider for minikube adapter: "${manifest.database.provider}". Only "supabase" is implemented.`,
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const appSlug = validateCanonicalAppSlug(options.appManifest?.metadata.slug);
|
|
34
|
-
const appRuntimeEnabled =
|
|
35
|
-
options.appManifest?.deploy === undefined ||
|
|
36
|
-
options.appManifest.deploy.targets.web?.enabled === true;
|
|
37
|
-
const namespace = APP_NAMESPACE;
|
|
38
|
-
|
|
39
|
-
const authArtifacts = generateAuthProviderArtifacts({
|
|
40
|
-
appManifest: options.appManifest,
|
|
41
|
-
manifest,
|
|
42
|
-
namespace,
|
|
43
|
-
});
|
|
44
|
-
const authzArtifacts = generateAuthorizationArtifacts({
|
|
45
|
-
manifest,
|
|
46
|
-
namespace,
|
|
47
|
-
appManifest: options.appManifest,
|
|
48
|
-
});
|
|
49
|
-
const storageArtifacts = generateStorageArtifacts({ manifest, namespace });
|
|
50
|
-
const secretStoreArtifacts = generateSecretStoreArtifacts({ manifest, namespace });
|
|
51
|
-
|
|
52
|
-
const extraResources = unique([
|
|
53
|
-
...authArtifacts.resources,
|
|
54
|
-
...authzArtifacts.resources,
|
|
55
|
-
...storageArtifacts.resources,
|
|
56
|
-
...secretStoreArtifacts.resources,
|
|
57
|
-
]);
|
|
58
|
-
const providerLifecycle = [
|
|
59
|
-
...authArtifacts.providerLifecycle,
|
|
60
|
-
...authzArtifacts.providerLifecycle,
|
|
61
|
-
...storageArtifacts.providerLifecycle,
|
|
62
|
-
...secretStoreArtifacts.providerLifecycle,
|
|
63
|
-
];
|
|
64
|
-
const providerNamespaces = unique([
|
|
65
|
-
...providerLifecycle.map((contribution) => contribution.namespace),
|
|
66
|
-
]).filter((providerNamespace) => !BUILT_IN_NAMESPACES.has(providerNamespace));
|
|
67
|
-
const extraEnvEntries = unique([
|
|
68
|
-
...authArtifacts.envEntries,
|
|
69
|
-
...authzArtifacts.envEntries,
|
|
70
|
-
...storageArtifacts.envEntries,
|
|
71
|
-
...secretStoreArtifacts.envEntries,
|
|
72
|
-
]);
|
|
73
|
-
|
|
74
|
-
const baseFiles = generateMinikubeBaseArtifacts({
|
|
75
|
-
manifest,
|
|
76
|
-
appSlug,
|
|
77
|
-
extraResources,
|
|
78
|
-
providerNamespaces,
|
|
79
|
-
providerLifecycle,
|
|
80
|
-
extraEnvEntries,
|
|
81
|
-
appRuntimeEnabled,
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
const warnings = unique([
|
|
85
|
-
...collectWarnings(manifest),
|
|
86
|
-
...authArtifacts.warnings,
|
|
87
|
-
...authzArtifacts.warnings,
|
|
88
|
-
...storageArtifacts.warnings,
|
|
89
|
-
...secretStoreArtifacts.warnings,
|
|
90
|
-
]);
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
files: [
|
|
94
|
-
...baseFiles,
|
|
95
|
-
...authArtifacts.files,
|
|
96
|
-
...authzArtifacts.files,
|
|
97
|
-
...storageArtifacts.files,
|
|
98
|
-
...secretStoreArtifacts.files,
|
|
99
|
-
],
|
|
100
|
-
warnings,
|
|
101
|
-
meta: {
|
|
102
|
-
target: 'minikube',
|
|
103
|
-
providers: collectProviders(manifest),
|
|
104
|
-
},
|
|
105
|
-
dependencies: collectDependencies(manifest),
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function collectProviders(manifest: InfraManifestInput): string[] {
|
|
110
|
-
const providers = new Set<string>();
|
|
111
|
-
|
|
112
|
-
if (manifest.auth?.provider) providers.add(manifest.auth.provider);
|
|
113
|
-
if (manifest.auth?.authorization?.engine) {
|
|
114
|
-
providers.add(manifest.auth.authorization.engine);
|
|
115
|
-
}
|
|
116
|
-
if (manifest.database?.provider) providers.add(manifest.database.provider);
|
|
117
|
-
if (manifest.storage?.provider) providers.add(manifest.storage.provider);
|
|
118
|
-
if (manifest.secretStore?.provider) providers.add(manifest.secretStore.provider);
|
|
119
|
-
if (manifest.state?.provider) providers.add(manifest.state.provider);
|
|
120
|
-
|
|
121
|
-
return [...providers].sort();
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function collectDependencies(manifest: InfraManifestInput): readonly GeneratedPackageDependency[] {
|
|
125
|
-
if (manifest.state?.provider !== 'legend') {
|
|
126
|
-
return [];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return [
|
|
130
|
-
{
|
|
131
|
-
name: '@ankhorage/state-legend',
|
|
132
|
-
version: '^0.1.0',
|
|
133
|
-
reason: 'Selected by infra.state.provider=legend.',
|
|
134
|
-
},
|
|
135
|
-
];
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function collectWarnings(manifest: InfraManifestInput): string[] {
|
|
139
|
-
const warnings = [...validateInfraApiSupport(manifest)];
|
|
140
|
-
|
|
141
|
-
if (manifest.deployment?.monitoring) {
|
|
142
|
-
warnings.push(
|
|
143
|
-
'Monitoring is enabled in manifest, but monitoring stack resources are not generated yet.',
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
if (manifest.networking?.cdn) {
|
|
148
|
-
warnings.push('CDN is enabled in manifest, but CDN resources are not generated for minikube.');
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return warnings;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function validateCanonicalAppSlug(slug: string | undefined): string {
|
|
155
|
-
if (!slug) {
|
|
156
|
-
throw new Error(
|
|
157
|
-
'Cannot generate Minikube infrastructure: appManifest.metadata.slug is required.',
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (slug.trim() !== slug || !CANONICAL_PROJECT_SLUG_RE.test(slug)) {
|
|
162
|
-
throw new Error(
|
|
163
|
-
'Cannot generate Minikube infrastructure: appManifest.metadata.slug must be a canonical lowercase slug up to 40 characters using only a-z, 0-9, and hyphens, without leading or trailing hyphens.',
|
|
164
|
-
);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
return slug;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function unique(values: string[]): string[] {
|
|
171
|
-
return [...new Set(values)];
|
|
172
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import type { AppManifest } from '@ankhorage/contracts';
|
|
2
|
-
import { describe, expect, test } from 'bun:test';
|
|
3
|
-
|
|
4
|
-
import { generateInfrastructure } from '../../../index';
|
|
5
|
-
import type { InfraManifestInput } from '../../../types';
|
|
6
|
-
import { SUPABASE_VAULT_MIGRATION_PATH } from './supabase-vault';
|
|
7
|
-
|
|
8
|
-
function createManifest(overrides: Partial<InfraManifestInput> = {}): InfraManifestInput {
|
|
9
|
-
return {
|
|
10
|
-
deployment: {
|
|
11
|
-
target: 'minikube',
|
|
12
|
-
monitoring: false,
|
|
13
|
-
},
|
|
14
|
-
secretStore: {
|
|
15
|
-
provider: 'supabase-vault',
|
|
16
|
-
},
|
|
17
|
-
modules: [],
|
|
18
|
-
...overrides,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
describe('minikube secret-store generation', () => {
|
|
23
|
-
test('generates the released Supabase Vault migration through the Kubernetes lifecycle', () => {
|
|
24
|
-
const result = generateInfrastructure(createManifest(), {
|
|
25
|
-
appManifest: createAppManifest('vault-app'),
|
|
26
|
-
});
|
|
27
|
-
const migration = result.files.find((file) => file.path === SUPABASE_VAULT_MIGRATION_PATH);
|
|
28
|
-
const envExample = result.files.find((file) => file.path === 'infra/minikube/.env.example');
|
|
29
|
-
const upScript = result.files.find((file) => file.path === 'infra/minikube/scripts/up.sh');
|
|
30
|
-
|
|
31
|
-
expect(migration?.content).toContain('create schema if not exists vault;');
|
|
32
|
-
expect(migration?.content).toContain(
|
|
33
|
-
'create extension if not exists supabase_vault with schema vault;',
|
|
34
|
-
);
|
|
35
|
-
expect(migration?.content).toContain('when insufficient_privilege then');
|
|
36
|
-
expect(migration?.content).toContain('create or replace function vault.create_secret');
|
|
37
|
-
expect(migration?.content).toContain('create or replace view vault.decrypted_secrets');
|
|
38
|
-
expect(migration?.content).not.toContain('supabase_vault with schema extensions');
|
|
39
|
-
expect(envExample?.content).toContain('SECRET_STORE_PROVIDER=supabase-vault');
|
|
40
|
-
expect(envExample?.content).not.toContain('SUPABASE_RUNTIME_ENABLED=');
|
|
41
|
-
expect(upScript?.content).toContain('SUPABASE_RUNTIME_ENABLED="true"');
|
|
42
|
-
expect(upScript?.content).not.toContain('SUPABASE_RUNTIME_ENABLED="${SUPABASE_RUNTIME_ENABLED');
|
|
43
|
-
expect(result.meta.providers).toContain('supabase-vault');
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test('requires credentialsRef for every enabled OAuth provider', () => {
|
|
47
|
-
expect(() =>
|
|
48
|
-
generateInfrastructure(
|
|
49
|
-
createManifest({
|
|
50
|
-
auth: {
|
|
51
|
-
scope: 'global',
|
|
52
|
-
provider: 'supabase',
|
|
53
|
-
signIn: {
|
|
54
|
-
identifiers: ['email'],
|
|
55
|
-
},
|
|
56
|
-
oauth: {
|
|
57
|
-
enabled: true,
|
|
58
|
-
callbackRoute: '/auth/callback',
|
|
59
|
-
providers: [
|
|
60
|
-
{
|
|
61
|
-
id: 'google',
|
|
62
|
-
enabled: true,
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
}),
|
|
68
|
-
{ appManifest: createAppManifest('vault-app') },
|
|
69
|
-
),
|
|
70
|
-
).toThrow('does not define credentialsRef');
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
test('accepts provider-neutral OAuth secret references without serializing values', () => {
|
|
74
|
-
const result = generateInfrastructure(
|
|
75
|
-
createManifest({
|
|
76
|
-
auth: {
|
|
77
|
-
scope: 'global',
|
|
78
|
-
provider: 'supabase',
|
|
79
|
-
signIn: {
|
|
80
|
-
identifiers: ['email'],
|
|
81
|
-
},
|
|
82
|
-
oauth: {
|
|
83
|
-
enabled: true,
|
|
84
|
-
callbackRoute: '/auth/callback',
|
|
85
|
-
providers: [
|
|
86
|
-
{
|
|
87
|
-
id: 'google',
|
|
88
|
-
enabled: true,
|
|
89
|
-
credentialsRef: 'auth/oauth/google',
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
}),
|
|
95
|
-
{ appManifest: createAppManifest('vault-app') },
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
const serialized = JSON.stringify(result.files);
|
|
99
|
-
expect(serialized).toContain('auth/oauth/google');
|
|
100
|
-
expect(serialized).not.toContain('sentinel-client-secret-value');
|
|
101
|
-
expect(serialized).not.toContain('sentinel-private-key-value');
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
test('rejects unknown secret-store providers', () => {
|
|
105
|
-
expect(() =>
|
|
106
|
-
generateInfrastructure(
|
|
107
|
-
createManifest({
|
|
108
|
-
secretStore: {
|
|
109
|
-
provider: 'aws-secrets-manager',
|
|
110
|
-
},
|
|
111
|
-
}),
|
|
112
|
-
{ appManifest: createAppManifest('vault-app') },
|
|
113
|
-
),
|
|
114
|
-
).toThrow('Unsupported secret-store provider for minikube adapter');
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
function createAppManifest(
|
|
119
|
-
slug: string,
|
|
120
|
-
): Pick<AppManifest, 'metadata' | 'navigator' | 'screens' | 'settings'> {
|
|
121
|
-
return {
|
|
122
|
-
metadata: {
|
|
123
|
-
name: slug,
|
|
124
|
-
slug,
|
|
125
|
-
version: '1.0.0',
|
|
126
|
-
themeId: 'default',
|
|
127
|
-
},
|
|
128
|
-
navigator: {
|
|
129
|
-
type: 'stack',
|
|
130
|
-
routes: [],
|
|
131
|
-
},
|
|
132
|
-
screens: {},
|
|
133
|
-
settings: {
|
|
134
|
-
localization: {
|
|
135
|
-
defaultLocale: 'en',
|
|
136
|
-
locales: ['en'],
|
|
137
|
-
},
|
|
138
|
-
authFlow: {
|
|
139
|
-
signInRoute: '/sign-in',
|
|
140
|
-
signUpRoute: '/sign-up',
|
|
141
|
-
signOutRoute: '/sign-out',
|
|
142
|
-
unauthorizedRoute: '/sign-in',
|
|
143
|
-
postSignInRoute: '/',
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
};
|
|
147
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { SUPABASE_VAULT_SECRET_STORE_PROVIDER } from '@ankhorage/supabase-vault';
|
|
2
|
-
|
|
3
|
-
import type { InfraManifestInput } from '../../../types';
|
|
4
|
-
import { emptyMinikubeArtifacts, type MinikubeAdapterArtifacts } from '../contracts';
|
|
5
|
-
import { generateSupabaseVaultSecretStoreArtifacts } from './supabase-vault';
|
|
6
|
-
|
|
7
|
-
export function generateSecretStoreArtifacts(args: {
|
|
8
|
-
readonly manifest: InfraManifestInput;
|
|
9
|
-
readonly namespace: string;
|
|
10
|
-
}): MinikubeAdapterArtifacts {
|
|
11
|
-
const provider = args.manifest.secretStore?.provider;
|
|
12
|
-
if (!provider) return emptyMinikubeArtifacts();
|
|
13
|
-
|
|
14
|
-
if (provider === SUPABASE_VAULT_SECRET_STORE_PROVIDER) {
|
|
15
|
-
return generateSupabaseVaultSecretStoreArtifacts(args);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
throw new Error(`Unsupported secret-store provider for minikube adapter: "${provider}".`);
|
|
19
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SUPABASE_VAULT_MIGRATION_SQL,
|
|
3
|
-
SUPABASE_VAULT_SECRET_STORE_PROVIDER,
|
|
4
|
-
} from '@ankhorage/supabase-vault';
|
|
5
|
-
|
|
6
|
-
import type { InfraManifestInput } from '../../../../types';
|
|
7
|
-
import type { MinikubeAdapterArtifacts } from '../../contracts';
|
|
8
|
-
|
|
9
|
-
export const SUPABASE_VAULT_MIGRATION_PATH =
|
|
10
|
-
'infra/minikube/supabase/migrations/202607120001_ankhorage_supabase_vault.sql';
|
|
11
|
-
|
|
12
|
-
export function generateSupabaseVaultSecretStoreArtifacts(args: {
|
|
13
|
-
readonly manifest: InfraManifestInput;
|
|
14
|
-
readonly namespace: string;
|
|
15
|
-
}): MinikubeAdapterArtifacts {
|
|
16
|
-
validateOAuthSecretReferences(args.manifest);
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
files: [
|
|
20
|
-
{
|
|
21
|
-
path: SUPABASE_VAULT_MIGRATION_PATH,
|
|
22
|
-
content: getCurrentSupabaseVaultMigrationSql(),
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
path: 'infra/minikube/secrets/supabase-vault.md',
|
|
26
|
-
content: getRuntimeGuide(args.namespace),
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
resources: [],
|
|
30
|
-
providerLifecycle: [],
|
|
31
|
-
envEntries: [`SECRET_STORE_PROVIDER=${SUPABASE_VAULT_SECRET_STORE_PROVIDER}`],
|
|
32
|
-
warnings: [],
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function getCurrentSupabaseVaultMigrationSql(): string {
|
|
37
|
-
return `${SUPABASE_VAULT_MIGRATION_SQL.trim()
|
|
38
|
-
.replace(
|
|
39
|
-
'create extension if not exists supabase_vault with schema extensions;',
|
|
40
|
-
() => `create schema if not exists vault;
|
|
41
|
-
do $$
|
|
42
|
-
begin
|
|
43
|
-
create extension if not exists supabase_vault with schema vault;
|
|
44
|
-
exception
|
|
45
|
-
when insufficient_privilege then
|
|
46
|
-
create table if not exists vault.secrets (
|
|
47
|
-
id uuid primary key default gen_random_uuid(),
|
|
48
|
-
secret text not null,
|
|
49
|
-
name text,
|
|
50
|
-
description text,
|
|
51
|
-
created_at timestamptz not null default now()
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
create or replace function vault.create_secret(
|
|
55
|
-
secret text,
|
|
56
|
-
name text default null,
|
|
57
|
-
description text default null
|
|
58
|
-
)
|
|
59
|
-
returns uuid
|
|
60
|
-
language plpgsql
|
|
61
|
-
security definer
|
|
62
|
-
set search_path = vault, public
|
|
63
|
-
as $vault$
|
|
64
|
-
declare
|
|
65
|
-
secret_id uuid;
|
|
66
|
-
begin
|
|
67
|
-
insert into vault.secrets (secret, name, description)
|
|
68
|
-
values (secret, name, description)
|
|
69
|
-
returning id into secret_id;
|
|
70
|
-
|
|
71
|
-
return secret_id;
|
|
72
|
-
end;
|
|
73
|
-
$vault$;
|
|
74
|
-
|
|
75
|
-
create or replace view vault.decrypted_secrets as
|
|
76
|
-
select id, secret as decrypted_secret
|
|
77
|
-
from vault.secrets;
|
|
78
|
-
end
|
|
79
|
-
$$;`,
|
|
80
|
-
)
|
|
81
|
-
.trim()}\n`;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function validateOAuthSecretReferences(manifest: InfraManifestInput): void {
|
|
85
|
-
const oauth = manifest.auth?.oauth;
|
|
86
|
-
if (!oauth?.enabled) return;
|
|
87
|
-
|
|
88
|
-
const enabledProviders = oauth.providers.filter((provider) => provider.enabled !== false);
|
|
89
|
-
if (enabledProviders.length === 0) {
|
|
90
|
-
throw new Error('OAuth is enabled but no OAuth provider is enabled.');
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
for (const provider of enabledProviders) {
|
|
94
|
-
if (!provider.credentialsRef?.trim()) {
|
|
95
|
-
throw new Error(
|
|
96
|
-
`OAuth provider "${provider.id}" is enabled but does not define credentialsRef.`,
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function getRuntimeGuide(namespace: string): string {
|
|
103
|
-
return `# Supabase Vault secret store
|
|
104
|
-
|
|
105
|
-
This project selects the provider-neutral secret-store backend through:
|
|
106
|
-
|
|
107
|
-
\`\`\`text
|
|
108
|
-
infra.secretStore.provider = ${SUPABASE_VAULT_SECRET_STORE_PROVIDER}
|
|
109
|
-
\`\`\`
|
|
110
|
-
|
|
111
|
-
The immutable migration at:
|
|
112
|
-
|
|
113
|
-
\`\`\`text
|
|
114
|
-
${SUPABASE_VAULT_MIGRATION_PATH}
|
|
115
|
-
\`\`\`
|
|
116
|
-
|
|
117
|
-
is applied by the Kubernetes-owned Supabase migration lifecycle during \`scripts/up.sh\`
|
|
118
|
-
with command-scoped CLI telemetry disabled around
|
|
119
|
-
\`supabase --yes migration up --db-url "$SUPABASE_DB_URL"\`.
|
|
120
|
-
|
|
121
|
-
## Security boundary
|
|
122
|
-
|
|
123
|
-
- Secret values are stored only through Supabase Vault.
|
|
124
|
-
- Public manifests contain logical references such as \`auth/oauth/google\`, never values.
|
|
125
|
-
- Project and environment scope are supplied by trusted server code.
|
|
126
|
-
- The browser may receive secret metadata, but must never receive resolved values or Vault IDs.
|
|
127
|
-
- Bootstrap database access must come from trusted process environment or workload identity.
|
|
128
|
-
- Do not expose service-role keys, provider secrets, or resolved payloads through
|
|
129
|
-
\`NEXT_PUBLIC_*\`, \`EXPO_PUBLIC_*\`, generated YAML, tracked JSON, or app bundles.
|
|
130
|
-
|
|
131
|
-
## Trusted adapter composition
|
|
132
|
-
|
|
133
|
-
Use \`createInfraSecretStoreAdapter\` from \`@ankhorage/infra\` in server-only code and pass
|
|
134
|
-
a trusted Supabase Vault SQL client. The app manifest chooses the provider; privileged connection
|
|
135
|
-
configuration does not belong in the manifest.
|
|
136
|
-
|
|
137
|
-
Generated Kubernetes namespace: \`${namespace}\`.
|
|
138
|
-
`;
|
|
139
|
-
}
|