import { z } from "zod"; import { Options } from "./parse"; /** * Error codes used for CSV parsing operations */ declare const ERROR_CODES: { HEADER: { MISSING_HEADER: string; MISSING_COLUMN: string; }; }; type ResultCSV = { success: true; header: string[]; allRows: Record[]; validRows: z.infer[]; } | { success: false; header: string[]; allRows: Record[]; validRows: z.infer[]; errors: { header?: { errorCode: keyof typeof ERROR_CODES['HEADER']; header: string; }; rows?: Record>; }; }; /** * Parses CSV content against a Zod schema * * @template T - The Zod schema type * @param {string} csvContent - The CSV content to parse as a string * @param {T} schema - The Zod schema to validate against * @param {Options} [options] - Optional configuration for CSV parsing * @returns {ResultCSV} Object containing parsing results including: * - success: Whether parsing was completely successful * - header: The detected CSV headers * - allRows: All rows from the CSV (valid and invalid) * - validRows: Only the rows that passed validation * - errors: When success is false, contains header and/or row validation errors */ export declare const parseCSVContent: >(csvContent: string, schema: T, options?: Options) => ResultCSV; /** * Parses a CSV file against a Zod schema * * @template T - The Zod schema type * @param {File} csv - The CSV file to parse * @param {T} schema - The Zod schema to validate against * @param {Options} [options] - Optional configuration for CSV parsing * @returns {Promise>} A promise resolving to an object containing parsing results including: * - success: Whether parsing was completely successful * - header: The detected CSV headers * - allRows: All rows from the CSV (valid and invalid) * - validRows: Only the rows that passed validation * - errors: When success is false, contains header and/or row validation errors */ export declare const parseCSV: >(csv: File, schema: T, options?: Options) => Promise>; type ResultRow = { success: true; row: z.infer; } | { success: false; errors: z.ZodError[]; }; /** * Parses a single CSV row against a Zod schema * * @template T - The Zod schema type * @param {string} row - The CSV row content as a string * @param {T} schema - The Zod schema to validate against * @param {Options} [options] - Optional configuration for CSV parsing * @returns {ResultRow} Object containing parsing results including: * - When successful: { success: true, row: } * - When unsuccessful: { success: false, errors: } */ export declare const parseRow: >(row: string, schema: T, options?: Options) => ResultRow; export { ERROR_CODES };