import { GraphError } from "@garden-io/grow-sdk/errors"; import type { GrowErrorParams } from "@garden-io/grow-sdk/errors"; import type { EmptyObject } from "@garden-io/grow-sdk/util/types"; import type { GrowContext } from "../context"; import type { Log } from "../logger/log-entry"; import type { BaseTask } from "../tasks/base"; import { TypedEventEmitter } from "../util/events"; import type { InternalNodeTypes, TaskNode } from "./nodes"; import { GraphResults } from "./results"; import type { GraphResult, GraphResultEventPayload, TaskEventBase } from "./results"; export interface SolveOpts { statusOnly?: boolean; throwOnError?: boolean; } export interface SolveParams extends SolveOpts { log: Log; tasks: T[]; } export interface SolveResult { error: GraphResultError | null; results: GraphResults; } export declare class GraphSolver extends TypedEventEmitter { private grow; private log; private hardConcurrencyLimit; private readonly requestedTasks; private nodes; private pendingNodes; private readonly inProgress; private inLoop; private lock; constructor(grow: GrowContext, log: Log, hardConcurrencyLimit?: number); toSanitizedValue(): string; solve(params: SolveParams): Promise>; private getPendingGraph; start(): void; clearCache(): void; getNode({ type, task, statusOnly, }: { type: N; task: BaseTask; statusOnly: boolean; }): TaskNode>; private loop; /** * Processes a single task to completion, handling errors and providing its result to in-progress task batches. */ private processNode; private requestTask; private evaluateRequests; private ensurePendingNode; private completeTask; private getPendingResult; private logTask; private logTaskError; private logInternalError; private logError; } interface TaskStartEvent extends TaskEventBase { startedAt: Date; } interface SolverEvents { abort: { error: GraphResultError | null; }; loop: EmptyObject; process: { keys: string[]; inProgress: string[]; }; taskStart: TaskStartEvent; solveComplete: { error: Error | null; results: { [taskKey: string]: GraphResult; }; }; start: EmptyObject; statusComplete: GraphResultEventPayload; statusStart: TaskStartEvent; } interface GraphResultErrorDetail { results: GraphResults; } declare class GraphResultError extends GraphError { results: GraphResults; constructor(params: GraphResultErrorDetail & GrowErrorParams); } export {};