@equinor/fusion-framework 7.4.14-next.0 → 8.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.
@@ -6,9 +6,37 @@ import { enableTelemetry } from '@equinor/fusion-framework-module-telemetry';
6
6
  import type { FusionModules } from './types.js';
7
7
  import type { MsalClientConfig } from '@equinor/fusion-framework-module-msal';
8
8
  /**
9
- * Module configurator for Framework modules
10
- * @template TModules - Addition modules
11
- * @template TRef - usually undefined, optional references
9
+ * Configurator that registers and wires the core Fusion Framework modules.
10
+ *
11
+ * Extend `FrameworkConfigurator` to declare which modules (authentication,
12
+ * HTTP, service-discovery, telemetry, context, …) the framework instance
13
+ * should contain and how each module is configured before the framework
14
+ * starts.
15
+ *
16
+ * Typical workflow:
17
+ * 1. Create a `FrameworkConfigurator` instance.
18
+ * 2. Call configuration helpers such as {@link configureMsal},
19
+ * {@link configureHttp}, {@link configureHttpClient}, and
20
+ * {@link configureServiceDiscovery}.
21
+ * 3. Pass the configurator to {@link init} to bootstrap the framework.
22
+ *
23
+ * @template TModules - Additional module descriptors to merge with the
24
+ * built-in Fusion modules.
25
+ * @template TRef - Optional reference object forwarded to module
26
+ * initialization (e.g. a parent framework instance).
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * import { FrameworkConfigurator, init } from '@equinor/fusion-framework';
31
+ *
32
+ * const configurator = new FrameworkConfigurator();
33
+ * configurator.configureMsal({ clientId: 'my-client-id', authority: '…' });
34
+ * configurator.configureServiceDiscovery({
35
+ * client: { baseUri: 'https://service-registry.example.com' },
36
+ * });
37
+ *
38
+ * const fusion = await init(configurator);
39
+ * ```
12
40
  */
