@equinor/fusion-framework-module-app 5.1.2 → 5.2.0
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 +32 -0
- package/dist/esm/AppModuleProvider.js +1 -0
- package/dist/esm/AppModuleProvider.js.map +1 -1
- package/dist/esm/app/App.js +5 -2
- package/dist/esm/app/App.js.map +1 -1
- package/dist/esm/app/actions.js +6 -3
- package/dist/esm/app/actions.js.map +1 -1
- package/dist/esm/app/create-reducer.js +6 -1
- package/dist/esm/app/create-reducer.js.map +1 -1
- package/dist/esm/app/flows.js +2 -2
- package/dist/esm/app/flows.js.map +1 -1
- package/dist/esm/app/index.js.map +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/AppModuleProvider.d.ts +2 -2
- package/dist/types/app/App.d.ts +29 -2
- package/dist/types/app/actions.d.ts +16 -10
- package/dist/types/app/create-reducer.d.ts +1 -1
- package/dist/types/app/index.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types.d.ts +2 -2
- package/package.json +6 -7
- package/src/AppModuleProvider.ts +5 -3
- package/src/app/App.ts +46 -3
- package/src/app/actions.ts +8 -3
- package/src/app/create-reducer.ts +5 -1
- package/src/app/flows.ts +2 -2
- package/src/app/index.ts +1 -1
- package/src/index.ts +1 -1
- package/src/types.ts +3 -2
- package/LICENSE +0 -21
|
@@ -3,7 +3,7 @@ import { ModuleType } from '@equinor/fusion-framework-module';
|
|
|
3
3
|
import { EventModule } from '@equinor/fusion-framework-module-event';
|
|
4
4
|
import { Query } from '@equinor/fusion-query';
|
|
5
5
|
import type { AppConfig, AppManifest, CurrentApp } from './types';
|
|
6
|
-
import { App } from './app/App';
|
|
6
|
+
import { App, IApp } from './app/App';
|
|
7
7
|
import { AppModuleConfig } from './AppConfigurator';
|
|
8
8
|
import { AppBundleStateInitial } from './app/types';
|
|
9
9
|
export declare class AppModuleProvider {
|
|
@@ -21,7 +21,7 @@ export declare class AppModuleProvider {
|
|
|
21
21
|
getAppManifest(appKey: string): Observable<AppManifest>;
|
|
22
22
|
getAllAppManifests(): Observable<AppManifest[]>;
|
|
23
23
|
getAppConfig<TType = unknown>(appKey: string, tag?: string): Observable<AppConfig<TType>>;
|
|
24
|
-
setCurrentApp(appKeyOrApp: string |
|
|
24
|
+
setCurrentApp(appKeyOrApp: string | IApp): void;
|
|
25
25
|
clearCurrentApp(): void;
|
|
26
26
|
createApp(value: AppBundleStateInitial): App;
|
|
27
27
|
dispose(): void;
|
package/dist/types/app/App.d.ts
CHANGED
|
@@ -7,7 +7,33 @@ import { AnyModule, ModuleType } from '@equinor/fusion-framework-module';
|
|
|
7
7
|
import { AppBundleState, AppBundleStateInitial } from './types';
|
|
8
8
|
import './events';
|
|
9
9
|
export declare function filterEmpty<T>(): OperatorFunction<T | null | undefined, T>;
|
|
10
|
-
export
|
|
10
|
+
export interface IApp<TEnv = any, TModules extends Array<AnyModule> | unknown = unknown> {
|
|
11
|
+
get manifest$(): Observable<AppManifest>;
|
|
12
|
+
get config$(): Observable<AppConfig<TEnv>>;
|
|
13
|
+
get modules$(): Observable<AppScriptModule>;
|
|
14
|
+
get instance$(): Observable<AppModulesInstance<TModules>>;
|
|
15
|
+
get state(): AppBundleState;
|
|
16
|
+
get appKey(): string;
|
|
17
|
+
get manifest(): AppManifest | undefined;
|
|
18
|
+
get manifestAsync(): Promise<AppManifest>;
|
|
19
|
+
get config(): AppConfig<TEnv> | undefined;
|
|
20
|
+
get instance(): AppModulesInstance<TModules> | undefined;
|
|
21
|
+
initialize(): Observable<{
|
|
22
|
+
manifest: AppManifest;
|
|
23
|
+
script: AppScriptModule;
|
|
24
|
+
config: AppConfig;
|
|
25
|
+
}>;
|
|
26
|
+
loadConfig(): void;
|
|
27
|
+
loadManifest(): void;
|
|
28
|
+
loadAppModule(allow_cache?: boolean): void;
|
|
29
|
+
getConfig(force_refresh?: boolean): Observable<AppConfig>;
|
|
30
|
+
getConfigAsync(allow_cache?: boolean): Promise<AppConfig>;
|
|
31
|
+
getManifest(force_refresh?: boolean): Observable<AppManifest>;
|
|
32
|
+
getManifestAsync(allow_cache?: boolean): Promise<AppManifest>;
|
|
33
|
+
getAppModule(force_refresh?: boolean): Observable<AppScriptModule>;
|
|
34
|
+
getAppModuleAsync(allow_cache?: boolean): Promise<AppScriptModule>;
|
|
35
|
+
}
|
|
36
|
+
export declare class App<TEnv = any, TModules extends Array<AnyModule> | unknown = unknown> implements IApp<TEnv, TModules> {
|
|
11
37
|
#private;
|
|
12
38
|
get manifest$(): Observable<AppManifest>;
|
|
13
39
|
get config$(): Observable<AppConfig<TEnv>>;
|
|
@@ -30,7 +56,8 @@ export declare class App<TEnv = any, TModules extends Array<AnyModule> | unknown
|
|
|
30
56
|
config: AppConfig;
|
|
31
57
|
}>;
|
|
32
58
|
loadConfig(): void;
|
|
33
|
-
loadManifest(): void;
|
|
59
|
+
loadManifest(update?: boolean): void;
|
|
60
|
+
updateManifest(manifest: AppManifest, replace?: false): void;
|
|
34
61
|
loadAppModule(allow_cache?: boolean): Promise<void>;
|
|
35
62
|
getConfig(force_refresh?: boolean): Observable<AppConfig>;
|
|
36
63
|
getConfigAsync(allow_cache?: boolean): Promise<AppConfig>;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { ActionInstanceMap, ActionTypes } from '@equinor/fusion-observable';
|
|
2
2
|
import { AppConfig, AppManifest, AppModulesInstance, AppScriptModule } from '../types';
|
|
3
3
|
declare const createActions: () => {
|
|
4
|
-
setManifest: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: AppManifest], AppManifest, "set_manifest", never, {
|
|
4
|
+
setManifest: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: AppManifest, update?: boolean | undefined], AppManifest, "set_manifest", never, {
|
|
5
5
|
created: number;
|
|
6
|
+
update: boolean | undefined;
|
|
6
7
|
}>;
|
|
7
|
-
fetchManifest: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[key: string], string, "fetch_manifest::request", never,
|
|
8
|
+
fetchManifest: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[key: string, update?: boolean | undefined], string, "fetch_manifest::request", never, {
|
|
9
|
+
update: boolean | undefined;
|
|
10
|
+
}> & {
|
|
8
11
|
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: AppManifest], AppManifest, "fetch_manifest::success", never, never>;
|
|
9
12
|
failure: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[error: unknown], unknown, "fetch_manifest::failure", never, never>;
|
|
10
13
|
};
|
|
11
|
-
setConfig: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[config: AppConfig
|
|
14
|
+
setConfig: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[config: AppConfig], AppConfig, "set_config", never, never>;
|
|
12
15
|
fetchConfig: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[key: string], string, "fetch_config::request", never, never> & {
|
|
13
|
-
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[config: AppConfig
|
|
16
|
+
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[config: AppConfig], AppConfig, "fetch_config::success", never, never>;
|
|
14
17
|
failure: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[error: unknown], unknown, "fetch_config::failure", never, never>;
|
|
15
18
|
};
|
|
16
19
|
setModule: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[module: any], any, "set_module", never, never>;
|
|
@@ -18,23 +21,26 @@ declare const createActions: () => {
|
|
|
18
21
|
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[module: AppScriptModule], AppScriptModule, "import_app::success", never, never>;
|
|
19
22
|
failure: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[error: unknown], unknown, "import_app::failure", never, never>;
|
|
20
23
|
};
|
|
21
|
-
setInstance: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[instance: AppModulesInstance
|
|
24
|
+
setInstance: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[instance: AppModulesInstance], AppModulesInstance, "set_instance", never, never>;
|
|
22
25
|
initialize: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[], null, "initialize_app::request", never, never> & {
|
|
23
26
|
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[], null, "initialize_app::success", never, never>;
|
|
24
27
|
failure: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[error: unknown], unknown, "initialize_app::failure", never, never>;
|
|
25
28
|
};
|
|
26
29
|
};
|
|
27
30
|
export declare const actions: {
|
|
28
|
-
setManifest: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: AppManifest], AppManifest, "set_manifest", never, {
|
|
31
|
+
setManifest: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: AppManifest, update?: boolean | undefined], AppManifest, "set_manifest", never, {
|
|
29
32
|
created: number;
|
|
33
|
+
update: boolean | undefined;
|
|
30
34
|
}>;
|
|
31
|
-
fetchManifest: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[key: string], string, "fetch_manifest::request", never,
|
|
35
|
+
fetchManifest: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[key: string, update?: boolean | undefined], string, "fetch_manifest::request", never, {
|
|
36
|
+
update: boolean | undefined;
|
|
37
|
+
}> & {
|
|
32
38
|
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: AppManifest], AppManifest, "fetch_manifest::success", never, never>;
|
|
33
39
|
failure: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[error: unknown], unknown, "fetch_manifest::failure", never, never>;
|
|
34
40
|
};
|
|
35
|
-
setConfig: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[config: AppConfig
|
|
41
|
+
setConfig: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[config: AppConfig], AppConfig, "set_config", never, never>;
|
|
36
42
|
fetchConfig: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[key: string], string, "fetch_config::request", never, never> & {
|
|
37
|
-
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[config: AppConfig
|
|
43
|
+
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[config: AppConfig], AppConfig, "fetch_config::success", never, never>;
|
|
38
44
|
failure: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[error: unknown], unknown, "fetch_config::failure", never, never>;
|
|
39
45
|
};
|
|
40
46
|
setModule: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[module: any], any, "set_module", never, never>;
|
|
@@ -42,7 +48,7 @@ export declare const actions: {
|
|
|
42
48
|
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[module: AppScriptModule], AppScriptModule, "import_app::success", never, never>;
|
|
43
49
|
failure: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[error: unknown], unknown, "import_app::failure", never, never>;
|
|
44
50
|
};
|
|
45
|
-
setInstance: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[instance: AppModulesInstance
|
|
51
|
+
setInstance: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[instance: AppModulesInstance], AppModulesInstance, "set_instance", never, never>;
|
|
46
52
|
initialize: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[], null, "initialize_app::request", never, never> & {
|
|
47
53
|
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[], null, "initialize_app::success", never, never>;
|
|
48
54
|
failure: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[error: unknown], unknown, "initialize_app::failure", never, never>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AppBundleState, AppBundleStateInitial } from './types';
|
|
2
|
-
export declare const createReducer: (value: AppBundleStateInitial) => import("@equinor/fusion-observable").ReducerWithInitialState<AppBundleState
|
|
2
|
+
export declare const createReducer: (value: AppBundleStateInitial) => import("@equinor/fusion-observable").ReducerWithInitialState<AppBundleState, import("@equinor/fusion-observable").AnyAction>;
|
|
3
3
|
export default createReducer;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { App } from './App';
|
|
1
|
+
export { App, IApp } from './App';
|
|
2
2
|
export { default } from './App';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { AppModuleConfig, AppConfigurator, IAppConfigurator, AppModuleConfig as IAppModuleConfig, } from './AppConfigurator';
|
|
2
2
|
export { AppModuleProvider } from './AppModuleProvider';
|
|
3
|
-
export {
|
|
3
|
+
export { IApp } from './app/App';
|
|
4
4
|
export * from './events';
|
|
5
5
|
export * from './types';
|
|
6
6
|
export { enableAppModule } from './enable-app-module';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { EventModule } from '@equinor/fusion-framework-module-event';
|
|
|
3
3
|
import type { HttpModule } from '@equinor/fusion-framework-module-http';
|
|
4
4
|
import { MsalModule } from '@equinor/fusion-framework-module-msal';
|
|
5
5
|
import type { ServiceDiscoveryModule } from '@equinor/fusion-framework-module-service-discovery';
|
|
6
|
-
import
|
|
6
|
+
import IApp from './app';
|
|
7
7
|
type Fusion = any;
|
|
8
8
|
export type AppEnv<TConfig = unknown, TProps = unknown> = {
|
|
9
9
|
basename?: string;
|
|
@@ -13,7 +13,7 @@ export type AppEnv<TConfig = unknown, TProps = unknown> = {
|
|
|
13
13
|
};
|
|
14
14
|
export type ModuleDeps = [HttpModule, ServiceDiscoveryModule, EventModule];
|
|
15
15
|
export type AppType = 'standalone' | 'report' | 'launcher';
|
|
16
|
-
export type CurrentApp<TModules extends Array<AnyModule> = [], TEnv = any> =
|
|
16
|
+
export type CurrentApp<TModules extends Array<AnyModule> = [], TEnv = any> = IApp<TEnv, TModules> | null | undefined;
|
|
17
17
|
export type AppAuth = {
|
|
18
18
|
clientId: string;
|
|
19
19
|
resources: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-module-app",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -39,11 +39,10 @@
|
|
|
39
39
|
"rxjs": "^7.5.7"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@equinor/fusion-framework-module": "^4.
|
|
42
|
+
"@equinor/fusion-framework-module": "^4.2.0",
|
|
43
43
|
"@equinor/fusion-framework-module-event": "^4.0.1",
|
|
44
|
-
"@equinor/fusion-framework-module-http": "^5.0.
|
|
45
|
-
"@equinor/fusion-framework-module-service-discovery": "^7.0.
|
|
46
|
-
"typescript": "^
|
|
47
|
-
}
|
|
48
|
-
"gitHead": "753d04a18764d5a16d9491ec189df90089534879"
|
|
44
|
+
"@equinor/fusion-framework-module-http": "^5.0.3",
|
|
45
|
+
"@equinor/fusion-framework-module-service-discovery": "^7.0.4",
|
|
46
|
+
"typescript": "^5.0.4"
|
|
47
|
+
}
|
|
49
48
|
}
|
package/src/AppModuleProvider.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { Query } from '@equinor/fusion-query';
|
|
|
17
17
|
|
|
18
18
|
import type { AppConfig, AppManifest, CurrentApp } from './types';
|
|
19
19
|
|
|
20
|
-
import { App, filterEmpty } from './app/App';
|
|
20
|
+
import { App, filterEmpty, IApp } from './app/App';
|
|
21
21
|
import { AppModuleConfig } from './AppConfigurator';
|
|
22
22
|
import { AppConfigError, AppManifestError } from './errors';
|
|
23
23
|
import { AppBundleStateInitial } from './app/types';
|
|
@@ -154,10 +154,10 @@ export class AppModuleProvider {
|
|
|
154
154
|
* set the current application, will internally resolve manifest
|
|
155
155
|
* @param appKey - application key
|
|
156
156
|
*/
|
|
157
|
-
public setCurrentApp(appKeyOrApp: string |
|
|
157
|
+
public setCurrentApp(appKeyOrApp: string | IApp): void {
|
|
158
158
|
const app =
|
|
159
159
|
typeof appKeyOrApp === 'string' ? this.createApp({ appKey: appKeyOrApp }) : appKeyOrApp;
|
|
160
|
-
this.#current$.next(app as
|
|
160
|
+
this.#current$.next(app as CurrentApp);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
public clearCurrentApp(): void {
|
|
@@ -166,8 +166,10 @@ export class AppModuleProvider {
|
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
168
|
* This should not be used, only for legacy creation backdoor
|
|
169
|
+
* @deprecated
|
|
169
170
|
*/
|
|
170
171
|
public createApp(value: AppBundleStateInitial): App {
|
|
172
|
+
console.warn();
|
|
171
173
|
return new App(value, { provider: this, event: this.#event });
|
|
172
174
|
}
|
|
173
175
|
|
package/src/app/App.ts
CHANGED
|
@@ -25,8 +25,47 @@ export function filterEmpty<T>(): OperatorFunction<T | null | undefined, T> {
|
|
|
25
25
|
return filter((value): value is T => value !== undefined && value !== null);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
// TODO add comments!
|
|
28
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
-
export
|
|
30
|
+
export interface IApp<TEnv = any, TModules extends Array<AnyModule> | unknown = unknown> {
|
|
31
|
+
get manifest$(): Observable<AppManifest>;
|
|
32
|
+
get config$(): Observable<AppConfig<TEnv>>;
|
|
33
|
+
get modules$(): Observable<AppScriptModule>;
|
|
34
|
+
get instance$(): Observable<AppModulesInstance<TModules>>;
|
|
35
|
+
get state(): AppBundleState;
|
|
36
|
+
get appKey(): string;
|
|
37
|
+
get manifest(): AppManifest | undefined;
|
|
38
|
+
get manifestAsync(): Promise<AppManifest>;
|
|
39
|
+
get config(): AppConfig<TEnv> | undefined;
|
|
40
|
+
get instance(): AppModulesInstance<TModules> | undefined;
|
|
41
|
+
|
|
42
|
+
initialize(): Observable<{
|
|
43
|
+
manifest: AppManifest;
|
|
44
|
+
script: AppScriptModule;
|
|
45
|
+
config: AppConfig;
|
|
46
|
+
}>;
|
|
47
|
+
|
|
48
|
+
loadConfig(): void;
|
|
49
|
+
|
|
50
|
+
loadManifest(): void;
|
|
51
|
+
|
|
52
|
+
loadAppModule(allow_cache?: boolean): void;
|
|
53
|
+
|
|
54
|
+
getConfig(force_refresh?: boolean): Observable<AppConfig>;
|
|
55
|
+
getConfigAsync(allow_cache?: boolean): Promise<AppConfig>;
|
|
56
|
+
|
|
57
|
+
getManifest(force_refresh?: boolean): Observable<AppManifest>;
|
|
58
|
+
getManifestAsync(allow_cache?: boolean): Promise<AppManifest>;
|
|
59
|
+
|
|
60
|
+
getAppModule(force_refresh?: boolean): Observable<AppScriptModule>;
|
|
61
|
+
getAppModuleAsync(allow_cache?: boolean): Promise<AppScriptModule>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// TODO make streams distinct until changed from state
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
66
|
+
export class App<TEnv = any, TModules extends Array<AnyModule> | unknown = unknown>
|
|
67
|
+
implements IApp<TEnv, TModules>
|
|
68
|
+
{
|
|
30
69
|
#state: FlowSubject<AppBundleState, Actions>;
|
|
31
70
|
|
|
32
71
|
//#region === streams ===
|
|
@@ -223,8 +262,12 @@ export class App<TEnv = any, TModules extends Array<AnyModule> | unknown = unkno
|
|
|
223
262
|
this.#state.next(actions.fetchConfig(this.appKey));
|
|
224
263
|
}
|
|
225
264
|
|
|
226
|
-
public loadManifest() {
|
|
227
|
-
this.#state.next(actions.fetchManifest(this.appKey));
|
|
265
|
+
public loadManifest(update?: boolean) {
|
|
266
|
+
this.#state.next(actions.fetchManifest(this.appKey, update));
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
public updateManifest(manifest: AppManifest, replace?: false) {
|
|
270
|
+
this.#state.next(actions.setManifest(manifest, !replace));
|
|
228
271
|
}
|
|
229
272
|
|
|
230
273
|
public async loadAppModule(allow_cache = true) {
|
package/src/app/actions.ts
CHANGED
|
@@ -8,13 +8,18 @@ import { AppConfig, AppManifest, AppModulesInstance, AppScriptModule } from '../
|
|
|
8
8
|
|
|
9
9
|
const createActions = () => ({
|
|
10
10
|
/** Manifest loading */
|
|
11
|
-
setManifest: createAction('set_manifest', (manifest: AppManifest) => ({
|
|
11
|
+
setManifest: createAction('set_manifest', (manifest: AppManifest, update?: boolean) => ({
|
|
12
12
|
payload: manifest,
|
|
13
|
-
meta: {
|
|
13
|
+
meta: {
|
|
14
|
+
// TODO when updating
|
|
15
|
+
created: Date.now(),
|
|
16
|
+
update,
|
|
17
|
+
},
|
|
14
18
|
})),
|
|
19
|
+
|
|
15
20
|
fetchManifest: createAsyncAction(
|
|
16
21
|
'fetch_manifest',
|
|
17
|
-
(key: string) => ({ payload: key }),
|
|
22
|
+
(key: string, update?: boolean) => ({ payload: key, meta: { update } }),
|
|
18
23
|
(manifest: AppManifest) => ({ payload: manifest }),
|
|
19
24
|
(error: unknown) => ({ payload: error })
|
|
20
25
|
),
|
|
@@ -17,7 +17,11 @@ export const createReducer = (value: AppBundleStateInitial) =>
|
|
|
17
17
|
makeReducer({ ...value, status: new Set() } as AppBundleState, (builder) =>
|
|
18
18
|
builder
|
|
19
19
|
.addCase(actions.setManifest, (state, action) => {
|
|
20
|
-
|
|
20
|
+
if (action.meta.update) {
|
|
21
|
+
state.manifest = { ...state.manifest, ...action.payload };
|
|
22
|
+
} else {
|
|
23
|
+
state.manifest = action.payload;
|
|
24
|
+
}
|
|
21
25
|
})
|
|
22
26
|
.addCase(actions.setConfig, (state, action) => {
|
|
23
27
|
state.config = action.payload;
|
package/src/app/flows.ts
CHANGED
|
@@ -13,10 +13,10 @@ export const handleFetchManifest =
|
|
|
13
13
|
(action$) =>
|
|
14
14
|
action$.pipe(
|
|
15
15
|
filter(actions.fetchManifest.match),
|
|
16
|
-
switchMap(({ payload: appKey }) => {
|
|
16
|
+
switchMap(({ payload: appKey, meta: { update } }) => {
|
|
17
17
|
const fetch$ = from(provider.getAppManifest(appKey)).pipe(
|
|
18
18
|
filter((x) => !!x),
|
|
19
|
-
map(actions.setManifest)
|
|
19
|
+
map((manifest) => actions.setManifest(manifest, update))
|
|
20
20
|
);
|
|
21
21
|
return merge(
|
|
22
22
|
fetch$,
|
package/src/app/index.ts
CHANGED
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { EventModule } from '@equinor/fusion-framework-module-event';
|
|
|
3
3
|
import type { HttpModule } from '@equinor/fusion-framework-module-http';
|
|
4
4
|
import { MsalModule } from '@equinor/fusion-framework-module-msal';
|
|
5
5
|
import type { ServiceDiscoveryModule } from '@equinor/fusion-framework-module-service-discovery';
|
|
6
|
-
import
|
|
6
|
+
import IApp from './app';
|
|
7
7
|
|
|
8
8
|
// TODO
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -21,8 +21,9 @@ export type ModuleDeps = [HttpModule, ServiceDiscoveryModule, EventModule];
|
|
|
21
21
|
|
|
22
22
|
export type AppType = 'standalone' | 'report' | 'launcher';
|
|
23
23
|
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
25
|
export type CurrentApp<TModules extends Array<AnyModule> = [], TEnv = any> =
|
|
25
|
-
|
|
|
26
|
+
| IApp<TEnv, TModules>
|
|
26
27
|
| null
|
|
27
28
|
| undefined;
|
|
28
29
|
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Equinor
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|