@optimiser/common 1.0.429 → 1.0.431
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/utility.js +11 -5
- package/package.json +2 -1
package/dist/lib/utility.js
CHANGED
|
@@ -106,6 +106,7 @@ var sanitize_html_1 = __importDefault(require("sanitize-html"));
|
|
|
106
106
|
var sanitize = require('mongo-sanitize');
|
|
107
107
|
var phoneUtil = require("google-libphonenumber").PhoneNumberUtil.getInstance();
|
|
108
108
|
var qrcode = require('qrcode');
|
|
109
|
+
var convert = require('html-to-text').convert;
|
|
109
110
|
var _settingData = {};
|
|
110
111
|
function GetObjectByKeyValueFromList(list, key, val) {
|
|
111
112
|
if (list && list.length > 0) {
|
|
@@ -4909,7 +4910,7 @@ function ValidateUserInput(options) {
|
|
|
4909
4910
|
}
|
|
4910
4911
|
}
|
|
4911
4912
|
_loop_20 = function (pageField) {
|
|
4912
|
-
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, _p, fieldData_2, obj;
|
|
4913
|
+
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;
|
|
4913
4914
|
return __generator(this, function (_q) {
|
|
4914
4915
|
switch (_q.label) {
|
|
4915
4916
|
case 0:
|
|
@@ -4920,6 +4921,7 @@ function ValidateUserInput(options) {
|
|
|
4920
4921
|
fieldData = inputFields[fieldName];
|
|
4921
4922
|
if (pageField.IsDisplayOnly) {
|
|
4922
4923
|
delete inputFields[pageField.Name];
|
|
4924
|
+
return [2 /*return*/, "continue"];
|
|
4923
4925
|
}
|
|
4924
4926
|
field = schemaFields.find(function (x) { return x.Name == fieldName; });
|
|
4925
4927
|
if (!field) return [3 /*break*/, 60];
|
|
@@ -5051,10 +5053,10 @@ function ValidateUserInput(options) {
|
|
|
5051
5053
|
msg = 'Invalid value for ' + field.DisplayName + '!';
|
|
5052
5054
|
}
|
|
5053
5055
|
else if (minValue !== undefined && minValue !== null && fieldData < minValue) {
|
|
5054
|
-
msg = field.DisplayName + ' value must be greater
|
|
5056
|
+
msg = field.DisplayName + ' value must be greater than or equal to ' + minValue;
|
|
5055
5057
|
}
|
|
5056
5058
|
else if (maxValue !== undefined && maxValue !== null && maxValue < fieldData) {
|
|
5057
|
-
msg = field.DisplayName + ' value must be smaller
|
|
5059
|
+
msg = field.DisplayName + ' value must be smaller than or equal to ' + maxValue;
|
|
5058
5060
|
}
|
|
5059
5061
|
}
|
|
5060
5062
|
return [3 /*break*/, 59];
|
|
@@ -5335,9 +5337,13 @@ function ValidateUserInput(options) {
|
|
|
5335
5337
|
return [3 /*break*/, 59];
|
|
5336
5338
|
case 53:
|
|
5337
5339
|
{
|
|
5338
|
-
// Maxlength check;
|
|
5340
|
+
// Maxlength check;
|
|
5341
|
+
if (field.UIDataType === 'texteditor') {
|
|
5342
|
+
text = convert(fieldData, { wordwrap: false });
|
|
5343
|
+
fieldData = text.replace(/\n/g, ' ').trim();
|
|
5344
|
+
}
|
|
5339
5345
|
if (field.MaxLength !== undefined && field.MaxLength !== null && fieldData.length > field.MaxLength) {
|
|
5340
|
-
msg = field.DisplayName + ' can not be greater
|
|
5346
|
+
msg = field.DisplayName + ' can not be greater than ' + field.MaxLength + ' characters!';
|
|
5341
5347
|
}
|
|
5342
5348
|
if (!IsStringValue(fieldData)) {
|
|
5343
5349
|
msg = 'Invalid value for ' + field.DisplayName;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optimiser/common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.431",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"firebase-admin": "^12.0.0",
|
|
30
30
|
"geoip-lite": "^1.4.2",
|
|
31
31
|
"google-libphonenumber": "^3.2.30",
|
|
32
|
+
"html-to-text": "^8.2.0",
|
|
32
33
|
"ioredis": "^4.17.3",
|
|
33
34
|
"libphonenumber-js": "^1.9.51",
|
|
34
35
|
"moment": "^2.25.3",
|