Class RunnerBase<Node, Result, Sync, O>Abstract

Base class of Runner and RunnerSync

Type Parameters

Hierarchy (view full)

Constructors

Properties

abortController: AbortController

AbortController used internally to abort the process.

This is internal only, and triggering it at the wrong time may cause undefined and unsupported behavior. Do not use!

Instead, if you want to be able to abort the walk at any time, provide your own AbortSignal in the opions.

dependents: Map<Node, Set<Node>> = ...

Set of dependents (direct & transitive) on each node

directDependents: Map<Node, Set<Node>> = ...

Set of direct dependents on each node

errors: unknown[] = []

Rejections and Errors encountered in the traversal

failFast: boolean

True if we are in failFast mode

from: Callable

Function defining the callsite where the traversal was initiated, used for Error.captureStackTrace.

options: O

Options provided to constructor

results: Map<Node, Result> = ...

The map of traversal results

settled: SettledMap<Node, Result> = ...

The map of PromiseSettledResult objects

Methods

  • Internal

    If the dependency from n -> d at the specified path would cause a cycle, then call the onCycle method and return true. Oherwise, assign the appropriate entries in the dependency tracking sets, and return false.

    Parameters

    Returns boolean

  • Get the dependencies of a given node

    Parameters

    Returns Sync extends true
        ? Node[]
        : Promise<Node[]>

  • Internal

    Method that handles errors raised by visits.

    Parameters

    Returns void

  • Internal

    Method that handles successful visit results

    Parameters

    Returns void

  • Calls the options.onCycle() method when a cycle is detected.

    Parameters

    Returns Sync extends true
        ? void
        : void | Promise<void>

  • For a Node n that depends directly or transitively on Node d, find the shortest known dependency path from n to d. This is done by walking backwards breadth-first up the dependency relations from d until n is found.

    If no known path can be found, then undefined is returned. Otherwise, a path array is returned that starts with n and ends with d.

    Note that self-referential links are never considered, since they're by definition cyclical.

    Parameters

    Returns undefined | [n: Node, ...path: Node[]]

  • Initiate the graph traversal, resolving/returning when complete

    Returns Sync extends true
        ? void
        : Promise<void>