Comparing version 1.0.29 to 1.0.30
{ | ||
"name": "meadow", | ||
"version": "1.0.29", | ||
"version": "1.0.30", | ||
"description": "A data access library.", | ||
@@ -29,15 +29,15 @@ "main": "source/Meadow.js", | ||
"devDependencies": { | ||
"alasql": "^0.4.0", | ||
"chai": "3.5.0", | ||
"codeclimate-test-reporter": "0.4.1", | ||
"alasql": "^0.4.0", | ||
"mysql2": "1.2.0", | ||
"coveralls": "2.13.1", | ||
"groc": "^0.8.0", | ||
"istanbul": "0.4.5", | ||
"mocha": "3.4.1" | ||
"mocha": "3.4.1", | ||
"mysql2": "1.2.0" | ||
}, | ||
"dependencies": { | ||
"async": "2.4.0", | ||
"fable": "~1.0.1", | ||
"foxhound": "~1.0.22", | ||
"fable": "^2.0.1", | ||
"foxhound": "~1.0.31", | ||
"is-my-json-valid": "2.16.0", | ||
@@ -44,0 +44,0 @@ "underscore": "1.8.3" |
@@ -27,3 +27,3 @@ // ##### Part of the **[retold](https://stevenvelozo.github.io/retold/)** system | ||
// If a valid Fable object isn't passed in, return a constructor | ||
if ((typeof(pMeadow) !== 'object') || (!pMeadow.hasOwnProperty('fable'))) | ||
if ((typeof(pMeadow) !== 'object') || !('fable' in pMeadow)) | ||
{ | ||
@@ -30,0 +30,0 @@ return {new: createNew}; |
@@ -19,3 +19,3 @@ // ##### Part of the **[retold](https://stevenvelozo.github.io/retold/)** system | ||
// If a valid Fable object isn't passed in, return a constructor | ||
if ((typeof(pFable) !== 'object') || (!pFable.hasOwnProperty('fable'))) | ||
if ((typeof(pFable) !== 'object') || !('fable' in pFable)) | ||
{ | ||
@@ -114,4 +114,4 @@ return {new: createNew}; | ||
}; | ||
/** | ||
@@ -131,3 +131,3 @@ * Set the Provider for Query execution. | ||
{ | ||
return setProvider('None'); | ||
pProviderName = 'None'; | ||
} | ||
@@ -145,3 +145,2 @@ | ||
_ProviderName = pProviderName; | ||
@@ -151,3 +150,3 @@ } | ||
{ | ||
_Fable.log.error({ProviderModuleFile:tmpProviderModuleFile, InvalidProvider:pProviderName, error:pError}, 'Provider not set - require load problem'); | ||
_Fable.log.error('Provider not set - require load problem', {ProviderModuleFile:tmpProviderModuleFile, InvalidProvider:pProviderName, error:pError}); | ||
//setProvider('None'); | ||
@@ -288,10 +287,19 @@ } | ||
*/ | ||
var _RoleNames = [ | ||
"Readonly", | ||
"User", | ||
"Manager", | ||
"Director", | ||
"Executive", | ||
"Administrator" | ||
]; | ||
let _RoleNames; | ||
if (Array.isArray(_Fable.settings.MeadowRoleNames)) | ||
{ | ||
_RoleNames = _Fable.settings.MeadowRoleNames; | ||
} | ||
else | ||
{ | ||
_RoleNames = | ||
[ | ||
'Unauthenticated', | ||
'User', | ||
'Manager', | ||
'Director', | ||
'Executive', | ||
'Administrator', | ||
]; | ||
} | ||
var getRoleName = function(pRoleIndex) | ||
@@ -529,4 +537,29 @@ { | ||
_Fable.addServices(tmpNewMeadowObject); | ||
// addServices removed in fable 2.x | ||
if (typeof(_Fable.addServices) === 'function') | ||
{ | ||
_Fable.addServices(tmpNewMeadowObject); | ||
} | ||
else | ||
{ | ||
// bring over addServices implementation from Fable 1.x for backward compatibility | ||
Object.defineProperty(tmpNewMeadowObject, 'fable', | ||
{ | ||
get: function() { return _Fable; }, | ||
enumerable: false, | ||
}); | ||
Object.defineProperty(tmpNewMeadowObject, 'settings', | ||
{ | ||
get: function() { return _Fable.settings; }, | ||
enumerable: false, | ||
}); | ||
Object.defineProperty(tmpNewMeadowObject, 'log', | ||
{ | ||
get: function() { return _Fable.log; }, | ||
enumerable: false, | ||
}); | ||
} | ||
return tmpNewMeadowObject; | ||
@@ -533,0 +566,0 @@ } |
@@ -12,3 +12,3 @@ // ##### Part of the **[retold](https://stevenvelozo.github.io/retold/)** system | ||
// If a valid Fable object isn't passed in, return a constructor | ||
if ((typeof(pFable) !== 'object') || (!pFable.hasOwnProperty('fable'))) | ||
if ((typeof(pFable) !== 'object') || !('fable' in pFable)) | ||
{ | ||
@@ -15,0 +15,0 @@ return {new: createNew}; |
@@ -13,15 +13,3 @@ /** | ||
var libFable = require('fable').new({ | ||
LogStreams: | ||
[ | ||
{ | ||
level: 'fatal', | ||
streamtype:'process.stdout', | ||
}, | ||
{ | ||
level: 'trace', | ||
path: __dirname+'/../tests.log' | ||
} | ||
] | ||
}); | ||
var libFable = require('fable'); | ||
@@ -69,2 +57,3 @@ var _TestAnimalJsonSchema = ( | ||
{ | ||
let _Fable; | ||
setup | ||
@@ -74,2 +63,16 @@ ( | ||
{ | ||
_Fable = libFable.new( | ||
{ | ||
LogStreams: | ||
[ | ||
{ | ||
level: 'fatal', | ||
streamtype:'process.stdout', | ||
}, | ||
{ | ||
level: 'trace', | ||
path: __dirname+'/../tests.log' | ||
} | ||
] | ||
}); | ||
} | ||
@@ -97,3 +100,3 @@ ); | ||
{ | ||
var testMeadow = require('../source/Meadow.js').new(libFable); | ||
var testMeadow = require('../source/Meadow.js').new(_Fable); | ||
Expect(testMeadow).to.have.a.property('scope') | ||
@@ -112,3 +115,3 @@ .that.is.a('string'); // Scope is always a string | ||
{ | ||
var testMeadow = require('../source/Meadow.js').new(libFable, 'Animal', _TestAnimalJsonSchema); | ||
var testMeadow = require('../source/Meadow.js').new(_Fable, 'Animal', _TestAnimalJsonSchema); | ||
Expect(testMeadow.scope) | ||
@@ -125,3 +128,3 @@ .to.equal('Animal'); | ||
{ | ||
var testMeadow = require('../source/Meadow.js').new(libFable, 'Animal', _TestAnimalJsonSchema); | ||
var testMeadow = require('../source/Meadow.js').new(_Fable, 'Animal', _TestAnimalJsonSchema); | ||
Expect(testMeadow.getRoleName(0)) | ||
@@ -142,3 +145,3 @@ .to.equal('Unauthenticated'); | ||
{ | ||
var testMeadow = require('../source/Meadow.js').new(libFable) | ||
var testMeadow = require('../source/Meadow.js').new(_Fable) | ||
.setScope('Animal') | ||
@@ -158,3 +161,3 @@ .setSchema(_TestAnimalJsonSchema); | ||
{ | ||
var testMeadow = require('../source/Meadow.js').new(libFable, 'Animal', _TestAnimalJsonSchema); | ||
var testMeadow = require('../source/Meadow.js').new(_Fable, 'Animal', _TestAnimalJsonSchema); | ||
var tmpValidationResults = testMeadow.validateObject({id:10, type:'bunny', name:'foofoo', age:3}); | ||
@@ -170,6 +173,6 @@ Expect(tmpValidationResults.Valid) | ||
{ | ||
var testMeadow = require('../source/Meadow.js').new(libFable, 'Animal', _TestAnimalJsonSchema); | ||
var testMeadow = require('../source/Meadow.js').new(_Fable, 'Animal', _TestAnimalJsonSchema); | ||
// Our zombie needs a name! | ||
var tmpValidationResults = testMeadow.validateObject({id:9, type:'zombie', age:3}); | ||
libFable.log.info('Bad Unnamed Zombie Validation Results', tmpValidationResults); | ||
_Fable.log.info('Bad Unnamed Zombie Validation Results', tmpValidationResults); | ||
Expect(tmpValidationResults.Valid) | ||
@@ -184,3 +187,3 @@ .to.equal(false); | ||
{ | ||
var testMeadow = require('../source/Meadow.js').new(libFable, 'Animal', _TestAnimalJsonSchema); | ||
var testMeadow = require('../source/Meadow.js').new(_Fable, 'Animal', _TestAnimalJsonSchema); | ||
Expect(testMeadow.providerName) | ||
@@ -195,3 +198,3 @@ .to.equal('None'); | ||
{ | ||
var testMeadow = require('../source/Meadow.js').new(libFable, 'Animal', _TestAnimalJsonSchema); | ||
var testMeadow = require('../source/Meadow.js').new(_Fable, 'Animal', _TestAnimalJsonSchema); | ||
testMeadow.logSlowQuery(100, testMeadow.query); | ||
@@ -205,3 +208,3 @@ } | ||
{ | ||
var testMeadow = require('../source/Meadow.js').new(libFable, 'Animal', _TestAnimalJsonSchema); | ||
var testMeadow = require('../source/Meadow.js').new(_Fable, 'Animal', _TestAnimalJsonSchema); | ||
Expect(testMeadow.providerName) | ||
@@ -222,3 +225,3 @@ .to.equal('None'); | ||
{ | ||
var testMeadow = require('../source/Meadow.js').new(libFable).loadFromPackage(__dirname+'/Animal.json'); | ||
var testMeadow = require('../source/Meadow.js').new(_Fable).loadFromPackage(__dirname+'/Animal.json'); | ||
Expect(testMeadow.scope) | ||
@@ -233,3 +236,3 @@ .to.equal('FableTest'); | ||
{ | ||
var testMeadow = require('../source/Meadow.js').new(libFable).loadFromPackage(__dirname+'/EmptyPackage.json'); | ||
var testMeadow = require('../source/Meadow.js').new(_Fable).loadFromPackage(__dirname+'/EmptyPackage.json'); | ||
Expect(testMeadow.scope) | ||
@@ -244,3 +247,3 @@ .to.equal('Unknown'); | ||
{ | ||
var testMeadow = require('../source/Meadow.js').new(libFable).loadFromPackage(__dirname+'/BadAnimal.json'); | ||
var testMeadow = require('../source/Meadow.js').new(_Fable).loadFromPackage(__dirname+'/BadAnimal.json'); | ||
Expect(testMeadow) | ||
@@ -250,5 +253,37 @@ .to.equal(false); | ||
); | ||
test | ||
( | ||
'Able to override role names', | ||
function() | ||
{ | ||
// given | ||
_Fable = libFable.new( | ||
{ | ||
MeadowRoleNames: ['Cool', 'Bold', 'Tired'], | ||
LogStreams: | ||
[ | ||
{ | ||
level: 'fatal', | ||
streamtype:'process.stdout', | ||
}, | ||
{ | ||
level: 'trace', | ||
path: __dirname+'/../tests.log' | ||
} | ||
] | ||
}); | ||
const meadow = require('../source/Meadow.js').new(_Fable); | ||
// when | ||
const roleNames = [0, 1, 2].map(i => meadow.getRoleName(i)); | ||
// then | ||
Expect(roleNames).to.deep.equal(_Fable.settings.MeadowRoleNames); | ||
} | ||
); | ||
} | ||
); | ||
} | ||
); | ||
); |
@@ -25,4 +25,4 @@ /** | ||
Port: 3306, | ||
User: "root", | ||
Password: "", | ||
User: "admin", | ||
Password: "zKVMD14cPC5N", | ||
Database: "FableTest", | ||
@@ -1120,2 +1120,2 @@ ConnectionPoolLimit: 20 | ||
} | ||
); | ||
); |
@@ -167,3 +167,3 @@ /** | ||
// Can't really test update with NONE | ||
fDone(); | ||
@@ -198,3 +198,3 @@ } | ||
{ | ||
libFable.log.info(pError, pRecord) | ||
libFable.log.info(pError, pRecord); | ||
Expect(pQuery.parameters.result.executed).to.equal(true); | ||
@@ -209,2 +209,2 @@ fDone(); | ||
} | ||
); | ||
); |
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
142264
30
4579
1
+ Addedbunyan@1.8.15(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedasap@2.0.6(transitive)
- Removedbiguint-format2@1.0.0(transitive)
- Removedbson@0.5.7(transitive)
- Removedbuffer-shims@1.0.0(transitive)
- Removedbunyan@1.8.12(transitive)
- Removedbunyan-elasticsearch@1.0.1(transitive)
- Removedbunyan-mongo@0.1.0(transitive)
- Removedchalk@1.1.3(transitive)
- Removedcoffee-script@1.12.7(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedelasticsearch@12.1.3(transitive)
- Removedes6-promise@3.2.1(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedfable@1.0.3(transitive)
- Removedfable-log@1.0.10(transitive)
- Removedfable-settings@1.0.3(transitive)
- Removedfable-uuid@1.0.3(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedgelf-stream@1.1.1(transitive)
- Removedgelfling@0.3.1(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedisarray@1.0.0(transitive)
- Removedmongodb@2.2.10(transitive)
- Removedmongodb-core@2.0.12(transitive)
- Removedprocess-nextick-args@1.0.7(transitive)
- Removedpromise@7.3.1(transitive)
- Removedreadable-stream@2.1.5(transitive)
- Removedrequire_optional@1.0.1(transitive)
- Removedresolve-from@2.0.0(transitive)
- Removedsemver@5.7.2(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.0(transitive)
- Removedunderscore@1.9.1(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removeduuid@3.4.0(transitive)
Updatedfable@^2.0.1
Updatedfoxhound@~1.0.31