import { GrpcMethodStreamingType } from '../decorators';
import { CustomTransportStrategy, MessageHandler } from '../interfaces';
import { GrpcOptions } from '../interfaces/microservice-configuration.interface';
import { Server } from './server';
interface GrpcCall<TRequest = any, TMetadata = any> {
request: TRequest;
metadata: TMetadata;
end: Function;
write: Function;
on: Function;
emit: Function;
}
export declare class ServerGrpc extends Server implements CustomTransportStrategy {
private readonly options;
private readonly url;
private grpcClient;
constructor(options: GrpcOptions['options']);
getTransport(): number;
listen(callback: () => void): Promise<void>;
start(callback?: () => void): Promise<void>;
bindEvents(): Promise<void>;
/**
* Will return all of the services along with their fully namespaced
* names as an array of objects.
* This method initiates recursive scan of grpcPkg object
*/
getServiceNames(grpcPkg: any): {
name: string;
service: any;
}[];
/**
* Will create service mapping from gRPC generated Object to handlers
* defined with @GrpcMethod or @GrpcStreamMethod annotations
*
* @param grpcService
* @param name
*/
createService(grpcService: any, name: string): Promise<{}>;
/**
* Will create a string of a JSON serialized format
*
* @param service name of the service which should be a match to gRPC service definition name
* @param methodName name of the method which is coming after rpc keyword
* @param streaming GrpcMethodStreamingType parameter which should correspond to
* stream keyword in gRPC service request part
*/
createPattern(service: string, methodName: string, streaming: GrpcMethodStreamingType): string;
/**
* Will return async function which will handle gRPC call
* with Rx streams or as a direct call passthrough
*
* @param methodHandler
* @param protoNativeHandler
*/
createServiceMethod(methodHandler: Function, protoNativeHandler: any, streamType: GrpcMethodStreamingType): Function;
createUnaryServiceMethod(methodHandler: Function): Function;
createStreamServiceMethod(methodHandler: Function): Function;
createRequestStreamMethod(methodHandler: Function, isResponseStream: boolean): (call: GrpcCall<any, any>, callback: (err: unknown, value: unknown) => void) => Promise<void>;
createStreamCallMethod(methodHandler: Function, isResponseStream: boolean): (call: GrpcCall<any, any>, callback: (err: unknown, value: unknown) => void) => Promise<void>;
close(): void;
deserialize(obj: any): any;
addHandler(pattern: any, callback: MessageHandler, isEventHandler?: boolean): void;
createClient(): any;
lookupPackage(root: any, packageName: string): any;
loadProto(): any;
/**
* Recursively fetch all of the service methods available on loaded
* protobuf descriptor object, and collect those as an objects with
* dot-syntax full-path names.
*
* Example:
* for proto package Bundle.FirstService with service Events { rpc...
* will be resolved to object of (while loaded for Bundle package):
* {
* name: "FirstService.Events",
* service: {Object}
* }
*/
private collectDeepServices;
private parseDeepServiceName;
private createServices;
}
export {};