typekro 0.33.9 → 0.34.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/dist/.tsbuildinfo +1 -1
- package/dist/compositions/typekro-runtime/typekro-runtime.d.ts +0 -33
- package/dist/compositions/typekro-runtime/typekro-runtime.d.ts.map +1 -1
- package/dist/compositions/typekro-runtime/typekro-runtime.js +63 -1
- package/dist/compositions/typekro-runtime/typekro-runtime.js.map +1 -1
- package/dist/compositions/typekro-runtime/types.d.ts +8 -0
- package/dist/compositions/typekro-runtime/types.d.ts.map +1 -1
- package/dist/compositions/typekro-runtime/types.js +1 -0
- package/dist/compositions/typekro-runtime/types.js.map +1 -1
- package/dist/core/aspects/values-merge.d.ts +17 -0
- package/dist/core/aspects/values-merge.d.ts.map +1 -1
- package/dist/core/aspects/values-merge.js +67 -8
- package/dist/core/aspects/values-merge.js.map +1 -1
- package/dist/core/deployment/direct-factory.d.ts +9 -0
- package/dist/core/deployment/direct-factory.d.ts.map +1 -1
- package/dist/core/deployment/direct-factory.js +37 -3
- package/dist/core/deployment/direct-factory.js.map +1 -1
- package/dist/core/deployment/engine.d.ts +34 -0
- package/dist/core/deployment/engine.d.ts.map +1 -1
- package/dist/core/deployment/engine.js +173 -29
- package/dist/core/deployment/engine.js.map +1 -1
- package/dist/core/deployment/index.d.ts +2 -0
- package/dist/core/deployment/index.d.ts.map +1 -1
- package/dist/core/deployment/index.js +1 -0
- package/dist/core/deployment/index.js.map +1 -1
- package/dist/core/deployment/k8s-helpers.d.ts +73 -0
- package/dist/core/deployment/k8s-helpers.d.ts.map +1 -1
- package/dist/core/deployment/k8s-helpers.js +198 -4
- package/dist/core/deployment/k8s-helpers.js.map +1 -1
- package/dist/core/deployment/kro-factory.d.ts.map +1 -1
- package/dist/core/deployment/kro-factory.js +21 -1
- package/dist/core/deployment/kro-factory.js.map +1 -1
- package/dist/core/deployment/status-leaf-resolution.d.ts +101 -0
- package/dist/core/deployment/status-leaf-resolution.d.ts.map +1 -0
- package/dist/core/deployment/status-leaf-resolution.js +232 -0
- package/dist/core/deployment/status-leaf-resolution.js.map +1 -0
- package/dist/core/deployment/strategies/base-strategy.d.ts.map +1 -1
- package/dist/core/deployment/strategies/base-strategy.js +31 -3
- package/dist/core/deployment/strategies/base-strategy.js.map +1 -1
- package/dist/core/deployment/strategies/kro-strategy.d.ts.map +1 -1
- package/dist/core/deployment/strategies/kro-strategy.js +8 -1
- package/dist/core/deployment/strategies/kro-strategy.js.map +1 -1
- package/dist/core/expressions/composition/composition-analyzer-helpers.d.ts.map +1 -1
- package/dist/core/expressions/composition/composition-analyzer-helpers.js +20 -2
- package/dist/core/expressions/composition/composition-analyzer-helpers.js.map +1 -1
- package/dist/core/kro/index.d.ts +6 -0
- package/dist/core/kro/index.d.ts.map +1 -0
- package/dist/core/kro/index.js +6 -0
- package/dist/core/kro/index.js.map +1 -0
- package/dist/core/kro/label-guard-capability.d.ts +141 -0
- package/dist/core/kro/label-guard-capability.d.ts.map +1 -0
- package/dist/core/kro/label-guard-capability.js +257 -0
- package/dist/core/kro/label-guard-capability.js.map +1 -0
- package/dist/core/kro/labels.d.ts +56 -0
- package/dist/core/kro/labels.d.ts.map +1 -0
- package/dist/core/kro/labels.js +62 -0
- package/dist/core/kro/labels.js.map +1 -0
- package/dist/core/kubernetes/api-capability.d.ts +196 -0
- package/dist/core/kubernetes/api-capability.d.ts.map +1 -0
- package/dist/core/kubernetes/api-capability.js +301 -0
- package/dist/core/kubernetes/api-capability.js.map +1 -0
- package/dist/core/kubernetes/index.d.ts +2 -0
- package/dist/core/kubernetes/index.d.ts.map +1 -1
- package/dist/core/kubernetes/index.js +2 -0
- package/dist/core/kubernetes/index.js.map +1 -1
- package/dist/core/kubernetes/naming.d.ts +100 -0
- package/dist/core/kubernetes/naming.d.ts.map +1 -0
- package/dist/core/kubernetes/naming.js +93 -0
- package/dist/core/kubernetes/naming.js.map +1 -0
- package/dist/core/planning/direct-runtime-adapter.d.ts.map +1 -1
- package/dist/core/planning/direct-runtime-adapter.js +54 -17
- package/dist/core/planning/direct-runtime-adapter.js.map +1 -1
- package/dist/core/planning/planner.d.ts.map +1 -1
- package/dist/core/planning/planner.js +17 -0
- package/dist/core/planning/planner.js.map +1 -1
- package/dist/core/planning/schema.d.ts.map +1 -1
- package/dist/core/planning/schema.js +7 -3
- package/dist/core/planning/schema.js.map +1 -1
- package/dist/core/references/cel-lexical-scanner.d.ts +100 -1
- package/dist/core/references/cel-lexical-scanner.d.ts.map +1 -1
- package/dist/core/references/cel-lexical-scanner.js +196 -2
- package/dist/core/references/cel-lexical-scanner.js.map +1 -1
- package/dist/core/references/cel.d.ts +249 -1
- package/dist/core/references/cel.d.ts.map +1 -1
- package/dist/core/references/cel.js +289 -8
- package/dist/core/references/cel.js.map +1 -1
- package/dist/core/serialization/arktype-ast.d.ts +21 -0
- package/dist/core/serialization/arktype-ast.d.ts.map +1 -0
- package/dist/core/serialization/arktype-ast.js +29 -0
- package/dist/core/serialization/arktype-ast.js.map +1 -0
- package/dist/core/serialization/cel-references.d.ts +133 -32
- package/dist/core/serialization/cel-references.d.ts.map +1 -1
- package/dist/core/serialization/cel-references.js +908 -109
- package/dist/core/serialization/cel-references.js.map +1 -1
- package/dist/core/serialization/core.d.ts.map +1 -1
- package/dist/core/serialization/core.js +13 -2
- package/dist/core/serialization/core.js.map +1 -1
- package/dist/core/serialization/schema.d.ts +16 -2
- package/dist/core/serialization/schema.d.ts.map +1 -1
- package/dist/core/serialization/schema.js +113 -21
- package/dist/core/serialization/schema.js.map +1 -1
- package/dist/core/types/composable.d.ts +7 -1
- package/dist/core/types/composable.d.ts.map +1 -1
- package/dist/core/types/deployment.d.ts +32 -2
- package/dist/core/types/deployment.d.ts.map +1 -1
- package/dist/core/types/serialization.d.ts +37 -0
- package/dist/core/types/serialization.d.ts.map +1 -1
- package/dist/core/validation/cel-dialect.d.ts +246 -0
- package/dist/core/validation/cel-dialect.d.ts.map +1 -0
- package/dist/core/validation/cel-dialect.js +1997 -0
- package/dist/core/validation/cel-dialect.js.map +1 -0
- package/dist/core/validation/cel-validator.d.ts.map +1 -1
- package/dist/core/validation/cel-validator.js +8 -1
- package/dist/core/validation/cel-validator.js.map +1 -1
- package/dist/core/validation/literal-status.d.ts +107 -0
- package/dist/core/validation/literal-status.d.ts.map +1 -0
- package/dist/core/validation/literal-status.js +346 -0
- package/dist/core/validation/literal-status.js.map +1 -0
- package/dist/core/validation/structural-spec-dependence.d.ts +179 -0
- package/dist/core/validation/structural-spec-dependence.d.ts.map +1 -0
- package/dist/core/validation/structural-spec-dependence.js +911 -0
- package/dist/core/validation/structural-spec-dependence.js.map +1 -0
- package/dist/factories/apisix/compositions/apisix-bootstrap.d.ts.map +1 -1
- package/dist/factories/apisix/compositions/apisix-bootstrap.js +9 -0
- package/dist/factories/apisix/compositions/apisix-bootstrap.js.map +1 -1
- package/dist/factories/clickhouse/compositions/clickhouse-cluster.d.ts +6 -0
- package/dist/factories/clickhouse/compositions/clickhouse-cluster.d.ts.map +1 -1
- package/dist/factories/clickhouse/compositions/clickhouse-cluster.js +273 -23
- package/dist/factories/clickhouse/compositions/clickhouse-cluster.js.map +1 -1
- package/dist/factories/clickhouse/resources/index.d.ts +1 -0
- package/dist/factories/clickhouse/resources/index.d.ts.map +1 -1
- package/dist/factories/clickhouse/resources/index.js +1 -0
- package/dist/factories/clickhouse/resources/index.js.map +1 -1
- package/dist/factories/clickhouse/resources/installation.d.ts.map +1 -1
- package/dist/factories/clickhouse/resources/installation.js +31 -4
- package/dist/factories/clickhouse/resources/installation.js.map +1 -1
- package/dist/factories/clickhouse/resources/s3-backup.d.ts +215 -0
- package/dist/factories/clickhouse/resources/s3-backup.d.ts.map +1 -0
- package/dist/factories/clickhouse/resources/s3-backup.js +410 -0
- package/dist/factories/clickhouse/resources/s3-backup.js.map +1 -0
- package/dist/factories/clickhouse/types.d.ts +416 -20
- package/dist/factories/clickhouse/types.d.ts.map +1 -1
- package/dist/factories/clickhouse/types.js +235 -11
- package/dist/factories/clickhouse/types.js.map +1 -1
- package/dist/factories/clickhouse/utils/helm-values-mapper.d.ts +42 -0
- package/dist/factories/clickhouse/utils/helm-values-mapper.d.ts.map +1 -1
- package/dist/factories/clickhouse/utils/helm-values-mapper.js +48 -0
- package/dist/factories/clickhouse/utils/helm-values-mapper.js.map +1 -1
- package/dist/factories/clickhouse/utils/index.d.ts +2 -0
- package/dist/factories/clickhouse/utils/index.d.ts.map +1 -1
- package/dist/factories/clickhouse/utils/index.js +2 -0
- package/dist/factories/clickhouse/utils/index.js.map +1 -1
- package/dist/factories/clickhouse/utils/s3-storage.d.ts +503 -0
- package/dist/factories/clickhouse/utils/s3-storage.d.ts.map +1 -0
- package/dist/factories/clickhouse/utils/s3-storage.js +1139 -0
- package/dist/factories/clickhouse/utils/s3-storage.js.map +1 -0
- package/dist/factories/clickhouse/utils/validation.d.ts +103 -0
- package/dist/factories/clickhouse/utils/validation.d.ts.map +1 -1
- package/dist/factories/clickhouse/utils/validation.js +129 -0
- package/dist/factories/clickhouse/utils/validation.js.map +1 -1
- package/dist/factories/clickhouse/utils/xml.d.ts +87 -0
- package/dist/factories/clickhouse/utils/xml.d.ts.map +1 -0
- package/dist/factories/clickhouse/utils/xml.js +151 -0
- package/dist/factories/clickhouse/utils/xml.js.map +1 -0
- package/dist/factories/clickstack/compositions/clickstack-bootstrap.d.ts +57 -0
- package/dist/factories/clickstack/compositions/clickstack-bootstrap.d.ts.map +1 -1
- package/dist/factories/clickstack/compositions/clickstack-bootstrap.js +266 -7
- package/dist/factories/clickstack/compositions/clickstack-bootstrap.js.map +1 -1
- package/dist/factories/clickstack/types.d.ts +205 -26
- package/dist/factories/clickstack/types.d.ts.map +1 -1
- package/dist/factories/clickstack/types.js +106 -8
- package/dist/factories/clickstack/types.js.map +1 -1
- package/dist/factories/clickstack/utils/collector-config.d.ts +104 -0
- package/dist/factories/clickstack/utils/collector-config.d.ts.map +1 -0
- package/dist/factories/clickstack/utils/collector-config.js +266 -0
- package/dist/factories/clickstack/utils/collector-config.js.map +1 -0
- package/dist/factories/clickstack/utils/helm-values-mapper.d.ts +26 -0
- package/dist/factories/clickstack/utils/helm-values-mapper.d.ts.map +1 -1
- package/dist/factories/clickstack/utils/helm-values-mapper.js +53 -12
- package/dist/factories/clickstack/utils/helm-values-mapper.js.map +1 -1
- package/dist/factories/clickstack/utils/index.d.ts +2 -0
- package/dist/factories/clickstack/utils/index.d.ts.map +1 -1
- package/dist/factories/clickstack/utils/index.js +2 -0
- package/dist/factories/clickstack/utils/index.js.map +1 -1
- package/dist/factories/clickstack/utils/storage.d.ts +449 -0
- package/dist/factories/clickstack/utils/storage.d.ts.map +1 -0
- package/dist/factories/clickstack/utils/storage.js +698 -0
- package/dist/factories/clickstack/utils/storage.js.map +1 -0
- package/dist/factories/cnpg/resources/helm.d.ts.map +1 -1
- package/dist/factories/cnpg/resources/helm.js +4 -4
- package/dist/factories/cnpg/resources/helm.js.map +1 -1
- package/dist/factories/cnpg/types.d.ts +10 -1
- package/dist/factories/cnpg/types.d.ts.map +1 -1
- package/dist/factories/cnpg/types.js.map +1 -1
- package/dist/factories/cnpg/utils/helm-values-mapper.d.ts +19 -2
- package/dist/factories/cnpg/utils/helm-values-mapper.d.ts.map +1 -1
- package/dist/factories/cnpg/utils/helm-values-mapper.js +22 -4
- package/dist/factories/cnpg/utils/helm-values-mapper.js.map +1 -1
- package/dist/factories/envoy-ai-gateway/compositions/gateway.d.ts.map +1 -1
- package/dist/factories/envoy-ai-gateway/compositions/gateway.js +16 -3
- package/dist/factories/envoy-ai-gateway/compositions/gateway.js.map +1 -1
- package/dist/factories/envoy-ai-gateway/constants.d.ts +5 -2
- package/dist/factories/envoy-ai-gateway/constants.d.ts.map +1 -1
- package/dist/factories/envoy-ai-gateway/constants.js +5 -2
- package/dist/factories/envoy-ai-gateway/constants.js.map +1 -1
- package/dist/factories/envoy-ai-gateway/resources/gateway.d.ts +12 -0
- package/dist/factories/envoy-ai-gateway/resources/gateway.d.ts.map +1 -1
- package/dist/factories/envoy-ai-gateway/resources/gateway.js +27 -104
- package/dist/factories/envoy-ai-gateway/resources/gateway.js.map +1 -1
- package/dist/factories/envoy-ai-gateway/types.d.ts +15 -47
- package/dist/factories/envoy-ai-gateway/types.d.ts.map +1 -1
- package/dist/factories/envoy-ai-gateway/types.js.map +1 -1
- package/dist/factories/gateway-api/constants.d.ts +27 -0
- package/dist/factories/gateway-api/constants.d.ts.map +1 -0
- package/dist/factories/gateway-api/constants.js +27 -0
- package/dist/factories/gateway-api/constants.js.map +1 -0
- package/dist/factories/gateway-api/index.d.ts +14 -0
- package/dist/factories/gateway-api/index.d.ts.map +1 -0
- package/dist/factories/gateway-api/index.js +14 -0
- package/dist/factories/gateway-api/index.js.map +1 -0
- package/dist/factories/gateway-api/readiness.d.ts +67 -0
- package/dist/factories/gateway-api/readiness.d.ts.map +1 -0
- package/dist/factories/gateway-api/readiness.js +213 -0
- package/dist/factories/gateway-api/readiness.js.map +1 -0
- package/dist/factories/gateway-api/resources/gateway.d.ts +91 -0
- package/dist/factories/gateway-api/resources/gateway.d.ts.map +1 -0
- package/dist/factories/gateway-api/resources/gateway.js +99 -0
- package/dist/factories/gateway-api/resources/gateway.js.map +1 -0
- package/dist/factories/gateway-api/resources/index.d.ts +2 -0
- package/dist/factories/gateway-api/resources/index.d.ts.map +1 -0
- package/dist/factories/gateway-api/resources/index.js +2 -0
- package/dist/factories/gateway-api/resources/index.js.map +1 -0
- package/dist/factories/gateway-api/types.d.ts +1269 -0
- package/dist/factories/gateway-api/types.d.ts.map +1 -0
- package/dist/factories/gateway-api/types.js +417 -0
- package/dist/factories/gateway-api/types.js.map +1 -0
- package/dist/factories/helm/readiness-evaluators.d.ts +21 -3
- package/dist/factories/helm/readiness-evaluators.d.ts.map +1 -1
- package/dist/factories/helm/readiness-evaluators.js +117 -11
- package/dist/factories/helm/readiness-evaluators.js.map +1 -1
- package/dist/factories/helm/types.d.ts +28 -0
- package/dist/factories/helm/types.d.ts.map +1 -1
- package/dist/factories/index.d.ts +2 -0
- package/dist/factories/index.d.ts.map +1 -1
- package/dist/factories/index.js +8 -0
- package/dist/factories/index.js.map +1 -1
- package/dist/factories/inngest/compositions/inngest-bootstrap.d.ts.map +1 -1
- package/dist/factories/inngest/compositions/inngest-bootstrap.js +10 -0
- package/dist/factories/inngest/compositions/inngest-bootstrap.js.map +1 -1
- package/dist/factories/kubernetes/admission/index.d.ts +2 -0
- package/dist/factories/kubernetes/admission/index.d.ts.map +1 -1
- package/dist/factories/kubernetes/admission/index.js +2 -0
- package/dist/factories/kubernetes/admission/index.js.map +1 -1
- package/dist/factories/kubernetes/admission/label-propagation-guard.d.ts +108 -0
- package/dist/factories/kubernetes/admission/label-propagation-guard.d.ts.map +1 -0
- package/dist/factories/kubernetes/admission/label-propagation-guard.js +247 -0
- package/dist/factories/kubernetes/admission/label-propagation-guard.js.map +1 -0
- package/dist/factories/kubernetes/admission/mutating-admission-policy.d.ts +286 -0
- package/dist/factories/kubernetes/admission/mutating-admission-policy.d.ts.map +1 -0
- package/dist/factories/kubernetes/admission/mutating-admission-policy.js +157 -0
- package/dist/factories/kubernetes/admission/mutating-admission-policy.js.map +1 -0
- package/dist/factories/opensearch/compositions/cluster.d.ts.map +1 -1
- package/dist/factories/opensearch/compositions/cluster.js +6 -1
- package/dist/factories/opensearch/compositions/cluster.js.map +1 -1
- package/dist/factories/ory/compositions/ory-identity-stack.d.ts +8 -8
- package/dist/factories/ory/types.d.ts +16 -16
- package/dist/factories/rook/compositions/object-storage-claim.d.ts +1 -1
- package/dist/factories/rook/compositions/rook-ceph-platform.js +8 -1
- package/dist/factories/rook/compositions/rook-ceph-platform.js.map +1 -1
- package/dist/factories/rook/types.d.ts +1 -1
- package/dist/factories/searxng/compositions/searxng-bootstrap.d.ts +1 -1
- package/dist/factories/searxng/compositions/searxng-bootstrap.d.ts.map +1 -1
- package/dist/factories/searxng/compositions/searxng-bootstrap.js +18 -13
- package/dist/factories/searxng/compositions/searxng-bootstrap.js.map +1 -1
- package/dist/factories/searxng/index.d.ts +3 -0
- package/dist/factories/searxng/index.d.ts.map +1 -1
- package/dist/factories/searxng/index.js +3 -0
- package/dist/factories/searxng/index.js.map +1 -1
- package/dist/factories/searxng/types.js +1 -1
- package/dist/factories/searxng/types.js.map +1 -1
- package/dist/factories/traefik/compositions/index.d.ts +6 -0
- package/dist/factories/traefik/compositions/index.d.ts.map +1 -0
- package/dist/factories/traefik/compositions/index.js +6 -0
- package/dist/factories/traefik/compositions/index.js.map +1 -0
- package/dist/factories/traefik/compositions/traefik-bootstrap.d.ts +185 -0
- package/dist/factories/traefik/compositions/traefik-bootstrap.d.ts.map +1 -0
- package/dist/factories/traefik/compositions/traefik-bootstrap.js +339 -0
- package/dist/factories/traefik/compositions/traefik-bootstrap.js.map +1 -0
- package/dist/factories/traefik/compositions/traefik-helm-repository.d.ts +16 -0
- package/dist/factories/traefik/compositions/traefik-helm-repository.d.ts.map +1 -0
- package/dist/factories/traefik/compositions/traefik-helm-repository.js +31 -0
- package/dist/factories/traefik/compositions/traefik-helm-repository.js.map +1 -0
- package/dist/factories/traefik/constants.d.ts +78 -0
- package/dist/factories/traefik/constants.d.ts.map +1 -0
- package/dist/factories/traefik/constants.js +104 -0
- package/dist/factories/traefik/constants.js.map +1 -0
- package/dist/factories/traefik/index.d.ts +25 -0
- package/dist/factories/traefik/index.d.ts.map +1 -0
- package/dist/factories/traefik/index.js +25 -0
- package/dist/factories/traefik/index.js.map +1 -0
- package/dist/factories/traefik/resources/common.d.ts +68 -0
- package/dist/factories/traefik/resources/common.d.ts.map +1 -0
- package/dist/factories/traefik/resources/common.js +59 -0
- package/dist/factories/traefik/resources/common.js.map +1 -0
- package/dist/factories/traefik/resources/gateway.d.ts +85 -0
- package/dist/factories/traefik/resources/gateway.d.ts.map +1 -0
- package/dist/factories/traefik/resources/gateway.js +109 -0
- package/dist/factories/traefik/resources/gateway.js.map +1 -0
- package/dist/factories/traefik/resources/helm.d.ts +56 -0
- package/dist/factories/traefik/resources/helm.d.ts.map +1 -0
- package/dist/factories/traefik/resources/helm.js +131 -0
- package/dist/factories/traefik/resources/helm.js.map +1 -0
- package/dist/factories/traefik/resources/index.d.ts +10 -0
- package/dist/factories/traefik/resources/index.d.ts.map +1 -0
- package/dist/factories/traefik/resources/index.js +10 -0
- package/dist/factories/traefik/resources/index.js.map +1 -0
- package/dist/factories/traefik/resources/middleware.d.ts +169 -0
- package/dist/factories/traefik/resources/middleware.d.ts.map +1 -0
- package/dist/factories/traefik/resources/middleware.js +225 -0
- package/dist/factories/traefik/resources/middleware.js.map +1 -0
- package/dist/factories/traefik/resources/routing.d.ts +113 -0
- package/dist/factories/traefik/resources/routing.d.ts.map +1 -0
- package/dist/factories/traefik/resources/routing.js +119 -0
- package/dist/factories/traefik/resources/routing.js.map +1 -0
- package/dist/factories/traefik/resources/tls.d.ts +85 -0
- package/dist/factories/traefik/resources/tls.d.ts.map +1 -0
- package/dist/factories/traefik/resources/tls.js +93 -0
- package/dist/factories/traefik/resources/tls.js.map +1 -0
- package/dist/factories/traefik/types.d.ts +2690 -0
- package/dist/factories/traefik/types.d.ts.map +1 -0
- package/dist/factories/traefik/types.js +1084 -0
- package/dist/factories/traefik/types.js.map +1 -0
- package/dist/factories/traefik/utils/helm-values-mapper.d.ts +198 -0
- package/dist/factories/traefik/utils/helm-values-mapper.d.ts.map +1 -0
- package/dist/factories/traefik/utils/helm-values-mapper.js +372 -0
- package/dist/factories/traefik/utils/helm-values-mapper.js.map +1 -0
- package/dist/factories/traefik/utils/index.d.ts +6 -0
- package/dist/factories/traefik/utils/index.d.ts.map +1 -0
- package/dist/factories/traefik/utils/index.js +6 -0
- package/dist/factories/traefik/utils/index.js.map +1 -0
- package/dist/factories/traefik/utils/middleware-validation.d.ts +42 -0
- package/dist/factories/traefik/utils/middleware-validation.d.ts.map +1 -0
- package/dist/factories/traefik/utils/middleware-validation.js +78 -0
- package/dist/factories/traefik/utils/middleware-validation.js.map +1 -0
- package/dist/factories/webapp/compositions/web-app-with-processing.d.ts.map +1 -1
- package/dist/factories/webapp/compositions/web-app-with-processing.js +10 -0
- package/dist/factories/webapp/compositions/web-app-with-processing.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +9 -1
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dropped status-leaf validation for KRO mode.
|
|
3
|
+
*
|
|
4
|
+
* THE RULE: a KRO status field must reference at least one RESOURCE in the
|
|
5
|
+
* graph. KRO's own instance builder enforces exactly that — `instance status
|
|
6
|
+
* field must refer to a resource` (KRO `builder.go`, quoted in
|
|
7
|
+
* `kro-instance-safety.ts`) — and its status CEL environment has no `schema`
|
|
8
|
+
* identifier at all. A status expression with no resource in it therefore has
|
|
9
|
+
* nothing to project from and is left unset on the instance. The declared
|
|
10
|
+
* status schema then promises a field the custom resource never carries, and
|
|
11
|
+
* every consumer that reads the CR directly (kubectl, another controller, an
|
|
12
|
+
* `externalRef` from a second composition) sees `undefined`.
|
|
13
|
+
*
|
|
14
|
+
* Two shapes have no resource in them, and KRO drops BOTH the same way:
|
|
15
|
+
*
|
|
16
|
+
* - a bare LITERAL — a string, number, boolean, literal array/object, or a
|
|
17
|
+
* reference-free CEL expression such as `Cel.expr`'running'``;
|
|
18
|
+
* - a bare SCHEMA REFERENCE — `schema.spec.foo` standing alone in a status
|
|
19
|
+
* leaf. It looks resolvable (the CR does hold that value in its own spec),
|
|
20
|
+
* but a status leaf is a PROJECTION, and there is no resource here to
|
|
21
|
+
* project from. TypeKro's own serializer already agrees: it classifies a
|
|
22
|
+
* schema-only status field as "static" and excludes it from the emitted
|
|
23
|
+
* status block — see invariant I1/I2 in
|
|
24
|
+
* `test/unit/nested-composition-kro-serialization.test.ts` ("KRO status CEL
|
|
25
|
+
* does NOT support `schema.spec.*`"), the same conclusion in
|
|
26
|
+
* `src/core/proxy/create-resource.ts` ("classifies the resulting status
|
|
27
|
+
* field as schema-derived and drops it from the live KRO CR's status
|
|
28
|
+
* entirely"), and `assertNoHoistWeakenedStatusFields`, which already THROWS
|
|
29
|
+
* for precisely this shape when a hoisted Namespace leaves a field
|
|
30
|
+
* schema-only. This module simply makes the general case agree with that
|
|
31
|
+
* special one.
|
|
32
|
+
*
|
|
33
|
+
* What stays valid is any expression ANCHORED on a resource. A mixed template
|
|
34
|
+
* such as `` `http://${schema.spec.name}-svc:${svc.spec.ports[0].port}` `` is
|
|
35
|
+
* fine: the resource reference gives KRO the dependency it requires, and
|
|
36
|
+
* `schema.spec.*` resolves against the instance's own spec from there. The
|
|
37
|
+
* serializer deliberately preserves those (`cel-references.ts`: "Plain CR spec
|
|
38
|
+
* fields must remain `schema.spec.*`"), and
|
|
39
|
+
* `nested-composition-kro-serialization.test.ts` pins the emitted shape. So the
|
|
40
|
+
* test is not "does this mention `schema`" but "does this reference a
|
|
41
|
+
* resource".
|
|
42
|
+
*
|
|
43
|
+
* TypeKro classified both dropped shapes as "static" and hydrated them
|
|
44
|
+
* client-side in `getStatus()`, which hides the gap from the composition's own
|
|
45
|
+
* author while leaving it wide open for everybody else. This module finds those
|
|
46
|
+
* leaves at serialization time so the author is told before the RGD ships.
|
|
47
|
+
*
|
|
48
|
+
* Direct mode is unaffected — there is no KRO reconciler in that path and the
|
|
49
|
+
* status object is assembled locally, so literals and schema refs are perfectly
|
|
50
|
+
* fine there. The check therefore runs only from the KRO schema emitter.
|
|
51
|
+
*
|
|
52
|
+
* See issue #188.
|
|
53
|
+
*/
|
|
54
|
+
import { KUBERNETES_REF_MARKER_SOURCE, KUBERNETES_REF_SCHEMA_MARKER_SOURCE, } from '../../shared/brands.js';
|
|
55
|
+
import { celRootReferences, kubernetesMarkerReferences, } from '../../utils/cel-resource-identifiers.js';
|
|
56
|
+
import { isCelExpression, isKubernetesRef } from '../../utils/type-guards.js';
|
|
57
|
+
import { lookupNestedExpression } from '../serialization/cel-references.js';
|
|
58
|
+
/** Longest rendered literal included in a diagnostic before truncation. */
|
|
59
|
+
const MAX_RENDERED_LITERAL_LENGTH = 60;
|
|
60
|
+
/**
|
|
61
|
+
* CEL roots that are NOT a resource: the instance's own spec, in both the
|
|
62
|
+
* pre-rewrite (`__schema__`) and emitted (`schema`) spellings.
|
|
63
|
+
*/
|
|
64
|
+
const SCHEMA_REFERENCE_ROOTS = new Set(['schema', '__schema__']);
|
|
65
|
+
const REF_MARKER_PATTERN = new RegExp(KUBERNETES_REF_MARKER_SOURCE, 'g');
|
|
66
|
+
const SCHEMA_REF_MARKER_PATTERN = new RegExp(KUBERNETES_REF_SCHEMA_MARKER_SOURCE);
|
|
67
|
+
/**
|
|
68
|
+
* Blank every TypeKro ref marker out of an expression before CEL analysis.
|
|
69
|
+
*
|
|
70
|
+
* Markers are read by {@link kubernetesMarkerReferences}, never by the CEL
|
|
71
|
+
* parser: a marker's own text (`__KUBERNETES_REF___schema___spec_name__`) is a
|
|
72
|
+
* legal CEL identifier, so leaving it in place would make a SCHEMA marker parse
|
|
73
|
+
* as a root named `__KUBERNETES_REF___schema___spec` — i.e. read as a resource.
|
|
74
|
+
* Replacing each with an empty string literal keeps the surrounding expression
|
|
75
|
+
* parseable while contributing no references of its own.
|
|
76
|
+
*/
|
|
77
|
+
function stripRefMarkers(expression) {
|
|
78
|
+
return expression.replace(REF_MARKER_PATTERN, '""');
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Does this CEL expression reference at least one RESOURCE?
|
|
82
|
+
*
|
|
83
|
+
* Handles every expression shape the status analyzer produces: ref markers,
|
|
84
|
+
* KRO mixed templates (`http://${svc.status.clusterIP}`), and plain CEL
|
|
85
|
+
* (`deploy.status.readyReplicas > 0`).
|
|
86
|
+
*
|
|
87
|
+
* `kubernetesMarkerReferences` already drops the `__schema__` root, so a marker
|
|
88
|
+
* hit is by construction a resource. For the parsed form, a root of `schema` /
|
|
89
|
+
* `__schema__` is the instance's own spec rather than a resource, so it does
|
|
90
|
+
* not anchor the leaf.
|
|
91
|
+
*
|
|
92
|
+
* A reference-free expression — `'"web"'`, `'41.5'`, `'true'` — is a literal in
|
|
93
|
+
* CEL clothing and gets dropped exactly like a bare literal would.
|
|
94
|
+
*
|
|
95
|
+
* CEL string literals never surface as identifier nodes and macro-bound lambda
|
|
96
|
+
* variables are excluded, so `['a','b'].map(x, x)` does not read as a
|
|
97
|
+
* reference to `x`.
|
|
98
|
+
*/
|
|
99
|
+
function expressionReferencesResource(expression) {
|
|
100
|
+
if (kubernetesMarkerReferences(expression).length > 0)
|
|
101
|
+
return true;
|
|
102
|
+
return celRootReferences(stripRefMarkers(expression)).some((reference) => !SCHEMA_REFERENCE_ROOTS.has(reference.root));
|
|
103
|
+
}
|
|
104
|
+
/** Does this CEL expression mention the instance's own spec? */
|
|
105
|
+
function expressionReferencesSchema(expression) {
|
|
106
|
+
if (SCHEMA_REF_MARKER_PATTERN.test(expression))
|
|
107
|
+
return true;
|
|
108
|
+
return celRootReferences(stripRefMarkers(expression)).some((reference) => SCHEMA_REFERENCE_ROOTS.has(reference.root));
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Is this plain status string safe to hand to the CEL analyzer at all?
|
|
112
|
+
*
|
|
113
|
+
* A plain string is ordinary data, not CEL, so it must never be analyzed
|
|
114
|
+
* wholesale: `'http://static.example.test'` would parse as the identifiers
|
|
115
|
+
* `http`, `static`, `example` and `test` and read as four references to
|
|
116
|
+
* resources that do not exist. Only two shapes are expressions:
|
|
117
|
+
*
|
|
118
|
+
* - a TypeKro ref marker, resource (`__KUBERNETES_REF_<id>_<path>__`) or
|
|
119
|
+
* schema (`__KUBERNETES_REF___schema___spec.name__`);
|
|
120
|
+
* - a `${...}` interpolation, which the status analyzer emits for a mixed
|
|
121
|
+
* template or an already-converted CEL expression. Those DO get analyzed,
|
|
122
|
+
* so a hand-written `${"idle"}` is still caught.
|
|
123
|
+
*/
|
|
124
|
+
function stringIsExpression(value) {
|
|
125
|
+
return value.includes('__KUBERNETES_REF_') || value.includes('${');
|
|
126
|
+
}
|
|
127
|
+
/** Does this plain status string reference at least one resource? */
|
|
128
|
+
function stringReferencesResource(value) {
|
|
129
|
+
return stringIsExpression(value) && expressionReferencesResource(value);
|
|
130
|
+
}
|
|
131
|
+
/** Does this plain status string reference the instance's own spec? */
|
|
132
|
+
function stringReferencesSchema(value) {
|
|
133
|
+
return stringIsExpression(value) && expressionReferencesSchema(value);
|
|
134
|
+
}
|
|
135
|
+
function renderLiteral(value) {
|
|
136
|
+
const rendered = value === undefined
|
|
137
|
+
? 'undefined'
|
|
138
|
+
: typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean'
|
|
139
|
+
? JSON.stringify(value)
|
|
140
|
+
: (JSON.stringify(value) ?? String(value));
|
|
141
|
+
return rendered.length > MAX_RENDERED_LITERAL_LENGTH
|
|
142
|
+
? `${rendered.slice(0, MAX_RENDERED_LITERAL_LENGTH)}…`
|
|
143
|
+
: rendered;
|
|
144
|
+
}
|
|
145
|
+
function isPlainStatusObject(value) {
|
|
146
|
+
return (typeof value === 'object' &&
|
|
147
|
+
value !== null &&
|
|
148
|
+
!Array.isArray(value) &&
|
|
149
|
+
!isKubernetesRef(value) &&
|
|
150
|
+
!isCelExpression(value));
|
|
151
|
+
}
|
|
152
|
+
/** Is this ref the instance's own spec rather than a graph resource? */
|
|
153
|
+
function isSchemaRef(value) {
|
|
154
|
+
return SCHEMA_REFERENCE_ROOTS.has(value.resourceId);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Put ref markers back into the form the author would recognise:
|
|
158
|
+
* `__KUBERNETES_REF___schema___spec.name__` reads as `${schema.spec.name}`.
|
|
159
|
+
*
|
|
160
|
+
* Markers are an internal encoding of template-literal analysis. Printing one
|
|
161
|
+
* raw makes the diagnostic look like a TypeKro bug rather than a description of
|
|
162
|
+
* the author's own status field.
|
|
163
|
+
*/
|
|
164
|
+
function humanizeRefMarkers(expression) {
|
|
165
|
+
return expression.replace(REF_MARKER_PATTERN, (_match, root, fieldPath) => {
|
|
166
|
+
const readableRoot = root === '__schema__' ? 'schema' : root;
|
|
167
|
+
return `\${${readableRoot}.${fieldPath}}`;
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Render an expression as itself, unquoted — `schema.spec.foo`, not
|
|
172
|
+
* `"schema.spec.foo"`. Quoting a reference would read as a string literal and
|
|
173
|
+
* misdescribe what the author actually wrote.
|
|
174
|
+
*/
|
|
175
|
+
function renderExpression(expression) {
|
|
176
|
+
const readable = humanizeRefMarkers(expression);
|
|
177
|
+
return readable.length > MAX_RENDERED_LITERAL_LENGTH
|
|
178
|
+
? `${readable.slice(0, MAX_RENDERED_LITERAL_LENGTH)}…`
|
|
179
|
+
: readable;
|
|
180
|
+
}
|
|
181
|
+
/** Render a bare schema ref the way the author wrote it: `schema.spec.foo`. */
|
|
182
|
+
function renderSchemaRef(fieldPath) {
|
|
183
|
+
return renderExpression(`schema.${fieldPath.replace(/^schema\./, '')}`);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Classify an expression that has already been found to reference no resource.
|
|
187
|
+
*/
|
|
188
|
+
function droppedExpressionLeaf(path, expression) {
|
|
189
|
+
return expressionReferencesSchema(expression)
|
|
190
|
+
? { path, literal: renderExpression(expression), kind: 'schema-reference' }
|
|
191
|
+
: { path, literal: renderLiteral(expression), kind: 'literal' };
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Walk one status value, appending every leaf KRO would drop from beneath it.
|
|
195
|
+
*/
|
|
196
|
+
function collectLeaves(value, path, nestedStatusCel, found) {
|
|
197
|
+
if (isKubernetesRef(value)) {
|
|
198
|
+
const nestedRef = value.__nestedComposition === true;
|
|
199
|
+
if (!nestedRef) {
|
|
200
|
+
// A projection of a graph resource anchors the leaf and is exactly what
|
|
201
|
+
// KRO wants. A bare `schema.spec.*` does not: it is the instance's own
|
|
202
|
+
// spec, not a resource, so KRO has nothing to project and leaves the
|
|
203
|
+
// field unset — the same outcome as a literal, by the same mechanism.
|
|
204
|
+
if (isSchemaRef(value) && typeof value.fieldPath === 'string') {
|
|
205
|
+
found.push({
|
|
206
|
+
path,
|
|
207
|
+
literal: renderSchemaRef(value.fieldPath),
|
|
208
|
+
kind: 'schema-reference',
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (!nestedStatusCel || typeof value.fieldPath !== 'string')
|
|
214
|
+
return;
|
|
215
|
+
// A nested composition's status field is only as projectable as the
|
|
216
|
+
// expression the inner composition put behind it: `outer.ready` is a
|
|
217
|
+
// dropped leaf when the inner `ready` was `true`, and equally when it was a
|
|
218
|
+
// `schema.spec` passthrough — flattening does not give either one a
|
|
219
|
+
// resource to project from. Resolve one level and classify what is actually
|
|
220
|
+
// there. An unresolvable reference is left alone —
|
|
221
|
+
// `validateStatusCelExpressions` reports those structurally.
|
|
222
|
+
const innerExpression = lookupNestedExpression(value.resourceId, value.fieldPath.replace(/^status\./, ''), nestedStatusCel);
|
|
223
|
+
if (innerExpression !== undefined && !expressionReferencesResource(innerExpression)) {
|
|
224
|
+
found.push(droppedExpressionLeaf(path, innerExpression));
|
|
225
|
+
}
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (isCelExpression(value)) {
|
|
229
|
+
if (!expressionReferencesResource(value.expression)) {
|
|
230
|
+
found.push(droppedExpressionLeaf(path, value.expression));
|
|
231
|
+
}
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (Array.isArray(value)) {
|
|
235
|
+
// An empty array is itself the dropped value — there are no elements to
|
|
236
|
+
// blame, so report the field.
|
|
237
|
+
if (value.length === 0) {
|
|
238
|
+
found.push({ path, literal: '[]', kind: 'literal' });
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
value.forEach((item, index) => {
|
|
242
|
+
collectLeaves(item, `${path}[${index}]`, nestedStatusCel, found);
|
|
243
|
+
});
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (isPlainStatusObject(value)) {
|
|
247
|
+
const entries = Object.entries(value).filter(([key]) => !key.startsWith('__'));
|
|
248
|
+
if (entries.length === 0) {
|
|
249
|
+
found.push({ path, literal: '{}', kind: 'literal' });
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
for (const [key, nested] of entries) {
|
|
253
|
+
if (nested === undefined)
|
|
254
|
+
continue;
|
|
255
|
+
collectLeaves(nested, `${path}.${key}`, nestedStatusCel, found);
|
|
256
|
+
}
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
// Template-literal analysis leaves ref markers and `${...}` interpolations in
|
|
260
|
+
// plain strings; only those are expressions, and only a resource inside one
|
|
261
|
+
// anchors the leaf. Everything else here is bare data.
|
|
262
|
+
if (typeof value === 'string') {
|
|
263
|
+
if (!stringReferencesResource(value)) {
|
|
264
|
+
found.push(stringReferencesSchema(value)
|
|
265
|
+
? { path, literal: renderExpression(value), kind: 'schema-reference' }
|
|
266
|
+
: { path, literal: renderLiteral(value), kind: 'literal' });
|
|
267
|
+
}
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
if (value === undefined)
|
|
271
|
+
return;
|
|
272
|
+
found.push({ path, literal: renderLiteral(value), kind: 'literal' });
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Find every status leaf that KRO would leave unset.
|
|
276
|
+
*
|
|
277
|
+
* `statusMappings` is the analyzed status mapping (post-CEL-conversion,
|
|
278
|
+
* pre-static/dynamic split) — the split is exactly what hides the problem, so
|
|
279
|
+
* the walk has to happen before it.
|
|
280
|
+
*/
|
|
281
|
+
export function findLiteralStatusLeaves(statusMappings, nestedStatusCel) {
|
|
282
|
+
if (!statusMappings || typeof statusMappings !== 'object')
|
|
283
|
+
return [];
|
|
284
|
+
const found = [];
|
|
285
|
+
for (const [fieldName, fieldValue] of Object.entries(statusMappings)) {
|
|
286
|
+
// Internal serialization metadata, not user-facing status.
|
|
287
|
+
if (fieldName.startsWith('__') || fieldValue === undefined)
|
|
288
|
+
continue;
|
|
289
|
+
collectLeaves(fieldValue, `status.${fieldName}`, nestedStatusCel, found);
|
|
290
|
+
}
|
|
291
|
+
return found;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Human-readable diagnostic for a set of dropped status leaves.
|
|
295
|
+
*/
|
|
296
|
+
export function formatLiteralStatusLeaves(leaves) {
|
|
297
|
+
const paths = leaves
|
|
298
|
+
.map((leaf) => ` - ${leaf.path} = ${leaf.literal}` +
|
|
299
|
+
(leaf.kind === 'schema-reference' ? ' (schema reference — no resource to project from)' : ''))
|
|
300
|
+
.join('\n');
|
|
301
|
+
const schemaNote = leaves.some((leaf) => leaf.kind === 'schema-reference')
|
|
302
|
+
? ' A bare `schema.spec.*` is dropped for the same reason a literal is: KRO requires every ' +
|
|
303
|
+
'status field to refer to a resource, and its status CEL has no `schema` identifier. It ' +
|
|
304
|
+
'stays valid INSIDE an expression that also references a resource — a template ' +
|
|
305
|
+
'interpolating both `myService.metadata.name` and `schema.spec.namespace` is anchored by ' +
|
|
306
|
+
'the resource, and the spec value resolves from there. To surface a spec value on its ' +
|
|
307
|
+
'own, project it through a resource this graph owns: echo it into a ConfigMap (or an ' +
|
|
308
|
+
'annotation) you create and read it back.'
|
|
309
|
+
: '';
|
|
310
|
+
return ("KRO fills a status field only from the graph's own resources, so it leaves these fields " +
|
|
311
|
+
'unset and the declared status schema would promise ' +
|
|
312
|
+
`${leaves.length === 1 ? 'a field' : 'fields'} the instance never carries:\n${paths}\n` +
|
|
313
|
+
'Project each leaf from a resource this graph owns (for example, put the value in a ' +
|
|
314
|
+
'ConfigMap you create and reference `myConfigMap.data.<key>`), or remove the field from ' +
|
|
315
|
+
`the status schema.${schemaNote} Set \`allowLiteralStatus: true\` to log these paths instead ` +
|
|
316
|
+
'of failing while migrating.');
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Default for `allowLiteralStatus` — i.e. whether a literal status leaf warns
|
|
320
|
+
* rather than throwing.
|
|
321
|
+
*
|
|
322
|
+
* `true` (warn) for now. The check is correct and the diagnostic is actionable,
|
|
323
|
+
* but literal status leaves are not a rare mistake in existing code: turning
|
|
324
|
+
* this on as a hard error against the repository's own suite rejected 377
|
|
325
|
+
* serializations across 69 test files and every bootstrap composition listed in
|
|
326
|
+
* `test/unit/literal-status-repo-scan.test.ts`. Shipping that as a patch-level
|
|
327
|
+
* error would break every downstream composition using the same shape, with no
|
|
328
|
+
* migration window.
|
|
329
|
+
*
|
|
330
|
+
* So: warn by default, and let a composition (or a CI job, via the factory
|
|
331
|
+
* option) opt into the error with `allowLiteralStatus: false` today. Flip this
|
|
332
|
+
* constant to `false` in the next major once the bundled compositions are
|
|
333
|
+
* projections — that single edit is the whole migration.
|
|
334
|
+
*/
|
|
335
|
+
export const DEFAULT_ALLOW_LITERAL_STATUS = true;
|
|
336
|
+
/**
|
|
337
|
+
* Resolve the effective `allowLiteralStatus` setting.
|
|
338
|
+
*
|
|
339
|
+
* A factory-level setting wins over the composition's own, so a CI job can run
|
|
340
|
+
* `graph.factory('kro', { allowLiteralStatus: false }).toYaml()` to enforce
|
|
341
|
+
* projection across compositions it does not own.
|
|
342
|
+
*/
|
|
343
|
+
export function resolveAllowLiteralStatus(factoryOption, compositionOption) {
|
|
344
|
+
return factoryOption ?? compositionOption ?? DEFAULT_ALLOW_LITERAL_STATUS;
|
|
345
|
+
}
|
|
346
|
+
//# sourceMappingURL=literal-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"literal-status.js","sourceRoot":"","sources":["../../../src/core/validation/literal-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,EACL,4BAA4B,EAC5B,mCAAmC,GACpC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,yCA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AAO,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;QACpC,CAAC,IAAI,CAAC,IAAI,KAAK,kBAAkB,CAAC,CAAC,CAAC,mDAAmD,CAAC,CAAC,CAAC,EAAE,CAAC,CAChG;SACA,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,kBAAkB,CAAC;QACxE,CAAC,CAAC,0FAA0F;YAC1F,yFAAyF;YACzF,gFAAgF;YAChF,0FAA0F;YAC1F,uFAAuF;YACvF,sFAAsF;YACtF,0CAA0C;QAC5C,CAAC,CAAC,EAAE,CAAC;IACP,OAAO,CACL,0FAA0F;QAC1F,qDAAqD;QACrD,GAAG,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,iCAAiC,KAAK,IAAI;QACvF,qFAAqF;QACrF,yFAAyF;QACzF,qBAAqB,UAAU,+DAA+D;QAC9F,6BAA6B,CAC9B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,aAAkC,EAClC,iBAAsC;IAEtC,OAAO,aAAa,IAAI,iBAAiB,IAAI,4BAA4B,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural spec-dependence diagnostics.
|
|
3
|
+
*
|
|
4
|
+
* ## The rule
|
|
5
|
+
*
|
|
6
|
+
* A `ResourceGraphDefinition` is fixed at build time. `schema.spec.*` values
|
|
7
|
+
* are *runtime* references: KRO substitutes them per instance, long after the
|
|
8
|
+
* composition function has run. So a spec value may decide what a field
|
|
9
|
+
* **contains** (a value position), but it may never decide what the graph
|
|
10
|
+
* **looks like** — which resources exist, how many list entries there are, or
|
|
11
|
+
* what an object's keys are called (a structural position).
|
|
12
|
+
*
|
|
13
|
+
* When a composition puts a spec value in a structural position, the
|
|
14
|
+
* composition function still runs: the schema proxy hands the author a
|
|
15
|
+
* `KubernetesRef` and JavaScript does something plausible-but-wrong with it.
|
|
16
|
+
* An `if` takes the truthy branch because a proxy object is truthy. A `.map()`
|
|
17
|
+
* runs exactly once against a sentinel element. `Object.keys()` yields one
|
|
18
|
+
* fabricated key. The RGD that comes out is well-formed and silently encodes
|
|
19
|
+
* the build-time guess for every instance.
|
|
20
|
+
*
|
|
21
|
+
* This module turns that silence into a KRO-mode serialization error.
|
|
22
|
+
*
|
|
23
|
+
* ## What is detected
|
|
24
|
+
*
|
|
25
|
+
* Two independent detectors, deliberately narrow so that legitimate
|
|
26
|
+
* value-position uses (`replicas: spec.replicas`, `` url: `http://${spec.host}` ``,
|
|
27
|
+
* CEL ternaries in status) stay silent:
|
|
28
|
+
*
|
|
29
|
+
* 1. {@link scanRgdResourcesForStructuralSpecArtifacts} — reads the RGD that is
|
|
30
|
+
* about to be emitted and reports build-time residue that can only come from
|
|
31
|
+
* a structural use. This is evidence-based: every finding is a concrete
|
|
32
|
+
* artifact in the output, so there are no false positives by construction.
|
|
33
|
+
* - `spec-derived-key`: an object key (or resource id) that is a schema
|
|
34
|
+
* reference marker — `{ [spec.key]: v }`, or `Object.fromEntries(...)`
|
|
35
|
+
* over a spec collection.
|
|
36
|
+
* - `runtime-map-enumerated`: the `__typekroSchemaKey` sentinel, which the
|
|
37
|
+
* schema proxy hands out when a composition enumerates a
|
|
38
|
+
* `Record<string, V>` spec field (`Object.keys(spec.settings)`,
|
|
39
|
+
* `{ ...spec.settings }`) whose keys are not knowable until runtime.
|
|
40
|
+
* - `collection-length-collapsed`: a `$item` element sentinel surviving in
|
|
41
|
+
* a resource that carries no `forEach` dimension — a `.map()` / `for-of`
|
|
42
|
+
* over a spec collection that was flattened to a single element instead
|
|
43
|
+
* of being compiled to KRO's `forEach`. A backstop: the serializer
|
|
44
|
+
* normally rewrites `$item` either into a `forEach` loop variable or
|
|
45
|
+
* into a whole-array reference (`ports: ${schema.spec.ports}`), both of
|
|
46
|
+
* which are correct, so this catches only what those miss.
|
|
47
|
+
*
|
|
48
|
+
* 2. {@link detectStructuralSpecPredicates} — parses the composition source and
|
|
49
|
+
* reports branch predicates that are spec-derived in a form the control-flow
|
|
50
|
+
* analyzer cannot compile to `includeWhen`, so the branch was decided at
|
|
51
|
+
* build time:
|
|
52
|
+
* - `uncompiled-predicate`: the `if` / ternary test reaches the spec only
|
|
53
|
+
* through a local binding (`const enabled = spec.enabled; if (enabled)`,
|
|
54
|
+
* `const { enabled } = spec;`), so the analyzer's lexical `spec` check
|
|
55
|
+
* misses it and no `includeWhen` is attached.
|
|
56
|
+
* - `switch-discriminator`: a `switch` on a spec-derived discriminant.
|
|
57
|
+
* There is no `switch` lowering at all; the proxy matches no `case`, so
|
|
58
|
+
* `default` wins for every instance.
|
|
59
|
+
* - `collection-length-read`: `.length` on a spec-derived collection or
|
|
60
|
+
* string. The proxy always answers `1`, so the value is a build-time
|
|
61
|
+
* constant no matter what the instance holds.
|
|
62
|
+
*
|
|
63
|
+
* A branch only counts when it BUILDS something. That question is settled
|
|
64
|
+
* by an allowlist, not by the callee's name: nothing in the source says
|
|
65
|
+
* whether an imported binding is a factory, and casing least of all — most
|
|
66
|
+
* of this repo's factories are camelCase (`helmRelease`, `serviceAccount`,
|
|
67
|
+
* `persistentVolumeClaim`, `observedResource`, `singleton`). So any call in
|
|
68
|
+
* the branch counts as building structure unless it is a pure JavaScript
|
|
69
|
+
* builtin (`String(…)`, `JSON.stringify(…)`, `Math.max(…)`, `items.map(…)`)
|
|
70
|
+
* or a `Cel.*` runtime expression. See {@link isPureHelperCall}.
|
|
71
|
+
*
|
|
72
|
+
* ## What is NOT detected
|
|
73
|
+
*
|
|
74
|
+
* Static analysis of arbitrary JavaScript cannot be complete, and this check
|
|
75
|
+
* does not pretend otherwise. Known blind spots:
|
|
76
|
+
*
|
|
77
|
+
* - A predicate laundered through a **helper function** or a module-level
|
|
78
|
+
* constant: `if (isEnabled(spec))`. The alias resolver only walks
|
|
79
|
+
* top-level `const`/`let` bindings in the composition body.
|
|
80
|
+
* - A predicate on a value read back **out of a resource** rather than off
|
|
81
|
+
* the spec proxy.
|
|
82
|
+
* - Structure decided by a spec value that is **consumed by a factory** and
|
|
83
|
+
* collapsed inside it, if the collapse leaves no marker, sentinel or
|
|
84
|
+
* `$item` residue in the emitted RGD.
|
|
85
|
+
* - A branch whose only call is a **method named like a builtin**
|
|
86
|
+
* (`registry.push(…)`, `catalog.map(…)`): the pure-helper allowlist matches
|
|
87
|
+
* on the method name without resolving the receiver, so such a call is
|
|
88
|
+
* assumed pure. No factory in `src/factories/**` carries one of those
|
|
89
|
+
* names, and a new one must not.
|
|
90
|
+
* - Anything reached through `eval`, dynamic imports, or a composition whose
|
|
91
|
+
* source cannot be parsed (the AST detector degrades to silence, never to
|
|
92
|
+
* a false positive).
|
|
93
|
+
*
|
|
94
|
+
* Detector 1 is the backstop for most of these: however the structure was
|
|
95
|
+
* decided, if the decision left residue in the RGD it is reported.
|
|
96
|
+
*/
|
|
97
|
+
import { TypeKroError } from '../errors.js';
|
|
98
|
+
import type { KroResourceTemplate } from '../types/serialization.js';
|
|
99
|
+
/** How a runtime spec value ended up deciding build-time structure. */
|
|
100
|
+
export type StructuralSpecDependenceKind = 'spec-derived-key' | 'runtime-map-enumerated' | 'collection-length-collapsed' | 'uncompiled-predicate' | 'switch-discriminator' | 'collection-length-read';
|
|
101
|
+
/** One place where graph structure was decided by a runtime spec value. */
|
|
102
|
+
export interface StructuralSpecDependenceFinding {
|
|
103
|
+
readonly kind: StructuralSpecDependenceKind;
|
|
104
|
+
/**
|
|
105
|
+
* Where the dependence surfaced: a resource id, or `resource.<id>` plus the
|
|
106
|
+
* dotted path inside its template, or a source excerpt for AST findings.
|
|
107
|
+
*/
|
|
108
|
+
readonly location: string;
|
|
109
|
+
/** Spec paths involved, as `spec.<path>` (may be empty when unresolvable). */
|
|
110
|
+
readonly specPaths: readonly string[];
|
|
111
|
+
/** One sentence naming what the emitted RGD actually encodes. */
|
|
112
|
+
readonly detail: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* A place where the composition read the keys of a spec field at build time.
|
|
116
|
+
* A candidate for a `runtime-map-enumerated` finding, not a finding itself.
|
|
117
|
+
*/
|
|
118
|
+
export interface MapEnumerationSite {
|
|
119
|
+
/** Source excerpt, e.g. `Object.keys(spec.settings)` or `...spec.app.env`. */
|
|
120
|
+
readonly location: string;
|
|
121
|
+
/** The `spec.<path>` whose keys were read. */
|
|
122
|
+
readonly specPath: string;
|
|
123
|
+
}
|
|
124
|
+
/** Thrown when a KRO-mode RGD would silently encode a build-time guess. */
|
|
125
|
+
export declare class StructuralSpecDependenceError extends TypeKroError {
|
|
126
|
+
readonly graphName: string;
|
|
127
|
+
readonly findings: readonly StructuralSpecDependenceFinding[];
|
|
128
|
+
constructor(message: string, graphName: string, findings: readonly StructuralSpecDependenceFinding[]);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Report build-time residue in the RGD that is about to be emitted.
|
|
132
|
+
*
|
|
133
|
+
* Operates on the serialized manifest rather than on live composition state,
|
|
134
|
+
* so every finding is backed by a concrete artifact in the output.
|
|
135
|
+
*/
|
|
136
|
+
export declare function scanRgdResourcesForStructuralSpecArtifacts(resources: readonly KroResourceTemplate[]): StructuralSpecDependenceFinding[];
|
|
137
|
+
/**
|
|
138
|
+
* Branch predicates and `.length` reads the control-flow analyzer does not
|
|
139
|
+
* compile. See {@link analyzeCompositionSource}.
|
|
140
|
+
*/
|
|
141
|
+
export declare function detectStructuralSpecPredicates(compositionSource: string | undefined): StructuralSpecDependenceFinding[];
|
|
142
|
+
/**
|
|
143
|
+
* Sites where the composition reads the keys of a spec field at build time.
|
|
144
|
+
*
|
|
145
|
+
* These are CANDIDATES, never findings. Enumerating an *object-typed* spec
|
|
146
|
+
* field is legitimate — the schema proxy is shape-aware and yields the real
|
|
147
|
+
* declared names — and the AST cannot tell that apart from a map-typed field,
|
|
148
|
+
* whose keys exist only per instance. Only the emitted RGD can, by leaving the
|
|
149
|
+
* `__typekroSchemaKey` sentinel behind; but that sentinel carries no path when
|
|
150
|
+
* it was consumed as a plain string. Reporting these alongside such a finding
|
|
151
|
+
* lets the message point at the lines worth reading without claiming any one
|
|
152
|
+
* of them is the culprit.
|
|
153
|
+
*/
|
|
154
|
+
export declare function detectMapEnumerationSites(compositionSource: string | undefined): readonly MapEnumerationSite[];
|
|
155
|
+
/** Render the diagnostic text shared by the error and the escape-hatch warning. */
|
|
156
|
+
export declare function formatStructuralSpecDependence(graphName: string, findings: readonly StructuralSpecDependenceFinding[], mapEnumerationSites?: readonly MapEnumerationSite[]): string;
|
|
157
|
+
/**
|
|
158
|
+
* Whether the structural spec-dependence check ignores per-composition escape
|
|
159
|
+
* hatches.
|
|
160
|
+
*
|
|
161
|
+
* `TYPEKRO_STRUCTURAL_SPEC=strict` makes every structural use an error even
|
|
162
|
+
* when the composition sets `allowStructuralSpecDependence`, so a repository
|
|
163
|
+
* can audit what its shipped graphs still depend on without editing them.
|
|
164
|
+
* Resolved in ONE place, matching `isStrictCelDiagnosticsEnabled`.
|
|
165
|
+
*/
|
|
166
|
+
export declare function isStructuralSpecDependenceStrict(): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Gate KRO-mode serialization on structural spec-dependence.
|
|
169
|
+
*
|
|
170
|
+
* Throws {@link StructuralSpecDependenceError} unless `allow` is set, in which
|
|
171
|
+
* case the same report is logged as a warning naming every path.
|
|
172
|
+
*/
|
|
173
|
+
export declare function assertNoStructuralSpecDependence(input: {
|
|
174
|
+
graphName: string;
|
|
175
|
+
resources: readonly KroResourceTemplate[];
|
|
176
|
+
compositionSource?: string | undefined;
|
|
177
|
+
allow?: boolean | undefined;
|
|
178
|
+
}): void;
|
|
179
|
+
//# sourceMappingURL=structural-spec-dependence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structural-spec-dependence.d.ts","sourceRoot":"","sources":["../../../src/core/validation/structural-spec-dependence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+FG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AA0BrE,uEAAuE;AACvE,MAAM,MAAM,4BAA4B,GACpC,kBAAkB,GAClB,wBAAwB,GACxB,6BAA6B,GAC7B,sBAAsB,GACtB,sBAAsB,GACtB,wBAAwB,CAAC;AAE7B,2EAA2E;AAC3E,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAC;IAC5C;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8EAA8E;IAC9E,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,iEAAiE;IACjE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAOD,2EAA2E;AAC3E,qBAAa,6BAA8B,SAAQ,YAAY;aAG3C,SAAS,EAAE,MAAM;aACjB,QAAQ,EAAE,SAAS,+BAA+B,EAAE;gBAFpE,OAAO,EAAE,MAAM,EACC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,SAAS,+BAA+B,EAAE;CAKvE;AA4DD;;;;;GAKG;AACH,wBAAgB,0CAA0C,CACxD,SA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