@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.
Files changed (190) hide show
  1. package/README.md +5 -4
  2. package/dist/bundle/faro-core.iife.js +1 -1
  3. package/dist/cjs/api/events/initialize.js +1 -1
  4. package/dist/cjs/api/events/initialize.js.map +1 -1
  5. package/dist/cjs/api/exceptions/initialize.js +1 -1
  6. package/dist/cjs/api/exceptions/initialize.js.map +1 -1
  7. package/dist/cjs/api/initialize.js +3 -3
  8. package/dist/cjs/api/initialize.js.map +1 -1
  9. package/dist/cjs/api/logs/initialize.js +1 -1
  10. package/dist/cjs/api/logs/initialize.js.map +1 -1
  11. package/dist/cjs/api/measurements/initialize.js +4 -3
  12. package/dist/cjs/api/measurements/initialize.js.map +1 -1
  13. package/dist/cjs/api/measurements/types.js.map +1 -1
  14. package/dist/cjs/api/meta/initialize.js +14 -1
  15. package/dist/cjs/api/meta/initialize.js.map +1 -1
  16. package/dist/cjs/api/meta/types.js.map +1 -1
  17. package/dist/cjs/api/traces/initialize.js +1 -1
  18. package/dist/cjs/api/traces/initialize.js.map +1 -1
  19. package/dist/cjs/config/types.js.map +1 -1
  20. package/dist/cjs/{utils/extensions.js → extensions/baseExtension.js} +15 -17
  21. package/dist/cjs/extensions/baseExtension.js.map +1 -0
  22. package/dist/cjs/extensions/index.js +6 -0
  23. package/dist/cjs/extensions/index.js.map +1 -0
  24. package/dist/cjs/extensions/types.js +3 -0
  25. package/dist/cjs/extensions/types.js.map +1 -0
  26. package/dist/cjs/index.js +12 -11
  27. package/dist/cjs/index.js.map +1 -1
  28. package/dist/cjs/initialize.js +11 -21
  29. package/dist/cjs/initialize.js.map +1 -1
  30. package/dist/cjs/instrumentations/base.js +6 -3
  31. package/dist/cjs/instrumentations/base.js.map +1 -1
  32. package/dist/cjs/instrumentations/index.js +3 -1
  33. package/dist/cjs/instrumentations/index.js.map +1 -1
  34. package/dist/cjs/instrumentations/initialize.js +8 -2
  35. package/dist/cjs/instrumentations/initialize.js.map +1 -1
  36. package/dist/cjs/instrumentations/registerInitial.js +9 -0
  37. package/dist/cjs/instrumentations/registerInitial.js.map +1 -0
  38. package/dist/cjs/instrumentations/types.js.map +1 -1
  39. package/dist/cjs/internalLogger/const.js.map +1 -1
  40. package/dist/cjs/internalLogger/createInternalLogger.js.map +1 -1
  41. package/dist/cjs/internalLogger/index.js +2 -1
  42. package/dist/cjs/internalLogger/index.js.map +1 -1
  43. package/dist/cjs/internalLogger/initialize.js.map +1 -1
  44. package/dist/cjs/metas/index.js +3 -1
  45. package/dist/cjs/metas/index.js.map +1 -1
  46. package/dist/cjs/metas/initialize.js +4 -30
  47. package/dist/cjs/metas/initialize.js.map +1 -1
  48. package/dist/cjs/metas/registerInitial.js +42 -0
  49. package/dist/cjs/metas/registerInitial.js.map +1 -0
  50. package/dist/cjs/metas/types.js.map +1 -1
  51. package/dist/cjs/sdk/faroGlobalObject.js.map +1 -1
  52. package/dist/cjs/sdk/index.js +3 -3
  53. package/dist/cjs/sdk/index.js.map +1 -1
  54. package/dist/cjs/sdk/internalFaroGlobalObject.js.map +1 -1
  55. package/dist/cjs/sdk/{register.js → registerFaro.js} +13 -3
  56. package/dist/cjs/sdk/registerFaro.js.map +1 -0
  57. package/dist/cjs/semantic.js +1 -0
  58. package/dist/cjs/semantic.js.map +1 -1
  59. package/dist/cjs/testUtils/mockConfig.js.map +1 -1
  60. package/dist/cjs/transports/base.js +2 -2
  61. package/dist/cjs/transports/base.js.map +1 -1
  62. package/dist/cjs/transports/index.js +3 -1
  63. package/dist/cjs/transports/index.js.map +1 -1
  64. package/dist/cjs/transports/initialize.js +5 -4
  65. package/dist/cjs/transports/initialize.js.map +1 -1
  66. package/dist/cjs/transports/registerInitial.js +11 -0
  67. package/dist/cjs/transports/registerInitial.js.map +1 -0
  68. package/dist/cjs/transports/types.js.map +1 -1
  69. package/dist/cjs/unpatchedConsole/initialize.js.map +1 -1
  70. package/dist/cjs/utils/index.js +1 -3
  71. package/dist/cjs/utils/index.js.map +1 -1
  72. package/dist/cjs/utils/shortId.js.map +1 -1
  73. package/dist/cjs/version.js +1 -1
  74. package/dist/cjs/version.js.map +1 -1
  75. package/dist/esm/api/events/initialize.js +1 -1
  76. package/dist/esm/api/events/initialize.js.map +1 -1
  77. package/dist/esm/api/exceptions/initialize.js +1 -1
  78. package/dist/esm/api/exceptions/initialize.js.map +1 -1
  79. package/dist/esm/api/initialize.js +3 -3
  80. package/dist/esm/api/initialize.js.map +1 -1
  81. package/dist/esm/api/logs/initialize.js +1 -1
  82. package/dist/esm/api/logs/initialize.js.map +1 -1
  83. package/dist/esm/api/measurements/initialize.js +4 -3
  84. package/dist/esm/api/measurements/initialize.js.map +1 -1
  85. package/dist/esm/api/measurements/types.js.map +1 -1
  86. package/dist/esm/api/meta/initialize.js +14 -1
  87. package/dist/esm/api/meta/initialize.js.map +1 -1
  88. package/dist/esm/api/meta/types.js.map +1 -1
  89. package/dist/esm/api/traces/initialize.js +1 -1
  90. package/dist/esm/api/traces/initialize.js.map +1 -1
  91. package/dist/esm/config/types.js.map +1 -1
  92. package/dist/esm/extensions/baseExtension.js +23 -0
  93. package/dist/esm/extensions/baseExtension.js.map +1 -0
  94. package/dist/esm/extensions/index.js +2 -0
  95. package/dist/esm/extensions/index.js.map +1 -0
  96. package/dist/esm/extensions/types.js +2 -0
  97. package/dist/esm/extensions/types.js.map +1 -0
  98. package/dist/esm/index.js +4 -3
  99. package/dist/esm/index.js.map +1 -1
  100. package/dist/esm/initialize.js +14 -23
  101. package/dist/esm/initialize.js.map +1 -1
  102. package/dist/esm/instrumentations/base.js +6 -1
  103. package/dist/esm/instrumentations/base.js.map +1 -1
  104. package/dist/esm/instrumentations/index.js +1 -0
  105. package/dist/esm/instrumentations/index.js.map +1 -1
  106. package/dist/esm/instrumentations/initialize.js +8 -2
  107. package/dist/esm/instrumentations/initialize.js.map +1 -1
  108. package/dist/esm/instrumentations/registerInitial.js +4 -0
  109. package/dist/esm/instrumentations/registerInitial.js.map +1 -0
  110. package/dist/esm/instrumentations/types.js.map +1 -1
  111. package/dist/esm/internalLogger/const.js.map +1 -1
  112. package/dist/esm/internalLogger/createInternalLogger.js.map +1 -1
  113. package/dist/esm/internalLogger/index.js +1 -1
  114. package/dist/esm/internalLogger/index.js.map +1 -1
  115. package/dist/esm/internalLogger/initialize.js.map +1 -1
  116. package/dist/esm/metas/index.js +1 -0
  117. package/dist/esm/metas/index.js.map +1 -1
  118. package/dist/esm/metas/initialize.js +4 -18
  119. package/dist/esm/metas/initialize.js.map +1 -1
  120. package/dist/esm/metas/registerInitial.js +25 -0
  121. package/dist/esm/metas/registerInitial.js.map +1 -0
  122. package/dist/esm/metas/types.js.map +1 -1
  123. package/dist/esm/sdk/faroGlobalObject.js.map +1 -1
  124. package/dist/esm/sdk/index.js +1 -1
  125. package/dist/esm/sdk/index.js.map +1 -1
  126. package/dist/esm/sdk/internalFaroGlobalObject.js.map +1 -1
  127. package/dist/esm/sdk/registerFaro.js +21 -0
  128. package/dist/esm/sdk/registerFaro.js.map +1 -0
  129. package/dist/esm/semantic.js +1 -0
  130. package/dist/esm/semantic.js.map +1 -1
  131. package/dist/esm/testUtils/mockConfig.js.map +1 -1
  132. package/dist/esm/transports/base.js +1 -1
  133. package/dist/esm/transports/base.js.map +1 -1
  134. package/dist/esm/transports/index.js +1 -0
  135. package/dist/esm/transports/index.js.map +1 -1
  136. package/dist/esm/transports/initialize.js +5 -4
  137. package/dist/esm/transports/initialize.js.map +1 -1
  138. package/dist/esm/transports/registerInitial.js +6 -0
  139. package/dist/esm/transports/registerInitial.js.map +1 -0
  140. package/dist/esm/transports/types.js.map +1 -1
  141. package/dist/esm/unpatchedConsole/initialize.js.map +1 -1
  142. package/dist/esm/utils/index.js +0 -1
  143. package/dist/esm/utils/index.js.map +1 -1
  144. package/dist/esm/utils/shortId.js.map +1 -1
  145. package/dist/esm/version.js +1 -1
  146. package/dist/esm/version.js.map +1 -1
  147. package/dist/types/api/events/initialize.d.ts +2 -1
  148. package/dist/types/api/exceptions/initialize.d.ts +2 -1
  149. package/dist/types/api/initialize.d.ts +2 -1
  150. package/dist/types/api/logs/initialize.d.ts +2 -1
  151. package/dist/types/api/measurements/initialize.d.ts +2 -1
  152. package/dist/types/api/measurements/types.d.ts +2 -1
  153. package/dist/types/api/meta/initialize.d.ts +2 -1
  154. package/dist/types/api/meta/types.d.ts +5 -3
  155. package/dist/types/api/traces/initialize.d.ts +2 -1
  156. package/dist/types/config/types.d.ts +2 -1
  157. package/dist/types/extensions/baseExtension.d.ts +15 -0
  158. package/dist/types/extensions/index.d.ts +2 -0
  159. package/dist/types/extensions/types.d.ts +16 -0
  160. package/dist/types/index.d.ts +7 -5
  161. package/dist/types/instrumentations/base.d.ts +5 -1
  162. package/dist/types/instrumentations/index.d.ts +1 -0
  163. package/dist/types/instrumentations/initialize.d.ts +5 -1
  164. package/dist/types/instrumentations/registerInitial.d.ts +2 -0
  165. package/dist/types/instrumentations/types.d.ts +5 -1
  166. package/dist/types/internalLogger/index.d.ts +1 -1
  167. package/dist/types/metas/index.d.ts +2 -1
  168. package/dist/types/metas/initialize.d.ts +2 -1
  169. package/dist/types/metas/registerInitial.d.ts +2 -0
  170. package/dist/types/metas/types.d.ts +6 -1
  171. package/dist/types/sdk/index.d.ts +1 -1
  172. package/dist/types/sdk/registerFaro.d.ts +10 -0
  173. package/dist/types/semantic.d.ts +1 -0
  174. package/dist/types/testUtils/mockTransport.d.ts +1 -1
  175. package/dist/types/transports/base.d.ts +1 -1
  176. package/dist/types/transports/index.d.ts +1 -0
  177. package/dist/types/transports/initialize.d.ts +3 -1
  178. package/dist/types/transports/registerInitial.d.ts +2 -0
  179. package/dist/types/transports/types.d.ts +1 -1
  180. package/dist/types/utils/index.d.ts +0 -2
  181. package/dist/types/version.d.ts +1 -1
  182. package/package.json +4 -4
  183. package/dist/cjs/sdk/register.js.map +0 -1
  184. package/dist/cjs/utils/extensions.js.map +0 -1
  185. package/dist/esm/sdk/register.js +0 -11
  186. package/dist/esm/sdk/register.js.map +0 -1
  187. package/dist/esm/utils/extensions.js +0 -23
  188. package/dist/esm/utils/extensions.js.map +0 -1
  189. package/dist/types/sdk/register.d.ts +0 -4
  190. 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, transports: Transports, metas: Metas, tracesApi: TracesAPI): MeasurementsAPI;
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, _transports: Transports, metas: Metas): MetaAPI;
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: MetaUser) => void;
3
+ setUser: (user?: MetaUser | undefined) => void;
4
4
  resetUser: () => void;
