import { DepGraph } from "dependency-graph"; import { ConfigurationError } from "@garden-io/grow-sdk/errors"; import type { LogMetadata, TaskLogStatus } from "../logger/log-entry"; import type { BaseTask } from "../tasks/base"; import type { GraphNodes } from "./config-graph"; type CircularDependenciesErrorParams = { messagePrefix: string; cycles: Cycle[]; cyclesSummary: string; }; export declare class CircularDependenciesError extends ConfigurationError { private _messagePrefix; cycles: Cycle[]; cyclesSummary: string; constructor({ messagePrefix, cycles, cyclesSummary }: CircularDependenciesErrorParams); set messagePrefix(newMessagePrefix: string); get messagePrefix(): string; private static constructMessage; } export type DependencyGraphNode = { key: string; dependencies: string[]; description?: string; }; /** * Extends the dependency-graph module to improve circular dependency detection (see below). */ export declare class DependencyGraph extends DepGraph { outgoingEdges: Record; nodes: Record; static fromGraphNodes(dependencyGraph: G): DependencyGraph; overallOrder(leavesOnly?: boolean): string[]; /** * Returns an error if cycles were found. */ detectCircularDependencies(): Cycle[]; /** * Computes minimal cycles for the graph. This is more expensive than the above method, so it should be used rarely. */ detectMinimalCircularDependencies(): Cycle[]; cyclesToString(cycles: Cycle[]): string; } export type Cycle = string[]; interface DependencyEdge { from: string; to: string; } /** * Implements a variation on the Floyd-Warshall algorithm to compute minimal cycles. * * This is approximately O(n^3), where n is the number of nodes in the graph. * * Returns a list of cycles found. */ export declare function detectCycles(edges: DependencyEdge[]): Cycle[]; export declare function cyclesToString(cycles: Cycle[]): string; export declare function nodeKey(name: string): string; export declare function metadataForLog(task: BaseTask, status: TaskLogStatus, outputVersion?: string): LogMetadata; export {};