@optimiser/common 1.0.381 → 1.0.383

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 +11 -24
  2. package/package.json +1 -1
@@ -1860,7 +1860,7 @@ function CheckDataBeforeAdd(updateObj, objectSchema, db) {
1860
1860
  switch (_c.label) {
1861
1861
  case 0:
1862
1862
  fieldSchema = objectSchema.Fields.find(function (x) { return x.Name == fldName; });
1863
- if (!fieldSchema) return [3 /*break*/, 9];
1863
+ if (!fieldSchema) return [3 /*break*/, 7];
1864
1864
  cityfield = void 0;
1865
1865
  if (fieldSchema.LookupObject == "City") {
1866
1866
  cityfield = updateObj[fldName];
@@ -1901,14 +1901,7 @@ function CheckDataBeforeAdd(updateObj, objectSchema, db) {
1901
1901
  if (fieldSchema.UIDataType == 'formula')
1902
1902
  delete updateObj[fldName];
1903
1903
  _c.label = 7;
1904
- case 7:
1905
- // QPC-9020 for State and Country Field Server Side Validation
1906
- return [4 /*yield*/, ValidateStateCountryField(fieldSchema, updateObj, fldName, objectSchema, db, cityfield)];
1907
- case 8:
1908
- // QPC-9020 for State and Country Field Server Side Validation
1909
- _c.sent();
1910
- _c.label = 9;
1911
- case 9: return [2 /*return*/];
1904
+ case 7: return [2 /*return*/];
1912
1905
  }
1913
1906
  });
1914
1907
  };
@@ -1944,10 +1937,10 @@ function CheckDataBeforeUpdate(updateObj, objectData, objectSchema, db) {
1944
1937
  case 0:
1945
1938
  if (!(fldName == '_id')) return [3 /*break*/, 1];
1946
1939
  delete updateObj[fldName];
1947
- return [3 /*break*/, 7];
1940
+ return [3 /*break*/, 5];
1948
1941
  case 1:
1949
1942
  fieldSchema = objectSchema.Fields.find(function (x) { return x.Name == fldName; });
1950
- if (!fieldSchema) return [3 /*break*/, 7];
1943
+ if (!fieldSchema) return [3 /*break*/, 5];
1951
1944
  cityfield = void 0;
1952
1945
  if (fieldSchema.LookupObject == "City") {
1953
1946
  cityfield = updateObj[fldName];
@@ -1975,14 +1968,7 @@ function CheckDataBeforeUpdate(updateObj, objectData, objectSchema, db) {
1975
1968
  case 4:
1976
1969
  _c.sent();
1977
1970
  _c.label = 5;
1978
- case 5:
1979
- // QPC-9020 for State and Country Field Server Side Validation
1980
- return [4 /*yield*/, ValidateStateCountryField(fieldSchema, updateObj, fldName, objectSchema, db, cityfield)];
1981
- case 6:
1982
- // QPC-9020 for State and Country Field Server Side Validation
1983
- _c.sent();
1984
- _c.label = 7;
1985
- case 7: return [2 /*return*/];
1971
+ case 5: return [2 /*return*/];
1986
1972
  }
1987
1973
  });
1988
1974
  };
@@ -4803,13 +4789,14 @@ function ValidateUserInput(options) {
4803
4789
  }
4804
4790
  field = schemaFields.find(function (x) { return x.Name == fieldName; });
4805
4791
  if (!field) return [3 /*break*/, 58];
4806
- if (field.DisableValidateUserInput) {
4807
- return [2 /*return*/, "continue"];
4808
- }
4809
- if (IsStringValue(fieldData)) { //sanitizing Html
4792
+ //sanitizing Html and added IgnoreSanitizeHtml condition so that it can be ignored for certain fields
4793
+ if (!field.IgnoreSanitizeHtml && IsStringValue(fieldData)) {
4810
4794
  inputFields[fieldName] = (0, sanitize_html_1.default)(fieldData);
4811
4795
  fieldData = inputFields[fieldName];
4812
4796
  }
4797
+ if (field.DisableValidateUserInput) {
4798
+ return [2 /*return*/, "continue"];
4799
+ }
4813
4800
  if ((field.UIDataType == 'date' || field.UIDataType == 'datetime') && IsStringValue(fieldData) && fieldData.trim() == '') {
4814
4801
  inputFields[fieldName] = null;
4815
4802
  }
@@ -5690,7 +5677,7 @@ function ValidateStateCountryField(fieldSchema, updateObj, fldName, objectSchema
5690
5677
  case 0:
5691
5678
  if (!((fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.LookupObject) === 'City')) return [3 /*break*/, 3];
5692
5679
  if (!cityfield) return [3 /*break*/, 2];
5693
- return [4 /*yield*/, db.collection('City').findOne({ _id: updateObj[fldName] })];
5680
+ return [4 /*yield*/, db.collection('City').findOne({ _id: cityfield })];
5694
5681
  case 1:
5695
5682
  cityDocument = _a.sent();
5696
5683
  if (cityDocument) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimiser/common",
3
- "version": "1.0.381",
3
+ "version": "1.0.383",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {