/** * Dependency graph validator * * Validates dependency graphs for cycles, missing dependencies, * and other structural issues. * * @module validation/dependency-validator */ import type { Plugin } from "../../plugin.js"; /** * Dependency graph validator * * Provides validation for dependency graphs including: * - Cycle detection * - Missing dependency detection * - Invalid dependency references */ export declare class DependencyValidator { /** * Validates a dependency graph * * @param dimensions - All available dimension names * @param dependencyGraph - Dependency graph to validate * @param plugin - Plugin instance for dimension lookup * @throws {CircularDependencyError} If cycles are detected * @throws {DependencyNotFoundError} If dependencies reference unknown dimensions * * @example * ```typescript * const dimensions = ['summary', 'tags', 'sentiment']; * const deps = { sentiment: ['summary'], tags: ['summary'] }; * * try { * DependencyValidator.validate(dimensions, deps, plugin); * } catch (error) { * if (error instanceof CircularDependencyError) { * console.error('Cycle detected:', error.cycle); * } * } * ``` */ static validate(dimensions: string[], dependencyGraph: Record, plugin: Plugin): void; /** * Validates that all dependencies reference existing dimensions */ private static validateDependenciesExist; /** * Validates that the dependency graph contains no cycles * * Uses depth-first search to detect cycles. */ private static validateNoCycles; /** * Validates that global dimensions only depend on other global dimensions * or section dimensions (for aggregation) * * Section dimensions cannot depend on global dimensions that come after them * in the execution order (would create ordering issues). */ private static validateGlobalDependencies; /** * Detects strongly connected components (cycles) in a directed graph * * Uses Tarjan's algorithm for cycle detection. * Returns all cycles found in the graph. * * @param dependencyGraph - Dependency graph to analyze * @returns Array of cycles, where each cycle is an array of dimension names */ static findAllCycles(dependencyGraph: Record): string[][]; /** * Validates that a dependency graph is acyclic (no cycles) * * @param dependencyGraph - Dependency graph to check * @returns true if acyclic, false if cycles exist */ static isAcyclic(dependencyGraph: Record): boolean; /** * Gets all dependencies for a dimension (direct and transitive) * * @param dimension - Dimension to analyze * @param dependencyGraph - Dependency graph * @returns Set of all dependencies (including transitive) */ static getAllDependencies(dimension: string, dependencyGraph: Record): Set; /** * Gets all dependents for a dimension (dimensions that depend on it) * * @param dimension - Dimension to analyze * @param dependencyGraph - Dependency graph * @returns Set of all dependents (direct only) */ static getDependents(dimension: string, dependencyGraph: Record): Set; /** * Checks if one dimension depends on another (directly or transitively) * * @param dimension - Dimension to check * @param dependency - Potential dependency * @param dependencyGraph - Dependency graph * @returns true if dimension depends on dependency */ static dependsOn(dimension: string, dependency: string, dependencyGraph: Record): boolean; /** * Validates that dimensions are specified in the dependency graph * * @param dimensions - Dimensions to check * @param dependencyGraph - Dependency graph * @throws {ValidationError} If dimensions are not in graph */ static validateDimensionsInGraph(dimensions: string[], dependencyGraph: Record): void; } //# sourceMappingURL=dependency-validator.d.ts.map