n8n-nodes-prestashop8 2.4.2 → 2.5.0
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.
|
@@ -677,6 +677,14 @@ exports.PrestaShop8Description = {
|
|
|
677
677
|
default: 30000,
|
|
678
678
|
description: 'Request timeout in milliseconds',
|
|
679
679
|
},
|
|
680
|
+
{
|
|
681
|
+
displayName: 'Delay Between Calls (ms)',
|
|
682
|
+
name: 'delayBetweenCalls',
|
|
683
|
+
type: 'number',
|
|
684
|
+
typeOptions: { minValue: 0 },
|
|
685
|
+
default: 0,
|
|
686
|
+
description: 'Pause in milliseconds applied before each PrestaShop call except the first, to throttle requests when processing multiple input items',
|
|
687
|
+
},
|
|
680
688
|
],
|
|
681
689
|
},
|
|
682
690
|
],
|
|
@@ -100,6 +100,10 @@ class PrestaShop8 {
|
|
|
100
100
|
let requestDebugInfo = {};
|
|
101
101
|
const opts = (0, http_1.getOperationOptions)(this, i);
|
|
102
102
|
const { rawMode, timeout, neverError, includeResponseHeaders, showRequestInfo, showRequestUrl } = opts;
|
|
103
|
+
// Throttle: pause before each PrestaShop call except the first.
|
|
104
|
+
if (i > 0 && opts.delayBetweenCalls > 0) {
|
|
105
|
+
await (0, http_1.sleep)(opts.delayBetweenCalls);
|
|
106
|
+
}
|
|
103
107
|
switch (operation) {
|
|
104
108
|
case 'list': {
|
|
105
109
|
const advancedOptions = this.getNodeParameter('advancedOptions', i, {});
|
|
@@ -18,7 +18,12 @@ export interface OperationOptions {
|
|
|
18
18
|
rawMode: boolean;
|
|
19
19
|
showRequestInfo: boolean;
|
|
20
20
|
showRequestUrl: boolean;
|
|
21
|
+
delayBetweenCalls: number;
|
|
21
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Pause execution for the given number of milliseconds (used to throttle calls).
|
|
25
|
+
*/
|
|
26
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
22
27
|
/**
|
|
23
28
|
* Extract common operation options from node parameters
|
|
24
29
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FILTER_OPERATOR_FORMATS = void 0;
|
|
4
|
+
exports.sleep = sleep;
|
|
4
5
|
exports.getOperationOptions = getOperationOptions;
|
|
5
6
|
exports.buildHttpOptions = buildHttpOptions;
|
|
6
7
|
exports.captureRequestDebugInfo = captureRequestDebugInfo;
|
|
@@ -27,6 +28,12 @@ exports.FILTER_OPERATOR_FORMATS = {
|
|
|
27
28
|
'IS_EMPTY': { template: '[]', requiresValue: false },
|
|
28
29
|
'IS_NOT_EMPTY': { template: '![]', requiresValue: false },
|
|
29
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Pause execution for the given number of milliseconds (used to throttle calls).
|
|
33
|
+
*/
|
|
34
|
+
function sleep(ms) {
|
|
35
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
36
|
+
}
|
|
30
37
|
/**
|
|
31
38
|
* Extract common operation options from node parameters
|
|
32
39
|
*/
|
|
@@ -38,6 +45,7 @@ function getOperationOptions(executeFunctions, itemIndex) {
|
|
|
38
45
|
rawMode: executeFunctions.getNodeParameter('options.response.rawMode', itemIndex, false),
|
|
39
46
|
showRequestInfo: executeFunctions.getNodeParameter('options.request.showRequestInfo', itemIndex, false),
|
|
40
47
|
showRequestUrl: executeFunctions.getNodeParameter('options.request.showRequestUrl', itemIndex, false),
|
|
48
|
+
delayBetweenCalls: executeFunctions.getNodeParameter('options.delayBetweenCalls', itemIndex, 0),
|
|
41
49
|
};
|
|
42
50
|
}
|
|
43
51
|
/**
|
package/package.json
CHANGED