1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | import * as Protobuf from 'protobufjs';
|
20 | import * as descriptor from 'protobufjs/ext/descriptor';
|
21 | import { Options } from './util';
|
22 | import Long = require('long');
|
23 | export { Options, Long };
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 | export interface AnyExtension {
|
46 | |
47 |
|
48 |
|
49 |
|
50 | '@type': string;
|
51 | }
|
52 | export declare function isAnyExtension(obj: object): obj is AnyExtension;
|
53 | declare module 'protobufjs' {
|
54 | interface Type {
|
55 | toDescriptor(protoVersion: string): Protobuf.Message<descriptor.IDescriptorProto> & descriptor.IDescriptorProto;
|
56 | }
|
57 | interface RootConstructor {
|
58 | new (options?: Options): Root;
|
59 | fromDescriptor(descriptorSet: descriptor.IFileDescriptorSet | Protobuf.Reader | Uint8Array): Root;
|
60 | fromJSON(json: Protobuf.INamespace, root?: Root): Root;
|
61 | }
|
62 | interface Root {
|
63 | toDescriptor(protoVersion: string): Protobuf.Message<descriptor.IFileDescriptorSet> & descriptor.IFileDescriptorSet;
|
64 | }
|
65 | interface Enum {
|
66 | toDescriptor(protoVersion: string): Protobuf.Message<descriptor.IEnumDescriptorProto> & descriptor.IEnumDescriptorProto;
|
67 | }
|
68 | }
|
69 | export interface Serialize<T> {
|
70 | (value: T): Buffer;
|
71 | }
|
72 | export interface Deserialize<T> {
|
73 | (bytes: Buffer): T;
|
74 | }
|
75 | export interface ProtobufTypeDefinition {
|
76 | format: string;
|
77 | type: object;
|
78 | fileDescriptorProtos: Buffer[];
|
79 | }
|
80 | export interface MessageTypeDefinition extends ProtobufTypeDefinition {
|
81 | format: 'Protocol Buffer 3 DescriptorProto';
|
82 | }
|
83 | export interface EnumTypeDefinition extends ProtobufTypeDefinition {
|
84 | format: 'Protocol Buffer 3 EnumDescriptorProto';
|
85 | }
|
86 | export declare enum IdempotencyLevel {
|
87 | IDEMPOTENCY_UNKNOWN = "IDEMPOTENCY_UNKNOWN",
|
88 | NO_SIDE_EFFECTS = "NO_SIDE_EFFECTS",
|
89 | IDEMPOTENT = "IDEMPOTENT"
|
90 | }
|
91 | export interface NamePart {
|
92 | name_part: string;
|
93 | is_extension: boolean;
|
94 | }
|
95 | export interface UninterpretedOption {
|
96 | name?: NamePart[];
|
97 | identifier_value?: string;
|
98 | positive_int_value?: number;
|
99 | negative_int_value?: number;
|
100 | double_value?: number;
|
101 | string_value?: string;
|
102 | aggregate_value?: string;
|
103 | }
|
104 | export interface MethodOptions {
|
105 | deprecated: boolean;
|
106 | idempotency_level: IdempotencyLevel;
|
107 | uninterpreted_option: UninterpretedOption[];
|
108 | [k: string]: unknown;
|
109 | }
|
110 | export interface MethodDefinition<RequestType, ResponseType, OutputRequestType = RequestType, OutputResponseType = ResponseType> {
|
111 | path: string;
|
112 | requestStream: boolean;
|
113 | responseStream: boolean;
|
114 | requestSerialize: Serialize<RequestType>;
|
115 | responseSerialize: Serialize<ResponseType>;
|
116 | requestDeserialize: Deserialize<OutputRequestType>;
|
117 | responseDeserialize: Deserialize<OutputResponseType>;
|
118 | originalName?: string;
|
119 | requestType: MessageTypeDefinition;
|
120 | responseType: MessageTypeDefinition;
|
121 | options: MethodOptions;
|
122 | }
|
123 | export interface ServiceDefinition {
|
124 | [index: string]: MethodDefinition<object, object>;
|
125 | }
|
126 | export declare type AnyDefinition = ServiceDefinition | MessageTypeDefinition | EnumTypeDefinition;
|
127 | export interface PackageDefinition {
|
128 | [index: string]: AnyDefinition;
|
129 | }
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 | export declare function load(filename: string | string[], options?: Options): Promise<PackageDefinition>;
|
157 | export declare function loadSync(filename: string | string[], options?: Options): PackageDefinition;
|
158 | export declare function fromJSON(json: Protobuf.INamespace, options?: Options): PackageDefinition;
|
159 | export declare function loadFileDescriptorSetFromBuffer(descriptorSet: Buffer, options?: Options): PackageDefinition;
|
160 | export declare function loadFileDescriptorSetFromObject(descriptorSet: Parameters<typeof descriptor.FileDescriptorSet.fromObject>[0], options?: Options): PackageDefinition;
|