Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

consul

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

consul - npm Package Compare versions

Comparing version 0.34.0 to 0.34.1

29

lib/event.js

@@ -27,4 +27,5 @@ /**

Event.prototype.fire = function(opts, callback) {
var options;
if (arguments.length === 3) {
opts = {
options = {
name: arguments[0],

@@ -35,7 +36,9 @@ payload: arguments[1],

} else if (typeof opts === 'string') {
opts = { name: opts };
options = { name: opts };
} else {
options = opts;
}
opts = utils.normalizeKeys(opts);
opts = utils.defaults(opts, this.consul._defaults);
options = utils.normalizeKeys(options);
options = utils.defaults(options, this.consul._defaults);

@@ -45,7 +48,7 @@ var req = {

path: '/event/fire/{name}',
params: { name: opts.name },
params: { name: options.name },
query: {},
};
if (!opts.name) {
if (!options.name) {
return callback(this.consul._err(errors.Validation('name required'), req));

@@ -56,11 +59,11 @@ }

if (opts.hasOwnProperty('payload')) {
buffer = Buffer.isBuffer(opts.payload);
req.body = buffer ? opts.payload : Buffer.from(opts.payload);
if (options.hasOwnProperty('payload')) {
buffer = Buffer.isBuffer(options.payload);
req.body = buffer ? options.payload : Buffer.from(options.payload);
}
if (opts.node) req.query.node = opts.node;
if (opts.service) req.query.service = opts.service;
if (opts.tag) req.query.tag = opts.tag;
if (options.node) req.query.node = options.node;
if (options.service) req.query.service = options.service;
if (options.tag) req.query.tag = options.tag;
utils.options(req, opts);
utils.options(req, options);

@@ -67,0 +70,0 @@ this.consul._put(req, utils.body, function(err, data, res) {

@@ -112,8 +112,9 @@ /**

Kv.prototype.set = function(opts, callback) {
var options;
switch (arguments.length) {
case 4:
// set(key, value, opts, callback)
opts = arguments[2];
opts.key = arguments[0];
opts.value = arguments[1];
options = arguments[2];
options.key = arguments[0];
options.value = arguments[1];
callback = arguments[3];

@@ -123,3 +124,3 @@ break;

// set(key, value, callback)
opts = {
options = {
key: arguments[0],

@@ -130,6 +131,8 @@ value: arguments[1],

break;
default:
options = opts;
}
opts = utils.normalizeKeys(opts);
opts = utils.defaults(opts, this.consul._defaults);
options = utils.normalizeKeys(options);
options = utils.defaults(options, this.consul._defaults);

@@ -139,21 +142,21 @@ var req = {

path: '/kv/{key}',
params: { key: opts.key },
params: { key: options.key },
query: {},
type: 'text',
body: opts.value || '',
body: options.value || '',
};
if (!opts.key) {
if (!options.key) {
return callback(this.consul._err(errors.Validation('key required'), req));
}
if (!opts.hasOwnProperty('value')) {
if (!options.hasOwnProperty('value')) {
return callback(this.consul._err(errors.Validation('value required'), req));
}
if (opts.hasOwnProperty('cas')) req.query.cas = opts.cas;
if (opts.hasOwnProperty('flags')) req.query.flags = opts.flags;
if (opts.hasOwnProperty('acquire')) req.query.acquire = opts.acquire;
if (opts.hasOwnProperty('release')) req.query.release = opts.release;
if (options.hasOwnProperty('cas')) req.query.cas = options.cas;
if (options.hasOwnProperty('flags')) req.query.flags = options.flags;
if (options.hasOwnProperty('acquire')) req.query.acquire = options.acquire;
if (options.hasOwnProperty('release')) req.query.release = options.release;
utils.options(req, opts);
utils.options(req, options);

@@ -160,0 +163,0 @@ this.consul._put(req, utils.body, callback);

{
"name": "consul",
"version": "0.34.0",
"version": "0.34.1",
"description": "Consul client",

@@ -5,0 +5,0 @@ "main": "./lib",

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