import { Deserializer, DeserializerConfig, FieldTransform, RuleContext, SerdeType, Serializer, SerializerConfig } from "./serde"; import { Client, SchemaInfo } from "../schemaregistry-client"; import avro, { ForSchemaOptions, Type } from "avsc"; import { LRUCache } from 'lru-cache'; import { RuleRegistry } from "./rule-registry"; import type { IHeaders } from "@confluentinc/kafka-javascript/types/kafkajs"; export declare const AVRO_TYPE = "AVRO"; export type AvroSerdeConfig = Partial; export interface AvroSerde { schemaToTypeCache: LRUCache]>; } /** * AvroSerializerConfig is used to configure the AvroSerializer. */ export type AvroSerializerConfig = SerializerConfig & AvroSerdeConfig; /** * AvroSerializer is used to serialize messages using Avro. */ export declare class AvroSerializer extends Serializer implements AvroSerde { schemaToTypeCache: LRUCache]>; /** * Create a new AvroSerializer. * @param client - the schema registry client * @param serdeType - the type of the serializer * @param conf - the serializer configuration * @param ruleRegistry - the rule registry */ constructor(client: Client, serdeType: SerdeType, conf: AvroSerializerConfig, ruleRegistry?: RuleRegistry); /** * serialize is used to serialize a message using Avro. * @param topic - the topic to serialize the message for * @param msg - the message to serialize * @param headers - optional headers */ serialize(topic: string, msg: any, headers?: IHeaders): Promise; fieldTransform(ctx: RuleContext, fieldTransform: FieldTransform, msg: any): Promise; toType(info: SchemaInfo): Promise<[Type, Map]>; getRecordName(info?: SchemaInfo): Promise; static messageToSchema(msg: any): avro.Type; } /** * AvroDeserializerConfig is used to configure the AvroDeserializer. */ export type AvroDeserializerConfig = DeserializerConfig & AvroSerdeConfig; /** * AvroDeserializer is used to deserialize messages using Avro. */ export declare class AvroDeserializer extends Deserializer implements AvroSerde { schemaToTypeCache: LRUCache]>; /** * Create a new AvroDeserializer. * @param client - the schema registry client * @param serdeType - the type of the deserializer * @param conf - the deserializer configuration * @param ruleRegistry - the rule registry */ constructor(client: Client, serdeType: SerdeType, conf: AvroDeserializerConfig, ruleRegistry?: RuleRegistry); /** * Deserializes a message. * @param topic - the topic * @param payload - the message payload * @param headers - optional headers */ deserialize(topic: string, payload: Buffer, headers?: IHeaders): Promise; fieldTransform(ctx: RuleContext, fieldTransform: FieldTransform, msg: any): Promise; toType(info: SchemaInfo): Promise<[Type, Map]>; getRecordName(info?: SchemaInfo): Promise; }