drapcode-utility 1.5.7 → 1.5.9
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/build/format-fields/index.js +23 -8
- package/build/utils/util.d.ts +1 -1
- package/build/utils/util.js +7 -1
- package/package.json +3 -3
|
@@ -115,7 +115,7 @@ var cleanXssValuesFromData = function (data, fields) {
|
|
|
115
115
|
try {
|
|
116
116
|
if (fields) {
|
|
117
117
|
fields.forEach(function (field) {
|
|
118
|
-
if (
|
|
118
|
+
if ([drapcode_constant_1.FieldTypes.large_text.id, drapcode_constant_1.FieldTypes.markdown.id].includes(field.type))
|
|
119
119
|
exceptionFields.push(field.fieldName);
|
|
120
120
|
});
|
|
121
121
|
}
|
|
@@ -138,15 +138,30 @@ var processXssData = function (item, exceptionFields) {
|
|
|
138
138
|
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
|
|
139
139
|
var fieldName = keys_1[_i];
|
|
140
140
|
if (!exceptionFields.includes(fieldName)) {
|
|
141
|
-
|
|
142
|
-
item[fieldName] = item[fieldName].map(function (val) {
|
|
143
|
-
return domPurify.sanitize(val);
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
else
|
|
147
|
-
item[fieldName] = domPurify.sanitize(item[fieldName]);
|
|
141
|
+
item[fieldName] = sanitizeFieldValue(item[fieldName]);
|
|
148
142
|
}
|
|
149
143
|
}
|
|
150
144
|
}
|
|
151
145
|
return item;
|
|
152
146
|
};
|
|
147
|
+
var sanitizeFieldValue = function (value) {
|
|
148
|
+
if (value) {
|
|
149
|
+
if (Array.isArray(value)) {
|
|
150
|
+
value = value.map(function (val) { return sanitizeFieldValue(val); });
|
|
151
|
+
}
|
|
152
|
+
else if (typeof value === 'object' && value !== null) {
|
|
153
|
+
var tempItem = value;
|
|
154
|
+
var itemKeys = Object.keys(tempItem);
|
|
155
|
+
if (itemKeys.length) {
|
|
156
|
+
for (var _i = 0, itemKeys_1 = itemKeys; _i < itemKeys_1.length; _i++) {
|
|
157
|
+
var key = itemKeys_1[_i];
|
|
158
|
+
tempItem[key] = domPurify.sanitize(tempItem[key]);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
value = tempItem;
|
|
162
|
+
}
|
|
163
|
+
else
|
|
164
|
+
value = domPurify.sanitize(value);
|
|
165
|
+
}
|
|
166
|
+
return value;
|
|
167
|
+
};
|
package/build/utils/util.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare const arraysEqual: (array1: any, array2: any) => boolean;
|
|
|
20
20
|
export declare const convertItemToArray: (itemValue: any) => any[];
|
|
21
21
|
export declare const validateAlphanumericString: (str: string) => false | "String should contain only numbers and letters";
|
|
22
22
|
export declare const formatCustomCSSClasses: (customClasses: any) => string;
|
|
23
|
-
export declare const replaceDataValueIntoExpression: (expression: string, data: any, user: any, tenant: any, sessionValue: any, envConstants: any, sessionFormValue: any, localStorageValue: any, cookiesValue: any) => string;
|
|
23
|
+
export declare const replaceDataValueIntoExpression: (expression: string, data: any, user: any, tenant: any, userSetting: any, sessionValue: any, envConstants: any, sessionFormValue: any, localStorageValue: any, cookiesValue: any) => string;
|
|
24
24
|
export declare const parseJsonString: (str: string) => any;
|
|
25
25
|
export declare const parseValueFromData: (data: any, fieldName: string) => any;
|
|
26
26
|
export declare const unflattenObject: (obj: any) => {};
|
package/build/utils/util.js
CHANGED
|
@@ -291,7 +291,7 @@ var formatCustomCSSClasses = function (customClasses) {
|
|
|
291
291
|
return projectCustomCSSClassesData;
|
|
292
292
|
};
|
|
293
293
|
exports.formatCustomCSSClasses = formatCustomCSSClasses;
|
|
294
|
-
var replaceDataValueIntoExpression = function (expression, data, user, tenant, sessionValue, envConstants, sessionFormValue, localStorageValue, cookiesValue) {
|
|
294
|
+
var replaceDataValueIntoExpression = function (expression, data, user, tenant, userSetting, sessionValue, envConstants, sessionFormValue, localStorageValue, cookiesValue) {
|
|
295
295
|
var _a;
|
|
296
296
|
var contentList = (_a = expression
|
|
297
297
|
.match(/{{(.*?)}}/g)) === null || _a === void 0 ? void 0 : _a.map(function (b) { return b.replace(/{{(.*?)}}/g, "$1"); });
|
|
@@ -310,6 +310,12 @@ var replaceDataValueIntoExpression = function (expression, data, user, tenant, s
|
|
|
310
310
|
dataOfItem = (0, exports.parseValueFromData)(tenant, prop);
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
|
+
else if (prop.includes("current_settings")) {
|
|
314
|
+
prop = prop.replace("current_settings.", "");
|
|
315
|
+
if (Object.keys(userSetting).length > 0) {
|
|
316
|
+
dataOfItem = (0, exports.parseValueFromData)(userSetting, prop);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
313
319
|
else if (prop.includes("current_session")) {
|
|
314
320
|
prop = prop.replace("current_session.", "");
|
|
315
321
|
if (Object.keys(sessionValue).length > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drapcode-utility",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@types/voca": "^1.4.2",
|
|
38
38
|
"axios": "^1.1.2",
|
|
39
39
|
"dompurify": "^3.1.7",
|
|
40
|
-
"drapcode-constant": "^1.4.
|
|
41
|
-
"drapcode-logger": "^1.1.
|
|
40
|
+
"drapcode-constant": "^1.4.9",
|
|
41
|
+
"drapcode-logger": "^1.1.9",
|
|
42
42
|
"drapcode-redis": "^1.0.6",
|
|
43
43
|
"exiftool-vendored": "^28.2.1",
|
|
44
44
|
"express": "^4.17.1",
|