@equinor/fusion-framework-app 10.4.9 → 11.0.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 +49 -6
- package/README.md +162 -18
- package/dist/esm/AppConfigurator.js +56 -12
- package/dist/esm/AppConfigurator.js.map +1 -1
- package/dist/esm/configure-modules.js +31 -16
- package/dist/esm/configure-modules.js.map +1 -1
- package/dist/esm/enable-bookmark.js +25 -5
- package/dist/esm/enable-bookmark.js.map +1 -1
- package/dist/esm/index.js +20 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/AppConfigurator.d.ts +106 -32
- package/dist/types/configure-modules.d.ts +26 -12
- package/dist/types/enable-bookmark.d.ts +25 -5
- package/dist/types/index.d.ts +20 -0
- package/dist/types/types.d.ts +75 -23
- package/dist/types/version.d.ts +1 -1
- package/package.json +11 -11
- package/src/AppConfigurator.ts +108 -35
- package/src/configure-modules.ts +31 -16
- package/src/enable-bookmark.ts +25 -5
- package/src/index.ts +21 -1
- package/src/types.ts +75 -23
- package/src/version.ts +1 -1
package/src/AppConfigurator.ts
CHANGED
|
@@ -19,43 +19,72 @@ import auth from '@equinor/fusion-framework-module-msal';
|
|
|
19
19
|
import type { AppEnv, AppModules } from './types';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Contract for configuring Fusion application modules.
|
|
23
23
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* `IAppConfigurator` extends the base module configurator with application-specific
|
|
25
|
+
* methods for setting up HTTP clients and integrating with Fusion service discovery.
|
|
26
|
+
* Use this interface when typing configuration callbacks that receive the configurator.
|
|
27
|
+
*
|
|
28
|
+
* @template TModules - Additional application-specific modules to register beyond the defaults.
|
|
29
|
+
* @template TRef - The resolved Fusion modules instance used as a reference during initialization.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* import type { IAppConfigurator } from '@equinor/fusion-framework-app';
|
|
34
|
+
*
|
|
35
|
+
* const configure = (configurator: IAppConfigurator) => {
|
|
36
|
+
* configurator.configureHttpClient('myApi', {
|
|
37
|
+
* baseUri: 'https://api.example.com',
|
|
38
|
+
* defaultScopes: ['api://client-id/.default'],
|
|
39
|
+
* });
|
|
40
|
+
* };
|
|
41
|
+
* ```
|
|
26
42
|
*/
|
|
27
43
|
export interface IAppConfigurator<
|
|
28
44
|
TModules extends Array<AnyModule> | unknown = unknown,
|
|
29
45
|
TRef extends FusionModulesInstance = FusionModulesInstance,
|
|
30
46
|
> extends IModulesConfigurator<AppModules<TModules>, TRef> {
|
|
31
47
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
48
|
+
* Configure the HTTP module with custom settings.
|
|
49
|
+
*
|
|
50
|
+
* Delegates to the framework `configureHttp` helper. Use this when you need
|
|
51
|
+
* low-level control over the HTTP module configuration. For most applications,
|
|
52
|
+
* prefer {@link IAppConfigurator.configureHttpClient | configureHttpClient} instead.
|
|
53
|
+
*
|
|
54
|
+
* @param args - Arguments forwarded to the framework `configureHttp` function.
|
|
34
55
|
*/
|
|
35
56
|
configureHttp(...args: Parameters<typeof configureHttp>): void;
|
|
36
57
|
|
|
37
58
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
59
|
+
* Register a named HTTP client with explicit base URI and authentication scopes.
|
|
60
|
+
*
|
|
61
|
+
* Use this method when the application needs to call a specific API endpoint
|
|
62
|
+
* that is not provided through Fusion service discovery.
|
|
63
|
+
*
|
|
64
|
+
* @param args - Arguments forwarded to the framework `configureHttpClient` function.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* configurator.configureHttpClient('myClient', {
|
|
69
|
+
* baseUri: 'https://foo.bar',
|
|
70
|
+
* defaultScopes: ['api://client-id/.default'],
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
51
74
|
configureHttpClient(...args: Parameters<typeof configureHttpClient>): void;
|
|
52
75
|
|
|
53
76
|
/**
|
|
54
|
-
*
|
|
77
|
+
* Register a named HTTP client resolved through Fusion service discovery.
|
|
55
78
|
*
|
|
56
|
-
*
|
|
79
|
+
* The `serviceName` is looked up in the portal’s service-discovery registry at
|
|
80
|
+
* initialization time. Base URI and default scopes are resolved automatically.
|
|
81
|
+
* Use this instead of {@link IAppConfigurator.configureHttpClient | configureHttpClient}
|
|
82
|
+
* when the service is registered with the Fusion portal.
|
|
57
83
|
*
|
|
58
|
-
* @param serviceName - name of the service
|
|
84
|
+
* @param serviceName - Registered name of the service in Fusion service discovery.
|
|
85
|
+
* @param options - Optional HTTP client overrides (headers, interceptors, etc.).
|
|
86
|
+
* `baseUri` and `defaultScopes` are excluded because they are
|
|
87
|
+
* resolved from service discovery.
|
|
59
88
|
*/
|
|
60
89
|
// TODO - rename
|
|
61
90
|
useFrameworkServiceClient(
|
|
@@ -65,6 +94,28 @@ export interface IAppConfigurator<
|
|
|
65
94
|
): void;
|
|
66
95
|
}
|
|
67
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Configurator that bootstraps default Fusion application modules and provides
|
|
99
|
+
* helper methods for HTTP client and service-discovery setup.
|
|
100
|
+
*
|
|
101
|
+
* `AppConfigurator` is created internally by {@link configureModules}. It registers
|
|
102
|
+
* the `event`, `http`, and `msal` (auth) modules by default and reads any HTTP
|
|
103
|
+
* endpoints declared in the application’s environment config.
|
|
104
|
+
*
|
|
105
|
+
* @template TModules - Additional application-specific modules beyond the defaults.
|
|
106
|
+
* @template TRef - The resolved Fusion modules instance used as an initialization reference.
|
|
107
|
+
* @template TEnv - The application environment descriptor (manifest, config, basename).
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* // Typically used indirectly via configureModules:
|
|
112
|
+
* import { configureModules } from '@equinor/fusion-framework-app';
|
|
113
|
+
*
|
|
114
|
+
* const initialize = configureModules((configurator) => {
|
|
115
|
+
* configurator.useFrameworkServiceClient('my-service');
|
|
116
|
+
* });
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
68
119
|
export class AppConfigurator<
|
|
69
120
|
TModules extends Array<AnyModule> | unknown = unknown,
|
|
70
121
|
TRef extends FusionModulesInstance = FusionModulesInstance,
|
|
@@ -79,7 +130,14 @@ export class AppConfigurator<
|
|
|
79
130
|
*/
|
|
80
131
|
static readonly className: string = 'AppConfigurator';
|
|
81
132
|
|
|
82
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Create an application configurator with default modules and environment.
|
|
135
|
+
*
|
|
136
|
+
* Registers the `event`, `http`, and `msal` modules and pre-configures any
|
|
137
|
+
* HTTP clients declared in `env.config.endpoints`.
|
|
138
|
+
*
|
|
139
|
+
* @param env - The application environment containing manifest, config, and optional basename.
|
|
140
|
+
*/
|
|
83
141
|
constructor(public readonly env: TEnv) {
|
|
84
142
|
super([event, http, auth]);
|
|
85
143
|
|
|
@@ -87,7 +145,11 @@ export class AppConfigurator<
|
|
|
87
145
|
}
|
|
88
146
|
|
|
89
147
|
/**
|
|
90
|
-
*
|
|
148
|
+
* Read HTTP endpoint definitions from the application config and register each
|
|
149
|
+
* one as a named HTTP client.
|
|
150
|
+
*
|
|
151
|
+
* Iterates over `env.config.endpoints` and calls
|
|
152
|
+
* {@link IAppConfigurator.configureHttpClient | configureHttpClient} for each entry.
|
|
91
153
|
*/
|
|
92
154
|
protected _configureHttpClientsFromAppConfig() {
|
|
93
155
|
const { endpoints = {} } = this.env.config ?? {};
|
|
@@ -99,27 +161,38 @@ export class AppConfigurator<
|
|
|
99
161
|
}
|
|
100
162
|
}
|
|
101
163
|
|
|
102
|
-
|
|
164
|
+
/** {@inheritDoc IAppConfigurator.configureHttp} */
|
|
165
|
+
public configureHttp(...args: Parameters<typeof configureHttp>): void {
|
|
103
166
|
this.addConfig(configureHttp(...args));
|
|
104
167
|
}
|
|
105
168
|
|
|
106
|
-
|
|
169
|
+
/** {@inheritDoc IAppConfigurator.configureHttpClient} */
|
|
170
|
+
public configureHttpClient(...args: Parameters<typeof configureHttpClient>): void {
|
|
107
171
|
this.addConfig(configureHttpClient(...args));
|
|
108
172
|
}
|
|
109
173
|
|
|
110
174
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
175
|
+
* Register a named HTTP client whose base URI and scopes are resolved via
|
|
176
|
+
* Fusion service discovery.
|
|
177
|
+
*
|
|
178
|
+
* Resolution priority (highest wins):
|
|
179
|
+
* 1. Session overrides (user-specific URL / scopes)
|
|
180
|
+
* 2. Application config (`env.config.endpoints`)
|
|
181
|
+
* 3. Service-discovery registry
|
|
182
|
+
*
|
|
183
|
+
* If a client with the same `serviceName` is already registered (e.g. from
|
|
184
|
+
* app config) and the service has **not** been overridden at session level,
|
|
185
|
+
* a warning is logged and the existing configuration is kept.
|
|
115
186
|
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
187
|
+
* @param serviceName - Registered name of the service in Fusion service discovery.
|
|
188
|
+
* @param options - Optional HTTP client overrides. `baseUri` and `defaultScopes`
|
|
189
|
+
* are excluded because they come from service discovery.
|
|
190
|
+
* @throws {Error} When the service cannot be resolved from service discovery.
|
|
120
191
|
*
|
|
121
|
-
* @
|
|
122
|
-
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```ts
|
|
194
|
+
* configurator.useFrameworkServiceClient('my-backend-service');
|
|
195
|
+
* ```
|
|
123
196
|
*/
|
|
124
197
|
public useFrameworkServiceClient(
|
|
125
198
|
serviceName: string,
|
package/src/configure-modules.ts
CHANGED
|
@@ -9,23 +9,37 @@ import { AppConfigurator } from './AppConfigurator';
|
|
|
9
9
|
import type { AppModulesInstance, AppModuleInitiator, AppEnv } from './types';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
+
* Create an application module initializer for a Fusion application.
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
+
* `configureModules` is the primary entry point for setting up an application’s
|
|
15
|
+
* module pipeline. It returns an async function that, when called with the Fusion
|
|
16
|
+
* instance and the application environment, will:
|
|
17
|
+
*
|
|
18
|
+
* 1. Create an {@link AppConfigurator} with the provided environment.
|
|
19
|
+
* 2. Wire up telemetry scoped to the application.
|
|
20
|
+
* 3. Invoke the optional user-supplied configuration callback.
|
|
21
|
+
* 4. Initialize all registered modules and dispatch an `onAppModulesLoaded` event.
|
|
22
|
+
*
|
|
23
|
+
* @template TModules - Additional application-specific modules to register.
|
|
24
|
+
* @template TRef - The Fusion instance type, used as a configuration reference.
|
|
25
|
+
* @template TEnv - The application environment descriptor (manifest, config, basename).
|
|
26
|
+
*
|
|
27
|
+
* @param cb - Optional configuration callback invoked before modules are initialized.
|
|
28
|
+
* Use this to register HTTP clients, enable bookmarks, or add custom modules.
|
|
29
|
+
* @returns An async initializer function that accepts `{ fusion, env }` and resolves
|
|
30
|
+
* with the fully initialized application module instance.
|
|
14
31
|
*
|
|
15
32
|
* @example
|
|
16
|
-
```ts
|
|
17
|
-
|
|
18
|
-
configurator.configure(someModule);
|
|
19
|
-
});
|
|
20
|
-
await initialize({ fusion, { manifest, config }});
|
|
21
|
-
```
|
|
22
|
-
* @template TModules Addition modules
|
|
23
|
-
* @template TRef usually undefined, optional references
|
|
24
|
-
* @template TEnv environment object for configuring modules
|
|
33
|
+
* ```ts
|
|
34
|
+
* import { configureModules } from '@equinor/fusion-framework-app';
|
|
25
35
|
*
|
|
26
|
-
*
|
|
36
|
+
* const initialize = configureModules((configurator, { fusion, env }) => {
|
|
37
|
+
* configurator.useFrameworkServiceClient('my-service');
|
|
38
|
+
* });
|
|
27
39
|
*
|
|
28
|
-
*
|
|
40
|
+
* // Later, during app bootstrap:
|
|
41
|
+
* const modules = await initialize({ fusion, env });
|
|
42
|
+
* ```
|
|
29
43
|
*/
|
|
30
44
|
export const configureModules =
|
|
31
45
|
<
|
|
@@ -36,11 +50,12 @@ export const configureModules =
|
|
|
36
50
|
cb?: AppModuleInitiator<TModules, TRef, TEnv>,
|
|
37
51
|
): ((args: { fusion: TRef; env: TEnv }) => Promise<AppModulesInstance<TModules>>) =>
|
|
38
52
|
/**
|
|
53
|
+
* Async initializer that bootstraps application modules.
|
|
39
54
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* @param args -
|
|
43
|
-
* @returns initialized
|
|
55
|
+
* @param args - Object containing the Fusion instance and the application environment.
|
|
56
|
+
* @param args.fusion - The active Fusion framework instance.
|
|
57
|
+
* @param args.env - The application environment with manifest, config, and basename.
|
|
58
|
+
* @returns The fully initialized application module instance.
|
|
44
59
|
*/
|
|
45
60
|
async (args: { fusion: TRef; env: TEnv }): Promise<AppModulesInstance<TModules>> => {
|
|
46
61
|
const { fusion } = args;
|
package/src/enable-bookmark.ts
CHANGED
|
@@ -5,14 +5,34 @@ import type {
|
|
|
5
5
|
import type { IAppConfigurator } from './AppConfigurator';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Enable the bookmark module for a Fusion application.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Adds bookmark support by wiring the portal’s bookmark provider into the
|
|
11
|
+
* application’s module set. Payload generators registered by the application
|
|
12
|
+
* are automatically cleaned up when the module is disposed, preventing memory
|
|
13
|
+
* leaks across application load/unload cycles.
|
|
14
|
+
*
|
|
15
|
+
* Import this function from `@equinor/fusion-framework-app/enable-bookmark` or, for
|
|
16
|
+
* React apps, from `@equinor/fusion-framework-react-app/bookmark`.
|
|
12
17
|
*
|
|
13
18
|
* @remarks
|
|
14
|
-
* The
|
|
15
|
-
*
|
|
19
|
+
* - The portal must expose a bookmark provider on `ref.bookmark`; if it is
|
|
20
|
+
* missing, an error is logged and the module initializes as a no-op.
|
|
21
|
+
* - The `@equinor/fusion-framework-module-bookmark` package must be installed,
|
|
22
|
+
* but do **not** call its `enableBookmark` directly in app code — use this
|
|
23
|
+
* app-level enabler instead.
|
|
24
|
+
*
|
|
25
|
+
* @param config - The application configurator to register the bookmark module on.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* import { configureModules } from '@equinor/fusion-framework-app';
|
|
30
|
+
* import { enableBookmark } from '@equinor/fusion-framework-app/enable-bookmark';
|
|
31
|
+
*
|
|
32
|
+
* const initialize = configureModules((configurator) => {
|
|
33
|
+
* enableBookmark(configurator);
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
16
36
|
*/
|
|
17
37
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
38
|
export const enableBookmark = (config: IAppConfigurator): void => {
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* `@equinor/fusion-framework-app` provides the configuration and initialization
|
|
5
|
+
* layer for Fusion applications. Use this package to set up application modules,
|
|
6
|
+
* configure HTTP clients, enable bookmarks, and integrate with telemetry and
|
|
7
|
+
* service discovery.
|
|
8
|
+
*
|
|
9
|
+
* The main entry points are:
|
|
10
|
+
*
|
|
11
|
+
* - {@link configureModules} — factory that creates an application initializer
|
|
12
|
+
* - {@link AppConfigurator} / {@link IAppConfigurator} — configurator for registering modules and HTTP clients
|
|
13
|
+
* - Type aliases such as {@link AppModuleInitiator}, {@link AppEnv}, and {@link AppRenderFn}
|
|
14
|
+
*
|
|
15
|
+
* Bookmark support is available via the `@equinor/fusion-framework-app/enable-bookmark`
|
|
16
|
+
* sub-path export.
|
|
17
|
+
*/
|
|
18
|
+
|
|
1
19
|
export { AppConfigurator, IAppConfigurator } from './AppConfigurator';
|
|
2
20
|
|
|
3
21
|
export * from './types';
|
|
4
22
|
|
|
5
23
|
export { configureModules, default } from './configure-modules';
|
|
6
24
|
|
|
7
|
-
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Use {@link configureModules} instead. This alias will be removed in a future major version.
|
|
27
|
+
*/
|
|
8
28
|
export { configureModules as initAppModules } from './configure-modules';
|
package/src/types.ts
CHANGED
|
@@ -12,6 +12,14 @@ import type {
|
|
|
12
12
|
import type { IAppConfigurator } from './AppConfigurator';
|
|
13
13
|
import type { ConfigEnvironment } from '@equinor/fusion-framework-module-app';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Re-exported application module types from `@equinor/fusion-framework-module-app`.
|
|
17
|
+
*
|
|
18
|
+
* - `AppModules` — union of default application modules
|
|
19
|
+
* - `AppManifest` — application manifest metadata (app key, version, etc.)
|
|
20
|
+
* - `AppConfig` — environment-specific application configuration
|
|
21
|
+
* - `AppModulesInstance` — resolved module instances after initialization
|
|
22
|
+
*/
|
|
15
23
|
export type {
|
|
16
24
|
AppModules,
|
|
17
25
|
AppManifest,
|
|
@@ -20,26 +28,48 @@ export type {
|
|
|
20
28
|
} from '@equinor/fusion-framework-module-app';
|
|
21
29
|
|
|
22
30
|
/**
|
|
23
|
-
*
|
|
24
|
-
* Arguments provided when initializing/configuring application modules
|
|
31
|
+
* Environment descriptor passed to the application during module initialization.
|
|
25
32
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
33
|
+
* Contains the application manifest, optional config (with endpoint definitions),
|
|
34
|
+
* an optional base path for routing, and optional component props.
|
|
35
|
+
*
|
|
36
|
+
* @template TConfig - Shape of the environment-specific configuration object.
|
|
37
|
+
* @template TProps - Additional properties forwarded to the application component (currently unused).
|
|
28
38
|
*/
|
|
29
39
|
export type AppEnv<TConfig extends ConfigEnvironment = ConfigEnvironment, TProps = unknown> = {
|
|
30
|
-
/**
|
|
40
|
+
/** Base routing path of the application (e.g. `/apps/my-app`). */
|
|
31
41
|
basename?: string;
|
|
42
|
+
/** Application manifest describing the app key, version, and build metadata. */
|
|
32
43
|
manifest: AppManifest;
|
|
44
|
+
/** Environment-specific configuration with optional endpoint definitions. */
|
|
33
45
|
config?: AppConfig<TConfig>;
|
|
46
|
+
/** Optional properties forwarded to the application component. */
|
|
34
47
|
props?: TProps;
|
|
35
48
|
};
|
|
36
49
|
|
|
37
50
|
/**
|
|
38
|
-
*
|
|
51
|
+
* Configuration callback for setting up application modules.
|
|
52
|
+
*
|
|
53
|
+
* This is the function signature accepted by {@link configureModules}. Implement
|
|
54
|
+
* this callback to register HTTP clients, enable bookmarks, and add custom modules
|
|
55
|
+
* to the application’s module pipeline.
|
|
56
|
+
*
|
|
57
|
+
* @template TModules - Additional modules registered by the application.
|
|
58
|
+
* @template TRef - The Fusion instance type used as a configuration reference.
|
|
59
|
+
* @template TEnv - The application environment descriptor.
|
|
60
|
+
*
|
|
61
|
+
* @param configurator - The application configurator with HTTP and module helpers.
|
|
62
|
+
* @param args - Object containing the Fusion instance and the application environment.
|
|
63
|
+
* @returns `void` or a `Promise<void>` for async configuration steps.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* import type { AppModuleInitiator } from '@equinor/fusion-framework-app';
|
|
39
68
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
69
|
+
* const configure: AppModuleInitiator = (configurator, { fusion, env }) => {
|
|
70
|
+
* configurator.useFrameworkServiceClient('portal-api');
|
|
71
|
+
* };
|
|
72
|
+
* ```
|
|
43
73
|
*/
|
|
44
74
|
export type AppModuleInitiator<
|
|
45
75
|
TModules extends Array<AnyModule> | unknown = unknown,
|
|
@@ -51,11 +81,15 @@ export type AppModuleInitiator<
|
|
|
51
81
|
) => void | Promise<void>;
|
|
52
82
|
|
|
53
83
|
/**
|
|
54
|
-
*
|
|
84
|
+
* Factory type that wraps {@link AppModuleInitiator} into a complete initializer.
|
|
85
|
+
*
|
|
86
|
+
* Accepts a configuration callback and returns an async function that, given the
|
|
87
|
+
* Fusion instance and environment, produces the initialized module instance.
|
|
88
|
+
* This is the signature of the {@link configureModules} function itself.
|
|
55
89
|
*
|
|
56
|
-
* @template TModules
|
|
57
|
-
* @template TRef
|
|
58
|
-
* @template TEnv
|
|
90
|
+
* @template TModules - Additional modules registered by the application.
|
|
91
|
+
* @template TRef - The Fusion instance type used as a configuration reference.
|
|
92
|
+
* @template TEnv - The application environment descriptor.
|
|
59
93
|
*/
|
|
60
94
|
export type AppModuleInit<
|
|
61
95
|
TModules extends Array<AnyModule> | unknown = [],
|
|
@@ -65,26 +99,44 @@ export type AppModuleInit<
|
|
|
65
99
|
cb: AppModuleInitiator<TModules, TRef, TEnv>,
|
|
66
100
|
) => (args: AppModuleInitArgs<TRef, TEnv>) => Promise<AppModulesInstance<TModules>>;
|
|
67
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Arguments passed to the async initializer returned by {@link configureModules}.
|
|
104
|
+
*
|
|
105
|
+
* @template TRef - The Fusion instance type.
|
|
106
|
+
* @template TEnv - The application environment descriptor.
|
|
107
|
+
*/
|
|
68
108
|
export type AppModuleInitArgs<TRef extends Fusion = Fusion, TEnv = AppEnv> = {
|
|
69
109
|
fusion: TRef;
|
|
70
110
|
env: TEnv;
|
|
71
111
|
};
|
|
72
112
|
|
|
73
113
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
114
|
+
* Render function signature for mounting a Fusion application into the DOM.
|
|
115
|
+
*
|
|
116
|
+
* Called by the Fusion portal or dev-server to render the application. The
|
|
117
|
+
* function receives the root element and render arguments (Fusion instance,
|
|
118
|
+
* environment, and modules) and optionally returns a cleanup function that
|
|
119
|
+
* is invoked when the application is unmounted.
|
|
78
120
|
*
|
|
79
|
-
* @
|
|
80
|
-
* @
|
|
81
|
-
*
|
|
121
|
+
* @template TFusion - The Fusion instance type providing framework modules.
|
|
122
|
+
* @template TEnv - The application environment descriptor.
|
|
123
|
+
*
|
|
124
|
+
* @param el - The root HTML element where the application will be rendered.
|
|
125
|
+
* @param args - Render arguments including the Fusion instance, environment,
|
|
126
|
+
* and resolved modules.
|
|
127
|
+
* @returns A cleanup / teardown function, or `void` if no cleanup is needed.
|
|
82
128
|
*
|
|
83
129
|
* @example
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
130
|
+
* ```ts
|
|
131
|
+
* import type { AppRenderFn } from '@equinor/fusion-framework-app';
|
|
132
|
+
* import { createRoot } from 'react-dom/client';
|
|
133
|
+
*
|
|
134
|
+
* export const renderApp: AppRenderFn = (el, args) => {
|
|
135
|
+
* const root = createRoot(el);
|
|
136
|
+
* root.render(<App />);
|
|
137
|
+
* return () => root.unmount();
|
|
87
138
|
* };
|
|
139
|
+
* ```
|
|
88
140
|
*/
|
|
89
141
|
export type AppRenderFn<TFusion extends Fusion = Fusion, TEnv = AppEnv> = (
|
|
90
142
|
el: HTMLHtmlElement,
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '
|
|
2
|
+
export const version = '11.0.0';
|