@xnestjs/rabbitmq 1.6.2 → 1.6.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.
@@ -7,7 +7,7 @@ const node_assert_1 = tslib_1.__importDefault(require("node:assert"));
7
7
  const crypto = tslib_1.__importStar(require("node:crypto"));
8
8
  const common_1 = require("@nestjs/common");
9
9
  const microservices_1 = require("@nestjs/microservices");
10
- const colors = tslib_1.__importStar(require("ansi-colors"));
10
+ const ansi_colors_1 = tslib_1.__importDefault(require("ansi-colors"));
11
11
  const constants_js_1 = require("./constants.js");
12
12
  const get_rabbitmq_config_js_1 = require("./get-rabbitmq-config.js");
13
13
  const CLIENT_TOKEN = Symbol('CLIENT_TOKEN');
@@ -108,14 +108,14 @@ let RabbitmqCoreModule = RabbitmqCoreModule_1 = class RabbitmqCoreModule {
108
108
  }
109
109
  async onApplicationBootstrap() {
110
110
  const options = this.connectionOptions;
111
- if (!options.lazyConnect && options.urls?.length) {
112
- this.logger?.log('Connecting to RabbitMQ at ' + colors.blue(options.urls.join(',')));
113
- common_1.Logger.flush();
114
- await this.client.connect().catch(e => {
115
- this.logger?.error('RabbitMQ connection failed: ' + e.message);
116
- throw e;
117
- });
118
- }
111
+ if (options.lazyConnect || !options.urls?.length)
112
+ return;
113
+ this.logger?.log('Connecting to RabbitMQ at ' + ansi_colors_1.default.blue(options.urls.join(',')));
114
+ common_1.Logger.flush();
115
+ await this.client.connect().catch(e => {
116
+ this.logger?.error('RabbitMQ connection failed: ' + e.message);
117
+ throw e;
118
+ });
119
119
  }
120
120
  onApplicationShutdown() {
121
121
  return this.client.close();
@@ -4,7 +4,7 @@ import assert from 'node:assert';
4
4
  import * as crypto from 'node:crypto';
5
5
  import { Inject, Logger } from '@nestjs/common';
6
6
  import { ClientRMQ, ClientsModule, Transport } from '@nestjs/microservices';
7
- import * as colors from 'ansi-colors';
7
+ import colors from 'ansi-colors';
8
8
  import { RMQ_CONNECTION_OPTIONS, RMQ_MODULE_ID } from './constants.js';
9
9
  import { getRabbitmqConfig } from './get-rabbitmq-config.js';
10
10
  const CLIENT_TOKEN = Symbol('CLIENT_TOKEN');
@@ -105,14 +105,14 @@ let RabbitmqCoreModule = RabbitmqCoreModule_1 = class RabbitmqCoreModule {
105
105
  }
106
106
  async onApplicationBootstrap() {
107
107
  const options = this.connectionOptions;
108
- if (!options.lazyConnect && options.urls?.length) {
109
- this.logger?.log('Connecting to RabbitMQ at ' + colors.blue(options.urls.join(',')));
110
- Logger.flush();
111
- await this.client.connect().catch(e => {
112
- this.logger?.error('RabbitMQ connection failed: ' + e.message);
113
- throw e;
114
- });
115
- }
108
+ if (options.lazyConnect || !options.urls?.length)
109
+ return;
110
+ this.logger?.log('Connecting to RabbitMQ at ' + colors.blue(options.urls.join(',')));
111
+ Logger.flush();
112
+ await this.client.connect().catch(e => {
113
+ this.logger?.error('RabbitMQ connection failed: ' + e.message);
114
+ throw e;
115
+ });
116
116
  }
117
117
  onApplicationShutdown() {
118
118
  return this.client.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xnestjs/rabbitmq",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "description": "NestJS extension library for RabbitMQ",
5
5
  "author": "Panates",
6
6
  "license": "MIT",