@pokash/n8n-nodes-optima-rest-api 1.1.11 → 1.1.12

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.
@@ -431,19 +431,27 @@ class OptimaRestApi {
431
431
  // Extract customers array from response
432
432
  if (responseData.Customers && Array.isArray(responseData.Customers)) {
433
433
  const customers = responseData.Customers;
434
- // First, preserve binary from input (empty JSON)
434
+ // Preserve binary from input if present
435
435
  if (items[i].binary) {
436
436
  returnData.push({
437
- json: {},
437
+ json: customers[0] || {},
438
438
  binary: items[i].binary
439
439
  });
440
+ // Add remaining customers (without binary)
441
+ customers.slice(1).forEach((item) => {
442
+ returnData.push({
443
+ json: item
444
+ });
445
+ });
440
446
  }
441
- // Then add customer items (without binary to avoid duplication)
442
- customers.forEach((item) => {
443
- returnData.push({
444
- json: item
447
+ else {
448
+ // No binary - just add all customers normally
449
+ customers.forEach((item) => {
450
+ returnData.push({
451
+ json: item
452
+ });
445
453
  });
446
- });
454
+ }
447
455
  }
448
456
  else if (responseData.Customers) {
449
457
  // Single customer - preserve binary
@@ -572,19 +580,27 @@ class OptimaRestApi {
572
580
  // Extract dictionary array from response
573
581
  if (responseData[dictConfig.dataKey] && Array.isArray(responseData[dictConfig.dataKey])) {
574
582
  const dictItems = responseData[dictConfig.dataKey];
575
- // First, preserve binary from input (empty JSON)
583
+ // Preserve binary from input if present
576
584
  if (items[i].binary) {
577
585
  returnData.push({
578
- json: {},
586
+ json: dictItems[0] || {},
579
587
  binary: items[i].binary
580
588
  });
589
+ // Add remaining dictionary items (without binary)
590
+ dictItems.slice(1).forEach((item) => {
591
+ returnData.push({
592
+ json: item
593
+ });
594
+ });
581
595
  }
582
- // Then add dictionary items (without binary to avoid duplication)
583
- dictItems.forEach((item) => {
584
- returnData.push({
585
- json: item
596
+ else {
597
+ // No binary - just add all items normally
598
+ dictItems.forEach((item) => {
599
+ returnData.push({
600
+ json: item
601
+ });
586
602
  });
587
- });
603
+ }
588
604
  }
589
605
  else {
590
606
  // Fallback - return entire response if structure is unexpected
@@ -627,19 +643,27 @@ class OptimaRestApi {
627
643
  json: true,
628
644
  });
629
645
  const products = response;
630
- // First, preserve binary from input (empty JSON)
646
+ // Preserve binary from input if present
631
647
  if (items[i].binary) {
632
648
  returnData.push({
633
- json: {},
649
+ json: products[0] || {},
634
650
  binary: items[i].binary
635
651
  });
652
+ // Add remaining products (without binary)
653
+ products.slice(1).forEach((item) => {
654
+ returnData.push({
655
+ json: item
656
+ });
657
+ });
636
658
  }
637
- // Then add product items (without binary to avoid duplication)
638
- products.forEach((item) => {
639
- returnData.push({
640
- json: item
659
+ else {
660
+ // No binary - just add all products normally
661
+ products.forEach((item) => {
662
+ returnData.push({
663
+ json: item
664
+ });
641
665
  });
642
- });
666
+ }
643
667
  }
644
668
  }
645
669
  else if (resource === 'print') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pokash/n8n-nodes-optima-rest-api",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "description": "n8n node for Comarch Optima REST API integration",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",