postman-runtime 7.52.0 → 7.53.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.
- package/CHANGELOG.yaml +7 -0
- package/dist/index.js +1 -1
- package/lib/runner/index.js +4 -4
- package/lib/runner/nested-request.js +29 -7
- package/package.json +3 -3
package/lib/runner/index.js
CHANGED
|
@@ -79,15 +79,15 @@ _.assign(Runner.prototype, {
|
|
|
79
79
|
* the request being resolved
|
|
80
80
|
* @param {Number} [options.nestedRequest.hasVaultAccess] - Mutated and set by any nested or parent request
|
|
81
81
|
* to indicate whether vault access check has been performed.
|
|
82
|
-
* @param {
|
|
83
|
-
*
|
|
82
|
+
* @param {Array} [options.nestedRequest.callStack] - The current stack of nested request item ids
|
|
83
|
+
* used to enforce max nested depth. Internally set and used.
|
|
84
84
|
* @param {Object} [options.requester] - Options specific to the requester
|
|
85
85
|
* @param {Function} [options.script.requestResolver] - Resolver that receives an id from
|
|
86
86
|
* pm.execution.runRequest and returns the JSON for the request collection.
|
|
87
87
|
* Should return a postman-collection compatible collection JSON with `item` containing the request to run,
|
|
88
88
|
* `variable` array containing list of request-specific-collection variables and `event` with scripts to execute.
|
|
89
|
-
* @param {Number} [options.maxInvokableNestedRequests] - The maximum
|
|
90
|
-
* that a script can invoke
|
|
89
|
+
* @param {Number} [options.maxInvokableNestedRequests] - The maximum nested depth
|
|
90
|
+
* that a script can invoke via pm.execution.runRequest
|
|
91
91
|
* @param {Number} [options.iterationCount] -
|
|
92
92
|
* @param {CertificateList} [options.certificates] -
|
|
93
93
|
* @param {ProxyConfigList} [options.proxies] -
|
|
@@ -11,9 +11,27 @@ function runNestedRequest ({ executionId, isExecutionSkipped, vaultSecrets, item
|
|
|
11
11
|
const self = this,
|
|
12
12
|
requestResolver = _.get(self, 'options.script.requestResolver'),
|
|
13
13
|
runRequestRespEvent = EXECUTION_RUN_REQUEST_RESPONSE_EVENT_BASE + eventId,
|
|
14
|
-
maxInvokableNestedRequests = _.get(self, 'options.maxInvokableNestedRequests')
|
|
14
|
+
maxInvokableNestedRequests = _.get(self, 'options.maxInvokableNestedRequests'),
|
|
15
|
+
itemId = item.id,
|
|
16
|
+
currentItemState = { isPoppedFromCallStack: false },
|
|
17
|
+
popCurrentItemFromCallStack = () => {
|
|
18
|
+
if (currentItemState.isPoppedFromCallStack) { return; }
|
|
19
|
+
|
|
20
|
+
currentItemState.isPoppedFromCallStack = true;
|
|
21
|
+
|
|
22
|
+
if (!self.state.nestedRequest.callStack.length) { return; }
|
|
23
|
+
|
|
24
|
+
const { callStack } = self.state.nestedRequest,
|
|
25
|
+
itemIndex = callStack.lastIndexOf(itemId);
|
|
26
|
+
|
|
27
|
+
if (itemIndex !== -1) {
|
|
28
|
+
self.state.nestedRequest.callStack.splice(itemIndex, 1);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
15
31
|
|
|
16
32
|
function dispatchErrorToListener (err) {
|
|
33
|
+
popCurrentItemFromCallStack();
|
|
34
|
+
|
|
17
35
|
const error = serialisedError(err);
|
|
18
36
|
|
|
19
37
|
delete error.stack;
|
|
@@ -28,15 +46,15 @@ function runNestedRequest ({ executionId, isExecutionSkipped, vaultSecrets, item
|
|
|
28
46
|
isNestedRequest: true,
|
|
29
47
|
rootCursor: cursor,
|
|
30
48
|
rootItem: item,
|
|
31
|
-
|
|
49
|
+
callStack: []
|
|
32
50
|
});
|
|
33
51
|
|
|
34
|
-
self.state.nestedRequest.
|
|
52
|
+
self.state.nestedRequest.callStack.push(itemId);
|
|
35
53
|
|
|
36
|
-
// No more than maxInvokableNestedRequests
|
|
37
|
-
if (self.state.nestedRequest.
|
|
38
|
-
return dispatchErrorToListener(new Error('
|
|
39
|
-
'
|
|
54
|
+
// No more than maxInvokableNestedRequests nested depth
|
|
55
|
+
if (self.state.nestedRequest.callStack.length > maxInvokableNestedRequests) {
|
|
56
|
+
return dispatchErrorToListener(new Error('Max pm.execution.runRequest depth of ' +
|
|
57
|
+
maxInvokableNestedRequests + ' has been reached.'));
|
|
40
58
|
}
|
|
41
59
|
|
|
42
60
|
let rootRequestEventsList = self.state.nestedRequest.rootItem.events?.all?.() || [],
|
|
@@ -137,6 +155,8 @@ function runNestedRequest ({ executionId, isExecutionSkipped, vaultSecrets, item
|
|
|
137
155
|
variableMutationsFromThisExecution = {};
|
|
138
156
|
|
|
139
157
|
if (err) {
|
|
158
|
+
popCurrentItemFromCallStack();
|
|
159
|
+
|
|
140
160
|
return self.host
|
|
141
161
|
.dispatch(EXECUTION_RUN_REQUEST_RESPONSE_EVENT_BASE + eventId,
|
|
142
162
|
requestId, err);
|
|
@@ -206,6 +226,8 @@ function runNestedRequest ({ executionId, isExecutionSkipped, vaultSecrets, item
|
|
|
206
226
|
delete error.stack;
|
|
207
227
|
}
|
|
208
228
|
|
|
229
|
+
popCurrentItemFromCallStack();
|
|
230
|
+
|
|
209
231
|
return self.host.dispatch(runRequestRespEvent,
|
|
210
232
|
requestId, error || null,
|
|
211
233
|
responseForThisRequest,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postman-runtime",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.53.0",
|
|
4
4
|
"description": "Underlying library of executing Postman Collections",
|
|
5
5
|
"author": "Postman Inc.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
"@postman/tough-cookie": "4.1.3-postman.1",
|
|
46
46
|
"async": "3.2.6",
|
|
47
47
|
"aws4": "1.13.2",
|
|
48
|
-
"handlebars": "4.7.
|
|
48
|
+
"handlebars": "4.7.9",
|
|
49
49
|
"httpntlm": "1.8.13",
|
|
50
50
|
"jose": "5.10.0",
|
|
51
51
|
"js-sha512": "0.9.0",
|
|
52
52
|
"lodash": "4.17.23",
|
|
53
53
|
"mime-types": "2.1.35",
|
|
54
|
-
"node-forge": "1.
|
|
54
|
+
"node-forge": "1.4.0",
|
|
55
55
|
"node-oauth1": "1.3.0",
|
|
56
56
|
"performance-now": "2.1.0",
|
|
57
57
|
"postman-collection": "5.3.0",
|