@optimiser/common 1.0.439 → 1.0.440
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/lib/connection.d.ts +7 -0
- package/dist/lib/connection.js +29 -0
- package/package.json +1 -1
package/dist/lib/connection.d.ts
CHANGED
|
@@ -112,5 +112,12 @@ declare class Connection {
|
|
|
112
112
|
* @description return session from client
|
|
113
113
|
*/
|
|
114
114
|
GetDBClient(dbName: string, dbAddress: string): Promise<[Error?, MongoClient?]>;
|
|
115
|
+
/**
|
|
116
|
+
* Create New function to get DB Transaction Client as theres an issue in GetDBClient fn when client available in
|
|
117
|
+
* @param dbAddress
|
|
118
|
+
* @returns Promise
|
|
119
|
+
* @description return session from client
|
|
120
|
+
*/
|
|
121
|
+
GetDBTransactionClient(dbAddress: string): Promise<[Error?, MongoClient?]>;
|
|
115
122
|
}
|
|
116
123
|
export { Connection };
|
package/dist/lib/connection.js
CHANGED
|
@@ -590,6 +590,35 @@ var Connection = /** @class */ (function () {
|
|
|
590
590
|
});
|
|
591
591
|
});
|
|
592
592
|
};
|
|
593
|
+
/**
|
|
594
|
+
* Create New function to get DB Transaction Client as theres an issue in GetDBClient fn when client available in
|
|
595
|
+
* @param dbAddress
|
|
596
|
+
* @returns Promise
|
|
597
|
+
* @description return session from client
|
|
598
|
+
*/
|
|
599
|
+
Connection.prototype.GetDBTransactionClient = function (dbAddress) {
|
|
600
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
601
|
+
var client, ex_1;
|
|
602
|
+
return __generator(this, function (_a) {
|
|
603
|
+
switch (_a.label) {
|
|
604
|
+
case 0:
|
|
605
|
+
_a.trys.push([0, 2, , 3]);
|
|
606
|
+
return [4 /*yield*/, mongodb_1.MongoClient.connect(dbAddress, {
|
|
607
|
+
useNewUrlParser: true,
|
|
608
|
+
useUnifiedTopology: true
|
|
609
|
+
})];
|
|
610
|
+
case 1:
|
|
611
|
+
client = _a.sent();
|
|
612
|
+
return [2 /*return*/, ([undefined, client])];
|
|
613
|
+
case 2:
|
|
614
|
+
ex_1 = _a.sent();
|
|
615
|
+
console.error("Error in GetDBTransactionClient ", ex_1);
|
|
616
|
+
return [2 /*return*/, ([new Error('Error in Get db session'), undefined])];
|
|
617
|
+
case 3: return [2 /*return*/];
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
};
|
|
593
622
|
return Connection;
|
|
594
623
|
}());
|
|
595
624
|
exports.Connection = Connection;
|