import { IField } from '../interfaces'; /** * Validation pass over the field set that feeds `toWorkflow` (the dimensions/measures * pools). It catches, before any computation runs, the failure classes that the * workflow pipeline otherwise turns into silently wrong data: * * - `missing-field`: a computed field references a fid (or, inside a SQL expression, * a name) that resolves to nothing. `replaceFid` passes unresolved SQL refs through * verbatim and the client executor evaluates missing columns to nullish values. * - `cyclic-dependency`: computed fields that depend on each other. `treeShake` in * utils/workflow.ts terminates on cycles (its work list strictly shrinks) but emits * an unsatisfiable transform order, so every field in the cycle computes garbage. * - `duplicate-fid`: two pool fields sharing one fid; transforms write the same * column key and the group-by silently reads whichever ran last. * * Pure and additive: nothing in the existing pipeline calls it implicitly except * `normalize()`, which is a new strict entry. */ export type IWorkflowFieldIssue = { type: 'missing-field'; fid: string; missing: string; } | { type: 'cyclic-dependency'; cycle: string[]; } | { type: 'duplicate-fid'; fid: string; }; type FieldLike = Pick; /** * @param fields the field pools that feed `toWorkflow` (dimensions + measures). * @param knownFields the dataset schema (`IMutField[]`-like). Field existence can only be * judged against the dataset — computed expressions may legitimately reference raw data * columns that are not in the chart pools (the executors read raw rows keyed by fid). * Note the runtime asymmetry this pass mirrors: `type:'field'` params and pass-through SQL * refs resolve by fid against pools ∪ schema, but SQL refs resolve BY NAME only through the * pools (replaceFid never sees the schema) — a name-only reference to a schema column outside * the pools fails loudly at runtime and is therefore reported as missing. * When omitted, the `missing-field` check is skipped and only the intrinsic structural * checks (cycles, duplicate fids) run. */ export declare function validateWorkflowFields(fields: readonly FieldLike[], knownFields?: readonly { fid: string; name?: string; }[]): IWorkflowFieldIssue[]; export declare function assertValidWorkflowFields(fields: readonly FieldLike[], knownFields?: readonly { fid: string; name?: string; }[]): void; export {};