1 | import { Transport } from '../enums/transport.enum';
|
2 | import { ChannelOptions } from '../external/grpc-options.interface';
|
3 | import { ConsumerConfig, ConsumerRunConfig, ConsumerSubscribeTopic, KafkaConfig, ProducerConfig, ProducerRecord } from '../external/kafka.interface';
|
4 | import { MqttClientOptions } from '../external/mqtt-options.interface';
|
5 | import { ClientOpts } from '../external/redis.interface';
|
6 | import { RmqUrl } from '../external/rmq-url.interface';
|
7 | import { CustomTransportStrategy } from './custom-transport-strategy.interface';
|
8 | import { Deserializer } from './deserializer.interface';
|
9 | import { Serializer } from './serializer.interface';
|
10 | export declare type MicroserviceOptions = GrpcOptions | TcpOptions | RedisOptions | NatsOptions | MqttOptions | RmqOptions | KafkaOptions | CustomStrategy;
|
11 | export interface CustomStrategy {
|
12 | strategy: CustomTransportStrategy;
|
13 | options?: {};
|
14 | }
|
15 | export interface GrpcOptions {
|
16 | transport?: Transport.GRPC;
|
17 | options: {
|
18 | url?: string;
|
19 | maxSendMessageLength?: number;
|
20 | maxReceiveMessageLength?: number;
|
21 | maxMetadataSize?: number;
|
22 | keepalive?: {
|
23 | keepaliveTimeMs?: number;
|
24 | keepaliveTimeoutMs?: number;
|
25 | keepalivePermitWithoutCalls?: number;
|
26 | http2MaxPingsWithoutData?: number;
|
27 | http2MinTimeBetweenPingsMs?: number;
|
28 | http2MinPingIntervalWithoutDataMs?: number;
|
29 | http2MaxPingStrikes?: number;
|
30 | };
|
31 | channelOptions?: ChannelOptions;
|
32 | credentials?: any;
|
33 | protoPath: string | string[];
|
34 | package: string | string[];
|
35 | protoLoader?: string;
|
36 | loader?: {
|
37 | keepCase?: boolean;
|
38 | alternateCommentMode?: boolean;
|
39 | longs?: Function;
|
40 | enums?: Function;
|
41 | bytes?: Function;
|
42 | defaults?: boolean;
|
43 | arrays?: boolean;
|
44 | objects?: boolean;
|
45 | oneofs?: boolean;
|
46 | json?: boolean;
|
47 | includeDirs?: string[];
|
48 | };
|
49 | };
|
50 | }
|
51 | export interface TcpOptions {
|
52 | transport?: Transport.TCP;
|
53 | options?: {
|
54 | host?: string;
|
55 | port?: number;
|
56 | retryAttempts?: number;
|
57 | retryDelay?: number;
|
58 | serializer?: Serializer;
|
59 | deserializer?: Deserializer;
|
60 | };
|
61 | }
|
62 | export interface RedisOptions {
|
63 | transport?: Transport.REDIS;
|
64 | options?: {
|
65 | url?: string;
|
66 | retryAttempts?: number;
|
67 | retryDelay?: number;
|
68 | serializer?: Serializer;
|
69 | deserializer?: Deserializer;
|
70 | } & ClientOpts;
|
71 | }
|
72 | export interface MqttOptions {
|
73 | transport?: Transport.MQTT;
|
74 | options?: MqttClientOptions & {
|
75 | url?: string;
|
76 | serializer?: Serializer;
|
77 | deserializer?: Deserializer;
|
78 | };
|
79 | }
|
80 | export interface NatsOptions {
|
81 | transport?: Transport.NATS;
|
82 | options?: {
|
83 | authenticator?: any;
|
84 | debug?: boolean;
|
85 | ignoreClusterUpdates?: boolean;
|
86 | inboxPrefix?: string;
|
87 | encoding?: string;
|
88 | name?: string;
|
89 | user?: string;
|
90 | pass?: string;
|
91 | maxPingOut?: number;
|
92 | maxReconnectAttempts?: number;
|
93 | reconnectTimeWait?: number;
|
94 | reconnectJitter?: number;
|
95 | reconnectJitterTLS?: number;
|
96 | reconnectDelayHandler?: any;
|
97 | servers?: string[] | string;
|
98 | nkey?: any;
|
99 | reconnect?: boolean;
|
100 | pedantic?: boolean;
|
101 | tls?: any;
|
102 | queue?: string;
|
103 | serializer?: Serializer;
|
104 | deserializer?: Deserializer;
|
105 | userJWT?: string;
|
106 | nonceSigner?: any;
|
107 | userCreds?: any;
|
108 | useOldRequestStyle?: boolean;
|
109 | pingInterval?: number;
|
110 | preserveBuffers?: boolean;
|
111 | waitOnFirstConnect?: boolean;
|
112 | verbose?: boolean;
|
113 | noEcho?: boolean;
|
114 | noRandomize?: boolean;
|
115 | timeout?: number;
|
116 | token?: string;
|
117 | yieldTime?: number;
|
118 | tokenHandler?: any;
|
119 | [key: string]: any;
|
120 | };
|
121 | }
|
122 | export interface RmqOptions {
|
123 | transport?: Transport.RMQ;
|
124 | options?: {
|
125 | urls?: string[] | RmqUrl[];
|
126 | queue?: string;
|
127 | prefetchCount?: number;
|
128 | isGlobalPrefetchCount?: boolean;
|
129 | queueOptions?: any;
|
130 | socketOptions?: any;
|
131 | noAck?: boolean;
|
132 | serializer?: Serializer;
|
133 | deserializer?: Deserializer;
|
134 | replyQueue?: string;
|
135 | persistent?: boolean;
|
136 | };
|
137 | }
|
138 | export interface KafkaParserConfig {
|
139 | keepBinary?: boolean;
|
140 | }
|
141 | export interface KafkaOptions {
|
142 | transport?: Transport.KAFKA;
|
143 | options?: {
|
144 | postfixId?: string;
|
145 | client?: KafkaConfig;
|
146 | consumer?: ConsumerConfig;
|
147 | run?: Omit<ConsumerRunConfig, 'eachBatch' | 'eachMessage'>;
|
148 | subscribe?: Omit<ConsumerSubscribeTopic, 'topic'>;
|
149 | producer?: ProducerConfig;
|
150 | send?: Omit<ProducerRecord, 'topic' | 'messages'>;
|
151 | serializer?: Serializer;
|
152 | deserializer?: Deserializer;
|
153 | parser?: KafkaParserConfig;
|
154 | };
|
155 | }
|