@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,136 +0,0 @@
|
|
|
1
|
-
import { getLocalAuthRedirectPatterns, normalizeAuthCallbackRoute } from '../../../authRedirects';
|
|
2
|
-
import { resolveAuthTargetRedirectModel } from '../../../authTargetRedirects';
|
|
3
|
-
import type { InfraManifestInput, InfrastructureGenerationOptions } from '../../../types';
|
|
4
|
-
import type { MinikubeAdapterArtifacts, MinikubeProviderLifecycle } from '../contracts';
|
|
5
|
-
import { generateSupabaseOAuthRuntimeArtifacts } from './oauthRuntime';
|
|
6
|
-
|
|
7
|
-
interface RedirectPolicy {
|
|
8
|
-
readonly callbackRoute: string;
|
|
9
|
-
readonly localPatterns: readonly string[];
|
|
10
|
-
readonly nativeRedirectUris: readonly string[];
|
|
11
|
-
readonly webEnabled: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function generateTargetAwareSupabaseOAuthRuntimeArtifacts(args: {
|
|
15
|
-
readonly appManifest: InfrastructureGenerationOptions['appManifest'];
|
|
16
|
-
readonly manifest: InfraManifestInput;
|
|
17
|
-
}): MinikubeAdapterArtifacts {
|
|
18
|
-
const baseArtifacts = generateSupabaseOAuthRuntimeArtifacts(args.manifest);
|
|
19
|
-
if (!baseArtifacts.providerLifecycle.some((lifecycle) => lifecycle.id === 'supabase-auth')) {
|
|
20
|
-
return baseArtifacts;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const callbackRoute = normalizeAuthCallbackRoute(args.manifest.auth?.oauth?.callbackRoute ?? '');
|
|
24
|
-
const targets = resolveAuthTargetRedirectModel({
|
|
25
|
-
callbackRoute,
|
|
26
|
-
targets: args.appManifest?.deploy?.targets,
|
|
27
|
-
});
|
|
28
|
-
const policy: RedirectPolicy = {
|
|
29
|
-
callbackRoute,
|
|
30
|
-
localPatterns: targets.webEnabled ? getLocalAuthRedirectPatterns(callbackRoute) : [],
|
|
31
|
-
nativeRedirectUris: targets.nativeRedirectUris,
|
|
32
|
-
webEnabled: targets.webEnabled,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
...baseArtifacts,
|
|
37
|
-
files: baseArtifacts.files.map((file) =>
|
|
38
|
-
file.path === 'infra/minikube/auth/oauth-runtime.md'
|
|
39
|
-
? { ...file, content: getTargetAwareGuide(policy) }
|
|
40
|
-
: file,
|
|
41
|
-
),
|
|
42
|
-
providerLifecycle: baseArtifacts.providerLifecycle.map((lifecycle) =>
|
|
43
|
-
lifecycle.id === 'supabase-auth' ? applyRedirectPolicy(lifecycle, policy) : lifecycle,
|
|
44
|
-
),
|
|
45
|
-
warnings: [...baseArtifacts.warnings, ...targets.warnings],
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function applyRedirectPolicy(
|
|
50
|
-
lifecycle: MinikubeProviderLifecycle,
|
|
51
|
-
policy: RedirectPolicy,
|
|
52
|
-
): MinikubeProviderLifecycle {
|
|
53
|
-
return {
|
|
54
|
-
...lifecycle,
|
|
55
|
-
reconciliationCommands: lifecycle.reconciliationCommands.map((entry) => ({
|
|
56
|
-
...entry,
|
|
57
|
-
command: rewriteReconciliationCommand(entry.command, policy),
|
|
58
|
-
})),
|
|
59
|
-
statusChecks: lifecycle.statusChecks.map((entry) => ({
|
|
60
|
-
...entry,
|
|
61
|
-
command: getTargetAwareStatusCommand(policy),
|
|
62
|
-
})),
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function rewriteReconciliationCommand(command: string, policy: RedirectPolicy): string {
|
|
67
|
-
const legacyPatterns = getLocalAuthRedirectPatterns(policy.callbackRoute).join(',');
|
|
68
|
-
const legacyPolicy = `oauth_redirect_allow_list="\${oauth_site_url},\${oauth_site_url}/\${oauth_callback_path},${legacyPatterns}"
|
|
69
|
-
if [[ -n "\${OAUTH_NATIVE_REDIRECT_URLS:-}" ]]; then
|
|
70
|
-
oauth_redirect_allow_list="\${oauth_redirect_allow_list},\${OAUTH_NATIVE_REDIRECT_URLS}"
|
|
71
|
-
fi`;
|
|
72
|
-
const staticRedirects = [...policy.localPatterns, ...policy.nativeRedirectUris].join(',');
|
|
73
|
-
const suffix = staticRedirects ? `,${staticRedirects}` : '';
|
|
74
|
-
const canonicalPolicy = policy.webEnabled
|
|
75
|
-
? `oauth_redirect_allow_list="\${oauth_site_url},\${oauth_site_url}/\${oauth_callback_path}${suffix}"`
|
|
76
|
-
: `oauth_redirect_allow_list='${staticRedirects}'`;
|
|
77
|
-
let rewritten = replaceOnce(command, legacyPolicy, canonicalPolicy);
|
|
78
|
-
|
|
79
|
-
if (!policy.webEnabled) {
|
|
80
|
-
rewritten = replaceOnce(rewritten, 'oauth_site_url="${SITE_URL%/}"\n', '');
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return rewritten;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function getTargetAwareStatusCommand(policy: RedirectPolicy): string {
|
|
87
|
-
const appCallback = policy.webEnabled
|
|
88
|
-
? `if [[ -n "\${SITE_URL:-}" ]]; then
|
|
89
|
-
echo "- provider supabase-auth/app-callback: \${SITE_URL%/}/\${oauth_callback_path}"
|
|
90
|
-
else
|
|
91
|
-
echo "- provider supabase-auth/app-callback: unavailable"
|
|
92
|
-
fi`
|
|
93
|
-
: 'echo "- provider supabase-auth/app-callback: disabled (web target)"';
|
|
94
|
-
const localPatterns = policy.localPatterns.join(',') || 'none';
|
|
95
|
-
const nativeRedirects = policy.nativeRedirectUris.join(',') || 'none';
|
|
96
|
-
|
|
97
|
-
return `oauth_callback_route='${policy.callbackRoute}'
|
|
98
|
-
oauth_callback_path="\${oauth_callback_route#/}"
|
|
99
|
-
if [[ -n "\${API_EXTERNAL_URL:-}" ]]; then
|
|
100
|
-
echo "- provider supabase-auth/provider-callback: \${API_EXTERNAL_URL%/}/callback"
|
|
101
|
-
else
|
|
102
|
-
echo "- provider supabase-auth/provider-callback: unavailable"
|
|
103
|
-
fi
|
|
104
|
-
${appCallback}
|
|
105
|
-
echo "- provider supabase-auth/local-callback-patterns: ${localPatterns}"
|
|
106
|
-
echo "- provider supabase-auth/native-callbacks: ${nativeRedirects}"`;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function getTargetAwareGuide(policy: RedirectPolicy): string {
|
|
110
|
-
const nativeRedirects = policy.nativeRedirectUris.length
|
|
111
|
-
? policy.nativeRedirectUris.map((uri) => `- \`${uri}\``).join('\n')
|
|
112
|
-
: '- none';
|
|
113
|
-
|
|
114
|
-
return `# Supabase OAuth Runtime Reconciliation
|
|
115
|
-
|
|
116
|
-
The provider callback remains project-owned. GoTrue-to-app redirects use the configured callback
|
|
117
|
-
route \`${policy.callbackRoute}\` and are derived from \`AppManifest.deploy.targets\`.
|
|
118
|
-
|
|
119
|
-
- Web target: ${policy.webEnabled ? 'enabled' : 'disabled'}
|
|
120
|
-
- Native callbacks:
|
|
121
|
-
${nativeRedirects}
|
|
122
|
-
|
|
123
|
-
Local loopback patterns are emitted only for an enabled Web target. Native callbacks come only
|
|
124
|
-
from enabled Android/iOS target schemes; no environment variable or slug-derived identity can add
|
|
125
|
-
a native callback. Provider credential values remain sourced from trusted secret resolution.
|
|
126
|
-
`;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function replaceOnce(value: string, search: string, replacement: string): string {
|
|
130
|
-
if (!value.includes(search)) {
|
|
131
|
-
throw new Error(
|
|
132
|
-
'Supabase OAuth redirect reconciliation template drifted from its canonical form.',
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
return value.replace(search, replacement);
|
|
136
|
-
}
|
|
@@ -1,486 +0,0 @@
|
|
|
1
|
-
import type { AppManifest, NavigatorNode, RouteDefinition } from '@ankhorage/contracts';
|
|
2
|
-
import { resolveAuthFlow } from '@ankhorage/contracts/auth';
|
|
3
|
-
|
|
4
|
-
import type { InfraManifestInput } from '../../../../types';
|
|
5
|
-
import type { MinikubeAdapterArtifacts, MinikubeProviderLifecycle } from '../../contracts';
|
|
6
|
-
|
|
7
|
-
const CERBOS_NAMESPACE = 'cerbos';
|
|
8
|
-
|
|
9
|
-
export function generateCerbosAuthzArtifacts(args: {
|
|
10
|
-
manifest: InfraManifestInput;
|
|
11
|
-
namespace: string;
|
|
12
|
-
appManifest?: CerbosAppManifest;
|
|
13
|
-
}): MinikubeAdapterArtifacts {
|
|
14
|
-
const { manifest, appManifest } = args;
|
|
15
|
-
const namespace = CERBOS_NAMESPACE;
|
|
16
|
-
|
|
17
|
-
const root = 'infra/minikube/k8s/authz/cerbos';
|
|
18
|
-
const resourceRoot = 'authz/cerbos';
|
|
19
|
-
const intent = buildCerbosPolicyIntent({ manifest, appManifest });
|
|
20
|
-
|
|
21
|
-
const endpointUrl = `http://cerbos.${namespace}.svc.cluster.local:3592`;
|
|
22
|
-
const lifecycle: MinikubeProviderLifecycle = {
|
|
23
|
-
id: 'cerbos',
|
|
24
|
-
namespace,
|
|
25
|
-
endpoints: [{ name: 'http', url: endpointUrl }],
|
|
26
|
-
readinessChecks: [
|
|
27
|
-
{
|
|
28
|
-
label: 'cerbos',
|
|
29
|
-
namespace,
|
|
30
|
-
resource: 'deployment/cerbos',
|
|
31
|
-
timeoutSeconds: 180,
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
migrationCommands: [],
|
|
35
|
-
reconciliationCommands: [],
|
|
36
|
-
statusChecks: [],
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
files: [
|
|
41
|
-
{
|
|
42
|
-
path: `${root}/cerbos.configmap.yaml`,
|
|
43
|
-
content: getCerbosConfigMap(namespace),
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
path: `${root}/cerbos.policy.configmap.yaml`,
|
|
47
|
-
content: getCerbosPolicyConfigMap({ namespace, intent }),
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
path: `${root}/cerbos.deployment.yaml`,
|
|
51
|
-
content: getCerbosDeployment(namespace),
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
path: `${root}/cerbos.service.yaml`,
|
|
55
|
-
content: getCerbosService(namespace),
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
resources: [
|
|
59
|
-
`${resourceRoot}/cerbos.configmap.yaml`,
|
|
60
|
-
`${resourceRoot}/cerbos.policy.configmap.yaml`,
|
|
61
|
-
`${resourceRoot}/cerbos.deployment.yaml`,
|
|
62
|
-
`${resourceRoot}/cerbos.service.yaml`,
|
|
63
|
-
],
|
|
64
|
-
providerLifecycle: [lifecycle],
|
|
65
|
-
envEntries: [`CERBOS_URL=${endpointUrl}`],
|
|
66
|
-
warnings: [],
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function getCerbosConfigMap(namespace: string) {
|
|
71
|
-
return `apiVersion: v1
|
|
72
|
-
kind: ConfigMap
|
|
73
|
-
metadata:
|
|
74
|
-
name: cerbos-config
|
|
75
|
-
namespace: ${namespace}
|
|
76
|
-
data:
|
|
77
|
-
config.yaml: |
|
|
78
|
-
server:
|
|
79
|
-
httpListenAddr: ":3592"
|
|
80
|
-
storage:
|
|
81
|
-
driver: "disk"
|
|
82
|
-
disk:
|
|
83
|
-
directory: /policies
|
|
84
|
-
`;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function getCerbosPolicyConfigMap(args: { namespace: string; intent: CerbosPolicyIntent }) {
|
|
88
|
-
const { namespace, intent } = args;
|
|
89
|
-
const entries = getCerbosPolicyEntries(intent);
|
|
90
|
-
const renderedEntries = entries
|
|
91
|
-
.map((entry) => {
|
|
92
|
-
const indented = indentLines(entry.content, 4);
|
|
93
|
-
return ` ${entry.key}: |
|
|
94
|
-
${indented}`;
|
|
95
|
-
})
|
|
96
|
-
.join('\n');
|
|
97
|
-
|
|
98
|
-
return `apiVersion: v1
|
|
99
|
-
kind: ConfigMap
|
|
100
|
-
metadata:
|
|
101
|
-
name: cerbos-policy
|
|
102
|
-
namespace: ${namespace}
|
|
103
|
-
data:
|
|
104
|
-
${renderedEntries}
|
|
105
|
-
`;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function getCerbosDeployment(namespace: string) {
|
|
109
|
-
return `apiVersion: apps/v1
|
|
110
|
-
kind: Deployment
|
|
111
|
-
metadata:
|
|
112
|
-
name: cerbos
|
|
113
|
-
namespace: ${namespace}
|
|
114
|
-
labels:
|
|
115
|
-
app.kubernetes.io/name: cerbos
|
|
116
|
-
spec:
|
|
117
|
-
replicas: 1
|
|
118
|
-
selector:
|
|
119
|
-
matchLabels:
|
|
120
|
-
app.kubernetes.io/name: cerbos
|
|
121
|
-
template:
|
|
122
|
-
metadata:
|
|
123
|
-
labels:
|
|
124
|
-
app.kubernetes.io/name: cerbos
|
|
125
|
-
spec:
|
|
126
|
-
containers:
|
|
127
|
-
- name: cerbos
|
|
128
|
-
image: ghcr.io/cerbos/cerbos:0.40.0
|
|
129
|
-
args:
|
|
130
|
-
- server
|
|
131
|
-
- --config=/config/config.yaml
|
|
132
|
-
ports:
|
|
133
|
-
- containerPort: 3592
|
|
134
|
-
volumeMounts:
|
|
135
|
-
- name: cerbos-config
|
|
136
|
-
mountPath: /config
|
|
137
|
-
- name: cerbos-policy
|
|
138
|
-
mountPath: /policies
|
|
139
|
-
volumes:
|
|
140
|
-
- name: cerbos-config
|
|
141
|
-
configMap:
|
|
142
|
-
name: cerbos-config
|
|
143
|
-
- name: cerbos-policy
|
|
144
|
-
configMap:
|
|
145
|
-
name: cerbos-policy
|
|
146
|
-
`;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function getCerbosService(namespace: string) {
|
|
150
|
-
return `apiVersion: v1
|
|
151
|
-
kind: Service
|
|
152
|
-
metadata:
|
|
153
|
-
name: cerbos
|
|
154
|
-
namespace: ${namespace}
|
|
155
|
-
spec:
|
|
156
|
-
selector:
|
|
157
|
-
app.kubernetes.io/name: cerbos
|
|
158
|
-
ports:
|
|
159
|
-
- name: http
|
|
160
|
-
port: 3592
|
|
161
|
-
targetPort: 3592
|
|
162
|
-
`;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const PUBLIC_GUARD_HINTS = new Set(['public', 'guest', 'anonymous', 'unauthenticated']);
|
|
166
|
-
const AUTH_GUARD_HINTS = new Set([
|
|
167
|
-
'auth',
|
|
168
|
-
'authenticated',
|
|
169
|
-
'private',
|
|
170
|
-
'protected',
|
|
171
|
-
'requiresauth',
|
|
172
|
-
'requires-auth',
|
|
173
|
-
]);
|
|
174
|
-
|
|
175
|
-
type CerbosAppManifest = Pick<AppManifest, 'metadata' | 'navigator' | 'screens'> & {
|
|
176
|
-
infra?: AppManifest['infra'];
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
type AuthScope = NonNullable<InfraManifestInput['auth']>['scope'] | 'none';
|
|
180
|
-
|
|
181
|
-
interface CerbosRouteIntent {
|
|
182
|
-
name: string;
|
|
183
|
-
guards: string[];
|
|
184
|
-
screenId?: string;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
interface CerbosPolicyIntent {
|
|
188
|
-
authScope: AuthScope;
|
|
189
|
-
publicRoutes: string[];
|
|
190
|
-
protectedRoutes: string[];
|
|
191
|
-
publicScreens: string[];
|
|
192
|
-
protectedScreens: string[];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
interface CerbosPolicyEntry {
|
|
196
|
-
key: string;
|
|
197
|
-
content: string;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function getCerbosPolicyEntries(intent: CerbosPolicyIntent): CerbosPolicyEntry[] {
|
|
201
|
-
const entries: CerbosPolicyEntry[] = [
|
|
202
|
-
{
|
|
203
|
-
key: 'app.resource_policy.yaml',
|
|
204
|
-
content: getAppPolicy(intent),
|
|
205
|
-
},
|
|
206
|
-
];
|
|
207
|
-
|
|
208
|
-
if (intent.publicRoutes.length > 0 || intent.protectedRoutes.length > 0) {
|
|
209
|
-
entries.push({
|
|
210
|
-
key: 'route.resource_policy.yaml',
|
|
211
|
-
content: getRoutePolicy(intent),
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (intent.publicScreens.length > 0 || intent.protectedScreens.length > 0) {
|
|
216
|
-
entries.push({
|
|
217
|
-
key: 'screen.resource_policy.yaml',
|
|
218
|
-
content: getScreenPolicy(intent),
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
return entries;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function getAppPolicy(intent: CerbosPolicyIntent): string {
|
|
226
|
-
const roles = intent.authScope === 'global' ? ['authenticated'] : ['anonymous', 'authenticated'];
|
|
227
|
-
|
|
228
|
-
return `apiVersion: api.cerbos.dev/v1
|
|
229
|
-
resourcePolicy:
|
|
230
|
-
version: "default"
|
|
231
|
-
resource: "app"
|
|
232
|
-
rules:
|
|
233
|
-
${indentLines(renderRule({ actions: ['*'], roles }), 4)}
|
|
234
|
-
`;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function getRoutePolicy(intent: CerbosPolicyIntent): string {
|
|
238
|
-
const rules: string[] = [];
|
|
239
|
-
|
|
240
|
-
if (intent.publicRoutes.length > 0) {
|
|
241
|
-
rules.push(
|
|
242
|
-
renderRule({
|
|
243
|
-
actions: ['view', 'navigate'],
|
|
244
|
-
roles: ['anonymous', 'authenticated'],
|
|
245
|
-
conditionExpr: getInConditionExpr('route', intent.publicRoutes),
|
|
246
|
-
}),
|
|
247
|
-
);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
if (intent.protectedRoutes.length > 0) {
|
|
251
|
-
rules.push(
|
|
252
|
-
renderRule({
|
|
253
|
-
actions: ['view', 'navigate'],
|
|
254
|
-
roles: ['authenticated'],
|
|
255
|
-
conditionExpr: getInConditionExpr('route', intent.protectedRoutes),
|
|
256
|
-
}),
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return `apiVersion: api.cerbos.dev/v1
|
|
261
|
-
resourcePolicy:
|
|
262
|
-
version: "default"
|
|
263
|
-
resource: "route"
|
|
264
|
-
rules:
|
|
265
|
-
${indentLines(rules.join('\n'), 4)}
|
|
266
|
-
`;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
function getScreenPolicy(intent: CerbosPolicyIntent): string {
|
|
270
|
-
const rules: string[] = [];
|
|
271
|
-
|
|
272
|
-
if (intent.publicScreens.length > 0) {
|
|
273
|
-
rules.push(
|
|
274
|
-
renderRule({
|
|
275
|
-
actions: ['view', 'render'],
|
|
276
|
-
roles: ['anonymous', 'authenticated'],
|
|
277
|
-
conditionExpr: getInConditionExpr('screen_id', intent.publicScreens),
|
|
278
|
-
}),
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
if (intent.protectedScreens.length > 0) {
|
|
283
|
-
rules.push(
|
|
284
|
-
renderRule({
|
|
285
|
-
actions: ['view', 'render'],
|
|
286
|
-
roles: ['authenticated'],
|
|
287
|
-
conditionExpr: getInConditionExpr('screen_id', intent.protectedScreens),
|
|
288
|
-
}),
|
|
289
|
-
);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
return `apiVersion: api.cerbos.dev/v1
|
|
293
|
-
resourcePolicy:
|
|
294
|
-
version: "default"
|
|
295
|
-
resource: "screen"
|
|
296
|
-
rules:
|
|
297
|
-
${indentLines(rules.join('\n'), 4)}
|
|
298
|
-
`;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
function renderRule(args: { actions: string[]; roles: string[]; conditionExpr?: string }): string {
|
|
302
|
-
const { actions, roles, conditionExpr } = args;
|
|
303
|
-
|
|
304
|
-
const lines = [
|
|
305
|
-
`- actions: ${JSON.stringify(actions)}`,
|
|
306
|
-
' effect: EFFECT_ALLOW',
|
|
307
|
-
` roles: ${JSON.stringify(roles)}`,
|
|
308
|
-
];
|
|
309
|
-
|
|
310
|
-
if (conditionExpr) {
|
|
311
|
-
lines.push(' condition:');
|
|
312
|
-
lines.push(' match:');
|
|
313
|
-
lines.push(` expr: ${JSON.stringify(conditionExpr)}`);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
return lines.join('\n');
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
function getInConditionExpr(attribute: string, values: string[]): string {
|
|
320
|
-
return `request.resource.attr.${attribute} in ${JSON.stringify(values)}`;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
function indentLines(content: string, spaces: number): string {
|
|
324
|
-
const prefix = ' '.repeat(spaces);
|
|
325
|
-
return content
|
|
326
|
-
.trimEnd()
|
|
327
|
-
.split('\n')
|
|
328
|
-
.map((line) => `${prefix}${line}`)
|
|
329
|
-
.join('\n');
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
function buildCerbosPolicyIntent(args: {
|
|
333
|
-
manifest: InfraManifestInput;
|
|
334
|
-
appManifest?: CerbosAppManifest;
|
|
335
|
-
}): CerbosPolicyIntent {
|
|
336
|
-
const { manifest, appManifest } = args;
|
|
337
|
-
const authScope = manifest.auth?.scope ?? 'none';
|
|
338
|
-
|
|
339
|
-
const routes = appManifest?.navigator ? flattenNavigatorRoutes(appManifest.navigator) : [];
|
|
340
|
-
const flow = resolveAuthFlow(appManifest?.infra?.auth?.flow);
|
|
341
|
-
const { signInRoute } = flow;
|
|
342
|
-
const { signUpRoute } = flow;
|
|
343
|
-
const { unauthorizedRoute } = flow;
|
|
344
|
-
|
|
345
|
-
const publicRouteSet = new Set<string>();
|
|
346
|
-
const protectedRouteSet = new Set<string>();
|
|
347
|
-
|
|
348
|
-
for (const route of routes) {
|
|
349
|
-
const isPublic = isPublicRoute({
|
|
350
|
-
route,
|
|
351
|
-
authScope,
|
|
352
|
-
signInRoute,
|
|
353
|
-
signUpRoute,
|
|
354
|
-
unauthorizedRoute,
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
if (isPublic) {
|
|
358
|
-
publicRouteSet.add(route.name);
|
|
359
|
-
} else {
|
|
360
|
-
protectedRouteSet.add(route.name);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
const screenVisibility = new Map<string, 'public' | 'protected'>();
|
|
365
|
-
for (const route of routes) {
|
|
366
|
-
if (!route.screenId) continue;
|
|
367
|
-
const isPublic = publicRouteSet.has(route.name);
|
|
368
|
-
|
|
369
|
-
const current = screenVisibility.get(route.screenId);
|
|
370
|
-
if (current === 'protected') continue;
|
|
371
|
-
screenVisibility.set(route.screenId, isPublic ? 'public' : 'protected');
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
if (appManifest?.screens) {
|
|
375
|
-
const defaultVisibility: 'public' | 'protected' =
|
|
376
|
-
authScope === 'global' ? 'protected' : 'public';
|
|
377
|
-
|
|
378
|
-
for (const screenId of Object.keys(appManifest.screens)) {
|
|
379
|
-
if (!screenVisibility.has(screenId)) {
|
|
380
|
-
screenVisibility.set(screenId, defaultVisibility);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
const publicScreens = [...screenVisibility.entries()]
|
|
386
|
-
.filter(([, visibility]) => visibility === 'public')
|
|
387
|
-
.map(([screenId]) => screenId)
|
|
388
|
-
.sort();
|
|
389
|
-
const protectedScreens = [...screenVisibility.entries()]
|
|
390
|
-
.filter(([, visibility]) => visibility === 'protected')
|
|
391
|
-
.map(([screenId]) => screenId)
|
|
392
|
-
.sort();
|
|
393
|
-
|
|
394
|
-
return {
|
|
395
|
-
authScope,
|
|
396
|
-
publicRoutes: [...publicRouteSet].sort(),
|
|
397
|
-
protectedRoutes: [...protectedRouteSet].sort(),
|
|
398
|
-
publicScreens,
|
|
399
|
-
protectedScreens,
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
function flattenNavigatorRoutes(navigator: NavigatorNode): CerbosRouteIntent[] {
|
|
404
|
-
const deduped = new Map<string, CerbosRouteIntent>();
|
|
405
|
-
|
|
406
|
-
const walk = (current: NavigatorNode) => {
|
|
407
|
-
for (const route of current.routes) {
|
|
408
|
-
const normalizedGuards = normalizeGuards(route.guards);
|
|
409
|
-
const existing = deduped.get(route.name);
|
|
410
|
-
deduped.set(route.name, {
|
|
411
|
-
name: route.name,
|
|
412
|
-
guards: unique([...(existing?.guards ?? []), ...normalizedGuards]),
|
|
413
|
-
screenId: route.screenId ?? existing?.screenId,
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
if (route.navigator) {
|
|
417
|
-
walk(route.navigator);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
};
|
|
421
|
-
|
|
422
|
-
walk(navigator);
|
|
423
|
-
return [...deduped.values()];
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
function normalizeGuards(guards?: RouteDefinition['guards']): string[] {
|
|
427
|
-
return (guards ?? []).map((guard) => guard.trim().toLowerCase()).filter(Boolean);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
function isPublicRoute(args: {
|
|
431
|
-
route: CerbosRouteIntent;
|
|
432
|
-
authScope: AuthScope;
|
|
433
|
-
signInRoute?: string;
|
|
434
|
-
signUpRoute?: string;
|
|
435
|
-
unauthorizedRoute?: string;
|
|
436
|
-
}): boolean {
|
|
437
|
-
const { route, authScope, signInRoute, signUpRoute, unauthorizedRoute } = args;
|
|
438
|
-
const guardSet = new Set(route.guards);
|
|
439
|
-
const signInRouteName = authFlowPathToRouteName(signInRoute);
|
|
440
|
-
const signUpRouteName = authFlowPathToRouteName(signUpRoute);
|
|
441
|
-
const unauthorizedRouteName = authFlowPathToRouteName(unauthorizedRoute);
|
|
442
|
-
|
|
443
|
-
if (
|
|
444
|
-
route.name === signInRouteName ||
|
|
445
|
-
route.name === signUpRouteName ||
|
|
446
|
-
route.name === unauthorizedRouteName
|
|
447
|
-
) {
|
|
448
|
-
return true;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
if (hasAny(guardSet, PUBLIC_GUARD_HINTS)) {
|
|
452
|
-
return true;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
if (hasAny(guardSet, AUTH_GUARD_HINTS)) {
|
|
456
|
-
return false;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
switch (authScope) {
|
|
460
|
-
case 'none':
|
|
461
|
-
return true;
|
|
462
|
-
case 'global':
|
|
463
|
-
default:
|
|
464
|
-
return false;
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
function hasAny(values: Set<string>, candidates: Set<string>): boolean {
|
|
469
|
-
for (const candidate of candidates) {
|
|
470
|
-
if (values.has(candidate)) return true;
|
|
471
|
-
}
|
|
472
|
-
return false;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
function unique(values: string[]): string[] {
|
|
476
|
-
return [...new Set(values)];
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
function authFlowPathToRouteName(routePath: string | undefined): string | undefined {
|
|
480
|
-
if (!routePath) {
|
|
481
|
-
return undefined;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
const normalized = routePath.trim().replace(/^\/+/, '').replace(/\/+$/, '');
|
|
485
|
-
return normalized === '' ? 'index' : normalized;
|
|
486
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { AppManifest } from '@ankhorage/contracts';
|
|
2
|
-
|
|
3
|
-
import type { InfraManifestInput } from '../../../types';
|
|
4
|
-
import { emptyMinikubeArtifacts, type MinikubeAdapterArtifacts } from '../contracts';
|
|
5
|
-
import { generateCerbosAuthzArtifacts } from './cerbos';
|
|
6
|
-
|
|
7
|
-
export function generateAuthorizationArtifacts(args: {
|
|
8
|
-
manifest: InfraManifestInput;
|
|
9
|
-
namespace: string;
|
|
10
|
-
appManifest?: Pick<AppManifest, 'infra' | 'metadata' | 'navigator' | 'screens'>;
|
|
11
|
-
}): MinikubeAdapterArtifacts {
|
|
12
|
-
const { manifest, namespace, appManifest } = args;
|
|
13
|
-
const engine = manifest.auth?.authorization?.engine;
|
|
14
|
-
|
|
15
|
-
if (!engine) {
|
|
16
|
-
return emptyMinikubeArtifacts();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
switch (engine) {
|
|
20
|
-
case 'cerbos':
|
|
21
|
-
return generateCerbosAuthzArtifacts({ manifest, namespace, appManifest });
|
|
22
|
-
case 'native':
|
|
23
|
-
return {
|
|
24
|
-
...emptyMinikubeArtifacts(),
|
|
25
|
-
warnings: [
|
|
26
|
-
'Authorization engine "native" selected. No dedicated authz infrastructure artifacts were generated.',
|
|
27
|
-
],
|
|
28
|
-
};
|
|
29
|
-
default:
|
|
30
|
-
throw new Error(`Unsupported authorization engine for minikube adapter: ${String(engine)}`);
|
|
31
|
-
}
|
|
32
|
-
}
|