5
- setSession: (session: MetaSession) => void;
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, transports: Transports, metas: Metas): TracesAPI;
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,2 @@
1
+ export { BaseExtension } from './baseExtension';
2
+ export type { Extension } from './types';
@@ -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
+ }
@@ -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, BaseExtension, 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';
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 { BaseExtension } from '../utils';
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,3 +1,4 @@
1
1
  export { BaseInstrumentation } from './base';
2
2
  export { initializeInstrumentations } from './initialize';
3
+ export { registerInitialInstrumentations } from './registerInitial';
3
4
  export type { Instrumentation, Instrumentations } from './types';
@@ -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, _config: Config): Instrumentations;
8
+ export declare function initializeInstrumentations(unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, config: Config, metas: Metas, transports: Transports, api: API): Instrumentations;
@@ -0,0 +1,2 @@
1
+ import type { Faro } from '../sdk';
2
+ export declare function registerInitialInstrumentations(faro: Faro): void;
@@ -1,5 +1,9 @@
1
- import type { Extension } from '../utils';
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 type { Meta, MetaApp, MetaAttributes, MetaBrowser, MetaGetter, MetaItem, MetaPage, Metas, MetaSDK, MetaSDKIntegration, MetaSession, MetaUser, } from './types';
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, config: Config): Metas;
5
+ export declare function initializeMetas(_unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, _config: Config): Metas;
@@ -0,0 +1,2 @@
1
+ import type { Faro } from '../sdk';
2
+ export declare function registerInitialMetas(faro: Faro): void;
@@ -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 './register';
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;
@@ -3,5 +3,6 @@ export declare const Conventions: {
3
3
  readonly CLICK: "click";
4
4
  readonly NAVIGATION: "navigation";
5
5
  readonly SESSION_START: "session_start";
6
+ readonly VIEW_CHANGED: "view_changed";
6
7
  };
7
8
  };
@@ -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.0-beta4";
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 '../utils';
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;
@@ -0,0 +1,2 @@
1
+ import type { Faro } from '../sdk';
2
+ export declare function registerInitialTransports(faro: Faro): void;
@@ -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';
@@ -1 +1 @@
1
- export declare const VERSION = "1.0.0-beta4";
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.0-beta4",
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.3.0",
53
+ "@opentelemetry/api": "^1.4.0",
54
54
  "@opentelemetry/api-metrics": "^0.33.0",
55
- "@opentelemetry/otlp-transformer": "^0.34.0"
55
+ "@opentelemetry/otlp-transformer": "^0.35.0"
56
56
  },
57
57
  "publishConfig": {
58
58
  "access": "public"
59
59
  },
60
- "gitHead": "88ab57b93286d22830db932a7dc74bcaf2dd4c3d"
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"]}
@@ -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,4 +0,0 @@
1
- import type { InternalLogger } from '../internalLogger';
2
- import type { Faro } from './types';
3
- export declare let faro: Faro;
4
- export declare function registerFaro(internalLogger: InternalLogger, newFaro: Faro): Faro;
@@ -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
- }