@grafana/faro-core 1.0.0-beta4 → 1.0.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/README.md +5 -4
- package/dist/bundle/faro-core.iife.js +1 -1
- package/dist/cjs/api/events/initialize.js +1 -1
- package/dist/cjs/api/events/initialize.js.map +1 -1
- package/dist/cjs/api/exceptions/initialize.js +1 -1
- package/dist/cjs/api/exceptions/initialize.js.map +1 -1
- package/dist/cjs/api/initialize.js +3 -3
- package/dist/cjs/api/initialize.js.map +1 -1
- package/dist/cjs/api/logs/initialize.js +1 -1
- package/dist/cjs/api/logs/initialize.js.map +1 -1
- package/dist/cjs/api/measurements/initialize.js +4 -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 +14 -1
- package/dist/cjs/api/meta/initialize.js.map +1 -1
- package/dist/cjs/api/meta/types.js.map +1 -1
- package/dist/cjs/api/traces/initialize.js +1 -1
- package/dist/cjs/api/traces/initialize.js.map +1 -1
- package/dist/cjs/config/types.js.map +1 -1
- package/dist/cjs/{utils/extensions.js → extensions/baseExtension.js} +15 -17
- package/dist/cjs/extensions/baseExtension.js.map +1 -0
- package/dist/cjs/extensions/index.js +6 -0
- package/dist/cjs/extensions/index.js.map +1 -0
- package/dist/cjs/extensions/types.js +3 -0
- package/dist/cjs/extensions/types.js.map +1 -0
- package/dist/cjs/index.js +12 -11
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/initialize.js +11 -21
- package/dist/cjs/initialize.js.map +1 -1
- package/dist/cjs/instrumentations/base.js +6 -3
- package/dist/cjs/instrumentations/base.js.map +1 -1
- package/dist/cjs/instrumentations/index.js +3 -1
- package/dist/cjs/instrumentations/index.js.map +1 -1
- package/dist/cjs/instrumentations/initialize.js +8 -2
- package/dist/cjs/instrumentations/initialize.js.map +1 -1
- package/dist/cjs/instrumentations/registerInitial.js +9 -0
- package/dist/cjs/instrumentations/registerInitial.js.map +1 -0
- package/dist/cjs/instrumentations/types.js.map +1 -1
- package/dist/cjs/internalLogger/const.js.map +1 -1
- package/dist/cjs/internalLogger/createInternalLogger.js.map +1 -1
- package/dist/cjs/internalLogger/index.js +2 -1
- package/dist/cjs/internalLogger/index.js.map +1 -1
- package/dist/cjs/internalLogger/initialize.js.map +1 -1
- package/dist/cjs/metas/index.js +3 -1
- package/dist/cjs/metas/index.js.map +1 -1
- package/dist/cjs/metas/initialize.js +4 -30
- package/dist/cjs/metas/initialize.js.map +1 -1
- package/dist/cjs/metas/registerInitial.js +42 -0
- package/dist/cjs/metas/registerInitial.js.map +1 -0
- package/dist/cjs/metas/types.js.map +1 -1
- package/dist/cjs/sdk/faroGlobalObject.js.map +1 -1
- package/dist/cjs/sdk/index.js +3 -3
- package/dist/cjs/sdk/index.js.map +1 -1
- package/dist/cjs/sdk/internalFaroGlobalObject.js.map +1 -1
- package/dist/cjs/sdk/{register.js → registerFaro.js} +13 -3
- package/dist/cjs/sdk/registerFaro.js.map +1 -0
- package/dist/cjs/semantic.js +1 -0
- package/dist/cjs/semantic.js.map +1 -1
- package/dist/cjs/testUtils/mockConfig.js.map +1 -1
- package/dist/cjs/transports/base.js +2 -2
- package/dist/cjs/transports/base.js.map +1 -1
- package/dist/cjs/transports/index.js +3 -1
- package/dist/cjs/transports/index.js.map +1 -1
- package/dist/cjs/transports/initialize.js +5 -4
- package/dist/cjs/transports/initialize.js.map +1 -1
- package/dist/cjs/transports/registerInitial.js +11 -0
- package/dist/cjs/transports/registerInitial.js.map +1 -0
- package/dist/cjs/transports/types.js.map +1 -1
- package/dist/cjs/unpatchedConsole/initialize.js.map +1 -1
- package/dist/cjs/utils/index.js +1 -3
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/shortId.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/api/events/initialize.js +1 -1
- package/dist/esm/api/events/initialize.js.map +1 -1
- package/dist/esm/api/exceptions/initialize.js +1 -1
- package/dist/esm/api/exceptions/initialize.js.map +1 -1
- package/dist/esm/api/initialize.js +3 -3
- package/dist/esm/api/initialize.js.map +1 -1
- package/dist/esm/api/logs/initialize.js +1 -1
- package/dist/esm/api/logs/initialize.js.map +1 -1
- package/dist/esm/api/measurements/initialize.js +4 -3
- 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 +14 -1
- package/dist/esm/api/meta/initialize.js.map +1 -1
- package/dist/esm/api/meta/types.js.map +1 -1
- package/dist/esm/api/traces/initialize.js +1 -1
- package/dist/esm/api/traces/initialize.js.map +1 -1
- package/dist/esm/config/types.js.map +1 -1
- package/dist/esm/extensions/baseExtension.js +23 -0
- package/dist/esm/extensions/baseExtension.js.map +1 -0
- package/dist/esm/extensions/index.js +2 -0
- package/dist/esm/extensions/index.js.map +1 -0
- package/dist/esm/extensions/types.js +2 -0
- package/dist/esm/extensions/types.js.map +1 -0
- package/dist/esm/index.js +4 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/initialize.js +14 -23
- package/dist/esm/initialize.js.map +1 -1
- package/dist/esm/instrumentations/base.js +6 -1
- package/dist/esm/instrumentations/base.js.map +1 -1
- package/dist/esm/instrumentations/index.js +1 -0
- package/dist/esm/instrumentations/index.js.map +1 -1
- package/dist/esm/instrumentations/initialize.js +8 -2
- package/dist/esm/instrumentations/initialize.js.map +1 -1
- package/dist/esm/instrumentations/registerInitial.js +4 -0
- package/dist/esm/instrumentations/registerInitial.js.map +1 -0
- package/dist/esm/instrumentations/types.js.map +1 -1
- package/dist/esm/internalLogger/const.js.map +1 -1
- package/dist/esm/internalLogger/createInternalLogger.js.map +1 -1
- package/dist/esm/internalLogger/index.js +1 -1
- package/dist/esm/internalLogger/index.js.map +1 -1
- package/dist/esm/internalLogger/initialize.js.map +1 -1
- package/dist/esm/metas/index.js +1 -0
- package/dist/esm/metas/index.js.map +1 -1
- package/dist/esm/metas/initialize.js +4 -18
- package/dist/esm/metas/initialize.js.map +1 -1
- package/dist/esm/metas/registerInitial.js +25 -0
- package/dist/esm/metas/registerInitial.js.map +1 -0
- package/dist/esm/metas/types.js.map +1 -1
- package/dist/esm/sdk/faroGlobalObject.js.map +1 -1
- package/dist/esm/sdk/index.js +1 -1
- package/dist/esm/sdk/index.js.map +1 -1
- package/dist/esm/sdk/internalFaroGlobalObject.js.map +1 -1
- package/dist/esm/sdk/registerFaro.js +21 -0
- package/dist/esm/sdk/registerFaro.js.map +1 -0
- package/dist/esm/semantic.js +1 -0
- package/dist/esm/semantic.js.map +1 -1
- package/dist/esm/testUtils/mockConfig.js.map +1 -1
- package/dist/esm/transports/base.js +1 -1
- package/dist/esm/transports/base.js.map +1 -1
- package/dist/esm/transports/index.js +1 -0
- package/dist/esm/transports/index.js.map +1 -1
- package/dist/esm/transports/initialize.js +5 -4
- package/dist/esm/transports/initialize.js.map +1 -1
- package/dist/esm/transports/registerInitial.js +6 -0
- package/dist/esm/transports/registerInitial.js.map +1 -0
- package/dist/esm/transports/types.js.map +1 -1
- package/dist/esm/unpatchedConsole/initialize.js.map +1 -1
- package/dist/esm/utils/index.js +0 -1
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/shortId.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/api/events/initialize.d.ts +2 -1
- package/dist/types/api/exceptions/initialize.d.ts +2 -1
- package/dist/types/api/initialize.d.ts +2 -1
- package/dist/types/api/logs/initialize.d.ts +2 -1
- package/dist/types/api/measurements/initialize.d.ts +2 -1
- package/dist/types/api/measurements/types.d.ts +2 -1
- package/dist/types/api/meta/initialize.d.ts +2 -1
- package/dist/types/api/meta/types.d.ts +5 -3
- package/dist/types/api/traces/initialize.d.ts +2 -1
- package/dist/types/config/types.d.ts +2 -1
- package/dist/types/extensions/baseExtension.d.ts +15 -0
- package/dist/types/extensions/index.d.ts +2 -0
- package/dist/types/extensions/types.d.ts +16 -0
- package/dist/types/index.d.ts +7 -5
- package/dist/types/instrumentations/base.d.ts +5 -1
- package/dist/types/instrumentations/index.d.ts +1 -0
- package/dist/types/instrumentations/initialize.d.ts +5 -1
- package/dist/types/instrumentations/registerInitial.d.ts +2 -0
- package/dist/types/instrumentations/types.d.ts +5 -1
- package/dist/types/internalLogger/index.d.ts +1 -1
- package/dist/types/metas/index.d.ts +2 -1
- package/dist/types/metas/initialize.d.ts +2 -1
- package/dist/types/metas/registerInitial.d.ts +2 -0
- package/dist/types/metas/types.d.ts +6 -1
- package/dist/types/sdk/index.d.ts +1 -1
- package/dist/types/sdk/registerFaro.d.ts +10 -0
- package/dist/types/semantic.d.ts +1 -0
- package/dist/types/testUtils/mockTransport.d.ts +1 -1
- package/dist/types/transports/base.d.ts +1 -1
- package/dist/types/transports/index.d.ts +1 -0
- package/dist/types/transports/initialize.d.ts +3 -1
- package/dist/types/transports/registerInitial.d.ts +2 -0
- package/dist/types/transports/types.d.ts +1 -1
- package/dist/types/utils/index.d.ts +0 -2
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -4
- package/dist/cjs/sdk/register.js.map +0 -1
- package/dist/cjs/utils/extensions.js.map +0 -1
- package/dist/esm/sdk/register.js +0 -11
- package/dist/esm/sdk/register.js.map +0 -1
- package/dist/esm/utils/extensions.js +0 -23
- package/dist/esm/utils/extensions.js.map +0 -1
- package/dist/types/sdk/register.d.ts +0 -4
- package/dist/types/utils/extensions.d.ts +0 -19
|
@@ -2,6 +2,7 @@ import type { Config } from '../../config';
|
|
|
2
2
|
import type { InternalLogger } from '../../internalLogger';
|
|
3
3
|
import type { Metas } from '../../metas';
|
|
4
4
|
import type { Transports } from '../../transports';
|
|
5
|
+
import type { UnpatchedConsole } from '../../unpatchedConsole';
|
|
5
6
|
import type { TracesAPI } from '../traces';
|
|
6
7
|
import type { MeasurementsAPI } from './types';
|
|
7
|
-
export declare function initializeMeasurementsAPI(internalLogger: InternalLogger, config: Config,
|
|
8
|
+
export declare function initializeMeasurementsAPI(_unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, config: Config, metas: Metas, transports: Transports, tracesApi: TracesAPI): MeasurementsAPI;
|
|
@@ -6,11 +6,12 @@ export interface MeasurementEvent<V extends {
|
|
|
6
6
|
}> {
|
|
7
7
|
type: string;
|
|
8
8
|
values: V;
|
|
9
|
+
timestamp: string;
|
|
9
10
|
trace?: TraceContext;
|
|
10
11
|
}
|
|
11
12
|
export interface PushMeasurementOptions {
|
|
12
13
|
skipDedupe?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export interface MeasurementsAPI {
|
|
15
|
-
pushMeasurement: (payload: MeasurementEvent, options?: PushMeasurementOptions) => void;
|
|
16
|
+
pushMeasurement: (payload: Omit<MeasurementEvent, 'timestamp'> & Partial<Pick<MeasurementEvent, 'timestamp'>>, options?: PushMeasurementOptions) => void;
|
|
16
17
|
}
|
|
@@ -2,5 +2,6 @@ import type { Config } from '../../config';
|
|
|
2
2
|
import type { InternalLogger } from '../../internalLogger';
|
|
3
3
|
import type { Metas } from '../../metas';
|
|
4
4
|
import type { Transports } from '../../transports';
|
|
5
|
+
import type { UnpatchedConsole } from '../../unpatchedConsole';
|
|
5
6
|
import type { MetaAPI } from './types';
|
|
6
|
-
export declare function initializeMetaAPI(internalLogger: InternalLogger, _config: Config,
|
|
7
|
+
export declare function initializeMetaAPI(_unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, _config: Config, metas: Metas, _transports: Transports): MetaAPI;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type { MetaSession, MetaUser } from '../../metas';
|
|
1
|
+
import type { MetaSession, MetaUser, MetaView } from '../../metas';
|
|
2
2
|
export interface MetaAPI {
|
|
3
|
-
setUser: (user
|
|
3
|
+
setUser: (user?: MetaUser | undefined) => void;
|
|
4
4
|
resetUser: () => void;
|
|
5
|
-
setSession: (session
|
|
5
|
+
setSession: (session?: MetaSession | undefined) => void;
|
|
6
6
|
resetSession: () => void;
|
|
7
7
|
getSession: () => MetaSession | undefined;
|
|
8
|
+
setView: (view?: MetaView | undefined) => void;
|
|
9
|
+
getView: () => MetaView | undefined;
|
|
8
10
|
}
|
|
@@ -2,5 +2,6 @@ import type { Config } from '../../config';
|
|
|
2
2
|
import type { InternalLogger } from '../../internalLogger';
|
|
3
3
|
import type { Metas } from '../../metas';
|
|
4
4
|
import { Transports } from '../../transports';
|
|
5
|
+
import type { UnpatchedConsole } from '../../unpatchedConsole';
|
|
5
6
|
import type { TracesAPI } from './types';
|
|
6
|
-
export declare function initializeTracesAPI(internalLogger: InternalLogger, _config: Config,
|
|
7
|
+
export declare function initializeTracesAPI(_unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, _config: Config, metas: Metas, transports: Transports): TracesAPI;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { APIEvent, StacktraceParser } from '../api';
|
|
2
2
|
import type { Instrumentation } from '../instrumentations';
|
|
3
3
|
import type { InternalLoggerLevel } from '../internalLogger';
|
|
4
|
-
import type { MetaApp, MetaItem, MetaSession, MetaUser } from '../metas';
|
|
4
|
+
import type { MetaApp, MetaItem, MetaSession, MetaUser, MetaView } from '../metas';
|
|
5
5
|
import type { BeforeSendHook, Transport } from '../transports';
|
|
6
6
|
import type { UnpatchedConsole } from '../unpatchedConsole';
|
|
7
7
|
export interface Config<P = APIEvent> {
|
|
@@ -21,6 +21,7 @@ export interface Config<P = APIEvent> {
|
|
|
21
21
|
ignoreErrors?: Patterns;
|
|
22
22
|
session?: MetaSession;
|
|
23
23
|
user?: MetaUser;
|
|
24
|
+
view?: MetaView;
|
|
24
25
|
eventDomain?: string;
|
|
25
26
|
}
|
|
26
27
|
export type Patterns = Array<string | RegExp>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Config } from '../config';
|
|
2
|
+
import type { Metas } from '../metas';
|
|
3
|
+
import type { Extension } from './types';
|
|
4
|
+
export declare abstract class BaseExtension implements Extension {
|
|
5
|
+
abstract readonly name: string;
|
|
6
|
+
abstract readonly version: string;
|
|
7
|
+
unpatchedConsole: Console;
|
|
8
|
+
internalLogger: import("../internalLogger").InternalLogger;
|
|
9
|
+
config: Config<import("..").APIEvent>;
|
|
10
|
+
metas: Metas;
|
|
11
|
+
logDebug(...args: unknown[]): void;
|
|
12
|
+
logInfo(...args: unknown[]): void;
|
|
13
|
+
logWarn(...args: unknown[]): void;
|
|
14
|
+
logError(...args: unknown[]): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Config } from '../config';
|
|
2
|
+
import type { InternalLogger } from '../internalLogger';
|
|
3
|
+
import type { Metas } from '../metas';
|
|
4
|
+
import type { UnpatchedConsole } from '../unpatchedConsole';
|
|
5
|
+
export interface Extension {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly version: string;
|
|
8
|
+
internalLogger: InternalLogger;
|
|
9
|
+
unpatchedConsole: UnpatchedConsole;
|
|
10
|
+
config: Config;
|
|
11
|
+
metas: Metas;
|
|
12
|
+
logDebug(...args: unknown[]): void;
|
|
13
|
+
logInfo(...args: unknown[]): void;
|
|
14
|
+
logWarn(...args: unknown[]): void;
|
|
15
|
+
logError(...args: unknown[]): void;
|
|
16
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { faro, getInternalFaroFromGlobalObject, internalGlobalObjectKey, isInternalFaroOnGlobalObject, setInternalFaroOnGlobalObject, } from './sdk';
|
|
2
|
-
export type { Faro } from './sdk';
|
|
3
1
|
export { defaultExceptionType } from './api';
|
|
4
2
|
export type { API, APIEvent, EventAttributes, EventEvent, EventsAPI, ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, LogContext, LogEvent, LogsAPI, MeasurementEvent, MeasurementsAPI, MetaAPI, OTELApi, PushErrorOptions, PushLogOptions, PushMeasurementOptions, Stacktrace, StacktraceParser, TraceContext, TraceEvent, TracesAPI, } from './api';
|
|
3
|
+
export { BaseExtension } from './extensions';
|
|
4
|
+
export type { Extension } from './extensions';
|
|
5
5
|
export { globalObject } from './globalObject';
|
|
6
6
|
export type { GlobalObject } from './globalObject';
|
|
7
7
|
export { initializeFaro } from './initialize';
|
|
@@ -11,12 +11,14 @@ export { BaseInstrumentation } from './instrumentations';
|
|
|
11
11
|
export type { Instrumentation, Instrumentations } from './instrumentations';
|
|
12
12
|
export { createInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './internalLogger';
|
|
13
13
|
export type { InternalLogger } from './internalLogger';
|
|
14
|
-
export type { Meta, MetaApp, MetaAttributes, MetaBrowser, MetaGetter, MetaItem, MetaPage, Metas, MetaSDK, MetaSDKIntegration, MetaSession, MetaUser, } from './metas';
|
|
14
|
+
export type { Meta, MetaApp, MetaAttributes, MetaBrowser, MetaGetter, MetaItem, MetaPage, Metas, MetaSDK, MetaSDKIntegration, MetaSession, MetaUser, MetaView, } from './metas';
|
|
15
|
+
export { faro, getInternalFaroFromGlobalObject, internalGlobalObjectKey, isInternalFaroOnGlobalObject, setInternalFaroOnGlobalObject, } from './sdk';
|
|
16
|
+
export type { Faro } from './sdk';
|
|
17
|
+
export { Conventions } from './semantic';
|
|
15
18
|
export { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';
|
|
16
19
|
export type { BeforeSendHook, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, } from './transports';
|
|
17
20
|
export { defaultUnpatchedConsole } from './unpatchedConsole';
|
|
18
21
|
export type { UnpatchedConsole } from './unpatchedConsole';
|
|
19
|
-
export { allLogLevels,
|
|
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, } from './utils';
|
|
20
23
|
export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer, } from './utils';
|
|
21
24
|
export { VERSION } from './version';
|
|
22
|
-
export { Conventions } from './semantic';
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { API } from '../api';
|
|
2
|
+
import { BaseExtension } from '../extensions';
|
|
3
|
+
import type { Transports } from '../transports';
|
|
2
4
|
import type { Instrumentation } from './types';
|
|
3
5
|
export declare abstract class BaseInstrumentation extends BaseExtension implements Instrumentation {
|
|
6
|
+
api: API;
|
|
7
|
+
transports: Transports;
|
|
4
8
|
abstract initialize(): void;
|
|
5
9
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import type { API } from '../api';
|
|
1
2
|
import type { Config } from '../config';
|
|
2
3
|
import type { InternalLogger } from '../internalLogger';
|
|
4
|
+
import type { Metas } from '../metas';
|
|
5
|
+
import type { Transports } from '../transports';
|
|
6
|
+
import type { UnpatchedConsole } from '../unpatchedConsole';
|
|
3
7
|
import type { Instrumentations } from './types';
|
|
4
|
-
export declare function initializeInstrumentations(internalLogger: InternalLogger,
|
|
8
|
+
export declare function initializeInstrumentations(unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, config: Config, metas: Metas, transports: Transports, api: API): Instrumentations;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { API } from '../api';
|
|
2
|
+
import type { Extension } from '../extensions';
|
|
3
|
+
import type { Transports } from '../transports';
|
|
2
4
|
export interface Instrumentation extends Extension {
|
|
5
|
+
api: API;
|
|
6
|
+
transports: Transports;
|
|
3
7
|
initialize: VoidFunction;
|
|
4
8
|
destroy?: VoidFunction;
|
|
5
9
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defaultInternalLoggerLevel, InternalLoggerLevel } from './const';
|
|
1
|
+
export { defaultInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './const';
|
|
2
2
|
export { createInternalLogger } from './createInternalLogger';
|
|
3
3
|
export { initializeInternalLogger, internalLogger } from './initialize';
|
|
4
4
|
export type { InternalLogger } from './types';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { initializeMetas } from './initialize';
|
|
2
|
-
export
|
|
2
|
+
export { registerInitialMetas } from './registerInitial';
|
|
3
|
+
export type { Meta, MetaApp, MetaAttributes, MetaBrowser, MetaGetter, MetaItem, MetaPage, Metas, MetaSDK, MetaSDKIntegration, MetaSession, MetaUser, MetaView, } from './types';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Config } from '../config';
|
|
2
2
|
import type { InternalLogger } from '../internalLogger';
|
|
3
|
+
import type { UnpatchedConsole } from '../unpatchedConsole';
|
|
3
4
|
import type { Metas } from './types';
|
|
4
|
-
export declare function initializeMetas(internalLogger: InternalLogger,
|
|
5
|
+
export declare function initializeMetas(_unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, _config: Config): Metas;
|
|
@@ -32,7 +32,6 @@ export interface MetaUser {
|
|
|
32
32
|
}
|
|
33
33
|
export interface MetaSession {
|
|
34
34
|
id?: string;
|
|
35
|
-
started?: string;
|
|
36
35
|
attributes?: MetaAttributes;
|
|
37
36
|
}
|
|
38
37
|
export interface MetaPage {
|
|
@@ -45,6 +44,11 @@ export interface MetaBrowser {
|
|
|
45
44
|
version?: string;
|
|
46
45
|
os?: string;
|
|
47
46
|
mobile?: boolean;
|
|
47
|
+
userAgent?: string;
|
|
48
|
+
language?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface MetaView {
|
|
51
|
+
name: string;
|
|
48
52
|
}
|
|
49
53
|
export interface Meta {
|
|
50
54
|
sdk?: MetaSDK;
|
|
@@ -53,4 +57,5 @@ export interface Meta {
|
|
|
53
57
|
session?: MetaSession;
|
|
54
58
|
page?: MetaPage;
|
|
55
59
|
browser?: MetaBrowser;
|
|
60
|
+
view?: MetaView;
|
|
56
61
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { internalGlobalObjectKey } from './const';
|
|
2
|
-
export { faro, registerFaro } from './
|
|
2
|
+
export { faro, registerFaro } from './registerFaro';
|
|
3
3
|
export { getInternalFromGlobalObject as getInternalFaroFromGlobalObject, isInternalFaroOnGlobalObject as isInternalFaroOnGlobalObject, setInternalFaroOnGlobalObject as setInternalFaroOnGlobalObject, } from './internalFaroGlobalObject';
|
|
4
4
|
export type { Faro } from './types';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { API } from '../api';
|
|
2
|
+
import type { Config } from '../config';
|
|
3
|
+
import type { Instrumentations } from '../instrumentations';
|
|
4
|
+
import type { InternalLogger } from '../internalLogger';
|
|
5
|
+
import type { Metas } from '../metas';
|
|
6
|
+
import type { Transports } from '../transports';
|
|
7
|
+
import type { UnpatchedConsole } from '../unpatchedConsole';
|
|
8
|
+
import type { Faro } from './types';
|
|
9
|
+
export declare let faro: Faro;
|
|
10
|
+
export declare function registerFaro(unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, config: Config, metas: Metas, transports: Transports, api: API, instrumentations: Instrumentations): Faro;
|
package/dist/types/semantic.d.ts
CHANGED
|
@@ -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.0.
|
|
7
|
+
readonly version = "1.0.1";
|
|
8
8
|
items: TransportItem[];
|
|
9
9
|
constructor(ignoreURLs?: Patterns);
|
|
10
10
|
send(item: TransportItem): void | Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseExtension } from '../
|
|
1
|
+
import { BaseExtension } from '../extensions';
|
|
2
2
|
import type { Transport, TransportItem } from './types';
|
|
3
3
|
export declare abstract class BaseTransport extends BaseExtension implements Transport {
|
|
4
4
|
abstract send(item: TransportItem): void | Promise<void>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { initializeTransports } from './initialize';
|
|
2
2
|
export { BaseTransport } from './base';
|
|
3
3
|
export { TransportItemType, transportItemTypeToBodyKey } from './const';
|
|
4
|
+
export { registerInitialTransports } from './registerInitial';
|
|
4
5
|
export type { BeforeSendHook, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, } from './types';
|
|
5
6
|
export { getTransportBody } from './utils';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Config, Patterns } from '../config';
|
|
2
2
|
import type { InternalLogger } from '../internalLogger';
|
|
3
|
+
import type { Metas } from '../metas';
|
|
4
|
+
import type { UnpatchedConsole } from '../unpatchedConsole';
|
|
3
5
|
import type { BeforeSendHook, Transports } from './types';
|
|
4
6
|
export declare function shouldIgnoreEvent(patterns: Patterns, msg: string): boolean;
|
|
5
7
|
export declare function createBeforeSendHookFromIgnorePatterns(patterns: Patterns): BeforeSendHook;
|
|
6
|
-
export declare function initializeTransports(internalLogger: InternalLogger, config: Config): Transports;
|
|
8
|
+
export declare function initializeTransports(unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, config: Config, metas: Metas): Transports;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { APIEvent, EventEvent, ExceptionEvent, LogEvent, MeasurementEvent, TraceEvent } from '../api';
|
|
2
2
|
import type { Patterns } from '../config';
|
|
3
|
+
import type { Extension } from '../extensions';
|
|
3
4
|
import type { Meta } from '../metas';
|
|
4
|
-
import type { Extension } from '../utils';
|
|
5
5
|
import type { TransportItemType } from './const';
|
|
6
6
|
export type TransportItemPayload<P = APIEvent> = P;
|
|
7
7
|
export type BeforeSendHook<P = APIEvent> = (item: TransportItem<P>) => TransportItem<P> | null;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export { BaseExtension } from './extensions';
|
|
2
|
-
export type { Extension } from './extensions';
|
|
3
1
|
export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';
|
|
4
2
|
export { deepEqual } from './deepEqual';
|
|
5
3
|
export { getCurrentTimestamp } from './getCurrentTimestamp';
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.0.
|
|
1
|
+
export declare const VERSION = "1.0.1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/faro-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Core package of Faro.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"observability",
|
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
"quality:circular-deps": "madge --circular ."
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@opentelemetry/api": "^1.
|
|
53
|
+
"@opentelemetry/api": "^1.4.0",
|
|
54
54
|
"@opentelemetry/api-metrics": "^0.33.0",
|
|
55
|
-
"@opentelemetry/otlp-transformer": "^0.
|
|
55
|
+
"@opentelemetry/otlp-transformer": "^0.35.0"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "c5c93f2e33748e9dc1778a764f72a5a3f7d0221e"
|
|
61
61
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/sdk/register.ts"],"names":[],"mappings":";;;AACA,uDAA2D;AAC3D,uEAA2E;AAGhE,QAAA,IAAI,GAAS,EAAU,CAAC;AAEnC,SAAgB,YAAY,CAAC,cAA8B,EAAE,OAAa;IACxE,cAAc,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAE1C,YAAI,GAAG,OAAO,CAAC;IAEf,IAAA,wDAA6B,EAAC,YAAI,CAAC,CAAC;IAEpC,IAAA,wCAAqB,EAAC,YAAI,CAAC,CAAC;IAE5B,OAAO,YAAI,CAAC;AACd,CAAC;AAVD,oCAUC","sourcesContent":["import type { InternalLogger } from '../internalLogger';\nimport { setFaroOnGlobalObject } from './faroGlobalObject';\nimport { setInternalFaroOnGlobalObject } from './internalFaroGlobalObject';\nimport type { Faro } from './types';\n\nexport let faro: Faro = {} as Faro;\n\nexport function registerFaro(internalLogger: InternalLogger, newFaro: Faro): Faro {\n internalLogger.debug('Initializing Faro');\n\n faro = newFaro;\n\n setInternalFaroOnGlobalObject(faro);\n\n setFaroOnGlobalObject(faro);\n\n return faro;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.js","sourceRoot":"","sources":["../../../src/utils/extensions.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8BAA8B;AAe9B;IAAA;IAuBA,CAAC;IAnBC,sBAAI,+BAAI;aAAR;YACE,OAAO,UAAI,CAAC;QACd,CAAC;;;OAAA;IAED,gCAAQ,GAAR;;QAAS,cAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,yBAAkB;;QACzB,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,cAAc,0CAAE,KAAK,0BAAC,UAAG,IAAI,CAAC,IAAI,OAAI,GAAK,IAAI,SAAC,CAAC;IAC9D,CAAC;IAED,+BAAO,GAAP;;QAAQ,cAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,yBAAkB;;QACxB,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,cAAc,0CAAE,IAAI,0BAAC,UAAG,IAAI,CAAC,IAAI,OAAI,GAAK,IAAI,SAAC,CAAC;IAC7D,CAAC;IAED,+BAAO,GAAP;;QAAQ,cAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,yBAAkB;;QACxB,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,cAAc,0CAAE,IAAI,0BAAC,UAAG,IAAI,CAAC,IAAI,OAAI,GAAK,IAAI,SAAC,CAAC;IAC7D,CAAC;IAED,gCAAQ,GAAR;;QAAS,cAAkB;aAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;YAAlB,yBAAkB;;QACzB,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,cAAc,0CAAE,KAAK,0BAAC,UAAG,IAAI,CAAC,IAAI,OAAI,GAAK,IAAI,SAAC,CAAC;IAC9D,CAAC;IACH,oBAAC;AAAD,CAAC,AAvBD,IAuBC;AAvBqB,sCAAa","sourcesContent":["import { faro } from '../sdk';\nimport type { Faro } from '../sdk';\n\nexport interface Extension {\n readonly name: string;\n readonly version: string;\n\n get faro(): Faro;\n\n logDebug(...args: unknown[]): void;\n logInfo(...args: unknown[]): void;\n logWarn(...args: unknown[]): void;\n logError(...args: unknown[]): void;\n}\n\nexport abstract class BaseExtension implements Extension {\n abstract readonly name: string;\n abstract readonly version: string;\n\n get faro(): Faro {\n return faro;\n }\n\n logDebug(...args: unknown[]): void {\n this.faro?.internalLogger?.debug(`${this.name}\\n`, ...args);\n }\n\n logInfo(...args: unknown[]): void {\n this.faro?.internalLogger?.info(`${this.name}\\n`, ...args);\n }\n\n logWarn(...args: unknown[]): void {\n this.faro?.internalLogger?.warn(`${this.name}\\n`, ...args);\n }\n\n logError(...args: unknown[]): void {\n this.faro?.internalLogger?.error(`${this.name}\\n`, ...args);\n }\n}\n"]}
|
package/dist/esm/sdk/register.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { setFaroOnGlobalObject } from './faroGlobalObject';
|
|
2
|
-
import { setInternalFaroOnGlobalObject } from './internalFaroGlobalObject';
|
|
3
|
-
export let faro = {};
|
|
4
|
-
export function registerFaro(internalLogger, newFaro) {
|
|
5
|
-
internalLogger.debug('Initializing Faro');
|
|
6
|
-
faro = newFaro;
|
|
7
|
-
setInternalFaroOnGlobalObject(faro);
|
|
8
|
-
setFaroOnGlobalObject(faro);
|
|
9
|
-
return faro;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=register.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/sdk/register.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAG3E,MAAM,CAAC,IAAI,IAAI,GAAS,EAAU,CAAC;AAEnC,MAAM,UAAU,YAAY,CAAC,cAA8B,EAAE,OAAa;IACxE,cAAc,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAE1C,IAAI,GAAG,OAAO,CAAC;IAEf,6BAA6B,CAAC,IAAI,CAAC,CAAC;IAEpC,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAE5B,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { InternalLogger } from '../internalLogger';\nimport { setFaroOnGlobalObject } from './faroGlobalObject';\nimport { setInternalFaroOnGlobalObject } from './internalFaroGlobalObject';\nimport type { Faro } from './types';\n\nexport let faro: Faro = {} as Faro;\n\nexport function registerFaro(internalLogger: InternalLogger, newFaro: Faro): Faro {\n internalLogger.debug('Initializing Faro');\n\n faro = newFaro;\n\n setInternalFaroOnGlobalObject(faro);\n\n setFaroOnGlobalObject(faro);\n\n return faro;\n}\n"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { faro } from '../sdk';
|
|
2
|
-
export class BaseExtension {
|
|
3
|
-
get faro() {
|
|
4
|
-
return faro;
|
|
5
|
-
}
|
|
6
|
-
logDebug(...args) {
|
|
7
|
-
var _a, _b;
|
|
8
|
-
(_b = (_a = this.faro) === null || _a === void 0 ? void 0 : _a.internalLogger) === null || _b === void 0 ? void 0 : _b.debug(`${this.name}\n`, ...args);
|
|
9
|
-
}
|
|
10
|
-
logInfo(...args) {
|
|
11
|
-
var _a, _b;
|
|
12
|
-
(_b = (_a = this.faro) === null || _a === void 0 ? void 0 : _a.internalLogger) === null || _b === void 0 ? void 0 : _b.info(`${this.name}\n`, ...args);
|
|
13
|
-
}
|
|
14
|
-
logWarn(...args) {
|
|
15
|
-
var _a, _b;
|
|
16
|
-
(_b = (_a = this.faro) === null || _a === void 0 ? void 0 : _a.internalLogger) === null || _b === void 0 ? void 0 : _b.warn(`${this.name}\n`, ...args);
|
|
17
|
-
}
|
|
18
|
-
logError(...args) {
|
|
19
|
-
var _a, _b;
|
|
20
|
-
(_b = (_a = this.faro) === null || _a === void 0 ? void 0 : _a.internalLogger) === null || _b === void 0 ? void 0 : _b.error(`${this.name}\n`, ...args);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=extensions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.js","sourceRoot":"","sources":["../../../src/utils/extensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAe9B,MAAM,OAAgB,aAAa;IAIjC,IAAI,IAAI;QACN,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,CAAC,GAAG,IAAe;;QACzB,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,cAAc,0CAAE,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO,CAAC,GAAG,IAAe;;QACxB,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,cAAc,0CAAE,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,CAAC,GAAG,IAAe;;QACxB,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,cAAc,0CAAE,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IAC7D,CAAC;IAED,QAAQ,CAAC,GAAG,IAAe;;QACzB,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,cAAc,0CAAE,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IAC9D,CAAC;CACF","sourcesContent":["import { faro } from '../sdk';\nimport type { Faro } from '../sdk';\n\nexport interface Extension {\n readonly name: string;\n readonly version: string;\n\n get faro(): Faro;\n\n logDebug(...args: unknown[]): void;\n logInfo(...args: unknown[]): void;\n logWarn(...args: unknown[]): void;\n logError(...args: unknown[]): void;\n}\n\nexport abstract class BaseExtension implements Extension {\n abstract readonly name: string;\n abstract readonly version: string;\n\n get faro(): Faro {\n return faro;\n }\n\n logDebug(...args: unknown[]): void {\n this.faro?.internalLogger?.debug(`${this.name}\\n`, ...args);\n }\n\n logInfo(...args: unknown[]): void {\n this.faro?.internalLogger?.info(`${this.name}\\n`, ...args);\n }\n\n logWarn(...args: unknown[]): void {\n this.faro?.internalLogger?.warn(`${this.name}\\n`, ...args);\n }\n\n logError(...args: unknown[]): void {\n this.faro?.internalLogger?.error(`${this.name}\\n`, ...args);\n }\n}\n"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Faro } from '../sdk';
|
|
2
|
-
export interface Extension {
|
|
3
|
-
readonly name: string;
|
|
4
|
-
readonly version: string;
|
|
5
|
-
get faro(): Faro;
|
|
6
|
-
logDebug(...args: unknown[]): void;
|
|
7
|
-
logInfo(...args: unknown[]): void;
|
|
8
|
-
logWarn(...args: unknown[]): void;
|
|
9
|
-
logError(...args: unknown[]): void;
|
|
10
|
-
}
|
|
11
|
-
export declare abstract class BaseExtension implements Extension {
|
|
12
|
-
abstract readonly name: string;
|
|
13
|
-
abstract readonly version: string;
|
|
14
|
-
get faro(): Faro;
|
|
15
|
-
logDebug(...args: unknown[]): void;
|
|
16
|
-
logInfo(...args: unknown[]): void;
|
|
17
|
-
logWarn(...args: unknown[]): void;
|
|
18
|
-
logError(...args: unknown[]): void;
|
|
19
|
-
}
|