knifecycle
Advanced tools
Comparing version 11.0.0-beta.4 to 11.0.0-beta.5
@@ -1,2 +0,2 @@ | ||
# [11.0.0-beta.4](https://github.com/nfroidure/knifecycle/compare/v10.0.3...v11.0.0-beta.4) (2020-11-21) | ||
# [11.0.0-beta.5](https://github.com/nfroidure/knifecycle/compare/v10.0.3...v11.0.0-beta.5) (2020-11-21) | ||
@@ -3,0 +3,0 @@ |
@@ -60,3 +60,3 @@ import { SPECIAL_PROPS, SPECIAL_PROPS_PREFIX, DECLARATION_SEPARATOR, OPTIONAL_FLAG, ALLOWED_INITIALIZER_TYPES, ALLOWED_SPECIAL_PROPS, parseInjections, readFunctionName, reuseSpecialProps, parseName, name, autoName, inject, useInject, mergeInject, autoInject, alsoInject, type, extra, singleton, initializer, constant, service, autoService, provider, autoProvider, wrapInitializer, handler, autoHandler, parseDependencyDeclaration, stringifyDependencyDeclaration } from './util'; | ||
*/ | ||
register(initializer: Initializer<AS, AD>): Knifecycle<D, AD, AS>; | ||
register(initializer: Initializer<AS, Dependencies<AS>>): Knifecycle<D, AD, AS>; | ||
_lookupCircularDependencies(rootServiceName: ServiceName, dependencyDeclaration: DependencyDeclaration, declarationsStacks?: DependencyDeclaration[]): void; | ||
@@ -124,3 +124,3 @@ /** | ||
*/ | ||
run<D = Partial<AD>>(dependenciesDeclarations: DependencyDeclaration[]): Promise<D>; | ||
run<ID extends Partial<AD> = AD>(dependenciesDeclarations: DependencyDeclaration[]): Promise<ID>; | ||
/** | ||
@@ -127,0 +127,0 @@ * Destroy the Knifecycle instance |
@@ -507,3 +507,3 @@ export declare const DECLARATION_SEPARATOR = ">"; | ||
*/ | ||
export declare function handler<D extends Dependencies, V, P extends Parameters<V>, U extends unknown[], R>(handlerFunction: HandlerFunction<D, V, P, U, R>, name?: ServiceName, dependencies?: DependencyDeclaration[], singleton?: boolean, extra?: ExtraInformations): ServiceInitializer<D, (parameters: P) => Promise<R>>; | ||
export declare function handler<D extends Dependencies, V, P extends Parameters<V>, U extends unknown[], R>(handlerFunction: HandlerFunction<D, V, P, U, R>, name?: ServiceName, dependencies?: DependencyDeclaration[], singleton?: boolean, extra?: ExtraInformations): ServiceInitializer<D, (parameters: P, ...args: U) => Promise<R>>; | ||
/** | ||
@@ -510,0 +510,0 @@ * Allows to create an initializer with a simple handler automagically |
{ | ||
"name": "knifecycle", | ||
"version": "11.0.0-beta.4", | ||
"version": "11.0.0-beta.5", | ||
"description": "Manage your NodeJS processes's lifecycle automatically with an unobtrusive dependency injection implementation.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index", |
@@ -190,6 +190,6 @@ /* eslint max-len: ["warn", { "ignoreComments": true }] @typescript-eslint/no-this-alias: "warn" */ | ||
private _silosContexts: Set<AD['$siloContext']>; | ||
private _initializers: Map<string, ProviderInitializer<AD, AS>>; | ||
private _initializers: Map<string, ProviderInitializer<Dependencies<AS>, AS>>; | ||
private _initializerResolvers: Map< | ||
string, | ||
Promise<ProviderInitializer<AD, AS>> | ||
Promise<ProviderInitializer<Dependencies<AS>, AS>> | ||
>; | ||
@@ -237,7 +237,3 @@ private _singletonsServicesHandles: Map<string, Set<string>>; | ||
}, | ||
async ({ | ||
$siloContext, | ||
}: { | ||
$siloContext: SiloContext<AS>; | ||
}): Promise<Provider<AS>> => ({ | ||
async ({ $siloContext }: AD): Promise<Provider<AS>> => ({ | ||
service: (async (dependenciesDeclarations: DependencyDeclaration[]) => | ||
@@ -256,3 +252,3 @@ _buildFinalHash( | ||
this.register(initInjectorProvider as ProviderInitializer<AD, AS>); | ||
this.register(initInjectorProvider); | ||
} | ||
@@ -292,3 +288,5 @@ | ||
*/ | ||
register(initializer: Initializer<AS, AD>): Knifecycle<D, AD, AS> { | ||
register( | ||
initializer: Initializer<AS, Dependencies<AS>>, | ||
): Knifecycle<D, AD, AS> { | ||
if (this.shutdownPromise) { | ||
@@ -599,5 +597,5 @@ throw new YError(E_INSTANCE_DESTROYED); | ||
*/ | ||
async run<D = Partial<AD>>( | ||
async run<ID extends Partial<AD> = AD>( | ||
dependenciesDeclarations: DependencyDeclaration[], | ||
): Promise<D> { | ||
): Promise<ID> { | ||
const _this = this; | ||
@@ -604,0 +602,0 @@ const internalDependencies = [ |
@@ -1184,3 +1184,3 @@ /* eslint @typescript-eslint/ban-types:0 */ | ||
extra?: ExtraInformations, | ||
): ServiceInitializer<D, (parameters: P) => Promise<R>> { | ||
): ServiceInitializer<D, (parameters: P, ...args: U) => Promise<R>> { | ||
name = name || handlerFunction[SPECIAL_PROPS.NAME]; | ||
@@ -1187,0 +1187,0 @@ dependencies = dependencies || handlerFunction[SPECIAL_PROPS.INJECT] || []; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1161021
12776