@wildo-ai/platform-config-lib 1.0.1 → 1.1.1
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/LICENSE +34 -0
- package/dist/esm/.builder.pid +9 -0
- package/dist/esm/_unimplemented/index.d.ts +3 -0
- package/dist/esm/_unimplemented/index.d.ts.map +1 -0
- package/dist/esm/_unimplemented/index.js +3 -0
- package/dist/esm/_unimplemented/index.js.map +1 -0
- package/dist/esm/_unimplemented/soft-warn.d.ts +124 -0
- package/dist/esm/_unimplemented/soft-warn.d.ts.map +1 -0
- package/dist/esm/_unimplemented/soft-warn.js +170 -0
- package/dist/esm/_unimplemented/soft-warn.js.map +1 -0
- package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts +137 -0
- package/dist/esm/_unimplemented/unimplemented-field-warning.d.ts.map +1 -0
- package/dist/esm/_unimplemented/unimplemented-field-warning.js +153 -0
- package/dist/esm/_unimplemented/unimplemented-field-warning.js.map +1 -0
- package/dist/esm/bootstrap/application-backend-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/application-backend-env.contracts.js +1 -1
- package/dist/esm/bootstrap/application-backend-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/application-creation-verification-env.contracts.d.ts +13 -0
- package/dist/esm/bootstrap/application-creation-verification-env.contracts.d.ts.map +1 -0
- package/dist/esm/bootstrap/application-creation-verification-env.contracts.js +14 -0
- package/dist/esm/bootstrap/application-creation-verification-env.contracts.js.map +1 -0
- package/dist/esm/bootstrap/bootstrap-planner.d.ts +1 -1
- package/dist/esm/bootstrap/bootstrap-planner.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap-planner.js +1 -1
- package/dist/esm/bootstrap/bootstrap-planner.js.map +1 -1
- package/dist/esm/bootstrap/bootstrap.contracts.d.ts +141 -37
- package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.contracts.js +104 -18
- package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts +430 -421
- package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
- package/dist/esm/bootstrap/bootstrap.schemas.js +383 -21
- package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +213 -8
- package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js +230 -5
- package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
- package/dist/esm/bootstrap/runtime-backing-service-access.d.ts +79 -0
- package/dist/esm/bootstrap/runtime-backing-service-access.d.ts.map +1 -0
- package/dist/esm/bootstrap/runtime-backing-service-access.js +83 -0
- package/dist/esm/bootstrap/runtime-backing-service-access.js.map +1 -0
- package/dist/esm/bootstrap/runtime-network-policy.d.ts +63 -0
- package/dist/esm/bootstrap/runtime-network-policy.d.ts.map +1 -0
- package/dist/esm/bootstrap/runtime-network-policy.js +104 -0
- package/dist/esm/bootstrap/runtime-network-policy.js.map +1 -0
- package/dist/esm/bootstrap/runtime-network-topology.d.ts +78 -0
- package/dist/esm/bootstrap/runtime-network-topology.d.ts.map +1 -0
- package/dist/esm/bootstrap/runtime-network-topology.js +134 -0
- package/dist/esm/bootstrap/runtime-network-topology.js.map +1 -0
- package/dist/esm/bootstrap/runtime-platform-access.d.ts +67 -0
- package/dist/esm/bootstrap/runtime-platform-access.d.ts.map +1 -0
- package/dist/esm/bootstrap/runtime-platform-access.js +57 -0
- package/dist/esm/bootstrap/runtime-platform-access.js.map +1 -0
- package/dist/esm/bootstrap/runtime-principal.contracts.d.ts +173 -0
- package/dist/esm/bootstrap/runtime-principal.contracts.d.ts.map +1 -0
- package/dist/esm/bootstrap/runtime-principal.contracts.js +218 -0
- package/dist/esm/bootstrap/runtime-principal.contracts.js.map +1 -0
- package/dist/esm/bootstrap/runtime-topology.contracts.d.ts +112 -1
- package/dist/esm/bootstrap/runtime-topology.contracts.d.ts.map +1 -1
- package/dist/esm/bootstrap/runtime-topology.contracts.js +141 -8
- package/dist/esm/bootstrap/runtime-topology.contracts.js.map +1 -1
- package/dist/esm/config-authoring.entry.d.ts +3 -0
- package/dist/esm/config-authoring.entry.d.ts.map +1 -0
- package/dist/esm/config-authoring.entry.js +5 -0
- package/dist/esm/config-authoring.entry.js.map +1 -0
- package/dist/esm/credentials/credential-generator.service.d.ts.map +1 -1
- package/dist/esm/credentials/credential-generator.service.js +1 -1
- package/dist/esm/credentials/credential-generator.service.js.map +1 -1
- package/dist/esm/index.d.ts +30 -15
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +16 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lockfile/canonical-json.d.ts +41 -0
- package/dist/esm/lockfile/canonical-json.d.ts.map +1 -0
- package/dist/esm/lockfile/canonical-json.js +56 -0
- package/dist/esm/lockfile/canonical-json.js.map +1 -0
- package/dist/esm/lockfile/lockfile-io.d.ts +231 -0
- package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -0
- package/dist/esm/lockfile/lockfile-io.js +303 -0
- package/dist/esm/lockfile/lockfile-io.js.map +1 -0
- package/dist/esm/lockfile/materialize-infra-section.d.ts +99 -0
- package/dist/esm/lockfile/materialize-infra-section.d.ts.map +1 -0
- package/dist/esm/lockfile/materialize-infra-section.js +153 -0
- package/dist/esm/lockfile/materialize-infra-section.js.map +1 -0
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts +522 -0
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.d.ts.map +1 -0
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js +116 -0
- package/dist/esm/lockfile/wildo-saas-lock.shared.schemas.js.map +1 -0
- package/dist/esm/project-config/define-framework-config.d.ts +36 -10
- package/dist/esm/project-config/define-framework-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-framework-config.js +67 -3
- package/dist/esm/project-config/define-framework-config.js.map +1 -1
- package/dist/esm/project-config/define-infra-env-config.d.ts +570 -0
- package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -0
- package/dist/esm/project-config/define-infra-env-config.js +726 -0
- package/dist/esm/project-config/define-infra-env-config.js.map +1 -0
- package/dist/esm/project-config/define-minion-config.d.ts +221 -23
- package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-minion-config.js +228 -11
- package/dist/esm/project-config/define-minion-config.js.map +1 -1
- package/dist/esm/project-config/define-saas-config.d.ts +427 -218
- package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-saas-config.js +704 -75
- package/dist/esm/project-config/define-saas-config.js.map +1 -1
- package/dist/esm/project-config/define-worker-config.d.ts +106 -10
- package/dist/esm/project-config/define-worker-config.d.ts.map +1 -1
- package/dist/esm/project-config/define-worker-config.js +99 -9
- package/dist/esm/project-config/define-worker-config.js.map +1 -1
- package/dist/esm/project-config/index.d.ts +28 -21
- package/dist/esm/project-config/index.d.ts.map +1 -1
- package/dist/esm/project-config/index.js +14 -7
- package/dist/esm/project-config/index.js.map +1 -1
- package/dist/esm/project-config/loader.d.ts +120 -10
- package/dist/esm/project-config/loader.d.ts.map +1 -1
- package/dist/esm/project-config/loader.js +290 -38
- package/dist/esm/project-config/loader.js.map +1 -1
- package/dist/esm/project-config/minion-local-provider-registration.d.ts +69 -0
- package/dist/esm/project-config/minion-local-provider-registration.d.ts.map +1 -0
- package/dist/esm/project-config/minion-local-provider-registration.js +72 -0
- package/dist/esm/project-config/minion-local-provider-registration.js.map +1 -0
- package/dist/esm/project-config/provider-catalog-types.d.ts +12 -0
- package/dist/esm/project-config/provider-catalog-types.d.ts.map +1 -0
- package/dist/esm/project-config/provider-catalog-types.js +49 -0
- package/dist/esm/project-config/provider-catalog-types.js.map +1 -0
- package/dist/esm/project-config/provider-companion-discovery.d.ts +24 -0
- package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -0
- package/dist/esm/project-config/provider-companion-discovery.js +244 -0
- package/dist/esm/project-config/provider-companion-discovery.js.map +1 -0
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts +297 -0
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -0
- package/dist/esm/project-config/provider-runtime-artifacts.js +860 -0
- package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -0
- package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts +18 -0
- package/dist/esm/project-config/shared/application-creation-verification.schemas.d.ts.map +1 -0
- package/dist/esm/project-config/shared/application-creation-verification.schemas.js +25 -0
- package/dist/esm/project-config/shared/application-creation-verification.schemas.js.map +1 -0
- package/dist/esm/project-config/shared/application-modules.schemas.d.ts +10 -2
- package/dist/esm/project-config/shared/application-modules.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/application-modules.schemas.js +12 -1
- package/dist/esm/project-config/shared/application-modules.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/application-modules.utils.d.ts +2 -1
- package/dist/esm/project-config/shared/application-modules.utils.d.ts.map +1 -1
- package/dist/esm/project-config/shared/application-modules.utils.js +6 -1
- package/dist/esm/project-config/shared/application-modules.utils.js.map +1 -1
- package/dist/esm/project-config/shared/auth.schemas.d.ts +102 -0
- package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -0
- package/dist/esm/project-config/shared/auth.schemas.js +100 -0
- package/dist/esm/project-config/shared/auth.schemas.js.map +1 -0
- package/dist/esm/project-config/shared/backing-services.schemas.d.ts +316 -39
- package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/backing-services.schemas.js +359 -24
- package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/cdn.example.d.ts +14 -0
- package/dist/esm/project-config/shared/cdn.example.d.ts.map +1 -0
- package/dist/esm/project-config/shared/cdn.example.js +38 -0
- package/dist/esm/project-config/shared/cdn.example.js.map +1 -0
- package/dist/esm/project-config/shared/cdn.schemas.d.ts +182 -0
- package/dist/esm/project-config/shared/cdn.schemas.d.ts.map +1 -0
- package/dist/esm/project-config/shared/cdn.schemas.js +151 -0
- package/dist/esm/project-config/shared/cdn.schemas.js.map +1 -0
- package/dist/esm/project-config/shared/csp-defaults.d.ts +92 -0
- package/dist/esm/project-config/shared/csp-defaults.d.ts.map +1 -0
- package/dist/esm/project-config/shared/csp-defaults.js +195 -0
- package/dist/esm/project-config/shared/csp-defaults.js.map +1 -0
- package/dist/esm/project-config/shared/csp-emit.d.ts +106 -0
- package/dist/esm/project-config/shared/csp-emit.d.ts.map +1 -0
- package/dist/esm/project-config/shared/csp-emit.js +305 -0
- package/dist/esm/project-config/shared/csp-emit.js.map +1 -0
- package/dist/esm/project-config/shared/csp.schemas.d.ts +266 -0
- package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -0
- package/dist/esm/project-config/shared/csp.schemas.js +281 -0
- package/dist/esm/project-config/shared/csp.schemas.js.map +1 -0
- package/dist/esm/project-config/shared/data-services.schemas.d.ts +45 -9
- package/dist/esm/project-config/shared/data-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/data-services.schemas.js +45 -9
- package/dist/esm/project-config/shared/data-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/env-example-defaults.d.ts +0 -1
- package/dist/esm/project-config/shared/env-example-defaults.d.ts.map +1 -1
- package/dist/esm/project-config/shared/env-example-defaults.js +1 -2
- package/dist/esm/project-config/shared/env-example-defaults.js.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.d.ts +134 -8
- package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/environment.schemas.js +185 -2
- package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +779 -0
- package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -0
- package/dist/esm/project-config/shared/infra-providers.schemas.js +210 -0
- package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -0
- package/dist/esm/project-config/shared/infra-service.schemas.d.ts +18 -0
- package/dist/esm/project-config/shared/infra-service.schemas.d.ts.map +1 -0
- package/dist/esm/project-config/shared/infra-service.schemas.js +16 -0
- package/dist/esm/project-config/shared/infra-service.schemas.js.map +1 -0
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts +83 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js +99 -2
- package/dist/esm/project-config/shared/infrastructure-defaults.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/k8s-utils.d.ts +51 -7
- package/dist/esm/project-config/shared/k8s-utils.d.ts.map +1 -1
- package/dist/esm/project-config/shared/k8s-utils.js +59 -12
- package/dist/esm/project-config/shared/k8s-utils.js.map +1 -1
- package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts +31 -0
- package/dist/esm/project-config/shared/minion-platform-access.vocabulary.d.ts.map +1 -0
- package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js +32 -0
- package/dist/esm/project-config/shared/minion-platform-access.vocabulary.js.map +1 -0
- package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +142 -0
- package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -0
- package/dist/esm/project-config/shared/minion-resource-access.validation.js +159 -0
- package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -0
- package/dist/esm/project-config/shared/object-storage-session-policy.d.ts +100 -0
- package/dist/esm/project-config/shared/object-storage-session-policy.d.ts.map +1 -0
- package/dist/esm/project-config/shared/object-storage-session-policy.js +130 -0
- package/dist/esm/project-config/shared/object-storage-session-policy.js.map +1 -0
- package/dist/esm/project-config/shared/platform-services.schemas.d.ts +9 -14
- package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/platform-services.schemas.js +13 -9
- package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
- package/dist/esm/project-config/shared/schema-version.schemas.d.ts +15 -0
- package/dist/esm/project-config/shared/schema-version.schemas.d.ts.map +1 -0
- package/dist/esm/project-config/shared/schema-version.schemas.js +40 -0
- package/dist/esm/project-config/shared/schema-version.schemas.js.map +1 -0
- package/dist/esm/project-config/shared/service-definitions.schemas.d.ts +283 -8
- package/dist/esm/project-config/shared/service-definitions.schemas.d.ts.map +1 -1
- package/dist/esm/project-config/shared/service-definitions.schemas.js +325 -8
- package/dist/esm/project-config/shared/service-definitions.schemas.js.map +1 -1
- package/dist/esm/registry/artifact-domain.schemas.d.ts +54 -0
- package/dist/esm/registry/artifact-domain.schemas.d.ts.map +1 -0
- package/dist/esm/registry/artifact-domain.schemas.js +40 -0
- package/dist/esm/registry/artifact-domain.schemas.js.map +1 -0
- package/dist/esm/registry/companion-api.schemas.d.ts +176 -0
- package/dist/esm/registry/companion-api.schemas.d.ts.map +1 -0
- package/dist/esm/registry/companion-api.schemas.js +165 -0
- package/dist/esm/registry/companion-api.schemas.js.map +1 -0
- package/dist/esm/registry/digest.schemas.d.ts +20 -0
- package/dist/esm/registry/digest.schemas.d.ts.map +1 -0
- package/dist/esm/registry/digest.schemas.js +21 -0
- package/dist/esm/registry/digest.schemas.js.map +1 -0
- package/dist/esm/registry/index.d.ts +33 -0
- package/dist/esm/registry/index.d.ts.map +1 -0
- package/dist/esm/registry/index.js +33 -0
- package/dist/esm/registry/index.js.map +1 -0
- package/dist/esm/registry/lockfile-modules-section.schemas.d.ts +107 -0
- package/dist/esm/registry/lockfile-modules-section.schemas.d.ts.map +1 -0
- package/dist/esm/registry/lockfile-modules-section.schemas.js +67 -0
- package/dist/esm/registry/lockfile-modules-section.schemas.js.map +1 -0
- package/dist/esm/registry/module-artifact.schemas.d.ts +94 -0
- package/dist/esm/registry/module-artifact.schemas.d.ts.map +1 -0
- package/dist/esm/registry/module-artifact.schemas.js +69 -0
- package/dist/esm/registry/module-artifact.schemas.js.map +1 -0
- package/dist/esm/registry/module-manifest.schemas.d.ts +134 -0
- package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -0
- package/dist/esm/registry/module-manifest.schemas.js +155 -0
- package/dist/esm/registry/module-manifest.schemas.js.map +1 -0
- package/dist/esm/registry/registry-config.schemas.d.ts +31 -0
- package/dist/esm/registry/registry-config.schemas.d.ts.map +1 -0
- package/dist/esm/registry/registry-config.schemas.js +24 -0
- package/dist/esm/registry/registry-config.schemas.js.map +1 -0
- package/dist/esm/registry/registry-defaults.constants.d.ts +37 -0
- package/dist/esm/registry/registry-defaults.constants.d.ts.map +1 -0
- package/dist/esm/registry/registry-defaults.constants.js +37 -0
- package/dist/esm/registry/registry-defaults.constants.js.map +1 -0
- package/dist/esm/registry/registry-errors.d.ts +109 -0
- package/dist/esm/registry/registry-errors.d.ts.map +1 -0
- package/dist/esm/registry/registry-errors.js +185 -0
- package/dist/esm/registry/registry-errors.js.map +1 -0
- package/dist/esm/registry/registry-section-schemas.constants.d.ts +39 -0
- package/dist/esm/registry/registry-section-schemas.constants.d.ts.map +1 -0
- package/dist/esm/registry/registry-section-schemas.constants.js +22 -0
- package/dist/esm/registry/registry-section-schemas.constants.js.map +1 -0
- package/dist/esm/release/framework-release.constants.d.ts +26 -1
- package/dist/esm/release/framework-release.constants.d.ts.map +1 -1
- package/dist/esm/release/framework-release.constants.js +27 -2
- package/dist/esm/release/framework-release.constants.js.map +1 -1
- package/dist/esm/schemas/framework-info.schemas.d.ts +1 -1
- package/dist/esm/schemas/framework-info.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/framework-info.schemas.js +1 -1
- package/dist/esm/schemas/framework-info.schemas.js.map +1 -1
- package/dist/esm/schemas/framework-secrets.schemas.d.ts +5 -5
- package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/framework-secrets.schemas.js +1 -1
- package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
- package/dist/esm/schemas/platform-application-config.schemas.d.ts +1 -1
- package/dist/esm/schemas/platform-application-config.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/platform-application-config.schemas.js +11 -2
- package/dist/esm/schemas/platform-application-config.schemas.js.map +1 -1
- package/dist/esm/schemas/platform-application-secrets.schemas.d.ts +7 -7
- package/dist/esm/schemas/platform-application-secrets.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/platform-application-secrets.schemas.js +17 -2
- package/dist/esm/schemas/platform-application-secrets.schemas.js.map +1 -1
- package/dist/esm/schemas/platform-config.schemas.d.ts +12 -13
- package/dist/esm/schemas/platform-config.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/platform-config.schemas.js +15 -3
- package/dist/esm/schemas/platform-config.schemas.js.map +1 -1
- package/dist/esm/workspace-scope/application-subject-manifest.d.ts +26 -0
- package/dist/esm/workspace-scope/application-subject-manifest.d.ts.map +1 -0
- package/dist/esm/workspace-scope/application-subject-manifest.js +43 -0
- package/dist/esm/workspace-scope/application-subject-manifest.js.map +1 -0
- package/dist/esm/workspace-scope/index.d.ts +5 -2
- package/dist/esm/workspace-scope/index.d.ts.map +1 -1
- package/dist/esm/workspace-scope/index.js +4 -1
- package/dist/esm/workspace-scope/index.js.map +1 -1
- package/dist/esm/workspace-scope/resolve-homes.d.ts +20 -0
- package/dist/esm/workspace-scope/resolve-homes.d.ts.map +1 -0
- package/dist/esm/workspace-scope/resolve-homes.js +62 -0
- package/dist/esm/workspace-scope/resolve-homes.js.map +1 -0
- package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts +211 -0
- package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -0
- package/dist/esm/workspace-scope/workspace-homes.schemas.js +113 -0
- package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -0
- package/dist/esm/workspace-scope/workspace-scope-detector.d.ts +10 -5
- package/dist/esm/workspace-scope/workspace-scope-detector.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope-detector.js +22 -36
- package/dist/esm/workspace-scope/workspace-scope-detector.js.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts +147 -58
- package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
- package/dist/esm/workspace-scope/workspace-scope.schemas.js +174 -78
- package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +31 -17
- package/dist/esm/credentials/credentials-provisioner.service.d.ts +0 -190
- package/dist/esm/credentials/credentials-provisioner.service.d.ts.map +0 -1
- package/dist/esm/credentials/credentials-provisioner.service.js +0 -278
- package/dist/esm/credentials/credentials-provisioner.service.js.map +0 -1
- package/dist/esm/infra-managers/infra-manager.models.d.ts +0 -146
- package/dist/esm/infra-managers/infra-manager.models.d.ts.map +0 -1
- package/dist/esm/infra-managers/infra-manager.models.js +0 -2
- package/dist/esm/infra-managers/infra-manager.models.js.map +0 -1
- package/dist/esm/infra-managers/mongo-atlas-manager.service.d.ts +0 -64
- package/dist/esm/infra-managers/mongo-atlas-manager.service.d.ts.map +0 -1
- package/dist/esm/infra-managers/mongo-atlas-manager.service.js +0 -307
- package/dist/esm/infra-managers/mongo-atlas-manager.service.js.map +0 -1
- package/dist/esm/infra-managers/postgresql-manager.service.d.ts +0 -115
- package/dist/esm/infra-managers/postgresql-manager.service.d.ts.map +0 -1
- package/dist/esm/infra-managers/postgresql-manager.service.js +0 -403
- package/dist/esm/infra-managers/postgresql-manager.service.js.map +0 -1
- package/dist/esm/infra-managers/rabbitmq-manager.service.d.ts +0 -64
- package/dist/esm/infra-managers/rabbitmq-manager.service.d.ts.map +0 -1
- package/dist/esm/infra-managers/rabbitmq-manager.service.js +0 -288
- package/dist/esm/infra-managers/rabbitmq-manager.service.js.map +0 -1
- package/dist/esm/infra-managers/redis-manager.service.d.ts +0 -78
- package/dist/esm/infra-managers/redis-manager.service.d.ts.map +0 -1
- package/dist/esm/infra-managers/redis-manager.service.js +0 -326
- package/dist/esm/infra-managers/redis-manager.service.js.map +0 -1
- package/dist/esm/project-config/define-infra-config.d.ts +0 -128
- package/dist/esm/project-config/define-infra-config.d.ts.map +0 -1
- package/dist/esm/project-config/define-infra-config.js +0 -87
- package/dist/esm/project-config/define-infra-config.js.map +0 -1
- package/dist/esm/project-config/define-platform-config.d.ts +0 -65
- package/dist/esm/project-config/define-platform-config.d.ts.map +0 -1
- package/dist/esm/project-config/define-platform-config.js +0 -22
- package/dist/esm/project-config/define-platform-config.js.map +0 -1
- package/dist/esm/project-config/define-platform-env-config.d.ts +0 -41
- package/dist/esm/project-config/define-platform-env-config.d.ts.map +0 -1
- package/dist/esm/project-config/define-platform-env-config.js +0 -45
- package/dist/esm/project-config/define-platform-env-config.js.map +0 -1
- package/dist/esm/project-config/define-project-config.d.ts +0 -38
- package/dist/esm/project-config/define-project-config.d.ts.map +0 -1
- package/dist/esm/project-config/define-project-config.js +0 -57
- package/dist/esm/project-config/define-project-config.js.map +0 -1
- package/dist/esm/project-config/define-sharing-policy.d.ts +0 -35
- package/dist/esm/project-config/define-sharing-policy.d.ts.map +0 -1
- package/dist/esm/project-config/define-sharing-policy.js +0 -30
- package/dist/esm/project-config/define-sharing-policy.js.map +0 -1
- package/dist/esm/project-config/sharing-policy-validation.d.ts +0 -40
- package/dist/esm/project-config/sharing-policy-validation.d.ts.map +0 -1
- package/dist/esm/project-config/sharing-policy-validation.js +0 -143
- package/dist/esm/project-config/sharing-policy-validation.js.map +0 -1
- package/dist/esm/runtime-bridge/platform-runtime-bridge.contracts.d.ts +0 -23
- package/dist/esm/runtime-bridge/platform-runtime-bridge.contracts.d.ts.map +0 -1
- package/dist/esm/runtime-bridge/platform-runtime-bridge.contracts.js +0 -13
- package/dist/esm/runtime-bridge/platform-runtime-bridge.contracts.js.map +0 -1
- package/src/bootstrap/application-backend-env.contracts.ts +0 -17
- package/src/bootstrap/bootstrap-planner.ts +0 -46
- package/src/bootstrap/bootstrap.contracts.ts +0 -251
- package/src/bootstrap/bootstrap.schemas.ts +0 -164
- package/src/bootstrap/platform-runtime-env.contracts.ts +0 -99
- package/src/bootstrap/runtime-topology.contracts.ts +0 -102
- package/src/credentials/credential-generator.service.ts +0 -39
- package/src/index.ts +0 -16
- package/src/project-config/__tests__/application-modules.utils.test.ts +0 -53
- package/src/project-config/__tests__/define-framework-config.test.ts +0 -43
- package/src/project-config/__tests__/define-saas-config.test.ts +0 -210
- package/src/project-config/__tests__/loader.test.ts +0 -100
- package/src/project-config/define-framework-config.ts +0 -44
- package/src/project-config/define-infra-config.ts +0 -168
- package/src/project-config/define-minion-config.ts +0 -27
- package/src/project-config/define-platform-config.ts +0 -28
- package/src/project-config/define-platform-env-config.ts +0 -59
- package/src/project-config/define-project-config.ts +0 -63
- package/src/project-config/define-saas-config.ts +0 -171
- package/src/project-config/define-sharing-policy.ts +0 -36
- package/src/project-config/define-worker-config.ts +0 -27
- package/src/project-config/index.ts +0 -23
- package/src/project-config/loader.ts +0 -220
- package/src/project-config/shared/application-modules.schemas.ts +0 -12
- package/src/project-config/shared/application-modules.utils.ts +0 -65
- package/src/project-config/shared/backing-services.schemas.ts +0 -59
- package/src/project-config/shared/data-services.schemas.ts +0 -58
- package/src/project-config/shared/env-example-defaults.ts +0 -50
- package/src/project-config/shared/environment.schemas.ts +0 -136
- package/src/project-config/shared/infrastructure-defaults.schemas.ts +0 -47
- package/src/project-config/shared/k8s-utils.ts +0 -56
- package/src/project-config/shared/platform-services.schemas.ts +0 -33
- package/src/project-config/shared/service-definitions.schemas.ts +0 -38
- package/src/project-config/sharing-policy-validation.ts +0 -159
- package/src/release/framework-release.constants.ts +0 -2
- package/src/schemas/__tests__/platform-config.schemas.test.ts +0 -90
- package/src/schemas/framework-info.schemas.ts +0 -13
- package/src/schemas/framework-secrets.schemas.ts +0 -19
- package/src/schemas/platform-application-config.schemas.ts +0 -25
- package/src/schemas/platform-application-secrets.schemas.ts +0 -78
- package/src/schemas/platform-config.schemas.ts +0 -45
- package/src/workspace-scope/index.ts +0 -2
- package/src/workspace-scope/workspace-scope-detector.ts +0 -98
- package/src/workspace-scope/workspace-scope.schemas.ts +0 -224
|
@@ -14,9 +14,36 @@ export declare function buildK8sInternalUrl(service: string, port: number, names
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function buildK8sInternalHost(service: string, namespace: string): string;
|
|
16
16
|
/**
|
|
17
|
-
* Builds an ingress-based public URL: `https://<service>.<
|
|
17
|
+
* Builds an ingress-based public URL: `https://<service>.<publicDomain>`
|
|
18
|
+
*
|
|
19
|
+
* `publicDomain` is the runtime-agnostic external hostname (browsers /
|
|
20
|
+
* reverse proxy / DNS terminate here). See `WildoInfraEnvConfig.publicDomain`.
|
|
21
|
+
*
|
|
22
|
+
* Used for PLATFORM services (apps-manager, module-registry, …) whose
|
|
23
|
+
* subdomain is always the service name. Application services (frontends +
|
|
24
|
+
* backend API) resolve their public host through {@link buildServicePublicHost}
|
|
25
|
+
* so the operator's authored `serviceHosts` map wins.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildK8sPublicUrl(service: string, publicDomain: string): string;
|
|
28
|
+
export interface ServicePublicHostParams {
|
|
29
|
+
/** The application service key (`config.services.<key>` / `serviceHosts` key). */
|
|
30
|
+
serviceKey: string;
|
|
31
|
+
/** Authored per-service subdomain map from `wildo.infra.<env>.config.ts`. */
|
|
32
|
+
serviceHosts: Record<string, string> | undefined;
|
|
33
|
+
/** The operator's public domain (`WildoInfraEnvConfig.publicDomain`). */
|
|
34
|
+
publicDomain: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Resolve an application service's PUBLIC hostname (no scheme). `serviceHosts`
|
|
38
|
+
* wins; the service key is its own subdomain when unauthored; `''` = apex.
|
|
39
|
+
* See the section header.
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildServicePublicHost(params: ServicePublicHostParams): string;
|
|
42
|
+
/**
|
|
43
|
+
* Resolve an application service's PUBLIC URL (`https://<host>`), where the
|
|
44
|
+
* host comes from {@link buildServicePublicHost}.
|
|
18
45
|
*/
|
|
19
|
-
export declare function
|
|
46
|
+
export declare function buildServicePublicUrl(params: ServicePublicHostParams): string;
|
|
20
47
|
/**
|
|
21
48
|
* K8s Secret name for a platform service: `<service>-secret`
|
|
22
49
|
*/
|
|
@@ -26,11 +53,28 @@ export declare function k8sServiceSecretName(service: string): string;
|
|
|
26
53
|
*/
|
|
27
54
|
export declare function k8sServiceConfigMapName(service: string): string;
|
|
28
55
|
/**
|
|
29
|
-
* K8s Secret name for an app backend:
|
|
56
|
+
* K8s Secret name for an app backend: `<serviceName>-secret`
|
|
57
|
+
*
|
|
58
|
+
* The emitted name MUST match the `envFrom: secretRef.name` the application
|
|
59
|
+
* deployment template mounts. The CLI static emit lane
|
|
60
|
+
* (`k8s-secrets-generator.service.ts` § 5) calls this helper with the app's
|
|
61
|
+
* backend `serviceName`.
|
|
62
|
+
*
|
|
63
|
+
* ⚠️ KNOWN GAP — the K8s app lane is not yet runtime-verified (no live cluster
|
|
64
|
+
* run). `wildo-ai-application/deployment.yaml.hbs` hardcodes the mount name
|
|
65
|
+
* `wildo-ai-application-secret` (and the image `wildo-ai-application:{{imageTag}}`),
|
|
66
|
+
* i.e. the manifests assume one canonical app identity, while this helper is
|
|
67
|
+
* called with the app's REAL backend `serviceName` (e.g.
|
|
68
|
+
* `wonder-todos-backend-api`). The two only line up when the backend is literally
|
|
69
|
+
* named `wildo-ai-application`. The mount is fail-closed (no `optional: true`),
|
|
70
|
+
* so a mismatch means the pod cannot boot. Resolve by either parameterizing the
|
|
71
|
+
* template's secret name or pinning the emit to the canonical app identity —
|
|
72
|
+
* see `.claude/plans/self-host-domain-subdomain-model.md`.
|
|
73
|
+
*
|
|
74
|
+
* Application backends emit a single Secret per app (no companion ConfigMap):
|
|
75
|
+
* envFrom mounts every entry as `process.env.*`, so splitting sensitive vs
|
|
76
|
+
* non-sensitive added zero runtime value and fragmented the canonical sink.
|
|
77
|
+
* See `k8s-secrets-generator.service.ts` § 5 for the design note.
|
|
30
78
|
*/
|
|
31
79
|
export declare function k8sAppBackendSecretName(serviceName: string): string;
|
|
32
|
-
/**
|
|
33
|
-
* K8s ConfigMap name for an app backend: `app-<serviceName>-config`
|
|
34
|
-
*/
|
|
35
|
-
export declare function k8sAppBackendConfigMapName(serviceName: string): string;
|
|
36
80
|
//# sourceMappingURL=k8s-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"k8s-utils.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"k8s-utils.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/k8s-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5F;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE/E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAE/E;AAuBD,MAAM,WAAW,uBAAuB;IACtC,kFAAkF;IAClF,UAAU,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IACjD,yEAAyE;IACzE,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM,CAW9E;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM,CAE7E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEnE"}
|
|
@@ -18,10 +18,42 @@ export function buildK8sInternalHost(service, namespace) {
|
|
|
18
18
|
return `${service}.${namespace}.svc.cluster.local`;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Builds an ingress-based public URL: `https://<service>.<
|
|
21
|
+
* Builds an ingress-based public URL: `https://<service>.<publicDomain>`
|
|
22
|
+
*
|
|
23
|
+
* `publicDomain` is the runtime-agnostic external hostname (browsers /
|
|
24
|
+
* reverse proxy / DNS terminate here). See `WildoInfraEnvConfig.publicDomain`.
|
|
25
|
+
*
|
|
26
|
+
* Used for PLATFORM services (apps-manager, module-registry, …) whose
|
|
27
|
+
* subdomain is always the service name. Application services (frontends +
|
|
28
|
+
* backend API) resolve their public host through {@link buildServicePublicHost}
|
|
29
|
+
* so the operator's authored `serviceHosts` map wins.
|
|
30
|
+
*/
|
|
31
|
+
export function buildK8sPublicUrl(service, publicDomain) {
|
|
32
|
+
return `https://${service}.${publicDomain}`;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Resolve an application service's PUBLIC hostname (no scheme). `serviceHosts`
|
|
36
|
+
* wins; the service key is its own subdomain when unauthored; `''` = apex.
|
|
37
|
+
* See the section header.
|
|
38
|
+
*/
|
|
39
|
+
export function buildServicePublicHost(params) {
|
|
40
|
+
const { serviceKey, serviceHosts, publicDomain } = params;
|
|
41
|
+
// Fallback uses the service key AS the subdomain, lowercased: DNS labels are
|
|
42
|
+
// case-insensitive and Let's Encrypt / `new URL()` canonicalize to lowercase,
|
|
43
|
+
// so a camelCase key like `backendApi` must become `backendapi` to round-trip
|
|
44
|
+
// (and to match the ingress host). Authored serviceHosts values are already
|
|
45
|
+
// lowercase-validated upstream (`SERVICE_HOST_LABEL`). NOTE: a config key with
|
|
46
|
+
// a DNS-invalid char (e.g. `_`) still yields an invalid host — the operator
|
|
47
|
+
// must author a `serviceHosts` entry for it.
|
|
48
|
+
const host = serviceHosts?.[serviceKey] ?? serviceKey.toLowerCase();
|
|
49
|
+
return host === '' ? publicDomain : `${host}.${publicDomain}`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Resolve an application service's PUBLIC URL (`https://<host>`), where the
|
|
53
|
+
* host comes from {@link buildServicePublicHost}.
|
|
22
54
|
*/
|
|
23
|
-
export function
|
|
24
|
-
return `https://${
|
|
55
|
+
export function buildServicePublicUrl(params) {
|
|
56
|
+
return `https://${buildServicePublicHost(params)}`;
|
|
25
57
|
}
|
|
26
58
|
/**
|
|
27
59
|
* K8s Secret name for a platform service: `<service>-secret`
|
|
@@ -36,15 +68,30 @@ export function k8sServiceConfigMapName(service) {
|
|
|
36
68
|
return `${service}-config`;
|
|
37
69
|
}
|
|
38
70
|
/**
|
|
39
|
-
* K8s Secret name for an app backend:
|
|
71
|
+
* K8s Secret name for an app backend: `<serviceName>-secret`
|
|
72
|
+
*
|
|
73
|
+
* The emitted name MUST match the `envFrom: secretRef.name` the application
|
|
74
|
+
* deployment template mounts. The CLI static emit lane
|
|
75
|
+
* (`k8s-secrets-generator.service.ts` § 5) calls this helper with the app's
|
|
76
|
+
* backend `serviceName`.
|
|
77
|
+
*
|
|
78
|
+
* ⚠️ KNOWN GAP — the K8s app lane is not yet runtime-verified (no live cluster
|
|
79
|
+
* run). `wildo-ai-application/deployment.yaml.hbs` hardcodes the mount name
|
|
80
|
+
* `wildo-ai-application-secret` (and the image `wildo-ai-application:{{imageTag}}`),
|
|
81
|
+
* i.e. the manifests assume one canonical app identity, while this helper is
|
|
82
|
+
* called with the app's REAL backend `serviceName` (e.g.
|
|
83
|
+
* `wonder-todos-backend-api`). The two only line up when the backend is literally
|
|
84
|
+
* named `wildo-ai-application`. The mount is fail-closed (no `optional: true`),
|
|
85
|
+
* so a mismatch means the pod cannot boot. Resolve by either parameterizing the
|
|
86
|
+
* template's secret name or pinning the emit to the canonical app identity —
|
|
87
|
+
* see `.claude/plans/self-host-domain-subdomain-model.md`.
|
|
88
|
+
*
|
|
89
|
+
* Application backends emit a single Secret per app (no companion ConfigMap):
|
|
90
|
+
* envFrom mounts every entry as `process.env.*`, so splitting sensitive vs
|
|
91
|
+
* non-sensitive added zero runtime value and fragmented the canonical sink.
|
|
92
|
+
* See `k8s-secrets-generator.service.ts` § 5 for the design note.
|
|
40
93
|
*/
|
|
41
94
|
export function k8sAppBackendSecretName(serviceName) {
|
|
42
|
-
return
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* K8s ConfigMap name for an app backend: `app-<serviceName>-config`
|
|
46
|
-
*/
|
|
47
|
-
export function k8sAppBackendConfigMapName(serviceName) {
|
|
48
|
-
return `app-${serviceName}-config`;
|
|
95
|
+
return `${serviceName}-secret`;
|
|
49
96
|
}
|
|
50
|
-
//# sourceMappingURL=k8s-utils.js.map
|
|
97
|
+
//# sourceMappingURL=k8s-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"k8s-utils.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"k8s-utils.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/k8s-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,IAAY,EAAE,SAAiB;IAClF,OAAO,UAAU,OAAO,IAAI,SAAS,sBAAsB,IAAI,EAAE,CAAC;AACpE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,SAAiB;IACrE,OAAO,GAAG,OAAO,IAAI,SAAS,oBAAoB,CAAC;AACrD,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe,EAAE,YAAoB;IACrE,OAAO,WAAW,OAAO,IAAI,YAAY,EAAE,CAAC;AAC9C,CAAC;AAgCD;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAA+B;IACpE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IAC1D,6EAA6E;IAC7E,8EAA8E;IAC9E,8EAA8E;IAC9E,4EAA4E;IAC5E,+EAA+E;IAC/E,4EAA4E;IAC5E,6CAA6C;IAC7C,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC;IACpE,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,YAAY,EAAE,CAAC;AAChE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAA+B;IACnE,OAAO,WAAW,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,OAAO,GAAG,OAAO,SAAS,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAe;IACrD,OAAO,GAAG,OAAO,SAAS,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,uBAAuB,CAAC,WAAmB;IACzD,OAAO,GAAG,WAAW,SAAS,CAAC;AACjC,CAAC","sourcesContent":["/**\n * Kubernetes URL builders and naming conventions.\n * Single source of truth for constructing K8s-style addresses and resource names.\n *\n * Used by CLI (ServiceAddressResolver, K8s manifest gen) and apps-manager\n * (application lifecycle) to ensure consistent URL/naming patterns.\n */\n\n/**\n * Builds a K8s cluster-internal URL: `http://<service>.<namespace>.svc.cluster.local:<port>`\n */\nexport function buildK8sInternalUrl(service: string, port: number, namespace: string): string {\n return `http://${service}.${namespace}.svc.cluster.local:${port}`;\n}\n\n/**\n * Builds a K8s cluster-internal hostname (without scheme/port).\n */\nexport function buildK8sInternalHost(service: string, namespace: string): string {\n return `${service}.${namespace}.svc.cluster.local`;\n}\n\n/**\n * Builds an ingress-based public URL: `https://<service>.<publicDomain>`\n *\n * `publicDomain` is the runtime-agnostic external hostname (browsers /\n * reverse proxy / DNS terminate here). See `WildoInfraEnvConfig.publicDomain`.\n *\n * Used for PLATFORM services (apps-manager, module-registry, …) whose\n * subdomain is always the service name. Application services (frontends +\n * backend API) resolve their public host through {@link buildServicePublicHost}\n * so the operator's authored `serviceHosts` map wins.\n */\nexport function buildK8sPublicUrl(service: string, publicDomain: string): string {\n return `https://${service}.${publicDomain}`;\n}\n\n// ============================================================================\n// Application public-host resolution (serviceHosts-driven)\n// ============================================================================\n//\n// Single source of truth for an application service's PUBLIC hostname, shared\n// by every producer so ingress routing, `runtime.endPoints[*].publicUrl`, and\n// CORS never diverge (a divergence breaks the browser's next `fetch` on CORS —\n// see `.claude/plans/self-host-domain-subdomain-model.md`).\n//\n// The self-hosted, single-app, mono-env model: each service lives at a\n// subdomain of the operator's own `publicDomain`. Greenfield — there is NO\n// multi-tenant `{service}-{appSlug}-{env}` fan-out.\n//\n// - `serviceHosts[serviceKey]` authored → `<host>.<publicDomain>`\n// (`app` → `app.example.com`), or `<publicDomain>` when the authored value\n// is the empty string (apex — `''` → `example.com`).\n// - key NOT authored → `<serviceKey>.<publicDomain>`: the service key IS its\n// own subdomain, the same convention platform services use via\n// {@link buildK8sPublicUrl}. A DEFINED fallback (never a silent error — the\n// `serviceHosts` schema requires consumers handle \"not mapped\" explicitly).\n\nexport interface ServicePublicHostParams {\n /** The application service key (`config.services.<key>` / `serviceHosts` key). */\n serviceKey: string;\n /** Authored per-service subdomain map from `wildo.infra.<env>.config.ts`. */\n serviceHosts: Record<string, string> | undefined;\n /** The operator's public domain (`WildoInfraEnvConfig.publicDomain`). */\n publicDomain: string;\n}\n\n/**\n * Resolve an application service's PUBLIC hostname (no scheme). `serviceHosts`\n * wins; the service key is its own subdomain when unauthored; `''` = apex.\n * See the section header.\n */\nexport function buildServicePublicHost(params: ServicePublicHostParams): string {\n const { serviceKey, serviceHosts, publicDomain } = params;\n // Fallback uses the service key AS the subdomain, lowercased: DNS labels are\n // case-insensitive and Let's Encrypt / `new URL()` canonicalize to lowercase,\n // so a camelCase key like `backendApi` must become `backendapi` to round-trip\n // (and to match the ingress host). Authored serviceHosts values are already\n // lowercase-validated upstream (`SERVICE_HOST_LABEL`). NOTE: a config key with\n // a DNS-invalid char (e.g. `_`) still yields an invalid host — the operator\n // must author a `serviceHosts` entry for it.\n const host = serviceHosts?.[serviceKey] ?? serviceKey.toLowerCase();\n return host === '' ? publicDomain : `${host}.${publicDomain}`;\n}\n\n/**\n * Resolve an application service's PUBLIC URL (`https://<host>`), where the\n * host comes from {@link buildServicePublicHost}.\n */\nexport function buildServicePublicUrl(params: ServicePublicHostParams): string {\n return `https://${buildServicePublicHost(params)}`;\n}\n\n/**\n * K8s Secret name for a platform service: `<service>-secret`\n */\nexport function k8sServiceSecretName(service: string): string {\n return `${service}-secret`;\n}\n\n/**\n * K8s ConfigMap name for a platform service: `<service>-config`\n */\nexport function k8sServiceConfigMapName(service: string): string {\n return `${service}-config`;\n}\n\n/**\n * K8s Secret name for an app backend: `<serviceName>-secret`\n *\n * The emitted name MUST match the `envFrom: secretRef.name` the application\n * deployment template mounts. The CLI static emit lane\n * (`k8s-secrets-generator.service.ts` § 5) calls this helper with the app's\n * backend `serviceName`.\n *\n * ⚠️ KNOWN GAP — the K8s app lane is not yet runtime-verified (no live cluster\n * run). `wildo-ai-application/deployment.yaml.hbs` hardcodes the mount name\n * `wildo-ai-application-secret` (and the image `wildo-ai-application:{{imageTag}}`),\n * i.e. the manifests assume one canonical app identity, while this helper is\n * called with the app's REAL backend `serviceName` (e.g.\n * `wonder-todos-backend-api`). The two only line up when the backend is literally\n * named `wildo-ai-application`. The mount is fail-closed (no `optional: true`),\n * so a mismatch means the pod cannot boot. Resolve by either parameterizing the\n * template's secret name or pinning the emit to the canonical app identity —\n * see `.claude/plans/self-host-domain-subdomain-model.md`.\n *\n * Application backends emit a single Secret per app (no companion ConfigMap):\n * envFrom mounts every entry as `process.env.*`, so splitting sensitive vs\n * non-sensitive added zero runtime value and fragmented the canonical sink.\n * See `k8s-secrets-generator.service.ts` § 5 for the design note.\n */\nexport function k8sAppBackendSecretName(serviceName: string): string {\n return `${serviceName}-secret`;\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The PLATFORM-ACCESS vocabulary a minion declaration is authored with (R4 / R5).
|
|
3
|
+
*
|
|
4
|
+
* ## Why it lives under `project-config` and not beside its derivation
|
|
5
|
+
*
|
|
6
|
+
* An authored `wildo.saas.config.ts` does NOT see the package root barrel. The
|
|
7
|
+
* config loader resolves `@wildo-ai/platform-config-lib` to
|
|
8
|
+
* `src/config-authoring.entry.ts`, which exports `./project-config` and
|
|
9
|
+
* `./workspace-scope` and nothing else — so a symbol under `bootstrap/` is
|
|
10
|
+
* invisible to the very file that has to name it.
|
|
11
|
+
*
|
|
12
|
+
* This was measured, not guessed. With the enum in `bootstrap/`, an app config
|
|
13
|
+
* importing it alongside `AppFrontendType` — same package, same import statement
|
|
14
|
+
* — got `AppFrontendType` fine and `undefined` for this one, and
|
|
15
|
+
* `wildo config sync` failed with `Cannot read properties of undefined (reading
|
|
16
|
+
* 'OWN_CRON_RECORDS')`. Nothing in that message points at an entrypoint.
|
|
17
|
+
*
|
|
18
|
+
* So the split is by AUDIENCE: the vocabulary an app author writes lives where
|
|
19
|
+
* app authors can reach it; {@link buildOwnCronRecordFilter} and the declaration
|
|
20
|
+
* type stay in `bootstrap/`, because a runtime derivation is not something an
|
|
21
|
+
* authored config should be able to call.
|
|
22
|
+
*/
|
|
23
|
+
export declare enum MinionPlatformAccessScope {
|
|
24
|
+
/**
|
|
25
|
+
* The minion's OWN cron/schedule records. There is deliberately no
|
|
26
|
+
* `ALL_CRON_RECORDS` member: a scope that could name another minion is a scope
|
|
27
|
+
* somebody will eventually grant.
|
|
28
|
+
*/
|
|
29
|
+
OWN_CRON_RECORDS = "own_cron_records"
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=minion-platform-access.vocabulary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minion-platform-access.vocabulary.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/minion-platform-access.vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,oBAAY,yBAAyB;IACnC;;;;OAIG;IACH,gBAAgB,qBAAqB;CACtC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The PLATFORM-ACCESS vocabulary a minion declaration is authored with (R4 / R5).
|
|
3
|
+
*
|
|
4
|
+
* ## Why it lives under `project-config` and not beside its derivation
|
|
5
|
+
*
|
|
6
|
+
* An authored `wildo.saas.config.ts` does NOT see the package root barrel. The
|
|
7
|
+
* config loader resolves `@wildo-ai/platform-config-lib` to
|
|
8
|
+
* `src/config-authoring.entry.ts`, which exports `./project-config` and
|
|
9
|
+
* `./workspace-scope` and nothing else — so a symbol under `bootstrap/` is
|
|
10
|
+
* invisible to the very file that has to name it.
|
|
11
|
+
*
|
|
12
|
+
* This was measured, not guessed. With the enum in `bootstrap/`, an app config
|
|
13
|
+
* importing it alongside `AppFrontendType` — same package, same import statement
|
|
14
|
+
* — got `AppFrontendType` fine and `undefined` for this one, and
|
|
15
|
+
* `wildo config sync` failed with `Cannot read properties of undefined (reading
|
|
16
|
+
* 'OWN_CRON_RECORDS')`. Nothing in that message points at an entrypoint.
|
|
17
|
+
*
|
|
18
|
+
* So the split is by AUDIENCE: the vocabulary an app author writes lives where
|
|
19
|
+
* app authors can reach it; {@link buildOwnCronRecordFilter} and the declaration
|
|
20
|
+
* type stay in `bootstrap/`, because a runtime derivation is not something an
|
|
21
|
+
* authored config should be able to call.
|
|
22
|
+
*/
|
|
23
|
+
export var MinionPlatformAccessScope;
|
|
24
|
+
(function (MinionPlatformAccessScope) {
|
|
25
|
+
/**
|
|
26
|
+
* The minion's OWN cron/schedule records. There is deliberately no
|
|
27
|
+
* `ALL_CRON_RECORDS` member: a scope that could name another minion is a scope
|
|
28
|
+
* somebody will eventually grant.
|
|
29
|
+
*/
|
|
30
|
+
MinionPlatformAccessScope["OWN_CRON_RECORDS"] = "own_cron_records";
|
|
31
|
+
})(MinionPlatformAccessScope || (MinionPlatformAccessScope = {}));
|
|
32
|
+
//# sourceMappingURL=minion-platform-access.vocabulary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minion-platform-access.vocabulary.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/minion-platform-access.vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,CAAN,IAAY,yBAOX;AAPD,WAAY,yBAAyB;IACnC;;;;OAIG;IACH,kEAAqC,CAAA;AACvC,CAAC,EAPW,yBAAyB,KAAzB,yBAAyB,QAOpC","sourcesContent":["/**\n * The PLATFORM-ACCESS vocabulary a minion declaration is authored with (R4 / R5).\n *\n * ## Why it lives under `project-config` and not beside its derivation\n *\n * An authored `wildo.saas.config.ts` does NOT see the package root barrel. The\n * config loader resolves `@wildo-ai/platform-config-lib` to\n * `src/config-authoring.entry.ts`, which exports `./project-config` and\n * `./workspace-scope` and nothing else — so a symbol under `bootstrap/` is\n * invisible to the very file that has to name it.\n *\n * This was measured, not guessed. With the enum in `bootstrap/`, an app config\n * importing it alongside `AppFrontendType` — same package, same import statement\n * — got `AppFrontendType` fine and `undefined` for this one, and\n * `wildo config sync` failed with `Cannot read properties of undefined (reading\n * 'OWN_CRON_RECORDS')`. Nothing in that message points at an entrypoint.\n *\n * So the split is by AUDIENCE: the vocabulary an app author writes lives where\n * app authors can reach it; {@link buildOwnCronRecordFilter} and the declaration\n * type stay in `bootstrap/`, because a runtime derivation is not something an\n * authored config should be able to call.\n */\n\nexport enum MinionPlatformAccessScope {\n /**\n * The minion's OWN cron/schedule records. There is deliberately no\n * `ALL_CRON_RECORDS` member: a scope that could name another minion is a scope\n * somebody will eventually grant.\n */\n OWN_CRON_RECORDS = 'own_cron_records',\n}\n"]}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { type ResourceType } from '@wildo-ai/saas-models';
|
|
2
|
+
/**
|
|
3
|
+
* The two safety gates that must hold BEFORE a minion's `resourceAccess` may be
|
|
4
|
+
* turned into database grants (Step 3 shared prerequisites, R11 + the F1 guard).
|
|
5
|
+
*
|
|
6
|
+
* Both exist because of the same asymmetry: `resourceAccess` is a RESOURCE-TYPE
|
|
7
|
+
* whitelist, while a database grant is a COLLECTION grant. The two only line up
|
|
8
|
+
* when the mapping between them is injective over the declarable set — and the
|
|
9
|
+
* alias map is exactly where it is not.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Resource types a minion may never declare (D15 / R11).
|
|
13
|
+
*
|
|
14
|
+
* A self-door type addresses "MY row" — it is meaningless for a principal that
|
|
15
|
+
* has no row. `APPLICATION_MACHINE` carries no `userId`; a minion is not a user
|
|
16
|
+
* and cannot become one. So the rejection is a SEMANTIC rule that happens to
|
|
17
|
+
* also dissolve F1, not a convenience rule adopted because it was easier.
|
|
18
|
+
*
|
|
19
|
+
* That ordering matters for anyone tempted to relax this later. The alias map
|
|
20
|
+
* holds exactly three entries, and all three are self→admin pairs onto the SAME
|
|
21
|
+
* rows. Remove the self doors from the declarable set and resource-type →
|
|
22
|
+
* collection becomes INJECTIVE, which is what lets a grant derived per resource
|
|
23
|
+
* type mean exactly what the author wrote. Relaxing D15 for convenience would
|
|
24
|
+
* silently restore the coarser floor: declaring `USER_SELF` would grant the
|
|
25
|
+
* whole `users` collection — every user's row, through a door that promises
|
|
26
|
+
* only one.
|
|
27
|
+
*
|
|
28
|
+
* Derived from the alias map rather than listed, so a fourth self door added
|
|
29
|
+
* there is forbidden here on the same commit instead of quietly becoming
|
|
30
|
+
* declarable.
|
|
31
|
+
*/
|
|
32
|
+
export declare const MINION_FORBIDDEN_SELF_DOOR_RESOURCE_TYPES: readonly string[];
|
|
33
|
+
/** One reason a `resourceAccess` declaration cannot be turned into grants. */
|
|
34
|
+
export interface MinionResourceAccessViolation {
|
|
35
|
+
/** `read` or `write` — the axis the offending entry was declared on. */
|
|
36
|
+
readonly axis: 'read' | 'write';
|
|
37
|
+
readonly resourceType: string;
|
|
38
|
+
/** Operator-facing explanation naming the consequence and the fix. */
|
|
39
|
+
readonly message: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Reject self-door types, and refuse any declaration whose types collapse onto
|
|
43
|
+
* one collection.
|
|
44
|
+
*
|
|
45
|
+
* Returns every violation rather than throwing on the first: an author fixing a
|
|
46
|
+
* config wants the whole list, and a caller that wants to fail closed can do so
|
|
47
|
+
* on a non-empty result.
|
|
48
|
+
*
|
|
49
|
+
* ## The injectivity check is NOT redundant with the self-door rejection
|
|
50
|
+
*
|
|
51
|
+
* It is tempting to think removing the self doors makes collisions impossible —
|
|
52
|
+
* that is true of TODAY's alias map and is exactly why this must be checked
|
|
53
|
+
* rather than assumed. The alias map is data: a future entry that aliases two
|
|
54
|
+
* ADMIN types onto one collection would reintroduce the collapse without
|
|
55
|
+
* touching a self door, and the grant derived for one type would silently carry
|
|
56
|
+
* the other's rows. Failing closed here makes that a build failure instead of a
|
|
57
|
+
* containment that quietly widened.
|
|
58
|
+
*/
|
|
59
|
+
export declare function findMinionResourceAccessViolations(resourceAccess: {
|
|
60
|
+
read?: readonly string[] | undefined;
|
|
61
|
+
write?: readonly string[] | undefined;
|
|
62
|
+
}): MinionResourceAccessViolation[];
|
|
63
|
+
/**
|
|
64
|
+
* What a minion may touch, per axis — expressed in RESOURCE TYPES, the
|
|
65
|
+
* vocabulary the rest of the platform speaks.
|
|
66
|
+
*
|
|
67
|
+
* ## Why not collection names
|
|
68
|
+
*
|
|
69
|
+
* An earlier revision returned collection names, which quietly made storage the
|
|
70
|
+
* API of a security decision. `resourceAccess` is AUTHORED in resource types,
|
|
71
|
+
* `ResourceType` is what every other Wildo surface passes around, and a
|
|
72
|
+
* collection is one adapter's rendering of where those rows happen to live —
|
|
73
|
+
* MongoDB calls it a collection, PostgreSQL a table, and a future adapter will
|
|
74
|
+
* call it something else again. Naming the security contract after one of them
|
|
75
|
+
* would force every reader to translate back, and would make the grant set look
|
|
76
|
+
* different depending on which database an application chose.
|
|
77
|
+
*
|
|
78
|
+
* The translation therefore happens at the ADAPTER boundary — see
|
|
79
|
+
* {@link resolveGrantStorageNames} — which is the only place that legitimately
|
|
80
|
+
* knows about storage, exactly as external protocol literals are confined to the
|
|
81
|
+
* thin adapter that speaks them.
|
|
82
|
+
*
|
|
83
|
+
* `null` means **no access was declared at all**, which is NOT the same as an
|
|
84
|
+
* empty declaration and must not be flattened into one. Absent ⇒ mint no
|
|
85
|
+
* database user whatsoever (D11 / R3: application-data access is an OPTIONAL
|
|
86
|
+
* capability). Declared-but-empty ⇒ the author asked for a principal with no
|
|
87
|
+
* access, a different and legitimate statement. One "empty list" for both would
|
|
88
|
+
* make "I forgot" indistinguishable from "I meant none".
|
|
89
|
+
*/
|
|
90
|
+
export interface MinionResourceGrants {
|
|
91
|
+
readonly read: readonly ResourceType[];
|
|
92
|
+
readonly write: readonly ResourceType[];
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Derive a minion's grants from an authored `resourceAccess`.
|
|
96
|
+
*
|
|
97
|
+
* ## `write` does NOT imply `read`, deliberately
|
|
98
|
+
*
|
|
99
|
+
* It is tempting to add read wherever write is granted — most write paths in the
|
|
100
|
+
* backend pipeline do read first (validation, FK resolution, read-modify-write),
|
|
101
|
+
* so a `write: ['todos']` minion will often need `read: ['todos']` too.
|
|
102
|
+
*
|
|
103
|
+
* It is still refused, for the reason this entire workstream exists: a grant the
|
|
104
|
+
* author did not write is a grant nobody reviewed. An insert-only minion is a
|
|
105
|
+
* real shape, and silently widening every writer to a reader would make the
|
|
106
|
+
* declaration stop describing the outcome — the precise property that made
|
|
107
|
+
* `resourceAccess` non-binding before it produced real credentials.
|
|
108
|
+
*
|
|
109
|
+
* The cost is stated rather than hidden: a minion that writes without declaring
|
|
110
|
+
* read will fail at RUNTIME on its first read, with the database naming the
|
|
111
|
+
* action it lacked. A loud, local failure with an obvious fix (declare the read)
|
|
112
|
+
* is the trade this prefers over a silent widening.
|
|
113
|
+
*
|
|
114
|
+
* ## The F2 transitive read path is the CALLER's to supply
|
|
115
|
+
*
|
|
116
|
+
* A declared type can pull in others through nested reads — the closure rule is
|
|
117
|
+
* *declared ∪ child-direction targets declaring nested `onRead`, transitively*.
|
|
118
|
+
* Computing it needs the resource graph, which this layer does not have, so it
|
|
119
|
+
* arrives as `transitiveReadResourceTypes`. Omitting it is correct ONLY when the
|
|
120
|
+
* application declares no nested `onRead` (true of Wonder Todos, measured
|
|
121
|
+
* 2026-08-05); omitting it elsewhere yields a credential that is denied on a
|
|
122
|
+
* path which works today.
|
|
123
|
+
*/
|
|
124
|
+
export declare function deriveMinionResourceGrants(resourceAccess: {
|
|
125
|
+
read?: readonly string[] | undefined;
|
|
126
|
+
write?: readonly string[] | undefined;
|
|
127
|
+
} | undefined, transitiveReadResourceTypes?: readonly string[]): MinionResourceGrants | null;
|
|
128
|
+
/**
|
|
129
|
+
* Translate a grant axis into the STORAGE names one adapter will grant on.
|
|
130
|
+
*
|
|
131
|
+
* The single, explicitly-named boundary between the platform vocabulary and a
|
|
132
|
+
* database dialect. A Mongo module builds collection privileges from it; a
|
|
133
|
+
* PostgreSQL module builds table grants; both call the same function so the two
|
|
134
|
+
* cannot disagree about which rows a resource type addresses.
|
|
135
|
+
*
|
|
136
|
+
* Safe to collapse duplicates here ONLY because the F1 guard already refused any
|
|
137
|
+
* declaration whose types share a collection — see
|
|
138
|
+
* {@link findMinionResourceAccessViolations}. Without that guarantee this
|
|
139
|
+
* function would silently merge two declarations into one grant.
|
|
140
|
+
*/
|
|
141
|
+
export declare function resolveGrantStorageNames(resourceTypes: readonly ResourceType[]): string[];
|
|
142
|
+
//# sourceMappingURL=minion-resource-access.validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minion-resource-access.validation.d.ts","sourceRoot":"","sources":["../../../../../src/project-config/shared/minion-resource-access.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,yCAAyC,EAAE,SAAS,MAAM,EACV,CAAC;AAE9D,8EAA8E;AAC9E,MAAM,WAAW,6BAA6B;IAC5C,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kCAAkC,CAAC,cAAc,EAAE;IACjE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACrC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CACvC,GAAG,6BAA6B,EAAE,CA+ClC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,SAAS,YAAY,EAAE,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE;IAAE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;CAAE,GAAG,SAAS,EAC3G,2BAA2B,GAAE,SAAS,MAAM,EAAO,GAClD,oBAAoB,GAAG,IAAI,CAuB7B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,EAAE,CAEzF"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES, resolveSharedPersistenceCollectionName, } from '@wildo-ai/saas-models';
|
|
2
|
+
/**
|
|
3
|
+
* The two safety gates that must hold BEFORE a minion's `resourceAccess` may be
|
|
4
|
+
* turned into database grants (Step 3 shared prerequisites, R11 + the F1 guard).
|
|
5
|
+
*
|
|
6
|
+
* Both exist because of the same asymmetry: `resourceAccess` is a RESOURCE-TYPE
|
|
7
|
+
* whitelist, while a database grant is a COLLECTION grant. The two only line up
|
|
8
|
+
* when the mapping between them is injective over the declarable set — and the
|
|
9
|
+
* alias map is exactly where it is not.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Resource types a minion may never declare (D15 / R11).
|
|
13
|
+
*
|
|
14
|
+
* A self-door type addresses "MY row" — it is meaningless for a principal that
|
|
15
|
+
* has no row. `APPLICATION_MACHINE` carries no `userId`; a minion is not a user
|
|
16
|
+
* and cannot become one. So the rejection is a SEMANTIC rule that happens to
|
|
17
|
+
* also dissolve F1, not a convenience rule adopted because it was easier.
|
|
18
|
+
*
|
|
19
|
+
* That ordering matters for anyone tempted to relax this later. The alias map
|
|
20
|
+
* holds exactly three entries, and all three are self→admin pairs onto the SAME
|
|
21
|
+
* rows. Remove the self doors from the declarable set and resource-type →
|
|
22
|
+
* collection becomes INJECTIVE, which is what lets a grant derived per resource
|
|
23
|
+
* type mean exactly what the author wrote. Relaxing D15 for convenience would
|
|
24
|
+
* silently restore the coarser floor: declaring `USER_SELF` would grant the
|
|
25
|
+
* whole `users` collection — every user's row, through a door that promises
|
|
26
|
+
* only one.
|
|
27
|
+
*
|
|
28
|
+
* Derived from the alias map rather than listed, so a fourth self door added
|
|
29
|
+
* there is forbidden here on the same commit instead of quietly becoming
|
|
30
|
+
* declarable.
|
|
31
|
+
*/
|
|
32
|
+
export const MINION_FORBIDDEN_SELF_DOOR_RESOURCE_TYPES = Object.keys(RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES);
|
|
33
|
+
/**
|
|
34
|
+
* Reject self-door types, and refuse any declaration whose types collapse onto
|
|
35
|
+
* one collection.
|
|
36
|
+
*
|
|
37
|
+
* Returns every violation rather than throwing on the first: an author fixing a
|
|
38
|
+
* config wants the whole list, and a caller that wants to fail closed can do so
|
|
39
|
+
* on a non-empty result.
|
|
40
|
+
*
|
|
41
|
+
* ## The injectivity check is NOT redundant with the self-door rejection
|
|
42
|
+
*
|
|
43
|
+
* It is tempting to think removing the self doors makes collisions impossible —
|
|
44
|
+
* that is true of TODAY's alias map and is exactly why this must be checked
|
|
45
|
+
* rather than assumed. The alias map is data: a future entry that aliases two
|
|
46
|
+
* ADMIN types onto one collection would reintroduce the collapse without
|
|
47
|
+
* touching a self door, and the grant derived for one type would silently carry
|
|
48
|
+
* the other's rows. Failing closed here makes that a build failure instead of a
|
|
49
|
+
* containment that quietly widened.
|
|
50
|
+
*/
|
|
51
|
+
export function findMinionResourceAccessViolations(resourceAccess) {
|
|
52
|
+
const violations = [];
|
|
53
|
+
const axes = [
|
|
54
|
+
['read', resourceAccess.read ?? []],
|
|
55
|
+
['write', resourceAccess.write ?? []],
|
|
56
|
+
];
|
|
57
|
+
for (const [axis, declared] of axes) {
|
|
58
|
+
for (const resourceType of declared) {
|
|
59
|
+
if (MINION_FORBIDDEN_SELF_DOOR_RESOURCE_TYPES.includes(resourceType)) {
|
|
60
|
+
violations.push({
|
|
61
|
+
axis,
|
|
62
|
+
resourceType,
|
|
63
|
+
message: `'${resourceType}' is a SELF door and cannot be granted to a minion (D15). `
|
|
64
|
+
+ 'A self door addresses "my row", and a minion has no row — it is a machine principal '
|
|
65
|
+
+ `carrying no userId. Granting it would give access to the whole `
|
|
66
|
+
+ `'${resolveSharedPersistenceCollectionName(resourceType)}' collection — `
|
|
67
|
+
+ 'every user\'s row — through a door that promises only one. Declare the ADMIN resource '
|
|
68
|
+
+ 'type explicitly if the minion genuinely needs that breadth.',
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Injectivity, per AXIS: two declared types resolving to one collection make
|
|
73
|
+
// the derived grant wider than either declaration reads.
|
|
74
|
+
const collectionOwners = new Map();
|
|
75
|
+
for (const resourceType of declared) {
|
|
76
|
+
const collection = resolveSharedPersistenceCollectionName(resourceType);
|
|
77
|
+
const existing = collectionOwners.get(collection);
|
|
78
|
+
if (existing !== undefined && existing !== resourceType) {
|
|
79
|
+
violations.push({
|
|
80
|
+
axis,
|
|
81
|
+
resourceType,
|
|
82
|
+
message: `'${resourceType}' and '${existing}' both resolve to the '${collection}' collection, `
|
|
83
|
+
+ 'so a grant derived from either carries the other\'s rows. Refusing to derive grants '
|
|
84
|
+
+ 'from a declaration whose types are not injective over collections (F1 guard) — '
|
|
85
|
+
+ 'declare exactly one of them.',
|
|
86
|
+
});
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
collectionOwners.set(collection, resourceType);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return violations;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Derive a minion's grants from an authored `resourceAccess`.
|
|
96
|
+
*
|
|
97
|
+
* ## `write` does NOT imply `read`, deliberately
|
|
98
|
+
*
|
|
99
|
+
* It is tempting to add read wherever write is granted — most write paths in the
|
|
100
|
+
* backend pipeline do read first (validation, FK resolution, read-modify-write),
|
|
101
|
+
* so a `write: ['todos']` minion will often need `read: ['todos']` too.
|
|
102
|
+
*
|
|
103
|
+
* It is still refused, for the reason this entire workstream exists: a grant the
|
|
104
|
+
* author did not write is a grant nobody reviewed. An insert-only minion is a
|
|
105
|
+
* real shape, and silently widening every writer to a reader would make the
|
|
106
|
+
* declaration stop describing the outcome — the precise property that made
|
|
107
|
+
* `resourceAccess` non-binding before it produced real credentials.
|
|
108
|
+
*
|
|
109
|
+
* The cost is stated rather than hidden: a minion that writes without declaring
|
|
110
|
+
* read will fail at RUNTIME on its first read, with the database naming the
|
|
111
|
+
* action it lacked. A loud, local failure with an obvious fix (declare the read)
|
|
112
|
+
* is the trade this prefers over a silent widening.
|
|
113
|
+
*
|
|
114
|
+
* ## The F2 transitive read path is the CALLER's to supply
|
|
115
|
+
*
|
|
116
|
+
* A declared type can pull in others through nested reads — the closure rule is
|
|
117
|
+
* *declared ∪ child-direction targets declaring nested `onRead`, transitively*.
|
|
118
|
+
* Computing it needs the resource graph, which this layer does not have, so it
|
|
119
|
+
* arrives as `transitiveReadResourceTypes`. Omitting it is correct ONLY when the
|
|
120
|
+
* application declares no nested `onRead` (true of Wonder Todos, measured
|
|
121
|
+
* 2026-08-05); omitting it elsewhere yields a credential that is denied on a
|
|
122
|
+
* path which works today.
|
|
123
|
+
*/
|
|
124
|
+
export function deriveMinionResourceGrants(resourceAccess, transitiveReadResourceTypes = []) {
|
|
125
|
+
if (!resourceAccess)
|
|
126
|
+
return null;
|
|
127
|
+
const violations = findMinionResourceAccessViolations(resourceAccess);
|
|
128
|
+
if (violations.length > 0) {
|
|
129
|
+
// Fail closed. Reaching here means the parse-time gate was bypassed (a
|
|
130
|
+
// hand-built object, a future caller); deriving anyway would issue exactly
|
|
131
|
+
// the over-broad grant those gates exist to refuse.
|
|
132
|
+
throw new Error(`Refusing to derive minion resource grants from an invalid resourceAccess: `
|
|
133
|
+
+ violations.map((violation) => `[${violation.axis}] ${violation.message}`).join(' '));
|
|
134
|
+
}
|
|
135
|
+
// Deduped and ordered so a grant set is stable between syncs — an unstable
|
|
136
|
+
// one reads as a change and would re-issue credentials for nothing.
|
|
137
|
+
const normalize = (resourceTypes) => [...new Set(resourceTypes)].sort();
|
|
138
|
+
return {
|
|
139
|
+
read: normalize([...(resourceAccess.read ?? []), ...transitiveReadResourceTypes]),
|
|
140
|
+
write: normalize(resourceAccess.write ?? []),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Translate a grant axis into the STORAGE names one adapter will grant on.
|
|
145
|
+
*
|
|
146
|
+
* The single, explicitly-named boundary between the platform vocabulary and a
|
|
147
|
+
* database dialect. A Mongo module builds collection privileges from it; a
|
|
148
|
+
* PostgreSQL module builds table grants; both call the same function so the two
|
|
149
|
+
* cannot disagree about which rows a resource type addresses.
|
|
150
|
+
*
|
|
151
|
+
* Safe to collapse duplicates here ONLY because the F1 guard already refused any
|
|
152
|
+
* declaration whose types share a collection — see
|
|
153
|
+
* {@link findMinionResourceAccessViolations}. Without that guarantee this
|
|
154
|
+
* function would silently merge two declarations into one grant.
|
|
155
|
+
*/
|
|
156
|
+
export function resolveGrantStorageNames(resourceTypes) {
|
|
157
|
+
return [...new Set(resourceTypes.map((resourceType) => resolveSharedPersistenceCollectionName(resourceType)))].sort();
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=minion-resource-access.validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minion-resource-access.validation.js","sourceRoot":"","sources":["../../../../../src/project-config/shared/minion-resource-access.validation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8CAA8C,EAC9C,sCAAsC,GAEvC,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,yCAAyC,GACpD,MAAM,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;AAW9D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,kCAAkC,CAAC,cAGlD;IACC,MAAM,UAAU,GAAoC,EAAE,CAAC;IACvD,MAAM,IAAI,GAAiD;QACzD,CAAC,MAAM,EAAE,cAAc,CAAC,IAAI,IAAI,EAAE,CAAC;QACnC,CAAC,OAAO,EAAE,cAAc,CAAC,KAAK,IAAI,EAAE,CAAC;KACtC,CAAC;IAEF,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;QACpC,KAAK,MAAM,YAAY,IAAI,QAAQ,EAAE,CAAC;YACpC,IAAI,yCAAyC,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;gBACrE,UAAU,CAAC,IAAI,CAAC;oBACd,IAAI;oBACJ,YAAY;oBACZ,OAAO,EACL,IAAI,YAAY,4DAA4D;0BAC1E,sFAAsF;0BACtF,iEAAiE;0BACjE,IAAI,sCAAsC,CAAC,YAA4B,CAAC,iBAAiB;0BACzF,wFAAwF;0BACxF,6DAA6D;iBAClE,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,6EAA6E;QAC7E,yDAAyD;QACzD,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;QACnD,KAAK,MAAM,YAAY,IAAI,QAAQ,EAAE,CAAC;YACpC,MAAM,UAAU,GAAG,sCAAsC,CAAC,YAA4B,CAAC,CAAC;YACxF,MAAM,QAAQ,GAAG,gBAAgB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAClD,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,YAAY,EAAE,CAAC;gBACxD,UAAU,CAAC,IAAI,CAAC;oBACd,IAAI;oBACJ,YAAY;oBACZ,OAAO,EACL,IAAI,YAAY,UAAU,QAAQ,0BAA0B,UAAU,gBAAgB;0BACpF,sFAAsF;0BACtF,iFAAiF;0BACjF,8BAA8B;iBACnC,CAAC,CAAC;gBACH,SAAS;YACX,CAAC;YACD,gBAAgB,CAAC,GAAG,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAkCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,0BAA0B,CACxC,cAA2G,EAC3G,8BAAiD,EAAE;IAEnD,IAAI,CAAC,cAAc;QAAE,OAAO,IAAI,CAAC;IAEjC,MAAM,UAAU,GAAG,kCAAkC,CAAC,cAAc,CAAC,CAAC;IACtE,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,uEAAuE;QACvE,2EAA2E;QAC3E,oDAAoD;QACpD,MAAM,IAAI,KAAK,CACb,4EAA4E;cAC1E,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CACtF,CAAC;IACJ,CAAC;IAED,2EAA2E;IAC3E,oEAAoE;IACpE,MAAM,SAAS,GAAG,CAAC,aAAgC,EAAkB,EAAE,CACrE,CAAC,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,EAAoB,CAAC;IAEvD,OAAO;QACL,IAAI,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,GAAG,2BAA2B,CAAC,CAAC;QACjF,KAAK,EAAE,SAAS,CAAC,cAAc,CAAC,KAAK,IAAI,EAAE,CAAC;KAC7C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,wBAAwB,CAAC,aAAsC;IAC7E,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,sCAAsC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACxH,CAAC","sourcesContent":["import {\n RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES,\n resolveSharedPersistenceCollectionName,\n type ResourceType,\n} from '@wildo-ai/saas-models';\n\n/**\n * The two safety gates that must hold BEFORE a minion's `resourceAccess` may be\n * turned into database grants (Step 3 shared prerequisites, R11 + the F1 guard).\n *\n * Both exist because of the same asymmetry: `resourceAccess` is a RESOURCE-TYPE\n * whitelist, while a database grant is a COLLECTION grant. The two only line up\n * when the mapping between them is injective over the declarable set — and the\n * alias map is exactly where it is not.\n */\n\n/**\n * Resource types a minion may never declare (D15 / R11).\n *\n * A self-door type addresses \"MY row\" — it is meaningless for a principal that\n * has no row. `APPLICATION_MACHINE` carries no `userId`; a minion is not a user\n * and cannot become one. So the rejection is a SEMANTIC rule that happens to\n * also dissolve F1, not a convenience rule adopted because it was easier.\n *\n * That ordering matters for anyone tempted to relax this later. The alias map\n * holds exactly three entries, and all three are self→admin pairs onto the SAME\n * rows. Remove the self doors from the declarable set and resource-type →\n * collection becomes INJECTIVE, which is what lets a grant derived per resource\n * type mean exactly what the author wrote. Relaxing D15 for convenience would\n * silently restore the coarser floor: declaring `USER_SELF` would grant the\n * whole `users` collection — every user's row, through a door that promises\n * only one.\n *\n * Derived from the alias map rather than listed, so a fourth self door added\n * there is forbidden here on the same commit instead of quietly becoming\n * declarable.\n */\nexport const MINION_FORBIDDEN_SELF_DOOR_RESOURCE_TYPES: readonly string[] =\n Object.keys(RESOURCE_SHARED_PERSISTENCE_COLLECTION_ALIASES);\n\n/** One reason a `resourceAccess` declaration cannot be turned into grants. */\nexport interface MinionResourceAccessViolation {\n /** `read` or `write` — the axis the offending entry was declared on. */\n readonly axis: 'read' | 'write';\n readonly resourceType: string;\n /** Operator-facing explanation naming the consequence and the fix. */\n readonly message: string;\n}\n\n/**\n * Reject self-door types, and refuse any declaration whose types collapse onto\n * one collection.\n *\n * Returns every violation rather than throwing on the first: an author fixing a\n * config wants the whole list, and a caller that wants to fail closed can do so\n * on a non-empty result.\n *\n * ## The injectivity check is NOT redundant with the self-door rejection\n *\n * It is tempting to think removing the self doors makes collisions impossible —\n * that is true of TODAY's alias map and is exactly why this must be checked\n * rather than assumed. The alias map is data: a future entry that aliases two\n * ADMIN types onto one collection would reintroduce the collapse without\n * touching a self door, and the grant derived for one type would silently carry\n * the other's rows. Failing closed here makes that a build failure instead of a\n * containment that quietly widened.\n */\nexport function findMinionResourceAccessViolations(resourceAccess: {\n read?: readonly string[] | undefined;\n write?: readonly string[] | undefined;\n}): MinionResourceAccessViolation[] {\n const violations: MinionResourceAccessViolation[] = [];\n const axes: Array<['read' | 'write', readonly string[]]> = [\n ['read', resourceAccess.read ?? []],\n ['write', resourceAccess.write ?? []],\n ];\n\n for (const [axis, declared] of axes) {\n for (const resourceType of declared) {\n if (MINION_FORBIDDEN_SELF_DOOR_RESOURCE_TYPES.includes(resourceType)) {\n violations.push({\n axis,\n resourceType,\n message:\n `'${resourceType}' is a SELF door and cannot be granted to a minion (D15). `\n + 'A self door addresses \"my row\", and a minion has no row — it is a machine principal '\n + `carrying no userId. Granting it would give access to the whole `\n + `'${resolveSharedPersistenceCollectionName(resourceType as ResourceType)}' collection — `\n + 'every user\\'s row — through a door that promises only one. Declare the ADMIN resource '\n + 'type explicitly if the minion genuinely needs that breadth.',\n });\n }\n }\n\n // Injectivity, per AXIS: two declared types resolving to one collection make\n // the derived grant wider than either declaration reads.\n const collectionOwners = new Map<string, string>();\n for (const resourceType of declared) {\n const collection = resolveSharedPersistenceCollectionName(resourceType as ResourceType);\n const existing = collectionOwners.get(collection);\n if (existing !== undefined && existing !== resourceType) {\n violations.push({\n axis,\n resourceType,\n message:\n `'${resourceType}' and '${existing}' both resolve to the '${collection}' collection, `\n + 'so a grant derived from either carries the other\\'s rows. Refusing to derive grants '\n + 'from a declaration whose types are not injective over collections (F1 guard) — '\n + 'declare exactly one of them.',\n });\n continue;\n }\n collectionOwners.set(collection, resourceType);\n }\n }\n\n return violations;\n}\n\n/**\n * What a minion may touch, per axis — expressed in RESOURCE TYPES, the\n * vocabulary the rest of the platform speaks.\n *\n * ## Why not collection names\n *\n * An earlier revision returned collection names, which quietly made storage the\n * API of a security decision. `resourceAccess` is AUTHORED in resource types,\n * `ResourceType` is what every other Wildo surface passes around, and a\n * collection is one adapter's rendering of where those rows happen to live —\n * MongoDB calls it a collection, PostgreSQL a table, and a future adapter will\n * call it something else again. Naming the security contract after one of them\n * would force every reader to translate back, and would make the grant set look\n * different depending on which database an application chose.\n *\n * The translation therefore happens at the ADAPTER boundary — see\n * {@link resolveGrantStorageNames} — which is the only place that legitimately\n * knows about storage, exactly as external protocol literals are confined to the\n * thin adapter that speaks them.\n *\n * `null` means **no access was declared at all**, which is NOT the same as an\n * empty declaration and must not be flattened into one. Absent ⇒ mint no\n * database user whatsoever (D11 / R3: application-data access is an OPTIONAL\n * capability). Declared-but-empty ⇒ the author asked for a principal with no\n * access, a different and legitimate statement. One \"empty list\" for both would\n * make \"I forgot\" indistinguishable from \"I meant none\".\n */\nexport interface MinionResourceGrants {\n readonly read: readonly ResourceType[];\n readonly write: readonly ResourceType[];\n}\n\n/**\n * Derive a minion's grants from an authored `resourceAccess`.\n *\n * ## `write` does NOT imply `read`, deliberately\n *\n * It is tempting to add read wherever write is granted — most write paths in the\n * backend pipeline do read first (validation, FK resolution, read-modify-write),\n * so a `write: ['todos']` minion will often need `read: ['todos']` too.\n *\n * It is still refused, for the reason this entire workstream exists: a grant the\n * author did not write is a grant nobody reviewed. An insert-only minion is a\n * real shape, and silently widening every writer to a reader would make the\n * declaration stop describing the outcome — the precise property that made\n * `resourceAccess` non-binding before it produced real credentials.\n *\n * The cost is stated rather than hidden: a minion that writes without declaring\n * read will fail at RUNTIME on its first read, with the database naming the\n * action it lacked. A loud, local failure with an obvious fix (declare the read)\n * is the trade this prefers over a silent widening.\n *\n * ## The F2 transitive read path is the CALLER's to supply\n *\n * A declared type can pull in others through nested reads — the closure rule is\n * *declared ∪ child-direction targets declaring nested `onRead`, transitively*.\n * Computing it needs the resource graph, which this layer does not have, so it\n * arrives as `transitiveReadResourceTypes`. Omitting it is correct ONLY when the\n * application declares no nested `onRead` (true of Wonder Todos, measured\n * 2026-08-05); omitting it elsewhere yields a credential that is denied on a\n * path which works today.\n */\nexport function deriveMinionResourceGrants(\n resourceAccess: { read?: readonly string[] | undefined; write?: readonly string[] | undefined } | undefined,\n transitiveReadResourceTypes: readonly string[] = [],\n): MinionResourceGrants | null {\n if (!resourceAccess) return null;\n\n const violations = findMinionResourceAccessViolations(resourceAccess);\n if (violations.length > 0) {\n // Fail closed. Reaching here means the parse-time gate was bypassed (a\n // hand-built object, a future caller); deriving anyway would issue exactly\n // the over-broad grant those gates exist to refuse.\n throw new Error(\n `Refusing to derive minion resource grants from an invalid resourceAccess: `\n + violations.map((violation) => `[${violation.axis}] ${violation.message}`).join(' '),\n );\n }\n\n // Deduped and ordered so a grant set is stable between syncs — an unstable\n // one reads as a change and would re-issue credentials for nothing.\n const normalize = (resourceTypes: readonly string[]): ResourceType[] =>\n [...new Set(resourceTypes)].sort() as ResourceType[];\n\n return {\n read: normalize([...(resourceAccess.read ?? []), ...transitiveReadResourceTypes]),\n write: normalize(resourceAccess.write ?? []),\n };\n}\n\n/**\n * Translate a grant axis into the STORAGE names one adapter will grant on.\n *\n * The single, explicitly-named boundary between the platform vocabulary and a\n * database dialect. A Mongo module builds collection privileges from it; a\n * PostgreSQL module builds table grants; both call the same function so the two\n * cannot disagree about which rows a resource type addresses.\n *\n * Safe to collapse duplicates here ONLY because the F1 guard already refused any\n * declaration whose types share a collection — see\n * {@link findMinionResourceAccessViolations}. Without that guarantee this\n * function would silently merge two declarations into one grant.\n */\nexport function resolveGrantStorageNames(resourceTypes: readonly ResourceType[]): string[] {\n return [...new Set(resourceTypes.map((resourceType) => resolveSharedPersistenceCollectionName(resourceType)))].sort();\n}\n"]}
|