@examgoal/mongodb
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -13,5 +13,5 @@ import { ClientSession, Db, MongoClient } from 'mongodb'; | ||
readonly name: string; | ||
static initializeApp(config: ConfigOptions): Promise<void>; | ||
static initializeApp(config: ConfigOptions): void; | ||
static getInstance(name: string): MongodbClient; | ||
} | ||
export = MongodbClient; |
@@ -55,3 +55,2 @@ "use strict"; | ||
this.mongoClient = new mongodb_1.MongoClient(config.uri, __assign(__assign({}, (config.mongodbOptions || {})), { useNewUrlParser: true })); | ||
instances[config.name || '[DEFAULT]'] = this; | ||
} | ||
@@ -111,19 +110,6 @@ MongodbClient.prototype.connect = function () { | ||
MongodbClient.initializeApp = function (config) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var a, e_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
a = new MongodbClient(config); | ||
return [4 /*yield*/, a.connect()]; | ||
case 1: | ||
_a.sent(); | ||
return [3 /*break*/, 3]; | ||
case 2: | ||
e_1 = _a.sent(); | ||
throw new Error(this.name + " MongoDB App's Error Occurred on first initialization " + e_1.toString()); | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
var a = new MongodbClient(config); | ||
instances[config.name || '[DEFAULT]'] = a; | ||
a.connect().catch(function (err) { | ||
throw new Error(a.name + " MongoDB App's Error Occurred on first initialization " + err.toString()); | ||
}); | ||
@@ -130,0 +116,0 @@ }; |
{ | ||
"name": "@examgoal/mongodb", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "MongoDB Session Management Helper for ExpressJS or any Node JS Projects", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
7342
149