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

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.

@@ -34,6 +34,10 @@ class OptimaRestApi {
34
34
  name: 'Customer',
35
35
  value: 'customer',
36
36
  },
37
+ {
38
+ name: 'Dictionary',
39
+ value: 'dictionary',
40
+ },
37
41
  {
38
42
  name: 'Document',
39
43
  value: 'document',
@@ -169,6 +173,51 @@ class OptimaRestApi {
169
173
  default: '{\n "akronim": "KLIENT01",\n "nazwa": "Firma Example",\n "nip": "1234567890"\n}',
170
174
  description: 'Customer data in JSON format',
171
175
  },
176
+ // Dictionary Operations
177
+ {
178
+ displayName: 'Dictionary Type',
179
+ name: 'operation',
180
+ type: 'options',
181
+ noDataExpression: true,
182
+ displayOptions: {
183
+ show: {
184
+ resource: ['dictionary'],
185
+ },
186
+ },
187
+ options: [
188
+ {
189
+ name: 'Payment Methods',
190
+ value: 'paymentMethods',
191
+ description: 'Get payment methods dictionary',
192
+ action: 'Get payment methods',
193
+ },
194
+ {
195
+ name: 'Warehouses',
196
+ value: 'warehouses',
197
+ description: 'Get warehouses dictionary',
198
+ action: 'Get warehouses',
199
+ },
200
+ {
201
+ name: 'Currencies',
202
+ value: 'currencies',
203
+ description: 'Get currencies dictionary',
204
+ action: 'Get currencies',
205
+ },
206
+ {
207
+ name: 'Document Definitions',
208
+ value: 'documentDefinitions',
209
+ description: 'Get document definitions dictionary',
210
+ action: 'Get document definitions',
211
+ },
212
+ {
213
+ name: 'Accounting Categories',
214
+ value: 'accountingCategories',
215
+ description: 'Get accounting categories dictionary',
216
+ action: 'Get accounting categories',
217
+ },
218
+ ],
219
+ default: 'paymentMethods',
220
+ },
172
221
  // Document Operations
173
222
  {
174
223
  displayName: 'Operation',
@@ -451,6 +500,38 @@ class OptimaRestApi {
451
500
  returnData.push({ json: response });
452
501
  }
453
502
  }
503
+ else if (resource === 'dictionary') {
504
+ // Dictionary operations - map operation names to API endpoints
505
+ const dictionaryEndpoints = {
506
+ paymentMethods: { endpoint: 'Dictionary/PaymentMethods', dataKey: 'PaymentMethods' },
507
+ warehouses: { endpoint: 'Dictionary/Warehouses', dataKey: 'Warehouses' },
508
+ currencies: { endpoint: 'Dictionary/Currencies', dataKey: 'Currencies' },
509
+ documentDefinitions: { endpoint: 'Dictionary/DocumentDefinitions', dataKey: 'DocumentDefinitions' },
510
+ accountingCategories: { endpoint: 'Dictionary/AccountingCategories', dataKey: 'AccountingCategories' },
511
+ };
512
+ const dictConfig = dictionaryEndpoints[operation];
513
+ if (dictConfig) {
514
+ const response = await this.helpers.request({
515
+ method: 'GET',
516
+ url: `${gatewayUrl}/api/${dictConfig.endpoint}`,
517
+ headers: {
518
+ Authorization: `Bearer ${token}`,
519
+ },
520
+ json: true,
521
+ });
522
+ // API returns { Success: true, [DataKey]: [...], TotalCount: ... }
523
+ const responseData = response;
524
+ // Extract dictionary array from response
525
+ if (responseData[dictConfig.dataKey] && Array.isArray(responseData[dictConfig.dataKey])) {
526
+ const items = responseData[dictConfig.dataKey].map(item => ({ json: item }));
527
+ returnData.push(...items);
528
+ }
529
+ else {
530
+ // Fallback - return entire response if structure is unexpected
531
+ returnData.push({ json: responseData });
532
+ }
533
+ }
534
+ }
454
535
  else if (resource === 'product') {
455
536
  if (operation === 'get') {
456
537
  const productId = this.getNodeParameter('productId', i);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pokash/n8n-nodes-optima-rest-api",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "n8n node for Comarch Optima REST API integration",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",