/** * ParseBudget — Phase 13: Parsing cost tracking + timeout * ───────────────────────────────────────────────────────── * Provides a configurable "budget" that can abort parsing when any of * these limits is exceeded: * * • wallTime – maximum elapsed milliseconds * • bytes – maximum input bytes processed * • nodes – maximum DOM nodes created * • depth – maximum nesting depth (also in ParseOptions) * * Usage * ───── * const budget = new ParseBudget({ wallTimeMs: 2000, nodes: 500_000 }); * const doc = budget.parse(hugeXml); // throws XmlError(SEC_*) if exceeded */ import { ParseOptions } from '../parser/XmlParser'; import { XmlDocument } from '../parser/XmlNodes'; export interface ParseBudgetOptions { /** Maximum elapsed wall-clock time in milliseconds (default: no limit) */ wallTimeMs?: number; /** Maximum input byte count (default: no limit) */ bytes?: number; /** Maximum DOM nodes (forwarded to maxNodeCount) (default: 1_000_000) */ nodes?: number; /** Maximum nesting depth (forwarded to maxDepth) (default: 500) */ depth?: number; /** Maximum attributes per element (default: 256) */ maxAttributes?: number; /** Maximum text node length (default: 10_000_000) */ maxTextLength?: number; /** Any additional ParseOptions */ parseOptions?: ParseOptions; } export declare class ParseBudget { private opts; constructor(opts?: ParseBudgetOptions); /** * Parse `input` under the configured budget. * Throws XmlError with code SEC_* if any limit is exceeded. */ parse(input: string): XmlDocument; /** * Run a cost report for the given input without throwing. * Useful for profiling / monitoring. */ report(input: string): { bytes: number; elapsedMs: number; withinBudget: boolean; violations: string[]; }; } //# sourceMappingURL=ParseBudget.d.ts.map