knifecycle
Advanced tools
Comparing version 11.0.0-beta.2 to 11.0.0-beta.3
@@ -1,2 +0,2 @@ | ||
# [11.0.0-beta.2](https://github.com/nfroidure/knifecycle/compare/v10.0.3...v11.0.0-beta.2) (2020-11-18) | ||
# [11.0.0-beta.3](https://github.com/nfroidure/knifecycle/compare/v10.0.3...v11.0.0-beta.3) (2020-11-21) | ||
@@ -3,0 +3,0 @@ |
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'; | ||
import type { ServiceName, Service, Disposer, FatalErrorProvider, Provider, Dependencies, DependencyName, DependencyDeclaration, ExtraInformations, ParsedDependencyDeclaration, ConstantProperties, ConstantInitializer, ProviderInitializerBuilder, ProviderProperties, ProviderInitializer, ProviderInputProperties, ServiceInitializerBuilder, ServiceProperties, ServiceInitializer, ServiceInputProperties, AsyncInitializerBuilder, AsyncInitializer, PartialAsyncInitializer, Initializer, Parameters, HandlerFunction } from './util'; | ||
export type { ServiceName, Service, Disposer, FatalErrorProvider, Provider, Dependencies, DependencyName, DependencyDeclaration, ExtraInformations, ParsedDependencyDeclaration, ConstantProperties, ConstantInitializer, ProviderInitializerBuilder, ProviderProperties, ProviderInitializer, ProviderInputProperties, ServiceInitializerBuilder, ServiceProperties, ServiceInitializer, ServiceInputProperties, AsyncInitializerBuilder, AsyncInitializer, PartialAsyncInitializer, Initializer, Parameters, HandlerFunction, }; | ||
import type { ServiceName, Service, Disposer, FatalErrorProvider, Provider, Dependencies, DependencyName, DependencyDeclaration, ExtraInformations, ParsedDependencyDeclaration, ConstantProperties, ConstantInitializer, ProviderInitializerBuilder, ProviderProperties, ProviderInitializer, ProviderInputProperties, ServiceInitializerBuilder, ServiceProperties, ServiceInitializer, ServiceInputProperties, AsyncInitializerBuilder, AsyncInitializer, PartialAsyncInitializer, Initializer, ServiceInitializerWrapper, ProviderInitializerWrapper, Parameters, HandlerFunction } from './util'; | ||
export type { ServiceName, Service, Disposer, FatalErrorProvider, Provider, Dependencies, DependencyName, DependencyDeclaration, ExtraInformations, ParsedDependencyDeclaration, ConstantProperties, ConstantInitializer, ProviderInitializerBuilder, ProviderProperties, ProviderInitializer, ProviderInputProperties, ServiceInitializerBuilder, ServiceProperties, ServiceInitializer, ServiceInputProperties, AsyncInitializerBuilder, AsyncInitializer, PartialAsyncInitializer, Initializer, ServiceInitializerWrapper, ProviderInitializerWrapper, Parameters, HandlerFunction, }; | ||
export interface Injector<S extends Service> { | ||
@@ -5,0 +5,0 @@ (dependencies: DependencyDeclaration[]): Promise<Dependencies<S>>; |
@@ -69,2 +69,4 @@ export declare const DECLARATION_SEPARATOR = ">"; | ||
export declare type Initializer<S extends Service, D extends Dependencies = Dependencies> = ConstantInitializer<S> | ServiceInitializer<D, S> | ProviderInitializer<D, S>; | ||
export declare type ServiceInitializerWrapper<S extends Service, D extends Dependencies = Dependencies> = (dependencies: D, baseService: S) => Promise<S>; | ||
export declare type ProviderInitializerWrapper<S extends Service, D extends Dependencies = Dependencies> = (dependencies: D, baseService: Provider<S>) => Promise<Provider<S>>; | ||
export declare type Parameters<V = any> = { | ||
@@ -235,4 +237,4 @@ [name: string]: V; | ||
*/ | ||
export declare function wrapInitializer<D, S>(wrapper: (dependencies: D, baseService: S) => Promise<S>, baseInitializer: ServiceInitializer<D, S>): ServiceInitializer<D, S>; | ||
export declare function wrapInitializer<D, S>(wrapper: (dependencies: D, baseService: Provider<S>) => Promise<Provider<S>>, baseInitializer: ProviderInitializer<D, S>): ProviderInitializer<D, S>; | ||
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>; | ||
/** | ||
@@ -239,0 +241,0 @@ * Decorator creating a new initializer with different |
{ | ||
"name": "knifecycle", | ||
"version": "11.0.0-beta.2", | ||
"version": "11.0.0-beta.3", | ||
"description": "Manage your NodeJS processes's lifecycle automatically with an unobtrusive dependency injection implementation.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index", |
@@ -62,2 +62,4 @@ /* eslint max-len: ["warn", { "ignoreComments": true }] @typescript-eslint/no-this-alias: "warn" */ | ||
Initializer, | ||
ServiceInitializerWrapper, | ||
ProviderInitializerWrapper, | ||
Parameters, | ||
@@ -91,2 +93,4 @@ HandlerFunction, | ||
Initializer, | ||
ServiceInitializerWrapper, | ||
ProviderInitializerWrapper, | ||
Parameters, | ||
@@ -93,0 +97,0 @@ HandlerFunction, |
@@ -133,2 +133,11 @@ /* eslint @typescript-eslint/ban-types:0 */ | ||
export type ServiceInitializerWrapper< | ||
S extends Service, | ||
D extends Dependencies = Dependencies | ||
> = (dependencies: D, baseService: S) => Promise<S>; | ||
export type ProviderInitializerWrapper< | ||
S extends Service, | ||
D extends Dependencies = Dependencies | ||
> = (dependencies: D, baseService: Provider<S>) => Promise<Provider<S>>; | ||
export type Parameters<V = any> = { [name: string]: V }; | ||
@@ -512,14 +521,11 @@ export interface HandlerFunction< | ||
export function wrapInitializer<D, S>( | ||
wrapper: (dependencies: D, baseService: S) => Promise<S>, | ||
wrapper: ProviderInitializerWrapper<S, D>, | ||
baseInitializer: ProviderInitializer<D, S>, | ||
): ProviderInitializer<D, S>; | ||
export function wrapInitializer<D, S>( | ||
wrapper: ServiceInitializerWrapper<S, D>, | ||
baseInitializer: ServiceInitializer<D, S>, | ||
): ServiceInitializer<D, S>; | ||
export function wrapInitializer<D, S>( | ||
wrapper: (dependencies: D, baseService: Provider<S>) => Promise<Provider<S>>, | ||
baseInitializer: ProviderInitializer<D, S>, | ||
): ProviderInitializer<D, S>; | ||
export function wrapInitializer<D, S>( | ||
wrapper: ( | ||
dependencies: D, | ||
baseService: S | Provider<S>, | ||
) => Promise<S | Provider<S>>, | ||
wrapper: ProviderInitializerWrapper<S, D> | ServiceInitializerWrapper<S, D>, | ||
baseInitializer: ServiceInitializer<D, S> | ProviderInitializer<D, S>, | ||
@@ -530,3 +536,6 @@ ): ServiceInitializer<D, S> | ProviderInitializer<D, S> { | ||
return wrapper(services, baseInstance); | ||
return (wrapper as ServiceInitializerWrapper<S, D>)( | ||
services, | ||
baseInstance as S, | ||
); | ||
}) as ServiceInitializer<D, S>; | ||
@@ -533,0 +542,0 @@ } |
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
1160524
12771