/** * Recursive JSON schema walker for hydration payloads. * * When a site embeds its data as `window.__INITIAL_STATE__` / `__NEXT_DATA__` * / `__initialData__` etc., the natural temptation is to extract only the * keys you guessed before opening the page. That's how fields get missed. * * walkSchema() flattens an entire JSON tree into `path → sample value` * rows so the agent can see EVERY leaf and pick what's worth capturing. * Designed to be used during reconnaissance, not at runtime. */ export interface SchemaLeaf { /** Dot-separated path, with `[N]` for array indices. */ readonly path: string; /** Primitive value (string truncated to ~80 chars). */ readonly value: string | number | boolean | null; /** Inferred type — useful when value is null/empty. */ readonly type: "string" | "number" | "boolean" | "null"; } export interface WalkOptions { /** Cap on visited array elements per array. Default 3. */ readonly arraySampleSize?: number; /** Truncate string values to this many chars. Default 80. */ readonly maxValueLength?: number; /** Maximum recursion depth. Default 12. */ readonly maxDepth?: number; } export declare function walkSchema(root: unknown, options?: WalkOptions): readonly SchemaLeaf[]; /** * Filter walked leaves by keyword. Useful for "show me anything that mentions * price/area/owner/etc" without writing custom traversal each time. */ export declare function filterLeaves(leaves: readonly SchemaLeaf[], keywords: readonly string[]): readonly SchemaLeaf[]; /** * Format leaves as a markdown table — paste straight into a recon report. */ export declare function formatLeavesTable(leaves: readonly SchemaLeaf[], header?: string): string; export interface HydrationPayload { /** Where the payload was found — informational, may be truncated for display. */ readonly source: string; /** * Full source URL when the payload came from network capture (XHR). Carries * the complete query string — `api_key`, filters, pagination — so you can * replay the request directly (Tier 3 → Tier 2 downgrade). Undefined for * payloads extracted from inline HTML. */ readonly url?: string; /** Parsed JSON object. */ readonly data: unknown; } /** * Find every hydration payload on the page. Returns an array because real * sites embed multiple: e.g. IndiaMART has `__INITIAL_STATE__` AND two * `` * 3. Every `` block * 4. Every `` block */ export declare function extractAllHydrationPayloads(html: string): readonly HydrationPayload[]; /** * Backwards-compatible single-payload extractor. Returns the first parsed * payload found (preferring known globals over generic/JSON-LD). Use * `extractAllHydrationPayloads` when you want everything. */ export declare function extractAnyHydrationPayload(html: string): unknown;