| 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 serializing to the protobuf text format. |
| 6 |
* |
| 7 |
* The text format represents 64-bit integral types with BigInt and has no |
| 8 |
* string fall-back: toText throws immediately when BigInt is unavailable. |
| 9 |
*/ |
| 10 |
export interface TextWriteOptions { |
| 11 |
/** |
| 12 |
* Print unknown fields? |
| 13 |
* |
| 14 |
* Disabled by default. This is a debugging aid only: unknown fields are |
| 15 |
* printed by field number, and fromText rejects fields named by number, so |
| 16 |
* output that includes them cannot be parsed back. |
| 17 |
*/ |
| 18 |
printUnknownFields: boolean; |
| 19 |
/** |
| 20 |
* The registry to resolve `google.protobuf.Any` and extensions. Without it, |
| 21 |
* an Any is written as its raw `type_url`/`value` fields and extensions are |
| 22 |
* omitted. |
| 23 |
*/ |
| 24 |
registry?: Registry | undefined; |
| 25 |
} |
| 26 |
/** |
| 27 |
* Serialize a message to the protobuf text format. |
| 28 |
* |
| 29 |
* The output matches the default formatting of txtpbfmt: two-space indentation, |
| 30 |
* one field per line, and a trailing newline. |
| 31 |
* |
| 32 |
* Requires BigInt: throws immediately if the environment does not support it. |
| 33 |
*/ |
| 34 |
export declare function toText<Desc extends DescMessage>(schema: Desc, message: MessageShape<Desc>, options?: Partial<TextWriteOptions>): string; |