@equinor/fusion-framework-app 10.0.0 → 10.1.1
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 +47 -0
- package/dist/esm/AppConfigurator.js +6 -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/AppConfigurator.d.ts +5 -0
- package/dist/types/__tests__/AppConfigurator.test.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +11 -9
- package/src/AppConfigurator.ts +6 -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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 10.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3590](https://github.com/equinor/fusion-framework/pull/3590) [`0bc6b38`](https://github.com/equinor/fusion-framework/commit/0bc6b38e61c98a2f9dea7b55fa9983f268f860be) Thanks [@odinr](https://github.com/odinr)! - Internal: Add static className properties to configurator classes (ModulesConfigurator, FrameworkConfigurator, AppConfigurator) to prevent constructor name mangling during compilation and ensure proper event naming.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`dcdec9f`](https://github.com/equinor/fusion-framework/commit/dcdec9f87d591781d11db34c24e6bf85de3a3f48), [`6900d98`](https://github.com/equinor/fusion-framework/commit/6900d98142c84f4703095f8d03b09af57a1d7d2e), [`e1a94c5`](https://github.com/equinor/fusion-framework/commit/e1a94c5a1df4ac2ec92ed25b75648397a3dbfa7b), [`e1a94c5`](https://github.com/equinor/fusion-framework/commit/e1a94c5a1df4ac2ec92ed25b75648397a3dbfa7b), [`31e2581`](https://github.com/equinor/fusion-framework/commit/31e2581fca2765dc7caf54f74db3db51020b53b7), [`0bc6b38`](https://github.com/equinor/fusion-framework/commit/0bc6b38e61c98a2f9dea7b55fa9983f268f860be)]:
|
|
10
|
+
- @equinor/fusion-framework-module-event@4.4.0
|
|
11
|
+
- @equinor/fusion-framework-module-http@7.0.3
|
|
12
|
+
- @equinor/fusion-framework-module@5.0.4
|
|
13
|
+
- @equinor/fusion-framework-module-msal@5.1.1
|
|
14
|
+
- @equinor/fusion-framework-module-telemetry@4.3.0
|
|
15
|
+
- @equinor/fusion-framework@7.4.1
|
|
16
|
+
|
|
17
|
+
## 10.1.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- [#3493](https://github.com/equinor/fusion-framework/pull/3493) [`9f5de98`](https://github.com/equinor/fusion-framework/commit/9f5de9844181b8bc2d770032ff3b1709e87c7c21) Thanks [@odinr](https://github.com/odinr)! - Add telemetry integration to app configurator.
|
|
22
|
+
|
|
23
|
+
- Add telemetry module dependency to enable telemetry collection
|
|
24
|
+
- Configure telemetry in app module configurator with metadata extraction from app manifest
|
|
25
|
+
- Add event mapping to prefix configurator events with `AppConfigurator::` namespace
|
|
26
|
+
- Set default telemetry scope to `['app']` for app-specific telemetry
|
|
27
|
+
- Remove unused ModuleConsoleLogger import in favor of telemetry logging
|
|
28
|
+
|
|
29
|
+
This enables applications to collect telemetry data from module configuration events and app lifecycle.
|
|
30
|
+
|
|
31
|
+
resolves: [#3486](https://github.com/equinor/fusion-framework/issues/3486)
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- [#3490](https://github.com/equinor/fusion-framework/pull/3490) [`45954e5`](https://github.com/equinor/fusion-framework/commit/45954e5db471a2faa24e88e41fc6d6c18817d6d1) Thanks [@odinr](https://github.com/odinr)! - Remove explicit logger initialization from configurator constructors in favor of telemetry.
|
|
36
|
+
|
|
37
|
+
- Removed `this.logger = new ModuleConsoleLogger(...)` from FrameworkConfigurator, AppConfigurator, and WidgetConfigurator constructors
|
|
38
|
+
- Logger functionality will be handled through telemetry module with console logging adapter
|
|
39
|
+
|
|
40
|
+
This prepares the configurators to use telemetry for logging instead of direct console logger initialization.
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [[`45954e5`](https://github.com/equinor/fusion-framework/commit/45954e5db471a2faa24e88e41fc6d6c18817d6d1), [`a66d70a`](https://github.com/equinor/fusion-framework/commit/a66d70a9fa40ab14f2534be4f22b6d1f602097a0), [`7ba4713`](https://github.com/equinor/fusion-framework/commit/7ba47139a8d7cfbb757bd4626425c611e22c2126), [`45954e5`](https://github.com/equinor/fusion-framework/commit/45954e5db471a2faa24e88e41fc6d6c18817d6d1), [`4e78565`](https://github.com/equinor/fusion-framework/commit/4e7856590f73fee840b065a0e4d89962e167ed9e), [`0bad642`](https://github.com/equinor/fusion-framework/commit/0bad642205a7f780dcb6685243102b65b3755fa2), [`45954e5`](https://github.com/equinor/fusion-framework/commit/45954e5db471a2faa24e88e41fc6d6c18817d6d1)]:
|
|
43
|
+
- @equinor/fusion-framework@7.4.0
|
|
44
|
+
- @equinor/fusion-framework-module-http@7.0.2
|
|
45
|
+
- @equinor/fusion-framework-module@5.0.3
|
|
46
|
+
- @equinor/fusion-framework-module-telemetry@4.2.0
|
|
47
|
+
- @equinor/fusion-framework-module-app@7.0.2
|
|
48
|
+
- @equinor/fusion-framework-module-bookmark@3.0.2
|
|
49
|
+
|
|
3
50
|
## 10.0.0
|
|
4
51
|
|
|
5
52
|
### Patch Changes
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
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
5
|
export class AppConfigurator extends ModulesConfigurator {
|
|
6
6
|
env;
|
|
7
|
+
/**
|
|
8
|
+
* The class name used for event naming. This static property ensures
|
|
9
|
+
* the name is preserved through compilation and minification.
|
|
10
|
+
*/
|
|
11
|
+
static className = 'AppConfigurator';
|
|
7
12
|
constructor(env) {
|
|
8
13
|
super([event, http, auth]);
|
|
9
14
|
this.env = env;
|
|
10
|
-
this.logger = new ModuleConsoleLogger('AppConfigurator');
|
|
11
15
|
}
|
|
12
16
|
configureHttp(...args) {
|
|
13
17
|
this.addConfig(configureHttp(...args));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppConfigurator.js","sourceRoot":"","sources":["../../src/AppConfigurator.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,mBAAmB,
|
|
1
|
+
{"version":3,"file":"AppConfigurator.js","sourceRoot":"","sources":["../../src/AppConfigurator.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,MAAM,wCAAwC,CAAC;AAE3D,OAAO,IAAI,EAAE,EACX,mBAAmB,EACnB,aAAa,GAEd,MAAM,uCAAuC,CAAC;AAE/C,OAAO,IAAI,MAAM,uCAAuC,CAAC;AAmDzD,MAAM,OAAO,eAKX,SAAQ,mBAA+C;IAS3B;IAN5B;;;OAGG;IACH,MAAM,CAAU,SAAS,GAAW,iBAAiB,CAAC;IAEtD,YAA4B,GAAS;QACnC,KAAK,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QADD,QAAG,GAAH,GAAG,CAAM;IAErC,CAAC;IAEM,aAAa,CAAC,GAAG,IAAsC;QAC5D,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACzC,CAAC;IAEM,mBAAmB,CAAC,GAAG,IAA4C;QACxE,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;IAEM,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,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;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"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
2
|
+
import { firstValueFrom, take } from 'rxjs';
|
|
3
|
+
import { AppConfigurator } from '../AppConfigurator';
|
|
4
|
+
import { SemanticVersion } from '@equinor/fusion-framework-module';
|
|
5
|
+
describe('AppConfigurator', () => {
|
|
6
|
+
let configurator;
|
|
7
|
+
// Create a mock module for testing
|
|
8
|
+
const createMockModule = (name, version = '1.0.0') => ({
|
|
9
|
+
name,
|
|
10
|
+
version: new SemanticVersion(version),
|
|
11
|
+
initialize: () => ({ mockInstance: true }),
|
|
12
|
+
});
|
|
13
|
+
// Mock environment object
|
|
14
|
+
const mockEnv = {
|
|
15
|
+
manifest: {
|
|
16
|
+
appKey: 'test-app',
|
|
17
|
+
displayName: 'Test App',
|
|
18
|
+
description: 'A test application',
|
|
19
|
+
type: 'standalone',
|
|
20
|
+
build: {
|
|
21
|
+
version: '1.0.0',
|
|
22
|
+
entryPoint: 'index.js',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
configurator = new AppConfigurator(mockEnv);
|
|
28
|
+
});
|
|
29
|
+
describe('Event Name Prefixing', () => {
|
|
30
|
+
it('should prefix event names with "AppConfigurator::"', async () => {
|
|
31
|
+
// Trigger event by adding a config
|
|
32
|
+
configurator.addConfig({
|
|
33
|
+
module: createMockModule('test', '1.0.0'),
|
|
34
|
+
configure: () => { },
|
|
35
|
+
});
|
|
36
|
+
// Wait for the first event to be emitted
|
|
37
|
+
const event = await firstValueFrom(configurator.event$.pipe(take(1)));
|
|
38
|
+
expect(event.name).toMatch(/^AppConfigurator::/);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=AppConfigurator.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppConfigurator.test.js","sourceRoot":"","sources":["../../../src/__tests__/AppConfigurator.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAI,YAA6B,CAAC;IAElC,mCAAmC;IACnC,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,OAAO,GAAG,OAAO,EAAa,EAAE,CAAC,CAAC;QACxE,IAAI;QACJ,OAAO,EAAE,IAAI,eAAe,CAAC,OAAO,CAAC;QACrC,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;KAC3C,CAAC,CAAC;IAEH,0BAA0B;IAC1B,MAAM,OAAO,GAAG;QACd,QAAQ,EAAE;YACR,MAAM,EAAE,UAAU;YAClB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE,YAAqB;YAC3B,KAAK,EAAE;gBACL,OAAO,EAAE,OAAO;gBAChB,UAAU,EAAE,UAAU;aACvB;SACF;KACF,CAAC;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,YAAY,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;QACpC,EAAE,CAAC,oDAAoD,EAAE,KAAK,IAAI,EAAE;YAClE,mCAAmC;YACnC,YAAY,CAAC,SAAS,CAAC;gBACrB,MAAM,EAAE,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC;gBACzC,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;aACpB,CAAC,CAAC;YAEH,yCAAyC;YACzC,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAEtE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { enableTelemetry, } from '@equinor/fusion-framework-module-telemetry';
|
|
1
2
|
import { AppConfigurator } from './AppConfigurator';
|
|
2
3
|
/**
|
|
3
4
|
*
|
|
@@ -27,12 +28,38 @@ export const configureModules = (cb) =>
|
|
|
27
28
|
* @returns initialized app modules
|
|
28
29
|
*/
|
|
29
30
|
async (args) => {
|
|
31
|
+
const { fusion } = args;
|
|
32
|
+
// Create app configurator
|
|
30
33
|
const configurator = new AppConfigurator(args.env);
|
|
34
|
+
// Extract telemetry metadata from app manifest for tracking and debugging
|
|
35
|
+
const metadataExtractor = () => {
|
|
36
|
+
return {
|
|
37
|
+
fusion: {
|
|
38
|
+
type: 'app-telemetry',
|
|
39
|
+
app: {
|
|
40
|
+
key: args.env.manifest?.appKey || 'unknown-app',
|
|
41
|
+
version: args.env.manifest?.build?.version || 'unknown-version',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
// Enable telemetry collection for module configuration events
|
|
47
|
+
// attachConfiguratorEvents automatically prefixes events with configurator class name
|
|
48
|
+
enableTelemetry(configurator, {
|
|
49
|
+
attachConfiguratorEvents: true,
|
|
50
|
+
configure: (builder) => {
|
|
51
|
+
builder.setMetadata(metadataExtractor);
|
|
52
|
+
builder.setParent(fusion.modules.telemetry);
|
|
53
|
+
// Scope telemetry to 'app' level for app-specific event filtering
|
|
54
|
+
builder.setDefaultScope(['app']);
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
// Allow user configuration callback to run before module initialization
|
|
31
58
|
if (cb) {
|
|
32
59
|
await Promise.resolve(cb(configurator, args));
|
|
33
60
|
}
|
|
34
61
|
const modules = (await configurator.initialize(args.fusion.modules));
|
|
35
|
-
//
|
|
62
|
+
// Dispatch app modules loaded event for app lifecycle tracking
|
|
36
63
|
// TODO - remove check after fusion-cli is updated (app module is not enabled in fusion-cli)
|
|
37
64
|
if (args.env.manifest?.appKey) {
|
|
38
65
|
modules.event.dispatchEvent('onAppModulesLoaded', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure-modules.js","sourceRoot":"","sources":["../../src/configure-modules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"configure-modules.js","sourceRoot":"","sources":["../../src/configure-modules.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,GAEhB,MAAM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