@equinor/fusion-framework-app 10.0.0 → 10.1.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.
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1 @@
1
- export declare const version = "10.0.0";
1
+ export declare const version = "10.1.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-app",
3
- "version": "10.0.0",
3
+ "version": "10.1.0",
4
4
  "description": "",
5
5
  "main": "dist/esm/index.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -45,19 +45,21 @@
45
45
  "directory": "packages/app"
46
46
  },
47
47
  "dependencies": {
48
- "@equinor/fusion-framework": "^7.3.19",
49
- "@equinor/fusion-framework-module": "^5.0.1",
50
- "@equinor/fusion-framework-module-app": "^7.0.0",
48
+ "rxjs": "^7.8.1",
49
+ "@equinor/fusion-framework": "^7.4.0",
50
+ "@equinor/fusion-framework-module-app": "^7.0.2",
51
+ "@equinor/fusion-framework-module": "^5.0.3",
52
+ "@equinor/fusion-framework-module-http": "^7.0.2",
53
+ "@equinor/fusion-framework-module-msal": "^5.0.1",
51
54
  "@equinor/fusion-framework-module-event": "^4.3.7",
52
- "@equinor/fusion-framework-module-msal": "^5.0.0",
53
- "@equinor/fusion-framework-module-http": "^7.0.0"
55
+ "@equinor/fusion-framework-module-telemetry": "^4.2.0"
54
56
  },
55
57
  "devDependencies": {
56
58
  "typescript": "^5.8.2",
57
- "@equinor/fusion-framework-module-bookmark": "^3.0.0"
59
+ "@equinor/fusion-framework-module-bookmark": "^3.0.2"
58
60
  },
59
61
  "peerDependencies": {
60
- "@equinor/fusion-framework-module-bookmark": "^3.0.0"
62
+ "@equinor/fusion-framework-module-bookmark": "^3.0.2"
61
63
  },
