typekro 0.3.1 → 0.4.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/README.md +142 -1054
- package/dist/.tsbuildinfo +1 -1
- package/dist/alchemy/deployers.d.ts +0 -5
- package/dist/alchemy/deployers.d.ts.map +1 -1
- package/dist/alchemy/deployers.js +25 -72
- package/dist/alchemy/deployers.js.map +1 -1
- package/dist/core/composition/imperative.d.ts +2 -2
- package/dist/core/composition/imperative.d.ts.map +1 -1
- package/dist/core/composition/imperative.js +394 -10
- package/dist/core/composition/imperative.js.map +1 -1
- package/dist/core/composition/typekro-runtime/typekro-runtime.d.ts +1 -9
- package/dist/core/composition/typekro-runtime/typekro-runtime.d.ts.map +1 -1
- package/dist/core/composition/typekro-runtime/typekro-runtime.js +76 -10
- package/dist/core/composition/typekro-runtime/typekro-runtime.js.map +1 -1
- package/dist/core/composition/typekro-runtime/types.d.ts +8 -5
- package/dist/core/composition/typekro-runtime/types.d.ts.map +1 -1
- package/dist/core/composition/typekro-runtime/types.js.map +1 -1
- package/dist/core/constants/brands.d.ts +20 -0
- package/dist/core/constants/brands.d.ts.map +1 -1
- package/dist/core/constants/brands.js +20 -0
- package/dist/core/constants/brands.js.map +1 -1
- package/dist/core/deployment/direct-factory.d.ts +36 -1
- package/dist/core/deployment/direct-factory.d.ts.map +1 -1
- package/dist/core/deployment/direct-factory.js +289 -4
- package/dist/core/deployment/direct-factory.js.map +1 -1
- package/dist/core/deployment/engine.d.ts +44 -2
- package/dist/core/deployment/engine.d.ts.map +1 -1
- package/dist/core/deployment/engine.js +645 -63
- package/dist/core/deployment/engine.js.map +1 -1
- package/dist/core/deployment/event-filter.d.ts.map +1 -1
- package/dist/core/deployment/event-filter.js +6 -7
- package/dist/core/deployment/event-filter.js.map +1 -1
- package/dist/core/deployment/event-monitor.d.ts +36 -2
- package/dist/core/deployment/event-monitor.d.ts.map +1 -1
- package/dist/core/deployment/event-monitor.js +183 -33
- package/dist/core/deployment/event-monitor.js.map +1 -1
- package/dist/core/deployment/kro-factory.d.ts +22 -0
- package/dist/core/deployment/kro-factory.d.ts.map +1 -1
- package/dist/core/deployment/kro-factory.js +291 -27
- package/dist/core/deployment/kro-factory.js.map +1 -1
- package/dist/core/deployment/readiness.d.ts.map +1 -1
- package/dist/core/deployment/readiness.js +4 -2
- package/dist/core/deployment/readiness.js.map +1 -1
- package/dist/core/deployment/rollback-manager.d.ts +2 -1
- package/dist/core/deployment/rollback-manager.d.ts.map +1 -1
- package/dist/core/deployment/rollback-manager.js +5 -2
- package/dist/core/deployment/rollback-manager.js.map +1 -1
- package/dist/core/deployment/shared-utilities.js.map +1 -1
- package/dist/core/deployment/status-hydrator.d.ts +1 -1
- package/dist/core/deployment/status-hydrator.d.ts.map +1 -1
- package/dist/core/deployment/status-hydrator.js +8 -5
- package/dist/core/deployment/status-hydrator.js.map +1 -1
- package/dist/core/deployment/strategies/base-strategy.d.ts.map +1 -1
- package/dist/core/deployment/strategies/base-strategy.js +60 -21
- package/dist/core/deployment/strategies/base-strategy.js.map +1 -1
- package/dist/core/deployment/strategies/direct-strategy.d.ts +7 -0
- package/dist/core/deployment/strategies/direct-strategy.d.ts.map +1 -1
- package/dist/core/deployment/strategies/direct-strategy.js +50 -0
- package/dist/core/deployment/strategies/direct-strategy.js.map +1 -1
- package/dist/core/deployment/strategies/kro-strategy.d.ts +5 -0
- package/dist/core/deployment/strategies/kro-strategy.d.ts.map +1 -1
- package/dist/core/deployment/strategies/kro-strategy.js +53 -4
- package/dist/core/deployment/strategies/kro-strategy.js.map +1 -1
- package/dist/core/expressions/analyzer.d.ts +6 -6
- package/dist/core/expressions/analyzer.d.ts.map +1 -1
- package/dist/core/expressions/analyzer.js +40 -75
- package/dist/core/expressions/analyzer.js.map +1 -1
- package/dist/core/expressions/cel-conversion-engine.d.ts.map +1 -1
- package/dist/core/expressions/cel-conversion-engine.js +10 -11
- package/dist/core/expressions/cel-conversion-engine.js.map +1 -1
- package/dist/core/expressions/composition-integration.d.ts +2 -2
- package/dist/core/expressions/composition-integration.d.ts.map +1 -1
- package/dist/core/expressions/composition-integration.js +20 -12
- package/dist/core/expressions/composition-integration.js.map +1 -1
- package/dist/core/expressions/field-hydration-processor.d.ts +4 -1
- package/dist/core/expressions/field-hydration-processor.d.ts.map +1 -1
- package/dist/core/expressions/field-hydration-processor.js +12 -13
- package/dist/core/expressions/field-hydration-processor.js.map +1 -1
- package/dist/core/expressions/imperative-analyzer.d.ts.map +1 -1
- package/dist/core/expressions/imperative-analyzer.js +54 -24
- package/dist/core/expressions/imperative-analyzer.js.map +1 -1
- package/dist/core/expressions/index.d.ts +2 -0
- package/dist/core/expressions/index.d.ts.map +1 -1
- package/dist/core/expressions/index.js +2 -0
- package/dist/core/expressions/index.js.map +1 -1
- package/dist/core/expressions/magic-proxy-analyzer.d.ts +1 -1
- package/dist/core/expressions/magic-proxy-analyzer.d.ts.map +1 -1
- package/dist/core/expressions/magic-proxy-analyzer.js +8 -7
- package/dist/core/expressions/magic-proxy-analyzer.js.map +1 -1
- package/dist/core/expressions/parser.d.ts +163 -0
- package/dist/core/expressions/parser.d.ts.map +1 -0
- package/dist/core/expressions/parser.js +272 -0
- package/dist/core/expressions/parser.js.map +1 -0
- package/dist/core/kubernetes/api.d.ts.map +1 -1
- package/dist/core/kubernetes/api.js +5 -6
- package/dist/core/kubernetes/api.js.map +1 -1
- package/dist/core/kubernetes/bun-api-client.d.ts +95 -0
- package/dist/core/kubernetes/bun-api-client.d.ts.map +1 -0
- package/dist/core/kubernetes/bun-api-client.js +160 -0
- package/dist/core/kubernetes/bun-api-client.js.map +1 -0
- package/dist/core/kubernetes/bun-http-library.d.ts +38 -0
- package/dist/core/kubernetes/bun-http-library.d.ts.map +1 -0
- package/dist/core/kubernetes/bun-http-library.js +133 -0
- package/dist/core/kubernetes/bun-http-library.js.map +1 -0
- package/dist/core/kubernetes/client-provider.d.ts +3 -0
- package/dist/core/kubernetes/client-provider.d.ts.map +1 -1
- package/dist/core/kubernetes/client-provider.js +32 -23
- package/dist/core/kubernetes/client-provider.js.map +1 -1
- package/dist/core/kubernetes/errors.d.ts +189 -0
- package/dist/core/kubernetes/errors.d.ts.map +1 -0
- package/dist/core/kubernetes/errors.js +298 -0
- package/dist/core/kubernetes/errors.js.map +1 -0
- package/dist/core/kubernetes/index.d.ts +19 -0
- package/dist/core/kubernetes/index.d.ts.map +1 -0
- package/dist/core/kubernetes/index.js +23 -0
- package/dist/core/kubernetes/index.js.map +1 -0
- package/dist/core/kubernetes/type-guards.d.ts +142 -0
- package/dist/core/kubernetes/type-guards.d.ts.map +1 -0
- package/dist/core/kubernetes/type-guards.js +151 -0
- package/dist/core/kubernetes/type-guards.js.map +1 -0
- package/dist/core/logging/logger.d.ts.map +1 -1
- package/dist/core/logging/logger.js +8 -0
- package/dist/core/logging/logger.js.map +1 -1
- package/dist/core/readiness/cluster-state.d.ts.map +1 -1
- package/dist/core/readiness/cluster-state.js +6 -4
- package/dist/core/readiness/cluster-state.js.map +1 -1
- package/dist/core/references/cel-evaluator.d.ts.map +1 -1
- package/dist/core/references/cel-evaluator.js +12 -2
- package/dist/core/references/cel-evaluator.js.map +1 -1
- package/dist/core/references/cel.js +1 -1
- package/dist/core/references/cel.js.map +1 -1
- package/dist/core/references/resolver.d.ts +28 -1
- package/dist/core/references/resolver.d.ts.map +1 -1
- package/dist/core/references/resolver.js +325 -11
- package/dist/core/references/resolver.js.map +1 -1
- package/dist/core/references/schema-proxy.d.ts.map +1 -1
- package/dist/core/references/schema-proxy.js +14 -5
- package/dist/core/references/schema-proxy.js.map +1 -1
- package/dist/core/scope/resolver.d.ts +16 -0
- package/dist/core/scope/resolver.d.ts.map +1 -0
- package/dist/core/scope/resolver.js +45 -0
- package/dist/core/scope/resolver.js.map +1 -0
- package/dist/core/serialization/core.d.ts +1 -1
- package/dist/core/serialization/core.d.ts.map +1 -1
- package/dist/core/serialization/core.js +78 -54
- package/dist/core/serialization/core.js.map +1 -1
- package/dist/core/types/common.d.ts +23 -1
- package/dist/core/types/common.d.ts.map +1 -1
- package/dist/core/types/deployment.d.ts +68 -1
- package/dist/core/types/deployment.d.ts.map +1 -1
- package/dist/core/types/deployment.js +17 -0
- package/dist/core/types/deployment.js.map +1 -1
- package/dist/core/types/factory-scope.d.ts +42 -0
- package/dist/core/types/factory-scope.d.ts.map +1 -0
- package/dist/core/types/factory-scope.js +14 -0
- package/dist/core/types/factory-scope.js.map +1 -0
- package/dist/core/types/kubernetes.d.ts +146 -4
- package/dist/core/types/kubernetes.d.ts.map +1 -1
- package/dist/core/types/references.d.ts +47 -3
- package/dist/core/types/references.d.ts.map +1 -1
- package/dist/core/types/references.js.map +1 -1
- package/dist/core/types/serialization.d.ts +17 -6
- package/dist/core/types/serialization.d.ts.map +1 -1
- package/dist/core/utils/crd-patcher.d.ts +30 -0
- package/dist/core/utils/crd-patcher.d.ts.map +1 -0
- package/dist/core/utils/crd-patcher.js +198 -0
- package/dist/core/utils/crd-patcher.js.map +1 -0
- package/dist/core/utils/crd-schema-fix.d.ts +108 -0
- package/dist/core/utils/crd-schema-fix.d.ts.map +1 -0
- package/dist/core/utils/crd-schema-fix.js +245 -0
- package/dist/core/utils/crd-schema-fix.js.map +1 -0
- package/dist/core/utils/index.d.ts +12 -0
- package/dist/core/utils/index.d.ts.map +1 -0
- package/dist/core/utils/index.js +12 -0
- package/dist/core/utils/index.js.map +1 -0
- package/dist/core/utils/minimal-connection-reset-suppression.d.ts +16 -0
- package/dist/core/utils/minimal-connection-reset-suppression.d.ts.map +1 -0
- package/dist/core/utils/minimal-connection-reset-suppression.js +72 -0
- package/dist/core/utils/minimal-connection-reset-suppression.js.map +1 -0
- package/dist/core/utils/output-filter.d.ts +16 -0
- package/dist/core/utils/output-filter.d.ts.map +1 -0
- package/dist/core/utils/output-filter.js +90 -0
- package/dist/core/utils/output-filter.js.map +1 -0
- package/dist/core/utils/scoped-error-suppression.d.ts +25 -0
- package/dist/core/utils/scoped-error-suppression.d.ts.map +1 -0
- package/dist/core/utils/scoped-error-suppression.js +226 -0
- package/dist/core/utils/scoped-error-suppression.js.map +1 -0
- package/dist/core/validation/cel-validator.d.ts.map +1 -1
- package/dist/core/validation/cel-validator.js +52 -12
- package/dist/core/validation/cel-validator.js.map +1 -1
- package/dist/factories/apisix/compositions/apisix-bootstrap.d.ts +38 -0
- package/dist/factories/apisix/compositions/apisix-bootstrap.d.ts.map +1 -0
- package/dist/factories/apisix/compositions/apisix-bootstrap.js +280 -0
- package/dist/factories/apisix/compositions/apisix-bootstrap.js.map +1 -0
- package/dist/factories/apisix/compositions/index.d.ts +5 -0
- package/dist/factories/apisix/compositions/index.d.ts.map +1 -0
- package/dist/factories/apisix/compositions/index.js +5 -0
- package/dist/factories/apisix/compositions/index.js.map +1 -0
- package/dist/factories/apisix/index.d.ts +11 -0
- package/dist/factories/apisix/index.d.ts.map +1 -0
- package/dist/factories/apisix/index.js +11 -0
- package/dist/factories/apisix/index.js.map +1 -0
- package/dist/factories/apisix/resources/helm.d.ts +59 -0
- package/dist/factories/apisix/resources/helm.d.ts.map +1 -0
- package/dist/factories/apisix/resources/helm.js +175 -0
- package/dist/factories/apisix/resources/helm.js.map +1 -0
- package/dist/factories/apisix/resources/index.d.ts +5 -0
- package/dist/factories/apisix/resources/index.d.ts.map +1 -0
- package/dist/factories/apisix/resources/index.js +5 -0
- package/dist/factories/apisix/resources/index.js.map +1 -0
- package/dist/factories/apisix/types.d.ts +339 -0
- package/dist/factories/apisix/types.d.ts.map +1 -0
- package/dist/factories/apisix/types.js +88 -0
- package/dist/factories/apisix/types.js.map +1 -0
- package/dist/factories/apisix/utils/helm-values-mapper.d.ts +19 -0
- package/dist/factories/apisix/utils/helm-values-mapper.d.ts.map +1 -0
- package/dist/factories/apisix/utils/helm-values-mapper.js +108 -0
- package/dist/factories/apisix/utils/helm-values-mapper.js.map +1 -0
- package/dist/factories/apisix/utils/index.d.ts +5 -0
- package/dist/factories/apisix/utils/index.d.ts.map +1 -0
- package/dist/factories/apisix/utils/index.js +5 -0
- package/dist/factories/apisix/utils/index.js.map +1 -0
- package/dist/factories/cert-manager/compositions/cert-manager-bootstrap.d.ts +45 -0
- package/dist/factories/cert-manager/compositions/cert-manager-bootstrap.d.ts.map +1 -0
- package/dist/factories/cert-manager/compositions/cert-manager-bootstrap.js +323 -0
- package/dist/factories/cert-manager/compositions/cert-manager-bootstrap.js.map +1 -0
- package/dist/factories/cert-manager/compositions/index.d.ts +2 -0
- package/dist/factories/cert-manager/compositions/index.d.ts.map +1 -0
- package/dist/factories/cert-manager/compositions/index.js +2 -0
- package/dist/factories/cert-manager/compositions/index.js.map +1 -0
- package/dist/factories/cert-manager/index.d.ts +10 -0
- package/dist/factories/cert-manager/index.d.ts.map +1 -0
- package/dist/factories/cert-manager/index.js +19 -0
- package/dist/factories/cert-manager/index.js.map +1 -0
- package/dist/factories/cert-manager/resources/certificates.d.ts +39 -0
- package/dist/factories/cert-manager/resources/certificates.d.ts.map +1 -0
- package/dist/factories/cert-manager/resources/certificates.js +132 -0
- package/dist/factories/cert-manager/resources/certificates.js.map +1 -0
- package/dist/factories/cert-manager/resources/challenges.d.ts +113 -0
- package/dist/factories/cert-manager/resources/challenges.d.ts.map +1 -0
- package/dist/factories/cert-manager/resources/challenges.js +281 -0
- package/dist/factories/cert-manager/resources/challenges.js.map +1 -0
- package/dist/factories/cert-manager/resources/helm.d.ts +57 -0
- package/dist/factories/cert-manager/resources/helm.d.ts.map +1 -0
- package/dist/factories/cert-manager/resources/helm.js +390 -0
- package/dist/factories/cert-manager/resources/helm.js.map +1 -0
- package/dist/factories/cert-manager/resources/index.d.ts +5 -0
- package/dist/factories/cert-manager/resources/index.d.ts.map +1 -0
- package/dist/factories/cert-manager/resources/index.js +6 -0
- package/dist/factories/cert-manager/resources/index.js.map +1 -0
- package/dist/factories/cert-manager/resources/issuers.d.ts +79 -0
- package/dist/factories/cert-manager/resources/issuers.d.ts.map +1 -0
- package/dist/factories/cert-manager/resources/issuers.js +204 -0
- package/dist/factories/cert-manager/resources/issuers.js.map +1 -0
- package/dist/factories/cert-manager/types.d.ts +1015 -0
- package/dist/factories/cert-manager/types.d.ts.map +1 -0
- package/dist/factories/cert-manager/types.js +198 -0
- package/dist/factories/cert-manager/types.js.map +1 -0
- package/dist/factories/cert-manager/utils/helm-values-mapper.d.ts +19 -0
- package/dist/factories/cert-manager/utils/helm-values-mapper.d.ts.map +1 -0
- package/dist/factories/cert-manager/utils/helm-values-mapper.js +117 -0
- package/dist/factories/cert-manager/utils/helm-values-mapper.js.map +1 -0
- package/dist/factories/cert-manager/utils/index.d.ts +2 -0
- package/dist/factories/cert-manager/utils/index.d.ts.map +1 -0
- package/dist/factories/cert-manager/utils/index.js +2 -0
- package/dist/factories/cert-manager/utils/index.js.map +1 -0
- package/dist/factories/cilium/compositions/cilium-bootstrap.d.ts +220 -0
- package/dist/factories/cilium/compositions/cilium-bootstrap.d.ts.map +1 -0
- package/dist/factories/cilium/compositions/cilium-bootstrap.js +293 -0
- package/dist/factories/cilium/compositions/cilium-bootstrap.js.map +1 -0
- package/dist/factories/cilium/compositions/index.d.ts +8 -0
- package/dist/factories/cilium/compositions/index.d.ts.map +1 -0
- package/dist/factories/cilium/compositions/index.js +11 -0
- package/dist/factories/cilium/compositions/index.js.map +1 -0
- package/dist/factories/cilium/index.d.ts +10 -0
- package/dist/factories/cilium/index.d.ts.map +1 -0
- package/dist/factories/cilium/index.js +19 -0
- package/dist/factories/cilium/index.js.map +1 -0
- package/dist/factories/cilium/resources/bgp.d.ts +10 -0
- package/dist/factories/cilium/resources/bgp.d.ts.map +1 -0
- package/dist/factories/cilium/resources/bgp.js +14 -0
- package/dist/factories/cilium/resources/bgp.js.map +1 -0
- package/dist/factories/cilium/resources/gateway.d.ts +72 -0
- package/dist/factories/cilium/resources/gateway.d.ts.map +1 -0
- package/dist/factories/cilium/resources/gateway.js +118 -0
- package/dist/factories/cilium/resources/gateway.js.map +1 -0
- package/dist/factories/cilium/resources/helm.d.ts +93 -0
- package/dist/factories/cilium/resources/helm.d.ts.map +1 -0
- package/dist/factories/cilium/resources/helm.js +377 -0
- package/dist/factories/cilium/resources/helm.js.map +1 -0
- package/dist/factories/cilium/resources/index.d.ts +14 -0
- package/dist/factories/cilium/resources/index.d.ts.map +1 -0
- package/dist/factories/cilium/resources/index.js +35 -0
- package/dist/factories/cilium/resources/index.js.map +1 -0
- package/dist/factories/cilium/resources/load-balancer.d.ts +9 -0
- package/dist/factories/cilium/resources/load-balancer.d.ts.map +1 -0
- package/dist/factories/cilium/resources/load-balancer.js +12 -0
- package/dist/factories/cilium/resources/load-balancer.js.map +1 -0
- package/dist/factories/cilium/resources/networking.d.ts +202 -0
- package/dist/factories/cilium/resources/networking.d.ts.map +1 -0
- package/dist/factories/cilium/resources/networking.js +581 -0
- package/dist/factories/cilium/resources/networking.js.map +1 -0
- package/dist/factories/cilium/resources/observability.d.ts +9 -0
- package/dist/factories/cilium/resources/observability.d.ts.map +1 -0
- package/dist/factories/cilium/resources/observability.js +11 -0
- package/dist/factories/cilium/resources/observability.js.map +1 -0
- package/dist/factories/cilium/resources/security.d.ts +10 -0
- package/dist/factories/cilium/resources/security.d.ts.map +1 -0
- package/dist/factories/cilium/resources/security.js +14 -0
- package/dist/factories/cilium/resources/security.js.map +1 -0
- package/dist/factories/cilium/types.d.ts +1001 -0
- package/dist/factories/cilium/types.d.ts.map +1 -0
- package/dist/factories/cilium/types.js +79 -0
- package/dist/factories/cilium/types.js.map +1 -0
- package/dist/factories/external-dns/compositions/external-dns-bootstrap.d.ts +32 -0
- package/dist/factories/external-dns/compositions/external-dns-bootstrap.d.ts.map +1 -0
- package/dist/factories/external-dns/compositions/external-dns-bootstrap.js +152 -0
- package/dist/factories/external-dns/compositions/external-dns-bootstrap.js.map +1 -0
- package/dist/factories/external-dns/compositions/index.d.ts +2 -0
- package/dist/factories/external-dns/compositions/index.d.ts.map +1 -0
- package/dist/factories/external-dns/compositions/index.js +3 -0
- package/dist/factories/external-dns/compositions/index.js.map +1 -0
- package/dist/factories/external-dns/index.d.ts +10 -0
- package/dist/factories/external-dns/index.d.ts.map +1 -0
- package/dist/factories/external-dns/index.js +19 -0
- package/dist/factories/external-dns/index.js.map +1 -0
- package/dist/factories/external-dns/resources/dns-endpoint.d.ts +54 -0
- package/dist/factories/external-dns/resources/dns-endpoint.d.ts.map +1 -0
- package/dist/factories/external-dns/resources/dns-endpoint.js +53 -0
- package/dist/factories/external-dns/resources/dns-endpoint.js.map +1 -0
- package/dist/factories/external-dns/resources/helm.d.ts +57 -0
- package/dist/factories/external-dns/resources/helm.d.ts.map +1 -0
- package/dist/factories/external-dns/resources/helm.js +435 -0
- package/dist/factories/external-dns/resources/helm.js.map +1 -0
- package/dist/factories/external-dns/resources/index.d.ts +3 -0
- package/dist/factories/external-dns/resources/index.d.ts.map +1 -0
- package/dist/factories/external-dns/resources/index.js +4 -0
- package/dist/factories/external-dns/resources/index.js.map +1 -0
- package/dist/factories/external-dns/types.d.ts +180 -0
- package/dist/factories/external-dns/types.d.ts.map +1 -0
- package/dist/factories/external-dns/types.js +39 -0
- package/dist/factories/external-dns/types.js.map +1 -0
- package/dist/factories/flux/git-repository.d.ts +2 -2
- package/dist/factories/flux/git-repository.d.ts.map +1 -1
- package/dist/factories/helm/types.d.ts +24 -3
- package/dist/factories/helm/types.d.ts.map +1 -1
- package/dist/factories/index.d.ts +7 -1
- package/dist/factories/index.d.ts.map +1 -1
- package/dist/factories/index.js +21 -2
- package/dist/factories/index.js.map +1 -1
- package/dist/factories/kubernetes/config/config-map.d.ts +4 -1
- package/dist/factories/kubernetes/config/config-map.d.ts.map +1 -1
- package/dist/factories/kubernetes/config/config-map.js +4 -0
- package/dist/factories/kubernetes/config/config-map.js.map +1 -1
- package/dist/factories/kubernetes/config/secret.d.ts +6 -1
- package/dist/factories/kubernetes/config/secret.d.ts.map +1 -1
- package/dist/factories/kubernetes/config/secret.js +4 -0
- package/dist/factories/kubernetes/config/secret.js.map +1 -1
- package/dist/factories/kubernetes/networking/service.d.ts.map +1 -1
- package/dist/factories/kubernetes/networking/service.js +6 -1
- package/dist/factories/kubernetes/networking/service.js.map +1 -1
- package/dist/factories/kubernetes/rbac/cluster-role-binding.d.ts.map +1 -1
- package/dist/factories/kubernetes/rbac/cluster-role-binding.js +1 -1
- package/dist/factories/kubernetes/rbac/cluster-role-binding.js.map +1 -1
- package/dist/factories/kubernetes/rbac/cluster-role.d.ts.map +1 -1
- package/dist/factories/kubernetes/rbac/cluster-role.js +1 -1
- package/dist/factories/kubernetes/rbac/cluster-role.js.map +1 -1
- package/dist/factories/kubernetes/scheduling/priority-class.d.ts.map +1 -1
- package/dist/factories/kubernetes/scheduling/priority-class.js +1 -1
- package/dist/factories/kubernetes/scheduling/priority-class.js.map +1 -1
- package/dist/factories/kubernetes/storage/storage-class.d.ts.map +1 -1
- package/dist/factories/kubernetes/storage/storage-class.js +1 -1
- package/dist/factories/kubernetes/storage/storage-class.js.map +1 -1
- package/dist/factories/kubernetes/workloads/deployment.d.ts.map +1 -1
- package/dist/factories/kubernetes/workloads/deployment.js +9 -4
- package/dist/factories/kubernetes/workloads/deployment.js.map +1 -1
- package/dist/factories/kubernetes/yaml/yaml-directory.js +2 -2
- package/dist/factories/kubernetes/yaml/yaml-directory.js.map +1 -1
- package/dist/factories/kubernetes/yaml/yaml-file.d.ts +31 -1
- package/dist/factories/kubernetes/yaml/yaml-file.d.ts.map +1 -1
- package/dist/factories/kubernetes/yaml/yaml-file.js +80 -7
- package/dist/factories/kubernetes/yaml/yaml-file.js.map +1 -1
- package/dist/factories/pebble/compositions/index.d.ts +2 -0
- package/dist/factories/pebble/compositions/index.d.ts.map +1 -0
- package/dist/factories/pebble/compositions/index.js +3 -0
- package/dist/factories/pebble/compositions/index.js.map +1 -0
- package/dist/factories/pebble/compositions/pebble-bootstrap.d.ts +56 -0
- package/dist/factories/pebble/compositions/pebble-bootstrap.d.ts.map +1 -0
- package/dist/factories/pebble/compositions/pebble-bootstrap.js +97 -0
- package/dist/factories/pebble/compositions/pebble-bootstrap.js.map +1 -0
- package/dist/factories/pebble/index.d.ts +10 -0
- package/dist/factories/pebble/index.d.ts.map +1 -0
- package/dist/factories/pebble/index.js +19 -0
- package/dist/factories/pebble/index.js.map +1 -0
- package/dist/factories/pebble/resources/helm.d.ts +99 -0
- package/dist/factories/pebble/resources/helm.d.ts.map +1 -0
- package/dist/factories/pebble/resources/helm.js +167 -0
- package/dist/factories/pebble/resources/helm.js.map +1 -0
- package/dist/factories/pebble/resources/index.d.ts +2 -0
- package/dist/factories/pebble/resources/index.d.ts.map +1 -0
- package/dist/factories/pebble/resources/index.js +3 -0
- package/dist/factories/pebble/resources/index.js.map +1 -0
- package/dist/factories/pebble/types.d.ts +184 -0
- package/dist/factories/pebble/types.d.ts.map +1 -0
- package/dist/factories/pebble/types.js +23 -0
- package/dist/factories/pebble/types.js.map +1 -0
- package/dist/factories/pebble/utils/helm-values-mapper.d.ts +21 -0
- package/dist/factories/pebble/utils/helm-values-mapper.d.ts.map +1 -0
- package/dist/factories/pebble/utils/helm-values-mapper.js +96 -0
- package/dist/factories/pebble/utils/helm-values-mapper.js.map +1 -0
- package/dist/factories/shared.d.ts +18 -1
- package/dist/factories/shared.d.ts.map +1 -1
- package/dist/factories/shared.js +89 -8
- package/dist/factories/shared.js.map +1 -1
- package/dist/factories/simple/config/config-map.d.ts +7 -2
- package/dist/factories/simple/config/config-map.d.ts.map +1 -1
- package/dist/factories/simple/config/config-map.js +3 -0
- package/dist/factories/simple/config/config-map.js.map +1 -1
- package/dist/factories/simple/config/secret.d.ts +11 -2
- package/dist/factories/simple/config/secret.d.ts.map +1 -1
- package/dist/factories/simple/config/secret.js +23 -1
- package/dist/factories/simple/config/secret.js.map +1 -1
- package/dist/factories/simple/storage/persistent-volume-claim.d.ts.map +1 -1
- package/dist/factories/simple/storage/persistent-volume-claim.js +1 -0
- package/dist/factories/simple/storage/persistent-volume-claim.js.map +1 -1
- package/dist/factories/simple/types.d.ts +5 -1
- package/dist/factories/simple/types.d.ts.map +1 -1
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/utils/helpers.js +67 -0
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/type-guards.d.ts +5 -0
- package/dist/utils/type-guards.d.ts.map +1 -1
- package/dist/utils/type-guards.js +9 -3
- package/dist/utils/type-guards.js.map +1 -1
- package/package.json +49 -5
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kubernetes Error Handling Utilities
|
|
3
|
+
*
|
|
4
|
+
* Centralized error handling for Kubernetes API errors.
|
|
5
|
+
* Supports both the old request-based errors (0.x) and new fetch-based errors (1.x+).
|
|
6
|
+
*
|
|
7
|
+
* This module provides consistent error handling across the codebase,
|
|
8
|
+
* making it easier to handle API errors and prepare for future client upgrades.
|
|
9
|
+
*/
|
|
10
|
+
import { getComponentLogger } from '../logging/index.js';
|
|
11
|
+
const logger = getComponentLogger('kubernetes-errors');
|
|
12
|
+
/**
|
|
13
|
+
* Extract the HTTP status code from a Kubernetes API error.
|
|
14
|
+
*
|
|
15
|
+
* Handles multiple error structures from different client versions:
|
|
16
|
+
* - Direct statusCode property (0.x style)
|
|
17
|
+
* - Nested response.statusCode (1.x+ fetch style)
|
|
18
|
+
* - Nested body.code (some error responses)
|
|
19
|
+
*
|
|
20
|
+
* @param error - The error object to extract status code from
|
|
21
|
+
* @returns The HTTP status code, or undefined if not found
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* try {
|
|
26
|
+
* await api.read(resource);
|
|
27
|
+
* } catch (error) {
|
|
28
|
+
* const statusCode = getErrorStatusCode(error);
|
|
29
|
+
* if (statusCode === 404) {
|
|
30
|
+
* // Handle not found
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export function getErrorStatusCode(error) {
|
|
36
|
+
if (typeof error !== 'object' || error === null) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
const err = error;
|
|
40
|
+
// Try direct statusCode first (0.x style and some 1.x errors)
|
|
41
|
+
if (typeof err.statusCode === 'number') {
|
|
42
|
+
return err.statusCode;
|
|
43
|
+
}
|
|
44
|
+
// Try nested response.statusCode (1.x+ fetch style)
|
|
45
|
+
if (typeof err.response?.statusCode === 'number') {
|
|
46
|
+
return err.response.statusCode;
|
|
47
|
+
}
|
|
48
|
+
// Try nested body.code (some Kubernetes error responses)
|
|
49
|
+
if (typeof err.body?.code === 'number') {
|
|
50
|
+
return err.body.code;
|
|
51
|
+
}
|
|
52
|
+
// Log unexpected error shape at debug level for diagnostics
|
|
53
|
+
logger.debug('Could not extract status code from error', {
|
|
54
|
+
errorType: typeof error,
|
|
55
|
+
hasStatusCode: 'statusCode' in err,
|
|
56
|
+
hasResponse: 'response' in err,
|
|
57
|
+
hasBody: 'body' in err,
|
|
58
|
+
errorKeys: Object.keys(err),
|
|
59
|
+
});
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Check if an error is a "Not Found" (404) error.
|
|
64
|
+
*
|
|
65
|
+
* @param error - The error to check
|
|
66
|
+
* @returns true if the error is a 404 Not Found error
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* try {
|
|
71
|
+
* await api.read(resource);
|
|
72
|
+
* } catch (error) {
|
|
73
|
+
* if (isNotFoundError(error)) {
|
|
74
|
+
* console.log('Resource does not exist');
|
|
75
|
+
* }
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export function isNotFoundError(error) {
|
|
80
|
+
return getErrorStatusCode(error) === 404;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Check if an error is a "Conflict" (409) error.
|
|
84
|
+
*
|
|
85
|
+
* Conflict errors typically occur when:
|
|
86
|
+
* - Trying to create a resource that already exists
|
|
87
|
+
* - Optimistic locking fails due to resource version mismatch
|
|
88
|
+
*
|
|
89
|
+
* @param error - The error to check
|
|
90
|
+
* @returns true if the error is a 409 Conflict error
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* try {
|
|
95
|
+
* await api.create(resource);
|
|
96
|
+
* } catch (error) {
|
|
97
|
+
* if (isConflictError(error)) {
|
|
98
|
+
* console.log('Resource already exists');
|
|
99
|
+
* }
|
|
100
|
+
* }
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export function isConflictError(error) {
|
|
104
|
+
return getErrorStatusCode(error) === 409;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* HTTP status codes that are typically retryable.
|
|
108
|
+
* These indicate temporary issues that may resolve on retry.
|
|
109
|
+
*/
|
|
110
|
+
const RETRYABLE_STATUS_CODES = [
|
|
111
|
+
408, // Request Timeout
|
|
112
|
+
429, // Too Many Requests
|
|
113
|
+
500, // Internal Server Error
|
|
114
|
+
502, // Bad Gateway
|
|
115
|
+
503, // Service Unavailable
|
|
116
|
+
504, // Gateway Timeout
|
|
117
|
+
];
|
|
118
|
+
/**
|
|
119
|
+
* Check if an error is retryable.
|
|
120
|
+
*
|
|
121
|
+
* An error is considered retryable if:
|
|
122
|
+
* - It has a retryable HTTP status code (408, 429, 500, 502, 503, 504)
|
|
123
|
+
* - It's a network connectivity error (ECONNREFUSED, ENOTFOUND, ETIMEDOUT)
|
|
124
|
+
* - It's a fetch-related TypeError (network failure)
|
|
125
|
+
* - It's an AbortError (timeout)
|
|
126
|
+
*
|
|
127
|
+
* @param error - The error to check
|
|
128
|
+
* @returns true if the error is retryable
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* try {
|
|
133
|
+
* await api.read(resource);
|
|
134
|
+
* } catch (error) {
|
|
135
|
+
* if (isRetryableError(error)) {
|
|
136
|
+
* // Retry the operation
|
|
137
|
+
* } else {
|
|
138
|
+
* // Don't retry, handle the error
|
|
139
|
+
* }
|
|
140
|
+
* }
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
export function isRetryableError(error) {
|
|
144
|
+
// Check for retryable HTTP status codes
|
|
145
|
+
const statusCode = getErrorStatusCode(error);
|
|
146
|
+
if (statusCode !== undefined && RETRYABLE_STATUS_CODES.includes(statusCode)) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
// Check for network errors by message content
|
|
150
|
+
if (error instanceof Error) {
|
|
151
|
+
const message = error.message.toLowerCase();
|
|
152
|
+
// Network connectivity issues
|
|
153
|
+
if (message.includes('econnrefused') ||
|
|
154
|
+
message.includes('enotfound') ||
|
|
155
|
+
message.includes('etimedout') ||
|
|
156
|
+
message.includes('network error') ||
|
|
157
|
+
message.includes('socket hang up') ||
|
|
158
|
+
message.includes('connection reset')) {
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
// Fetch-related network errors (1.x+ client)
|
|
162
|
+
if (error instanceof TypeError && message.includes('fetch')) {
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
// Abort errors (timeout)
|
|
166
|
+
if (error.name === 'AbortError') {
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// Check for DOMException AbortError (browser/Node.js fetch)
|
|
171
|
+
if (typeof error === 'object' &&
|
|
172
|
+
error !== null &&
|
|
173
|
+
'name' in error &&
|
|
174
|
+
error.name === 'AbortError') {
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Format a Kubernetes API error into a human-readable message.
|
|
181
|
+
*
|
|
182
|
+
* Extracts relevant information from the error and formats it consistently.
|
|
183
|
+
*
|
|
184
|
+
* @param error - The error to format
|
|
185
|
+
* @returns A formatted error message string
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```typescript
|
|
189
|
+
* try {
|
|
190
|
+
* await api.read(resource);
|
|
191
|
+
* } catch (error) {
|
|
192
|
+
* console.error(formatKubernetesError(error));
|
|
193
|
+
* // Output: "Kubernetes API error (404): Not Found - the resource does not exist"
|
|
194
|
+
* }
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
export function formatKubernetesError(error) {
|
|
198
|
+
if (typeof error !== 'object' || error === null) {
|
|
199
|
+
return String(error);
|
|
200
|
+
}
|
|
201
|
+
const err = error;
|
|
202
|
+
const statusCode = getErrorStatusCode(error);
|
|
203
|
+
const parts = [];
|
|
204
|
+
// Add status code if available
|
|
205
|
+
if (statusCode !== undefined) {
|
|
206
|
+
parts.push(`Kubernetes API error (${statusCode})`);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
parts.push('Kubernetes API error');
|
|
210
|
+
}
|
|
211
|
+
// Add reason if available from body
|
|
212
|
+
if (err.body?.reason) {
|
|
213
|
+
parts.push(err.body.reason);
|
|
214
|
+
}
|
|
215
|
+
// Add message
|
|
216
|
+
if (err.body?.message) {
|
|
217
|
+
parts.push(err.body.message);
|
|
218
|
+
}
|
|
219
|
+
else if (err.message) {
|
|
220
|
+
parts.push(err.message);
|
|
221
|
+
}
|
|
222
|
+
return parts.join(': ');
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Check if an error is an "Unauthorized" (401) error.
|
|
226
|
+
*
|
|
227
|
+
* @param error - The error to check
|
|
228
|
+
* @returns true if the error is a 401 Unauthorized error
|
|
229
|
+
*/
|
|
230
|
+
export function isUnauthorizedError(error) {
|
|
231
|
+
return getErrorStatusCode(error) === 401;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Check if an error is a "Forbidden" (403) error.
|
|
235
|
+
*
|
|
236
|
+
* @param error - The error to check
|
|
237
|
+
* @returns true if the error is a 403 Forbidden error
|
|
238
|
+
*/
|
|
239
|
+
export function isForbiddenError(error) {
|
|
240
|
+
return getErrorStatusCode(error) === 403;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Check if an error is a "Bad Request" (400) error.
|
|
244
|
+
*
|
|
245
|
+
* @param error - The error to check
|
|
246
|
+
* @returns true if the error is a 400 Bad Request error
|
|
247
|
+
*/
|
|
248
|
+
export function isBadRequestError(error) {
|
|
249
|
+
return getErrorStatusCode(error) === 400;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Check if an error is a "Unprocessable Entity" (422) error.
|
|
253
|
+
*
|
|
254
|
+
* This typically indicates validation errors in the request body.
|
|
255
|
+
*
|
|
256
|
+
* @param error - The error to check
|
|
257
|
+
* @returns true if the error is a 422 Unprocessable Entity error
|
|
258
|
+
*/
|
|
259
|
+
export function isValidationError(error) {
|
|
260
|
+
return getErrorStatusCode(error) === 422;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Extract the error reason from a Kubernetes API error.
|
|
264
|
+
*
|
|
265
|
+
* @param error - The error to extract reason from
|
|
266
|
+
* @returns The error reason string, or undefined if not available
|
|
267
|
+
*/
|
|
268
|
+
export function getErrorReason(error) {
|
|
269
|
+
if (typeof error !== 'object' || error === null) {
|
|
270
|
+
return undefined;
|
|
271
|
+
}
|
|
272
|
+
const err = error;
|
|
273
|
+
return err.body?.reason;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Extract detailed error information from a Kubernetes API error.
|
|
277
|
+
*
|
|
278
|
+
* @param error - The error to extract details from
|
|
279
|
+
* @returns An object containing all available error details
|
|
280
|
+
*/
|
|
281
|
+
export function getErrorDetails(error) {
|
|
282
|
+
if (typeof error !== 'object' || error === null) {
|
|
283
|
+
return {
|
|
284
|
+
statusCode: undefined,
|
|
285
|
+
reason: undefined,
|
|
286
|
+
message: String(error),
|
|
287
|
+
details: undefined,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
const err = error;
|
|
291
|
+
return {
|
|
292
|
+
statusCode: getErrorStatusCode(error),
|
|
293
|
+
reason: err.body?.reason,
|
|
294
|
+
message: err.body?.message ?? err.message,
|
|
295
|
+
details: err.body?.details,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/core/kubernetes/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,MAAM,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;AAwBvD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,GAAG,GAAG,KAA2B,CAAC;IAExC,8DAA8D;IAC9D,IAAI,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QACvC,OAAO,GAAG,CAAC,UAAU,CAAC;IACxB,CAAC;IAED,oDAAoD;IACpD,IAAI,OAAO,GAAG,CAAC,QAAQ,EAAE,UAAU,KAAK,QAAQ,EAAE,CAAC;QACjD,OAAO,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC;IACjC,CAAC;IAED,yDAAyD;IACzD,IAAI,OAAO,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;QACvC,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,4DAA4D;IAC5D,MAAM,CAAC,KAAK,CAAC,0CAA0C,EAAE;QACvD,SAAS,EAAE,OAAO,KAAK;QACvB,aAAa,EAAE,YAAY,IAAI,GAAG;QAClC,WAAW,EAAE,UAAU,IAAI,GAAG;QAC9B,OAAO,EAAE,MAAM,IAAI,GAAG;QACtB,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;KAC5B,CAAC,CAAC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,MAAM,CAAC,KAAK,CAAC;YACtB,OAAO,EAAE,SAAS;SACnB,CAAC;IACJ,CAAC;IAED,MAAM,GAAG,GAAG,KAA2B,CAAC;IAExC,OAAO;QACL,UAAU,EAAE,kBAAkB,CAAC,KAAK,CAAC;QACrC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM;QACxB,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,IAAI,GAAG,CAAC,OAAO;QACzC,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO;KAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kubernetes Module
|
|
3
|
+
*
|
|
4
|
+
* Centralized exports for Kubernetes client functionality.
|
|
5
|
+
* This module provides:
|
|
6
|
+
* - Client provider for managing Kubernetes API clients
|
|
7
|
+
* - API utilities for common operations
|
|
8
|
+
* - Error handling utilities for consistent error management
|
|
9
|
+
*/
|
|
10
|
+
export { KubernetesClientProvider, createKubernetesClientProvider, createKubernetesClientProviderWithKubeConfig, getKubernetesClientProvider, getKubernetesApi, getKubeConfig, getCoreV1Api, getAppsV1Api, } from './client-provider.js';
|
|
11
|
+
export type { KubernetesClientConfig, KubernetesApiConsumer, KubeConfigConsumer, RetryOptions, } from './client-provider.js';
|
|
12
|
+
export { KubernetesApi } from './api.js';
|
|
13
|
+
export { getErrorStatusCode, isNotFoundError, isConflictError, isRetryableError, formatKubernetesError, isUnauthorizedError, isForbiddenError, isBadRequestError, isValidationError, getErrorReason, getErrorDetails, } from './errors.js';
|
|
14
|
+
export type { KubernetesApiError } from './errors.js';
|
|
15
|
+
export { isKubernetesResponse, isKubernetesError, hasStatusCode, isKubernetesResource, hasBody, isKubernetesList, hasResourceVersion, } from './type-guards.js';
|
|
16
|
+
export type { KubernetesResponse, KubernetesResourceShape, } from './type-guards.js';
|
|
17
|
+
export { BunCompatibleHttpLibrary, isBunRuntime, getHttpLibraryForRuntime, } from './bun-http-library.js';
|
|
18
|
+
export { createBunCompatibleApiClient, createBunCompatibleCoreV1Api, createBunCompatibleAppsV1Api, createBunCompatibleCustomObjectsApi, createBunCompatibleBatchV1Api, createBunCompatibleNetworkingV1Api, createBunCompatibleRbacAuthorizationV1Api, createBunCompatibleStorageV1Api, createBunCompatibleApiextensionsV1Api, createBunCompatibleKubernetesObjectApi, } from './bun-api-client.js';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/kubernetes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,4CAA4C,EAC5C,2BAA2B,EAC3B,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,YAAY,GACb,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,OAAO,EACP,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACL,wBAAwB,EACxB,YAAY,EACZ,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,mCAAmC,EACnC,6BAA6B,EAC7B,kCAAkC,EAClC,yCAAyC,EACzC,+BAA+B,EAC/B,qCAAqC,EACrC,sCAAsC,GACvC,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kubernetes Module
|
|
3
|
+
*
|
|
4
|
+
* Centralized exports for Kubernetes client functionality.
|
|
5
|
+
* This module provides:
|
|
6
|
+
* - Client provider for managing Kubernetes API clients
|
|
7
|
+
* - API utilities for common operations
|
|
8
|
+
* - Error handling utilities for consistent error management
|
|
9
|
+
*/
|
|
10
|
+
// Client provider and configuration
|
|
11
|
+
export { KubernetesClientProvider, createKubernetesClientProvider, createKubernetesClientProviderWithKubeConfig, getKubernetesClientProvider, getKubernetesApi, getKubeConfig, getCoreV1Api, getAppsV1Api, } from './client-provider.js';
|
|
12
|
+
// API utilities
|
|
13
|
+
export { KubernetesApi } from './api.js';
|
|
14
|
+
// Error handling utilities
|
|
15
|
+
export { getErrorStatusCode, isNotFoundError, isConflictError, isRetryableError, formatKubernetesError, isUnauthorizedError, isForbiddenError, isBadRequestError, isValidationError, getErrorReason, getErrorDetails, } from './errors.js';
|
|
16
|
+
// Type guards
|
|
17
|
+
export { isKubernetesResponse, isKubernetesError, hasStatusCode, isKubernetesResource, hasBody, isKubernetesList, hasResourceVersion, } from './type-guards.js';
|
|
18
|
+
// Bun compatibility utilities
|
|
19
|
+
// These provide workarounds for Bun's fetch TLS issues
|
|
20
|
+
// See: https://github.com/oven-sh/bun/issues/10642
|
|
21
|
+
export { BunCompatibleHttpLibrary, isBunRuntime, getHttpLibraryForRuntime, } from './bun-http-library.js';
|
|
22
|
+
export { createBunCompatibleApiClient, createBunCompatibleCoreV1Api, createBunCompatibleAppsV1Api, createBunCompatibleCustomObjectsApi, createBunCompatibleBatchV1Api, createBunCompatibleNetworkingV1Api, createBunCompatibleRbacAuthorizationV1Api, createBunCompatibleStorageV1Api, createBunCompatibleApiextensionsV1Api, createBunCompatibleKubernetesObjectApi, } from './bun-api-client.js';
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/kubernetes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,oCAAoC;AACpC,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,4CAA4C,EAC5C,2BAA2B,EAC3B,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,sBAAsB,CAAC;AAS9B,gBAAgB;AAChB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,2BAA2B;AAC3B,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,aAAa,CAAC;AAIrB,cAAc;AACd,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,OAAO,EACP,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAO1B,8BAA8B;AAC9B,uDAAuD;AACvD,mDAAmD;AACnD,OAAO,EACL,wBAAwB,EACxB,YAAY,EACZ,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,4BAA4B,EAC5B,mCAAmC,EACnC,6BAA6B,EAC7B,kCAAkC,EAClC,yCAAyC,EACzC,+BAA+B,EAC/B,qCAAqC,EACrC,sCAAsC,GACvC,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kubernetes Type Guards
|
|
3
|
+
*
|
|
4
|
+
* Type guards for validating Kubernetes API response shapes.
|
|
5
|
+
* These guards help ensure type safety when working with API responses
|
|
6
|
+
* that may have different structures across client versions.
|
|
7
|
+
*/
|
|
8
|
+
import type { KubernetesApiError } from './errors.js';
|
|
9
|
+
/**
|
|
10
|
+
* Interface representing a standard Kubernetes API response.
|
|
11
|
+
* The response typically contains a body property with the actual data.
|
|
12
|
+
*/
|
|
13
|
+
export interface KubernetesResponse<T> {
|
|
14
|
+
body: T;
|
|
15
|
+
response?: {
|
|
16
|
+
statusCode?: number;
|
|
17
|
+
headers?: Record<string, string>;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Interface representing a Kubernetes resource with standard metadata.
|
|
22
|
+
*/
|
|
23
|
+
export interface KubernetesResourceShape {
|
|
24
|
+
apiVersion?: string;
|
|
25
|
+
kind?: string;
|
|
26
|
+
metadata?: {
|
|
27
|
+
name?: string;
|
|
28
|
+
namespace?: string;
|
|
29
|
+
uid?: string;
|
|
30
|
+
resourceVersion?: string;
|
|
31
|
+
creationTimestamp?: string;
|
|
32
|
+
labels?: Record<string, string>;
|
|
33
|
+
annotations?: Record<string, string>;
|
|
34
|
+
};
|
|
35
|
+
spec?: unknown;
|
|
36
|
+
status?: unknown;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Check if a value is a Kubernetes API response with a body property.
|
|
40
|
+
*
|
|
41
|
+
* @param response - The value to check
|
|
42
|
+
* @returns true if the value is a KubernetesResponse
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const result = await api.read(resource);
|
|
47
|
+
* if (isKubernetesResponse(result)) {
|
|
48
|
+
* const resource = result.body;
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function isKubernetesResponse<T>(response: unknown): response is KubernetesResponse<T>;
|
|
53
|
+
/**
|
|
54
|
+
* Check if an error is a Kubernetes API error with expected properties.
|
|
55
|
+
*
|
|
56
|
+
* @param error - The error to check
|
|
57
|
+
* @returns true if the error is a KubernetesApiError
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* try {
|
|
62
|
+
* await api.read(resource);
|
|
63
|
+
* } catch (error) {
|
|
64
|
+
* if (isKubernetesError(error)) {
|
|
65
|
+
* console.log('Status:', error.statusCode);
|
|
66
|
+
* }
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function isKubernetesError(error: unknown): error is KubernetesApiError;
|
|
71
|
+
/**
|
|
72
|
+
* Check if an object has a statusCode property.
|
|
73
|
+
*
|
|
74
|
+
* @param obj - The object to check
|
|
75
|
+
* @returns true if the object has a numeric statusCode property
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* if (hasStatusCode(error)) {
|
|
80
|
+
* console.log('HTTP Status:', error.statusCode);
|
|
81
|
+
* }
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function hasStatusCode(obj: unknown): obj is {
|
|
85
|
+
statusCode: number;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Check if a value is a Kubernetes resource with standard shape.
|
|
89
|
+
*
|
|
90
|
+
* @param value - The value to check
|
|
91
|
+
* @returns true if the value has Kubernetes resource shape
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* if (isKubernetesResource(obj)) {
|
|
96
|
+
* console.log('Kind:', obj.kind);
|
|
97
|
+
* console.log('Name:', obj.metadata?.name);
|
|
98
|
+
* }
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare function isKubernetesResource(value: unknown): value is KubernetesResourceShape;
|
|
102
|
+
/**
|
|
103
|
+
* Check if a value has a body property with a specific shape.
|
|
104
|
+
*
|
|
105
|
+
* @param value - The value to check
|
|
106
|
+
* @param bodyGuard - A type guard function to validate the body
|
|
107
|
+
* @returns true if the value has a body that passes the guard
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* if (hasBody(response, isKubernetesResource)) {
|
|
112
|
+
* console.log('Resource:', response.body.kind);
|
|
113
|
+
* }
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export declare function hasBody<T>(value: unknown, bodyGuard: (body: unknown) => body is T): value is {
|
|
117
|
+
body: T;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Check if a value is a list response from the Kubernetes API.
|
|
121
|
+
*
|
|
122
|
+
* @param value - The value to check
|
|
123
|
+
* @returns true if the value is a Kubernetes list response
|
|
124
|
+
*/
|
|
125
|
+
export declare function isKubernetesList(value: unknown): value is {
|
|
126
|
+
items: unknown[];
|
|
127
|
+
metadata?: {
|
|
128
|
+
resourceVersion?: string;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Check if a response has a resourceVersion in its metadata.
|
|
133
|
+
*
|
|
134
|
+
* @param value - The value to check
|
|
135
|
+
* @returns true if the value has a resourceVersion
|
|
136
|
+
*/
|
|
137
|
+
export declare function hasResourceVersion(value: unknown): value is {
|
|
138
|
+
metadata: {
|
|
139
|
+
resourceVersion: string;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=type-guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-guards.d.ts","sourceRoot":"","sources":["../../../src/core/kubernetes/type-guards.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC;IACR,QAAQ,CAAC,EAAE;QACT,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM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AAA;CAAE,CAOtB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI;IAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAOxE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI;IAAE,QAAQ,EAAE;QAAE,eAAe,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAYpD"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kubernetes Type Guards
|
|
3
|
+
*
|
|
4
|
+
* Type guards for validating Kubernetes API response shapes.
|
|
5
|
+
* These guards help ensure type safety when working with API responses
|
|
6
|
+
* that may have different structures across client versions.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Check if a value is a Kubernetes API response with a body property.
|
|
10
|
+
*
|
|
11
|
+
* @param response - The value to check
|
|
12
|
+
* @returns true if the value is a KubernetesResponse
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const result = await api.read(resource);
|
|
17
|
+
* if (isKubernetesResponse(result)) {
|
|
18
|
+
* const resource = result.body;
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function isKubernetesResponse(response) {
|
|
23
|
+
return (typeof response === 'object' &&
|
|
24
|
+
response !== null &&
|
|
25
|
+
'body' in response);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Check if an error is a Kubernetes API error with expected properties.
|
|
29
|
+
*
|
|
30
|
+
* @param error - The error to check
|
|
31
|
+
* @returns true if the error is a KubernetesApiError
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* try {
|
|
36
|
+
* await api.read(resource);
|
|
37
|
+
* } catch (error) {
|
|
38
|
+
* if (isKubernetesError(error)) {
|
|
39
|
+
* console.log('Status:', error.statusCode);
|
|
40
|
+
* }
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export function isKubernetesError(error) {
|
|
45
|
+
if (typeof error !== 'object' || error === null) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
const err = error;
|
|
49
|
+
// Check for common Kubernetes error properties
|
|
50
|
+
return (typeof err.statusCode === 'number' ||
|
|
51
|
+
(typeof err.response === 'object' &&
|
|
52
|
+
err.response !== null &&
|
|
53
|
+
typeof err.response.statusCode === 'number') ||
|
|
54
|
+
(typeof err.body === 'object' &&
|
|
55
|
+
err.body !== null &&
|
|
56
|
+
typeof err.body.code === 'number'));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check if an object has a statusCode property.
|
|
60
|
+
*
|
|
61
|
+
* @param obj - The object to check
|
|
62
|
+
* @returns true if the object has a numeric statusCode property
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* if (hasStatusCode(error)) {
|
|
67
|
+
* console.log('HTTP Status:', error.statusCode);
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export function hasStatusCode(obj) {
|
|
72
|
+
return (typeof obj === 'object' &&
|
|
73
|
+
obj !== null &&
|
|
74
|
+
'statusCode' in obj &&
|
|
75
|
+
typeof obj.statusCode === 'number');
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Check if a value is a Kubernetes resource with standard shape.
|
|
79
|
+
*
|
|
80
|
+
* @param value - The value to check
|
|
81
|
+
* @returns true if the value has Kubernetes resource shape
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* if (isKubernetesResource(obj)) {
|
|
86
|
+
* console.log('Kind:', obj.kind);
|
|
87
|
+
* console.log('Name:', obj.metadata?.name);
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export function isKubernetesResource(value) {
|
|
92
|
+
if (typeof value !== 'object' || value === null) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
const obj = value;
|
|
96
|
+
// A Kubernetes resource should have at least apiVersion and kind
|
|
97
|
+
return ((typeof obj.apiVersion === 'string' || obj.apiVersion === undefined) &&
|
|
98
|
+
(typeof obj.kind === 'string' || obj.kind === undefined) &&
|
|
99
|
+
(typeof obj.metadata === 'object' || obj.metadata === undefined));
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Check if a value has a body property with a specific shape.
|
|
103
|
+
*
|
|
104
|
+
* @param value - The value to check
|
|
105
|
+
* @param bodyGuard - A type guard function to validate the body
|
|
106
|
+
* @returns true if the value has a body that passes the guard
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* if (hasBody(response, isKubernetesResource)) {
|
|
111
|
+
* console.log('Resource:', response.body.kind);
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export function hasBody(value, bodyGuard) {
|
|
116
|
+
return (typeof value === 'object' &&
|
|
117
|
+
value !== null &&
|
|
118
|
+
'body' in value &&
|
|
119
|
+
bodyGuard(value.body));
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Check if a value is a list response from the Kubernetes API.
|
|
123
|
+
*
|
|
124
|
+
* @param value - The value to check
|
|
125
|
+
* @returns true if the value is a Kubernetes list response
|
|
126
|
+
*/
|
|
127
|
+
export function isKubernetesList(value) {
|
|
128
|
+
if (typeof value !== 'object' || value === null) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
const obj = value;
|
|
132
|
+
return Array.isArray(obj.items);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Check if a response has a resourceVersion in its metadata.
|
|
136
|
+
*
|
|
137
|
+
* @param value - The value to check
|
|
138
|
+
* @returns true if the value has a resourceVersion
|
|
139
|
+
*/
|
|
140
|
+
export function hasResourceVersion(value) {
|
|
141
|
+
if (typeof value !== 'object' || value === null) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
const obj = value;
|
|
145
|
+
if (typeof obj.metadata !== 'object' || obj.metadata === null) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
const metadata = obj.metadata;
|
|
149
|
+
return typeof metadata.resourceVersion === 'string';
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=type-guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-guards.js","sourceRoot":"","sources":["../../../src/core/kubernetes/type-guards.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmCH;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAiB;IAEjB,OAAO,CACL,OAAO,QAAQ,KAAK,QAAQ;QAC5B,QAAQ,KAAK,IAAI;QACjB,MAAM,IAAI,QAAQ,CACnB,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,GAAG,GAAG,KAAgC,CAAC;IAE7C,+CAA+C;IAC/C,OAAO,CACL,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ;QAClC,CAAC,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ;YAC/B,GAAG,CAAC,QAAQ,KAAK,IAAI;YACrB,OAAQ,GAAG,CAAC,QAAoC,CAAC,UAAU,KAAK,QAAQ,CAAC;QAC3E,CAAC,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ;YAC3B,GAAG,CAAC,IAAI,KAAK,IAAI;YACjB,OAAQ,GAAG,CAAC,IAAg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,CAAC;IAC7C,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAc;IAEd,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,GAAG,GAAG,KAAgC,CAAC;IAC7C,IAAI,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC9D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAmC,CAAC;IACzD,OAAO,OAAO,QAAQ,CAAC,eAAe,KAAK,QAAQ,CAAC;AACtD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/core/logging/logger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/core/logging/logger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAiE7E;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,aAAa,CAoC1E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,aAAa,EACtB,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAC7B,aAAa,CAGf;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,aAA8B,CAAC;AAEpD;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACtC,aAAa,CAEf;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACtC,aAAa,CAEf;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACtC,aAAa,CAEf"}
|