/** * CSV Row Processor * * Core row processing logic shared between sync and streaming parsers. * Handles header processing, column validation, and row completion. */ import type { CsvRecordError, RecordInfo } from "../types.js"; import type { ParseConfig } from "./config.js"; import type { ParseState } from "./state.js"; /** * Result of processing a single row */ export interface RowProcessResult { /** Whether to stop parsing (maxRows reached) */ stop: boolean; /** Whether row was skipped (invalid, filtered, etc.) */ skipped: boolean; /** Processed row data (if not skipped) */ row?: string[]; /** Record info (if info option enabled) */ info?: RecordInfo; /** Error that occurred (if any) */ error?: CsvRecordError; /** Reason for skipping/invalidating the row */ reason?: string; /** Extra columns when columnMismatch.more is 'keep' */ extras?: string[]; } /** * Process headers from a row (first data row or configured headers) * Returns true if the row should be skipped (was used as headers) */ export declare function processHeaderRow(row: string[], state: ParseState, config: Pick): boolean; /** * Validate row column count against headers * Returns error info if validation fails, null otherwise */ export declare function validateRowColumns(row: string[], state: ParseState, config: Pick): { errorCode: "TooManyFields" | "TooFewFields"; message: string; isValid: boolean; reason?: string; extras?: string[]; } | null; /** * Build record info for a completed row */ export declare function buildRecordInfo(state: ParseState, dataRowIndex: number, includeRaw: boolean, fieldCount: number): RecordInfo; /** * Convert a raw row to an object record with optional dynamic typing */ export declare function rowToRecord(row: string[], state: ParseState, config: Pick): Record; /** * Check if a row should be skipped (comment or empty) */ export declare function shouldSkipRow(row: string[], comment: string | undefined, shouldSkipEmpty: boolean | "greedy", skipRecordsWithEmptyValues: boolean): boolean; /** * Process a completed row through headers, validation, etc. * This is the core row processing logic shared between sync and streaming parsers. */ export declare function processCompletedRow(row: string[], state: ParseState, config: ParseConfig, errors: CsvRecordError[], lineNumber: number): RowProcessResult;