@equinor/fusion-framework 9.0.5 → 9.1.0-next.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/README.md +24 -0
- package/dist/esm/FrameworkConfigurator.js +45 -15
- package/dist/esm/FrameworkConfigurator.js.map +1 -1
- package/dist/esm/__tests__/http-telemetry.test.js +136 -0
- package/dist/esm/__tests__/http-telemetry.test.js.map +1 -0
- package/dist/esm/__tests__/telemetry-host.test.js +26 -0
- package/dist/esm/__tests__/telemetry-host.test.js.map +1 -0
- package/dist/esm/connect-http-telemetry.js +40 -0
- package/dist/esm/connect-http-telemetry.js.map +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/mock/FrameworkMockConfigurator.js +7 -7
- package/dist/esm/mock/FrameworkMockConfigurator.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/FrameworkConfigurator.d.ts +34 -3
- package/dist/types/__tests__/http-telemetry.test.d.ts +1 -0
- package/dist/types/__tests__/telemetry-host.test.d.ts +1 -0
- package/dist/types/connect-http-telemetry.d.ts +32 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/mock/FrameworkMockConfigurator.d.ts +3 -4
- package/dist/types/version.d.ts +1 -1
- package/package.json +9 -9
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
import { type AnyModule, ModulesConfigurator } from '@equinor/fusion-framework-module';
|
|
1
|
+
import { type AnyModule, type CombinedModules, type ModulesConfig, ModulesConfigurator } from '@equinor/fusion-framework-module';
|
|
2
2
|
import { configureHttpClient, configureHttp, type HttpClientOptions } from '@equinor/fusion-framework-module-http';
|
|
3
3
|
import type { HttpClientMsal } from '@equinor/fusion-framework-module-http/client';
|
|
4
4
|
import { type AuthConfigFn } from '@equinor/fusion-framework-module-msal';
|
|
5
|
-
import { enableTelemetry } from '@equinor/fusion-framework-module-telemetry';
|
|
5
|
+
import { enableTelemetry, type ITelemetryConfigurator } 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
|
+
/**
|
|
9
|
+
* Options for creating a {@link FrameworkConfigurator}.
|
|
10
|
+
*/
|
|
11
|
+
export interface FrameworkConfiguratorOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Telemetry configuration builder the framework host should configure, for example a
|
|
14
|
+
* mock builder in tests. Defaults to a new `TelemetryConfigurator`.
|
|
15
|
+
*/
|
|
16
|
+
telemetry?: ITelemetryConfigurator;
|
|
17
|
+
/**
|
|
18
|
+
* Records one safe `fusion.http.request.duration` metric per transport attempt of the
|
|
19
|
+
* framework's HTTP clients, plus a sanitized failure on error. Defaults to `true`; set
|
|
20
|
+
* `false` to keep framework HTTP traffic out of operational telemetry.
|
|
21
|
+
*/
|
|
22
|
+
httpTelemetry?: boolean;
|
|
23
|
+
}
|
|
8
24
|
/**
|
|
9
25
|
* Configurator that registers and wires the core Fusion Framework modules.
|
|
10
26
|
*
|
|
@@ -39,6 +55,7 @@ import type { MsalClientConfig } from '@equinor/fusion-framework-module-msal';
|
|
|
39
55
|
* ```
|
|
40
56
|
*/
|
|
41
57
|
export declare class FrameworkConfigurator<TModules extends Array<AnyModule> = [], TRef = any> extends ModulesConfigurator<FusionModules<TModules>, TRef> {
|
|
58
|
+
#private;
|
|
42
59
|
/**
|
|
43
60
|
* The class name used for event naming. This static property ensures
|
|
44
61
|
* the name is preserved through compilation and minification.
|
|
@@ -50,6 +67,7 @@ export declare class FrameworkConfigurator<TModules extends Array<AnyModule> = [
|
|
|
50
67
|
* Initializes the framework with core modules (event, auth, http, service discovery,
|
|
51
68
|
* services, context, and telemetry) and sets up default telemetry that includes
|
|
52
69
|
* framework version metadata and 'framework' scope for all telemetry events.
|
|
70
|
+
* @param options - Optional host setup; see {@link FrameworkConfiguratorOptions}.
|
|
53
71
|
*
|
|
54
72
|
* @example
|
|
55
73
|
* ```typescript
|
|
@@ -57,7 +75,20 @@ export declare class FrameworkConfigurator<TModules extends Array<AnyModule> = [
|
|
|
57
75
|
* // Now ready to configure additional modules
|
|
58
76
|
* ```
|
|
59
77
|
*/
|
|
60
|
-
constructor();
|
|
78
|
+
constructor(options?: FrameworkConfiguratorOptions);
|
|
79
|
+
/**
|
|
80
|
+
* Configures modules, then installs HTTP telemetry as the innermost middleware.
|
|
81
|
+
*
|
|
82
|
+
* Post-configure callbacks run concurrently, so installing after the whole configure phase
|
|
83
|
+
* is the only point where every application middleware, including retry middleware added
|
|
84
|
+
* from asynchronous callbacks, is already registered.
|
|
85
|
+
*
|
|
86
|
+
* @param ref - Optional reference forwarded to module configuration.
|
|
87
|
+
* @returns The final module configuration map.
|
|
88
|
+
* @template T - Additional modules included in the configuration type.
|
|
89
|
+
* @template R - Reference type forwarded to module configuration.
|
|
90
|
+
*/
|
|
91
|
+
protected _configure<T, R extends TRef = TRef>(ref?: R): Promise<ModulesConfig<CombinedModules<T, FusionModules<TModules>>>>;
|
|
61
92
|
/**
|
|
62
93
|
* Configures the global HTTP module settings such as base URLs, default headers,
|
|
63
94
|
* request/response interceptors, and timeout settings.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AnyModule, ModulesConfigurator } from '@equinor/fusion-framework-module';
|
|
2
|
+
/** Host-owned HTTP telemetry, installed once the configure phase has settled. */
|
|
3
|
+
export interface HostHttpTelemetry {
|
|
4
|
+
/**
|
|
5
|
+
* Appends the transport-attempt middleware to the host's HTTP configuration.
|
|
6
|
+
* Call it after every `configure`, `onConfigured` and `afterConfig` callback has settled,
|
|
7
|
+
* so the middleware is innermost regardless of callback registration order or timing.
|
|
8
|
+
* @param config - Final module configuration map of the host.
|
|
9
|
+
*/
|
|
10
|
+
install(config: unknown): void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Instruments every HTTP client the host's HTTP module builds with transport-attempt telemetry.
|
|
14
|
+
*
|
|
15
|
+
* The owning host calls {@link HostHttpTelemetry.install} after its configure phase has
|
|
16
|
+
* settled, making this the innermost configurator-level middleware: retry or caching
|
|
17
|
+
* middleware registered by applications, including from asynchronous post-configure
|
|
18
|
+
* callbacks, wraps it, and each actual fetch attempt produces one
|
|
19
|
+
* `fusion.http.request.duration` record. Clients configured with their own
|
|
20
|
+
* `middlewareHandler` replace the configurator middleware and are not instrumented.
|
|
21
|
+
*
|
|
22
|
+
* Telemetry is resolved after initialization through a plugin, so HTTP never waits for
|
|
23
|
+
* telemetry and requests issued while modules initialize are not recorded. The plugin
|
|
24
|
+
* teardown detaches instrumentation before modules dispose, without aborting requests.
|
|
25
|
+
*
|
|
26
|
+
* @param configurator - Host configurator owning the HTTP and telemetry modules.
|
|
27
|
+
* @returns The installer the host calls once configuration has settled.
|
|
28
|
+
* @template TModules - Modules registered on the host configurator.
|
|
29
|
+
* @template TRef - Reference type forwarded to module initialization.
|
|
30
|
+
*/
|
|
31
|
+
export declare function connectHttpTelemetry<TModules extends Array<AnyModule>, TRef>(configurator: ModulesConfigurator<TModules, TRef>): HostHttpTelemetry;
|
|
32
|
+
export default connectHttpTelemetry;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -32,5 +32,6 @@ export { FrameworkConfigurator,
|
|
|
32
32
|
* @deprecated Use {@link FrameworkConfigurator} instead.
|
|
33
33
|
*/
|
|
34
34
|
FrameworkConfigurator as FusionConfigurator, } from './FrameworkConfigurator.js';
|
|
35
|
+
export type { FrameworkConfiguratorOptions } from './FrameworkConfigurator.js';
|
|
35
36
|
export type { FusionModules, FusionModulesInstance, Fusion, FusionRenderFn } from './types.js';
|
|
36
37
|
export { default, init } from './init.js';
|
|
@@ -4,7 +4,7 @@ import { type IHttpClientConfigurator } from '@equinor/fusion-framework-module-h
|
|
|
4
4
|
import { type MsalMockConfigurator } from '@equinor/fusion-framework-module-msal/mock';
|
|
5
5
|
import { type ServiceDiscoveryMockConfigurator } from '@equinor/fusion-framework-module-service-discovery/mock';
|
|
6
6
|
import { type IApiConfigurator } from '@equinor/fusion-framework-module-services';
|
|
7
|
-
import {
|
|
7
|
+
import { TelemetryMockConfigurator } from '@equinor/fusion-framework-module-telemetry/mock';
|
|
8
8
|
import { FrameworkConfigurator } from '../FrameworkConfigurator.js';
|
|
9
9
|
/**
|
|
10
10
|
* The real framework configurator, with every built-in module that reaches
|
|
@@ -69,9 +69,8 @@ export declare class FrameworkMockConfigurator<TModules extends Array<AnyModule>
|
|
|
69
69
|
* @remarks
|
|
70
70
|
* The module system otherwise builds a fresh configurator from its own
|
|
71
71
|
* `configure` factory during the configure phase — too late for a test to
|
|
72
|
-
* reach, and a new instance on every call besides.
|
|
73
|
-
*
|
|
74
|
-
* result under the module's own name.
|
|
72
|
+
* reach, and a new instance on every call besides. Prepared registration
|
|
73
|
+
* supplies that exact builder without replacing the module's factory.
|
|
75
74
|
*
|
|
76
75
|
* A subclass registering a module supplied through {@link TModules} uses
|
|
77
76
|
* this the same way `.msal` and `.serviceDiscovery` do, to expose its own
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "9.0.
|
|
1
|
+
export declare const version = "9.1.0-next.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.1.0-next.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"directory": "packages/framework"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@equinor/fusion-framework-module": "6.
|
|
45
|
-
"@equinor/fusion-framework-module-context": "9.0.
|
|
46
|
-
"@equinor/fusion-framework-module-event": "6.1.
|
|
47
|
-
"@equinor/fusion-framework-module-http": "8.1.
|
|
48
|
-
"@equinor/fusion-framework-module-msal": "12.0.
|
|
49
|
-
"@equinor/fusion-framework-module-service-discovery": "10.
|
|
50
|
-
"@equinor/fusion-framework-module-services": "8.
|
|
51
|
-
"@equinor/fusion-framework-module-telemetry": "
|
|
44
|
+
"@equinor/fusion-framework-module": "6.2.0-next.0",
|
|
45
|
+
"@equinor/fusion-framework-module-context": "9.1.0-next.0",
|
|
46
|
+
"@equinor/fusion-framework-module-event": "6.1.4-next.0",
|
|
47
|
+
"@equinor/fusion-framework-module-http": "8.1.5-next.0",
|
|
48
|
+
"@equinor/fusion-framework-module-msal": "12.1.0-next.0",
|
|
49
|
+
"@equinor/fusion-framework-module-service-discovery": "10.3.0-next.0",
|
|
50
|
+
"@equinor/fusion-framework-module-services": "8.2.0-next.0",
|
|
51
|
+
"@equinor/fusion-framework-module-telemetry": "8.0.0-next.0",
|
|
52
52
|
"rxjs": "^7.8.1"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|