Interface RunnerOptions<Node, Result>

Options that define the graph and how to traverse it

interface RunnerOptions<Node, Result> {
    failFast?: boolean;
    getDeps: ((node: Node) => Node[] | Promise<Node[]>);
    graph: [node: Node, ...rest: Node[]];
    onCycle?: ((node: Node, cycle: Node[], path: Node[]) => void | Promise<void>);
    signal?: AbortSignal;
    visit: ((node: Node, signal: AbortSignal, path: Node[], depResults: DepResults<Node, Result>) => Result | Promise<Result>);
}

Type Parameters

  • Node
  • Result = void

Hierarchy (view full)

Properties

failFast?: boolean

Set to false to continue operations even if errors occur. If set to false, then an AggregateError will be raised on failure containing all failures (even if only one). If true, then a normal Error will be raised on failure.

true
getDeps: ((node: Node) => Node[] | Promise<Node[]>)

get the dependencies of a given node

graph: [node: Node, ...rest: Node[]]

Array of one or more entry nodes.

onCycle?: ((node: Node, cycle: Node[], path: Node[]) => void | Promise<void>)

Called when a cycle is encountered. Throw in this method to enforce a DAG graph. If left undefined, then cycles are silently ignored and skipped.

node parameter is the dependency that is being skipped.

cycle is the route from the dependent back to itself via the parent.

path is the path to the dependent who wanted this dep to be loaded.

signal?: AbortSignal

a signal that will trigger the graph traversal to end prematurely

visit: ((node: Node, signal: AbortSignal, path: Node[], depResults: DepResults<Node, Result>) => Result | Promise<Result>)

action to take on each node