UNPKG

@nestjs/microservices

Version:

Microservices for NestJS: message and event handlers over Kafka, RabbitMQ, NATS, Redis, MQTT, gRPC or TCP.

47 lines (46 loc) • 2.26 kB
import { Observable } from 'rxjs'; import { ClientGrpc, GrpcOptions } from '../interfaces/index.js'; import { ClientProxy } from './client-proxy.js'; import { Logger } from '@nestjs/common'; type GrpcClient = any; /** * @publicApi */ export declare class ClientGrpcProxy extends ClientProxy<never, never> implements ClientGrpc { protected readonly options: Required<GrpcOptions>['options']; protected readonly logger: Logger; protected readonly clients: Map<string, any>; protected readonly url: string; protected grpcClients: GrpcClient[]; get status(): never; constructor(options: Required<GrpcOptions>['options']); getService<T extends object>(name: string): T; getClientByServiceName<T = unknown>(name: string): T; createClientByServiceName(name: string): any; getKeepaliveOptions(): {}; createServiceMethod(client: any, methodName: string): (...args: unknown[]) => Observable<unknown>; createStreamServiceMethod(client: unknown, methodName: string): (...args: any[]) => Observable<any>; createUnaryServiceMethod(client: any, methodName: string): (...args: any[]) => Observable<any>; /** * Runs the dispatch hook for a call - gRPC calls do not go through `send()` * or `emit()` - once per subscription, in the subscriber's context. * * Returns the arguments to make the call with: the caller's, with the * metadata the hook attached added to the call's `Metadata` under every key * the caller did not set. A `Metadata` the caller passed is cloned rather * than changed, as it may be reused for other calls. */ protected applyDispatchHook(client: any, methodName: string, args: any[]): any[]; createClients(): any[]; loadProto(): any; lookupPackage(root: any, packageName: string): any; close(): void; connect(): Promise<any>; send<TResult = any, TInput = any>(pattern: any, data: TInput): Observable<TResult>; protected getClient(name: string): any; protected publish(packet: any, callback: (packet: any) => any): any; protected dispatchEvent(packet: any): Promise<any>; on<EventKey extends never = never, EventCallback = any>(event: EventKey, callback: EventCallback): void; unwrap<T>(): T; } export {};