@equinor/fusion-framework-app 7.1.15 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +32 -0
- package/dist/esm/AppConfigurator.js +40 -1
- package/dist/esm/AppConfigurator.js.map +1 -1
- package/dist/esm/configure-modules.js +1 -1
- package/dist/esm/configure-modules.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/AppConfigurator.d.ts +13 -3
- package/dist/types/version.d.ts +1 -1
- package/package.json +15 -6
- package/src/AppConfigurator.ts +66 -2
- package/src/configure-modules.ts +1 -1
- package/src/version.ts +1 -1
- package/tsconfig.json +3 -0
|
@@ -2,18 +2,28 @@ import { type FusionModulesInstance } from '@equinor/fusion-framework';
|
|
|
2
2
|
import { type AnyModule, type IModulesConfigurator, ModulesConfigurator } from '@equinor/fusion-framework-module';
|
|
3
3
|
import { configureHttpClient, configureHttp, type HttpClientOptions } from '@equinor/fusion-framework-module-http';
|
|
4
4
|
import { configureMsal } from '@equinor/fusion-framework-module-msal';
|
|
5
|
-
import {
|
|
5
|
+
import { type IFeatureFlag, type FeatureFlagBuilderCallback } from '@equinor/fusion-framework-module-feature-flag';
|
|
6
|
+
import { AppEnv, AppModules } from './types';
|
|
6
7
|
export interface IAppConfigurator<TModules extends Array<AnyModule> | unknown = unknown, TRef extends FusionModulesInstance = FusionModulesInstance> extends IModulesConfigurator<AppModules<TModules>, TRef> {
|
|
7
8
|
configureHttp(...args: Parameters<typeof configureHttp>): void;
|
|
8
9
|
configureHttpClient(...args: Parameters<typeof configureHttpClient>): void;
|
|
9
10
|
configureMsal(...args: Parameters<typeof configureMsal>): void;
|
|
10
11
|
useFrameworkServiceClient(serviceName: string): void;
|
|
12
|
+
useFeatureFlags(flags: Array<IFeatureFlag & {
|
|
13
|
+
allowUrl?: boolean;
|
|
14
|
+
}>): void;
|
|
15
|
+
useFeatureFlags(cb: FeatureFlagBuilderCallback): void;
|
|
16
|
+
useFeatureFlags(): void;
|
|
11
17
|
}
|
|
12
|
-
export declare class AppConfigurator<TModules extends Array<AnyModule> | unknown = unknown, TRef extends FusionModulesInstance = FusionModulesInstance> extends ModulesConfigurator<AppModules<TModules>, TRef> implements IAppConfigurator<TModules, TRef> {
|
|
13
|
-
|
|
18
|
+
export declare class AppConfigurator<TModules extends Array<AnyModule> | unknown = unknown, TRef extends FusionModulesInstance = FusionModulesInstance, TEnv extends AppEnv = AppEnv> extends ModulesConfigurator<AppModules<TModules>, TRef> implements IAppConfigurator<TModules, TRef> {
|
|
19
|
+
readonly env: TEnv;
|
|
20
|
+
constructor(env: TEnv);
|
|
14
21
|
configureHttp(...args: Parameters<typeof configureHttp>): void;
|
|
15
22
|
configureHttpClient(...args: Parameters<typeof configureHttpClient>): void;
|
|
16
23
|
useFrameworkServiceClient(serviceName: string, options?: Omit<HttpClientOptions<any>, 'baseUri' | 'defaultScopes'>): void;
|
|
17
24
|
configureMsal(...args: Parameters<typeof configureMsal>): void;
|
|
25
|
+
useFeatureFlags(flags_cb?: Array<IFeatureFlag<unknown> & {
|
|
26
|
+
allowUrl?: boolean | undefined;
|
|
27
|
+
}> | FeatureFlagBuilderCallback): void;
|
|
18
28
|
}
|
|
19
29
|
export default AppConfigurator;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "
|
|
1
|
+
export declare const version = "8.0.1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-app",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -28,15 +28,24 @@
|
|
|
28
28
|
"directory": "packages/app"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@equinor/fusion-framework": "^7.0.
|
|
31
|
+
"@equinor/fusion-framework": "^7.0.29",
|
|
32
32
|
"@equinor/fusion-framework-module": "^4.2.6",
|
|
33
|
-
"@equinor/fusion-framework-module-app": "^5.2.
|
|
34
|
-
"@equinor/fusion-framework-module-
|
|
33
|
+
"@equinor/fusion-framework-module-app": "^5.2.13",
|
|
34
|
+
"@equinor/fusion-framework-module-event": "^4.0.7",
|
|
35
35
|
"@equinor/fusion-framework-module-msal": "^3.0.9",
|
|
36
|
-
"@equinor/fusion-framework-module-
|
|
36
|
+
"@equinor/fusion-framework-module-http": "^5.1.5"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"typescript": "^5.1.3"
|
|
39
|
+
"typescript": "^5.1.3",
|
|
40
|
+
"@equinor/fusion-framework-module-feature-flag": "^1.0.1"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@equinor/fusion-framework-module-feature-flag": "^1.0.1"
|
|
44
|
+
},
|
|
45
|
+
"peerDependenciesMeta": {
|
|
46
|
+
"@equinor/fusion-framework-module-feature-flag": {
|
|
47
|
+
"optional": true
|
|
48
|
+
}
|
|
40
49
|
},
|
|
41
50
|
"scripts": {
|
|
42
51
|
"build": "tsc -b"
|
package/src/AppConfigurator.ts
CHANGED
|
@@ -17,7 +17,17 @@ import http, {
|
|
|
17
17
|
|
|
18
18
|
import auth, { configureMsal } from '@equinor/fusion-framework-module-msal';
|
|
19
19
|
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
enableFeatureFlagging,
|
|
22
|
+
type IFeatureFlag,
|
|
23
|
+
type FeatureFlagBuilderCallback,
|
|
24
|
+
} from '@equinor/fusion-framework-module-feature-flag';
|
|
25
|
+
import {
|
|
26
|
+
createLocalStoragePlugin,
|
|
27
|
+
createUrlPlugin,
|
|
28
|
+
} from '@equinor/fusion-framework-module-feature-flag/plugins';
|
|
29
|
+
|
|
30
|
+
import { AppEnv, AppModules } from './types';
|
|
21
31
|
|
|
22
32
|
/**
|
|
23
33
|
* Configurator for configuring application modules
|
|
@@ -77,16 +87,38 @@ export interface IAppConfigurator<
|
|
|
77
87
|
*/
|
|
78
88
|
// TODO - rename
|
|
79
89
|
useFrameworkServiceClient(serviceName: string): void;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* enable feature flagging with predefined flags
|
|
93
|
+
* @param flags array of flags
|
|
94
|
+
* @remarks
|
|
95
|
+
* this will store defined flags in local storage
|
|
96
|
+
*/
|
|
97
|
+
useFeatureFlags(flags: Array<IFeatureFlag & { allowUrl?: boolean }>): void;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* enable feature flagging with callback
|
|
101
|
+
* @param cb callback for configuring module
|
|
102
|
+
*/
|
|
103
|
+
useFeatureFlags(cb: FeatureFlagBuilderCallback): void;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* enable feature flags
|
|
107
|
+
* @remarks
|
|
108
|
+
* this function does nothing atm since api is not implemented yet
|
|
109
|
+
*/
|
|
110
|
+
useFeatureFlags(): void;
|
|
80
111
|
}
|
|
81
112
|
|
|
82
113
|
export class AppConfigurator<
|
|
83
114
|
TModules extends Array<AnyModule> | unknown = unknown,
|
|
84
115
|
TRef extends FusionModulesInstance = FusionModulesInstance,
|
|
116
|
+
TEnv extends AppEnv = AppEnv,
|
|
85
117
|
>
|
|
86
118
|
extends ModulesConfigurator<AppModules<TModules>, TRef>
|
|
87
119
|
implements IAppConfigurator<TModules, TRef>
|
|
88
120
|
{
|
|
89
|
-
constructor() {
|
|
121
|
+
constructor(public readonly env: TEnv) {
|
|
90
122
|
super([event, http, auth]);
|
|
91
123
|
this.logger = new ModuleConsoleLogger('AppConfigurator');
|
|
92
124
|
}
|
|
@@ -123,6 +155,38 @@ export class AppConfigurator<
|
|
|
123
155
|
public configureMsal(...args: Parameters<typeof configureMsal>) {
|
|
124
156
|
this.addConfig(configureMsal(...args));
|
|
125
157
|
}
|
|
158
|
+
|
|
159
|
+
useFeatureFlags(
|
|
160
|
+
flags_cb?:
|
|
161
|
+
| Array<IFeatureFlag<unknown> & { allowUrl?: boolean | undefined }>
|
|
162
|
+
| FeatureFlagBuilderCallback,
|
|
163
|
+
): void {
|
|
164
|
+
switch (typeof flags_cb) {
|
|
165
|
+
case 'function': {
|
|
166
|
+
enableFeatureFlagging(this, flags_cb);
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
case 'object': {
|
|
170
|
+
const urlFlags: IFeatureFlag[] = [];
|
|
171
|
+
const localFlags = (flags_cb ?? []).map((flag) => {
|
|
172
|
+
const { allowUrl, ...localFlag } = flag;
|
|
173
|
+
if (allowUrl) {
|
|
174
|
+
urlFlags.push(flag);
|
|
175
|
+
}
|
|
176
|
+
return localFlag;
|
|
177
|
+
});
|
|
178
|
+
enableFeatureFlagging(this, async (builder) => {
|
|
179
|
+
builder.addPlugin(
|
|
180
|
+
createLocalStoragePlugin(localFlags, {
|
|
181
|
+
name: this.env.manifest.key,
|
|
182
|
+
}),
|
|
183
|
+
);
|
|
184
|
+
builder.addPlugin(createUrlPlugin(urlFlags));
|
|
185
|
+
});
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
126
190
|
}
|
|
127
191
|
|
|
128
192
|
export default AppConfigurator;
|
package/src/configure-modules.ts
CHANGED
|
@@ -39,7 +39,7 @@ export const configureModules =
|
|
|
39
39
|
* @returns initialized app modules
|
|
40
40
|
*/
|
|
41
41
|
async (args: { fusion: TRef; env: TEnv }): Promise<AppModulesInstance<TModules>> => {
|
|
42
|
-
const configurator = new AppConfigurator<TModules, TRef['modules']>();
|
|
42
|
+
const configurator = new AppConfigurator<TModules, TRef['modules'], TEnv>(args.env);
|
|
43
43
|
if (cb) {
|
|
44
44
|
await Promise.resolve(cb(configurator, args));
|
|
45
45
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '
|
|
2
|
+
export const version = '8.0.1';
|