1 |
|
2 | import { ChannelCredentials } from './channel-credentials';
|
3 | import { ChannelOptions } from './channel-options';
|
4 | import { Client } from './client';
|
5 | import { UntypedServiceImplementation } from './server';
|
6 | export interface Serialize<T> {
|
7 | (value: T): Buffer;
|
8 | }
|
9 | export interface Deserialize<T> {
|
10 | (bytes: Buffer): T;
|
11 | }
|
12 | export interface ClientMethodDefinition<RequestType, ResponseType> {
|
13 | path: string;
|
14 | requestStream: boolean;
|
15 | responseStream: boolean;
|
16 | requestSerialize: Serialize<RequestType>;
|
17 | responseDeserialize: Deserialize<ResponseType>;
|
18 | originalName?: string;
|
19 | }
|
20 | export interface ServerMethodDefinition<RequestType, ResponseType> {
|
21 | path: string;
|
22 | requestStream: boolean;
|
23 | responseStream: boolean;
|
24 | responseSerialize: Serialize<ResponseType>;
|
25 | requestDeserialize: Deserialize<RequestType>;
|
26 | originalName?: string;
|
27 | }
|
28 | export interface MethodDefinition<RequestType, ResponseType> extends ClientMethodDefinition<RequestType, ResponseType>, ServerMethodDefinition<RequestType, ResponseType> {
|
29 | }
|
30 | export type ServiceDefinition<ImplementationType = UntypedServiceImplementation> = {
|
31 | readonly [index in keyof ImplementationType]: MethodDefinition<any, any>;
|
32 | };
|
33 | export interface ProtobufTypeDefinition {
|
34 | format: string;
|
35 | type: object;
|
36 | fileDescriptorProtos: Buffer[];
|
37 | }
|
38 | export interface PackageDefinition {
|
39 | [index: string]: ServiceDefinition | ProtobufTypeDefinition;
|
40 | }
|
41 | export interface ServiceClient extends Client {
|
42 | [methodName: string]: Function;
|
43 | }
|
44 | export interface ServiceClientConstructor {
|
45 | new (address: string, credentials: ChannelCredentials, options?: Partial<ChannelOptions>): ServiceClient;
|
46 | service: ServiceDefinition;
|
47 | serviceName: string;
|
48 | }
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 | export declare function makeClientConstructor(methods: ServiceDefinition, serviceName: string, classOptions?: {}): ServiceClientConstructor;
|
64 | export interface GrpcObject {
|
65 | [index: string]: GrpcObject | ServiceClientConstructor | ProtobufTypeDefinition;
|
66 | }
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 | export declare function loadPackageDefinition(packageDef: PackageDefinition): GrpcObject;
|