@grafana/faro-core 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +13 -1
  2. package/dist/bundle/faro-core.iife.js +1 -1
  3. package/dist/bundle/types/api/exceptions/types.d.ts +2 -0
  4. package/dist/bundle/types/api/index.d.ts +1 -0
  5. package/dist/bundle/types/api/noop.d.ts +2 -0
  6. package/dist/bundle/types/api/userActions/userAction.d.ts +1 -0
  7. package/dist/bundle/types/index.d.ts +2 -2
  8. package/dist/bundle/types/metas/index.d.ts +1 -1
  9. package/dist/bundle/types/metas/types.d.ts +19 -2
  10. package/dist/bundle/types/testUtils/mockTransport.d.ts +1 -1
  11. package/dist/bundle/types/utils/date.d.ts +18 -0
  12. package/dist/bundle/types/utils/index.d.ts +1 -1
  13. package/dist/bundle/types/version.d.ts +1 -1
  14. package/dist/cjs/api/exceptions/initialize.js +6 -4
  15. package/dist/cjs/api/exceptions/initialize.js.map +1 -1
  16. package/dist/cjs/api/exceptions/types.js.map +1 -1
  17. package/dist/cjs/api/index.js +3 -1
  18. package/dist/cjs/api/index.js.map +1 -1
  19. package/dist/cjs/api/noop.js +30 -0
  20. package/dist/cjs/api/noop.js.map +1 -0
  21. package/dist/cjs/api/userActions/userAction.js +10 -1
  22. package/dist/cjs/api/userActions/userAction.js.map +1 -1
  23. package/dist/cjs/index.js +2 -1
  24. package/dist/cjs/index.js.map +1 -1
  25. package/dist/cjs/metas/index.js.map +1 -1
  26. package/dist/cjs/metas/types.js.map +1 -1
  27. package/dist/cjs/sdk/registerFaro.js +2 -1
  28. package/dist/cjs/sdk/registerFaro.js.map +1 -1
  29. package/dist/cjs/utils/date.js +24 -0
  30. package/dist/cjs/utils/date.js.map +1 -1
  31. package/dist/cjs/utils/index.js +2 -1
  32. package/dist/cjs/utils/index.js.map +1 -1
  33. package/dist/cjs/version.js +1 -1
  34. package/dist/cjs/version.js.map +1 -1
  35. package/dist/esm/api/exceptions/initialize.js +6 -4
  36. package/dist/esm/api/exceptions/initialize.js.map +1 -1
  37. package/dist/esm/api/exceptions/types.js.map +1 -1
  38. package/dist/esm/api/index.js +1 -0
  39. package/dist/esm/api/index.js.map +1 -1
  40. package/dist/esm/api/noop.js +27 -0
  41. package/dist/esm/api/noop.js.map +1 -0
  42. package/dist/esm/api/userActions/userAction.js +11 -2
  43. package/dist/esm/api/userActions/userAction.js.map +1 -1
  44. package/dist/esm/index.js +1 -1
  45. package/dist/esm/index.js.map +1 -1
  46. package/dist/esm/metas/index.js.map +1 -1
  47. package/dist/esm/metas/types.js.map +1 -1
  48. package/dist/esm/sdk/registerFaro.js +2 -1
  49. package/dist/esm/sdk/registerFaro.js.map +1 -1
  50. package/dist/esm/utils/date.js +23 -0
  51. package/dist/esm/utils/date.js.map +1 -1
  52. package/dist/esm/utils/index.js +1 -1
  53. package/dist/esm/utils/index.js.map +1 -1
  54. package/dist/esm/version.js +1 -1
  55. package/dist/esm/version.js.map +1 -1
  56. package/dist/types/api/exceptions/types.d.ts +2 -0
  57. package/dist/types/api/index.d.ts +1 -0
  58. package/dist/types/api/noop.d.ts +2 -0
  59. package/dist/types/api/userActions/userAction.d.ts +1 -0
  60. package/dist/types/index.d.ts +2 -2
  61. package/dist/types/metas/index.d.ts +1 -1
  62. package/dist/types/metas/types.d.ts +19 -2
  63. package/dist/types/testUtils/mockTransport.d.ts +1 -1
  64. package/dist/types/utils/date.d.ts +18 -0
  65. package/dist/types/utils/index.d.ts +1 -1
  66. package/dist/types/version.d.ts +1 -1
  67. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/metas/index.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAAtC,6GAAA,eAAe,OAAA;AAExB,qDAAyD;AAAhD,uHAAA,oBAAoB,OAAA","sourcesContent":["export { initializeMetas } from './initialize';\n\nexport { registerInitialMetas } from './registerInitial';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaK6,\n MetaPage,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n Metas,\n MetaOverrides,\n} from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/metas/index.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAAtC,6GAAA,eAAe,OAAA;AAExB,qDAAyD;AAAhD,uHAAA,oBAAoB,OAAA","sourcesContent":["export { initializeMetas } from './initialize';\n\nexport { registerInitialMetas } from './registerInitial';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaDevice,\n MetaGetter,\n MetaItem,\n MetaK6,\n MetaOS,\n MetaPage,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n Metas,\n MetaOverrides,\n} from './types';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/metas/types.ts"],"names":[],"mappings":"","sourcesContent":["export type MetaGetter<P = Partial<Meta>> = () => P;\n\nexport type MetaItem<P = Partial<Meta>> = P | MetaGetter<P>;\n\nexport type MetasListener = (value: Meta) => void;\n\nexport interface Metas {\n add: (...getters: MetaItem[]) => void;\n remove: (...getters: MetaItem[]) => void;\n addListener: (listener: MetasListener) => void;\n removeListener: (listener: MetasListener) => void;\n value: Meta;\n}\n\nexport type MetaAttributes = Record<string, string>;\n\nexport interface MetaSDKIntegration {\n name?: string;\n version?: string;\n}\n\nexport interface MetaSDK {\n name?: string;\n version?: string;\n integrations?: MetaSDKIntegration[];\n}\n\nexport interface MetaApp {\n name?: string;\n namespace?: string;\n release?: string;\n version?: string;\n environment?: string;\n bundleId?: string;\n}\n\nexport interface MetaUser {\n /**\n * User email address.\n */\n email?: string;\n /**\n * Unique identifier\n */\n id?: string;\n /**\n * Short name or login/username of the user.\n */\n username?: string;\n /**\n * User’s full name\n */\n fullName?: string;\n /**\n * comma separated list of user roles. \"admin\",editor\" etc.\n */\n roles?: string;\n /**\n * Unique user hash to correlate information for a user in anonymized form.\n */\n hash?: string;\n /**\n * arbitrary user attributes, must be of type string.\n */\n attributes?: MetaAttributes;\n}\n\nexport interface MetaSession {\n id?: string;\n attributes?: MetaAttributes;\n overrides?: MetaOverrides;\n}\n\nexport interface MetaPage {\n id?: string;\n url?: string;\n attributes?: MetaAttributes;\n}\n\ninterface NavigatorUABrandVersion {\n brand?: string;\n version?: string;\n}\n\nexport interface MetaBrowser {\n name?: string;\n version?: string;\n os?: string;\n mobile?: boolean;\n userAgent?: string;\n language?: string;\n brands?: NavigatorUABrandVersion[] | string;\n viewportWidth?: string;\n viewportHeight?: string;\n}\n\nexport interface MetaView {\n name: string;\n}\n\nexport interface MetaK6 {\n isK6Browser?: boolean;\n testRunId?: string;\n}\n\nexport interface Meta {\n sdk?: MetaSDK;\n app?: MetaApp;\n user?: MetaUser;\n session?: MetaSession;\n page?: MetaPage;\n browser?: MetaBrowser;\n view?: MetaView;\n k6?: MetaK6;\n}\n\n/**\n * MetaOverrides are instructions that allow the receiver to override certain properties (Grafana Cloud only).\n */\nexport type MetaOverrides = {\n /**\n * New service name (Grafana Cloud only)\n */\n serviceName?: string;\n\n /**\n * Enable or disable geolocation tracking (Grafana Cloud only).\n * Geolocation tracking must be enabled in the Grafana Cloud settings first.\n * It cannot be enabled solely on the client side.\n * This option allows control over tracking on the client side to comply with user\n * privacy requirements.\n */\n geoLocationTrackingEnabled?: boolean;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/metas/types.ts"],"names":[],"mappings":"","sourcesContent":["export type MetaGetter<P = Partial<Meta>> = () => P;\n\nexport type MetaItem<P = Partial<Meta>> = P | MetaGetter<P>;\n\nexport type MetasListener = (value: Meta) => void;\n\nexport interface Metas {\n add: (...getters: MetaItem[]) => void;\n remove: (...getters: MetaItem[]) => void;\n addListener: (listener: MetasListener) => void;\n removeListener: (listener: MetasListener) => void;\n value: Meta;\n}\n\nexport type MetaAttributes = Record<string, string>;\n\nexport interface MetaSDKIntegration {\n name?: string;\n version?: string;\n}\n\nexport interface MetaSDK {\n name?: string;\n version?: string;\n integrations?: MetaSDKIntegration[];\n}\n\nexport interface MetaApp {\n bundleId?: string;\n environment?: string;\n installationId?: string;\n name?: string;\n namespace?: string;\n release?: string;\n version?: string;\n}\n\nexport interface MetaUser {\n /**\n * User email address.\n */\n email?: string;\n /**\n * Unique identifier\n */\n id?: string;\n /**\n * Short name or login/username of the user.\n */\n username?: string;\n /**\n * User’s full name\n */\n fullName?: string;\n /**\n * comma separated list of user roles. \"admin\",editor\" etc.\n */\n roles?: string;\n /**\n * Unique user hash to correlate information for a user in anonymized form.\n */\n hash?: string;\n /**\n * arbitrary user attributes, must be of type string.\n */\n attributes?: MetaAttributes;\n}\n\nexport interface MetaSession {\n id?: string;\n attributes?: MetaAttributes;\n overrides?: MetaOverrides;\n}\n\nexport interface MetaPage {\n id?: string;\n url?: string;\n attributes?: MetaAttributes;\n}\n\ninterface NavigatorUABrandVersion {\n brand?: string;\n version?: string;\n}\n\nexport interface MetaBrowser {\n name?: string;\n version?: string;\n os?: string;\n mobile?: boolean;\n userAgent?: string;\n language?: string;\n brands?: NavigatorUABrandVersion[] | string;\n viewportWidth?: string;\n viewportHeight?: string;\n}\n\nexport interface MetaView {\n name: string;\n}\n\nexport interface MetaK6 {\n isK6Browser?: boolean;\n testRunId?: string;\n}\n\n// Fields on MetaOS and MetaDevice use snake_case to mirror the Faro spec wire\n// format, which in turn mirrors OTel `os.*` and `device.*` semantic convention\n// attribute keys (e.g. os.build_id, device.model.identifier). Intentionally\n// inconsistent with the camelCase used elsewhere in Meta.\nexport interface MetaOS {\n name?: string;\n version?: string;\n build_id?: string;\n detail?: string;\n}\n\nexport interface MetaDevice {\n manufacturer?: string;\n model_identifier?: string;\n model_name?: string;\n brand?: string;\n is_physical?: boolean;\n type?: string;\n}\n\nexport interface Meta {\n sdk?: MetaSDK;\n app?: MetaApp;\n user?: MetaUser;\n session?: MetaSession;\n page?: MetaPage;\n browser?: MetaBrowser;\n view?: MetaView;\n k6?: MetaK6;\n os?: MetaOS;\n device?: MetaDevice;\n}\n\n/**\n * MetaOverrides are instructions that allow the receiver to override certain properties (Grafana Cloud only).\n */\nexport type MetaOverrides = {\n /**\n * New service name (Grafana Cloud only)\n */\n serviceName?: string;\n\n /**\n * Enable or disable geolocation tracking (Grafana Cloud only).\n * Geolocation tracking must be enabled in the Grafana Cloud settings first.\n * It cannot be enabled solely on the client side.\n * This option allows control over tracking on the client side to comply with user\n * privacy requirements.\n */\n geoLocationTrackingEnabled?: boolean;\n};\n"]}
@@ -2,9 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.faro = void 0;
4
4
  exports.registerFaro = registerFaro;
5
+ const noop_1 = require("../api/noop");
5
6
  const faroGlobalObject_1 = require("./faroGlobalObject");
6
7
  const internalFaroGlobalObject_1 = require("./internalFaroGlobalObject");
7
- exports.faro = {};
8
+ exports.faro = { api: (0, noop_1.getNoopAPI)() };
8
9
  function registerFaro(unpatchedConsole, internalLogger, config, metas, transports, api, instrumentations) {
9
10
  internalLogger.debug('Initializing Faro');
10
11
  exports.faro = {
@@ -1 +1 @@
1
- {"version":3,"file":"registerFaro.js","sourceRoot":"","sources":["../../../src/sdk/registerFaro.ts"],"names":[],"mappings":";;;AAcA,oCA4BC;AAlCD,yDAA2D;AAC3D,yEAA2E;AAGhE,QAAA,IAAI,GAAS,EAAU,CAAC;AAEnC,SAAgB,YAAY,CAC1B,gBAAkC,EAClC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB,EACtB,GAAQ,EACR,gBAAkC;IAElC,cAAc,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAE1C,YAAI,GAAG;QACL,GAAG;QACH,MAAM;QACN,gBAAgB;QAChB,cAAc;QACd,KAAK;QACL,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,UAAU;QACV,gBAAgB;QAChB,OAAO,EAAE,UAAU,CAAC,OAAO;KAC5B,CAAC;IAEF,IAAA,wDAA6B,EAAC,YAAI,CAAC,CAAC;IAEpC,IAAA,wCAAqB,EAAC,YAAI,CAAC,CAAC;IAE5B,OAAO,YAAI,CAAC;AACd,CAAC","sourcesContent":["import type { API } from '../api';\nimport type { Config } from '../config';\nimport type { Instrumentations } from '../instrumentations';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { Transports } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nimport { setFaroOnGlobalObject } from './faroGlobalObject';\nimport { setInternalFaroOnGlobalObject } from './internalFaroGlobalObject';\nimport type { Faro } from './types';\n\nexport let faro: Faro = {} as Faro;\n\nexport function registerFaro(\n unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n api: API,\n instrumentations: Instrumentations\n): Faro {\n internalLogger.debug('Initializing Faro');\n\n faro = {\n api,\n config,\n instrumentations,\n internalLogger,\n metas,\n pause: transports.pause,\n transports,\n unpatchedConsole,\n unpause: transports.unpause,\n };\n\n setInternalFaroOnGlobalObject(faro);\n\n setFaroOnGlobalObject(faro);\n\n return faro;\n}\n"]}
1
+ {"version":3,"file":"registerFaro.js","sourceRoot":"","sources":["../../../src/sdk/registerFaro.ts"],"names":[],"mappings":";;;AAeA,oCA4BC;AA1CD,sCAAyC;AAQzC,yDAA2D;AAC3D,yEAA2E;AAGhE,QAAA,IAAI,GAAS,EAAE,GAAG,EAAE,IAAA,iBAAU,GAAE,EAAU,CAAC;AAEtD,SAAgB,YAAY,CAC1B,gBAAkC,EAClC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB,EACtB,GAAQ,EACR,gBAAkC;IAElC,cAAc,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAE1C,YAAI,GAAG;QACL,GAAG;QACH,MAAM;QACN,gBAAgB;QAChB,cAAc;QACd,KAAK;QACL,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,UAAU;QACV,gBAAgB;QAChB,OAAO,EAAE,UAAU,CAAC,OAAO;KAC5B,CAAC;IAEF,IAAA,wDAA6B,EAAC,YAAI,CAAC,CAAC;IAEpC,IAAA,wCAAqB,EAAC,YAAI,CAAC,CAAC;IAE5B,OAAO,YAAI,CAAC;AACd,CAAC","sourcesContent":["import type { API } from '../api';\nimport { getNoopAPI } from '../api/noop';\nimport type { Config } from '../config';\nimport type { Instrumentations } from '../instrumentations';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { Transports } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nimport { setFaroOnGlobalObject } from './faroGlobalObject';\nimport { setInternalFaroOnGlobalObject } from './internalFaroGlobalObject';\nimport type { Faro } from './types';\n\nexport let faro: Faro = { api: getNoopAPI() } as Faro;\n\nexport function registerFaro(\n unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n api: API,\n instrumentations: Instrumentations\n): Faro {\n internalLogger.debug('Initializing Faro');\n\n faro = {\n api,\n config,\n instrumentations,\n internalLogger,\n metas,\n pause: transports.pause,\n transports,\n unpatchedConsole,\n unpause: transports.unpause,\n };\n\n setInternalFaroOnGlobalObject(faro);\n\n setFaroOnGlobalObject(faro);\n\n return faro;\n}\n"]}
@@ -1,11 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dateNow = dateNow;
4
+ exports.monoNow = monoNow;
4
5
  exports.getCurrentTimestamp = getCurrentTimestamp;
5
6
  exports.timestampToIsoString = timestampToIsoString;
6
7
  function dateNow() {
7
8
  return Date.now();
8
9
  }
10
+ /**
11
+ * Returns a high-resolution, monotonic timestamp in milliseconds.
12
+ *
13
+ * Use this for measuring elapsed time / durations. Unlike {@link dateNow} (which is
14
+ * derived from the system wall clock and is therefore subject to NTP adjustments,
15
+ * manual clock changes, daylight-savings transitions, etc.), `monoNow` is backed by
16
+ * `performance.now()`, which is guaranteed never to decrease and is unaffected by
17
+ * such adjustments.
18
+ *
19
+ * Do NOT use this for absolute event timestamps that need to be correlated with
20
+ * other systems or persisted across page loads — use {@link dateNow} or
21
+ * {@link getCurrentTimestamp} for that.
22
+ *
23
+ * Falls back to {@link dateNow} in environments where `performance.now` is
24
+ * unavailable (very old runtimes, unusual SSR setups). The fallback re-introduces
25
+ * wall-clock susceptibility but preserves the API contract.
26
+ */
27
+ function monoNow() {
28
+ if (typeof performance !== 'undefined' && typeof performance.now === 'function') {
29
+ return performance.now();
30
+ }
31
+ return Date.now();
32
+ }
9
33
  function getCurrentTimestamp() {
10
34
  return new Date().toISOString();
11
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"date.js","sourceRoot":"","sources":["../../../src/utils/date.ts"],"names":[],"mappings":";;AAAA,0BAEC;AAED,kDAEC;AAED,oDAEC;AAVD,SAAgB,OAAO;IACrB,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;AACpB,CAAC;AAED,SAAgB,mBAAmB;IACjC,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC;AAED,SAAgB,oBAAoB,CAAC,KAAa;IAChD,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AACvC,CAAC","sourcesContent":["export function dateNow(): number {\n return Date.now();\n}\n\nexport function getCurrentTimestamp(): string {\n return new Date().toISOString();\n}\n\nexport function timestampToIsoString(value: number): string {\n return new Date(value).toISOString();\n}\n"]}
1
+ {"version":3,"file":"date.js","sourceRoot":"","sources":["../../../src/utils/date.ts"],"names":[],"mappings":";;AAAA,0BAEC;AAmBD,0BAKC;AAED,kDAEC;AAED,oDAEC;AAlCD,SAAgB,OAAO;IACrB,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;AACpB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,OAAO;IACrB,IAAI,OAAO,WAAW,KAAK,WAAW,IAAI,OAAO,WAAW,CAAC,GAAG,KAAK,UAAU,EAAE,CAAC;QAChF,OAAO,WAAW,CAAC,GAAG,EAAE,CAAC;IAC3B,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;AACpB,CAAC;AAED,SAAgB,mBAAmB;IACjC,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC;AAED,SAAgB,oBAAoB,CAAC,KAAa;IAChD,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AACvC,CAAC","sourcesContent":["export function dateNow(): number {\n return Date.now();\n}\n\n/**\n * Returns a high-resolution, monotonic timestamp in milliseconds.\n *\n * Use this for measuring elapsed time / durations. Unlike {@link dateNow} (which is\n * derived from the system wall clock and is therefore subject to NTP adjustments,\n * manual clock changes, daylight-savings transitions, etc.), `monoNow` is backed by\n * `performance.now()`, which is guaranteed never to decrease and is unaffected by\n * such adjustments.\n *\n * Do NOT use this for absolute event timestamps that need to be correlated with\n * other systems or persisted across page loads — use {@link dateNow} or\n * {@link getCurrentTimestamp} for that.\n *\n * Falls back to {@link dateNow} in environments where `performance.now` is\n * unavailable (very old runtimes, unusual SSR setups). The fallback re-introduces\n * wall-clock susceptibility but preserves the API contract.\n */\nexport function monoNow(): number {\n if (typeof performance !== 'undefined' && typeof performance.now === 'function') {\n return performance.now();\n }\n return Date.now();\n}\n\nexport function getCurrentTimestamp(): string {\n return new Date().toISOString();\n}\n\nexport function timestampToIsoString(value: number): string {\n return new Date(value).toISOString();\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Observable = exports.stringifyObjectValues = exports.stringifyExternalJson = exports.getCircularDependencyReplacer = exports.dateNow = exports.getBundleId = exports.genShortID = exports.createPromiseBuffer = exports.noop = exports.LogLevel = exports.defaultLogLevel = exports.allLogLevels = exports.isEmpty = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.getCurrentTimestamp = exports.deepEqual = exports.clampSamplingRate = void 0;
3
+ exports.Observable = exports.stringifyObjectValues = exports.stringifyExternalJson = exports.getCircularDependencyReplacer = exports.monoNow = exports.dateNow = exports.getBundleId = exports.genShortID = exports.createPromiseBuffer = exports.noop = exports.LogLevel = exports.defaultLogLevel = exports.allLogLevels = exports.isEmpty = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = exports.isString = exports.isRegExp = exports.isPrimitive = exports.isObject = exports.isNumber = exports.isNull = exports.isMapDefined = exports.isMap = exports.isInt = exports.isInstanceOf = exports.isFunction = exports.isEventDefined = exports.isEvent = exports.isErrorEvent = exports.isErrorDefined = exports.isError = exports.isElementDefined = exports.isElement = exports.isDomException = exports.isDomError = exports.isBoolean = exports.isArray = exports.getCurrentTimestamp = exports.deepEqual = exports.clampSamplingRate = void 0;
4
4
  var sampling_1 = require("./sampling");
5
5
  Object.defineProperty(exports, "clampSamplingRate", { enumerable: true, get: function () { return sampling_1.clampSamplingRate; } });
6
6
  var deepEqual_1 = require("./deepEqual");
@@ -51,6 +51,7 @@ var sourceMaps_1 = require("./sourceMaps");
51
51
  Object.defineProperty(exports, "getBundleId", { enumerable: true, get: function () { return sourceMaps_1.getBundleId; } });
52
52
  var date_2 = require("./date");
53
53
  Object.defineProperty(exports, "dateNow", { enumerable: true, get: function () { return date_2.dateNow; } });
54
+ Object.defineProperty(exports, "monoNow", { enumerable: true, get: function () { return date_2.monoNow; } });
54
55
  var json_1 = require("./json");
55
56
  Object.defineProperty(exports, "getCircularDependencyReplacer", { enumerable: true, get: function () { return json_1.getCircularDependencyReplacer; } });
56
57
  Object.defineProperty(exports, "stringifyExternalJson", { enumerable: true, get: function () { return json_1.stringifyExternalJson; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAEA,uCAA+C;AAAtC,6GAAA,iBAAiB,OAAA;AAE1B,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAElB,+BAA6C;AAApC,2GAAA,mBAAmB,OAAA;AAE5B,2BA8Bc;AA7BZ,6FAAA,OAAO,OAAA;AACP,+FAAA,SAAS,OAAA;AACT,gGAAA,UAAU,OAAA;AACV,oGAAA,cAAc,OAAA;AACd,+FAAA,SAAS,OAAA;AACT,sGAAA,gBAAgB,OAAA;AAChB,6FAAA,OAAO,OAAA;AACP,oGAAA,cAAc,OAAA;AACd,kGAAA,YAAY,OAAA;AACZ,6FAAA,OAAO,OAAA;AACP,oGAAA,cAAc,OAAA;AACd,gGAAA,UAAU,OAAA;AACV,kGAAA,YAAY,OAAA;AACZ,2FAAA,KAAK,OAAA;AACL,2FAAA,KAAK,OAAA;AACL,kGAAA,YAAY,OAAA;AACZ,4FAAA,MAAM,OAAA;AACN,8FAAA,QAAQ,OAAA;AACR,8FAAA,QAAQ,OAAA;AACR,iGAAA,WAAW,OAAA;AACX,8FAAA,QAAQ,OAAA;AACR,8FAAA,QAAQ,OAAA;AACR,8FAAA,QAAQ,OAAA;AACR,sGAAA,gBAAgB,OAAA;AAChB,gGAAA,UAAU,OAAA;AACV,gGAAA,UAAU,OAAA;AACV,8FAAA,QAAQ,OAAA;AACR,iGAAA,WAAW,OAAA;AACX,6FAAA,OAAO,OAAA;AAIT,yCAAsE;AAA7D,yGAAA,YAAY,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAEhD,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AAEb,iDAAsD;AAA7C,oHAAA,mBAAmB,OAAA;AAG5B,qCAAuC;AAA9B,qGAAA,UAAU,OAAA;AAEnB,2CAA2C;AAAlC,yGAAA,WAAW,OAAA;AAEpB,+BAAiC;AAAxB,+FAAA,OAAO,OAAA;AAEhB,+BAAqG;AAA5F,qHAAA,6BAA6B,OAAA;AAAE,6GAAA,qBAAqB,OAAA;AAAE,6GAAA,qBAAqB,OAAA;AAEpF,uCAAwC;AAA/B,sGAAA,UAAU,OAAA","sourcesContent":["export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';\n\nexport { clampSamplingRate } from './sampling';\n\nexport { deepEqual } from './deepEqual';\n\nexport { getCurrentTimestamp } from './date';\n\nexport {\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n isEmpty,\n} from './is';\nexport type { IsFnHelper } from './is';\n\nexport { allLogLevels, defaultLogLevel, LogLevel } from './logLevels';\n\nexport { noop } from './noop';\n\nexport { createPromiseBuffer } from './promiseBuffer';\nexport type { BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer } from './promiseBuffer';\n\nexport { genShortID } from './shortId';\n\nexport { getBundleId } from './sourceMaps';\n\nexport { dateNow } from './date';\n\nexport { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';\n\nexport { Observable } from './reactive';\nexport type { Subscription } from './reactive';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAEA,uCAA+C;AAAtC,6GAAA,iBAA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AAE,6GAAA,qBAAqB,OAAA;AAEpF,uCAAwC;AAA/B,sGAAA,UAAU,OAAA","sourcesContent":["export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';\n\nexport { clampSamplingRate } from './sampling';\n\nexport { deepEqual } from './deepEqual';\n\nexport { getCurrentTimestamp } from './date';\n\nexport {\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n isEmpty,\n} from './is';\nexport type { IsFnHelper } from './is';\n\nexport { allLogLevels, defaultLogLevel, LogLevel } from './logLevels';\n\nexport { noop } from './noop';\n\nexport { createPromiseBuffer } from './promiseBuffer';\nexport type { BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer } from './promiseBuffer';\n\nexport { genShortID } from './shortId';\n\nexport { getBundleId } from './sourceMaps';\n\nexport { dateNow, monoNow } from './date';\n\nexport { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';\n\nexport { Observable } from './reactive';\nexport type { Subscription } from './reactive';\n"]}
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // auto-generated by bin/genVersion.ts
5
- exports.VERSION = '2.4.0';
5
+ exports.VERSION = '2.5.0';
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '2.4.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '2.5.0';\n"]}
@@ -16,7 +16,8 @@ export function initializeExceptionsAPI({ internalLogger, config, metas, transpo
16
16
  };
17
17
  const getStacktraceParser = () => stacktraceParser;
18
18
  const { ignoreErrors = [], preserveOriginalError } = config;
19
- const pushError = (error, { skipDedupe, stackFrames, type, context, spanContext, timestampOverwriteMs, originalError, fingerprint } = {}) => {
19
+ const pushError = (error, { skipDedupe, stackFrames, type, context, spanContext, timestampOverwriteMs, originalError, fingerprint, fatal, } = {}) => {
20
+ var _a;
20
21
  if (isErrorIgnored(ignoreErrors, originalError !== null && originalError !== void 0 ? originalError : error)) {
21
22
  return;
22
23
  }
@@ -24,12 +25,12 @@ export function initializeExceptionsAPI({ internalLogger, config, metas, transpo
24
25
  const ctx = stringifyObjectValues(Object.assign(Object.assign({}, parseCause(originalError !== null && originalError !== void 0 ? originalError : error)), (context !== null && context !== void 0 ? context : {})));
25
26
  const item = {
26
27
  meta: metas.value,
27
- payload: Object.assign(Object.assign(Object.assign({ type: type || error.name || defaultExceptionType, value: error.message, timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(), trace: spanContext
28
+ payload: Object.assign(Object.assign(Object.assign(Object.assign({ type: type || error.name || defaultExceptionType, value: error.message, timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(), trace: spanContext
28
29
  ? {
29
30
  trace_id: spanContext.traceId,
30
31
  span_id: spanContext.spanId,
31
32
  }
32
- : tracesApi.getTraceContext() }, (isEmpty(ctx) ? {} : { context: ctx })), (preserveOriginalError ? { originalError } : {})), (fingerprint ? { fingerprint } : {})),
33
+ : tracesApi.getTraceContext() }, (isEmpty(ctx) ? {} : { context: ctx })), (preserveOriginalError ? { originalError } : {})), (fingerprint ? { fingerprint } : {})), (fatal !== undefined ? { fatal } : {})),
33
34
  type: TransportItemType.EXCEPTION,
34
35
  };
35
36
  stackFrames = stackFrames !== null && stackFrames !== void 0 ? stackFrames : (error.stack ? stacktraceParser === null || stacktraceParser === void 0 ? void 0 : stacktraceParser(error).frames : undefined);
@@ -41,9 +42,10 @@ export function initializeExceptionsAPI({ internalLogger, config, metas, transpo
41
42
  const testingPayload = {
42
43
  type: item.payload.type,
43
44
  value: item.payload.value,
44
- stackTrace: item.payload.stacktrace,
45
+ stacktrace: item.payload.stacktrace,
45
46
  context: item.payload.context,
46
47
  fingerprint: item.payload.fingerprint,
48
+ fatal: (_a = item.payload.fatal) !== null && _a !== void 0 ? _a : false,
47
49
  };
48
50
  if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {
49
51
  internalLogger.debug('Skipping error push because it is the same as the last one\n', item.payload);
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/exceptions/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAG/C,IAAI,gBAA8C,CAAC;AAEnD,MAAM,UAAU,uBAAuB,CAAC,EACtC,cAAc,EACd,MAAM,EACN,KAAK,EACL,UAAU,EACV,SAAS,EACT,cAAc,GASf;;IACC,cAAc,CAAC,KAAK,CAAC,6BAA6B,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AK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;AACxC,CAAC;AAED,SAAS,cAAc,CAAC,YAAsB,EAAE,KAA+B;IAC7E,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACvC,OAAO,iBAAiB,CAAC,YAAY,EAAE,OAAO,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import type { Config, Patterns } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport {\n deepEqual,\n getCurrentTimestamp,\n isArray,\n isEmpty,\n isError,\n isNull,\n isObject,\n stringifyExternalJson,\n stringifyObjectValues,\n} from '../../utils';\nimport { timestampToIsoString } from '../../utils/date';\nimport type { TracesAPI } from '../traces';\nimport type { UserActionsAPI } from '../userActions';\nimport { addItemToUserActionBuffer } from '../userActions/initialize';\nimport { shouldIgnoreEvent } from '../utils';\n\nimport { defaultExceptionType } from './const';\nimport type { ErrorWithIndexProperties, ExceptionEvent, ExceptionsAPI, StacktraceParser } from './types';\n\nlet stacktraceParser: StacktraceParser | undefined;\n\nexport function initializeExceptionsAPI({\n internalLogger,\n config,\n metas,\n transports,\n tracesApi,\n userActionsApi,\n}: {\n unpatchedConsole: UnpatchedConsole;\n internalLogger: InternalLogger;\n config: Config;\n metas: Metas;\n transports: Transports;\n tracesApi: TracesAPI;\n userActionsApi: UserActionsAPI;\n}): ExceptionsAPI {\n internalLogger.debug('Initializing exceptions API');\n\n let lastPayload: Pick<ExceptionEvent, 'type' | 'value' | 'stacktrace' | 'context' | 'fingerprint'> | null = null;\n\n stacktraceParser = config.parseStacktrace ?? stacktraceParser;\n\n const changeStacktraceParser: ExceptionsAPI['changeStacktraceParser'] = (newStacktraceParser) => {\n internalLogger.debug('Changing stacktrace parser');\n\n stacktraceParser = newStacktraceParser ?? stacktraceParser;\n };\n\n const getStacktraceParser: ExceptionsAPI['getStacktraceParser'] = () => stacktraceParser;\n\n const { ignoreErrors = [], preserveOriginalError } = config;\n\n const pushError: ExceptionsAPI['pushError'] = (\n error,\n { skipDedupe, stackFrames, type, context, spanContext, timestampOverwriteMs, originalError, fingerprint } = {}\n ) => {\n if (isErrorIgnored(ignoreErrors, originalError ?? error)) {\n return;\n }\n try {\n const ctx = stringifyObjectValues({\n ...parseCause(originalError ?? error),\n ...(context ?? {}),\n });\n\n const item: TransportItem<ExceptionEvent<typeof preserveOriginalError>> = {\n meta: metas.value,\n payload: {\n type: type || error.name || defaultExceptionType,\n value: error.message,\n timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),\n trace: spanContext\n ? {\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n }\n : tracesApi.getTraceContext(),\n ...(isEmpty(ctx) ? {} : { context: ctx }),\n ...(preserveOriginalError ? { originalError } : {}),\n ...(fingerprint ? { fingerprint } : {}),\n },\n type: TransportItemType.EXCEPTION,\n };\n\n stackFrames = stackFrames ?? (error.stack ? stacktraceParser?.(error).frames : undefined);\n\n if (stackFrames?.length) {\n item.payload.stacktrace = {\n frames: stackFrames,\n };\n }\n\n const testingPayload = {\n type: item.payload.type,\n value: item.payload.value,\n stackTrace: item.payload.stacktrace,\n context: item.payload.context,\n fingerprint: item.payload.fingerprint,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping error push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing exception\\n', item);\n\n if (!addItemToUserActionBuffer(userActionsApi.getActiveUserAction(), item)) {\n transports.execute(item);\n }\n } catch (err) {\n internalLogger.error('Error pushing event', err);\n }\n };\n\n changeStacktraceParser(config.parseStacktrace);\n\n return {\n changeStacktraceParser,\n getStacktraceParser,\n pushError,\n };\n}\n\nfunction parseCause(error: ErrorWithIndexProperties): {} | { cause: string } {\n let cause = error.cause;\n\n if (isError(cause)) {\n cause = error.cause.toString();\n // typeof operator on null returns \"object\". This is a well-known quirk in JavaScript and is considered a bug that cannot be fixed due to backward compatibility issues.\n // MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#typeof_null\n } else if (cause !== null && (isObject(error.cause) || isArray(error.cause))) {\n cause = stringifyExternalJson(error.cause);\n } else if (cause != null) {\n cause = error.cause.toString();\n }\n\n return cause == null ? {} : { cause };\n}\n\nfunction isErrorIgnored(ignoreErrors: Patterns, error: ErrorWithIndexProperties): boolean {\n const { message, name, stack } = error;\n return shouldIgnoreEvent(ignoreErrors, message + ' ' + name + ' ' + stack);\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/exceptions/initialize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAG/C,IAAI,gBAA8C,CAAC;AAEnD,MAAM,UAAU,uBAAuB,CAAC,EACtC,cAAc,EACd,MAAM,EACN,KAAK,EACL,UAAU,EACV,SAAS,EACT,cAAc,GASf;;IACC,cAAc,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;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AC,CAAC;IAC7C,CAAC;SAAM,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QACzB,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;IAED,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;AACxC,CAAC;AAED,SAAS,cAAc,CAAC,YAAsB,EAAE,KAA+B;IAC7E,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACvC,OAAO,iBAAiB,CAAC,YAAY,EAAE,OAAO,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import type { Config, Patterns } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport {\n deepEqual,\n getCurrentTimestamp,\n isArray,\n isEmpty,\n isError,\n isNull,\n isObject,\n stringifyExternalJson,\n stringifyObjectValues,\n} from '../../utils';\nimport { timestampToIsoString } from '../../utils/date';\nimport type { TracesAPI } from '../traces';\nimport type { UserActionsAPI } from '../userActions';\nimport { addItemToUserActionBuffer } from '../userActions/initialize';\nimport { shouldIgnoreEvent } from '../utils';\n\nimport { defaultExceptionType } from './const';\nimport type { ErrorWithIndexProperties, ExceptionEvent, ExceptionsAPI, StacktraceParser } from './types';\n\nlet stacktraceParser: StacktraceParser | undefined;\n\nexport function initializeExceptionsAPI({\n internalLogger,\n config,\n metas,\n transports,\n tracesApi,\n userActionsApi,\n}: {\n unpatchedConsole: UnpatchedConsole;\n internalLogger: InternalLogger;\n config: Config;\n metas: Metas;\n transports: Transports;\n tracesApi: TracesAPI;\n userActionsApi: UserActionsAPI;\n}): ExceptionsAPI {\n internalLogger.debug('Initializing exceptions API');\n\n let lastPayload: Pick<ExceptionEvent, 'type' | 'value' | 'stacktrace' | 'context' | 'fingerprint' | 'fatal'> | null =\n null;\n\n stacktraceParser = config.parseStacktrace ?? stacktraceParser;\n\n const changeStacktraceParser: ExceptionsAPI['changeStacktraceParser'] = (newStacktraceParser) => {\n internalLogger.debug('Changing stacktrace parser');\n\n stacktraceParser = newStacktraceParser ?? stacktraceParser;\n };\n\n const getStacktraceParser: ExceptionsAPI['getStacktraceParser'] = () => stacktraceParser;\n\n const { ignoreErrors = [], preserveOriginalError } = config;\n\n const pushError: ExceptionsAPI['pushError'] = (\n error,\n {\n skipDedupe,\n stackFrames,\n type,\n context,\n spanContext,\n timestampOverwriteMs,\n originalError,\n fingerprint,\n fatal,\n } = {}\n ) => {\n if (isErrorIgnored(ignoreErrors, originalError ?? error)) {\n return;\n }\n try {\n const ctx = stringifyObjectValues({\n ...parseCause(originalError ?? error),\n ...(context ?? {}),\n });\n\n const item: TransportItem<ExceptionEvent<typeof preserveOriginalError>> = {\n meta: metas.value,\n payload: {\n type: type || error.name || defaultExceptionType,\n value: error.message,\n timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),\n trace: spanContext\n ? {\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n }\n : tracesApi.getTraceContext(),\n ...(isEmpty(ctx) ? {} : { context: ctx }),\n ...(preserveOriginalError ? { originalError } : {}),\n ...(fingerprint ? { fingerprint } : {}),\n ...(fatal !== undefined ? { fatal } : {}),\n },\n type: TransportItemType.EXCEPTION,\n };\n\n stackFrames = stackFrames ?? (error.stack ? stacktraceParser?.(error).frames : undefined);\n\n if (stackFrames?.length) {\n item.payload.stacktrace = {\n frames: stackFrames,\n };\n }\n\n const testingPayload = {\n type: item.payload.type,\n value: item.payload.value,\n stacktrace: item.payload.stacktrace,\n context: item.payload.context,\n fingerprint: item.payload.fingerprint,\n fatal: item.payload.fatal ?? false,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping error push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing exception\\n', item);\n\n if (!addItemToUserActionBuffer(userActionsApi.getActiveUserAction(), item)) {\n transports.execute(item);\n }\n } catch (err) {\n internalLogger.error('Error pushing event', err);\n }\n };\n\n changeStacktraceParser(config.parseStacktrace);\n\n return {\n changeStacktraceParser,\n getStacktraceParser,\n pushError,\n };\n}\n\nfunction parseCause(error: ErrorWithIndexProperties): {} | { cause: string } {\n let cause = error.cause;\n\n if (isError(cause)) {\n cause = error.cause.toString();\n // typeof operator on null returns \"object\". This is a well-known quirk in JavaScript and is considered a bug that cannot be fixed due to backward compatibility issues.\n // MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#typeof_null\n } else if (cause !== null && (isObject(error.cause) || isArray(error.cause))) {\n cause = stringifyExternalJson(error.cause);\n } else if (cause != null) {\n cause = error.cause.toString();\n }\n\n return cause == null ? {} : { cause };\n}\n\nfunction isErrorIgnored(ignoreErrors: Patterns, error: ErrorWithIndexProperties): boolean {\n const { message, name, stack } = error;\n return shouldIgnoreEvent(ignoreErrors, message + ' ' + name + ' ' + stack);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/api/exceptions/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { SpanContext } from '@opentelemetry/api';\n\nimport type { TraceContext } from '../traces';\nimport type { UserAction } from '../types';\n\nexport type StacktraceParser = (err: ExtendedError) => Stacktrace;\n\nexport interface ExceptionStackFrame {\n filename: string;\n function: string;\n\n colno?: number;\n lineno?: number;\n\n bundleid?: string;\n}\n\nexport interface ExtendedError extends Error {\n columnNumber?: number;\n stacktrace?: Error['stack'];\n}\n\nexport interface Stacktrace {\n frames: ExceptionStackFrame[];\n}\n\nexport type ExceptionContext = Record<string, string>;\n\nexport interface ExceptionEventDefault {\n timestamp: string;\n type: string;\n value: string;\n\n fingerprint?: string;\n stacktrace?: Stacktrace;\n trace?: TraceContext;\n context?: ExceptionContext;\n\n action?: UserAction;\n}\n\n/**\n * The ExceptionEventExtended type is used to represent an exception event with an additional error\n * property and is only meant for client side use. The additional property is removed by Faro before\n * sending the event to the transport.\n */\nexport type ExceptionEventExtended = ExceptionEventDefault & {\n originalError?: Error;\n};\n\nexport type ExceptionEvent<EXTENDED = ExceptionEventDefault> = EXTENDED extends boolean\n ? ExceptionEventExtended\n : ExceptionEventDefault;\n\nexport interface PushErrorOptions {\n fingerprint?: string;\n skipDedupe?: boolean;\n stackFrames?: ExceptionStackFrame[];\n type?: string;\n context?: ExceptionContext;\n spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;\n timestampOverwriteMs?: number;\n /**\n * Retains the original error object in the payload after parsing.\n * This is primarily for internal, advanced use cases.\n * Faro users should not need to use this option.\n */\n originalError?: Error;\n}\n\n// ts type is missing the cause property\nexport type ErrorWithIndexProperties = Error & {\n cause?: any;\n};\n\nexport interface ExceptionsAPI {\n changeStacktraceParser: (stacktraceParser: StacktraceParser) => void;\n getStacktraceParser: () => StacktraceParser | undefined;\n pushError: (value: ErrorWithIndexProperties, options?: PushErrorOptions) => void;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/api/exceptions/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { SpanContext } from '@opentelemetry/api';\n\nimport type { TraceContext } from '../traces';\nimport type { UserAction } from '../types';\n\nexport type StacktraceParser = (err: ExtendedError) => Stacktrace;\n\nexport interface ExceptionStackFrame {\n filename: string;\n function: string;\n\n colno?: number;\n lineno?: number;\n\n bundleid?: string;\n}\n\nexport interface ExtendedError extends Error {\n columnNumber?: number;\n stacktrace?: Error['stack'];\n}\n\nexport interface Stacktrace {\n frames: ExceptionStackFrame[];\n}\n\nexport type ExceptionContext = Record<string, string>;\n\nexport interface ExceptionEventDefault {\n timestamp: string;\n type: string;\n value: string;\n\n fatal?: boolean;\n fingerprint?: string;\n stacktrace?: Stacktrace;\n trace?: TraceContext;\n context?: ExceptionContext;\n\n action?: UserAction;\n}\n\n/**\n * The ExceptionEventExtended type is used to represent an exception event with an additional error\n * property and is only meant for client side use. The additional property is removed by Faro before\n * sending the event to the transport.\n */\nexport type ExceptionEventExtended = ExceptionEventDefault & {\n originalError?: Error;\n};\n\nexport type ExceptionEvent<EXTENDED = ExceptionEventDefault> = EXTENDED extends boolean\n ? ExceptionEventExtended\n : ExceptionEventDefault;\n\nexport interface PushErrorOptions {\n fatal?: boolean;\n fingerprint?: string;\n skipDedupe?: boolean;\n stackFrames?: ExceptionStackFrame[];\n type?: string;\n context?: ExceptionContext;\n spanContext?: Pick<SpanContext, 'traceId' | 'spanId'>;\n timestampOverwriteMs?: number;\n /**\n * Retains the original error object in the payload after parsing.\n * This is primarily for internal, advanced use cases.\n * Faro users should not need to use this option.\n */\n originalError?: Error;\n}\n\n// ts type is missing the cause property\nexport type ErrorWithIndexProperties = Error & {\n cause?: any;\n};\n\nexport interface ExceptionsAPI {\n changeStacktraceParser: (stacktraceParser: StacktraceParser) => void;\n getStacktraceParser: () => StacktraceParser | undefined;\n pushError: (value: ErrorWithIndexProperties, options?: PushErrorOptions) => void;\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  export { initializeAPI } from './initialize';
2
+ export { getNoopAPI } from './noop';
2
3
  export { defaultExceptionType, defaultErrorArgsSerializer } from './exceptions';
3
4
  export { defaultLogArgsSerializer } from './logs';
4
5
  export { UserActionImportance, UserActionState, userActionsMessageBus, } from './userActions';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAK7C,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAYhF,OAAO,EAAE,wBAAwB,EAAE,MAAM,QAAQ,CAAC;AAOlD,OAAO,EACL,oBAAoB,EAEpB,eAAe,EAIf,qBAAqB,GACtB,MAAM,eAAe,CAAC","sourcesContent":["export { initializeAPI } from './initialize';\nexport type { API, APIEvent, UserAction } from './types';\n\nexport type { EventAttributes, EventEvent, EventsAPI, PushEventOptions } from './events';\n\nexport { defaultExceptionType, defaultErrorArgsSerializer } from './exceptions';\nexport type {\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n PushErrorOptions,\n Stacktrace,\n StacktraceParser,\n ExceptionEventExtended,\n} from './exceptions';\n\nexport { defaultLogArgsSerializer } from './logs';\nexport type { LogContext, LogEvent, LogArgsSerializer, LogsAPI, PushLogOptions } from './logs';\n\nexport type { MeasurementEvent, MeasurementsAPI, PushMeasurementOptions } from './measurements';\n\nexport type { MetaAPI } from './meta';\n\nexport {\n UserActionImportance,\n type UserActionImportanceType,\n UserActionState,\n type UserActionInterface,\n type UserActionInternalInterface,\n type UserActionsAPI,\n userActionsMessageBus,\n} from './userActions';\n\nexport type { OTELApi, TraceContext, TraceEvent, TracesAPI } from './traces';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAKpC,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAYhF,OAAO,EAAE,wBAAwB,EAAE,MAAM,QAAQ,CAAC;AAOlD,OAAO,EACL,oBAAoB,EAEpB,eAAe,EAIf,qBAAqB,GACtB,MAAM,eAAe,CAAC","sourcesContent":["export { initializeAPI } from './initialize';\nexport { getNoopAPI } from './noop';\nexport type { API, APIEvent, UserAction } from './types';\n\nexport type { EventAttributes, EventEvent, EventsAPI, PushEventOptions } from './events';\n\nexport { defaultExceptionType, defaultErrorArgsSerializer } from './exceptions';\nexport type {\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n PushErrorOptions,\n Stacktrace,\n StacktraceParser,\n ExceptionEventExtended,\n} from './exceptions';\n\nexport { defaultLogArgsSerializer } from './logs';\nexport type { LogContext, LogEvent, LogArgsSerializer, LogsAPI, PushLogOptions } from './logs';\n\nexport type { MeasurementEvent, MeasurementsAPI, PushMeasurementOptions } from './measurements';\n\nexport type { MetaAPI } from './meta';\n\nexport {\n UserActionImportance,\n type UserActionImportanceType,\n UserActionState,\n type UserActionInterface,\n type UserActionInternalInterface,\n type UserActionsAPI,\n userActionsMessageBus,\n} from './userActions';\n\nexport type { OTELApi, TraceContext, TraceEvent, TracesAPI } from './traces';\n"]}
@@ -0,0 +1,27 @@
1
+ export function getNoopAPI() {
2
+ return {
3
+ pushLog: () => { },
4
+ pushError: () => { },
5
+ changeStacktraceParser: () => { },
6
+ getStacktraceParser: () => undefined,
7
+ pushMeasurement: () => { },
8
+ pushTraces: () => { },
9
+ getOTEL: () => undefined,
10
+ getTraceContext: () => undefined,
11
+ initOTEL: () => { },
12
+ isOTELInitialized: () => false,
13
+ setUser: () => { },
14
+ resetUser: () => { },
15
+ setSession: () => { },
16
+ resetSession: () => { },
17
+ getSession: () => undefined,
18
+ setView: () => { },
19
+ getView: () => undefined,
20
+ setPage: () => { },
21
+ getPage: () => undefined,
22
+ pushEvent: () => { },
23
+ startUserAction: () => undefined,
24
+ getActiveUserAction: () => undefined,
25
+ };
26
+ }
27
+ //# sourceMappingURL=noop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noop.js","sourceRoot":"","sources":["../../../src/api/noop.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,UAAU;IACxB,OAAO;QACL,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;QACjB,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;QACnB,sBAAsB,EAAE,GAAG,EAAE,GAAE,CAAC;QAChC,mBAAmB,EAAE,GAAG,EAAE,CAAC,SAAS;QACpC,eAAe,EAAE,GAAG,EAAE,GAAE,CAAC;QACzB,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;QACpB,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS;QACxB,eAAe,EAAE,GAAG,EAAE,CAAC,SAAS;QAChC,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;QAClB,iBAAiB,EAAE,GAAG,EAAE,CAAC,KAAK;QAC9B,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;QACjB,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;QACnB,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;QACpB,YAAY,EAAE,GAAG,EAAE,GAAE,CAAC;QACtB,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS;QAC3B,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;QACjB,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS;QACxB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;QACjB,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS;QACxB,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;QACnB,eAAe,EAAE,GAAG,EAAE,CAAC,SAAS;QAChC,mBAAmB,EAAE,GAAG,EAAE,CAAC,SAAS;KACrC,CAAC;AACJ,CAAC","sourcesContent":["import type { API } from './types';\n\nexport function getNoopAPI(): API {\n return {\n pushLog: () => {},\n pushError: () => {},\n changeStacktraceParser: () => {},\n getStacktraceParser: () => undefined,\n pushMeasurement: () => {},\n pushTraces: () => {},\n getOTEL: () => undefined,\n getTraceContext: () => undefined,\n initOTEL: () => {},\n isOTELInitialized: () => false,\n setUser: () => {},\n resetUser: () => {},\n setSession: () => {},\n resetSession: () => {},\n getSession: () => undefined,\n setView: () => {},\n getView: () => undefined,\n setPage: () => {},\n getPage: () => undefined,\n pushEvent: () => {},\n startUserAction: () => undefined,\n getActiveUserAction: () => undefined,\n };\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { TransportItemType } from '../../transports';
2
- import { dateNow, genShortID, Observable, stringifyObjectValues } from '../../utils';
2
+ import { dateNow, genShortID, monoNow, Observable, stringifyObjectValues } from '../../utils';
3
3
  import { ItemBuffer } from '../ItemBuffer';
4
4
  import {} from '../measurements/types';
5
5
  import {} from '../types';
@@ -31,7 +31,12 @@ export default class UserAction extends Observable {
31
31
  _start() {
32
32
  this._state = UserActionState.Started;
33
33
  if (this._state === UserActionState.Started) {
34
+ // `startTime` is wall-clock (Unix-epoch ms) so it can be used as the event's
35
+ // `timestampOverwriteMs` and emitted as `userActionStartTime` for consumers that
36
+ // correlate with other systems. `_startTimeMono` is the monotonic anchor used
37
+ // for the duration calculation in `end()`.
34
38
  this.startTime = dateNow();
39
+ this._startTimeMono = monoNow();
35
40
  }
36
41
  }
37
42
  halt() {
@@ -56,7 +61,11 @@ export default class UserAction extends Observable {
56
61
  return;
57
62
  }
58
63
  const endTime = dateNow();
59
- const duration = endTime - this.startTime;
64
+ // Compute duration from the monotonic clock so it is unaffected by wall-clock
65
+ // adjustments during the action. Note: `endTime - startTime` (both wall-clock) may
66
+ // disagree with `duration` if the system clock was adjusted between start and end;
67
+ // `duration` is authoritative.
68
+ const duration = monoNow() - this._startTimeMono;
60
69
  this._state = UserActionState.Ended;
61
70
  this._itemBuffer.flushBuffer((item) => {
62
71
  if (isExcludeFromUserAction(item, this.trackUserActionsExcludeItem)) {
@@ -1 +1 @@
1
- {"version":3,"file":"userAction.js","sourceRoot":"","sources":["../../../../src/api/userActions/userAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,iBAAiB,EAAmB,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAErF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAyB,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAiB,MAAM,UAAU,CAAC;AAEzC,O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AK,iBAAiB,CAAC,WAAW,IAAK,IAAI,CAAC,OAA4B,CAAC,IAAI,KAAK,YAAY,CAAC,CAC1G,CAAC;AACJ,CAAC","sourcesContent":["import { type TransportItem, TransportItemType, type Transports } from '../../transports';\nimport { dateNow, genShortID, Observable, stringifyObjectValues } from '../../utils';\nimport type { EventsAPI } from '../events/types';\nimport { ItemBuffer } from '../ItemBuffer';\nimport { type MeasurementEvent } from '../measurements/types';\nimport { type APIEvent } from '../types';\n\nimport { userActionEventName, UserActionImportance, type UserActionImportanceType } from './const';\nimport { type UserActionInternalInterface, UserActionState, type UserActionTransportItemBuffer } from './types';\n\nexport default class UserAction\n extends Observable\n implements UserActionInternalInterface, UserActionTransportItemBuffer\n{\n name: string;\n id: string;\n attributes?: Record<string, string>;\n parentId: string;\n trigger: string;\n importance: UserActionImportanceType;\n startTime?: number;\n trackUserActionsExcludeItem?: (item: TransportItem<APIEvent>) => boolean;\n\n private _state: UserActionState;\n private _itemBuffer: ItemBuffer<TransportItem>;\n private _transports: Transports;\n private _pushEvent: EventsAPI['pushEvent'];\n\n constructor({\n name,\n parentId,\n trigger,\n transports,\n attributes,\n trackUserActionsExcludeItem,\n importance = UserActionImportance.Normal,\n pushEvent,\n }: {\n name: string;\n transports: Transports;\n parentId?: string;\n trigger: string;\n attributes?: Record<string, string>;\n trackUserActionsExcludeItem?: (item: TransportItem<APIEvent>) => boolean;\n importance?: UserActionImportanceType;\n pushEvent: EventsAPI['pushEvent'];\n }) {\n super();\n this.name = name;\n this.attributes = attributes;\n this.id = genShortID();\n this.trigger = trigger;\n this.parentId = parentId ?? this.id;\n this.trackUserActionsExcludeItem = trackUserActionsExcludeItem;\n this.importance = importance;\n this._pushEvent = pushEvent;\n\n this._itemBuffer = new ItemBuffer<TransportItem>();\n this._transports = transports;\n this._state = UserActionState.Started;\n this._start();\n }\n\n addItem(item: TransportItem): boolean {\n if (this._state === UserActionState.Started) {\n this._itemBuffer.addItem(item);\n return true;\n }\n return false;\n }\n\n private _start(): void {\n this._state = UserActionState.Started;\n if (this._state === UserActionState.Started) {\n this.startTime = dateNow();\n }\n }\n\n halt() {\n if (this._state !== UserActionState.Started) {\n return;\n }\n this._state = UserActionState.Halted;\n this.notify(this._state);\n }\n\n cancel() {\n if (this._state === UserActionState.Started) {\n // Empty the buffer\n this._itemBuffer.flushBuffer((item) => {\n this._transports.execute(item);\n });\n }\n\n this._state = UserActionState.Cancelled;\n this.notify(this._state);\n }\n\n end() {\n if (this._state === UserActionState.Cancelled) {\n return;\n }\n\n const endTime = dateNow();\n const duration = endTime - this.startTime!;\n this._state = UserActionState.Ended;\n this._itemBuffer.flushBuffer((item) => {\n if (isExcludeFromUserAction(item, this.trackUserActionsExcludeItem)) {\n this._transports.execute(item);\n return;\n }\n\n const userActionItem = {\n ...item,\n payload: {\n ...item.payload,\n action: {\n parentId: this.id,\n name: this.name,\n },\n },\n } as TransportItem;\n\n this._transports.execute(userActionItem);\n });\n\n this._state = UserActionState.Ended;\n this.notify(this._state);\n\n this._pushEvent(\n userActionEventName,\n {\n userActionName: this.name,\n userActionStartTime: this.startTime!.toString(),\n userActionEndTime: endTime.toString(),\n userActionDuration: duration.toString(),\n userActionTrigger: this.trigger!,\n userActionImportance: this.importance,\n ...stringifyObjectValues(this.attributes),\n },\n undefined,\n {\n timestampOverwriteMs: this.startTime,\n customPayloadTransformer: (payload) => {\n payload.action = {\n id: this.id,\n name: this.name,\n };\n\n return payload;\n },\n }\n );\n }\n\n getState(): UserActionState {\n return this._state;\n }\n}\n\nfunction isExcludeFromUserAction(\n item: TransportItem<APIEvent>,\n trackUserActionsExcludeItem: ((item: TransportItem<APIEvent>) => boolean) | undefined\n) {\n return (\n trackUserActionsExcludeItem?.(item) ||\n (item.type === TransportItemType.MEASUREMENT && (item.payload as MeasurementEvent).type === 'web-vitals')\n );\n}\n"]}
1
+ {"version":3,"file":"userAction.js","sourceRoot":"","sources":["../../../../src/api/userActions/userAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAs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C,wBAAwB,EAAE,CAAC,OAAO,EAAE,EAAE;gBACpC,OAAO,CAAC,MAAM,GAAG;oBACf,EAAE,EAAE,IAAI,CAAC,EAAE;oBACX,IAAI,EAAE,IAAI,CAAC,IAAI;iBAChB,CAAC;gBAEF,OAAO,OAAO,CAAC;YACjB,CAAC;SACF,CACF,CAAC;IACJ,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AAED,SAAS,uBAAuB,CAC9B,IAA6B,EAC7B,2BAAqF;IAErF,OAAO,CACL,CAAA,2BAA2B,aAA3B,2BAA2B,uBAA3B,2BAA2B,CAAG,IAAI,CAAC;QACnC,CAAC,IAAI,CAAC,IAAI,KAAK,iBAAiB,CAAC,WAAW,IAAK,IAAI,CAAC,OAA4B,CAAC,IAAI,KAAK,YAAY,CAAC,CAC1G,CAAC;AACJ,CAAC","sourcesContent":["import { type TransportItem, TransportItemType, type Transports } from '../../transports';\nimport { dateNow, genShortID, monoNow, Observable, stringifyObjectValues } from '../../utils';\nimport type { EventsAPI } from '../events/types';\nimport { ItemBuffer } from '../ItemBuffer';\nimport { type MeasurementEvent } from '../measurements/types';\nimport { type APIEvent } from '../types';\n\nimport { userActionEventName, UserActionImportance, type UserActionImportanceType } from './const';\nimport { type UserActionInternalInterface, UserActionState, type UserActionTransportItemBuffer } from './types';\n\nexport default class UserAction\n extends Observable\n implements UserActionInternalInterface, UserActionTransportItemBuffer\n{\n name: string;\n id: string;\n attributes?: Record<string, string>;\n parentId: string;\n trigger: string;\n importance: UserActionImportanceType;\n startTime?: number;\n // Monotonic counterpart to `startTime`, used to compute `duration` immune to wall-clock\n // adjustments (NTP step, manual clock change, DST). Not exposed in telemetry — see `end()`.\n private _startTimeMono?: number;\n trackUserActionsExcludeItem?: (item: TransportItem<APIEvent>) => boolean;\n\n private _state: UserActionState;\n private _itemBuffer: ItemBuffer<TransportItem>;\n private _transports: Transports;\n private _pushEvent: EventsAPI['pushEvent'];\n\n constructor({\n name,\n parentId,\n trigger,\n transports,\n attributes,\n trackUserActionsExcludeItem,\n importance = UserActionImportance.Normal,\n pushEvent,\n }: {\n name: string;\n transports: Transports;\n parentId?: string;\n trigger: string;\n attributes?: Record<string, string>;\n trackUserActionsExcludeItem?: (item: TransportItem<APIEvent>) => boolean;\n importance?: UserActionImportanceType;\n pushEvent: EventsAPI['pushEvent'];\n }) {\n super();\n this.name = name;\n this.attributes = attributes;\n this.id = genShortID();\n this.trigger = trigger;\n this.parentId = parentId ?? this.id;\n this.trackUserActionsExcludeItem = trackUserActionsExcludeItem;\n this.importance = importance;\n this._pushEvent = pushEvent;\n\n this._itemBuffer = new ItemBuffer<TransportItem>();\n this._transports = transports;\n this._state = UserActionState.Started;\n this._start();\n }\n\n addItem(item: TransportItem): boolean {\n if (this._state === UserActionState.Started) {\n this._itemBuffer.addItem(item);\n return true;\n }\n return false;\n }\n\n private _start(): void {\n this._state = UserActionState.Started;\n if (this._state === UserActionState.Started) {\n // `startTime` is wall-clock (Unix-epoch ms) so it can be used as the event's\n // `timestampOverwriteMs` and emitted as `userActionStartTime` for consumers that\n // correlate with other systems. `_startTimeMono` is the monotonic anchor used\n // for the duration calculation in `end()`.\n this.startTime = dateNow();\n this._startTimeMono = monoNow();\n }\n }\n\n halt() {\n if (this._state !== UserActionState.Started) {\n return;\n }\n this._state = UserActionState.Halted;\n this.notify(this._state);\n }\n\n cancel() {\n if (this._state === UserActionState.Started) {\n // Empty the buffer\n this._itemBuffer.flushBuffer((item) => {\n this._transports.execute(item);\n });\n }\n\n this._state = UserActionState.Cancelled;\n this.notify(this._state);\n }\n\n end() {\n if (this._state === UserActionState.Cancelled) {\n return;\n }\n\n const endTime = dateNow();\n // Compute duration from the monotonic clock so it is unaffected by wall-clock\n // adjustments during the action. Note: `endTime - startTime` (both wall-clock) may\n // disagree with `duration` if the system clock was adjusted between start and end;\n // `duration` is authoritative.\n const duration = monoNow() - this._startTimeMono!;\n this._state = UserActionState.Ended;\n this._itemBuffer.flushBuffer((item) => {\n if (isExcludeFromUserAction(item, this.trackUserActionsExcludeItem)) {\n this._transports.execute(item);\n return;\n }\n\n const userActionItem = {\n ...item,\n payload: {\n ...item.payload,\n action: {\n parentId: this.id,\n name: this.name,\n },\n },\n } as TransportItem;\n\n this._transports.execute(userActionItem);\n });\n\n this._state = UserActionState.Ended;\n this.notify(this._state);\n\n this._pushEvent(\n userActionEventName,\n {\n userActionName: this.name,\n userActionStartTime: this.startTime!.toString(),\n userActionEndTime: endTime.toString(),\n userActionDuration: duration.toString(),\n userActionTrigger: this.trigger!,\n userActionImportance: this.importance,\n ...stringifyObjectValues(this.attributes),\n },\n undefined,\n {\n timestampOverwriteMs: this.startTime,\n customPayloadTransformer: (payload) => {\n payload.action = {\n id: this.id,\n name: this.name,\n };\n\n return payload;\n },\n }\n );\n }\n\n getState(): UserActionState {\n return this._state;\n }\n}\n\nfunction isExcludeFromUserAction(\n item: TransportItem<APIEvent>,\n trackUserActionsExcludeItem: ((item: TransportItem<APIEvent>) => boolean) | undefined\n) {\n return (\n trackUserActionsExcludeItem?.(item) ||\n (item.type === TransportItemType.MEASUREMENT && (item.payload as MeasurementEvent).type === 'web-vitals')\n );\n}\n"]}
package/dist/esm/index.js CHANGED
@@ -9,7 +9,7 @@ export { faro, getInternalFaroFromGlobalObject, internalGlobalObjectKey, isInter
9
9
  export * from './semantic';
10
10
  export { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';
11
11
  export { defaultUnpatchedConsole } from './unpatchedConsole';
12
- export { allLogLevels, clampSamplingRate, 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, } from './utils';
12
+ export { allLogLevels, clampSamplingRate, 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, monoNow, isEmpty, getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues, Observable, } from './utils';
13
13
  export { VERSION } from './version';
14
14
  export { unknownString } from './consts';
15
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,oBAAoB,EAEpB,eAAe,EACf,qBAAqB,GACtB,MAAM,OAAO,CAAC;AAkCf,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAoBzG,OAAO,EACL,IAAI,EACJ,+BAA+B,EAC/B,uBAAuB,EACvB,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,OAAO,CAAC;AAGf,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAW9G,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,OAAO,EACP,SAAS,EACT,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,EACZ,KAAK,EACL,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,OAAO,EACP,6BAA6B,EAC7B,qBAAqB,EACrB,qBAAqB,EACrB,UAAU,GACX,MAAM,SAAS,CAAC;AAajB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export {\n defaultExceptionType,\n defaultLogArgsSerializer,\n defaultErrorArgsSerializer,\n UserActionImportance,\n type UserActionImportanceType,\n UserActionState,\n userActionsMessageBus,\n} from './api';\nexport type {\n API,\n APIEvent,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionEventExtended,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n LogArgsSerializer,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n MetaAPI,\n OTELApi,\n PushErrorOptions,\n PushEventOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n UserAction,\n UserActionInterface,\n UserActionInternalInterface,\n} from './api';\n\nexport { BaseExtension } from './extensions';\nexport type { Extension } from './extensions';\n\nexport { globalObject } from './globalObject';\nexport type { GlobalObject } from './globalObject';\n\nexport { initializeFaro } from './initialize';\n\nexport { defaultBatchingConfig, defaultGlobalObjectKey } from './config';\nexport type { Config, Patterns } from './config';\n\nexport { BaseInstrumentation } from './instrumentations';\nexport type { Instrumentation, Instrumentations } from './instrumentations';\n\nexport { createInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './internalLogger';\nexport type { InternalLogger } from './internalLogger';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n MetaOverrides,\n} from './metas';\n\nexport {\n faro,\n getInternalFaroFromGlobalObject,\n internalGlobalObjectKey,\n isInternalFaroOnGlobalObject,\n setInternalFaroOnGlobalObject,\n} from './sdk';\nexport type { Faro } from './sdk';\n\nexport * from './semantic';\n\nexport { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';\nexport type {\n BeforeSendHook,\n SendFn,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n} from './transports';\n\nexport { defaultUnpatchedConsole } from './unpatchedConsole';\nexport type { UnpatchedConsole } from './unpatchedConsole';\n\nexport {\n allLogLevels,\n clampSamplingRate,\n createPromiseBuffer,\n deepEqual,\n defaultLogLevel,\n genShortID,\n getCurrentTimestamp,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n LogLevel,\n noop,\n dateNow,\n isEmpty,\n getCircularDependencyReplacer,\n stringifyExternalJson,\n stringifyObjectValues,\n Observable,\n} from './utils';\nexport type {\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BufferItem,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n Subscription,\n} from './utils';\n\nexport { VERSION } from './version';\n\nexport { unknownString } from './consts';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,oBAAoB,EAEpB,eAAe,EACf,qBAAqB,GACtB,MAAM,OAAO,CAAC;AAkCf,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAsBzG,OAAO,EACL,IAAI,EACJ,+BAA+B,EAC/B,uBAAuB,EACvB,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,OAAO,CAAC;AAGf,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAW9G,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,UAAU,EACV,mBAAmB,EACnB,OAAO,EACP,SAAS,EACT,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,EACZ,KAAK,EACL,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,OAAO,EACP,OAAO,EACP,6BAA6B,EAC7B,qBAAqB,EACrB,qBAAqB,EACrB,UAAU,GACX,MAAM,SAAS,CAAC;AAajB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export {\n defaultExceptionType,\n defaultLogArgsSerializer,\n defaultErrorArgsSerializer,\n UserActionImportance,\n type UserActionImportanceType,\n UserActionState,\n userActionsMessageBus,\n} from './api';\nexport type {\n API,\n APIEvent,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\n ExceptionEventExtended,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n LogArgsSerializer,\n LogContext,\n LogEvent,\n LogsAPI,\n MeasurementEvent,\n MeasurementsAPI,\n MetaAPI,\n OTELApi,\n PushErrorOptions,\n PushEventOptions,\n PushLogOptions,\n PushMeasurementOptions,\n Stacktrace,\n StacktraceParser,\n TraceContext,\n TraceEvent,\n TracesAPI,\n UserAction,\n UserActionInterface,\n UserActionInternalInterface,\n} from './api';\n\nexport { BaseExtension } from './extensions';\nexport type { Extension } from './extensions';\n\nexport { globalObject } from './globalObject';\nexport type { GlobalObject } from './globalObject';\n\nexport { initializeFaro } from './initialize';\n\nexport { defaultBatchingConfig, defaultGlobalObjectKey } from './config';\nexport type { Config, Patterns } from './config';\n\nexport { BaseInstrumentation } from './instrumentations';\nexport type { Instrumentation, Instrumentations } from './instrumentations';\n\nexport { createInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './internalLogger';\nexport type { InternalLogger } from './internalLogger';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaDevice,\n MetaGetter,\n MetaItem,\n MetaOS,\n MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n MetaOverrides,\n} from './metas';\n\nexport {\n faro,\n getInternalFaroFromGlobalObject,\n internalGlobalObjectKey,\n isInternalFaroOnGlobalObject,\n setInternalFaroOnGlobalObject,\n} from './sdk';\nexport type { Faro } from './sdk';\n\nexport * from './semantic';\n\nexport { BaseTransport, getTransportBody, TransportItemType, transportItemTypeToBodyKey } from './transports';\nexport type {\n BeforeSendHook,\n SendFn,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n} from './transports';\n\nexport { defaultUnpatchedConsole } from './unpatchedConsole';\nexport type { UnpatchedConsole } from './unpatchedConsole';\n\nexport {\n allLogLevels,\n clampSamplingRate,\n createPromiseBuffer,\n deepEqual,\n defaultLogLevel,\n genShortID,\n getCurrentTimestamp,\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n LogLevel,\n noop,\n dateNow,\n monoNow,\n isEmpty,\n getCircularDependencyReplacer,\n stringifyExternalJson,\n stringifyObjectValues,\n Observable,\n} from './utils';\nexport type {\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BufferItem,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\n Subscription,\n} from './utils';\n\nexport { VERSION } from './version';\n\nexport { unknownString } from './consts';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/metas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { initializeMetas } from './initialize';\n\nexport { registerInitialMetas } from './registerInitial';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaGetter,\n MetaItem,\n MetaK6,\n MetaPage,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n Metas,\n MetaOverrides,\n} from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/metas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { initializeMetas } from './initialize';\n\nexport { registerInitialMetas } from './registerInitial';\n\nexport type {\n Meta,\n MetaApp,\n MetaAttributes,\n MetaBrowser,\n MetaDevice,\n MetaGetter,\n MetaItem,\n MetaK6,\n MetaOS,\n MetaPage,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n Metas,\n MetaOverrides,\n} from './types';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/metas/types.ts"],"names":[],"mappings":"","sourcesContent":["export type MetaGetter<P = Partial<Meta>> = () => P;\n\nexport type MetaItem<P = Partial<Meta>> = P | MetaGetter<P>;\n\nexport type MetasListener = (value: Meta) => void;\n\nexport interface Metas {\n add: (...getters: MetaItem[]) => void;\n remove: (...getters: MetaItem[]) => void;\n addListener: (listener: MetasListener) => void;\n removeListener: (listener: MetasListener) => void;\n value: Meta;\n}\n\nexport type MetaAttributes = Record<string, string>;\n\nexport interface MetaSDKIntegration {\n name?: string;\n version?: string;\n}\n\nexport interface MetaSDK {\n name?: string;\n version?: string;\n integrations?: MetaSDKIntegration[];\n}\n\nexport interface MetaApp {\n name?: string;\n namespace?: string;\n release?: string;\n version?: string;\n environment?: string;\n bundleId?: string;\n}\n\nexport interface MetaUser {\n /**\n * User email address.\n */\n email?: string;\n /**\n * Unique identifier\n */\n id?: string;\n /**\n * Short name or login/username of the user.\n */\n username?: string;\n /**\n * User’s full name\n */\n fullName?: string;\n /**\n * comma separated list of user roles. \"admin\",editor\" etc.\n */\n roles?: string;\n /**\n * Unique user hash to correlate information for a user in anonymized form.\n */\n hash?: string;\n /**\n * arbitrary user attributes, must be of type string.\n */\n attributes?: MetaAttributes;\n}\n\nexport interface MetaSession {\n id?: string;\n attributes?: MetaAttributes;\n overrides?: MetaOverrides;\n}\n\nexport interface MetaPage {\n id?: string;\n url?: string;\n attributes?: MetaAttributes;\n}\n\ninterface NavigatorUABrandVersion {\n brand?: string;\n version?: string;\n}\n\nexport interface MetaBrowser {\n name?: string;\n version?: string;\n os?: string;\n mobile?: boolean;\n userAgent?: string;\n language?: string;\n brands?: NavigatorUABrandVersion[] | string;\n viewportWidth?: string;\n viewportHeight?: string;\n}\n\nexport interface MetaView {\n name: string;\n}\n\nexport interface MetaK6 {\n isK6Browser?: boolean;\n testRunId?: string;\n}\n\nexport interface Meta {\n sdk?: MetaSDK;\n app?: MetaApp;\n user?: MetaUser;\n session?: MetaSession;\n page?: MetaPage;\n browser?: MetaBrowser;\n view?: MetaView;\n k6?: MetaK6;\n}\n\n/**\n * MetaOverrides are instructions that allow the receiver to override certain properties (Grafana Cloud only).\n */\nexport type MetaOverrides = {\n /**\n * New service name (Grafana Cloud only)\n */\n serviceName?: string;\n\n /**\n * Enable or disable geolocation tracking (Grafana Cloud only).\n * Geolocation tracking must be enabled in the Grafana Cloud settings first.\n * It cannot be enabled solely on the client side.\n * This option allows control over tracking on the client side to comply with user\n * privacy requirements.\n */\n geoLocationTrackingEnabled?: boolean;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/metas/types.ts"],"names":[],"mappings":"","sourcesContent":["export type MetaGetter<P = Partial<Meta>> = () => P;\n\nexport type MetaItem<P = Partial<Meta>> = P | MetaGetter<P>;\n\nexport type MetasListener = (value: Meta) => void;\n\nexport interface Metas {\n add: (...getters: MetaItem[]) => void;\n remove: (...getters: MetaItem[]) => void;\n addListener: (listener: MetasListener) => void;\n removeListener: (listener: MetasListener) => void;\n value: Meta;\n}\n\nexport type MetaAttributes = Record<string, string>;\n\nexport interface MetaSDKIntegration {\n name?: string;\n version?: string;\n}\n\nexport interface MetaSDK {\n name?: string;\n version?: string;\n integrations?: MetaSDKIntegration[];\n}\n\nexport interface MetaApp {\n bundleId?: string;\n environment?: string;\n installationId?: string;\n name?: string;\n namespace?: string;\n release?: string;\n version?: string;\n}\n\nexport interface MetaUser {\n /**\n * User email address.\n */\n email?: string;\n /**\n * Unique identifier\n */\n id?: string;\n /**\n * Short name or login/username of the user.\n */\n username?: string;\n /**\n * User’s full name\n */\n fullName?: string;\n /**\n * comma separated list of user roles. \"admin\",editor\" etc.\n */\n roles?: string;\n /**\n * Unique user hash to correlate information for a user in anonymized form.\n */\n hash?: string;\n /**\n * arbitrary user attributes, must be of type string.\n */\n attributes?: MetaAttributes;\n}\n\nexport interface MetaSession {\n id?: string;\n attributes?: MetaAttributes;\n overrides?: MetaOverrides;\n}\n\nexport interface MetaPage {\n id?: string;\n url?: string;\n attributes?: MetaAttributes;\n}\n\ninterface NavigatorUABrandVersion {\n brand?: string;\n version?: string;\n}\n\nexport interface MetaBrowser {\n name?: string;\n version?: string;\n os?: string;\n mobile?: boolean;\n userAgent?: string;\n language?: string;\n brands?: NavigatorUABrandVersion[] | string;\n viewportWidth?: string;\n viewportHeight?: string;\n}\n\nexport interface MetaView {\n name: string;\n}\n\nexport interface MetaK6 {\n isK6Browser?: boolean;\n testRunId?: string;\n}\n\n// Fields on MetaOS and MetaDevice use snake_case to mirror the Faro spec wire\n// format, which in turn mirrors OTel `os.*` and `device.*` semantic convention\n// attribute keys (e.g. os.build_id, device.model.identifier). Intentionally\n// inconsistent with the camelCase used elsewhere in Meta.\nexport interface MetaOS {\n name?: string;\n version?: string;\n build_id?: string;\n detail?: string;\n}\n\nexport interface MetaDevice {\n manufacturer?: string;\n model_identifier?: string;\n model_name?: string;\n brand?: string;\n is_physical?: boolean;\n type?: string;\n}\n\nexport interface Meta {\n sdk?: MetaSDK;\n app?: MetaApp;\n user?: MetaUser;\n session?: MetaSession;\n page?: MetaPage;\n browser?: MetaBrowser;\n view?: MetaView;\n k6?: MetaK6;\n os?: MetaOS;\n device?: MetaDevice;\n}\n\n/**\n * MetaOverrides are instructions that allow the receiver to override certain properties (Grafana Cloud only).\n */\nexport type MetaOverrides = {\n /**\n * New service name (Grafana Cloud only)\n */\n serviceName?: string;\n\n /**\n * Enable or disable geolocation tracking (Grafana Cloud only).\n * Geolocation tracking must be enabled in the Grafana Cloud settings first.\n * It cannot be enabled solely on the client side.\n * This option allows control over tracking on the client side to comply with user\n * privacy requirements.\n */\n geoLocationTrackingEnabled?: boolean;\n};\n"]}
@@ -1,6 +1,7 @@
1
+ import { getNoopAPI } from '../api/noop';
1
2
  import { setFaroOnGlobalObject } from './faroGlobalObject';
2
3
  import { setInternalFaroOnGlobalObject } from './internalFaroGlobalObject';
3
- export let faro = {};
4
+ export let faro = { api: getNoopAPI() };
4
5
  export function registerFaro(unpatchedConsole, internalLogger, config, metas, transports, api, instrumentations) {
5
6
  internalLogger.debug('Initializing Faro');
6
7
  faro = {
@@ -1 +1 @@
1
- {"version":3,"file":"registerFaro.js","sourceRoot":"","sources":["../../../src/sdk/registerFaro.ts"],"names":[],"mappings":"AAQA,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,CAC1B,gBAAkC,EAClC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB,EACtB,GAAQ,EACR,gBAAkC;IAElC,cAAc,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAE1C,IAAI,GAAG;QACL,GAAG;QACH,MAAM;QACN,gBAAgB;QAChB,cAAc;QACd,KAAK;QACL,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,UAAU;QACV,gBAAgB;QAChB,OAAO,EAAE,UAAU,CAAC,OAAO;KAC5B,CAAC;IAEF,6BAA6B,CAAC,IAAI,CAAC,CAAC;IAEpC,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAE5B,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { API } from '../api';\nimport type { Config } from '../config';\nimport type { Instrumentations } from '../instrumentations';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { Transports } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nimport { setFaroOnGlobalObject } from './faroGlobalObject';\nimport { setInternalFaroOnGlobalObject } from './internalFaroGlobalObject';\nimport type { Faro } from './types';\n\nexport let faro: Faro = {} as Faro;\n\nexport function registerFaro(\n unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n api: API,\n instrumentations: Instrumentations\n): Faro {\n internalLogger.debug('Initializing Faro');\n\n faro = {\n api,\n config,\n instrumentations,\n internalLogger,\n metas,\n pause: transports.pause,\n transports,\n unpatchedConsole,\n unpause: transports.unpause,\n };\n\n setInternalFaroOnGlobalObject(faro);\n\n setFaroOnGlobalObject(faro);\n\n return faro;\n}\n"]}
1
+ {"version":3,"file":"registerFaro.js","sourceRoot":"","sources":["../../../src/sdk/registerFaro.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAQzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAG3E,MAAM,CAAC,IAAI,IAAI,GAAS,EAAE,GAAG,EAAE,UAAU,EAAE,EAAU,CAAC;AAEtD,MAAM,UAAU,YAAY,CAC1B,gBAAkC,EAClC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB,EACtB,GAAQ,EACR,gBAAkC;IAElC,cAAc,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAE1C,IAAI,GAAG;QACL,GAAG;QACH,MAAM;QACN,gBAAgB;QAChB,cAAc;QACd,KAAK;QACL,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,UAAU;QACV,gBAAgB;QAChB,OAAO,EAAE,UAAU,CAAC,OAAO;KAC5B,CAAC;IAEF,6BAA6B,CAAC,IAAI,CAAC,CAAC;IAEpC,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAE5B,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { API } from '../api';\nimport { getNoopAPI } from '../api/noop';\nimport type { Config } from '../config';\nimport type { Instrumentations } from '../instrumentations';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { Transports } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nimport { setFaroOnGlobalObject } from './faroGlobalObject';\nimport { setInternalFaroOnGlobalObject } from './internalFaroGlobalObject';\nimport type { Faro } from './types';\n\nexport let faro: Faro = { api: getNoopAPI() } as Faro;\n\nexport function registerFaro(\n unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n api: API,\n instrumentations: Instrumentations\n): Faro {\n internalLogger.debug('Initializing Faro');\n\n faro = {\n api,\n config,\n instrumentations,\n internalLogger,\n metas,\n pause: transports.pause,\n transports,\n unpatchedConsole,\n unpause: transports.unpause,\n };\n\n setInternalFaroOnGlobalObject(faro);\n\n setFaroOnGlobalObject(faro);\n\n return faro;\n}\n"]}
@@ -1,6 +1,29 @@
1
1
  export function dateNow() {
2
2
  return Date.now();
3
3
  }
4
+ /**
5
+ * Returns a high-resolution, monotonic timestamp in milliseconds.
6
+ *
7
+ * Use this for measuring elapsed time / durations. Unlike {@link dateNow} (which is
8
+ * derived from the system wall clock and is therefore subject to NTP adjustments,
9
+ * manual clock changes, daylight-savings transitions, etc.), `monoNow` is backed by
10
+ * `performance.now()`, which is guaranteed never to decrease and is unaffected by
11
+ * such adjustments.
12
+ *
13
+ * Do NOT use this for absolute event timestamps that need to be correlated with
14
+ * other systems or persisted across page loads — use {@link dateNow} or
15
+ * {@link getCurrentTimestamp} for that.
16
+ *
17
+ * Falls back to {@link dateNow} in environments where `performance.now` is
18
+ * unavailable (very old runtimes, unusual SSR setups). The fallback re-introduces
19
+ * wall-clock susceptibility but preserves the API contract.
20
+ */
21
+ export function monoNow() {
22
+ if (typeof performance !== 'undefined' && typeof performance.now === 'function') {
23
+ return performance.now();
24
+ }
25
+ return Date.now();
26
+ }
4
27
  export function getCurrentTimestamp() {
5
28
  return new Date().toISOString();
6
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"date.js","sourceRoot":"","sources":["../../../src/utils/date.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,OAAO;IACrB,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AACvC,CAAC","sourcesContent":["export function dateNow(): number {\n return Date.now();\n}\n\nexport function getCurrentTimestamp(): string {\n return new Date().toISOString();\n}\n\nexport function timestampToIsoString(value: number): string {\n return new Date(value).toISOString();\n}\n"]}
1
+ {"version":3,"file":"date.js","sourceRoot":"","sources":["../../../src/utils/date.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,OAAO;IACrB,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;AACpB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,OAAO;IACrB,IAAI,OAAO,WAAW,KAAK,WAAW,IAAI,OAAO,WAAW,CAAC,GAAG,KAAK,UAAU,EAAE,CAAC;QAChF,OAAO,WAAW,CAAC,GAAG,EAAE,CAAC;IAC3B,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AACvC,CAAC","sourcesContent":["export function dateNow(): number {\n return Date.now();\n}\n\n/**\n * Returns a high-resolution, monotonic timestamp in milliseconds.\n *\n * Use this for measuring elapsed time / durations. Unlike {@link dateNow} (which is\n * derived from the system wall clock and is therefore subject to NTP adjustments,\n * manual clock changes, daylight-savings transitions, etc.), `monoNow` is backed by\n * `performance.now()`, which is guaranteed never to decrease and is unaffected by\n * such adjustments.\n *\n * Do NOT use this for absolute event timestamps that need to be correlated with\n * other systems or persisted across page loads — use {@link dateNow} or\n * {@link getCurrentTimestamp} for that.\n *\n * Falls back to {@link dateNow} in environments where `performance.now` is\n * unavailable (very old runtimes, unusual SSR setups). The fallback re-introduces\n * wall-clock susceptibility but preserves the API contract.\n */\nexport function monoNow(): number {\n if (typeof performance !== 'undefined' && typeof performance.now === 'function') {\n return performance.now();\n }\n return Date.now();\n}\n\nexport function getCurrentTimestamp(): string {\n return new Date().toISOString();\n}\n\nexport function timestampToIsoString(value: number): string {\n return new Date(value).toISOString();\n}\n"]}
@@ -7,7 +7,7 @@ export { noop } from './noop';
7
7
  export { createPromiseBuffer } from './promiseBuffer';
8
8
  export { genShortID } from './shortId';
9
9
  export { getBundleId } from './sourceMaps';
10
- export { dateNow } from './date';
10
+ export { dateNow, monoNow } from './date';
11
11
  export { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';
12
12
  export { Observable } from './reactive';
13
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,EACL,OAAO,EACP,SAAS,EACT,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,EACZ,KAAK,EACL,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,OAAO,GACR,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAErG,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';\n\nexport { clampSamplingRate } from './sampling';\n\nexport { deepEqual } from './deepEqual';\n\nexport { getCurrentTimestamp } from './date';\n\nexport {\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n isEmpty,\n} from './is';\nexport type { IsFnHelper } from './is';\n\nexport { allLogLevels, defaultLogLevel, LogLevel } from './logLevels';\n\nexport { noop } from './noop';\n\nexport { createPromiseBuffer } from './promiseBuffer';\nexport type { BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer } from './promiseBuffer';\n\nexport { genShortID } from './shortId';\n\nexport { getBundleId } from './sourceMaps';\n\nexport { dateNow } from './date';\n\nexport { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';\n\nexport { Observable } from './reactive';\nexport type { Subscription } from './reactive';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,EACL,OAAO,EACP,SAAS,EACT,UAAU,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,YAAY,EACZ,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,EACZ,KAAK,EACL,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,OAAO,GACR,MAAM,MAAM,CAAC;AAGd,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE1C,OAAO,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAErG,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';\n\nexport { clampSamplingRate } from './sampling';\n\nexport { deepEqual } from './deepEqual';\n\nexport { getCurrentTimestamp } from './date';\n\nexport {\n isArray,\n isBoolean,\n isDomError,\n isDomException,\n isElement,\n isElementDefined,\n isError,\n isErrorDefined,\n isErrorEvent,\n isEvent,\n isEventDefined,\n isFunction,\n isInstanceOf,\n isInt,\n isMap,\n isMapDefined,\n isNull,\n isNumber,\n isObject,\n isPrimitive,\n isRegExp,\n isString,\n isSymbol,\n isSyntheticEvent,\n isThenable,\n isToString,\n isTypeof,\n isUndefined,\n isEmpty,\n} from './is';\nexport type { IsFnHelper } from './is';\n\nexport { allLogLevels, defaultLogLevel, LogLevel } from './logLevels';\n\nexport { noop } from './noop';\n\nexport { createPromiseBuffer } from './promiseBuffer';\nexport type { BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer } from './promiseBuffer';\n\nexport { genShortID } from './shortId';\n\nexport { getBundleId } from './sourceMaps';\n\nexport { dateNow, monoNow } from './date';\n\nexport { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';\n\nexport { Observable } from './reactive';\nexport type { Subscription } from './reactive';\n"]}
@@ -1,3 +1,3 @@
1
1
  // auto-generated by bin/genVersion.ts
2
- export const VERSION = '2.4.0';
2
+ export const VERSION = '2.5.0';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '2.4.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '2.5.0';\n"]}
@@ -21,6 +21,7 @@ export interface ExceptionEventDefault {
21
21
  timestamp: string;
22
22
  type: string;
23
23
  value: string;
24
+ fatal?: boolean;
24
25
  fingerprint?: string;
25
26
  stacktrace?: Stacktrace;
26
27
  trace?: TraceContext;
@@ -37,6 +38,7 @@ export type ExceptionEventExtended = ExceptionEventDefault & {
37
38
  };
38
39
  export type ExceptionEvent<EXTENDED = ExceptionEventDefault> = EXTENDED extends boolean ? ExceptionEventExtended : ExceptionEventDefault;
39
40
  export interface PushErrorOptions {
41
+ fatal?: boolean;
40
42
  fingerprint?: string;
41
43
  skipDedupe?: boolean;
42
44
  stackFrames?: ExceptionStackFrame[];
@@ -1,4 +1,5 @@
1
1
  export { initializeAPI } from './initialize';
2
+ export { getNoopAPI } from './noop';
2
3
  export type { API, APIEvent, UserAction } from './types';
3
4
  export type { EventAttributes, EventEvent, EventsAPI, PushEventOptions } from './events';
4
5
  export { defaultExceptionType, defaultErrorArgsSerializer } from './exceptions';
@@ -0,0 +1,2 @@
1
+ import type { API } from './types';
2
+ export declare function getNoopAPI(): API;
@@ -12,6 +12,7 @@ export default class UserAction extends Observable implements UserActionInternal
12
12
  trigger: string;
13
13
  importance: UserActionImportanceType;
14
14
  startTime?: number;
15
+ private _startTimeMono?;
15
16
  trackUserActionsExcludeItem?: (item: TransportItem<APIEvent>) => boolean;
16
17
  private _state;
17
18
  private _itemBuffer;