Comparing version 0.16.4 to 0.17.0
// 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" |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
NPM Shrinkwrap
Supply chain riskPackage contains a shrinkwrap file. This may allow the package to bypass normal install procedures.
Found 1 instance in 1 package
6
0
21038
18
8
453
1
+ Addedzmq@^2.15.3
+ Addedbindings@1.2.1(transitive)
+ Addedlodash.flatten@4.2.0(transitive)
+ Addednan@2.3.5(transitive)
+ Addedrails-delegate@0.6.1(transitive)
+ Addedzmq@2.15.3(transitive)
- Removedbody-parser@1.15.1
- Removedexpress@4.13.4
- Removedrequest@2.72.0
- Removedaccepts@1.2.13(transitive)
- Removedarray-flatten@1.1.1(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@0.2.01.0.0(transitive)
- Removedasync@2.6.4(transitive)
- Removedaws-sign2@0.6.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedbl@1.1.2(transitive)
- Removedbody-parser@1.15.1(transitive)
- Removedboom@2.10.1(transitive)
- Removedbytes@2.3.02.4.0(transitive)
- Removedcaseless@0.11.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcommander@2.20.3(transitive)
- Removedcontent-disposition@0.5.1(transitive)
- Removedcontent-type@1.0.5(transitive)
- Removedcookie@0.1.5(transitive)
- Removedcookie-signature@1.0.6(transitive)
- Removedcore-util-is@1.0.21.0.3(transitive)
- Removedcryptiles@2.0.5(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removeddepd@1.1.2(transitive)
- Removeddestroy@1.0.4(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedee-first@1.1.1(transitive)
- Removedescape-html@1.0.3(transitive)
- Removedetag@1.7.0(transitive)
- Removedexpress@4.13.4(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfinalhandler@0.4.1(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@1.0.1(transitive)
- Removedforwarded@0.1.2(transitive)
- Removedfresh@0.3.0(transitive)
- Removedgenerate-function@2.3.1(transitive)
- Removedgenerate-object-property@1.2.0(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-validator@2.0.6(transitive)
- Removedhawk@3.1.3(transitive)
- Removedhoek@2.16.3(transitive)
- Removedhttp-errors@1.3.11.4.0(transitive)
- Removedhttp-signature@1.1.1(transitive)
- Removediconv-lite@0.4.13(transitive)
- Removedinherits@2.0.1(transitive)
- Removedipaddr.js@1.0.5(transitive)
- Removedis-my-ip-valid@1.0.1(transitive)
- Removedis-my-json-valid@2.20.6(transitive)
- Removedis-property@1.0.2(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsonpointer@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedlodash@4.17.21(transitive)
- Removedlodash.flatten@4.1.0(transitive)
- Removedmedia-typer@0.3.0(transitive)
- Removedmerge-descriptors@1.0.1(transitive)
- Removedmethods@1.1.2(transitive)
- Removedmime@1.3.4(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removednegotiator@0.5.3(transitive)
- Removedoauth-sign@0.8.2(transitive)
- Removedon-finished@2.3.0(transitive)
- Removedparseurl@1.3.3(transitive)
- Removedpath-to-regexp@0.1.7(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
- Removedprocess-nextick-args@1.0.7(transitive)
- Removedproxy-addr@1.0.10(transitive)
- Removedqs@4.0.06.1.0(transitive)
- Removedrails-delegate@0.6.0(transitive)
- Removedrange-parser@1.0.3(transitive)
- Removedraw-body@2.1.7(transitive)
- Removedreadable-stream@2.0.6(transitive)
- Removedrequest@2.72.0(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsend@0.13.10.13.2(transitive)
- Removedserve-static@1.10.3(transitive)
- Removedsntp@1.0.9(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedstatuses@1.2.11.5.0(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedstringstream@0.0.6(transitive)
- Removedtough-cookie@2.2.2(transitive)
- Removedtunnel-agent@0.4.3(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removedtype-is@1.6.18(transitive)
- Removedunpipe@1.0.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedutils-merge@1.0.0(transitive)
- Removedvary@1.0.1(transitive)
- Removedverror@1.10.0(transitive)
- Removedxtend@4.0.2(transitive)
Updatedrails-delegate@0.6.1