UNPKG

1.61 kBTypeScriptView Raw
1import { Observable, Observer } from 'rxjs';
2import { ClientOptions, MsPattern, PacketId, ReadPacket, WritePacket } from '../interfaces';
3import { ProducerDeserializer } from '../interfaces/deserializer.interface';
4import { ProducerSerializer } from '../interfaces/serializer.interface';
5export declare abstract class ClientProxy {
6 abstract connect(): Promise<any>;
7 abstract close(): any;
8 protected routingMap: Map<string, Function>;
9 protected serializer: ProducerSerializer;
10 protected deserializer: ProducerDeserializer;
11 send<TResult = any, TInput = any>(pattern: any, data: TInput): Observable<TResult>;
12 emit<TResult = any, TInput = any>(pattern: any, data: TInput): Observable<TResult>;
13 protected abstract publish(packet: ReadPacket, callback: (packet: WritePacket) => void): () => void;
14 protected abstract dispatchEvent<T = any>(packet: ReadPacket): Promise<T>;
15 protected createObserver<T>(observer: Observer<T>): (packet: WritePacket) => void;
16 protected serializeError(err: any): any;
17 protected serializeResponse(response: any): any;
18 protected assignPacketId(packet: ReadPacket): ReadPacket & PacketId;
19 protected connect$(instance: any, errorEvent?: string, connectEvent?: string): Observable<any>;
20 protected getOptionsProp<T extends ClientOptions['options'], K extends keyof T>(obj: T, prop: K, defaultValue?: T[K]): T[K];
21 protected normalizePattern(pattern: MsPattern): string;
22 protected initializeSerializer(options: ClientOptions['options']): void;
23 protected initializeDeserializer(options: ClientOptions['options']): void;
24}