Comparing version 1.1.0 to 1.1.1
@@ -1,2 +0,2 @@ | ||
const {getType, isPromise} = require('./util') | ||
const {getType, isPromise, isFunction} = require('./util') | ||
const { | ||
@@ -6,2 +6,3 @@ InvalidArgumentsObjectError, | ||
} = require('./errors') | ||
const {inspect} = require('util') | ||
@@ -16,2 +17,8 @@ // execute a stack of services (similar to async.waterfall) | ||
if (cb != null && !isFunction(cb)) { | ||
const e = new Error(`WARNING: ${serviceName} was provided ${inspect(cb)} as callback. Did you mean to pass a function?`) | ||
console.warn(e) | ||
cb = () => {} | ||
} | ||
// if no callback was provided, then return a promise | ||
@@ -18,0 +25,0 @@ let p |
{ | ||
"name": "law", | ||
"description": "Tools to create policy and validations for services.", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"homepage": "http://github.com/TorchlightSoftware/law", | ||
@@ -6,0 +6,0 @@ "repository": "git://github.com/TorchlightSoftware/law.git", |
@@ -24,3 +24,3 @@ # Law | ||
// check the sessionId against the database | ||
done null, {role: 'Supreme Commander'} | ||
done(null, {role: 'Supreme Commander'}) | ||
} | ||
@@ -38,3 +38,3 @@ ``` | ||
// check the sessionId against the database | ||
done null, {role: 'Supreme Commander'} | ||
done(null, {role: 'Supreme Commander'}) | ||
} | ||
@@ -61,17 +61,17 @@ } | ||
{ | ||
typeName: 'String' | ||
typeName: 'String', | ||
validation: (arg, assert) => | ||
assert(typeof arg === 'string') | ||
assert(typeof arg === 'string'), | ||
defaultArgs: ['email', 'password', 'sessionId', 'userId'] | ||
}, | ||
{ | ||
typeName: 'SessionId' | ||
typeName: 'SessionId', | ||
validation: (arg, assert) => | ||
assert(arg.match(redisId)) | ||
assert(arg.match(redisId)), | ||
defaultArgs: ['sessionId'] | ||
}, | ||
{ | ||
typeName: 'MongoId' | ||
typeName: 'MongoId', | ||
validation: (arg, assert) => | ||
assert(arg.match(mongoId)) | ||
assert(arg.match(mongoId)), | ||
defaultArgs: ['userId'] | ||
@@ -156,4 +156,2 @@ } | ||
Knock yourself out. | ||
## Dependencies (optional feature) | ||
@@ -175,3 +173,2 @@ | ||
}, | ||
service: (args, done, {services: {aHelperService}, lib: {lodash}}) => { | ||
@@ -210,8 +207,11 @@ args = lodash.merge({myOpt: 1}, args) | ||
// files from the sample app | ||
const serviceLocation = join(__dirname, '../sample/app/domain/auth/services') | ||
const argTypes = require('../sample/app/domain/auth/jargon') | ||
const serviceRoot = join(__dirname, '../sample/app/domain/auth/services') | ||
const jargon = require('../sample/app/domain/auth/jargon') | ||
const policy = require('../sample/app/domain/auth/policy') | ||
// load recurses through subdirectories and tries to | ||
// load any js files it finds | ||
const services = load(serviceRoot) | ||
// services is just an object with {serviceName: serviceFn} | ||
const services = load(serviceLocation) | ||
const services = create({services, jargon, policy}) | ||
@@ -218,0 +218,0 @@ console.debug("I am the law:", printFilters(services)) |
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
37746
730