@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.
- package/CHANGELOG.md +33 -0
- package/dist/esm/AppConfigurator.js +1 -2
- package/dist/esm/AppConfigurator.js.map +1 -1
- package/dist/esm/__tests__/AppConfigurator.test.js +42 -0
- package/dist/esm/__tests__/AppConfigurator.test.js.map +1 -0
- package/dist/esm/configure-modules.js +28 -1
- package/dist/esm/configure-modules.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/__tests__/AppConfigurator.test.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +10 -8
- package/src/AppConfigurator.ts +0 -2
- package/src/__tests__/AppConfigurator.test.ts +49 -0
- package/src/configure-modules.ts +37 -3
- package/src/version.ts +1 -1
- package/tsconfig.json +3 -0
- package/vitest.config.ts +10 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "10.
|
|
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.
|
|
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
|
-
"
|
|
49
|
-
"@equinor/fusion-framework
|
|
50
|
-
"@equinor/fusion-framework-module-app": "^7.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-
|
|
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.
|
|
59
|
+
"@equinor/fusion-framework-module-bookmark": "^3.0.2"
|
|
58
60
|
},
|
|
59
61
|
"peerDependencies": {
|
|
60
|
-
"@equinor/fusion-framework-module-bookmark": "^3.0.
|
|
62
|
+
"@equinor/fusion-framework-module-bookmark": "^3.0.2"
|
|
61
63
|
},
|
|
62
64
|
"peerDependenciesMeta": {
|
|
63
65
|
"@equinor/fusion-framework-module-bookmark": {
|
package/src/AppConfigurator.ts
CHANGED
|
@@ -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
|
+
});
|
package/src/configure-modules.ts
CHANGED
|
@@ -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
|
-
//
|
|
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.
|
|
2
|
+
export const version = '10.1.0';
|
package/tsconfig.json
CHANGED