@pokash/n8n-nodes-optima-rest-api 1.0.5 → 1.0.6

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.

@@ -314,7 +314,7 @@ class OptimaRestApi {
314
314
  },
315
315
  json: true,
316
316
  });
317
- returnData.push(response);
317
+ returnData.push({ json: response });
318
318
  }
319
319
  else if (operation === 'getAll') {
320
320
  const response = await this.helpers.request({
@@ -325,7 +325,8 @@ class OptimaRestApi {
325
325
  },
326
326
  json: true,
327
327
  });
328
- returnData.push(...response);
328
+ const items = response.map(item => ({ json: item }));
329
+ returnData.push(...items);
329
330
  }
330
331
  else if (operation === 'create') {
331
332
  const customerData = JSON.parse(this.getNodeParameter('customerData', i));
@@ -338,7 +339,7 @@ class OptimaRestApi {
338
339
  body: customerData,
339
340
  json: true,
340
341
  });
341
- returnData.push(response);
342
+ returnData.push({ json: response });
342
343
  }
343
344
  else if (operation === 'update') {
344
345
  const customerId = this.getNodeParameter('customerId', i);
@@ -354,7 +355,7 @@ class OptimaRestApi {
354
355
  body: customerData,
355
356
  json: true,
356
357
  });
357
- returnData.push(response);
358
+ returnData.push({ json: response });
358
359
  }
359
360
  else if (operation === 'delete') {
360
361
  const customerId = this.getNodeParameter('customerId', i);
@@ -366,7 +367,7 @@ class OptimaRestApi {
366
367
  },
367
368
  json: true,
368
369
  });
369
- returnData.push({ success: true, id: customerId });
370
+ returnData.push({ json: { success: true, id: customerId } });
370
371
  }
371
372
  }
372
373
  else if (resource === 'document') {
@@ -382,7 +383,7 @@ class OptimaRestApi {
382
383
  body: documentData,
383
384
  json: true,
384
385
  });
385
- returnData.push(response);
386
+ returnData.push({ json: response });
386
387
  }
387
388
  }
388
389
  else if (resource === 'product') {
@@ -396,7 +397,7 @@ class OptimaRestApi {
396
397
  },
397
398
  json: true,
398
399
  });
399
- returnData.push(response);
400
+ returnData.push({ json: response });
400
401
  }
401
402
  else if (operation === 'getAll') {
402
403
  const response = await this.helpers.request({
@@ -407,7 +408,8 @@ class OptimaRestApi {
407
408
  },
408
409
  json: true,
409
410
  });
410
- returnData.push(...response);
411
+ const items = response.map(item => ({ json: item }));
412
+ returnData.push(...items);
411
413
  }
412
414
  }
413
415
  else if (resource === 'print') {
@@ -432,12 +434,18 @@ class OptimaRestApi {
432
434
  const buffer = Buffer.isBuffer(response)
433
435
  ? response
434
436
  : Buffer.from(response);
437
+ const fileName = `document_${Date.now()}.pdf`;
435
438
  returnData.push({
436
- success: true,
439
+ json: {
440
+ success: true,
441
+ fileName: fileName,
442
+ },
437
443
  binary: {
438
- data: buffer,
439
- mimeType: 'application/pdf',
440
- fileName: `document_${Date.now()}.pdf`,
444
+ data: {
445
+ data: buffer.toString('base64'),
446
+ mimeType: 'application/pdf',
447
+ fileName: fileName,
448
+ },
441
449
  },
442
450
  });
443
451
  }
@@ -446,13 +454,13 @@ class OptimaRestApi {
446
454
  catch (error) {
447
455
  const errorMessage = error instanceof Error ? error.message : String(error);
448
456
  if (this.continueOnFail()) {
449
- returnData.push({ error: errorMessage });
457
+ returnData.push({ json: { error: errorMessage } });
450
458
  continue;
451
459
  }
452
460
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), errorMessage);
453
461
  }
454
462
  }
455
- return [this.helpers.returnJsonArray(returnData)];
463
+ return [returnData];
456
464
  }
457
465
  }
458
466
  exports.OptimaRestApi = OptimaRestApi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pokash/n8n-nodes-optima-rest-api",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "n8n node for Comarch Optima REST API integration",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",