/** * The flow stage of validation: a flow read against the catalogue it runs in, * before the first spawn. * * Every name is resolved here (the agents, the flows called, and the * addresses each node reads in its lexical scope) and every fault is * returned at once. What passes * becomes a `CheckedFlow`, the one thing the runner takes. What depends on the * project a run starts in (its working tree, its ports, whether somebody is * there) is the run stage's, and is not looked at here. */ import type { AgentNames } from "./agents.ts"; import { Callees } from "./check-call.ts"; import type { FlowCatalogue } from "./catalogue.ts"; import { type CheckedFlow, type CheckedNode, type CheckedRead } from "./checked.ts"; import { type Condition } from "./condition/index.ts"; import { FaultList, type Fault } from "./fault.ts"; import type { FlowFile } from "./file.ts"; import { type FlowNode } from "./node.ts"; import { Scope } from "./scope.ts"; import type { ValueType } from "./type.ts"; /** A checked flow, or every fault that refused it. */ export type CheckFlow = { readonly ok: true; readonly flow: CheckedFlow; } | { readonly ok: false; readonly faults: readonly Fault[]; }; /** * The flow named `name` in `catalogue`, checked, with every flow it calls. * * A flow is found by its file name, so a file that does not parse is still * found, and reported as broken rather than unknown; its `name:` must say the * same. A flow calling a broken one is broken too. */ export declare function checkFlow(name: string, catalogue: FlowCatalogue): CheckFlow; /** * A sequence checked: its nodes, the type of each one's output by id, and the * type of what its last node outputs, which is what leaves a block. */ export type CheckedSequence = { readonly nodes: CheckedNode[]; readonly outputs: ReadonlyMap; readonly last?: ValueType; }; /** A node checked: the node when it passed, and the type of its output either way, so what follows is checked too. */ export type CheckedOne = { readonly node?: CheckedNode; readonly output: ValueType; }; /** * Resolves the nodes of one file. Each kind is checked in a `check-*.ts` of * its own, and the structural ones come back through * {@link Checker.sequence}. */ export declare class Checker { readonly faults: FaultList; /** The flow's name in the catalogue: what a call back to it is refused by. */ private readonly name; private readonly flow; private readonly callees; readonly agents: AgentNames; /** Every id of the file, so an address to one not ended yet says so. */ private readonly ids; /** Ids nothing is reported about again: the file's refused nodes, and the calls whose callee is. */ private readonly refused; constructor(name: string, flow: FlowFile, callees: Callees, faults: FaultList); /** `nodes` in `scope`, each ended node readable by the ones after it. */ sequence(nodes: readonly FlowNode[], scope: Scope): CheckedSequence; /** * The same checker with its faults thrown away: what a loop's body outputs * is needed to type its `previous` before the body is checked for real. */ quietly(): Checker; /** The condition `source`, written at `at`, compiled against what `scope` can read. */ condition(source: string, at: string, scope: Scope): Condition | undefined; /** The type `address` names in `scope`, or `undefined` after saying why. */ typeOf(address: string, at: string, scope: Scope): ValueType | undefined; private node; /** The flow `name`, called at `at`, checked whole; or `undefined` after saying why not. */ callee(name: string, at: string): CheckedFlow | undefined; /** The prose of the `agent` node `id`, its `## ` section. */ prose(id: string): string; /** Marks the node `id` refused: what reads it is not reported again. */ refuse(id: string): void; /** Whether `name` is the id of a node of this file. */ isNode(name: string): boolean; /** A bare id reads a node's output whole; a deeper address reads that value only. */ read(address: string, at: string, scope: Scope): CheckedRead | undefined; /** Whether a condition names a refused node, so it is not reported again. */ private refusedIn; } //# sourceMappingURL=check.d.ts.map