/** * What a visit can read where it stands, at run time: the lexical scope of * `src/flow/scope.ts`, holding values where that one holds types. * * Validation already proved every address names something readable here, so * the one thing a read can still meet is a node that ended without the value: * it failed under `on-fail: continue`, or an optional field was left out. */ import type { Ended } from "./ended.ts"; /** * What an address gave: its value, the node it went through that failed, * nothing, or, for `.previous` on a first iteration, nothing to hand on. */ export type Reading = { readonly kind: "value"; readonly value: unknown; } | { readonly kind: "failed"; readonly ended: Ended & { ok: false; }; } | { readonly kind: "absent"; readonly message: string; } | { readonly kind: "first"; }; /** One level of run-time scope. A child starts with everything its parent could read. */ export declare class Values { /** What is read whole by name: `input`, `item`, and a loop's or a map's own id inside it. */ private readonly lent; /** The nodes that ended, by id. */ private readonly nodes; /** The loops whose iteration here is their first, so `.previous` is not there yet. */ private readonly firsts; private constructor(); /** The root sequence's scope: only `input`. */ static root(input: unknown): Values; /** The scope of a sequence nested in this one. What ends in it is gone when it is. */ inside(): Values; /** Lends `name`, read whole: `item`, or a block's own id. `first` marks a loop's first iteration. */ lend(name: string, value: unknown, first?: boolean): this; /** Records that the node `id` ended. */ end(id: string, ended: Ended): void; /** How the node `id` ended, when it did here. */ ended(id: string): Ended | undefined; /** Everything readable here, by first word, as a condition reads it. */ all(): Record; /** * What `address` reads. A bare node id is its output; a deeper address * reads the node as it ended, so `plan.ok` is readable after a failure and * `plan.output.x` is not. */ read(address: string): Reading; /** The value at `address`, or why a block that needs it cannot have it. */ need(address: string): { readonly ok: true; readonly value: unknown; } | { readonly ok: false; readonly message: string; }; } //# sourceMappingURL=values.d.ts.map