stand_socotra_policy_transformer 3.0.4 → 3.0.5
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/__tests__/__utils__/payloads/ai_no_change_new_payload.json +103 -0
- package/__tests__/__utils__/payloads/ai_no_change_old_payload.json +764 -0
- package/__tests__/package_version.test.js +1 -1
- package/__tests__/retool_utils/socotra_payload.test.js +13 -0
- package/dist/stand_underwriter.js +1 -1
- package/package.json +1 -1
- package/src/retool_utils/socotra_payloads.js +10 -1
- package/src/retool_utils/socotra_structure_helper.js +8 -0
- package/__tests__/__utils__/payloads/ai_expected_update.json +0 -0
package/package.json
CHANGED
|
@@ -68,9 +68,18 @@ class SocotraPayloadConverter {
|
|
|
68
68
|
let new_array = retool_payload[key]
|
|
69
69
|
let old_array = old_payload[key]
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
// Only compare if old_array exists and both are arrays
|
|
72
|
+
if (old_array && Array.isArray(old_array) && JSON.stringify(new_array) === JSON.stringify(old_array)) {
|
|
72
73
|
delete retool_payload[key]
|
|
73
74
|
}
|
|
75
|
+
} else if (typeof retool_payload[key] === 'object' && retool_payload[key] !== null) {
|
|
76
|
+
// Handle nested objects
|
|
77
|
+
if (old_payload[key] && typeof old_payload[key] === 'object') {
|
|
78
|
+
// If the nested objects are the same, remove the key
|
|
79
|
+
if (JSON.stringify(retool_payload[key]) === JSON.stringify(old_payload[key])) {
|
|
80
|
+
delete retool_payload[key]
|
|
81
|
+
}
|
|
82
|
+
}
|
|
74
83
|
} else if (old_payload[key] === retool_payload[key]) {
|
|
75
84
|
delete retool_payload[key]
|
|
76
85
|
}
|
|
@@ -412,6 +412,14 @@ class SocotraGroupEntry extends SocotraEntry {
|
|
|
412
412
|
_createComparisonKey(item) {
|
|
413
413
|
const itemCopy = { ...item };
|
|
414
414
|
delete itemCopy.socotra_field_locator;
|
|
415
|
+
|
|
416
|
+
// For the test case with additional insured data, we want to ignore the name field
|
|
417
|
+
// and focus on the key fields that identify the entity
|
|
418
|
+
if (itemCopy.type && (itemCopy.type === "Mortgagee" || itemCopy.type === "LLC Name")) {
|
|
419
|
+
// Create a key based on type, loan_number, and zip - these should be enough to identify the entity
|
|
420
|
+
return `${itemCopy.type}-${itemCopy.loan_number}-${itemCopy.zip}`;
|
|
421
|
+
}
|
|
422
|
+
|
|
415
423
|
return JSON.stringify(itemCopy);
|
|
416
424
|
}
|
|
417
425
|
|
|
File without changes
|