@equinor/fusion-framework-module-analytics 1.0.2 → 2.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.
- package/CHANGELOG.md +34 -0
- package/README.md +147 -130
- package/dist/esm/AnalyticsConfigurator.js +22 -17
- package/dist/esm/AnalyticsConfigurator.js.map +1 -1
- package/dist/esm/AnalyticsProvider.js +39 -18
- package/dist/esm/AnalyticsProvider.js.map +1 -1
- package/dist/esm/adapters/ConsoleAnalyticsAdapter.js +15 -1
- package/dist/esm/adapters/ConsoleAnalyticsAdapter.js.map +1 -1
- package/dist/esm/adapters/FusionAnalyticsAdapter.js +32 -3
- package/dist/esm/adapters/FusionAnalyticsAdapter.js.map +1 -1
- package/dist/esm/adapters/index.js.map +1 -1
- package/dist/esm/collectors/AppLoadedCollector.js +21 -5
- package/dist/esm/collectors/AppLoadedCollector.js.map +1 -1
- package/dist/esm/collectors/AppSelectedCollector.js +17 -5
- package/dist/esm/collectors/AppSelectedCollector.js.map +1 -1
- package/dist/esm/collectors/BaseCollector.js +48 -3
- package/dist/esm/collectors/BaseCollector.js.map +1 -1
- package/dist/esm/collectors/ContextSelectedCollector.js +20 -5
- package/dist/esm/collectors/ContextSelectedCollector.js.map +1 -1
- package/dist/esm/collectors/index.js.map +1 -1
- package/dist/esm/collectors/utils/extractAppMetadata.js +25 -4
- package/dist/esm/collectors/utils/extractAppMetadata.js.map +1 -1
- package/dist/esm/collectors/utils/extractContextMetadata.js +13 -2
- package/dist/esm/collectors/utils/extractContextMetadata.js.map +1 -1
- package/dist/esm/enable-analytics.js +18 -3
- package/dist/esm/enable-analytics.js.map +1 -1
- package/dist/esm/index.js +18 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/logExporters/fusionOTLPLogExporter/FusionOTLPLogExporter.js +26 -4
- package/dist/esm/logExporters/fusionOTLPLogExporter/FusionOTLPLogExporter.js.map +1 -1
- package/dist/esm/logExporters/fusionOTLPLogExporter/HttpClientExporterTransport.js +36 -7
- package/dist/esm/logExporters/fusionOTLPLogExporter/HttpClientExporterTransport.js.map +1 -1
- package/dist/esm/logExporters/index.js +8 -0
- package/dist/esm/logExporters/index.js.map +1 -1
- package/dist/esm/module.js +8 -8
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/AnalyticsConfigurator.d.ts +22 -17
- package/dist/types/AnalyticsConfigurator.interface.d.ts +41 -12
- package/dist/types/AnalyticsProvider.d.ts +32 -18
- package/dist/types/AnalyticsProvider.interface.d.ts +28 -6
- package/dist/types/adapters/AnalyticsAdapter.interface.d.ts +15 -2
- package/dist/types/adapters/ConsoleAnalyticsAdapter.d.ts +15 -1
- package/dist/types/adapters/FusionAnalyticsAdapter.d.ts +32 -3
- package/dist/types/adapters/index.d.ts +8 -0
- package/dist/types/collectors/AnalyticsCollector.interface.d.ts +11 -2
- package/dist/types/collectors/AppLoadedCollector.d.ts +20 -2
- package/dist/types/collectors/AppSelectedCollector.d.ts +16 -2
- package/dist/types/collectors/BaseCollector.d.ts +58 -3
- package/dist/types/collectors/ContextSelectedCollector.d.ts +19 -2
- package/dist/types/collectors/index.d.ts +8 -0
- package/dist/types/collectors/utils/extractAppMetadata.d.ts +27 -0
- package/dist/types/collectors/utils/extractContextMetadata.d.ts +14 -0
- package/dist/types/enable-analytics.d.ts +19 -3
- package/dist/types/index.d.ts +18 -0
- package/dist/types/logExporters/fusionOTLPLogExporter/FusionOTLPLogExporter.d.ts +21 -3
- package/dist/types/logExporters/fusionOTLPLogExporter/HttpClientExporterTransport.d.ts +24 -1
- package/dist/types/logExporters/index.d.ts +8 -0
- package/dist/types/module.d.ts +15 -15
- package/dist/types/types.d.ts +38 -7
- package/dist/types/version.d.ts +1 -1
- package/package.json +11 -11
- package/src/AnalyticsConfigurator.interface.ts +41 -12
- package/src/AnalyticsConfigurator.ts +22 -17
- package/src/AnalyticsProvider.interface.ts +28 -6
- package/src/AnalyticsProvider.ts +39 -18
- package/src/adapters/AnalyticsAdapter.interface.ts +15 -2
- package/src/adapters/ConsoleAnalyticsAdapter.ts +15 -1
- package/src/adapters/FusionAnalyticsAdapter.ts +32 -3
- package/src/adapters/index.ts +8 -0
- package/src/collectors/AnalyticsCollector.interface.ts +11 -2
- package/src/collectors/AppLoadedCollector.ts +21 -5
- package/src/collectors/AppSelectedCollector.ts +17 -5
- package/src/collectors/BaseCollector.ts +58 -3
- package/src/collectors/ContextSelectedCollector.ts +20 -5
- package/src/collectors/index.ts +8 -0
- package/src/collectors/utils/extractAppMetadata.ts +27 -4
- package/src/collectors/utils/extractContextMetadata.ts +14 -2
- package/src/enable-analytics.ts +19 -3
- package/src/index.ts +19 -0
- package/src/logExporters/fusionOTLPLogExporter/FusionOTLPLogExporter.ts +26 -4
- package/src/logExporters/fusionOTLPLogExporter/HttpClientExporterTransport.ts +36 -7
- package/src/logExporters/index.ts +8 -0
- package/src/module.ts +15 -15
- package/src/types.ts +39 -8
- package/src/version.ts +1 -1
package/src/module.ts
CHANGED
|
@@ -5,16 +5,16 @@ import { AnalyticsConfigurator } from './AnalyticsConfigurator.js';
|
|
|
5
5
|
import { AnalyticsProvider } from './AnalyticsProvider.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Represents the Analytics module type within the Fusion Framework module system.
|
|
9
9
|
*
|
|
10
10
|
* @remarks
|
|
11
|
-
* This type defines a module
|
|
12
|
-
* It specifies the provider and configurator interfaces for analytics
|
|
13
|
-
*
|
|
11
|
+
* This type defines a module named `analytics` that integrates with the framework's
|
|
12
|
+
* module system. It specifies the provider and configurator interfaces for analytics
|
|
13
|
+
* functionality, and declares a self-dependency so that child modules can inherit
|
|
14
|
+
* analytics from a parent scope.
|
|
14
15
|
*
|
|
15
|
-
* @
|
|
16
|
-
* @
|
|
17
|
-
* @typeParam AnalyticsModule - Self-reference to allow for recursive or hierarchical module composition.
|
|
16
|
+
* @see {@link IAnalyticsProvider} for the runtime provider interface.
|
|
17
|
+
* @see {@link IAnalyticsConfigurator} for configuration-time setup.
|
|
18
18
|
*/
|
|
19
19
|
export type AnalyticsModule = Module<
|
|
20
20
|
'analytics',
|
|
@@ -27,15 +27,15 @@ export type AnalyticsModule = Module<
|
|
|
27
27
|
* Analytics module definition for the Fusion Framework.
|
|
28
28
|
*
|
|
29
29
|
* @remarks
|
|
30
|
-
* This module provides analytics capabilities by configuring and initializing
|
|
30
|
+
* This module provides analytics capabilities by configuring and initializing an
|
|
31
|
+
* {@link AnalyticsProvider}. Register it with {@link enableAnalytics} or add it
|
|
32
|
+
* directly to a module configurator.
|
|
31
33
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* - @param args - Initialization arguments, including configuration and module dependencies.
|
|
38
|
-
* - @returns A promise that resolves to an instance of IAnalyticsProvider.
|
|
34
|
+
* - `name` — `'analytics'`
|
|
35
|
+
* - `configure()` — creates a new {@link AnalyticsConfigurator} instance.
|
|
36
|
+
* - `initialize(args)` — resolves the configuration, creates an
|
|
37
|
+
* {@link AnalyticsProvider}, calls {@link AnalyticsProvider.initialize},
|
|
38
|
+
* and returns the ready-to-use provider.
|
|
39
39
|
*/
|
|
40
40
|
export const module = {
|
|
41
41
|
name: 'analytics',
|
package/src/types.ts
CHANGED
|
@@ -1,29 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scalar analytics attribute value: a string, number, or boolean.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Mirrors the OpenTelemetry `AnyValue` scalar subset used in log record
|
|
6
|
+
* attributes and event bodies.
|
|
7
|
+
*/
|
|
1
8
|
export type AnyValueScalar = string | number | boolean;
|
|
9
|
+
|
|
10
|
+
/** Array of {@link AnyValue} entries, allowing nested attribute structures. */
|
|
2
11
|
export type AnyValueArray = Array<AnyValue>;
|
|
3
12
|
|
|
4
13
|
/**
|
|
5
|
-
*
|
|
14
|
+
* A key–value map where each value is an {@link AnyValue}.
|
|
15
|
+
*
|
|
16
|
+
* Used as the attribute bag on {@link AnalyticsEvent} instances and for
|
|
17
|
+
* nested attribute structures.
|
|
6
18
|
*/
|
|
7
19
|
export interface AnyValueMap {
|
|
8
20
|
[attributeKey: string]: AnyValue;
|
|
9
21
|
}
|
|
10
22
|
|
|
11
23
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* -
|
|
16
|
-
* -
|
|
17
|
-
* -
|
|
24
|
+
* A flexible value type compatible with OpenTelemetry log record bodies and attributes.
|
|
25
|
+
*
|
|
26
|
+
* Can be one of the following:
|
|
27
|
+
* - a scalar value (`string | number | boolean`)
|
|
28
|
+
* - a byte array (`Uint8Array`)
|
|
29
|
+
* - an array of any value ({@link AnyValueArray})
|
|
30
|
+
* - a map from string to any value ({@link AnyValueMap})
|
|
31
|
+
* - `null` or `undefined`
|
|
18
32
|
*/
|
|
19
|
-
|
|
20
33
|
export type AnyValue = AnyValueScalar | Uint8Array | AnyValueArray | AnyValueMap | null | undefined;
|
|
21
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Represents a single analytics event emitted by a collector and consumed by adapters.
|
|
37
|
+
*
|
|
38
|
+
* @template TValue - The event body type, defaults to {@link AnyValue}.
|
|
39
|
+
* @template TAttr - The attributes map type, defaults to {@link AnyValueMap}.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const event: AnalyticsEvent = {
|
|
44
|
+
* name: 'button-click',
|
|
45
|
+
* value: 'submit',
|
|
46
|
+
* attributes: { section: 'header', count: 1 },
|
|
47
|
+
* };
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
22
50
|
export type AnalyticsEvent<
|
|
23
51
|
TValue extends AnyValue = AnyValue,
|
|
24
52
|
TAttr extends AnyValueMap = AnyValueMap,
|
|
25
53
|
> = {
|
|
54
|
+
/** Descriptive event name used to categorise the analytic, e.g. `'context-selected'`. */
|
|
26
55
|
name: string;
|
|
56
|
+
/** The primary payload of the event. */
|
|
27
57
|
value: TValue;
|
|
58
|
+
/** Optional metadata attached to the event for filtering and grouping. */
|
|
28
59
|
attributes?: TAttr;
|
|
29
60
|
};
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '
|
|
2
|
+
export const version = '2.0.0';
|