@equinor/fusion-framework-app 10.4.10-next.0 → 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 +44 -11
- 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/esm/version.js.map +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/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,53 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 11.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- abffa53: Major version bump for Fusion Framework React 19 release.
|
|
8
|
+
|
|
9
|
+
All packages are bumped to the next major version as part of the React 19 upgrade. This release drops support for React versions below 18 and includes breaking changes across the framework.
|
|
10
|
+
|
|
11
|
+
**Breaking changes:**
|
|
12
|
+
- Peer dependencies now require React 18 or 19 (`^18.0.0 || ^19.0.0`)
|
|
13
|
+
- React Router upgraded from v6 to v7
|
|
14
|
+
- Navigation module refactored with new history API
|
|
15
|
+
- `renderComponent` and `renderApp` now use `createRoot` API
|
|
16
|
+
|
|
17
|
+
**Migration:**
|
|
18
|
+
- Update your React version to 18.0.0 or higher before upgrading
|
|
19
|
+
- Replace `NavigationProvider.createRouter()` with `@equinor/fusion-framework-react-router`
|
|
20
|
+
- See individual package changelogs for package-specific migration steps
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
6
23
|
|
|
7
|
-
-
|
|
24
|
+
- aaa3f74: fix(security): address undici multiple vulnerabilities (CVE-2026-1524, 1527, 1528, 2581)
|
|
25
|
+
|
|
26
|
+
Upgrade undici from 7.22.0 to 7.24.3 to fix multiple security vulnerabilities affecting WebSocket parsing, HTTP header validation, and request deduplication:
|
|
27
|
+
- **CVE-2026-1528** (HIGH): WebSocket 64-bit length integer overflow causing process crash
|
|
28
|
+
- **CVE-2026-1524** (MODERATE): HTTP/1.1 response field header injection
|
|
29
|
+
- **CVE-2026-1527** (MODERATE): CRLF injection via upgrade option enabling protocol smuggling
|
|
30
|
+
- **CVE-2026-2581** (MODERATE): Unbounded memory consumption in deduplication handler
|
|
31
|
+
|
|
32
|
+
These are non-breaking security patches that harden undici against untrusted upstream endpoints and malicious WebSocket frames.
|
|
33
|
+
|
|
34
|
+
**Advisories**: GHSA-f269-vfmq-vjvj, GHSA-v9p9-hfj2-hcw8, GHSA-4992-7rv2-5pvq, GHSA-phc3-fgpg-7m6h
|
|
35
|
+
**Fixed in**: undici 7.24.0+ (deployed 7.24.3)
|
|
8
36
|
|
|
9
|
-
- Updated dependencies [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- @equinor/fusion-framework
|
|
16
|
-
- @equinor/fusion-framework-module@
|
|
17
|
-
- @equinor/fusion-framework-module-
|
|
37
|
+
- Updated dependencies [abffa53]
|
|
38
|
+
- Updated dependencies [abffa53]
|
|
39
|
+
- Updated dependencies [abffa53]
|
|
40
|
+
- Updated dependencies [abffa53]
|
|
41
|
+
- Updated dependencies [aaa3f74]
|
|
42
|
+
- Updated dependencies [abffa53]
|
|
43
|
+
- @equinor/fusion-framework@8.0.0
|
|
44
|
+
- @equinor/fusion-framework-module@6.0.0
|
|
45
|
+
- @equinor/fusion-framework-module-app@8.0.0
|
|
46
|
+
- @equinor/fusion-framework-module-bookmark@4.0.0
|
|
47
|
+
- @equinor/fusion-framework-module-event@6.0.0
|
|
48
|
+
- @equinor/fusion-framework-module-http@8.0.0
|
|
49
|
+
- @equinor/fusion-framework-module-msal@8.0.0
|
|
50
|
+
- @equinor/fusion-framework-module-telemetry@5.0.0
|
|
18
51
|
|
|
19
52
|
## 10.4.9
|
|
20
53
|
|
package/README.md
CHANGED
|
@@ -1,32 +1,176 @@
|
|
|
1
1
|
# @equinor/fusion-framework-app
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Configuration and initialization layer for Fusion applications.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Use this package to set up application modules, configure HTTP clients, integrate
|
|
6
|
+
with service discovery, enable bookmarks, and wire up telemetry — all with a
|
|
7
|
+
single `configureModules` call.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
> **Most Fusion apps should use `@equinor/fusion-framework-react-app` instead.**
|
|
10
|
+
> This lower-level package is for framework-agnostic or advanced scenarios.
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
## Installation
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
```sh
|
|
15
|
+
pnpm add @equinor/fusion-framework-app
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { configureModules } from '@equinor/fusion-framework-app';
|
|
22
|
+
|
|
23
|
+
// Create an initializer with custom configuration
|
|
24
|
+
const initialize = configureModules((configurator, { fusion, env }) => {
|
|
25
|
+
// Register a named HTTP client
|
|
26
|
+
configurator.configureHttpClient('myApi', {
|
|
27
|
+
baseUri: 'https://api.example.com',
|
|
28
|
+
defaultScopes: ['api://client-id/.default'],
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Bootstrap the application
|
|
33
|
+
const modules = await initialize({ fusion, env });
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Key Concepts
|
|
37
|
+
|
|
38
|
+
| Concept | Description |
|
|
39
|
+
|---|---|
|
|
40
|
+
| `configureModules` | Factory function that creates an async initializer for application modules. |
|
|
41
|
+
| `AppConfigurator` | Internal configurator created by `configureModules`; registers default modules (`event`, `http`, `msal`) and reads endpoint config. |
|
|
42
|
+
| `IAppConfigurator` | Public interface for the configurator, used when typing configuration callbacks. |
|
|
43
|
+
| `AppModuleInitiator` | Callback signature accepted by `configureModules` for user-supplied setup. |
|
|
44
|
+
| `AppEnv` | Environment descriptor containing the app manifest, config, and optional basename. |
|
|
45
|
+
| `enableBookmark` | Helper to enable the bookmark module (import from `@equinor/fusion-framework-app/enable-bookmark`). |
|
|
46
|
+
|
|
47
|
+
## API Surface
|
|
48
|
+
|
|
49
|
+
### `configureModules(cb?)`
|
|
50
|
+
|
|
51
|
+
Returns an async initializer `(args: { fusion, env }) => Promise<AppModulesInstance>`.
|
|
52
|
+
|
|
53
|
+
The optional callback receives an `IAppConfigurator` and the Fusion/env args,
|
|
54
|
+
giving you access to:
|
|
55
|
+
|
|
56
|
+
- **`configurator.configureHttpClient(name, options)`** — register a named HTTP client with explicit base URI and scopes.
|
|
57
|
+
- **`configurator.configureHttp(...)`** — low-level HTTP module configuration.
|
|
58
|
+
- **`configurator.useFrameworkServiceClient(serviceName, options?)`** — register a client resolved via Fusion service discovery.
|
|
59
|
+
|
|
60
|
+
### Sub-path Exports
|
|
61
|
+
|
|
62
|
+
| Export path | What it provides |
|
|
63
|
+
|---|---|
|
|
64
|
+
| `@equinor/fusion-framework-app` | `configureModules`, `AppConfigurator`, `IAppConfigurator`, all type aliases |
|
|
65
|
+
| `@equinor/fusion-framework-app/enable-bookmark` | `enableBookmark` function |
|
|
66
|
+
|
|
67
|
+
## Configure HTTP Clients
|
|
68
|
+
|
|
69
|
+
The `AppConfigurator` can register named HTTP clients from several sources.
|
|
70
|
+
You retrieve a client at runtime with `framework.modules.http.createClient(name)`.
|
|
71
|
+
|
|
72
|
+
### From Application Config (auto-registration)
|
|
73
|
+
|
|
74
|
+
Endpoints defined in `app.config.<env>.ts` are **automatically registered as
|
|
75
|
+
named HTTP clients** when the `AppConfigurator` is created — no extra code
|
|
76
|
+
needed in `config.ts`.
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
// app.config.ts
|
|
80
|
+
import { defineAppConfig } from '@equinor/fusion-framework-cli/app';
|
|
81
|
+
|
|
82
|
+
export default defineAppConfig(() => ({
|
|
83
|
+
endpoints: {
|
|
84
|
+
schedule: {
|
|
85
|
+
url: 'https://schedule-api.example.com',
|
|
86
|
+
scopes: ['api://schedule-id/.default'],
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
}));
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
After initialization, use the client directly:
|
|
13
93
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
>
|
|
19
|
-
> _We might in the future allow application configure their own module, but for now, use the enabler in the app package_
|
|
94
|
+
```ts
|
|
95
|
+
const client = framework.modules.http.createClient('schedule');
|
|
96
|
+
const data = await client.json('/items');
|
|
97
|
+
```
|
|
20
98
|
|
|
21
|
-
###
|
|
99
|
+
### Via Service Discovery
|
|
22
100
|
|
|
23
101
|
```ts
|
|
24
|
-
|
|
102
|
+
const initialize = configureModules((configurator) => {
|
|
103
|
+
configurator.useFrameworkServiceClient('people');
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Explicit Registration
|
|
25
108
|
|
|
26
|
-
|
|
109
|
+
Use `configureHttpClient` in `config.ts` when the endpoint is **not** in
|
|
110
|
+
`app.config.ts`, or when you need custom transport behavior such as headers,
|
|
111
|
+
response guards, or a custom client class.
|
|
27
112
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
113
|
+
```ts
|
|
114
|
+
configurator.configureHttpClient('custom-api', {
|
|
115
|
+
baseUri: 'https://custom.api.example.com',
|
|
116
|
+
defaultScopes: ['api://custom-id/.default'],
|
|
117
|
+
onCreate: (client) => {
|
|
118
|
+
client.requestHandler.setHeader('X-Source', 'portal');
|
|
119
|
+
},
|
|
120
|
+
});
|
|
31
121
|
```
|
|
32
122
|
|
|
123
|
+
### Resolution Priority
|
|
124
|
+
|
|
125
|
+
When the same client name is configured in more than one place, the
|
|
126
|
+
highest-priority source wins:
|
|
127
|
+
|
|
128
|
+
| Priority | Source | Example |
|
|
129
|
+
|----------|--------|---------|
|
|
130
|
+
| 1 (highest) | **Session overrides** | User-specific URL / scopes set at runtime via `sessionStorage` |
|
|
131
|
+
| 2 | **Application config endpoints** | `endpoints` in `app.config.ts` |
|
|
132
|
+
| 3 | **Service-discovery registry** | Resolved via `useFrameworkServiceClient` |
|
|
133
|
+
| 4 (lowest) | **Explicit registration** | `configureHttpClient(name, options)` in `config.ts` |
|
|
134
|
+
|
|
135
|
+
This means an endpoint defined in `app.config.ts` will override a
|
|
136
|
+
`configureHttpClient` call for the same name, and a session override will
|
|
137
|
+
override both.
|
|
138
|
+
|
|
139
|
+
## Enable Bookmarks
|
|
140
|
+
|
|
141
|
+
The bookmark module allows applications to save and restore application state.
|
|
142
|
+
|
|
143
|
+
> **Important:** Import `enableBookmark` from the app-level package, not from
|
|
144
|
+
> `@equinor/fusion-framework-module-bookmark` directly.
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
import { configureModules } from '@equinor/fusion-framework-app';
|
|
148
|
+
import { enableBookmark } from '@equinor/fusion-framework-app/enable-bookmark';
|
|
149
|
+
|
|
150
|
+
const initialize = configureModules((configurator) => {
|
|
151
|
+
enableBookmark(configurator);
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Payload generators registered through the bookmark module are automatically
|
|
156
|
+
cleaned up when the module is disposed.
|
|
157
|
+
|
|
158
|
+
## Types
|
|
159
|
+
|
|
160
|
+
| Type | Purpose |
|
|
161
|
+
|---|---|
|
|
162
|
+
| `AppEnv` | Environment descriptor (manifest, config, basename, props) |
|
|
163
|
+
| `AppModuleInitiator` | Configuration callback signature for `configureModules` |
|
|
164
|
+
| `AppModuleInit` | Full factory type wrapping `AppModuleInitiator` |
|
|
165
|
+
| `AppModuleInitArgs` | Arguments passed to the returned initializer |
|
|
166
|
+
| `AppRenderFn` | Render function for mounting an app into a DOM element |
|
|
167
|
+
| `AppManifest` | Application manifest metadata (re-export) |
|
|
168
|
+
| `AppConfig` | Environment-specific config (re-export) |
|
|
169
|
+
| `AppModules` | Union of default application modules (re-export) |
|
|
170
|
+
| `AppModulesInstance` | Resolved module instances after initialization (re-export) |
|
|
171
|
+
|
|
172
|
+
## Further Reading
|
|
173
|
+
|
|
174
|
+
- [Fusion Framework documentation](https://equinor.github.io/fusion-framework/)
|
|
175
|
+
- [`@equinor/fusion-framework-react-app`](../react/app/) — React wrapper with hooks and providers
|
|
176
|
+
|
|
@@ -2,6 +2,28 @@ import { ModulesConfigurator, } from '@equinor/fusion-framework-module';
|
|
|
2
2
|
import event from '@equinor/fusion-framework-module-event';
|
|
3
3
|
import http, { configureHttpClient, configureHttp, } from '@equinor/fusion-framework-module-http';
|
|
4
4
|
import auth from '@equinor/fusion-framework-module-msal';
|
|
5
|
+
/**
|
|
6
|
+
* Configurator that bootstraps default Fusion application modules and provides
|
|
7
|
+
* helper methods for HTTP client and service-discovery setup.
|
|
8
|
+
*
|
|
9
|
+
* `AppConfigurator` is created internally by {@link configureModules}. It registers
|
|
10
|
+
* the `event`, `http`, and `msal` (auth) modules by default and reads any HTTP
|
|
11
|
+
* endpoints declared in the application’s environment config.
|
|
12
|
+
*
|
|
13
|
+
* @template TModules - Additional application-specific modules beyond the defaults.
|
|
14
|
+
* @template TRef - The resolved Fusion modules instance used as an initialization reference.
|
|
15
|
+
* @template TEnv - The application environment descriptor (manifest, config, basename).
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* // Typically used indirectly via configureModules:
|
|
20
|
+
* import { configureModules } from '@equinor/fusion-framework-app';
|
|
21
|
+
*
|
|
22
|
+
* const initialize = configureModules((configurator) => {
|
|
23
|
+
* configurator.useFrameworkServiceClient('my-service');
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
5
27
|
export class AppConfigurator extends ModulesConfigurator {
|
|
6
28
|
env;
|
|
7
29
|
/**
|
|
@@ -9,14 +31,25 @@ export class AppConfigurator extends ModulesConfigurator {
|
|
|
9
31
|
* the name is preserved through compilation and minification.
|
|
10
32
|
*/
|
|
11
33
|
static className = 'AppConfigurator';
|
|
12
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Create an application configurator with default modules and environment.
|
|
36
|
+
*
|
|
37
|
+
* Registers the `event`, `http`, and `msal` modules and pre-configures any
|
|
38
|
+
* HTTP clients declared in `env.config.endpoints`.
|
|
39
|
+
*
|
|
40
|
+
* @param env - The application environment containing manifest, config, and optional basename.
|
|
41
|
+
*/
|
|
13
42
|
constructor(env) {
|
|
14
43
|
super([event, http, auth]);
|
|
15
44
|
this.env = env;
|
|
16
45
|
this._configureHttpClientsFromAppConfig();
|
|
17
46
|
}
|
|
18
47
|
/**
|
|
19
|
-
*
|
|
48
|
+
* Read HTTP endpoint definitions from the application config and register each
|
|
49
|
+
* one as a named HTTP client.
|
|
50
|
+
*
|
|
51
|
+
* Iterates over `env.config.endpoints` and calls
|
|
52
|
+
* {@link IAppConfigurator.configureHttpClient | configureHttpClient} for each entry.
|
|
20
53
|
*/
|
|
21
54
|
_configureHttpClientsFromAppConfig() {
|
|
22
55
|
const { endpoints = {} } = this.env.config ?? {};
|
|
@@ -27,25 +60,36 @@ export class AppConfigurator extends ModulesConfigurator {
|
|
|
27
60
|
});
|
|
28
61
|
}
|
|
29
62
|
}
|
|
63
|
+
/** {@inheritDoc IAppConfigurator.configureHttp} */
|
|
30
64
|
configureHttp(...args) {
|
|
31
65
|
this.addConfig(configureHttp(...args));
|
|
32
66
|
}
|
|
67
|
+
/** {@inheritDoc IAppConfigurator.configureHttpClient} */
|
|
33
68
|
configureHttpClient(...args) {
|
|
34
69
|
this.addConfig(configureHttpClient(...args));
|
|
35
70
|
}
|
|
36
71
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
72
|
+
* Register a named HTTP client whose base URI and scopes are resolved via
|
|
73
|
+
* Fusion service discovery.
|
|
74
|
+
*
|
|
75
|
+
* Resolution priority (highest wins):
|
|
76
|
+
* 1. Session overrides (user-specific URL / scopes)
|
|
77
|
+
* 2. Application config (`env.config.endpoints`)
|
|
78
|
+
* 3. Service-discovery registry
|
|
79
|
+
*
|
|
80
|
+
* If a client with the same `serviceName` is already registered (e.g. from
|
|
81
|
+
* app config) and the service has **not** been overridden at session level,
|
|
82
|
+
* a warning is logged and the existing configuration is kept.
|
|
41
83
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
84
|
+
* @param serviceName - Registered name of the service in Fusion service discovery.
|
|
85
|
+
* @param options - Optional HTTP client overrides. `baseUri` and `defaultScopes`
|
|
86
|
+
* are excluded because they come from service discovery.
|
|
87
|
+
* @throws {Error} When the service cannot be resolved from service discovery.
|
|
46
88
|
*
|
|
47
|
-
* @
|
|
48
|
-
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* configurator.useFrameworkServiceClient('my-backend-service');
|
|
92
|
+
* ```
|
|
49
93
|
*/
|
|
50
94
|
useFrameworkServiceClient(serviceName,
|
|
51
95
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppConfigurator.js","sourceRoot":"","sources":["../../src/AppConfigurator.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,mBAAmB,GAC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AAC,GAAG,IAAsC;QAC5D,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,yDAAyD;IAClD,mBAAmB,CAAC,GAAG,IAA4C;QACxE,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACI,yBAAyB,CAC9B,WAAmB;IACnB,8DAA8D;IAC9D,OAAmE;QAEnE,IAAI,CAAC,SAAS,CAAC;YACb,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE;gBAC/B,iEAAiE;gBACjE,MAAM,OAAO,GAAG,MAAM,GAAG,EAAE,gBAAgB,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;gBACxE,IAAI,CAAC,OAAO,EAAE,CAAC;oBACb,MAAM,KAAK,CAAC,gCAAgC,WAAW,GAAG,CAAC,CAAC;gBAC9D,CAAC;gBAED,2EAA2E;gBAC3E,0EAA0E;gBAC1E,uCAAuC;gBACvC,IAAI,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;oBACzD,OAAO,CAAC,IAAI,CACV,GAAG,WAAW;;oCAEU,CACzB,CAAC;oBACF,OAAO;gBACT,CAAC;gBACD,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE;oBAClC,GAAG,OAAO;oBACV,OAAO,EAAE,OAAO,CAAC,GAAG;oBACpB,aAAa,EAAE,OAAO,CAAC,aAAa;iBACrC,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;IACL,CAAC;;AAGH,eAAe,eAAe,CAAC"}
|
|
@@ -1,31 +1,46 @@
|
|
|
1
1
|
import { enableTelemetry, } from '@equinor/fusion-framework-module-telemetry';
|
|
2
2
|
import { AppConfigurator } from './AppConfigurator';
|
|
3
3
|
/**
|
|
4
|
+
* Create an application module initializer for a Fusion application.
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
+
* `configureModules` is the primary entry point for setting up an application’s
|
|
7
|
+
* module pipeline. It returns an async function that, when called with the Fusion
|
|
8
|
+
* instance and the application environment, will:
|
|
9
|
+
*
|
|
10
|
+
* 1. Create an {@link AppConfigurator} with the provided environment.
|
|
11
|
+
* 2. Wire up telemetry scoped to the application.
|
|
12
|
+
* 3. Invoke the optional user-supplied configuration callback.
|
|
13
|
+
* 4. Initialize all registered modules and dispatch an `onAppModulesLoaded` event.
|
|
14
|
+
*
|
|
15
|
+
* @template TModules - Additional application-specific modules to register.
|
|
16
|
+
* @template TRef - The Fusion instance type, used as a configuration reference.
|
|
17
|
+
* @template TEnv - The application environment descriptor (manifest, config, basename).
|
|
18
|
+
*
|
|
19
|
+
* @param cb - Optional configuration callback invoked before modules are initialized.
|
|
20
|
+
* Use this to register HTTP clients, enable bookmarks, or add custom modules.
|
|
21
|
+
* @returns An async initializer function that accepts `{ fusion, env }` and resolves
|
|
22
|
+
* with the fully initialized application module instance.
|
|
6
23
|
*
|
|
7
24
|
* @example
|
|
8
|
-
```ts
|
|
9
|
-
|
|
10
|
-
configurator.configure(someModule);
|
|
11
|
-
});
|
|
12
|
-
await initialize({ fusion, { manifest, config }});
|
|
13
|
-
```
|
|
14
|
-
* @template TModules Addition modules
|
|
15
|
-
* @template TRef usually undefined, optional references
|
|
16
|
-
* @template TEnv environment object for configuring modules
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { configureModules } from '@equinor/fusion-framework-app';
|
|
17
27
|
*
|
|
18
|
-
*
|
|
28
|
+
* const initialize = configureModules((configurator, { fusion, env }) => {
|
|
29
|
+
* configurator.useFrameworkServiceClient('my-service');
|
|
30
|
+
* });
|
|
19
31
|
*
|
|
20
|
-
*
|
|
32
|
+
* // Later, during app bootstrap:
|
|
33
|
+
* const modules = await initialize({ fusion, env });
|
|
34
|
+
* ```
|
|
21
35
|
*/
|
|
22
36
|
export const configureModules = (cb) =>
|
|
23
37
|
/**
|
|
38
|
+
* Async initializer that bootstraps application modules.
|
|
24
39
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* @param args -
|
|
28
|
-
* @returns initialized
|
|
40
|
+
* @param args - Object containing the Fusion instance and the application environment.
|
|
41
|
+
* @param args.fusion - The active Fusion framework instance.
|
|
42
|
+
* @param args.env - The application environment with manifest, config, and basename.
|
|
43
|
+
* @returns The fully initialized application module instance.
|
|
29
44
|
*/
|
|
30
45
|
async (args) => {
|
|
31
46
|
const { fusion } = args;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure-modules.js","sourceRoot":"","sources":["../../src/configure-modules.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,GAEhB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD
|
|
1
|
+
{"version":3,"file":"configure-modules.js","sourceRoot":"","sources":["../../src/configure-modules.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,GAEhB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAC3B,CAKE,EAA6C,EACmC,EAAE;AACpF;;;;;;;GAOG;AACH,KAAK,EAAE,IAAiC,EAAyC,EAAE;IACjF,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAExB,0BAA0B;IAC1B,MAAM,YAAY,GAAG,IAAI,eAAe,CAAkC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEpF,0EAA0E;IAC1E,MAAM,iBAAiB,GAAsB,GAAG,EAAE;QAChD,OAAO;YACL,MAAM,EAAE;gBACN,IAAI,EAAE,eAAe;gBACrB,GAAG,EAAE;oBACH,GAAG,EAAE,IAAI,CAAC,GA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|
2
|
-
*
|
|
2
|
+
* Enable the bookmark module for a Fusion application.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Adds bookmark support by wiring the portal’s bookmark provider into the
|
|
5
|
+
* application’s module set. Payload generators registered by the application
|
|
6
|
+
* are automatically cleaned up when the module is disposed, preventing memory
|
|
7
|
+
* leaks across application load/unload cycles.
|
|
8
|
+
*
|
|
9
|
+
* Import this function from `@equinor/fusion-framework-app/enable-bookmark` or, for
|
|
10
|
+
* React apps, from `@equinor/fusion-framework-react-app/bookmark`.
|
|
6
11
|
*
|
|
7
12
|
* @remarks
|
|
8
|
-
* The
|
|
9
|
-
*
|
|
13
|
+
* - The portal must expose a bookmark provider on `ref.bookmark`; if it is
|
|
14
|
+
* missing, an error is logged and the module initializes as a no-op.
|
|
15
|
+
* - The `@equinor/fusion-framework-module-bookmark` package must be installed,
|
|
16
|
+
* but do **not** call its `enableBookmark` directly in app code — use this
|
|
17
|
+
* app-level enabler instead.
|
|
18
|
+
*
|
|
19
|
+
* @param config - The application configurator to register the bookmark module on.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { configureModules } from '@equinor/fusion-framework-app';
|
|
24
|
+
* import { enableBookmark } from '@equinor/fusion-framework-app/enable-bookmark';
|
|
25
|
+
*
|
|
26
|
+
* const initialize = configureModules((configurator) => {
|
|
27
|
+
* enableBookmark(configurator);
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
10
30
|
*/
|
|
11
31
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
32
|
export const enableBookmark = (config) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enable-bookmark.js","sourceRoot":"","sources":["../../src/enable-bookmark.ts"],"names":[],"mappings":"AAMA
|
|
1
|
+
{"version":3,"file":"enable-bookmark.js","sourceRoot":"","sources":["../../src/enable-bookmark.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;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CAAC,IAAI,CAAC,CAAC;wBACtB,CAAC;oBACH,CAAC;iBACF,CAAC,CAAC;YACL,CAAC;YACD,OAAO;gBACL,KAAK,MAAM,QAAQ,IAAI,gBAAgB,EAAE,CAAC;oBACxC,QAAQ,EAAE,CAAC;gBACb,CAAC;gBACD,gBAAgB,CAAC,KAAK,EAAE,CAAC;YAC3B,CAAC;SACuB;KAC3B,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
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
|
+
*/
|
|
1
18
|
export { AppConfigurator } from './AppConfigurator';
|
|
2
19
|
export * from './types';
|
|
3
20
|
export { configureModules, default } from './configure-modules';
|
|
4
|
-
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Use {@link configureModules} instead. This alias will be removed in a future major version.
|
|
23
|
+
*/
|
|
5
24
|
export { configureModules as initAppModules } from './configure-modules';
|
|
6
25
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAoB,MAAM,mBAAmB,CAAC;AAEtE,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEhE
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,eAAe,EAAoB,MAAM,mBAAmB,CAAC;AAEtE,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;GAEG;AACH,OAAO,EAAE,gBAAgB,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC"}
|