@pokash/n8n-nodes-optima-rest-api 1.11.0 → 1.12.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.
@@ -141,7 +141,61 @@ class OptimaRestApi {
141
141
  type: 'string',
142
142
  default: '',
143
143
  placeholder: 'Knt_Kod = \'TEST\'',
144
- description: 'SQL-like filter string for searching customers (e.g., Knt_Kod = \'ACME\' or Knt_Nip = \'1234567890\')',
144
+ description: 'Deprecated — raw SQL condition, admin only on secured gateways. Use the named filters below.',
145
+ },
146
+ // TNXP-791: jawne filtry (GET /api/customer?kod=…) — wartości jako parametry, bez SQL
147
+ {
148
+ displayName: 'Code (Akronim)',
149
+ name: 'kod',
150
+ type: 'string',
151
+ default: '',
152
+ description: 'Customer code (exact match)',
153
+ },
154
+ {
155
+ displayName: 'NIP',
156
+ name: 'nip',
157
+ type: 'string',
158
+ default: '',
159
+ description: 'Tax ID — dashes, spaces and country prefix are ignored',
160
+ },
161
+ {
162
+ displayName: 'Name Contains',
163
+ name: 'nazwa',
164
+ type: 'string',
165
+ default: '',
166
+ description: 'Part of the first name line (case-insensitive)',
167
+ },
168
+ {
169
+ displayName: 'Email',
170
+ name: 'email',
171
+ type: 'string',
172
+ default: '',
173
+ description: 'Email address (exact match)',
174
+ },
175
+ {
176
+ displayName: 'Group',
177
+ name: 'grupa',
178
+ type: 'string',
179
+ default: '',
180
+ description: 'Customer group (exact match)',
181
+ },
182
+ {
183
+ displayName: 'Active',
184
+ name: 'aktywny',
185
+ type: 'options',
186
+ options: [
187
+ { name: 'Only Active', value: 'true' },
188
+ { name: 'Only Inactive', value: 'false' },
189
+ ],
190
+ default: 'true',
191
+ description: 'Filter by active flag',
192
+ },
193
+ {
194
+ displayName: 'Changed Since',
195
+ name: 'zmienionyOd',
196
+ type: 'dateTime',
197
+ default: '',
198
+ description: 'Only records changed at or after this date and time (incremental sync)',
145
199
  },
