@equinor/fusion-framework-module-app 5.2.8 → 5.2.10
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 +13 -0
- package/dist/esm/app/App.js +39 -3
- package/dist/esm/app/App.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/app/events.d.ts +23 -15
- package/dist/types/version.d.ts +1 -1
- package/package.json +8 -4
- package/src/app/App.ts +39 -3
- package/src/app/events.ts +33 -29
- package/src/version.ts +1 -1
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
import type { FrameworkEvent, FrameworkEventInit } from '@equinor/fusion-framework-module-event';
|
|
2
2
|
import type { App } from './App';
|
|
3
|
-
import type { AppConfig, AppManifest, AppModulesInstance } from '../types';
|
|
3
|
+
import type { AppConfig, AppManifest, AppModulesInstance, AppScriptModule } from '../types';
|
|
4
4
|
export type AppEventEventInit<TDetail extends Record<string, unknown> | unknown = unknown> = FrameworkEventInit<TDetail & {
|
|
5
5
|
appKey: string;
|
|
6
6
|
}, App>;
|
|
7
|
+
export type AppEvent<TDetail extends Record<string, unknown> | unknown = unknown> = FrameworkEvent<AppEventEventInit<TDetail>>;
|
|
8
|
+
export type AppEventFailure = FrameworkEvent<AppEventEventInit<{
|
|
9
|
+
error: AppConfig;
|
|
10
|
+
}>>;
|
|
7
11
|
declare module '@equinor/fusion-framework-module-event' {
|
|
8
12
|
interface FrameworkEventMap {
|
|
9
|
-
onAppModulesLoaded:
|
|
13
|
+
onAppModulesLoaded: AppEvent<{
|
|
10
14
|
modules: AppModulesInstance;
|
|
11
|
-
}
|
|
12
|
-
|
|
15
|
+
}>;
|
|
16
|
+
onAppManifestLoad: AppEvent;
|
|
17
|
+
onAppManifestLoaded: AppEvent<{
|
|
13
18
|
manifest: AppManifest;
|
|
14
|
-
}
|
|
15
|
-
|
|
19
|
+
}>;
|
|
20
|
+
onAppManifestFailure: AppEventFailure;
|
|
21
|
+
onAppConfigLoad: AppEvent;
|
|
22
|
+
onAppConfigLoaded: AppEvent<{
|
|
16
23
|
config: AppConfig;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
}>;
|
|
25
|
+
onAppConfigFailure: AppEventFailure;
|
|
26
|
+
onAppScriptLoad: AppEvent;
|
|
27
|
+
onAppScriptLoaded: AppEvent<{
|
|
28
|
+
script: AppScriptModule;
|
|
29
|
+
}>;
|
|
30
|
+
onAppScriptFailure: AppEventFailure;
|
|
31
|
+
onAppInitialize: AppEvent;
|
|
32
|
+
onAppInitialized: AppEvent;
|
|
33
|
+
onAppInitializeFailure: AppEventFailure;
|
|
26
34
|
onAppDispose: FrameworkEvent<AppEventEventInit>;
|
|
27
35
|
}
|
|
28
36
|
}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.2.
|
|
1
|
+
export declare const version = "5.2.10";
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-module-app",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./dist/esm/index.js",
|
|
8
8
|
"./errors.js": "./dist/esm/errors.js",
|
|
9
|
-
"./app": "./dist/esm/app/index.js"
|
|
9
|
+
"./app": "./dist/esm/app/index.js",
|
|
10
|
+
"./app/*.js": "./dist/esm/app/*.js"
|
|
10
11
|
},
|
|
11
12
|
"types": "dist/types/index.d.ts",
|
|
12
13
|
"typesVersions": {
|
|
@@ -16,6 +17,9 @@
|
|
|
16
17
|
],
|
|
17
18
|
"app": [
|
|
18
19
|
"dist/types/app/index.d.ts"
|
|
20
|
+
],
|
|
21
|
+
"app/*.js": [
|
|
22
|
+
"dist/types/app/*.d.ts"
|
|
19
23
|
]
|
|
20
24
|
}
|
|
21
25
|
},
|
|
@@ -39,10 +43,10 @@
|
|
|
39
43
|
"devDependencies": {
|
|
40
44
|
"typescript": "^5.1.3",
|
|
41
45
|
"@equinor/fusion-framework-module": "^4.2.5",
|
|
42
|
-
"@equinor/fusion-framework-module-event": "^4.0.6",
|
|
43
46
|
"@equinor/fusion-framework-module-http": "^5.1.1",
|
|
44
47
|
"@equinor/fusion-framework-module-msal": "^3.0.7",
|
|
45
|
-
"@equinor/fusion-framework-module-service-discovery": "^7.0.13"
|
|
48
|
+
"@equinor/fusion-framework-module-service-discovery": "^7.0.13",
|
|
49
|
+
"@equinor/fusion-framework-module-event": "^4.0.6"
|
|
46
50
|
},
|
|
47
51
|
"scripts": {
|
|
48
52
|
"build": "tsc -b"
|
package/src/app/App.ts
CHANGED
|
@@ -170,23 +170,59 @@ export class App<TEnv = any, TModules extends Array<AnyModule> | unknown = unkno
|
|
|
170
170
|
#registerEvents(event: ModuleType<EventModule>): void {
|
|
171
171
|
const { appKey } = this;
|
|
172
172
|
|
|
173
|
+
this.#state.addEffect(actions.fetchManifest.type, () => {
|
|
174
|
+
event.dispatchEvent('onAppManifestLoad', {
|
|
175
|
+
detail: { appKey },
|
|
176
|
+
source: this,
|
|
177
|
+
});
|
|
178
|
+
});
|
|
173
179
|
this.#state.addEffect(actions.fetchManifest.success.type, (action) => {
|
|
174
180
|
event.dispatchEvent('onAppManifestLoaded', {
|
|
175
181
|
detail: { appKey, manifest: action.payload },
|
|
176
182
|
source: this,
|
|
177
183
|
});
|
|
178
184
|
});
|
|
185
|
+
this.#state.addEffect(actions.fetchManifest.failure.type, (action) => {
|
|
186
|
+
event.dispatchEvent('onAppManifestFailure', {
|
|
187
|
+
detail: { appKey, error: action.payload },
|
|
188
|
+
source: this,
|
|
189
|
+
});
|
|
190
|
+
});
|
|
179
191
|
|
|
192
|
+
this.#state.addEffect(actions.fetchConfig.type, () => {
|
|
193
|
+
event.dispatchEvent('onAppConfigLoad', {
|
|
194
|
+
detail: { appKey },
|
|
195
|
+
source: this,
|
|
196
|
+
});
|
|
197
|
+
});
|
|
180
198
|
this.#state.addEffect(actions.fetchConfig.success.type, (action) => {
|
|
181
199
|
event.dispatchEvent('onAppConfigLoaded', {
|
|
182
|
-
detail: { appKey,
|
|
200
|
+
detail: { appKey, config: action.payload },
|
|
201
|
+
source: this,
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
this.#state.addEffect(actions.fetchConfig.failure.type, (action) => {
|
|
205
|
+
event.dispatchEvent('onAppConfigFailure', {
|
|
206
|
+
detail: { appKey, error: action.payload },
|
|
183
207
|
source: this,
|
|
184
208
|
});
|
|
185
209
|
});
|
|
186
210
|
|
|
211
|
+
this.#state.addEffect(actions.importApp.type, () => {
|
|
212
|
+
event.dispatchEvent('onAppScriptLoad', {
|
|
213
|
+
detail: { appKey },
|
|
214
|
+
source: this,
|
|
215
|
+
});
|
|
216
|
+
});
|
|
187
217
|
this.#state.addEffect(actions.importApp.success.type, (action) => {
|
|
188
218
|
event.dispatchEvent('onAppScriptLoaded', {
|
|
189
|
-
detail: { appKey,
|
|
219
|
+
detail: { appKey, script: action.payload },
|
|
220
|
+
source: this,
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
this.#state.addEffect(actions.importApp.failure.type, (action) => {
|
|
224
|
+
event.dispatchEvent('onAppScriptFailure', {
|
|
225
|
+
detail: { appKey, error: action.payload },
|
|
190
226
|
source: this,
|
|
191
227
|
});
|
|
192
228
|
});
|
|
@@ -206,7 +242,7 @@ export class App<TEnv = any, TModules extends Array<AnyModule> | unknown = unkno
|
|
|
206
242
|
});
|
|
207
243
|
|
|
208
244
|
this.#state.addEffect(actions.initialize.failure.type, ({ payload }) => {
|
|
209
|
-
event.dispatchEvent('
|
|
245
|
+
event.dispatchEvent('onAppInitializeFailure', {
|
|
210
246
|
detail: { appKey, error: payload },
|
|
211
247
|
source: this,
|
|
212
248
|
});
|
package/src/app/events.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { FrameworkEvent, FrameworkEventInit } from '@equinor/fusion-framewo
|
|
|
2
2
|
|
|
3
3
|
import type { App } from './App';
|
|
4
4
|
|
|
5
|
-
import type { AppConfig, AppManifest, AppModulesInstance } from '../types';
|
|
5
|
+
import type { AppConfig, AppManifest, AppModulesInstance, AppScriptModule } from '../types';
|
|
6
6
|
|
|
7
7
|
/** base event type for applications */
|
|
8
8
|
export type AppEventEventInit<TDetail extends Record<string, unknown> | unknown = unknown> =
|
|
@@ -13,53 +13,57 @@ export type AppEventEventInit<TDetail extends Record<string, unknown> | unknown
|
|
|
13
13
|
App
|
|
14
14
|
>;
|
|
15
15
|
|
|
16
|
+
export type AppEvent<TDetail extends Record<string, unknown> | unknown = unknown> = FrameworkEvent<
|
|
17
|
+
AppEventEventInit<TDetail>
|
|
18
|
+
>;
|
|
19
|
+
|
|
20
|
+
export type AppEventFailure = FrameworkEvent<
|
|
21
|
+
AppEventEventInit<{
|
|
22
|
+
error: AppConfig;
|
|
23
|
+
}>
|
|
24
|
+
>;
|
|
25
|
+
|
|
16
26
|
declare module '@equinor/fusion-framework-module-event' {
|
|
17
27
|
interface FrameworkEventMap {
|
|
18
28
|
/** fired when the application has initiated its modules */
|
|
19
|
-
onAppModulesLoaded:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}>
|
|
24
|
-
>;
|
|
29
|
+
onAppModulesLoaded: AppEvent<{
|
|
30
|
+
/** initiated modules for application */
|
|
31
|
+
modules: AppModulesInstance;
|
|
32
|
+
}>;
|
|
25
33
|
|
|
34
|
+
onAppManifestLoad: AppEvent;
|
|
26
35
|
/** fired when the application has loaded corresponding manifest */
|
|
27
|
-
onAppManifestLoaded:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
>;
|
|
36
|
+
onAppManifestLoaded: AppEvent<{
|
|
37
|
+
manifest: AppManifest;
|
|
38
|
+
}>;
|
|
39
|
+
onAppManifestFailure: AppEventFailure;
|
|
32
40
|
|
|
41
|
+
onAppConfigLoad: AppEvent;
|
|
33
42
|
/** fired when the application has loaded corresponding config */
|
|
34
|
-
onAppConfigLoaded:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
>;
|
|
43
|
+
onAppConfigLoaded: AppEvent<{
|
|
44
|
+
config: AppConfig;
|
|
45
|
+
}>;
|
|
46
|
+
onAppConfigFailure: AppEventFailure;
|
|
39
47
|
|
|
40
48
|
/** fired when the application has loaded corresponding javascript module */
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
onAppScriptLoad: AppEvent;
|
|
50
|
+
onAppScriptLoaded: AppEvent<{
|
|
51
|
+
script: AppScriptModule;
|
|
52
|
+
}>;
|
|
53
|
+
onAppScriptFailure: AppEventFailure;
|
|
46
54
|
|
|
47
55
|
/** fired before application loads manifest, config and script */
|
|
48
|
-
onAppInitialize:
|
|
56
|
+
onAppInitialize: AppEvent;
|
|
49
57
|
|
|
50
58
|
/**
|
|
51
59
|
* fired after application has loaded manifest, config and script
|
|
52
60
|
*
|
|
53
61
|
* __note:__ not fired until all loaders has settled (last emit)
|
|
54
62
|
*/
|
|
55
|
-
onAppInitialized:
|
|
63
|
+
onAppInitialized: AppEvent;
|
|
56
64
|
|
|
57
65
|
/** fired when application fails to load either manifest, config and script */
|
|
58
|
-
|
|
59
|
-
AppEventEventInit<{
|
|
60
|
-
error: unknown;
|
|
61
|
-
}>
|
|
62
|
-
>;
|
|
66
|
+
onAppInitializeFailure: AppEventFailure;
|
|
63
67
|
|
|
64
68
|
/** fired when the application is disposed (unmounts) */
|
|
65
69
|
onAppDispose: FrameworkEvent<AppEventEventInit>;
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '5.2.
|
|
2
|
+
export const version = '5.2.10';
|