Comparing version 0.32.0 to 0.33.0
@@ -25,3 +25,2 @@ /** | ||
var Watch = require('./watch').Watch; | ||
var constants = require('./constants'); | ||
var utils = require('./utils'); | ||
@@ -49,11 +48,3 @@ | ||
if (opts.defaults) { | ||
var rawDefaults = utils.normalizeKeys(opts.defaults); | ||
var defaults; | ||
constants.DEFAULT_OPTIONS.forEach(function(key) { | ||
if (!rawDefaults.hasOwnProperty(key)) return; | ||
if (!defaults) defaults = {}; | ||
defaults[key] = rawDefaults[key]; | ||
}); | ||
var defaults = utils.defaultCommonOptions(opts.defaults); | ||
if (defaults) this._defaults = defaults; | ||
@@ -60,0 +51,0 @@ } |
@@ -55,3 +55,3 @@ /** | ||
buffer = Buffer.isBuffer(opts.payload); | ||
req.body = buffer ? opts.payload : new Buffer(opts.payload); | ||
req.body = buffer ? opts.payload : Buffer.from(opts.payload); | ||
} | ||
@@ -58,0 +58,0 @@ if (opts.node) req.query.node = opts.node; |
@@ -41,2 +41,3 @@ /** | ||
this._opts = opts; | ||
this._defaults = utils.defaultCommonOptions(opts); | ||
@@ -165,3 +166,3 @@ if (opts.session) { | ||
ctx: ctx, | ||
}, ctx.session, self.consul._defaults); | ||
}, ctx.session, self._defaults, self.consul._defaults); | ||
@@ -189,3 +190,3 @@ self.consul.session.create(opts, function(err, data, res) { | ||
ctx: ctx, | ||
}, self.consul._defaults); | ||
}, self._defaults, self.consul._defaults); | ||
@@ -229,3 +230,3 @@ self.consul.session.renew(opts, function(err, data, res) { | ||
index: ctx.index, | ||
}, self.consul._defaults); | ||
}, self._defaults, self.consul._defaults); | ||
@@ -273,3 +274,3 @@ self.consul.kv.get(opts, function(err, data, res) { | ||
flags: LOCK_FLAG_VALUE, | ||
}, self.consul._defaults); | ||
}, self._defaults, self.consul._defaults); | ||
@@ -309,3 +310,3 @@ self.consul.kv.set(opts, function(err, data, res) { | ||
index: ctx.index, | ||
}, self.consul._defaults), | ||
}, self._defaults, self.consul._defaults), | ||
}); | ||
@@ -370,3 +371,3 @@ | ||
timeout: 1000, | ||
}, self.consul._defaults); | ||
}, self._defaults, self.consul._defaults); | ||
@@ -405,3 +406,3 @@ self.consul.session.destroy(opts, function() { | ||
flags: LOCK_FLAG_VALUE, | ||
}, self.consul._defaults); | ||
}, self._defaults, self.consul._defaults); | ||
@@ -408,0 +409,0 @@ self.consul.kv.set(opts, function(err, data) { |
@@ -123,2 +123,19 @@ /** | ||
/** | ||
* Default common options | ||
*/ | ||
function defaultCommonOptions(opts) { | ||
opts = normalizeKeys(opts); | ||
var defaults; | ||
constants.DEFAULT_OPTIONS.forEach(function(key) { | ||
if (!opts.hasOwnProperty(key)) return; | ||
if (!defaults) defaults = {}; | ||
defaults[key] = opts[key]; | ||
}); | ||
return defaults; | ||
} | ||
/** | ||
* Decode value | ||
@@ -129,3 +146,3 @@ */ | ||
if (typeof value !== 'string') return value; | ||
value = new Buffer(value, 'base64'); | ||
value = Buffer.from(value, 'base64'); | ||
if (!opts || !opts.buffer) value = value.toString(); | ||
@@ -337,2 +354,3 @@ return value; | ||
exports.options = options; | ||
exports.defaultCommonOptions = defaultCommonOptions; | ||
exports.clone = clone; | ||
@@ -339,0 +357,0 @@ exports.parseDuration = parseDuration; |
@@ -32,2 +32,5 @@ /** | ||
options.index = options.index || '0'; | ||
options.timeout = typeof options.timeout === 'number' ? | ||
options.timeout : | ||
(utils.parseDuration(options.wait) + 500); | ||
@@ -133,2 +136,3 @@ var backoffFactor = 100; | ||
if (err && err.isValidation) return self.end(); | ||
if (res && res.statusCode === 400) return self.end(); | ||
@@ -165,2 +169,6 @@ if (self._maxAttempts >= 0 && self._attempts >= self._maxAttempts) return self.end(); | ||
if (newIndex === undefined) { | ||
return self._err(errors.Validation('Watch not supported'), res); | ||
} | ||
if (utils.hasIndexChanged(newIndex, self._options.index)) { | ||
@@ -167,0 +175,0 @@ self._options.index = newIndex; |
{ | ||
"name": "consul", | ||
"version": "0.32.0", | ||
"version": "0.33.0", | ||
"description": "Consul client", | ||
"main": "./lib", | ||
"dependencies": { | ||
"papi": "^0.27.0" | ||
"papi": "^0.28.0" | ||
}, | ||
"devDependencies": { | ||
"async": "^1.4.0", | ||
"async": "^2.6.1", | ||
"bluebird": "^3.1.1", | ||
"debug": "^2.1.3", | ||
"istanbul": "^0.3.8", | ||
"jscs": "^2.1.1", | ||
"debug": "^3.1.0", | ||
"istanbul": "^0.4.5", | ||
"jscs": "^3.0.7", | ||
"jshint": "^2.5.5", | ||
"lodash": "^3.5.0", | ||
"mocha": "^2.2.1", | ||
"nock": "^2.9.1", | ||
"lodash": "^4.17.10", | ||
"mocha": "^5.2.0", | ||
"nock": "^9.3.2", | ||
"node-uuid": "^1.4.3", | ||
"should": "^7.0.2", | ||
"sinon": "^1.14.1", | ||
"should": "^13.2.1", | ||
"sinon": "^5.1.1", | ||
"temp": "^0.8.1" | ||
@@ -23,0 +23,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
122689
2458
+ Addedpapi@0.28.0(transitive)
- Removedpapi@0.27.0(transitive)
Updatedpapi@^0.28.0