@optimiser/common 1.0.423 → 1.0.425
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/taskutils.js +2 -2
- package/dist/lib/utility.js +117 -61
- package/package.json +59 -59
package/dist/lib/taskutils.js
CHANGED
|
@@ -310,14 +310,14 @@ function CreateNotificationContent(info, req, db, event) {
|
|
|
310
310
|
});
|
|
311
311
|
Payload['pushObj'] = {
|
|
312
312
|
title: "New ".concat(listType, " assigned: ").concat(list.ListName),
|
|
313
|
-
message: "".concat(creator.FirstName, " ").concat(creator.LastName, " has added you to this ").concat(listType),
|
|
313
|
+
message: "".concat(creator.FirstName, " ").concat(creator.LastName, " has added you in Tasks to this ").concat(listType),
|
|
314
314
|
attr: "TaskList:".concat(list._id, ":").concat(list.IsMasterList, ":").concat(list.IsPublic, ":").concat(list.OwnerID)
|
|
315
315
|
};
|
|
316
316
|
Payload['desktopObj'] = {
|
|
317
317
|
EventObjectName: "TaskList",
|
|
318
318
|
EventID: list._id,
|
|
319
319
|
UserIds: Payload['users'],
|
|
320
|
-
Message: "".concat(creator.FirstName, " ").concat(creator.LastName, " has added you to this ").concat(listType, ": ").concat(list.ListName),
|
|
320
|
+
Message: "".concat(creator.FirstName, " ").concat(creator.LastName, " has added you in Tasks to this ").concat(listType, ": ").concat(list.ListName),
|
|
321
321
|
CreatedBy: creator._id
|
|
322
322
|
};
|
|
323
323
|
TriggerNotifications(list.TaskNotification, Payload, req, db, event);
|
package/dist/lib/utility.js
CHANGED
|
@@ -4803,11 +4803,11 @@ var CustomSanitizeHtml = function (dirtyHtml, uiDataType) {
|
|
|
4803
4803
|
function ValidateUserInput(options) {
|
|
4804
4804
|
var _a, _b, _c;
|
|
4805
4805
|
return __awaiter(this, void 0, void 0, function () {
|
|
4806
|
-
var inputFields, fieldsJsonData, pageData, documentID, db, mdb, fiscalSettingData, action, objectSchema, objectName, pageFields, schemaFields, inputField, msg, _loop_18, _i, inputField_1, name_1, state_1, _loop_19, isValid, isValid, validateResp,
|
|
4807
|
-
return __generator(this, function (
|
|
4808
|
-
switch (
|
|
4806
|
+
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;
|
|
4807
|
+
return __generator(this, function (_j) {
|
|
4808
|
+
switch (_j.label) {
|
|
4809
4809
|
case 0:
|
|
4810
|
-
|
|
4810
|
+
_j.trys.push([0, 8, , 9]);
|
|
4811
4811
|
inputFields = options.userInput;
|
|
4812
4812
|
fieldsJsonData = bson_1.EJSON.parse(JSON.stringify(inputFields));
|
|
4813
4813
|
pageData = options.pageData;
|
|
@@ -4816,7 +4816,7 @@ function ValidateUserInput(options) {
|
|
|
4816
4816
|
mdb = options.mdb;
|
|
4817
4817
|
return [4 /*yield*/, db.collection('Company').findOne({ IsActive: true }, { projection: { "Setting.FiscalFrom": 1, "Setting.FiscalMonth": 1, "Setting.DateFormat": 1 } })];
|
|
4818
4818
|
case 1:
|
|
4819
|
-
fiscalSettingData =
|
|
4819
|
+
fiscalSettingData = _j.sent();
|
|
4820
4820
|
_settingData['FiscalMonth'] = ((_a = fiscalSettingData === null || fiscalSettingData === void 0 ? void 0 : fiscalSettingData.Setting) === null || _a === void 0 ? void 0 : _a.FiscalMonth) || 'Jan';
|
|
4821
4821
|
_settingData['FiscalFrom'] = ((_b = fiscalSettingData === null || fiscalSettingData === void 0 ? void 0 : fiscalSettingData.Setting) === null || _b === void 0 ? void 0 : _b.FiscalFrom) || 'Start';
|
|
4822
4822
|
_settingData['DateFormat'] = ((_c = fiscalSettingData === null || fiscalSettingData === void 0 ? void 0 : fiscalSettingData.Setting) === null || _c === void 0 ? void 0 : _c.DateFormat) || 'DD-MMM-YYYY';
|
|
@@ -4846,10 +4846,29 @@ function ValidateUserInput(options) {
|
|
|
4846
4846
|
break;
|
|
4847
4847
|
}
|
|
4848
4848
|
}
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4849
|
+
for (_d = 0, _e = pageData.Groups; _d < _e.length; _d++) {
|
|
4850
|
+
grp = _e[_d];
|
|
4851
|
+
if (grp.IsConditionalGroup) {
|
|
4852
|
+
_loop_19 = function (fld) {
|
|
4853
|
+
fld = JSON.parse(JSON.stringify(fld));
|
|
4854
|
+
var schemafld = schemaFields.find(function (x) { return x.Name == fld.Name; });
|
|
4855
|
+
fld.Schema = schemafld;
|
|
4856
|
+
msg = CheckConditionalGroup(grp, fld, fieldsJsonData);
|
|
4857
|
+
if (msg != "")
|
|
4858
|
+
return "break";
|
|
4859
|
+
};
|
|
4860
|
+
for (_f = 0, _g = grp.Fields; _f < _g.length; _f++) {
|
|
4861
|
+
fld = _g[_f];
|
|
4862
|
+
state_2 = _loop_19(fld);
|
|
4863
|
+
if (state_2 === "break")
|
|
4864
|
+
break;
|
|
4865
|
+
}
|
|
4866
|
+
}
|
|
4867
|
+
}
|
|
4868
|
+
_loop_20 = function (pageField) {
|
|
4869
|
+
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, _o, fieldData_2, obj;
|
|
4870
|
+
return __generator(this, function (_p) {
|
|
4871
|
+
switch (_p.label) {
|
|
4853
4872
|
case 0:
|
|
4854
4873
|
if (msg != "") {
|
|
4855
4874
|
return [2 /*return*/, "break"];
|
|
@@ -4895,7 +4914,7 @@ function ValidateUserInput(options) {
|
|
|
4895
4914
|
if (!(action === 'update' && (['edit', 'both'].includes(field.DisableON) || ['edit', 'both'].includes(field.HideON)))) return [3 /*break*/, 3];
|
|
4896
4915
|
return [4 /*yield*/, db.collection(objectName).findOne({ '_id': documentID })];
|
|
4897
4916
|
case 2:
|
|
4898
|
-
parentData =
|
|
4917
|
+
parentData = _p.sent();
|
|
4899
4918
|
oldValue = parentData[fieldName] != undefined ? parentData[fieldName] : null;
|
|
4900
4919
|
newValue = fieldData;
|
|
4901
4920
|
// Check if newValue is undefined
|
|
@@ -4913,7 +4932,7 @@ function ValidateUserInput(options) {
|
|
|
4913
4932
|
msg = "The field " + field.DisplayName + " was passed in the API request but is not allowed.";
|
|
4914
4933
|
return [2 /*return*/, "break"];
|
|
4915
4934
|
}
|
|
4916
|
-
|
|
4935
|
+
_p.label = 3;
|
|
4917
4936
|
case 3:
|
|
4918
4937
|
if (!(field.IsUnique == true)) return [3 /*break*/, 5];
|
|
4919
4938
|
if (!(field.UIDataType == "email" && fieldData)) return [3 /*break*/, 5];
|
|
@@ -4924,12 +4943,12 @@ function ValidateUserInput(options) {
|
|
|
4924
4943
|
}
|
|
4925
4944
|
return [4 /*yield*/, db.collection(objectSchema.Name).findOne(searchQuery)];
|
|
4926
4945
|
case 4:
|
|
4927
|
-
result =
|
|
4946
|
+
result = _p.sent();
|
|
4928
4947
|
if (result != null) {
|
|
4929
4948
|
msg = 'Email already exists for ' + field.DisplayName + '!';
|
|
4930
4949
|
return [2 /*return*/, "break"];
|
|
4931
4950
|
}
|
|
4932
|
-
|
|
4951
|
+
_p.label = 5;
|
|
4933
4952
|
case 5:
|
|
4934
4953
|
// Added by Shahzaib to check conditional field criteria
|
|
4935
4954
|
if (field.IsConditionalField) {
|
|
@@ -4941,8 +4960,8 @@ function ValidateUserInput(options) {
|
|
|
4941
4960
|
}
|
|
4942
4961
|
if (!inputField.includes(fieldName)) return [3 /*break*/, 57];
|
|
4943
4962
|
if (!(fieldData || fieldData === 0 || fieldData === false)) return [3 /*break*/, 57];
|
|
4944
|
-
|
|
4945
|
-
switch (
|
|
4963
|
+
_k = field.UIDataType;
|
|
4964
|
+
switch (_k) {
|
|
4946
4965
|
case 'int': return [3 /*break*/, 6];
|
|
4947
4966
|
case 'decimal': return [3 /*break*/, 7];
|
|
4948
4967
|
case 'date': return [3 /*break*/, 8];
|
|
@@ -5049,11 +5068,11 @@ function ValidateUserInput(options) {
|
|
|
5049
5068
|
dbConnection = (field.UseMasterDatabase && mdb) ? mdb : db;
|
|
5050
5069
|
return [4 /*yield*/, dbConnection.collection(field.LookupObject).findOne(searchObj)];
|
|
5051
5070
|
case 13:
|
|
5052
|
-
result =
|
|
5071
|
+
result = _p.sent();
|
|
5053
5072
|
if (result == null) {
|
|
5054
5073
|
msg = field.DisplayName + ' does not exist!';
|
|
5055
5074
|
}
|
|
5056
|
-
|
|
5075
|
+
_p.label = 14;
|
|
5057
5076
|
case 14: return [3 /*break*/, 57];
|
|
5058
5077
|
case 15:
|
|
5059
5078
|
if (!Array.isArray(fieldData)) return [3 /*break*/, 22];
|
|
@@ -5070,28 +5089,28 @@ function ValidateUserInput(options) {
|
|
|
5070
5089
|
;
|
|
5071
5090
|
return [4 /*yield*/, db.collection(field.LookupObject).find(searchObj).count()];
|
|
5072
5091
|
case 16:
|
|
5073
|
-
totalRecord =
|
|
5092
|
+
totalRecord = _p.sent();
|
|
5074
5093
|
if (!(objectName == "Activity" && field.Name == 'Attendees')) return [3 /*break*/, 18];
|
|
5075
|
-
|
|
5094
|
+
_l = totalRecord;
|
|
5076
5095
|
return [4 /*yield*/, db.collection('Contact').find(searchObj).count()];
|
|
5077
5096
|
case 17:
|
|
5078
|
-
totalRecord =
|
|
5079
|
-
|
|
5097
|
+
totalRecord = _l + _p.sent();
|
|
5098
|
+
_p.label = 18;
|
|
5080
5099
|
case 18:
|
|
5081
5100
|
if (totalRecord !== fieldData.length) {
|
|
5082
5101
|
msg = field.DisplayName + ' does not exist!';
|
|
5083
5102
|
}
|
|
5084
|
-
|
|
5103
|
+
_p.label = 19;
|
|
5085
5104
|
case 19: return [3 /*break*/, 21];
|
|
5086
5105
|
case 20:
|
|
5087
5106
|
if (field.IsRequired) {
|
|
5088
5107
|
msg = field.DisplayName + ' is required!';
|
|
5089
5108
|
}
|
|
5090
|
-
|
|
5109
|
+
_p.label = 21;
|
|
5091
5110
|
case 21: return [3 /*break*/, 23];
|
|
5092
5111
|
case 22:
|
|
5093
5112
|
msg = 'Invalid value for ' + field.DisplayName;
|
|
5094
|
-
|
|
5113
|
+
_p.label = 23;
|
|
5095
5114
|
case 23: return [3 /*break*/, 57];
|
|
5096
5115
|
case 24:
|
|
5097
5116
|
if (!(field.ListSchemaName !== undefined)) return [3 /*break*/, 27];
|
|
@@ -5099,13 +5118,13 @@ function ValidateUserInput(options) {
|
|
|
5099
5118
|
schemaData = null;
|
|
5100
5119
|
return [4 /*yield*/, db.collection('ListSchema').findOne({ Name: field.ListSchemaName })];
|
|
5101
5120
|
case 25:
|
|
5102
|
-
result =
|
|
5121
|
+
result = _p.sent();
|
|
5103
5122
|
if (result && result.Data)
|
|
5104
5123
|
schemaData = result.Data.find(function (x) { return x.Key == fieldData; });
|
|
5105
5124
|
if (schemaData == null || (action == 'add' && schemaData.IsActive == false)) {
|
|
5106
5125
|
msg = field.DisplayName + ' does not exist!';
|
|
5107
5126
|
}
|
|
5108
|
-
|
|
5127
|
+
_p.label = 26;
|
|
5109
5128
|
case 26: return [3 /*break*/, 29];
|
|
5110
5129
|
case 27:
|
|
5111
5130
|
if (!(field.LookupObject !== undefined && !field.IsMultipleLookupObject)) return [3 /*break*/, 29];
|
|
@@ -5120,11 +5139,11 @@ function ValidateUserInput(options) {
|
|
|
5120
5139
|
;
|
|
5121
5140
|
return [4 /*yield*/, db.collection(field.LookupObject).findOne(searchObj)];
|
|
5122
5141
|
case 28:
|
|
5123
|
-
result =
|
|
5142
|
+
result = _p.sent();
|
|
5124
5143
|
if (result == null) {
|
|
5125
5144
|
msg = field.DisplayName + ' does not exist!';
|
|
5126
5145
|
}
|
|
5127
|
-
|
|
5146
|
+
_p.label = 29;
|
|
5128
5147
|
case 29: return [3 /*break*/, 57];
|
|
5129
5148
|
case 30:
|
|
5130
5149
|
if (!Array.isArray(fieldData)) return [3 /*break*/, 38];
|
|
@@ -5134,7 +5153,7 @@ function ValidateUserInput(options) {
|
|
|
5134
5153
|
schemaData = [];
|
|
5135
5154
|
return [4 /*yield*/, db.collection('ListSchema').findOne({ Name: field.ListSchemaName })];
|
|
5136
5155
|
case 31:
|
|
5137
|
-
result =
|
|
5156
|
+
result = _p.sent();
|
|
5138
5157
|
if (result && result.Data) {
|
|
5139
5158
|
if (action == 'add')
|
|
5140
5159
|
schemaData = result.Data.filter(function (x) { return x.IsActive == true && fieldData.includes(x.Key.toString()); });
|
|
@@ -5144,7 +5163,7 @@ function ValidateUserInput(options) {
|
|
|
5144
5163
|
if (schemaData.length != fieldData.length) {
|
|
5145
5164
|
msg = field.DisplayName + ' does not exist!';
|
|
5146
5165
|
}
|
|
5147
|
-
|
|
5166
|
+
_p.label = 32;
|
|
5148
5167
|
case 32: return [3 /*break*/, 35];
|
|
5149
5168
|
case 33:
|
|
5150
5169
|
if (!(field.LookupObject !== undefined && !field.IsMultipleLookupObject)) return [3 /*break*/, 35];
|
|
@@ -5159,21 +5178,21 @@ function ValidateUserInput(options) {
|
|
|
5159
5178
|
;
|
|
5160
5179
|
return [4 /*yield*/, db.collection(field.LookupObject).find(searchObj).count()];
|
|
5161
5180
|
case 34:
|
|
5162
|
-
totalRecord =
|
|
5181
|
+
totalRecord = _p.sent();
|
|
5163
5182
|
if (totalRecord !== fieldData.length) {
|
|
5164
5183
|
msg = field.DisplayName + ' does not exist!';
|
|
5165
5184
|
}
|
|
5166
|
-
|
|
5185
|
+
_p.label = 35;
|
|
5167
5186
|
case 35: return [3 /*break*/, 37];
|
|
5168
5187
|
case 36:
|
|
5169
5188
|
if (field.IsRequired) {
|
|
5170
5189
|
msg = field.DisplayName + ' is required!';
|
|
5171
5190
|
}
|
|
5172
|
-
|
|
5191
|
+
_p.label = 37;
|
|
5173
5192
|
case 37: return [3 /*break*/, 39];
|
|
5174
5193
|
case 38:
|
|
5175
5194
|
msg = 'Invalid value for ' + field.DisplayName;
|
|
5176
|
-
|
|
5195
|
+
_p.label = 39;
|
|
5177
5196
|
case 39: return [3 /*break*/, 57];
|
|
5178
5197
|
case 40:
|
|
5179
5198
|
{
|
|
@@ -5203,8 +5222,8 @@ function ValidateUserInput(options) {
|
|
|
5203
5222
|
if (!Array.isArray(fieldData)) return [3 /*break*/, 46];
|
|
5204
5223
|
if (!fieldData.length) return [3 /*break*/, 44];
|
|
5205
5224
|
files = [];
|
|
5206
|
-
for (
|
|
5207
|
-
obj = fieldData_1[
|
|
5225
|
+
for (_m = 0, fieldData_1 = fieldData; _m < fieldData_1.length; _m++) {
|
|
5226
|
+
obj = fieldData_1[_m];
|
|
5208
5227
|
files.push(obj._id);
|
|
5209
5228
|
}
|
|
5210
5229
|
searchObj = { _id: { $in: files } };
|
|
@@ -5214,7 +5233,7 @@ function ValidateUserInput(options) {
|
|
|
5214
5233
|
;
|
|
5215
5234
|
return [4 /*yield*/, db.collection("Drive").find(searchObj).count()];
|
|
5216
5235
|
case 43:
|
|
5217
|
-
totalRecord =
|
|
5236
|
+
totalRecord = _p.sent();
|
|
5218
5237
|
if (totalRecord !== fieldData.length) {
|
|
5219
5238
|
msg = field.DisplayName + ' does not exist!';
|
|
5220
5239
|
}
|
|
@@ -5223,11 +5242,11 @@ function ValidateUserInput(options) {
|
|
|
5223
5242
|
if (field.IsRequired) {
|
|
5224
5243
|
msg = field.DisplayName + ' is required!';
|
|
5225
5244
|
}
|
|
5226
|
-
|
|
5245
|
+
_p.label = 45;
|
|
5227
5246
|
case 45: return [3 /*break*/, 47];
|
|
5228
5247
|
case 46:
|
|
5229
5248
|
msg = 'Invalid value for ' + field.DisplayName;
|
|
5230
|
-
|
|
5249
|
+
_p.label = 47;
|
|
5231
5250
|
case 47: return [3 /*break*/, 50];
|
|
5232
5251
|
case 48:
|
|
5233
5252
|
searchObj = { _id: fieldData };
|
|
@@ -5237,11 +5256,11 @@ function ValidateUserInput(options) {
|
|
|
5237
5256
|
;
|
|
5238
5257
|
return [4 /*yield*/, db.collection("Drive").findOne(searchObj)];
|
|
5239
5258
|
case 49:
|
|
5240
|
-
result =
|
|
5259
|
+
result = _p.sent();
|
|
5241
5260
|
if (result == null) {
|
|
5242
5261
|
msg = field.DisplayName + ' does not exist!';
|
|
5243
5262
|
}
|
|
5244
|
-
|
|
5263
|
+
_p.label = 50;
|
|
5245
5264
|
case 50: return [3 /*break*/, 57];
|
|
5246
5265
|
case 51:
|
|
5247
5266
|
{
|
|
@@ -5256,21 +5275,21 @@ function ValidateUserInput(options) {
|
|
|
5256
5275
|
return [3 /*break*/, 57];
|
|
5257
5276
|
case 52:
|
|
5258
5277
|
if (!fieldData.length) return [3 /*break*/, 56];
|
|
5259
|
-
|
|
5260
|
-
|
|
5278
|
+
_o = 0, fieldData_2 = fieldData;
|
|
5279
|
+
_p.label = 53;
|
|
5261
5280
|
case 53:
|
|
5262
|
-
if (!(
|
|
5263
|
-
obj = fieldData_2[
|
|
5281
|
+
if (!(_o < fieldData_2.length)) return [3 /*break*/, 56];
|
|
5282
|
+
obj = fieldData_2[_o];
|
|
5264
5283
|
return [4 /*yield*/, ValidateUserInput({ 'userInput': obj, 'pageData': pageData, 'objectID': documentID, 'db': db, 'collectionField': fieldName })];
|
|
5265
5284
|
case 54:
|
|
5266
|
-
validateResp =
|
|
5285
|
+
validateResp = _p.sent();
|
|
5267
5286
|
if (validateResp && validateResp != "") {
|
|
5268
5287
|
msg = validateResp;
|
|
5269
5288
|
return [3 /*break*/, 56];
|
|
5270
5289
|
}
|
|
5271
|
-
|
|
5290
|
+
_p.label = 55;
|
|
5272
5291
|
case 55:
|
|
5273
|
-
|
|
5292
|
+
_o++;
|
|
5274
5293
|
return [3 /*break*/, 53];
|
|
5275
5294
|
case 56: return [3 /*break*/, 57];
|
|
5276
5295
|
case 57: return [3 /*break*/, 59];
|
|
@@ -5279,24 +5298,24 @@ function ValidateUserInput(options) {
|
|
|
5279
5298
|
msg = fieldName + " is not valid schema!";
|
|
5280
5299
|
return [2 /*return*/, "break"];
|
|
5281
5300
|
}
|
|
5282
|
-
|
|
5301
|
+
_p.label = 59;
|
|
5283
5302
|
case 59: return [2 /*return*/];
|
|
5284
5303
|
}
|
|
5285
5304
|
});
|
|
5286
5305
|
};
|
|
5287
|
-
|
|
5288
|
-
|
|
5306
|
+
_h = 0, pageFields_1 = pageFields;
|
|
5307
|
+
_j.label = 2;
|
|
5289
5308
|
case 2:
|
|
5290
|
-
if (!(
|
|
5291
|
-
pageField = pageFields_1[
|
|
5292
|
-
return [5 /*yield**/,
|
|
5309
|
+
if (!(_h < pageFields_1.length)) return [3 /*break*/, 5];
|
|
5310
|
+
pageField = pageFields_1[_h];
|
|
5311
|
+
return [5 /*yield**/, _loop_20(pageField)];
|
|
5293
5312
|
case 3:
|
|
5294
|
-
|
|
5295
|
-
if (
|
|
5313
|
+
state_3 = _j.sent();
|
|
5314
|
+
if (state_3 === "break")
|
|
5296
5315
|
return [3 /*break*/, 5];
|
|
5297
|
-
|
|
5316
|
+
_j.label = 4;
|
|
5298
5317
|
case 4:
|
|
5299
|
-
|
|
5318
|
+
_h++;
|
|
5300
5319
|
return [3 /*break*/, 2];
|
|
5301
5320
|
case 5:
|
|
5302
5321
|
if (msg != "") {
|
|
@@ -5305,17 +5324,17 @@ function ValidateUserInput(options) {
|
|
|
5305
5324
|
if (!(objectName == 'City')) return [3 /*break*/, 7];
|
|
5306
5325
|
return [4 /*yield*/, db.collection("Country").findOne({ '_id': inputFields.CountryID, 'IsActive': true })];
|
|
5307
5326
|
case 6:
|
|
5308
|
-
countryData =
|
|
5327
|
+
countryData = _j.sent();
|
|
5309
5328
|
if (countryData) {
|
|
5310
5329
|
inputFields.CountryName = countryData.Name;
|
|
5311
5330
|
}
|
|
5312
5331
|
else {
|
|
5313
5332
|
msg = "Invalid country code!";
|
|
5314
5333
|
}
|
|
5315
|
-
|
|
5334
|
+
_j.label = 7;
|
|
5316
5335
|
case 7: return [2 /*return*/, msg];
|
|
5317
5336
|
case 8:
|
|
5318
|
-
err_3 =
|
|
5337
|
+
err_3 = _j.sent();
|
|
5319
5338
|
console.log("Error in ValidateUserInput", err_3);
|
|
5320
5339
|
return [3 /*break*/, 9];
|
|
5321
5340
|
case 9: return [2 /*return*/];
|
|
@@ -5929,3 +5948,40 @@ function CheckExistingDocument(existingDoc, action, userVersion) {
|
|
|
5929
5948
|
return 'success'; // Indicates success
|
|
5930
5949
|
}
|
|
5931
5950
|
exports.CheckExistingDocument = CheckExistingDocument;
|
|
5951
|
+
/**
|
|
5952
|
+
* TODO: Check conditional group criteria with user inputs
|
|
5953
|
+
*
|
|
5954
|
+
* @param {string} group contains ConditionalAction
|
|
5955
|
+
* @param {object} field Contains shcema
|
|
5956
|
+
* @param {object} record contains user inputs
|
|
5957
|
+
* @return message in string
|
|
5958
|
+
*/
|
|
5959
|
+
function CheckConditionalGroup(group, field, record) {
|
|
5960
|
+
try {
|
|
5961
|
+
var msg = '';
|
|
5962
|
+
var fieldData = record[field.Name];
|
|
5963
|
+
if (record != undefined && eval(group.ConditionalExpression) == true) {
|
|
5964
|
+
switch (group.ConditionalAction) {
|
|
5965
|
+
case "hide-group":
|
|
5966
|
+
if (fieldData && field.Schema.UIDataType !== "location") {
|
|
5967
|
+
msg = ((field.DisplayName || field.Schema.DisplayName) || field.Name) + ' is in a hidden group and should not contain value.';
|
|
5968
|
+
}
|
|
5969
|
+
break;
|
|
5970
|
+
}
|
|
5971
|
+
}
|
|
5972
|
+
else {
|
|
5973
|
+
switch (group.ConditionalAction) {
|
|
5974
|
+
case "show-group":
|
|
5975
|
+
if (fieldData && field.Schema.UIDataType !== "location") {
|
|
5976
|
+
msg = ((field.DisplayName || field.Schema.DisplayName) || field.Name) + ' is in a hidden group and should not contain value.';
|
|
5977
|
+
}
|
|
5978
|
+
break;
|
|
5979
|
+
}
|
|
5980
|
+
}
|
|
5981
|
+
return msg;
|
|
5982
|
+
}
|
|
5983
|
+
catch (error) {
|
|
5984
|
+
console.error("Internal Error in CheckConditionalGroup Function : ", error);
|
|
5985
|
+
return '';
|
|
5986
|
+
}
|
|
5987
|
+
}
|
package/package.json
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@optimiser/common",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"compile": "tsc",
|
|
8
|
-
"push": "tsc && npm version patch -git-tag-version false && npm publish"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"dist/*"
|
|
12
|
-
],
|
|
13
|
-
"author": "",
|
|
14
|
-
"license": "ISC",
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"@types/geoip-lite": "^1.4.0",
|
|
17
|
-
"@types/promise.allsettled": "^1.0.3",
|
|
18
|
-
"@types/request": "^2.48.5",
|
|
19
|
-
"@types/sanitize-html": "^2.11.0",
|
|
20
|
-
"@types/sequelize": "^4.28.9",
|
|
21
|
-
"@types/unzipper": "^0.10.3",
|
|
22
|
-
"@types/uuid": "^8.3.0",
|
|
23
|
-
"aws-sdk": "^2.786.0",
|
|
24
|
-
"axios": "^0.21.4",
|
|
25
|
-
"bson": "^4.2.0",
|
|
26
|
-
"exceljs": "^4.3.0",
|
|
27
|
-
"express": "^4.17.1",
|
|
28
|
-
"express-validator": "^6.9.2",
|
|
29
|
-
"firebase-admin": "^12.0.0",
|
|
30
|
-
"geoip-lite": "^1.4.2",
|
|
31
|
-
"google-libphonenumber": "^3.2.30",
|
|
32
|
-
"ioredis": "^4.17.3",
|
|
33
|
-
"libphonenumber-js": "^1.9.51",
|
|
34
|
-
"moment": "^2.25.3",
|
|
35
|
-
"moment-timezone": "^0.5.27",
|
|
36
|
-
"mongo-sanitize": "^1.1.0",
|
|
37
|
-
"mongodb": "^3.6.2",
|
|
38
|
-
"nodemailer": "^6.4.11",
|
|
39
|
-
"promise.allsettled": "^1.0.2",
|
|
40
|
-
"qrcode": "^1.5.3",
|
|
41
|
-
"request": "^2.88.2",
|
|
42
|
-
"sanitize-html": "^2.13.0",
|
|
43
|
-
"sequelize": "^6.3.5",
|
|
44
|
-
"typescript": "^5.3.3",
|
|
45
|
-
"unzipper": "^0.10.11",
|
|
46
|
-
"uuid": "^8.3.1"
|
|
47
|
-
},
|
|
48
|
-
"devDependencies": {
|
|
49
|
-
"@types/aws-sdk": "^2.7.0",
|
|
50
|
-
"@types/bson": "^4.0.2",
|
|
51
|
-
"@types/exceljs": "^1.3.0",
|
|
52
|
-
"@types/express": "^4.17.8",
|
|
53
|
-
"@types/ioredis": "^4.17.4",
|
|
54
|
-
"@types/moment": "^2.13.0",
|
|
55
|
-
"@types/moment-timezone": "^0.5.30",
|
|
56
|
-
"@types/mongodb": "^3.5.27",
|
|
57
|
-
"@types/nodemailer": "^6.4.0"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@optimiser/common",
|
|
3
|
+
"version": "1.0.425",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"compile": "tsc",
|
|
8
|
+
"push": "tsc && npm version patch -git-tag-version false && npm publish"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/*"
|
|
12
|
+
],
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@types/geoip-lite": "^1.4.0",
|
|
17
|
+
"@types/promise.allsettled": "^1.0.3",
|
|
18
|
+
"@types/request": "^2.48.5",
|
|
19
|
+
"@types/sanitize-html": "^2.11.0",
|
|
20
|
+
"@types/sequelize": "^4.28.9",
|
|
21
|
+
"@types/unzipper": "^0.10.3",
|
|
22
|
+
"@types/uuid": "^8.3.0",
|
|
23
|
+
"aws-sdk": "^2.786.0",
|
|
24
|
+
"axios": "^0.21.4",
|
|
25
|
+
"bson": "^4.2.0",
|
|
26
|
+
"exceljs": "^4.3.0",
|
|
27
|
+
"express": "^4.17.1",
|
|
28
|
+
"express-validator": "^6.9.2",
|
|
29
|
+
"firebase-admin": "^12.0.0",
|
|
30
|
+
"geoip-lite": "^1.4.2",
|
|
31
|
+
"google-libphonenumber": "^3.2.30",
|
|
32
|
+
"ioredis": "^4.17.3",
|
|
33
|
+
"libphonenumber-js": "^1.9.51",
|
|
34
|
+
"moment": "^2.25.3",
|
|
35
|
+
"moment-timezone": "^0.5.27",
|
|
36
|
+
"mongo-sanitize": "^1.1.0",
|
|
37
|
+
"mongodb": "^3.6.2",
|
|
38
|
+
"nodemailer": "^6.4.11",
|
|
39
|
+
"promise.allsettled": "^1.0.2",
|
|
40
|
+
"qrcode": "^1.5.3",
|
|
41
|
+
"request": "^2.88.2",
|
|
42
|
+
"sanitize-html": "^2.13.0",
|
|
43
|
+
"sequelize": "^6.3.5",
|
|
44
|
+
"typescript": "^5.3.3",
|
|
45
|
+
"unzipper": "^0.10.11",
|
|
46
|
+
"uuid": "^8.3.1"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/aws-sdk": "^2.7.0",
|
|
50
|
+
"@types/bson": "^4.0.2",
|
|
51
|
+
"@types/exceljs": "^1.3.0",
|
|
52
|
+
"@types/express": "^4.17.8",
|
|
53
|
+
"@types/ioredis": "^4.17.4",
|
|
54
|
+
"@types/moment": "^2.13.0",
|
|
55
|
+
"@types/moment-timezone": "^0.5.30",
|
|
56
|
+
"@types/mongodb": "^3.5.27",
|
|
57
|
+
"@types/nodemailer": "^6.4.0"
|
|
58
|
+
}
|
|
59
|
+
}
|