@oondemand/oon-core-back 0.3.60 → 0.3.61
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
CHANGED
|
@@ -173,6 +173,7 @@ async function synchronizeOmieList(definitions, list, event, context = {}) {
|
|
|
173
173
|
const failures = [];
|
|
174
174
|
|
|
175
175
|
for (const [index, item] of items.entries()) {
|
|
176
|
+
let externalValue;
|
|
176
177
|
try {
|
|
177
178
|
const mapped = mapRecord(item, list.mapping || {}, {
|
|
178
179
|
input,
|
|
@@ -180,7 +181,7 @@ async function synchronizeOmieList(definitions, list, event, context = {}) {
|
|
|
180
181
|
instanceId,
|
|
181
182
|
});
|
|
182
183
|
const externalField = list.target.externalKey;
|
|
183
|
-
|
|
184
|
+
externalValue = mapped[externalField]
|
|
184
185
|
?? getPath(item, list.sourceExternalKey || externalField);
|
|
185
186
|
if (externalValue === undefined || externalValue === null || externalValue === "") {
|
|
186
187
|
throw new GenericError(`Item sem chave externa ${externalField}.`, { statusCode: 422 });
|
|
@@ -226,7 +227,13 @@ async function synchronizeOmieList(definitions, list, event, context = {}) {
|
|
|
226
227
|
context.recordItem?.({ index, externalKey: externalValue, status: current ? "updated" : "created" });
|
|
227
228
|
} catch (error) {
|
|
228
229
|
summary.errors += 1;
|
|
229
|
-
const failure = {
|
|
230
|
+
const failure = {
|
|
231
|
+
index,
|
|
232
|
+
...(externalValue !== undefined && externalValue !== null && externalValue !== ""
|
|
233
|
+
? { externalKey: sanitizeIntegrationValue(externalValue) }
|
|
234
|
+
: {}),
|
|
235
|
+
error: sanitizeIntegrationError(error),
|
|
236
|
+
};
|
|
230
237
|
failures.push(failure);
|
|
231
238
|
context.recordItem?.(failure);
|
|
232
239
|
context.recordError?.(failure);
|