@equinor/fusion-framework-module-app 0.0.0-next-20230915111233
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/.turbo/turbo-build.log +4 -0
- package/CHANGELOG.md +555 -0
- package/LICENSE +21 -0
- package/dist/esm/AppConfigBuilder.js +57 -0
- package/dist/esm/AppConfigBuilder.js.map +1 -0
- package/dist/esm/AppConfigurator.js +82 -0
- package/dist/esm/AppConfigurator.js.map +1 -0
- package/dist/esm/AppModuleProvider.js +104 -0
- package/dist/esm/AppModuleProvider.js.map +1 -0
- package/dist/esm/app/App.js +250 -0
- package/dist/esm/app/App.js.map +1 -0
- package/dist/esm/app/actions.js +21 -0
- package/dist/esm/app/actions.js.map +1 -0
- package/dist/esm/app/create-reducer.js +30 -0
- package/dist/esm/app/create-reducer.js.map +1 -0
- package/dist/esm/app/create-state.js +12 -0
- package/dist/esm/app/create-state.js.map +1 -0
- package/dist/esm/app/events.js +2 -0
- package/dist/esm/app/events.js.map +1 -0
- package/dist/esm/app/flows.js +17 -0
- package/dist/esm/app/flows.js.map +1 -0
- package/dist/esm/app/index.js +3 -0
- package/dist/esm/app/index.js.map +1 -0
- package/dist/esm/app/types.js +2 -0
- package/dist/esm/app/types.js.map +1 -0
- package/dist/esm/enable-app-module.js +10 -0
- package/dist/esm/enable-app-module.js.map +1 -0
- package/dist/esm/errors.js +37 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/events.js +2 -0
- package/dist/esm/events.js.map +1 -0
- package/dist/esm/helpers.js +2 -0
- package/dist/esm/helpers.js.map +1 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/module.js +26 -0
- package/dist/esm/module.js.map +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/version.js +2 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/AppConfigBuilder.d.ts +26 -0
- package/dist/types/AppConfigurator.d.ts +28 -0
- package/dist/types/AppModuleProvider.d.ts +29 -0
- package/dist/types/app/App.d.ts +70 -0
- package/dist/types/app/actions.d.ts +60 -0
- package/dist/types/app/create-reducer.d.ts +3 -0
- package/dist/types/app/create-state.d.ts +5 -0
- package/dist/types/app/events.d.ts +28 -0
- package/dist/types/app/flows.d.ts +7 -0
- package/dist/types/app/index.d.ts +2 -0
- package/dist/types/app/types.d.ts +10 -0
- package/dist/types/enable-app-module.d.ts +3 -0
- package/dist/types/errors.d.ts +16 -0
- package/dist/types/events.d.ts +11 -0
- package/dist/types/helpers.d.ts +2 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/module.d.ts +13 -0
- package/dist/types/types.d.ts +73 -0
- package/dist/types/version.d.ts +1 -0
- package/package.json +50 -0
- package/src/AppConfigBuilder.ts +89 -0
- package/src/AppConfigurator.ts +104 -0
- package/src/AppModuleProvider.ts +181 -0
- package/src/app/App.ts +399 -0
- package/src/app/actions.ts +63 -0
- package/src/app/create-reducer.ts +45 -0
- package/src/app/create-state.ts +21 -0
- package/src/app/events.ts +67 -0
- package/src/app/flows.ts +61 -0
- package/src/app/index.ts +3 -0
- package/src/app/types.ts +17 -0
- package/src/enable-app-module.ts +21 -0
- package/src/errors.ts +65 -0
- package/src/events.ts +18 -0
- package/src/helpers.ts +4 -0
- package/src/index.ts +16 -0
- package/src/module.ts +30 -0
- package/src/types.ts +95 -0
- package/src/version.ts +2 -0
- package/tsconfig.json +33 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FlowSubject } from '@equinor/fusion-observable';
|
|
2
|
+
|
|
3
|
+
import { createReducer } from './create-reducer';
|
|
4
|
+
|
|
5
|
+
import { handleFetchManifest, handleFetchConfig, handleImportApplication } from './flows';
|
|
6
|
+
|
|
7
|
+
import type { Actions } from './actions';
|
|
8
|
+
import type { AppBundleState, AppBundleStateInitial } from './types';
|
|
9
|
+
import type { AppModuleProvider } from '../AppModuleProvider';
|
|
10
|
+
|
|
11
|
+
export const createState = (
|
|
12
|
+
value: AppBundleStateInitial,
|
|
13
|
+
provider: AppModuleProvider,
|
|
14
|
+
): FlowSubject<AppBundleState, Actions> => {
|
|
15
|
+
const reducer = createReducer(value);
|
|
16
|
+
const state = new FlowSubject<AppBundleState, Actions>(reducer);
|
|
17
|
+
state.addFlow(handleFetchManifest(provider));
|
|
18
|
+
state.addFlow(handleFetchConfig(provider));
|
|
19
|
+
state.addFlow(handleImportApplication());
|
|
20
|
+
return state;
|
|
21
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { FrameworkEvent, FrameworkEventInit } from '@equinor/fusion-framework-module-event';
|
|
2
|
+
|
|
3
|
+
import type { App } from './App';
|
|
4
|
+
|
|
5
|
+
import type { AppConfig, AppManifest, AppModulesInstance } from '../types';
|
|
6
|
+
|
|
7
|
+
/** base event type for applications */
|
|
8
|
+
export type AppEventEventInit<TDetail extends Record<string, unknown> | unknown = unknown> =
|
|
9
|
+
FrameworkEventInit<
|
|
10
|
+
/** additional event details and key of target event */
|
|
11
|
+
TDetail & { appKey: string },
|
|
12
|
+
/** source of the event */
|
|
13
|
+
App
|
|
14
|
+
>;
|
|
15
|
+
|
|
16
|
+
declare module '@equinor/fusion-framework-module-event' {
|
|
17
|
+
interface FrameworkEventMap {
|
|
18
|
+
/** fired when the application has initiated its modules */
|
|
19
|
+
onAppModulesLoaded: FrameworkEvent<
|
|
20
|
+
AppEventEventInit<{
|
|
21
|
+
/** initiated modules for application */
|
|
22
|
+
modules: AppModulesInstance;
|
|
23
|
+
}>
|
|
24
|
+
>;
|
|
25
|
+
|
|
26
|
+
/** fired when the application has loaded corresponding manifest */
|
|
27
|
+
onAppManifestLoaded: FrameworkEvent<
|
|
28
|
+
AppEventEventInit<{
|
|
29
|
+
manifest: AppManifest;
|
|
30
|
+
}>
|
|
31
|
+
>;
|
|
32
|
+
|
|
33
|
+
/** fired when the application has loaded corresponding config */
|
|
34
|
+
onAppConfigLoaded: FrameworkEvent<
|
|
35
|
+
AppEventEventInit<{
|
|
36
|
+
config: AppConfig;
|
|
37
|
+
}>
|
|
38
|
+
>;
|
|
39
|
+
|
|
40
|
+
/** fired when the application has loaded corresponding javascript module */
|
|
41
|
+
onAppScriptLoaded: FrameworkEvent<
|
|
42
|
+
AppEventEventInit<{
|
|
43
|
+
manifest: AppManifest;
|
|
44
|
+
}>
|
|
45
|
+
>;
|
|
46
|
+
|
|
47
|
+
/** fired before application loads manifest, config and script */
|
|
48
|
+
onAppInitialize: FrameworkEvent<AppEventEventInit>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* fired after application has loaded manifest, config and script
|
|
52
|
+
*
|
|
53
|
+
* __note:__ not fired until all loaders has settled (last emit)
|
|
54
|
+
*/
|
|
55
|
+
onAppInitialized: FrameworkEvent<AppEventEventInit>;
|
|
56
|
+
|
|
57
|
+
/** fired when application fails to load either manifest, config and script */
|
|
58
|
+
onAppInitializeFailed: FrameworkEvent<
|
|
59
|
+
AppEventEventInit<{
|
|
60
|
+
error: unknown;
|
|
61
|
+
}>
|
|
62
|
+
>;
|
|
63
|
+
|
|
64
|
+
/** fired when the application is disposed (unmounts) */
|
|
65
|
+
onAppDispose: FrameworkEvent<AppEventEventInit>;
|
|
66
|
+
}
|
|
67
|
+
}
|
package/src/app/flows.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { from, of, merge } from 'rxjs';
|
|
2
|
+
import { catchError, filter, last, map, switchMap } from 'rxjs/operators';
|
|
3
|
+
|
|
4
|
+
import { actions } from './actions';
|
|
5
|
+
|
|
6
|
+
import type { Flow } from '@equinor/fusion-observable';
|
|
7
|
+
import type { AppModuleProvider } from '../AppModuleProvider';
|
|
8
|
+
import type { Actions } from './actions';
|
|
9
|
+
import type { AppBundleState } from './types';
|
|
10
|
+
|
|
11
|
+
export const handleFetchManifest =
|
|
12
|
+
(provider: AppModuleProvider): Flow<Actions, AppBundleState> =>
|
|
13
|
+
(action$) =>
|
|
14
|
+
action$.pipe(
|
|
15
|
+
filter(actions.fetchManifest.match),
|
|
16
|
+
switchMap(({ payload: appKey, meta: { update } }) => {
|
|
17
|
+
const fetch$ = from(provider.getAppManifest(appKey)).pipe(
|
|
18
|
+
filter((x) => !!x),
|
|
19
|
+
map((manifest) => actions.setManifest(manifest, update)),
|
|
20
|
+
);
|
|
21
|
+
return merge(
|
|
22
|
+
fetch$,
|
|
23
|
+
fetch$.pipe(
|
|
24
|
+
last(),
|
|
25
|
+
map(({ payload }) => actions.fetchManifest.success(payload)),
|
|
26
|
+
),
|
|
27
|
+
).pipe(
|
|
28
|
+
catchError((err) => {
|
|
29
|
+
return of(actions.fetchManifest.failure(err));
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export const handleFetchConfig =
|
|
36
|
+
(provider: AppModuleProvider): Flow<Actions, AppBundleState> =>
|
|
37
|
+
(action$) =>
|
|
38
|
+
action$.pipe(
|
|
39
|
+
filter(actions.fetchConfig.match),
|
|
40
|
+
switchMap(({ payload: appKey }) => {
|
|
41
|
+
const fetch$ = from(provider.getAppConfig(appKey)).pipe(map(actions.setConfig));
|
|
42
|
+
return merge(
|
|
43
|
+
fetch$,
|
|
44
|
+
fetch$.pipe(
|
|
45
|
+
last(),
|
|
46
|
+
map(({ payload }) => actions.fetchConfig.success(payload)),
|
|
47
|
+
),
|
|
48
|
+
).pipe(catchError((err) => of(actions.fetchConfig.failure(err))));
|
|
49
|
+
}),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
export const handleImportApplication = (): Flow<Actions, AppBundleState> => (action$) =>
|
|
53
|
+
action$.pipe(
|
|
54
|
+
filter(actions.importApp.match),
|
|
55
|
+
switchMap(({ payload }) => {
|
|
56
|
+
return from(import(payload)).pipe(
|
|
57
|
+
map(actions.importApp.success),
|
|
58
|
+
catchError((err) => of(actions.importApp.failure(err))),
|
|
59
|
+
);
|
|
60
|
+
}),
|
|
61
|
+
);
|
package/src/app/index.ts
ADDED
package/src/app/types.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AppConfig, AppManifest, AppModulesInstance, AppScriptModule } from '../types';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
|
+
export type AppBundleState<TConfig = any, TModules = any> = {
|
|
5
|
+
appKey: string;
|
|
6
|
+
status: Set<string>;
|
|
7
|
+
manifest?: AppManifest;
|
|
8
|
+
config?: AppConfig<TConfig>;
|
|
9
|
+
modules?: AppScriptModule;
|
|
10
|
+
instance?: AppModulesInstance<TModules>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
export type AppBundleStateInitial<TConfig = any, TModules = any> = Omit<
|
|
15
|
+
AppBundleState<TConfig, TModules>,
|
|
16
|
+
'status'
|
|
17
|
+
>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IModulesConfigurator } from '@equinor/fusion-framework-module';
|
|
2
|
+
import type { AppConfigBuilderCallback } from './AppConfigBuilder';
|
|
3
|
+
|
|
4
|
+
import { module } from './module';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Method for enabling the Service module
|
|
8
|
+
* @param configurator - configuration object
|
|
9
|
+
*/
|
|
10
|
+
export const enableAppModule = (
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
+
configurator: IModulesConfigurator<any, any>,
|
|
13
|
+
builder?: AppConfigBuilderCallback,
|
|
14
|
+
): void => {
|
|
15
|
+
configurator.addConfig({
|
|
16
|
+
module,
|
|
17
|
+
configure: (appConfigurator) => {
|
|
18
|
+
builder && appConfigurator.addConfigBuilder(builder);
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
};
|
package/src/errors.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
type AppErrorType = 'not_found' | 'unauthorized' | 'unknown';
|
|
2
|
+
|
|
3
|
+
export class AppManifestError extends Error {
|
|
4
|
+
static fromHttpResponse(response: Response, options?: ErrorOptions) {
|
|
5
|
+
switch (response.status) {
|
|
6
|
+
case 401:
|
|
7
|
+
return new AppManifestError(
|
|
8
|
+
'unauthorized',
|
|
9
|
+
'failed to load application manifest, request not authorized',
|
|
10
|
+
options,
|
|
11
|
+
);
|
|
12
|
+
case 404:
|
|
13
|
+
return new AppManifestError('not_found', 'application manifest not found', options);
|
|
14
|
+
}
|
|
15
|
+
return new AppManifestError(
|
|
16
|
+
'unknown',
|
|
17
|
+
`failed to load application manifest, status code ${response.status}`,
|
|
18
|
+
options,
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
constructor(
|
|
22
|
+
public readonly type: AppErrorType,
|
|
23
|
+
message?: string,
|
|
24
|
+
options?: ErrorOptions,
|
|
25
|
+
) {
|
|
26
|
+
super(message, options);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export class AppConfigError extends Error {
|
|
31
|
+
static fromHttpResponse(response: Response, options?: ErrorOptions) {
|
|
32
|
+
switch (response.status) {
|
|
33
|
+
case 401:
|
|
34
|
+
return new AppConfigError(
|
|
35
|
+
'unauthorized',
|
|
36
|
+
'failed to load application config, request not authorized',
|
|
37
|
+
options,
|
|
38
|
+
);
|
|
39
|
+
case 404:
|
|
40
|
+
return new AppConfigError('not_found', 'application config not found', options);
|
|
41
|
+
}
|
|
42
|
+
return new AppConfigError(
|
|
43
|
+
'unknown',
|
|
44
|
+
`failed to load application config, status code ${response.status}`,
|
|
45
|
+
options,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
constructor(
|
|
49
|
+
public readonly type: AppErrorType,
|
|
50
|
+
message?: string,
|
|
51
|
+
options?: ErrorOptions,
|
|
52
|
+
) {
|
|
53
|
+
super(message, options);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export class AppScriptModuleError extends Error {
|
|
58
|
+
constructor(
|
|
59
|
+
public readonly type: AppErrorType,
|
|
60
|
+
message?: string,
|
|
61
|
+
options?: ErrorOptions,
|
|
62
|
+
) {
|
|
63
|
+
super(message, options);
|
|
64
|
+
}
|
|
65
|
+
}
|
package/src/events.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FrameworkEvent, FrameworkEventInit } from '@equinor/fusion-framework-module-event';
|
|
2
|
+
import { App } from './app/App';
|
|
3
|
+
|
|
4
|
+
import './app/events';
|
|
5
|
+
|
|
6
|
+
declare module '@equinor/fusion-framework-module-event' {
|
|
7
|
+
interface FrameworkEventMap {
|
|
8
|
+
/** fired when the current selected application changes */
|
|
9
|
+
onCurrentAppChanged: FrameworkEvent<
|
|
10
|
+
FrameworkEventInit<{
|
|
11
|
+
/** current application */
|
|
12
|
+
next?: App;
|
|
13
|
+
/** previous application */
|
|
14
|
+
previous?: App;
|
|
15
|
+
}>
|
|
16
|
+
>;
|
|
17
|
+
}
|
|
18
|
+
}
|
package/src/helpers.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export {
|
|
2
|
+
AppModuleConfig,
|
|
3
|
+
AppConfigurator,
|
|
4
|
+
IAppConfigurator,
|
|
5
|
+
AppModuleConfig as IAppModuleConfig,
|
|
6
|
+
} from './AppConfigurator';
|
|
7
|
+
export { AppModuleProvider } from './AppModuleProvider';
|
|
8
|
+
|
|
9
|
+
export { IApp } from './app/App';
|
|
10
|
+
|
|
11
|
+
export * from './events';
|
|
12
|
+
export * from './types';
|
|
13
|
+
|
|
14
|
+
export { enableAppModule } from './enable-app-module';
|
|
15
|
+
|
|
16
|
+
export { default, AppModule, module, moduleKey } from './module';
|
package/src/module.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Module } from '@equinor/fusion-framework-module';
|
|
2
|
+
import { ModuleDeps } from './types';
|
|
3
|
+
|
|
4
|
+
import { IAppConfigurator, AppConfigurator } from './AppConfigurator';
|
|
5
|
+
import { AppModuleProvider } from './AppModuleProvider';
|
|
6
|
+
|
|
7
|
+
export const moduleKey = 'app';
|
|
8
|
+
|
|
9
|
+
export type AppModule = Module<typeof moduleKey, AppModuleProvider, IAppConfigurator, ModuleDeps>;
|
|
10
|
+
|
|
11
|
+
export const module: AppModule = {
|
|
12
|
+
name: moduleKey,
|
|
13
|
+
configure: () => new AppConfigurator(),
|
|
14
|
+
initialize: async (args) => {
|
|
15
|
+
const config = await (args.config as AppConfigurator).createConfig(args);
|
|
16
|
+
const event = await args.requireInstance('event').catch(() => undefined);
|
|
17
|
+
return new AppModuleProvider({ config, event });
|
|
18
|
+
},
|
|
19
|
+
dispose: (args) => {
|
|
20
|
+
(args.instance as unknown as AppModuleProvider).dispose();
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default module;
|
|
25
|
+
|
|
26
|
+
declare module '@equinor/fusion-framework-module' {
|
|
27
|
+
interface Modules {
|
|
28
|
+
app: AppModule;
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { AnyModule, CombinedModules, ModulesInstance } from '@equinor/fusion-framework-module';
|
|
2
|
+
import type { EventModule } from '@equinor/fusion-framework-module-event';
|
|
3
|
+
import type { HttpModule } from '@equinor/fusion-framework-module-http';
|
|
4
|
+
import type { MsalModule } from '@equinor/fusion-framework-module-msal';
|
|
5
|
+
import type { ServiceDiscoveryModule } from '@equinor/fusion-framework-module-service-discovery';
|
|
6
|
+
import IApp from './app';
|
|
7
|
+
|
|
8
|
+
// TODO
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
type Fusion = any;
|
|
11
|
+
|
|
12
|
+
export type AppEnv<TConfig = unknown, TProps = unknown> = {
|
|
13
|
+
basename?: string;
|
|
14
|
+
manifest?: AppManifest;
|
|
15
|
+
config?: AppConfig<TConfig>;
|
|
16
|
+
props?: TProps;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// TODO: change to module-services when new app service is created
|
|
20
|
+
export type ModuleDeps = [HttpModule, ServiceDiscoveryModule, EventModule];
|
|
21
|
+
|
|
22
|
+
export type AppType = 'standalone' | 'report' | 'launcher';
|
|
23
|
+
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
+
export type CurrentApp<TModules extends Array<AnyModule> = [], TEnv = any> =
|
|
26
|
+
| IApp<TEnv, TModules>
|
|
27
|
+
| null
|
|
28
|
+
| undefined;
|
|
29
|
+
|
|
30
|
+
export type AppAuth = {
|
|
31
|
+
clientId: string;
|
|
32
|
+
resources: string[];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type AppCategory = {
|
|
36
|
+
id?: string;
|
|
37
|
+
name: string | null;
|
|
38
|
+
color: string | null;
|
|
39
|
+
defaultIcon: string | null;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type AppManifest = {
|
|
43
|
+
key: string;
|
|
44
|
+
name: string;
|
|
45
|
+
entry: string;
|
|
46
|
+
version: string;
|
|
47
|
+
shortName?: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
type?: AppType;
|
|
50
|
+
tags?: string[];
|
|
51
|
+
// context?: ContextManifest;
|
|
52
|
+
auth?: AppAuth[];
|
|
53
|
+
icon?: string;
|
|
54
|
+
order?: number;
|
|
55
|
+
publishedDate?: Date;
|
|
56
|
+
accentColor?: string;
|
|
57
|
+
categoryId?: string;
|
|
58
|
+
category?: AppCategory;
|
|
59
|
+
hide?: boolean;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type Endpoint = { name: string; uri: string; scopes?: string[] };
|
|
63
|
+
|
|
64
|
+
export type AppConfig<TEnvironment = unknown> = {
|
|
65
|
+
environment: TEnvironment;
|
|
66
|
+
endpoints: Record<string, string | Endpoint>;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @template TEnvironment - name of hosted environment
|
|
71
|
+
* @template TModule - ES module type (import return type)
|
|
72
|
+
*/
|
|
73
|
+
export type AppBundle<TEnvironment = unknown, TModule = unknown> = {
|
|
74
|
+
manifest: AppManifest;
|
|
75
|
+
config: AppConfig<TEnvironment>;
|
|
76
|
+
module: TModule;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export type AppModules<TModules extends Array<AnyModule> | unknown = unknown> = CombinedModules<
|
|
80
|
+
TModules,
|
|
81
|
+
[EventModule, HttpModule, MsalModule]
|
|
82
|
+
>;
|
|
83
|
+
|
|
84
|
+
export type ComponentRenderArgs<TFusion extends Fusion = Fusion, TEnv = AppEnv> = {
|
|
85
|
+
fusion: TFusion;
|
|
86
|
+
env: TEnv;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export type AppScriptModule = {
|
|
90
|
+
default: (el: HTMLElement, args: ComponentRenderArgs) => VoidFunction;
|
|
91
|
+
renderApp: (el: HTMLElement, args: ComponentRenderArgs) => VoidFunction;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export type AppModulesInstance<TModules extends Array<AnyModule> | unknown = unknown> =
|
|
95
|
+
ModulesInstance<AppModules<TModules>>;
|
package/src/version.ts
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "dist/esm",
|
|
5
|
+
"rootDir": "src",
|
|
6
|
+
"declarationDir": "./dist/types",
|
|
7
|
+
|
|
8
|
+
},
|
|
9
|
+
"references": [
|
|
10
|
+
{
|
|
11
|
+
"path": "../../utils/query"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"path": "../module"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"path": "../http"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"path": "../event"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"path": "../service-discovery"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"include": [
|
|
27
|
+
"src/**/*",
|
|
28
|
+
],
|
|
29
|
+
"exclude": [
|
|
30
|
+
"node_modules",
|
|
31
|
+
"lib"
|
|
32
|
+
]
|
|
33
|
+
}
|