13
41
  export declare class FrameworkConfigurator<TModules extends Array<AnyModule> = [], TRef = any> extends ModulesConfigurator<FusionModules<TModules>, TRef> {
14
42
  /**
@@ -1,18 +1,35 @@
1
+ /**
2
+ * Entry point for `@equinor/fusion-framework` — the core initialization
3
+ * package of Fusion Framework.
4
+ *
5
+ * @remarks
6
+ * Re-exports the {@link FrameworkConfigurator} (used to configure framework
7
+ * modules before initialization), the {@link init} function (used to
8
+ * bootstrap the framework), and all public type aliases that describe
9
+ * the resulting module graph.
10
+ *
11
+ * @packageDocumentation
12
+ */
1
13
  import type { FrameworkEvent, FrameworkEventInit } from '@equinor/fusion-framework-module-event';
2
14
  import type { Fusion } from './types.js';
3
15
  declare module '@equinor/fusion-framework-module-event' {
4
16
  interface FrameworkEventMap {
17
+ /**
18
+ * Dispatched after all framework modules have been initialized and the
19
+ * global `window.Fusion` reference has been set.
20
+ */
5
21
  onFrameworkLoaded: FrameworkEvent<FrameworkEventInit<Fusion>>;
6
22
  }
7
23
  }
8
24
  declare global {
9
25
  interface Window {
26
+ /** Global Fusion instance, set during {@link init}. */
10
27
  Fusion: Fusion;
11
28
  }
12
29
  }
13
30
  export { FrameworkConfigurator,
14
31
  /**
15
- * @deprecated use FrameworkConfigurator
32
+ * @deprecated Use {@link FrameworkConfigurator} instead.
16
33
  */
17
34
  FrameworkConfigurator as FusionConfigurator, } from './FrameworkConfigurator';
18
35
  export type { FusionModules, FusionModulesInstance, Fusion, FusionRenderFn } from './types';
@@ -2,13 +2,38 @@ import type { AnyModule } from '@equinor/fusion-framework-module';
2
2
  import type { FrameworkConfigurator } from './FrameworkConfigurator.js';
3
3
  import type { Fusion } from './types.js';
4
4
  /**
5
+ * Initialize Fusion Framework from a fully-configured
6
+ * {@link FrameworkConfigurator}.
5
7
  *
6
- * @template TModules addition modules
7
- * @template TRef optional reference
8
+ * This is the main bootstrap entry point. It resolves all module
9
+ * configurations, instantiates every registered module, assigns the
10
+ * resulting {@link Fusion} object to `window.Fusion`, and dispatches
11
+ * the `onFrameworkLoaded` event.
8
12
  *
9
- * @param configurator config builder instance
10
- * @param ref optional references
11
- * @returns instance of framework modules
13
+ * @template TModules - Additional module descriptors beyond the built-in
14
+ * Fusion modules.
15
+ * @template TRef - Reference object forwarded to modules during
16
+ * initialization (e.g. a parent framework instance).
17
+ *
18
+ * @param configurator - A {@link FrameworkConfigurator} that has been set up
19
+ * with the desired module configurations (MSAL, HTTP, service discovery,
20
+ * etc.).
21
+ * @param ref - Optional reference object passed through to each module's
22
+ * initializer, typically used when an application framework is initialized
23
+ * within an outer host framework.
24
+ * @returns A promise that resolves to the initialized {@link Fusion}
25
+ * instance containing all configured module instances.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * import { FrameworkConfigurator, init } from '@equinor/fusion-framework';
30
+ *
31
+ * const configurator = new FrameworkConfigurator();
32
+ * configurator.configureMsal({ clientId: '…', authority: '…' });
33
+ *
34
+ * const fusion = await init(configurator);
35
+ * console.log(fusion.modules); // all instantiated modules
36
+ * ```
12
37
  */
13
38
  export declare const init: <TModules extends Array<AnyModule>, TRef extends object>(configurator: FrameworkConfigurator<TModules>, ref?: TRef) => Promise<Fusion<TModules>>;
14
39
  export default init;
@@ -8,7 +8,21 @@ import type { ServiceDiscoveryModule } from '@equinor/fusion-framework-module-se
8
8
  import type { ServicesModule } from '@equinor/fusion-framework-module-services';
9
9
  import type { TelemetryModule } from '@equinor/fusion-framework-module-telemetry';
10
10
  /**
11
- * interface of the modules provided by Fusion Framework
11
+ * Union of all built-in Fusion Framework module descriptors, optionally
12
+ * combined with additional custom modules.
13
+ *
14
+ * Use this type to describe the full set of modules the framework
15
+ * configurator will manage. The built-in set includes:
16
+ * - {@link ContextModule} — application/project context selection
17
+ * - {@link EventModule} — cross-module event bus
18
+ * - {@link HttpModule} — HTTP client factory
19
+ * - {@link MsalModule} — Microsoft Authentication Library integration
20
+ * - {@link ServicesModule} — typed service clients
21
+ * - {@link ServiceDiscoveryModule} — runtime service endpoint resolution
22
+ * - {@link TelemetryModule} — telemetry and logging
23
+ *
24
+ * @template TModules - Additional module descriptors to merge with the
25
+ * built-in modules. Defaults to `unknown` (no extra modules).
12
26
  */
13
27
  export type FusionModules<TModules extends Array<AnyModule> | unknown = unknown> = CombinedModules<TModules, [
14
28
  ContextModule,
@@ -20,15 +34,42 @@ export type FusionModules<TModules extends Array<AnyModule> | unknown = unknown>
20
34
  TelemetryModule
21
35
  ]>;
22
36
  /**
23
- * Blueprint of instance of framework modules
37
+ * Resolved instance map for all Fusion Framework modules.
38
+ *
39
+ * This is the runtime counterpart of {@link FusionModules}: after the
40
+ * framework has been initialized with {@link init}, every module
41
+ * descriptor is replaced by its live instance (clients, providers,
42
+ * managers, etc.).
43
+ *
44
+ * @template TModules - Additional module descriptors whose instances
45
+ * should be included. Defaults to `unknown`.
24
46
  */
25
47
  export type FusionModulesInstance<TModules extends Array<AnyModule> | unknown = unknown> = ModulesInstance<FusionModules<TModules>>;
48
+ /**
49
+ * Root object returned by {@link init} after bootstrapping the framework.
50
+ *
51
+ * The `Fusion` object is also assigned to `window.Fusion` so that portal
52
+ * shells, micro-frontends, and widgets can access the running framework
53
+ * instance globally.
54
+ *
55
+ * @template TModules - Additional module descriptors beyond the built-in
56
+ * set. Defaults to `unknown`.
57
+ */
26
58
  export interface Fusion<TModules extends Array<AnyModule> | unknown = unknown> {
27
- /**
28
- * Configured services for Fusion
29
- */
59
+ /** Map of all initialized module instances keyed by module name. */
30
60
  modules: FusionModulesInstance<TModules>;
31
61
  }
62
+ /**
63
+ * Callback signature for rendering a Fusion application into a DOM element.
64
+ *
65
+ * Portal hosts call this function when mounting an application, passing the
66
+ * root element and a reference to the host's module instances so the
67
+ * application can share authentication, HTTP clients, and other services.
68
+ *
69
+ * @param el - The DOM element into which the application should render.
70
+ * @param args - Initialization arguments containing a reference to the
71
+ * host framework's module instances.
72
+ */
32
73
  export type FusionRenderFn = (el: HTMLElement, args: {
33
74
  ref: ModulesInstance<AnyModule[]>;
34
75
  }) => void;
@@ -1 +1 @@
1
- export declare const version = "7.4.14-next.0";
1
+ export declare const version = "8.0.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework",
3
- "version": "7.4.14-next.0",
3
+ "version": "8.0.0",
4
4
  "description": "",
5
5
  "main": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -32,18 +32,18 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "rxjs": "^7.8.1",
35
- "@equinor/fusion-framework-module": "5.0.7-next.0",
36
- "@equinor/fusion-framework-module-context": "7.0.4-next.0",
37
- "@equinor/fusion-framework-module-event": "5.0.2-next.0",
38
- "@equinor/fusion-framework-module-http": "7.0.9-next.0",
39
- "@equinor/fusion-framework-module-msal": "7.3.2-next.0",
40
- "@equinor/fusion-framework-module-services": "7.2.2-next.0",
41
- "@equinor/fusion-framework-module-service-discovery": "9.1.2-next.0",
42
- "@equinor/fusion-framework-module-telemetry": "4.6.5-next.0"
35
+ "@equinor/fusion-framework-module": "6.0.0",
36
+ "@equinor/fusion-framework-module-context": "8.0.0",
37
+ "@equinor/fusion-framework-module-event": "6.0.0",
38
+ "@equinor/fusion-framework-module-msal": "8.0.0",
39
+ "@equinor/fusion-framework-module-http": "8.0.0",
40
+ "@equinor/fusion-framework-module-service-discovery": "10.0.0",
41
+ "@equinor/fusion-framework-module-services": "8.0.0",
42
+ "@equinor/fusion-framework-module-telemetry": "5.0.0"
43
43
  },
