import type { NumericMap } from '../utils.ts'; import { type CompressionAlgorithmValue } from './compression.ts'; import { type NullableString } from './definitions.ts'; import { Reader } from './reader.ts'; import { Writer } from './writer.ts'; export declare const CURRENT_RECORD_VERSION = 2; export declare const IS_COMPRESSED = 7; export declare const IS_TRANSACTIONAL: number; export declare const IS_CONTROL: number; export declare const BATCH_HEAD: number; export interface MessageBase { key?: Key; value?: Value; topic: string; partition?: number; timestamp?: bigint; } export interface MessageToProduce extends MessageBase { headers?: Map | Record; metadata?: unknown; } export interface MessageConsumerMetadata { coordinatorId: number; groupId: string; generationId: number; memberId: string; } export interface MessageJSON { key: Key; value: Value; headers: Array<[HeaderKey, HeaderValue]>; topic: string; partition: number; timestamp: string; offset: string; metadata: Record; } export interface Message extends Required> { headers: Map; offset: bigint; metadata: Record; commit(callback?: (error?: Error) => void): void | Promise; toJSON(): MessageJSON; } export interface MessageRecord { key?: Buffer; value: Buffer; headers?: Map; topic: string; partition?: number; timestamp?: bigint; } export interface CreateRecordsBatchOptions { transactionalId?: NullableString; compression: CompressionAlgorithmValue; firstSequence?: number; producerId: bigint; producerEpoch: number; sequences: NumericMap; partitionLeaderEpoch: number; } export interface KafkaRecord { length: number; attributes: number; timestampDelta: bigint; offsetDelta: number; key: Buffer | null; value: Buffer | null; headers: [Buffer | null, Buffer | null][]; } export interface MessageToConsume extends KafkaRecord { topic: string; partition: number; } export interface RecordsBatch { firstOffset: bigint; length: number; partitionLeaderEpoch: number; magic: number; crc: number; attributes: number; lastOffsetDelta: number; firstTimestamp: bigint; maxTimestamp: bigint; producerId: bigint; producerEpoch: number; firstSequence: number; records: KafkaRecord[]; } export declare const messageSchema: { type: string; properties: { key: boolean; value: boolean; headers: { anyOf: ({ map: boolean; type?: undefined; additionalProperties?: undefined; } | { type: string; additionalProperties: boolean; map?: undefined; })[]; }; topic: { type: string; }; partition: { type: string; }; timestamp: { bigint: boolean; }; }; required: string[]; additionalProperties: boolean; }; export declare function createRecord(message: MessageRecord, offsetDelta: number, firstTimestamp: bigint): Writer; export declare function readRecord(reader: Reader): KafkaRecord; export declare function createRecordsBatch(messages: MessageRecord[], options?: Partial): Writer; export declare function readRecordsBatch(reader: Reader): RecordsBatch; export declare function readRecordsBatches(reader: Reader): RecordsBatch[];