/** * ValidationPipeline (G34 — Pipeline Specification) * ──────────────────────────────────────────────────── * Defines and orchestrates the formal validation pipeline for xml-xsd-engine. * * Pipeline stages (in execution order) * ───────────────────────────────────── * Stage 1: XML Parse – raw string → XmlDocument (well-formedness) * Stage 2: Namespace Resolve – attach namespace URIs to all nodes (G35) * Stage 3: Schema Compile – SchemaModel → CompiledSchema (G27-lite) * Stage 4: Structure Validate – DFA-style structural check (sequences/choices) * Stage 5: Type Validate – per-element & per-attribute type checking * Stage 6: Identity Check – xs:key / xs:unique / xs:keyref * Stage 7: Post-process – IDREF resolution, PSVI tagging (future) * * The pipeline is: * • Observable — callers receive per-stage timing via profiling hooks (G44) * • Resumable — with `recover: true`, later stages still run after errors * • Configurable — strict/lax mode, schema-less parse, etc. * * Usage * ───── * const pipeline = new ValidationPipeline(schema, options); * const result = pipeline.run(xmlString); // full run * const result = pipeline.runDocument(doc); // from pre-parsed doc */ import { XmlDocument } from '../parser/XmlNodes'; import { ParseOptions } from '../parser/XmlParser'; import { SchemaModel } from '../schema/SchemaModel'; import { ValidationResult } from '../validator/ValidationResult'; import { ValidationOptions } from '../validator/ValidationEngine'; import { CompiledSchema } from './SchemaCompilerLite'; export interface PipelineOptions extends ValidationOptions { /** * Parse options forwarded to XmlParser (stage 1). * maxDepth, maxAttributes, etc. */ parseOptions?: ParseOptions; /** * 'strict' (default): unknown elements/attributes are errors. * 'lax': unknown elements/attributes are warnings only. */ mode?: 'strict' | 'lax'; /** * When true, the pipeline continues past structural errors to collect as * many issues as possible (required for IDE integrations — G15). * Default: false. */ recover?: boolean; /** * Enable per-stage profiling. Each StageResult will include a `durationMs` * field. Default: false. */ profile?: boolean; } export type PipelineStage = 'parse' | 'namespace' | 'schema-compile' | 'structure-validate' | 'type-validate' | 'identity-check' | 'post-process'; export interface StageResult { stage: PipelineStage; success: boolean; durationMs: number; /** Issues produced specifically by this stage */ issues: import('../validator/ValidationResult').ValidationIssue[]; } export interface PipelineResult { /** The final merged ValidationResult across all stages */ validation: ValidationResult; /** Per-stage breakdown (populated when options.profile = true, or always) */ stages: StageResult[]; /** The parsed document, if stage 1 succeeded */ document?: XmlDocument; /** The compiled schema, if stage 3 succeeded */ compiled?: CompiledSchema; /** True if every stage completed successfully */ success: boolean; /** Total wall-clock time across all stages (ms) */ totalMs: number; } export declare class ValidationPipeline { private schema; private opts; private compiled; constructor(schema: SchemaModel | null, options?: PipelineOptions); /** * Run the full pipeline from a raw XML string. */ run(xmlSource: string): PipelineResult; /** * Run from a pre-parsed XmlDocument (stages 2–7 only). */ runDocument(doc: XmlDocument): PipelineResult; /** * Pre-compile the schema (stage 3) so it can be reused across multiple runs. * The compiled result is cached on this instance. */ precompileSchema(): CompiledSchema | null; private _runValidationStages; private _runStage; private _newResult; private _finalise; } /** * Run the full pipeline from an XML string against an optional schema. * Returns both the ValidationResult and per-stage profiling data. */ export declare function runPipeline(xmlSource: string, schema: SchemaModel | null, options?: PipelineOptions): PipelineResult; //# sourceMappingURL=ValidationPipeline.d.ts.map