| 1 |
import type { Message, MessageShape } from "../types.js"; |
| 2 |
import type { Any } from "./gen/google/protobuf/any_pb.js"; |
| 3 |
import type { DescMessage } from "../descriptors.js"; |
| 4 |
import type { Registry } from "../registry.js"; |
| 5 |
/** |
| 6 |
* Creates a `google.protobuf.Any` from a message. |
| 7 |
*/ |
| 8 |
export declare function anyPack<Desc extends DescMessage>(schema: Desc, message: MessageShape<Desc>): Any; |
| 9 |
/** |
| 10 |
* Packs the message into the given any. |
| 11 |
*/ |
| 12 |
export declare function anyPack<Desc extends DescMessage>(schema: Desc, message: MessageShape<Desc>, into: Any): void; |
| 13 |
/** |
| 14 |
* Returns true if the Any contains the type given by schema. |
| 15 |
*/ |
| 16 |
export declare function anyIs(any: Any, schema: DescMessage): boolean; |
| 17 |
/** |
| 18 |
* Returns true if the Any contains a message with the given typeName. |
| 19 |
*/ |
| 20 |
export declare function anyIs(any: Any, typeName: string): boolean; |
| 21 |
/** |
| 22 |
* Unpacks the message the Any represents. |
| 23 |
* |
| 24 |
* Returns undefined if the Any is empty, or if packed type is not included |
| 25 |
* in the given registry. |
| 26 |
*/ |
| 27 |
export declare function anyUnpack(any: Any, registry: Registry): Message | undefined; |
| 28 |
/** |
| 29 |
* Unpacks the message the Any represents. |
| 30 |
* |
| 31 |
* Returns undefined if the Any is empty, or if it does not contain the type |
| 32 |
* given by schema. |
| 33 |
*/ |
| 34 |
export declare function anyUnpack<Desc extends DescMessage>(any: Any, schema: Desc): MessageShape<Desc> | undefined; |
| 35 |
/** |
| 36 |
* Same as anyUnpack but unpacks into the target message. |
| 37 |
*/ |
| 38 |
export declare function anyUnpackTo<Desc extends DescMessage>(any: Any, schema: Desc, message: MessageShape<Desc>): MessageShape<Desc> | undefined; |