@optimiser/common 1.0.376 → 1.0.378

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.
@@ -102,6 +102,7 @@ var cryptoService = __importStar(require("../utility/crypto"));
102
102
  var countrycode_1 = require("./countrycode");
103
103
  require("moment-timezone");
104
104
  var helper_1 = require("./helper");
105
+ var sanitize_html_1 = __importDefault(require("sanitize-html"));
105
106
  var sanitize = require('mongo-sanitize');
106
107
  var phoneUtil = require("google-libphonenumber").PhoneNumberUtil.getInstance();
107
108
  var qrcode = require('qrcode');
@@ -4783,6 +4784,9 @@ function ValidateUserInput(options) {
4783
4784
  if (field.DisableValidateUserInput) {
4784
4785
  return [2 /*return*/, "continue"];
4785
4786
  }
4787
+ if (IsStringValue(fieldData)) { //sanitizing Html
4788
+ fieldData = (0, sanitize_html_1.default)(fieldData);
4789
+ }
4786
4790
  if ((field.UIDataType == 'date' || field.UIDataType == 'datetime') && IsStringValue(fieldData) && fieldData.trim() == '') {
4787
4791
  inputFields[fieldName] = null;
4788
4792
  }
@@ -4810,8 +4814,12 @@ function ValidateUserInput(options) {
4810
4814
  return [4 /*yield*/, db.collection(objectName).findOne({ '_id': documentID })];
4811
4815
  case 2:
4812
4816
  parentData = _k.sent();
4813
- oldValue = parentData[fieldName];
4817
+ oldValue = parentData[fieldName] || null;
4814
4818
  newValue = fieldData;
4819
+ // Check if newValue is undefined
4820
+ if (newValue === undefined) {
4821
+ return [2 /*return*/, "break"];
4822
+ }
4815
4823
  isSame = false;
4816
4824
  if (field.UIDataType == 'multiselect' || field.UIDataType == 'multilookup') {
4817
4825
  isSame = IsEqualArrays(oldValue, newValue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimiser/common",
3
- "version": "1.0.376",
3
+ "version": "1.0.378",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -16,6 +16,7 @@
16
16
  "@types/geoip-lite": "^1.4.0",
17
17
  "@types/promise.allsettled": "^1.0.3",
18
18
  "@types/request": "^2.48.5",
19
+ "@types/sanitize-html": "^2.11.0",
19
20
  "@types/sequelize": "^4.28.9",
20
21
  "@types/unzipper": "^0.10.3",
21
22
  "@types/uuid": "^8.3.0",
@@ -38,6 +39,7 @@
38
39
  "promise.allsettled": "^1.0.2",
39
40
  "qrcode": "^1.5.3",
40
41
  "request": "^2.88.2",
42
+ "sanitize-html": "^2.13.0",
41
43
  "sequelize": "^6.3.5",
42
44
  "typescript": "^5.3.3",
43
45
  "unzipper": "^0.10.11",