44
44
  "devDependencies": {
45
- "typescript": "^5.8.2",
46
- "vitest": "^4.0.18"
45
+ "typescript": "^5.9.3",
46
+ "vitest": "^4.1.0"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsc -b",
@@ -22,9 +22,37 @@ import type { MsalClientConfig } from '@equinor/fusion-framework-module-msal';
22
22
  import { version } from './version.js';
23
23
 
24
24
  /**
25
- * Module configurator for Framework modules
26
- * @template TModules - Addition modules
27
- * @template TRef - usually undefined, optional references
25
+ * Configurator that registers and wires the core Fusion Framework modules.
26
+ *
27
+ * Extend `FrameworkConfigurator` to declare which modules (authentication,
28
+ * HTTP, service-discovery, telemetry, context, …) the framework instance
29
+ * should contain and how each module is configured before the framework
30
+ * starts.
31
+ *
32
+ * Typical workflow:
33
+ * 1. Create a `FrameworkConfigurator` instance.
34
+ * 2. Call configuration helpers such as {@link configureMsal},
35
+ * {@link configureHttp}, {@link configureHttpClient}, and
36
+ * {@link configureServiceDiscovery}.
37
+ * 3. Pass the configurator to {@link init} to bootstrap the framework.
38
+ *
39
+ * @template TModules - Additional module descriptors to merge with the
40
+ * built-in Fusion modules.
41
+ * @template TRef - Optional reference object forwarded to module
42
+ * initialization (e.g. a parent framework instance).
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * import { FrameworkConfigurator, init } from '@equinor/fusion-framework';
47
+ *
48
+ * const configurator = new FrameworkConfigurator();
49
+ * configurator.configureMsal({ clientId: 'my-client-id', authority: '…' });
50
+ * configurator.configureServiceDiscovery({
51
+ * client: { baseUri: 'https://service-registry.example.com' },
52
+ * });
53
+ *
54
+ * const fusion = await init(configurator);
55
+ * ```
28
56
  */
29
57
  export class FrameworkConfigurator<
30
58
  TModules extends Array<AnyModule> = [],
package/src/index.ts CHANGED
@@ -1,14 +1,32 @@
1
+ /**
2
+ * Entry point for `@equinor/fusion-framework` — the core initialization
3
+ * package of Fusion Framework.
4
+ *
5
+ * @remarks
6
+ * Re-exports the {@link FrameworkConfigurator} (used to configure framework
7
+ * modules before initialization), the {@link init} function (used to
8
+ * bootstrap the framework), and all public type aliases that describe
9
+ * the resulting module graph.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+
1
14
  import type { FrameworkEvent, FrameworkEventInit } from '@equinor/fusion-framework-module-event';
2
15
  import type { Fusion } from './types.js';
3
16
 
4
17
  declare module '@equinor/fusion-framework-module-event' {
5
18
  interface FrameworkEventMap {
19
+ /**
20
+ * Dispatched after all framework modules have been initialized and the
21
+ * global `window.Fusion` reference has been set.
22
+ */
6
23
  onFrameworkLoaded: FrameworkEvent<FrameworkEventInit<Fusion>>;
7
24
  }
