| 1 |
import { type DescMessage } from "../descriptors.js"; |
| 2 |
import type { Registry } from "../registry.js"; |
| 3 |
import type { MessageShape } from "../types.js"; |
| 4 |
/** |
| 5 |
* Options for parsing the protobuf text format. |
| 6 |
*/ |
| 7 |
export interface TextReadOptions { |
| 8 |
/** |
| 9 |
* The registry to resolve `google.protobuf.Any` and extensions. Parsing an |
| 10 |
* Any in its expanded form, or an extension field, requires it. |
| 11 |
*/ |
| 12 |
registry?: Registry | undefined; |
| 13 |
/** |
| 14 |
* The maximum depth of nested messages to parse. A message nesting deeper |
| 15 |
* than this fails with an error instead of exhausting the call stack. |
| 16 |
* Defaults to 100. |
| 17 |
*/ |
| 18 |
recursionLimit: number; |
| 19 |
} |
| 20 |
/** |
| 21 |
* Parse a message from the protobuf text format. |
| 22 |
* |
| 23 |
* Requires BigInt: throws immediately if the environment does not support it. |
| 24 |
*/ |
| 25 |
export declare function fromText<Desc extends DescMessage>(schema: Desc, text: string, options?: Partial<TextReadOptions>): MessageShape<Desc>; |
| 26 |
/** |
| 27 |
* Parse a message from the protobuf text format, merging into the target. |
| 28 |
* |
| 29 |
* Repeated fields are appended, singular fields are overwritten (last wins), |
| 30 |
* message fields are merged, and map entries are added (overwriting an existing |
| 31 |
* key). |
| 32 |
* |
| 33 |
* Requires BigInt: throws immediately if the environment does not support it. |
| 34 |
*/ |
| 35 |
export declare function mergeFromText<Desc extends DescMessage>(schema: Desc, target: MessageShape<Desc>, text: string, options?: Partial<TextReadOptions>): MessageShape<Desc>; |