@autofleet/rabbit 4.0.2 → 4.1.0-beta.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.
Files changed (57) hide show
  1. package/coverage/clover.xml +669 -0
  2. package/coverage/coverage-final.json +9 -0
  3. package/coverage/lcov-report/base.css +224 -0
  4. package/coverage/lcov-report/block-navigation.js +87 -0
  5. package/coverage/lcov-report/favicon.png +0 -0
  6. package/coverage/lcov-report/index.html +131 -0
  7. package/coverage/lcov-report/prettify.css +1 -0
  8. package/coverage/lcov-report/prettify.js +2 -0
  9. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  10. package/coverage/lcov-report/sorter.js +196 -0
  11. package/coverage/lcov-report/src/index.html +131 -0
  12. package/coverage/lcov-report/src/index.ts.html +3826 -0
  13. package/coverage/lcov-report/src/lib/celery.ts.html +352 -0
  14. package/coverage/lcov-report/src/lib/consts.ts.html +142 -0
  15. package/coverage/lcov-report/src/lib/index.html +191 -0
  16. package/coverage/lcov-report/src/lib/rabbitError.ts.html +103 -0
  17. package/coverage/lcov-report/src/lib/redis.ts.html +133 -0
  18. package/coverage/lcov-report/src/lib/types.ts.html +268 -0
  19. package/coverage/lcov-report/src/lib/utils.ts.html +142 -0
  20. package/coverage/lcov-report/src/logger.ts.html +100 -0
  21. package/coverage/lcov.info +1076 -0
  22. package/dist/index.d.ts +19 -33
  23. package/dist/index.js +217 -341
  24. package/dist/lib/celery.js +0 -1
  25. package/dist/lib/consts.d.ts +2 -10
  26. package/dist/lib/consts.js +3 -12
  27. package/dist/lib/rabbitError.js +0 -1
  28. package/dist/lib/redis.js +0 -1
  29. package/dist/lib/types.d.ts +0 -8
  30. package/dist/lib/types.js +0 -1
  31. package/dist/lib/utils.d.ts +0 -5
  32. package/dist/lib/utils.js +1 -9
  33. package/dist/logger.js +0 -1
  34. package/dist/{mock/index.d.ts → mock.d.ts} +1 -1
  35. package/dist/{mock/index.js → mock.js} +1 -2
  36. package/package.json +16 -23
  37. package/src/index.ts +243 -417
  38. package/src/lib/consts.ts +2 -11
  39. package/src/lib/types.ts +0 -10
  40. package/src/lib/utils.ts +0 -10
  41. package/src/{mock/index.ts → mock.ts} +2 -2
  42. package/tsconfig.json +2 -2
  43. package/dist/index.js.map +0 -1
  44. package/dist/lib/celery.js.map +0 -1
  45. package/dist/lib/consts.js.map +0 -1
  46. package/dist/lib/rabbitError.js.map +0 -1
  47. package/dist/lib/redis.js.map +0 -1
  48. package/dist/lib/types.js.map +0 -1
  49. package/dist/lib/utils.js.map +0 -1
  50. package/dist/logger.js.map +0 -1
  51. package/dist/mock/index.js.map +0 -1
  52. package/dist/mock/vitest.d.ts +0 -13
  53. package/dist/mock/vitest.js +0 -18
  54. package/dist/mock/vitest.js.map +0 -1
  55. package/src/mock/vitest.ts +0 -24
  56. package/tsconfig.build.json +0 -5
  57. package/vitest.config.ts +0 -17
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, ConnectionData } from './lib/types';
6
+ import { CallbackFunction, ConsumeMessageOrNull, ConsumeOptions, CustomMessageHeaders, QueuesCache, RedisLockType, ExchangesCache, QueueSetupPromisesDictionary, AssertExchangePromisesDictionary } from './lib/types';
7
7
  export interface IAfRabbitMq {
8
8
  ack: any;
9
9
  nack: any;
@@ -38,12 +38,10 @@ type newChannelOpts = {
38
38
  name?: string;
39
39
  onClose?: null | ((args: any | null) => void);
40
40
  options?: CreateChannelOpts | undefined;
41
- connection: ConnectionData;
42
41
  };
43
42
  type assertChannelOpts = {
44
43
  channelName?: string;
45
44
  force?: boolean;
46
- connection: ConnectionData;
47
45
  };
48
46
  declare class RabbitMq implements IAfRabbitMq {
49
47
  static parseMsg(msg: any): any;
@@ -60,54 +58,44 @@ declare class RabbitMq implements IAfRabbitMq {
60
58
  };
61
59
  DISCONNECT_MSG: string;
62
60
  RECONNECT_MSG: string;
63
- publishChannel: ChannelWrapper | null;
61
+ channel: ChannelWrapper | null;
64
62
  publishChannelSetupPromise: Promise<ChannelWrapper> | null;
65
63
  blockReconnect: boolean | null | undefined;
66
- publishConnection: ConnectionData;
67
- consumeConnection: ConnectionData;
64
+ connection: AmqpConnectionManager | null | undefined;
68
65
  em: EventEmitter;
69
66
  creatingConnection: boolean;
70
67
  exchanges: ExchangesCache;
71
68
  queues: QueuesCache;
72
69
  queueSetupPromises: QueueSetupPromisesDictionary;
73
70
  assertExchangePromises: AssertExchangePromisesDictionary;
74
- options: AfRabbitOptions;
71
+ options: AfRabbitOptions | undefined;
75
72
  redisClient: any;
76
73
  redisLock?: RedisLockType;
77
74
  /** Array of consumers tags used for canceling consumption */
78
- consumersTags: Map<string, {
79
- channel: ConfirmChannel;
80
- consumerTag: string;
81
- }>;
82
- private consumersToRegister;
83
- private doesVHostExist;
84
- private vhost;
85
- private gracefulShutdownStarted;
86
- oldPublishChannel: ChannelWrapper | null;
75
+ consumersTags: Array<[ConfirmChannel, string]>;
76
+ private consumers;
77
+ private isVHostExist;
78
+ oldChannel: ChannelWrapper | null;
87
79
  oldPublishChannelSetupPromise: Promise<ChannelWrapper> | null;
88
80
  oldBlockReconnect: boolean | null | undefined;
89
- oldPublishConnection: ConnectionData;
90
- oldConsumeConnection: ConnectionData;
81
+ oldConnection: AmqpConnectionManager | null | undefined;
91
82
  oldEm: EventEmitter;
92
83
  oldCreatingConnection: boolean;
93
84
  oldExchanges: ExchangesCache;
94
85
  oldQueues: QueuesCache;
95
86
  oldQueueSetupPromises: QueueSetupPromisesDictionary;
96
87
  oldAssertExchangePromises: AssertExchangePromisesDictionary;
97
- oldConsumersTags: Map<string, {
98
- channel: ConfirmChannel;
99
- consumerTag: string;
100
- }>;
101
- private oldConsumersToRegister;
88
+ oldConsumersTags: Array<[ConfirmChannel, string]>;
89
+ private oldConsumers;
102
90
  constructor(options?: AfRabbitOptions, redisConfig?: RedisConfig);
103
91
  private assertVHost;
104
92
  private shouldConsumeMessageByTimestamp;
105
93
  ack: (channel: ConfirmChannel, msg: ConsumeMessageOrNull, shouldUpdateRedisTimestamp?: boolean, releaseLock?: null) => (userMsg: ConsumeMessage) => Promise<any>;
106
94
  nack: (channel: ConfirmChannel, queue: string, options: any, deadQueueOptions: Options.AssertQueue, msg: ConsumeMessageOrNull, releaseLock: any) => (userMsg: ConsumeMessageOrNull, { skipRetry, }?: NackOptions) => Promise<any>;
107
- getConnection(connection: ConnectionData): Promise<AmqpConnectionManager>;
108
- getNewChannel({ name, onClose, options, connection, }: newChannelOpts): Promise<import("amqp-connection-manager/dist/types/ChannelWrapper").default>;
109
- assertChannel({ force, connection }: assertChannelOpts): Promise<ChannelWrapper>;
110
- assertExchange(exchangeName: string, connection: ConnectionData): Promise<any>;
95
+ getConnection(): Promise<AmqpConnectionManager>;
96
+ getNewChannel({ name, onClose, options }?: newChannelOpts): Promise<ChannelWrapper>;
97
+ assertChannel({ force }?: assertChannelOpts): Promise<ChannelWrapper>;
98
+ assertExchange(exchangeName: string, options?: any): Promise<any>;
111
99
  getQueueLength(queue: string): Promise<Replies.AssertQueue>;
112
100
  private deleteQueue;
113
101
  bindQueue(queue: string, exchange: string): Promise<void>;
@@ -127,16 +115,14 @@ declare class RabbitMq implements IAfRabbitMq {
127
115
  isConnected(): Promise<boolean>;
128
116
  gracefulShutdown(signal: string): Promise<void>;
129
117
  private consumeFromRabbitOld;
130
- getNewChannelOld({ name, onClose, options, connection, }: newChannelOpts): Promise<import("amqp-connection-manager/dist/types/ChannelWrapper").default>;
131
- getConnectionOld(connection: ConnectionData): Promise<AmqpConnectionManager>;
118
+ getNewChannelOld({ name, onClose, options }?: newChannelOpts): Promise<ChannelWrapper>;
119
+ getConnectionOld(): Promise<AmqpConnectionManager>;
132
120
  private saveConsumerOld;
133
121
  assertQueueOld(queueName: string, options?: Options.AssertQueue): Promise<any>;
134
122
  setupQueueOld(queueName: string, options?: Options.AssertQueue): Promise<Replies.AssertQueue>;
135
- assertChannelOld({ force, connection }: assertChannelOpts): Promise<ChannelWrapper>;
123
+ assertChannelOld({ force }?: assertChannelOpts): Promise<ChannelWrapper>;
136
124
  private deleteQueueOld;
137
- assertExchangeOld(exchangeName: string, connection: ConnectionData): Promise<any>;
138
- isConnectedOld(): Promise<boolean>;
139
- private maskURL;
125
+ assertExchangeOld(exchangeName: string, options?: any): Promise<any>;
140
126
  }
141
127
  export default RabbitMq;
142
128
  export { sendCeleryTaskViaHttp, } from './lib/celery';