@orbit/record-cache
Advanced tools
Comparing version 0.16.0-beta.4 to 0.16.0-beta.5
@@ -53,14 +53,26 @@ 'use strict'; | ||
Object.keys(replacement.relationships).forEach(field => { | ||
let currentData = (0, _utils.deepGet)(current, ['relationships', field, 'data']); | ||
let data = (0, _utils.deepGet)(replacement, ['relationships', field, 'data']); | ||
let relationshipMatch; | ||
if ((0, _utils.isArray)(data)) { | ||
relationshipMatch = (0, _data.equalRecordIdentitySets)(currentData, data); | ||
} else { | ||
relationshipMatch = (0, _data.equalRecordIdentities)(currentData, data); | ||
if (data !== undefined) { | ||
let currentData = (0, _utils.deepGet)(current, ['relationships', field, 'data']); | ||
let relationshipChanged; | ||
if ((0, _utils.isArray)(data)) { | ||
if (currentData) { | ||
relationshipChanged = !(0, _data.equalRecordIdentitySets)(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = []; | ||
} | ||
} else { | ||
if (currentData) { | ||
relationshipChanged = !(0, _data.equalRecordIdentities)(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = null; | ||
} | ||
} | ||
if (relationshipChanged) { | ||
changed = true; | ||
(0, _utils.deepSet)(result, ['relationships', field, 'data'], currentData); | ||
} | ||
} | ||
if (!relationshipMatch) { | ||
changed = true; | ||
(0, _utils.deepSet)(result, ['relationships', field, 'data'], currentData === undefined ? null : currentData); | ||
} | ||
}); | ||
@@ -167,2 +179,2 @@ } | ||
}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9wZXJhdG9ycy9hc3luYy1pbnZlcnNlLXBhdGNoLW9wZXJhdG9ycy5qcyJdLCJuYW1lcyI6WyJBc3luY0ludmVyc2VQYXRjaE9wZXJhdG9ycyIsImFkZFJlY29yZCIsImNhY2hlIiwib3AiLCJ0eXBlIiwiaWQiLCJyZWNvcmQiLCJjdXJyZW50IiwiZ2V0UmVjb3JkQXN5bmMiLCJ1cGRhdGVSZWNvcmQiLCJyZXB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tcbiAgICAgICAgICAgICAgICAgICAgb3A6ICd1cGRhdGVSZWNvcmQnLFxuICAgICAgICAgICAgICAgICAgICByZWNvcmQ6IGN1cnJlbnRcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlbW92ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIGFzeW5jIHVwZGF0ZVJlY29yZChjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IGF3YWl0IGNhY2hlLmdldFJlY29yZEFzeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGNvbnN0IHJlcGxhY2VtZW50ID0gb3AucmVjb3JkO1xuICAgICAgICBjb25zdCB7IHR5cGUsIGlkIH0gPSByZXBsYWNlbWVudDtcbiAgICAgICAgaWYgKGN1cnJlbnQpIHtcbiAgICAgICAgICAgIGxldCByZXN1bHQgPSB7IHR5cGUsIGlkIH07XG4gICAgICAgICAgICBsZXQgY2hhbmdlZCA9IGZhbHNlO1xuICAgICAgICAgICAgWydhdHRyaWJ1dGVzJywgJ2tleXMnXS5mb3JFYWNoKGdyb3VwaW5nID0+IHtcbiAgICAgICAgICAgICAgICBpZiAocmVwbGFjZW1lbnRbZ3JvdXBpbmddKSB7XG4gICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKHJlcGxhY2VtZW50W2dyb3VwaW5nXSkuZm9yRWFjaChmaWVsZCA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgdmFsdWUgPSByZXBsYWNlbWVudFtncm91cGluZ11bZmllbGRdO1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGN1cnJlbnRWYWx1ZSA9IGRlZXBHZXQoY3VycmVudCwgW2dyb3VwaW5nLCBmaWVsZF0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlcSh2YWx1ZSwgY3VycmVudFZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZXBTZXQocmVzdWx0LCBbZ3JvdXBpbmcsIGZpZWxkXSwgY3VycmVudFZhbHVlID09PSB1bmRlZmluZWQgPyBudWxsIDogY3VycmVudFZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBpZiAocmVwbGFjZW1lbnQucmVsYXRpb25zaGlwcykge1xuICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKHJlcGxhY2VtZW50LnJlbGF0aW9uc2hpcHMpLmZvckVhY2goZmllbGQgPT4ge1xuICAgICAgICAgICAgICAgICAgICBsZXQgY3VycmVudERhdGEgPSBkZWVwR2V0KGN1cnJlbnQsIFsncmVsYXRpb25zaGlwcycsIGZpZWxkLCAnZGF0YSddKTtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGEgPSBkZWVwR2V0KHJlcGxhY2VtZW50LCBbJ3JlbGF0aW9uc2hpcHMnLCBmaWVsZCwgJ2RhdGEnXSk7XG4gICAgICAgICAgICAgICAgICAgIGxldCByZWxhdGlvbnNoaXBNYXRjaDtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzQXJyYXkoZGF0YSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcE1hdGNoID0gZXF1YWxSZWNvcmRJZGVudGl0eVNldHMoY3VycmVudERhdGEsIGRhdGEpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwTWF0Y2ggPSBlcXVhbFJlY29yZElkZW50aXRpZXMoY3VycmVudERhdGEsIGRhdGEpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGlmICghcmVsYXRpb25zaGlwTWF0Y2gpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgZGVlcFNldChyZXN1bHQsIFsncmVsYXRpb25zaGlwcycsIGZpZWxkLCAnZGF0YSddLCBjdXJyZW50RGF0YSA9PT0gdW5kZWZpbmVkID8gbnVsbCA6IGN1cnJlbnREYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGNoYW5nZWQpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICBvcDogJ3VwZGF0ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgICAgIHJlY29yZDogcmVzdWx0XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgb3A6ICdyZW1vdmVSZWNvcmQnLFxuICAgICAgICAgICAgICAgIHJlY29yZDogeyB0eXBlLCBpZCB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICBhc3luYyByZW1vdmVSZWNvcmQoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IGN1cnJlbnQgPSBhd2FpdCBjYWNoZS5nZXRSZWNvcmRBc3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBpZiAoY3VycmVudCkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ2FkZFJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiBjdXJyZW50XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICBhc3luYyByZXBsYWNlS2V5KGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCB7IGtleSB9ID0gb3A7XG4gICAgICAgIGNvbnN0IHJlY29yZCA9IGF3YWl0IGNhY2hlLmdldFJlY29yZEFzeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGNvbnN0IGN1cnJlbnQgPSByZWNvcmQgJiYgZGVlcEdldChyZWNvcmQsIFsna2V5cycsIGtleV0pO1xuICAgICAgICBpZiAoIWVxKGN1cnJlbnQsIG9wLnZhbHVlKSkge1xuICAgICAgICAgICAgY29uc3QgeyB0eXBlLCBpZCB9ID0gb3AucmVjb3JkO1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlcGxhY2VLZXknLFxuICAgICAgICAgICAgICAgIHJlY29yZDogeyB0eXBlLCBpZCB9LFxuICAgICAgICAgICAgICAgIGtleSxcbiAgICAgICAgICAgICAgICB2YWx1ZTogY3VycmVudFxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH0sXG4gICAgYXN5bmMgcmVwbGFjZUF0dHJpYnV0ZShjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgeyBhdHRyaWJ1dGUgfSA9IG9wO1xuICAgICAgICBjb25zdCByZWNvcmQgPSBhd2FpdCBjYWNoZS5nZXRSZWNvcmRBc3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBjb25zdCBjdXJyZW50ID0gcmVjb3JkICYmIGRlZXBHZXQocmVjb3JkLCBbJ2F0dHJpYnV0ZXMnLCBhdHRyaWJ1dGVdKTtcbiAgICAgICAgaWYgKCFlcShjdXJyZW50LCBvcC52YWx1ZSkpIHtcbiAgICAgICAgICAgIGNvbnN0IHsgdHlwZSwgaWQgfSA9IG9wLnJlY29yZDtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgb3A6ICdyZXBsYWNlQXR0cmlidXRlJyxcbiAgICA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WNvcmRBc3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBpZiAoY3VycmVudCkge1xuICAgICAgICAgICAgaWYgKGVxKGN1cnJlbnQsIG9wLnJlY29yZCkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgIG9wOiAndXBkYXRlUmVjb3JkJyxcbiAgICAgICAgICAgICAgICAgICAgcmVjb3JkOiBjdXJyZW50XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgb3A6ICdyZW1vdmVSZWNvcmQnLFxuICAgICAgICAgICAgICAgIHJlY29yZDogeyB0eXBlLCBpZCB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICBhc3luYyB1cGRhdGVSZWNvcmQoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IGN1cnJlbnQgPSBhd2FpdCBjYWNoZS5nZXRSZWNvcmRBc3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBjb25zdCByZXBsYWNlbWVudCA9IG9wLnJlY29yZDtcbiAgICAgICAgY29uc3QgeyB0eXBlLCBpZCB9ID0gcmVwbGFjZW1lbnQ7XG4gICAgICAgIGlmIChjdXJyZW50KSB7XG4gICAgICAgICAgICBsZXQgcmVzdWx0ID0geyB0eXBlLCBpZCB9O1xuICAgICAgICAgICAgbGV0IGNoYW5nZWQgPSBmYWxzZTtcbiAgICAgICAgICAgIFsnYXR0cmlidXRlcycsICdrZXlzJ10uZm9yRWFjaChncm91cGluZyA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKHJlcGxhY2VtZW50W2dyb3VwaW5nXSkge1xuICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhyZXBsYWNlbWVudFtncm91cGluZ10pLmZvckVhY2goZmllbGQgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHZhbHVlID0gcmVwbGFjZW1lbnRbZ3JvdXBpbmddW2ZpZWxkXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBjdXJyZW50VmFsdWUgPSBkZWVwR2V0KGN1cnJlbnQsIFtncm91cGluZywgZmllbGRdKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZXEodmFsdWUsIGN1cnJlbnRWYWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWVwU2V0KHJlc3VsdCwgW2dyb3VwaW5nLCBmaWVsZF0sIGN1cnJlbnRWYWx1ZSA9PT0gdW5kZWZpbmVkID8gbnVsbCA6IGN1cnJlbnRWYWx1ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgaWYgKHJlcGxhY2VtZW50LnJlbGF0aW9uc2hpcHMpIHtcbiAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhyZXBsYWNlbWVudC5yZWxhdGlvbnNoaXBzKS5mb3JFYWNoKGZpZWxkID0+IHtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGEgPSBkZWVwR2V0KHJlcGxhY2VtZW50LCBbJ3JlbGF0aW9uc2hpcHMnLCBmaWVsZCwgJ2RhdGEnXSk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChkYXRhICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBjdXJyZW50RGF0YSA9IGRlZXBHZXQoY3VycmVudCwgWydyZWxhdGlvbnNoaXBzJywgZmllbGQsICdkYXRhJ10pO1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHJlbGF0aW9uc2hpcENoYW5nZWQ7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNBcnJheShkYXRhKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXJyZW50RGF0YSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXBDaGFuZ2VkID0gIWVxdWFsUmVjb3JkSWRlbnRpdHlTZXRzKGN1cnJlbnREYXRhLCBkYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXBDaGFuZ2VkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudERhdGEgPSBbXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXJyZW50RGF0YSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXBDaGFuZ2VkID0gIWVxdWFsUmVjb3JkSWRlbnRpdGllcyhjdXJyZW50RGF0YSwgZGF0YSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwQ2hhbmdlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnREYXRhID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVsYXRpb25zaGlwQ2hhbmdlZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZXBTZXQocmVzdWx0LCBbJ3JlbGF0aW9uc2hpcHMnLCBmaWVsZCwgJ2RhdGEnXSwgY3VycmVudERhdGEpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoY2hhbmdlZCkge1xuICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgIG9wOiAndXBkYXRlUmVjb3JkJyxcbiAgICAgICAgICAgICAgICAgICAgcmVjb3JkOiByZXN1bHRcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlbW92ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIGFzeW5jIHJlbW92ZVJlY29yZChjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IGF3YWl0IGNhY2hlLmdldFJlY29yZEFzeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGlmIChjdXJyZW50KSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAnYWRkUmVjb3JkJyxcbiAgICAgICAgICAgICAgICByZWNvcmQ6IGN1cnJlbnRcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIGFzeW5jIHJlcGxhY2VLZXkoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IHsga2V5IH0gPSBvcDtcbiAgICAgICAgY29uc3QgcmVjb3JkID0gYXdhaXQgY2FjaGUuZ2V0UmVjb3JkQXN5bmMob3AucmVjb3JkKTtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IHJlY29yZCAmJiBkZWVwR2V0KHJlY29yZCwgWydrZXlzJywga2V5XSk7XG4gICAgICAgIGlmICghZXEoY3VycmVudCwgb3AudmFsdWUpKSB7XG4gICAgICAgICAgICBjb25zdCB7IHR5cGUsIGlkIH0gPSBvcC5yZWNvcmQ7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAncmVwbGFjZUtleScsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH0sXG4gICAgICAgICAgICAgICAga2V5LFxuICAgICAgICAgICAgICAgIHZhbHVlOiBjdXJyZW50XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICBhc3luYyByZXBsYWNlQXR0cmlidXRlKGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCB7IGF0dHJpYnV0ZSB9ID0gb3A7XG4gICAgICAgIGNvbnN0IHJlY29yZCA9IGF3YWl0IGNhY2hlLmdldFJlY29yZEFzeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGNvbnN0IGN1cnJlbnQgPSByZWNvcmQgJiYgZGVlcEdldChyZWNvcmQsIFsnYXR0cmlidXRlcycsIGF0dHJpYnV0ZV0pO1xuICAgICAgICBpZiAoIWVxKGN1cnJlbnQsIG9wLnZhbHVlKSkge1xuICAgICAgICAgICAgY29uc3QgeyB0eXBlLCBpZCB9ID0gb3AucmVjb3JkO1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlcGxhY2VBdHRyaWJ1dGUnLFxuICAgICAgICAgICAgICAgIHJlY29yZDogeyB0eXBlLCBpZCB9LFxuICAgICAgICAgICAgICAgIGF0dHJpYnV0ZSxcbiAgICAgICAgICAgICAgICB2YWx1ZTogY3VycmVudFxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH0sXG4gICAgYXN5bmMgYWRkVG9SZWxhdGVkUmVjb3JkcyhjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3Q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yhyZWNvcmQsIHJlbGF0aW9uc2hpcCk7XG4gICAgICAgIGlmIChjdXJyZW50UmVsYXRlZFJlY29yZCA9PT0gdW5kZWZpbmVkIHx8ICFlcXVhbFJlY29yZElkZW50aXRpZXMoY3VycmVudFJlbGF0ZWRSZWNvcmQsIHJlbGF0ZWRSZWNvcmQpKSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAncmVwbGFjZVJlbGF0ZWRSZWNvcmQnLFxuICAgICAgICAgICAgICAgIHJlY29yZCxcbiAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXAsXG4gICAgICAgICAgICAgICAgcmVsYXRlZFJlY29yZDogY3VycmVudFJlbGF0ZWRSZWNvcmQgfHwgbnVsbFxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH1cbn07Il19 |
@@ -53,14 +53,26 @@ 'use strict'; | ||
Object.keys(replacement.relationships).forEach(field => { | ||
let currentData = (0, _utils.deepGet)(current, ['relationships', field, 'data']); | ||
let data = (0, _utils.deepGet)(replacement, ['relationships', field, 'data']); | ||
let relationshipMatch; | ||
if ((0, _utils.isArray)(data)) { | ||
relationshipMatch = (0, _data.equalRecordIdentitySets)(currentData, data); | ||
} else { | ||
relationshipMatch = (0, _data.equalRecordIdentities)(currentData, data); | ||
if (data !== undefined) { | ||
let currentData = (0, _utils.deepGet)(current, ['relationships', field, 'data']); | ||
let relationshipChanged; | ||
if ((0, _utils.isArray)(data)) { | ||
if (currentData) { | ||
relationshipChanged = !(0, _data.equalRecordIdentitySets)(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = []; | ||
} | ||
} else { | ||
if (currentData) { | ||
relationshipChanged = !(0, _data.equalRecordIdentities)(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = null; | ||
} | ||
} | ||
if (relationshipChanged) { | ||
changed = true; | ||
(0, _utils.deepSet)(result, ['relationships', field, 'data'], currentData); | ||
} | ||
} | ||
if (!relationshipMatch) { | ||
changed = true; | ||
(0, _utils.deepSet)(result, ['relationships', field, 'data'], currentData === undefined ? null : currentData); | ||
} | ||
}); | ||
@@ -167,2 +179,2 @@ } | ||
}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9wZXJhdG9ycy9zeW5jLWludmVyc2UtcGF0Y2gtb3BlcmF0b3JzLmpzIl0sIm5hbWVzIjpbIlN5bmNJbnZlcnNlUGF0Y2hPcGVyYXRvcnMiLCJhZGRSZWNvcmQiLCJjYWNoZSIsIm9wIiwidHlwZSIsImlkIiwicmVjb3JkIiwiY3VycmVudCIsImdldFJlY29yZFN5bmMiLCJ1cGRhdGVSZWNvcmQiLCJyZXBsYWNlbWVudCIsInJlc3VsdCIsImNoYW5nZWQiLCJmb3JFYWNoIiwiZ3JvdXBpbmciLCJPYmplY3QiLCJrZXlzIiwiZmllbGQiLCJ2YWx1ZSIsImN1cnJlbnRWYWx1ZSIsInVuZGVmaW5lZCIsInJlbGF0aW9uc2hpcHMiLCJjdXJyZW50RGF0YSIsImRhdGEiLCJyZWxhdGlvbnNoaXBNYXRjaCIsInJlbW92ZVJlY29yZCIsInJlcGxhY2VLZXkiLCJrZXkiLCJyZXBsYWNlQXR0cmlidXRlIiwiYXR0cmlidXRlIiwiYWRkVG9SZWxhdGVkUmVjb3JkcyIsInJlbGF0aW9uc2hpcCIsInJlbGF0ZWRSZWNvcmQiLCJjdXJyZW50UmVsYXRlZFJlY29yZHMiLCJnZXRSZWxhdGVkUmVjb3Jkc1N5bmMiLCJyZW1vdmVGcm9tUmVsYXRlZFJlY29yZHMiLCJyZXBsYWNlUmVsYXRlZFJlY29yZHMiLCJyZWxhdGVkUmVjb3JkcyIsInJlcGxhY2VSZWxhdGVkUmVjb3JkIiwiY3VycmVudFJlbGF0ZWRSZWNvcmQiLCJnZXRSZWxhdGVkUmVjb3JkU3luYyJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUF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3AucmVjb3JkKTtcbiAgICAgICAgaWYgKGN1cnJlbnQpIHtcbiAgICAgICAgICAgIGlmIChlcShjdXJyZW50LCBvcC5yZWNvcmQpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICBvcDogJ3VwZGF0ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgICAgIHJlY29yZDogY3VycmVudFxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAncmVtb3ZlUmVjb3JkJyxcbiAgICAgICAgICAgICAgICByZWNvcmQ6IHsgdHlwZSwgaWQgfVxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH0sXG4gICAgdXBkYXRlUmVjb3JkKGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCBjdXJyZW50ID0gY2FjaGUuZ2V0UmVjb3JkU3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBjb25zdCByZXBsYWNlbWVudCA9IG9wLnJlY29yZDtcbiAgICAgICAgY29uc3QgeyB0eXBlLCBpZCB9ID0gcmVwbGFjZW1lbnQ7XG4gICAgICAgIGlmIChjdXJyZW50KSB7XG4gICAgICAgICAgICBsZXQgcmVzdWx0ID0geyB0eXBlLCBpZCB9O1xuICAgICAgICAgICAgbGV0IGNoYW5nZWQgPSBmYWxzZTtcbiAgICAgICAgICAgIFsnYXR0cmlidXRlcycsICdrZXlzJ10uZm9yRWFjaChncm91cGluZyA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKHJlcGxhY2VtZW50W2dyb3VwaW5nXSkge1xuICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhyZXBsYWNlbWVudFtncm91cGluZ10pLmZvckVhY2goZmllbGQgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHZhbHVlID0gcmVwbGFjZW1lbnRbZ3JvdXBpbmddW2ZpZWxkXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBjdXJyZW50VmFsdWUgPSBkZWVwR2V0KGN1cnJlbnQsIFtncm91cGluZywgZmllbGRdKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZXEodmFsdWUsIGN1cnJlbnRWYWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWVwU2V0KHJlc3VsdCwgW2dyb3VwaW5nLCBmaWVsZF0sIGN1cnJlbnRWYWx1ZSA9PT0gdW5kZWZpbmVkID8gbnVsbCA6IGN1cnJlbnRWYWx1ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgaWYgKHJlcGxhY2VtZW50LnJlbGF0aW9uc2hpcHMpIHtcbiAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhyZXBsYWNlbWVudC5yZWxhdGlvbnNoaXBzKS5mb3JFYWNoKGZpZWxkID0+IHtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGN1cnJlbnREYXRhID0gZGVlcEdldChjdXJyZW50LCBbJ3JlbGF0aW9uc2hpcHMnLCBmaWVsZCwgJ2RhdGEnXSk7XG4gICAgICAgICAgICAgICAgICAgIGxldCBkYXRhID0gZGVlcEdldChyZXBsYWNlbWVudCwgWydyZWxhdGlvbnNoaXBzJywgZmllbGQsICdkYXRhJ10pO1xuICAgICAgICAgICAgICAgICAgICBsZXQgcmVsYXRpb25zaGlwTWF0Y2g7XG4gICAgICAgICAgICAgICAgICAgIGlmIChpc0FycmF5KGRhdGEpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXBNYXRjaCA9IGVxdWFsUmVjb3JkSWRlbnRpdHlTZXRzKGN1cnJlbnREYXRhLCBkYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcE1hdGNoID0gZXF1YWxSZWNvcmRJZGVudGl0aWVzKGN1cnJlbnREYXRhLCBkYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpZiAoIXJlbGF0aW9uc2hpcE1hdGNoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlZXBTZXQocmVzdWx0LCBbJ3JlbGF0aW9uc2hpcHMnLCBmaWVsZCwgJ2RhdGEnXSwgY3VycmVudERhdGEgPT09IHVuZGVmaW5lZCA/IG51bGwgOiBjdXJyZW50RGF0YSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjaGFuZ2VkKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgICAgb3A6ICd1cGRhdGVSZWNvcmQnLFxuICAgICAgICAgICAgICAgICAgICByZWNvcmQ6IHJlc3VsdFxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAncmVtb3ZlUmVjb3JkJyxcbiAgICAgICAgICAgICAgICByZWNvcmQ6IHsgdHlwZSwgaWQgfVxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH0sXG4gICAgcmVtb3ZlUmVjb3JkKGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCBjdXJyZW50ID0gY2FjaGUuZ2V0UmVjb3JkU3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBpZiAoY3VycmVudCkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ2FkZFJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiBjdXJyZW50XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICByZXBsYWNlS2V5KGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCB7IGtleSB9ID0gb3A7XG4gICAgICAgIGNvbnN0IHJlY29yZCA9IGNhY2hlLmdldFJlY29yZFN5bmMob3AucmVjb3JkKTtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IHJlY29yZCAmJiBkZWVwR2V0KHJlY29yZCwgWydrZXlzJywga2V5XSk7XG4gICAgICAgIGlmICghZXEoY3VycmVudCwgb3AudmFsdWUpKSB7XG4gICAgICAgICAgICBjb25zdCB7IHR5cGUsIGlkIH0gPSBvcC5yZWNvcmQ7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAncmVwbGFjZUtleScsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH0sXG4gICAgICAgICAgICAgICAga2V5LFxuICAgICAgICAgICAgICAgIHZhbHVlOiBjdXJyZW50XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICByZXBsYWNlQXR0cmlidXRlKGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCB7IGF0dHJpYnV0ZSB9ID0gb3A7XG4gICAgICAgIGNvbnN0IHJlY29yZCA9IGNhY2hlLmdldFJlY29yZFN5bmMob3AucmVjb3JkKTtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IHJlY29yZCAmJiBkZWVwR2V0KHJlY29yZCwgWydhdHRyaWJ1dGVzJywgYXR0cmlidXRlXSk7XG4gICAgICAgIGlmICghZXEoY3VycmVudCwgb3AudmFsdWUpKSB7XG4gICAgICAgICAgICBjb25zdCB7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FJlbGF0ZWRSZWNvcmRzIHx8IFtdXG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICByZXBsYWNlUmVsYXRlZFJlY29yZChjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgeyByZWNvcmQsIHJlbGF0aW9uc2hpcCwgcmVsYXRlZFJlY29yZCB9ID0gb3A7XG4gICAgICAgIGNvbnN0IGN1cnJlbnRSZWxhdGVkUmVjb3JkID0gY2FjaGUuZ2V0UmVsYXRlZFJlY29yZFN5bmMocmVjb3JkLCByZWxhdGlvbnNoaXApO1xuICAgICAgICBpZiAoY3VycmVudFJlbGF0ZWRSZWNvcmQgPT09IHVuZGVmaW5lZCB8fCAhZXF1YWxSZWNvcmRJZGVudGl0aWVzKGN1cnJlbnRSZWxhdGVkUmVjb3JkLCByZWxhdGVkUmVjb3JkKSkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlcGxhY2VSZWxhdGVkUmVjb3JkJyxcbiAgICAgICAgICAgICAgICByZWNvcmQsXG4gICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwLFxuICAgICAgICAgICAgICAgIHJlbGF0ZWRSZWNvcmQ6IGN1cnJlbnRSZWxhdGVkUmVjb3JkIHx8IG51bGxcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9XG59OyJdfQ== | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9wZXJhdG9ycy9zeW5jLWludmVyc2UtcGF0Y2gtb3BlcmF0b3JzLmpzIl0sIm5hbWVzIjpbIlN5bmNJbnZlcnNlUGF0Y2hPcGVyYXRvcnMiLCJhZGRSZWNvcmQiLCJjYWNoZSIsIm9wIiwidHlwZSIsImlkIiwicmVjb3JkIiwiY3VycmVudCIsImdldFJlY29yZFN5bmMiLCJ1cGRhdGVSZWNvcmQiLCJyZXBsYWNlbWVudCIsInJlc3Vs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gcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgICAgb3A6ICd1cGRhdGVSZWNvcmQnLFxuICAgICAgICAgICAgICAgICAgICByZWNvcmQ6IGN1cnJlbnRcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlbW92ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIHVwZGF0ZVJlY29yZChjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IGNhY2hlLmdldFJlY29yZFN5bmMob3AucmVjb3JkKTtcbiAgICAgICAgY29uc3QgcmVwbGFjZW1lbnQgPSBvcC5yZWNvcmQ7XG4gICAgICAgIGNvbnN0IHsgdHlwZSwgaWQgfSA9IHJlcGxhY2VtZW50O1xuICAgICAgICBpZiAoY3VycmVudCkge1xuICAgICAgICAgICAgbGV0IHJlc3VsdCA9IHsgdHlwZSwgaWQgfTtcbiAgICAgICAgICAgIGxldCBjaGFuZ2VkID0gZmFsc2U7XG4gICAgICAgICAgICBbJ2F0dHJpYnV0ZXMnLCAna2V5cyddLmZvckVhY2goZ3JvdXBpbmcgPT4ge1xuICAgICAgICAgICAgICAgIGlmIChyZXBsYWNlbWVudFtncm91cGluZ10pIHtcbiAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMocmVwbGFjZW1lbnRbZ3JvdXBpbmddKS5mb3JFYWNoKGZpZWxkID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB2YWx1ZSA9IHJlcGxhY2VtZW50W2dyb3VwaW5nXVtmaWVsZF07XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgY3VycmVudFZhbHVlID0gZGVlcEdldChjdXJyZW50LCBbZ3JvdXBpbmcsIGZpZWxkXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWVxKHZhbHVlLCBjdXJyZW50VmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbmdlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVlcFNldChyZXN1bHQsIFtncm91cGluZywgZmllbGRdLCBjdXJyZW50VmFsdWUgPT09IHVuZGVmaW5lZCA/IG51bGwgOiBjdXJyZW50VmFsdWUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGlmIChyZXBsYWNlbWVudC5yZWxhdGlvbnNoaXBzKSB7XG4gICAgICAgICAgICAgICAgT2JqZWN0LmtleXMocmVwbGFjZW1lbnQucmVsYXRpb25zaGlwcykuZm9yRWFjaChmaWVsZCA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGxldCBkYXRhID0gZGVlcEdldChyZXBsYWNlbWVudCwgWydyZWxhdGlvbnNoaXBzJywgZmllbGQsICdkYXRhJ10pO1xuICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgY3VycmVudERhdGEgPSBkZWVwR2V0KGN1cnJlbnQsIFsncmVsYXRpb25zaGlwcycsIGZpZWxkLCAnZGF0YSddKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCByZWxhdGlvbnNoaXBDaGFuZ2VkO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlzQXJyYXkoZGF0YSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3VycmVudERhdGEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwQ2hhbmdlZCA9ICFlcXVhbFJlY29yZElkZW50aXR5U2V0cyhjdXJyZW50RGF0YSwgZGF0YSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwQ2hhbmdlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnREYXRhID0gW107XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3VycmVudERhdGEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwQ2hhbmdlZCA9ICFlcXVhbFJlY29yZElkZW50aXRpZXMoY3VycmVudERhdGEsIGRhdGEpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcENoYW5nZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW50RGF0YSA9IG51bGw7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlbGF0aW9uc2hpcENoYW5nZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWVwU2V0KHJlc3VsdCwgWydyZWxhdGlvbnNoaXBzJywgZmllbGQsICdkYXRhJ10sIGN1cnJlbnREYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGNoYW5nZWQpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICBvcDogJ3VwZGF0ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgICAgIHJlY29yZDogcmVzdWx0XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgb3A6ICdyZW1vdmVSZWNvcmQnLFxuICAgICAgICAgICAgICAgIHJlY29yZDogeyB0eXBlLCBpZCB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICByZW1vdmVSZWNvcmQoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IGN1cnJlbnQgPSBjYWNoZS5nZXRSZWNvcmRTeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGlmIChjdXJyZW50KSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAnYWRkUmVjb3JkJyxcbiAgICAgICAgICAgICAgICByZWNvcmQ6IGN1cnJlbnRcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIHJlcGxhY2VLZXkoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IHsga2V5IH0gPSBvcDtcbiAgICAgICAgY29uc3QgcmVjb3JkID0gY2FjaGUuZ2V0UmVjb3JkU3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBjb25zdCBjdXJyZW50ID0gcmVjb3JkICYmIGRlZXBHZXQocmVjb3JkLCBbJ2tleXMnLCBrZXldKTtcbiAgICAgICAgaWYgKCFlcShjdXJyZW50LCBvcC52YWx1ZSkpIHtcbiAgICAgICAgICAgIGNvbnN0IHsgdHlwZSwgaWQgfSA9IG9wLnJlY29yZDtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgb3A6ICdyZXBsYWNlS2V5JyxcbiAgICAgICAgICAgICAgICByZWNvcmQ6IHs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GlvbnNoaXAsXG4gICAgICAgICAgICAgICAgcmVsYXRlZFJlY29yZDogY3VycmVudFJlbGF0ZWRSZWNvcmQgfHwgbnVsbFxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH1cbn07Il19 |
@@ -58,14 +58,26 @@ 'use strict'; | ||
Object.keys(replacement.relationships).forEach(function (field) { | ||
var currentData = (0, _utils.deepGet)(current, ['relationships', field, 'data']); | ||
var data = (0, _utils.deepGet)(replacement, ['relationships', field, 'data']); | ||
var relationshipMatch = void 0; | ||
if ((0, _utils.isArray)(data)) { | ||
relationshipMatch = (0, _data.equalRecordIdentitySets)(currentData, data); | ||
} else { | ||
relationshipMatch = (0, _data.equalRecordIdentities)(currentData, data); | ||
if (data !== undefined) { | ||
var currentData = (0, _utils.deepGet)(current, ['relationships', field, 'data']); | ||
var relationshipChanged = void 0; | ||
if ((0, _utils.isArray)(data)) { | ||
if (currentData) { | ||
relationshipChanged = !(0, _data.equalRecordIdentitySets)(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = []; | ||
} | ||
} else { | ||
if (currentData) { | ||
relationshipChanged = !(0, _data.equalRecordIdentities)(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = null; | ||
} | ||
} | ||
if (relationshipChanged) { | ||
changed = true; | ||
(0, _utils.deepSet)(result, ['relationships', field, 'data'], currentData); | ||
} | ||
} | ||
if (!relationshipMatch) { | ||
changed = true; | ||
(0, _utils.deepSet)(result, ['relationships', field, 'data'], currentData === undefined ? null : currentData); | ||
} | ||
}); | ||
@@ -192,2 +204,2 @@ } | ||
}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9wZXJhdG9ycy9hc3luYy1pbnZlcnNlLXBhdGNoLW9wZXJhdG9ycy5qcyJdLCJuYW1lcyI6WyJBc3luY0ludmVyc2VQYXRjaE9wZXJhdG9ycyIsIm9wIiwiY3VycmVudCIsImNhY2hl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HJldHVybjtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgICAgb3A6ICd1cGRhdGVSZWNvcmQnLFxuICAgICAgICAgICAgICAgICAgICByZWNvcmQ6IGN1cnJlbnRcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlbW92ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIGFzeW5jIHVwZGF0ZVJlY29yZChjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IGF3YWl0IGNhY2hlLmdldFJlY29yZEFzeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGNvbnN0IHJlcGxhY2VtZW50ID0gb3AucmVjb3JkO1xuICAgICAgICBjb25zdCB7IHR5cGUsIGlkIH0gPSByZXBsYWNlbWVudDtcbiAgICAgICAgaWYgKGN1cnJlbnQpIHtcbiAgICAgICAgICAgIGxldCByZXN1bHQgPSB7IHR5cGUsIGlkIH07XG4gICAgICAgICAgICBsZXQgY2hhbmdlZCA9IGZhbHNlO1xuICAgICAgICAgICAgWydhdHRyaWJ1dGVzJywgJ2tleXMnXS5mb3JFYWNoKGdyb3VwaW5nID0+IHtcbiAgICAgICAgICAgICAgICBpZiAocmVwbGFjZW1lbnRbZ3JvdXBpbmddKSB7XG4gICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKHJlcGxhY2VtZW50W2dyb3VwaW5nXSkuZm9yRWFjaChmaWVsZCA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgdmFsdWUgPSByZXBsYWNlbWVudFtncm91cGluZ11bZmllbGRdO1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGN1cnJlbnRWYWx1ZSA9IGRlZXBHZXQoY3VycmVudCwgW2dyb3VwaW5nLCBmaWVsZF0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlcSh2YWx1ZSwgY3VycmVudFZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZXBTZXQocmVzdWx0LCBbZ3JvdXBpbmcsIGZpZWxkXSwgY3VycmVudFZhbHVlID09PSB1bmRlZmluZWQgPyBudWxsIDogY3VycmVudFZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBpZiAocmVwbGFjZW1lbnQucmVsYXRpb25zaGlwcykge1xuICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKHJlcGxhY2VtZW50LnJlbGF0aW9uc2hpcHMpLmZvckVhY2goZmllbGQgPT4ge1xuICAgICAgICAgICAgICAgICAgICBsZXQgY3VycmVudERhdGEgPSBkZWVwR2V0KGN1cnJlbnQsIFsncmVsYXRpb25zaGlwcycsIGZpZWxkLCAnZGF0YSddKTtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGEgPSBkZWVwR2V0KHJlcGxhY2VtZW50LCBbJ3JlbGF0aW9uc2hpcHMnLCBmaWVsZCwgJ2RhdGEnXSk7XG4gICAgICAgICAgICAgICAgICAgIGxldCByZWxhdGlvbnNoaXBNYXRjaDtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzQXJyYXkoZGF0YSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcE1hdGNoID0gZXF1YWxSZWNvcmRJZGVudGl0eVNldHMoY3VycmVudERhdGEsIGRhdGEpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwTWF0Y2ggPSBlcXVhbFJlY29yZElkZW50aXRpZXMoY3VycmVudERhdGEsIGRhdGEpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGlmICghcmVsYXRpb25zaGlwTWF0Y2gpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgZGVlcFNldChyZXN1bHQsIFsncmVsYXRpb25zaGlwcycsIGZpZWxkLCAnZGF0YSddLCBjdXJyZW50RGF0YSA9PT0gdW5kZWZpbmVkID8gbnVsbCA6IGN1cnJlbnREYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGNoYW5nZWQpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICBvcDogJ3VwZGF0ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgICAgIHJlY29yZDogcmVzdWx0XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgb3A6ICdyZW1vdmVSZWNvcmQnLFxuICAgICAgICAgICAgICAgIHJlY29yZDogeyB0eXBlLCBpZCB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICBhc3luYyByZW1vdmVSZWNvcmQoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IGN1cnJlbnQgPSBhd2FpdCBjYWNoZS5nZXRSZWNvcmRBc3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBpZiAoY3VycmVudCkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ2FkZFJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiBjdXJyZW50XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICBhc3luYyByZXBsYWNlS2V5KGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCB7IGtleSB9ID0gb3A7XG4gICAgICAgIGNvbnN0IHJlY29yZCA9IGF3YWl0IGNhY2hlLmdldFJlY29yZEFzeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGNvbnN0IGN1cnJlbnQgPSByZWNvcmQgJiYgZGVlcEdldChyZWNvcmQsIFsna2V5cycsIGtleV0pO1xuICAgICAgICBpZiAoIWVxKGN1cnJlbnQsIG9wLnZhbHVlKSkge1xuICAgICAgICAgICAgY29uc3QgeyB0eXBlLCBpZCB9ID0gb3AucmVjb3JkO1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlcGxhY2VLZXknLFxuICAgICAgICAgICAgICAgIHJlY29yZDogeyB0eXBlLCBpZCB9LFxuICAgICAgICAgICAgICAgIGtleSxcbiAgICAgICAgICAgICAgICB2YWx1ZTogY3VycmVudFxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH0sXG4gICAgYXN5bmMgcmVwbGFjZUF0dHJpYnV0ZShjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgeyBhdHRyaWJ1dGUgfSA9IG9wO1xuICAgICAgICBjb25zdCByZWNvcmQgPSBhd2FpdCBjYWNoZS5nZXRSZWNvcmRBc3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBjb25zdCBjdXJyZW50ID0gcmVjb3JkICYmIGRlZXBHZXQocmVjb3JkLCBbJ2F0dHJpYnV0ZXMnLCBhdHRyaWJ1dGVdKTtcbiAgICAgICAgaWYgKCFlcShjdXJyZW50LCBvcC52YWx1ZSkpIHtcbiAgICAgICAgICAgIGNvbnN0IHsgdHlwZSwgaWQgfSA9IG9wLnJlY29yZDtcbiAgICAgICAgICAgIHJ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BjdXJyZW50UmVsYXRlZFJlY29yZHMgfHwgW11cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIGFzeW5jIHJlcGxhY2VSZWxhdGVkUmVjb3JkKGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCB7IHJlY29yZCwgcmVsYXRpb25zaGlwLCByZWxhdGVkUmVjb3JkIH0gPSBvcDtcbiAgICAgICAgY29uc3QgY3VycmVudFJlbGF0ZWRSZWNvcmQgPSBhd2FpdCBjYWNoZS5nZXRSZWxhdGVkUmVjb3JkQXN5bmMocmVjb3JkLCByZWxhdGlvbnNoaXApO1xuICAgICAgICBpZiAoY3VycmVudFJlbGF0ZWRSZWNvcmQgPT09IHVuZGVmaW5lZCB8fCAhZXF1YWxSZWNvcmRJZGVudGl0aWVzKGN1cnJlbnRSZWxhdGVkUmVjb3JkLCByZWxhdGVkUmVjb3JkKSkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlcGxhY2VSZWxhdGVkUmVjb3JkJyxcbiAgICAgICAgICAgICAgICByZWNvcmQsXG4gICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwLFxuICAgICAgICAgICAgICAgIHJlbGF0ZWRSZWNvcmQ6IGN1cnJlbnRSZWxhdGVkUmVjb3JkIHx8IG51bGxcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9XG59OyJdfQ== | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9wZXJhdG9ycy9hc3luYy1pbnZlcnNlLXBhdGNoLW9wZXJhdG9ycy5qcyJdLCJuYW1lcyI6WyJBc3luY0ludmVyc2VQYXRjaE9wZXJhdG9ycyIsIm9wIiwiY3VycmVudCIsImNhY2hlIiwiZXEiLCJyZWNvcmQiLCJ0eXBlIiwiaWQiLCJyZXBsYWNlbWVudCIsInJlc3VsdCIsImNoYW5nZWQiLCJPYmplY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jYWNoZS5nZXRSZWNvcmRBc3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBpZiAoY3VycmVudCkge1xuICAgICAgICAgICAgaWYgKGVxKGN1cnJlbnQsIG9wLnJlY29yZCkpIHtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgIG9wOiAndXBkYXRlUmVjb3JkJyxcbiAgICAgICAgICAgICAgICAgICAgcmVjb3JkOiBjdXJyZW50XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgb3A6ICdyZW1vdmVSZWNvcmQnLFxuICAgICAgICAgICAgICAgIHJlY29yZDogeyB0eXBlLCBpZCB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICBhc3luYyB1cGRhdGVSZWNvcmQoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IGN1cnJlbnQgPSBhd2FpdCBjYWNoZS5nZXRSZWNvcmRBc3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBjb25zdCByZXBsYWNlbWVudCA9IG9wLnJlY29yZDtcbiAgICAgICAgY29uc3QgeyB0eXBlLCBpZCB9ID0gcmVwbGFjZW1lbnQ7XG4gICAgICAgIGlmIChjdXJyZW50KSB7XG4gICAgICAgICAgICBsZXQgcmVzdWx0ID0geyB0eXBlLCBpZCB9O1xuICAgICAgICAgICAgbGV0IGNoYW5nZWQgPSBmYWxzZTtcbiAgICAgICAgICAgIFsnYXR0cmlidXRlcycsICdrZXlzJ10uZm9yRWFjaChncm91cGluZyA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKHJlcGxhY2VtZW50W2dyb3VwaW5nXSkge1xuICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhyZXBsYWNlbWVudFtncm91cGluZ10pLmZvckVhY2goZmllbGQgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHZhbHVlID0gcmVwbGFjZW1lbnRbZ3JvdXBpbmddW2ZpZWxkXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBjdXJyZW50VmFsdWUgPSBkZWVwR2V0KGN1cnJlbnQsIFtncm91cGluZywgZmllbGRdKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZXEodmFsdWUsIGN1cnJlbnRWYWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWVwU2V0KHJlc3VsdCwgW2dyb3VwaW5nLCBmaWVsZF0sIGN1cnJlbnRWYWx1ZSA9PT0gdW5kZWZpbmVkID8gbnVsbCA6IGN1cnJlbnRWYWx1ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgaWYgKHJlcGxhY2VtZW50LnJlbGF0aW9uc2hpcHMpIHtcbiAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhyZXBsYWNlbWVudC5yZWxhdGlvbnNoaXBzKS5mb3JFYWNoKGZpZWxkID0+IHtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGEgPSBkZWVwR2V0KHJlcGxhY2VtZW50LCBbJ3JlbGF0aW9uc2hpcHMnLCBmaWVsZCwgJ2RhdGEnXSk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChkYXRhICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBjdXJyZW50RGF0YSA9IGRlZXBHZXQoY3VycmVudCwgWydyZWxhdGlvbnNoaXBzJywgZmllbGQsICdkYXRhJ10pO1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHJlbGF0aW9uc2hpcENoYW5nZWQ7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNBcnJheShkYXRhKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXJyZW50RGF0YSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXBDaGFuZ2VkID0gIWVxdWFsUmVjb3JkSWRlbnRpdHlTZXRzKGN1cnJlbnREYXRhLCBkYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXBDaGFuZ2VkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudERhdGEgPSBbXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXJyZW50RGF0YSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXBDaGFuZ2VkID0gIWVxdWFsUmVjb3JkSWRlbnRpdGllcyhjdXJyZW50RGF0YSwgZGF0YSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwQ2hhbmdlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnREYXRhID0gbnVsbDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVsYXRpb25zaGlwQ2hhbmdlZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZXBTZXQocmVzdWx0LCBbJ3JlbGF0aW9uc2hpcHMnLCBmaWVsZCwgJ2RhdGEnXSwgY3VycmVudERhdGEpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoY2hhbmdlZCkge1xuICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgIG9wOiAndXBkYXRlUmVjb3JkJyxcbiAgICAgICAgICAgICAgICAgICAgcmVjb3JkOiByZXN1bHRcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlbW92ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIGFzeW5jIHJlbW92ZVJlY29yZChjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IGF3YWl0IGNhY2hlLmdldFJlY29yZEFzeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGlmIChjdXJyZW50KSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAnYWRkUmVjb3JkJyxcbiAgICAgICAgICAgICAgICByZWNvcmQ6IGN1cnJlbnRcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIGFzeW5jIHJlcGxhY2VLZXkoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IHsga2V5IH0gPSBvcDtcbiAgICAgICAgY29uc3QgcmVjb3JkID0gYXdhaXQgY2FjaGUuZ2V0UmVjb3JkQXN5bmMob3AucmVjb3JkKTtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IHJlY29yZCAmJiBkZWVwR2V0KHJlY29yZCwgWydrZXlzJywga2V5XSk7XG4gICAgICAgIGlmICghZXEoY3VycmVudCwgb3AudmFsdWUpKSB7XG4gICAgICAgICAgICBjb25zdCB7IHR5cGUsIGlkIH0gPSBvcC5yZWNvcmQ7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAncmVwbGFjZUtleScsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH0sXG4gICAgICAgICAgICAgICAga2V5LFxuICAgICAgICAgICAgICAgIHZhbHVlOiBjdXJyZW50XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICBhc3luYyByZXBsYWNlQXR0cmlidXRlKGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCB7IGF0dHJpYnV0ZSB9ID0gb3A7XG4gICAgICAgIGNvbnN0IHJlY29yZCA9IGF3YWl0IGNhY2hlLmdldFJlY29yZEFzeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGNvbnN0IGN1cnJlbnQgPSByZWNvcmQgJiYgZGVlcEdldChyZWNvcmQsIFsnYXR0cmlidXRlcycsIGF0dHJpYnV0ZV0pO1xuICAgICAgICBpZiAoIWVxKGN1cnJlbnQsIG9wLnZhbHVlKSkge1xuICAgICAgICAgICAgY29uc3QgeyB0eXBlLCBpZCB9ID0gb3AucmVjb3JkO1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlcGxhY2VBdHRyaWJ1dGUnLFxuICAgICAgICAgICAgICAgIHJlY29yZDogeyB0eXBlLCBpZCB9LFxuICAgICAgICAgICAgICAgIGF0dHJpYnV0ZSxcbiAgICAgICAgICAgICAgICB2YWx1ZTogY3VycmVudFxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH0sXG4gICAgYXN5bmMgYWRkVG9SZWxhdGVkUmVjb3JkcyhjYWNoZSwgb3ApIHtcbi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RSZWNvcmRBc3luYyhyZWNvcmQsIHJlbGF0aW9uc2hpcCk7XG4gICAgICAgIGlmIChjdXJyZW50UmVsYXRlZFJlY29yZCA9PT0gdW5kZWZpbmVkIHx8ICFlcXVhbFJlY29yZElkZW50aXRpZXMoY3VycmVudFJlbGF0ZWRSZWNvcmQsIHJlbGF0ZWRSZWNvcmQpKSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAncmVwbGFjZVJlbGF0ZWRSZWNvcmQnLFxuICAgICAgICAgICAgICAgIHJlY29yZCxcbiAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXAsXG4gICAgICAgICAgICAgICAgcmVsYXRlZFJlY29yZDogY3VycmVudFJlbGF0ZWRSZWNvcmQgfHwgbnVsbFxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH1cbn07Il19 |
@@ -58,14 +58,26 @@ 'use strict'; | ||
Object.keys(replacement.relationships).forEach(function (field) { | ||
var currentData = (0, _utils.deepGet)(current, ['relationships', field, 'data']); | ||
var data = (0, _utils.deepGet)(replacement, ['relationships', field, 'data']); | ||
var relationshipMatch = void 0; | ||
if ((0, _utils.isArray)(data)) { | ||
relationshipMatch = (0, _data.equalRecordIdentitySets)(currentData, data); | ||
} else { | ||
relationshipMatch = (0, _data.equalRecordIdentities)(currentData, data); | ||
if (data !== undefined) { | ||
var currentData = (0, _utils.deepGet)(current, ['relationships', field, 'data']); | ||
var relationshipChanged = void 0; | ||
if ((0, _utils.isArray)(data)) { | ||
if (currentData) { | ||
relationshipChanged = !(0, _data.equalRecordIdentitySets)(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = []; | ||
} | ||
} else { | ||
if (currentData) { | ||
relationshipChanged = !(0, _data.equalRecordIdentities)(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = null; | ||
} | ||
} | ||
if (relationshipChanged) { | ||
changed = true; | ||
(0, _utils.deepSet)(result, ['relationships', field, 'data'], currentData); | ||
} | ||
} | ||
if (!relationshipMatch) { | ||
changed = true; | ||
(0, _utils.deepSet)(result, ['relationships', field, 'data'], currentData === undefined ? null : currentData); | ||
} | ||
}); | ||
@@ -192,2 +204,2 @@ } | ||
}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9wZXJhdG9ycy9zeW5jLWludmVyc2UtcGF0Y2gtb3BlcmF0b3JzLmpzIl0sIm5hbWVzIjpbIlN5bmNJbnZlcnNlUGF0Y2hPcGVyYXRvcnMiLCJvcCIsImN1cnJlbnQiLCJjYWNoZSIsImVxIiwicmVjb3JkIiwidHlwZSIsImlkIiwicmVwbGFjZW1lbnQiLCJyZXN1bHQiLCJjaGFuZ2VkIiwiT2JqZWN0IiwidmFsdWUiLCJjdXJyZW50VmFsdWUiLCJkZWVwR2V0IiwiZGVlcFNldCIsImN1cnJlbnREYXRhIiwiZGF0YSIsInJlbGF0aW9uc2hpcE1hdGNoIiwiaXNBcnJheSIsImVxdWFsUmVjb3JkSWRlbnRpdHlTZXRzIiwiZXF1YWxSZWNvcmRJZGVudGl0aWVzIiwia2V5IiwiYXR0cmlidXRlIiwiY3VycmVudFJlbGF0ZWRSZWNvcmRzIiwicmVjb3Jkc0luY2x1ZGUiLCJyZWxhdGlvbnNoaXAiLCJyZWxhdGVkUmVjb3JkIiwicmVsYXRlZFJlY29yZHMiLCJjdXJyZW50UmVsYXRlZFJlY29yZCJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQ0E7O0FBQ08sSUFBTUEsZ0VBQTRCO0FBQUEsZUFBQSxVQUFBLEtBQUEsRUFBQSxFQUFBLEVBQ2hCO0FBQUEsWUFBQSxhQUNJQyxHQURKLE1BQUE7QUFBQSxZQUFBLE9BQUEsV0FBQSxJQUFBO0FBQUEsWUFBQSxLQUFBLFdBQUEsRUFBQTs7QUFFakIsWUFBTUMsVUFBVUMsTUFBQUEsYUFBQUEsQ0FBb0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FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IHsgdHlwZSwgaWQgfSA9IG9wLnJlY29yZDtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IGNhY2hlLmdldFJlY29yZFN5bmMob3AucmVjb3JkKTtcbiAgICAgICAgaWYgKGN1cnJlbnQpIHtcbiAgICAgICAgICAgIGlmIChlcShjdXJyZW50LCBvcC5yZWNvcmQpKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICBvcDogJ3VwZGF0ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgICAgIHJlY29yZDogY3VycmVudFxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAncmVtb3ZlUmVjb3JkJyxcbiAgICAgICAgICAgICAgICByZWNvcmQ6IHsgdHlwZSwgaWQgfVxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH0sXG4gICAgdXBkYXRlUmVjb3JkKGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCBjdXJyZW50ID0gY2FjaGUuZ2V0UmVjb3JkU3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBjb25zdCByZXBsYWNlbWVudCA9IG9wLnJlY29yZDtcbiAgICAgICAgY29uc3QgeyB0eXBlLCBpZCB9ID0gcmVwbGFjZW1lbnQ7XG4gICAgICAgIGlmIChjdXJyZW50KSB7XG4gICAgICAgICAgICBsZXQgcmVzdWx0ID0geyB0eXBlLCBpZCB9O1xuICAgICAgICAgICAgbGV0IGNoYW5nZWQgPSBmYWxzZTtcbiAgICAgICAgICAgIFsnYXR0cmlidXRlcycsICdrZXlzJ10uZm9yRWFjaChncm91cGluZyA9PiB7XG4gICAgICAgICAgICAgICAgaWYgKHJlcGxhY2VtZW50W2dyb3VwaW5nXSkge1xuICAgICAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhyZXBsYWNlbWVudFtncm91cGluZ10pLmZvckVhY2goZmllbGQgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHZhbHVlID0gcmVwbGFjZW1lbnRbZ3JvdXBpbmddW2ZpZWxkXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBjdXJyZW50VmFsdWUgPSBkZWVwR2V0KGN1cnJlbnQsIFtncm91cGluZywgZmllbGRdKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZXEodmFsdWUsIGN1cnJlbnRWYWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWVwU2V0KHJlc3VsdCwgW2dyb3VwaW5nLCBmaWVsZF0sIGN1cnJlbnRWYWx1ZSA9PT0gdW5kZWZpbmVkID8gbnVsbCA6IGN1cnJlbnRWYWx1ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgaWYgKHJlcGxhY2VtZW50LnJlbGF0aW9uc2hpcHMpIHtcbiAgICAgICAgICAgICAgICBPYmplY3Qua2V5cyhyZXBsYWNlbWVudC5yZWxhdGlvbnNoaXBzKS5mb3JFYWNoKGZpZWxkID0+IHtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGN1cnJlbnREYXRhID0gZGVlcEdldChjdXJyZW50LCBbJ3JlbGF0aW9uc2hpcHMnLCBmaWVsZCwgJ2RhdGEnXSk7XG4gICAgICAgICAgICAgICAgICAgIGxldCBkYXRhID0gZGVlcEdldChyZXBsYWNlbWVudCwgWydyZWxhdGlvbnNoaXBzJywgZmllbGQsICdkYXRhJ10pO1xuICAgICAgICAgICAgICAgICAgICBsZXQgcmVsYXRpb25zaGlwTWF0Y2g7XG4gICAgICAgICAgICAgICAgICAgIGlmIChpc0FycmF5KGRhdGEpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXBNYXRjaCA9IGVxdWFsUmVjb3JkSWRlbnRpdHlTZXRzKGN1cnJlbnREYXRhLCBkYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcE1hdGNoID0gZXF1YWxSZWNvcmRJZGVudGl0aWVzKGN1cnJlbnREYXRhLCBkYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBpZiAoIXJlbGF0aW9uc2hpcE1hdGNoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlZXBTZXQocmVzdWx0LCBbJ3JlbGF0aW9uc2hpcHMnLCBmaWVsZCwgJ2RhdGEnXSwgY3VycmVudERhdGEgPT09IHVuZGVmaW5lZCA/IG51bGwgOiBjdXJyZW50RGF0YSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjaGFuZ2VkKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgICAgb3A6ICd1cGRhdGVSZWNvcmQnLFxuICAgICAgICAgICAgICAgICAgICByZWNvcmQ6IHJlc3VsdFxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAncmVtb3ZlUmVjb3JkJyxcbiAgICAgICAgICAgICAgICByZWNvcmQ6IHsgdHlwZSwgaWQgfVxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH0sXG4gICAgcmVtb3ZlUmVjb3JkKGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCBjdXJyZW50ID0gY2FjaGUuZ2V0UmVjb3JkU3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBpZiAoY3VycmVudCkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ2FkZFJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiBjdXJyZW50XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICByZXBsYWNlS2V5KGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCB7IGtleSB9ID0gb3A7XG4gICAgICAgIGNvbnN0IHJlY29yZCA9IGNhY2hlLmdldFJlY29yZFN5bmMob3AucmVjb3JkKTtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IHJlY29yZCAmJiBkZWVwR2V0KHJlY29yZCwgWydrZXlzJywga2V5XSk7XG4gICAgICAgIGlmICghZXEoY3VycmVudCwgb3AudmFsdWUpKSB7XG4gICAgICAgICAgICBjb25zdCB7IHR5cGUsIGlkIH0gPSBvcC5yZWNvcmQ7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAncmVwbGFjZUtleScsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH0sXG4gICAgICAgICAgICAgICAga2V5LFxuICAgICAgICAgICAgICAgIHZhbHVlOiBjdXJyZW50XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICByZXBsYWNlQXR0cmlidXRlKGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCB7IGF0dHJpYnV0ZSB9ID0gb3A7XG4gICAgICAgIGNvbnN0IHJlY29yZCA9IGNhY2hlLmdldFJlY29yZFN5bmMob3AucmVjb3JkKTtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IHJlY29yZCAmJiBkZWVwR2V0KHJlY29yZCwgWydhdHRyaWJ1dGVzJywgYXR0cmlidXRlXSk7XG4gICAgICAgIGlmICghZXEoY3VycmVudCwgb3AudmFsdWUpKSB7XG4gICAgICAgICAgICBjb25zdCB7IHR5cGUsIGlkIH0gPSBvcC5yZWNvcmQ7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAncmVwbGFjZUF0dHJpYnV0ZScsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH0sXG4gICAgICAgICAgICAgICAgYXR0cmlidXRlLFxuICAgICAgICAgICAgICAgIHZhbHVlOiBjdXJyZW50XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICBhZGRUb1JlbGF0ZWRSZWNvcmRzKGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCB7IHJlY29yZCwgcmVsYXRpb25zaGlwLCByZWxhdGVkUmVjb3JkIH0gPSBvcDtcbiAgICAgICAgY29uc3QgY3VycmVudFJlbGF0ZWRSZWNvcmRzID0gY2FjaGUuZ2V0UmVsYXRlZFJlY29yZHNTeW5jKHJlY29yZCwgcmVsYXRpb25zaGlwKTtcbiAgICAgICAgaWYgKGN1cnJlbnRSZWxhdGVkUmVjb3JkcyA9PT0gdW5kZWZpbmVkIHx8ICFyZWNvcmRzSW5jbHVkZShjdXJyZW50UmVsYXRlZFJlY29yZHMsIHJlbGF0ZWRSZWNvcmQpKSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAncmVtb3ZlRnJvbVJlbGF0ZWRSZWNvcmRzJyxcbiAgICAgICAgICAgICAgICByZWNvcmQsXG4gICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwLFxuICAgICAgICAgICAgICAgIHJlbGF0ZWRSZWNvcmRcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIHJlbW92ZUZyb21SZWxhdGVkUmVjb3Jkcyhj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UmVjb3JkcycsXG4gICAgICAgICAgICAgICAgcmVjb3JkLFxuICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcCxcbiAgICAgICAgICAgICAgICByZWxhdGVkUmVjb3JkczogY3VycmVudFJlbGF0ZWRSZWNvcmRzIHx8IFtdXG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICByZXBsYWNlUmVsYXRlZFJlY29yZChjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgeyByZWNvcmQsIHJlbGF0aW9uc2hpcCwgcmVsYXRlZFJlY29yZCB9ID0gb3A7XG4gICAgICAgIGNvbnN0IGN1cnJlbnRSZWxhdGVkUmVjb3JkID0gY2FjaGUuZ2V0UmVsYXRlZFJlY29yZFN5bmMocmVjb3JkLCByZWxhdGlvbnNoaXApO1xuICAgICAgICBpZiAoY3VycmVudFJlbGF0ZWRSZWNvcmQgPT09IHVuZGVmaW5lZCB8fCAhZXF1YWxSZWNvcmRJZGVudGl0aWVzKGN1cnJlbnRSZWxhdGVkUmVjb3JkLCByZWxhdGVkUmVjb3JkKSkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlcGxhY2VSZWxhdGVkUmVjb3JkJyxcbiAgICAgICAgICAgICAgICByZWNvcmQsXG4gICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwLFxuICAgICAgICAgICAgICAgIHJlbGF0ZWRSZWNvcmQ6IGN1cnJlbnRSZWxhdGVkUmVjb3JkIHx8IG51bGxcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9XG59OyJdfQ== | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9wZXJhdG9ycy9zeW5jLWludmVyc2UtcGF0Y2gtb3BlcmF0b3JzLmpzIl0sIm5hbWVzIjpbIlN5bmNJbnZlcnNlUGF0Y2hPcGVyYXRvcnMiLCJvcCIsImN1cnJl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yZWNvcmQ7XG4gICAgICAgIGNvbnN0IGN1cnJlbnQgPSBjYWNoZS5nZXRSZWNvcmRTeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGlmIChjdXJyZW50KSB7XG4gICAgICAgICAgICBpZiAoZXEoY3VycmVudCwgb3AucmVjb3JkKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgICAgb3A6ICd1cGRhdGVSZWNvcmQnLFxuICAgICAgICAgICAgICAgICAgICByZWNvcmQ6IGN1cnJlbnRcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlbW92ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIHVwZGF0ZVJlY29yZChjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IGNhY2hlLmdldFJlY29yZFN5bmMob3AucmVjb3JkKTtcbiAgICAgICAgY29uc3QgcmVwbGFjZW1lbnQgPSBvcC5yZWNvcmQ7XG4gICAgICAgIGNvbnN0IHsgdHlwZSwgaWQgfSA9IHJlcGxhY2VtZW50O1xuICAgICAgICBpZiAoY3VycmVudCkge1xuICAgICAgICAgICAgbGV0IHJlc3VsdCA9IHsgdHlwZSwgaWQgfTtcbiAgICAgICAgICAgIGxldCBjaGFuZ2VkID0gZmFsc2U7XG4gICAgICAgICAgICBbJ2F0dHJpYnV0ZXMnLCAna2V5cyddLmZvckVhY2goZ3JvdXBpbmcgPT4ge1xuICAgICAgICAgICAgICAgIGlmIChyZXBsYWNlbWVudFtncm91cGluZ10pIHtcbiAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMocmVwbGFjZW1lbnRbZ3JvdXBpbmddKS5mb3JFYWNoKGZpZWxkID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB2YWx1ZSA9IHJlcGxhY2VtZW50W2dyb3VwaW5nXVtmaWVsZF07XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgY3VycmVudFZhbHVlID0gZGVlcEdldChjdXJyZW50LCBbZ3JvdXBpbmcsIGZpZWxkXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWVxKHZhbHVlLCBjdXJyZW50VmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbmdlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVlcFNldChyZXN1bHQsIFtncm91cGluZywgZmllbGRdLCBjdXJyZW50VmFsdWUgPT09IHVuZGVmaW5lZCA/IG51bGwgOiBjdXJyZW50VmFsdWUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGlmIChyZXBsYWNlbWVudC5yZWxhdGlvbnNoaXBzKSB7XG4gICAgICAgICAgICAgICAgT2JqZWN0LmtleXMocmVwbGFjZW1lbnQucmVsYXRpb25zaGlwcykuZm9yRWFjaChmaWVsZCA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGxldCBkYXRhID0gZGVlcEdldChyZXBsYWNlbWVudCwgWydyZWxhdGlvbnNoaXBzJywgZmllbGQsICdkYXRhJ10pO1xuICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgY3VycmVudERhdGEgPSBkZWVwR2V0KGN1cnJlbnQsIFsncmVsYXRpb25zaGlwcycsIGZpZWxkLCAnZGF0YSddKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCByZWxhdGlvbnNoaXBDaGFuZ2VkO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlzQXJyYXkoZGF0YSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3VycmVudERhdGEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwQ2hhbmdlZCA9ICFlcXVhbFJlY29yZElkZW50aXR5U2V0cyhjdXJyZW50RGF0YSwgZGF0YSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwQ2hhbmdlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnREYXRhID0gW107XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3VycmVudERhdGEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwQ2hhbmdlZCA9ICFlcXVhbFJlY29yZElkZW50aXRpZXMoY3VycmVudERhdGEsIGRhdGEpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcENoYW5nZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW50RGF0YSA9IG51bGw7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlbGF0aW9uc2hpcENoYW5nZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWVwU2V0KHJlc3VsdCwgWydyZWxhdGlvbnNoaXBzJywgZmllbGQsICdkYXRhJ10sIGN1cnJlbnREYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGNoYW5nZWQpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICBvcDogJ3VwZGF0ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgICAgIHJlY29yZDogcmVzdWx0XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgb3A6ICdyZW1vdmVSZWNvcmQnLFxuICAgICAgICAgICAgICAgIHJlY29yZDogeyB0eXBlLCBpZCB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICByZW1vdmVSZWNvcmQoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IGN1cnJlbnQgPSBjYWNoZS5nZXRSZWNvcmRTeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGlmIChjdXJyZW50KSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAnYWRkUmVjb3JkJyxcbiAgICAgICAgICAgICAgICByZWNvcmQ6IGN1cnJlbnRcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIHJlcGxhY2VLZXkoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IHsga2V5IH0gPSBvcDtcbiAgICAgICAgY29uc3QgcmVjb3JkID0gY2FjaGUuZ2V0UmVjb3JkU3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBjb25zdCBjdXJyZW50ID0gcmVjb3JkICYmIGRlZXBHZXQ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T0gdW5kZWZpbmVkIHx8ICFlcXVhbFJlY29yZElkZW50aXRpZXMoY3VycmVudFJlbGF0ZWRSZWNvcmQsIHJlbGF0ZWRSZWNvcmQpKSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAncmVwbGFjZVJlbGF0ZWRSZWNvcmQnLFxuICAgICAgICAgICAgICAgIHJlY29yZCxcbiAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXAsXG4gICAgICAgICAgICAgICAgcmVsYXRlZFJlY29yZDogY3VycmVudFJlbGF0ZWRSZWNvcmQgfHwgbnVsbFxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH1cbn07Il19 |
@@ -44,14 +44,26 @@ import { deepGet, deepSet, eq, isArray } from '@orbit/utils'; | ||
Object.keys(replacement.relationships).forEach(field => { | ||
let currentData = deepGet(current, ['relationships', field, 'data']); | ||
let data = deepGet(replacement, ['relationships', field, 'data']); | ||
let relationshipMatch; | ||
if (isArray(data)) { | ||
relationshipMatch = equalRecordIdentitySets(currentData, data); | ||
} else { | ||
relationshipMatch = equalRecordIdentities(currentData, data); | ||
if (data !== undefined) { | ||
let currentData = deepGet(current, ['relationships', field, 'data']); | ||
let relationshipChanged; | ||
if (isArray(data)) { | ||
if (currentData) { | ||
relationshipChanged = !equalRecordIdentitySets(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = []; | ||
} | ||
} else { | ||
if (currentData) { | ||
relationshipChanged = !equalRecordIdentities(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = null; | ||
} | ||
} | ||
if (relationshipChanged) { | ||
changed = true; | ||
deepSet(result, ['relationships', field, 'data'], currentData); | ||
} | ||
} | ||
if (!relationshipMatch) { | ||
changed = true; | ||
deepSet(result, ['relationships', field, 'data'], currentData === undefined ? null : currentData); | ||
} | ||
}); | ||
@@ -58,0 +70,0 @@ } |
@@ -44,14 +44,26 @@ import { deepGet, deepSet, eq, isArray } from '@orbit/utils'; | ||
Object.keys(replacement.relationships).forEach(field => { | ||
let currentData = deepGet(current, ['relationships', field, 'data']); | ||
let data = deepGet(replacement, ['relationships', field, 'data']); | ||
let relationshipMatch; | ||
if (isArray(data)) { | ||
relationshipMatch = equalRecordIdentitySets(currentData, data); | ||
} else { | ||
relationshipMatch = equalRecordIdentities(currentData, data); | ||
if (data !== undefined) { | ||
let currentData = deepGet(current, ['relationships', field, 'data']); | ||
let relationshipChanged; | ||
if (isArray(data)) { | ||
if (currentData) { | ||
relationshipChanged = !equalRecordIdentitySets(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = []; | ||
} | ||
} else { | ||
if (currentData) { | ||
relationshipChanged = !equalRecordIdentities(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = null; | ||
} | ||
} | ||
if (relationshipChanged) { | ||
changed = true; | ||
deepSet(result, ['relationships', field, 'data'], currentData); | ||
} | ||
} | ||
if (!relationshipMatch) { | ||
changed = true; | ||
deepSet(result, ['relationships', field, 'data'], currentData === undefined ? null : currentData); | ||
} | ||
}); | ||
@@ -58,0 +70,0 @@ } |
@@ -49,14 +49,26 @@ import { deepGet, deepSet, eq, isArray } from '@orbit/utils'; | ||
Object.keys(replacement.relationships).forEach(function (field) { | ||
var currentData = deepGet(current, ['relationships', field, 'data']); | ||
var data = deepGet(replacement, ['relationships', field, 'data']); | ||
var relationshipMatch = void 0; | ||
if (isArray(data)) { | ||
relationshipMatch = equalRecordIdentitySets(currentData, data); | ||
} else { | ||
relationshipMatch = equalRecordIdentities(currentData, data); | ||
if (data !== undefined) { | ||
var currentData = deepGet(current, ['relationships', field, 'data']); | ||
var relationshipChanged = void 0; | ||
if (isArray(data)) { | ||
if (currentData) { | ||
relationshipChanged = !equalRecordIdentitySets(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = []; | ||
} | ||
} else { | ||
if (currentData) { | ||
relationshipChanged = !equalRecordIdentities(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = null; | ||
} | ||
} | ||
if (relationshipChanged) { | ||
changed = true; | ||
deepSet(result, ['relationships', field, 'data'], currentData); | ||
} | ||
} | ||
if (!relationshipMatch) { | ||
changed = true; | ||
deepSet(result, ['relationships', field, 'data'], currentData === undefined ? null : currentData); | ||
} | ||
}); | ||
@@ -183,2 +195,2 @@ } | ||
}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9wZXJhdG9ycy9hc3luYy1pbnZlcnNlLXBhdGNoLW9wZXJhdG9ycy5qcyJdLCJuYW1lcyI6WyJkZWVwR2V0IiwiZGVlcFNldCIsImVxIiwiaXNBcnJheSIsImVxdWFsUmVjb3JkSWRlbnRpdGllcyIsImVxdWFsUmVjb3JkSWRlbnRpdHlTZXRzIiwicmVjb3Jkc0luY2x1ZGUiLCJBc3luY0ludmVyc2VQYXRjaE9wZXJhdG9ycyIsImFkZFJlY29yZCIsImNhY2hlIiwib3AiLCJyZWNvcmQiLCJ0eXBlIiwiaWQiLCJjdXJyZW50IiwiZ2V0UmVjb3JkQXN5bmMiLCJ1cGRhdGVSZWNvcmQiLCJyZXBsYWNlbWVudCIsInJlc3VsdCIsImNoYW5nZWQiLCJmb3JFYWNoIiwiZ3JvdXBpbmciLCJPYmplY3QiLCJrZXlzIiwidmFsdWUiLCJmaWVsZCIsImN1cnJlbnRWYWx1ZSIsInVuZGVmaW5lZCIsInJlbGF0aW9uc2hpcHMiLCJjdXJyZW50RGF0YSIsImRhdGEiLCJyZWxhdGlvbnNoaXBNYXRjaCIsInJlbW92ZVJlY29yZCIsInJlcGxhY2VLZXkiLCJrZXkiLCJyZXBsYWNlQXR0cmlidXRlIiwiYXR0cmlidXRlIiwiYWRkVG9SZWxhdGVkUmVjb3JkcyIsInJlbGF0aW9uc2hpcCIsInJlbGF0ZWRSZWNvcmQiLCJjdXJyZW50UmVsYXRlZFJlY29yZHMiLCJnZXRSZWxhdGVkUmVjb3Jkc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ICBhc3luYyBhZGRSZWNvcmQoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IHsgdHlwZSwgaWQgfSA9IG9wLnJlY29yZDtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IGF3YWl0IGNhY2hlLmdldFJlY29yZEFzeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGlmIChjdXJyZW50KSB7XG4gICAgICAgICAgICBpZiAoZXEoY3VycmVudCwgb3AucmVjb3JkKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgICAgb3A6ICd1cGRhdGVSZWNvcmQnLFxuICAgICAgICAgICAgICAgICAgICByZWNvcmQ6IGN1cnJlbnRcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlbW92ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIGFzeW5jIHVwZGF0ZVJlY29yZChjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IGF3YWl0IGNhY2hlLmdldFJlY29yZEFzeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGNvbnN0IHJlcGxhY2VtZW50ID0gb3AucmVjb3JkO1xuICAgICAgICBjb25zdCB7IHR5cGUsIGlkIH0gPSByZXBsYWNlbWVudDtcbiAgICAgICAgaWYgKGN1cnJlbnQpIHtcbiAgICAgICAgICAgIGxldCByZXN1bHQgPSB7IHR5cGUsIGlkIH07XG4gICAgICAgICAgICBsZXQgY2hhbmdlZCA9IGZhbHNlO1xuICAgICAgICAgICAgWydhdHRyaWJ1dGVzJywgJ2tleXMnXS5mb3JFYWNoKGdyb3VwaW5nID0+IHtcbiAgICAgICAgICAgICAgICBpZiAocmVwbGFjZW1lbnRbZ3JvdXBpbmddKSB7XG4gICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKHJlcGxhY2VtZW50W2dyb3VwaW5nXSkuZm9yRWFjaChmaWVsZCA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgdmFsdWUgPSByZXBsYWNlbWVudFtncm91cGluZ11bZmllbGRdO1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGN1cnJlbnRWYWx1ZSA9IGRlZXBHZXQoY3VycmVudCwgW2dyb3VwaW5nLCBmaWVsZF0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlcSh2YWx1ZSwgY3VycmVudFZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZXBTZXQocmVzdWx0LCBbZ3JvdXBpbmcsIGZpZWxkXSwgY3VycmVudFZhbHVlID09PSB1bmRlZmluZWQgPyBudWxsIDogY3VycmVudFZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBpZiAocmVwbGFjZW1lbnQucmVsYXRpb25zaGlwcykge1xuICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKHJlcGxhY2VtZW50LnJlbGF0aW9uc2hpcHMpLmZvckVhY2goZmllbGQgPT4ge1xuICAgICAgICAgICAgICAgICAgICBsZXQgY3VycmVudERhdGEgPSBkZWVwR2V0KGN1cnJlbnQsIFsncmVsYXRpb25zaGlwcycsIGZpZWxkLCAnZGF0YSddKTtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGRhdGEgPSBkZWVwR2V0KHJlcGxhY2VtZW50LCBbJ3JlbGF0aW9uc2hpcHMnLCBmaWVsZCwgJ2RhdGEnXSk7XG4gICAgICAgICAgICAgICAgICAgIGxldCByZWxhdGlvbnNoaXBNYXRjaDtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzQXJyYXkoZGF0YSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcE1hdGNoID0gZXF1YWxSZWNvcmRJZGVudGl0eVNldHMoY3VycmVudERhdGEsIGRhdGEpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwTWF0Y2ggPSBlcXVhbFJlY29yZElkZW50aXRpZXMoY3VycmVudERhdGEsIGRhdGEpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGlmICghcmVsYXRpb25zaGlwTWF0Y2gpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgZGVlcFNldChyZXN1bHQsIFsncmVsYXRpb25zaGlwcycsIGZpZWxkLCAnZGF0YSddLCBjdXJyZW50RGF0YSA9PT0gdW5kZWZpbmVkID8gbnVsbCA6IGN1cnJlbnREYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGNoYW5nZWQpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICBvcDogJ3VwZGF0ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgICAgIHJlY29yZDogcmVzdWx0XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgb3A6ICdyZW1vdmVSZWNvcmQnLFxuICAgICAgICAgICAgICAgIHJlY29yZDogeyB0eXBlLCBpZCB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICBhc3luYyByZW1vdmVSZWNvcmQoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IGN1cnJlbnQgPSBhd2FpdCBjYWNoZS5nZXRSZWNvcmRBc3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBpZiAoY3VycmVudCkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ2FkZFJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiBjdXJyZW50XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICBhc3luYyByZXBsYWNlS2V5KGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCB7IGtleSB9ID0gb3A7XG4gICAgICAgIGNvbnN0IHJlY29yZCA9IGF3YWl0IGNhY2hlLmdldFJlY29yZEFzeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGNvbnN0IGN1cnJlbnQgPSByZWNvcmQgJiYgZGVlcEdldChyZWNvcmQsIFsna2V5cycsIGtleV0pO1xuICAgICAgICBpZiAoIWVxKGN1cnJlbnQsIG9wLnZhbHVlKSkge1xuICAgICAgICAgICAgY29uc3QgeyB0eXBlLCBpZCB9ID0gb3AucmVjb3JkO1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlcGxhY2VLZXknLFxuICAgICAgICAgICAgICAgIHJlY29yZDogeyB0eXBlLCBpZCB9LFxuICAgICAgICAgICAgICAgIGtleSxcbiAgICAgICAgICAgICAgICB2YWx1ZTogY3VycmVudFxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH0sXG4gICAgYXN5bmMgcmVwbGFjZUF0dHJpYnV0ZShjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgeyBhdHRyaWJ1dGUgfSA9IG9wO1xuICAgICAgICBjb25zdCByZWNvcmQgPSBhd2FpdCBj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sUmVjb3JkSWRlbnRpdHlTZXRzKGN1cnJlbnRSZWxhdGVkUmVjb3JkcywgcmVsYXRlZFJlY29yZHMpKSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAncmVwbGFjZVJlbGF0ZWRSZWNvcmRzJyxcbiAgICAgICAgICAgICAgICByZWNvcmQsXG4gICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwLFxuICAgICAgICAgICAgICAgIHJlbGF0ZWRSZWNvcmRzOiBjdXJyZW50UmVsYXRlZFJlY29yZHMgfHwgW11cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIGFzeW5jIHJlcGxhY2VSZWxhdGVkUmVjb3JkKGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCB7IHJlY29yZCwgcmVsYXRpb25zaGlwLCByZWxhdGVkUmVjb3JkIH0gPSBvcDtcbiAgICAgICAgY29uc3QgY3VycmVudFJlbGF0ZWRSZWNvcmQgPSBhd2FpdCBjYWNoZS5nZXRSZWxhdGVkUmVjb3JkQXN5bmMocmVjb3JkLCByZWxhdGlvbnNoaXApO1xuICAgICAgICBpZiAoY3VycmVudFJlbGF0ZWRSZWNvcmQgPT09IHVuZGVmaW5lZCB8fCAhZXF1YWxSZWNvcmRJZGVudGl0aWVzKGN1cnJlbnRSZWxhdGVkUmVjb3JkLCByZWxhdGVkUmVjb3JkKSkge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlcGxhY2VSZWxhdGVkUmVjb3JkJyxcbiAgICAgICAgICAgICAgICByZWNvcmQsXG4gICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwLFxuICAgICAgICAgICAgICAgIHJlbGF0ZWRSZWNvcmQ6IGN1cnJlbnRSZWxhdGVkUmVjb3JkIHx8IG51bGxcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9XG59OyJdfQ== | ||
//# sourceMappingURL=data:application/json;char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YyBhZGRSZWNvcmQoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IHsgdHlwZSwgaWQgfSA9IG9wLnJlY29yZDtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IGF3YWl0IGNhY2hlLmdldFJlY29yZEFzeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGlmIChjdXJyZW50KSB7XG4gICAgICAgICAgICBpZiAoZXEoY3VycmVudCwgb3AucmVjb3JkKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgICAgb3A6ICd1cGRhdGVSZWNvcmQnLFxuICAgICAgICAgICAgICAgICAgICByZWNvcmQ6IGN1cnJlbnRcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlbW92ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIGFzeW5jIHVwZGF0ZVJlY29yZChjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IGF3YWl0IGNhY2hlLmdldFJlY29yZEFzeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGNvbnN0IHJlcGxhY2VtZW50ID0gb3AucmVjb3JkO1xuICAgICAgICBjb25zdCB7IHR5cGUsIGlkIH0gPSByZXBsYWNlbWVudDtcbiAgICAgICAgaWYgKGN1cnJlbnQpIHtcbiAgICAgICAgICAgIGxldCByZXN1bHQgPSB7IHR5cGUsIGlkIH07XG4gICAgICAgICAgICBsZXQgY2hhbmdlZCA9IGZhbHNlO1xuICAgICAgICAgICAgWydhdHRyaWJ1dGVzJywgJ2tleXMnXS5mb3JFYWNoKGdyb3VwaW5nID0+IHtcbiAgICAgICAgICAgICAgICBpZiAocmVwbGFjZW1lbnRbZ3JvdXBpbmddKSB7XG4gICAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKHJlcGxhY2VtZW50W2dyb3VwaW5nXSkuZm9yRWFjaChmaWVsZCA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgdmFsdWUgPSByZXBsYWNlbWVudFtncm91cGluZ11bZmllbGRdO1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGN1cnJlbnRWYWx1ZSA9IGRlZXBHZXQoY3VycmVudCwgW2dyb3VwaW5nLCBmaWVsZF0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFlcSh2YWx1ZSwgY3VycmVudFZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYW5nZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZXBTZXQocmVzdWx0LCBbZ3JvdXBpbmcsIGZpZWxkXSwgY3VycmVudFZhbHVlID09PSB1bmRlZmluZWQgPyBudWxsIDogY3VycmVudFZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICBpZiAocmVwbGFjZW1lbnQucmVsYXRpb25zaGlwcykge1xuICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKHJlcGxhY2VtZW50LnJlbGF0aW9uc2hpcHMpLmZvckVhY2goZmllbGQgPT4ge1xuICAgICAgICAgICAgICAgICAgICBsZXQgZGF0YSA9IGRlZXBHZXQocmVwbGFjZW1lbnQsIFsncmVsYXRpb25zaGlwcycsIGZpZWxkLCAnZGF0YSddKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGRhdGEgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGN1cnJlbnREYXRhID0gZGVlcEdldChjdXJyZW50LCBbJ3JlbGF0aW9uc2hpcHMnLCBmaWVsZCwgJ2RhdGEnXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgcmVsYXRpb25zaGlwQ2hhbmdlZDtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpc0FycmF5KGRhdGEpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGN1cnJlbnREYXRhKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcENoYW5nZWQgPSAhZXF1YWxSZWNvcmRJZGVudGl0eVNldHMoY3VycmVudERhdGEsIGRhdGEpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcENoYW5nZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW50RGF0YSA9IFtdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGN1cnJlbnREYXRhKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcENoYW5nZWQgPSAhZXF1YWxSZWNvcmRJZGVudGl0aWVzKGN1cnJlbnREYXRhLCBkYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXBDaGFuZ2VkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudERhdGEgPSBudWxsO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZWxhdGlvbnNoaXBDaGFuZ2VkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbmdlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVlcFNldChyZXN1bHQsIFsncmVsYXRpb25zaGlwcycsIGZpZWxkLCAnZGF0YSddLCBjdXJyZW50RGF0YSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChjaGFuZ2VkKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgICAgb3A6ICd1cGRhdGVSZWNvcmQnLFxuICAgICAgICAgICAgICAgICAgICByZWNvcmQ6IHJlc3VsdFxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAncmVtb3ZlUmVjb3JkJyxcbiAgICAgICAgICAgICAgICByZWNvcmQ6IHsgdHlwZSwgaWQgfVxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH0sXG4gICAgYXN5bmMgcmVtb3ZlUmVjb3JkKGNhY2hlLCBvcCkge1xuICAgICAgICBjb25zdCBjdXJyZW50ID0gYXdhaXQgY2FjaGUuZ2V0UmVjb3JkQXN5bmMob3AucmVjb3JkKTtcbiAgICAgICAgaWYgKGN1cnJlbnQpIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgb3A6ICdhZGRSZWNvcmQnLFxuICAgICAgICAgICAgICAgIHJlY29yZDogY3VycmVudFxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH0sXG4gICAgYXN5bmMgcmVwbGFjZUtleShjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgeyBrZXkgfSA9IG9wO1xuICAgICAgICBjb25zdCByZWNvcmQgPSBhd2FpdCBjYWNoZS5nZXRSZWNvcmRBc3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBjb25zdCBjdXJyZW50ID0gcmVjb3JkICYmIGRlZXBHZXQocmVjb3JkLCBbJ2tleXMnLCBrZXldKTtcbiAgICAgICAgaWYgKCFlcShjdXJyZW50LCBvcC52YWx1ZSkpIHtcbiAgICAgICAgICAgIGNvbnN0IHsgdHlwZSwgaWQgfSA9IG9wLnJlY29yZDtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgb3A6ICdyZXBsYWNlS2V5JyxcbiAgICAgICAgICAgICAgICByZWNvcmQ6IHsgdHlwZSwgaWQgfSxcbiAgICAgICAgICAgICAgICBrZXksXG4gICAgICAgICAgICAgICAgdmFsdWU6IGN1cnJlbnRcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIGFzeW5jIHJlcGxhY2VBdHRyaWJ1dGUoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IHsgYXR0cmlidXRlIH0gPSBvcDtcbiAgICAgICAgY29uc3QgcmVjb3JkID0gYXdhaXQgY2FjaGUuZ2V0UmVjb3JkQXN5bmMob3AucmVjb3JkKTtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IHJlY29yZCAmJiBkZWVwR2V0KHJlY29yZCwgWydhdHRyaWJ1dGVzJywgYXR0cmlidXRlXSk7XG4gICAgICAgIGlmICghZXEoY3VycmVudCwgb3AudmFsdWUpKSB7XG4gICAgICAgICAgICBjb25zdCB7IHR5cGUsIGlkIH0gPSBvcC5yZWNvcmQ7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAncmVwbGFjZUF0dHJpYnV0ZScsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH0sXG4gICAgICAgICAgICAgICAgYXR0cmlidXRlLFxuICAgICAgICAg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QsIHJlbGF0aW9uc2hpcCwgcmVsYXRlZFJlY29yZCB9ID0gb3A7XG4gICAgICAgIGNvbnN0IGN1cnJlbnRSZWxhdGVkUmVjb3JkID0gYXdhaXQgY2FjaGUuZ2V0UmVsYXRlZFJlY29yZEFzeW5jKHJlY29yZCwgcmVsYXRpb25zaGlwKTtcbiAgICAgICAgaWYgKGN1cnJlbnRSZWxhdGVkUmVjb3JkID09PSB1bmRlZmluZWQgfHwgIWVxdWFsUmVjb3JkSWRlbnRpdGllcyhjdXJyZW50UmVsYXRlZFJlY29yZCwgcmVsYXRlZFJlY29yZCkpIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgb3A6ICdyZXBsYWNlUmVsYXRlZFJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkLFxuICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcCxcbiAgICAgICAgICAgICAgICByZWxhdGVkUmVjb3JkOiBjdXJyZW50UmVsYXRlZFJlY29yZCB8fCBudWxsXG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfVxufTsiXX0= |
@@ -49,14 +49,26 @@ import { deepGet, deepSet, eq, isArray } from '@orbit/utils'; | ||
Object.keys(replacement.relationships).forEach(function (field) { | ||
var currentData = deepGet(current, ['relationships', field, 'data']); | ||
var data = deepGet(replacement, ['relationships', field, 'data']); | ||
var relationshipMatch = void 0; | ||
if (isArray(data)) { | ||
relationshipMatch = equalRecordIdentitySets(currentData, data); | ||
} else { | ||
relationshipMatch = equalRecordIdentities(currentData, data); | ||
if (data !== undefined) { | ||
var currentData = deepGet(current, ['relationships', field, 'data']); | ||
var relationshipChanged = void 0; | ||
if (isArray(data)) { | ||
if (currentData) { | ||
relationshipChanged = !equalRecordIdentitySets(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = []; | ||
} | ||
} else { | ||
if (currentData) { | ||
relationshipChanged = !equalRecordIdentities(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = null; | ||
} | ||
} | ||
if (relationshipChanged) { | ||
changed = true; | ||
deepSet(result, ['relationships', field, 'data'], currentData); | ||
} | ||
} | ||
if (!relationshipMatch) { | ||
changed = true; | ||
deepSet(result, ['relationships', field, 'data'], currentData === undefined ? null : currentData); | ||
} | ||
}); | ||
@@ -183,2 +195,2 @@ } | ||
}; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9wZXJhdG9ycy9zeW5jLWludmVyc2UtcGF0Y2gtb3BlcmF0b3JzLmpzIl0sIm5hbWVzIjpbImRlZXBHZXQiLCJkZWVwU2V0IiwiZXEiLCJpc0FycmF5IiwiZXF1YWxSZWNvcmRJZGVudGl0aWVzIiwiZXF1YWxSZWNvcmRJZGVudGl0eVNldHMiLCJyZWNvcmRzSW5jbHVkZSIsIlN5bmNJbnZlcnNlUGF0Y2hPcGVyYXRvcnMiLCJhZGRSZWNvcmQiLCJjYWNoZSIsIm9wIiwicmVjb3JkIiwidHlwZSIsImlkIiwiY3VycmVudCIsImdldFJlY29yZFN5bmMiLCJ1cGRhdGVSZWNvcmQiLCJyZXBsYWNlbWVudCIsInJlc3VsdCIsImNoYW5nZWQiLCJmb3JFYWNoIiwiZ3JvdXBpbmciLCJPYmplY3QiLCJrZXlzIiwidmFsdWUiLCJmaWVsZCIsImN1cnJlbnRWYWx1ZSIsInVuZGVmaW5lZCIsInJlbGF0aW9uc2hpcHMiLCJjdXJyZW50RGF0YSIsImRhdGEiLCJyZWxhdGlvbnNoaXBNYXRjaCIsInJlbW92ZVJlY29yZCIsInJlcGxhY2VLZXkiLCJrZXkiLCJyZXBsYWNlQXR0cmlidXRlIiwiYXR0cmlidXRlIiwiYWRkVG9SZWxhdGVkUmVjb3JkcyIsInJlbGF0aW9uc2hpcCIsInJlbGF0ZWRSZWNvcmQiLCJjdXJyZW50UmVsYXRlZFJlY29yZHMiLCJnZXRSZWxhdGVkUmVjb3Jkc1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0IGN1cnJlbnQgPSBjYWNoZS5nZXRSZWNvcmRTeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGlmIChjdXJyZW50KSB7XG4gICAgICAgICAgICBpZiAoZXEoY3VycmVudCwgb3AucmVjb3JkKSkge1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICAgICAgb3A6ICd1cGRhdGVSZWNvcmQnLFxuICAgICAgICAgICAgICAgICAgICByZWNvcmQ6IGN1cnJlbnRcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlbW92ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIHVwZGF0ZVJlY29yZChjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IGNhY2hlLmdldFJlY29yZFN5bmMob3AucmVjb3JkKTtcbiAgICAgICAgY29uc3QgcmVwbGFjZW1lbnQgPSBvcC5yZWNvcmQ7XG4gICAgICAgIGNvbnN0IHsgdHlwZSwgaWQgfSA9IHJlcGxhY2VtZW50O1xuICAgICAgICBpZiAoY3VycmVudCkge1xuICAgICAgICAgICAgbGV0IHJlc3VsdCA9IHsgdHlwZSwgaWQgfTtcbiAgICAgICAgICAgIGxldCBjaGFuZ2VkID0gZmFsc2U7XG4gICAgICAgICAgICBbJ2F0dHJpYnV0ZXMnLCAna2V5cyddLmZvckVhY2goZ3JvdXBpbmcgPT4ge1xuICAgICAgICAgICAgICAgIGlmIChyZXBsYWNlbWVudFtncm91cGluZ10pIHtcbiAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMocmVwbGFjZW1lbnRbZ3JvdXBpbmddKS5mb3JFYWNoKGZpZWxkID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB2YWx1ZSA9IHJlcGxhY2VtZW50W2dyb3VwaW5nXVtmaWVsZF07XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgY3VycmVudFZhbHVlID0gZGVlcEdldChjdXJyZW50LCBbZ3JvdXBpbmcsIGZpZWxkXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWVxKHZhbHVlLCBjdXJyZW50VmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbmdlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVlcFNldChyZXN1bHQsIFtncm91cGluZywgZmllbGRdLCBjdXJyZW50VmFsdWUgPT09IHVuZGVmaW5lZCA/IG51bGwgOiBjdXJyZW50VmFsdWUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGlmIChyZXBsYWNlbWVudC5yZWxhdGlvbnNoaXBzKSB7XG4gICAgICAgICAgICAgICAgT2JqZWN0LmtleXMocmVwbGFjZW1lbnQucmVsYXRpb25zaGlwcykuZm9yRWFjaChmaWVsZCA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGxldCBjdXJyZW50RGF0YSA9IGRlZXBHZXQoY3VycmVudCwgWydyZWxhdGlvbnNoaXBzJywgZmllbGQsICdkYXRhJ10pO1xuICAgICAgICAgICAgICAgICAgICBsZXQgZGF0YSA9IGRlZXBHZXQocmVwbGFjZW1lbnQsIFsncmVsYXRpb25zaGlwcycsIGZpZWxkLCAnZGF0YSddKTtcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJlbGF0aW9uc2hpcE1hdGNoO1xuICAgICAgICAgICAgICAgICAgICBpZiAoaXNBcnJheShkYXRhKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwTWF0Y2ggPSBlcXVhbFJlY29yZElkZW50aXR5U2V0cyhjdXJyZW50RGF0YSwgZGF0YSk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZWxhdGlvbnNoaXBNYXRjaCA9IGVxdWFsUmVjb3JkSWRlbnRpdGllcyhjdXJyZW50RGF0YSwgZGF0YSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaWYgKCFyZWxhdGlvbnNoaXBNYXRjaCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2hhbmdlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICBkZWVwU2V0KHJlc3VsdCwgWydyZWxhdGlvbnNoaXBzJywgZmllbGQsICdkYXRhJ10sIGN1cnJlbnREYXRhID09PSB1bmRlZmluZWQgPyBudWxsIDogY3VycmVudERhdGEpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoY2hhbmdlZCkge1xuICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgIG9wOiAndXBkYXRlUmVjb3JkJyxcbiAgICAgICAgICAgICAgICAgICAgcmVjb3JkOiByZXN1bHRcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlbW92ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIHJlbW92ZVJlY29yZChjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IGNhY2hlLmdldFJlY29yZFN5bmMob3AucmVjb3JkKTtcbiAgICAgICAgaWYgKGN1cnJlbnQpIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgb3A6ICdhZGRSZWNvcmQnLFxuICAgICAgICAgICAgICAgIHJlY29yZDogY3VycmVudFxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH0sXG4gICAgcmVwbGFjZUtleShjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgeyBrZXkgfSA9IG9wO1xuICAgICAgICBjb25zdCByZWNvcmQgPSBjYWNoZS5nZXRSZWNvcmRTeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGNvbnN0IGN1cnJlbnQgPSByZWNvcmQgJiYgZGVlcEdldChyZWNvcmQsIFsna2V5cycsIGtleV0pO1xuICAgICAgICBpZiAoIWVxKGN1cnJlbnQsIG9wLnZhbHVlKSkge1xuICAgICAgICAgICAgY29uc3QgeyB0eXBlLCBpZCB9ID0gb3AucmVjb3JkO1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlcGxhY2VLZXknLFxuICAgICAgICAgICAgICAgIHJlY29yZDogeyB0eXBlLCBpZCB9LFxuICAgICAgICAgICAgICAgIGtleSxcbiAgICAgICAgICAgICAgICB2YWx1ZTogY3VycmVudFxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH0sXG4gICAgcmVwbGFjZUF0dHJpYnV0ZShjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgeyBhdHRyaWJ1dGUgfSA9IG9wO1xuICAgICAgICBjb25zdCByZWNvcmQgPSBjYWNoZS5nZXRSZWNvcmRTeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGNvbnN0IGN1cnJlbnQgPSByZWNvcmQgJiYgZGVlcEdldChyZWNvcmQsIFsnYXR0cmlidXRlcycsIGF0dHJpYnV0ZV0pO1xuICAgICAgICBpZiAoIWVxKGN1cnJlbnQsIG9wLnZhbHVlKSkge1xuIC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yZHM6IGN1cnJlbnRSZWxhdGVkUmVjb3JkcyB8fCBbXVxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH0sXG4gICAgcmVwbGFjZVJlbGF0ZWRSZWNvcmQoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IHsgcmVjb3JkLCByZWxhdGlvbnNoaXAsIHJlbGF0ZWRSZWNvcmQgfSA9IG9wO1xuICAgICAgICBjb25zdCBjdXJyZW50UmVsYXRlZFJlY29yZCA9IGNhY2hlLmdldFJlbGF0ZWRSZWNvcmRTeW5jKHJlY29yZCwgcmVsYXRpb25zaGlwKTtcbiAgICAgICAgaWYgKGN1cnJlbnRSZWxhdGVkUmVjb3JkID09PSB1bmRlZmluZWQgfHwgIWVxdWFsUmVjb3JkSWRlbnRpdGllcyhjdXJyZW50UmVsYXRlZFJlY29yZCwgcmVsYXRlZFJlY29yZCkpIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgb3A6ICdyZXBsYWNlUmVsYXRlZFJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkLFxuICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcCxcbiAgICAgICAgICAgICAgICByZWxhdGVkUmVjb3JkOiBjdXJyZW50UmVsYXRlZFJlY29yZCB8fCBudWxsXG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfVxufTsiXX0= | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm9wZXJhdG9ycy9zeW5jLWludmVyc2UtcGF0Y2gtb3BlcmF0b3JzLmpzIl0sIm5hbWVzIjpbImRlZXBHZXQiLCJkZWVwU2V0IiwiZXEiLCJpc0FycmF5IiwiZXF1YWxSZWNvcmRJZGVudGl0aWVzIiwiZXF1YWxSZWNvcmRJZGVudGl0eVNldHMiLCJyZWNvcmRzSW5jbHVkZSIsIlN5bmNJbnZlcnNlUGF0Y2hPcGVy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ICd1cGRhdGVSZWNvcmQnLFxuICAgICAgICAgICAgICAgICAgICByZWNvcmQ6IGN1cnJlbnRcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmV0dXJuIHtcbiAgICAgICAgICAgICAgICBvcDogJ3JlbW92ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgcmVjb3JkOiB7IHR5cGUsIGlkIH1cbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIHVwZGF0ZVJlY29yZChjYWNoZSwgb3ApIHtcbiAgICAgICAgY29uc3QgY3VycmVudCA9IGNhY2hlLmdldFJlY29yZFN5bmMob3AucmVjb3JkKTtcbiAgICAgICAgY29uc3QgcmVwbGFjZW1lbnQgPSBvcC5yZWNvcmQ7XG4gICAgICAgIGNvbnN0IHsgdHlwZSwgaWQgfSA9IHJlcGxhY2VtZW50O1xuICAgICAgICBpZiAoY3VycmVudCkge1xuICAgICAgICAgICAgbGV0IHJlc3VsdCA9IHsgdHlwZSwgaWQgfTtcbiAgICAgICAgICAgIGxldCBjaGFuZ2VkID0gZmFsc2U7XG4gICAgICAgICAgICBbJ2F0dHJpYnV0ZXMnLCAna2V5cyddLmZvckVhY2goZ3JvdXBpbmcgPT4ge1xuICAgICAgICAgICAgICAgIGlmIChyZXBsYWNlbWVudFtncm91cGluZ10pIHtcbiAgICAgICAgICAgICAgICAgICAgT2JqZWN0LmtleXMocmVwbGFjZW1lbnRbZ3JvdXBpbmddKS5mb3JFYWNoKGZpZWxkID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB2YWx1ZSA9IHJlcGxhY2VtZW50W2dyb3VwaW5nXVtmaWVsZF07XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgY3VycmVudFZhbHVlID0gZGVlcEdldChjdXJyZW50LCBbZ3JvdXBpbmcsIGZpZWxkXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWVxKHZhbHVlLCBjdXJyZW50VmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhbmdlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVlcFNldChyZXN1bHQsIFtncm91cGluZywgZmllbGRdLCBjdXJyZW50VmFsdWUgPT09IHVuZGVmaW5lZCA/IG51bGwgOiBjdXJyZW50VmFsdWUpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGlmIChyZXBsYWNlbWVudC5yZWxhdGlvbnNoaXBzKSB7XG4gICAgICAgICAgICAgICAgT2JqZWN0LmtleXMocmVwbGFjZW1lbnQucmVsYXRpb25zaGlwcykuZm9yRWFjaChmaWVsZCA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGxldCBkYXRhID0gZGVlcEdldChyZXBsYWNlbWVudCwgWydyZWxhdGlvbnNoaXBzJywgZmllbGQsICdkYXRhJ10pO1xuICAgICAgICAgICAgICAgICAgICBpZiAoZGF0YSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgY3VycmVudERhdGEgPSBkZWVwR2V0KGN1cnJlbnQsIFsncmVsYXRpb25zaGlwcycsIGZpZWxkLCAnZGF0YSddKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCByZWxhdGlvbnNoaXBDaGFuZ2VkO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlzQXJyYXkoZGF0YSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3VycmVudERhdGEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwQ2hhbmdlZCA9ICFlcXVhbFJlY29yZElkZW50aXR5U2V0cyhjdXJyZW50RGF0YSwgZGF0YSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwQ2hhbmdlZCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1cnJlbnREYXRhID0gW107XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3VycmVudERhdGEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVsYXRpb25zaGlwQ2hhbmdlZCA9ICFlcXVhbFJlY29yZElkZW50aXRpZXMoY3VycmVudERhdGEsIGRhdGEpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbGF0aW9uc2hpcENoYW5nZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW50RGF0YSA9IG51bGw7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlbGF0aW9uc2hpcENoYW5nZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFuZ2VkID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWVwU2V0KHJlc3VsdCwgWydyZWxhdGlvbnNoaXBzJywgZmllbGQsICdkYXRhJ10sIGN1cnJlbnREYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGNoYW5nZWQpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICBvcDogJ3VwZGF0ZVJlY29yZCcsXG4gICAgICAgICAgICAgICAgICAgIHJlY29yZDogcmVzdWx0XG4gICAgICAgICAgICAgICAgfTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgb3A6ICdyZW1vdmVSZWNvcmQnLFxuICAgICAgICAgICAgICAgIHJlY29yZDogeyB0eXBlLCBpZCB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgfSxcbiAgICByZW1vdmVSZWNvcmQoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IGN1cnJlbnQgPSBjYWNoZS5nZXRSZWNvcmRTeW5jKG9wLnJlY29yZCk7XG4gICAgICAgIGlmIChjdXJyZW50KSB7XG4gICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgIG9wOiAnYWRkUmVjb3JkJyxcbiAgICAgICAgICAgICAgICByZWNvcmQ6IGN1cnJlbnRcbiAgICAgICAgICAgIH07XG4gICAgICAgIH1cbiAgICB9LFxuICAgIHJlcGxhY2VLZXkoY2FjaGUsIG9wKSB7XG4gICAgICAgIGNvbnN0IHsga2V5IH0gPSBvcDtcbiAgICAgICAgY29uc3QgcmVjb3JkID0gY2FjaGUuZ2V0UmVjb3JkU3luYyhvcC5yZWNvcmQpO1xuICAgICAgICBjb25zdCBjdXJyZW50ID0gcmVjb3JkICYmIGRlZXBHZXQocmVjb3JkLCBbJ2tleXMnLCBrZXldKTtcbiAgICAgICAgaWYgKCFlcShjdXJyZW50LCBvcC52YWx1ZSkpIHtcbiAgICAgICAgICAgIGNvbnN0IHsgdHlwZSwgaWQgfSA9IG9wLnJlY29yZDtcbiAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgb3A6ICdyZXBsYWNlS2V5JyxcbiAgICAgICAgICAgICAgICByZWNvcmQ6IHsgdHlwZSwgaWQgfSxcbiAgICAgICAgICAgICAgICBrZXks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FJlY29yZDogY3VycmVudFJlbGF0ZWRSZWNvcmQgfHwgbnVsbFxuICAgICAgICAgICAgfTtcbiAgICAgICAgfVxuICAgIH1cbn07Il19 |
{ | ||
"name": "@orbit/record-cache", | ||
"version": "0.16.0-beta.4", | ||
"version": "0.16.0-beta.5", | ||
"description": "Orbit base classes used to access and maintain a set of records.", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -70,15 +70,28 @@ import { Dict, deepGet, deepSet, eq, isArray } from '@orbit/utils'; | ||
Object.keys(replacement.relationships).forEach(field => { | ||
let currentData = deepGet(current, ['relationships', field, 'data']); | ||
let data = deepGet(replacement, ['relationships', field, 'data']); | ||
if (data !== undefined) { | ||
let currentData = deepGet(current, ['relationships', field, 'data']); | ||
let relationshipChanged; | ||
let relationshipMatch; | ||
if (isArray(data)) { | ||
relationshipMatch = equalRecordIdentitySets(currentData, data); | ||
} else { | ||
relationshipMatch = equalRecordIdentities(currentData, data); | ||
} | ||
if (isArray(data)) { | ||
if (currentData) { | ||
relationshipChanged = !equalRecordIdentitySets(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = []; | ||
} | ||
if (!relationshipMatch) { | ||
changed = true; | ||
deepSet(result, ['relationships', field, 'data'], currentData === undefined ? null : currentData); | ||
} else { | ||
if (currentData) { | ||
relationshipChanged = !equalRecordIdentities(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = null; | ||
} | ||
} | ||
if (relationshipChanged) { | ||
changed = true; | ||
deepSet(result, ['relationships', field, 'data'], currentData); | ||
} | ||
} | ||
@@ -85,0 +98,0 @@ }); |
@@ -70,15 +70,28 @@ import { Dict, deepGet, deepSet, eq, isArray } from '@orbit/utils'; | ||
Object.keys(replacement.relationships).forEach(field => { | ||
let currentData = deepGet(current, ['relationships', field, 'data']); | ||
let data = deepGet(replacement, ['relationships', field, 'data']); | ||
if (data !== undefined) { | ||
let currentData = deepGet(current, ['relationships', field, 'data']); | ||
let relationshipChanged; | ||
let relationshipMatch; | ||
if (isArray(data)) { | ||
relationshipMatch = equalRecordIdentitySets(currentData, data); | ||
} else { | ||
relationshipMatch = equalRecordIdentities(currentData, data); | ||
} | ||
if (isArray(data)) { | ||
if (currentData) { | ||
relationshipChanged = !equalRecordIdentitySets(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = []; | ||
} | ||
if (!relationshipMatch) { | ||
changed = true; | ||
deepSet(result, ['relationships', field, 'data'], currentData === undefined ? null : currentData); | ||
} else { | ||
if (currentData) { | ||
relationshipChanged = !equalRecordIdentities(currentData, data); | ||
} else { | ||
relationshipChanged = true; | ||
currentData = null; | ||
} | ||
} | ||
if (relationshipChanged) { | ||
changed = true; | ||
deepSet(result, ['relationships', field, 'data'], currentData); | ||
} | ||
} | ||
@@ -85,0 +98,0 @@ }); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1256172
13994