62
64
  "peerDependenciesMeta": {
63
65
  "@equinor/fusion-framework-module-bookmark": {
@@ -3,7 +3,6 @@ import type { FusionModulesInstance } from '@equinor/fusion-framework';
3
3
  import {
4
4
  type AnyModule,
5
5
  type IModulesConfigurator,
6
- ModuleConsoleLogger,
7
6
  ModulesConfigurator,
8
7
  } from '@equinor/fusion-framework-module';
9
8
 
@@ -76,7 +75,6 @@ export class AppConfigurator<
76
75
  {
77
76
  constructor(public readonly env: TEnv) {
78
77
  super([event, http, auth]);
79
- this.logger = new ModuleConsoleLogger('AppConfigurator');
80
78
  }
81
79
 
82
80
  public configureHttp(...args: Parameters<typeof configureHttp>) {
@@ -0,0 +1,49 @@
1
+ import { describe, it, expect, beforeEach } from 'vitest';
2
+ import { firstValueFrom, take } from 'rxjs';
3
+ import { AppConfigurator } from '../AppConfigurator';
4
+ import type { AnyModule } from '@equinor/fusion-framework-module';
5
+ import { SemanticVersion } from '@equinor/fusion-framework-module';
6
+
7
+ describe('AppConfigurator', () => {
8
+ let configurator: AppConfigurator;
9
+
10
+ // Create a mock module for testing
11
+ const createMockModule = (name: string, version = '1.0.0'): AnyModule => ({
12
+ name,
13
+ version: new SemanticVersion(version),
14
+ initialize: () => ({ mockInstance: true }),
15
+ });
16
+
17
+ // Mock environment object
18
+ const mockEnv = {
19
+ manifest: {
20
+ appKey: 'test-app',
21
+ displayName: 'Test App',
22
+ description: 'A test application',
23
+ type: 'standalone' as const,
24
+ build: {
25
+ version: '1.0.0',
26
+ entryPoint: 'index.js',
27
+ },
28
+ },
29
+ };
30
+
31
+ beforeEach(() => {
32
+ configurator = new AppConfigurator(mockEnv);
33
+ });
34
+
35
+ describe('Event Name Prefixing', () => {
36
+ it('should prefix event names with "AppConfigurator::"', async () => {
37
+ // Trigger event by adding a config
38
+ configurator.addConfig({
39
+ module: createMockModule('test', '1.0.0'),
40
+ configure: () => {},
41
+ });
42
+
43
+ // Wait for the first event to be emitted
44
+ const event = await firstValueFrom(configurator.event$.pipe(take(1)));
45
+
46
+ expect(event.name).toMatch(/^AppConfigurator::/);
47
+ });
48
+ });
49
+ });
@@ -1,5 +1,9 @@
1
1
  import type { Fusion } from '@equinor/fusion-framework';
2
2
  import type { AnyModule } from '@equinor/fusion-framework-module';
3
+ import {
4
+ enableTelemetry,
5
+ type MetadataExtractor,
6
+ } from '@equinor/fusion-framework-module-telemetry';
3
7
 
4
8
  import { AppConfigurator } from './AppConfigurator';
5
9
  import type { AppModulesInstance, AppModuleInitiator, AppEnv } from './types';
@@ -39,16 +43,46 @@ export const configureModules =
39
43
  * @returns initialized app modules
40
44
  */
41
45
  async (args: { fusion: TRef; env: TEnv }): Promise<AppModulesInstance<TModules>> => {
46
+ const { fusion } = args;
47
+
48
+ // Create app configurator
42
49
  const configurator = new AppConfigurator<TModules, TRef['modules'], TEnv>(args.env);
50
+
51
+ // Extract telemetry metadata from app manifest for tracking and debugging
52
+ const metadataExtractor: MetadataExtractor = () => {
53
+ return {
54
+ fusion: {
55
+ type: 'app-telemetry',
56
+ app: {
57
+ key: args.env.manifest?.appKey || 'unknown-app',
58
+ version: args.env.manifest?.build?.version || 'unknown-version',
59
+ },
60
+ },
61
+ };
62
+ };
63
+
64
+ // Enable telemetry collection for module configuration events
65
+ // attachConfiguratorEvents automatically prefixes events with configurator class name
66
+ enableTelemetry(configurator, {
67
+ attachConfiguratorEvents: true,
68
+ configure: (builder) => {
69
+ builder.setMetadata(metadataExtractor);
70
+ builder.setParent(fusion.modules.telemetry);
71
+ // Scope telemetry to 'app' level for app-specific event filtering
72
+ builder.setDefaultScope(['app']);
73
+ },
74
+ });
75
+
76
+ // Allow user configuration callback to run before module initialization
43
77
  if (cb) {
44
78
  await Promise.resolve(cb(configurator, args));
45
79
  }
46
- const modules = (await configurator.initialize(
80
+ const modules: AppModulesInstance<TModules> = (await configurator.initialize(
47
81
  args.fusion.modules,
48
- // TODO
82
+ // TODO: type cast to unknown should not be needed in future
49
83
  )) as unknown as AppModulesInstance<TModules>;
50
84
 
51
- // @eikeland
85
+ // Dispatch app modules loaded event for app lifecycle tracking
52
86
  // TODO - remove check after fusion-cli is updated (app module is not enabled in fusion-cli)
53
87
  if (args.env.manifest?.appKey) {
54
88
  modules.event.dispatchEvent('onAppModulesLoaded', {
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '10.0.0';
2
+ export const version = '10.1.0';
package/tsconfig.json CHANGED
@@ -18,6 +18,9 @@
18
18
  {
19
19
  "path": "../modules/event"
20
20
  },
21
+ {
22
+ "path": "../modules/telemetry"
23
+ },
21
24
  {
22
25
  "path": "../modules/bookmark"
23
26
  },
@@ -0,0 +1,10 @@
1
+ import { defineProject } from 'vitest/config';
2
+
3
+ import { name, version } from './package.json';
4
+
5
+ export default defineProject({
6
+ test: {
7
+ include: ['src/__tests__/**'],
8
+ name: `${name}@${version}`,
9
+ },
10
+ });