1 | import { GrpcMethodStreamingType } from '../decorators';
|
2 | import { Transport } from '../enums';
|
3 | import { CustomTransportStrategy, MessageHandler } from '../interfaces';
|
4 | import { GrpcOptions } from '../interfaces/microservice-configuration.interface';
|
5 | import { Server } from './server';
|
6 | interface GrpcCall<TRequest = any, TMetadata = any> {
|
7 | request: TRequest;
|
8 | metadata: TMetadata;
|
9 | sendMetadata: Function;
|
10 | end: Function;
|
11 | write: Function;
|
12 | on: Function;
|
13 | emit: Function;
|
14 | }
|
15 | export declare class ServerGrpc extends Server implements CustomTransportStrategy {
|
16 | private readonly options;
|
17 | readonly transportId = Transport.GRPC;
|
18 | private readonly url;
|
19 | private grpcClient;
|
20 | constructor(options: GrpcOptions['options']);
|
21 | listen(callback: (err?: unknown, ...optionalParams: unknown[]) => void): Promise<void>;
|
22 | start(callback?: () => void): Promise<void>;
|
23 | bindEvents(): Promise<void>;
|
24 | /**
|
25 | * Will return all of the services along with their fully namespaced
|
26 | * names as an array of objects.
|
27 | * This method initiates recursive scan of grpcPkg object
|
28 | */
|
29 | getServiceNames(grpcPkg: any): {
|
30 | name: string;
|
31 | service: any;
|
32 | }[];
|
33 | |
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | createService(grpcService: any, name: string): Promise<{}>;
|
41 | |
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | createPattern(service: string, methodName: string, streaming: GrpcMethodStreamingType): string;
|
50 | |
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | createServiceMethod(methodHandler: Function, protoNativeHandler: any, streamType: GrpcMethodStreamingType): Function;
|
58 | createUnaryServiceMethod(methodHandler: Function): Function;
|
59 | createStreamServiceMethod(methodHandler: Function): Function;
|
60 | createRequestStreamMethod(methodHandler: Function, isResponseStream: boolean): (call: GrpcCall, callback: (err: unknown, value: unknown) => void) => Promise<void>;
|
61 | createStreamCallMethod(methodHandler: Function, isResponseStream: boolean): (call: GrpcCall, callback: (err: unknown, value: unknown) => void) => Promise<void>;
|
62 | close(): void;
|
63 | deserialize(obj: any): any;
|
64 | addHandler(pattern: unknown, callback: MessageHandler, isEventHandler?: boolean): void;
|
65 | createClient(): Promise<any>;
|
66 | lookupPackage(root: any, packageName: string): any;
|
67 | loadProto(): any;
|
68 | |
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 | private collectDeepServices;
|
82 | private parseDeepServiceName;
|
83 | private createServices;
|
84 | }
|
85 | export {};
|