@pokash/n8n-nodes-optima-rest-api 1.1.3 → 1.1.4
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.
Potentially problematic release.
This version of @pokash/n8n-nodes-optima-rest-api might be problematic. Click here for more details.
|
@@ -428,29 +428,30 @@ class OptimaRestApi {
|
|
|
428
428
|
});
|
|
429
429
|
// API returns { Success: true, Customers: [...], TotalCount: ... }
|
|
430
430
|
const responseData = response;
|
|
431
|
-
// Preserve binary data from input item
|
|
432
|
-
const inputItem = items[i];
|
|
433
|
-
const binaryData = inputItem.binary;
|
|
434
431
|
// Extract customers array from response
|
|
435
432
|
if (responseData.Customers && Array.isArray(responseData.Customers)) {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
433
|
+
// For arrays, only preserve binary on first item to avoid duplication
|
|
434
|
+
const customers = responseData.Customers;
|
|
435
|
+
customers.forEach((item, index) => {
|
|
436
|
+
returnData.push({
|
|
437
|
+
json: item,
|
|
438
|
+
// Only preserve binary on first item when splitting 1 input into many outputs
|
|
439
|
+
binary: index === 0 ? items[i].binary : undefined
|
|
440
|
+
});
|
|
441
|
+
});
|
|
441
442
|
}
|
|
442
443
|
else if (responseData.Customers) {
|
|
443
|
-
// Single customer
|
|
444
|
+
// Single customer - preserve binary
|
|
444
445
|
returnData.push({
|
|
445
446
|
json: responseData.Customers,
|
|
446
|
-
binary:
|
|
447
|
+
binary: items[i].binary
|
|
447
448
|
});
|
|
448
449
|
}
|
|
449
450
|
else {
|
|
450
451
|
// Fallback - return entire response if structure is unexpected
|
|
451
452
|
returnData.push({
|
|
452
453
|
json: responseData,
|
|
453
|
-
binary:
|
|
454
|
+
binary: items[i].binary
|
|
454
455
|
});
|
|
455
456
|
}
|
|
456
457
|
}
|
|
@@ -545,21 +546,23 @@ class OptimaRestApi {
|
|
|
545
546
|
});
|
|
546
547
|
// API returns { Success: true, [DataKey]: [...], TotalCount: ... }
|
|
547
548
|
const responseData = response;
|
|
548
|
-
// Preserve binary data from input item
|
|
549
|
-
const binaryData = items[i].binary;
|
|
550
549
|
// Extract dictionary array from response
|
|
551
550
|
if (responseData[dictConfig.dataKey] && Array.isArray(responseData[dictConfig.dataKey])) {
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
551
|
+
// For arrays, only preserve binary on first item to avoid duplication
|
|
552
|
+
const dictItems = responseData[dictConfig.dataKey];
|
|
553
|
+
dictItems.forEach((item, index) => {
|
|
554
|
+
returnData.push({
|
|
555
|
+
json: item,
|
|
556
|
+
// Only preserve binary on first item when splitting 1 input into many outputs
|
|
557
|
+
binary: index === 0 ? items[i].binary : undefined
|
|
558
|
+
});
|
|
559
|
+
});
|
|
557
560
|
}
|
|
558
561
|
else {
|
|
559
562
|
// Fallback - return entire response if structure is unexpected
|
|
560
563
|
returnData.push({
|
|
561
564
|
json: responseData,
|
|
562
|
-
binary:
|
|
565
|
+
binary: items[i].binary
|
|
563
566
|
});
|
|
564
567
|
}
|
|
565
568
|
}
|
|
@@ -589,12 +592,15 @@ class OptimaRestApi {
|
|
|
589
592
|
},
|
|
590
593
|
json: true,
|
|
591
594
|
});
|
|
592
|
-
|
|
593
|
-
const
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
595
|
+
// For arrays, only preserve binary on first item to avoid duplication
|
|
596
|
+
const products = response;
|
|
597
|
+
products.forEach((item, index) => {
|
|
598
|
+
returnData.push({
|
|
599
|
+
json: item,
|
|
600
|
+
// Only preserve binary on first item when splitting 1 input into many outputs
|
|
601
|
+
binary: index === 0 ? items[i].binary : undefined
|
|
602
|
+
});
|
|
603
|
+
});
|
|
598
604
|
}
|
|
599
605
|
}
|
|
600
606
|
else if (resource === 'print') {
|