@autofleet/rabbit 3.2.22-beta.3 → 3.2.22-beta.4

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 CHANGED
@@ -42,7 +42,7 @@ type newChannelOpts = {
42
42
  type assertChannelOpts = {
43
43
  channelName?: string;
44
44
  force?: boolean;
45
- connectionPurpose: ConnectionPurpose;
45
+ connectionPurpose?: ConnectionPurpose;
46
46
  };
47
47
  declare class RabbitMq implements IAfRabbitMq {
48
48
  static parseMsg(msg: any): any;
package/dist/index.js CHANGED
@@ -508,6 +508,9 @@ class RabbitMq {
508
508
  async isConnected() {
509
509
  const isEachConnectionConnected = await Promise.all(Object.entries(this.connectionsMap).map(async ([connectionPurpose, connectionData]) => {
510
510
  const { connection } = connectionData;
511
+ if (connectionPurpose === types_1.ConnectionPurpose.Publish && !connection) {
512
+ return true; // The connection hasn't been initialized yet, as no messages have been sent through it
513
+ }
511
514
  const isConnected = connection?.isConnected();
512
515
  if (!isConnected) {
513
516
  logger_1.default.error('rabbit: isConnected - false');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/rabbit",
3
- "version": "3.2.22-beta.3",
3
+ "version": "3.2.22-beta.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -89,7 +89,7 @@ type newChannelOpts = {
89
89
  type assertChannelOpts = {
90
90
  channelName?: string;
91
91
  force?: boolean;
92
- connectionPurpose: ConnectionPurpose;
92
+ connectionPurpose?: ConnectionPurpose;
93
93
  }
94
94
 
95
95
  type AfConsumer = {
@@ -699,6 +699,9 @@ class RabbitMq implements IAfRabbitMq {
699
699
  const isEachConnectionConnected = await Promise.all(
700
700
  Object.entries(this.connectionsMap).map(async ([connectionPurpose, connectionData]) => {
701
701
  const { connection } = connectionData;
702
+ if (connectionPurpose === ConnectionPurpose.Publish && !connection) {
703
+ return true; // The connection hasn't been initialized yet, as no messages have been sent through it
704
+ }
702
705
  const isConnected = connection?.isConnected();
703
706
  if (!isConnected) {
704
707
  logger.error('rabbit: isConnected - false');