Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

knifecycle

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knifecycle - npm Package Compare versions

Comparing version 14.0.0 to 14.1.0

9

CHANGELOG.md

@@ -0,1 +1,10 @@

# [14.1.0](https://github.com/nfroidure/knifecycle/compare/v14.0.0...v14.1.0) (2022-08-30)
### Bug Fixes
* **types:** fix types according to the last TypeScript version ([0873bff](https://github.com/nfroidure/knifecycle/commit/0873bffb094563c4ffecd80b6484d50f068d7f9b))
# [14.0.0](https://github.com/nfroidure/knifecycle/compare/v13.0.0...v14.0.0) (2022-06-16)

@@ -2,0 +11,0 @@

2

dist/build.js

@@ -171,3 +171,3 @@ import { SPECIAL_PROPS, parseDependencyDeclaration, initializer, } from './util.js';

}
node.__childNodes.forEach((childNode) => {
(node?.__childNodes || []).forEach((childNode) => {
hash = buildHashFromNode(childNode, hash);

@@ -174,0 +174,0 @@ });

@@ -0,1 +1,2 @@

import { describe, test } from '@jest/globals';
import assert from 'assert';

@@ -44,3 +45,3 @@ import { YError } from 'yerror';

});
it('should build an initialization module', async () => {
test('should build an initialization module', async () => {
const $ = new Knifecycle();

@@ -47,0 +48,0 @@ $.register(constant('PWD', '~/my-project'));

/* eslint max-nested-callbacks:0 */
import { describe, beforeEach, test } from '@jest/globals';
import assert from 'assert';

@@ -26,9 +27,9 @@ import sinon from 'sinon';

describe('with constants', () => {
it('should work with an object', () => {
test('should work with an object', () => {
$.register(constant('ENV', ENV));
});
it('should work with a function', () => {
test('should work with a function', () => {
$.register(constant('time', time));
});
it('should work when overriding a previously set constant', async () => {
test('should work when overriding a previously set constant', async () => {
$.register(constant('TEST', 1));

@@ -40,3 +41,3 @@ $.register(constant('TEST', 2));

});
it('should fail when overriding an initialized constant', async () => {
test('should fail when overriding an initialized constant', async () => {
$.register(constant('TEST', 1));

@@ -56,6 +57,6 @@ assert.deepEqual(await $.run(['TEST']), {

describe('with services', () => {
it('should work with a service', () => {
test('should work with a service', () => {
$.register(service(timeService, 'time'));
});
it('should work when overriding a previously set service', async () => {
test('should work when overriding a previously set service', async () => {
$.register(service(async () => () => 1, 'test'));

@@ -66,3 +67,3 @@ $.register(service(async () => () => 2, 'test'));

});
it('should fail when overriding an initialized service', async () => {
test('should fail when overriding an initialized service', async () => {
$.register(service(async () => () => 1, 'test'));

@@ -81,6 +82,6 @@ const { test } = await $.run(['test']);

describe('with providers', () => {
it('should work with a provider', () => {
test('should work with a provider', () => {
$.register(service(hashProvider, 'hash'));
});
it('should work when overriding a previously set provider', async () => {
test('should work when overriding a previously set provider', async () => {
$.register(initializer({

@@ -103,3 +104,3 @@ type: 'provider',

});
it('should work when overriding a previously set singleton provider', async () => {
test('should work when overriding a previously set singleton provider', async () => {
$.register(initializer({

@@ -123,3 +124,3 @@ type: 'provider',

});
it('should fail when overriding an initialized provider', async () => {
test('should fail when overriding an initialized provider', async () => {
$.register(initializer({

@@ -150,3 +151,3 @@ type: 'provider',

});
it('should fail when intitializer is no a function', () => {
test('should fail when intitializer is no a function', () => {
assert.throws(() => {

@@ -160,3 +161,3 @@ $.register('not_a_function');

});
it('should fail with no service name', () => {
test('should fail with no service name', () => {
assert.throws(() => {

@@ -170,3 +171,3 @@ $.register(async () => undefined);

});
it('should fail with a bad service type', () => {
test('should fail with a bad service type', () => {
assert.throws(() => {

@@ -187,3 +188,3 @@ const fn = async () => undefined;

});
it('should fail with an undefined constant', () => {
test('should fail with an undefined constant', () => {
assert.throws(() => {

@@ -201,3 +202,3 @@ const fn = async () => undefined;

});
it('should fail with a non constant that has a value', () => {
test('should fail with a non constant that has a value', () => {
assert.throws(() => {

@@ -215,3 +216,3 @@ const fn = async () => undefined;

});
it('should fail with special autoload intitializer that is not a singleton', () => {
test('should fail with special autoload intitializer that is not a singleton', () => {
assert.throws(() => {

@@ -230,6 +231,6 @@ $.register(initializer({

describe('provider', () => {
it('should register provider', () => {
test('should register provider', () => {
$.register(provider(hashProvider, 'hash'));
});
it('should fail with direct circular dependencies', () => {
test('should fail with direct circular dependencies', () => {
assert.throws(() => {

@@ -243,3 +244,3 @@ $.register(provider(hashProvider, 'hash', ['hash']));

});
it('should fail with direct circular dependencies on mapped services', () => {
test('should fail with direct circular dependencies on mapped services', () => {
assert.throws(() => {

@@ -253,3 +254,3 @@ $.register(provider(hashProvider, 'hash', ['hash>lol']));

});
it('should fail with circular dependencies', () => {
test('should fail with circular dependencies', () => {
assert.throws(() => {

@@ -266,3 +267,3 @@ $.register(provider(inject(['hash3'], hashProvider), 'hash'));

});
it('should fail with deeper circular dependencies', () => {
test('should fail with deeper circular dependencies', () => {
assert.throws(() => {

@@ -285,3 +286,3 @@ $.register(provider(inject(['hash1'], hashProvider), 'hash'));

});
it('should fail with circular dependencies on mapped services', () => {
test('should fail with circular dependencies on mapped services', () => {
assert.throws(() => {

@@ -304,7 +305,7 @@ $.register(provider(inject(['hash3>aHash3'], hashProvider), 'hash'));

describe('run', () => {
it('should work with no dependencies', async () => {
test('should work with no dependencies', async () => {
const dependencies = await $.run([]);
assert.deepEqual(dependencies, {});
});
it('should work with constant dependencies', async () => {
test('should work with constant dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -319,3 +320,3 @@ $.register(constant('time', time));

});
it('should work with service dependencies', async () => {
test('should work with service dependencies', async () => {
const wrappedSampleService = inject(['time'], async function sampleService({ time }) {

@@ -332,3 +333,3 @@ return Promise.resolve(typeof time);

});
it('should work with simple dependencies', async () => {
test('should work with simple dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -344,3 +345,3 @@ $.register(constant('time', time));

});
it('should work with given optional dependencies', async () => {
test('should work with given optional dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -357,3 +358,3 @@ $.register(constant('DEBUG', {}));

});
it('should work with lacking optional dependencies', async () => {
test('should work with lacking optional dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -369,3 +370,3 @@ $.register(constant('time', time));

});
it('should work with deeper dependencies', async () => {
test('should work with deeper dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -382,3 +383,3 @@ $.register(constant('time', time));

});
it('should instanciate services once', async () => {
test('should instanciate services once', async () => {
const timeServiceStub = sinon.spy(timeService);

@@ -404,3 +405,3 @@ $.register(constant('ENV', ENV));

});
it('should instanciate a single mapped service', async () => {
test('should instanciate a single mapped service', async () => {
const providerStub = sinon.stub().returns(Promise.resolve({

@@ -428,3 +429,3 @@ service: 'stub',

});
it('should instanciate several services with mappings', async () => {
test('should instanciate several services with mappings', async () => {
const timeServiceStub = sinon.spy(timeService);

@@ -444,3 +445,3 @@ $.register(constant('ENV', ENV));

});
it('should fail with bad service', async () => {
test('should fail with bad service', async () => {
$.register(service((() => undefined), 'lol'));

@@ -456,3 +457,3 @@ try {

});
it('should fail with bad provider', async () => {
test('should fail with bad provider', async () => {
$.register(provider((() => undefined), 'lol'));

@@ -468,3 +469,3 @@ try {

});
it('should fail with bad service in a provider', async () => {
test('should fail with bad service in a provider', async () => {
$.register(provider(() => Promise.resolve(), 'lol'));

@@ -480,3 +481,3 @@ try {

});
it('should fail with undeclared dependencies', async () => {
test('should fail with undeclared dependencies', async () => {
try {

@@ -491,3 +492,3 @@ await $.run(['lol']);

});
it('should fail with undeclared dependencies upstream', async () => {
test('should fail with undeclared dependencies upstream', async () => {
$.register(constant('ENV', ENV));

@@ -506,3 +507,3 @@ $.register(constant('time', time));

});
it('should provide a fatal error handler', async () => {
test('should provide a fatal error handler', async () => {
$.register(constant('ENV', ENV));

@@ -551,3 +552,3 @@ $.register(constant('time', time));

describe('autoload', () => {
it('should work with lacking autoloaded dependencies', async () => {
test('should work with lacking autoloaded dependencies', async () => {
const autoloaderInitializer = initializer({

@@ -578,3 +579,3 @@ type: 'service',

});
it('should work with deeper several lacking dependencies', async () => {
test('should work with deeper several lacking dependencies', async () => {
$.register(initializer({

@@ -605,3 +606,3 @@ name: '$autoload',

});
it('should work with various dependencies', async () => {
test('should work with various dependencies', async () => {
$.register(provider(hashProvider, 'hash', ['hash2']));

@@ -631,3 +632,3 @@ $.register(provider(hashProvider, 'hash3', ['?ENV']));

});
it('should instanciate services once', async () => {
test('should instanciate services once', async () => {
$.register(initializer({

@@ -658,3 +659,3 @@ name: '$autoload',

});
it('should fail when autoload does not exists', async () => {
test('should fail when autoload does not exists', async () => {
try {

@@ -668,3 +669,3 @@ await $.run(['test']);

});
it('should fail when autoloaded dependencies are not found', async () => {
test('should fail when autoloaded dependencies are not found', async () => {
$.register(initializer({

@@ -687,3 +688,3 @@ type: 'service',

});
it('should fail when autoloaded dependencies are not initializers', async () => {
test('should fail when autoloaded dependencies are not initializers', async () => {
$.register(initializer({

@@ -704,3 +705,3 @@ type: 'service',

});
it('should fail when autoloaded dependencies are not right initializers', async () => {
test('should fail when autoloaded dependencies are not right initializers', async () => {
$.register(initializer({

@@ -728,3 +729,3 @@ type: 'service',

});
it('should fail when autoload depends on existing autoloaded dependencies', async () => {
test('should fail when autoload depends on existing autoloaded dependencies', async () => {
$.register(initializer({

@@ -752,3 +753,3 @@ type: 'service',

});
it('should work when autoload depends on optional and unexisting autoloaded dependencies', async () => {
test('should work when autoload depends on optional and unexisting autoloaded dependencies', async () => {
$.register(initializer({

@@ -770,3 +771,3 @@ type: 'service',

});
it.skip('should work when autoload depends on deeper optional and unexisting autoloaded dependencies', async () => {
test.skip('should work when autoload depends on deeper optional and unexisting autoloaded dependencies', async () => {
$.register(initializer({

@@ -799,3 +800,3 @@ type: 'service',

describe('$injector', () => {
it('should work with no dependencies', async () => {
test('should work with no dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -818,3 +819,3 @@ $.register(constant('time', time));

});
it('should work with same dependencies then the running silo', async () => {
test('should work with same dependencies then the running silo', async () => {
$.register(constant('ENV', ENV));

@@ -840,3 +841,3 @@ $.register(constant('time', time));

});
it('should work with name mapping', async () => {
test('should work with name mapping', async () => {
$.register(constant('ENV', ENV));

@@ -865,3 +866,3 @@ $.register(constant('time', time));

});
it('should work with non instanciated dependencies', async () => {
test('should work with non instanciated dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -882,3 +883,3 @@ $.register(constant('time', time));

});
it('should create dependencies when not declared as singletons', async () => {
test('should create dependencies when not declared as singletons', async () => {
$.register(constant('ENV', ENV));

@@ -894,3 +895,3 @@ $.register(provider(hashProvider, 'hash', ['ENV']));

});
it('should reuse dependencies when declared as singletons', async () => {
test('should reuse dependencies when declared as singletons', async () => {
$.register(constant('ENV', ENV));

@@ -912,3 +913,3 @@ $.register(provider(hashProvider, 'hash', ['ENV'], true));

describe('destroy', () => {
it('should work even with one silo and no dependencies', async () => {
test('should work even with one silo and no dependencies', async () => {
assert.equal(typeof $.destroy, 'function');

@@ -918,3 +919,3 @@ const dependencies = await $.run(['$instance']);

});
it('should work with several silos and dependencies', async () => {
test('should work with several silos and dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -933,3 +934,3 @@ $.register(constant('time', time));

});
it('should work when trigered from several silos simultaneously', async () => {
test('should work when trigered from several silos simultaneously', async () => {
$.register(constant('ENV', ENV));

@@ -953,3 +954,3 @@ $.register(constant('time', time));

});
it('should work when a silo shutdown is in progress', async () => {
test('should work when a silo shutdown is in progress', async () => {
$.register(constant('ENV', ENV));

@@ -976,3 +977,3 @@ $.register(constant('time', time));

});
it('should disallow new runs', async () => {
test('should disallow new runs', async () => {
$.register(constant('ENV', ENV));

@@ -995,3 +996,3 @@ $.register(constant('time', time));

describe('$dispose', () => {
it('should work with no dependencies', async () => {
test('should work with no dependencies', async () => {
const dependencies = await $.run(['$dispose']);

@@ -1001,3 +1002,3 @@ assert.equal(typeof dependencies.$dispose, 'function');

});
it('should work with constant dependencies', async () => {
test('should work with constant dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -1013,3 +1014,3 @@ $.register(constant('time', time));

});
it('should work with simple dependencies', async () => {
test('should work with simple dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -1026,3 +1027,3 @@ $.register(constant('time', time));

});
it('should work with deeper dependencies', async () => {
test('should work with deeper dependencies', async () => {
let shutdownCallResolve;

@@ -1073,3 +1074,3 @@ let shutdownResolve;

});
it('should work with deeper multi used dependencies', async () => {
test('should work with deeper multi used dependencies', async () => {
let shutdownCallResolve;

@@ -1116,3 +1117,3 @@ let shutdownResolve;

});
it('should delay service shutdown to their deeper dependencies', async () => {
test('should delay service shutdown to their deeper dependencies', async () => {
const servicesShutdownCalls = sinon.spy(() => Promise.resolve());

@@ -1143,3 +1144,3 @@ $.register(provider(() => Promise.resolve({

});
it('should not shutdown singleton dependencies if used elsewhere', async () => {
test('should not shutdown singleton dependencies if used elsewhere', async () => {
$.register(constant('ENV', ENV));

@@ -1162,3 +1163,3 @@ $.register(constant('time', time));

});
it('should shutdown singleton dependencies if not used elsewhere', async () => {
test('should shutdown singleton dependencies if not used elsewhere', async () => {
$.register(constant('ENV', ENV));

@@ -1178,3 +1179,3 @@ $.register(constant('time', time));

describe('toMermaidGraph', () => {
it('should print nothing when no dependency', () => {
test('should print nothing when no dependency', () => {
$.register(constant('ENV', ENV));

@@ -1184,3 +1185,3 @@ $.register(constant('time', time));

});
it('should print a dependency graph', () => {
test('should print a dependency graph', () => {
$.register(constant('ENV', ENV));

@@ -1202,3 +1203,3 @@ $.register(constant('time', time));

});
it('should allow custom shapes', () => {
test('should allow custom shapes', () => {
$.register(constant('ENV', ENV));

@@ -1235,3 +1236,3 @@ $.register(constant('time', time));

});
it('should allow custom styles', () => {
test('should allow custom styles', () => {
$.register(constant('ENV', ENV));

@@ -1238,0 +1239,0 @@ $.register(constant('time', time));

@@ -0,5 +1,6 @@

import { describe, test } from '@jest/globals';
import assert from 'assert';
import { buildInitializationSequence } from './sequence.js';
describe('buildInitializationSequence()', () => {
it('should work with one level trees', () => {
test('should work with one level trees', () => {
const tree = {

@@ -10,3 +11,3 @@ __name: 'lol',

});
it('should work with multi-level trees', () => {
test('should work with multi-level trees', () => {
const tree = {

@@ -64,3 +65,3 @@ __name: 'lol',

});
it('should work with multi-level trees and cross dependencies', () => {
test('should work with multi-level trees and cross dependencies', () => {
const tree = {

@@ -67,0 +68,0 @@ __name: 'lol',

@@ -100,4 +100,4 @@ export declare const DECLARATION_SEPARATOR = ">";

*/
export declare function reuseSpecialProps<FD, TD, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ProviderInitializerBuilder<TD, S>, amend?: Partial<ProviderProperties>): ProviderInitializerBuilder<FD & TD, S>;
export declare function reuseSpecialProps<FD, TD, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ServiceInitializerBuilder<TD, S>, amend?: Partial<ServiceProperties>): ServiceInitializerBuilder<FD & TD, S>;
export declare function reuseSpecialProps<FD extends Dependencies<any>, TD extends Dependencies<any>, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ProviderInitializerBuilder<TD, S>, amend?: Partial<ProviderProperties>): ProviderInitializerBuilder<FD & TD, S>;
export declare function reuseSpecialProps<FD extends Dependencies<any>, TD extends Dependencies<any>, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ServiceInitializerBuilder<TD, S>, amend?: Partial<ServiceProperties>): ServiceInitializerBuilder<FD & TD, S>;
/**

@@ -157,3 +157,3 @@ * Decorator that creates an initializer for a constant value

*/
export declare function service<D, S>(serviceBuilder: ServiceInitializerBuilder<D, S>, name?: DependencyName, dependencies?: DependencyDeclaration[], singleton?: boolean, extra?: ExtraInformations): ServiceInitializer<D, S>;
export declare function service<D extends Dependencies<any>, S>(serviceBuilder: ServiceInitializerBuilder<D, S>, name?: DependencyName, dependencies?: DependencyDeclaration[], singleton?: boolean, extra?: ExtraInformations): ServiceInitializer<D, S>;
/**

@@ -168,3 +168,3 @@ * Decorator that creates an initializer from a service

*/
export declare function autoService<D, S>(serviceBuilder: ServiceInitializerBuilder<D, S>): ServiceInitializer<D, S>;
export declare function autoService<D extends Dependencies<any>, S>(serviceBuilder: ServiceInitializerBuilder<D, S>): ServiceInitializer<D, S>;
/**

@@ -218,3 +218,3 @@ * Decorator that creates an initializer for a provider

*/
export declare function provider<D, S>(providerBuilder: ProviderInitializerBuilder<D, S>, name?: DependencyName, dependencies?: DependencyDeclaration[], singleton?: boolean, extra?: ExtraInformations): ProviderInitializer<D, S>;
export declare function provider<D extends Dependencies<any>, S>(providerBuilder: ProviderInitializerBuilder<D, S>, name?: DependencyName, dependencies?: DependencyDeclaration[], singleton?: boolean, extra?: ExtraInformations): ProviderInitializer<D, S>;
/**

@@ -229,3 +229,3 @@ * Decorator that creates an initializer from a provider

*/
export declare function autoProvider<D, S>(providerBuilder: ProviderInitializerBuilder<D, S>): ProviderInitializer<D, S>;
export declare function autoProvider<D extends Dependencies<any>, S>(providerBuilder: ProviderInitializerBuilder<D, S>): ProviderInitializer<D, S>;
/**

@@ -241,4 +241,4 @@ * Allows to wrap an initializer to add extra initialization steps

*/
export declare function wrapInitializer<D, S>(wrapper: ProviderInitializerWrapper<S, D>, baseInitializer: ProviderInitializer<D, S>): ProviderInitializer<D, S>;
export declare function wrapInitializer<D, S>(wrapper: ServiceInitializerWrapper<S, D>, baseInitializer: ServiceInitializer<D, S>): ServiceInitializer<D, S>;
export declare function wrapInitializer<D extends Dependencies<any>, S>(wrapper: ProviderInitializerWrapper<S, D>, baseInitializer: ProviderInitializer<D, S>): ProviderInitializer<D, S>;
export declare function wrapInitializer<D extends Dependencies<any>, S>(wrapper: ServiceInitializerWrapper<S, D>, baseInitializer: ServiceInitializer<D, S>): ServiceInitializer<D, S>;
/**

@@ -269,6 +269,6 @@ * Decorator creating a new initializer with different

*/
export declare function inject<D, S>(dependencies: DependencyDeclaration[], initializer: ProviderInitializer<any, S>): ProviderInitializer<D, S>;
export declare function inject<D, S>(dependencies: DependencyDeclaration[], initializer: ProviderInitializerBuilder<any, S>): ProviderInitializerBuilder<D, S>;
export declare function inject<D, S>(dependencies: DependencyDeclaration[], initializer: ServiceInitializer<any, S>): ServiceInitializer<D, S>;
export declare function inject<D, S>(dependencies: DependencyDeclaration[], initializer: ServiceInitializerBuilder<any, S>): ServiceInitializerBuilder<D, S>;
export declare function inject<D extends Dependencies<any>, S>(dependencies: DependencyDeclaration[], initializer: ProviderInitializer<any, S>): ProviderInitializer<D, S>;
export declare function inject<D extends Dependencies<any>, S>(dependencies: DependencyDeclaration[], initializer: ProviderInitializerBuilder<any, S>): ProviderInitializerBuilder<D, S>;
export declare function inject<D extends Dependencies<any>, S>(dependencies: DependencyDeclaration[], initializer: ServiceInitializer<any, S>): ServiceInitializer<D, S>;
export declare function inject<D extends Dependencies<any>, S>(dependencies: DependencyDeclaration[], initializer: ServiceInitializerBuilder<any, S>): ServiceInitializerBuilder<D, S>;
/**

@@ -280,6 +280,6 @@ * Apply injected dependencies from the given initializer to another one

*/
export declare function useInject<FD, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ProviderInitializer<Dependencies, S>): ProviderInitializer<FD, S>;
export declare function useInject<FD, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ProviderInitializerBuilder<Dependencies, S>): ProviderInitializerBuilder<FD, S>;
export declare function useInject<FD, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ServiceInitializer<Dependencies, S>): ServiceInitializer<FD, S>;
export declare function useInject<FD, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ServiceInitializerBuilder<Dependencies, S>): ServiceInitializerBuilder<FD, S>;
export declare function useInject<FD extends Dependencies<any>, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ProviderInitializer<Dependencies, S>): ProviderInitializer<FD, S>;
export declare function useInject<FD extends Dependencies<any>, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ProviderInitializerBuilder<Dependencies, S>): ProviderInitializerBuilder<FD, S>;
export declare function useInject<FD extends Dependencies<any>, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ServiceInitializer<Dependencies, S>): ServiceInitializer<FD, S>;
export declare function useInject<FD extends Dependencies<any>, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ServiceInitializerBuilder<Dependencies, S>): ServiceInitializerBuilder<FD, S>;
/**

@@ -291,6 +291,6 @@ * Merge injected dependencies of the given initializer with another one

*/
export declare function mergeInject<FD, D, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ProviderInitializer<D, S>): ProviderInitializer<FD & D, S>;
export declare function mergeInject<FD, D, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ProviderInitializerBuilder<D, S>): ProviderInitializerBuilder<FD & D, S>;
export declare function mergeInject<FD, D, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ServiceInitializer<D, S>): ServiceInitializer<FD, S>;
export declare function mergeInject<FD, D, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ServiceInitializerBuilder<D, S>): ServiceInitializerBuilder<FD, S>;
export declare function mergeInject<FD extends Dependencies<any>, D extends Dependencies<any>, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ProviderInitializer<D, S>): ProviderInitializer<FD & D, S>;
export declare function mergeInject<FD extends Dependencies<any>, D extends Dependencies<any>, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ProviderInitializerBuilder<D, S>): ProviderInitializerBuilder<FD & D, S>;
export declare function mergeInject<FD extends Dependencies<any>, D extends Dependencies<any>, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ServiceInitializer<D, S>): ServiceInitializer<FD, S>;
export declare function mergeInject<FD extends Dependencies<any>, D extends Dependencies<any>, S>(from: AsyncInitializerBuilder<FD, unknown> | PartialAsyncInitializer<FD, unknown>, to: ServiceInitializerBuilder<D, S>): ServiceInitializerBuilder<FD, S>;
/**

@@ -321,6 +321,6 @@ * Decorator creating a new initializer with different

*/
export declare function autoInject<D, S>(initializer: ProviderInitializer<D, S>): ProviderInitializer<D, S>;
export declare function autoInject<D, S>(initializer: ProviderInitializerBuilder<D, S>): ProviderInitializerBuilder<D, S>;
export declare function autoInject<D, S>(initializer: ServiceInitializer<D, S>): ServiceInitializer<D, S>;
export declare function autoInject<D, S>(initializer: ServiceInitializerBuilder<D, S>): ServiceInitializerBuilder<D, S>;
export declare function autoInject<D extends Dependencies<any>, S>(initializer: ProviderInitializer<D, S>): ProviderInitializer<D, S>;
export declare function autoInject<D extends Dependencies<any>, S>(initializer: ProviderInitializerBuilder<D, S>): ProviderInitializerBuilder<D, S>;
export declare function autoInject<D extends Dependencies<any>, S>(initializer: ServiceInitializer<D, S>): ServiceInitializer<D, S>;
export declare function autoInject<D extends Dependencies<any>, S>(initializer: ServiceInitializerBuilder<D, S>): ServiceInitializerBuilder<D, S>;
/**

@@ -346,6 +346,6 @@ * Decorator creating a new initializer with some

*/
export declare function alsoInject<ND, D, S>(dependencies: DependencyDeclaration[], to: ProviderInitializer<D, S>): ProviderInitializer<ND & D, S>;
export declare function alsoInject<ND, D, S>(dependencies: DependencyDeclaration[], to: ProviderInitializerBuilder<D, S>): ProviderInitializerBuilder<ND & D, S>;
export declare function alsoInject<ND, D, S>(dependencies: DependencyDeclaration[], to: ServiceInitializer<D, S>): ServiceInitializer<ND & D, S>;
export declare function alsoInject<ND, D, S>(dependencies: DependencyDeclaration[], to: ServiceInitializerBuilder<D, S>): ServiceInitializerBuilder<ND & D, S>;
export declare function alsoInject<ND extends Dependencies<any>, D extends Dependencies<any>, S>(dependencies: DependencyDeclaration[], to: ProviderInitializer<D, S>): ProviderInitializer<ND & D, S>;
export declare function alsoInject<ND extends Dependencies<any>, D extends Dependencies<any>, S>(dependencies: DependencyDeclaration[], to: ProviderInitializerBuilder<D, S>): ProviderInitializerBuilder<ND & D, S>;
export declare function alsoInject<ND extends Dependencies<any>, D extends Dependencies<any>, S>(dependencies: DependencyDeclaration[], to: ServiceInitializer<D, S>): ServiceInitializer<ND & D, S>;
export declare function alsoInject<ND extends Dependencies<any>, D extends Dependencies<any>, S>(dependencies: DependencyDeclaration[], to: ServiceInitializerBuilder<D, S>): ServiceInitializerBuilder<ND & D, S>;
/**

@@ -377,6 +377,6 @@ * Decorator creating a new initializer with some

*/
export declare function extra<D, S>(extraInformations: ExtraInformations, initializer: ProviderInitializer<D, S>, merge?: boolean): ProviderInitializer<D, S>;
export declare function extra<D, S>(extraInformations: ExtraInformations, initializer: ProviderInitializerBuilder<D, S>, merge?: boolean): ProviderInitializerBuilder<D, S>;
export declare function extra<D, S>(extraInformations: ExtraInformations, initializer: ServiceInitializer<D, S>): ServiceInitializer<D, S>;
export declare function extra<D, S>(extraInformations: ExtraInformations, initializer: ServiceInitializerBuilder<D, S>): ServiceInitializerBuilder<D, S>;
export declare function extra<D extends Dependencies<any>, S>(extraInformations: ExtraInformations, initializer: ProviderInitializer<D, S>, merge?: boolean): ProviderInitializer<D, S>;
export declare function extra<D extends Dependencies<any>, S>(extraInformations: ExtraInformations, initializer: ProviderInitializerBuilder<D, S>, merge?: boolean): ProviderInitializerBuilder<D, S>;
export declare function extra<D extends Dependencies<any>, S>(extraInformations: ExtraInformations, initializer: ServiceInitializer<D, S>): ServiceInitializer<D, S>;
export declare function extra<D extends Dependencies<any>, S>(extraInformations: ExtraInformations, initializer: ServiceInitializerBuilder<D, S>): ServiceInitializerBuilder<D, S>;
/**

@@ -404,6 +404,6 @@ * Decorator to set an initializer singleton option.

*/
export declare function singleton<D, S>(initializer: ProviderInitializer<D, S>, isSingleton?: boolean): ProviderInitializer<D, S>;
export declare function singleton<D, S>(initializer: ProviderInitializerBuilder<D, S>, isSingleton?: boolean): ProviderInitializerBuilder<D, S>;
export declare function singleton<D, S>(initializer: ServiceInitializer<D, S>, isSingleton?: boolean): ServiceInitializer<D, S>;
export declare function singleton<D, S>(initializer: ServiceInitializerBuilder<D, S>, isSingleton?: boolean): ServiceInitializerBuilder<D, S>;
export declare function singleton<D extends Dependencies<any>, S>(initializer: ProviderInitializer<D, S>, isSingleton?: boolean): ProviderInitializer<D, S>;
export declare function singleton<D extends Dependencies<any>, S>(initializer: ProviderInitializerBuilder<D, S>, isSingleton?: boolean): ProviderInitializerBuilder<D, S>;
export declare function singleton<D extends Dependencies<any>, S>(initializer: ServiceInitializer<D, S>, isSingleton?: boolean): ServiceInitializer<D, S>;
export declare function singleton<D extends Dependencies<any>, S>(initializer: ServiceInitializerBuilder<D, S>, isSingleton?: boolean): ServiceInitializerBuilder<D, S>;
/**

@@ -425,6 +425,6 @@ * Decorator to set an initializer name.

*/
export declare function name<D, S>(name: DependencyName, initializer: ProviderInitializer<D, S>): ProviderInitializer<D, S>;
export declare function name<D, S>(name: DependencyName, initializer: ProviderInitializerBuilder<D, S>): ProviderInitializerBuilder<D, S>;
export declare function name<D, S>(name: DependencyName, initializer: ServiceInitializer<D, S>): ServiceInitializer<D, S>;
export declare function name<D, S>(name: DependencyName, initializer: ServiceInitializerBuilder<D, S>): ServiceInitializerBuilder<D, S>;
export declare function name<D extends Dependencies<any>, S>(name: DependencyName, initializer: ProviderInitializer<D, S>): ProviderInitializer<D, S>;
export declare function name<D extends Dependencies<any>, S>(name: DependencyName, initializer: ProviderInitializerBuilder<D, S>): ProviderInitializerBuilder<D, S>;
export declare function name<D extends Dependencies<any>, S>(name: DependencyName, initializer: ServiceInitializer<D, S>): ServiceInitializer<D, S>;
export declare function name<D extends Dependencies<any>, S>(name: DependencyName, initializer: ServiceInitializerBuilder<D, S>): ServiceInitializerBuilder<D, S>;
/**

@@ -443,6 +443,6 @@ * Decorator to set an initializer name from its function name.

*/
export declare function autoName<D, S>(initializer: ProviderInitializer<D, S>): ProviderInitializer<D, S>;
export declare function autoName<D, S>(initializer: ProviderInitializerBuilder<D, S>): ProviderInitializerBuilder<D, S>;
export declare function autoName<D, S>(initializer: ServiceInitializer<D, S>): ServiceInitializer<D, S>;
export declare function autoName<D, S>(initializer: ServiceInitializerBuilder<D, S>): ServiceInitializerBuilder<D, S>;
export declare function autoName<D extends Dependencies<any>, S>(initializer: ProviderInitializer<D, S>): ProviderInitializer<D, S>;
export declare function autoName<D extends Dependencies<any>, S>(initializer: ProviderInitializerBuilder<D, S>): ProviderInitializerBuilder<D, S>;
export declare function autoName<D extends Dependencies<any>, S>(initializer: ServiceInitializer<D, S>): ServiceInitializer<D, S>;
export declare function autoName<D extends Dependencies<any>, S>(initializer: ServiceInitializerBuilder<D, S>): ServiceInitializerBuilder<D, S>;
/**

@@ -470,6 +470,6 @@ * Decorator to set an initializer type.

*/
export declare function type<D, S>(type: 'provider', initializer: ProviderInitializer<D, S>): ProviderInitializer<D, S>;
export declare function type<D, S>(type: 'provider', initializer: ProviderInitializerBuilder<D, S>): ProviderInitializerBuilder<D, S>;
export declare function type<D, S>(type: 'service', initializer: ServiceInitializer<D, S>): ServiceInitializer<D, S>;
export declare function type<D, S>(type: 'service', initializer: ServiceInitializerBuilder<D, S>): ServiceInitializerBuilder<D, S>;
export declare function type<D extends Dependencies<any>, S>(type: 'provider', initializer: ProviderInitializer<D, S>): ProviderInitializer<D, S>;
export declare function type<D extends Dependencies<any>, S>(type: 'provider', initializer: ProviderInitializerBuilder<D, S>): ProviderInitializerBuilder<D, S>;
export declare function type<D extends Dependencies<any>, S>(type: 'service', initializer: ServiceInitializer<D, S>): ServiceInitializer<D, S>;
export declare function type<D extends Dependencies<any>, S>(type: 'service', initializer: ServiceInitializerBuilder<D, S>): ServiceInitializerBuilder<D, S>;
/**

@@ -496,4 +496,4 @@ * Decorator to set an initializer properties.

*/
export declare function initializer<D, S>(properties: ProviderInputProperties, initializer: ProviderInitializerBuilder<D, S>): ProviderInitializer<D, S>;
export declare function initializer<D, S>(properties: ServiceInputProperties, initializer: ServiceInitializerBuilder<D, S>): ServiceInitializer<D, S>;
export declare function initializer<D extends Dependencies<any>, S>(properties: ProviderInputProperties, initializer: ProviderInitializerBuilder<D, S>): ProviderInitializer<D, S>;
export declare function initializer<D extends Dependencies<any>, S>(properties: ServiceInputProperties, initializer: ServiceInitializerBuilder<D, S>): ServiceInitializer<D, S>;
/**

@@ -585,5 +585,5 @@ * Shortcut to create an initializer with a simple handler

*/
export declare function unwrapInitializerProperties<S, D>(initializer: ProviderInitializer<D, S>): ProviderProperties;
export declare function unwrapInitializerProperties<S, D>(initializer: ServiceInitializer<D, S>): ServiceProperties;
export declare function unwrapInitializerProperties<S, D>(initializer: ConstantInitializer<S>): ConstantProperties;
export declare function unwrapInitializerProperties<S, D>(initializer: Initializer<S, D>): InitializerProperties;
export declare function unwrapInitializerProperties<S, D extends Dependencies<any>>(initializer: ProviderInitializer<D, S>): ProviderProperties;
export declare function unwrapInitializerProperties<S, D extends Dependencies<any>>(initializer: ServiceInitializer<D, S>): ServiceProperties;
export declare function unwrapInitializerProperties<S, D extends Dependencies<any>>(initializer: ConstantInitializer<S>): ConstantProperties;
export declare function unwrapInitializerProperties<S, D extends Dependencies<any>>(initializer: Initializer<S, D>): InitializerProperties;

@@ -0,1 +1,2 @@

import { describe, test } from '@jest/globals';
import assert from 'assert';

@@ -13,3 +14,3 @@ import sinon from 'sinon';

describe('reuseSpecialProps', () => {
it('should work', () => {
test('should work', () => {
// We can safely ignore coverage here since the

@@ -53,3 +54,3 @@ // function are here just as placeholders

describe('wrapInitializer', () => {
it('should work with a service initializer', async () => {
test('should work with a service initializer', async () => {
async function baseServiceInitializer() {

@@ -70,3 +71,3 @@ return () => 'test';

});
it('should work with a provider initialzer', async () => {
test('should work with a provider initialzer', async () => {
async function baseInitializer() {

@@ -90,3 +91,3 @@ return { service: () => 'test' };

describe('inject', () => {
it('should allow to decorate an initializer with dependencies', () => {
test('should allow to decorate an initializer with dependencies', () => {
const dependencies = ['ENV'];

@@ -98,3 +99,3 @@ const newInitializer = inject(dependencies, provider(aProviderInitializer, 'aProvider'));

});
it('should allow to decorate an initializer builder with dependencies', () => {
test('should allow to decorate an initializer builder with dependencies', () => {
const dependencies = ['ENV'];

@@ -106,3 +107,3 @@ const newInitializer = inject(dependencies, aProviderInitializer);

});
it('should allow to decorate an initializer with dependencies', () => {
test('should allow to decorate an initializer with dependencies', () => {
const dependencies = ['ENV'];

@@ -114,3 +115,3 @@ const newInitializer = inject(dependencies, service(aServiceInitializer, 'aService'));

});
it('should allow to decorate an initializer builder with dependencies', () => {
test('should allow to decorate an initializer builder with dependencies', () => {
const dependencies = ['ENV'];

@@ -122,3 +123,3 @@ const newInitializer = inject(dependencies, aServiceInitializer);

});
it('should allow to decorate an initializer with mapped dependencies', () => {
test('should allow to decorate an initializer with mapped dependencies', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -130,3 +131,3 @@ const newInitializer = inject(dependencies, aProviderInitializer);

});
it('should fail with a constant', () => {
test('should fail with a constant', () => {
assert.throws(() => {

@@ -138,3 +139,3 @@ inject(['test'], constant('test', 'test'));

describe('useInject', () => {
it('should set the right dependencies', () => {
test('should set the right dependencies', () => {
const fromDependencies = ['ENV', 'CORS'];

@@ -154,3 +155,3 @@ const fromInitializer = inject(fromDependencies, aProviderInitializer);

describe('mergeInject', () => {
it('should amend dependencies', () => {
test('should amend dependencies', () => {
const fromDependencies = ['ENV', 'CORS'];

@@ -171,3 +172,3 @@ const fromInitializer = inject(fromDependencies, aProviderInitializer);

describe('autoInject', () => {
it('should allow to decorate an initializer with dependencies', () => {
test('should allow to decorate an initializer with dependencies', () => {
const baseProvider = async ({ ENV, mysql: db }) => async () => ({

@@ -183,3 +184,3 @@ ENV,

});
it('should allow to decorate an initializer with a function name', () => {
test('should allow to decorate an initializer with a function name', () => {
async function baseProvider({ ENV, mysql: db }) {

@@ -197,3 +198,3 @@ async () => ({

});
it('should allow to decorate an initializer with optional dependencies', () => {
test('should allow to decorate an initializer with optional dependencies', () => {
const noop = () => undefined;

@@ -211,3 +212,3 @@ const baseProvider = async ({ ENV, log = noop, debug: aDebug = noop }) => async () => ({

});
it('should allow to decorate an initializer with several arguments', () => {
test('should allow to decorate an initializer with several arguments', () => {
const noop = () => undefined;

@@ -225,3 +226,3 @@ const baseProvider = async ({ ENV, log = noop, debug: aDebug = noop }) => async () => ({

});
it('should allow to decorate an initializer with complex arguments', () => {
test('should allow to decorate an initializer with complex arguments', () => {
const noop = () => undefined;

@@ -239,3 +240,3 @@ const baseProvider = async ({ ENV, log = noop, debug: aDebug = noop }) => async () => ({

});
it('should fail with non async initializers', () => {
test('should fail with non async initializers', () => {
assert.throws(() => {

@@ -247,3 +248,3 @@ autoInject((({ foo: bar = { bar: 'foo' } }) => {

});
it('should fail with too complex injections', () => {
test('should fail with too complex injections', () => {
assert.throws(() => {

@@ -255,3 +256,3 @@ autoInject(async ({ foo: bar = { bar: 'foo' } }) => {

});
it('should fail with no injections', () => {
test('should fail with no injections', () => {
assert.throws(() => {

@@ -263,3 +264,3 @@ autoInject(async () => undefined);

describe('alsoInject', () => {
it('should allow to decorate an initializer with dependencies', () => {
test('should allow to decorate an initializer with dependencies', () => {
const newInitializer = alsoInject(['ENV'], inject(['TEST'], aProviderInitializer));

@@ -269,3 +270,3 @@ assert.notEqual(newInitializer, aProviderInitializer);

});
it('should allow to decorate an initializer with dependencies', () => {
test('should allow to decorate an initializer with dependencies', () => {
const newInitializer = alsoInject(['ENV'], aProviderInitializer);

@@ -275,3 +276,3 @@ assert.notEqual(newInitializer, aProviderInitializer);

});
it('should dedupe dependencies', () => {
test('should dedupe dependencies', () => {
const baseProvider = inject(['?TEST'], aProviderInitializer);

@@ -289,3 +290,3 @@ const newInitializer = alsoInject(['ENV', '?NODE_ENV', '?TEST', 'TEST2', 'db>mysql'], alsoInject(['ENV', 'NODE_ENV', '?TEST', '?TEST2', 'mysql'], baseProvider));

});
it('should preserve single optional dependencies', () => {
test('should preserve single optional dependencies', () => {
const baseProvider = inject(['ENV', '?TEST'], aProviderInitializer);

@@ -301,3 +302,3 @@ const newInitializer = alsoInject(['ENV', '?TEST2'], alsoInject(['ENV', '?TEST3'], baseProvider));

});
it('should preserve mapped dependencies', () => {
test('should preserve mapped dependencies', () => {
const baseProvider = inject(['mysql', '?sftp'], aProviderInitializer);

@@ -313,3 +314,3 @@ const newInitializer = alsoInject(['db>mysql', '?ftp>sftp'], baseProvider);

});
it('should solve dependencies alias name clash', () => {
test('should solve dependencies alias name clash', () => {
const baseProvider = inject(['?TEST'], aProviderInitializer);

@@ -326,3 +327,3 @@ const newInitializer = alsoInject(['ENV', '?NODE_ENV', '?TEST', 'db>mysql', '?log>logly'], alsoInject(['ENV', 'NODE_ENV', '?TEST', 'db>pg', '?log>logger'], baseProvider));

});
it('should solve dependencies alias name clash', () => {
test('should solve dependencies alias name clash', () => {
const baseProvider = inject(['?TEST'], aProviderInitializer);

@@ -341,3 +342,3 @@ const newInitializer = alsoInject(['ENV', '?NODE_ENV', '?TEST', 'db>mysql', '?log>logly'], alsoInject(['ENV', 'NODE_ENV', '?TEST', 'db>pg', '?log>logger'], baseProvider));

describe('parseInjections', () => {
it('should work with TypeScript dependencies', () => {
test('should work with TypeScript dependencies', () => {
assert.deepEqual(parseInjections(`async function initNexmo({

@@ -353,3 +354,3 @@ ENV,

});
it('should allow to decorate an initializer with dependencies', () => {
test('should allow to decorate an initializer with dependencies', () => {
const newInitializer = alsoInject(['ENV'], aProviderInitializer);

@@ -361,3 +362,3 @@ assert.notEqual(newInitializer, aProviderInitializer);

describe('singleton', () => {
it('should allow to decorate an initializer with singleton option', () => {
test('should allow to decorate an initializer with singleton option', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -370,3 +371,3 @@ const newInitializer = inject(dependencies, singleton(aProviderInitializer, true));

});
it('should allow to be used several times', () => {
test('should allow to be used several times', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -381,3 +382,3 @@ const newInitializer = inject(dependencies, singleton(singleton(aProviderInitializer), false));

describe('name', () => {
it('should allow to decorate an initializer with a name', () => {
test('should allow to decorate an initializer with a name', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -393,3 +394,3 @@ const baseName = 'hash';

describe('autoName', () => {
it('should allow to decorate an initializer with its function name', () => {
test('should allow to decorate an initializer with its function name', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -405,3 +406,3 @@ const baseName = 'hash';

});
it('should allow to decorate an initializer with its init like function name', () => {
test('should allow to decorate an initializer with its init like function name', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -417,3 +418,3 @@ const baseName = 'hash';

});
it('should allow to decorate an initializer with its initialize like function name', () => {
test('should allow to decorate an initializer with its initialize like function name', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -429,3 +430,3 @@ const baseName = 'hash';

});
it('should allow to decorate a bounded initializer', () => {
test('should allow to decorate a bounded initializer', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -442,3 +443,3 @@ const baseName = 'hash';

});
it('should fail with anonymous functions', () => {
test('should fail with anonymous functions', () => {
assert.throws(() => {

@@ -450,3 +451,3 @@ autoName(async () => undefined);

describe('extra', () => {
it('should allow to decorate an initializer with extra infos', () => {
test('should allow to decorate an initializer with extra infos', () => {
const extraInformations = { httpHandler: true };

@@ -458,3 +459,3 @@ const newInitializer = extra(extraInformations, aProviderInitializer);

});
it('should allow to decorate an initializer with extra infos', () => {
test('should allow to decorate an initializer with extra infos', () => {
const extraInformations = { httpHandler: true };

@@ -466,3 +467,3 @@ const newInitializer = extra(extraInformations, aProviderInitializer, true);

});
it('should allow to decorate an initializer with additional extra infos', () => {
test('should allow to decorate an initializer with additional extra infos', () => {
const baseExtraInformations = { yolo: true, httpHandler: false };

@@ -481,3 +482,3 @@ const additionalExtraInformations = { httpHandler: true };

describe('type', () => {
it('should allow to decorate an initializer with a type', () => {
test('should allow to decorate an initializer with a type', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -495,3 +496,3 @@ const baseName = 'hash';

describe('initializer', () => {
it('should allow to decorate an initializer with every properties', () => {
test('should allow to decorate an initializer with every properties', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -513,3 +514,3 @@ const baseName = 'hash';

});
it('should fail with bad properties', () => {
test('should fail with bad properties', () => {
assert.throws(() => {

@@ -524,3 +525,3 @@ initializer({

describe('constant', () => {
it('should allow to create an initializer from a constant', async () => {
test('should allow to create an initializer from a constant', async () => {
const baseName = 'THE_VALUE';

@@ -533,3 +534,3 @@ const baseValue = 42;

});
it('should fail with dependencies since it makes no sense', () => {
test('should fail with dependencies since it makes no sense', () => {
assert.throws(() => {

@@ -541,3 +542,3 @@ constant('time', inject(['hash3'], async () => undefined));

describe('service', () => {
it('should allow to create an initializer from a service builder', async () => {
test('should allow to create an initializer from a service builder', async () => {
const aServiceBuilder = async (_services) => 'A_SERVICE';

@@ -557,3 +558,3 @@ const dependencies = ['ANOTHER_ENV>ENV'];

});
it('should allow to create an initializer from a generic service builder', async () => {
test('should allow to create an initializer from a generic service builder', async () => {
const aServiceBuilder = async (_services) => '';

@@ -573,3 +574,3 @@ const dependencies = ['ANOTHER_ENV>ENV'];

});
it('should fail with no service builder', () => {
test('should fail with no service builder', () => {
assert.throws(() => {

@@ -581,3 +582,3 @@ service(undefined);

describe('autoService', () => {
it('should detect the service details', () => {
test('should detect the service details', () => {
const baseServiceBuilder = async function initializeMySQL({ ENV }) {

@@ -592,3 +593,3 @@ return ENV;

});
it('should detect the service details even with no dependencies', () => {
test('should detect the service details even with no dependencies', () => {
const baseServiceBuilder = async function initializeMySQL() {

@@ -605,3 +606,3 @@ return;

describe('provider', () => {
it('should allow to create an initializer from a provider builder', async () => {
test('should allow to create an initializer from a provider builder', async () => {
const aProviderInitializerBuilder = async () => ({ service: 'A_SERVICE' });

@@ -621,3 +622,3 @@ const dependencies = ['ANOTHER_ENV>ENV'];

});
it('should allow to create an initializer from a provider builder', async () => {
test('should allow to create an initializer from a provider builder', async () => {
const aServiceBuilder = async (_services) => ({

@@ -639,3 +640,3 @@ service: 'A_SERVICE',

});
it('should fail with no provider builder', () => {
test('should fail with no provider builder', () => {
assert.throws(() => {

@@ -647,3 +648,3 @@ provider(undefined);

describe('autoProvider', () => {
it('should detect the provider details', () => {
test('should detect the provider details', () => {
const baseInitializer = async function initializeMySQL({ ENV, }) {

@@ -658,3 +659,3 @@ return { service: ENV };

});
it('should detect the provider details even with no dependencies', () => {
test('should detect the provider details even with no dependencies', () => {
const baseInitializer = async function initializeMySQL() {

@@ -671,3 +672,3 @@ return { service: 'A_SERVICE' };

describe('handler', () => {
it('should work', async () => {
test('should work', async () => {
const baseName = 'sampleHandler';

@@ -692,3 +693,3 @@ const injectedServices = ['kikooo', 'lol'];

});
it('should fail with no name', () => {
test('should fail with no name', () => {
assert.throws(() => {

@@ -700,3 +701,3 @@ handler(async () => undefined);

describe('autoHandler', () => {
it('should work', async () => {
test('should work', async () => {
const services = {

@@ -719,3 +720,3 @@ kikooo: 'kikooo',

});
it('should work with spread services', async () => {
test('should work with spread services', async () => {
const services = {

@@ -738,3 +739,3 @@ kikooo: 'kikooo',

});
it('should fail for anonymous functions', () => {
test('should fail for anonymous functions', () => {
assert.throws(() => {

@@ -746,3 +747,3 @@ autoHandler(async () => undefined);

describe('parseDependencyDeclaration', () => {
it('should work', () => {
test('should work', () => {
assert.deepEqual(parseDependencyDeclaration('db>pgsql'), {

@@ -754,3 +755,3 @@ serviceName: 'db',

});
it('should work with unmapped names', () => {
test('should work with unmapped names', () => {
assert.deepEqual(parseDependencyDeclaration('?pgsql'), {

@@ -757,0 +758,0 @@ serviceName: 'pgsql',

{
"name": "knifecycle",
"version": "14.0.0",
"version": "14.1.0",
"description": "Manage your NodeJS processes's lifecycle automatically with an unobtrusive dependency injection implementation.",

@@ -80,24 +80,22 @@ "main": "dist/index.js",

"devDependencies": {
"@types/jest": "^28.1.1",
"@typescript-eslint/eslint-plugin": "^5.27.0",
"@typescript-eslint/parser": "^5.27.0",
"commitizen": "^4.2.4",
"@typescript-eslint/eslint-plugin": "^5.36.0",
"@typescript-eslint/parser": "^5.36.0",
"commitizen": "^4.2.5",
"conventional-changelog-cli": "^2.2.2",
"coveralls": "^3.1.1",
"cz-conventional-changelog": "^3.3.0",
"esbuild": "^0.14.43",
"esbuild": "^0.15.6",
"esbuild-jest": "^0.5.0",
"eslint": "^8.17.0",
"eslint": "^8.23.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^28.1.0",
"jsarch": "^5.0.1",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.0.1",
"jsarch": "^5.0.2",
"jsdoc-to-markdown": "^7.1.1",
"metapak": "^4.0.4",
"metapak-nfroidure": "12.0.6",
"mocha": "8.2.1",
"prettier": "^2.6.2",
"metapak-nfroidure": "^12.2.0",
"prettier": "^2.7.1",
"rimraf": "^3.0.2",
"sinon": "^14.0.0",
"typescript": "^4.7.3"
"typescript": "^4.8.2"
},

@@ -104,0 +102,0 @@ "dependencies": {

@@ -0,1 +1,2 @@

import { describe, test } from '@jest/globals';
import assert from 'assert';

@@ -59,3 +60,3 @@ import { YError } from 'yerror';

it('should build an initialization module', async () => {
test('should build an initialization module', async () => {
const $ = new Knifecycle();

@@ -62,0 +63,0 @@

@@ -7,5 +7,19 @@ import {

import { buildInitializationSequence } from './sequence.js';
import type { DependencyDeclaration, Initializer } from './util.js';
import type {
DependencyDeclaration,
Initializer,
Dependencies,
} from './util.js';
import type { Autoloader } from './index.js';
type DependencyTreeNode = {
__name: string;
__childNodes?: DependencyTreeNode[];
__initializer: Initializer<unknown, Dependencies<unknown>>;
__inject: DependencyDeclaration[];
__type: 'provider' | 'constant' | 'service';
__initializerName: string;
__path: string;
};
export type BuildInitializer = (

@@ -89,3 +103,3 @@ dependencies: DependencyDeclaration[],

const dependenciesHash = buildDependenciesHash(
dependencyTrees.filter(identity),
dependencyTrees.filter(identity) as DependencyTreeNode[],
);

@@ -184,12 +198,2 @@ const batches = buildInitializationSequence({

type DependencyTreeNode = {
__name: string;
__childNodes?: DependencyTreeNode[];
__initializer: Initializer<unknown, Record<string, unknown>>;
__inject: DependencyDeclaration[];
__type: 'provider' | 'constant' | 'service';
__initializerName: string;
__path: string;
};
async function buildDependencyTree(

@@ -245,3 +249,6 @@ {

function buildDependenciesHash(dependencyTrees, hash = {}) {
function buildDependenciesHash(
dependencyTrees: DependencyTreeNode[],
hash: Record<string, DependencyTreeNode> = {},
): Record<string, DependencyTreeNode> {
return dependencyTrees.reduce(

@@ -253,3 +260,6 @@ (hash, tree) => buildHashFromNode(tree, hash),

function buildHashFromNode(node, hash = {}) {
function buildHashFromNode(
node: DependencyTreeNode,
hash: Record<string, DependencyTreeNode> = {},
): Record<string, DependencyTreeNode> {
const nodeIsALeaf = !(node.__childNodes && node.__childNodes.length);

@@ -263,3 +273,3 @@

node.__childNodes.forEach((childNode) => {
(node?.__childNodes || []).forEach((childNode) => {
hash = buildHashFromNode(childNode, hash);

@@ -271,8 +281,8 @@ });

function identity(a) {
function identity<T = unknown>(a: T): T {
return a;
}
function upperCaseFirst(str) {
function upperCaseFirst(str: string): string {
return str[0].toUpperCase() + str.slice(1);
}
/* eslint max-nested-callbacks:0 */
import { describe, beforeEach, test } from '@jest/globals';
import assert from 'assert';

@@ -42,11 +43,11 @@ import sinon from 'sinon';

describe('with constants', () => {
it('should work with an object', () => {
test('should work with an object', () => {
$.register(constant('ENV', ENV));
});
it('should work with a function', () => {
test('should work with a function', () => {
$.register(constant('time', time));
});
it('should work when overriding a previously set constant', async () => {
test('should work when overriding a previously set constant', async () => {
$.register(constant('TEST', 1));

@@ -59,3 +60,3 @@ $.register(constant('TEST', 2));

it('should fail when overriding an initialized constant', async () => {
test('should fail when overriding an initialized constant', async () => {
$.register(constant('TEST', 1));

@@ -79,7 +80,7 @@ assert.deepEqual(await $.run<Record<string, any>>(['TEST']), {

describe('with services', () => {
it('should work with a service', () => {
test('should work with a service', () => {
$.register(service(timeService, 'time'));
});
it('should work when overriding a previously set service', async () => {
test('should work when overriding a previously set service', async () => {
$.register(service(async () => () => 1, 'test'));

@@ -92,3 +93,3 @@ $.register(service(async () => () => 2, 'test'));

it('should fail when overriding an initialized service', async () => {
test('should fail when overriding an initialized service', async () => {
$.register(service(async () => () => 1, 'test'));

@@ -111,7 +112,7 @@ const { test } = await $.run<{ test: () => number }>(['test']);

describe('with providers', () => {
it('should work with a provider', () => {
test('should work with a provider', () => {
$.register(service(hashProvider, 'hash'));
});
it('should work when overriding a previously set provider', async () => {
test('should work when overriding a previously set provider', async () => {
$.register(

@@ -146,3 +147,3 @@ initializer(

it('should work when overriding a previously set singleton provider', async () => {
test('should work when overriding a previously set singleton provider', async () => {
$.register(

@@ -178,3 +179,3 @@ initializer(

it('should fail when overriding an initialized provider', async () => {
test('should fail when overriding an initialized provider', async () => {
$.register(

@@ -220,3 +221,3 @@ initializer(

it('should fail when intitializer is no a function', () => {
test('should fail when intitializer is no a function', () => {
assert.throws(

@@ -234,3 +235,3 @@ () => {

it('should fail with no service name', () => {
test('should fail with no service name', () => {
assert.throws(

@@ -248,3 +249,3 @@ () => {

it('should fail with a bad service type', () => {
test('should fail with a bad service type', () => {
assert.throws(

@@ -269,3 +270,3 @@ () => {

it('should fail with an undefined constant', () => {
test('should fail with an undefined constant', () => {
assert.throws(

@@ -290,3 +291,3 @@ () => {

it('should fail with a non constant that has a value', () => {
test('should fail with a non constant that has a value', () => {
assert.throws(

@@ -311,3 +312,3 @@ () => {

it('should fail with special autoload intitializer that is not a singleton', () => {
test('should fail with special autoload intitializer that is not a singleton', () => {
assert.throws(

@@ -335,7 +336,7 @@ () => {

describe('provider', () => {
it('should register provider', () => {
test('should register provider', () => {
$.register(provider(hashProvider, 'hash'));
});
it('should fail with direct circular dependencies', () => {
test('should fail with direct circular dependencies', () => {
assert.throws(

@@ -353,3 +354,3 @@ () => {

it('should fail with direct circular dependencies on mapped services', () => {
test('should fail with direct circular dependencies on mapped services', () => {
assert.throws(

@@ -367,3 +368,3 @@ () => {

it('should fail with circular dependencies', () => {
test('should fail with circular dependencies', () => {
assert.throws(

@@ -384,3 +385,3 @@ () => {

it('should fail with deeper circular dependencies', () => {
test('should fail with deeper circular dependencies', () => {
assert.throws(

@@ -407,3 +408,3 @@ () => {

it('should fail with circular dependencies on mapped services', () => {
test('should fail with circular dependencies on mapped services', () => {
assert.throws(

@@ -430,3 +431,3 @@ () => {

describe('run', () => {
it('should work with no dependencies', async () => {
test('should work with no dependencies', async () => {
const dependencies = await $.run<Record<string, any>>([]);

@@ -437,3 +438,3 @@

it('should work with constant dependencies', async () => {
test('should work with constant dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -451,3 +452,3 @@ $.register(constant('time', time));

it('should work with service dependencies', async () => {
test('should work with service dependencies', async () => {
const wrappedSampleService = inject<{ time: any }, string>(

@@ -470,3 +471,3 @@ ['time'],

it('should work with simple dependencies', async () => {
test('should work with simple dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -485,3 +486,3 @@ $.register(constant('time', time));

it('should work with given optional dependencies', async () => {
test('should work with given optional dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -501,3 +502,3 @@ $.register(constant('DEBUG', {}));

it('should work with lacking optional dependencies', async () => {
test('should work with lacking optional dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -516,3 +517,3 @@ $.register(constant('time', time));

it('should work with deeper dependencies', async () => {
test('should work with deeper dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -532,3 +533,3 @@ $.register(constant('time', time));

it('should instanciate services once', async () => {
test('should instanciate services once', async () => {
const timeServiceStub = sinon.spy(timeService);

@@ -558,3 +559,3 @@

it('should instanciate a single mapped service', async () => {
test('should instanciate a single mapped service', async () => {
const providerStub = sinon.stub().returns(

@@ -590,3 +591,3 @@ Promise.resolve({

it('should instanciate several services with mappings', async () => {
test('should instanciate several services with mappings', async () => {
const timeServiceStub = sinon.spy(timeService);

@@ -610,3 +611,3 @@

it('should fail with bad service', async () => {
test('should fail with bad service', async () => {
$.register(service((() => undefined) as any, 'lol'));

@@ -623,3 +624,3 @@

it('should fail with bad provider', async () => {
test('should fail with bad provider', async () => {
$.register(provider((() => undefined) as any, 'lol'));

@@ -635,3 +636,3 @@ try {

it('should fail with bad service in a provider', async () => {
test('should fail with bad service in a provider', async () => {
$.register(provider(() => Promise.resolve() as any, 'lol'));

@@ -647,3 +648,3 @@ try {

it('should fail with undeclared dependencies', async () => {
test('should fail with undeclared dependencies', async () => {
try {

@@ -658,3 +659,3 @@ await $.run<Record<string, any>>(['lol']);

it('should fail with undeclared dependencies upstream', async () => {
test('should fail with undeclared dependencies upstream', async () => {
$.register(constant('ENV', ENV));

@@ -674,3 +675,3 @@ $.register(constant('time', time));

it('should provide a fatal error handler', async () => {
test('should provide a fatal error handler', async () => {
$.register(constant('ENV', ENV));

@@ -728,3 +729,3 @@ $.register(constant('time', time));

describe('autoload', () => {
it('should work with lacking autoloaded dependencies', async () => {
test('should work with lacking autoloaded dependencies', async () => {
const autoloaderInitializer = initializer(

@@ -765,3 +766,3 @@ {

it('should work with deeper several lacking dependencies', async () => {
test('should work with deeper several lacking dependencies', async () => {
$.register(

@@ -804,3 +805,3 @@ initializer(

it('should work with various dependencies', async () => {
test('should work with various dependencies', async () => {
$.register(provider(hashProvider, 'hash', ['hash2']));

@@ -842,3 +843,3 @@ $.register(provider(hashProvider, 'hash3', ['?ENV']));

it('should instanciate services once', async () => {
test('should instanciate services once', async () => {
$.register(

@@ -881,3 +882,3 @@ initializer(

it('should fail when autoload does not exists', async () => {
test('should fail when autoload does not exists', async () => {
try {

@@ -891,3 +892,3 @@ await $.run<Record<string, any>>(['test']);

it('should fail when autoloaded dependencies are not found', async () => {
test('should fail when autoloaded dependencies are not found', async () => {
$.register(

@@ -916,3 +917,3 @@ initializer(

it('should fail when autoloaded dependencies are not initializers', async () => {
test('should fail when autoloaded dependencies are not initializers', async () => {
$.register(

@@ -939,3 +940,3 @@ initializer(

it('should fail when autoloaded dependencies are not right initializers', async () => {
test('should fail when autoloaded dependencies are not right initializers', async () => {
$.register(

@@ -972,3 +973,3 @@ initializer(

it('should fail when autoload depends on existing autoloaded dependencies', async () => {
test('should fail when autoload depends on existing autoloaded dependencies', async () => {
$.register(

@@ -1005,3 +1006,3 @@ initializer(

it('should work when autoload depends on optional and unexisting autoloaded dependencies', async () => {
test('should work when autoload depends on optional and unexisting autoloaded dependencies', async () => {
$.register(

@@ -1034,3 +1035,3 @@ initializer(

it.skip('should work when autoload depends on deeper optional and unexisting autoloaded dependencies', async () => {
test.skip('should work when autoload depends on deeper optional and unexisting autoloaded dependencies', async () => {
$.register(

@@ -1079,3 +1080,3 @@ initializer(

describe('$injector', () => {
it('should work with no dependencies', async () => {
test('should work with no dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -1101,3 +1102,3 @@ $.register(constant('time', time));

it('should work with same dependencies then the running silo', async () => {
test('should work with same dependencies then the running silo', async () => {
$.register(constant('ENV', ENV));

@@ -1126,3 +1127,3 @@ $.register(constant('time', time));

it('should work with name mapping', async () => {
test('should work with name mapping', async () => {
$.register(constant('ENV', ENV));

@@ -1154,3 +1155,3 @@ $.register(constant('time', time));

it('should work with non instanciated dependencies', async () => {
test('should work with non instanciated dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -1174,3 +1175,3 @@ $.register(constant('time', time));

it('should create dependencies when not declared as singletons', async () => {
test('should create dependencies when not declared as singletons', async () => {
$.register(constant('ENV', ENV));

@@ -1191,3 +1192,3 @@ $.register(provider(hashProvider, 'hash', ['ENV']));

it('should reuse dependencies when declared as singletons', async () => {
test('should reuse dependencies when declared as singletons', async () => {
$.register(constant('ENV', ENV));

@@ -1214,3 +1215,3 @@ $.register(provider(hashProvider, 'hash', ['ENV'], true));

describe('destroy', () => {
it('should work even with one silo and no dependencies', async () => {
test('should work even with one silo and no dependencies', async () => {
assert.equal(typeof $.destroy, 'function');

@@ -1222,3 +1223,3 @@ const dependencies = await $.run<Record<string, any>>(['$instance']);

it('should work with several silos and dependencies', async () => {
test('should work with several silos and dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -1241,3 +1242,3 @@ $.register(constant('time', time));

it('should work when trigered from several silos simultaneously', async () => {
test('should work when trigered from several silos simultaneously', async () => {
$.register(constant('ENV', ENV));

@@ -1268,3 +1269,3 @@ $.register(constant('time', time));

it('should work when a silo shutdown is in progress', async () => {
test('should work when a silo shutdown is in progress', async () => {
$.register(constant('ENV', ENV));

@@ -1293,3 +1294,3 @@ $.register(constant('time', time));

it('should disallow new runs', async () => {
test('should disallow new runs', async () => {
$.register(constant('ENV', ENV));

@@ -1316,3 +1317,3 @@ $.register(constant('time', time));

describe('$dispose', () => {
it('should work with no dependencies', async () => {
test('should work with no dependencies', async () => {
const dependencies = await $.run<Record<string, any>>(['$dispose']);

@@ -1324,3 +1325,3 @@ assert.equal(typeof dependencies.$dispose, 'function');

it('should work with constant dependencies', async () => {
test('should work with constant dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -1339,3 +1340,3 @@ $.register(constant('time', time));

it('should work with simple dependencies', async () => {
test('should work with simple dependencies', async () => {
$.register(constant('ENV', ENV));

@@ -1355,3 +1356,3 @@ $.register(constant('time', time));

it('should work with deeper dependencies', async () => {
test('should work with deeper dependencies', async () => {
let shutdownCallResolve;

@@ -1414,3 +1415,3 @@ let shutdownResolve;

it('should work with deeper multi used dependencies', async () => {
test('should work with deeper multi used dependencies', async () => {
let shutdownCallResolve;

@@ -1469,3 +1470,3 @@ let shutdownResolve;

it('should delay service shutdown to their deeper dependencies', async () => {
test('should delay service shutdown to their deeper dependencies', async () => {
const servicesShutdownCalls = sinon.spy(() => Promise.resolve());

@@ -1520,3 +1521,3 @@

it('should not shutdown singleton dependencies if used elsewhere', async () => {
test('should not shutdown singleton dependencies if used elsewhere', async () => {
$.register(constant('ENV', ENV));

@@ -1544,3 +1545,3 @@ $.register(constant('time', time));

it('should shutdown singleton dependencies if not used elsewhere', async () => {
test('should shutdown singleton dependencies if not used elsewhere', async () => {
$.register(constant('ENV', ENV));

@@ -1564,3 +1565,3 @@ $.register(constant('time', time));

describe('toMermaidGraph', () => {
it('should print nothing when no dependency', () => {
test('should print nothing when no dependency', () => {
$.register(constant('ENV', ENV));

@@ -1571,3 +1572,3 @@ $.register(constant('time', time));

it('should print a dependency graph', () => {
test('should print a dependency graph', () => {
$.register(constant('ENV', ENV));

@@ -1593,3 +1594,3 @@ $.register(constant('time', time));

it('should allow custom shapes', () => {
test('should allow custom shapes', () => {
$.register(constant('ENV', ENV));

@@ -1630,3 +1631,3 @@ $.register(constant('time', time));

it('should allow custom styles', () => {
test('should allow custom styles', () => {
$.register(constant('ENV', ENV));

@@ -1633,0 +1634,0 @@ $.register(constant('time', time));

@@ -0,1 +1,2 @@

import { describe, test } from '@jest/globals';
import assert from 'assert';

@@ -5,3 +6,3 @@ import { buildInitializationSequence } from './sequence.js';

describe('buildInitializationSequence()', () => {
it('should work with one level trees', () => {
test('should work with one level trees', () => {
const tree = {

@@ -14,3 +15,3 @@ __name: 'lol',

it('should work with multi-level trees', () => {
test('should work with multi-level trees', () => {
const tree = {

@@ -70,3 +71,3 @@ __name: 'lol',

it('should work with multi-level trees and cross dependencies', () => {
test('should work with multi-level trees and cross dependencies', () => {
const tree = {

@@ -73,0 +74,0 @@ __name: 'lol',

@@ -0,1 +1,2 @@

import { describe, test } from '@jest/globals';
import assert from 'assert';

@@ -41,3 +42,3 @@ import sinon from 'sinon';

describe('reuseSpecialProps', () => {
it('should work', () => {
test('should work', () => {
// We can safely ignore coverage here since the

@@ -87,3 +88,3 @@ // function are here just as placeholders

describe('wrapInitializer', () => {
it('should work with a service initializer', async () => {
test('should work with a service initializer', async () => {
async function baseServiceInitializer() {

@@ -116,3 +117,3 @@ return () => 'test';

it('should work with a provider initialzer', async () => {
test('should work with a provider initialzer', async () => {
async function baseInitializer() {

@@ -151,3 +152,3 @@ return { service: () => 'test' };

describe('inject', () => {
it('should allow to decorate an initializer with dependencies', () => {
test('should allow to decorate an initializer with dependencies', () => {
const dependencies = ['ENV'];

@@ -164,3 +165,3 @@ const newInitializer = inject<{ ENV: string }, string>(

it('should allow to decorate an initializer builder with dependencies', () => {
test('should allow to decorate an initializer builder with dependencies', () => {
const dependencies = ['ENV'];

@@ -177,3 +178,3 @@ const newInitializer = inject<{ ENV: string }, string>(

it('should allow to decorate an initializer with dependencies', () => {
test('should allow to decorate an initializer with dependencies', () => {
const dependencies = ['ENV'];

@@ -190,3 +191,3 @@ const newInitializer = inject<{ ENV: string }, string>(

it('should allow to decorate an initializer builder with dependencies', () => {
test('should allow to decorate an initializer builder with dependencies', () => {
const dependencies = ['ENV'];

@@ -203,3 +204,3 @@ const newInitializer = inject<{ ENV: string }, string>(

it('should allow to decorate an initializer with mapped dependencies', () => {
test('should allow to decorate an initializer with mapped dependencies', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -213,3 +214,3 @@ const newInitializer = inject(dependencies, aProviderInitializer);

it('should fail with a constant', () => {
test('should fail with a constant', () => {
assert.throws(() => {

@@ -227,3 +228,3 @@ inject(

describe('useInject', () => {
it('should set the right dependencies', () => {
test('should set the right dependencies', () => {
const fromDependencies = ['ENV', 'CORS'];

@@ -245,3 +246,3 @@ const fromInitializer = inject(fromDependencies, aProviderInitializer);

describe('mergeInject', () => {
it('should amend dependencies', () => {
test('should amend dependencies', () => {
const fromDependencies = ['ENV', 'CORS'];

@@ -270,3 +271,3 @@ const fromInitializer = inject<

describe('autoInject', () => {
it('should allow to decorate an initializer with dependencies', () => {
test('should allow to decorate an initializer with dependencies', () => {
const baseProvider =

@@ -286,3 +287,3 @@ async ({ ENV, mysql: db }) =>

it('should allow to decorate an initializer with a function name', () => {
test('should allow to decorate an initializer with a function name', () => {
async function baseProvider({ ENV, mysql: db }) {

@@ -302,3 +303,3 @@ async () => ({

it('should allow to decorate an initializer with optional dependencies', () => {
test('should allow to decorate an initializer with optional dependencies', () => {
const noop = () => undefined;

@@ -320,3 +321,3 @@ const baseProvider =

it('should allow to decorate an initializer with several arguments', () => {
test('should allow to decorate an initializer with several arguments', () => {
const noop = () => undefined;

@@ -338,3 +339,3 @@ const baseProvider =

it('should allow to decorate an initializer with complex arguments', () => {
test('should allow to decorate an initializer with complex arguments', () => {
const noop = () => undefined;

@@ -356,3 +357,3 @@ const baseProvider =

it('should fail with non async initializers', () => {
test('should fail with non async initializers', () => {
assert.throws(() => {

@@ -365,3 +366,3 @@ autoInject((({ foo: bar = { bar: 'foo' } }) => {

it('should fail with too complex injections', () => {
test('should fail with too complex injections', () => {
assert.throws(() => {

@@ -374,3 +375,3 @@ autoInject(async ({ foo: bar = { bar: 'foo' } }) => {

it('should fail with no injections', () => {
test('should fail with no injections', () => {
assert.throws(() => {

@@ -383,3 +384,3 @@ autoInject(async () => undefined);

describe('alsoInject', () => {
it('should allow to decorate an initializer with dependencies', () => {
test('should allow to decorate an initializer with dependencies', () => {
const newInitializer = alsoInject(

@@ -394,3 +395,3 @@ ['ENV'],

it('should allow to decorate an initializer with dependencies', () => {
test('should allow to decorate an initializer with dependencies', () => {
const newInitializer = alsoInject(['ENV'], aProviderInitializer);

@@ -402,3 +403,3 @@

it('should dedupe dependencies', () => {
test('should dedupe dependencies', () => {
const baseProvider = inject(['?TEST'], aProviderInitializer);

@@ -421,3 +422,3 @@ const newInitializer = alsoInject(

it('should preserve single optional dependencies', () => {
test('should preserve single optional dependencies', () => {
const baseProvider = inject(['ENV', '?TEST'], aProviderInitializer);

@@ -438,3 +439,3 @@ const newInitializer = alsoInject(

it('should preserve mapped dependencies', () => {
test('should preserve mapped dependencies', () => {
const baseProvider = inject(['mysql', '?sftp'], aProviderInitializer);

@@ -452,3 +453,3 @@ const newInitializer = alsoInject(['db>mysql', '?ftp>sftp'], baseProvider);

it('should solve dependencies alias name clash', () => {
test('should solve dependencies alias name clash', () => {
const baseProvider = inject(['?TEST'], aProviderInitializer);

@@ -473,3 +474,3 @@ const newInitializer = alsoInject(

it('should solve dependencies alias name clash', () => {
test('should solve dependencies alias name clash', () => {
const baseProvider = inject(['?TEST'], aProviderInitializer);

@@ -496,3 +497,3 @@ const newInitializer = alsoInject(

describe('parseInjections', () => {
it('should work with TypeScript dependencies', () => {
test('should work with TypeScript dependencies', () => {
assert.deepEqual(

@@ -512,3 +513,3 @@ parseInjections(`async function initNexmo({

it('should allow to decorate an initializer with dependencies', () => {
test('should allow to decorate an initializer with dependencies', () => {
const newInitializer = alsoInject(['ENV'], aProviderInitializer);

@@ -522,3 +523,3 @@

describe('singleton', () => {
it('should allow to decorate an initializer with singleton option', () => {
test('should allow to decorate an initializer with singleton option', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -536,3 +537,3 @@ const newInitializer = inject(

it('should allow to be used several times', () => {
test('should allow to be used several times', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -552,3 +553,3 @@ const newInitializer = inject(

describe('name', () => {
it('should allow to decorate an initializer with a name', () => {
test('should allow to decorate an initializer with a name', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -569,3 +570,3 @@ const baseName = 'hash';

describe('autoName', () => {
it('should allow to decorate an initializer with its function name', () => {
test('should allow to decorate an initializer with its function name', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -586,3 +587,3 @@ const baseName = 'hash';

it('should allow to decorate an initializer with its init like function name', () => {
test('should allow to decorate an initializer with its init like function name', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -603,3 +604,3 @@ const baseName = 'hash';

it('should allow to decorate an initializer with its initialize like function name', () => {
test('should allow to decorate an initializer with its initialize like function name', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -620,3 +621,3 @@ const baseName = 'hash';

it('should allow to decorate a bounded initializer', () => {
test('should allow to decorate a bounded initializer', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -640,3 +641,3 @@ const baseName = 'hash';

it('should fail with anonymous functions', () => {
test('should fail with anonymous functions', () => {
assert.throws(() => {

@@ -649,3 +650,3 @@ autoName(async () => undefined);

describe('extra', () => {
it('should allow to decorate an initializer with extra infos', () => {
test('should allow to decorate an initializer with extra infos', () => {
const extraInformations = { httpHandler: true };

@@ -659,3 +660,3 @@ const newInitializer = extra(extraInformations, aProviderInitializer);

it('should allow to decorate an initializer with extra infos', () => {
test('should allow to decorate an initializer with extra infos', () => {
const extraInformations = { httpHandler: true };

@@ -669,3 +670,3 @@ const newInitializer = extra(extraInformations, aProviderInitializer, true);

it('should allow to decorate an initializer with additional extra infos', () => {
test('should allow to decorate an initializer with additional extra infos', () => {
const baseExtraInformations = { yolo: true, httpHandler: false };

@@ -690,3 +691,3 @@ const additionalExtraInformations = { httpHandler: true };

describe('type', () => {
it('should allow to decorate an initializer with a type', () => {
test('should allow to decorate an initializer with a type', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -709,3 +710,3 @@ const baseName = 'hash';

describe('initializer', () => {
it('should allow to decorate an initializer with every properties', () => {
test('should allow to decorate an initializer with every properties', () => {
const dependencies = ['ANOTHER_ENV>ENV'];

@@ -732,3 +733,3 @@ const baseName = 'hash';

it('should fail with bad properties', () => {
test('should fail with bad properties', () => {
assert.throws(() => {

@@ -747,3 +748,3 @@ initializer(

describe('constant', () => {
it('should allow to create an initializer from a constant', async () => {
test('should allow to create an initializer from a constant', async () => {
const baseName = 'THE_VALUE';

@@ -758,3 +759,3 @@ const baseValue = 42;

it('should fail with dependencies since it makes no sense', () => {
test('should fail with dependencies since it makes no sense', () => {
assert.throws(() => {

@@ -770,3 +771,3 @@ constant(

describe('service', () => {
it('should allow to create an initializer from a service builder', async () => {
test('should allow to create an initializer from a service builder', async () => {
const aServiceBuilder = async (_services: unknown) => 'A_SERVICE';

@@ -794,3 +795,3 @@ const dependencies = ['ANOTHER_ENV>ENV'];

it('should allow to create an initializer from a generic service builder', async () => {
test('should allow to create an initializer from a generic service builder', async () => {
const aServiceBuilder = async <T>(_services: T) => '';

@@ -818,3 +819,3 @@ const dependencies = ['ANOTHER_ENV>ENV'];

it('should fail with no service builder', () => {
test('should fail with no service builder', () => {
assert.throws(() => {

@@ -827,3 +828,3 @@ service(undefined as any);

describe('autoService', () => {
it('should detect the service details', () => {
test('should detect the service details', () => {
const baseServiceBuilder = async function initializeMySQL({ ENV }) {

@@ -840,3 +841,3 @@ return ENV;

it('should detect the service details even with no dependencies', () => {
test('should detect the service details even with no dependencies', () => {
const baseServiceBuilder = async function initializeMySQL() {

@@ -855,3 +856,3 @@ return;

describe('provider', () => {
it('should allow to create an initializer from a provider builder', async () => {
test('should allow to create an initializer from a provider builder', async () => {
const aProviderInitializerBuilder = async () => ({ service: 'A_SERVICE' });

@@ -879,3 +880,3 @@ const dependencies = ['ANOTHER_ENV>ENV'];

it('should allow to create an initializer from a provider builder', async () => {
test('should allow to create an initializer from a provider builder', async () => {
const aServiceBuilder = async (_services: unknown) => ({

@@ -904,3 +905,3 @@ service: 'A_SERVICE',

it('should fail with no provider builder', () => {
test('should fail with no provider builder', () => {
assert.throws(() => {

@@ -913,3 +914,3 @@ provider(undefined as any);

describe('autoProvider', () => {
it('should detect the provider details', () => {
test('should detect the provider details', () => {
const baseInitializer = async function initializeMySQL({

@@ -930,3 +931,3 @@ ENV,

it('should detect the provider details even with no dependencies', () => {
test('should detect the provider details even with no dependencies', () => {
const baseInitializer = async function initializeMySQL() {

@@ -945,3 +946,3 @@ return { service: 'A_SERVICE' };

describe('handler', () => {
it('should work', async () => {
test('should work', async () => {
const baseName = 'sampleHandler';

@@ -970,3 +971,3 @@ const injectedServices = ['kikooo', 'lol'];

it('should fail with no name', () => {
test('should fail with no name', () => {
assert.throws(() => {

@@ -979,3 +980,3 @@ handler(async () => undefined);

describe('autoHandler', () => {
it('should work', async () => {
test('should work', async () => {
const services = {

@@ -1002,3 +1003,3 @@ kikooo: 'kikooo',

it('should work with spread services', async () => {
test('should work with spread services', async () => {
const services = {

@@ -1025,3 +1026,3 @@ kikooo: 'kikooo',

it('should fail for anonymous functions', () => {
test('should fail for anonymous functions', () => {
assert.throws(() => {

@@ -1034,3 +1035,3 @@ autoHandler(async () => undefined);

describe('parseDependencyDeclaration', () => {
it('should work', () => {
test('should work', () => {
assert.deepEqual(parseDependencyDeclaration('db>pgsql'), {

@@ -1043,3 +1044,3 @@ serviceName: 'db',

it('should work with unmapped names', () => {
test('should work with unmapped names', () => {
assert.deepEqual(parseDependencyDeclaration('?pgsql'), {

@@ -1046,0 +1047,0 @@ serviceName: 'pgsql',

@@ -237,3 +237,7 @@ /* eslint @typescript-eslint/ban-types:0 */

*/
export function reuseSpecialProps<FD, TD, S>(
export function reuseSpecialProps<
FD extends Dependencies<any>,
TD extends Dependencies<any>,
S,
>(
from:

@@ -245,3 +249,7 @@ | AsyncInitializerBuilder<FD, unknown>

): ProviderInitializerBuilder<FD & TD, S>;
export function reuseSpecialProps<FD, TD, S>(
export function reuseSpecialProps<
FD extends Dependencies<any>,
TD extends Dependencies<any>,
S,
>(
from:

@@ -253,3 +261,7 @@ | AsyncInitializerBuilder<FD, unknown>

): ServiceInitializerBuilder<FD & TD, S>;
export function reuseSpecialProps<FD, TD, S>(
export function reuseSpecialProps<
FD extends Dependencies<any>,
TD extends Dependencies<any>,
S,
>(
from:

@@ -355,3 +367,3 @@ | AsyncInitializerBuilder<FD, unknown>

*/
export function service<D, S>(
export function service<D extends Dependencies<any>, S>(
serviceBuilder: ServiceInitializerBuilder<D, S>,

@@ -397,3 +409,3 @@ name?: DependencyName,

*/
export function autoService<D, S>(
export function autoService<D extends Dependencies<any>, S>(
serviceBuilder: ServiceInitializerBuilder<D, S>,

@@ -456,3 +468,3 @@ ): ServiceInitializer<D, S> {

*/
export function provider<D, S>(
export function provider<D extends Dependencies<any>, S>(
providerBuilder: ProviderInitializerBuilder<D, S>,

@@ -504,3 +516,3 @@ name?: DependencyName,

*/
export function autoProvider<D, S>(
export function autoProvider<D extends Dependencies<any>, S>(
providerBuilder: ProviderInitializerBuilder<D, S>,

@@ -526,11 +538,11 @@ ): ProviderInitializer<D, S> {

export function wrapInitializer<D, S>(
export function wrapInitializer<D extends Dependencies<any>, S>(
wrapper: ProviderInitializerWrapper<S, D>,
baseInitializer: ProviderInitializer<D, S>,
): ProviderInitializer<D, S>;
export function wrapInitializer<D, S>(
export function wrapInitializer<D extends Dependencies<any>, S>(
wrapper: ServiceInitializerWrapper<S, D>,
baseInitializer: ServiceInitializer<D, S>,
): ServiceInitializer<D, S>;
export function wrapInitializer<D, S>(
export function wrapInitializer<D extends Dependencies<any>, S>(
wrapper: ProviderInitializerWrapper<S, D> | ServiceInitializerWrapper<S, D>,

@@ -574,19 +586,19 @@ baseInitializer: ProviderInitializer<D, S> | ServiceInitializer<D, S>,

*/
export function inject<D, S>(
export function inject<D extends Dependencies<any>, S>(
dependencies: DependencyDeclaration[],
initializer: ProviderInitializer<any, S>,
): ProviderInitializer<D, S>;
export function inject<D, S>(
export function inject<D extends Dependencies<any>, S>(
dependencies: DependencyDeclaration[],
initializer: ProviderInitializerBuilder<any, S>,
): ProviderInitializerBuilder<D, S>;
export function inject<D, S>(
export function inject<D extends Dependencies<any>, S>(
dependencies: DependencyDeclaration[],
initializer: ServiceInitializer<any, S>,
): ServiceInitializer<D, S>;
export function inject<D, S>(
export function inject<D extends Dependencies<any>, S>(
dependencies: DependencyDeclaration[],
initializer: ServiceInitializerBuilder<any, S>,
): ServiceInitializerBuilder<D, S>;
export function inject<D, S>(
export function inject<D extends Dependencies<any>, S>(
dependencies: DependencyDeclaration[],

@@ -624,3 +636,3 @@ initializer:

*/
export function useInject<FD, S>(
export function useInject<FD extends Dependencies<any>, S>(
from:

@@ -631,3 +643,3 @@ | AsyncInitializerBuilder<FD, unknown>

): ProviderInitializer<FD, S>;
export function useInject<FD, S>(
export function useInject<FD extends Dependencies<any>, S>(
from:

@@ -638,3 +650,3 @@ | AsyncInitializerBuilder<FD, unknown>

): ProviderInitializerBuilder<FD, S>;
export function useInject<FD, S>(
export function useInject<FD extends Dependencies<any>, S>(
from:

@@ -645,3 +657,3 @@ | AsyncInitializerBuilder<FD, unknown>

): ServiceInitializer<FD, S>;
export function useInject<FD, S>(
export function useInject<FD extends Dependencies<any>, S>(
from:

@@ -652,3 +664,3 @@ | AsyncInitializerBuilder<FD, unknown>

): ServiceInitializerBuilder<FD, S>;
export function useInject<FD, S>(
export function useInject<FD extends Dependencies<any>, S>(
from:

@@ -668,3 +680,7 @@ | AsyncInitializerBuilder<FD, unknown>

*/
export function mergeInject<FD, D, S>(
export function mergeInject<
FD extends Dependencies<any>,
D extends Dependencies<any>,
S,
>(
from:

@@ -675,3 +691,7 @@ | AsyncInitializerBuilder<FD, unknown>

): ProviderInitializer<FD & D, S>;
export function mergeInject<FD, D, S>(
export function mergeInject<
FD extends Dependencies<any>,
D extends Dependencies<any>,
S,
>(
from:

@@ -682,3 +702,7 @@ | AsyncInitializerBuilder<FD, unknown>

): ProviderInitializerBuilder<FD & D, S>;
export function mergeInject<FD, D, S>(
export function mergeInject<
FD extends Dependencies<any>,
D extends Dependencies<any>,
S,
>(
from:

@@ -689,3 +713,7 @@ | AsyncInitializerBuilder<FD, unknown>

): ServiceInitializer<FD, S>;
export function mergeInject<FD, D, S>(
export function mergeInject<
FD extends Dependencies<any>,
D extends Dependencies<any>,
S,
>(
from:

@@ -696,3 +724,7 @@ | AsyncInitializerBuilder<FD, unknown>

): ServiceInitializerBuilder<FD, S>;
export function mergeInject<FD, D, S>(
export function mergeInject<
FD extends Dependencies<any>,
D extends Dependencies<any>,
S,
>(
from:

@@ -736,15 +768,15 @@ | AsyncInitializerBuilder<FD, unknown>

*/
export function autoInject<D, S>(
export function autoInject<D extends Dependencies<any>, S>(
initializer: ProviderInitializer<D, S>,
): ProviderInitializer<D, S>;
export function autoInject<D, S>(
export function autoInject<D extends Dependencies<any>, S>(
initializer: ProviderInitializerBuilder<D, S>,
): ProviderInitializerBuilder<D, S>;
export function autoInject<D, S>(
export function autoInject<D extends Dependencies<any>, S>(
initializer: ServiceInitializer<D, S>,
): ServiceInitializer<D, S>;
export function autoInject<D, S>(
export function autoInject<D extends Dependencies<any>, S>(
initializer: ServiceInitializerBuilder<D, S>,
): ServiceInitializerBuilder<D, S>;
export function autoInject<D, S>(
export function autoInject<D extends Dependencies<any>, S>(
initializer:

@@ -783,19 +815,39 @@ | ProviderInitializerBuilder<D, S>

*/
export function alsoInject<ND, D, S>(
export function alsoInject<
ND extends Dependencies<any>,
D extends Dependencies<any>,
S,
>(
dependencies: DependencyDeclaration[],
to: ProviderInitializer<D, S>,
): ProviderInitializer<ND & D, S>;
export function alsoInject<ND, D, S>(
export function alsoInject<
ND extends Dependencies<any>,
D extends Dependencies<any>,
S,
>(
dependencies: DependencyDeclaration[],
to: ProviderInitializerBuilder<D, S>,
): ProviderInitializerBuilder<ND & D, S>;
export function alsoInject<ND, D, S>(
export function alsoInject<
ND extends Dependencies<any>,
D extends Dependencies<any>,
S,
>(
dependencies: DependencyDeclaration[],
to: ServiceInitializer<D, S>,
): ServiceInitializer<ND & D, S>;
export function alsoInject<ND, D, S>(
export function alsoInject<
ND extends Dependencies<any>,
D extends Dependencies<any>,
S,
>(
dependencies: DependencyDeclaration[],
to: ServiceInitializerBuilder<D, S>,
): ServiceInitializerBuilder<ND & D, S>;
export function alsoInject<ND, D, S>(
export function alsoInject<
ND extends Dependencies<any>,
D extends Dependencies<any>,
S,
>(
dependencies: DependencyDeclaration[],

@@ -873,3 +925,3 @@ initializer:

export function extra<D, S>(
export function extra<D extends Dependencies<any>, S>(
extraInformations: ExtraInformations,

@@ -879,3 +931,3 @@ initializer: ProviderInitializer<D, S>,

): ProviderInitializer<D, S>;
export function extra<D, S>(
export function extra<D extends Dependencies<any>, S>(
extraInformations: ExtraInformations,

@@ -885,11 +937,11 @@ initializer: ProviderInitializerBuilder<D, S>,

): ProviderInitializerBuilder<D, S>;
export function extra<D, S>(
export function extra<D extends Dependencies<any>, S>(
extraInformations: ExtraInformations,
initializer: ServiceInitializer<D, S>,
): ServiceInitializer<D, S>;
export function extra<D, S>(
export function extra<D extends Dependencies<any>, S>(
extraInformations: ExtraInformations,
initializer: ServiceInitializerBuilder<D, S>,
): ServiceInitializerBuilder<D, S>;
export function extra<D, S>(
export function extra<D extends Dependencies<any>, S>(
extraInformations: ExtraInformations,

@@ -941,19 +993,19 @@ initializer:

*/
export function singleton<D, S>(
export function singleton<D extends Dependencies<any>, S>(
initializer: ProviderInitializer<D, S>,
isSingleton?: boolean,
): ProviderInitializer<D, S>;
export function singleton<D, S>(
export function singleton<D extends Dependencies<any>, S>(
initializer: ProviderInitializerBuilder<D, S>,
isSingleton?: boolean,
): ProviderInitializerBuilder<D, S>;
export function singleton<D, S>(
export function singleton<D extends Dependencies<any>, S>(
initializer: ServiceInitializer<D, S>,
isSingleton?: boolean,
): ServiceInitializer<D, S>;
export function singleton<D, S>(
export function singleton<D extends Dependencies<any>, S>(
initializer: ServiceInitializerBuilder<D, S>,
isSingleton?: boolean,
): ServiceInitializerBuilder<D, S>;
export function singleton<D, S>(
export function singleton<D extends Dependencies<any>, S>(
initializer:

@@ -993,19 +1045,19 @@ | ProviderInitializerBuilder<D, S>

*/
export function name<D, S>(
export function name<D extends Dependencies<any>, S>(
name: DependencyName,
initializer: ProviderInitializer<D, S>,
): ProviderInitializer<D, S>;
export function name<D, S>(
export function name<D extends Dependencies<any>, S>(
name: DependencyName,
initializer: ProviderInitializerBuilder<D, S>,
): ProviderInitializerBuilder<D, S>;
export function name<D, S>(
export function name<D extends Dependencies<any>, S>(
name: DependencyName,
initializer: ServiceInitializer<D, S>,
): ServiceInitializer<D, S>;
export function name<D, S>(
export function name<D extends Dependencies<any>, S>(
name: DependencyName,
initializer: ServiceInitializerBuilder<D, S>,
): ServiceInitializerBuilder<D, S>;
export function name<D, S>(
export function name<D extends Dependencies<any>, S>(
name: DependencyName,

@@ -1042,15 +1094,15 @@ initializer:

*/
export function autoName<D, S>(
export function autoName<D extends Dependencies<any>, S>(
initializer: ProviderInitializer<D, S>,
): ProviderInitializer<D, S>;
export function autoName<D, S>(
export function autoName<D extends Dependencies<any>, S>(
initializer: ProviderInitializerBuilder<D, S>,
): ProviderInitializerBuilder<D, S>;
export function autoName<D, S>(
export function autoName<D extends Dependencies<any>, S>(
initializer: ServiceInitializer<D, S>,
): ServiceInitializer<D, S>;
export function autoName<D, S>(
export function autoName<D extends Dependencies<any>, S>(
initializer: ServiceInitializerBuilder<D, S>,
): ServiceInitializerBuilder<D, S>;
export function autoName<D, S>(
export function autoName<D extends Dependencies<any>, S>(
initializer:

@@ -1088,19 +1140,19 @@ | ProviderInitializerBuilder<D, S>

*/
export function type<D, S>(
export function type<D extends Dependencies<any>, S>(
type: 'provider',
initializer: ProviderInitializer<D, S>,
): ProviderInitializer<D, S>;
export function type<D, S>(
export function type<D extends Dependencies<any>, S>(
type: 'provider',
initializer: ProviderInitializerBuilder<D, S>,
): ProviderInitializerBuilder<D, S>;
export function type<D, S>(
export function type<D extends Dependencies<any>, S>(
type: 'service',
initializer: ServiceInitializer<D, S>,
): ServiceInitializer<D, S>;
export function type<D, S>(
export function type<D extends Dependencies<any>, S>(
type: 'service',
initializer: ServiceInitializerBuilder<D, S>,
): ServiceInitializerBuilder<D, S>;
export function type<D, S>(
export function type<D extends Dependencies<any>, S>(
type: 'service' | 'provider',

@@ -1145,11 +1197,11 @@ initializer:

*/
export function initializer<D, S>(
export function initializer<D extends Dependencies<any>, S>(
properties: ProviderInputProperties,
initializer: ProviderInitializerBuilder<D, S>,
): ProviderInitializer<D, S>;
export function initializer<D, S>(
export function initializer<D extends Dependencies<any>, S>(
properties: ServiceInputProperties,
initializer: ServiceInitializerBuilder<D, S>,
): ServiceInitializer<D, S>;
export function initializer<D, S>(
export function initializer<D extends Dependencies<any>, S>(
properties: ServiceInputProperties | ProviderInputProperties,

@@ -1368,16 +1420,16 @@ initializer:

*/
export function unwrapInitializerProperties<S, D>(
export function unwrapInitializerProperties<S, D extends Dependencies<any>>(
initializer: ProviderInitializer<D, S>,
): ProviderProperties;
export function unwrapInitializerProperties<S, D>(
export function unwrapInitializerProperties<S, D extends Dependencies<any>>(
initializer: ServiceInitializer<D, S>,
): ServiceProperties;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function unwrapInitializerProperties<S, D>(
export function unwrapInitializerProperties<S, D extends Dependencies<any>>(
initializer: ConstantInitializer<S>,
): ConstantProperties;
export function unwrapInitializerProperties<S, D>(
export function unwrapInitializerProperties<S, D extends Dependencies<any>>(
initializer: Initializer<S, D>,
): InitializerProperties;
export function unwrapInitializerProperties<S, D>(
export function unwrapInitializerProperties<S, D extends Dependencies<any>>(
initializer:

@@ -1384,0 +1436,0 @@ | ProviderInitializerBuilder<D, S>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc