Comparing version 0.5.10 to 0.5.11
## 0.5.11: | ||
* parambulator arg validation logged | ||
## 0.5.10: | ||
@@ -3,0 +7,0 @@ |
@@ -270,7 +270,9 @@ /* Copyright (c) 2010-2012 Richard Rodger */ | ||
else { | ||
var include_$ = _.isUndefined(data) ? true : data | ||
var include_$ = _.isUndefined(data) ? true : !!data | ||
var data = {} | ||
var fields = self.fields$() | ||
for( var fI = 0; fI < fields.length; fI++ ) { | ||
data[fields[fI]] = self[fields[fI]] | ||
if( !~fields[fI].indexOf('$') ) { | ||
data[fields[fI]] = self[fields[fI]] | ||
} | ||
} | ||
@@ -282,2 +284,5 @@ | ||
//console.dir(data) | ||
return data | ||
@@ -284,0 +289,0 @@ } |
@@ -5,3 +5,3 @@ /* Copyright (c) 2010-2013 Richard Rodger */ | ||
var VERSION = '0.5.10' | ||
var VERSION = '0.5.11' | ||
@@ -564,2 +564,3 @@ // FIX: nix this common thing! | ||
var deps = arguments[1] | ||
_.each(deps, function(depname){ | ||
@@ -756,2 +757,6 @@ if( !_.contains($.plugin_order.byname,depname) && | ||
port = void 0 != port ? port : opts.listen.port | ||
host = void 0 != host ? host : opts.listen.host | ||
path = void 0 != path ? path : opts.listen.path | ||
var app = connect() | ||
@@ -787,2 +792,4 @@ app.use( connect.limit( opts.listen.limit ) ) | ||
app.use( function( req, res, next ){ | ||
if( 0 != req.url.indexOf(path) ) return next(); | ||
self.act( req.body, function( err, out ){ | ||
@@ -823,2 +830,6 @@ if( err ) return next(err); | ||
port = void 0 != port ? port : opts.listen.port | ||
host = void 0 != host ? host : opts.listen.host | ||
path = void 0 != path ? path : opts.listen.path | ||
var fullurl = 'http://'+host+':'+port+path | ||
@@ -829,3 +840,3 @@ | ||
var actmeta = self.findact( args ) | ||
if( actmeta ) { | ||
if( actmeta && !args.remote$ ) { | ||
return client.act( args, done ) | ||
@@ -1028,10 +1039,19 @@ } | ||
var objstr = err ? JSON.stringify({error:''+err}) : safe_json_stringify(outobj) | ||
var code = err ? (err.seneca && err.seneca.status ? err.seneca.status : 500) : 200; | ||
var code = err ? (err.seneca && err.seneca.httpstatus ? err.seneca.httpstatus : 500) : obj.httpstatus$ ? obj.httpstatus$ : 200; | ||
res.writeHead(code,{ | ||
'Content-Type': 'application/json', | ||
'Cache-Control': 'private, max-age=0, no-cache, no-store', | ||
"Content-Length": buffer.Buffer.byteLength(objstr) | ||
}) | ||
res.end( objstr ) | ||
var redirect = obj.redirect$ || (err && err.seneca.httpredirect) | ||
if( redirect ) { | ||
res.writeHead(code,{ | ||
'Location': redirect | ||
}) | ||
} | ||
else { | ||
res.writeHead(code,{ | ||
'Content-Type': 'application/json', | ||
'Cache-Control': 'private, max-age=0, no-cache, no-store', | ||
"Content-Length": buffer.Buffer.byteLength(objstr) | ||
}) | ||
res.end( objstr ) | ||
} | ||
} | ||
@@ -1312,2 +1332,6 @@ | ||
var args = _.clone(origargs) | ||
// TODO: doesn't really work, as requires all sub actions to use 'this' | ||
var actid = ((instance.fixedargs&&instance.fixedargs.actid)?instance.fixedargs.actid+'/':'')+nid() | ||
@@ -1317,4 +1341,9 @@ // FIX: make this error nice to handle for calling code - git rid of circular ref | ||
actmeta.parambulator.validate(args,function(err){ | ||
// FIX: should have an error code | ||
if( err ) return instance.fail({code:'seneca/invalid-act-args',message:err.message,args:args},cb) | ||
if( err ) { | ||
self.log.error('act','err',actid, 'bad-args', err.message, actmeta.id ) | ||
return instance.fail({code:'seneca/invalid-act-args',message:err.message,args:args},cb) | ||
} | ||
return perform(actmeta) | ||
@@ -1326,6 +1355,2 @@ }) | ||
function perform(actmeta) { | ||
// TODO: doesn't really work, as requires all sub actions to use 'this' | ||
var actid = ((instance.fixedargs&&instance.fixedargs.actid)?instance.fixedargs.actid+'/':'')+nid() | ||
var plugin_nameref = actmeta.plugin_nameref||['-','-'] | ||
@@ -1468,7 +1493,17 @@ | ||
var pinthis = this || self | ||
_.each( pinthis.pinact(pin), function(actpattern){ | ||
pinthis.add(actpattern,function(args,done){ | ||
wrapper.call(this,args,done) | ||
if( _.isArray(pin) ) { | ||
_.each(pin, function(p){ | ||
do_wrap(p) | ||
}) | ||
}) | ||
} | ||
else return do_wrap(pin); | ||
function do_wrap( pin ) { | ||
_.each( pinthis.pinact(pin), function(actpattern){ | ||
pinthis.add(actpattern,function(args,done){ | ||
wrapper.call(this,args,done) | ||
}) | ||
}) | ||
} | ||
} | ||
@@ -1669,10 +1704,11 @@ | ||
function clean(obj) { | ||
var out = {} | ||
if( obj ) { | ||
for( var p in obj ) { | ||
if( ~p.indexOf('$') ) { | ||
delete obj[p] | ||
if( !~p.indexOf('$') ) { | ||
out[p] = obj[p] | ||
} | ||
} | ||
} | ||
return obj | ||
return out | ||
} | ||
@@ -1679,0 +1715,0 @@ |
@@ -14,3 +14,3 @@ { | ||
], | ||
"version": "0.5.10", | ||
"version": "0.5.11", | ||
"license": "MIT", | ||
@@ -17,0 +17,0 @@ "homepage": "http://senecajs.org", |
@@ -144,2 +144,3 @@ /* Copyright (c) 2010-2013 Richard Rodger */ | ||
this.log.debug(function(){return['list',q,qent.canon$({string:1}),,list.length,list[0],desc]}) | ||
list = _.map(list,function(ent){ return ent.clone$() }) | ||
cb(err, list) | ||
@@ -146,0 +147,0 @@ }) |
@@ -118,3 +118,3 @@ /* Copyright (c) 2011-2013 Richard Rodger */ | ||
if( err ) return done(err); | ||
return seneca.parent(args,done) | ||
return seneca.prior(args,done) | ||
} | ||
@@ -121,0 +121,0 @@ ) |
@@ -16,3 +16,3 @@ # seneca - Node.js module | ||
Current Version: 0.5.10 | ||
Current Version: 0.5.11 | ||
@@ -19,0 +19,0 @@ Tested on: node 0.10.6, 0.8.7 |
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
495128
6673