@xnestjs/kafka 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 create_log_creator_js_1 = require("./create-log-creator.js");
13
13
  const get_kafka_config_js_1 = require("./get-kafka-config.js");
@@ -115,14 +115,14 @@ let KafkaCoreModule = KafkaCoreModule_1 = class KafkaCoreModule {
115
115
  }
116
116
  async onApplicationBootstrap() {
117
117
  const options = this.connectionOptions;
118
- if (!options.lazyConnect) {
119
- this.logger?.log('Connecting to Kafka brokers' + (Array.isArray(options.brokers) ? colors.blue(options.brokers.join(',')) : ''));
120
- common_1.Logger.flush();
121
- await this.client.connect().catch(e => {
122
- this.logger?.error('Kafka connection failed: ' + e.message);
123
- throw e;
124
- });
125
- }
118
+ if (options.lazyConnect)
119
+ return;
120
+ this.logger?.log('Connecting to Kafka brokers' + (Array.isArray(options.brokers) ? ansi_colors_1.default.blue(options.brokers.join(',')) : ''));
121
+ common_1.Logger.flush();
122
+ await this.client.connect().catch(e => {
123
+ this.logger?.error('Kafka connection failed: ' + e.message);
124
+ throw e;
125
+ });
126
126
  }
127
127
  onApplicationShutdown() {
128
128
  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 { ClientKafka, ClientsModule, Transport } from '@nestjs/microservices';
7
- import * as colors from 'ansi-colors';
7
+ import colors from 'ansi-colors';
8
8
  import { KAFKA_CONNECTION_OPTIONS, KAFKA_MODULE_ID } from './constants.js';
9
9
  import { createLogCreator } from './create-log-creator.js';
10
10
  import { getKafkaConfig } from './get-kafka-config.js';
@@ -112,14 +112,14 @@ let KafkaCoreModule = KafkaCoreModule_1 = class KafkaCoreModule {
112
112
  }
113
113
  async onApplicationBootstrap() {
114
114
  const options = this.connectionOptions;
115
- if (!options.lazyConnect) {
116
- this.logger?.log('Connecting to Kafka brokers' + (Array.isArray(options.brokers) ? colors.blue(options.brokers.join(',')) : ''));
117
- Logger.flush();
118
- await this.client.connect().catch(e => {
119
- this.logger?.error('Kafka connection failed: ' + e.message);
120
- throw e;
121
- });
122
- }
115
+ if (options.lazyConnect)
116
+ return;
117
+ this.logger?.log('Connecting to Kafka brokers' + (Array.isArray(options.brokers) ? colors.blue(options.brokers.join(',')) : ''));
118
+ Logger.flush();
119
+ await this.client.connect().catch(e => {
120
+ this.logger?.error('Kafka connection failed: ' + e.message);
121
+ throw e;
122
+ });
123
123
  }
124
124
  onApplicationShutdown() {
125
125
  return this.client.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xnestjs/kafka",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "description": "NestJS extension library for Kafka",
5
5
  "author": "Panates",
6
6
  "license": "MIT",