@@ -0,1 +1,9 @@ | ||
## 1.0.0: 2016-01-11 | ||
* Fixed API wrapper so that original function name preserved. Issue #296 | ||
* Fixed CLI `--seneca.print.tree` arg so that it works correctly. Issue #235 | ||
* Seneca instance now passed as property on `add` callback function. PR #290 | ||
* Dependencies updated to latest versions. PR #285 and #304 | ||
## 0.9.3: 2015-12-21 | ||
@@ -2,0 +10,0 @@ |
@@ -108,3 +108,3 @@ /* Copyright (c) 2010-2015 Richard Rodger, MIT License */ | ||
exports.argpattern = function argpattern (args) { | ||
if ( _.isString( args ) ) { | ||
if (_.isString(args)) { | ||
return args | ||
@@ -111,0 +111,0 @@ } |
/* Copyright (c) 2010-2015 Richard Rodger, MIT License */ | ||
'use strict' | ||
var util = require('util') | ||
var Util = require('util') | ||
var _ = require('lodash') | ||
var jsonic = require('jsonic') | ||
var Jsonic = require('jsonic') | ||
var Common = require('./common') | ||
@@ -15,5 +16,4 @@ var error = require('eraro')({ | ||
var common = require('./common') | ||
var noop = common.noop | ||
var noop = Common.noop | ||
@@ -64,3 +64,3 @@ function Entity (canon, seneca) { | ||
var self = this | ||
var args = common.arrayify(arguments) | ||
var args = Common.arrayify(arguments) | ||
@@ -267,3 +267,3 @@ var canon, name, base, zone | ||
return util.inspect(self.canon$({object: true})) === util.inspect(canon) | ||
return Util.inspect(self.canon$({object: true})) === Util.inspect(canon) | ||
} | ||
@@ -469,3 +469,3 @@ | ||
';id=', this.id, ';', | ||
jsonic.stringify(this, {omit: hidden_fields || {}})].join('') | ||
Jsonic.stringify(this, {omit: hidden_fields || {}})].join('') | ||
} | ||
@@ -472,0 +472,0 @@ } |
@@ -123,3 +123,3 @@ /* Copyright (c) 2013-2015 Richard Rodger, MIT License */ | ||
_.each(map, function (entry) { | ||
if ( _.isString(entry)) { | ||
if (_.isString(entry)) { | ||
var entries = shortcut(entry) | ||
@@ -293,3 +293,3 @@ entries.forEach(function (entry) { | ||
function make_regex_handler (regex, handler) { | ||
if ( !_.isRegExp(regex)) { | ||
if (!_.isRegExp(regex)) { | ||
var re_str = '' + regex | ||
@@ -307,3 +307,3 @@ var re_flags = '' | ||
var pretty = handlers.pretty.apply(null, Common.arrayify(arguments)).join('\t') | ||
if ( regex.test(pretty)) { | ||
if (regex.test(pretty)) { | ||
return handler.apply(this, arguments) | ||
@@ -316,3 +316,3 @@ } | ||
return function () { | ||
if ( -1 !== ('' + arguments[ log_index.act ]).indexOf(act)) { | ||
if (-1 !== ('' + arguments[ log_index.act ]).indexOf(act)) { | ||
return handler.apply(this, arguments) | ||
@@ -408,3 +408,3 @@ } | ||
exports.makelog = function ( logspec, ctxt ) { | ||
exports.makelog = function (logspec, ctxt) { | ||
var identifier = ctxt.id | ||
@@ -411,0 +411,0 @@ var short = ctxt.short || logspec.short |
/* Copyright (c) 2014-2015 Richard Rodger, MIT License */ | ||
'use strict' | ||
var fs = require('fs') | ||
var Fs = require('fs') | ||
var _ = require('lodash') | ||
var error = require('eraro')({ package: 'seneca', msgmap: ERRMSGMAP() }) | ||
var jsonic = require('jsonic') | ||
var minimist = require('minimist') | ||
var Error = require('eraro') | ||
var Jsonic = require('jsonic') | ||
var Minimist = require('minimist') | ||
var Logging = require('./logging') | ||
var Common = require('./common') | ||
var logging = require('./logging') | ||
var common = require('./common') | ||
var error = Error({ package: 'seneca', msgmap: ERRMSGMAP() }) | ||
@@ -20,3 +20,3 @@ module.exports = function (callmodule, defaults) { | ||
var options = {} | ||
var argv = minimist(process.argv.slice(2)) | ||
var argv = Minimist(process.argv.slice(2)) | ||
@@ -29,3 +29,3 @@ var sourcemap = { | ||
if (fs.existsSync(FATAL_OPTIONS_FILE)) { | ||
if (Fs.existsSync(FATAL_OPTIONS_FILE)) { | ||
throw error('inverted_file_name', { from: FATAL_OPTIONS_FILE, module: callmodule }) | ||
@@ -54,3 +54,3 @@ } | ||
sourcemap.env.log.map = sourcemap.env.log.map || [] | ||
logging.parse_command_line(process.env.SENECA_LOG, | ||
Logging.parse_command_line(process.env.SENECA_LOG, | ||
sourcemap.env.log, | ||
@@ -61,4 +61,4 @@ {shortcut: true}) | ||
if (process.env.SENECA_OPTIONS) { | ||
sourcemap.env = common.deepextend({}, sourcemap.env, | ||
jsonic(process.env.SENECA_OPTIONS)) | ||
sourcemap.env = Common.deepextend({}, sourcemap.env, | ||
Jsonic(process.env.SENECA_OPTIONS)) | ||
} | ||
@@ -75,3 +75,3 @@ | ||
else { | ||
sourcemap.argv = jsonic(argv.seneca.options) | ||
sourcemap.argv = Jsonic(argv.seneca.options) | ||
} | ||
@@ -81,7 +81,7 @@ } | ||
if (_.isString(sourcemap.argv.from)) { | ||
sourcemap.argv = common.deepextend(load_options(sourcemap.argv.from), | ||
sourcemap.argv = Common.deepextend(load_options(sourcemap.argv.from), | ||
sourcemap.argv) | ||
} | ||
if ( null != argv.seneca.tag ) { | ||
if (null != argv.seneca.tag) { | ||
sourcemap.argv.tag = '' + argv.seneca.tag | ||
@@ -93,3 +93,3 @@ } | ||
sourcemap.argv.log.map = sourcemap.argv.log.map || [] | ||
logging.parse_command_line(argv.seneca.log, | ||
Logging.parse_command_line(argv.seneca.log, | ||
sourcemap.argv.log, | ||
@@ -117,3 +117,3 @@ { shortcut: true }) | ||
// i.e. command line arguments (argv) win | ||
options = common.deepextend( | ||
options = Common.deepextend( | ||
{}, | ||
@@ -131,3 +131,3 @@ defaults, | ||
if (!first) { | ||
options = common.deepextend(options, input) | ||
options = Common.deepextend(options, input) | ||
} | ||
@@ -151,4 +151,4 @@ | ||
// this is deliberate, options are ALWAYS loaded synchronously | ||
var text = fs.readFileSync(from).toString() | ||
out = jsonic(text) | ||
var text = Fs.readFileSync(from).toString() | ||
out = Jsonic(text) | ||
} | ||
@@ -155,0 +155,0 @@ else if (from.match(/\.js$/i)) { |
@@ -34,3 +34,3 @@ /* Copyright (c) 2014-2015 Richard Rodger, MIT License */ | ||
module.exports = function () { | ||
module.exports = function default_decorations () { | ||
var seneca = this | ||
@@ -37,0 +37,0 @@ |
@@ -5,6 +5,8 @@ /* Copyright (c) 2015 Richard Rodger, MIT License */ | ||
var _ = require('lodash') | ||
var archy = require('archy') | ||
var Archy = require('archy') | ||
var Minimist = require('minimist') | ||
/** Handle command line specific functionality */ | ||
module.exports = function (seneca, argv) { | ||
module.exports = function (seneca) { | ||
var argv = Minimist(process.argv.slice(2)) | ||
if (!argv || !argv.seneca) { | ||
@@ -99,3 +101,3 @@ return | ||
console.log(archy(tree)) | ||
console.log(Archy(tree)) | ||
} |
@@ -54,4 +54,4 @@ /* Copyright (c) 2012-2015 Richard Rodger, MIT License */ | ||
function make_tag ( store_name ) { | ||
return tag_count_map[store_name] = ( tag_count_map[store_name] || 0 ) + 1 | ||
function make_tag (store_name) { | ||
return tag_count_map[store_name] = (tag_count_map[store_name] || 0) + 1 | ||
} | ||
@@ -69,6 +69,6 @@ | ||
if ( opts.map) { | ||
for ( var canon in opts.map) { | ||
if (opts.map) { | ||
for (var canon in opts.map) { | ||
var cmds = opts.map[canon] | ||
if ( '*' === cmds) { | ||
if ('*' === cmds) { | ||
cmds = allcmds | ||
@@ -92,3 +92,3 @@ } | ||
for ( var esI = 0; esI < entspecs.length; esI++) { | ||
for (var esI = 0; esI < entspecs.length; esI++) { | ||
var entspec = entspecs[esI] | ||
@@ -102,3 +102,3 @@ | ||
var m = /^(\w*|-)\/(\w*|-)\/(\w*|-)$/.exec(entspec.canon) | ||
if ( m ) { | ||
if (m) { | ||
zone = m[1] | ||
@@ -108,7 +108,7 @@ base = m[2] | ||
} | ||
else if ( (m = /^(\w*|-)\/(\w*|-)$/.exec(entspec.canon)) ) { | ||
else if ((m = /^(\w*|-)\/(\w*|-)$/.exec(entspec.canon))) { | ||
base = m[1] | ||
name = m[2] | ||
} | ||
else if ( (m = /^(\w*|-)$/.exec(entspec.canon)) ) { | ||
else if ((m = /^(\w*|-)$/.exec(entspec.canon))) { | ||
name = m[1] | ||
@@ -122,5 +122,5 @@ } | ||
var entargs = {} | ||
if ( void 0 !== name) entargs.name = name | ||
if ( void 0 !== base) entargs.base = base | ||
if ( void 0 !== zone) entargs.zone = zone | ||
if (void 0 !== name) entargs.name = name | ||
if (void 0 !== base) entargs.base = base | ||
if (void 0 !== zone) entargs.zone = zone | ||
@@ -131,8 +131,8 @@ _.each(entspec.cmds, function (cmd) { | ||
if ( wrap[cmd]) { | ||
if (wrap[cmd]) { | ||
cmdfunc = wrap[cmd](cmdfunc) | ||
} | ||
if ( cmdfunc ) { | ||
if ( 'close' !== cmd) { | ||
if (cmdfunc) { | ||
if ('close' !== cmd) { | ||
instance.add(args, cmdfunc) | ||
@@ -145,9 +145,9 @@ } | ||
if ( 'close' === cmd) { | ||
instance.add('role:seneca,cmd:close', function ( close_args, done ) { | ||
if ('close' === cmd) { | ||
instance.add('role:seneca,cmd:close', function (close_args, done) { | ||
var closer = this | ||
if ( !store.closed$) { | ||
if (!store.closed$) { | ||
cmdfunc.call(closer, close_args, function (err) { | ||
if ( err ) closer.log.error('close-error', close_args, err) | ||
if (err) closer.log.error('close-error', close_args, err) | ||
@@ -167,3 +167,3 @@ store.closed$ = true | ||
// legacy | ||
if ( cb ) { | ||
if (cb) { | ||
cb.call(instance, null, tag, storedesc.join('~')) | ||
@@ -170,0 +170,0 @@ } |
@@ -73,3 +73,3 @@ /* Copyright (c) 2010-2015 Richard Rodger, MIT License */ | ||
var pins = config.pins || | ||
(_.isArray(config.pin) ? config.pin : [config.pin || ''] ) | ||
(_.isArray(config.pin) ? config.pin : [config.pin || '']) | ||
@@ -84,6 +84,6 @@ pins = _.map(pins, function (pin) { | ||
if (msg.local$) { | ||
this.prior(msg, done ) | ||
this.prior(msg, done) | ||
} | ||
else { | ||
sendclient.send.call(this, msg, done ) | ||
sendclient.send.call(this, msg, done) | ||
} | ||
@@ -110,3 +110,3 @@ } | ||
if (err) { | ||
return sd.die(internals.error(err, 'transport_client', config) ) | ||
return sd.die(internals.error(err, 'transport_client', config)) | ||
} | ||
@@ -113,0 +113,0 @@ if (liveclient === null) { |
@@ -21,3 +21,3 @@ { | ||
], | ||
"version": "0.9.3", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
@@ -46,6 +46,6 @@ "homepage": "http://senecajs.org", | ||
"gate-executor": "0.2.3", | ||
"gex": "0.2.1", | ||
"gex": "0.2.2", | ||
"jsonic": "0.2.2", | ||
"lodash": "3.10.1", | ||
"lru-cache": "2.7.0", | ||
"lru-cache": "4.0.0", | ||
"minimist": "1.2.0", | ||
@@ -60,3 +60,3 @@ "nid": "0.3.2", | ||
"seneca-cluster": "0.0.1", | ||
"seneca-mem-store": "0.3.1", | ||
"seneca-mem-store": "0.4.0", | ||
"seneca-repl": "0.0.1", | ||
@@ -69,2 +69,5 @@ "seneca-transport": "0.9.1", | ||
"main": "seneca.js", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"files": [ | ||
@@ -88,14 +91,14 @@ "LICENSE.txt", | ||
"devDependencies": { | ||
"async": "0.9.2", | ||
"async": "1.5.2", | ||
"bench": "0.3.x", | ||
"body-parser": "1.14.1", | ||
"body-parser": "1.14.2", | ||
"code": "1.5.0", | ||
"connect": "3.4.0", | ||
"connect-query": "0.2.0", | ||
"coveralls": "^2.11.4", | ||
"coveralls": "^2.11.6", | ||
"docco": "0.7.0", | ||
"eslint-config-seneca": "1.1.1", | ||
"eslint-config-seneca": "1.1.2", | ||
"eslint-plugin-standard": "1.3.1", | ||
"joi": "6.x.x", | ||
"lab": "6.2.0", | ||
"joi": "6.10.x", | ||
"lab": "6.2.x", | ||
"no-shadow-relaxed": "1.0.1", | ||
@@ -102,0 +105,0 @@ "seneca": "latest", |
@@ -75,10 +75,10 @@  | ||
seneca.add( {cmd:'salestax'}, function(args,callback){ | ||
seneca.add({ cmd: 'salestax' }, function (args, callback) { | ||
var rate = 0.23 | ||
var total = args.net * (1+rate) | ||
callback(null,{total:total}) | ||
var total = args.net * (1 + rate) | ||
callback(null, { total: total }) | ||
}) | ||
seneca.act( {cmd:'salestax', net:100}, function(err,result){ | ||
console.log( result.total ) | ||
seneca.act({ cmd: 'salestax', net: 100 }, function (err, result) { | ||
console.log(result.total) | ||
}) | ||
@@ -98,3 +98,3 @@ ``` | ||
```javascript | ||
seneca.add( {cmd:'config'}, function(args,callback){ | ||
seneca.add({ cmd: 'config' }, function (args, callback) { | ||
var config = { | ||
@@ -104,15 +104,15 @@ rate: 0.23 | ||
var value = config[args.prop] | ||
callback(null,{value:value}) | ||
callback(null, { value: value }) | ||
}) | ||
seneca.add( {cmd:'salestax'}, function(args,callback){ | ||
seneca.act( {cmd:'config', prop:'rate'}, function(err,result){ | ||
seneca.add({ cmd: 'salestax' }, function (args, callback) { | ||
seneca.act({ cmd: 'config', prop: 'rate' }, function (err, result) { | ||
var rate = parseFloat(result.value) | ||
var total = args.net * (1+rate) | ||
callback(null,{total:total}) | ||
var total = args.net * (1 + rate) | ||
callback(null, { total: total }) | ||
}) | ||
}) | ||
seneca.act( {cmd:'salestax', net:100}, function(err,result){ | ||
console.log( result.total ) | ||
seneca.act({ cmd: 'salestax', net: 100 }, function (err, result) { | ||
console.log(result.total) | ||
}) | ||
@@ -130,4 +130,4 @@ ``` | ||
```javascript | ||
seneca.act('cmd:salestax,net:100', function(err,result){ | ||
console.log( result.total ) | ||
seneca.act('cmd:salestax,net:100', function (err, result) { | ||
console.log(result.total) | ||
}) | ||
@@ -141,4 +141,4 @@ ``` | ||
```javascript | ||
seneca.act('cmd:salestax', {net:100}, function(err,result){ | ||
console.log( result.total ) | ||
seneca.act('cmd:salestax', { net: 100 }, function (err, result) { | ||
console.log(result.total) | ||
}) | ||
@@ -159,3 +159,3 @@ ``` | ||
```javascript | ||
seneca.add( {cmd:'config'}, function(args,callback){ | ||
seneca.add({ cmd: 'config' }, function (args, callback) { | ||
var config = { | ||
@@ -165,3 +165,3 @@ rate: 0.23 | ||
var value = config[args.prop] | ||
callback(null,{value:value}) | ||
callback(null, { value: value }) | ||
}) | ||
@@ -184,7 +184,7 @@ | ||
```javascript | ||
seneca.add( {cmd:'salestax'}, function(args,callback){ | ||
seneca.act( {cmd:'config', prop:'rate'}, function(err,result){ | ||
seneca.add({ cmd: 'salestax' }, function (args, callback) { | ||
seneca.act({cmd: 'config', prop: 'rate' }, function (err, result) { | ||
var rate = parseFloat(result.value) | ||
var total = args.net * (1+rate) | ||
callback(null,{total:total}) | ||
var total = args.net * (1 + rate) | ||
callback(null, { total: total }) | ||
}) | ||
@@ -195,4 +195,4 @@ }) | ||
seneca.act('cmd:salestax,net:100', function(err,result){ | ||
console.log( result.total ) | ||
seneca.act('cmd:salestax,net:100', function (err, result) { | ||
console.log(result.total) | ||
}) | ||
@@ -226,6 +226,6 @@ ``` | ||
// fixed rate | ||
seneca.add( {cmd:'salestax'}, function(args,callback){ | ||
seneca.add({ cmd: 'salestax' }, function (args, callback) { | ||
var rate = 0.23 | ||
var total = args.net * (1+rate) | ||
callback(null,{total:total}) | ||
var total = args.net * (1 + rate) | ||
callback(null, { total: total }) | ||
}) | ||
@@ -235,3 +235,3 @@ | ||
// local rates | ||
seneca.add( {cmd:'salestax',country:'US'}, function(args,callback){ | ||
seneca.add({ cmd: 'salestax', country: 'US' }, function (args, callback) { | ||
var state = { | ||
@@ -243,4 +243,4 @@ 'NY': 0.04, | ||
var rate = state[args.state] | ||
var total = args.net * (1+rate) | ||
callback(null,{total:total}) | ||
var total = args.net * (1 + rate) | ||
callback(null, { total: total }) | ||
}) | ||
@@ -250,3 +250,3 @@ | ||
// categories | ||
seneca.add( {cmd:'salestax',country:'IE'}, function(args,callback){ | ||
seneca.add({ cmd: 'salestax', country: 'IE' }, function (args, callback) { | ||
var category = { | ||
@@ -258,17 +258,17 @@ 'top': 0.23, | ||
var rate = category[args.category] | ||
var total = args.net * (1+rate) | ||
callback(null,{total:total}) | ||
var total = args.net * (1 + rate) | ||
callback(null, { total: total }) | ||
}) | ||
seneca.act('cmd:salestax,net:100,country:DE', function(err,result){ | ||
console.log( 'DE: '+result.total ) | ||
seneca.act('cmd:salestax,net:100,country:DE', function (err, result) { | ||
console.log('DE: ' + result.total) | ||
}) | ||
seneca.act('cmd:salestax,net:100,country:US,state:NY', function(err,result){ | ||
console.log( 'US,NY: '+result.total ) | ||
seneca.act('cmd:salestax,net:100,country:US,state:NY', function (err, result) { | ||
console.log('US,NY: ' + result.total) | ||
}) | ||
seneca.act('cmd:salestax,net:100,country:IE,category:reduced', function(err,result){ | ||
console.log( 'IE: '+result.total ) | ||
seneca.act('cmd:salestax,net:100,country:IE,category:reduced', function (err, result) { | ||
console.log('IE: ' + result.total) | ||
}) | ||
@@ -292,5 +292,10 @@ | ||
## Contributing | ||
The [Senecajs org][] encourage open participation. If you feel you can help in any way, be it with | ||
documentation, examples, extra testing, or new features please get in touch. | ||
The [Senecajs org][] encourages open participation. If you feel you can help in any way, be it with | ||
bug reporting, documentation, examples, extra testing, or new features feel free to [create an issue][github issue], | ||
or better yet, [submit a pull request][github pull request]. | ||
We have 2 main forms of documention for getting started with contributing: | ||
- [Our very brief, and to the point, contributing.md](./CONTRIBUTING.md) | ||
- [Our much more comprehensive contributing documentation.][contributing] | ||
## License | ||
@@ -312,4 +317,6 @@ Copyright Richard Rodger and other contributors 2015, Licensed under [MIT][]. | ||
[github issue]: https://github.com/senecajs/seneca/issues | ||
[github pull request]: https://github.com/senecajs/seneca/pulls | ||
[@senecajs]: http://twitter.com/senecajs | ||
[lightning]: http://aws.amazon.com/message/67457/ | ||
[plugins]: https://github.com/search?utf8=%E2%9C%93&q=seneca&type=Repositories&ref=searchresults | ||
[contributing]: http://senecajs.org/contribute/ |
@@ -595,3 +595,3 @@ /* Copyright (c) 2010-2015 Richard Rodger, MIT License */ | ||
self.log.error( | ||
'sub', 'err', args.meta.id$, err.message, args, err.stack) | ||
'sub', 'err', args.meta$.id, err.message, args, err.stack) | ||
} | ||
@@ -725,3 +725,3 @@ }) | ||
if (_.isFunction(priormeta.handle)) { | ||
priormeta.handle( args.pattern, action ) | ||
priormeta.handle(args.pattern, action) | ||
addroute = false | ||
@@ -880,6 +880,4 @@ } | ||
_.each(pin, function (p) { | ||
_.each( pinthis.findpins(p), function (actpattern) { | ||
pinthis.add(actpattern, meta, function (args, done) { | ||
wrapper.call(this, args, done) | ||
}) | ||
_.each(pinthis.findpins(p), function (actpattern) { | ||
pinthis.add(actpattern, meta, wrapper) | ||
}) | ||
@@ -1191,2 +1189,4 @@ }) | ||
fn: function (cb) { | ||
cb.seneca = delegate | ||
if (root.closed && !callargs.closing$) { | ||
@@ -1193,0 +1193,0 @@ return cb(internals.error('instance-closed', {args: Common.clean(callargs)})) |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
137534
0.69%3712
0.05%0
-100%307
2.33%