@grafana/faro-core 1.14.1 → 1.14.2
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/dist/bundle/faro-core.iife.js +1 -1
- package/dist/bundle/types/api/ItemBuffer.d.ts +7 -0
- package/dist/bundle/types/api/apiTestHelpers.d.ts +11 -0
- package/dist/bundle/types/api/const.d.ts +3 -0
- package/dist/bundle/types/api/events/initialize.d.ts +13 -2
- package/dist/bundle/types/api/events/types.d.ts +11 -0
- package/dist/bundle/types/api/exceptions/initialize.d.ts +13 -2
- package/dist/bundle/types/api/exceptions/types.d.ts +2 -0
- package/dist/bundle/types/api/index.d.ts +3 -1
- package/dist/bundle/types/api/initialize.d.ts +3 -1
- package/dist/bundle/types/api/logs/initialize.d.ts +13 -2
- package/dist/bundle/types/api/logs/types.d.ts +3 -1
- package/dist/bundle/types/api/measurements/initialize.d.ts +13 -1
- package/dist/bundle/types/api/measurements/types.d.ts +2 -0
- package/dist/bundle/types/api/meta/initialize.d.ts +14 -2
- package/dist/bundle/types/api/types.d.ts +37 -0
- package/dist/bundle/types/api/userActionLifecycleHandler.d.ts +13 -0
- package/dist/bundle/types/config/types.d.ts +21 -12
- package/dist/bundle/types/index.d.ts +4 -4
- package/dist/bundle/types/testUtils/mockTransport.d.ts +1 -1
- package/dist/bundle/types/utils/index.d.ts +2 -0
- package/dist/bundle/types/utils/reactive.d.ts +46 -0
- package/dist/bundle/types/version.d.ts +1 -1
- package/dist/cjs/api/ItemBuffer.js +27 -0
- package/dist/cjs/api/ItemBuffer.js.map +1 -0
- package/dist/cjs/api/apiTestHelpers.js +36 -0
- package/dist/cjs/api/apiTestHelpers.js.map +1 -0
- package/dist/cjs/api/const.js +7 -0
- package/dist/cjs/api/const.js.map +1 -0
- package/dist/cjs/api/events/initialize.js +15 -6
- package/dist/cjs/api/events/initialize.js.map +1 -1
- package/dist/cjs/api/events/types.js.map +1 -1
- package/dist/cjs/api/exceptions/initialize.js +51 -37
- package/dist/cjs/api/exceptions/initialize.js.map +1 -1
- package/dist/cjs/api/exceptions/types.js.map +1 -1
- package/dist/cjs/api/index.js +7 -1
- package/dist/cjs/api/index.js.map +1 -1
- package/dist/cjs/api/initialize.js +16 -2
- package/dist/cjs/api/initialize.js.map +1 -1
- package/dist/cjs/api/logs/initialize.js +15 -6
- package/dist/cjs/api/logs/initialize.js.map +1 -1
- package/dist/cjs/api/logs/types.js.map +1 -1
- package/dist/cjs/api/measurements/initialize.js +12 -3
- package/dist/cjs/api/measurements/initialize.js.map +1 -1
- package/dist/cjs/api/measurements/types.js.map +1 -1
- package/dist/cjs/api/meta/initialize.js +2 -1
- package/dist/cjs/api/meta/initialize.js.map +1 -1
- package/dist/cjs/api/types.js.map +1 -1
- package/dist/cjs/api/userActionLifecycleHandler.js +59 -0
- package/dist/cjs/api/userActionLifecycleHandler.js.map +1 -0
- package/dist/cjs/config/types.js.map +1 -1
- package/dist/cjs/index.js +8 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/index.js +4 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/reactive.js +104 -0
- package/dist/cjs/utils/reactive.js.map +1 -0
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/api/ItemBuffer.js +21 -0
- package/dist/esm/api/ItemBuffer.js.map +1 -0
- package/dist/esm/api/apiTestHelpers.js +33 -0
- package/dist/esm/api/apiTestHelpers.js.map +1 -0
- package/dist/esm/api/const.js +4 -0
- package/dist/esm/api/const.js.map +1 -0
- package/dist/esm/api/events/initialize.js +15 -7
- package/dist/esm/api/events/initialize.js.map +1 -1
- package/dist/esm/api/events/types.js.map +1 -1
- package/dist/esm/api/exceptions/initialize.js +47 -34
- package/dist/esm/api/exceptions/initialize.js.map +1 -1
- package/dist/esm/api/exceptions/types.js.map +1 -1
- package/dist/esm/api/index.js +2 -0
- package/dist/esm/api/index.js.map +1 -1
- package/dist/esm/api/initialize.js +15 -1
- package/dist/esm/api/initialize.js.map +1 -1
- package/dist/esm/api/logs/initialize.js +12 -4
- package/dist/esm/api/logs/initialize.js.map +1 -1
- package/dist/esm/api/logs/types.js.map +1 -1
- package/dist/esm/api/measurements/initialize.js +12 -4
- package/dist/esm/api/measurements/initialize.js.map +1 -1
- package/dist/esm/api/measurements/types.js.map +1 -1
- package/dist/esm/api/meta/initialize.js +1 -1
- package/dist/esm/api/meta/initialize.js.map +1 -1
- package/dist/esm/api/types.js.map +1 -1
- package/dist/esm/api/userActionLifecycleHandler.js +43 -0
- package/dist/esm/api/userActionLifecycleHandler.js.map +1 -0
- package/dist/esm/config/types.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/reactive.js +93 -0
- package/dist/esm/utils/reactive.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/spec/core/src/api/ItemBuffer.js +27 -0
- package/dist/spec/core/src/api/ItemBuffer.js.map +1 -0
- package/dist/spec/core/src/api/apiTestHelpers.js +36 -0
- package/dist/spec/core/src/api/apiTestHelpers.js.map +1 -0
- package/dist/spec/core/src/api/const.js +7 -0
- package/dist/spec/core/src/api/const.js.map +1 -0
- package/dist/spec/core/src/api/events/initialize.js +15 -6
- package/dist/spec/core/src/api/events/initialize.js.map +1 -1
- package/dist/spec/core/src/api/events/initialize.test.js +57 -0
- package/dist/spec/core/src/api/events/initialize.test.js.map +1 -1
- package/dist/spec/core/src/api/events/types.js.map +1 -1
- package/dist/spec/core/src/api/exceptions/initialize.js +51 -37
- package/dist/spec/core/src/api/exceptions/initialize.js.map +1 -1
- package/dist/spec/core/src/api/exceptions/initialize.test.js +62 -3
- package/dist/spec/core/src/api/exceptions/initialize.test.js.map +1 -1
- package/dist/spec/core/src/api/exceptions/types.js.map +1 -1
- package/dist/spec/core/src/api/index.js +7 -1
- package/dist/spec/core/src/api/index.js.map +1 -1
- package/dist/spec/core/src/api/initialize.js +16 -2
- package/dist/spec/core/src/api/initialize.js.map +1 -1
- package/dist/spec/core/src/api/initialize.test.js +73 -0
- package/dist/spec/core/src/api/initialize.test.js.map +1 -0
- package/dist/spec/core/src/api/itemBuffer.test.js +36 -0
- package/dist/spec/core/src/api/itemBuffer.test.js.map +1 -0
- package/dist/spec/core/src/api/logs/initialize.js +15 -6
- package/dist/spec/core/src/api/logs/initialize.js.map +1 -1
- package/dist/spec/core/src/api/logs/initialize.test.js +98 -0
- package/dist/spec/core/src/api/logs/initialize.test.js.map +1 -1
- package/dist/spec/core/src/api/logs/types.js.map +1 -1
- package/dist/spec/core/src/api/measurements/initialize.js +12 -3
- package/dist/spec/core/src/api/measurements/initialize.js.map +1 -1
- package/dist/spec/core/src/api/measurements/initialize.test.js +105 -0
- package/dist/spec/core/src/api/measurements/initialize.test.js.map +1 -1
- package/dist/spec/core/src/api/measurements/types.js.map +1 -1
- package/dist/spec/core/src/api/meta/initialize.js +2 -1
- package/dist/spec/core/src/api/meta/initialize.js.map +1 -1
- package/dist/spec/core/src/api/meta/initilialize.test.js +1 -3
- package/dist/spec/core/src/api/meta/initilialize.test.js.map +1 -1
- package/dist/spec/core/src/api/types.js.map +1 -1
- package/dist/spec/core/src/api/userActionLifecycleHandler.js +59 -0
- package/dist/spec/core/src/api/userActionLifecycleHandler.js.map +1 -0
- package/dist/spec/core/src/api/userActionLifecycleHandler.test.js +152 -0
- package/dist/spec/core/src/api/userActionLifecycleHandler.test.js.map +1 -0
- package/dist/spec/core/src/config/types.js.map +1 -1
- package/dist/spec/core/src/index.js +8 -2
- package/dist/spec/core/src/index.js.map +1 -1
- package/dist/spec/core/src/utils/index.js +4 -1
- package/dist/spec/core/src/utils/index.js.map +1 -1
- package/dist/spec/core/src/utils/reactive.js +104 -0
- package/dist/spec/core/src/utils/reactive.js.map +1 -0
- package/dist/spec/core/src/utils/reactive.test.js +104 -0
- package/dist/spec/core/src/utils/reactive.test.js.map +1 -0
- package/dist/spec/core/src/version.js +1 -1
- package/dist/spec/core/src/version.js.map +1 -1
- package/dist/types/api/ItemBuffer.d.ts +7 -0
- package/dist/types/api/apiTestHelpers.d.ts +11 -0
- package/dist/types/api/const.d.ts +3 -0
- package/dist/types/api/events/initialize.d.ts +13 -2
- package/dist/types/api/events/types.d.ts +11 -0
- package/dist/types/api/exceptions/initialize.d.ts +13 -2
- package/dist/types/api/exceptions/types.d.ts +2 -0
- package/dist/types/api/index.d.ts +3 -1
- package/dist/types/api/initialize.d.ts +3 -1
- package/dist/types/api/logs/initialize.d.ts +13 -2
- package/dist/types/api/logs/types.d.ts +3 -1
- package/dist/types/api/measurements/initialize.d.ts +13 -1
- package/dist/types/api/measurements/types.d.ts +2 -0
- package/dist/types/api/meta/initialize.d.ts +14 -2
- package/dist/types/api/types.d.ts +37 -0
- package/dist/types/api/userActionLifecycleHandler.d.ts +13 -0
- package/dist/types/config/types.d.ts +21 -12
- package/dist/types/core/src/api/ItemBuffer.d.ts +7 -0
- package/dist/types/core/src/api/apiTestHelpers.d.ts +11 -0
- package/dist/types/core/src/api/const.d.ts +3 -0
- package/dist/types/core/src/api/events/initialize.d.ts +13 -2
- package/dist/types/core/src/api/events/types.d.ts +11 -0
- package/dist/types/core/src/api/exceptions/initialize.d.ts +13 -2
- package/dist/types/core/src/api/exceptions/types.d.ts +2 -0
- package/dist/types/core/src/api/index.d.ts +3 -1
- package/dist/types/core/src/api/initialize.d.ts +3 -1
- package/dist/types/core/src/api/initialize.test.d.ts +1 -0
- package/dist/types/core/src/api/itemBuffer.test.d.ts +1 -0
- package/dist/types/core/src/api/logs/initialize.d.ts +13 -2
- package/dist/types/core/src/api/logs/types.d.ts +3 -1
- package/dist/types/core/src/api/measurements/initialize.d.ts +13 -1
- package/dist/types/core/src/api/measurements/types.d.ts +2 -0
- package/dist/types/core/src/api/meta/initialize.d.ts +14 -2
- package/dist/types/core/src/api/types.d.ts +37 -0
- package/dist/types/core/src/api/userActionLifecycleHandler.d.ts +13 -0
- package/dist/types/core/src/api/userActionLifecycleHandler.test.d.ts +1 -0
- package/dist/types/core/src/config/types.d.ts +21 -12
- package/dist/types/core/src/index.d.ts +4 -4
- package/dist/types/core/src/testUtils/mockTransport.d.ts +1 -1
- package/dist/types/core/src/utils/index.d.ts +2 -0
- package/dist/types/core/src/utils/reactive.d.ts +46 -0
- package/dist/types/core/src/utils/reactive.test.d.ts +1 -0
- package/dist/types/core/src/version.d.ts +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/testUtils/mockTransport.d.ts +1 -1
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/reactive.d.ts +46 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import type { Config } from '../../config';
|
|
2
2
|
import type { InternalLogger } from '../../internalLogger';
|
|
3
3
|
import type { Metas } from '../../metas';
|
|
4
|
+
import { TransportItem } from '../../transports';
|
|
4
5
|
import type { Transports } from '../../transports';
|
|
5
6
|
import type { UnpatchedConsole } from '../../unpatchedConsole';
|
|
7
|
+
import type { ItemBuffer } from '../ItemBuffer';
|
|
6
8
|
import type { TracesAPI } from '../traces';
|
|
9
|
+
import type { ApiMessageBusMessages } from '../types';
|
|
7
10
|
import type { MeasurementsAPI } from './types';
|
|
8
|
-
export declare function initializeMeasurementsAPI(
|
|
11
|
+
export declare function initializeMeasurementsAPI({ internalLogger, config, metas, transports, tracesApi, actionBuffer, getMessage, }: {
|
|
12
|
+
unpatchedConsole: UnpatchedConsole;
|
|
13
|
+
internalLogger: InternalLogger;
|
|
14
|
+
config: Config;
|
|
15
|
+
metas: Metas;
|
|
16
|
+
transports: Transports;
|
|
17
|
+
tracesApi: TracesAPI;
|
|
18
|
+
actionBuffer: ItemBuffer<TransportItem>;
|
|
19
|
+
getMessage: () => ApiMessageBusMessages | undefined;
|
|
20
|
+
}): MeasurementsAPI;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SpanContext } from '@opentelemetry/api';
|
|
2
2
|
import type { TraceContext } from '../traces';
|
|
3
|
+
import type { UserAction } from '../types';
|
|
3
4
|
export type MeasurementContext = Record<string, string>;
|
|
4
5
|
export interface MeasurementEvent<V extends {
|
|
5
6
|
[label: string]: number;
|
|
@@ -11,6 +12,7 @@ export interface MeasurementEvent<V extends {
|
|
|
11
12
|
timestamp: string;
|
|
12
13
|
trace?: TraceContext;
|
|
13
14
|
context?: MeasurementContext;
|
|
15
|
+
action?: UserAction;
|
|
14
16
|
}
|
|
15
17
|
export interface PushMeasurementOptions {
|
|
16
18
|
skipDedupe?: boolean;
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import type { Config } from '../../config';
|
|
2
2
|
import type { InternalLogger } from '../../internalLogger';
|
|
3
3
|
import type { Metas } from '../../metas';
|
|
4
|
-
import type { Transports } from '../../transports';
|
|
4
|
+
import type { TransportItem, Transports } from '../../transports';
|
|
5
5
|
import type { UnpatchedConsole } from '../../unpatchedConsole';
|
|
6
|
+
import type { ItemBuffer } from '../ItemBuffer';
|
|
7
|
+
import type { TracesAPI } from '../traces';
|
|
8
|
+
import type { ApiMessageBusMessages } from '../types';
|
|
6
9
|
import type { MetaAPI } from './types';
|
|
7
|
-
export declare function initializeMetaAPI(
|
|
10
|
+
export declare function initializeMetaAPI({ internalLogger, metas, }: {
|
|
11
|
+
unpatchedConsole: UnpatchedConsole;
|
|
12
|
+
internalLogger: InternalLogger;
|
|
13
|
+
config: Config;
|
|
14
|
+
metas: Metas;
|
|
15
|
+
transports: Transports;
|
|
16
|
+
tracesApi: TracesAPI;
|
|
17
|
+
actionBuffer: ItemBuffer<TransportItem>;
|
|
18
|
+
getMessage: () => ApiMessageBusMessages | undefined;
|
|
19
|
+
}): MetaAPI;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { USER_ACTION_CANCEL_MESSAGE_TYPE, USER_ACTION_END_MESSAGE_TYPE, USER_ACTION_START_MESSAGE_TYPE } from './const';
|
|
1
2
|
import type { EventEvent, EventsAPI } from './events';
|
|
2
3
|
import type { ExceptionEvent, ExceptionsAPI } from './exceptions';
|
|
3
4
|
import type { LogEvent, LogsAPI } from './logs';
|
|
@@ -6,3 +7,39 @@ import type { MetaAPI } from './meta';
|
|
|
6
7
|
import type { TraceEvent, TracesAPI } from './traces';
|
|
7
8
|
export type APIEvent = LogEvent | ExceptionEvent | MeasurementEvent | TraceEvent | EventEvent;
|
|
8
9
|
export type API = LogsAPI & ExceptionsAPI & MeasurementsAPI & TracesAPI & MetaAPI & EventsAPI;
|
|
10
|
+
export type ApiMessageBusMessages = UserActionStartMessage | UserActionEndMessage | UserActionCancelMessage;
|
|
11
|
+
export type UserActionMessageType = typeof USER_ACTION_START_MESSAGE_TYPE | typeof USER_ACTION_END_MESSAGE_TYPE | typeof USER_ACTION_CANCEL_MESSAGE_TYPE;
|
|
12
|
+
export type UserActionStartMessage = {
|
|
13
|
+
type: typeof USER_ACTION_START_MESSAGE_TYPE;
|
|
14
|
+
name: string;
|
|
15
|
+
startTime: number;
|
|
16
|
+
/**
|
|
17
|
+
* Unique identifier of the parent user action to which this action belongs.
|
|
18
|
+
*/
|
|
19
|
+
parentId: string;
|
|
20
|
+
};
|
|
21
|
+
export type UserActionEndMessage = {
|
|
22
|
+
type: typeof USER_ACTION_END_MESSAGE_TYPE;
|
|
23
|
+
name: string;
|
|
24
|
+
startTime: number;
|
|
25
|
+
endTime: number;
|
|
26
|
+
duration: number;
|
|
27
|
+
eventType: string;
|
|
28
|
+
/**
|
|
29
|
+
* Unique identifier for the user action. Will be undefined for messages related to child actions.
|
|
30
|
+
*/
|
|
31
|
+
id: string;
|
|
32
|
+
};
|
|
33
|
+
export type UserActionCancelMessage = {
|
|
34
|
+
type: typeof USER_ACTION_CANCEL_MESSAGE_TYPE;
|
|
35
|
+
name: string;
|
|
36
|
+
/**
|
|
37
|
+
* Unique identifier of the parent user action to which this action belongs.
|
|
38
|
+
*/
|
|
39
|
+
parentId?: string;
|
|
40
|
+
};
|
|
41
|
+
export type UserAction = {
|
|
42
|
+
name: string;
|
|
43
|
+
id?: string;
|
|
44
|
+
parentId?: string;
|
|
45
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Config } from '../config';
|
|
2
|
+
import { type TransportItem, type Transports } from '../transports';
|
|
3
|
+
import type { Observable } from '../utils';
|
|
4
|
+
import { ItemBuffer } from './ItemBuffer';
|
|
5
|
+
import type { APIEvent, ApiMessageBusMessages } from './types';
|
|
6
|
+
export declare function createUserActionLifecycleHandler({ apiMessageBus, transports, config, }: {
|
|
7
|
+
apiMessageBus: Observable<ApiMessageBusMessages>;
|
|
8
|
+
transports: Transports;
|
|
9
|
+
config: Config;
|
|
10
|
+
}): {
|
|
11
|
+
actionBuffer: ItemBuffer<TransportItem<APIEvent>>;
|
|
12
|
+
getMessage: () => ApiMessageBusMessages | undefined;
|
|
13
|
+
};
|
|
@@ -2,7 +2,7 @@ import type { APIEvent, LogArgsSerializer, StacktraceParser } from '../api';
|
|
|
2
2
|
import type { Instrumentation } from '../instrumentations';
|
|
3
3
|
import type { InternalLoggerLevel } from '../internalLogger';
|
|
4
4
|
import type { Meta, MetaApp, MetaItem, MetaPage, MetaSession, MetaUser, MetaView } from '../metas';
|
|
5
|
-
import type { BatchExecutorOptions, BeforeSendHook, Transport } from '../transports';
|
|
5
|
+
import type { BatchExecutorOptions, BeforeSendHook, Transport, TransportItem } from '../transports';
|
|
6
6
|
import type { UnpatchedConsole } from '../unpatchedConsole';
|
|
7
7
|
import type { LogLevel } from '../utils';
|
|
8
8
|
type SamplingContext = {
|
|
@@ -192,18 +192,27 @@ export interface Config<P = APIEvent> {
|
|
|
192
192
|
generatePageId?: (location: Location) => string;
|
|
193
193
|
};
|
|
194
194
|
/**
|
|
195
|
-
*
|
|
195
|
+
* Enable or disable geolocation tracking.
|
|
196
|
+
* Geolocation tracking must be enabled in the Grafana Cloud settings first.
|
|
197
|
+
* It cannot be enabled solely on the client side.
|
|
198
|
+
* This option allows control over tracking on the client side to comply with user
|
|
199
|
+
* privacy requirements.
|
|
196
200
|
*/
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
201
|
+
trackGeolocation?: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* This is a preview feature.
|
|
204
|
+
* We have tested it thoroughly, but it is possible that it might not work as expected in all cases.
|
|
205
|
+
*/
|
|
206
|
+
trackUserActionsPreview?: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Configure your own attribute name for tracking user actions. Default is 'data-faro-user-action-name'
|
|
209
|
+
*/
|
|
210
|
+
trackUserActionsDataAttributeName?: string;
|
|
211
|
+
/**
|
|
212
|
+
* Predicate function to exclude items from user actions.
|
|
213
|
+
* If the function returns true, the item will be excluded from user actions.
|
|
214
|
+
*/
|
|
215
|
+
trackUserActionsExcludeItem?: (item: TransportItem<APIEvent>) => boolean;
|
|
207
216
|
}
|
|
208
217
|
export type Patterns = Array<string | RegExp>;
|
|
209
218
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Transports } from '../transports';
|
|
2
|
+
import type { TracesAPI } from './traces/types';
|
|
3
|
+
export declare const mockMetas: {
|
|
4
|
+
add: jest.Mock<any, any, any>;
|
|
5
|
+
remove: jest.Mock<any, any, any>;
|
|
6
|
+
addListener: jest.Mock<any, any, any>;
|
|
7
|
+
removeListener: jest.Mock<any, any, any>;
|
|
8
|
+
value: {};
|
|
9
|
+
};
|
|
10
|
+
export declare const mockTransports: Transports;
|
|
11
|
+
export declare const mockTracesApi: TracesAPI;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import type { Config } from '../../config';
|
|
2
2
|
import type { InternalLogger } from '../../internalLogger';
|
|
3
3
|
import type { Metas } from '../../metas';
|
|
4
|
-
import { Transports } from '../../transports';
|
|
4
|
+
import type { TransportItem, Transports } from '../../transports';
|
|
5
5
|
import type { UnpatchedConsole } from '../../unpatchedConsole';
|
|
6
|
+
import type { ItemBuffer } from '../ItemBuffer';
|
|
6
7
|
import type { TracesAPI } from '../traces';
|
|
8
|
+
import type { ApiMessageBusMessages } from '../types';
|
|
7
9
|
import type { EventsAPI } from './types';
|
|
8
|
-
export declare function initializeEventsAPI(
|
|
10
|
+
export declare function initializeEventsAPI({ internalLogger, config, metas, transports, tracesApi, actionBuffer, getMessage, }: {
|
|
11
|
+
unpatchedConsole: UnpatchedConsole;
|
|
12
|
+
internalLogger: InternalLogger;
|
|
13
|
+
config: Config;
|
|
14
|
+
metas: Metas;
|
|
15
|
+
transports: Transports;
|
|
16
|
+
tracesApi: TracesAPI;
|
|
17
|
+
actionBuffer: ItemBuffer<TransportItem>;
|
|
18
|
+
getMessage: () => ApiMessageBusMessages | undefined;
|
|
19
|
+
}): EventsAPI;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SpanContext } from '@opentelemetry/api';
|
|
2
2
|
import type { TraceContext } from '../traces';
|
|
3
|
+
import type { UserAction } from '../types';
|
|
3
4
|
export type EventAttributes = Record<string, string>;
|
|
4
5
|
export interface EventEvent {
|
|
5
6
|
name: string;
|
|
@@ -7,11 +8,21 @@ export interface EventEvent {
|
|
|
7
8
|
domain?: string;
|
|
8
9
|
attributes?: EventAttributes;
|
|
9
10
|
trace?: TraceContext;
|
|
11
|
+
action?: UserAction;
|
|
10
12
|
}
|
|
11
13
|
export interface PushEventOptions {
|
|
12
14
|
skipDedupe?: boolean;
|
|
13
15
|
spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;
|
|
14
16
|
timestampOverwriteMs?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Allows manual transformation of the payload before adding it to the internal buffer.
|
|
19
|
+
*
|
|
20
|
+
* @param payload - The event payload to be transformed.
|
|
21
|
+
* @returns The transformed event payload.
|
|
22
|
+
*
|
|
23
|
+
* @remarks This should be used sparingly and only in special cases where custom payload processing cannot be deferred to the before-send hook.
|
|
24
|
+
*/
|
|
25
|
+
customPayloadTransformer?: (payload: EventEvent) => EventEvent;
|
|
15
26
|
}
|
|
16
27
|
export interface EventsAPI {
|
|
17
28
|
pushEvent: (name: string, attributes?: EventAttributes, domain?: string, options?: PushEventOptions) => void;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import type { Config } from '../../config';
|
|
2
2
|
import type { InternalLogger } from '../../internalLogger';
|
|
3
3
|
import type { Metas } from '../../metas';
|
|
4
|
-
import type { Transports } from '../../transports';
|
|
4
|
+
import type { TransportItem, Transports } from '../../transports';
|
|
5
5
|
import type { UnpatchedConsole } from '../../unpatchedConsole';
|
|
6
|
+
import type { ItemBuffer } from '../ItemBuffer';
|
|
6
7
|
import type { TracesAPI } from '../traces';
|
|
8
|
+
import type { ApiMessageBusMessages } from '../types';
|
|
7
9
|
import type { ExceptionsAPI } from './types';
|
|
8
|
-
export declare function initializeExceptionsAPI(
|
|
10
|
+
export declare function initializeExceptionsAPI({ internalLogger, config, metas, transports, tracesApi, actionBuffer, getMessage, }: {
|
|
11
|
+
unpatchedConsole: UnpatchedConsole;
|
|
12
|
+
internalLogger: InternalLogger;
|
|
13
|
+
config: Config;
|
|
14
|
+
metas: Metas;
|
|
15
|
+
transports: Transports;
|
|
16
|
+
tracesApi: TracesAPI;
|
|
17
|
+
actionBuffer: ItemBuffer<TransportItem>;
|
|
18
|
+
getMessage: () => ApiMessageBusMessages | undefined;
|
|
19
|
+
}): ExceptionsAPI;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SpanContext } from '@opentelemetry/api';
|
|
2
2
|
import type { TraceContext } from '../traces';
|
|
3
|
+
import type { UserAction } from '../types';
|
|
3
4
|
export type StacktraceParser = (err: ExtendedError) => Stacktrace;
|
|
4
5
|
export interface ExceptionStackFrame {
|
|
5
6
|
filename: string;
|
|
@@ -23,6 +24,7 @@ export interface ExceptionEvent {
|
|
|
23
24
|
stacktrace?: Stacktrace;
|
|
24
25
|
trace?: TraceContext;
|
|
25
26
|
context?: ExceptionContext;
|
|
27
|
+
action?: UserAction;
|
|
26
28
|
}
|
|
27
29
|
export interface PushErrorOptions {
|
|
28
30
|
skipDedupe?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { initializeAPI } from './initialize';
|
|
2
|
-
export type { API, APIEvent } from './types';
|
|
2
|
+
export type { API, APIEvent, ApiMessageBusMessages, UserActionCancelMessage, UserActionEndMessage, UserActionStartMessage, UserAction, } from './types';
|
|
3
3
|
export type { EventAttributes, EventEvent, EventsAPI, PushEventOptions } from './events';
|
|
4
4
|
export { defaultExceptionType, defaultErrorArgsSerializer } from './exceptions';
|
|
5
5
|
export type { ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, PushErrorOptions, Stacktrace, StacktraceParser, } from './exceptions';
|
|
@@ -8,3 +8,5 @@ export type { LogContext, LogEvent, LogArgsSerializer, LogsAPI, PushLogOptions }
|
|
|
8
8
|
export type { MeasurementEvent, MeasurementsAPI, PushMeasurementOptions } from './measurements';
|
|
9
9
|
export type { MetaAPI } from './meta';
|
|
10
10
|
export type { OTELApi, TraceContext, TraceEvent, TracesAPI } from './traces';
|
|
11
|
+
export { apiMessageBus } from './initialize';
|
|
12
|
+
export { USER_ACTION_CANCEL_MESSAGE_TYPE, USER_ACTION_END_MESSAGE_TYPE, USER_ACTION_START_MESSAGE_TYPE } from './const';
|
|
@@ -3,5 +3,7 @@ import type { InternalLogger } from '../internalLogger';
|
|
|
3
3
|
import type { Metas } from '../metas';
|
|
4
4
|
import type { Transports } from '../transports';
|
|
5
5
|
import type { UnpatchedConsole } from '../unpatchedConsole';
|
|
6
|
-
import
|
|
6
|
+
import { Observable } from '../utils';
|
|
7
|
+
import type { API, ApiMessageBusMessages } from './types';
|
|
8
|
+
export declare const apiMessageBus: Observable<ApiMessageBusMessages>;
|
|
7
9
|
export declare function initializeAPI(unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, config: Config, metas: Metas, transports: Transports): API;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import type { Config } from '../../config';
|
|
2
2
|
import type { InternalLogger } from '../../internalLogger';
|
|
3
3
|
import type { Metas } from '../../metas';
|
|
4
|
-
import
|
|
4
|
+
import { TransportItem, Transports } from '../../transports';
|
|
5
5
|
import type { UnpatchedConsole } from '../../unpatchedConsole';
|
|
6
|
+
import type { ItemBuffer } from '../ItemBuffer';
|
|
6
7
|
import type { TracesAPI } from '../traces';
|
|
8
|
+
import type { ApiMessageBusMessages } from '../types';
|
|
7
9
|
import type { LogsAPI } from './types';
|
|
8
|
-
export declare function initializeLogsAPI(
|
|
10
|
+
export declare function initializeLogsAPI({ internalLogger, config, metas, transports, tracesApi, actionBuffer, getMessage, }: {
|
|
11
|
+
unpatchedConsole: UnpatchedConsole;
|
|
12
|
+
internalLogger: InternalLogger;
|
|
13
|
+
config: Config;
|
|
14
|
+
metas: Metas;
|
|
15
|
+
transports: Transports;
|
|
16
|
+
tracesApi: TracesAPI;
|
|
17
|
+
actionBuffer: ItemBuffer<TransportItem>;
|
|
18
|
+
getMessage: () => ApiMessageBusMessages | undefined;
|
|
19
|
+
}): LogsAPI;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { SpanContext } from '@opentelemetry/api';
|
|
2
2
|
import type { LogLevel } from '../../utils';
|
|
3
3
|
import type { TraceContext } from '../traces';
|
|
4
|
+
import type { UserAction } from '../types';
|
|
4
5
|
export type LogContext = Record<string, string>;
|
|
5
6
|
export interface LogEvent {
|
|
6
|
-
context: LogContext;
|
|
7
|
+
context: LogContext | undefined;
|
|
7
8
|
level: LogLevel;
|
|
8
9
|
message: string;
|
|
9
10
|
timestamp: string;
|
|
10
11
|
trace?: TraceContext;
|
|
12
|
+
action?: UserAction;
|
|
11
13
|
}
|
|
12
14
|
export interface PushLogOptions {
|
|
13
15
|
context?: LogContext;
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import type { Config } from '../../config';
|
|
2
2
|
import type { InternalLogger } from '../../internalLogger';
|
|
3
3
|
import type { Metas } from '../../metas';
|
|
4
|
+
import { TransportItem } from '../../transports';
|
|
4
5
|
import type { Transports } from '../../transports';
|
|
5
6
|
import type { UnpatchedConsole } from '../../unpatchedConsole';
|
|
7
|
+
import type { ItemBuffer } from '../ItemBuffer';
|
|
6
8
|
import type { TracesAPI } from '../traces';
|
|
9
|
+
import type { ApiMessageBusMessages } from '../types';
|
|
7
10
|
import type { MeasurementsAPI } from './types';
|
|
8
|
-
export declare function initializeMeasurementsAPI(
|
|
11
|
+
export declare function initializeMeasurementsAPI({ internalLogger, config, metas, transports, tracesApi, actionBuffer, getMessage, }: {
|
|
12
|
+
unpatchedConsole: UnpatchedConsole;
|
|
13
|
+
internalLogger: InternalLogger;
|
|
14
|
+
config: Config;
|
|
15
|
+
metas: Metas;
|
|
16
|
+
transports: Transports;
|
|
17
|
+
tracesApi: TracesAPI;
|
|
18
|
+
actionBuffer: ItemBuffer<TransportItem>;
|
|
19
|
+
getMessage: () => ApiMessageBusMessages | undefined;
|
|
20
|
+
}): MeasurementsAPI;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SpanContext } from '@opentelemetry/api';
|
|
2
2
|
import type { TraceContext } from '../traces';
|
|
3
|
+
import type { UserAction } from '../types';
|
|
3
4
|
export type MeasurementContext = Record<string, string>;
|
|
4
5
|
export interface MeasurementEvent<V extends {
|
|
5
6
|
[label: string]: number;
|
|
@@ -11,6 +12,7 @@ export interface MeasurementEvent<V extends {
|
|
|
11
12
|
timestamp: string;
|
|
12
13
|
trace?: TraceContext;
|
|
13
14
|
context?: MeasurementContext;
|
|
15
|
+
action?: UserAction;
|
|
14
16
|
}
|
|
15
17
|
export interface PushMeasurementOptions {
|
|
16
18
|
skipDedupe?: boolean;
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import type { Config } from '../../config';
|
|
2
2
|
import type { InternalLogger } from '../../internalLogger';
|
|
3
3
|
import type { Metas } from '../../metas';
|
|
4
|
-
import type { Transports } from '../../transports';
|
|
4
|
+
import type { TransportItem, Transports } from '../../transports';
|
|
5
5
|
import type { UnpatchedConsole } from '../../unpatchedConsole';
|
|
6
|
+
import type { ItemBuffer } from '../ItemBuffer';
|
|
7
|
+
import type { TracesAPI } from '../traces';
|
|
8
|
+
import type { ApiMessageBusMessages } from '../types';
|
|
6
9
|
import type { MetaAPI } from './types';
|
|
7
|
-
export declare function initializeMetaAPI(
|
|
10
|
+
export declare function initializeMetaAPI({ internalLogger, metas, }: {
|
|
11
|
+
unpatchedConsole: UnpatchedConsole;
|
|
12
|
+
internalLogger: InternalLogger;
|
|
13
|
+
config: Config;
|
|
14
|
+
metas: Metas;
|
|
15
|
+
transports: Transports;
|
|
16
|
+
tracesApi: TracesAPI;
|
|
17
|
+
actionBuffer: ItemBuffer<TransportItem>;
|
|
18
|
+
getMessage: () => ApiMessageBusMessages | undefined;
|
|
19
|
+
}): MetaAPI;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { USER_ACTION_CANCEL_MESSAGE_TYPE, USER_ACTION_END_MESSAGE_TYPE, USER_ACTION_START_MESSAGE_TYPE } from './const';
|
|
1
2
|
import type { EventEvent, EventsAPI } from './events';
|
|
2
3
|
import type { ExceptionEvent, ExceptionsAPI } from './exceptions';
|
|
3
4
|
import type { LogEvent, LogsAPI } from './logs';
|
|
@@ -6,3 +7,39 @@ import type { MetaAPI } from './meta';
|
|
|
6
7
|
import type { TraceEvent, TracesAPI } from './traces';
|
|
7
8
|
export type APIEvent = LogEvent | ExceptionEvent | MeasurementEvent | TraceEvent | EventEvent;
|
|
8
9
|
export type API = LogsAPI & ExceptionsAPI & MeasurementsAPI & TracesAPI & MetaAPI & EventsAPI;
|
|
10
|
+
export type ApiMessageBusMessages = UserActionStartMessage | UserActionEndMessage | UserActionCancelMessage;
|
|
11
|
+
export type UserActionMessageType = typeof USER_ACTION_START_MESSAGE_TYPE | typeof USER_ACTION_END_MESSAGE_TYPE | typeof USER_ACTION_CANCEL_MESSAGE_TYPE;
|
|
12
|
+
export type UserActionStartMessage = {
|
|
13
|
+
type: typeof USER_ACTION_START_MESSAGE_TYPE;
|
|
14
|
+
name: string;
|
|
15
|
+
startTime: number;
|
|
16
|
+
/**
|
|
17
|
+
* Unique identifier of the parent user action to which this action belongs.
|
|
18
|
+
*/
|
|
19
|
+
parentId: string;
|
|
20
|
+
};
|
|
21
|
+
export type UserActionEndMessage = {
|
|
22
|
+
type: typeof USER_ACTION_END_MESSAGE_TYPE;
|
|
23
|
+
name: string;
|
|
24
|
+
startTime: number;
|
|
25
|
+
endTime: number;
|
|
26
|
+
duration: number;
|
|
27
|
+
eventType: string;
|
|
28
|
+
/**
|
|
29
|
+
* Unique identifier for the user action. Will be undefined for messages related to child actions.
|
|
30
|
+
*/
|
|
31
|
+
id: string;
|
|
32
|
+
};
|
|
33
|
+
export type UserActionCancelMessage = {
|
|
34
|
+
type: typeof USER_ACTION_CANCEL_MESSAGE_TYPE;
|
|
35
|
+
name: string;
|
|
36
|
+
/**
|
|
37
|
+
* Unique identifier of the parent user action to which this action belongs.
|
|
38
|
+
*/
|
|
39
|
+
parentId?: string;
|
|
40
|
+
};
|
|
41
|
+
export type UserAction = {
|
|
42
|
+
name: string;
|
|
43
|
+
id?: string;
|
|
44
|
+
parentId?: string;
|
|
45
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Config } from '../config';
|
|
2
|
+
import { type TransportItem, type Transports } from '../transports';
|
|
3
|
+
import type { Observable } from '../utils';
|
|
4
|
+
import { ItemBuffer } from './ItemBuffer';
|
|
5
|
+
import type { APIEvent, ApiMessageBusMessages } from './types';
|
|
6
|
+
export declare function createUserActionLifecycleHandler({ apiMessageBus, transports, config, }: {
|
|
7
|
+
apiMessageBus: Observable<ApiMessageBusMessages>;
|
|
8
|
+
transports: Transports;
|
|
9
|
+
config: Config;
|
|
10
|
+
}): {
|
|
11
|
+
actionBuffer: ItemBuffer<TransportItem<APIEvent>>;
|
|
12
|
+
getMessage: () => ApiMessageBusMessages | undefined;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,7 +2,7 @@ import type { APIEvent, LogArgsSerializer, StacktraceParser } from '../api';
|
|
|
2
2
|
import type { Instrumentation } from '../instrumentations';
|
|
3
3
|
import type { InternalLoggerLevel } from '../internalLogger';
|
|
4
4
|
import type { Meta, MetaApp, MetaItem, MetaPage, MetaSession, MetaUser, MetaView } from '../metas';
|
|
5
|
-
import type { BatchExecutorOptions, BeforeSendHook, Transport } from '../transports';
|
|
5
|
+
import type { BatchExecutorOptions, BeforeSendHook, Transport, TransportItem } from '../transports';
|
|
6
6
|
import type { UnpatchedConsole } from '../unpatchedConsole';
|
|
7
7
|
import type { LogLevel } from '../utils';
|
|
8
8
|
type SamplingContext = {
|
|
@@ -192,18 +192,27 @@ export interface Config<P = APIEvent> {
|
|
|
192
192
|
generatePageId?: (location: Location) => string;
|
|
193
193
|
};
|
|
194
194
|
/**
|
|
195
|
-
*
|
|
195
|
+
* Enable or disable geolocation tracking.
|
|
196
|
+
* Geolocation tracking must be enabled in the Grafana Cloud settings first.
|
|
197
|
+
* It cannot be enabled solely on the client side.
|
|
198
|
+
* This option allows control over tracking on the client side to comply with user
|
|
199
|
+
* privacy requirements.
|
|
196
200
|
*/
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
201
|
+
trackGeolocation?: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* This is a preview feature.
|
|
204
|
+
* We have tested it thoroughly, but it is possible that it might not work as expected in all cases.
|
|
205
|
+
*/
|
|
206
|
+
trackUserActionsPreview?: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Configure your own attribute name for tracking user actions. Default is 'data-faro-user-action-name'
|
|
209
|
+
*/
|
|
210
|
+
trackUserActionsDataAttributeName?: string;
|
|
211
|
+
/**
|
|
212
|
+
* Predicate function to exclude items from user actions.
|
|
213
|
+
* If the function returns true, the item will be excluded from user actions.
|
|
214
|
+
*/
|
|
215
|
+
trackUserActionsExcludeItem?: (item: TransportItem<APIEvent>) => boolean;
|
|
207
216
|
}
|
|
208
217
|
export type Patterns = Array<string | RegExp>;
|
|
209
218
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { defaultExceptionType, defaultLogArgsSerializer, defaultErrorArgsSerializer } from './api';
|
|
2
|
-
export type { API, APIEvent, EventAttributes, EventEvent, EventsAPI, ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, LogArgsSerializer, LogContext, LogEvent, LogsAPI, MeasurementEvent, MeasurementsAPI, MetaAPI, OTELApi, PushErrorOptions, PushEventOptions, PushLogOptions, PushMeasurementOptions, Stacktrace, StacktraceParser, TraceContext, TraceEvent, TracesAPI, } from './api';
|
|
1
|
+
export { defaultExceptionType, defaultLogArgsSerializer, defaultErrorArgsSerializer, apiMessageBus, USER_ACTION_CANCEL_MESSAGE_TYPE, USER_ACTION_END_MESSAGE_TYPE, USER_ACTION_START_MESSAGE_TYPE, } from './api';
|
|
2
|
+
export type { API, APIEvent, EventAttributes, EventEvent, EventsAPI, ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, LogArgsSerializer, LogContext, LogEvent, LogsAPI, MeasurementEvent, MeasurementsAPI, MetaAPI, OTELApi, PushErrorOptions, PushEventOptions, PushLogOptions, PushMeasurementOptions, Stacktrace, StacktraceParser, TraceContext, TraceEvent, TracesAPI, ApiMessageBusMessages, UserActionStartMessage, UserActionEndMessage, UserActionCancelMessage, UserAction, } from './api';
|
|
3
3
|
export { BaseExtension } from './extensions';
|
|
4
4
|
export type { Extension } from './extensions';
|
|
5
5
|
export { globalObject } from './globalObject';
|
|
@@ -19,7 +19,7 @@ export { BaseTransport, getTransportBody, TransportItemType, transportItemTypeTo
|
|
|
19
19
|
export type { BeforeSendHook, SendFn, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, } from './transports';
|
|
20
20
|
export { defaultUnpatchedConsole } from './unpatchedConsole';
|
|
21
21
|
export type { UnpatchedConsole } from './unpatchedConsole';
|
|
22
|
-
export { allLogLevels, createPromiseBuffer, deepEqual, defaultLogLevel, genShortID, getCurrentTimestamp, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, LogLevel, noop, dateNow, isEmpty, getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues, } from './utils';
|
|
23
|
-
export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer, } from './utils';
|
|
22
|
+
export { allLogLevels, createPromiseBuffer, deepEqual, defaultLogLevel, genShortID, getCurrentTimestamp, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, LogLevel, noop, dateNow, isEmpty, getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues, Observable, merge, } from './utils';
|
|
23
|
+
export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer, Subscription, } from './utils';
|
|
24
24
|
export { VERSION } from './version';
|
|
25
25
|
export { unknownString } from './consts';
|
|
@@ -4,7 +4,7 @@ import type { Transport, TransportItem } from '../transports';
|
|
|
4
4
|
export declare class MockTransport extends BaseTransport implements Transport {
|
|
5
5
|
private ignoreURLs;
|
|
6
6
|
readonly name = "@grafana/transport-mock";
|
|
7
|
-
readonly version = "1.14.
|
|
7
|
+
readonly version = "1.14.2";
|
|
8
8
|
items: TransportItem[];
|
|
9
9
|
constructor(ignoreURLs?: Patterns);
|
|
10
10
|
send(items: TransportItem[]): void | Promise<void>;
|
|
@@ -11,3 +11,5 @@ export { genShortID } from './shortId';
|
|
|
11
11
|
export { getBundleId } from './sourceMaps';
|
|
12
12
|
export { dateNow } from './date';
|
|
13
13
|
export { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';
|
|
14
|
+
export { Observable, merge } from './reactive';
|
|
15
|
+
export type { Subscription } from './reactive';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface Subscription {
|
|
2
|
+
unsubscribe: () => void;
|
|
3
|
+
}
|
|
4
|
+
export declare class Observable<T = any> {
|
|
5
|
+
private subscribers;
|
|
6
|
+
constructor();
|
|
7
|
+
/**
|
|
8
|
+
* Subscribes a callback function to the observable.
|
|
9
|
+
* @param callback - The function to call when the observable emits a value.
|
|
10
|
+
* @returns A subscription object with an unsubscribe method to cancel the subscription.
|
|
11
|
+
*/
|
|
12
|
+
subscribe(callback: (data: T) => void): Subscription;
|
|
13
|
+
/**
|
|
14
|
+
* Notifies all subscribers with the given data.
|
|
15
|
+
* @param data - The data to emit to all subscribers.
|
|
16
|
+
*/
|
|
17
|
+
notify(data: T): void;
|
|
18
|
+
/**
|
|
19
|
+
* Subscribes a callback function to the observable and automatically unsubscribes after the first emission.
|
|
20
|
+
* @param callback - The function to call when the observable emits a value.
|
|
21
|
+
* @returns A subscription object with an unsubscribe method to cancel the subscription.
|
|
22
|
+
*/
|
|
23
|
+
first(callback: (data: T) => void): Subscription;
|
|
24
|
+
/**
|
|
25
|
+
* Emits values from the source observable until the provided predicate function returns false.
|
|
26
|
+
* @param predicate - A function that evaluates each value emitted by the source observable.
|
|
27
|
+
* @returns A new observable that emits values from the source observable while the predicate returns true.
|
|
28
|
+
*/
|
|
29
|
+
takeWhile(predicate: (value: T) => boolean): Observable<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Unsubscribes all subscribers by clearing the subscribers array.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* This method sets the `subscribers` array to an empty array, effectively removing all current subscribers.
|
|
35
|
+
*/
|
|
36
|
+
unsubscribeAll(): void;
|
|
37
|
+
private unsubscribe;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Merges multiple observables into a single observable.
|
|
41
|
+
*
|
|
42
|
+
* @template T - The type of the values emitted by the observables.
|
|
43
|
+
* @param {...Observable[]} observables - The observables to merge.
|
|
44
|
+
* @returns {Observable} A new observable that emits values from all input observables.
|
|
45
|
+
*/
|
|
46
|
+
export declare function merge<T>(...observables: Array<Observable<T>>): Observable<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.14.
|
|
1
|
+
export declare const VERSION = "1.14.2";
|