8
25
  }
9
26
 
10
27
  declare global {
11
28
  interface Window {
29
+ /** Global Fusion instance, set during {@link init}. */
12
30
  Fusion: Fusion;
13
31
  }
14
32
  }
@@ -16,7 +34,7 @@ declare global {
16
34
  export {
17
35
  FrameworkConfigurator,
18
36
  /**
19
- * @deprecated use FrameworkConfigurator
37
+ * @deprecated Use {@link FrameworkConfigurator} instead.
20
38
  */
21
39
  FrameworkConfigurator as FusionConfigurator,
22
40
  } from './FrameworkConfigurator';
package/src/init.ts CHANGED
@@ -4,13 +4,38 @@ import type { FrameworkConfigurator } from './FrameworkConfigurator.js';
4
4
  import type { Fusion, FusionModules } from './types.js';
5
5
 
6
6
  /**
7
+ * Initialize Fusion Framework from a fully-configured
8
+ * {@link FrameworkConfigurator}.
7
9
  *
8
- * @template TModules addition modules
9
- * @template TRef optional reference
10
+ * This is the main bootstrap entry point. It resolves all module
11
+ * configurations, instantiates every registered module, assigns the
12
+ * resulting {@link Fusion} object to `window.Fusion`, and dispatches
13
+ * the `onFrameworkLoaded` event.
10
14
  *
11
- * @param configurator config builder instance
12
- * @param ref optional references
13
- * @returns instance of framework modules
15
+ * @template TModules - Additional module descriptors beyond the built-in
16
+ * Fusion modules.
17
+ * @template TRef - Reference object forwarded to modules during
18
+ * initialization (e.g. a parent framework instance).
19
+ *
20
+ * @param configurator - A {@link FrameworkConfigurator} that has been set up
21
+ * with the desired module configurations (MSAL, HTTP, service discovery,
22
+ * etc.).
23
+ * @param ref - Optional reference object passed through to each module's
24
+ * initializer, typically used when an application framework is initialized
25
+ * within an outer host framework.
26
+ * @returns A promise that resolves to the initialized {@link Fusion}
27
+ * instance containing all configured module instances.
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * import { FrameworkConfigurator, init } from '@equinor/fusion-framework';
32
+ *
33
+ * const configurator = new FrameworkConfigurator();
34
+ * configurator.configureMsal({ clientId: '…', authority: '…' });
35
+ *
36
+ * const fusion = await init(configurator);
37
+ * console.log(fusion.modules); // all instantiated modules
38
+ * ```
14
39
  */
15
40
  export const init = async <TModules extends Array<AnyModule>, TRef extends object>(
16
41
  configurator: FrameworkConfigurator<TModules>,
@@ -20,6 +45,7 @@ export const init = async <TModules extends Array<AnyModule>, TRef extends objec
20
45
  const fusion = {
21
46
  modules,
22
47
  };
48
+ // Expose globally so portal shells and widgets can access the running instance
23
49
  window.Fusion = fusion as unknown as Fusion;
24
50
  modules.event.dispatchEvent('onFrameworkLoaded', { detail: fusion });
25
51
 
package/src/types.ts CHANGED
@@ -10,7 +10,21 @@ import type { ServicesModule } from '@equinor/fusion-framework-module-services';
10
10
  import type { TelemetryModule } from '@equinor/fusion-framework-module-telemetry';
11
11
 
12
12
  /**
13
- * interface of the modules provided by Fusion Framework
13
+ * Union of all built-in Fusion Framework module descriptors, optionally
14
+ * combined with additional custom modules.
15
+ *
16
+ * Use this type to describe the full set of modules the framework
17
+ * configurator will manage. The built-in set includes:
18
+ * - {@link ContextModule} — application/project context selection
19
+ * - {@link EventModule} — cross-module event bus
20
+ * - {@link HttpModule} — HTTP client factory
21
+ * - {@link MsalModule} — Microsoft Authentication Library integration
22
+ * - {@link ServicesModule} — typed service clients
23
+ * - {@link ServiceDiscoveryModule} — runtime service endpoint resolution
24
+ * - {@link TelemetryModule} — telemetry and logging
25
+ *
26
+ * @template TModules - Additional module descriptors to merge with the
27
+ * built-in modules. Defaults to `unknown` (no extra modules).
14
28
  */
15
29
  export type FusionModules<TModules extends Array<AnyModule> | unknown = unknown> = CombinedModules<
16
30
  TModules,
@@ -26,16 +40,43 @@ export type FusionModules<TModules extends Array<AnyModule> | unknown = unknown>
26
40
  >;
27
41
 
28
42
  /**
29
- * Blueprint of instance of framework modules
43
+ * Resolved instance map for all Fusion Framework modules.
44
+ *
45
+ * This is the runtime counterpart of {@link FusionModules}: after the
46
+ * framework has been initialized with {@link init}, every module
47
+ * descriptor is replaced by its live instance (clients, providers,
48
+ * managers, etc.).
49
+ *
50
+ * @template TModules - Additional module descriptors whose instances
51
+ * should be included. Defaults to `unknown`.
30
52
  */
31
53
  export type FusionModulesInstance<TModules extends Array<AnyModule> | unknown = unknown> =
32
54
  ModulesInstance<FusionModules<TModules>>;
33
55
 
56
+ /**
57
+ * Root object returned by {@link init} after bootstrapping the framework.
58
+ *
59
+ * The `Fusion` object is also assigned to `window.Fusion` so that portal
60
+ * shells, micro-frontends, and widgets can access the running framework
61
+ * instance globally.
62
+ *
63
+ * @template TModules - Additional module descriptors beyond the built-in
64
+ * set. Defaults to `unknown`.
65
+ */
34
66
  export interface Fusion<TModules extends Array<AnyModule> | unknown = unknown> {
35
- /**
36
- * Configured services for Fusion
37
- */
67
+ /** Map of all initialized module instances keyed by module name. */
38
68
  modules: FusionModulesInstance<TModules>;
39
69
  }
40
70
 
71
+ /**
72
+ * Callback signature for rendering a Fusion application into a DOM element.
73
+ *
74
+ * Portal hosts call this function when mounting an application, passing the
75
+ * root element and a reference to the host's module instances so the
76
+ * application can share authentication, HTTP clients, and other services.
77
+ *
78
+ * @param el - The DOM element into which the application should render.
79
+ * @param args - Initialization arguments containing a reference to the
80
+ * host framework's module instances.
81
+ */
41
82
  export type FusionRenderFn = (el: HTMLElement, args: { ref: ModulesInstance<AnyModule[]> }) => void;
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '7.4.14-next.0';
2
+ export const version = '8.0.0';