@equinor/fusion-framework-module
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -6,2 +6,11 @@ # Change Log | ||
## 1.2.1 (2022-09-27) | ||
### Bug Fixes | ||
* update registering of configuration ([20942ce](https://github.com/equinor/fusion-framework/commit/20942ce1c7a853ea3b55c031a242646e378db8c9)) | ||
## 1.2.0 (2022-09-20) | ||
@@ -8,0 +17,0 @@ |
@@ -28,3 +28,3 @@ import { BehaviorSubject, firstValueFrom, from, lastValueFrom, throwError } from 'rxjs'; | ||
this._modules.add(module); | ||
configure && this._configs.push((config) => configure(config[module.name])); | ||
configure && this._configs.push((config, ref) => configure(config[module.name], ref)); | ||
afterConfig && this._afterConfiguration.push((config) => afterConfig(config[module.name])); | ||
@@ -49,3 +49,3 @@ afterInit && this._afterInit.push((instances) => afterInit(instances[module.name])); | ||
const config = await this._createConfig(ref); | ||
await Promise.all(this._configs.map((x) => Promise.resolve(x(config)))); | ||
await Promise.all(this._configs.map((x) => Promise.resolve(x(config, ref)))); | ||
await this._postConfigure(config); | ||
@@ -52,0 +52,0 @@ return config; |
@@ -5,4 +5,4 @@ import { ModuleConsoleLogger } from './logger'; | ||
logger: ModuleConsoleLogger; | ||
configure(...configs: Array<IModuleConfigurator>): void; | ||
addConfig<T extends AnyModule>(config: IModuleConfigurator<T>): void; | ||
configure(...configs: Array<IModuleConfigurator<any, TRef>>): void; | ||
addConfig<T extends AnyModule>(config: IModuleConfigurator<T, TRef>): void; | ||
initialize<T extends Array<AnyModule> | unknown>(ref?: TRef): Promise<ModulesInstance<CombinedModules<T, TModules>>>; | ||
@@ -21,3 +21,3 @@ onConfigured<T>(cb: (config: ModulesConfigType<CombinedModules<T, TModules>>) => void | Promise<void>): void; | ||
logger: ModuleConsoleLogger; | ||
protected _configs: Array<(config: ModulesConfig<[AnyModule]>) => void | Promise<void>>; | ||
protected _configs: Array<(config: ModulesConfig<[AnyModule]>, ref?: TRef) => void | Promise<void>>; | ||
protected _afterConfiguration: Array<(config: any) => void>; | ||
@@ -28,8 +28,8 @@ protected _afterInit: Array<(instance: any) => void>; | ||
get modules(): Array<AnyModule>; | ||
configure(...configs: Array<IModuleConfigurator>): void; | ||
addConfig<T extends AnyModule>(config: IModuleConfigurator<T>): void; | ||
configure(...configs: Array<IModuleConfigurator<any, TRef>>): void; | ||
addConfig<T extends AnyModule>(config: IModuleConfigurator<T, TRef>): void; | ||
onConfigured<T>(cb: (config: ModulesConfigType<CombinedModules<T, TModules>>) => void | Promise<void>): void; | ||
onInitialized<T>(cb: (instance: ModulesInstanceType<CombinedModules<T, TModules>>) => void): void; | ||
initialize<T, R = TRef>(ref?: R): Promise<ModulesInstance<CombinedModules<T, TModules>>>; | ||
protected _configure<T, R = TRef>(ref?: R): Promise<ModulesConfig<CombinedModules<T, TModules>>>; | ||
initialize<T, R extends TRef = TRef>(ref?: R): Promise<ModulesInstance<CombinedModules<T, TModules>>>; | ||
protected _configure<T, R extends TRef = TRef>(ref?: R): Promise<ModulesConfig<CombinedModules<T, TModules>>>; | ||
protected _createConfig<T, R = TRef>(ref?: R): Promise<ModulesConfig<CombinedModules<T, TModules>>>; | ||
@@ -36,0 +36,0 @@ protected _postConfigure<T>(config: ModulesConfigType<CombinedModules<T, TModules>>): Promise<void>; |
{ | ||
"name": "@equinor/fusion-framework-module", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "", | ||
@@ -31,3 +31,3 @@ "main": "dist/esm/index.js", | ||
}, | ||
"gitHead": "2cd29e53f0f29582cdf98b18699d6aa0f171f7fe" | ||
"gitHead": "6948015d0a835b16e75699fcd0b317e54fa93eef" | ||
} |
@@ -24,5 +24,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
logger: ModuleConsoleLogger; | ||
configure(...configs: Array<IModuleConfigurator>): void; | ||
configure(...configs: Array<IModuleConfigurator<any, TRef>>): void; | ||
addConfig<T extends AnyModule>(config: IModuleConfigurator<T>): void; | ||
addConfig<T extends AnyModule>(config: IModuleConfigurator<T, TRef>): void; | ||
@@ -65,3 +65,5 @@ initialize<T extends Array<AnyModule> | unknown>( | ||
protected _configs: Array<(config: ModulesConfig<[AnyModule]>) => void | Promise<void>> = []; | ||
protected _configs: Array< | ||
(config: ModulesConfig<[AnyModule]>, ref?: TRef) => void | Promise<void> | ||
> = []; | ||
protected _afterConfiguration: Array<(config: any) => void> = []; | ||
@@ -80,10 +82,10 @@ protected _afterInit: Array<(instance: any) => void> = []; | ||
public configure(...configs: Array<IModuleConfigurator>) { | ||
public configure(...configs: Array<IModuleConfigurator<any, TRef>>) { | ||
configs.forEach((x) => this.addConfig(x)); | ||
} | ||
public addConfig<T extends AnyModule>(config: IModuleConfigurator<T>) { | ||
public addConfig<T extends AnyModule>(config: IModuleConfigurator<T, TRef>) { | ||
const { module, afterConfig, afterInit, configure } = config; | ||
this._modules.add(module); | ||
configure && this._configs.push((config) => configure(config[module.name])); | ||
configure && this._configs.push((config, ref) => configure(config[module.name], ref)); | ||
afterConfig && this._afterConfiguration.push((config) => afterConfig(config[module.name])); | ||
@@ -105,3 +107,3 @@ afterInit && this._afterInit.push((instances) => afterInit(instances[module.name])); | ||
public async initialize<T, R = TRef>( | ||
public async initialize<T, R extends TRef = TRef>( | ||
ref?: R | ||
@@ -119,7 +121,7 @@ ): Promise<ModulesInstance<CombinedModules<T, TModules>>> { | ||
protected async _configure<T, R = TRef>( | ||
protected async _configure<T, R extends TRef = TRef>( | ||
ref?: R | ||
): Promise<ModulesConfig<CombinedModules<T, TModules>>> { | ||
const config = await this._createConfig<T, R>(ref); | ||
await Promise.all(this._configs.map((x) => Promise.resolve(x(config)))); | ||
await Promise.all(this._configs.map((x) => Promise.resolve(x(config, ref)))); | ||
await this._postConfigure<T>(config); | ||
@@ -126,0 +128,0 @@ return config; |
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
114369
814