146
200
  {
147
201
  displayName: 'Skip',
@@ -632,7 +686,65 @@ class OptimaRestApi {
632
686
  name: 'filter',
633
687
  type: 'string',
634
688
  default: '',
635
- description: 'SQL-like filter expression (e.g., "Twr_Kod=\'PROD01\'" or "Twr_Nazwa LIKE \'%laptop%\'")',
689
+ description: 'Deprecated — raw SQL condition, admin only on secured gateways. Use the named filters below.',
690
+ },
691
+ // TNXP-791: jawne filtry (GET /api/product?kod=…) — wartości jako parametry, bez SQL
692
+ {
693
+ displayName: 'Code',
694
+ name: 'kod',
695
+ type: 'string',
696
+ default: '',
697
+ description: 'Product code (exact match)',
698
+ },
699
+ {
700
+ displayName: 'EAN',
701
+ name: 'ean',
702
+ type: 'string',
703
+ default: '',
704
+ description: 'EAN code (exact match)',
705
+ },
706
+ {
707
+ displayName: 'Name Contains',
708
+ name: 'nazwa',
709
+ type: 'string',
710
+ default: '',
711
+ description: 'Part of the product name (case-insensitive)',
712
+ },
713
+ {
714
+ displayName: 'Type',
715
+ name: 'typ',
716
+ type: 'options',
717
+ options: [
718
+ { name: 'Towar', value: 'Towar' },
719
+ { name: 'Usługa', value: 'Usługa' },
720
+ ],
721
+ default: 'Towar',
722
+ description: 'Product or service',
723
+ },
724
+ {
725
+ displayName: 'Group',
726
+ name: 'grupa',
727
+ type: 'string',
728
+ default: '',
729
+ description: 'Product group code (exact match)',
730
+ },
731
+ {
732
+ displayName: 'Active',
733
+ name: 'aktywny',
734
+ type: 'options',
735
+ options: [
736
+ { name: 'Only Active', value: 'true' },
737
+ { name: 'Only Inactive', value: 'false' },
738
+ ],
739
+ default: 'true',
740
+ description: 'Filter by active flag',
741
+ },
742
+ {
743
+ displayName: 'Changed Since',
744
+ name: 'zmienionyOd',
745
+ type: 'dateTime',
746
+ default: '',
747
+ description: 'Only records changed at or after this date and time (incremental sync)',
636
748
  },
637
749
  {
638
750
  displayName: 'Skip',
@@ -871,6 +983,12 @@ class OptimaRestApi {
871
983
  if (options.filter) {
872
984
  queryParams.append('Filter', String(options.filter));
873
985
  }
986
+ // TNXP-791: jawne filtry
987
+ for (const pole of ['kod', 'nip', 'nazwa', 'email', 'grupa', 'aktywny', 'zmienionyOd']) {
988
+ if (options[pole] !== undefined && options[pole] !== '') {
989
+ queryParams.append(pole, String(options[pole]));
990
+ }
991
+ }
874
992
  if (options.skip) {
875
993
  queryParams.append('Skip', String(options.skip));
876
994
  }
@@ -881,11 +999,16 @@ class OptimaRestApi {
881
999
  const url = queryString
882
1000
  ? `${gatewayUrl}/api/customer?${queryString}`
883
1001
  : `${gatewayUrl}/api/customer`;
884
- const response = await makeAuthenticatedRequest({
885
- method: 'GET',
886
- url,
887
- json: true,
888
- });
1002
+ // TNXP-791: skonfigurowany filtr dokładny z pustą wartością (np. pusty akronim z wyrażenia) = brak wyników,
1003
+ // jak dawny surowy filtr Knt_Kod='' — bez tego węzeł pominąłby filtr i zwrócił całą listę.
1004
+ const pustyFiltrDokladny = ['kod', 'nip', 'email', 'grupa'].some((pole) => { var _a; return pole in options && String((_a = options[pole]) !== null && _a !== void 0 ? _a : '').trim() === ''; });
1005
+ const response = pustyFiltrDokladny
1006
+ ? { Success: true, Customers: [], TotalCount: 0 }
1007
+ : await makeAuthenticatedRequest({
1008
+ method: 'GET',
1009
+ url,
1010
+ json: true,
1011
+ });
889
1012
  // API returns { Success: true, Customers: [...], TotalCount: ... }
890
1013
  const responseData = response;
891
1014
  // Extract customers array from response
@@ -1190,6 +1313,12 @@ class OptimaRestApi {
1190
1313
  if (options.filter) {
1191
1314
  queryParams.append('Filter', String(options.filter));
1192
1315
  }
1316
+ // TNXP-791: jawne filtry
1317
+ for (const pole of ['kod', 'ean', 'nazwa', 'typ', 'grupa', 'aktywny', 'zmienionyOd']) {
1318
+ if (options[pole] !== undefined && options[pole] !== '') {
1319
+ queryParams.append(pole, String(options[pole]));
1320
+ }
1321
+ }
1193
1322
  if (options.skip) {
1194
1323
  queryParams.append('Skip', String(options.skip));
1195
1324
  }
@@ -1200,11 +1329,16 @@ class OptimaRestApi {
1200
1329
  const url = queryString
1201
1330
  ? `${gatewayUrl}/api/product?${queryString}`
1202
1331
  : `${gatewayUrl}/api/product`;
1203
- const response = await makeAuthenticatedRequest({
1204
- method: 'GET',
1205
- url,
1206
- json: true,
1207
- });
1332
+ // TNXP-791: skonfigurowany filtr dokładny z pustą wartością (np. pusty akronim z wyrażenia) = brak wyników,
1333
+ // jak dawny surowy filtr Knt_Kod='' — bez tego węzeł pominąłby filtr i zwrócił całą listę.
1334
+ const pustyFiltrDokladny = ['kod', 'ean', 'grupa'].some((pole) => { var _a; return pole in options && String((_a = options[pole]) !== null && _a !== void 0 ? _a : '').trim() === ''; });
1335
+ const response = pustyFiltrDokladny
1336
+ ? { Success: true, Products: [], TotalCount: 0 }
1337
+ : await makeAuthenticatedRequest({
1338
+ method: 'GET',
1339
+ url,
1340
+ json: true,
1341
+ });
1208
1342
  // API returns { Success: true, Products: [...], TotalCount: ... }
1209
1343
  const responseData = response;
1210
1344
  // Extract products array from response
package/package.json CHANGED
@@ -1,60 +1,60 @@
1
- {
2
- "name": "@pokash/n8n-nodes-optima-rest-api",
3
- "version": "1.11.0",
4
- "description": "n8n node for Comarch Optima REST API integration",
5
- "keywords": [
6
- "n8n-community-node-package",
7
- "n8n",
8
- "optima",
9
- "comarch",
10
- "erp"
11
- ],
12
- "license": "MIT",
13
- "homepage": "https://github.com/pokash-pl/n8n-nodes-optima-rest-api",
14
- "author": {
15
- "name": "POKASH.PL Sp. z o. o.",
16
- "email": "hello@pokash.cloud"
17
- },
18
- "repository": {
19
- "type": "git",
20
- "url": "git+https://github.com/pokash-pl/n8n-nodes-optima-rest-api.git"
21
- },
22
- "main": "index.js",
23
- "scripts": {
24
- "build": "tsc && gulp build:icons",
25
- "dev": "tsc --watch",
26
- "format": "prettier nodes --write",
27
- "lint": "eslint nodes/**/*.ts package.json",
28
- "lintfix": "eslint nodes/**/*.ts package.json --fix",
29
- "prepublishOnly": "npm run build"
30
- },
31
- "files": [
32
- "dist"
33
- ],
34
- "n8n": {
35
- "n8nNodesApiVersion": 1,
36
- "credentials": [
37
- "dist/credentials/OptimaRestApiCredentials.credentials.js"
38
- ],
39
- "nodes": [
40
- "dist/nodes/OptimaRestApi/OptimaRestApi.node.js"
41
- ]
42
- },
43
- "devDependencies": {
44
- "@types/node": "^20.0.0",
45
- "@typescript-eslint/eslint-plugin": "^6.21.0",
46
- "@typescript-eslint/parser": "^6.21.0",
47
- "eslint": "^8.57.0",
48
- "eslint-plugin-n8n-nodes-base": "^1.16.0",
49
- "gulp": "^5.0.0",
50
- "n8n-workflow": "^2.2.2",
51
- "prettier": "^3.3.0",
52
- "typescript": "~5.6.0"
53
- },
54
- "peerDependencies": {
55
- "n8n-workflow": "^2.0.0"
56
- },
57
- "overrides": {
58
- "form-data": "^4.0.4"
59
- }
60
- }
1
+ {
2
+ "name": "@pokash/n8n-nodes-optima-rest-api",
3
+ "version": "1.12.1",
4
+ "description": "n8n node for Comarch Optima REST API integration",
5
+ "keywords": [
6
+ "n8n-community-node-package",
7
+ "n8n",
8
+ "optima",
9
+ "comarch",
10
+ "erp"
11
+ ],
12
+ "license": "MIT",
13
+ "homepage": "https://github.com/pokash-pl/n8n-nodes-optima-rest-api",
14
+ "author": {
15
+ "name": "POKASH.PL Sp. z o. o.",
16
+ "email": "hello@pokash.cloud"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/pokash-pl/n8n-nodes-optima-rest-api.git"
21
+ },
22
+ "main": "index.js",
23
+ "scripts": {
24
+ "build": "tsc && gulp build:icons",
25
+ "dev": "tsc --watch",
26
+ "format": "prettier nodes --write",
27
+ "lint": "eslint nodes/**/*.ts package.json",
28
+ "lintfix": "eslint nodes/**/*.ts package.json --fix",
29
+ "prepublishOnly": "npm run build"
30
+ },
31
+ "files": [
32
+ "dist"
33
+ ],
34
+ "n8n": {
35
+ "n8nNodesApiVersion": 1,
36
+ "credentials": [
37
+ "dist/credentials/OptimaRestApiCredentials.credentials.js"
38
+ ],
39
+ "nodes": [
40
+ "dist/nodes/OptimaRestApi/OptimaRestApi.node.js"
41
+ ]
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "^20.0.0",
45
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
46
+ "@typescript-eslint/parser": "^6.21.0",
47
+ "eslint": "^8.57.0",
48
+ "eslint-plugin-n8n-nodes-base": "^1.16.0",
49
+ "gulp": "^5.0.0",
50
+ "n8n-workflow": "^2.2.2",
51
+ "prettier": "^3.3.0",
52
+ "typescript": "~5.6.0"
53
+ },
54
+ "peerDependencies": {
55
+ "n8n-workflow": "^2.0.0"
56
+ },
57
+ "overrides": {
58
+ "form-data": "^4.0.4"
59
+ }
60
+ }