knifecycle
Advanced tools
Comparing version 7.0.0 to 7.0.1
@@ -0,1 +1,5 @@ | ||
## [7.0.1](https://github.com/nfroidure/knifecycle/compare/v7.0.0...v7.0.1) (2019-12-01) | ||
# [7.0.0](https://github.com/nfroidure/knifecycle/compare/v6.0.0...v7.0.0) (2019-11-28) | ||
@@ -2,0 +6,0 @@ |
@@ -641,2 +641,6 @@ "use strict"; | ||
if (serviceDescriptorPromise) { | ||
if (autoloading) { | ||
debug(`⚠️ - Possible dead lock due to reusing "${serviceName}" from the silo context while autoloading.`); | ||
} | ||
return serviceDescriptorPromise; | ||
@@ -652,2 +656,6 @@ } | ||
if (serviceDescriptorPromise) { | ||
if (autoloading) { | ||
debug(`⚠️ - Possible dead lock due to reusing the singleton "${serviceName}" while autoloading.`); | ||
} | ||
this._singletonsServicesHandles.get(serviceName).add(siloContext.name); | ||
@@ -654,0 +662,0 @@ } else { |
@@ -791,3 +791,3 @@ "use strict"; | ||
}); | ||
it('should fail when autoload depends on autoloaded/unexisting dependencies', async () => { | ||
it('should fail when autoload depends on existing autoloaded dependencies', async () => { | ||
$.register((0, _index.initializer)({ | ||
@@ -818,2 +818,51 @@ type: 'service', | ||
}); | ||
it('should work when autoload depends on optional and unexisting autoloaded dependencies', async () => { | ||
$.register((0, _index.initializer)({ | ||
type: 'service', | ||
name: '$autoload', | ||
inject: ['?ENV'], | ||
options: { | ||
singleton: true | ||
} | ||
}, async () => async serviceName => ({ | ||
path: `/path/of/${serviceName}`, | ||
initializer: (0, _index.initializer)({ | ||
type: 'service', | ||
name: serviceName, | ||
inject: [] | ||
}, async () => `THE_${serviceName.toUpperCase()}:` + serviceName) | ||
}))); | ||
const dependencies = await $.run(['test']); | ||
_assert.default.deepEqual(Object.keys(dependencies), ['test']); | ||
}); | ||
it.skip('should work when autoload depends on deeper optional and unexisting autoloaded dependencies', async () => { | ||
$.register((0, _index.initializer)({ | ||
type: 'service', | ||
name: 'log', | ||
inject: ['?LOG_ROUTING', '?LOGGER', '?debug'] | ||
}, async () => { | ||
return function log() {}; | ||
})); | ||
$.register((0, _index.constant)('LOGGER', 'LOGGER_CONSTANT')); | ||
$.register((0, _index.constant)('debug', 'debug_value')); | ||
$.register((0, _index.initializer)({ | ||
type: 'service', | ||
name: '$autoload', | ||
inject: ['?ENV', '?log'], | ||
options: { | ||
singleton: true | ||
} | ||
}, async () => async serviceName => ({ | ||
path: `/path/of/${serviceName}`, | ||
initializer: (0, _index.initializer)({ | ||
type: 'service', | ||
name: serviceName, | ||
inject: [] | ||
}, async () => `THE_${serviceName.toUpperCase()}:` + serviceName) | ||
}))); | ||
const dependencies = await $.run(['test', 'log']); | ||
_assert.default.deepEqual(Object.keys(dependencies), ['test', 'log']); | ||
}); | ||
}); | ||
@@ -820,0 +869,0 @@ describe('$injector', () => { |
{ | ||
"name": "knifecycle", | ||
"version": "7.0.0", | ||
"version": "7.0.1", | ||
"description": "Manage your NodeJS processes's lifecycle automatically with an unobtrusive dependency injection implementation.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
220993
3929