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

seneca-transport

Package Overview
Dependencies
Maintainers
3
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

seneca-transport - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

LICENSE

30

lib/http.js

@@ -20,3 +20,4 @@ /* Copyright (c) 2013-2015 Richard Rodger, MIT License */

return function (msg, callback) {
var seneca = this
var seneca = this.root.delegate()
var listenOptions = seneca.util.deepextend(options[msg.type], msg)

@@ -79,3 +80,4 @@

return function (msg, callback) {
var seneca = this
var seneca = this.root.delegate()
var clientOptions = seneca.util.deepextend(options[msg.type], msg)

@@ -103,4 +105,4 @@ var defaultHeaders = null

function action (msg, done) {
var data = transportUtil.prepare_request(this, msg, done)
function action (msg, done, meta) {
var data = transportUtil.prepare_request(this, msg, done, meta)

@@ -129,14 +131,14 @@ var headers = {

Wreck.post(url, requestOptions, function (err, res, payload) {
var data = {
var response = {
kind: 'res',
res: payload && _.isObject(payload) ? payload : null,
error: err,
sync: msg.meta$.sync
sync: (msg.meta$ || meta).sync
}
if (res) {
data.id = res.headers['seneca-id']
data.origin = res.headers['seneca-origin']
data.accept = res.headers['seneca-accept']
data.time = {
response.id = res.headers['seneca-id']
response.origin = res.headers['seneca-origin']
response.accept = res.headers['seneca-accept']
response.time = {
client_sent: res.headers['seneca-time-client-sent'],

@@ -148,7 +150,11 @@ listen_recv: res.headers['seneca-time-listen-recv'],

if (res.statusCode !== 200) {
data.error = payload
response.error = payload
}
}
else {
response.id = data.id
response.origin = seneca.id
}
transportUtil.handle_response(seneca, data, clientOptions)
transportUtil.handle_response(seneca, response, clientOptions)
})

@@ -155,0 +161,0 @@ }

16

lib/tcp.js

@@ -17,3 +17,4 @@ /* Copyright (c) 2013-2015 Richard Rodger, MIT License */

return function (args, callback) {
var seneca = this
var seneca = this.root.delegate()
var listenOptions = seneca.util.deepextend(options[args.type], args)

@@ -107,3 +108,4 @@

return function (args, callback) {
var seneca = this
var seneca = this.root.delegate()
var type = args.type

@@ -144,4 +146,4 @@ if (args.host) {

send_done(null, function (args, done) {
var outmsg = transportUtil.prepare_request(this, args, done)
send_done(null, function (args, done, meta) {
var outmsg = transportUtil.prepare_request(this, args, done, meta)
if (!outmsg.replied) stringifier.write(outmsg)

@@ -163,3 +165,7 @@ })

(err && err.stack) || err)
_.find(connections, { clientOptions: clientOptions }).setup = false
var conn = _.find(connections, { clientOptions: clientOptions })
if (conn) {
conn.setup = false
}
})

@@ -166,0 +172,0 @@ reconnect.on('error', function (err) {

@@ -1,7 +0,7 @@

/* Copyright (c) 2015 Richard Rodger, MIT License */
/* jshint node:true, asi:true, eqnull:true */
/* Copyright (c) 2015-2017 Richard Rodger, MIT License */
'use strict'
// Load modules
var Util = require('util')
var _ = require('lodash')

@@ -13,2 +13,3 @@ var Nid = require('nid')

// Declare internals

@@ -132,5 +133,9 @@ var internals = {

internals.Utils.prototype.prepare_request = function (seneca, args, done) {
args.meta$.sync = void 0 === args.meta$.sync ? true : args.meta$.sync
internals.Utils.prototype.prepare_request = function (seneca, args, done, meta) {
var meta$ = (args.meta$ || meta)
// FIX: this is mutating args.meta$ - sync should be inited elsewhere
meta$.sync = void 0 === meta$.sync ? true : meta$.sync
var callmeta = {

@@ -143,4 +148,4 @@ args: args,

// store callback only if sync is response expected
if (args.meta$.sync) {
this._context.callmap.set(args.meta$.id, callmeta)
if (meta$.sync) {
this._context.callmap.set(meta$.id, callmeta)
}

@@ -166,3 +171,3 @@ else {

var output = {
id: args.meta$.id,
id: meta$.id,
kind: 'act',

@@ -173,5 +178,15 @@ origin: seneca.id,

act: seneca.util.clean(args),
sync: args.meta$.sync
sync: meta$.sync
}
output.msg$ = {
vin: 1,
sid: seneca.id,
out: true,
mid: meta$.mi,
cid: meta$.tx,
snc: meta$.sync,
pat: meta$.pattern
}
return output

@@ -306,2 +321,3 @@ }

/*
// TODO: is this used?

@@ -311,5 +327,6 @@ match: function (args) {

},
*/
send: function (args, done) {
send.call(this, args, done)
send: function (args, done, meta) {
send.call(this, args, done, meta)
}

@@ -329,2 +346,3 @@ }

/*
// TODO: is this used?

@@ -335,4 +353,5 @@ match: function (args) {

},
*/
send: function (args, done) {
send: function (args, done, meta) {
var seneca = this

@@ -345,3 +364,3 @@ var spec = argspatrun.find(args)

}
send.call(seneca, args, done)
send.call(seneca, args, done, meta)
})

@@ -486,2 +505,25 @@ }

// legacy names
internals.Utils.prototype.resolvetopic = internals.Utils.prototype.resolve_topic
internals.Utils.prototype.prepareResponse = function (seneca, input) {
return {
id: input.id,
kind: 'res',
origin: input.origin,
accept: seneca.id,
track: input.track,
time: {
client_sent: (input.time && input.time.client_sent) || 0,
listen_recv: Date.now()
},
sync: input.sync
}
}
// Utilities
// only support first level

@@ -510,4 +552,2 @@ // interim measure - deal with this in core seneca act api

// legacy names
internals.Utils.prototype.resolvetopic = internals.Utils.prototype.resolve_topic

@@ -528,2 +568,3 @@ internals.Utils.prototype.close = function (seneca, closer) {

internals.Utils.prototype.stringifyJSON = function (seneca, note, obj) {

@@ -542,2 +583,3 @@ if (!obj) {

internals.Utils.prototype.parseJSON = function (seneca, note, str) {

@@ -558,16 +600,2 @@ if (!str) {

internals.Utils.prototype.prepareResponse = function (seneca, input) {
return {
id: input.id,
kind: 'res',
origin: input.origin,
accept: seneca.id,
track: input.track,
time: {
client_sent: (input.time && input.time.client_sent) || 0,
listen_recv: Date.now()
},
sync: input.sync
}
}

@@ -574,0 +602,0 @@ internals.Utils.prototype.resolveDynamicValue = function (value, options) {

{
"name": "seneca-transport",
"version": "2.1.0",
"version": "2.1.1",
"description": "Seneca transport",

@@ -19,6 +19,7 @@ "main": "transport.js",

"scripts": {
"test": "lab -v -L -P test -t 81 -m 5000",
"test-report": "lab -v -L -P test -t 81 -m 5000 -r html > test/report.html; open test/report.html",
"test": "lab -v -L -P test -t 81 -m 5000 -I WebAssembly",
"test-report": "lab -v -L -P test -t 81 -m 5000 -r html -I WebAssembly > test/report.html; open test/report.html",
"bench": "node bench",
"coveralls": "lab -s -P test -r lcov | coveralls",
"coveralls": "lab -s -P test -r lcov -I WebAssembly | coveralls",
"coverage": "lab -v -P test -L -t 81 -r html -I WebAssembly > docs/coverage.html",
"annotate": "docco transport.js -o docs/annotated; open docs/annotated/transport.html"

@@ -43,3 +44,4 @@ },

"Boris Jonica (https://github.com/bjonica)",
"Damien Simonin Feugas (https://github.com/feugy)"
"Damien Simonin Feugas (https://github.com/feugy)",
"Tyler Waters (https://github.com/tswaters)"
],

@@ -72,3 +74,4 @@ "dependencies": {

"seneca-entity": "1.3.x",
"seneca-transport-test": "0.2.0"
"seneca-transport-test": "0.2.0",
"sinon": "1.17.x"
},

@@ -78,3 +81,3 @@ "files": [

"README.md",
"LICENSE.txt",
"LICENSE",
"bench.js",

@@ -81,0 +84,0 @@ "lib"

@@ -31,3 +31,3 @@ ![Seneca](http://senecajs.org/files/assets/seneca-logo.png)

### Seneca compatibility
Supports Seneca versions **1.x** - **3.x**
Supports Seneca versions **3.x** and above.

@@ -123,3 +123,3 @@ ## Install

If you run the full script (full source is in
[readme-color.js](https://github.com/senecajs/seneca-transport/blob/master/test/readme-color.js)),
[readme-color.js](https://github.com/senecajs/seneca-transport/blob/master/test/stubs/readme-color.js)),
you'll see the standard Seneca startup log messages, but you won't see

@@ -378,3 +378,3 @@ anything that tells you what the _color_ plugin is doing since this

The full source code is in the
[readme-color-tcp.js](https://github.com/senecajs/seneca-transport/blob/master/test/readme-color-tcp.js)
[readme-color-tcp.js](https://github.com/senecajs/seneca-transport/blob/master/test/stubs/readme-color-tcp.js)
file. When you run this script it would be great to verify that the

@@ -512,3 +512,3 @@ right transport channels are being created. You'd like to see the

for settings. Here's the service code (see
[readme-many-colors-server.js](https://github.com/senecajs/seneca-transport/blob/master/test/readme-many-colors-server.js)):
[readme-many-colors-server.js](https://github.com/senecajs/seneca-transport/blob/master/test/stubs/readme-many-colors-server.js)):

@@ -654,3 +654,3 @@ ```js

The script
[readme-many-colors.sh](https://github.com/senecajs/seneca-transport/blob/master/test/readme-many-colors.sh)
[readme-many-colors.sh](https://github.com/senecajs/seneca-transport/blob/master/test/stubs/readme-many-colors.sh)
wraps all this up into one place for you so that it is easy to run.

@@ -657,0 +657,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