import { TopicPartitionOffsetAndMetadata, KafkaMessage, Consumer } from 'kafkajs'; interface SetHasConsumedParams { messages: WrappedKafkaMessage[]; commitOptions: TopicPartitionOffsetAndMetadata[]; } interface CheckIfAlreadyConsumedParams { topic: string; partition: number; offset: string; } interface OffsetDeduper { setHasConsumed: (params: SetHasConsumedParams) => Promise; checkIfAlreadyConsumed: (params: CheckIfAlreadyConsumedParams) => Promise; [key: string]: any; } type WrappedKafkaMessage = { message: KafkaMessage; topic: string; partition: number; offset: string; }; interface BatchContext { [key: string]: unknown; } interface BatcherHandlerParams { messages: WrappedKafkaMessage[]; batchContext: BatchContext; } type BatcherHandler = (params: BatcherHandlerParams) => Promise; type GetMessageFunctionInfo = (kafkaMessage: any, topic: string, partition: number) => Promise<{ [key: string]: unknown; count: number; storeKey: string; }> | { [key: string]: unknown; count: number; storeKey: string; }; interface BatcherConstructorOptions { handler: BatcherHandler; consumer: Consumer; getMessageInfo?: GetMessageFunctionInfo; batchSize?: number; maxIdleMs?: number; offsetDeduper?: OffsetDeduper; } interface IngestBatchParams { messages: KafkaMessage[]; resolveOffset(offset: string): void; topic: string; partition: number; } declare class Batcher { private store; private timeouts; private one; private ready; private maxIdleMs; private batchSize; private handler; private getMessageInfo; private consumer; private flushQueue; private prepareQueue; private offsetDeduper; constructor(opts: BatcherConstructorOptions); stop(): Promise; private getBatchCommitMap; private getPendingCommitMap; private commitSkipped; private getCommitOptions; private flush; private _getMessageInfo; private clearTimeout; private push; private prepare; private setTimeouts; ingestBatch({ messages, topic, partition, resolveOffset, }: IngestBatchParams): Promise; } export { Batcher as B, CheckIfAlreadyConsumedParams as C, OffsetDeduper as O, SetHasConsumedParams as S, WrappedKafkaMessage as W };