| 1 |
import { type DescField, type DescMessage } from "./descriptors.js"; |
| 2 |
import type { MessageShape } from "./types.js"; |
| 3 |
import type { ReflectMessage } from "./reflect/index.js"; |
| 4 |
import { BinaryReader, WireType } from "./wire/binary-encoding.js"; |
| 5 |
/** |
| 6 |
* Options for parsing binary data. |
| 7 |
*/ |
| 8 |
export interface BinaryReadOptions { |
| 9 |
/** |
| 10 |
* Retain unknown fields during parsing? The default behavior is to retain |
| 11 |
* unknown fields and include them in the serialized output. |
| 12 |
* |
| 13 |
* For more details see https://developers.google.com/protocol-buffers/docs/proto3#unknowns |
| 14 |
*/ |
| 15 |
readUnknownFields: boolean; |
| 16 |
/** |
| 17 |
* The maximum depth of nested messages to parse. If a message nests deeper |
| 18 |
* than this limit, parsing fails with an error instead of exhausting the |
| 19 |
* call stack. Defaults to 100. |
| 20 |
*/ |
| 21 |
recursionLimit: number; |
| 22 |
} |
| 23 |
interface BinaryReadContext extends BinaryReadOptions { |
| 24 |
depth: number; |
| 25 |
} |
| 26 |
/** |
| 27 |
* @private Only exported for getExtension() |
| 28 |
*/ |
| 29 |
export declare function makeReadContext(options?: Partial<BinaryReadOptions>): BinaryReadContext; |
| 30 |
/** |
| 31 |
* Parse serialized binary data. |
| 32 |
*/ |
| 33 |
export declare function fromBinary<Desc extends DescMessage>(schema: Desc, bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MessageShape<Desc>; |
| 34 |
/** |
| 35 |
* Parse from binary data, merging fields. |
| 36 |
* |
| 37 |
* Repeated fields are appended. Map entries are added, overwriting |
| 38 |
* existing keys. |
| 39 |
* |
| 40 |
* If a message field is already present, it will be merged with the |
| 41 |
* new data. |
| 42 |
*/ |
| 43 |
export declare function mergeFromBinary<Desc extends DescMessage>(schema: Desc, target: MessageShape<Desc>, bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MessageShape<Desc>; |
| 44 |
/** |
| 45 |
* @private Only exported for getExtension() |
| 46 |
*/ |
| 47 |
export declare function readField(message: ReflectMessage, reader: BinaryReader, field: DescField, wireType: WireType, ctx: BinaryReadContext): void; |
| 48 |
export {}; |