import avro from "avsc"; /** Schema metadata Pub/Sub attaches to a message. See `SCHEMA_ATTRIBUTES` for the wire names. */ export interface SchemaMessageMeta { readonly name?: string; readonly revision?: string; readonly encoding?: string; } export declare class SchemaDecodeError extends Error { readonly cause?: unknown | undefined; constructor(message: string, cause?: unknown | undefined); } export interface AvroCodecOptions { /** Fetches a writer schema definition by revision-qualified name (`name@revisionId`). */ fetchWriterSchema: (revisionQualifiedName: string) => Promise; /** * The compiled reader type for a schema, from the types the consumer imports — never from the * registry. Returning undefined means this consumer cannot read the schema at all. */ readerTypeFor: (schemaName: string) => avro.Type | undefined; /** * Fail closed when the writer schema cannot be *fetched*. Default true. `false` falls back to * plain JSON for that failure alone — every other resolution failure stays fatal. See * `SchemaRegistryOptions.strict`. */ strict?: boolean; maxCachedRevisions?: number; cacheTtlMs?: number; now?: () => number; logger?: Pick; /** Called once per schema lookup, so the cache hit rate can be reported as a metric. */ onCacheResult?: (result: "hit" | "miss") => void; } export declare class AvroCodec { private readonly options; private readonly cache; private readonly strict; constructor(options: AvroCodecOptions); decode(body: Buffer, meta: SchemaMessageMeta): Promise; private resolve; } /** * The writer schema could not be fetched: a Schema Service outage, a client without schema support, * or a revision that has not propagated yet. An availability problem rather than evidence that the * message cannot be read, which is why it is the one case `strict: false` may fall back on. * * Exported because the distinction outlives this module: `MessagePipeline` routes it through * `validation.onSchemaUnavailable` (default nack) rather than `onDecodeFailure`, since redelivering * costs a retry while dead-lettering a decodable message costs a manual redrive. */ export declare class WriterSchemaUnavailableError extends SchemaDecodeError { constructor(revisionQualifiedName: string, cause: unknown); } //# sourceMappingURL=avro-codec.d.ts.map