determination
Advanced tools
Comparing version 2.0.0 to 3.0.0
### 3.0.0 | ||
- Updated license and copyright | ||
- [BREAKING] Updated Node.js supported version | ||
### 2.0.0 | ||
@@ -3,0 +8,0 @@ |
@@ -0,5 +1,30 @@ | ||
/** | ||
* | ||
* MIT License | ||
* | ||
* Copyright (c) 2019 Expedia, Inc | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
* | ||
**/ | ||
'use strict'; | ||
const Joi = require('joi'); | ||
const Hoek = require('hoek'); | ||
const Joi = require('@hapi/joi'); | ||
const Hoek = require('@hapi/hoek'); | ||
const Resolver = require('./resolver'); | ||
@@ -17,8 +42,6 @@ const Store = require('./store'); | ||
const create = function (options) { | ||
const validation = Joi.validate(options, schema); | ||
const validation = schema.validate(options); | ||
Hoek.assert(!validation.error, validation.error); | ||
const resolver = Resolver(validation.value); | ||
const determination = { | ||
@@ -33,3 +56,3 @@ resolve(callback) { | ||
} | ||
resolver().then((resolved) => callback(null, new Store(resolved))).catch(callback); | ||
Resolver(validation.value).then((resolved) => callback(null, new Store(resolved))).catch(callback); | ||
} | ||
@@ -36,0 +59,0 @@ }; |
@@ -0,8 +1,33 @@ | ||
/** | ||
* | ||
* MIT License | ||
* | ||
* Copyright (c) 2019 Expedia, Inc | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
* | ||
**/ | ||
'use strict'; | ||
const Co = require('co'); | ||
const Entries = require('entries'); | ||
const Shortstop = require('shortstop'); | ||
const Confidence = require('confidence'); | ||
const Hoek = require('hoek'); | ||
const Hoek = require('@hapi/hoek'); | ||
const Path = require('path'); | ||
@@ -35,3 +60,3 @@ const LoadJson = require('load-jsonic-sync'); | ||
const resolver = function ({ config, criteria, protocols, defaults, overrides }) { | ||
const resolver = async function ({ config, criteria, protocols, defaults, overrides }) { | ||
@@ -50,41 +75,38 @@ const basedir = Path.dirname(config); | ||
return Co.wrap(function *() { | ||
const overriden = Hoek.applyToDefaults(configobject, overrides); | ||
const overriden = Hoek.applyToDefaults(configobject, overrides); | ||
const merged = Hoek.applyToDefaults(defaults, overriden); | ||
const merged = Hoek.applyToDefaults(defaults, overriden); | ||
const resolvedCriteria = resolveCriteria(merged, criteria); | ||
const resolvedCriteria = resolveCriteria(merged, criteria); | ||
const importsResolved = await resolveProtocols(resolvedCriteria, { | ||
import(key) { | ||
return resolveCriteria(LoadJson(Path.resolve(Path.join(basedir, key))), criteria); | ||
} | ||
}); | ||
const importsResolved = yield resolveProtocols(resolvedCriteria, { | ||
import(key) { | ||
return resolveCriteria(LoadJson(Path.resolve(Path.join(basedir, key))), criteria); | ||
} | ||
}); | ||
const baseResolved = await resolveProtocols(importsResolved, protocols); | ||
const baseResolved = yield resolveProtocols(importsResolved, protocols); | ||
const configResolved = await resolveProtocols(baseResolved, { | ||
config(key) { | ||
const keys = key.split('.'); | ||
let result = this; //eslint-disable-line consistent-this | ||
const configResolved = yield resolveProtocols(baseResolved, { | ||
config(key) { | ||
const keys = key.split('.'); | ||
let result = this; | ||
while (result && keys.length) { | ||
const prop = keys.shift(); | ||
while (result && keys.length) { | ||
const prop = keys.shift(); | ||
if (!result.hasOwnProperty(prop)) { | ||
return undefined; | ||
} | ||
result = result[prop]; | ||
if (!result.hasOwnProperty(prop)) { | ||
return undefined; | ||
} | ||
return keys.length ? null : result; | ||
result = result[prop]; | ||
} | ||
}); | ||
return configResolved; | ||
return keys.length ? null : result; | ||
} | ||
}); | ||
return configResolved; | ||
}; | ||
module.exports = resolver; |
@@ -0,5 +1,31 @@ | ||
/** | ||
* | ||
* MIT License | ||
* | ||
* Copyright (c) 2019 Expedia, Inc | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
* | ||
**/ | ||
'use strict'; | ||
const Props = require('dot-prop'); | ||
const Hoek = require('hoek'); | ||
const Hoek = require('@hapi/hoek'); | ||
@@ -6,0 +32,0 @@ class Store { |
@@ -5,8 +5,8 @@ { | ||
"keywords": [ | ||
"application", | ||
"configuration", | ||
"confidence", | ||
"shortstop" | ||
"application", | ||
"configuration", | ||
"confidence", | ||
"shortstop" | ||
], | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"author": "Trevor Livingston <tlivings@gmail.com>", | ||
@@ -19,12 +19,10 @@ "repository": { | ||
"engines": { | ||
"node": ">= 6.0.0" | ||
"node": ">= 8.0.0" | ||
}, | ||
"dependencies": { | ||
"async": "^2.3.0", | ||
"co": "^4.6.0", | ||
"confidence": "^3.0.2", | ||
"dot-prop": "^4.1.1", | ||
"entries": "^1.0.1", | ||
"hoek": "^4.1.1", | ||
"joi": "^10.4.1", | ||
"@hapi/hoek": "^8.5.0", | ||
"@hapi/joi": "^16.1.7", | ||
"load-jsonic-sync": "^1.0.1", | ||
@@ -34,14 +32,15 @@ "shortstop": "^1.0.3" | ||
"devDependencies": { | ||
"eslint": "^3.7.1", | ||
"eslint": "^5.15.1", | ||
"eslint-config-hapi": "^10.0.0", | ||
"eslint-plugin-hapi": "^4.0.0", | ||
"istanbul": "^0.4.1", | ||
"nyc": "^14.1.1", | ||
"tape": "^4.2.2" | ||
}, | ||
"scripts": { | ||
"cover": "istanbul cover tape -- test/*.js", | ||
"cover": "nyc npm test", | ||
"lint": "eslint lib", | ||
"test": "tape test/*.js" | ||
"test": "npm run lint && tape test/*.js" | ||
}, | ||
"main": "./lib" | ||
"main": "./lib", | ||
"license": "MIT" | ||
} |
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
13970
7
191
7
+ Added@hapi/hoek@^8.5.0
+ Added@hapi/joi@^16.1.7
+ Added@hapi/address@2.1.4(transitive)
+ Added@hapi/formula@1.2.0(transitive)
+ Added@hapi/hoek@8.5.1(transitive)
+ Added@hapi/joi@16.1.8(transitive)
+ Added@hapi/pinpoint@1.0.2(transitive)
+ Added@hapi/topo@3.1.6(transitive)
- Removedasync@^2.3.0
- Removedco@^4.6.0
- Removedhoek@^4.1.1
- Removedjoi@^10.4.1
- Removedasync@2.6.4(transitive)
- Removedco@4.6.0(transitive)
- Removedisemail@2.2.1(transitive)
- Removeditems@2.2.1(transitive)
- Removedjoi@10.6.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedtopo@2.1.1(transitive)