postman-runtime 7.28.3 → 7.29.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.
Files changed (44) hide show
  1. package/CHANGELOG.yaml +30 -0
  2. package/README.md +3 -7
  3. package/dist/index.js +1 -1
  4. package/lib/authorizer/apikey.js +12 -11
  5. package/lib/authorizer/auth-interface.js +6 -6
  6. package/lib/authorizer/aws4.js +20 -20
  7. package/lib/authorizer/basic.js +12 -12
  8. package/lib/authorizer/bearer.js +12 -12
  9. package/lib/authorizer/digest.js +32 -31
  10. package/lib/authorizer/edgegrid.js +7 -7
  11. package/lib/authorizer/hawk.js +20 -20
  12. package/lib/authorizer/index.js +12 -8
  13. package/lib/authorizer/noauth.js +11 -11
  14. package/lib/authorizer/ntlm.js +43 -22
  15. package/lib/authorizer/oauth1.js +21 -21
  16. package/lib/authorizer/oauth2.js +12 -12
  17. package/lib/backpack/index.js +19 -19
  18. package/lib/requester/core-body-builder.js +16 -16
  19. package/lib/requester/core.js +25 -20
  20. package/lib/requester/dry-run.js +21 -21
  21. package/lib/requester/request-wrapper.js +6 -6
  22. package/lib/requester/requester-pool.js +1 -0
  23. package/lib/requester/requester.js +38 -43
  24. package/lib/runner/create-item-context.js +6 -6
  25. package/lib/runner/cursor.js +63 -63
  26. package/lib/runner/extensions/control.command.js +15 -14
  27. package/lib/runner/extensions/delay.command.js +12 -12
  28. package/lib/runner/extensions/event.command.js +33 -27
  29. package/lib/runner/extensions/http-request.command.js +20 -23
  30. package/lib/runner/extensions/item.command.js +6 -5
  31. package/lib/runner/extensions/request.command.js +12 -12
  32. package/lib/runner/extensions/waterfall.command.js +6 -6
  33. package/lib/runner/extract-runnable-items.js +25 -25
  34. package/lib/runner/index.js +20 -21
  35. package/lib/runner/instruction.js +14 -11
  36. package/lib/runner/replay-controller.js +6 -6
  37. package/lib/runner/request-helpers-postsend.js +5 -6
  38. package/lib/runner/request-helpers-presend.js +12 -16
  39. package/lib/runner/run.js +46 -41
  40. package/lib/runner/timings.js +7 -3
  41. package/lib/runner/util.js +10 -9
  42. package/lib/version.js +2 -2
  43. package/lib/visualizer/index.js +1 -1
  44. package/package.json +71 -75
package/lib/runner/run.js CHANGED
@@ -9,8 +9,8 @@ var _ = require('lodash'),
9
9
  * The run object is the primary way to interact with a run in progress. It allows controlling the run (pausing,
10
10
  * starting, etc) and holds references to the helpers, such as requesters and authorizer.
11
11
  *
12
- * @param state
13
- * @param options
12
+ * @param {Object} state -
13
+ * @param {Object} options -
14
14
  *
15
15
  * @property {Requester} requester
16
16
  * @constructor
