typekro 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +185 -0
- package/README.md +1137 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/alchemy/deployers.d.ts +39 -0
- package/dist/alchemy/deployers.d.ts.map +1 -0
- package/dist/alchemy/deployers.js +194 -0
- package/dist/alchemy/deployers.js.map +1 -0
- package/dist/alchemy/deployment.d.ts +12 -0
- package/dist/alchemy/deployment.d.ts.map +1 -0
- package/dist/alchemy/deployment.js +12 -0
- package/dist/alchemy/deployment.js.map +1 -0
- package/dist/alchemy/index.d.ts +17 -0
- package/dist/alchemy/index.d.ts.map +1 -0
- package/dist/alchemy/index.js +20 -0
- package/dist/alchemy/index.js.map +1 -0
- package/dist/alchemy/resolver.d.ts +127 -0
- package/dist/alchemy/resolver.d.ts.map +1 -0
- package/dist/alchemy/resolver.js +341 -0
- package/dist/alchemy/resolver.js.map +1 -0
- package/dist/alchemy/resource-registration.d.ts +22 -0
- package/dist/alchemy/resource-registration.d.ts.map +1 -0
- package/dist/alchemy/resource-registration.js +218 -0
- package/dist/alchemy/resource-registration.js.map +1 -0
- package/dist/alchemy/type-inference.d.ts +13 -0
- package/dist/alchemy/type-inference.d.ts.map +1 -0
- package/dist/alchemy/type-inference.js +67 -0
- package/dist/alchemy/type-inference.js.map +1 -0
- package/dist/alchemy/types.d.ts +92 -0
- package/dist/alchemy/types.d.ts.map +1 -0
- package/dist/alchemy/types.js +8 -0
- package/dist/alchemy/types.js.map +1 -0
- package/dist/alchemy/utilities.d.ts +12 -0
- package/dist/alchemy/utilities.d.ts.map +1 -0
- package/dist/alchemy/utilities.js +16 -0
- package/dist/alchemy/utilities.js.map +1 -0
- package/dist/alchemy/wrapper.d.ts +16 -0
- package/dist/alchemy/wrapper.d.ts.map +1 -0
- package/dist/alchemy/wrapper.js +23 -0
- package/dist/alchemy/wrapper.js.map +1 -0
- package/dist/core/composition/composition.d.ts +94 -0
- package/dist/core/composition/composition.d.ts.map +1 -0
- package/dist/core/composition/composition.js +230 -0
- package/dist/core/composition/composition.js.map +1 -0
- package/dist/core/composition/index.d.ts +12 -0
- package/dist/core/composition/index.d.ts.map +1 -0
- package/dist/core/composition/index.js +12 -0
- package/dist/core/composition/index.js.map +1 -0
- package/dist/core/composition/typekro-runtime/index.d.ts +3 -0
- package/dist/core/composition/typekro-runtime/index.d.ts.map +1 -0
- package/dist/core/composition/typekro-runtime/index.js +2 -0
- package/dist/core/composition/typekro-runtime/index.js.map +1 -0
- package/dist/core/composition/typekro-runtime/typekro-runtime.d.ts +39 -0
- package/dist/core/composition/typekro-runtime/typekro-runtime.d.ts.map +1 -0
- package/dist/core/composition/typekro-runtime/typekro-runtime.js +100 -0
- package/dist/core/composition/typekro-runtime/typekro-runtime.js.map +1 -0
- package/dist/core/composition/typekro-runtime/types.d.ts +16 -0
- package/dist/core/composition/typekro-runtime/types.d.ts.map +1 -0
- package/dist/core/composition/typekro-runtime/types.js +12 -0
- package/dist/core/composition/typekro-runtime/types.js.map +1 -0
- package/dist/core/composition/types.d.ts +264 -0
- package/dist/core/composition/types.d.ts.map +1 -0
- package/dist/core/composition/types.js +2 -0
- package/dist/core/composition/types.js.map +1 -0
- package/dist/core/constants/brands.d.ts +42 -0
- package/dist/core/constants/brands.d.ts.map +1 -0
- package/dist/core/constants/brands.js +51 -0
- package/dist/core/constants/brands.js.map +1 -0
- package/dist/core/dependencies/graph.d.ts +67 -0
- package/dist/core/dependencies/graph.d.ts.map +1 -0
- package/dist/core/dependencies/graph.js +220 -0
- package/dist/core/dependencies/graph.js.map +1 -0
- package/dist/core/dependencies/index.d.ts +7 -0
- package/dist/core/dependencies/index.d.ts.map +1 -0
- package/dist/core/dependencies/index.js +8 -0
- package/dist/core/dependencies/index.js.map +1 -0
- package/dist/core/dependencies/resolver.d.ts +53 -0
- package/dist/core/dependencies/resolver.d.ts.map +1 -0
- package/dist/core/dependencies/resolver.js +167 -0
- package/dist/core/dependencies/resolver.js.map +1 -0
- package/dist/core/dependencies/type-guards.d.ts +17 -0
- package/dist/core/dependencies/type-guards.d.ts.map +1 -0
- package/dist/core/dependencies/type-guards.js +35 -0
- package/dist/core/dependencies/type-guards.js.map +1 -0
- package/dist/core/deployment/deployment-strategies.d.ts +12 -0
- package/dist/core/deployment/deployment-strategies.d.ts.map +1 -0
- package/dist/core/deployment/deployment-strategies.js +11 -0
- package/dist/core/deployment/deployment-strategies.js.map +1 -0
- package/dist/core/deployment/direct-factory.d.ts +111 -0
- package/dist/core/deployment/direct-factory.d.ts.map +1 -0
- package/dist/core/deployment/direct-factory.js +627 -0
- package/dist/core/deployment/direct-factory.js.map +1 -0
- package/dist/core/deployment/engine.d.ts +128 -0
- package/dist/core/deployment/engine.d.ts.map +1 -0
- package/dist/core/deployment/engine.js +1408 -0
- package/dist/core/deployment/engine.js.map +1 -0
- package/dist/core/deployment/index.d.ts +14 -0
- package/dist/core/deployment/index.d.ts.map +1 -0
- package/dist/core/deployment/index.js +14 -0
- package/dist/core/deployment/index.js.map +1 -0
- package/dist/core/deployment/kro-factory.d.ts +143 -0
- package/dist/core/deployment/kro-factory.d.ts.map +1 -0
- package/dist/core/deployment/kro-factory.js +837 -0
- package/dist/core/deployment/kro-factory.js.map +1 -0
- package/dist/core/deployment/readiness.d.ts +54 -0
- package/dist/core/deployment/readiness.d.ts.map +1 -0
- package/dist/core/deployment/readiness.js +175 -0
- package/dist/core/deployment/readiness.js.map +1 -0
- package/dist/core/deployment/rollback-manager.d.ts +63 -0
- package/dist/core/deployment/rollback-manager.d.ts.map +1 -0
- package/dist/core/deployment/rollback-manager.js +225 -0
- package/dist/core/deployment/rollback-manager.js.map +1 -0
- package/dist/core/deployment/shared-utilities.d.ts +41 -0
- package/dist/core/deployment/shared-utilities.d.ts.map +1 -0
- package/dist/core/deployment/shared-utilities.js +100 -0
- package/dist/core/deployment/shared-utilities.js.map +1 -0
- package/dist/core/deployment/status-hydrator.d.ts +86 -0
- package/dist/core/deployment/status-hydrator.d.ts.map +1 -0
- package/dist/core/deployment/status-hydrator.js +262 -0
- package/dist/core/deployment/status-hydrator.js.map +1 -0
- package/dist/core/deployment/strategies/alchemy-strategy.d.ts +107 -0
- package/dist/core/deployment/strategies/alchemy-strategy.d.ts.map +1 -0
- package/dist/core/deployment/strategies/alchemy-strategy.js +446 -0
- package/dist/core/deployment/strategies/alchemy-strategy.js.map +1 -0
- package/dist/core/deployment/strategies/base-strategy.d.ts +50 -0
- package/dist/core/deployment/strategies/base-strategy.d.ts.map +1 -0
- package/dist/core/deployment/strategies/base-strategy.js +82 -0
- package/dist/core/deployment/strategies/base-strategy.js.map +1 -0
- package/dist/core/deployment/strategies/direct-strategy.d.ts +29 -0
- package/dist/core/deployment/strategies/direct-strategy.d.ts.map +1 -0
- package/dist/core/deployment/strategies/direct-strategy.js +80 -0
- package/dist/core/deployment/strategies/direct-strategy.js.map +1 -0
- package/dist/core/deployment/strategies/index.d.ts +12 -0
- package/dist/core/deployment/strategies/index.d.ts.map +1 -0
- package/dist/core/deployment/strategies/index.js +12 -0
- package/dist/core/deployment/strategies/index.js.map +1 -0
- package/dist/core/deployment/strategies/kro-strategy.d.ts +41 -0
- package/dist/core/deployment/strategies/kro-strategy.d.ts.map +1 -0
- package/dist/core/deployment/strategies/kro-strategy.js +270 -0
- package/dist/core/deployment/strategies/kro-strategy.js.map +1 -0
- package/dist/core/direct-deployment.d.ts +8 -0
- package/dist/core/direct-deployment.d.ts.map +1 -0
- package/dist/core/direct-deployment.js +9 -0
- package/dist/core/direct-deployment.js.map +1 -0
- package/dist/core/errors.d.ts +73 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +250 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/evaluation/cel-optimizer.d.ts +48 -0
- package/dist/core/evaluation/cel-optimizer.d.ts.map +1 -0
- package/dist/core/evaluation/cel-optimizer.js +176 -0
- package/dist/core/evaluation/cel-optimizer.js.map +1 -0
- package/dist/core/factory.d.ts +12 -0
- package/dist/core/factory.d.ts.map +1 -0
- package/dist/core/factory.js +13 -0
- package/dist/core/factory.js.map +1 -0
- package/dist/core/kubernetes/api.d.ts +43 -0
- package/dist/core/kubernetes/api.d.ts.map +1 -0
- package/dist/core/kubernetes/api.js +209 -0
- package/dist/core/kubernetes/api.js.map +1 -0
- package/dist/core/kubernetes/client-provider.d.ts +204 -0
- package/dist/core/kubernetes/client-provider.d.ts.map +1 -0
- package/dist/core/kubernetes/client-provider.js +421 -0
- package/dist/core/kubernetes/client-provider.js.map +1 -0
- package/dist/core/logging/config.d.ts +14 -0
- package/dist/core/logging/config.d.ts.map +1 -0
- package/dist/core/logging/config.js +57 -0
- package/dist/core/logging/config.js.map +1 -0
- package/dist/core/logging/index.d.ts +4 -0
- package/dist/core/logging/index.d.ts.map +1 -0
- package/dist/core/logging/index.js +4 -0
- package/dist/core/logging/index.js.map +1 -0
- package/dist/core/logging/logger.d.ts +26 -0
- package/dist/core/logging/logger.d.ts.map +1 -0
- package/dist/core/logging/logger.js +114 -0
- package/dist/core/logging/logger.js.map +1 -0
- package/dist/core/logging/types.d.ts +93 -0
- package/dist/core/logging/types.d.ts.map +1 -0
- package/dist/core/logging/types.js +2 -0
- package/dist/core/logging/types.js.map +1 -0
- package/dist/core/readiness/cluster-state.d.ts +229 -0
- package/dist/core/readiness/cluster-state.d.ts.map +1 -0
- package/dist/core/readiness/cluster-state.js +360 -0
- package/dist/core/readiness/cluster-state.js.map +1 -0
- package/dist/core/readiness/index.d.ts +5 -0
- package/dist/core/readiness/index.d.ts.map +1 -0
- package/dist/core/readiness/index.js +5 -0
- package/dist/core/readiness/index.js.map +1 -0
- package/dist/core/readiness/registry.d.ts +45 -0
- package/dist/core/readiness/registry.d.ts.map +1 -0
- package/dist/core/readiness/registry.js +62 -0
- package/dist/core/readiness/registry.js.map +1 -0
- package/dist/core/references/cel-evaluator.d.ts +102 -0
- package/dist/core/references/cel-evaluator.d.ts.map +1 -0
- package/dist/core/references/cel-evaluator.js +288 -0
- package/dist/core/references/cel-evaluator.js.map +1 -0
- package/dist/core/references/cel.d.ts +75 -0
- package/dist/core/references/cel.d.ts.map +1 -0
- package/dist/core/references/cel.js +213 -0
- package/dist/core/references/cel.js.map +1 -0
- package/dist/core/references/external-refs.d.ts +37 -0
- package/dist/core/references/external-refs.d.ts.map +1 -0
- package/dist/core/references/external-refs.js +53 -0
- package/dist/core/references/external-refs.js.map +1 -0
- package/dist/core/references/index.d.ts +15 -0
- package/dist/core/references/index.d.ts.map +1 -0
- package/dist/core/references/index.js +19 -0
- package/dist/core/references/index.js.map +1 -0
- package/dist/core/references/resolver.d.ts +117 -0
- package/dist/core/references/resolver.d.ts.map +1 -0
- package/dist/core/references/resolver.js +554 -0
- package/dist/core/references/resolver.js.map +1 -0
- package/dist/core/references/schema-proxy.d.ts +38 -0
- package/dist/core/references/schema-proxy.d.ts.map +1 -0
- package/dist/core/references/schema-proxy.js +163 -0
- package/dist/core/references/schema-proxy.js.map +1 -0
- package/dist/core/serialization/core.d.ts +15 -0
- package/dist/core/serialization/core.d.ts.map +1 -0
- package/dist/core/serialization/core.js +169 -0
- package/dist/core/serialization/core.js.map +1 -0
- package/dist/core/serialization/index.d.ts +9 -0
- package/dist/core/serialization/index.d.ts.map +1 -0
- package/dist/core/serialization/index.js +12 -0
- package/dist/core/serialization/index.js.map +1 -0
- package/dist/core/serialization/schema.d.ts +14 -0
- package/dist/core/serialization/schema.d.ts.map +1 -0
- package/dist/core/serialization/schema.js +33 -0
- package/dist/core/serialization/schema.js.map +1 -0
- package/dist/core/serialization/validation.d.ts +18 -0
- package/dist/core/serialization/validation.d.ts.map +1 -0
- package/dist/core/serialization/validation.js +165 -0
- package/dist/core/serialization/validation.js.map +1 -0
- package/dist/core/serialization/yaml.d.ts +10 -0
- package/dist/core/serialization/yaml.d.ts.map +1 -0
- package/dist/core/serialization/yaml.js +63 -0
- package/dist/core/serialization/yaml.js.map +1 -0
- package/dist/core/types/common.d.ts +41 -0
- package/dist/core/types/common.d.ts.map +1 -0
- package/dist/core/types/common.js +9 -0
- package/dist/core/types/common.js.map +1 -0
- package/dist/core/types/dependencies.d.ts +14 -0
- package/dist/core/types/dependencies.d.ts.map +1 -0
- package/dist/core/types/dependencies.js +5 -0
- package/dist/core/types/dependencies.js.map +1 -0
- package/dist/core/types/deployment.d.ts +265 -0
- package/dist/core/types/deployment.d.ts.map +1 -0
- package/dist/core/types/deployment.js +20 -0
- package/dist/core/types/deployment.js.map +1 -0
- package/dist/core/types/index.d.ts +19 -0
- package/dist/core/types/index.d.ts.map +1 -0
- package/dist/core/types/index.js +15 -0
- package/dist/core/types/index.js.map +1 -0
- package/dist/core/types/kubernetes.d.ts +352 -0
- package/dist/core/types/kubernetes.d.ts.map +1 -0
- package/dist/core/types/kubernetes.js +5 -0
- package/dist/core/types/kubernetes.js.map +1 -0
- package/dist/core/types/references.d.ts +54 -0
- package/dist/core/types/references.d.ts.map +1 -0
- package/dist/core/types/references.js +14 -0
- package/dist/core/types/references.js.map +1 -0
- package/dist/core/types/resource-graph.d.ts +93 -0
- package/dist/core/types/resource-graph.d.ts.map +1 -0
- package/dist/core/types/resource-graph.js +8 -0
- package/dist/core/types/resource-graph.js.map +1 -0
- package/dist/core/types/serialization.d.ts +210 -0
- package/dist/core/types/serialization.d.ts.map +1 -0
- package/dist/core/types/serialization.js +5 -0
- package/dist/core/types/serialization.js.map +1 -0
- package/dist/core/types/yaml.d.ts +92 -0
- package/dist/core/types/yaml.d.ts.map +1 -0
- package/dist/core/types/yaml.js +2 -0
- package/dist/core/types/yaml.js.map +1 -0
- package/dist/core/types.d.ts +8 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +9 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/validation/cel-validator.d.ts +47 -0
- package/dist/core/validation/cel-validator.d.ts.map +1 -0
- package/dist/core/validation/cel-validator.js +200 -0
- package/dist/core/validation/cel-validator.js.map +1 -0
- package/dist/core/yaml/index.d.ts +5 -0
- package/dist/core/yaml/index.d.ts.map +1 -0
- package/dist/core/yaml/index.js +5 -0
- package/dist/core/yaml/index.js.map +1 -0
- package/dist/core/yaml/path-resolver.d.ts +122 -0
- package/dist/core/yaml/path-resolver.d.ts.map +1 -0
- package/dist/core/yaml/path-resolver.js +556 -0
- package/dist/core/yaml/path-resolver.js.map +1 -0
- package/dist/core.d.ts +30 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +59 -0
- package/dist/core.js.map +1 -0
- package/dist/factories/flux/git-repository.d.ts +62 -0
- package/dist/factories/flux/git-repository.d.ts.map +1 -0
- package/dist/factories/flux/git-repository.js +34 -0
- package/dist/factories/flux/git-repository.js.map +1 -0
- package/dist/factories/flux/index.d.ts +10 -0
- package/dist/factories/flux/index.d.ts.map +1 -0
- package/dist/factories/flux/index.js +11 -0
- package/dist/factories/flux/index.js.map +1 -0
- package/dist/factories/flux/kustomize/index.d.ts +4 -0
- package/dist/factories/flux/kustomize/index.d.ts.map +1 -0
- package/dist/factories/flux/kustomize/index.js +3 -0
- package/dist/factories/flux/kustomize/index.js.map +1 -0
- package/dist/factories/flux/kustomize/kustomization.d.ts +178 -0
- package/dist/factories/flux/kustomize/kustomization.d.ts.map +1 -0
- package/dist/factories/flux/kustomize/kustomization.js +108 -0
- package/dist/factories/flux/kustomize/kustomization.js.map +1 -0
- package/dist/factories/flux/kustomize/readiness-evaluators.d.ts +9 -0
- package/dist/factories/flux/kustomize/readiness-evaluators.d.ts.map +1 -0
- package/dist/factories/flux/kustomize/readiness-evaluators.js +71 -0
- package/dist/factories/flux/kustomize/readiness-evaluators.js.map +1 -0
- package/dist/factories/flux/kustomize/types.d.ts +2 -0
- package/dist/factories/flux/kustomize/types.d.ts.map +1 -0
- package/dist/factories/flux/kustomize/types.js +2 -0
- package/dist/factories/flux/kustomize/types.js.map +1 -0
- package/dist/factories/helm/helm-release.d.ts +139 -0
- package/dist/factories/helm/helm-release.d.ts.map +1 -0
- package/dist/factories/helm/helm-release.js +180 -0
- package/dist/factories/helm/helm-release.js.map +1 -0
- package/dist/factories/helm/helm-repository.d.ts +24 -0
- package/dist/factories/helm/helm-repository.d.ts.map +1 -0
- package/dist/factories/helm/helm-repository.js +57 -0
- package/dist/factories/helm/helm-repository.js.map +1 -0
- package/dist/factories/helm/index.d.ts +8 -0
- package/dist/factories/helm/index.d.ts.map +1 -0
- package/dist/factories/helm/index.js +8 -0
- package/dist/factories/helm/index.js.map +1 -0
- package/dist/factories/helm/readiness-evaluators.d.ts +55 -0
- package/dist/factories/helm/readiness-evaluators.d.ts.map +1 -0
- package/dist/factories/helm/readiness-evaluators.js +295 -0
- package/dist/factories/helm/readiness-evaluators.js.map +1 -0
- package/dist/factories/helm/types.d.ts +21 -0
- package/dist/factories/helm/types.d.ts.map +1 -0
- package/dist/factories/helm/types.js +2 -0
- package/dist/factories/helm/types.js.map +1 -0
- package/dist/factories/index.d.ts +12 -0
- package/dist/factories/index.d.ts.map +1 -0
- package/dist/factories/index.js +31 -0
- package/dist/factories/index.js.map +1 -0
- package/dist/factories/kro/index.d.ts +11 -0
- package/dist/factories/kro/index.d.ts.map +1 -0
- package/dist/factories/kro/index.js +10 -0
- package/dist/factories/kro/index.js.map +1 -0
- package/dist/factories/kro/kro-crd.d.ts +14 -0
- package/dist/factories/kro/kro-crd.d.ts.map +1 -0
- package/dist/factories/kro/kro-crd.js +51 -0
- package/dist/factories/kro/kro-crd.js.map +1 -0
- package/dist/factories/kro/kro-custom-resource.d.ts +23 -0
- package/dist/factories/kro/kro-custom-resource.d.ts.map +1 -0
- package/dist/factories/kro/kro-custom-resource.js +153 -0
- package/dist/factories/kro/kro-custom-resource.js.map +1 -0
- package/dist/factories/kro/resource-graph-definition.d.ts +12 -0
- package/dist/factories/kro/resource-graph-definition.d.ts.map +1 -0
- package/dist/factories/kro/resource-graph-definition.js +94 -0
- package/dist/factories/kro/resource-graph-definition.js.map +1 -0
- package/dist/factories/kubernetes/admission/index.d.ts +9 -0
- package/dist/factories/kubernetes/admission/index.d.ts.map +1 -0
- package/dist/factories/kubernetes/admission/index.js +9 -0
- package/dist/factories/kubernetes/admission/index.js.map +1 -0
- package/dist/factories/kubernetes/admission/mutating-webhook-configuration.d.ts +5 -0
- package/dist/factories/kubernetes/admission/mutating-webhook-configuration.d.ts.map +1 -0
- package/dist/factories/kubernetes/admission/mutating-webhook-configuration.js +10 -0
- package/dist/factories/kubernetes/admission/mutating-webhook-configuration.js.map +1 -0
- package/dist/factories/kubernetes/admission/validating-webhook-configuration.d.ts +5 -0
- package/dist/factories/kubernetes/admission/validating-webhook-configuration.d.ts.map +1 -0
- package/dist/factories/kubernetes/admission/validating-webhook-configuration.js +10 -0
- package/dist/factories/kubernetes/admission/validating-webhook-configuration.js.map +1 -0
- package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler-v1.d.ts +6 -0
- package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler-v1.d.ts.map +1 -0
- package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler-v1.js +35 -0
- package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler-v1.js.map +1 -0
- package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler.d.ts +6 -0
- package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler.d.ts.map +1 -0
- package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler.js +31 -0
- package/dist/factories/kubernetes/autoscaling/horizontal-pod-autoscaler.js.map +1 -0
- package/dist/factories/kubernetes/autoscaling/index.d.ts +9 -0
- package/dist/factories/kubernetes/autoscaling/index.d.ts.map +1 -0
- package/dist/factories/kubernetes/autoscaling/index.js +9 -0
- package/dist/factories/kubernetes/autoscaling/index.js.map +1 -0
- package/dist/factories/kubernetes/certificates/certificate-signing-request.d.ts +6 -0
- package/dist/factories/kubernetes/certificates/certificate-signing-request.d.ts.map +1 -0
- package/dist/factories/kubernetes/certificates/certificate-signing-request.js +48 -0
- package/dist/factories/kubernetes/certificates/certificate-signing-request.js.map +1 -0
- package/dist/factories/kubernetes/certificates/index.d.ts +8 -0
- package/dist/factories/kubernetes/certificates/index.d.ts.map +1 -0
- package/dist/factories/kubernetes/certificates/index.js +8 -0
- package/dist/factories/kubernetes/certificates/index.js.map +1 -0
- package/dist/factories/kubernetes/config/config-map.d.ts +5 -0
- package/dist/factories/kubernetes/config/config-map.d.ts.map +1 -0
- package/dist/factories/kubernetes/config/config-map.js +16 -0
- package/dist/factories/kubernetes/config/config-map.js.map +1 -0
- package/dist/factories/kubernetes/config/index.d.ts +9 -0
- package/dist/factories/kubernetes/config/index.d.ts.map +1 -0
- package/dist/factories/kubernetes/config/index.js +9 -0
- package/dist/factories/kubernetes/config/index.js.map +1 -0
- package/dist/factories/kubernetes/config/secret.d.ts +5 -0
- package/dist/factories/kubernetes/config/secret.d.ts.map +1 -0
- package/dist/factories/kubernetes/config/secret.js +16 -0
- package/dist/factories/kubernetes/config/secret.js.map +1 -0
- package/dist/factories/kubernetes/coordination/index.d.ts +8 -0
- package/dist/factories/kubernetes/coordination/index.d.ts.map +1 -0
- package/dist/factories/kubernetes/coordination/index.js +8 -0
- package/dist/factories/kubernetes/coordination/index.js.map +1 -0
- package/dist/factories/kubernetes/coordination/lease.d.ts +5 -0
- package/dist/factories/kubernetes/coordination/lease.d.ts.map +1 -0
- package/dist/factories/kubernetes/coordination/lease.js +10 -0
- package/dist/factories/kubernetes/coordination/lease.js.map +1 -0
- package/dist/factories/kubernetes/core/component-status.d.ts +4 -0
- package/dist/factories/kubernetes/core/component-status.d.ts.map +1 -0
- package/dist/factories/kubernetes/core/component-status.js +25 -0
- package/dist/factories/kubernetes/core/component-status.js.map +1 -0
- package/dist/factories/kubernetes/core/index.d.ts +11 -0
- package/dist/factories/kubernetes/core/index.d.ts.map +1 -0
- package/dist/factories/kubernetes/core/index.js +11 -0
- package/dist/factories/kubernetes/core/index.js.map +1 -0
- package/dist/factories/kubernetes/core/namespace.d.ts +9 -0
- package/dist/factories/kubernetes/core/namespace.d.ts.map +1 -0
- package/dist/factories/kubernetes/core/namespace.js +48 -0
- package/dist/factories/kubernetes/core/namespace.js.map +1 -0
- package/dist/factories/kubernetes/core/node.d.ts +6 -0
- package/dist/factories/kubernetes/core/node.d.ts.map +1 -0
- package/dist/factories/kubernetes/core/node.js +34 -0
- package/dist/factories/kubernetes/core/node.js.map +1 -0
- package/dist/factories/kubernetes/core/pod.d.ts +6 -0
- package/dist/factories/kubernetes/core/pod.d.ts.map +1 -0
- package/dist/factories/kubernetes/core/pod.js +44 -0
- package/dist/factories/kubernetes/core/pod.js.map +1 -0
- package/dist/factories/kubernetes/extensions/custom-resource-definition.d.ts +6 -0
- package/dist/factories/kubernetes/extensions/custom-resource-definition.d.ts.map +1 -0
- package/dist/factories/kubernetes/extensions/custom-resource-definition.js +45 -0
- package/dist/factories/kubernetes/extensions/custom-resource-definition.js.map +1 -0
- package/dist/factories/kubernetes/extensions/custom-resource.d.ts +12 -0
- package/dist/factories/kubernetes/extensions/custom-resource.d.ts.map +1 -0
- package/dist/factories/kubernetes/extensions/custom-resource.js +17 -0
- package/dist/factories/kubernetes/extensions/custom-resource.js.map +1 -0
- package/dist/factories/kubernetes/extensions/index.d.ts +9 -0
- package/dist/factories/kubernetes/extensions/index.d.ts.map +1 -0
- package/dist/factories/kubernetes/extensions/index.js +9 -0
- package/dist/factories/kubernetes/extensions/index.js.map +1 -0
- package/dist/factories/kubernetes/index.d.ts +24 -0
- package/dist/factories/kubernetes/index.d.ts.map +1 -0
- package/dist/factories/kubernetes/index.js +75 -0
- package/dist/factories/kubernetes/index.js.map +1 -0
- package/dist/factories/kubernetes/networking/endpoint-slice.d.ts +4 -0
- package/dist/factories/kubernetes/networking/endpoint-slice.d.ts.map +1 -0
- package/dist/factories/kubernetes/networking/endpoint-slice.js +10 -0
- package/dist/factories/kubernetes/networking/endpoint-slice.js.map +1 -0
- package/dist/factories/kubernetes/networking/endpoints.d.ts +4 -0
- package/dist/factories/kubernetes/networking/endpoints.d.ts.map +1 -0
- package/dist/factories/kubernetes/networking/endpoints.js +39 -0
- package/dist/factories/kubernetes/networking/endpoints.js.map +1 -0
- package/dist/factories/kubernetes/networking/index.d.ts +13 -0
- package/dist/factories/kubernetes/networking/index.d.ts.map +1 -0
- package/dist/factories/kubernetes/networking/index.js +13 -0
- package/dist/factories/kubernetes/networking/index.js.map +1 -0
- package/dist/factories/kubernetes/networking/ingress-class.d.ts +5 -0
- package/dist/factories/kubernetes/networking/ingress-class.d.ts.map +1 -0
- package/dist/factories/kubernetes/networking/ingress-class.js +16 -0
- package/dist/factories/kubernetes/networking/ingress-class.js.map +1 -0
- package/dist/factories/kubernetes/networking/ingress.d.ts +5 -0
- package/dist/factories/kubernetes/networking/ingress.d.ts.map +1 -0
- package/dist/factories/kubernetes/networking/ingress.js +33 -0
- package/dist/factories/kubernetes/networking/ingress.js.map +1 -0
- package/dist/factories/kubernetes/networking/network-policy.d.ts +5 -0
- package/dist/factories/kubernetes/networking/network-policy.d.ts.map +1 -0
- package/dist/factories/kubernetes/networking/network-policy.js +17 -0
- package/dist/factories/kubernetes/networking/network-policy.js.map +1 -0
- package/dist/factories/kubernetes/networking/service.d.ts +5 -0
- package/dist/factories/kubernetes/networking/service.d.ts.map +1 -0
- package/dist/factories/kubernetes/networking/service.js +64 -0
- package/dist/factories/kubernetes/networking/service.js.map +1 -0
- package/dist/factories/kubernetes/policy/index.d.ts +10 -0
- package/dist/factories/kubernetes/policy/index.d.ts.map +1 -0
- package/dist/factories/kubernetes/policy/index.js +10 -0
- package/dist/factories/kubernetes/policy/index.js.map +1 -0
- package/dist/factories/kubernetes/policy/limit-range.d.ts +5 -0
- package/dist/factories/kubernetes/policy/limit-range.d.ts.map +1 -0
- package/dist/factories/kubernetes/policy/limit-range.js +17 -0
- package/dist/factories/kubernetes/policy/limit-range.js.map +1 -0
- package/dist/factories/kubernetes/policy/pod-disruption-budget.d.ts +6 -0
- package/dist/factories/kubernetes/policy/pod-disruption-budget.d.ts.map +1 -0
- package/dist/factories/kubernetes/policy/pod-disruption-budget.js +55 -0
- package/dist/factories/kubernetes/policy/pod-disruption-budget.js.map +1 -0
- package/dist/factories/kubernetes/policy/resource-quota.d.ts +6 -0
- package/dist/factories/kubernetes/policy/resource-quota.d.ts.map +1 -0
- package/dist/factories/kubernetes/policy/resource-quota.js +43 -0
- package/dist/factories/kubernetes/policy/resource-quota.js.map +1 -0
- package/dist/factories/kubernetes/rbac/cluster-role-binding.d.ts +4 -0
- package/dist/factories/kubernetes/rbac/cluster-role-binding.d.ts.map +1 -0
- package/dist/factories/kubernetes/rbac/cluster-role-binding.js +17 -0
- package/dist/factories/kubernetes/rbac/cluster-role-binding.js.map +1 -0
- package/dist/factories/kubernetes/rbac/cluster-role.d.ts +4 -0
- package/dist/factories/kubernetes/rbac/cluster-role.d.ts.map +1 -0
- package/dist/factories/kubernetes/rbac/cluster-role.js +17 -0
- package/dist/factories/kubernetes/rbac/cluster-role.js.map +1 -0
- package/dist/factories/kubernetes/rbac/index.d.ts +12 -0
- package/dist/factories/kubernetes/rbac/index.d.ts.map +1 -0
- package/dist/factories/kubernetes/rbac/index.js +12 -0
- package/dist/factories/kubernetes/rbac/index.js.map +1 -0
- package/dist/factories/kubernetes/rbac/role-binding.d.ts +4 -0
- package/dist/factories/kubernetes/rbac/role-binding.d.ts.map +1 -0
- package/dist/factories/kubernetes/rbac/role-binding.js +17 -0
- package/dist/factories/kubernetes/rbac/role-binding.js.map +1 -0
- package/dist/factories/kubernetes/rbac/role.d.ts +4 -0
- package/dist/factories/kubernetes/rbac/role.d.ts.map +1 -0
- package/dist/factories/kubernetes/rbac/role.js +17 -0
- package/dist/factories/kubernetes/rbac/role.js.map +1 -0
- package/dist/factories/kubernetes/rbac/service-account.d.ts +4 -0
- package/dist/factories/kubernetes/rbac/service-account.d.ts.map +1 -0
- package/dist/factories/kubernetes/rbac/service-account.js +17 -0
- package/dist/factories/kubernetes/rbac/service-account.js.map +1 -0
- package/dist/factories/kubernetes/scheduling/index.d.ts +9 -0
- package/dist/factories/kubernetes/scheduling/index.d.ts.map +1 -0
- package/dist/factories/kubernetes/scheduling/index.js +9 -0
- package/dist/factories/kubernetes/scheduling/index.js.map +1 -0
- package/dist/factories/kubernetes/scheduling/priority-class.d.ts +4 -0
- package/dist/factories/kubernetes/scheduling/priority-class.d.ts.map +1 -0
- package/dist/factories/kubernetes/scheduling/priority-class.js +16 -0
- package/dist/factories/kubernetes/scheduling/priority-class.js.map +1 -0
- package/dist/factories/kubernetes/scheduling/runtime-class.d.ts +5 -0
- package/dist/factories/kubernetes/scheduling/runtime-class.d.ts.map +1 -0
- package/dist/factories/kubernetes/scheduling/runtime-class.js +10 -0
- package/dist/factories/kubernetes/scheduling/runtime-class.js.map +1 -0
- package/dist/factories/kubernetes/storage/csi-driver.d.ts +5 -0
- package/dist/factories/kubernetes/storage/csi-driver.d.ts.map +1 -0
- package/dist/factories/kubernetes/storage/csi-driver.js +16 -0
- package/dist/factories/kubernetes/storage/csi-driver.js.map +1 -0
- package/dist/factories/kubernetes/storage/csi-node.d.ts +5 -0
- package/dist/factories/kubernetes/storage/csi-node.d.ts.map +1 -0
- package/dist/factories/kubernetes/storage/csi-node.js +10 -0
- package/dist/factories/kubernetes/storage/csi-node.js.map +1 -0
- package/dist/factories/kubernetes/storage/index.d.ts +13 -0
- package/dist/factories/kubernetes/storage/index.d.ts.map +1 -0
- package/dist/factories/kubernetes/storage/index.js +13 -0
- package/dist/factories/kubernetes/storage/index.js.map +1 -0
- package/dist/factories/kubernetes/storage/persistent-volume-claim.d.ts +6 -0
- package/dist/factories/kubernetes/storage/persistent-volume-claim.d.ts.map +1 -0
- package/dist/factories/kubernetes/storage/persistent-volume-claim.js +30 -0
- package/dist/factories/kubernetes/storage/persistent-volume-claim.js.map +1 -0
- package/dist/factories/kubernetes/storage/persistent-volume.d.ts +6 -0
- package/dist/factories/kubernetes/storage/persistent-volume.d.ts.map +1 -0
- package/dist/factories/kubernetes/storage/persistent-volume.js +47 -0
- package/dist/factories/kubernetes/storage/persistent-volume.js.map +1 -0
- package/dist/factories/kubernetes/storage/storage-class.d.ts +4 -0
- package/dist/factories/kubernetes/storage/storage-class.d.ts.map +1 -0
- package/dist/factories/kubernetes/storage/storage-class.js +17 -0
- package/dist/factories/kubernetes/storage/storage-class.js.map +1 -0
- package/dist/factories/kubernetes/storage/volume-attachment.d.ts +6 -0
- package/dist/factories/kubernetes/storage/volume-attachment.d.ts.map +1 -0
- package/dist/factories/kubernetes/storage/volume-attachment.js +10 -0
- package/dist/factories/kubernetes/storage/volume-attachment.js.map +1 -0
- package/dist/factories/kubernetes/types.d.ts +8 -0
- package/dist/factories/kubernetes/types.d.ts.map +1 -0
- package/dist/factories/kubernetes/types.js +8 -0
- package/dist/factories/kubernetes/types.js.map +1 -0
- package/dist/factories/kubernetes/workloads/cron-job.d.ts +6 -0
- package/dist/factories/kubernetes/workloads/cron-job.d.ts.map +1 -0
- package/dist/factories/kubernetes/workloads/cron-job.js +53 -0
- package/dist/factories/kubernetes/workloads/cron-job.js.map +1 -0
- package/dist/factories/kubernetes/workloads/daemon-set.d.ts +6 -0
- package/dist/factories/kubernetes/workloads/daemon-set.d.ts.map +1 -0
- package/dist/factories/kubernetes/workloads/daemon-set.js +32 -0
- package/dist/factories/kubernetes/workloads/daemon-set.js.map +1 -0
- package/dist/factories/kubernetes/workloads/deployment.d.ts +5 -0
- package/dist/factories/kubernetes/workloads/deployment.d.ts.map +1 -0
- package/dist/factories/kubernetes/workloads/deployment.js +59 -0
- package/dist/factories/kubernetes/workloads/deployment.js.map +1 -0
- package/dist/factories/kubernetes/workloads/index.d.ts +14 -0
- package/dist/factories/kubernetes/workloads/index.d.ts.map +1 -0
- package/dist/factories/kubernetes/workloads/index.js +14 -0
- package/dist/factories/kubernetes/workloads/index.js.map +1 -0
- package/dist/factories/kubernetes/workloads/job.d.ts +6 -0
- package/dist/factories/kubernetes/workloads/job.d.ts.map +1 -0
- package/dist/factories/kubernetes/workloads/job.js +105 -0
- package/dist/factories/kubernetes/workloads/job.js.map +1 -0
- package/dist/factories/kubernetes/workloads/replica-set.d.ts +6 -0
- package/dist/factories/kubernetes/workloads/replica-set.d.ts.map +1 -0
- package/dist/factories/kubernetes/workloads/replica-set.js +33 -0
- package/dist/factories/kubernetes/workloads/replica-set.js.map +1 -0
- package/dist/factories/kubernetes/workloads/replication-controller.d.ts +6 -0
- package/dist/factories/kubernetes/workloads/replication-controller.d.ts.map +1 -0
- package/dist/factories/kubernetes/workloads/replication-controller.js +56 -0
- package/dist/factories/kubernetes/workloads/replication-controller.js.map +1 -0
- package/dist/factories/kubernetes/workloads/stateful-set.d.ts +6 -0
- package/dist/factories/kubernetes/workloads/stateful-set.d.ts.map +1 -0
- package/dist/factories/kubernetes/workloads/stateful-set.js +81 -0
- package/dist/factories/kubernetes/workloads/stateful-set.js.map +1 -0
- package/dist/factories/kubernetes/yaml/index.d.ts +6 -0
- package/dist/factories/kubernetes/yaml/index.d.ts.map +1 -0
- package/dist/factories/kubernetes/yaml/index.js +6 -0
- package/dist/factories/kubernetes/yaml/index.js.map +1 -0
- package/dist/factories/kubernetes/yaml/yaml-directory.d.ts +54 -0
- package/dist/factories/kubernetes/yaml/yaml-directory.d.ts.map +1 -0
- package/dist/factories/kubernetes/yaml/yaml-directory.js +178 -0
- package/dist/factories/kubernetes/yaml/yaml-directory.js.map +1 -0
- package/dist/factories/kubernetes/yaml/yaml-file.d.ts +54 -0
- package/dist/factories/kubernetes/yaml/yaml-file.d.ts.map +1 -0
- package/dist/factories/kubernetes/yaml/yaml-file.js +181 -0
- package/dist/factories/kubernetes/yaml/yaml-file.js.map +1 -0
- package/dist/factories/shared.d.ts +11 -0
- package/dist/factories/shared.d.ts.map +1 -0
- package/dist/factories/shared.js +364 -0
- package/dist/factories/shared.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/helpers.d.ts +69 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/helpers.js +405 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +11 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/type-guards.d.ts +34 -0
- package/dist/utils/type-guards.d.ts.map +1 -0
- package/dist/utils/type-guards.js +66 -0
- package/dist/utils/type-guards.js.map +1 -0
- package/package.json +109 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path resolution system for YAML resources
|
|
3
|
+
* Handles local files, directories, and Git repositories
|
|
4
|
+
*/
|
|
5
|
+
import { TypeKroError } from '../errors.js';
|
|
6
|
+
/**
|
|
7
|
+
* Information parsed from a git: URL
|
|
8
|
+
*/
|
|
9
|
+
export interface GitPathInfo {
|
|
10
|
+
host: string;
|
|
11
|
+
owner: string;
|
|
12
|
+
repo: string;
|
|
13
|
+
path: string;
|
|
14
|
+
ref: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Result of content resolution
|
|
18
|
+
*/
|
|
19
|
+
export interface ResolvedContent {
|
|
20
|
+
content: string;
|
|
21
|
+
source: 'local' | 'git' | 'http';
|
|
22
|
+
originalPath: string;
|
|
23
|
+
resolvedPath?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Result of directory discovery
|
|
27
|
+
*/
|
|
28
|
+
export interface DiscoveredFile {
|
|
29
|
+
path: string;
|
|
30
|
+
relativePath: string;
|
|
31
|
+
content: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* YAML-specific error types
|
|
35
|
+
*/
|
|
36
|
+
export declare class YamlPathResolutionError extends TypeKroError {
|
|
37
|
+
readonly resourceName: string;
|
|
38
|
+
readonly path: string;
|
|
39
|
+
readonly suggestions?: string[] | undefined;
|
|
40
|
+
constructor(message: string, resourceName: string, path: string, suggestions?: string[] | undefined);
|
|
41
|
+
static invalidGitUrl(resourceName: string, userInput: string): YamlPathResolutionError;
|
|
42
|
+
static fileNotFound(resourceName: string, filePath: string): YamlPathResolutionError;
|
|
43
|
+
static directoryNotFound(resourceName: string, dirPath: string): YamlPathResolutionError;
|
|
44
|
+
}
|
|
45
|
+
export declare class GitContentError extends TypeKroError {
|
|
46
|
+
readonly resourceName: string;
|
|
47
|
+
readonly gitPath: string;
|
|
48
|
+
readonly suggestions?: string[] | undefined;
|
|
49
|
+
constructor(message: string, resourceName: string, gitPath: string, suggestions?: string[] | undefined);
|
|
50
|
+
static repositoryNotFound(resourceName: string, gitPath: string): GitContentError;
|
|
51
|
+
static authenticationFailed(resourceName: string, gitPath: string): GitContentError;
|
|
52
|
+
static pathNotFound(resourceName: string, gitPath: string, pathInRepo: string): GitContentError;
|
|
53
|
+
}
|
|
54
|
+
export declare class YamlProcessingError extends TypeKroError {
|
|
55
|
+
readonly resourceName: string;
|
|
56
|
+
readonly filePath: string;
|
|
57
|
+
readonly line?: number | undefined;
|
|
58
|
+
readonly suggestions?: string[] | undefined;
|
|
59
|
+
constructor(message: string, resourceName: string, filePath: string, line?: number | undefined, suggestions?: string[] | undefined);
|
|
60
|
+
static invalidYaml(resourceName: string, filePath: string, line?: number): YamlProcessingError;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Unified path resolver for local files and Git repositories
|
|
64
|
+
*/
|
|
65
|
+
export declare class PathResolver {
|
|
66
|
+
/**
|
|
67
|
+
* Resolve content from a path (local file or git: URL)
|
|
68
|
+
*/
|
|
69
|
+
resolveContent(filePath: string, resourceName?: string): Promise<ResolvedContent>;
|
|
70
|
+
/**
|
|
71
|
+
* Resolve content from a local file
|
|
72
|
+
*/
|
|
73
|
+
resolveLocalContent(localPath: string, resourceName?: string): Promise<string>;
|
|
74
|
+
/**
|
|
75
|
+
* Resolve content from a Git repository
|
|
76
|
+
*/
|
|
77
|
+
resolveGitContent(gitPath: string, resourceName?: string): Promise<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Parse a git: URL into components
|
|
80
|
+
* Format: git:github.com/owner/repo/path/to/file.yaml[@ref]
|
|
81
|
+
*/
|
|
82
|
+
parseGitPath(gitPath: string, resourceName?: string): GitPathInfo;
|
|
83
|
+
/**
|
|
84
|
+
* Fetch content from Git repository
|
|
85
|
+
* Currently supports GitHub API for public repositories
|
|
86
|
+
*/
|
|
87
|
+
private fetchFromGit;
|
|
88
|
+
/**
|
|
89
|
+
* Discover YAML files in a directory (local or Git)
|
|
90
|
+
*/
|
|
91
|
+
discoverYamlFiles(dirPath: string, options?: {
|
|
92
|
+
recursive?: boolean;
|
|
93
|
+
include?: string[];
|
|
94
|
+
exclude?: string[];
|
|
95
|
+
}, resourceName?: string): Promise<DiscoveredFile[]>;
|
|
96
|
+
/**
|
|
97
|
+
* Discover YAML files in a local directory
|
|
98
|
+
*/
|
|
99
|
+
private discoverLocalYamlFiles;
|
|
100
|
+
/**
|
|
101
|
+
* Recursively walk a directory and collect YAML files
|
|
102
|
+
*/
|
|
103
|
+
private walkDirectory;
|
|
104
|
+
/**
|
|
105
|
+
* Discover YAML files in a Git repository directory
|
|
106
|
+
*/
|
|
107
|
+
private discoverGitYamlFiles;
|
|
108
|
+
/**
|
|
109
|
+
* Check if a file path matches any of the given glob patterns
|
|
110
|
+
* Simple implementation - could be enhanced with a proper glob library
|
|
111
|
+
*/
|
|
112
|
+
private matchesPatterns;
|
|
113
|
+
/**
|
|
114
|
+
* Resolve content from an HTTP/HTTPS URL
|
|
115
|
+
*/
|
|
116
|
+
private resolveHttpContent;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Default path resolver instance
|
|
120
|
+
*/
|
|
121
|
+
export declare const pathResolver: PathResolver;
|
|
122
|
+
//# sourceMappingURL=path-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-resolver.d.ts","sourceRoot":"","sources":["../../../src/core/yaml/path-resolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,YAAY;aAGrC,YAAY,EAAE,MAAM;aACpB,IAAI,EAAE,MAAM;aACZ,WAAW,CAAC,EAAE,MAAM,EAAE;gBAHtC,OAAO,EAAE,MAAM,EACC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,MAAM,EAAE,YAAA;IAUxC,MAAM,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,uBAAuB;IAatF,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,uBAAuB;IAcpF,MAAM,CAAC,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,uBAAuB;CAazF;AAED,qBAAa,eAAgB,SAAQ,YAAY;aAG7B,YAAY,EAAE,MAAM;aACpB,OAAO,EAAE,MAAM;aACf,WAAW,CAAC,EAAE,MAAM,EAAE;gBAHtC,OAAO,EAAE,MAAM,EACC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,EAAE,YAAA;IAUxC,MAAM,CAAC,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,eAAe;IAcjF,MAAM,CAAC,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,eAAe;IAcnF,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,eAAe;CAahG;AAED,qBAAa,mBAAoB,SAAQ,YAAY;aAGjC,YAAY,EAAE,MAAM;aACpB,QAAQ,EAAE,MAAM;aAChB,IAAI,CAAC,EAAE,MAAM;aACb,WAAW,CAAC,EAAE,MAAM,EAAE;gBAJtC,OAAO,EAAE,MAAM,EACC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,YAAA,EACb,WAAW,CAAC,EAAE,MAAM,EAAE,YAAA;IAWxC,MAAM,CAAC,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,mBAAmB;CAe/F;AAED;;GAEG;AACH,qBAAa,YAAY;IACvB;;OAEG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,GAAE,MAAkB,GAAG,OAAO,CAAC,eAAe,CAAC;IA0BlG;;OAEG;IACG,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,GAAE,MAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAkE/F;;OAEG;IACG,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,GAAE,MAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAK3F;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,GAAE,MAAkB,GAAG,WAAW;IAiB5E;;;OAGG;YACW,YAAY;IAqG1B;;OAEG;IACG,iBAAiB,CACrB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QACP,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACf,EACN,YAAY,GAAE,MAAkB,GAC/B,OAAO,CAAC,cAAc,EAAE,CAAC;IAc5B;;OAEG;YACW,sBAAsB;IAyDpC;;OAEG;YACW,aAAa;IAyC3B;;OAEG;YACW,oBAAoB;IAqIlC;;;OAGG;IACH,OAAO,CAAC,eAAe;IA6CvB;;OAEG;YACW,kBAAkB;CAoDjC;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,cAAqB,CAAC"}
|
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path resolution system for YAML resources
|
|
3
|
+
* Handles local files, directories, and Git repositories
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from 'node:fs';
|
|
6
|
+
import * as path from 'node:path';
|
|
7
|
+
import { TypeKroError } from '../errors.js';
|
|
8
|
+
/**
|
|
9
|
+
* YAML-specific error types
|
|
10
|
+
*/
|
|
11
|
+
export class YamlPathResolutionError extends TypeKroError {
|
|
12
|
+
resourceName;
|
|
13
|
+
path;
|
|
14
|
+
suggestions;
|
|
15
|
+
constructor(message, resourceName, path, suggestions) {
|
|
16
|
+
super(message, 'YAML_PATH_RESOLUTION_ERROR', {
|
|
17
|
+
resourceName,
|
|
18
|
+
path,
|
|
19
|
+
suggestions,
|
|
20
|
+
});
|
|
21
|
+
this.resourceName = resourceName;
|
|
22
|
+
this.path = path;
|
|
23
|
+
this.suggestions = suggestions;
|
|
24
|
+
this.name = 'YamlPathResolutionError';
|
|
25
|
+
}
|
|
26
|
+
static invalidGitUrl(resourceName, userInput) {
|
|
27
|
+
return new YamlPathResolutionError(`Invalid git URL format for resource '${resourceName}'. Expected: git:github.com/owner/repo/path@ref\nGot: ${userInput}`, resourceName, userInput, [
|
|
28
|
+
'Use format: git:github.com/owner/repo/path@ref',
|
|
29
|
+
'Example: git:github.com/fluxcd/helm-controller/config/default@main',
|
|
30
|
+
'Use GitPaths.fluxHelm() for common controllers',
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
static fileNotFound(resourceName, filePath) {
|
|
34
|
+
return new YamlPathResolutionError(`File not found for resource '${resourceName}': ${filePath}`, resourceName, filePath, [
|
|
35
|
+
'Check that the file path is correct and the file exists',
|
|
36
|
+
'Ensure the file has proper read permissions',
|
|
37
|
+
'For relative paths, check they are relative to the current working directory',
|
|
38
|
+
'Use absolute paths if needed to avoid path resolution issues',
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
static directoryNotFound(resourceName, dirPath) {
|
|
42
|
+
return new YamlPathResolutionError(`Directory not found for resource '${resourceName}': ${dirPath}`, resourceName, dirPath, [
|
|
43
|
+
'Check that the directory path is correct and the directory exists',
|
|
44
|
+
'Ensure the directory has proper read permissions',
|
|
45
|
+
'For relative paths, check they are relative to the current working directory',
|
|
46
|
+
'Use absolute paths if needed to avoid path resolution issues',
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export class GitContentError extends TypeKroError {
|
|
51
|
+
resourceName;
|
|
52
|
+
gitPath;
|
|
53
|
+
suggestions;
|
|
54
|
+
constructor(message, resourceName, gitPath, suggestions) {
|
|
55
|
+
super(message, 'GIT_CONTENT_ERROR', {
|
|
56
|
+
resourceName,
|
|
57
|
+
gitPath,
|
|
58
|
+
suggestions,
|
|
59
|
+
});
|
|
60
|
+
this.resourceName = resourceName;
|
|
61
|
+
this.gitPath = gitPath;
|
|
62
|
+
this.suggestions = suggestions;
|
|
63
|
+
this.name = 'GitContentError';
|
|
64
|
+
}
|
|
65
|
+
static repositoryNotFound(resourceName, gitPath) {
|
|
66
|
+
return new GitContentError(`Git repository not found for resource '${resourceName}': ${gitPath}`, resourceName, gitPath, [
|
|
67
|
+
'Check that the repository exists and is accessible',
|
|
68
|
+
'Verify the repository URL and path are correct',
|
|
69
|
+
'For private repositories, ensure authentication is configured',
|
|
70
|
+
'Try using a specific branch or tag: @main, @v1.0.0',
|
|
71
|
+
]);
|
|
72
|
+
}
|
|
73
|
+
static authenticationFailed(resourceName, gitPath) {
|
|
74
|
+
return new GitContentError(`Git authentication failed for resource '${resourceName}': ${gitPath}`, resourceName, gitPath, [
|
|
75
|
+
'Ensure Git credentials are properly configured',
|
|
76
|
+
'For GitHub, check that your personal access token has the required permissions',
|
|
77
|
+
'For private repositories, verify you have read access',
|
|
78
|
+
'Consider using SSH keys for authentication',
|
|
79
|
+
]);
|
|
80
|
+
}
|
|
81
|
+
static pathNotFound(resourceName, gitPath, pathInRepo) {
|
|
82
|
+
return new GitContentError(`Path not found in Git repository for resource '${resourceName}': ${pathInRepo} in ${gitPath}`, resourceName, gitPath, [
|
|
83
|
+
'Check that the path exists in the specified branch/tag',
|
|
84
|
+
'Verify the path is correct (case-sensitive)',
|
|
85
|
+
'Try browsing the repository to confirm the path structure',
|
|
86
|
+
'Ensure you are using the correct branch or tag reference',
|
|
87
|
+
]);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export class YamlProcessingError extends TypeKroError {
|
|
91
|
+
resourceName;
|
|
92
|
+
filePath;
|
|
93
|
+
line;
|
|
94
|
+
suggestions;
|
|
95
|
+
constructor(message, resourceName, filePath, line, suggestions) {
|
|
96
|
+
super(message, 'YAML_PROCESSING_ERROR', {
|
|
97
|
+
resourceName,
|
|
98
|
+
filePath,
|
|
99
|
+
line,
|
|
100
|
+
suggestions,
|
|
101
|
+
});
|
|
102
|
+
this.resourceName = resourceName;
|
|
103
|
+
this.filePath = filePath;
|
|
104
|
+
this.line = line;
|
|
105
|
+
this.suggestions = suggestions;
|
|
106
|
+
this.name = 'YamlProcessingError';
|
|
107
|
+
}
|
|
108
|
+
static invalidYaml(resourceName, filePath, line) {
|
|
109
|
+
const lineInfo = line ? ` at line ${line}` : '';
|
|
110
|
+
return new YamlProcessingError(`Invalid YAML syntax in resource '${resourceName}' file '${filePath}'${lineInfo}`, resourceName, filePath, line, [
|
|
111
|
+
'Check YAML syntax for proper indentation and structure',
|
|
112
|
+
'Ensure all strings are properly quoted',
|
|
113
|
+
'Validate YAML using a linter or online validator',
|
|
114
|
+
'Check for tabs vs spaces consistency',
|
|
115
|
+
]);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Unified path resolver for local files and Git repositories
|
|
120
|
+
*/
|
|
121
|
+
export class PathResolver {
|
|
122
|
+
/**
|
|
123
|
+
* Resolve content from a path (local file or git: URL)
|
|
124
|
+
*/
|
|
125
|
+
async resolveContent(filePath, resourceName = 'unknown') {
|
|
126
|
+
if (filePath.startsWith('git:')) {
|
|
127
|
+
const content = await this.resolveGitContent(filePath, resourceName);
|
|
128
|
+
return {
|
|
129
|
+
content,
|
|
130
|
+
source: 'git',
|
|
131
|
+
originalPath: filePath,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
else if (filePath.startsWith('https://') || filePath.startsWith('http://')) {
|
|
135
|
+
const content = await this.resolveHttpContent(filePath, resourceName);
|
|
136
|
+
return {
|
|
137
|
+
content,
|
|
138
|
+
source: 'http',
|
|
139
|
+
originalPath: filePath,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
const content = await this.resolveLocalContent(filePath, resourceName);
|
|
144
|
+
return {
|
|
145
|
+
content,
|
|
146
|
+
source: 'local',
|
|
147
|
+
originalPath: filePath,
|
|
148
|
+
resolvedPath: path.isAbsolute(filePath) ? filePath : path.resolve(process.cwd(), filePath),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Resolve content from a local file
|
|
154
|
+
*/
|
|
155
|
+
async resolveLocalContent(localPath, resourceName = 'unknown') {
|
|
156
|
+
try {
|
|
157
|
+
// Resolve relative paths
|
|
158
|
+
const resolvedPath = path.isAbsolute(localPath)
|
|
159
|
+
? localPath
|
|
160
|
+
: path.resolve(process.cwd(), localPath);
|
|
161
|
+
// Check if file exists
|
|
162
|
+
if (!fs.existsSync(resolvedPath)) {
|
|
163
|
+
throw YamlPathResolutionError.fileNotFound(resourceName, localPath);
|
|
164
|
+
}
|
|
165
|
+
// Check if it's a file (not a directory)
|
|
166
|
+
const stats = fs.statSync(resolvedPath);
|
|
167
|
+
if (!stats.isFile()) {
|
|
168
|
+
throw new YamlPathResolutionError(`Path is not a file for resource '${resourceName}': ${localPath}`, resourceName, localPath, [
|
|
169
|
+
'Ensure the path points to a file, not a directory',
|
|
170
|
+
'Use yamlDirectory() factory for directory processing',
|
|
171
|
+
'Check that the path is correct',
|
|
172
|
+
]);
|
|
173
|
+
}
|
|
174
|
+
// Read file content
|
|
175
|
+
return fs.readFileSync(resolvedPath, 'utf-8');
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
if (error instanceof YamlPathResolutionError) {
|
|
179
|
+
throw error;
|
|
180
|
+
}
|
|
181
|
+
// Handle other file system errors
|
|
182
|
+
if (error instanceof Error) {
|
|
183
|
+
if (error.message.includes('ENOENT')) {
|
|
184
|
+
throw YamlPathResolutionError.fileNotFound(resourceName, localPath);
|
|
185
|
+
}
|
|
186
|
+
if (error.message.includes('EACCES')) {
|
|
187
|
+
throw new YamlPathResolutionError(`Permission denied reading file for resource '${resourceName}': ${localPath}`, resourceName, localPath, [
|
|
188
|
+
'Check file permissions and ensure read access',
|
|
189
|
+
'Run with appropriate user permissions',
|
|
190
|
+
'Verify the file is not locked by another process',
|
|
191
|
+
]);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
throw new YamlPathResolutionError(`Failed to read file for resource '${resourceName}': ${localPath}. ${error}`, resourceName, localPath, [
|
|
195
|
+
'Check that the file exists and is readable',
|
|
196
|
+
'Verify file permissions',
|
|
197
|
+
'Ensure the path is correct',
|
|
198
|
+
]);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Resolve content from a Git repository
|
|
203
|
+
*/
|
|
204
|
+
async resolveGitContent(gitPath, resourceName = 'unknown') {
|
|
205
|
+
const parsed = this.parseGitPath(gitPath, resourceName);
|
|
206
|
+
return this.fetchFromGit(parsed, resourceName);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Parse a git: URL into components
|
|
210
|
+
* Format: git:github.com/owner/repo/path/to/file.yaml[@ref]
|
|
211
|
+
*/
|
|
212
|
+
parseGitPath(gitPath, resourceName = 'unknown') {
|
|
213
|
+
// Match git: URLs with optional @ref suffix
|
|
214
|
+
const match = gitPath.match(/^git:([^/]+)\/([^/]+)\/([^/]+)\/(.+?)(?:@(.+))?$/);
|
|
215
|
+
if (!match) {
|
|
216
|
+
throw YamlPathResolutionError.invalidGitUrl(resourceName, gitPath);
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
host: match[1],
|
|
220
|
+
owner: match[2],
|
|
221
|
+
repo: match[3],
|
|
222
|
+
path: match[4],
|
|
223
|
+
ref: match[5] || 'main',
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Fetch content from Git repository
|
|
228
|
+
* Currently supports GitHub API for public repositories
|
|
229
|
+
*/
|
|
230
|
+
async fetchFromGit(gitInfo, resourceName) {
|
|
231
|
+
// For now, we'll implement GitHub API support
|
|
232
|
+
// In the future, this could be extended to support other Git hosts
|
|
233
|
+
if (gitInfo.host !== 'github.com') {
|
|
234
|
+
throw new GitContentError(`Unsupported Git host for resource '${resourceName}': ${gitInfo.host}. Currently only github.com is supported.`, resourceName, `git:${gitInfo.host}/${gitInfo.owner}/${gitInfo.repo}/${gitInfo.path}@${gitInfo.ref}`, [
|
|
235
|
+
'Use github.com for Git repositories',
|
|
236
|
+
'Consider using local files or copying the repository locally',
|
|
237
|
+
'Future versions may support additional Git hosts',
|
|
238
|
+
]);
|
|
239
|
+
}
|
|
240
|
+
try {
|
|
241
|
+
// Use GitHub API to fetch file content
|
|
242
|
+
const apiUrl = `https://api.github.com/repos/${gitInfo.owner}/${gitInfo.repo}/contents/${gitInfo.path}?ref=${gitInfo.ref}`;
|
|
243
|
+
const response = await fetch(apiUrl, {
|
|
244
|
+
headers: {
|
|
245
|
+
'Accept': 'application/vnd.github.v3+json',
|
|
246
|
+
'User-Agent': 'TypeKro/1.0',
|
|
247
|
+
// TODO: Add authentication support for private repositories
|
|
248
|
+
// 'Authorization': `token ${process.env.GITHUB_TOKEN}`,
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
if (!response.ok) {
|
|
252
|
+
if (response.status === 404) {
|
|
253
|
+
// Check if it's the repository or the path that's not found
|
|
254
|
+
const repoCheckUrl = `https://api.github.com/repos/${gitInfo.owner}/${gitInfo.repo}`;
|
|
255
|
+
const repoResponse = await fetch(repoCheckUrl, {
|
|
256
|
+
headers: {
|
|
257
|
+
'Accept': 'application/vnd.github.v3+json',
|
|
258
|
+
'User-Agent': 'TypeKro/1.0',
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
if (!repoResponse.ok) {
|
|
262
|
+
throw GitContentError.repositoryNotFound(resourceName, `git:${gitInfo.host}/${gitInfo.owner}/${gitInfo.repo}`);
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
throw GitContentError.pathNotFound(resourceName, `git:${gitInfo.host}/${gitInfo.owner}/${gitInfo.repo}`, gitInfo.path);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (response.status === 401 || response.status === 403) {
|
|
269
|
+
throw GitContentError.authenticationFailed(resourceName, `git:${gitInfo.host}/${gitInfo.owner}/${gitInfo.repo}/${gitInfo.path}@${gitInfo.ref}`);
|
|
270
|
+
}
|
|
271
|
+
throw new GitContentError(`Failed to fetch Git content for resource '${resourceName}': HTTP ${response.status} ${response.statusText}`, resourceName, `git:${gitInfo.host}/${gitInfo.owner}/${gitInfo.repo}/${gitInfo.path}@${gitInfo.ref}`, [
|
|
272
|
+
'Check that the repository and path exist',
|
|
273
|
+
'Verify the branch or tag reference is correct',
|
|
274
|
+
'For private repositories, ensure authentication is configured',
|
|
275
|
+
'Check GitHub API rate limits',
|
|
276
|
+
]);
|
|
277
|
+
}
|
|
278
|
+
const data = await response.json();
|
|
279
|
+
// GitHub API returns base64-encoded content for files
|
|
280
|
+
if (data.type === 'file' && data.content) {
|
|
281
|
+
return Buffer.from(data.content, 'base64').toString('utf-8');
|
|
282
|
+
}
|
|
283
|
+
throw new GitContentError(`Unexpected content type from Git repository for resource '${resourceName}': expected file, got ${data.type}`, resourceName, `git:${gitInfo.host}/${gitInfo.owner}/${gitInfo.repo}/${gitInfo.path}@${gitInfo.ref}`, [
|
|
284
|
+
'Ensure the path points to a file, not a directory',
|
|
285
|
+
'Use yamlDirectory() factory for directory processing',
|
|
286
|
+
'Check that the path is correct in the repository',
|
|
287
|
+
]);
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
if (error instanceof GitContentError) {
|
|
291
|
+
throw error;
|
|
292
|
+
}
|
|
293
|
+
// Handle network and other errors
|
|
294
|
+
throw new GitContentError(`Network error fetching Git content for resource '${resourceName}': ${error}`, resourceName, `git:${gitInfo.host}/${gitInfo.owner}/${gitInfo.repo}/${gitInfo.path}@${gitInfo.ref}`, [
|
|
295
|
+
'Check your internet connection',
|
|
296
|
+
'Verify the repository URL is correct',
|
|
297
|
+
'Check if GitHub is accessible',
|
|
298
|
+
'Consider using local files if network access is limited',
|
|
299
|
+
]);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Discover YAML files in a directory (local or Git)
|
|
304
|
+
*/
|
|
305
|
+
async discoverYamlFiles(dirPath, options = {}, resourceName = 'unknown') {
|
|
306
|
+
const { recursive = true, include = ['**/*.yaml', '**/*.yml'], exclude = [], } = options;
|
|
307
|
+
if (dirPath.startsWith('git:')) {
|
|
308
|
+
return this.discoverGitYamlFiles(dirPath, { recursive, include, exclude }, resourceName);
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
return this.discoverLocalYamlFiles(dirPath, { recursive, include, exclude }, resourceName);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Discover YAML files in a local directory
|
|
316
|
+
*/
|
|
317
|
+
async discoverLocalYamlFiles(dirPath, options, resourceName) {
|
|
318
|
+
try {
|
|
319
|
+
// Resolve relative paths
|
|
320
|
+
const resolvedPath = path.isAbsolute(dirPath)
|
|
321
|
+
? dirPath
|
|
322
|
+
: path.resolve(process.cwd(), dirPath);
|
|
323
|
+
// Check if directory exists
|
|
324
|
+
if (!fs.existsSync(resolvedPath)) {
|
|
325
|
+
throw YamlPathResolutionError.directoryNotFound(resourceName, dirPath);
|
|
326
|
+
}
|
|
327
|
+
// Check if it's a directory
|
|
328
|
+
const stats = fs.statSync(resolvedPath);
|
|
329
|
+
if (!stats.isDirectory()) {
|
|
330
|
+
throw new YamlPathResolutionError(`Path is not a directory for resource '${resourceName}': ${dirPath}`, resourceName, dirPath, [
|
|
331
|
+
'Ensure the path points to a directory, not a file',
|
|
332
|
+
'Use yamlFile() factory for single file processing',
|
|
333
|
+
'Check that the path is correct',
|
|
334
|
+
]);
|
|
335
|
+
}
|
|
336
|
+
const files = [];
|
|
337
|
+
await this.walkDirectory(resolvedPath, resolvedPath, files, options, resourceName);
|
|
338
|
+
return files;
|
|
339
|
+
}
|
|
340
|
+
catch (error) {
|
|
341
|
+
if (error instanceof YamlPathResolutionError) {
|
|
342
|
+
throw error;
|
|
343
|
+
}
|
|
344
|
+
throw new YamlPathResolutionError(`Failed to discover files in directory for resource '${resourceName}': ${dirPath}. ${error}`, resourceName, dirPath, [
|
|
345
|
+
'Check that the directory exists and is readable',
|
|
346
|
+
'Verify directory permissions',
|
|
347
|
+
'Ensure the path is correct',
|
|
348
|
+
]);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Recursively walk a directory and collect YAML files
|
|
353
|
+
*/
|
|
354
|
+
async walkDirectory(currentPath, basePath, files, options, resourceName) {
|
|
355
|
+
const entries = fs.readdirSync(currentPath, { withFileTypes: true });
|
|
356
|
+
for (const entry of entries) {
|
|
357
|
+
const fullPath = path.join(currentPath, entry.name);
|
|
358
|
+
const relativePath = path.relative(basePath, fullPath);
|
|
359
|
+
if (entry.isDirectory()) {
|
|
360
|
+
if (options.recursive) {
|
|
361
|
+
await this.walkDirectory(fullPath, basePath, files, options, resourceName);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
else if (entry.isFile()) {
|
|
365
|
+
// Check if file matches include/exclude patterns
|
|
366
|
+
if (this.matchesPatterns(relativePath, options.include) &&
|
|
367
|
+
!this.matchesPatterns(relativePath, options.exclude)) {
|
|
368
|
+
try {
|
|
369
|
+
const content = fs.readFileSync(fullPath, 'utf-8');
|
|
370
|
+
files.push({
|
|
371
|
+
path: fullPath,
|
|
372
|
+
relativePath,
|
|
373
|
+
content,
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
catch (error) {
|
|
377
|
+
// Log warning but continue processing other files
|
|
378
|
+
console.warn(`Warning: Could not read file ${fullPath}: ${error}`);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Discover YAML files in a Git repository directory
|
|
386
|
+
*/
|
|
387
|
+
async discoverGitYamlFiles(gitPath, options, resourceName) {
|
|
388
|
+
const parsed = this.parseGitPath(gitPath, resourceName);
|
|
389
|
+
// For now, we'll implement a simple approach using GitHub API
|
|
390
|
+
// This could be enhanced to support more complex directory traversal
|
|
391
|
+
if (parsed.host !== 'github.com') {
|
|
392
|
+
throw new GitContentError(`Unsupported Git host for directory discovery in resource '${resourceName}': ${parsed.host}. Currently only github.com is supported.`, resourceName, gitPath, [
|
|
393
|
+
'Use github.com for Git repositories',
|
|
394
|
+
'Consider using local files or cloning the repository locally',
|
|
395
|
+
'Future versions may support additional Git hosts',
|
|
396
|
+
]);
|
|
397
|
+
}
|
|
398
|
+
try {
|
|
399
|
+
// Use GitHub API to list directory contents
|
|
400
|
+
const apiUrl = `https://api.github.com/repos/${parsed.owner}/${parsed.repo}/contents/${parsed.path}?ref=${parsed.ref}`;
|
|
401
|
+
const response = await fetch(apiUrl, {
|
|
402
|
+
headers: {
|
|
403
|
+
'Accept': 'application/vnd.github.v3+json',
|
|
404
|
+
'User-Agent': 'TypeKro/1.0',
|
|
405
|
+
},
|
|
406
|
+
});
|
|
407
|
+
if (!response.ok) {
|
|
408
|
+
if (response.status === 404) {
|
|
409
|
+
throw GitContentError.pathNotFound(resourceName, gitPath, parsed.path);
|
|
410
|
+
}
|
|
411
|
+
throw new GitContentError(`Failed to list Git directory for resource '${resourceName}': HTTP ${response.status}`, resourceName, gitPath, [
|
|
412
|
+
'Check that the repository and directory path exist',
|
|
413
|
+
'Verify the branch or tag reference is correct',
|
|
414
|
+
'For private repositories, ensure authentication is configured',
|
|
415
|
+
]);
|
|
416
|
+
}
|
|
417
|
+
const data = await response.json();
|
|
418
|
+
if (!Array.isArray(data)) {
|
|
419
|
+
throw new GitContentError(`Expected directory listing from Git repository for resource '${resourceName}', but got a file`, resourceName, gitPath, [
|
|
420
|
+
'Ensure the path points to a directory, not a file',
|
|
421
|
+
'Use yamlFile() factory for single file processing',
|
|
422
|
+
'Check that the path is correct in the repository',
|
|
423
|
+
]);
|
|
424
|
+
}
|
|
425
|
+
const files = [];
|
|
426
|
+
// Process files in the directory
|
|
427
|
+
for (const item of data) {
|
|
428
|
+
if (item.type === 'file') {
|
|
429
|
+
const relativePath = item.name;
|
|
430
|
+
// Check if file matches include/exclude patterns
|
|
431
|
+
if (this.matchesPatterns(relativePath, options.include) &&
|
|
432
|
+
!this.matchesPatterns(relativePath, options.exclude)) {
|
|
433
|
+
try {
|
|
434
|
+
// Fetch file content
|
|
435
|
+
const fileContent = await this.resolveGitContent(`git:${parsed.host}/${parsed.owner}/${parsed.repo}/${item.path}@${parsed.ref}`, resourceName);
|
|
436
|
+
files.push({
|
|
437
|
+
path: item.path,
|
|
438
|
+
relativePath,
|
|
439
|
+
content: fileContent,
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
catch (error) {
|
|
443
|
+
// Log warning but continue processing other files
|
|
444
|
+
console.warn(`Warning: Could not fetch file ${item.path}: ${error}`);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
else if (item.type === 'dir' && options.recursive) {
|
|
449
|
+
// Recursively process subdirectories
|
|
450
|
+
const subDirFiles = await this.discoverGitYamlFiles(`git:${parsed.host}/${parsed.owner}/${parsed.repo}/${item.path}@${parsed.ref}`, options, resourceName);
|
|
451
|
+
// Adjust relative paths for subdirectory files
|
|
452
|
+
const adjustedFiles = subDirFiles.map(file => ({
|
|
453
|
+
...file,
|
|
454
|
+
relativePath: path.join(item.name, file.relativePath),
|
|
455
|
+
}));
|
|
456
|
+
files.push(...adjustedFiles);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return files;
|
|
460
|
+
}
|
|
461
|
+
catch (error) {
|
|
462
|
+
if (error instanceof GitContentError) {
|
|
463
|
+
throw error;
|
|
464
|
+
}
|
|
465
|
+
throw new GitContentError(`Network error discovering Git directory for resource '${resourceName}': ${error}`, resourceName, gitPath, [
|
|
466
|
+
'Check your internet connection',
|
|
467
|
+
'Verify the repository URL is correct',
|
|
468
|
+
'Check if GitHub is accessible',
|
|
469
|
+
'Consider using local files if network access is limited',
|
|
470
|
+
]);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Check if a file path matches any of the given glob patterns
|
|
475
|
+
* Simple implementation - could be enhanced with a proper glob library
|
|
476
|
+
*/
|
|
477
|
+
matchesPatterns(filePath, patterns) {
|
|
478
|
+
if (patterns.length === 0) {
|
|
479
|
+
return false;
|
|
480
|
+
}
|
|
481
|
+
return patterns.some(pattern => {
|
|
482
|
+
// Convert simple glob patterns to regex
|
|
483
|
+
// This is a basic implementation - could use a proper glob library like minimatch
|
|
484
|
+
try {
|
|
485
|
+
// Simple cases first
|
|
486
|
+
if (pattern === '*') {
|
|
487
|
+
return true;
|
|
488
|
+
}
|
|
489
|
+
if (!pattern.includes('*') && !pattern.includes('?')) {
|
|
490
|
+
// Exact match
|
|
491
|
+
return filePath === pattern;
|
|
492
|
+
}
|
|
493
|
+
// Handle ** first (before escaping)
|
|
494
|
+
let regexPattern = pattern.replace(/\*\*/g, '__DOUBLESTAR__');
|
|
495
|
+
// Escape special regex characters except * and ?
|
|
496
|
+
regexPattern = regexPattern.replace(/[.+^${}()|[\]\\]/g, '\\$&');
|
|
497
|
+
// Convert glob patterns to regex
|
|
498
|
+
regexPattern = regexPattern
|
|
499
|
+
.replace(/__DOUBLESTAR__/g, '.*') // ** matches any number of directories (including /)
|
|
500
|
+
.replace(/\\\*/g, '[^/]*') // * matches any characters except /
|
|
501
|
+
.replace(/\\\?/g, '.'); // ? matches any single character
|
|
502
|
+
const regex = new RegExp(`^${regexPattern}$`);
|
|
503
|
+
return regex.test(filePath);
|
|
504
|
+
}
|
|
505
|
+
catch (_error) {
|
|
506
|
+
// If regex fails, fall back to simple extension matching
|
|
507
|
+
if (pattern.startsWith('*.')) {
|
|
508
|
+
const extension = pattern.substring(2);
|
|
509
|
+
return filePath.endsWith(`.${extension}`);
|
|
510
|
+
}
|
|
511
|
+
return false;
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Resolve content from an HTTP/HTTPS URL
|
|
517
|
+
*/
|
|
518
|
+
async resolveHttpContent(url, resourceName = 'unknown') {
|
|
519
|
+
try {
|
|
520
|
+
const response = await fetch(url);
|
|
521
|
+
if (!response.ok) {
|
|
522
|
+
throw new YamlPathResolutionError(`Failed to fetch HTTP resource for resource '${resourceName}': HTTP ${response.status} ${response.statusText}`, resourceName, url, [
|
|
523
|
+
'Check that the URL is correct and accessible',
|
|
524
|
+
'Verify the resource exists at the specified URL',
|
|
525
|
+
'Check network connectivity and firewall settings',
|
|
526
|
+
'For private resources, ensure proper authentication is configured',
|
|
527
|
+
]);
|
|
528
|
+
}
|
|
529
|
+
const content = await response.text();
|
|
530
|
+
if (!content || content.trim().length === 0) {
|
|
531
|
+
throw new YamlPathResolutionError(`Empty content received from HTTP resource for resource '${resourceName}': ${url}`, resourceName, url, [
|
|
532
|
+
'Check that the URL points to a valid YAML file',
|
|
533
|
+
'Verify the resource is not empty',
|
|
534
|
+
'Try accessing the URL directly in a browser',
|
|
535
|
+
]);
|
|
536
|
+
}
|
|
537
|
+
return content;
|
|
538
|
+
}
|
|
539
|
+
catch (error) {
|
|
540
|
+
if (error instanceof YamlPathResolutionError) {
|
|
541
|
+
throw error;
|
|
542
|
+
}
|
|
543
|
+
throw new YamlPathResolutionError(`Failed to resolve HTTP content for resource '${resourceName}': ${error instanceof Error ? error.message : String(error)}`, resourceName, url, [
|
|
544
|
+
'Check network connectivity',
|
|
545
|
+
'Verify the URL is correct and accessible',
|
|
546
|
+
'Check for any firewall or proxy issues',
|
|
547
|
+
'Try accessing the URL directly to verify it works',
|
|
548
|
+
]);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Default path resolver instance
|
|
554
|
+
*/
|
|
555
|
+
export const pathResolver = new PathResolver();
|
|
556
|
+
//# sourceMappingURL=path-resolver.js.map
|