neo.mjs 4.0.68 → 4.0.71
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/package.json +1 -1
- package/src/data/RecordFactory.mjs +13 -7
package/package.json
CHANGED
@@ -228,11 +228,12 @@ class RecordFactory extends Base {
|
|
228
228
|
* @returns {*}
|
229
229
|
*/
|
230
230
|
parseRecordValue(record, field, value, recordConfig=null) {
|
231
|
-
let
|
231
|
+
let fieldName = field.name,
|
232
|
+
mapping = field.mapping,
|
232
233
|
maxLength = field.maxLength,
|
233
234
|
minLength = field.minLength,
|
234
235
|
nullable = field.nullable,
|
235
|
-
oldValue = recordConfig?.[
|
236
|
+
oldValue = recordConfig?.[fieldName] || record[fieldName],
|
236
237
|
type = field.type?.toLowerCase();
|
237
238
|
|
238
239
|
// only trigger mappings for initial values
|
@@ -246,22 +247,22 @@ class RecordFactory extends Base {
|
|
246
247
|
}
|
247
248
|
|
248
249
|
if (Object.hasOwn(field, 'maxLength')) {
|
249
|
-
if (value?.toString() > maxLength) {
|
250
|
-
console.warn(`Setting record field: ${
|
250
|
+
if (value?.toString().length > maxLength) {
|
251
|
+
console.warn(`Setting record field: ${fieldName} value: ${value} conflicts with maxLength: ${maxLength}`);
|
251
252
|
return oldValue;
|
252
253
|
}
|
253
254
|
}
|
254
255
|
|
255
256
|
if (Object.hasOwn(field, 'minLength')) {
|
256
|
-
if (value?.toString() < minLength) {
|
257
|
-
console.warn(`Setting record field: ${
|
257
|
+
if (value?.toString().length < minLength) {
|
258
|
+
console.warn(`Setting record field: ${fieldName} value: ${value} conflicts with minLength: ${minLength}`);
|
258
259
|
return oldValue;
|
259
260
|
}
|
260
261
|
}
|
261
262
|
|
262
263
|
if (Object.hasOwn(field, 'nullable')) {
|
263
264
|
if (nullable === false && value === null) {
|
264
|
-
console.warn(`Setting record field: ${
|
265
|
+
console.warn(`Setting record field: ${fieldName} value: ${value} conflicts with nullable: ${nullable}`);
|
265
266
|
return oldValue;
|
266
267
|
}
|
267
268
|
}
|
@@ -270,6 +271,11 @@ class RecordFactory extends Base {
|
|
270
271
|
return new Date(value);
|
271
272
|
}
|
272
273
|
|
274
|
+
if (type === 'string' && value !== null) {
|
275
|
+
value = value + '';
|
276
|
+
value = value.replace(/(<([^>]+)>)/ig, '');
|
277
|
+
}
|
278
|
+
|
273
279
|
return value;
|
274
280
|
}
|
275
281
|
|