1 | import { LoggerService } from '@nestjs/common/services/logger.service';
|
2 | import { Observable, ObservedValueOf, Subscription } from 'rxjs';
|
3 | import { BaseRpcContext } from '../ctx-host/base-rpc.context';
|
4 | import { ClientOptions, MessageHandler, MicroserviceOptions, MsPattern, ReadPacket, WritePacket } from '../interfaces';
|
5 | import { ConsumerDeserializer } from '../interfaces/deserializer.interface';
|
6 | import { ConsumerSerializer } from '../interfaces/serializer.interface';
|
7 |
|
8 |
|
9 |
|
10 | export declare abstract class Server {
|
11 | protected readonly messageHandlers: Map<string, MessageHandler<any, any, any>>;
|
12 | protected readonly logger: LoggerService;
|
13 | protected serializer: ConsumerSerializer;
|
14 | protected deserializer: ConsumerDeserializer;
|
15 | addHandler(pattern: any, callback: MessageHandler, isEventHandler?: boolean, extras?: Record<string, any>): void;
|
16 | getHandlers(): Map<string, MessageHandler>;
|
17 | getHandlerByPattern(pattern: string): MessageHandler | null;
|
18 | send(stream$: Observable<any>, respond: (data: WritePacket) => unknown | Promise<unknown>): Subscription;
|
19 | handleEvent(pattern: string, packet: ReadPacket, context: BaseRpcContext): Promise<any>;
|
20 | transformToObservable<T>(resultOrDeferred: Observable<T> | Promise<T>): Observable<T>;
|
21 | transformToObservable<T>(resultOrDeferred: T): never extends Observable<ObservedValueOf<T>> ? Observable<T> : Observable<ObservedValueOf<T>>;
|
22 | getOptionsProp<T extends MicroserviceOptions['options'], K extends keyof T>(obj: T, prop: K, defaultValue?: T[K]): T[K];
|
23 | protected handleError(error: string): void;
|
24 | protected loadPackage<T = any>(name: string, ctx: string, loader?: Function): T;
|
25 | protected initializeSerializer(options: ClientOptions['options']): void;
|
26 | protected initializeDeserializer(options: ClientOptions['options']): void;
|
27 | |
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | protected getRouteFromPattern(pattern: string): string;
|
34 | protected normalizePattern(pattern: MsPattern): string;
|
35 | }
|