import { DEFAULT_DELIMITER, DEFAULT_QUOTATION } from '../../core/constants'; import { StringCSVLexer, StringCSVLexerTransformerStreamOptions, Token } from '../../core/types'; /** * A transform stream that converts a stream of strings into a stream of tokens. * * For most use cases, prefer the factory function {@link createStringCSVLexerTransformer}. * Use this class directly only when you need a custom lexer implementation. * * @category Low-level API * * @param lexer - A StringCSVLexer instance (required). Use {@link createStringCSVLexer} to create one. * @param options - Stream-specific options (backpressureCheckInterval, etc.) * @param writableStrategy - Strategy for the writable side (default: `{ highWaterMark: 65536, size: chunk => chunk.length }`) * @param readableStrategy - Strategy for the readable side (default: `{ highWaterMark: 1024, size: () => 1 }`) * * @see {@link https://github.com/kamiazya/web-csv-toolbox/blob/main/docs/how-to-guides/choosing-the-right-api.md | Choosing the Right API} for guidance on selecting the appropriate API level. * * @example Custom lexer implementation * ```ts * import { StringCSVLexerTransformer, type StringCSVLexer, type Token } from 'web-csv-toolbox'; * * // Custom lexer for non-standard CSV dialect * class MyCustomLexer implements StringCSVLexer { * lex(chunk?: string, options?: { stream?: boolean }): IterableIterator { * // Return an iterator (can use internal generator) * return this.#tokens(); * } * *#tokens(): Generator { * // Actual token generation logic * } * } * * const customLexer = new MyCustomLexer(); * stream.pipeThrough(new StringCSVLexerTransformer(customLexer)); * ``` */ export declare class StringCSVLexerTransformer<_Delimiter extends string = DEFAULT_DELIMITER, _Quotation extends string = DEFAULT_QUOTATION> extends TransformStream { readonly lexer: StringCSVLexer; /** * Yields to the event loop to allow backpressure handling. * Can be overridden for testing purposes. * @internal */ protected yieldToEventLoop(): Promise; constructor(lexer: StringCSVLexer, options?: StringCSVLexerTransformerStreamOptions, writableStrategy?: QueuingStrategy, readableStrategy?: QueuingStrategy); }