@optimiser/common 1.0.438 → 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.
@@ -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 };
@@ -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;
@@ -4067,7 +4067,7 @@ function SyncUserLicenceConsumedCount(msp_d, db, dbMaster) {
4067
4067
  else {
4068
4068
  console.log('In company (' + msp_d.ci + '), copmany licence data not found in user licence while syncing user licence consumed count.');
4069
4069
  }
4070
- return [4 /*yield*/, GetCompanyLevelLicences({ mdb: dbMaster, companyId: msp_d.ci.toString() })];
4070
+ return [4 /*yield*/, GetCompanyLevelLicences({ mdb: dbMaster, companyId: msp_d.ci })];
4071
4071
  case 4:
4072
4072
  _a = _b.sent(), errCompLic = _a.errCompLic, resultCompLic = _a.resultCompLic;
4073
4073
  if (!errCompLic) return [3 /*break*/, 5];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimiser/common",
3
- "version": "1.0.438",
3
+ "version": "1.0.440",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {