@jepz20/conman
Advanced tools
Comparing version 0.0.13 to 0.0.14
{ | ||
"name": "@jepz20/conman", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "Configuration manager that supports ttl and plugabble sources", | ||
@@ -17,3 +17,3 @@ "main": "./src/conman", | ||
}, | ||
"gitHead": "520960b62d7a636a1a4c13d5933a06d2aefc852d", | ||
"gitHead": "a1877d23a24042de10fa25296f519a3c681712f2", | ||
"lint-staged": { | ||
@@ -20,0 +20,0 @@ "src/**/*.*": [ |
@@ -14,7 +14,7 @@ # CONMAN | ||
// Require conman | ||
const Conman = require('@jepz20/conman'); | ||
const Conman = require('@highly-attractive-people/conman'); | ||
// Require the sources you will need in your config | ||
const s3 = require('@jepz20/conman-s3-source'); | ||
const memory = require('@jepz20/conman-memory-source'); | ||
const s3 = require('@highly-attractive-people/conman-s3-source'); | ||
const memory = require('@highly-attractive-people/conman-memory-source'); | ||
@@ -21,0 +21,0 @@ // if your source requires it initialize it |
@@ -29,10 +29,15 @@ const { mergeDeepRight } = require('ramda'); | ||
* @param {object} logger Object that atleast a log and error function | ||
* @param logger.log Logs info | ||
* @param logger.error Logs error | ||
* @param {function} logger.log Logs info | ||
* @param {function} logger.error Logs error | ||
* @return {function(string, *)} Function that logs if enabled with the set logger | ||
*/ | ||
function _log(isEnabled, logger) { | ||
const fixedLogger = logger; | ||
if (!logger.log && logger.info) { | ||
fixedLogger.log = logger.info; | ||
} | ||
return function inner(type, ...args) { | ||
if (isEnabled) { | ||
logger[type](...args); | ||
fixedLogger[type](...args); | ||
} | ||
@@ -39,0 +44,0 @@ }; |
@@ -249,2 +249,26 @@ jest.mock('jsonfile'); | ||
it('should use logger info if no logger log is provided', async () => { | ||
const customLogger = { | ||
info: jest.fn(), | ||
error: jest.fn() | ||
}; | ||
const options = { | ||
logger: customLogger, | ||
logEnabled: true, | ||
useFile: false, | ||
ttl: 0 | ||
}; | ||
const source1 = source({ test: 'test', test3: 'test3' }); | ||
jest.spyOn(source1, 'build'); | ||
const config = conman(options); | ||
await config.addSource(source1).build(); | ||
expect(options.logger.info).toHaveBeenCalled(); | ||
expect(jsonfile.writeFile).toHaveBeenCalledTimes(0); | ||
expect(jsonfile.readFile).toHaveBeenCalledTimes(0); | ||
expect(source1.build).toHaveBeenCalledTimes(1); | ||
}); | ||
it('should use the file if is NOT expired', async () => { | ||
@@ -251,0 +275,0 @@ const source1 = source({ test: 'test', test3: 'test3' }); |
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
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 10 instances in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
0
0
492793
13
881