@pokash/n8n-nodes-optima-rest-api 1.1.0 → 1.1.1

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.

@@ -351,19 +351,19 @@ class OptimaRestApi {
351
351
  if (resource === 'customer') {
352
352
  if (operation === 'get' || operation === 'getAll') {
353
353
  const options = this.getNodeParameter('options', i, {});
354
- // Build query parameters
354
+ // Build query parameters (use PascalCase to match C# API)
355
355
  const queryParams = new URLSearchParams();
356
356
  if (options.id) {
357
- queryParams.append('id', String(options.id));
357
+ queryParams.append('Id', String(options.id));
358
358
  }
359
359
  if (options.filter) {
360
- queryParams.append('filter', String(options.filter));
360
+ queryParams.append('Filter', String(options.filter));
361
361
  }
362
362
  if (options.skip) {
363
- queryParams.append('skip', String(options.skip));
363
+ queryParams.append('Skip', String(options.skip));
364
364
  }
365
365
  if (options.take) {
366
- queryParams.append('take', String(options.take));
366
+ queryParams.append('Take', String(options.take));
367
367
  }
368
368
  const queryString = queryParams.toString();
369
369
  const url = queryString
@@ -377,13 +377,20 @@ class OptimaRestApi {
377
377
  },
378
378
  json: true,
379
379
  });
380
- // Handle both single customer and array of customers
381
- if (Array.isArray(response)) {
382
- const items = response.map(item => ({ json: item }));
380
+ // API returns { Success: true, Customers: [...], TotalCount: ... }
381
+ const responseData = response;
382
+ // Extract customers array from response
383
+ if (responseData.Customers && Array.isArray(responseData.Customers)) {
384
+ const items = responseData.Customers.map(item => ({ json: item }));
383
385
  returnData.push(...items);
384
386
  }
387
+ else if (responseData.Customers) {
388
+ // Single customer
389
+ returnData.push({ json: responseData.Customers });
390
+ }
385
391
  else {
386
- returnData.push({ json: response });
392
+ // Fallback - return entire response if structure is unexpected
393
+ returnData.push({ json: responseData });
387
394
  }
388
395
  }
389
396
  else if (operation === 'create') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pokash/n8n-nodes-optima-rest-api",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "n8n node for Comarch Optima REST API integration",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",