/** * Semantic validator for a parsed TDC document. * * Runs AFTER the parser has produced a concrete tree. Finds problems * that the grammar accepts but that would otherwise only surface at * render time — things like: * * - Missing or misspelled attribute names / values * - Unknown `` kinds * - Unknown template paths (with "did you mean X?" suggestions) * - Unknown / forward / malformed `parent="…"` references * - Malformed `if="…"` expressions (jsep compile + supported-operator check) * - Malformed numeric/date ranges, bad percent sums * - Missing files for `` * - Duplicate `` names * - Unknown attributes / unknown child tags (warnings) * * Every finding is a `Diagnostic` with line/column pointing at the most * specific node possible (ideally the attribute value token). The * renderer no longer needs to produce friendly errors for these — it can * assume a validated tree. */ import type { DataSourceOptions } from '../data-source/index.js'; import { type Diagnostic } from '../errors/index.js'; import type { DocumentContext } from '../generated/TDCParser.js'; import type { PackParams, PackParamWidths } from './pack-params.js'; export interface ValidationResult { readonly diagnostics: readonly Diagnostic[]; } export interface ValidationOptions { readonly dataSources?: DataSourceOptions | undefined; /** * Dotted addresses of loaded data packs. Treated as valid `template` * values so pack addresses aren't flagged as unknown template paths. */ readonly packAddresses?: readonly string[] | undefined; /** Address → why that pack file cannot be used. See `PackEntry.unusable`. */ readonly packUnusable?: ReadonlyMap | undefined; /** * Address → the parameter names a generator pack accepts (its `` * names). Lets the validator catch an attribute the pack cannot act on. */ readonly packParams?: PackParams | undefined; /** * Address → parameter → the width the pack's own sequence always produces. * Only the ones that can be PROVEN are here; the rest are simply absent. */ readonly packParamWidths?: PackParamWidths | undefined; /** * The pack addresses that name a generator rather than a value list. A * `uniq="true"` draw needs a list, so the run refuses one over a generator; * this lets `check` refuse it first. Absent → that check stays silent. */ readonly packGenerators?: ReadonlySet | undefined; /** * The row count the run will ACTUALLY use, when `--count` overrides the one * in ``. * * Several warnings are arithmetic over the count — a share that rounds to * less than one record, a `uniq` column too wide to hold in memory — and a * warning computed over the declared count while the run uses another is * describing a run that is not happening. Measured before this existed: * `--count 1000` on a `count="3"` config warned about 3 rows and generated * 1000, and the mirror image said nothing at all about a run that really did * ask for 0.99 of a record. */ readonly count?: number | undefined; } export declare function validate(tree: DocumentContext, options?: ValidationOptions): ValidationResult; //# sourceMappingURL=validate.d.ts.map