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 | off: Function;
|
14 | emit: Function;
|
15 | }
|
16 |
|
17 |
|
18 |
|
19 | export declare class ServerGrpc extends Server implements CustomTransportStrategy {
|
20 | private readonly options;
|
21 | readonly transportId = Transport.GRPC;
|
22 | private readonly url;
|
23 | private grpcClient;
|
24 | constructor(options: GrpcOptions['options']);
|
25 | listen(callback: (err?: unknown, ...optionalParams: unknown[]) => void): Promise<void>;
|
26 | start(callback?: () => void): Promise<void>;
|
27 | bindEvents(): Promise<void>;
|
28 | /**
|
29 | * Will return all of the services along with their fully namespaced
|
30 | * names as an array of objects.
|
31 | * This method initiates recursive scan of grpcPkg object
|
32 | */
|
33 | getServiceNames(grpcPkg: any): {
|
34 | name: string;
|
35 | service: any;
|
36 | }[];
|
37 | |
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 | createService(grpcService: any, name: string): Promise<{}>;
|
45 | getMessageHandler(serviceName: string, methodName: string, streaming: GrpcMethodStreamingType, grpcMethod: {
|
46 | path?: string;
|
47 | }): MessageHandler<any, any, any>;
|
48 | |
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 | createPattern(service: string, methodName: string, streaming: GrpcMethodStreamingType): string;
|
57 | |
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 | createServiceMethod(methodHandler: Function, protoNativeHandler: any, streamType: GrpcMethodStreamingType): Function;
|
66 | createUnaryServiceMethod(methodHandler: Function): Function;
|
67 | createStreamServiceMethod(methodHandler: Function): Function;
|
68 | |
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 | private writeObservableToGrpc;
|
79 | createRequestStreamMethod(methodHandler: Function, isResponseStream: boolean): (call: GrpcCall, callback: (err: unknown, value: unknown) => void) => Promise<void>;
|
80 | createStreamCallMethod(methodHandler: Function, isResponseStream: boolean): (call: GrpcCall, callback: (err: unknown, value: unknown) => void) => Promise<void>;
|
81 | close(): Promise<void>;
|
82 | deserialize(obj: any): any;
|
83 | addHandler(pattern: unknown, callback: MessageHandler, isEventHandler?: boolean): void;
|
84 | createClient(): Promise<any>;
|
85 | lookupPackage(root: any, packageName: string): any;
|
86 | loadProto(): any;
|
87 | |
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 | private collectDeepServices;
|
101 | private parseDeepServiceName;
|
102 | private createServices;
|
103 | private bufferUntilDrained;
|
104 | }
|
105 | export {};
|