flow/render/plan

Source: src/flow/render/plan.ts

The plan of a checked flow: one line per node, in the tree the file writes, each saying everything the check resolved about it.

A line is keyed by the visit path it stands for, with #n where a loop numbers its iterations and [i] where a map numbers its items, so a run can fill the plan as its visits end rather than draw a second picture. A call is one line: its callee’s plan is the callee’s own.

Plan

type

export type Plan = {
	/** The flow's name. */
	readonly flow: string;
	/** Its file, its input, and its `model:` and `timeout:` when it sets them. */
	readonly facts: readonly string[];
	/** Its worst case, run whole. */
	readonly bound: Bound;
	/** The root sequence. */
	readonly lines: readonly PlanLine[];
};

A flow’s plan: the flow itself, its worst case whole, and its root sequence.

PlanLine

type

export type PlanLine = {
	/** A node's kind, or a `choice` case, or a `parallel` branch. */
	readonly kind: NodeKind | "case" | "branch";
	/** The node's id, the branch's name, or the case's number, `default` for the last. */
	readonly id: string;
	/** The visit path the line stands for; a case has its choice's, since a case is not a segment of one. */
	readonly path: string;
	/** What was resolved, in the order the file's keys read. */
	readonly facts: readonly string[];
	/** A node's worst case over every visit a run can make of it; a case and a branch have none. */
	readonly bound?: Bound;
	/** The lines under it: a block's sequence, a case's, a branch's. */
	readonly lines: readonly PlanLine[];
};

One line of a plan: a node, a choice case or a parallel branch, and the lines under it.

planOf

function

export function planOf(checked: CheckedFlow): Plan { /* … */ }

The plan of checked, pure: the same flow gives the same plan.