@autofleet/rabbit 4.0.0-beta.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +24 -17
- package/dist/index.js +303 -180
- package/dist/index.js.map +1 -0
- package/dist/lib/celery.js +1 -0
- package/dist/lib/celery.js.map +1 -0
- package/dist/lib/consts.d.ts +0 -2
- package/dist/lib/consts.js +2 -3
- package/dist/lib/consts.js.map +1 -0
- package/dist/lib/rabbitError.js +1 -0
- package/dist/lib/rabbitError.js.map +1 -0
- package/dist/lib/redis.js +1 -0
- package/dist/lib/redis.js.map +1 -0
- package/dist/lib/types.d.ts +8 -0
- package/dist/lib/types.js +1 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utils.js +1 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/logger.js +1 -0
- package/dist/logger.js.map +1 -0
- package/dist/{mock.d.ts → mock/index.d.ts} +1 -1
- package/dist/{mock.js → mock/index.js} +2 -1
- package/dist/mock/index.js.map +1 -0
- package/dist/mock/vitest.d.ts +13 -0
- package/dist/mock/vitest.js +18 -0
- package/dist/mock/vitest.js.map +1 -0
- package/package.json +22 -16
- package/src/index.ts +359 -203
- package/src/lib/consts.ts +0 -2
- package/src/lib/types.ts +10 -0
- package/src/{mock.ts → mock/index.ts} +2 -2
- package/src/mock/vitest.ts +24 -0
- package/tsconfig.build.json +5 -0
- package/tsconfig.json +2 -2
- package/vitest.config.ts +17 -0
- package/coverage/clover.xml +0 -669
- package/coverage/coverage-final.json +0 -9
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -131
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/src/index.html +0 -131
- package/coverage/lcov-report/src/index.ts.html +0 -3826
- package/coverage/lcov-report/src/lib/celery.ts.html +0 -352
- package/coverage/lcov-report/src/lib/consts.ts.html +0 -142
- package/coverage/lcov-report/src/lib/index.html +0 -191
- package/coverage/lcov-report/src/lib/rabbitError.ts.html +0 -103
- package/coverage/lcov-report/src/lib/redis.ts.html +0 -133
- package/coverage/lcov-report/src/lib/types.ts.html +0 -268
- package/coverage/lcov-report/src/lib/utils.ts.html +0 -142
- package/coverage/lcov-report/src/logger.ts.html +0 -100
- package/coverage/lcov.info +0 -1076
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { EventEmitter } from 'events';
|
|
|
3
3
|
import { AmqpConnectionManager, ChannelWrapper, CreateChannelOpts } from 'amqp-connection-manager';
|
|
4
4
|
import { ConfirmChannel, ConsumeMessage, Options, Replies } from 'amqplib';
|
|
5
5
|
import { RedisConfig } from './lib/redis';
|
|
6
|
-
import { CallbackFunction, ConsumeMessageOrNull, ConsumeOptions, CustomMessageHeaders, QueuesCache, RedisLockType, ExchangesCache, QueueSetupPromisesDictionary, AssertExchangePromisesDictionary } from './lib/types';
|
|
6
|
+
import { CallbackFunction, ConsumeMessageOrNull, ConsumeOptions, CustomMessageHeaders, QueuesCache, RedisLockType, ExchangesCache, QueueSetupPromisesDictionary, AssertExchangePromisesDictionary, ConnectionData } from './lib/types';
|
|
7
7
|
export interface IAfRabbitMq {
|
|
8
8
|
ack: any;
|
|
9
9
|
nack: any;
|
|
@@ -38,10 +38,12 @@ type newChannelOpts = {
|
|
|
38
38
|
name?: string;
|
|
39
39
|
onClose?: null | ((args: any | null) => void);
|
|
40
40
|
options?: CreateChannelOpts | undefined;
|
|
41
|
+
connection: ConnectionData;
|
|
41
42
|
};
|
|
42
43
|
type assertChannelOpts = {
|
|
43
44
|
channelName?: string;
|
|
44
45
|
force?: boolean;
|
|
46
|
+
connection: ConnectionData;
|
|
45
47
|
};
|
|
46
48
|
declare class RabbitMq implements IAfRabbitMq {
|
|
47
49
|
static parseMsg(msg: any): any;
|
|
@@ -58,27 +60,30 @@ declare class RabbitMq implements IAfRabbitMq {
|
|
|
58
60
|
};
|
|
59
61
|
DISCONNECT_MSG: string;
|
|
60
62
|
RECONNECT_MSG: string;
|
|
61
|
-
|
|
63
|
+
publishChannel: ChannelWrapper | null;
|
|
62
64
|
publishChannelSetupPromise: Promise<ChannelWrapper> | null;
|
|
63
65
|
blockReconnect: boolean | null | undefined;
|
|
64
|
-
|
|
66
|
+
publishConnection: ConnectionData;
|
|
67
|
+
consumeConnection: ConnectionData;
|
|
65
68
|
em: EventEmitter;
|
|
66
69
|
creatingConnection: boolean;
|
|
67
70
|
exchanges: ExchangesCache;
|
|
68
71
|
queues: QueuesCache;
|
|
69
72
|
queueSetupPromises: QueueSetupPromisesDictionary;
|
|
70
73
|
assertExchangePromises: AssertExchangePromisesDictionary;
|
|
71
|
-
options: AfRabbitOptions
|
|
74
|
+
options: AfRabbitOptions;
|
|
72
75
|
redisClient: any;
|
|
73
76
|
redisLock?: RedisLockType;
|
|
74
77
|
/** Array of consumers tags used for canceling consumption */
|
|
75
78
|
consumersTags: Array<[ConfirmChannel, string]>;
|
|
76
79
|
private consumers;
|
|
77
|
-
private
|
|
78
|
-
|
|
80
|
+
private doesVHostExist;
|
|
81
|
+
private vhost;
|
|
82
|
+
oldPublishChannel: ChannelWrapper | null;
|
|
79
83
|
oldPublishChannelSetupPromise: Promise<ChannelWrapper> | null;
|
|
80
84
|
oldBlockReconnect: boolean | null | undefined;
|
|
81
|
-
|
|
85
|
+
oldPublishConnection: ConnectionData;
|
|
86
|
+
oldConsumeConnection: ConnectionData;
|
|
82
87
|
oldEm: EventEmitter;
|
|
83
88
|
oldCreatingConnection: boolean;
|
|
84
89
|
oldExchanges: ExchangesCache;
|
|
@@ -92,10 +97,10 @@ declare class RabbitMq implements IAfRabbitMq {
|
|
|
92
97
|
private shouldConsumeMessageByTimestamp;
|
|
93
98
|
ack: (channel: ConfirmChannel, msg: ConsumeMessageOrNull, shouldUpdateRedisTimestamp?: boolean, releaseLock?: null) => (userMsg: ConsumeMessage) => Promise<any>;
|
|
94
99
|
nack: (channel: ConfirmChannel, queue: string, options: any, deadQueueOptions: Options.AssertQueue, msg: ConsumeMessageOrNull, releaseLock: any) => (userMsg: ConsumeMessageOrNull, { skipRetry, }?: NackOptions) => Promise<any>;
|
|
95
|
-
getConnection(): Promise<AmqpConnectionManager>;
|
|
96
|
-
getNewChannel({ name, onClose, options }
|
|
97
|
-
assertChannel({ force }
|
|
98
|
-
assertExchange(exchangeName: string,
|
|
100
|
+
getConnection(connection: ConnectionData): Promise<AmqpConnectionManager>;
|
|
101
|
+
getNewChannel({ name, onClose, options, connection, }: newChannelOpts): Promise<import("amqp-connection-manager/dist/types/ChannelWrapper").default>;
|
|
102
|
+
assertChannel({ force, connection }: assertChannelOpts): Promise<ChannelWrapper>;
|
|
103
|
+
assertExchange(exchangeName: string, connection: ConnectionData): Promise<any>;
|
|
99
104
|
getQueueLength(queue: string): Promise<Replies.AssertQueue>;
|
|
100
105
|
private deleteQueue;
|
|
101
106
|
bindQueue(queue: string, exchange: string): Promise<void>;
|
|
@@ -110,19 +115,21 @@ declare class RabbitMq implements IAfRabbitMq {
|
|
|
110
115
|
private unlockRedisIfNeeded;
|
|
111
116
|
private consumeFromRabbit;
|
|
112
117
|
consumeFromExchange(queue: string, exchange: string, callback: CallbackFunction, options?: ConsumeOptions): Promise<any>;
|
|
113
|
-
publish(exchange: string, content: any, customHeaders?: any): Promise<boolean>;
|
|
114
|
-
sendToQueue(queue: string, content: any, options?: any, customHeaders?: any): Promise<boolean | undefined>;
|
|
118
|
+
publish(exchange: string, content: any, customHeaders?: any, isQuorumQueue?: boolean): Promise<boolean>;
|
|
119
|
+
sendToQueue(queue: string, content: any, options?: any, customHeaders?: any, isQuorumQueue?: boolean): Promise<boolean | undefined>;
|
|
115
120
|
isConnected(): Promise<boolean>;
|
|
116
121
|
gracefulShutdown(signal: string): Promise<void>;
|
|
117
122
|
private consumeFromRabbitOld;
|
|
118
|
-
getNewChannelOld({ name, onClose, options }
|
|
119
|
-
getConnectionOld(): Promise<AmqpConnectionManager>;
|
|
123
|
+
getNewChannelOld({ name, onClose, options, connection, }: newChannelOpts): Promise<import("amqp-connection-manager/dist/types/ChannelWrapper").default>;
|
|
124
|
+
getConnectionOld(connection: ConnectionData): Promise<AmqpConnectionManager>;
|
|
120
125
|
private saveConsumerOld;
|
|
121
126
|
assertQueueOld(queueName: string, options?: Options.AssertQueue): Promise<any>;
|
|
122
127
|
setupQueueOld(queueName: string, options?: Options.AssertQueue): Promise<Replies.AssertQueue>;
|
|
123
|
-
assertChannelOld({ force }
|
|
128
|
+
assertChannelOld({ force, connection }: assertChannelOpts): Promise<ChannelWrapper>;
|
|
124
129
|
private deleteQueueOld;
|
|
125
|
-
assertExchangeOld(exchangeName: string,
|
|
130
|
+
assertExchangeOld(exchangeName: string, connection: ConnectionData): Promise<any>;
|
|
131
|
+
isConnectedOld(): Promise<boolean>;
|
|
132
|
+
private maskURL;
|
|
126
133
|
}
|
|
127
134
|
export default RabbitMq;
|
|
128
135
|
export { sendCeleryTaskViaHttp, } from './lib/celery';
|