@optimiser/common 1.0.435 → 1.0.437

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.
Files changed (2) hide show
  1. package/dist/lib/utility.js +256 -67
  2. package/package.json +1 -1
@@ -3973,52 +3973,39 @@ function UpdateTagCount(tagids, objectName, db, params) {
3973
3973
  }
3974
3974
  function SyncUserLicenceConsumedCount(msp_d, db, dbMaster) {
3975
3975
  return __awaiter(this, void 0, void 0, function () {
3976
- var companySetting, companyLicencesData, companyLevelLicences, _loop_17, i, userLicenceData, u, licenceType, licenceName, licenceTotal, i, companyLicenceType, j, comLicenceInUserLicence, bulkLicenceOps, u, licenceID, licenceTotal, err_1;
3977
- return __generator(this, function (_a) {
3978
- switch (_a.label) {
3976
+ var companySetting, companyLicencesData, i, companyLicenceType, j, userLicenceData, u, licenceType, licenceName, licenceTotal, i, companyLicenceType, j, comLicenceInUserLicence, bulkLicenceOps, u, licenceID, licenceTotal, _a, errCompLic, resultCompLic, i, licenceModuleObj, clModule, totalCompanyLevelLicenceCount, setQueryTotalConsumed, licenceConsumedCountPath, err_1;
3977
+ return __generator(this, function (_b) {
3978
+ switch (_b.label) {
3979
3979
  case 0:
3980
- _a.trys.push([0, 9, , 10]);
3980
+ _b.trys.push([0, 17, , 18]);
3981
3981
  return [4 /*yield*/, dbMaster.collection("Company").findOne({ _id: new mongodb_1.ObjectId(msp_d.ci), 'IsActive': true }, { projection: { "Setting.Licences": 1 } })];
3982
3982
  case 1:
3983
- companySetting = _a.sent();
3984
- if (!(companySetting && companySetting.Setting)) return [3 /*break*/, 7];
3983
+ companySetting = _b.sent();
3984
+ if (!(companySetting && companySetting.Setting)) return [3 /*break*/, 15];
3985
3985
  companyLicencesData = (companySetting.Setting.Licences) ? companySetting.Setting.Licences : {};
3986
- if (!(isEmptyObj(companyLicencesData) == false)) return [3 /*break*/, 5];
3987
- return [4 /*yield*/, dbMaster.collection("Licences").find({ IsCompanyLevelLicence: true, "Status": "active", IsActive: true }).toArray()];
3988
- case 2:
3989
- companyLevelLicences = _a.sent();
3990
- _loop_17 = function (i) {
3986
+ if (!(isEmptyObj(companyLicencesData) == false)) return [3 /*break*/, 13];
3987
+ //getting all company level licences
3988
+ for (i in companyLicencesData) {
3991
3989
  /*Added by Chetan on 07-Mar-2022, Not necessary for Domain Licence*/
3992
3990
  if (i != "Domain") {
3993
- var companyLicenceType = companyLicencesData[i];
3994
- var _loop_18 = function (j) {
3991
+ companyLicenceType = companyLicencesData[i];
3992
+ for (j in companyLicenceType) {
3995
3993
  //Commented by SurajWasan on 27-May-2025, for story QPC-10970, now this will handle by IsCompanyLevelLicence property, its consumed count will be handle by its own module.
3996
3994
  // /*Added by Ashish to stop resetting App.Reception.NoOfLicenceConsumed to "0" QPC-7011 */
3997
3995
  // if (i == "App" && j == 'Reception') {
3998
3996
  // continue;
3999
3997
  // }
4000
3998
  //End
4001
- if (companyLevelLicences && companyLevelLicences.length) {
4002
- if (companyLevelLicences.some(function (x) { x.LicenceType == i && x.LicenceName == j; })) {
4003
- return "continue";
4004
- }
4005
- }
4006
3999
  companyLicenceType[j].NoOfLicenceConsumed = 0;
4007
- };
4008
- for (var j in companyLicenceType) {
4009
- _loop_18(j);
4010
4000
  }
4011
4001
  }
4012
- };
4013
- for (i in companyLicencesData) {
4014
- _loop_17(i);
4015
4002
  }
4016
4003
  return [4 /*yield*/, db.collection('UserLicence').aggregate([
4017
4004
  { $match: { Status: 'active', IsActive: true } },
4018
4005
  { $group: { _id: { "LicenceType": "$LicenceType", "LicenceName": "$LicenceName" }, Total: { $sum: 1 } } }
4019
4006
  ]).toArray()];
4020
- case 3:
4021
- userLicenceData = _a.sent();
4007
+ case 2:
4008
+ userLicenceData = _b.sent();
4022
4009
  if (userLicenceData) {
4023
4010
  for (u = 0; u < userLicenceData.length; u++) {
4024
4011
  licenceType = userLicenceData[u]._id['LicenceType'];
@@ -4048,8 +4035,8 @@ function SyncUserLicenceConsumedCount(msp_d, db, dbMaster) {
4048
4035
  { $match: { Status: 'active', IsActive: true } },
4049
4036
  { $group: { _id: { "CompanyLicenceID": "$CompanyLicenceID" }, Total: { $sum: 1 } } }
4050
4037
  ]).toArray()];
4051
- case 4:
4052
- comLicenceInUserLicence = _a.sent();
4038
+ case 3:
4039
+ comLicenceInUserLicence = _b.sent();
4053
4040
  if (comLicenceInUserLicence && comLicenceInUserLicence.length) {
4054
4041
  bulkLicenceOps = [{
4055
4042
  updateMany: {
@@ -4080,25 +4067,227 @@ function SyncUserLicenceConsumedCount(msp_d, db, dbMaster) {
4080
4067
  else {
4081
4068
  console.log('In company (' + msp_d.ci + '), copmany licence data not found in user licence while syncing user licence consumed count.');
4082
4069
  }
4083
- return [3 /*break*/, 6];
4070
+ return [4 /*yield*/, GetCompanyLevelLicences({ mdb: dbMaster, companyId: msp_d.ci.toString() })];
4071
+ case 4:
4072
+ _a = _b.sent(), errCompLic = _a.errCompLic, resultCompLic = _a.resultCompLic;
4073
+ if (!errCompLic) return [3 /*break*/, 5];
4074
+ console.error('In fn:SyncUserLicenceConsumedCount, error in getting Company Level Licences in company (' + msp_d.ci + ') ');
4075
+ return [3 /*break*/, 12];
4084
4076
  case 5:
4085
- console.log('Licence data not found in company (' + msp_d.ci + ') setting while syncing user licence consumed count.');
4086
- _a.label = 6;
4087
- case 6: return [3 /*break*/, 8];
4077
+ if (!(resultCompLic === null || resultCompLic === void 0 ? void 0 : resultCompLic.length)) return [3 /*break*/, 12];
4078
+ return [4 /*yield*/, GetCompanyLevelLicenceObject({ db: db, companyLevelLicences: resultCompLic })];
4079
+ case 6:
4080
+ _b.sent();
4081
+ i = 0;
4082
+ _b.label = 7;
4088
4083
  case 7:
4089
- console.log('Company (' + msp_d.ci + ') data not found while syncing user licence consumed count.');
4090
- _a.label = 8;
4091
- case 8: return [3 /*break*/, 10];
4084
+ if (!(i < resultCompLic.length)) return [3 /*break*/, 12];
4085
+ licenceModuleObj = resultCompLic[i];
4086
+ clModule = licenceModuleObj.LicenceObject;
4087
+ if (!clModule) return [3 /*break*/, 11];
4088
+ return [4 /*yield*/, db.collection(clModule).countDocuments({ LicenceStatus: "active", IsActive: true })];
4089
+ case 8:
4090
+ totalCompanyLevelLicenceCount = _b.sent();
4091
+ setQueryTotalConsumed = {};
4092
+ licenceConsumedCountPath = "Setting.Licences.".concat(licenceModuleObj.LicenceType, ".").concat(licenceModuleObj.LicenceName, ".NoOfLicenceConsumed");
4093
+ setQueryTotalConsumed[licenceConsumedCountPath] = totalCompanyLevelLicenceCount;
4094
+ //Updating Total Consumed in Company collection
4095
+ return [4 /*yield*/, dbMaster.collection("Company").updateOne({ _id: new mongodb_1.ObjectId(msp_d.ci) }, { $set: setQueryTotalConsumed })];
4092
4096
  case 9:
4093
- err_1 = _a.sent();
4097
+ //Updating Total Consumed in Company collection
4098
+ _b.sent();
4099
+ // console.log('Set Query => ', JSON.stringify(setQueryTotalConsumed));
4100
+ //Counting Licence ID wise Licences count in particular module of Company Level Licence
4101
+ return [4 /*yield*/, SetCompanyLevelLicenceCountInCompanyLicences({ clModule: clModule, db: db, dbMaster: dbMaster, companyId: msp_d.ci, companyLevelLicenceObj: licenceModuleObj })];
4102
+ case 10:
4103
+ // console.log('Set Query => ', JSON.stringify(setQueryTotalConsumed));
4104
+ //Counting Licence ID wise Licences count in particular module of Company Level Licence
4105
+ _b.sent();
4106
+ _b.label = 11;
4107
+ case 11:
4108
+ i++;
4109
+ return [3 /*break*/, 7];
4110
+ case 12: return [3 /*break*/, 14];
4111
+ case 13:
4112
+ console.log('Licence data not found in company (' + msp_d.ci + ') setting while syncing user licence consumed count.');
4113
+ _b.label = 14;
4114
+ case 14: return [3 /*break*/, 16];
4115
+ case 15:
4116
+ console.log('Company (' + msp_d.ci + ') data not found while syncing user licence consumed count.');
4117
+ _b.label = 16;
4118
+ case 16: return [3 /*break*/, 18];
4119
+ case 17:
4120
+ err_1 = _b.sent();
4094
4121
  console.log('Error occurred while syncing user licence consumed count.', err_1);
4095
- return [3 /*break*/, 10];
4096
- case 10: return [2 /*return*/];
4122
+ return [3 /*break*/, 18];
4123
+ case 18: return [2 /*return*/];
4097
4124
  }
4098
4125
  });
4099
4126
  });
4100
4127
  }
4101
4128
  exports.SyncUserLicenceConsumedCount = SyncUserLicenceConsumedCount;
4129
+ /**
4130
+ * To all Licences of Company level which are assigned to the given company Id
4131
+ * @param param0
4132
+ * @param param0.mdb
4133
+ * @param param0.companyId
4134
+ * @returns
4135
+ */
4136
+ var GetCompanyLevelLicences = function (_a) {
4137
+ var mdb = _a.mdb, companyId = _a.companyId;
4138
+ return __awaiter(void 0, void 0, void 0, function () {
4139
+ var companylevelLicences, error_4;
4140
+ return __generator(this, function (_b) {
4141
+ switch (_b.label) {
4142
+ case 0:
4143
+ _b.trys.push([0, 2, , 3]);
4144
+ return [4 /*yield*/, mdb.collection("Licences").aggregate([
4145
+ {
4146
+ $match: {
4147
+ IsCompanyLevelLicence: true,
4148
+ Status: "active",
4149
+ IsActive: true
4150
+ }
4151
+ },
4152
+ // Step 2: Lookup from Collection CompanyLicence using LType and LName
4153
+ {
4154
+ $lookup: {
4155
+ from: "CompanyLicence",
4156
+ let: { aLType: "$LicenceType", aLName: "$LicenceName" },
4157
+ pipeline: [
4158
+ {
4159
+ $match: {
4160
+ $expr: {
4161
+ $and: [
4162
+ { $eq: ["$LicenceType", "$$aLType"] },
4163
+ { $eq: ["$LicenceName", "$$aLName"] },
4164
+ { $eq: ["$Status", "active"] },
4165
+ { $eq: ["$CompanyID", new mongodb_1.ObjectId(companyId)] },
4166
+ { $eq: ["$IsActive", true] }
4167
+ ]
4168
+ }
4169
+ }
4170
+ }
4171
+ ],
4172
+ as: "companyLicence"
4173
+ }
4174
+ },
4175
+ // Step 3: Ensure there's at least one matching document in CompanyLicence collection
4176
+ {
4177
+ $match: {
4178
+ "companyLicence.0": { $exists: true }
4179
+ }
4180
+ },
4181
+ // Step 4: Unwind matchedB so each matching B record becomes a separate document
4182
+ {
4183
+ $unwind: "$companyLicence"
4184
+ },
4185
+ {
4186
+ $project: {
4187
+ "LicenceName": 1,
4188
+ "LicenceType": 1,
4189
+ "Modules": 1,
4190
+ }
4191
+ }
4192
+ ]).toArray()];
4193
+ case 1:
4194
+ companylevelLicences = _b.sent();
4195
+ return [2 /*return*/, { errCompLic: null, resultCompLic: companylevelLicences }];
4196
+ case 2:
4197
+ error_4 = _b.sent();
4198
+ console.error('Error in function GetCompanyLevelLicences for company ' + companyId + ' =>', error_4);
4199
+ return [2 /*return*/, { errCompLic: error_4, resultCompLic: null }];
4200
+ case 3: return [2 /*return*/];
4201
+ }
4202
+ });
4203
+ });
4204
+ };
4205
+ /**
4206
+ * To bind licence object of company level licences from module master
4207
+ * @param param0
4208
+ * @param param0.db
4209
+ * @param param0.companyLevelLicences array of company level licences
4210
+ */
4211
+ var GetCompanyLevelLicenceObject = function (_a) {
4212
+ var db = _a.db, companyLevelLicences = _a.companyLevelLicences;
4213
+ return __awaiter(void 0, void 0, void 0, function () {
4214
+ var moduleMasterData, i, j;
4215
+ var _b;
4216
+ return __generator(this, function (_c) {
4217
+ switch (_c.label) {
4218
+ case 0: return [4 /*yield*/, db.collection("ModuleMaster").find({ IsActive: true, LicenceObject: { $exists: true } }).toArray()];
4219
+ case 1:
4220
+ moduleMasterData = _c.sent();
4221
+ if (moduleMasterData) {
4222
+ for (i = 0; i < companyLevelLicences.length; i++) {
4223
+ for (j = 0; j < moduleMasterData.length; j++) {
4224
+ if ((_b = companyLevelLicences[i].Modules) === null || _b === void 0 ? void 0 : _b.includes(moduleMasterData[j]._id)) {
4225
+ companyLevelLicences[i].LicenceObject = moduleMasterData[j].LicenceObject;
4226
+ break;
4227
+ }
4228
+ }
4229
+ }
4230
+ }
4231
+ return [2 /*return*/];
4232
+ }
4233
+ });
4234
+ });
4235
+ };
4236
+ /**
4237
+ * To update licence counsumed count for company level licence in CompanyLicences collection
4238
+ * @param {string} clModule object name of company level licence
4239
+ * @param {object} db
4240
+ * @param {object} dbMaster
4241
+ * @param {string} companyId
4242
+ * @param {object} companyLevelLicenceObj company level licence object
4243
+ */
4244
+ var SetCompanyLevelLicenceCountInCompanyLicences = function (_a) {
4245
+ var clModule = _a.clModule, db = _a.db, dbMaster = _a.dbMaster, companyId = _a.companyId, companyLevelLicenceObj = _a.companyLevelLicenceObj;
4246
+ return __awaiter(void 0, void 0, void 0, function () {
4247
+ var comLevelLicence, bulkLicenceOps, u, licenceID, licenceTotal;
4248
+ return __generator(this, function (_b) {
4249
+ switch (_b.label) {
4250
+ case 0: return [4 /*yield*/, db.collection(clModule).aggregate([
4251
+ { $match: { LicenceStatus: 'active', IsActive: true } },
4252
+ { $group: { _id: { "CompanyLicenceID": "$CompanyLicenceID" }, Total: { $sum: 1 } } }
4253
+ ]).toArray()];
4254
+ case 1:
4255
+ comLevelLicence = _b.sent();
4256
+ if (comLevelLicence && comLevelLicence.length) {
4257
+ bulkLicenceOps = [{
4258
+ updateMany: {
4259
+ filter: { 'CompanyID': new mongodb_1.ObjectId(companyId), 'LicenceType': companyLevelLicenceObj.LicenceType, LicenceName: companyLevelLicenceObj.LicenceName, IsActive: true, Status: "active" },
4260
+ update: [
4261
+ { $set: { 'NoOfLicenceConsumed': 0 } },
4262
+ { $set: { 'NoOfRemainingLicence': "$NoOfLicence" } }
4263
+ ]
4264
+ }
4265
+ }];
4266
+ for (u = 0; u < comLevelLicence.length; u++) {
4267
+ licenceID = comLevelLicence[u]._id['CompanyLicenceID'];
4268
+ licenceTotal = comLevelLicence[u].Total;
4269
+ if (licenceID) {
4270
+ bulkLicenceOps.push({
4271
+ updateOne: {
4272
+ filter: { '_id': licenceID },
4273
+ update: [
4274
+ { $set: { 'NoOfLicenceConsumed': licenceTotal } },
4275
+ { $set: { 'NoOfRemainingLicence': { $subtract: ["$NoOfLicence", "$NoOfLicenceConsumed"] } } }
4276
+ ]
4277
+ }
4278
+ });
4279
+ }
4280
+ }
4281
+ dbMaster.collection('CompanyLicence').bulkWrite(bulkLicenceOps);
4282
+ }
4283
+ else {
4284
+ console.log('In company (' + companyId + '), copmany licence data not found in user licence while syncing user licence consumed count.');
4285
+ }
4286
+ return [2 /*return*/];
4287
+ }
4288
+ });
4289
+ });
4290
+ };
4102
4291
  /**
4103
4292
  * @param db: database object
4104
4293
  * @param event : event module object
@@ -4455,7 +4644,7 @@ exports.GetDayIndex = GetDayIndex;
4455
4644
  function GetUserProfile(msp_d, db, mdb, next) {
4456
4645
  var _a;
4457
4646
  return __awaiter(this, void 0, void 0, function () {
4458
- var userData, userProfile_1, error_4, objectIDs_1, modules_1, licenceDetail_1, companyLevelLicenceDetail, moduleList, _loop_19, i, error_5;
4647
+ var userData, userProfile_1, error_5, objectIDs_1, modules_1, licenceDetail_1, companyLevelLicenceDetail, moduleList, _loop_17, i, error_6;
4459
4648
  return __generator(this, function (_b) {
4460
4649
  switch (_b.label) {
4461
4650
  case 0:
@@ -4492,7 +4681,7 @@ function GetUserProfile(msp_d, db, mdb, next) {
4492
4681
  userProfile_1 = _b.sent();
4493
4682
  return [3 /*break*/, 5];
4494
4683
  case 4:
4495
- error_4 = _b.sent();
4684
+ error_5 = _b.sent();
4496
4685
  console.log('No Module provided to userprofile');
4497
4686
  return [2 /*return*/, { statusCode: 500, message: "Your profile doesn't have any module access. Please contact your Administrator.", data: {} }];
4498
4687
  case 5:
@@ -4529,14 +4718,14 @@ function GetUserProfile(msp_d, db, mdb, next) {
4529
4718
  moduleList = userProfile_1[0].ModuleList;
4530
4719
  userProfile_1[0].HasControlPanelAccess = [];
4531
4720
  if (userProfile_1[0].Permissions) {
4532
- _loop_19 = function (i) {
4721
+ _loop_17 = function (i) {
4533
4722
  userProfile_1[0].Permissions[i].ModuleData = moduleList.find(function (x) { return x._id == userProfile_1[0].Permissions[i].ModuleID; });
4534
4723
  if ((_a = userProfile_1[0].Permissions[i].Operations) === null || _a === void 0 ? void 0 : _a.includes("Control Panel")) {
4535
4724
  userProfile_1[0].HasControlPanelAccess.push(userProfile_1[0].Permissions[i].ModuleID);
4536
4725
  }
4537
4726
  };
4538
4727
  for (i = 0; i < userProfile_1[0].Permissions.length; i++) {
4539
- _loop_19(i);
4728
+ _loop_17(i);
4540
4729
  }
4541
4730
  }
4542
4731
  if (moduleList.length == 0) {
@@ -4552,9 +4741,9 @@ function GetUserProfile(msp_d, db, mdb, next) {
4552
4741
  case 9: return [2 /*return*/, { statusCode: 200, message: "There is no licence assigned to this user, please contact your administrator.", data: {} }];
4553
4742
  case 10: return [3 /*break*/, 12];
4554
4743
  case 11:
4555
- error_5 = _b.sent();
4556
- console.error("Internal Error in GetUserProfile Utility function : ".concat(error_5));
4557
- next(error_5);
4744
+ error_6 = _b.sent();
4745
+ console.error("Internal Error in GetUserProfile Utility function : ".concat(error_6));
4746
+ next(error_6);
4558
4747
  return [3 /*break*/, 12];
4559
4748
  case 12: return [2 /*return*/];
4560
4749
  }
@@ -4632,7 +4821,7 @@ exports.RemoveFieldsFromFilters = RemoveFieldsFromFilters;
4632
4821
  */
4633
4822
  function ErrorHandlerForServices(Error, ServiceOrigin, EmailConfig, Module, db) {
4634
4823
  return __awaiter(this, void 0, void 0, function () {
4635
- var _a, mailObj, errorObj, sendMailResult, ErrorOrigin, ErrorData, error_6;
4824
+ var _a, mailObj, errorObj, sendMailResult, ErrorOrigin, ErrorData, error_7;
4636
4825
  return __generator(this, function (_b) {
4637
4826
  switch (_b.label) {
4638
4827
  case 0:
@@ -4655,8 +4844,8 @@ function ErrorHandlerForServices(Error, ServiceOrigin, EmailConfig, Module, db)
4655
4844
  _b.label = 4;
4656
4845
  case 4: return [3 /*break*/, 6];
4657
4846
  case 5:
4658
- error_6 = _b.sent();
4659
- console.log("Error While connectin to Master DB", error_6);
4847
+ error_7 = _b.sent();
4848
+ console.log("Error While connectin to Master DB", error_7);
4660
4849
  return [3 /*break*/, 6];
4661
4850
  case 6: return [2 /*return*/];
4662
4851
  }
@@ -4858,7 +5047,7 @@ var CustomSanitizeHtml = function (dirtyHtml, uiDataType) {
4858
5047
  function ValidateUserInput(options) {
4859
5048
  var _a, _b, _c;
4860
5049
  return __awaiter(this, void 0, void 0, function () {
4861
- var inputFields, fieldsJsonData, pageData, documentID, db, mdb, fiscalSettingData, action, objectSchema, objectName, pageFields, schemaFields, inputField, msg, _loop_20, _i, inputField_1, name_1, state_1, _d, _e, grp, _loop_21, _f, _g, fld, state_2, _loop_22, isValid, isValid, validateResp, _h, pageFields_1, pageField, state_3, countryData, err_3;
5050
+ var inputFields, fieldsJsonData, pageData, documentID, db, mdb, fiscalSettingData, action, objectSchema, objectName, pageFields, schemaFields, inputField, msg, _loop_18, _i, inputField_1, name_1, state_1, _d, _e, grp, _loop_19, _f, _g, fld, state_2, _loop_20, isValid, isValid, validateResp, _h, pageFields_1, pageField, state_3, countryData, err_3;
4862
5051
  return __generator(this, function (_j) {
4863
5052
  switch (_j.label) {
4864
5053
  case 0:
@@ -4887,7 +5076,7 @@ function ValidateUserInput(options) {
4887
5076
  inputField = Object.keys(inputFields);
4888
5077
  msg = '';
4889
5078
  if (inputField && inputField.length) {
4890
- _loop_20 = function (name_1) {
5079
+ _loop_18 = function (name_1) {
4891
5080
  var field = pageFields.find(function (x) { return x.Name == name_1; });
4892
5081
  if (field == undefined && !IsSystemField(objectName, name_1)) {
4893
5082
  msg = name_1 + " is not valid field!";
@@ -4896,7 +5085,7 @@ function ValidateUserInput(options) {
4896
5085
  };
4897
5086
  for (_i = 0, inputField_1 = inputField; _i < inputField_1.length; _i++) {
4898
5087
  name_1 = inputField_1[_i];
4899
- state_1 = _loop_20(name_1);
5088
+ state_1 = _loop_18(name_1);
4900
5089
  if (state_1 === "break")
4901
5090
  break;
4902
5091
  }
@@ -4905,7 +5094,7 @@ function ValidateUserInput(options) {
4905
5094
  for (_d = 0, _e = pageData.Groups; _d < _e.length; _d++) {
4906
5095
  grp = _e[_d];
4907
5096
  if (grp.IsConditionalGroup) {
4908
- _loop_21 = function (fld) {
5097
+ _loop_19 = function (fld) {
4909
5098
  fld = JSON.parse(JSON.stringify(fld));
4910
5099
  var schemafld = schemaFields.find(function (x) { return x.Name == fld.Name; });
4911
5100
  fld.Schema = schemafld;
@@ -4915,14 +5104,14 @@ function ValidateUserInput(options) {
4915
5104
  };
4916
5105
  for (_f = 0, _g = grp.Fields; _f < _g.length; _f++) {
4917
5106
  fld = _g[_f];
4918
- state_2 = _loop_21(fld);
5107
+ state_2 = _loop_19(fld);
4919
5108
  if (state_2 === "break")
4920
5109
  break;
4921
5110
  }
4922
5111
  }
4923
5112
  }
4924
5113
  }
4925
- _loop_22 = function (pageField) {
5114
+ _loop_20 = function (pageField) {
4926
5115
  var fieldName, fieldData, field, parentData, oldValue, newValue, isSame, searchQuery, result, fld, _k, minValue, maxValue, filter, searchObj, dbConnection, result, searchObj, totalRecord, _l, schemaData, result, searchObj, result, schemaData, result, searchObj, totalRecord, regexpression, phone, files, _m, fieldData_1, obj, searchObj, totalRecord, searchObj, result, searchVideoObj, videoPromise, thumbnailPromise, searchThumbnailObj, _o, videoResult, thumbnailResult, text, _p, fieldData_2, obj;
4927
5116
  return __generator(this, function (_q) {
4928
5117
  switch (_q.label) {
@@ -5398,7 +5587,7 @@ function ValidateUserInput(options) {
5398
5587
  case 2:
5399
5588
  if (!(_h < pageFields_1.length)) return [3 /*break*/, 5];
5400
5589
  pageField = pageFields_1[_h];
5401
- return [5 /*yield**/, _loop_22(pageField)];
5590
+ return [5 /*yield**/, _loop_20(pageField)];
5402
5591
  case 3:
5403
5592
  state_3 = _j.sent();
5404
5593
  if (state_3 === "break")
@@ -5522,7 +5711,7 @@ exports.CheckExpressionOnDateField = CheckExpressionOnDateField;
5522
5711
  */
5523
5712
  function CreateBanquetingVATSettingsData(msp_d, db, sdata, next) {
5524
5713
  return __awaiter(this, void 0, void 0, function () {
5525
- var userID, schemaData, _i, _a, field, error_7;
5714
+ var userID, schemaData, _i, _a, field, error_8;
5526
5715
  return __generator(this, function (_b) {
5527
5716
  switch (_b.label) {
5528
5717
  case 0:
@@ -5549,8 +5738,8 @@ function CreateBanquetingVATSettingsData(msp_d, db, sdata, next) {
5549
5738
  return [3 /*break*/, 2];
5550
5739
  case 5: return [3 /*break*/, 7];
5551
5740
  case 6:
5552
- error_7 = _b.sent();
5553
- next(error_7);
5741
+ error_8 = _b.sent();
5742
+ next(error_8);
5554
5743
  return [3 /*break*/, 7];
5555
5744
  case 7: return [2 /*return*/];
5556
5745
  }
@@ -5705,7 +5894,7 @@ function BuildQRDataField(fieldSchema, updateObj, db) {
5705
5894
  function GenerateBase64QRCodeData(data, options) {
5706
5895
  if (options === void 0) { options = {}; }
5707
5896
  return __awaiter(this, void 0, void 0, function () {
5708
- var qrOptions, qrCodeB64Image, error_8;
5897
+ var qrOptions, qrCodeB64Image, error_9;
5709
5898
  return __generator(this, function (_a) {
5710
5899
  switch (_a.label) {
5711
5900
  case 0:
@@ -5724,8 +5913,8 @@ function GenerateBase64QRCodeData(data, options) {
5724
5913
  qrCodeB64Image = _a.sent();
5725
5914
  return [2 /*return*/, qrCodeB64Image];
5726
5915
  case 2:
5727
- error_8 = _a.sent();
5728
- console.error('Error while Generating BASE64 of QR URL ', error_8);
5916
+ error_9 = _a.sent();
5917
+ console.error('Error while Generating BASE64 of QR URL ', error_9);
5729
5918
  return [3 /*break*/, 3];
5730
5919
  case 3: return [2 /*return*/];
5731
5920
  }
@@ -5914,7 +6103,7 @@ function ValidateStateCountryField(_a) {
5914
6103
  */
5915
6104
  function CheckAccessPermissions(permissionType, objectName, msp_d, db, mdb, next) {
5916
6105
  return __awaiter(this, void 0, void 0, function () {
5917
- var response, isAllowed, data, _i, _a, item, error_9;
6106
+ var response, isAllowed, data, _i, _a, item, error_10;
5918
6107
  return __generator(this, function (_b) {
5919
6108
  switch (_b.label) {
5920
6109
  case 0:
@@ -5941,8 +6130,8 @@ function CheckAccessPermissions(permissionType, objectName, msp_d, db, mdb, next
5941
6130
  }
5942
6131
  return [2 /*return*/, isAllowed];
5943
6132
  case 2:
5944
- error_9 = _b.sent();
5945
- console.error("Internal Error in CheckAccessPermissions function : ".concat(error_9));
6133
+ error_10 = _b.sent();
6134
+ console.error("Internal Error in CheckAccessPermissions function : ".concat(error_10));
5946
6135
  return [3 /*break*/, 3];
5947
6136
  case 3: return [2 /*return*/];
5948
6137
  }
@@ -5965,7 +6154,7 @@ exports.CheckAccessPermissions = CheckAccessPermissions;
5965
6154
  function CheckProfilePermissions(permissionType, objectName, pageName, msp_d, db, mdb, next) {
5966
6155
  var _a, _b, _c, _d, _e;
5967
6156
  return __awaiter(this, void 0, void 0, function () {
5968
- var response, isAllowed, data, _i, _f, item, error_10;
6157
+ var response, isAllowed, data, _i, _f, item, error_11;
5969
6158
  return __generator(this, function (_g) {
5970
6159
  switch (_g.label) {
5971
6160
  case 0:
@@ -5994,8 +6183,8 @@ function CheckProfilePermissions(permissionType, objectName, pageName, msp_d, db
5994
6183
  }
5995
6184
  return [2 /*return*/, isAllowed];
5996
6185
  case 2:
5997
- error_10 = _g.sent();
5998
- console.error("Internal Error in CheckProfilePermissions function : ".concat(error_10));
6186
+ error_11 = _g.sent();
6187
+ console.error("Internal Error in CheckProfilePermissions function : ".concat(error_11));
5999
6188
  return [3 /*break*/, 3];
6000
6189
  case 3: return [2 /*return*/];
6001
6190
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimiser/common",
3
- "version": "1.0.435",
3
+ "version": "1.0.437",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {