Socket
Socket
Sign inDemoInstall

postman-collection

Package Overview
Dependencies
Maintainers
6
Versions
180
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postman-collection - npm Package Compare versions

Comparing version 3.4.3 to 3.4.4-beta.1

5

CHANGELOG.md
# Postman Collection SDK Changelog
#### v3.4.4 (unreleased)
* #798 Handle disabled property in `VariableScope` methods
* #809 Added client overhead properties in timing phases
* Updated dependencies
#### v3.4.3 (February 15, 2019)

@@ -4,0 +9,0 @@ * #800 Added support for port match in `UrlMatchPattern`

25

lib/collection/response.js

@@ -560,3 +560,4 @@ var util = require('../util'),

createFromNode: function (response, cookies) {
var timings;
var timings,
responseTime;

@@ -566,4 +567,5 @@ if (response.timingStart) {

* @typedef Response~timings
* @property {Number} start - timestamp of the start of the request (in Unix Epoch milliseconds)
* @property {Number} start - timestamp of the request sent from the client (in Unix Epoch milliseconds)
* @property {Object} offset - event timestamps in millisecond resolution relative to start
* @property {Number} offset.request - timestamp of the start of the request
* @property {Number} offset.socket - timestamp when the socket is assigned to the request

@@ -575,2 +577,3 @@ * @property {Number} offset.lookup - timestamp when the DNS has been resolved

* @property {Number} offset.end - timestamp when the last bytes of the response are received
* @property {Number} offset.done - timestamp when the response is received at the client
*

@@ -584,2 +587,10 @@ * @note If there were redirects, the properties reflect the timings

};
// since requesting client information is missing, we consider that
// there's no client overhead when the request is made
timings.offset.request = 0;
timings.offset.done = timings.offset.end;
// update response time to actual response end time
responseTime = Math.ceil(response.timings.end);
}

@@ -594,3 +605,3 @@

status: response.statusMessage,
responseTime: response.elapsedTime,
responseTime: responseTime || response.elapsedTime,
timings: timings

@@ -648,2 +659,3 @@ });

* {
* prepare: Number, // duration of request preparation
* wait: Number, // duration of socket initialization

@@ -655,2 +667,3 @@ * dns: Number, // duration of DNS lookup

* download: Number, // duration of HTTP download
* process: Number, // duration of response processing
* total: Number // duration entire HTTP round-trip

@@ -673,3 +686,4 @@ * }

phases = {
wait: offset.socket,
prepare: offset.request,
wait: offset.socket - offset.request,
dns: offset.lookup - offset.socket,

@@ -679,3 +693,4 @@ tcp: offset.connect - offset.lookup,

download: offset.end - offset.response,
total: offset.end
process: offset.done - offset.end,
total: offset.done
};

@@ -682,0 +697,0 @@

35

lib/collection/variable-list.js

@@ -112,3 +112,3 @@ var _ = require('../util').lodash,

/**
* Transfar all variables from this list to an object
* Transfer all variables from this list to an object
*

@@ -121,3 +121,3 @@ * @param {Object=} [obj]

// in case user did not ptovide an object to mutate, create a new one
// in case user did not provide an object to mutate, create a new one
!_.isObject(obj) && (obj = {});

@@ -136,2 +136,33 @@

return obj;
},
/**
* Fetches a variable and normalize its reference if disabled.
* This updates the disabled variable `reference` in VariableList with its
* last enabled duplicate(if found) in the `members` list.
*
* @private
* @param {String} variableName - The name of the variable to get
* @returns {Variable} - In case of duplicates, returns last enabled
*/
oneNormalizedVariable: function (variableName) {
var indexKey = this._postman_listIndexKey, // `key` for Variable
variable = this.reference[variableName],
i;
if (variable && !variable.disabled) {
return variable;
}
// traverse the members list in reverse direction in order to find the last enabled
for (i = this.members.length - 1; i >= 0; i--) {
variable = this.members[i];
if (variable[indexKey] === variableName && !variable.disabled) {
// update the input variable reference if comparison is not disabled
this.reference[variableName] = variable;
break; // return updated reference variable
}
}
return this.reference[variableName];
}

@@ -138,0 +169,0 @@ });

@@ -116,2 +116,15 @@ var _ = require('../util').lodash,

/**
* @note Handling disabled and duplicate variables:
* | method | single enabled | single disabled | with duplicates |
* |--------|-------------------|-----------------|------------------------------------------------------------------- |
* | has | true | false | true (if last enabled) OR false (if all disabled) |
* | get | {Variable} | undefined | last enabled {Variable} OR undefined (if all disabled) |
* | set | update {Variable} | new {Variable} | update last enabled {Variable} OR new {Variable} (if all disabled) |
* | unset | delete {Variable} | noop | delete all enabled {Variable} |
*
* @todo Expected behavior of `unset` with duplicates:
* delete last enabled {Variable} and update the reference with last enabled in rest of the list.
* This requires unique identifier in the variable list for mutations to work correctly.
*/
_.assign(VariableScope.prototype, /** @lends VariableScope.prototype */ {

@@ -188,3 +201,5 @@ /**

has: function (variableName) {
return this.values.has(variableName);
var variable = this.values.oneNormalizedVariable(variableName);
return Boolean(variable && !variable.disabled);
},

@@ -199,3 +214,3 @@

get: function (key) {
var variable = this.values.one(key),
var variable = this.values.oneNormalizedVariable(key),
i,

@@ -207,8 +222,8 @@ ii;

for (i = 0, ii = this._layers.length; i < ii; i++) {
variable = this._layers[i].one(key);
if (variable) { break; }
variable = this._layers[i].oneNormalizedVariable(key);
if (variable && !variable.disabled) { break; }
}
}
return variable ? variable.valueOf() : undefined;
return (variable && !variable.disabled) ? variable.valueOf() : undefined;
},

@@ -224,3 +239,3 @@

set: function (key, value, type) {
var variable = this.values.one(key),
var variable = this.values.oneNormalizedVariable(key),

@@ -235,3 +250,4 @@ update = { // create an object that will be used as setter

// If a variable by the name key exists, update it's value and return.
if (variable) {
// @note adds new variable if existing is disabled. Disabled variables are not updated.
if (variable && !variable.disabled) {
variable.update(update);

@@ -253,4 +269,25 @@ }

unset: function (key) {
this.values.remove(key);
var lastDisabledVariable;
this.values.remove(function (variable) {
// bail out if variable name didn't match
if (variable.key !== key) {
return false;
}
// don't delete disabled variables
if (variable.disabled) {
lastDisabledVariable = variable;
return false;
}
// delete all enabled variables
return true;
});
// restore the reference with the last disabled variable
if (lastDisabledVariable) {
this.values.reference[key] = lastDisabledVariable;
}
// track the change if mutation tracking is enabled

@@ -257,0 +294,0 @@ this._postman_enableTracking && this.mutations.track(MUTATIONS.UNSET, key);

@@ -199,2 +199,3 @@ var _ = require('../util').lodash,

options.hasOwnProperty('system') && (this.system = options.system);
options.hasOwnProperty('disabled') && (this.disabled = options.disabled);
}

@@ -201,0 +202,0 @@ });

@@ -109,3 +109,4 @@ var _ = require('../util').lodash,

if (obj.constructor._postman_propertyName === 'VariableList') {
value = obj.one(key);
value = obj.oneNormalizedVariable(key);
if (value && !value.disabled) {

@@ -112,0 +113,0 @@ return value;

@@ -5,3 +5,3 @@ {

"author": "Postman Labs <help@getpostman.com>",
"version": "3.4.3",
"version": "3.4.4-beta.1",
"keywords": [

@@ -56,3 +56,3 @@ "postman"

"dependency-check": "3.3.0",
"eslint": "5.13.0",
"eslint": "5.14.1",
"eslint-plugin-jsdoc": "4.1.0",

@@ -71,3 +71,3 @@ "eslint-plugin-lodash": "5.0.1",

"karma-mocha-reporter": "2.2.5",
"mocha": "5.2.0",
"mocha": "6.0.0",
"mustache": "3.0.1",

@@ -74,0 +74,0 @@ "packity": "0.3.2",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc