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

help-esb

Package Overview
Dependencies
Maintainers
5
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

help-esb - npm Package Compare versions

Comparing version 0.6.7 to 1.0.0

examples/failReceive.js

68

help-esb.js

@@ -187,33 +187,6 @@ (function(root, factory) {

var messageHandler = function(message) {
var meta = {
type: 'sendMessage',
replyTo: message.getMeta('id'),
channel: message.getMeta('from'),
inre: message.getMeta('id')
};
// Link up our reply to the incoming request but on the "result" group.
var groups = [group + '-result'];
// CC the groups in the incoming messages CC list.
if (message.hasMeta('cc.group')) {
groups = groups.concat(message.getMeta('cc.group'));
}
if (message.hasMeta('session')) {
meta.session = message.getMeta('session');
}
var sendToGroup = function(message, group) {
return this._send(this.mb.send(group, message));
}.bind(this);
var sendToAll = function(message) {
return Promise.all(groups.map(_.partial(sendToGroup, message)));
};
var execute = Promise.try(cb.bind({}, message)).then(function(message) {
return sendToAll(
var execute = Promise.try(cb.bind({}, message)).then(function(result) {
return this._send(
this.mb.success(
this.mb.extend({meta: meta}, this.mb.coerce(message))
this.mb.extend(this.mb.rpcReply(message), this.mb.coerce(result))
)

@@ -224,4 +197,3 @@ );

var errorHandler = function(error) {
var reason = _.isError(error) ? error.toString() : error;
var errorMeta = _.extend({reason: reason}, meta);
var errorMeta = {reason: _.isError(error) ? error.stack : error};

@@ -235,3 +207,7 @@ if (newrelic !== null) {

return sendToAll(this.mb.failure({meta: errorMeta}));
return this._send(
this.mb.failure(
this.mb.extend(this.mb.rpcReply(message), {meta: errorMeta})
)
);
}.bind(this);

@@ -540,2 +516,23 @@

// ### HelpEsb.MessageBuilder.rpcReply
// Wraps a standard send message based on an incoming RPC request message.
// Sets the replyTo, channel, group, and session meta fields.
HelpEsb.MessageBuilder.prototype.rpcReply = function(inre) {
var meta = {replyTo: inre.getMeta('id'), channel: inre.getMeta('from')};
// Link up our reply to the incoming request but on the "result" group.
var groups = [inre.getMeta('group') + '-result'];
// CC the groups in the incoming messages CC list.
if (inre.hasMeta('cc.group')) {
groups = groups.concat(inre.getMeta('cc.group'));
}
if (inre.hasMeta('session')) {
meta.session = inre.getMeta('session');
}
return this.send(groups, {meta: meta}, inre);
};
// ### HelpEsb.MessageBuilder.success

@@ -618,6 +615,3 @@ // Creates a standard success message which has a result status, extending

this._data = _.has(message, 'data') ? message.data : {};
this._meta = _.extend(
{id: uuid.v4(), ts: Math.floor(Date.now() / 1000)},
message.meta
);
this._meta = _.extend({id: uuid.v4(), ts: Date.now()}, message.meta);
};

@@ -624,0 +618,0 @@

{
"name": "help-esb",
"version": "0.6.7",
"version": "1.0.0",
"description": "A client for the Help.com team's ESB.",

@@ -5,0 +5,0 @@ "main": "help-esb.js",

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