@xnestjs/mongodb 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 assert = tslib_1.__importStar(require("node:assert"));
|
|
|
7
7
|
const crypto = tslib_1.__importStar(require("node:crypto"));
|
|
8
8
|
const objects_1 = require("@jsopen/objects");
|
|
9
9
|
const common_1 = require("@nestjs/common");
|
|
10
|
-
const
|
|
10
|
+
const ansi_colors_1 = tslib_1.__importDefault(require("ansi-colors"));
|
|
11
11
|
const mongodb_1 = require("mongodb");
|
|
12
12
|
const constants_js_1 = require("./constants.js");
|
|
13
13
|
const get_mongodb_config_js_1 = require("./get-mongodb-config.js");
|
|
@@ -102,14 +102,14 @@ let MongodbCoreModule = MongodbCoreModule_1 = class MongodbCoreModule {
|
|
|
102
102
|
}
|
|
103
103
|
onApplicationBootstrap() {
|
|
104
104
|
const options = this.connectionOptions;
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
105
|
+
if (options.lazyConnect)
|
|
106
|
+
return;
|
|
107
|
+
this.logger?.log(`Connecting to MongoDB [${options.database}] at ${ansi_colors_1.default.blue(options.url)}`);
|
|
108
|
+
common_1.Logger.flush();
|
|
109
|
+
return this.client.connect().catch(e => {
|
|
110
|
+
this.logger?.error('MongoDB connection failed: ' + e.message);
|
|
111
|
+
throw e;
|
|
112
|
+
});
|
|
113
113
|
}
|
|
114
114
|
onApplicationShutdown() {
|
|
115
115
|
return this.client.close(true);
|
|
@@ -4,7 +4,7 @@ import * as assert from 'node:assert';
|
|
|
4
4
|
import * as crypto from 'node:crypto';
|
|
5
5
|
import { omit } from '@jsopen/objects';
|
|
6
6
|
import { Inject, Logger } from '@nestjs/common';
|
|
7
|
-
import
|
|
7
|
+
import colors from 'ansi-colors';
|
|
8
8
|
import { Db, MongoClient } from 'mongodb';
|
|
9
9
|
import { MONGODB_CONNECTION_OPTIONS, MONGODB_MODULE_ID } from './constants.js';
|
|
10
10
|
import { getMongodbConfig } from './get-mongodb-config.js';
|
|
@@ -99,14 +99,14 @@ let MongodbCoreModule = MongodbCoreModule_1 = class MongodbCoreModule {
|
|
|
99
99
|
}
|
|
100
100
|
onApplicationBootstrap() {
|
|
101
101
|
const options = this.connectionOptions;
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
102
|
+
if (options.lazyConnect)
|
|
103
|
+
return;
|
|
104
|
+
this.logger?.log(`Connecting to MongoDB [${options.database}] at ${colors.blue(options.url)}`);
|
|
105
|
+
Logger.flush();
|
|
106
|
+
return this.client.connect().catch(e => {
|
|
107
|
+
this.logger?.error('MongoDB connection failed: ' + e.message);
|
|
108
|
+
throw e;
|
|
109
|
+
});
|
|
110
110
|
}
|
|
111
111
|
onApplicationShutdown() {
|
|
112
112
|
return this.client.close(true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xnestjs/mongodb",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"description": "NestJS extension library for MongoDb",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"peerDependencies": {
|
|
14
14
|
"@nestjs/common": "^10.0.0 || ^11.0.0",
|
|
15
15
|
"@nestjs/core": "^10.0.0 || ^11.0.0",
|
|
16
|
-
"mongodb": "^6.14.
|
|
16
|
+
"mongodb": "^6.14.2"
|
|
17
17
|
},
|
|
18
18
|
"type": "module",
|
|
19
19
|
"exports": {
|