@pokash/n8n-nodes-optima-rest-api 1.1.2 → 1.1.3

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,18 +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;
431
434
  // Extract customers array from response
432
435
  if (responseData.Customers && Array.isArray(responseData.Customers)) {
433
- const items = responseData.Customers.map(item => ({ json: item }));
434
- returnData.push(...items);
436
+ const resultItems = responseData.Customers.map(item => ({
437
+ json: item,
438
+ binary: binaryData
439
+ }));
440
+ returnData.push(...resultItems);
435
441
  }
436
442
  else if (responseData.Customers) {
437
443
  // Single customer
438
- returnData.push({ json: responseData.Customers });
444
+ returnData.push({
445
+ json: responseData.Customers,
446
+ binary: binaryData
447
+ });
439
448
  }
440
449
  else {
441
450
  // Fallback - return entire response if structure is unexpected
442
- returnData.push({ json: responseData });
451
+ returnData.push({
452
+ json: responseData,
453
+ binary: binaryData
454
+ });
443
455
  }
444
456
  }
445
457
  else if (operation === 'create') {
@@ -453,7 +465,10 @@ class OptimaRestApi {
453
465
  body: customerData,
454
466
  json: true,
455
467
  });
456
- returnData.push({ json: response });
468
+ returnData.push({
469
+ json: response,
470
+ binary: items[i].binary
471
+ });
457
472
  }
458
473
  else if (operation === 'update') {
459
474
  const customerId = this.getNodeParameter('customerId', i);
@@ -469,7 +484,10 @@ class OptimaRestApi {
469
484
  body: customerData,
470
485
  json: true,
471
486
  });
472
- returnData.push({ json: response });
487
+ returnData.push({
488
+ json: response,
489
+ binary: items[i].binary
490
+ });
473
491
  }
474
492
  else if (operation === 'delete') {
475
493
  const customerId = this.getNodeParameter('customerId', i);
@@ -481,7 +499,10 @@ class OptimaRestApi {
481
499
  },
482
500
  json: true,
483
501
  });
484
- returnData.push({ json: { success: true, id: customerId } });
502
+ returnData.push({
503
+ json: { success: true, id: customerId },
504
+ binary: items[i].binary
505
+ });
485
506
  }
486
507
  }
487
508
  else if (resource === 'document') {
@@ -497,7 +518,10 @@ class OptimaRestApi {
497
518
  body: documentData,
498
519
  json: true,
499
520
  });
500
- returnData.push({ json: response });
521
+ returnData.push({
522
+ json: response,
523
+ binary: items[i].binary
524
+ });
501
525
  }
502
526
  }
503
527
  else if (resource === 'dictionary') {
@@ -521,14 +545,22 @@ class OptimaRestApi {
521
545
  });
522
546
  // API returns { Success: true, [DataKey]: [...], TotalCount: ... }
523
547
  const responseData = response;
548
+ // Preserve binary data from input item
549
+ const binaryData = items[i].binary;
524
550
  // Extract dictionary array from response
525
551
  if (responseData[dictConfig.dataKey] && Array.isArray(responseData[dictConfig.dataKey])) {
526
- const items = responseData[dictConfig.dataKey].map(item => ({ json: item }));
527
- returnData.push(...items);
552
+ const resultItems = responseData[dictConfig.dataKey].map(item => ({
553
+ json: item,
554
+ binary: binaryData
555
+ }));
556
+ returnData.push(...resultItems);
528
557
  }
529
558
  else {
530
559
  // Fallback - return entire response if structure is unexpected
531
- returnData.push({ json: responseData });
560
+ returnData.push({
561
+ json: responseData,
562
+ binary: binaryData
563
+ });
532
564
  }
533
565
  }
534
566
  }
@@ -543,7 +575,10 @@ class OptimaRestApi {
543
575
  },
544
576
  json: true,
545
577
  });
546
- returnData.push({ json: response });
578
+ returnData.push({
579
+ json: response,
580
+ binary: items[i].binary
581
+ });
547
582
  }
548
583
  else if (operation === 'getAll') {
549
584
  const response = await this.helpers.request({
@@ -554,8 +589,12 @@ class OptimaRestApi {
554
589
  },
555
590
  json: true,
556
591
  });
557
- const items = response.map(item => ({ json: item }));
558
- returnData.push(...items);
592
+ const binaryData = items[i].binary;
593
+ const resultItems = response.map(item => ({
594
+ json: item,
595
+ binary: binaryData
596
+ }));
597
+ returnData.push(...resultItems);
559
598
  }
560
599
  }
561
600
  else if (resource === 'print') {
@@ -600,7 +639,10 @@ class OptimaRestApi {
600
639
  catch (error) {
601
640
  const errorMessage = error instanceof Error ? error.message : String(error);
602
641
  if (this.continueOnFail()) {
603
- returnData.push({ json: { error: errorMessage } });
642
+ returnData.push({
643
+ json: { error: errorMessage },
644
+ binary: items[i].binary
645
+ });
604
646
  continue;
605
647
  }
606
648
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), errorMessage);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pokash/n8n-nodes-optima-rest-api",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "n8n node for Comarch Optima REST API integration",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",