@equinor/fusion-framework
Advanced tools
Comparing version 1.1.17 to 1.2.0
@@ -6,2 +6,13 @@ # Change Log | ||
# 1.2.0 (2022-06-24) | ||
### Features | ||
* **framework:** allow addtional modules ([d8d697b](https://github.com/equinor/fusion-framework/commit/d8d697b6fa8ea5c8130b324195d39f354d2fa768)) | ||
## [1.1.17](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework@1.1.16...@equinor/fusion-framework@1.1.17) (2022-06-14) | ||
@@ -8,0 +19,0 @@ |
import { initializeFusionModules } from './modules'; | ||
export const initFusion = async (init) => { | ||
const modules = await initializeFusionModules(init); | ||
export const initFusion = async (init, additionalModules) => { | ||
const modules = await initializeFusionModules(init, additionalModules); | ||
const fusion = { | ||
@@ -5,0 +5,0 @@ modules, |
@@ -1,7 +0,7 @@ | ||
import { initializeModules } from '@equinor/fusion-framework-module'; | ||
import { initializeModules, } from '@equinor/fusion-framework-module'; | ||
import http from '@equinor/fusion-framework-module-http'; | ||
import auth from '@equinor/fusion-framework-module-msal'; | ||
import disco from '@equinor/fusion-framework-module-service-discovery'; | ||
export const modules = [http, auth, disco]; | ||
export const initializeFusionModules = async (configurator) => initializeModules(configurator, modules); | ||
export const baseModules = [http, auth, disco]; | ||
export const initializeFusionModules = async (configurator, modules) => initializeModules(configurator, [...baseModules, ...modules]); | ||
//# sourceMappingURL=modules.js.map |
@@ -0,9 +1,10 @@ | ||
import { AnyModule } from '@equinor/fusion-framework-module'; | ||
import { FusionConfigurator, FusionModulesInstance } from './modules'; | ||
export { FusionConfigurator }; | ||
export type { FusionConfigurator, FusionModules } from './modules'; | ||
export interface AppManifest { | ||
} | ||
export interface Fusion { | ||
modules: FusionModulesInstance; | ||
export interface Fusion<TModules extends Array<AnyModule> = Array<AnyModule>> { | ||
modules: FusionModulesInstance<TModules>; | ||
} | ||
export declare const initFusion: (init: FusionConfigurator) => Promise<Fusion>; | ||
export declare const initFusion: <TModules extends AnyModule[] = AnyModule[]>(init: FusionConfigurator<TModules>, additionalModules?: TModules | undefined) => Promise<Fusion<TModules>>; | ||
declare global { | ||
@@ -10,0 +11,0 @@ interface Window { |
@@ -1,2 +0,2 @@ | ||
import { ModulesInstanceType } from '@equinor/fusion-framework-module'; | ||
import { AnyModule, ModulesInstanceType } from '@equinor/fusion-framework-module'; | ||
import type { ModulesConfigurator } from '@equinor/fusion-framework-module'; | ||
@@ -7,5 +7,8 @@ import { HttpModule } from '@equinor/fusion-framework-module-http'; | ||
export declare type FusionModules = [HttpModule, MsalModule, ServiceDiscoveryModule]; | ||
export declare const modules: FusionModules; | ||
export declare type FusionModulesInstance = ModulesInstanceType<FusionModules>; | ||
export declare type FusionConfigurator = ModulesConfigurator<FusionModules>; | ||
export declare const initializeFusionModules: (configurator: FusionConfigurator) => Promise<FusionModulesInstance>; | ||
export declare const baseModules: FusionModules; | ||
export declare type FusionModulesInstance<TModules extends Array<AnyModule>> = ModulesInstanceType<FusionModules> & ModulesInstanceType<TModules>; | ||
export declare type FusionConfigurator<TModules extends Array<AnyModule>> = ModulesConfigurator<[ | ||
...FusionModules, | ||
...TModules | ||
]>; | ||
export declare const initializeFusionModules: <TModules extends AnyModule[] = []>(configurator: FusionConfigurator<TModules>, modules?: TModules | undefined) => Promise<FusionModulesInstance<TModules>>; |
{ | ||
"name": "@equinor/fusion-framework", | ||
"version": "1.1.17", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -38,3 +38,3 @@ "main": "./dist/esm/index.js", | ||
}, | ||
"gitHead": "b61d74513171d9b2ba84a6091966f6250f1a6aa0" | ||
"gitHead": "64eda203654cdb04bddbec725e6dd0f5222d950b" | ||
} |
/* eslint-disable @typescript-eslint/no-empty-interface */ | ||
import { AnyModule } from '@equinor/fusion-framework-module'; | ||
import { FusionConfigurator, FusionModulesInstance, initializeFusionModules } from './modules'; | ||
export { FusionConfigurator }; | ||
export type { FusionConfigurator, FusionModules } from './modules'; | ||
export interface AppManifest {} | ||
export interface Fusion { | ||
export interface Fusion<TModules extends Array<AnyModule> = Array<AnyModule>> { | ||
/** | ||
* Configured services for Fusion | ||
*/ | ||
modules: FusionModulesInstance; | ||
modules: FusionModulesInstance<TModules>; | ||
/** | ||
@@ -22,4 +23,7 @@ * Create a scoped instance of services | ||
export const initFusion = async (init: FusionConfigurator): Promise<Fusion> => { | ||
const modules = await initializeFusionModules(init); | ||
export const initFusion = async <TModules extends Array<AnyModule> = Array<AnyModule>>( | ||
init: FusionConfigurator<TModules>, | ||
additionalModules?: TModules | ||
): Promise<Fusion<TModules>> => { | ||
const modules = await initializeFusionModules(init, additionalModules); | ||
const fusion = { | ||
@@ -26,0 +30,0 @@ modules, |
@@ -1,2 +0,6 @@ | ||
import { initializeModules, ModulesInstanceType } from '@equinor/fusion-framework-module'; | ||
import { | ||
AnyModule, | ||
initializeModules, | ||
ModulesInstanceType, | ||
} from '@equinor/fusion-framework-module'; | ||
@@ -10,9 +14,18 @@ import type { ModulesConfigurator } from '@equinor/fusion-framework-module'; | ||
export type FusionModules = [HttpModule, MsalModule, ServiceDiscoveryModule]; | ||
export const modules: FusionModules = [http, auth, disco]; | ||
export const baseModules: FusionModules = [http, auth, disco]; | ||
export type FusionModulesInstance = ModulesInstanceType<FusionModules>; | ||
export type FusionConfigurator = ModulesConfigurator<FusionModules>; | ||
export type FusionModulesInstance<TModules extends Array<AnyModule>> = | ||
ModulesInstanceType<FusionModules> & ModulesInstanceType<TModules>; | ||
export const initializeFusionModules = async ( | ||
configurator: FusionConfigurator | ||
): Promise<FusionModulesInstance> => initializeModules(configurator, modules); | ||
export type FusionConfigurator<TModules extends Array<AnyModule>> = ModulesConfigurator< | ||
[...FusionModules, ...TModules] | ||
>; | ||
export const initializeFusionModules = async <TModules extends Array<AnyModule> = []>( | ||
configurator: FusionConfigurator<TModules>, | ||
modules?: TModules | ||
): Promise<FusionModulesInstance<TModules>> => | ||
// TODO - TS resolve overload, might fix later | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
initializeModules(configurator, [...baseModules, ...modules]); |
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
104273
132