n8n-nodes-prestashop8 2.3.0 → 2.4.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.
- package/dist/nodes/PrestaShop8/PrestaShop8.node.description.js +4 -2
- package/dist/nodes/PrestaShop8/PrestaShop8.node.js +5 -1
- package/dist/nodes/PrestaShop8/fieldMappings.js +3 -3
- package/dist/nodes/PrestaShop8/helpers/http.js +10 -9
- package/dist/nodes/PrestaShop8/loadOptions.js +17 -7
- package/dist/nodes/PrestaShop8/resourceSchemas.js +8 -8
- package/dist/nodes/PrestaShop8/types.js +45 -32
- package/dist/nodes/PrestaShop8/utils/errors.js +2 -3
- package/dist/nodes/PrestaShop8/utils/filters.js +5 -5
- package/dist/nodes/PrestaShop8/utils/response.js +6 -6
- package/dist/nodes/PrestaShop8/utils/xml.js +21 -11
- package/package.json +23 -10
|
@@ -19,7 +19,7 @@ function buildOperatorField() {
|
|
|
19
19
|
name: 'operator',
|
|
20
20
|
type: 'options',
|
|
21
21
|
options: types_1.FILTER_OPERATORS,
|
|
22
|
-
default: '
|
|
22
|
+
default: 'EQ',
|
|
23
23
|
noDataExpression: true,
|
|
24
24
|
description: 'Comparison operator for filtering. Custom allows you to write your own filter expression.',
|
|
25
25
|
};
|
|
@@ -354,9 +354,11 @@ exports.PrestaShop8Description = {
|
|
|
354
354
|
description: 'PrestaShop field list format: [field1,field2,field3] or comma-separated: field1,field2,field3',
|
|
355
355
|
},
|
|
356
356
|
// Search Filters - Images resource (custom filter only)
|
|
357
|
+
// NOTE: distinct name from the generic 'filters' below. Two parameters sharing
|
|
358
|
+
// the same name break n8n's NDV value binding (operator could not be selected).
|
|
357
359
|
{
|
|
358
360
|
displayName: 'Search Filters',
|
|
359
|
-
name: '
|
|
361
|
+
name: 'filtersImages',
|
|
360
362
|
type: 'fixedCollection',
|
|
361
363
|
...showForResourceOp('images', 'search'),
|
|
362
364
|
default: {},
|
|
@@ -233,7 +233,11 @@ class PrestaShop8 {
|
|
|
233
233
|
break;
|
|
234
234
|
}
|
|
235
235
|
case 'search': {
|
|
236
|
-
|
|
236
|
+
// Images uses a separate parameter ('filtersImages') to avoid a duplicate
|
|
237
|
+
// parameter name that breaks n8n's NDV value binding.
|
|
238
|
+
const filtersParam = (resource === 'images'
|
|
239
|
+
? this.getNodeParameter('filtersImages', i, {})
|
|
240
|
+
: this.getNodeParameter('filters', i, {}));
|
|
237
241
|
const advancedOptions = this.getNodeParameter('advancedOptions', i, {});
|
|
238
242
|
const display = this.getNodeParameter('display', i, 'full');
|
|
239
243
|
const customFields = this.getNodeParameter('customFields', i, '');
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* Eliminates duplication between node and utils files
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.CAMELCASE_TO_PRESTASHOP_MAPPINGS = exports.CREATE_FIELD_MAPPINGS = void 0;
|
|
8
|
+
exports.convertFromCamelCase = convertFromCamelCase;
|
|
9
|
+
exports.getFieldMappingsForResource = getFieldMappingsForResource;
|
|
8
10
|
/**
|
|
9
11
|
* Input field name to PrestaShop field name mappings for CREATE operations
|
|
10
12
|
*/
|
|
@@ -66,11 +68,9 @@ function convertFromCamelCase(fieldName) {
|
|
|
66
68
|
.toLowerCase()
|
|
67
69
|
.replace(/^_/, ''); // Remove leading underscore
|
|
68
70
|
}
|
|
69
|
-
exports.convertFromCamelCase = convertFromCamelCase;
|
|
70
71
|
/**
|
|
71
72
|
* Get field mappings for a specific resource
|
|
72
73
|
*/
|
|
73
74
|
function getFieldMappingsForResource(resource) {
|
|
74
75
|
return exports.CREATE_FIELD_MAPPINGS[resource] || null;
|
|
75
76
|
}
|
|
76
|
-
exports.getFieldMappingsForResource = getFieldMappingsForResource;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
exports.FILTER_OPERATOR_FORMATS = void 0;
|
|
4
|
+
exports.getOperationOptions = getOperationOptions;
|
|
5
|
+
exports.buildHttpOptions = buildHttpOptions;
|
|
6
|
+
exports.captureRequestDebugInfo = captureRequestDebugInfo;
|
|
7
|
+
exports.wrapResponse = wrapResponse;
|
|
8
|
+
exports.executeHttpRequest = executeHttpRequest;
|
|
9
|
+
exports.executeRawModeRequest = executeRawModeRequest;
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
5
11
|
const axios = require('axios');
|
|
6
12
|
/**
|
|
7
13
|
* Map of filter operators to their PrestaShop format templates.
|
|
8
14
|
* {v} is replaced by the filter value.
|
|
9
15
|
*/
|
|
10
16
|
exports.FILTER_OPERATOR_FORMATS = {
|
|
11
|
-
'
|
|
17
|
+
'EQ': { template: '[{v}]', requiresValue: true },
|
|
18
|
+
'=': { template: '[{v}]', requiresValue: true }, // legacy alias (custom filters / API)
|
|
12
19
|
'!=': { template: '![{v}]', requiresValue: true },
|
|
13
20
|
'>': { template: '>[{v}]', requiresValue: true },
|
|
14
21
|
'>=': { template: '>=[{v}]', requiresValue: true },
|
|
@@ -33,7 +40,6 @@ function getOperationOptions(executeFunctions, itemIndex) {
|
|
|
33
40
|
showRequestUrl: executeFunctions.getNodeParameter('options.request.showRequestUrl', itemIndex, false),
|
|
34
41
|
};
|
|
35
42
|
}
|
|
36
|
-
exports.getOperationOptions = getOperationOptions;
|
|
37
43
|
/**
|
|
38
44
|
* Build HTTP request options with appropriate headers
|
|
39
45
|
*/
|
|
@@ -58,7 +64,6 @@ function buildHttpOptions(method, url, credentials, rawMode, timeout, body) {
|
|
|
58
64
|
...(body && { body }),
|
|
59
65
|
};
|
|
60
66
|
}
|
|
61
|
-
exports.buildHttpOptions = buildHttpOptions;
|
|
62
67
|
/**
|
|
63
68
|
* Capture complete request information for debugging
|
|
64
69
|
*/
|
|
@@ -85,7 +90,6 @@ function captureRequestDebugInfo(options, credentials, rawMode, operation, resou
|
|
|
85
90
|
...(options.json !== undefined && { jsonParsing: options.json }),
|
|
86
91
|
};
|
|
87
92
|
}
|
|
88
|
-
exports.captureRequestDebugInfo = captureRequestDebugInfo;
|
|
89
93
|
/**
|
|
90
94
|
* Wrap response with optional headers and status information
|
|
91
95
|
*/
|
|
@@ -100,7 +104,6 @@ function wrapResponse(processedResponse, includeHeaders, headers, statusCode) {
|
|
|
100
104
|
}
|
|
101
105
|
return processedResponse;
|
|
102
106
|
}
|
|
103
|
-
exports.wrapResponse = wrapResponse;
|
|
104
107
|
/**
|
|
105
108
|
* Execute HTTP request with debug capture and response metadata
|
|
106
109
|
*/
|
|
@@ -135,7 +138,6 @@ async function executeHttpRequest(helpers, options, credentials, rawMode, operat
|
|
|
135
138
|
throw error;
|
|
136
139
|
}
|
|
137
140
|
}
|
|
138
|
-
exports.executeHttpRequest = executeHttpRequest;
|
|
139
141
|
/**
|
|
140
142
|
* Execute a raw mode request using axios directly (bypasses n8n parsing)
|
|
141
143
|
*/
|
|
@@ -179,4 +181,3 @@ async function executeRawModeRequest(requestUrl, credentials, timeout, neverErro
|
|
|
179
181
|
throw error;
|
|
180
182
|
}
|
|
181
183
|
}
|
|
182
|
-
exports.executeRawModeRequest = executeRawModeRequest;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.loadOptionsMethods = void 0;
|
|
27
37
|
const types_1 = require("./types");
|
|
@@ -8,7 +8,14 @@
|
|
|
8
8
|
* Used for automatic type conversion and field validation
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.
|
|
11
|
+
exports.RESOURCE_SCHEMAS = void 0;
|
|
12
|
+
exports.getResourceSchema = getResourceSchema;
|
|
13
|
+
exports.getResourceFields = getResourceFields;
|
|
14
|
+
exports.getRequiredFields = getRequiredFields;
|
|
15
|
+
exports.getWritableFields = getWritableFields;
|
|
16
|
+
exports.convertFieldValue = convertFieldValue;
|
|
17
|
+
exports.convertResourceTypes = convertResourceTypes;
|
|
18
|
+
exports.convertResourceArray = convertResourceArray;
|
|
12
19
|
exports.RESOURCE_SCHEMAS = {
|
|
13
20
|
'products': {
|
|
14
21
|
'id_manufacturer': {
|
|
@@ -3917,7 +3924,6 @@ const writableFieldsCache = new Map();
|
|
|
3917
3924
|
function getResourceSchema(resource) {
|
|
3918
3925
|
return exports.RESOURCE_SCHEMAS[resource] || null;
|
|
3919
3926
|
}
|
|
3920
|
-
exports.getResourceSchema = getResourceSchema;
|
|
3921
3927
|
/**
|
|
3922
3928
|
* Get all field names for a resource
|
|
3923
3929
|
*/
|
|
@@ -3930,7 +3936,6 @@ function getResourceFields(resource) {
|
|
|
3930
3936
|
fieldsCache.set(resource, cached);
|
|
3931
3937
|
return cached;
|
|
3932
3938
|
}
|
|
3933
|
-
exports.getResourceFields = getResourceFields;
|
|
3934
3939
|
/**
|
|
3935
3940
|
* Get required fields for a resource
|
|
3936
3941
|
*/
|
|
@@ -3949,7 +3954,6 @@ function getRequiredFields(resource) {
|
|
|
3949
3954
|
requiredFieldsCache.set(resource, cached);
|
|
3950
3955
|
return cached;
|
|
3951
3956
|
}
|
|
3952
|
-
exports.getRequiredFields = getRequiredFields;
|
|
3953
3957
|
/**
|
|
3954
3958
|
* Get writable fields for a resource (not read-only)
|
|
3955
3959
|
*/
|
|
@@ -3968,7 +3972,6 @@ function getWritableFields(resource) {
|
|
|
3968
3972
|
writableFieldsCache.set(resource, cached);
|
|
3969
3973
|
return cached;
|
|
3970
3974
|
}
|
|
3971
|
-
exports.getWritableFields = getWritableFields;
|
|
3972
3975
|
/**
|
|
3973
3976
|
* Convert field value to correct type based on schema
|
|
3974
3977
|
*/
|
|
@@ -3993,7 +3996,6 @@ function convertFieldValue(value, fieldInfo) {
|
|
|
3993
3996
|
return String(value);
|
|
3994
3997
|
}
|
|
3995
3998
|
}
|
|
3996
|
-
exports.convertFieldValue = convertFieldValue;
|
|
3997
3999
|
/**
|
|
3998
4000
|
* Check if a field name matches a numeric pattern (id, quantity, price)
|
|
3999
4001
|
* and convert its value to number if it's a string
|
|
@@ -4064,7 +4066,6 @@ function convertResourceTypes(data, resource) {
|
|
|
4064
4066
|
}
|
|
4065
4067
|
return converted;
|
|
4066
4068
|
}
|
|
4067
|
-
exports.convertResourceTypes = convertResourceTypes;
|
|
4068
4069
|
/**
|
|
4069
4070
|
* Convert array of resources
|
|
4070
4071
|
*/
|
|
@@ -4073,4 +4074,3 @@ function convertResourceArray(data, resource) {
|
|
|
4073
4074
|
return data;
|
|
4074
4075
|
return data.map(item => convertResourceTypes(item, resource));
|
|
4075
4076
|
}
|
|
4076
|
-
exports.convertResourceArray = convertResourceArray;
|
|
@@ -7,7 +7,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
7
7
|
customers: {
|
|
8
8
|
name: 'customers',
|
|
9
9
|
displayName: 'Customers',
|
|
10
|
-
description: 'Store customer management',
|
|
10
|
+
description: 'Store customer management (customers)',
|
|
11
11
|
supportsCreate: true,
|
|
12
12
|
supportsUpdate: true,
|
|
13
13
|
supportsDelete: true,
|
|
@@ -18,7 +18,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
18
18
|
addresses: {
|
|
19
19
|
name: 'addresses',
|
|
20
20
|
displayName: 'Addresses',
|
|
21
|
-
description: 'Customer and delivery addresses',
|
|
21
|
+
description: 'Customer and delivery addresses (addresses)',
|
|
22
22
|
supportsCreate: true,
|
|
23
23
|
supportsUpdate: true,
|
|
24
24
|
supportsDelete: true,
|
|
@@ -29,7 +29,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
29
29
|
groups: {
|
|
30
30
|
name: 'groups',
|
|
31
31
|
displayName: 'Customer Groups',
|
|
32
|
-
description: 'Customer groups and pricing',
|
|
32
|
+
description: 'Customer groups and pricing (groups)',
|
|
33
33
|
supportsCreate: true,
|
|
34
34
|
supportsUpdate: true,
|
|
35
35
|
supportsDelete: true,
|
|
@@ -40,7 +40,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
40
40
|
customer_threads: {
|
|
41
41
|
name: 'customer_threads',
|
|
42
42
|
displayName: 'Customer Threads',
|
|
43
|
-
description: 'Customer conversation threads',
|
|
43
|
+
description: 'Customer conversation threads (customer_threads)',
|
|
44
44
|
supportsCreate: true,
|
|
45
45
|
supportsUpdate: true,
|
|
46
46
|
supportsDelete: true,
|
|
@@ -51,7 +51,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
51
51
|
customer_messages: {
|
|
52
52
|
name: 'customer_messages',
|
|
53
53
|
displayName: 'Customer Messages',
|
|
54
|
-
description: 'Individual conversation messages',
|
|
54
|
+
description: 'Individual conversation messages (customer_messages)',
|
|
55
55
|
supportsCreate: true,
|
|
56
56
|
supportsUpdate: true,
|
|
57
57
|
supportsDelete: true,
|
|
@@ -63,7 +63,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
63
63
|
products: {
|
|
64
64
|
name: 'products',
|
|
65
65
|
displayName: 'Products',
|
|
66
|
-
description: 'Store product catalog',
|
|
66
|
+
description: 'Store product catalog (products)',
|
|
67
67
|
supportsCreate: true,
|
|
68
68
|
supportsUpdate: true,
|
|
69
69
|
supportsDelete: true,
|
|
@@ -74,7 +74,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
74
74
|
combinations: {
|
|
75
75
|
name: 'combinations',
|
|
76
76
|
displayName: 'Product Combinations',
|
|
77
|
-
description: 'Product variants and combinations',
|
|
77
|
+
description: 'Product variants and combinations (combinations)',
|
|
78
78
|
supportsCreate: true,
|
|
79
79
|
supportsUpdate: true,
|
|
80
80
|
supportsDelete: true,
|
|
@@ -93,10 +93,21 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
93
93
|
supportsGetById: true,
|
|
94
94
|
supportsSearch: true,
|
|
95
95
|
},
|
|
96
|
+
stock_movements: {
|
|
97
|
+
name: 'stock_movements',
|
|
98
|
+
displayName: 'Stock Movements',
|
|
99
|
+
description: 'Product stock movement history (stock_movements)',
|
|
100
|
+
supportsCreate: false,
|
|
101
|
+
supportsUpdate: false,
|
|
102
|
+
supportsDelete: false,
|
|
103
|
+
supportsList: true,
|
|
104
|
+
supportsGetById: true,
|
|
105
|
+
supportsSearch: true,
|
|
106
|
+
},
|
|
96
107
|
categories: {
|
|
97
108
|
name: 'categories',
|
|
98
109
|
displayName: 'Categories',
|
|
99
|
-
description: 'Product category hierarchy',
|
|
110
|
+
description: 'Product category hierarchy (categories)',
|
|
100
111
|
supportsCreate: true,
|
|
101
112
|
supportsUpdate: true,
|
|
102
113
|
supportsDelete: true,
|
|
@@ -107,7 +118,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
107
118
|
manufacturers: {
|
|
108
119
|
name: 'manufacturers',
|
|
109
120
|
displayName: 'Manufacturers',
|
|
110
|
-
description: 'Brands and manufacturers',
|
|
121
|
+
description: 'Brands and manufacturers (manufacturers)',
|
|
111
122
|
supportsCreate: true,
|
|
112
123
|
supportsUpdate: true,
|
|
113
124
|
supportsDelete: true,
|
|
@@ -118,7 +129,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
118
129
|
suppliers: {
|
|
119
130
|
name: 'suppliers',
|
|
120
131
|
displayName: 'Suppliers',
|
|
121
|
-
description: 'Product suppliers',
|
|
132
|
+
description: 'Product suppliers (suppliers)',
|
|
122
133
|
supportsCreate: true,
|
|
123
134
|
supportsUpdate: true,
|
|
124
135
|
supportsDelete: true,
|
|
@@ -129,7 +140,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
129
140
|
tags: {
|
|
130
141
|
name: 'tags',
|
|
131
142
|
displayName: 'Tags',
|
|
132
|
-
description: 'Product tags and keywords',
|
|
143
|
+
description: 'Product tags and keywords (tags)',
|
|
133
144
|
supportsCreate: true,
|
|
134
145
|
supportsUpdate: true,
|
|
135
146
|
supportsDelete: true,
|
|
@@ -140,7 +151,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
140
151
|
product_features: {
|
|
141
152
|
name: 'product_features',
|
|
142
153
|
displayName: 'Product Features',
|
|
143
|
-
description: 'Product features and attributes',
|
|
154
|
+
description: 'Product features and attributes (product_features)',
|
|
144
155
|
supportsCreate: true,
|
|
145
156
|
supportsUpdate: true,
|
|
146
157
|
supportsDelete: true,
|
|
@@ -151,7 +162,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
151
162
|
product_options: {
|
|
152
163
|
name: 'product_options',
|
|
153
164
|
displayName: 'Product Options',
|
|
154
|
-
description: 'Product customization options',
|
|
165
|
+
description: 'Product customization options (product_options)',
|
|
155
166
|
supportsCreate: true,
|
|
156
167
|
supportsUpdate: true,
|
|
157
168
|
supportsDelete: true,
|
|
@@ -163,7 +174,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
163
174
|
orders: {
|
|
164
175
|
name: 'orders',
|
|
165
176
|
displayName: 'Orders',
|
|
166
|
-
description: 'Store orders',
|
|
177
|
+
description: 'Store orders (orders)',
|
|
167
178
|
supportsCreate: true,
|
|
168
179
|
supportsUpdate: true,
|
|
169
180
|
supportsDelete: true,
|
|
@@ -174,7 +185,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
174
185
|
order_details: {
|
|
175
186
|
name: 'order_details',
|
|
176
187
|
displayName: 'Order Details',
|
|
177
|
-
description: 'Order line items',
|
|
188
|
+
description: 'Order line items (order_details)',
|
|
178
189
|
supportsCreate: false,
|
|
179
190
|
supportsUpdate: true,
|
|
180
191
|
supportsDelete: false,
|
|
@@ -185,7 +196,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
185
196
|
order_histories: {
|
|
186
197
|
name: 'order_histories',
|
|
187
198
|
displayName: 'Order Histories',
|
|
188
|
-
description: 'Order status changes',
|
|
199
|
+
description: 'Order status changes (order_histories)',
|
|
189
200
|
supportsCreate: true,
|
|
190
201
|
supportsUpdate: false,
|
|
191
202
|
supportsDelete: false,
|
|
@@ -196,7 +207,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
196
207
|
order_states: {
|
|
197
208
|
name: 'order_states',
|
|
198
209
|
displayName: 'Order States',
|
|
199
|
-
description: 'Possible order states',
|
|
210
|
+
description: 'Possible order states (order_states)',
|
|
200
211
|
supportsCreate: true,
|
|
201
212
|
supportsUpdate: true,
|
|
202
213
|
supportsDelete: true,
|
|
@@ -207,7 +218,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
207
218
|
order_carriers: {
|
|
208
219
|
name: 'order_carriers',
|
|
209
220
|
displayName: 'Order Carriers',
|
|
210
|
-
description: 'Order carrier assignments',
|
|
221
|
+
description: 'Order carrier assignments (order_carriers)',
|
|
211
222
|
supportsCreate: true,
|
|
212
223
|
supportsUpdate: true,
|
|
213
224
|
supportsDelete: true,
|
|
@@ -218,7 +229,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
218
229
|
carts: {
|
|
219
230
|
name: 'carts',
|
|
220
231
|
displayName: 'Carts',
|
|
221
|
-
description: 'Customer shopping carts',
|
|
232
|
+
description: 'Customer shopping carts (carts)',
|
|
222
233
|
supportsCreate: true,
|
|
223
234
|
supportsUpdate: true,
|
|
224
235
|
supportsDelete: true,
|
|
@@ -229,7 +240,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
229
240
|
cart_rules: {
|
|
230
241
|
name: 'cart_rules',
|
|
231
242
|
displayName: 'Cart Rules',
|
|
232
|
-
description: 'Discount vouchers and promotions',
|
|
243
|
+
description: 'Discount vouchers and promotions (cart_rules)',
|
|
233
244
|
supportsCreate: true,
|
|
234
245
|
supportsUpdate: true,
|
|
235
246
|
supportsDelete: true,
|
|
@@ -241,7 +252,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
241
252
|
carriers: {
|
|
242
253
|
name: 'carriers',
|
|
243
254
|
displayName: 'Carriers',
|
|
244
|
-
description: 'Shipping methods and carriers',
|
|
255
|
+
description: 'Shipping methods and carriers (carriers)',
|
|
245
256
|
supportsCreate: true,
|
|
246
257
|
supportsUpdate: true,
|
|
247
258
|
supportsDelete: true,
|
|
@@ -252,7 +263,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
252
263
|
zones: {
|
|
253
264
|
name: 'zones',
|
|
254
265
|
displayName: 'Geographic Zones',
|
|
255
|
-
description: 'Delivery zones',
|
|
266
|
+
description: 'Delivery zones (zones)',
|
|
256
267
|
supportsCreate: true,
|
|
257
268
|
supportsUpdate: true,
|
|
258
269
|
supportsDelete: true,
|
|
@@ -263,7 +274,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
263
274
|
countries: {
|
|
264
275
|
name: 'countries',
|
|
265
276
|
displayName: 'Countries',
|
|
266
|
-
description: 'Country list',
|
|
277
|
+
description: 'Country list (countries)',
|
|
267
278
|
supportsCreate: true,
|
|
268
279
|
supportsUpdate: true,
|
|
269
280
|
supportsDelete: true,
|
|
@@ -274,7 +285,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
274
285
|
states: {
|
|
275
286
|
name: 'states',
|
|
276
287
|
displayName: 'States/Regions',
|
|
277
|
-
description: 'States and regions by country',
|
|
288
|
+
description: 'States and regions by country (states)',
|
|
278
289
|
supportsCreate: true,
|
|
279
290
|
supportsUpdate: true,
|
|
280
291
|
supportsDelete: true,
|
|
@@ -286,7 +297,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
286
297
|
currencies: {
|
|
287
298
|
name: 'currencies',
|
|
288
299
|
displayName: 'Currencies',
|
|
289
|
-
description: 'Accepted currencies',
|
|
300
|
+
description: 'Accepted currencies (currencies)',
|
|
290
301
|
supportsCreate: true,
|
|
291
302
|
supportsUpdate: true,
|
|
292
303
|
supportsDelete: true,
|
|
@@ -297,7 +308,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
297
308
|
taxes: {
|
|
298
309
|
name: 'taxes',
|
|
299
310
|
displayName: 'Taxes',
|
|
300
|
-
description: 'Tax rates',
|
|
311
|
+
description: 'Tax rates (taxes)',
|
|
301
312
|
supportsCreate: true,
|
|
302
313
|
supportsUpdate: true,
|
|
303
314
|
supportsDelete: true,
|
|
@@ -309,7 +320,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
309
320
|
content_management_system: {
|
|
310
321
|
name: 'content_management_system',
|
|
311
322
|
displayName: 'CMS Pages',
|
|
312
|
-
description: 'Static content pages',
|
|
323
|
+
description: 'Static content pages (content_management_system)',
|
|
313
324
|
supportsCreate: true,
|
|
314
325
|
supportsUpdate: true,
|
|
315
326
|
supportsDelete: true,
|
|
@@ -320,7 +331,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
320
331
|
images: {
|
|
321
332
|
name: 'images',
|
|
322
333
|
displayName: 'Images',
|
|
323
|
-
description: 'Product and category images',
|
|
334
|
+
description: 'Product and category images (images)',
|
|
324
335
|
supportsCreate: true,
|
|
325
336
|
supportsUpdate: true,
|
|
326
337
|
supportsDelete: true,
|
|
@@ -332,7 +343,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
332
343
|
configurations: {
|
|
333
344
|
name: 'configurations',
|
|
334
345
|
displayName: 'Configuration',
|
|
335
|
-
description: 'Store settings',
|
|
346
|
+
description: 'Store settings (configurations)',
|
|
336
347
|
supportsCreate: false,
|
|
337
348
|
supportsUpdate: true,
|
|
338
349
|
supportsDelete: false,
|
|
@@ -343,7 +354,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
343
354
|
languages: {
|
|
344
355
|
name: 'languages',
|
|
345
356
|
displayName: 'Languages',
|
|
346
|
-
description: 'Supported languages',
|
|
357
|
+
description: 'Supported languages (languages)',
|
|
347
358
|
supportsCreate: true,
|
|
348
359
|
supportsUpdate: true,
|
|
349
360
|
supportsDelete: true,
|
|
@@ -354,7 +365,7 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
354
365
|
shops: {
|
|
355
366
|
name: 'shops',
|
|
356
367
|
displayName: 'Shops',
|
|
357
|
-
description: 'Multi-store management',
|
|
368
|
+
description: 'Multi-store management (shops)',
|
|
358
369
|
supportsCreate: true,
|
|
359
370
|
supportsUpdate: true,
|
|
360
371
|
supportsDelete: true,
|
|
@@ -365,7 +376,9 @@ exports.PRESTASHOP_RESOURCES = {
|
|
|
365
376
|
};
|
|
366
377
|
// Available filter operators
|
|
367
378
|
exports.FILTER_OPERATORS = [
|
|
368
|
-
|
|
379
|
+
// Value must NOT be '=': n8n treats any parameter value starting with '='
|
|
380
|
+
// as an expression, which makes the option impossible to select in the UI.
|
|
381
|
+
{ name: '= Equal to', value: 'EQ' },
|
|
369
382
|
{ name: '≠ Not equal to', value: '!=' },
|
|
370
383
|
{ name: '> Greater than', value: '>' },
|
|
371
384
|
{ name: '≥ Greater than or equal to', value: '>=' },
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.cleanErrorMessage = cleanErrorMessage;
|
|
4
|
+
exports.extractPrestashopError = extractPrestashopError;
|
|
4
5
|
/**
|
|
5
6
|
* Clean error message by removing PHP warnings and debug info
|
|
6
7
|
*/
|
|
@@ -30,7 +31,6 @@ function cleanErrorMessage(message) {
|
|
|
30
31
|
}
|
|
31
32
|
return cleanedMessage;
|
|
32
33
|
}
|
|
33
|
-
exports.cleanErrorMessage = cleanErrorMessage;
|
|
34
34
|
/**
|
|
35
35
|
* Extract meaningful error message from PrestaShop response
|
|
36
36
|
*/
|
|
@@ -93,4 +93,3 @@ function extractPrestashopError(error) {
|
|
|
93
93
|
const fallbackMsg = error.message || 'PrestaShop API error occurred';
|
|
94
94
|
return cleanErrorMessage(fallbackMsg);
|
|
95
95
|
}
|
|
96
|
-
exports.extractPrestashopError = extractPrestashopError;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.REQUIRED_FIELDS_BY_RESOURCE = void 0;
|
|
4
|
+
exports.buildUrlWithFilters = buildUrlWithFilters;
|
|
5
|
+
exports.validateFieldsForCreate = validateFieldsForCreate;
|
|
6
|
+
exports.validateDataForResource = validateDataForResource;
|
|
4
7
|
const response_1 = require("./response");
|
|
5
8
|
/**
|
|
6
9
|
* Required fields for each PrestaShop resource type
|
|
@@ -55,7 +58,6 @@ function buildUrlWithFilters(baseUrl, options, rawMode) {
|
|
|
55
58
|
}
|
|
56
59
|
return url.toString();
|
|
57
60
|
}
|
|
58
|
-
exports.buildUrlWithFilters = buildUrlWithFilters;
|
|
59
61
|
/**
|
|
60
62
|
* Validates fields for CREATE operations (key-value pairs)
|
|
61
63
|
*/
|
|
@@ -87,7 +89,6 @@ function validateFieldsForCreate(resource, fields) {
|
|
|
87
89
|
}
|
|
88
90
|
return { isValid: errors.length === 0, errors };
|
|
89
91
|
}
|
|
90
|
-
exports.validateFieldsForCreate = validateFieldsForCreate;
|
|
91
92
|
/**
|
|
92
93
|
* Validates data before sending (legacy function for backward compatibility)
|
|
93
94
|
*/
|
|
@@ -102,10 +103,9 @@ function validateDataForResource(resource, data, operation = 'create') {
|
|
|
102
103
|
if (updateFields.length === 0) {
|
|
103
104
|
errors.push('At least one field must be provided for update (excluding id)');
|
|
104
105
|
}
|
|
105
|
-
if (
|
|
106
|
+
if (Object.prototype.hasOwnProperty.call(data, 'id')) {
|
|
106
107
|
errors.push('Cannot modify id field in update operation. Use the ID parameter instead.');
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
110
|
return { isValid: errors.length === 0, errors };
|
|
110
111
|
}
|
|
111
|
-
exports.validateDataForResource = validateDataForResource;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.processSortParameter = processSortParameter;
|
|
4
|
+
exports.processDisplayParameter = processDisplayParameter;
|
|
5
|
+
exports.processResponseForMode = processResponseForMode;
|
|
6
|
+
exports.simplifyPrestashopResponse = simplifyPrestashopResponse;
|
|
7
|
+
exports.buildPrestashopXml = buildPrestashopXml;
|
|
4
8
|
const fieldMappings_1 = require("../fieldMappings");
|
|
5
9
|
/**
|
|
6
10
|
* Normalize sort parameter to include _DESC by default
|
|
@@ -17,7 +21,6 @@ function processSortParameter(sortValue) {
|
|
|
17
21
|
return `${sort}_ASC`;
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
|
-
exports.processSortParameter = processSortParameter;
|
|
21
24
|
/**
|
|
22
25
|
* Convert display parameter to PrestaShop-compatible format
|
|
23
26
|
* Returns null for minimal (no display parameter = IDs only)
|
|
@@ -41,7 +44,6 @@ function processDisplayParameter(displayValue, resource, customFields) {
|
|
|
41
44
|
}
|
|
42
45
|
return displayValue || 'full';
|
|
43
46
|
}
|
|
44
|
-
exports.processDisplayParameter = processDisplayParameter;
|
|
45
47
|
/**
|
|
46
48
|
* Process PrestaShop response for direct resource access
|
|
47
49
|
*/
|
|
@@ -68,7 +70,6 @@ function processResponseForMode(rawData, resource) {
|
|
|
68
70
|
}
|
|
69
71
|
return simplified;
|
|
70
72
|
}
|
|
71
|
-
exports.processResponseForMode = processResponseForMode;
|
|
72
73
|
/**
|
|
73
74
|
* Simplifies PrestaShop XML/JSON response to simplified JSON
|
|
74
75
|
*/
|
|
@@ -91,7 +92,6 @@ function simplifyPrestashopResponse(rawData, resource) {
|
|
|
91
92
|
}
|
|
92
93
|
return simplifyItem(data, resource);
|
|
93
94
|
}
|
|
94
|
-
exports.simplifyPrestashopResponse = simplifyPrestashopResponse;
|
|
95
95
|
/**
|
|
96
96
|
* Simplifies an individual element
|
|
97
97
|
*/
|
|
@@ -176,6 +176,7 @@ function convertValue(value) {
|
|
|
176
176
|
* Builds PrestaShop XML from simplified JSON
|
|
177
177
|
*/
|
|
178
178
|
function buildPrestashopXml(resource, data) {
|
|
179
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
179
180
|
const js2xmlparser = require('js2xmlparser');
|
|
180
181
|
const convertedData = convertSimplifiedToPrestaShop(data, resource);
|
|
181
182
|
const xmlOptions = {
|
|
@@ -189,7 +190,6 @@ function buildPrestashopXml(resource, data) {
|
|
|
189
190
|
};
|
|
190
191
|
return js2xmlparser.parse('prestashop', { [resource]: convertedData }, xmlOptions);
|
|
191
192
|
}
|
|
192
|
-
exports.buildPrestashopXml = buildPrestashopXml;
|
|
193
193
|
/**
|
|
194
194
|
* Converts simplified JSON to PrestaShop format
|
|
195
195
|
*/
|
|
@@ -15,15 +15,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
36
|
+
exports.SINGULAR_RESOURCE_MAP = void 0;
|
|
37
|
+
exports.buildCreateXml = buildCreateXml;
|
|
38
|
+
exports.buildUpdateXml = buildUpdateXml;
|
|
39
|
+
exports.parseXmlToJson = parseXmlToJson;
|
|
27
40
|
const xml2js = __importStar(require("xml2js"));
|
|
28
41
|
/**
|
|
29
42
|
* Map of plural resource names to their singular form for XML tags
|
|
@@ -115,7 +128,6 @@ function buildCreateXml(resource, fields) {
|
|
|
115
128
|
xml += '</prestashop>';
|
|
116
129
|
return xml;
|
|
117
130
|
}
|
|
118
|
-
exports.buildCreateXml = buildCreateXml;
|
|
119
131
|
/**
|
|
120
132
|
* Builds PrestaShop XML for Update operations using key-value pairs
|
|
121
133
|
*/
|
|
@@ -130,7 +142,6 @@ function buildUpdateXml(resource, id, fields) {
|
|
|
130
142
|
xml += '</prestashop>';
|
|
131
143
|
return xml;
|
|
132
144
|
}
|
|
133
|
-
exports.buildUpdateXml = buildUpdateXml;
|
|
134
145
|
/**
|
|
135
146
|
* Parse XML to JSON
|
|
136
147
|
*/
|
|
@@ -141,4 +152,3 @@ async function parseXmlToJson(xml) {
|
|
|
141
152
|
});
|
|
142
153
|
return parser.parseStringPromise(xml);
|
|
143
154
|
}
|
|
144
|
-
exports.parseXmlToJson = parseXmlToJson;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-prestashop8",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "Nœud n8n personnalisé pour PrestaShop 8 avec support CRUD complet et conversion XML/JSON automatique",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -55,19 +55,22 @@
|
|
|
55
55
|
]
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
+
"@eslint/js": "^9.39.4",
|
|
58
59
|
"@types/jest": "^30.0.0",
|
|
59
|
-
"
|
|
60
|
+
"axios": "^1.15.0",
|
|
61
|
+
"@types/node": "^24.12.2",
|
|
60
62
|
"@types/xml2js": "^0.4.14",
|
|
61
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
62
|
-
"@typescript-eslint/parser": "^8.
|
|
63
|
-
"eslint": "^
|
|
64
|
-
"eslint-plugin-n8n-nodes-base": "^1.
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "^8.59.0",
|
|
64
|
+
"@typescript-eslint/parser": "^8.59.0",
|
|
65
|
+
"eslint": "^9.37.0",
|
|
66
|
+
"eslint-plugin-n8n-nodes-base": "^1.16.6",
|
|
67
|
+
"globals": "^17.5.0",
|
|
65
68
|
"gulp": "^5.0.1",
|
|
66
|
-
"jest": "^30.
|
|
67
|
-
"n8n-workflow": "
|
|
69
|
+
"jest": "^30.3.0",
|
|
70
|
+
"n8n-workflow": "^1.82.0",
|
|
68
71
|
"prettier": "^2.7.1",
|
|
69
|
-
"ts-jest": "^29.4.
|
|
70
|
-
"typescript": "^
|
|
72
|
+
"ts-jest": "^29.4.9",
|
|
73
|
+
"typescript": "^5.9.3"
|
|
71
74
|
},
|
|
72
75
|
"dependencies": {
|
|
73
76
|
"js2xmlparser": "^5.0.0",
|
|
@@ -75,5 +78,15 @@
|
|
|
75
78
|
},
|
|
76
79
|
"peerDependencies": {
|
|
77
80
|
"n8n-workflow": "*"
|
|
81
|
+
},
|
|
82
|
+
"overrides": {
|
|
83
|
+
"lodash": "^4.18.0",
|
|
84
|
+
"minimatch": "^3.1.3",
|
|
85
|
+
"picomatch": "^4.0.4",
|
|
86
|
+
"brace-expansion": "^1.1.13",
|
|
87
|
+
"uuid": "^14.0.0",
|
|
88
|
+
"axios": "^1.15.0",
|
|
89
|
+
"form-data": "^4.0.4",
|
|
90
|
+
"follow-redirects": "^1.16.0"
|
|
78
91
|
}
|
|
79
92
|
}
|