@ankhorage/infra 4.1.12 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +21 -32
- package/dist/cli/bin.d.ts +1 -8
- package/dist/cli/bin.d.ts.map +1 -1
- package/dist/cli/bin.js +2 -34
- package/dist/cli/bin.js.map +1 -1
- package/dist/cli/commands/destroy.d.ts +11 -0
- package/dist/cli/commands/destroy.d.ts.map +1 -0
- package/dist/cli/commands/destroy.js +51 -0
- package/dist/cli/commands/destroy.js.map +1 -0
- package/dist/cli/commands/down.d.ts +11 -0
- package/dist/cli/commands/down.d.ts.map +1 -0
- package/dist/cli/commands/down.js +27 -0
- package/dist/cli/commands/down.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +11 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +29 -0
- package/dist/cli/commands/generate.js.map +1 -0
- package/dist/cli/commands/outputs.d.ts +11 -0
- package/dist/cli/commands/outputs.d.ts.map +1 -0
- package/dist/cli/commands/outputs.js +25 -0
- package/dist/cli/commands/outputs.js.map +1 -0
- package/dist/cli/commands/plan.d.ts +11 -0
- package/dist/cli/commands/plan.d.ts.map +1 -0
- package/dist/cli/commands/plan.js +19 -0
- package/dist/cli/commands/plan.js.map +1 -0
- package/dist/cli/commands/status.d.ts +11 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +19 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/up.d.ts +11 -0
- package/dist/cli/commands/up.d.ts.map +1 -0
- package/dist/cli/commands/up.js +28 -0
- package/dist/cli/commands/up.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +11 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +19 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/constants.d.ts +66 -0
- package/dist/cli/constants.d.ts.map +1 -0
- package/dist/cli/constants.js +19 -0
- package/dist/cli/constants.js.map +1 -0
- package/dist/cli/createDefaultInfraCommandContext.d.ts +4 -0
- package/dist/cli/createDefaultInfraCommandContext.d.ts.map +1 -0
- package/dist/{commandContext.js → cli/createDefaultInfraCommandContext.js} +4 -3
- package/dist/cli/createDefaultInfraCommandContext.js.map +1 -0
- package/dist/cli/createInfraRuntimeProvider.d.ts +5 -0
- package/dist/cli/createInfraRuntimeProvider.d.ts.map +1 -0
- package/dist/cli/createInfraRuntimeProvider.js +22 -0
- package/dist/cli/createInfraRuntimeProvider.js.map +1 -0
- package/dist/cli/createProviderCommandDescriptors.d.ts +4 -0
- package/dist/cli/createProviderCommandDescriptors.d.ts.map +1 -0
- package/dist/cli/createProviderCommandDescriptors.js +6 -0
- package/dist/cli/createProviderCommandDescriptors.js.map +1 -0
- package/dist/cli/findInfraCommand.d.ts +4 -0
- package/dist/cli/findInfraCommand.d.ts.map +1 -0
- package/dist/cli/findInfraCommand.js +6 -0
- package/dist/cli/findInfraCommand.js.map +1 -0
- package/dist/cli/index.d.ts +3 -8
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2 -24
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/renderInfraRootHelp.d.ts +3 -0
- package/dist/cli/renderInfraRootHelp.d.ts.map +1 -0
- package/dist/cli/renderInfraRootHelp.js +21 -0
- package/dist/cli/renderInfraRootHelp.js.map +1 -0
- package/dist/cli/renderUnknownInfraCommand.d.ts +3 -0
- package/dist/cli/renderUnknownInfraCommand.d.ts.map +1 -0
- package/dist/cli/renderUnknownInfraCommand.js +5 -0
- package/dist/cli/renderUnknownInfraCommand.js.map +1 -0
- package/dist/cli/runInfraCliAsync.d.ts +10 -0
- package/dist/cli/runInfraCliAsync.d.ts.map +1 -0
- package/dist/cli/runInfraCliAsync.js +34 -0
- package/dist/cli/runInfraCliAsync.js.map +1 -0
- package/dist/cli/runInfraCommandAsync.d.ts +4 -0
- package/dist/cli/runInfraCommandAsync.d.ts.map +1 -0
- package/dist/cli/runInfraCommandAsync.js +100 -0
- package/dist/cli/runInfraCommandAsync.js.map +1 -0
- package/dist/cli/utils/prepareInfraCommandOperationAsync.d.ts +4 -0
- package/dist/cli/utils/prepareInfraCommandOperationAsync.d.ts.map +1 -0
- package/dist/cli/utils/prepareInfraCommandOperationAsync.js +45 -0
- package/dist/cli/utils/prepareInfraCommandOperationAsync.js.map +1 -0
- package/dist/cli/utils/requireInfraSuccess.d.ts +7 -0
- package/dist/cli/utils/requireInfraSuccess.d.ts.map +1 -0
- package/dist/cli/utils/requireInfraSuccess.js +17 -0
- package/dist/cli/utils/requireInfraSuccess.js.map +1 -0
- package/dist/cli/utils/resolveInfraPersistence.d.ts +4 -0
- package/dist/cli/utils/resolveInfraPersistence.d.ts.map +1 -0
- package/dist/cli/utils/resolveInfraPersistence.js +17 -0
- package/dist/cli/utils/resolveInfraPersistence.js.map +1 -0
- package/dist/cli/utils/writeInfraEnvironmentOutputs.d.ts +5 -0
- package/dist/cli/utils/writeInfraEnvironmentOutputs.d.ts.map +1 -0
- package/dist/cli/utils/writeInfraEnvironmentOutputs.js +16 -0
- package/dist/cli/utils/writeInfraEnvironmentOutputs.js.map +1 -0
- package/dist/cli/utils/writeInfraStructured.d.ts +4 -0
- package/dist/cli/utils/writeInfraStructured.d.ts.map +1 -0
- package/dist/cli/utils/writeInfraStructured.js +8 -0
- package/dist/cli/utils/writeInfraStructured.js.map +1 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/{packageMetadata.js → constants.js} +6 -3
- package/dist/constants.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.js +35 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.js +23 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.js +9 -0
- package/dist/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.d.ts +5 -0
- package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.js +28 -0
- package/dist/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.js +7 -0
- package/dist/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.d.ts +7 -0
- package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.d.ts.map +1 -0
- package/dist/{project.js → features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.js} +10 -34
- package/dist/features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.d.ts +5 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.js +28 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.js +16 -0
- package/dist/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.d.ts +9 -0
- package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.js +2 -0
- package/dist/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.js +15 -0
- package/dist/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.js +84 -0
- package/dist/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.js +55 -0
- package/dist/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.js +38 -0
- package/dist/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.js +34 -0
- package/dist/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.js +57 -0
- package/dist/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.d.ts +5 -0
- package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.js +109 -0
- package/dist/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.d.ts +6 -0
- package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.js +181 -0
- package/dist/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.js +68 -0
- package/dist/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.js +98 -0
- package/dist/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.d.ts +5 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.js +17 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.d.ts +4 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.js +13 -0
- package/dist/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.js.map +1 -0
- package/dist/features/environment-lifecycle/composition/createInfraCommandServices.d.ts +4 -0
- package/dist/features/environment-lifecycle/composition/createInfraCommandServices.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/composition/createInfraCommandServices.js +43 -0
- package/dist/features/environment-lifecycle/composition/createInfraCommandServices.js.map +1 -0
- package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.d.ts +4 -0
- package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.js +54 -0
- package/dist/features/environment-lifecycle/domain/orderInfraPlanActions.js.map +1 -0
- package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.d.ts +5 -0
- package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.js +39 -0
- package/dist/features/environment-lifecycle/domain/resolveInfraEnvironment.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/appendInfraFailure.d.ts +7 -0
- package/dist/features/environment-lifecycle/utils/appendInfraFailure.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/appendInfraFailure.js +5 -0
- package/dist/features/environment-lifecycle/utils/appendInfraFailure.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.d.ts +5 -0
- package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.js +13 -0
- package/dist/features/environment-lifecycle/utils/createInfraExecutionContext.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraFailure.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/createInfraFailure.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraFailure.js +5 -0
- package/dist/features/environment-lifecycle/utils/createInfraFailure.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraLedger.d.ts +12 -0
- package/dist/features/environment-lifecycle/utils/createInfraLedger.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/createInfraLedger.js +14 -0
- package/dist/features/environment-lifecycle/utils/createInfraLedger.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/infraIdentityKey.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/infraIdentityKey.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/infraIdentityKey.js +5 -0
- package/dist/features/environment-lifecycle/utils/infraIdentityKey.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/isInfraStoredState.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/isInfraStoredState.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/isInfraStoredState.js +103 -0
- package/dist/features/environment-lifecycle/utils/isInfraStoredState.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.js +10 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraOutputs.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraResources.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraResources.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraResources.js +10 -0
- package/dist/features/environment-lifecycle/utils/mergeInfraResources.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.d.ts +3 -0
- package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.js +8 -0
- package/dist/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.js +11 -0
- package/dist/features/environment-lifecycle/utils/resolveInfraStatePath.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/resolveProjectFile.d.ts +3 -0
- package/dist/features/environment-lifecycle/utils/resolveProjectFile.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/resolveProjectFile.js +19 -0
- package/dist/features/environment-lifecycle/utils/resolveProjectFile.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.js +6 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.js.map +1 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.d.ts +4 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.d.ts.map +1 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.js +6 -0
- package/dist/features/environment-lifecycle/utils/retainUnchangedAdapterResources.js.map +1 -0
- package/dist/index.d.ts +16 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -15
- package/dist/index.js.map +1 -1
- package/dist/metadata/index.d.ts +1 -1
- package/dist/metadata/index.d.ts.map +1 -1
- package/dist/metadata/index.js +1 -1
- package/dist/metadata/index.js.map +1 -1
- package/dist/project/index.d.ts +7 -5
- package/dist/project/index.d.ts.map +1 -1
- package/dist/project/index.js +6 -5
- package/dist/project/index.js.map +1 -1
- package/dist/readme-usage.js +17 -26
- package/dist/readme-usage.js.map +1 -1
- package/dist/testSupport.d.ts +1 -1
- package/dist/testSupport.d.ts.map +1 -1
- package/dist/testSupport.js +11 -1
- package/dist/testSupport.js.map +1 -1
- package/dist/types/infraCli.d.ts +91 -0
- package/dist/types/infraCli.d.ts.map +1 -0
- package/dist/types/infraCli.js +2 -0
- package/dist/types/infraCli.js.map +1 -0
- package/dist/types/infraOrchestration.d.ts +84 -0
- package/dist/types/infraOrchestration.d.ts.map +1 -0
- package/dist/types/infraOrchestration.js +2 -0
- package/dist/types/infraOrchestration.js.map +1 -0
- package/dist/{project.d.ts → types/infraProject.d.ts} +6 -6
- package/dist/types/infraProject.d.ts.map +1 -0
- package/dist/types/infraProject.js +2 -0
- package/dist/types/infraProject.js.map +1 -0
- package/package.json +20 -10
- package/src/adapterPackages.integration.test.ts +79 -0
- package/src/cli/bin.ts +2 -61
- package/src/cli/cli.test.ts +35 -126
- package/src/cli/commands/destroy.ts +57 -0
- package/src/cli/commands/down.ts +28 -0
- package/src/cli/commands/generate.ts +34 -0
- package/src/cli/commands/outputs.ts +25 -0
- package/src/cli/commands/plan.ts +20 -0
- package/src/cli/commands/status.ts +20 -0
- package/src/cli/commands/up.ts +29 -0
- package/src/cli/commands/validate.ts +20 -0
- package/src/cli/constants.ts +19 -0
- package/src/cli/createDefaultInfraCommandContext.ts +17 -0
- package/src/cli/createInfraRuntimeProvider.ts +35 -0
- package/src/cli/createProviderCommandDescriptors.ts +8 -0
- package/src/cli/findInfraCommand.ts +7 -0
- package/src/cli/index.test.ts +12 -20
- package/src/cli/index.ts +7 -49
- package/src/cli/renderInfraRootHelp.ts +23 -0
- package/src/cli/renderUnknownInfraCommand.ts +4 -0
- package/src/cli/runInfraCliAsync.ts +51 -0
- package/src/cli/runInfraCommandAsync.ts +114 -0
- package/src/cli/utils/prepareInfraCommandOperationAsync.ts +64 -0
- package/src/cli/utils/requireInfraSuccess.ts +24 -0
- package/src/cli/utils/resolveInfraPersistence.ts +22 -0
- package/src/cli/utils/writeInfraEnvironmentOutputs.ts +24 -0
- package/src/cli/utils/writeInfraStructured.ts +11 -0
- package/src/commands.test.ts +198 -196
- package/src/{packageMetadata.ts → constants.ts} +5 -2
- package/src/environmentLifecycle.test.ts +193 -0
- package/src/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraCredentialPort.ts +52 -0
- package/src/features/environment-lifecycle/adapters/outbound/createEnvironmentInfraSecretPort.ts +32 -0
- package/src/features/environment-lifecycle/adapters/outbound/createNodeInfraAdapterPackageResolver.ts +10 -0
- package/src/features/environment-lifecycle/adapters/outbound/readStoredInfraStateAsync.ts +34 -0
- package/src/features/environment-lifecycle/adapters/outbound/removeStoredInfraStateAsync.ts +12 -0
- package/src/{project.ts → features/environment-lifecycle/adapters/outbound/resolveInfraProjectAsync.ts} +10 -45
- package/src/features/environment-lifecycle/adapters/outbound/writeInfraGeneratedArtifactsAsync.ts +34 -0
- package/src/features/environment-lifecycle/adapters/outbound/writeStoredInfraStateAsync.ts +21 -0
- package/src/features/environment-lifecycle/application/ports/outbound/infraAdapterPackage.ts +10 -0
- package/src/features/environment-lifecycle/application/use-cases/collectInfraWorkloadsAsync.ts +25 -0
- package/src/features/environment-lifecycle/application/use-cases/destroyInfraEnvironmentAsync.ts +119 -0
- package/src/features/environment-lifecycle/application/use-cases/downInfraEnvironmentAsync.ts +65 -0
- package/src/features/environment-lifecycle/application/use-cases/generateInfraEnvironmentAsync.ts +51 -0
- package/src/features/environment-lifecycle/application/use-cases/getInfraEnvironmentOutputs.ts +41 -0
- package/src/features/environment-lifecycle/application/use-cases/planInfraEnvironmentAsync.ts +67 -0
- package/src/features/environment-lifecycle/application/use-cases/prepareInfraOperationAsync.ts +137 -0
- package/src/features/environment-lifecycle/application/use-cases/resolveInfraAdaptersAsync.ts +257 -0
- package/src/features/environment-lifecycle/application/use-cases/statusInfraEnvironmentAsync.ts +80 -0
- package/src/features/environment-lifecycle/application/use-cases/upInfraEnvironmentAsync.ts +126 -0
- package/src/features/environment-lifecycle/application/use-cases/validateInfraAdaptersAsync.ts +25 -0
- package/src/features/environment-lifecycle/application/use-cases/validateInfraEnvironmentAsync.ts +21 -0
- package/src/features/environment-lifecycle/composition/createInfraCommandServices.ts +47 -0
- package/src/features/environment-lifecycle/domain/orderInfraPlanActions.ts +64 -0
- package/src/features/environment-lifecycle/domain/resolveInfraEnvironment.ts +62 -0
- package/src/features/environment-lifecycle/utils/appendInfraFailure.ts +9 -0
- package/src/features/environment-lifecycle/utils/createInfraExecutionContext.ts +24 -0
- package/src/features/environment-lifecycle/utils/createInfraFailure.ts +6 -0
- package/src/features/environment-lifecycle/utils/createInfraLedger.ts +30 -0
- package/src/features/environment-lifecycle/utils/infraIdentityKey.ts +6 -0
- package/src/features/environment-lifecycle/utils/isInfraStoredState.ts +141 -0
- package/src/features/environment-lifecycle/utils/mergeInfraOutputs.ts +14 -0
- package/src/features/environment-lifecycle/utils/mergeInfraResources.ts +14 -0
- package/src/features/environment-lifecycle/utils/normalizeInfraEnvironmentKey.ts +7 -0
- package/src/features/environment-lifecycle/utils/resolveInfraStatePath.ts +12 -0
- package/src/features/environment-lifecycle/utils/resolveProjectFile.ts +22 -0
- package/src/features/environment-lifecycle/utils/retainUnchangedAdapterOutputs.ts +15 -0
- package/src/features/environment-lifecycle/utils/retainUnchangedAdapterResources.ts +15 -0
- package/src/index.test.ts +22 -315
- package/src/index.ts +41 -53
- package/src/infraComposition.integration.test.ts +128 -0
- package/src/infraOperations.test.ts +386 -0
- package/src/infraUp.test.ts +260 -0
- package/src/metadata/index.ts +1 -1
- package/src/package.test.ts +4 -2
- package/src/project/index.test.ts +8 -188
- package/src/project/index.ts +7 -22
- package/src/project.test.ts +39 -189
- package/src/projectContractsParser.test.ts +2 -2
- package/src/projectInfrastructure.test.ts +121 -167
- package/src/readme-usage.ts +17 -26
- package/src/testSupport.ts +12 -2
- package/src/types/infraCli.ts +115 -0
- package/src/types/infraOrchestration.ts +126 -0
- package/src/types/infraProject.ts +15 -0
- package/dist/adapters/minikube/auth/index.d.ts +0 -8
- package/dist/adapters/minikube/auth/index.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/index.js +0 -29
- package/dist/adapters/minikube/auth/index.js.map +0 -1
- package/dist/adapters/minikube/auth/oauthRuntime.d.ts +0 -4
- package/dist/adapters/minikube/auth/oauthRuntime.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/oauthRuntime.js +0 -138
- package/dist/adapters/minikube/auth/oauthRuntime.js.map +0 -1
- package/dist/adapters/minikube/auth/supabase/index.d.ts +0 -7
- package/dist/adapters/minikube/auth/supabase/index.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/supabase/index.js +0 -232
- package/dist/adapters/minikube/auth/supabase/index.js.map +0 -1
- package/dist/adapters/minikube/auth/supabase/profile.d.ts +0 -20
- package/dist/adapters/minikube/auth/supabase/profile.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/supabase/profile.js +0 -452
- package/dist/adapters/minikube/auth/supabase/profile.js.map +0 -1
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.d.ts +0 -7
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.d.ts.map +0 -1
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.js +0 -104
- package/dist/adapters/minikube/auth/targetAwareOAuthRuntime.js.map +0 -1
- package/dist/adapters/minikube/authz/cerbos/index.d.ts +0 -13
- package/dist/adapters/minikube/authz/cerbos/index.d.ts.map +0 -1
- package/dist/adapters/minikube/authz/cerbos/index.js +0 -382
- package/dist/adapters/minikube/authz/cerbos/index.js.map +0 -1
- package/dist/adapters/minikube/authz/index.d.ts +0 -9
- package/dist/adapters/minikube/authz/index.d.ts.map +0 -1
- package/dist/adapters/minikube/authz/index.js +0 -23
- package/dist/adapters/minikube/authz/index.js.map +0 -1
- package/dist/adapters/minikube/base/index.d.ts +0 -14
- package/dist/adapters/minikube/base/index.d.ts.map +0 -1
- package/dist/adapters/minikube/base/index.js +0 -3433
- package/dist/adapters/minikube/base/index.js.map +0 -1
- package/dist/adapters/minikube/base/supabaseMigrations.d.ts +0 -2
- package/dist/adapters/minikube/base/supabaseMigrations.d.ts.map +0 -1
- package/dist/adapters/minikube/base/supabaseMigrations.js +0 -6
- package/dist/adapters/minikube/base/supabaseMigrations.js.map +0 -1
- package/dist/adapters/minikube/contracts.d.ts +0 -34
- package/dist/adapters/minikube/contracts.d.ts.map +0 -1
- package/dist/adapters/minikube/contracts.js +0 -10
- package/dist/adapters/minikube/contracts.js.map +0 -1
- package/dist/adapters/minikube/index.d.ts +0 -3
- package/dist/adapters/minikube/index.d.ts.map +0 -1
- package/dist/adapters/minikube/index.js +0 -136
- package/dist/adapters/minikube/index.js.map +0 -1
- package/dist/adapters/minikube/secrets/index.d.ts +0 -7
- package/dist/adapters/minikube/secrets/index.d.ts.map +0 -1
- package/dist/adapters/minikube/secrets/index.js +0 -13
- package/dist/adapters/minikube/secrets/index.js.map +0 -1
- package/dist/adapters/minikube/secrets/supabase-vault/index.d.ts +0 -8
- package/dist/adapters/minikube/secrets/supabase-vault/index.d.ts.map +0 -1
- package/dist/adapters/minikube/secrets/supabase-vault/index.js +0 -118
- package/dist/adapters/minikube/secrets/supabase-vault/index.js.map +0 -1
- package/dist/adapters/minikube/storage/index.d.ts +0 -7
- package/dist/adapters/minikube/storage/index.d.ts.map +0 -1
- package/dist/adapters/minikube/storage/index.js +0 -77
- package/dist/adapters/minikube/storage/index.js.map +0 -1
- package/dist/adapters/minikube/storage/supabase/index.d.ts +0 -7
- package/dist/adapters/minikube/storage/supabase/index.d.ts.map +0 -1
- package/dist/adapters/minikube/storage/supabase/index.js +0 -82
- package/dist/adapters/minikube/storage/supabase/index.js.map +0 -1
- package/dist/authRedirects.d.ts +0 -19
- package/dist/authRedirects.d.ts.map +0 -1
- package/dist/authRedirects.js +0 -80
- package/dist/authRedirects.js.map +0 -1
- package/dist/authTargetRedirects.d.ts +0 -12
- package/dist/authTargetRedirects.d.ts.map +0 -1
- package/dist/authTargetRedirects.js +0 -32
- package/dist/authTargetRedirects.js.map +0 -1
- package/dist/commandContext.d.ts +0 -12
- package/dist/commandContext.d.ts.map +0 -1
- package/dist/commandContext.js.map +0 -1
- package/dist/commands.d.ts +0 -95
- package/dist/commands.d.ts.map +0 -1
- package/dist/commands.js +0 -256
- package/dist/commands.js.map +0 -1
- package/dist/infraValidation.d.ts +0 -4
- package/dist/infraValidation.d.ts.map +0 -1
- package/dist/infraValidation.js +0 -63
- package/dist/infraValidation.js.map +0 -1
- package/dist/packageMetadata.d.ts +0 -10
- package/dist/packageMetadata.d.ts.map +0 -1
- package/dist/packageMetadata.js.map +0 -1
- package/dist/project.d.ts.map +0 -1
- package/dist/project.js.map +0 -1
- package/dist/projectDatabase.d.ts +0 -5
- package/dist/projectDatabase.d.ts.map +0 -1
- package/dist/projectDatabase.js +0 -22
- package/dist/projectDatabase.js.map +0 -1
- package/dist/projectEnvironment.d.ts +0 -6
- package/dist/projectEnvironment.d.ts.map +0 -1
- package/dist/projectEnvironment.js +0 -45
- package/dist/projectEnvironment.js.map +0 -1
- package/dist/projectInfrastructure.d.ts +0 -38
- package/dist/projectInfrastructure.d.ts.map +0 -1
- package/dist/projectInfrastructure.js +0 -145
- package/dist/projectInfrastructure.js.map +0 -1
- package/dist/runtime.d.ts +0 -54
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -151
- package/dist/runtime.js.map +0 -1
- package/dist/secretStore.d.ts +0 -19
- package/dist/secretStore.d.ts.map +0 -1
- package/dist/secretStore.js +0 -22
- package/dist/secretStore.js.map +0 -1
- package/dist/types.d.ts +0 -70
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/src/adapters/minikube/README.md +0 -115
- package/src/adapters/minikube/appRuntimeServing.test.ts +0 -28
- package/src/adapters/minikube/auth/index.ts +0 -40
- package/src/adapters/minikube/auth/oauthRuntime.ts +0 -163
- package/src/adapters/minikube/auth/supabase/index.test.ts +0 -227
- package/src/adapters/minikube/auth/supabase/index.ts +0 -293
- package/src/adapters/minikube/auth/supabase/oauthRuntime.test.ts +0 -154
- package/src/adapters/minikube/auth/supabase/profile.integration.test.ts +0 -1028
- package/src/adapters/minikube/auth/supabase/profile.ts +0 -526
- package/src/adapters/minikube/auth/supabase/providerAssignments.test.ts +0 -36
- package/src/adapters/minikube/auth/targetAwareOAuthRuntime.test.ts +0 -83
- package/src/adapters/minikube/auth/targetAwareOAuthRuntime.ts +0 -136
- package/src/adapters/minikube/authz/cerbos/index.ts +0 -486
- package/src/adapters/minikube/authz/index.ts +0 -32
- package/src/adapters/minikube/base/appImageBuild.test.ts +0 -352
- package/src/adapters/minikube/base/index.test.ts +0 -693
- package/src/adapters/minikube/base/index.ts +0 -3763
- package/src/adapters/minikube/base/portForwardRuntime.test.ts +0 -624
- package/src/adapters/minikube/base/supabaseMigrations.test.ts +0 -168
- package/src/adapters/minikube/base/supabaseMigrations.ts +0 -5
- package/src/adapters/minikube/base/twoAppIsolation.integration.test.ts +0 -898
- package/src/adapters/minikube/base/upgradeReconciliation.test.ts +0 -135
- package/src/adapters/minikube/contracts.ts +0 -46
- package/src/adapters/minikube/index.ts +0 -172
- package/src/adapters/minikube/secrets/index.test.ts +0 -147
- package/src/adapters/minikube/secrets/index.ts +0 -19
- package/src/adapters/minikube/secrets/supabase-vault/index.ts +0 -139
- package/src/adapters/minikube/storage/index.ts +0 -91
- package/src/adapters/minikube/storage/supabase/index.ts +0 -108
- package/src/apiInfrastructure.test.ts +0 -69
- package/src/authRedirects.test.ts +0 -63
- package/src/authRedirects.ts +0 -113
- package/src/authTargetRedirects.test.ts +0 -62
- package/src/authTargetRedirects.ts +0 -46
- package/src/commandContext.ts +0 -27
- package/src/commands.ts +0 -404
- package/src/generatedApiLedgerCleanup.test.ts +0 -72
- package/src/infraApiValidation.test.ts +0 -42
- package/src/infraValidation.ts +0 -99
- package/src/minikubeImageLifecycle.test.ts +0 -35
- package/src/projectDatabase.ts +0 -27
- package/src/projectEnvironment.ts +0 -51
- package/src/projectInfrastructure.ts +0 -221
- package/src/runtime.test.ts +0 -124
- package/src/runtime.ts +0 -234
- package/src/secretStore.test.ts +0 -76
- package/src/secretStore.ts +0 -44
- package/src/types.ts +0 -82
|
@@ -1,526 +0,0 @@
|
|
|
1
|
-
import { createHash } from 'node:crypto';
|
|
2
|
-
|
|
3
|
-
import type { InfraManifestInput } from '../../../../types';
|
|
4
|
-
|
|
5
|
-
const DEFAULT_PROFILE_FIELDS = ['email', 'firstName', 'lastName'];
|
|
6
|
-
const DEFAULT_PROFILE_PRIMARY_KEY = 'authUserId';
|
|
7
|
-
const DEFAULT_PROFILE_CREATE_STRATEGY = 'trigger';
|
|
8
|
-
const DEFAULT_PROFILE_UPDATE_STRATEGY = 'api';
|
|
9
|
-
const PROFILE_POLICY_VERSION = 1;
|
|
10
|
-
const PROFILE_RECONCILER_VERSION = 1;
|
|
11
|
-
const PROFILE_ARTIFACT_KEY = 'auth.profile';
|
|
12
|
-
|
|
13
|
-
const MANAGED_PROFILE_COLUMNS = [
|
|
14
|
-
'email',
|
|
15
|
-
'display_name',
|
|
16
|
-
'first_name',
|
|
17
|
-
'last_name',
|
|
18
|
-
'avatar_url',
|
|
19
|
-
'username',
|
|
20
|
-
'phone',
|
|
21
|
-
] as const;
|
|
22
|
-
|
|
23
|
-
interface ProfileColumnSpec {
|
|
24
|
-
readonly field: string;
|
|
25
|
-
readonly column: string;
|
|
26
|
-
readonly sqlType: string;
|
|
27
|
-
readonly fromNewUser: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface ResolvedProfileModel {
|
|
31
|
-
readonly enabled: boolean;
|
|
32
|
-
readonly table: string;
|
|
33
|
-
readonly primaryKey: string;
|
|
34
|
-
readonly createStrategy: string;
|
|
35
|
-
readonly updateStrategy: string;
|
|
36
|
-
readonly columns: readonly ProfileColumnSpec[];
|
|
37
|
-
readonly desiredStateHash: string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function resolveSupabaseProfileModel(manifest: InfraManifestInput): ResolvedProfileModel {
|
|
41
|
-
const table = normalizeIdentifier(manifest.auth?.profile?.table ?? '');
|
|
42
|
-
const fields = normalizeFieldList(manifest.auth?.profile?.fields);
|
|
43
|
-
const primaryKey = manifest.auth?.profile?.primaryKey ?? DEFAULT_PROFILE_PRIMARY_KEY;
|
|
44
|
-
const createStrategy = manifest.auth?.profile?.createStrategy ?? DEFAULT_PROFILE_CREATE_STRATEGY;
|
|
45
|
-
const updateStrategy = manifest.auth?.profile?.updateStrategy ?? DEFAULT_PROFILE_UPDATE_STRATEGY;
|
|
46
|
-
const columns = resolveProfileColumns(fields);
|
|
47
|
-
|
|
48
|
-
const hash = table
|
|
49
|
-
? getProfileDesiredStateHash({
|
|
50
|
-
table,
|
|
51
|
-
primaryKey,
|
|
52
|
-
createStrategy,
|
|
53
|
-
updateStrategy,
|
|
54
|
-
columns,
|
|
55
|
-
})
|
|
56
|
-
: '';
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
enabled: table.length > 0,
|
|
60
|
-
table,
|
|
61
|
-
primaryKey,
|
|
62
|
-
createStrategy,
|
|
63
|
-
updateStrategy,
|
|
64
|
-
columns,
|
|
65
|
-
desiredStateHash: hash,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export function getSupabaseProfileReconciliation(profileModel: ResolvedProfileModel): string {
|
|
70
|
-
const table = quoteIdentifier(profileModel.table);
|
|
71
|
-
const functionName = quoteIdentifier(`handle_new_${profileModel.table}_user`);
|
|
72
|
-
const triggerName = quoteIdentifier(`on_auth_user_created_${profileModel.table}`);
|
|
73
|
-
const configuredColumns = new Set(profileModel.columns.map((column) => column.column));
|
|
74
|
-
const addColumnSql = profileModel.columns
|
|
75
|
-
.map(
|
|
76
|
-
(column) =>
|
|
77
|
-
`alter table public.${table} add column if not exists ${quoteIdentifier(column.column)} ${column.sqlType};`,
|
|
78
|
-
)
|
|
79
|
-
.join('\n');
|
|
80
|
-
const dropStaleManagedColumnSql = MANAGED_PROFILE_COLUMNS.filter(
|
|
81
|
-
(column) => !configuredColumns.has(column),
|
|
82
|
-
)
|
|
83
|
-
.map(
|
|
84
|
-
(column) => `alter table public.${table} drop column if exists ${quoteIdentifier(column)};`,
|
|
85
|
-
)
|
|
86
|
-
.join('\n');
|
|
87
|
-
const insertColumns = ['id', ...profileModel.columns.map((column) => column.column)]
|
|
88
|
-
.map(quoteIdentifier)
|
|
89
|
-
.join(', ');
|
|
90
|
-
const insertValues = ['new.id', ...profileModel.columns.map((column) => column.fromNewUser)].join(
|
|
91
|
-
', ',
|
|
92
|
-
);
|
|
93
|
-
const updateAssignments = profileModel.columns
|
|
94
|
-
.filter((column) => column.field === 'email')
|
|
95
|
-
.map(
|
|
96
|
-
(column) => `${quoteIdentifier(column.column)} = excluded.${quoteIdentifier(column.column)}`,
|
|
97
|
-
);
|
|
98
|
-
const conflictUpdate = [...updateAssignments, 'updated_at = now()'].join(',\n ');
|
|
99
|
-
const updateGrantColumns = profileModel.columns.map((column) => quoteIdentifier(column.column));
|
|
100
|
-
const updateGrantSql =
|
|
101
|
-
updateGrantColumns.length > 0
|
|
102
|
-
? `grant update (${updateGrantColumns.join(', ')}) on table public.${table} to authenticated;`
|
|
103
|
-
: '';
|
|
104
|
-
const triggerSql =
|
|
105
|
-
profileModel.createStrategy === 'trigger'
|
|
106
|
-
? `
|
|
107
|
-
create or replace function public.${functionName}()
|
|
108
|
-
returns trigger
|
|
109
|
-
language plpgsql
|
|
110
|
-
security definer
|
|
111
|
-
set search_path = pg_catalog, pg_temp
|
|
112
|
-
as $$
|
|
113
|
-
begin
|
|
114
|
-
insert into public.${table} (${insertColumns})
|
|
115
|
-
values (${insertValues})
|
|
116
|
-
on conflict (id) do update set
|
|
117
|
-
${conflictUpdate};
|
|
118
|
-
|
|
119
|
-
return new;
|
|
120
|
-
end;
|
|
121
|
-
$$;
|
|
122
|
-
|
|
123
|
-
revoke execute on function public.${functionName}() from PUBLIC;
|
|
124
|
-
revoke execute on function public.${functionName}() from anon;
|
|
125
|
-
revoke execute on function public.${functionName}() from authenticated;
|
|
126
|
-
|
|
127
|
-
drop trigger if exists ${triggerName} on auth.users;
|
|
128
|
-
create trigger ${triggerName}
|
|
129
|
-
after insert on auth.users
|
|
130
|
-
for each row execute function public.${functionName}();
|
|
131
|
-
`
|
|
132
|
-
: `
|
|
133
|
-
drop trigger if exists ${triggerName} on auth.users;
|
|
134
|
-
drop function if exists public.${functionName}();
|
|
135
|
-
`;
|
|
136
|
-
|
|
137
|
-
return `-- Generated by @ankhorage/infra from manifest.auth.profile.
|
|
138
|
-
-- Desired-state reconciliation for local Supabase; not a migration-history entry.
|
|
139
|
-
|
|
140
|
-
begin;
|
|
141
|
-
|
|
142
|
-
create schema if not exists ankhorage_internal;
|
|
143
|
-
|
|
144
|
-
create table if not exists ankhorage_internal.generated_schema_state (
|
|
145
|
-
artifact_key text primary key,
|
|
146
|
-
table_name text,
|
|
147
|
-
content_hash text not null,
|
|
148
|
-
applied_at timestamptz not null
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
alter table ankhorage_internal.generated_schema_state
|
|
152
|
-
add column if not exists table_name text;
|
|
153
|
-
|
|
154
|
-
do $$
|
|
155
|
-
declare
|
|
156
|
-
previous_table_name text;
|
|
157
|
-
has_previous_state boolean;
|
|
158
|
-
begin
|
|
159
|
-
select table_name, true
|
|
160
|
-
into previous_table_name, has_previous_state
|
|
161
|
-
from ankhorage_internal.generated_schema_state
|
|
162
|
-
where artifact_key = '${PROFILE_ARTIFACT_KEY}';
|
|
163
|
-
|
|
164
|
-
if has_previous_state and previous_table_name is null then
|
|
165
|
-
raise exception 'existing auth.profile generated state is missing table identity; reset local Supabase or add an explicit cleanup migration before applying generated profile reconciliation';
|
|
166
|
-
end if;
|
|
167
|
-
|
|
168
|
-
if has_previous_state and previous_table_name <> '${escapeSqlLiteral(profileModel.table)}' then
|
|
169
|
-
raise exception 'profile.table changed from % to %; reset local Supabase or add an explicit cleanup migration before applying generated profile reconciliation', previous_table_name, '${escapeSqlLiteral(profileModel.table)}';
|
|
170
|
-
end if;
|
|
171
|
-
end;
|
|
172
|
-
$$;
|
|
173
|
-
|
|
174
|
-
create table if not exists public.${table} (
|
|
175
|
-
id uuid primary key references auth.users(id) on delete cascade,
|
|
176
|
-
created_at timestamptz not null default now(),
|
|
177
|
-
updated_at timestamptz not null default now()
|
|
178
|
-
);
|
|
179
|
-
|
|
180
|
-
alter table public.${table} add column if not exists id uuid;
|
|
181
|
-
alter table public.${table} add column if not exists created_at timestamptz not null default now();
|
|
182
|
-
alter table public.${table} add column if not exists updated_at timestamptz not null default now();
|
|
183
|
-
${addColumnSql}
|
|
184
|
-
alter table public.${table} drop column if exists role;
|
|
185
|
-
${dropStaleManagedColumnSql}
|
|
186
|
-
|
|
187
|
-
do $$
|
|
188
|
-
begin
|
|
189
|
-
if exists (
|
|
190
|
-
select 1
|
|
191
|
-
from pg_constraint c
|
|
192
|
-
where c.conrelid = 'public.${escapeSqlLiteral(profileModel.table)}'::regclass
|
|
193
|
-
and c.contype = 'p'
|
|
194
|
-
and c.conkey <> array[
|
|
195
|
-
(
|
|
196
|
-
select a.attnum
|
|
197
|
-
from pg_attribute a
|
|
198
|
-
where a.attrelid = 'public.${escapeSqlLiteral(profileModel.table)}'::regclass
|
|
199
|
-
and a.attname = 'id'
|
|
200
|
-
and not a.attisdropped
|
|
201
|
-
)
|
|
202
|
-
]::smallint[]
|
|
203
|
-
) then
|
|
204
|
-
raise exception 'profile table public.${escapeSqlLiteral(profileModel.table)} has a primary key that is not exactly id';
|
|
205
|
-
end if;
|
|
206
|
-
|
|
207
|
-
if not exists (
|
|
208
|
-
select 1
|
|
209
|
-
from pg_constraint
|
|
210
|
-
where conrelid = 'public.${escapeSqlLiteral(profileModel.table)}'::regclass
|
|
211
|
-
and contype = 'p'
|
|
212
|
-
) then
|
|
213
|
-
alter table public.${table}
|
|
214
|
-
add constraint ${quoteIdentifier(`${profileModel.table}_pkey`)} primary key (id);
|
|
215
|
-
end if;
|
|
216
|
-
end;
|
|
217
|
-
$$;
|
|
218
|
-
|
|
219
|
-
do $$
|
|
220
|
-
begin
|
|
221
|
-
if exists (
|
|
222
|
-
select 1
|
|
223
|
-
from pg_constraint c
|
|
224
|
-
where c.conrelid = 'public.${escapeSqlLiteral(profileModel.table)}'::regclass
|
|
225
|
-
and c.contype = 'f'
|
|
226
|
-
and c.confrelid = 'auth.users'::regclass
|
|
227
|
-
and c.conkey && array[
|
|
228
|
-
(
|
|
229
|
-
select a.attnum
|
|
230
|
-
from pg_attribute a
|
|
231
|
-
where a.attrelid = 'public.${escapeSqlLiteral(profileModel.table)}'::regclass
|
|
232
|
-
and a.attname = 'id'
|
|
233
|
-
and not a.attisdropped
|
|
234
|
-
)
|
|
235
|
-
]::smallint[]
|
|
236
|
-
and (
|
|
237
|
-
c.confdeltype <> 'c'
|
|
238
|
-
or c.conkey <> array[
|
|
239
|
-
(
|
|
240
|
-
select a.attnum
|
|
241
|
-
from pg_attribute a
|
|
242
|
-
where a.attrelid = 'public.${escapeSqlLiteral(profileModel.table)}'::regclass
|
|
243
|
-
and a.attname = 'id'
|
|
244
|
-
and not a.attisdropped
|
|
245
|
-
)
|
|
246
|
-
]::smallint[]
|
|
247
|
-
or c.confkey <> array[
|
|
248
|
-
(
|
|
249
|
-
select a.attnum
|
|
250
|
-
from pg_attribute a
|
|
251
|
-
where a.attrelid = 'auth.users'::regclass
|
|
252
|
-
and a.attname = 'id'
|
|
253
|
-
and not a.attisdropped
|
|
254
|
-
)
|
|
255
|
-
]::smallint[]
|
|
256
|
-
)
|
|
257
|
-
) then
|
|
258
|
-
raise exception 'profile table public.${escapeSqlLiteral(profileModel.table)} has an auth.users foreign key that is not exactly id -> auth.users(id) on delete cascade';
|
|
259
|
-
end if;
|
|
260
|
-
|
|
261
|
-
if not exists (
|
|
262
|
-
select 1
|
|
263
|
-
from pg_constraint c
|
|
264
|
-
where c.conrelid = 'public.${escapeSqlLiteral(profileModel.table)}'::regclass
|
|
265
|
-
and c.confrelid = 'auth.users'::regclass
|
|
266
|
-
and c.contype = 'f'
|
|
267
|
-
and c.confdeltype = 'c'
|
|
268
|
-
and c.conkey = array[
|
|
269
|
-
(
|
|
270
|
-
select a.attnum
|
|
271
|
-
from pg_attribute a
|
|
272
|
-
where a.attrelid = 'public.${escapeSqlLiteral(profileModel.table)}'::regclass
|
|
273
|
-
and a.attname = 'id'
|
|
274
|
-
and not a.attisdropped
|
|
275
|
-
)
|
|
276
|
-
]::smallint[]
|
|
277
|
-
and c.confkey = array[
|
|
278
|
-
(
|
|
279
|
-
select a.attnum
|
|
280
|
-
from pg_attribute a
|
|
281
|
-
where a.attrelid = 'auth.users'::regclass
|
|
282
|
-
and a.attname = 'id'
|
|
283
|
-
and not a.attisdropped
|
|
284
|
-
)
|
|
285
|
-
]::smallint[]
|
|
286
|
-
) then
|
|
287
|
-
alter table public.${table}
|
|
288
|
-
add constraint ${quoteIdentifier(`${profileModel.table}_id_auth_users_fkey`)}
|
|
289
|
-
foreign key (id) references auth.users(id) on delete cascade;
|
|
290
|
-
end if;
|
|
291
|
-
end;
|
|
292
|
-
$$;
|
|
293
|
-
|
|
294
|
-
do $$
|
|
295
|
-
begin
|
|
296
|
-
if not exists (
|
|
297
|
-
select 1
|
|
298
|
-
from information_schema.columns c
|
|
299
|
-
where c.table_schema = 'public'
|
|
300
|
-
and c.table_name = '${escapeSqlLiteral(profileModel.table)}'
|
|
301
|
-
and c.column_name = 'id'
|
|
302
|
-
and c.udt_name = 'uuid'
|
|
303
|
-
and c.is_nullable = 'NO'
|
|
304
|
-
) then
|
|
305
|
-
raise exception 'profile id column must be uuid not null';
|
|
306
|
-
end if;
|
|
307
|
-
|
|
308
|
-
if not exists (
|
|
309
|
-
select 1
|
|
310
|
-
from information_schema.columns c
|
|
311
|
-
where c.table_schema = 'public'
|
|
312
|
-
and c.table_name = '${escapeSqlLiteral(profileModel.table)}'
|
|
313
|
-
and c.column_name = 'created_at'
|
|
314
|
-
and c.data_type = 'timestamp with time zone'
|
|
315
|
-
and c.is_nullable = 'NO'
|
|
316
|
-
and c.column_default = 'now()'
|
|
317
|
-
) then
|
|
318
|
-
raise exception 'profile created_at column must be timestamptz not null default now()';
|
|
319
|
-
end if;
|
|
320
|
-
|
|
321
|
-
if not exists (
|
|
322
|
-
select 1
|
|
323
|
-
from information_schema.columns c
|
|
324
|
-
where c.table_schema = 'public'
|
|
325
|
-
and c.table_name = '${escapeSqlLiteral(profileModel.table)}'
|
|
326
|
-
and c.column_name = 'updated_at'
|
|
327
|
-
and c.data_type = 'timestamp with time zone'
|
|
328
|
-
and c.is_nullable = 'NO'
|
|
329
|
-
and c.column_default = 'now()'
|
|
330
|
-
) then
|
|
331
|
-
raise exception 'profile updated_at column must be timestamptz not null default now()';
|
|
332
|
-
end if;
|
|
333
|
-
end;
|
|
334
|
-
$$;
|
|
335
|
-
|
|
336
|
-
alter table public.${table} enable row level security;
|
|
337
|
-
|
|
338
|
-
revoke all on table public.${table} from anon, authenticated;
|
|
339
|
-
grant select on table public.${table} to authenticated;
|
|
340
|
-
${updateGrantSql}
|
|
341
|
-
|
|
342
|
-
drop policy if exists ${quoteIdentifier(`${profileModel.table}_select_own`)} on public.${table};
|
|
343
|
-
create policy ${quoteIdentifier(`${profileModel.table}_select_own`)}
|
|
344
|
-
on public.${table}
|
|
345
|
-
for select
|
|
346
|
-
to authenticated
|
|
347
|
-
using ((select auth.uid()) = id);
|
|
348
|
-
|
|
349
|
-
drop policy if exists ${quoteIdentifier(`${profileModel.table}_update_own`)} on public.${table};
|
|
350
|
-
create policy ${quoteIdentifier(`${profileModel.table}_update_own`)}
|
|
351
|
-
on public.${table}
|
|
352
|
-
for update
|
|
353
|
-
to authenticated
|
|
354
|
-
using ((select auth.uid()) = id)
|
|
355
|
-
with check ((select auth.uid()) = id);
|
|
356
|
-
${triggerSql}
|
|
357
|
-
insert into ankhorage_internal.generated_schema_state (
|
|
358
|
-
artifact_key,
|
|
359
|
-
table_name,
|
|
360
|
-
content_hash,
|
|
361
|
-
applied_at
|
|
362
|
-
)
|
|
363
|
-
values (
|
|
364
|
-
'${PROFILE_ARTIFACT_KEY}',
|
|
365
|
-
'${escapeSqlLiteral(profileModel.table)}',
|
|
366
|
-
'${profileModel.desiredStateHash}',
|
|
367
|
-
now()
|
|
368
|
-
)
|
|
369
|
-
on conflict (artifact_key)
|
|
370
|
-
do update set
|
|
371
|
-
table_name = excluded.table_name,
|
|
372
|
-
content_hash = excluded.content_hash,
|
|
373
|
-
applied_at = excluded.applied_at;
|
|
374
|
-
|
|
375
|
-
commit;
|
|
376
|
-
`;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
function mapProfileFieldToColumn(field: string): ProfileColumnSpec | null {
|
|
380
|
-
switch (field) {
|
|
381
|
-
case 'email':
|
|
382
|
-
return { field, column: 'email', sqlType: 'text', fromNewUser: 'new.email' };
|
|
383
|
-
case 'displayName':
|
|
384
|
-
return {
|
|
385
|
-
field,
|
|
386
|
-
column: 'display_name',
|
|
387
|
-
sqlType: 'text',
|
|
388
|
-
fromNewUser:
|
|
389
|
-
"coalesce(new.raw_user_meta_data->>'displayName', new.raw_user_meta_data->>'display_name', split_part(new.email, '@', 1))",
|
|
390
|
-
};
|
|
391
|
-
case 'firstName':
|
|
392
|
-
return {
|
|
393
|
-
field,
|
|
394
|
-
column: 'first_name',
|
|
395
|
-
sqlType: 'text',
|
|
396
|
-
fromNewUser:
|
|
397
|
-
"coalesce(new.raw_user_meta_data->>'firstName', new.raw_user_meta_data->>'first_name')",
|
|
398
|
-
};
|
|
399
|
-
case 'lastName':
|
|
400
|
-
return {
|
|
401
|
-
field,
|
|
402
|
-
column: 'last_name',
|
|
403
|
-
sqlType: 'text',
|
|
404
|
-
fromNewUser:
|
|
405
|
-
"coalesce(new.raw_user_meta_data->>'lastName', new.raw_user_meta_data->>'last_name')",
|
|
406
|
-
};
|
|
407
|
-
case 'avatarUrl':
|
|
408
|
-
return {
|
|
409
|
-
field,
|
|
410
|
-
column: 'avatar_url',
|
|
411
|
-
sqlType: 'text',
|
|
412
|
-
fromNewUser:
|
|
413
|
-
"coalesce(new.raw_user_meta_data->>'avatarUrl', new.raw_user_meta_data->>'avatar_url')",
|
|
414
|
-
};
|
|
415
|
-
case 'username':
|
|
416
|
-
return {
|
|
417
|
-
field,
|
|
418
|
-
column: 'username',
|
|
419
|
-
sqlType: 'text',
|
|
420
|
-
fromNewUser: "new.raw_user_meta_data->>'username'",
|
|
421
|
-
};
|
|
422
|
-
case 'phone':
|
|
423
|
-
return { field, column: 'phone', sqlType: 'text', fromNewUser: 'new.phone' };
|
|
424
|
-
default:
|
|
425
|
-
return null;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
function quoteIdentifier(value: string): string {
|
|
430
|
-
return `"${value.replaceAll('"', '""')}"`;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
function getProfileDesiredStateHash(args: {
|
|
434
|
-
readonly table: string;
|
|
435
|
-
readonly primaryKey: string;
|
|
436
|
-
readonly createStrategy: string;
|
|
437
|
-
readonly updateStrategy: string;
|
|
438
|
-
readonly columns: readonly ProfileColumnSpec[];
|
|
439
|
-
}): string {
|
|
440
|
-
const state = {
|
|
441
|
-
artifactKey: PROFILE_ARTIFACT_KEY,
|
|
442
|
-
table: args.table,
|
|
443
|
-
primaryKey: args.primaryKey,
|
|
444
|
-
createStrategy: args.createStrategy,
|
|
445
|
-
updateStrategy: args.updateStrategy,
|
|
446
|
-
managedColumns: args.columns.map((column) => ({
|
|
447
|
-
field: column.field,
|
|
448
|
-
column: column.column,
|
|
449
|
-
sqlType: column.sqlType,
|
|
450
|
-
})),
|
|
451
|
-
policyVersion: PROFILE_POLICY_VERSION,
|
|
452
|
-
reconcilerVersion: PROFILE_RECONCILER_VERSION,
|
|
453
|
-
};
|
|
454
|
-
|
|
455
|
-
return createHash('sha256').update(JSON.stringify(state)).digest('hex');
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
function resolveProfileColumns(fields: readonly string[]): ProfileColumnSpec[] {
|
|
459
|
-
const columns = new Map<string, ProfileColumnSpec>();
|
|
460
|
-
|
|
461
|
-
for (const field of fields) {
|
|
462
|
-
const column = mapProfileFieldToColumn(field);
|
|
463
|
-
if (!column) {
|
|
464
|
-
throw new Error(
|
|
465
|
-
`Unsupported Supabase profile field "${field}". Supported fields: ${getSupportedProfileFields().join(', ')}.`,
|
|
466
|
-
);
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
if (columns.has(column.column)) {
|
|
470
|
-
continue;
|
|
471
|
-
}
|
|
472
|
-
columns.set(column.column, column);
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
return [...columns.values()].sort(
|
|
476
|
-
(left, right) =>
|
|
477
|
-
MANAGED_PROFILE_COLUMNS.indexOf(left.column as (typeof MANAGED_PROFILE_COLUMNS)[number]) -
|
|
478
|
-
MANAGED_PROFILE_COLUMNS.indexOf(right.column as (typeof MANAGED_PROFILE_COLUMNS)[number]),
|
|
479
|
-
);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
function normalizeFieldList(values: readonly string[] | undefined): string[] {
|
|
483
|
-
const source = values ?? DEFAULT_PROFILE_FIELDS;
|
|
484
|
-
const next: string[] = [];
|
|
485
|
-
|
|
486
|
-
for (const value of source) {
|
|
487
|
-
const normalized = value.trim();
|
|
488
|
-
if (!normalized) {
|
|
489
|
-
throw new Error('Invalid Supabase profile field "". Profile fields must be non-empty.');
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
if (next.includes(normalized)) {
|
|
493
|
-
continue;
|
|
494
|
-
}
|
|
495
|
-
next.push(normalized);
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
return next;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
function getSupportedProfileFields(): string[] {
|
|
502
|
-
return ['email', 'displayName', 'firstName', 'lastName', 'avatarUrl', 'username', 'phone'];
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
function normalizeIdentifier(value: string): string {
|
|
506
|
-
const trimmed = value.trim();
|
|
507
|
-
if (!trimmed) return '';
|
|
508
|
-
|
|
509
|
-
if (trimmed === 'users') {
|
|
510
|
-
throw new Error(
|
|
511
|
-
'Invalid Supabase profile table identifier "users". public.users is reserved for identity conflict detection; use a dedicated profile table such as "profiles".',
|
|
512
|
-
);
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
if (!/^[a-z_][a-z0-9_]*$/.test(trimmed)) {
|
|
516
|
-
throw new Error(
|
|
517
|
-
`Invalid Supabase profile table identifier "${trimmed}". Use snake_case letters, numbers, and underscores.`,
|
|
518
|
-
);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
return trimmed;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
function escapeSqlLiteral(value: string): string {
|
|
525
|
-
return value.replaceAll("'", "''");
|
|
526
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { InfraManifest } from '@ankhorage/contracts';
|
|
2
|
-
import { expect, test } from 'bun:test';
|
|
3
|
-
|
|
4
|
-
import { generateInfrastructure } from '../../../../index';
|
|
5
|
-
import { createAppManifest } from '../../../../testSupport';
|
|
6
|
-
|
|
7
|
-
test('keeps multiple provider redirect assignments as separate shell arguments', () => {
|
|
8
|
-
const manifest: InfraManifest = {
|
|
9
|
-
deployment: { target: 'minikube', monitoring: false },
|
|
10
|
-
auth: {
|
|
11
|
-
scope: 'global',
|
|
12
|
-
provider: 'supabase',
|
|
13
|
-
oauth: {
|
|
14
|
-
enabled: true,
|
|
15
|
-
callbackRoute: '/auth/callback',
|
|
16
|
-
providers: [
|
|
17
|
-
{ id: 'google', enabled: true, credentialsRef: 'auth/oauth/google' },
|
|
18
|
-
{ id: 'apple', enabled: true, credentialsRef: 'auth/oauth/apple' },
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
database: { provider: 'supabase', tier: 'dev' },
|
|
23
|
-
secretStore: { provider: 'supabase-vault' },
|
|
24
|
-
modules: [],
|
|
25
|
-
};
|
|
26
|
-
const result = generateInfrastructure(manifest, {
|
|
27
|
-
appManifest: createAppManifest('multi-oauth'),
|
|
28
|
-
});
|
|
29
|
-
const upScript = result.files.find(
|
|
30
|
-
(file) => file.path === 'infra/minikube/scripts/up.sh',
|
|
31
|
-
)?.content;
|
|
32
|
-
|
|
33
|
-
expect(upScript).toContain('GOTRUE_EXTERNAL_GOOGLE_REDIRECT_URI="${oauth_provider_callback}"');
|
|
34
|
-
expect(upScript).toContain('GOTRUE_EXTERNAL_APPLE_REDIRECT_URI="${oauth_provider_callback}"');
|
|
35
|
-
expect(upScript).not.toContain('\\ GOTRUE_EXTERNAL_APPLE_REDIRECT_URI');
|
|
36
|
-
});
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type { InfraManifest } from '@ankhorage/contracts';
|
|
2
|
-
import { describe, expect, test } from 'bun:test';
|
|
3
|
-
|
|
4
|
-
import { createAppManifest } from '../../../testSupport';
|
|
5
|
-
import { generateTargetAwareSupabaseOAuthRuntimeArtifacts } from './targetAwareOAuthRuntime';
|
|
6
|
-
|
|
7
|
-
describe('target-aware Supabase OAuth runtime', () => {
|
|
8
|
-
test('removes the legacy native redirect environment source', () => {
|
|
9
|
-
const artifacts = generateTargetAwareSupabaseOAuthRuntimeArtifacts({
|
|
10
|
-
appManifest: undefined,
|
|
11
|
-
manifest: createOAuthManifest(),
|
|
12
|
-
});
|
|
13
|
-
const [lifecycle] = artifacts.providerLifecycle;
|
|
14
|
-
const command = lifecycle?.reconciliationCommands[0]?.command ?? '';
|
|
15
|
-
|
|
16
|
-
expect(command).toContain('http://127.0.0.1:*/auth/callback');
|
|
17
|
-
expect(command).toContain('http://localhost:*/auth/callback');
|
|
18
|
-
expect(command).not.toContain('OAUTH_NATIVE_REDIRECT_URLS');
|
|
19
|
-
expect(artifacts.warnings).toEqual([
|
|
20
|
-
'OAuth deploy.targets is missing; Infra keeps Web-local redirects only until canonical targets are persisted.',
|
|
21
|
-
]);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test('emits only the enabled native callback for a native-only app', () => {
|
|
25
|
-
const appManifest = {
|
|
26
|
-
...createAppManifest('native-oauth'),
|
|
27
|
-
deploy: {
|
|
28
|
-
targets: {
|
|
29
|
-
web: { enabled: false },
|
|
30
|
-
android: {
|
|
31
|
-
enabled: true,
|
|
32
|
-
package: 'com.ankh.native',
|
|
33
|
-
scheme: 'ankh-native',
|
|
34
|
-
},
|
|
35
|
-
ios: {
|
|
36
|
-
enabled: false,
|
|
37
|
-
bundleIdentifier: 'com.ankh.native',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
const artifacts = generateTargetAwareSupabaseOAuthRuntimeArtifacts({
|
|
43
|
-
appManifest,
|
|
44
|
-
manifest: createOAuthManifest(),
|
|
45
|
-
});
|
|
46
|
-
const [lifecycle] = artifacts.providerLifecycle;
|
|
47
|
-
const command = lifecycle?.reconciliationCommands[0]?.command ?? '';
|
|
48
|
-
const status = lifecycle?.statusChecks[0]?.command ?? '';
|
|
49
|
-
|
|
50
|
-
expect(command).toContain("oauth_redirect_allow_list='ankh-native://auth/callback'");
|
|
51
|
-
expect(command).not.toContain('oauth_site_url');
|
|
52
|
-
expect(command).not.toContain('localhost:*');
|
|
53
|
-
expect(command).not.toContain('127.0.0.1:*');
|
|
54
|
-
expect(command).not.toContain('OAUTH_NATIVE_REDIRECT_URLS');
|
|
55
|
-
expect(status).toContain('app-callback: disabled (web target)');
|
|
56
|
-
expect(status).toContain('native-callbacks: ankh-native://auth/callback');
|
|
57
|
-
expect(artifacts.warnings).toEqual([]);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
function createOAuthManifest(): InfraManifest {
|
|
62
|
-
return {
|
|
63
|
-
deployment: { target: 'minikube', monitoring: false },
|
|
64
|
-
auth: {
|
|
65
|
-
scope: 'global',
|
|
66
|
-
provider: 'supabase',
|
|
67
|
-
oauth: {
|
|
68
|
-
enabled: true,
|
|
69
|
-
callbackRoute: '/auth/callback',
|
|
70
|
-
providers: [
|
|
71
|
-
{
|
|
72
|
-
id: 'google',
|
|
73
|
-
enabled: true,
|
|
74
|
-
credentialsRef: 'auth/oauth/google',
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
database: { provider: 'supabase', tier: 'dev' },
|
|
80
|
-
secretStore: { provider: 'supabase-vault' },
|
|
81
|
-
modules: [],
|
|
82
|
-
};
|
|
83
|
-
}
|