Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / legacy-libs / @grpc / proto-loader / build / src / index.d.ts
1 /// <reference types="node" />
2 /**
3  * @license
4  * Copyright 2018 gRPC authors.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19 import * as Protobuf from 'protobufjs';
20 import * as descriptor from 'protobufjs/ext/descriptor';
21 declare module 'protobufjs' {
22     interface Type {
23         toDescriptor(protoVersion: string): Protobuf.Message<descriptor.IDescriptorProto> & descriptor.IDescriptorProto;
24     }
25     interface Root {
26         toDescriptor(protoVersion: string): Protobuf.Message<descriptor.IFileDescriptorSet> & descriptor.IFileDescriptorSet;
27     }
28     interface Enum {
29         toDescriptor(protoVersion: string): Protobuf.Message<descriptor.IEnumDescriptorProto> & descriptor.IEnumDescriptorProto;
30     }
31 }
32 export interface Serialize<T> {
33     (value: T): Buffer;
34 }
35 export interface Deserialize<T> {
36     (bytes: Buffer): T;
37 }
38 export interface ProtobufTypeDefinition {
39     format: string;
40     type: object;
41     fileDescriptorProtos: Buffer[];
42 }
43 export interface MessageTypeDefinition extends ProtobufTypeDefinition {
44     format: 'Protocol Buffer 3 DescriptorProto';
45 }
46 export interface EnumTypeDefinition extends ProtobufTypeDefinition {
47     format: 'Protocol Buffer 3 EnumDescriptorProto';
48 }
49 export interface MethodDefinition<RequestType, ResponseType> {
50     path: string;
51     requestStream: boolean;
52     responseStream: boolean;
53     requestSerialize: Serialize<RequestType>;
54     responseSerialize: Serialize<ResponseType>;
55     requestDeserialize: Deserialize<RequestType>;
56     responseDeserialize: Deserialize<ResponseType>;
57     originalName?: string;
58     requestType: MessageTypeDefinition;
59     responseType: MessageTypeDefinition;
60 }
61 export interface ServiceDefinition {
62     [index: string]: MethodDefinition<object, object>;
63 }
64 export declare type AnyDefinition = ServiceDefinition | MessageTypeDefinition | EnumTypeDefinition;
65 export interface PackageDefinition {
66     [index: string]: AnyDefinition;
67 }
68 export declare type Options = Protobuf.IParseOptions & Protobuf.IConversionOptions & {
69     includeDirs?: string[];
70 };
71 /**
72  * Load a .proto file with the specified options.
73  * @param filename The file path to load. Can be an absolute path or relative to
74  *     an include path.
75  * @param options.keepCase Preserve field names. The default is to change them
76  *     to camel case.
77  * @param options.longs The type that should be used to represent `long` values.
78  *     Valid options are `Number` and `String`. Defaults to a `Long` object type
79  *     from a library.
80  * @param options.enums The type that should be used to represent `enum` values.
81  *     The only valid option is `String`. Defaults to the numeric value.
82  * @param options.bytes The type that should be used to represent `bytes`
83  *     values. Valid options are `Array` and `String`. The default is to use
84  *     `Buffer`.
85  * @param options.defaults Set default values on output objects. Defaults to
86  *     `false`.
87  * @param options.arrays Set empty arrays for missing array values even if
88  *     `defaults` is `false`. Defaults to `false`.
89  * @param options.objects Set empty objects for missing object values even if
90  *     `defaults` is `false`. Defaults to `false`.
91  * @param options.oneofs Set virtual oneof properties to the present field's
92  *     name
93  * @param options.includeDirs Paths to search for imported `.proto` files.
94  */
95 export declare function load(filename: string, options?: Options): Promise<PackageDefinition>;
96 export declare function loadSync(filename: string, options?: Options): PackageDefinition;