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

exorelay

Package Overview
Dependencies
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exorelay - npm Package Compare versions

Comparing version 0.16.4 to 0.17.0

dist/zmq-listener/zmq-listener.js

27

dist/exorelay.js
// Generated by LiveScript 1.5.0
var HandlerManager, MessageSender, EventEmitter, HttpListener, ref$, delegate, delegateEvent, debug, ExoRelay;
var EventEmitter, HandlerManager, MessageSender, ref$, delegate, delegateEvent, ZmqListener, debug, ExoRelay;
EventEmitter = require('events').EventEmitter;
HandlerManager = require('./message-handler/message-manager');
MessageSender = require('./message-sender/message-sender');
EventEmitter = require('events').EventEmitter;
HttpListener = require('./http-listener/http-listener');
ref$ = require('rails-delegate'), delegate = ref$.delegate, delegateEvent = ref$.delegateEvent;
ZmqListener = require('./zmq-listener/zmq-listener');
debug = require('debug')('exorelay');

@@ -23,7 +23,11 @@ ExoRelay = (function(superclass){

this.messageSender = new MessageSender(config);
x$ = this.httpListener = new HttpListener();
x$ = this.zmqListener = new ZmqListener();
x$.on('message', this._onIncomingMessage);
delegate('closePort', {
from: this,
to: this.messageSender
});
delegate('close', 'listen', 'port', {
from: this,
to: this.httpListener
to: this.zmqListener
});

@@ -35,7 +39,7 @@ delegate('hasHandler', 'registerHandler', 'registerHandlers', {

delegateEvent('error', {
from: [this.httpListener, this.messageHandler, this.messageSender],
from: [this.zmqListener, this.messageHandler, this.messageSender],
to: this
});
delegateEvent('online', 'offline', {
from: this.httpListener,
delegateEvent('status', 'online', 'offline', {
from: this.zmqListener,
to: this

@@ -57,4 +61,7 @@ });

ExoRelay.prototype._onIncomingMessage = function(requestData){
switch (false) {
case !!requestData.id:
if (requestData.messageName === '__status') {
this.messageSender.send("__status-ok");
return 'success';
}
if (!requestData.id) {
return 'missing message id';

@@ -61,0 +68,0 @@ }

@@ -9,3 +9,6 @@ // Generated by LiveScript 1.5.0

var x$, this$ = this;
x$ = this.messageSender = new MessageSender();
x$ = this.messageSender = new MessageSender({
exocomPort: 4100,
serviceName: 'test'
});
x$.on('error', function(error){

@@ -16,2 +19,5 @@ this$.error = error;

});
afterEach(function(){
return this.messageSender.closePort();
});
return describe('reply-method-for', function(){

@@ -18,0 +24,0 @@ beforeEach(function(){

// Generated by LiveScript 1.5.0
var EventEmitter, isEmpty, uuid, request, debug, MessageSender;
var EventEmitter, isEmpty, uuid, zmq, debug, MessageSender;
EventEmitter = require('events').EventEmitter;
isEmpty = require('lodash.isempty');
uuid = require('node-uuid');
request = require('request');
zmq = require('zmq');
debug = require('debug')('exorelay:message-sender');

@@ -11,3 +11,3 @@ MessageSender = (function(superclass){

function MessageSender(arg$){
var ref$;
var ref$, x$;
ref$ = arg$ != null

@@ -17,4 +17,12 @@ ? arg$

this.exocomPort = +this.exocomPort;
if (!this.exocomPort) {
throw new Error('ExoCom port not provided');
}
x$ = this.socket = zmq.socket('push');
x$.connect("tcp://localhost:" + this.exocomPort);
this.lastSentId = null;
}
MessageSender.prototype.closePort = function(){
return this.socket.close();
};
MessageSender.prototype.replyMethodFor = function(id){

@@ -45,24 +53,14 @@ var this$ = this;

requestData = {
method: 'POST',
url: "http://localhost:" + this.exocomPort + "/send/" + messageName,
json: true,
body: {
sender: this.serviceName,
id: uuid.v1()
}
name: messageName,
sender: this.serviceName,
id: uuid.v1()
};
if (payload != null) {
requestData.body.payload = payload;
requestData.payload = payload;
}
if (options.responseTo) {
requestData.body.responseTo = options.responseTo;
requestData.responseTo = options.responseTo;
}
request(requestData, function(err, response, body){
if (err || (response != null ? response.statusCode : void 8) !== 200) {
debug("Error sending message '" + messageName + "'");
debug("* err: " + err);
return debug("* response: " + (response != null ? response.statusCode : void 8));
}
});
return this.lastSentId = requestData.body.id;
this.socket.send(JSON.stringify(requestData));
return this.lastSentId = requestData.id;
};

@@ -69,0 +67,0 @@ MessageSender.prototype._log = function(messageName, options){

{
"name": "exorelay",
"version": "0.16.4",
"version": "0.17.0",
"author": "Kevin Goslar",
"dependencies": {
"body-parser": "1.15.1",
"chalk": "1.1.3",
"debug": "2.2.0",
"express": "4.13.4",
"lodash.isempty": "4.2.1",
"node-uuid": "1.4.7",
"rails-delegate": "0.6.0",
"request": "2.72.0"
"rails-delegate": "0.6.1",
"zmq": "^2.15.3"
},

@@ -18,6 +16,7 @@ "description": "Communication relay between JavaScript code bases and the Exosphere environment",

"chai": "3.5.0",
"cucumber": "0.10.3",
"dependency-lint": "4.0.1",
"cucumber": "^1.2.1",
"cucumber-snippets-livescript": "1.0.1",
"dependency-lint": "^4.0.2",
"ejs": "2.4.2",
"jsdiff-console": "1.4.2",
"jsdiff-console": "2.2.1",
"livescript": "1.5.0",

@@ -28,6 +27,7 @@ "lodash.isequal": "4.2.0",

"nitroglycerin": "1.1.1",
"o-tools": "0.3.1",
"o-tools-livescript": "1.0.3",
"o-tools": "0.4.0",
"o-tools-livescript": "1.0.4",
"portfinder": "1.0.3",
"record-http": "0.6.0",
"request": "2.72.0",
"sinon": "1.17.4",

@@ -34,0 +34,0 @@ "wait": "0.1.0"

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