@@ -47,22 +47,20 @@ Run = function PostmanCollectionRun (state, options) { // eslint-disable-line fu
47
47
  _.assign(Run.prototype, {
48
48
  // eslint-disable-next-line jsdoc/check-param-names
49
49
  /**
50
- * @param {String} action
51
- * @param {Object} [payload]
52
- * @param {*} [args...]
50
+ * @param {String} action -
51
+ * @param {Object} [payload] -
53
52
  */
54
- queue: function (action, payload) {
53
+ queue (action, payload) {
55
54
  // extract the arguments that are to be forwarded to the processor
56
55
  return this._schedule(action, payload, _.slice(arguments, 2), false);
57
56
  },
58
57
 
59
58
  // eslint-disable-next-line jsdoc/check-param-names
60
59
  /**
61
- * @param {String} action
62
- * @param {Object} [payload]
63
- * @param {*} [args...]
60
+ * @param {String} action -
61
+ * @param {Object} [payload] -
64
62
  */
65
- interrupt: function (action, payload) {
63
+ interrupt (action, payload) {
66
64
  // extract the arguments that are to be forwarded to the processor
67
65
  return this._schedule(action, payload, _.slice(arguments, 2), true);
68
66
  },
@@ -75,11 +73,10 @@ _.assign(Run.prototype, {
75
73
  * without terminating the instruction queue. However, it is up to the caller to make sure errors are handled,
76
74
  * or it will go unhandled.
77
75
  *
78
- * @param {String} action
79
- * @param {Object} payload
80
- * @param {*} [args...]
76
+ * @param {String} action -
77
+ * @param {Object} payload -
81
78
  */
82
- immediate: function (action, payload) {
79
+ immediate (action, payload) {
83
80
  var scope = this,
84
81
  instruction = this.pool.create(action, payload, _.slice(arguments, 2));
85
82
 
@@ -94,9 +91,9 @@ _.assign(Run.prototype, {
94
91
  },
95
92
 
96
93
  /**
97
- * @param {Function|Object} callback
94
+ * @param {Function|Object} callback -
98
95
  */
99
- start: function (callback) {
96
+ start (callback) {
100
97
  // @todo add `when` parameter to backpack.normalise
101
98
  callback = backpack.normalise(callback, Object.keys(Run.triggers));
102
99
 
@@ -128,10 +125,10 @@ _.assign(Run.prototype, {
128
125
 
129
126
  /**
130
127
  * @private
131
- * @param {Object|Cursor} cursor
128
+ * @param {Object|Cursor} cursor -
132
129
  * @return {Item}
133
130
  */
134
- resolveCursor: function (cursor) {
131
+ resolveCursor (cursor) {
135
132
  if (!cursor || !Array.isArray(this.state.items)) { return; }
136
133
 
137
134
  return this.state.items[cursor.position];
@@ -140,12 +137,12 @@ _.assign(Run.prototype, {
140
137
  /**
141
138
  * @private
142
139
  *
143
- * @param {String} action
144
- * @param {Object} [payload]
145
- * @param {Array} [args]
146
- * @param {Boolean} [immediate]
140
+ * @param {String} action -
141
+ * @param {Object} [payload] -
142
+ * @param {Array} [args] -
143
+ * @param {Boolean} [immediate] -
147
144
  */
148
- _schedule: function (action, payload, args, immediate) {
145
+ _schedule (action, payload, args, immediate) {
149
146
  var instruction = this.pool.create(action, payload, args);
150
147
 
151
148
  // based on whether the immediate flag is set, add to the top or bottom of the instruction queue.
@@ -154,7 +151,7 @@ _.assign(Run.prototype, {
154
151
  return instruction;
155
152
  },
156
153
 
157
- _process: function (callback) {
154
+ _process (callback) {
158
155
  // extract the command from the queue
159
156
  var instruction = this.pool.shift();
160
157
 
@@ -183,6 +180,7 @@ _.assign(Run, {
183
180
 
184
181
  /**
185
182
  * stores all execution commands
183
+ *
186
184
  * @enum {Function}
187
185
  *
188
186
  * @note commands are loaded by flattening the modules in the `./commands` directory
@@ -191,6 +189,7 @@ _.assign(Run, {
191
189
 
192
190
  /**
193
191
  * Functions executed with commands on start
192
+ *
194
193
  * @type {Array}
195
194
  */
196
195
  initialisers: []
@@ -207,27 +206,33 @@ Run.commands = _.transform({
207
206
  'delay.command': require('./extensions/delay.command')
208
207
  }, function (all, extension) {
209
208
  // extract the prototype from the command interface
210
- _.has(extension, 'prototype') && _.forOwn(extension.prototype, function (value, prop) {
211
- if (Run.prototype.hasOwnProperty(prop)) {
212
- throw new Error('run: duplicate command prototype extension ' + prop);
213
- }
214
- Run.prototype[prop] = value;
215
- });
209
+ if (_.has(extension, 'prototype')) {
210
+ _.forOwn(extension.prototype, function (value, prop) {
211
+ if (Object.hasOwnProperty.call(Run.prototype, prop)) {
212
+ throw new Error('run: duplicate command prototype extension ' + prop);
213
+ }
214
+ Run.prototype[prop] = value;
215
+ });
216
+ }
216
217
 
217
218
  // put the triggers in a box
218
- _.has(extension, 'triggers') && _.isArray(extension.triggers) && _.forEach(extension.triggers, function (name) {
219
- name && (Run.triggers[name] = true);
220
- });
219
+ if (_.has(extension, 'triggers') && _.isArray(extension.triggers)) {
220
+ _.forEach(extension.triggers, function (name) {
221
+ name && (Run.triggers[name] = true);
222
+ });
223
+ }
221
224
 
222
225
  // we add the processors to the processor list
223
- _.has(extension, 'process') && _.forOwn(extension.process, function (command, name) {
224
- if (!_.isFunction(command)) { return; }
225
- if (all.hasOwnProperty(name)) {
226
- throw new Error('run: duplicate command processor ' + name);
227
- }
228
- // finally add the command function to the accumulator
229
- all[name] = command;
230
- });
226
+ if (_.has(extension, 'process')) {
227
+ _.forOwn(extension.process, function (command, name) {
228
+ if (!_.isFunction(command)) { return; }
229
+ if (Object.hasOwnProperty.call(all, name)) {
230
+ throw new Error('run: duplicate command processor ' + name);
231
+ }
232
+ // finally add the command function to the accumulator
233
+ all[name] = command;
234
+ });
235
+ }
231
236
 
232
237
  // add the initialisation functions
233
238
  _.has(extension, 'init') && _.isFunction(extension.init) && Run.initialisers.push(extension.init);
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * All timing related functions within the runner is maintained in this module. Things like recording time with label,
3
3
  * computing elapsed time between two labels, etc all go in here.
4
+ *
4
5
  * @module Run~Timer
5
6
  */
6
7
  var /**
@@ -18,6 +19,7 @@ var /**
18
19
  * @param {Object.<Number>} records create the timer instance with one or more labels and their timestamp.
19
20
  */
20
21
  Timings = function Timings (records) {
22
+ // eslint-disable-next-line guard-for-in
21
23
  for (var prop in records) {
22
24
  this[prop] = parseInt(records[prop], 10);
23
25
  }
@@ -26,7 +28,7 @@ Timings = function Timings (records) {
26
28
  /**
27
29
  * Create a new instance of timer. Equivalent to doing new {@link Timer}(records:Object.<Number>);
28
30
  *
29
- * @param {Object.<Number>} records
31
+ * @param {Object.<Number>} records -
30
32
  * @returns {Timings}
31
33
  */
32
34
  Timings.create = function (records) {
@@ -36,7 +38,7 @@ Timings.create = function (records) {
36
38
  /**
37
39
  * Record the current time with the label specified.
38
40
  *
39
- * @param {String} label
41
+ * @param {String} label -
40
42
  * @returns {Number}
41
43
  *
42
44
  * @example
@@ -60,7 +62,9 @@ Timings.prototype.toObject = function () {
60
62
  prop;
61
63
 
62
64
  for (prop in this) {
63
- (typeof this[prop] === NUMBER) && (obj[prop] = this[prop]);
65
+ if (typeof this[prop] === NUMBER) {
66
+ obj[prop] = this[prop];
67
+ }
64
68
  }
65
69
 
66
70
  return obj;
@@ -71,6 +71,7 @@ createReadStream = function (resolver, fileSrc, callback) {
71
71
 
72
72
  /**
73
73
  * Utility functions that are required to be re-used throughout the runner
74
+ *
74
75
  * @module Runner~util
75
76
  * @private
76
77
  *
@@ -83,13 +84,13 @@ module.exports = {
83
84
  * The first parameter is the function itself, followed by the scope in which this function is to be executed.
84
85
  * The third parameter onwards are blindly forwarded to the function being called
85
86
  *
86
- * @param {Function} fn
87
- * @param {*} ctx
87
+ * @param {Function} fn -
88
+ * @param {*} ctx -
88
89
  *
89
90
  * @returns {Error} If there was an error executing the function, the error is returned.
90
91
  * Note that if the function called here is asynchronous, it's errors will not be returned (for obvious reasons!)
91
92
  */
92
- safeCall: function (fn, ctx) {
93
+ safeCall (fn, ctx) {
93
94
  // extract the arguments that are to be forwarded to the function to be called
94
95
  var args = Array.prototype.slice.call(arguments, 2);
95
96
 
@@ -104,24 +105,24 @@ module.exports = {
104
105
  /**
105
106
  * Copies attributes from source object to destination object.
106
107
  *
107
- * @param dest
108
- * @param src
108
+ * @param {Object} dest -
109
+ * @param {Object} src -
109
110
  *
110
111
  * @return {Object}
111
112
  */
112
- syncObject: function (dest, src) {
113
+ syncObject (dest, src) {
113
114
  var prop;
114
115
 
115
116
  // update or add values from src
116
117
  for (prop in src) {
117
- if (src.hasOwnProperty(prop)) {
118
+ if (Object.hasOwnProperty.call(src, prop)) {
118
119
  dest[prop] = src[prop];
119
120
  }
120
121
  }
121
122
 
122
123
  // remove values that no longer exist
123
124
  for (prop in dest) {
124
- if (dest.hasOwnProperty(prop) && !src.hasOwnProperty(prop)) {
125
+ if (Object.hasOwnProperty.call(dest, prop) && !Object.hasOwnProperty.call(src, prop)) {
125
126
  delete dest[prop];
126
127
  }
127
128
  }
@@ -141,7 +142,7 @@ module.exports = {
141
142
  * @param {Function} callback -
142
143
  *
143
144
  */
144
- createReadStream: function (resolver, fileSrc, callback) {
145
+ createReadStream (resolver, fileSrc, callback) {
145
146
  // bail out if resolver not found.
146
147
  if (!resolver) {
147
148
  return callback(new Error('file resolver not supported'));
package/lib/version.js CHANGED
@@ -12,8 +12,8 @@ var _ = require('lodash'),
12
12
  'postman-collection': true,
13
13
  'postman-request': true,
14
14
  'postman-sandbox': true,
15
- 'uniscope': true,
16
- 'uvm': true
15
+ uniscope: true,
16
+ uvm: true
17
17
  },
18
18
 
19
19
  /**
@@ -9,7 +9,7 @@ module.exports = {
9
9
  * @param {Object} options - options for processing the template
10
10
  * @param {Function} callback - callback called with errors and processed template
11
11
  */
12
- processTemplate: function (template, userData, options, callback) {
12
+ processTemplate (template, userData, options, callback) {
13
13
  // bail out if there is no valid template to process
14
14
  if (typeof template !== 'string') {
15
15
  return callback(new Error(`Invalid template. Template must be of type string, found ${typeof template}`));
package/package.json CHANGED
@@ -1,102 +1,98 @@
1
1
  {
2
2
  "name": "postman-runtime",
3
- "version": "7.28.3",
4
- "description": "Underlying library of executing Postman Collections (used by Newman)",
3
+ "version": "7.29.1",
4
+ "description": "Underlying library of executing Postman Collections",
5
+ "author": "Postman Inc.",
6
+ "license": "Apache-2.0",
5
7
  "main": "index.js",
6
- "directories": {
7
- "lib": "lib",
8
- "test": "test"
8
+ "browser": {
9
+ "./lib/requester/request-wrapper.js": "./lib/requester/browser/request.js",
10
+ "postman-request": "./lib/requester/browser/request.js"
9
11
  },
12
+ "homepage": "https://github.com/postmanlabs/postman-runtime#readme",
13
+ "bugs": {
14
+ "email": "help@postman.com"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/postmanlabs/postman-runtime.git"
19
+ },
20
+ "keywords": [
21
+ "postman",
22
+ "collection",
23
+ "runtime",
24
+ "runner"
25
+ ],
10
26
  "scripts": {
11
27
  "codecov": "node npm/publish-coverage.js",
28
+ "dist": "node npm/dist.js",
29
+ "memory-check": "npm/memory-check.sh",
30
+ "prepack": "npm run dist",
31
+ "release": "node npm/create-release.js",
12
32
  "test": "npm run test-lint && npm run test-system && npm run test-unit && npm run test-integration && npm run test-integration-legacy",
13
- "test-system": "node npm/test-system.js",
14
- "test-lint": "node npm/test-lint.js",
15
- "test-unit": "node npm/test-unit.js",
16
33
  "test-browser": "node npm/test-browser.js",
17
34
  "test-electron": "node npm/test-electron.js",
18
- "test-integration": "node npm/test-integration.js",
19
- "test-integration-legacy": "node npm/test-integration-legacy.js",
35
+ "test-integration": "nyc --nycrc-path=.nycrc.js node npm/test-integration.js",
36
+ "test-integration-legacy": "nyc --nycrc-path=.nycrc.js node npm/test-integration-legacy.js",
20
37
  "test-integration-newman": "node npm/test-integration-newman.js",
21
- "test-coverage": "node npm/test-coverage.js",
22
- "build-docs": "node npm/build-docs.js",
23
- "build-wiki": "node npm/build-wiki.js",
24
- "publish-docs": "node npm/publish-docs.js",
25
- "publish-wiki": "node npm/build-wiki.js",
26
- "memory-check": "npm/memory-check.sh",
27
- "release": "node npm/create-release.js",
28
- "dist": "node npm/dist.js",
29
- "prepack": "npm run dist"
30
- },
31
- "repository": {
32
- "type": "git",
33
- "url": "git+ssh://git@github.com:postmanlabs/postman-runtime.git"
38
+ "test-lint": "node npm/test-lint.js",
39
+ "test-system": "node npm/test-system.js",
40
+ "test-unit": "nyc --nycrc-path=.nycrc.js node npm/test-unit.js"
34
41
  },
35
- "author": "Postman Labs <help@getpostman.com>",
36
- "license": "Apache-2.0",
37
42
  "dependencies": {
38
- "async": "2.6.3",
43
+ "async": "3.2.3",
39
44
  "aws4": "1.11.0",
40
- "eventemitter3": "4.0.7",
41
45
  "handlebars": "4.7.7",
42
- "http-reasons": "0.1.0",
43
46
  "httpntlm": "1.7.7",
44
- "inherits": "2.0.4",
45
47
  "js-sha512": "0.8.0",
46
48
  "lodash": "4.17.21",
49
+ "mime-types": "2.1.35",
47
50
  "node-oauth1": "1.3.0",
48
51
  "performance-now": "2.1.0",
49
- "postman-collection": "4.0.1",
50
- "postman-request": "2.88.1-postman.30",
51
- "postman-sandbox": "4.0.3",
52
- "postman-url-encoder": "3.0.3",
53
- "resolve-from": "5.0.0",
52
+ "postman-collection": "4.1.3",
53
+ "postman-request": "2.88.1-postman.31",
54
+ "postman-sandbox": "4.0.7",
55
+ "postman-url-encoder": "3.0.5",
54
56
  "serialised-error": "1.1.3",
55
57
  "tough-cookie": "3.0.1",
56
- "uuid": "3.4.0"
58
+ "uuid": "8.3.2"
57
59
  },
58
60
  "devDependencies": {
59
- "@postman/shipit": "0.3.0",
60
- "ajv": "6.12.6",
61
- "browserify": "16.5.2",
62
- "chai": "4.3.4",
63
- "colors": "1.4.0",
64
- "editorconfig": "0.15.3",
65
- "eslint": "5.16.0",
66
- "eslint-plugin-jsdoc": "8.7.0",
67
- "eslint-plugin-lodash": "7.2.0",
68
- "eslint-plugin-mocha": "6.3.0",
69
- "eslint-plugin-security": "1.4.0",
70
- "express": "4.17.1",
71
- "graphql": "15.5.1",
72
- "js-yaml": "4.1.0",
73
- "jsdoc": "3.6.7",
74
- "jsdoc-to-markdown": "7.0.1",
75
- "karma": "3.1.4",
76
- "karma-browserify": "6.1.0",
77
- "karma-chrome-launcher": "3.1.0",
78
- "karma-mocha": "2.0.1",
79
- "karma-mocha-reporter": "2.2.5",
80
- "mocha": "7.2.0",
81
- "nyc": "14.1.1",
82
- "parse-gitignore": "0.5.1",
83
- "passport": "0.4.1",
84
- "passport-http": "0.3.0",
85
- "postman-jsdoc-theme": "0.0.3",
86
- "recursive-readdir": "2.2.2",
87
- "server-destroy": "1.0.1",
88
- "shelljs": "0.8.4",
89
- "sinon": "8.1.1",
90
- "teleport-javascript": "1.0.0",
91
- "terser": "5.7.1",
92
- "tmp": "0.2.1",
93
- "yankee": "1.0.8"
94
- },
95
- "browser": {
96
- "./lib/requester/request-wrapper.js": "./lib/requester/browser/request.js",
97
- "postman-request": "./lib/requester/browser/request.js"
61
+ "@postman/shipit": "^0.4.0",
62
+ "ajv": "^8.11.0",
63
+ "browserify": "^17.0.0",
64
+ "chai": "^4.3.6",
65
+ "chalk": "^4.1.2",
66
+ "dependency-check": "^4.1.0",
67
+ "editorconfig": "^0.15.3",
68
+ "eslint": "^7.32.0",
69
+ "eslint-plugin-jsdoc": "^36.1.1",
70
+ "eslint-plugin-lodash": "^7.4.0",
71
+ "eslint-plugin-mocha": "^10.0.4",
72
+ "eslint-plugin-security": "^1.5.0",
73
+ "express": "^4.17.2",
74
+ "graphql": "^15.7.2",
75
+ "js-yaml": "^4.1.0",
76
+ "karma": "^6.3.20",
77
+ "karma-browserify": "^8.1.0",
78
+ "karma-chrome-launcher": "^3.1.1",
79
+ "karma-mocha": "^2.0.1",
80
+ "karma-mocha-reporter": "^2.2.5",
81
+ "mocha": "^9.1.3",
82
+ "nyc": "^15.1.0",
83
+ "parse-gitignore": "^1.0.1",
84
+ "passport": "^0.6.0",
85
+ "passport-http": "^0.3.0",
86
+ "recursive-readdir": "^2.2.2",
87
+ "server-destroy": "^1.0.1",
88
+ "shelljs": "^0.8.5",
89
+ "sinon": "^12.0.1",
90
+ "teleport-javascript": "^1.0.0",
91
+ "terser": "^5.13.1",
92
+ "tmp": "^0.2.1",
93
+ "yankee": "^1.0.8"
98
94
  },
99
95
  "engines": {
100
- "node": ">=8"
96
+ "node": ">=10"
101
97
  }
102
98
  }