seneca-transport
Advanced tools
Comparing version 0.2.1 to 0.2.2
{ | ||
"name": "seneca-transport", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Seneca transport", | ||
@@ -5,0 +5,0 @@ "main": "transport.js", |
@@ -19,3 +19,3 @@ # seneca-transport | ||
Current Version: 0.2.1 | ||
Current Version: 0.2.2 | ||
@@ -22,0 +22,0 @@ Tested on: Node 0.10.29, Seneca 0.5.18 |
@@ -84,2 +84,3 @@ /* Copyright (c) 2013-2014 Richard Rodger, MIT License */ | ||
@@ -118,2 +119,3 @@ function cmd_listen( args, done ) { | ||
function handle_legacy_types(type,done) { | ||
@@ -136,2 +138,3 @@ var ok = false | ||
function hook_listen_tcp( args, done ) { | ||
@@ -169,3 +172,3 @@ var seneca = this | ||
connection.on('error',function(err){ | ||
console.log(err) | ||
seneca.log.error('listen', 'pipe-error', listen_options, seneca, err.stack||err) | ||
}) | ||
@@ -205,2 +208,3 @@ | ||
function hook_client_tcp( args, clientdone ) { | ||
@@ -259,3 +263,3 @@ var seneca = this | ||
send_done( null, function( args, done ) { | ||
var outmsg = prepare_request( seneca, args, done ) | ||
var outmsg = prepare_request( this, args, done ) | ||
msger.push( outmsg ) | ||
@@ -278,2 +282,3 @@ }) | ||
function json_parser_stream() { | ||
@@ -317,2 +322,3 @@ var json_parser = new stream.Duplex({objectMode:true}) | ||
function json_stringify_stream() { | ||
@@ -335,2 +341,3 @@ var json_stringify = new stream.Duplex({objectMode:true}) | ||
function hook_listen_web( args, done ) { | ||
@@ -424,2 +431,3 @@ var seneca = this | ||
function hook_client_web( args, clientdone ) { | ||
@@ -482,2 +490,3 @@ var seneca = this | ||
function parseConfig( args ) { | ||
@@ -546,2 +555,3 @@ var out = {} | ||
// only support first level | ||
@@ -567,2 +577,3 @@ // interim measure - deal with this in core seneca act api | ||
function resolve_pins( opts ) { | ||
@@ -577,2 +588,3 @@ var pins = opts.pin || opts.pins | ||
// can handle glob expressions :) | ||
@@ -614,2 +626,4 @@ function make_argspatrun( pins ) { | ||
argspatrun.mark = util.inspect(pins).replace(/\s+/g, '').replace(/\n/g, '') | ||
return argspatrun | ||
@@ -619,2 +633,3 @@ } | ||
function resolvetopic( opts, spec, args ) { | ||
@@ -633,2 +648,3 @@ var msgprefix = (null == options.msgprefix ? '' : options.msgprefix) | ||
function make_resolvesend( opts, sendmap, make_send ) { | ||
@@ -649,2 +665,3 @@ return function( spec, args, done ) { | ||
function make_anyclient( opts, make_send, done ) { | ||
@@ -658,2 +675,3 @@ var msgprefix = (null == options.msgprefix ? '' : options.msgprefix) | ||
id: nid(), | ||
toString: function(){ return 'any-'+this.id }, | ||
match: function( args ) { | ||
@@ -670,5 +688,8 @@ return !this.has(args) | ||
function make_pinclient( resolvesend, argspatrun, done ) { | ||
done(null, { | ||
id: nid(), | ||
//toString: function(){ return 'pin-<<'+argspatrun.toString(function(o){return 'X'})+'>>-'+this.id }, | ||
toString: function(){ return 'pin-'+argspatrun.mark+'-'+this.id }, | ||
match: function( args ) { | ||
@@ -679,6 +700,7 @@ var match = !!argspatrun.find(args) | ||
send: function( args, done ) { | ||
var seneca = this | ||
var spec = argspatrun.find(args) | ||
resolvesend(spec,args,function(err, send){ | ||
if( err ) return done(err); | ||
send.call(this,args,done) | ||
send.call(seneca,args,done) | ||
}) | ||
@@ -690,2 +712,3 @@ } | ||
function prepare_response( seneca, input ) { | ||
@@ -705,2 +728,3 @@ return { | ||
function update_output( output, err, out ) { | ||
@@ -718,2 +742,3 @@ output.res = out | ||
function catch_act_error( seneca, e, listen_options, input, output ) { | ||
@@ -726,2 +751,3 @@ seneca.log.error('listen', 'act-error', listen_options, e.stack || e ) | ||
function listen_topics( seneca, args, listen_options, do_topic ) { | ||
@@ -743,2 +769,3 @@ var msgprefix = (null == options.msgprefix ? '' : options.msgprefix) | ||
function handle_response( seneca, data, client_options ) { | ||
@@ -790,2 +817,3 @@ data.time = data.time || {} | ||
function prepare_request( seneca, args, done ) { | ||
@@ -804,3 +832,3 @@ var callmeta = { | ||
time: { client_sent:Date.now() }, | ||
act: args, | ||
act: seneca.util.clean(args), | ||
} | ||
@@ -812,2 +840,3 @@ | ||
function handle_request( seneca, data, listen_options, respond ) { | ||
@@ -851,2 +880,3 @@ if( null == data ) return respond(null); | ||
function make_client( make_send, client_options, clientdone ) { | ||
@@ -874,2 +904,3 @@ var pins = resolve_pins( client_options ) | ||
function parseJSON( seneca, note, str ) { | ||
@@ -881,3 +912,3 @@ if( str ) { | ||
catch( e ) { | ||
seneca.log.error( 'json-parse', note, str ) | ||
seneca.log.error( 'json-parse', note, str, e.stack||e.message ) | ||
} | ||
@@ -888,2 +919,3 @@ } | ||
function stringifyJSON( seneca, note, obj ) { | ||
@@ -895,3 +927,3 @@ if( obj ) { | ||
catch( e ) { | ||
seneca.log.error( 'json-stringify', note, obj ) | ||
seneca.log.error( 'json-stringify', note, obj, e.stack||e.message ) | ||
} | ||
@@ -902,2 +934,3 @@ } | ||
var transutils = { | ||
@@ -904,0 +937,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
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
27589
701