@grafana/faro-core 1.12.3 → 1.13.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 (125) hide show
  1. package/dist/bundle/faro-core.iife.js +1 -1
  2. package/dist/bundle/types/api/exceptions/const.d.ts +1 -0
  3. package/dist/bundle/types/api/exceptions/index.d.ts +1 -1
  4. package/dist/bundle/types/api/index.d.ts +1 -1
  5. package/dist/bundle/types/api/meta/types.d.ts +13 -3
  6. package/dist/bundle/types/config/types.d.ts +21 -1
  7. package/dist/bundle/types/index.d.ts +3 -3
  8. package/dist/bundle/types/metas/index.d.ts +1 -1
  9. package/dist/bundle/types/metas/types.d.ts +7 -0
  10. package/dist/bundle/types/semantic.d.ts +1 -0
  11. package/dist/bundle/types/testUtils/mockTransport.d.ts +1 -1
  12. package/dist/bundle/types/utils/index.d.ts +2 -1
  13. package/dist/bundle/types/utils/is.d.ts +1 -0
  14. package/dist/bundle/types/utils/json.d.ts +2 -0
  15. package/dist/bundle/types/version.d.ts +1 -1
  16. package/dist/cjs/api/exceptions/const.js +13 -1
  17. package/dist/cjs/api/exceptions/const.js.map +1 -1
  18. package/dist/cjs/api/exceptions/index.js +2 -1
  19. package/dist/cjs/api/exceptions/index.js.map +1 -1
  20. package/dist/cjs/api/index.js +2 -1
  21. package/dist/cjs/api/index.js.map +1 -1
  22. package/dist/cjs/api/meta/initialize.js +34 -3
  23. package/dist/cjs/api/meta/initialize.js.map +1 -1
  24. package/dist/cjs/api/meta/types.js.map +1 -1
  25. package/dist/cjs/config/types.js.map +1 -1
  26. package/dist/cjs/index.js +6 -2
  27. package/dist/cjs/index.js.map +1 -1
  28. package/dist/cjs/metas/index.js.map +1 -1
  29. package/dist/cjs/metas/types.js.map +1 -1
  30. package/dist/cjs/semantic.js +2 -1
  31. package/dist/cjs/semantic.js.map +1 -1
  32. package/dist/cjs/utils/index.js +5 -1
  33. package/dist/cjs/utils/index.js.map +1 -1
  34. package/dist/cjs/utils/is.js +14 -1
  35. package/dist/cjs/utils/is.js.map +1 -1
  36. package/dist/cjs/utils/json.js +22 -0
  37. package/dist/cjs/utils/json.js.map +1 -0
  38. package/dist/cjs/version.js +1 -1
  39. package/dist/cjs/version.js.map +1 -1
  40. package/dist/esm/api/exceptions/const.js +11 -0
  41. package/dist/esm/api/exceptions/const.js.map +1 -1
  42. package/dist/esm/api/exceptions/index.js +1 -1
  43. package/dist/esm/api/exceptions/index.js.map +1 -1
  44. package/dist/esm/api/index.js +1 -1
  45. package/dist/esm/api/index.js.map +1 -1
  46. package/dist/esm/api/meta/initialize.js +23 -3
  47. package/dist/esm/api/meta/initialize.js.map +1 -1
  48. package/dist/esm/api/meta/types.js.map +1 -1
  49. package/dist/esm/config/types.js.map +1 -1
  50. package/dist/esm/index.js +2 -2
  51. package/dist/esm/index.js.map +1 -1
  52. package/dist/esm/metas/index.js.map +1 -1
  53. package/dist/esm/metas/types.js.map +1 -1
  54. package/dist/esm/semantic.js +1 -0
  55. package/dist/esm/semantic.js.map +1 -1
  56. package/dist/esm/utils/index.js +2 -1
  57. package/dist/esm/utils/index.js.map +1 -1
  58. package/dist/esm/utils/is.js +12 -0
  59. package/dist/esm/utils/is.js.map +1 -1
  60. package/dist/esm/utils/json.js +16 -0
  61. package/dist/esm/utils/json.js.map +1 -0
  62. package/dist/esm/version.js +1 -1
  63. package/dist/esm/version.js.map +1 -1
  64. package/dist/spec/core/src/api/exceptions/const.js +13 -1
  65. package/dist/spec/core/src/api/exceptions/const.js.map +1 -1
  66. package/dist/spec/core/src/api/exceptions/index.js +2 -1
  67. package/dist/spec/core/src/api/exceptions/index.js.map +1 -1
  68. package/dist/spec/core/src/api/index.js +2 -1
  69. package/dist/spec/core/src/api/index.js.map +1 -1
  70. package/dist/spec/core/src/api/meta/initialize.js +34 -3
  71. package/dist/spec/core/src/api/meta/initialize.js.map +1 -1
  72. package/dist/spec/core/src/api/meta/initilialize.test.js +90 -0
  73. package/dist/spec/core/src/api/meta/initilialize.test.js.map +1 -0
  74. package/dist/spec/core/src/api/meta/types.js.map +1 -1
  75. package/dist/spec/core/src/config/types.js.map +1 -1
  76. package/dist/spec/core/src/index.js +6 -2
  77. package/dist/spec/core/src/index.js.map +1 -1
  78. package/dist/spec/core/src/metas/index.js.map +1 -1
  79. package/dist/spec/core/src/metas/types.js.map +1 -1
  80. package/dist/spec/core/src/semantic.js +2 -1
  81. package/dist/spec/core/src/semantic.js.map +1 -1
  82. package/dist/spec/core/src/utils/index.js +5 -1
  83. package/dist/spec/core/src/utils/index.js.map +1 -1
  84. package/dist/spec/core/src/utils/is.js +14 -1
  85. package/dist/spec/core/src/utils/is.js.map +1 -1
  86. package/dist/spec/core/src/utils/is.test.js +21 -0
  87. package/dist/spec/core/src/utils/is.test.js.map +1 -0
  88. package/dist/spec/core/src/utils/json.js +22 -0
  89. package/dist/spec/core/src/utils/json.js.map +1 -0
  90. package/dist/spec/core/src/utils/json.test.js +17 -0
  91. package/dist/spec/core/src/utils/json.test.js.map +1 -0
  92. package/dist/spec/core/src/version.js +1 -1
  93. package/dist/spec/core/src/version.js.map +1 -1
  94. package/dist/types/api/exceptions/const.d.ts +1 -0
  95. package/dist/types/api/exceptions/index.d.ts +1 -1
  96. package/dist/types/api/index.d.ts +1 -1
  97. package/dist/types/api/meta/types.d.ts +13 -3
  98. package/dist/types/config/types.d.ts +21 -1
  99. package/dist/types/core/src/api/exceptions/const.d.ts +1 -0
  100. package/dist/types/core/src/api/exceptions/index.d.ts +1 -1
  101. package/dist/types/core/src/api/index.d.ts +1 -1
  102. package/dist/types/core/src/api/meta/initilialize.test.d.ts +1 -0
  103. package/dist/types/core/src/api/meta/types.d.ts +13 -3
  104. package/dist/types/core/src/config/types.d.ts +21 -1
  105. package/dist/types/core/src/index.d.ts +3 -3
  106. package/dist/types/core/src/metas/index.d.ts +1 -1
  107. package/dist/types/core/src/metas/types.d.ts +7 -0
  108. package/dist/types/core/src/semantic.d.ts +1 -0
  109. package/dist/types/core/src/testUtils/mockTransport.d.ts +1 -1
  110. package/dist/types/core/src/utils/index.d.ts +2 -1
  111. package/dist/types/core/src/utils/is.d.ts +1 -0
  112. package/dist/types/core/src/utils/is.test.d.ts +1 -0
  113. package/dist/types/core/src/utils/json.d.ts +2 -0
  114. package/dist/types/core/src/utils/json.test.d.ts +1 -0
  115. package/dist/types/core/src/version.d.ts +1 -1
  116. package/dist/types/index.d.ts +3 -3
  117. package/dist/types/metas/index.d.ts +1 -1
  118. package/dist/types/metas/types.d.ts +7 -0
  119. package/dist/types/semantic.d.ts +1 -0
  120. package/dist/types/testUtils/mockTransport.d.ts +1 -1
  121. package/dist/types/utils/index.d.ts +2 -1
  122. package/dist/types/utils/is.d.ts +1 -0
  123. package/dist/types/utils/json.d.ts +2 -0
  124. package/dist/types/version.d.ts +1 -1
  125. package/package.json +5 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/index.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AAKtB,2CAAoD;AAA3C,kHAAA,oBAAoB,OAAA;AAW7B,+BAAkD;AAAzC,gHAAA,wBAAwB,OAAA","sourcesContent":["export { initializeAPI } from './initialize';\nexport type { API, APIEvent } from './types';\n\nexport type { EventAttributes, EventEvent, EventsAPI, PushEventOptions } from './events';\n\nexport { defaultExceptionType } from './exceptions';\nexport type {\n ExceptionEvent,\n ExceptionStackFrame,\n ExceptionsAPI,\n ExtendedError,\n PushErrorOptions,\n Stacktrace,\n StacktraceParser,\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 type { OTELApi, TraceContext, TraceEvent, TracesAPI } from './traces';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/index.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AAKtB,2CAAgF;AAAvE,kHAAA,oBAAoB,OAAA;AAAE,wHAAA,0BAA0B,OAAA;AAWzD,+BAAkD;AAAzC,gHAAA,wBAAwB,OAAA","sourcesContent":["export { initializeAPI } from './initialize';\nexport type { API, APIEvent } 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} 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 type { OTELApi, TraceContext, TraceEvent, TracesAPI } from './traces';\n"]}
@@ -1,11 +1,24 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.initializeMetaAPI = void 0;
15
+ var is_1 = require("../../utils/is");
4
16
  function initializeMetaAPI(_unpatchedConsole, internalLogger, _config, metas, _transports) {
5
17
  internalLogger.debug('Initializing meta API');
6
18
  var metaSession = undefined;
7
19
  var metaUser = undefined;
8
20
  var metaView = undefined;
21
+ var metaPage = undefined;
9
22
  var setUser = function (user) {
10
23
  if (metaUser) {
11
24
  metas.remove(metaUser);
@@ -15,18 +28,22 @@ function initializeMetaAPI(_unpatchedConsole, internalLogger, _config, metas, _t
15
28
  };
16
29
  metas.add(metaUser);
17
30
  };
18
- var setSession = function (session) {
31
+ var setSession = function (session, options) {
32
+ var overrides = options === null || options === void 0 ? void 0 : options.overrides;
19
33
  if (metaSession) {
20
34
  metas.remove(metaSession);
21
35
  }
22
36
  metaSession = {
23
- session: session,
37
+ session: __assign(__assign({}, ((0, is_1.isEmpty)(session) ? undefined : session)), (overrides ? { overrides: overrides } : {})),
24
38
  };
25
39
  metas.add(metaSession);
26
40
  };
27
41
  var getSession = function () { return metas.value.session; };
28
- var setView = function (view) {
42
+ var setView = function (view, options) {
29
43
  var _a;
44
+ if (options === null || options === void 0 ? void 0 : options.overrides) {
45
+ setSession(getSession(), { overrides: options.overrides });
46
+ }
30
47
  if (((_a = metaView === null || metaView === void 0 ? void 0 : metaView.view) === null || _a === void 0 ? void 0 : _a.name) === (view === null || view === void 0 ? void 0 : view.name)) {
31
48
  return;
32
49
  }
@@ -40,6 +57,18 @@ function initializeMetaAPI(_unpatchedConsole, internalLogger, _config, metas, _t
40
57
  }
41
58
  };
42
59
  var getView = function () { return metas.value.view; };
60
+ var setPage = function (page) {
61
+ var pageMeta = (0, is_1.isString)(page)
62
+ ? __assign(__assign({}, metaPage === null || metaPage === void 0 ? void 0 : metaPage.page), { id: page }) : page;
63
+ if (metaPage) {
64
+ metas.remove(metaPage);
65
+ }
66
+ metaPage = {
67
+ page: pageMeta,
68
+ };
69
+ metas.add(metaPage);
70
+ };
71
+ var getPage = function () { return metas.value.page; };
43
72
  return {
44
73
  setUser: setUser,
45
74
  resetUser: setUser,
@@ -48,6 +77,8 @@ function initializeMetaAPI(_unpatchedConsole, internalLogger, _config, metas, _t
48
77
  getSession: getSession,
49
78
  setView: setView,
50
79
  getView: getView,
80
+ setPage: setPage,
81
+ getPage: getPage,
51
82
  };
52
83
  }
53
84
  exports.initializeMetaAPI = initializeMetaAPI;
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":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CAAC,YAAY,CAAC,CAAC;SAC5B;IACH,CAAC,CAAC;IAEF,IAAM,OAAO,GAAuB,cAAM,OAAA,KAAK,CAAC,KAAK,CAAC,IAAI,EAAhB,CAAgB,CAAC;IAE3D,OAAO;QACL,OAAO,SAAA;QACP,SAAS,EAAE,OAA+B;QAC1C,UAAU,YAAA;QACV,YAAY,EAAE,UAAqC;QACnD,UAAU,YAAA;QACV,OAAO,SAAA;QACP,OAAO,SAAA;KACR,CAAC;AACJ,CAAC;AApED,8CAoEC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Meta, Metas } from '../../metas';\nimport type { Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\n\nimport type { MetaAPI } from './types';\n\nexport function initializeMetaAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n _config: Config,\n metas: Metas,\n _transports: Transports\n): MetaAPI {\n internalLogger.debug('Initializing meta API');\n\n let metaSession: Partial<Meta> | undefined = undefined;\n let metaUser: Partial<Meta> | undefined = undefined;\n let metaView: Partial<Meta> | undefined = undefined;\n\n const setUser: MetaAPI['setUser'] = (user) => {\n if (metaUser) {\n metas.remove(metaUser);\n }\n\n metaUser = {\n user,\n };\n\n metas.add(metaUser);\n };\n\n const setSession: MetaAPI['setSession'] = (session) => {\n if (metaSession) {\n metas.remove(metaSession);\n }\n\n metaSession = {\n session,\n };\n\n metas.add(metaSession);\n };\n\n const getSession: MetaAPI['getSession'] = () => metas.value.session;\n\n const setView: MetaAPI['setView'] = (view) => {\n if (metaView?.view?.name === view?.name) {\n return;\n }\n\n const previousView = metaView;\n\n metaView = {\n view,\n };\n\n metas.add(metaView);\n\n if (previousView) {\n metas.remove(previousView);\n }\n };\n\n const getView: MetaAPI['getView'] = () => metas.value.view;\n\n return {\n setUser,\n resetUser: setUser as MetaAPI['resetUser'],\n setSession,\n resetSession: setSession as MetaAPI['resetSession'],\n getSession,\n setView,\n getView,\n };\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SAAS,EAAE,OAA+B;QAC1C,UAAU,YAAA;QACV,YAAY,EAAE,UAAqC;QACnD,UAAU,YAAA;QACV,OAAO,SAAA;QACP,OAAO,SAAA;QACP,OAAO,SAAA;QACP,OAAO,SAAA;KACR,CAAC;AACJ,CAAC;AAtGD,8CAsGC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Meta, Metas } from '../../metas';\nimport type { Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport { isEmpty, isString } from '../../utils/is';\n\nimport type { MetaAPI } from './types';\n\nexport function initializeMetaAPI(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n _config: Config,\n metas: Metas,\n _transports: Transports\n): MetaAPI {\n internalLogger.debug('Initializing meta API');\n\n let metaSession: Partial<Meta> | undefined = undefined;\n let metaUser: Partial<Meta> | undefined = undefined;\n let metaView: Partial<Meta> | undefined = undefined;\n let metaPage: Partial<Meta> | undefined = undefined;\n\n const setUser: MetaAPI['setUser'] = (user) => {\n if (metaUser) {\n metas.remove(metaUser);\n }\n\n metaUser = {\n user,\n };\n\n metas.add(metaUser);\n };\n\n const setSession: MetaAPI['setSession'] = (session, options) => {\n const overrides = options?.overrides;\n\n if (metaSession) {\n metas.remove(metaSession);\n }\n\n metaSession = {\n session: {\n // if session is empty, session manager force creates a new session\n ...(isEmpty(session) ? undefined : session),\n ...(overrides ? { overrides } : {}),\n },\n };\n\n metas.add(metaSession);\n };\n\n const getSession: MetaAPI['getSession'] = () => metas.value.session;\n\n const setView: MetaAPI['setView'] = (view, options) => {\n if (options?.overrides) {\n setSession(getSession(), { overrides: options.overrides });\n }\n\n if (metaView?.view?.name === view?.name) {\n return;\n }\n\n const previousView = metaView;\n\n metaView = {\n view,\n };\n\n metas.add(metaView);\n\n if (previousView) {\n metas.remove(previousView);\n }\n };\n\n const getView: MetaAPI['getView'] = () => metas.value.view;\n\n const setPage: MetaAPI['setPage'] = (page) => {\n const pageMeta = isString(page)\n ? {\n ...metaPage?.page,\n id: page,\n }\n : page;\n\n if (metaPage) {\n metas.remove(metaPage);\n }\n\n metaPage = {\n page: pageMeta,\n };\n\n metas.add(metaPage);\n };\n\n const getPage: MetaAPI['getPage'] = () => metas.value.page;\n\n return {\n setUser,\n resetUser: setUser as MetaAPI['resetUser'],\n setSession,\n resetSession: setSession as MetaAPI['resetSession'],\n getSession,\n setView,\n getView,\n setPage,\n getPage,\n };\n}\n"]}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ var faro_core_1 = require("@grafana/faro-core");
15
+ var testUtils_1 = require("@grafana/faro-core/src/testUtils");
16
+ describe('Meta API', function () {
17
+ beforeEach(function () {
18
+ jest.resetAllMocks();
19
+ jest.restoreAllMocks();
20
+ });
21
+ describe('setView', function () {
22
+ it('updates the view meta if the new view meta is different to the previous one', function () {
23
+ var api = (0, faro_core_1.initializeFaro)((0, testUtils_1.mockConfig)()).api;
24
+ var view = { name: 'my-view' };
25
+ api.setView(view);
26
+ var previousView = api.getView();
27
+ expect(previousView).toEqual(view);
28
+ var newView = { name: 'my-new-view' };
29
+ api.setView(newView);
30
+ previousView = api.getView();
31
+ expect(previousView).toEqual(newView);
32
+ });
33
+ it('does not update the view meta if the new view meta is identical to the previous one', function () {
34
+ var api = (0, faro_core_1.initializeFaro)((0, testUtils_1.mockConfig)()).api;
35
+ var view = { name: 'my-view' };
36
+ api.setView(view);
37
+ var previousView = api.getView();
38
+ expect(previousView).toEqual(view);
39
+ var newView = { name: 'my-view' };
40
+ api.setView(newView);
41
+ previousView = api.getView();
42
+ expect(previousView).toEqual(view);
43
+ });
44
+ });
45
+ describe('setSession', function () {
46
+ it('adds overrides to the session meta if provided via the setView() function call', function () {
47
+ var initialSession = { id: 'my-session' };
48
+ var api = (0, faro_core_1.initializeFaro)((0, testUtils_1.mockConfig)({ sessionTracking: { enabled: false, session: initialSession } })).api;
49
+ expect(api.getSession()).toEqual(initialSession);
50
+ var overrides = { serviceName: 'service-1' };
51
+ var newSession = { id: 'my-new-session', attributes: { hello: 'world' } };
52
+ api.setSession(newSession, { overrides: overrides });
53
+ expect(api.getSession()).toEqual(__assign(__assign({}, newSession), { overrides: overrides }));
54
+ overrides = { serviceName: 'service-2' };
55
+ api.setSession({}, { overrides: overrides });
56
+ expect(api.getSession()).toEqual({ overrides: overrides });
57
+ overrides = { serviceName: 'service-3' };
58
+ api.setSession(undefined, { overrides: overrides });
59
+ expect(api.getSession()).toEqual({ overrides: overrides });
60
+ });
61
+ });
62
+ describe('setPage / getPage', function () {
63
+ it('updates the page meta when setPage(meta) is called', function () {
64
+ var api = (0, faro_core_1.initializeFaro)((0, testUtils_1.mockConfig)()).api;
65
+ var page = { url: 'http://example.com/my-page', id: 'my-page' };
66
+ api.setPage(page);
67
+ expect(api.getPage()).toEqual(page);
68
+ var newPage = { url: 'http://example.com/my-new-page', id: 'my-new-page' };
69
+ api.setPage(newPage);
70
+ expect(api.getPage()).toEqual(newPage);
71
+ });
72
+ it('updates the page id if the parameter of setPage is a string', function () {
73
+ var _a;
74
+ var api = (0, faro_core_1.initializeFaro)((0, testUtils_1.mockConfig)()).api;
75
+ var initialPage = { url: 'http://example.com/my-page', id: 'my-page', attributes: { hello: 'world' } };
76
+ api.setPage(initialPage);
77
+ expect(api.getPage()).toStrictEqual(initialPage);
78
+ var newPageId = 'my-new-page-id';
79
+ api.setPage(newPageId);
80
+ expect((_a = api.getPage()) === null || _a === void 0 ? void 0 : _a.id).toEqual(newPageId);
81
+ });
82
+ it('gets the page meta when getPage(meta) is called', function () {
83
+ var api = (0, faro_core_1.initializeFaro)((0, testUtils_1.mockConfig)()).api;
84
+ var page = { url: 'http://example.com/my-page', id: 'my-page' };
85
+ api.setPage(page);
86
+ expect(api.getPage()).toEqual(page);
87
+ });
88
+ });
89
+ });
90
+ //# sourceMappingURL=initilialize.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initilialize.test.js","sourceRoot":"","sources":["../../../../../../src/api/meta/initilialize.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,gDAAoD;AACpD,8DAA8D;AAE9D,QAAQ,CAAC,UAAU,EAAE;IACnB,UAAU,CAAC;QACT,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,SAAS,EAAE;QAClB,EAAE,CAAC,6EAA6E,EAAE;YACxE,IAAA,GAAG,GAAK,IAAA,0BAAc,EAAC,IAAA,sBAAU,GAAE,CAAC,IAAjC,CAAkC;YAE7C,IAAM,IAAI,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;YACjC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAClB,IAAI,YAAY,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;YACjC,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAEnC,IAAM,OAAO,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;YACxC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACrB,YAAY,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;YAC7B,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qFAAqF,EAAE;YAChF,IAAA,GAAG,GAAK,IAAA,0BAAc,EAAC,IAAA,sBAAU,GAAE,CAAC,IAAjC,CAAkC;YAE7C,IAAM,IAAI,GAAG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;YAE7C,IAAM,WAAW,GAAG,EAAE,GAAG,EAAE,4BAA4B,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC;YACzG,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACzB,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;YAEjD,IAAM,SAAS,GAAG,gBAAgB,CAAC;YACnC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACvB,MAAM,CAAC,MAAA,GAAG,CAAC,OAAO,EAAE,0CAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,iDAAiD,EAAE;YAC5C,IAAA,GAAG,GAAK,IAAA,0BAAc,EAAC,IAAA,sBAAU,GAAE,CAAC,IAAjC,CAAkC;YAE7C,IAAM,IAAI,GAAG,EAAE,GAAG,EAAE,4BAA4B,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;YAClE,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAClB,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { initializeFaro } from '@grafana/faro-core';\nimport { mockConfig } from '@grafana/faro-core/src/testUtils';\n\ndescribe('Meta API', () => {\n beforeEach(() => {\n jest.resetAllMocks();\n jest.restoreAllMocks();\n });\n\n describe('setView', () => {\n it('updates the view meta if the new view meta is different to the previous one', () => {\n const { api } = initializeFaro(mockConfig());\n\n const view = { name: 'my-view' };\n api.setView(view);\n let previousView = api.getView();\n expect(previousView).toEqual(view);\n\n const newView = { name: 'my-new-view' };\n api.setView(newView);\n previousView = api.getView();\n expect(previousView).toEqual(newView);\n });\n\n it('does not update the view meta if the new view meta is identical to the previous one', () => {\n const { api } = initializeFaro(mockConfig());\n\n const view = { name: 'my-view' };\n api.setView(view);\n let previousView = api.getView();\n expect(previousView).toEqual(view);\n\n const newView = { name: 'my-view' };\n api.setView(newView);\n previousView = api.getView();\n expect(previousView).toEqual(view);\n });\n });\n\n describe('setSession', () => {\n it('adds overrides to the session meta if provided via the setView() function call', () => {\n const initialSession = { id: 'my-session' };\n\n const { api } = initializeFaro(mockConfig({ sessionTracking: { enabled: false, session: initialSession } }));\n\n expect(api.getSession()).toEqual(initialSession);\n\n let overrides = { serviceName: 'service-1' };\n\n const newSession = { id: 'my-new-session', attributes: { hello: 'world' } };\n api.setSession(newSession, { overrides });\n expect(api.getSession()).toEqual({ ...newSession, overrides });\n\n overrides = { serviceName: 'service-2' };\n api.setSession({}, { overrides });\n expect(api.getSession()).toEqual({ overrides });\n\n overrides = { serviceName: 'service-3' };\n api.setSession(undefined, { overrides });\n expect(api.getSession()).toEqual({ overrides });\n });\n });\n\n describe('setPage / getPage', () => {\n it('updates the page meta when setPage(meta) is called', () => {\n const { api } = initializeFaro(mockConfig());\n\n const page = { url: 'http://example.com/my-page', id: 'my-page' };\n api.setPage(page);\n expect(api.getPage()).toEqual(page);\n\n const newPage = { url: 'http://example.com/my-new-page', id: 'my-new-page' };\n api.setPage(newPage);\n expect(api.getPage()).toEqual(newPage);\n });\n\n it('updates the page id if the parameter of setPage is a string', () => {\n const { api } = initializeFaro(mockConfig());\n\n const initialPage = { url: 'http://example.com/my-page', id: 'my-page', attributes: { hello: 'world' } };\n api.setPage(initialPage);\n expect(api.getPage()).toStrictEqual(initialPage);\n\n const newPageId = 'my-new-page-id';\n api.setPage(newPageId);\n expect(api.getPage()?.id).toEqual(newPageId);\n });\n\n it('gets the page meta when getPage(meta) is called', () => {\n const { api } = initializeFaro(mockConfig());\n\n const page = { url: 'http://example.com/my-page', id: 'my-page' };\n api.setPage(page);\n expect(api.getPage()).toEqual(page);\n });\n });\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/api/meta/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MetaSession, MetaUser, MetaView } from '../../metas';\n\nexport interface MetaAPI {\n setUser: (user?: MetaUser | undefined) => void;\n resetUser: () => void;\n setSession: (session?: MetaSession | undefined) => void;\n resetSession: () => void;\n getSession: () => MetaSession | undefined;\n setView: (view?: MetaView | undefined) => void;\n getView: () => MetaView | undefined;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/api/meta/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MetaOverrides, MetaPage, MetaSession, MetaUser, MetaView } from '../../metas';\n\nexport interface MetaAPI {\n setUser: (user?: MetaUser | undefined) => void;\n resetUser: () => void;\n setSession: (\n session?: MetaSession | undefined,\n options?: {\n overrides: MetaOverrides;\n }\n ) => void;\n resetSession: () => void;\n getSession: () => MetaSession | undefined;\n setView: (\n view?: MetaView | undefined,\n options?: {\n overrides: MetaOverrides;\n }\n ) => void;\n getView: () => MetaView | undefined;\n /**\n * If a string is provided, it will be used as the page id.\n * @returns\n */\n setPage: (page?: MetaPage | string | undefined) => void;\n getPage: () => MetaPage | undefined;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/config/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { APIEvent, LogArgsSerializer, StacktraceParser } from '../api';\nimport type { Instrumentation } from '../instrumentations';\nimport type { InternalLoggerLevel } from '../internalLogger';\nimport type { Meta, MetaApp, MetaItem, MetaSession, MetaUser, MetaView } from '../metas';\nimport type { BatchExecutorOptions, BeforeSendHook, Transport } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\nimport type { LogLevel } from '../utils';\n\ntype SamplingContext = {\n metas: Meta;\n};\n\nexport interface Config<P = APIEvent> {\n /**\n * Application metadata\n */\n app: MetaApp;\n\n /**\n * Set max number and max interval for signals to be batched before sending\n */\n batching?: BatchExecutorOptions;\n\n /**\n * A flag for toggling deduplication for signals\n */\n dedupe: boolean;\n\n /**\n * The key (name) to use for the global Faro object (default: 'faro')\n */\n globalObjectKey: string;\n\n /**\n * The (custom) instrumentations to use with Faro\n */\n instrumentations: Instrumentation[];\n\n /**\n * The level of information printed to console for internal messages (default: LogLevel.ERROR)\n */\n internalLoggerLevel: InternalLoggerLevel;\n\n /**\n * Isolate Faro instance from other Faro instances on the same page. (default: false)\n */\n isolate: boolean;\n\n /**\n * Custom function to serialize log arguments\n */\n logArgsSerializer?: LogArgsSerializer;\n\n /**\n * Add custom Metas during Faro initialization\n */\n metas: MetaItem[];\n\n /**\n * Custom function used to parse stack traces\n */\n parseStacktrace: StacktraceParser;\n\n /**\n * Pause sending data (default: false)\n */\n paused: boolean;\n\n /**\n * Prevent Faro from exposing itself to the global object (default: false)\n */\n preventGlobalExposure: boolean;\n\n /**\n * The transports to use for sending beacons\n */\n transports: Transport[];\n\n /**\n * Some instrumentations might override the default console methods but Faro instance provides a\n * way to access the unmodified console methods.\n *\n * faro.unpatchedConsole.log('This is a log');\n * faro.unpatchedConsole.warn('This is a warning');\n */\n unpatchedConsole: UnpatchedConsole;\n\n /**\n * Function which invoked before pushing event to transport. Can be used to modify or filter events\n */\n beforeSend?: BeforeSendHook<P>;\n\n /**\n * Error message patterns for errors that should be ignored\n */\n ignoreErrors?: Patterns;\n\n /**\n * Path patterns for Endpoints that should be ignored form being tracked\n */\n ignoreUrls?: Patterns;\n\n /**\n * Configuration for the built in session tracker\n */\n sessionTracking?: {\n /**\n * Enable session tracking (default: true)\n */\n enabled?: boolean;\n /**\n * Wether to use sticky sessions (default: false)\n */\n persistent?: boolean;\n /**\n * Session metadata object to be used when initializing session tracking\n */\n session?: MetaSession;\n /**\n * How long is a sticky session valid for recurring users (default: 15 minutes)\n */\n maxSessionPersistenceTime?: number;\n /**\n * Called each time a session changes. This can be when a new session is created or when an existing session is updated.\n * @param oldSession\n * @param newSession\n */\n onSessionChange?: (oldSession: MetaSession | null, newSession: MetaSession) => void;\n /**\n * Then sampling rate for the session based sampler (default: 1). If a session is not part of a sample, no signals for this session are tracked.\n */\n samplingRate?: number;\n /**\n * Custom sampler function if custom sampling logic is needed.\n * @param context\n */\n sampler?: (context: SamplingContext) => number;\n /**\n * Custom function to generate session id. If available Faro uses this function instead of the internal one.\n */\n generateSessionId?: () => string;\n };\n\n /**\n * Meta object for user data\n */\n user?: MetaUser;\n\n /**\n * Meta object for view data\n */\n view?: MetaView;\n\n eventDomain?: string;\n\n /**\n * Only resource timings for fetch and xhr requests are tracked by default. Set this to true to track all resources (default: false).\n */\n trackResources?: boolean;\n\n /**\n * Track web vitals attribution data (default: false)\n */\n trackWebVitalsAttribution?: boolean;\n\n /**\n * Configuration for the console instrumentation\n */\n consoleInstrumentation?: {\n /**\n * Configure what console levels should be captured by Faro. By default the follwoing levels\n * are disabled: console.debug, console.trace, console.log\n *\n * If you want to collect all levels set captureConsoleDisabledLevels: [];\n * If you want to disable only some levels set captureConsoleDisabledLevels: [LogLevel.DEBUG, LogLevel.TRACE];\n */\n disabledLevels?: LogLevel[];\n /*\n * By default, Faro sends an error for console.error calls. If you want to send a log instead, set this to true.\n */\n consoleErrorAsLog?: boolean;\n };\n}\n\nexport type Patterns = Array<string | RegExp>;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/config/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { APIEvent, LogArgsSerializer, StacktraceParser } from '../api';\nimport type { Instrumentation } from '../instrumentations';\nimport type { InternalLoggerLevel } from '../internalLogger';\nimport type { Meta, MetaApp, MetaItem, MetaPage, MetaSession, MetaUser, MetaView } from '../metas';\nimport type { BatchExecutorOptions, BeforeSendHook, Transport } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\nimport type { LogLevel } from '../utils';\n\ntype SamplingContext = {\n metas: Meta;\n};\n\nexport interface Config<P = APIEvent> {\n /**\n * Application metadata\n */\n app: MetaApp;\n\n /**\n * Set max number and max interval for signals to be batched before sending\n */\n batching?: BatchExecutorOptions;\n\n /**\n * A flag for toggling deduplication for signals\n */\n dedupe: boolean;\n\n /**\n * The key (name) to use for the global Faro object (default: 'faro')\n */\n globalObjectKey: string;\n\n /**\n * The (custom) instrumentations to use with Faro\n */\n instrumentations: Instrumentation[];\n\n /**\n * The level of information printed to console for internal messages (default: LogLevel.ERROR)\n */\n internalLoggerLevel: InternalLoggerLevel;\n\n /**\n * Isolate Faro instance from other Faro instances on the same page. (default: false)\n */\n isolate: boolean;\n\n /**\n * Custom function to serialize log arguments\n */\n logArgsSerializer?: LogArgsSerializer;\n\n /**\n * Add custom Metas during Faro initialization\n */\n metas: MetaItem[];\n\n /**\n * Custom function used to parse stack traces\n */\n parseStacktrace: StacktraceParser;\n\n /**\n * Pause sending data (default: false)\n */\n paused: boolean;\n\n /**\n * Prevent Faro from exposing itself to the global object (default: false)\n */\n preventGlobalExposure: boolean;\n\n /**\n * The transports to use for sending beacons\n */\n transports: Transport[];\n\n /**\n * Some instrumentations might override the default console methods but Faro instance provides a\n * way to access the unmodified console methods.\n *\n * faro.unpatchedConsole.log('This is a log');\n * faro.unpatchedConsole.warn('This is a warning');\n */\n unpatchedConsole: UnpatchedConsole;\n\n /**\n * Function which invoked before pushing event to transport. Can be used to modify or filter events\n */\n beforeSend?: BeforeSendHook<P>;\n\n /**\n * Error message patterns for errors that should be ignored\n */\n ignoreErrors?: Patterns;\n\n /**\n * Path patterns for Endpoints that should be ignored form being tracked\n */\n ignoreUrls?: Patterns;\n\n /**\n * Configuration for the built in session tracker\n */\n sessionTracking?: {\n /**\n * Enable session tracking (default: true)\n */\n enabled?: boolean;\n /**\n * Wether to use sticky sessions (default: false)\n */\n persistent?: boolean;\n /**\n * Session metadata object to be used when initializing session tracking\n */\n session?: MetaSession;\n /**\n * How long is a sticky session valid for recurring users (default: 15 minutes)\n */\n maxSessionPersistenceTime?: number;\n /**\n * Called each time a session changes. This can be when a new session is created or when an existing session is updated.\n * @param oldSession\n * @param newSession\n */\n onSessionChange?: (oldSession: MetaSession | null, newSession: MetaSession) => void;\n /**\n * Then sampling rate for the session based sampler (default: 1). If a session is not part of a sample, no signals for this session are tracked.\n */\n samplingRate?: number;\n /**\n * Custom sampler function if custom sampling logic is needed.\n * @param context\n */\n sampler?: (context: SamplingContext) => number;\n /**\n * Custom function to generate session id. If available Faro uses this function instead of the internal one.\n */\n generateSessionId?: () => string;\n };\n\n /**\n * Meta object for user data\n */\n user?: MetaUser;\n\n /**\n * Meta object for view data\n */\n view?: MetaView;\n\n eventDomain?: string;\n\n /**\n * Only resource timings for fetch and xhr requests are tracked by default. Set this to true to track all resources (default: false).\n */\n trackResources?: boolean;\n\n /**\n * Track web vitals attribution data (default: false)\n */\n trackWebVitalsAttribution?: boolean;\n\n /**\n * Configuration for the console instrumentation\n */\n consoleInstrumentation?: {\n /**\n * Configure what console levels should be captured by Faro. By default the follwoing levels\n * are disabled: console.debug, console.trace, console.log\n *\n * If you want to collect all levels set captureConsoleDisabledLevels: [];\n * If you want to disable only some levels set captureConsoleDisabledLevels: [LogLevel.DEBUG, LogLevel.TRACE];\n */\n disabledLevels?: LogLevel[];\n /*\n * By default, Faro sends an error for console.error calls. If you want to send a log instead, set this to true.\n */\n consoleErrorAsLog?: boolean;\n\n /**\n * If true, use the default Faro error serializer for console.error calls. If false, simply call toString() on the error arguments.\n * If enabled, payloads containing serialized errors may become very large. If left disabled, some error details may be lost.\n * (default: false)\n */\n serializeErrors?: boolean;\n\n /**\n * Custom function to serialize Error arguments\n */\n errorSerializer?: LogArgsSerializer;\n };\n\n pageTracking?: {\n /**\n * The page meta for initial page settings\n */\n page?: MetaPage;\n\n /**\n * Allows to provide a template for the page id\n */\n generatePageId?: (location: Location) => string;\n };\n}\n\nexport type Patterns = Array<string | RegExp>;\n"]}
@@ -14,11 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- 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.genShortID = exports.defaultLogLevel = exports.deepEqual = exports.createPromiseBuffer = exports.allLogLevels = exports.defaultUnpatchedConsole = exports.transportItemTypeToBodyKey = exports.TransportItemType = exports.getTransportBody = exports.BaseTransport = exports.setInternalFaroOnGlobalObject = exports.isInternalFaroOnGlobalObject = exports.internalGlobalObjectKey = exports.getInternalFaroFromGlobalObject = exports.faro = exports.InternalLoggerLevel = exports.defaultInternalLoggerLevel = exports.createInternalLogger = exports.BaseInstrumentation = exports.defaultGlobalObjectKey = exports.defaultBatchingConfig = exports.initializeFaro = exports.globalObject = exports.BaseExtension = exports.defaultLogArgsSerializer = exports.defaultExceptionType = void 0;
18
- exports.unknownString = exports.VERSION = exports.dateNow = exports.noop = exports.LogLevel = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = void 0;
17
+ 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.genShortID = exports.defaultLogLevel = exports.deepEqual = exports.createPromiseBuffer = exports.allLogLevels = exports.defaultUnpatchedConsole = exports.transportItemTypeToBodyKey = exports.TransportItemType = exports.getTransportBody = exports.BaseTransport = exports.setInternalFaroOnGlobalObject = exports.isInternalFaroOnGlobalObject = exports.internalGlobalObjectKey = exports.getInternalFaroFromGlobalObject = exports.faro = exports.InternalLoggerLevel = exports.defaultInternalLoggerLevel = exports.createInternalLogger = exports.BaseInstrumentation = exports.defaultGlobalObjectKey = exports.defaultBatchingConfig = exports.initializeFaro = exports.globalObject = exports.BaseExtension = exports.defaultErrorArgsSerializer = exports.defaultLogArgsSerializer = exports.defaultExceptionType = void 0;
18
+ exports.unknownString = exports.VERSION = exports.stringifyExternalJson = exports.getCircularDependencyReplacer = exports.isEmpty = exports.dateNow = exports.noop = exports.LogLevel = exports.isUndefined = exports.isTypeof = exports.isToString = exports.isThenable = exports.isSyntheticEvent = exports.isSymbol = void 0;
19
19
  var api_1 = require("./api");
20
20
  Object.defineProperty(exports, "defaultExceptionType", { enumerable: true, get: function () { return api_1.defaultExceptionType; } });
21
21
  Object.defineProperty(exports, "defaultLogArgsSerializer", { enumerable: true, get: function () { return api_1.defaultLogArgsSerializer; } });
22
+ Object.defineProperty(exports, "defaultErrorArgsSerializer", { enumerable: true, get: function () { return api_1.defaultErrorArgsSerializer; } });
22
23
  var extensions_1 = require("./extensions");
23
24
  Object.defineProperty(exports, "BaseExtension", { enumerable: true, get: function () { return extensions_1.BaseExtension; } });
24
25
  var globalObject_1 = require("./globalObject");
@@ -86,6 +87,9 @@ Object.defineProperty(exports, "isUndefined", { enumerable: true, get: function
86
87
  Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return utils_1.LogLevel; } });
87
88
  Object.defineProperty(exports, "noop", { enumerable: true, get: function () { return utils_1.noop; } });
88
89
  Object.defineProperty(exports, "dateNow", { enumerable: true, get: function () { return utils_1.dateNow; } });
90
+ Object.defineProperty(exports, "isEmpty", { enumerable: true, get: function () { return utils_1.isEmpty; } });
91
+ Object.defineProperty(exports, "getCircularDependencyReplacer", { enumerable: true, get: function () { return utils_1.getCircularDependencyReplacer; } });
92
+ Object.defineProperty(exports, "stringifyExternalJson", { enumerable: true, get: function () { return utils_1.stringifyExternalJson; } });
89
93
  var version_1 = require("./version");
90
94
  Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
91
95
  var consts_1 = require("./consts");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6BAAuE;AAA9D,2GAAA,oBAAoB,OAAA;AAAE,+GAAA,wBAAwB,OAAA;AA8BvD,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AAGtB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAGrB,2CAA8C;AAArC,4GAAA,cAAc,OAAA;AAEvB,mCAAyE;AAAhE,+GAAA,qBAAqB,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AAGtD,uDAAyD;AAAhD,uHAAA,mBAAmB,OAAA;AAG5B,mDAAyG;AAAhG,sHAAA,oBAAoB,OAAA;AAAE,4HAAA,0BAA0B,OAAA;AAAE,qHAAA,mBAAmB,OAAA;AAmB9E,6BAMe;AALb,2FAAA,IAAI,OAAA;AACJ,sHAAA,+BAA+B,OAAA;AAC/B,8GAAA,uBAAuB,OAAA;AACvB,mHAAA,4BAA4B,OAAA;AAC5B,oHAAA,6BAA6B,OAAA;AAI/B,6CAA2B;AAE3B,2CAA8G;AAArG,2GAAA,aAAa,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AAAE,+GAAA,iBAAiB,OAAA;AAAE,wHAAA,0BAA0B,OAAA;AAWvF,uDAA6D;AAApD,2HAAA,uBAAuB,OAAA;AAGhC,iCAsCiB;AArCf,qGAAA,YAAY,OAAA;AACZ,4GAAA,mBAAmB,OAAA;AACnB,kGAAA,SAAS,OAAA;AACT,wGAAA,eAAe,OAAA;AACf,mGAAA,UAAU,OAAA;AACV,4GAAA,mBAAmB,OAAA;AACnB,gGAAA,OAAO,OAAA;AACP,kGAAA,SAAS,OAAA;AACT,mGAAA,UAAU,OAAA;AACV,uGAAA,cAAc,OAAA;AACd,kGAAA,SAAS,OAAA;AACT,yGAAA,gBAAgB,OAAA;AAChB,gGAAA,OAAO,OAAA;AACP,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,gGAAA,OAAO,OAAA;AACP,uGAAA,cAAc,OAAA;AACd,mGAAA,UAAU,OAAA;AACV,qGAAA,YAAY,OAAA;AACZ,8FAAA,KAAK,OAAA;AACL,8FAAA,KAAK,OAAA;AACL,qGAAA,YAAY,OAAA;AACZ,+FAAA,MAAM,OAAA;AACN,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,yGAAA,gBAAgB,OAAA;AAChB,mGAAA,UAAU,OAAA;AACV,mGAAA,UAAU,OAAA;AACV,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,6FAAA,IAAI,OAAA;AACJ,gGAAA,OAAO,OAAA;AAaT,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAEhB,mCAAyC;AAAhC,uGAAA,aAAa,OAAA","sourcesContent":["export { defaultExceptionType, defaultLogArgsSerializer } from './api';\nexport type {\n API,\n APIEvent,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\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} 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} 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 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} from './utils';\nexport type {\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BufferItem,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\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,6BAAmG;AAA1F,2GAAA,oBAAoB,OAAA;AAAE,+GAAA,wBAAwB,OAAA;AAAE,iHAAA,0BAA0B,OAAA;AA8BnF,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AAGtB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAGrB,2CAA8C;AAArC,4GAAA,cAAc,OAAA;AAEvB,mCAAyE;AAAhE,+GAAA,qBAAqB,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AAGtD,uDAAyD;AAAhD,uHAAA,mBAAmB,OAAA;AAG5B,mDAAyG;AAAhG,sHAAA,oBAAoB,OAAA;AAAE,4HAAA,0BAA0B,OAAA;AAAE,qHAAA,mBAAmB,OAAA;AAoB9E,6BAMe;AALb,2FAAA,IAAI,OAAA;AACJ,sHAAA,+BAA+B,OAAA;AAC/B,8GAAA,uBAAuB,OAAA;AACvB,mHAAA,4BAA4B,OAAA;AAC5B,oHAAA,6BAA6B,OAAA;AAI/B,6CAA2B;AAE3B,2CAA8G;AAArG,2GAAA,aAAa,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AAAE,+GAAA,iBAAiB,OAAA;AAAE,wHAAA,0BAA0B,OAAA;AAWvF,uDAA6D;AAApD,2HAAA,uBAAuB,OAAA;AAGhC,iCAyCiB;AAxCf,qGAAA,YAAY,OAAA;AACZ,4GAAA,mBAAmB,OAAA;AACnB,kGAAA,SAAS,OAAA;AACT,wGAAA,eAAe,OAAA;AACf,mGAAA,UAAU,OAAA;AACV,4GAAA,mBAAmB,OAAA;AACnB,gGAAA,OAAO,OAAA;AACP,kGAAA,SAAS,OAAA;AACT,mGAAA,UAAU,OAAA;AACV,uGAAA,cAAc,OAAA;AACd,kGAAA,SAAS,OAAA;AACT,yGAAA,gBAAgB,OAAA;AAChB,gGAAA,OAAO,OAAA;AACP,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,gGAAA,OAAO,OAAA;AACP,uGAAA,cAAc,OAAA;AACd,mGAAA,UAAU,OAAA;AACV,qGAAA,YAAY,OAAA;AACZ,8FAAA,KAAK,OAAA;AACL,8FAAA,KAAK,OAAA;AACL,qGAAA,YAAY,OAAA;AACZ,+FAAA,MAAM,OAAA;AACN,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,iGAAA,QAAQ,OAAA;AACR,yGAAA,gBAAgB,OAAA;AAChB,mGAAA,UAAU,OAAA;AACV,mGAAA,UAAU,OAAA;AACV,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,iGAAA,QAAQ,OAAA;AACR,6FAAA,IAAI,OAAA;AACJ,gGAAA,OAAO,OAAA;AACP,gGAAA,OAAO,OAAA;AACP,sHAAA,6BAA6B,OAAA;AAC7B,8GAAA,qBAAqB,OAAA;AAavB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAEhB,mCAAyC;AAAhC,uGAAA,aAAa,OAAA","sourcesContent":["export { defaultExceptionType, defaultLogArgsSerializer, defaultErrorArgsSerializer } from './api';\nexport type {\n API,\n APIEvent,\n EventAttributes,\n EventEvent,\n EventsAPI,\n ExceptionEvent,\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} 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 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} from './utils';\nexport type {\n BaseObject,\n BaseObjectKey,\n BaseObjectPrimitiveValue,\n BaseObjectValue,\n BufferItem,\n PromiseBuffer,\n PromiseBufferOptions,\n PromiseProducer,\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,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} 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 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 +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 email?: string;\n id?: string;\n username?: string;\n attributes?: MetaAttributes;\n}\n\nexport interface MetaSession {\n id?: string;\n attributes?: MetaAttributes;\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"]}
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 email?: string;\n id?: string;\n username?: string;\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 * Overrides are instructions that allow the receiver to override certain properties.\n */\nexport type MetaOverrides = {\n serviceName?: string;\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EVENT_ROUTE_CHANGE = exports.EVENT_SESSION_EXTEND = exports.EVENT_SESSION_RESUME = exports.EVENT_SESSION_START = exports.EVENT_VIEW_CHANGED = exports.EVENT_NAVIGATION = exports.EVENT_CLICK = exports.Conventions = void 0;
3
+ exports.EVENT_ROUTE_CHANGE = exports.EVENT_OVERRIDES_SERVICE_NAME = exports.EVENT_SESSION_EXTEND = exports.EVENT_SESSION_RESUME = exports.EVENT_SESSION_START = exports.EVENT_VIEW_CHANGED = exports.EVENT_NAVIGATION = exports.EVENT_CLICK = exports.Conventions = void 0;
4
4
  /**
5
5
  * @deprecated The conventions object will be removed in a future version
6
6
  */
@@ -21,5 +21,6 @@ exports.EVENT_VIEW_CHANGED = 'view_changed';
21
21
  exports.EVENT_SESSION_START = 'session_start';
22
22
  exports.EVENT_SESSION_RESUME = 'session_resume';
23
23
  exports.EVENT_SESSION_EXTEND = 'session_extend';
24
+ exports.EVENT_OVERRIDES_SERVICE_NAME = 'service_name_override';
24
25
  exports.EVENT_ROUTE_CHANGE = 'route_change';
25
26
  //# sourceMappingURL=semantic.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"semantic.js","sourceRoot":"","sources":["../../../../src/semantic.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,WAAW,GAAG;IACzB;;OAEG;IACH,UAAU,EAAE;QACV,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,YAAY;QACxB,aAAa,EAAE,eAAe;QAC9B,YAAY,EAAE,cAAc;KAC7B;CACO,CAAC;AAEE,QAAA,WAAW,GAAG,OAAO,CAAC;AACtB,QAAA,gBAAgB,GAAG,YAAY,CAAC;AAChC,QAAA,kBAAkB,GAAG,cAAc,CAAC;AACpC,QAAA,mBAAmB,GAAG,eAAe,CAAC;AACtC,QAAA,oBAAoB,GAAG,gBAAgB,CAAC;AACxC,QAAA,oBAAoB,GAAG,gBAAgB,CAAC;AACxC,QAAA,kBAAkB,GAAG,cAAc,CAAC","sourcesContent":["/**\n * @deprecated The conventions object will be removed in a future version\n */\nexport const Conventions = {\n /**\n * @deprecated The event names object will be removed in a future version\n */\n EventNames: {\n CLICK: 'click',\n NAVIGATION: 'navigation',\n SESSION_START: 'session_start',\n VIEW_CHANGED: 'view_changed',\n },\n} as const;\n\nexport const EVENT_CLICK = 'click';\nexport const EVENT_NAVIGATION = 'navigation';\nexport const EVENT_VIEW_CHANGED = 'view_changed';\nexport const EVENT_SESSION_START = 'session_start';\nexport const EVENT_SESSION_RESUME = 'session_resume';\nexport const EVENT_SESSION_EXTEND = 'session_extend';\nexport const EVENT_ROUTE_CHANGE = 'route_change';\n"]}
1
+ {"version":3,"file":"semantic.js","sourceRoot":"","sources":["../../../../src/semantic.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,WAAW,GAAG;IACzB;;OAEG;IACH,UAAU,EAAE;QACV,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,YAAY;QACxB,aAAa,EAAE,eAAe;QAC9B,YAAY,EAAE,cAAc;KAC7B;CACO,CAAC;AAEE,QAAA,WAAW,GAAG,OAAO,CAAC;AACtB,QAAA,gBAAgB,GAAG,YAAY,CAAC;AAChC,QAAA,kBAAkB,GAAG,cAAc,CAAC;AACpC,QAAA,mBAAmB,GAAG,eAAe,CAAC;AACtC,QAAA,oBAAoB,GAAG,gBAAgB,CAAC;AACxC,QAAA,oBAAoB,GAAG,gBAAgB,CAAC;AACxC,QAAA,4BAA4B,GAAG,uBAAuB,CAAC;AACvD,QAAA,kBAAkB,GAAG,cAAc,CAAC","sourcesContent":["/**\n * @deprecated The conventions object will be removed in a future version\n */\nexport const Conventions = {\n /**\n * @deprecated The event names object will be removed in a future version\n */\n EventNames: {\n CLICK: 'click',\n NAVIGATION: 'navigation',\n SESSION_START: 'session_start',\n VIEW_CHANGED: 'view_changed',\n },\n} as const;\n\nexport const EVENT_CLICK = 'click';\nexport const EVENT_NAVIGATION = 'navigation';\nexport const EVENT_VIEW_CHANGED = 'view_changed';\nexport const EVENT_SESSION_START = 'session_start';\nexport const EVENT_SESSION_RESUME = 'session_resume';\nexport const EVENT_SESSION_EXTEND = 'session_extend';\nexport const EVENT_OVERRIDES_SERVICE_NAME = 'service_name_override';\nexport const EVENT_ROUTE_CHANGE = 'route_change';\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dateNow = exports.getBundleId = exports.genShortID = exports.createPromiseBuffer = exports.noop = exports.LogLevel = exports.defaultLogLevel = exports.allLogLevels = 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 = void 0;
3
+ 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 = void 0;
4
4
  var deepEqual_1 = require("./deepEqual");
5
5
  Object.defineProperty(exports, "deepEqual", { enumerable: true, get: function () { return deepEqual_1.deepEqual; } });
6
6
  var date_1 = require("./date");
@@ -34,6 +34,7 @@ Object.defineProperty(exports, "isThenable", { enumerable: true, get: function (
34
34
  Object.defineProperty(exports, "isToString", { enumerable: true, get: function () { return is_1.isToString; } });
35
35
  Object.defineProperty(exports, "isTypeof", { enumerable: true, get: function () { return is_1.isTypeof; } });
36
36
  Object.defineProperty(exports, "isUndefined", { enumerable: true, get: function () { return is_1.isUndefined; } });
37
+ Object.defineProperty(exports, "isEmpty", { enumerable: true, get: function () { return is_1.isEmpty; } });
37
38
  var logLevels_1 = require("./logLevels");
38
39
  Object.defineProperty(exports, "allLogLevels", { enumerable: true, get: function () { return logLevels_1.allLogLevels; } });
39
40
  Object.defineProperty(exports, "defaultLogLevel", { enumerable: true, get: function () { return logLevels_1.defaultLogLevel; } });
@@ -48,4 +49,7 @@ var sourceMaps_1 = require("./sourceMaps");
48
49
  Object.defineProperty(exports, "getBundleId", { enumerable: true, get: function () { return sourceMaps_1.getBundleId; } });
49
50
  var date_2 = require("./date");
50
51
  Object.defineProperty(exports, "dateNow", { enumerable: true, get: function () { return date_2.dateNow; } });
52
+ var json_1 = require("./json");
53
+ Object.defineProperty(exports, "getCircularDependencyReplacer", { enumerable: true, get: function () { return json_1.getCircularDependencyReplacer; } });
54
+ Object.defineProperty(exports, "stringifyExternalJson", { enumerable: true, get: function () { return json_1.stringifyExternalJson; } });
51
55
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/utils/index.ts"],"names":[],"mappings":";;;AAEA,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAElB,+BAA6C;AAApC,2GAAA,mBAAmB,OAAA;AAE5B,2BA6Bc;AA5BZ,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;AAIb,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","sourcesContent":["export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';\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} 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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/utils/index.ts"],"names":[],"mappings":";;;AAEA,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,+BAA8E;AAArE,qHAAA,6BAA6B,OAAA;AAAE,6GAAA,qBAAqB,OAAA","sourcesContent":["export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue } from './baseObject';\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 } from './json';\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSyntheticEvent = exports.isMap = exports.isMapDefined = exports.isElement = exports.isElementDefined = exports.isDomException = exports.isDomError = exports.isErrorEvent = exports.isError = exports.isErrorDefined = exports.isEvent = exports.isEventDefined = exports.isPrimitive = exports.isThenable = exports.isRegExp = exports.isArray = exports.isFunction = exports.isObject = exports.isSymbol = exports.isBoolean = exports.isInt = exports.isNumber = exports.isString = exports.isNull = exports.isUndefined = exports.isInstanceOf = exports.isToString = exports.isTypeof = void 0;
3
+ exports.isEmpty = exports.isSyntheticEvent = exports.isMap = exports.isMapDefined = exports.isElement = exports.isElementDefined = exports.isDomException = exports.isDomError = exports.isErrorEvent = exports.isError = exports.isErrorDefined = exports.isEvent = exports.isEventDefined = exports.isPrimitive = exports.isThenable = exports.isRegExp = exports.isArray = exports.isFunction = exports.isObject = exports.isSymbol = exports.isBoolean = exports.isInt = exports.isNumber = exports.isString = exports.isNull = exports.isUndefined = exports.isInstanceOf = exports.isToString = exports.isTypeof = void 0;
4
4
  function isTypeof(value, type) {
5
5
  return typeof value === type;
6
6
  }
@@ -50,4 +50,17 @@ exports.isSyntheticEvent = (function (value) {
50
50
  'preventDefault' in value &&
51
51
  'stopPropagation' in value;
52
52
  });
53
+ function isEmpty(value) {
54
+ if (value == null) {
55
+ return true;
56
+ }
57
+ if ((0, exports.isArray)(value) || (0, exports.isString)(value)) {
58
+ return value.length === 0;
59
+ }
60
+ if ((0, exports.isObject)(value)) {
61
+ return Object.keys(value).length === 0;
62
+ }
63
+ return false;
64
+ }
65
+ exports.isEmpty = isEmpty;
53
66
  //# sourceMappingURL=is.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"is.js","sourceRoot":"","sources":["../../../../../src/utils/is.ts"],"names":[],"mappings":";;;AAEA,SAAgB,QAAQ,CAAc,KAAc,EAAE,IAAY;IAChE,OAAO,OAAO,KAAK,KAAK,IAAI,CAAC;AAC/B,CAAC;AAFD,4BAEC;AAED,SAAgB,UAAU,CAAc,KAAc,EAAE,IAAY;IAClE,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,kBAAW,IAAI,MAAG,CAAC;AACtE,CAAC;AAFD,gCAEC;AAED,SAAgB,YAAY,CAA2B,KAAc,EAAE,SAAY;IACjF,IAAI;QACF,OAAO,KAAK,YAAY,SAAS,CAAC;KACnC;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAND,oCAMC;AAEY,QAAA,WAAW,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,EAA5B,CAA4B,CAA0B,CAAC;AAEjF,QAAA,MAAM,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,EAAvB,CAAuB,CAAqB,CAAC;AAElE,QAAA,QAAQ,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAzB,CAAyB,CAAuB,CAAC;AAExE,QAAA,Q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IAAK,OAAA,oBAAY,IAAI,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,EAAxC,CAAwC,CAA8B,CAAC;AAE3F,QAAA,gBAAgB,GAAG,CAAC,UAAC,KAAK;IACrC,OAAA,IAAA,gBAAQ,EAAC,KAAK,CAAC;QACf,aAAa,IAAI,KAAK;QACtB,gBAAgB,IAAI,KAAK;QACzB,iBAAiB,IAAI,KAAK;AAH1B,CAG0B,CAAsB,CAAC","sourcesContent":["export type IsFnHelper<T = unknown> = (value: unknown) => value is T;\n\nexport function isTypeof<T = unknown>(value: unknown, type: string): value is T {\n return typeof value === type;\n}\n\nexport function isToString<T = unknown>(value: unknown, type: string): value is T {\n return Object.prototype.toString.call(value) === `[object ${type}]`;\n}\n\nexport function isInstanceOf<T extends Function = any>(value: unknown, reference: T): value is T {\n try {\n return value instanceof reference;\n } catch (err) {\n return false;\n }\n}\n\nexport const isUndefined = ((value) => isTypeof(value, 'undefined')) as IsFnHelper<undefined>;\n\nexport const isNull = ((value) => isTypeof(value, 'null')) as IsFnHelper<null>;\n\nexport const isString = ((value) => isTypeof(value, 'string')) as IsFnHelper<string>;\n\nexport const isNumber = ((value) =>\n (isTypeof<number>(value, 'number') && !isNaN(value)) || isTypeof(value, 'bigint')) as IsFnHelper<number | bigint>;\n\nexport const isInt = ((value) => isNumber(value) && Number.isInteger(value)) as IsFnHelper<number>;\n\nexport const isBoolean = ((value) => isTypeof(value, 'boolean')) as IsFnHelper<boolean>;\n\nexport const isSymbol = ((value) => isTypeof(value, 'symbol')) as IsFnHelper<Symbol>;\n\nexport const isObject = ((value) => !isNull(value) && isTypeof(value, 'object')) as IsFnHelper<object>;\n\nexport const isFunction = ((value) => isTypeof(value, 'function')) as IsFnHelper<Function>;\n\nexport const isArray = ((value) => isToString(value, 'Array')) as IsFnHelper<unknown[]>;\n\nexport const isRegExp = ((value) => isToString(value, 'RegExp')) as IsFnHelper<string>;\n\nexport const isThenable = ((value) => isFunction((value as any)?.then)) as IsFnHelper<{ then: Function }>;\n\nexport const isPrimitive = ((value) => !isObject(value) && !isFunction(value)) as IsFnHelper<\n string | number | bigint | boolean | symbol\n>;\n\nexport const isEventDefined = typeof Event !== 'undefined';\n\nexport const isEvent = ((value) => isEventDefined && isInstanceOf(value, Event)) as IsFnHelper<Event>;\n\nexport const isErrorDefined = typeof Error !== 'undefined';\n\nexport const isError = ((value) => isErrorDefined && isInstanceOf(value, Error)) as IsFnHelper<Error>;\n\nexport const isErrorEvent = ((value) => isToString(value, 'ErrorEvent')) as IsFnHelper<ErrorEvent>;\n\nexport const isDomError = ((value) => isToString(value, 'DOMError')) as IsFnHelper<DOMException>;\n\nexport const isDomException = ((value) => isToString(value, 'DOMException')) as IsFnHelper<DOMException>;\n\nexport const isElementDefined = typeof Element !== 'undefined';\n\nexport const isElement = ((value) => isElementDefined && isInstanceOf(value, Element)) as IsFnHelper<Element>;\n\nexport const isMapDefined = typeof Map !== 'undefined';\n\nexport const isMap = ((value) => isMapDefined && isInstanceOf(value, Map)) as IsFnHelper<Map<any, any>>;\n\nexport const isSyntheticEvent = ((value) =>\n isObject(value) &&\n 'nativeEvent' in value &&\n 'preventDefault' in value &&\n 'stopPropagation' in value) as IsFnHelper<Event>;\n"]}
1
+ {"version":3,"file":"is.js","sourceRoot":"","sources":["../../../../../src/utils/is.ts"],"names":[],"mappings":";;;AAEA,SAAgB,QAAQ,CAAc,KAAc,EAAE,IAAY;IAChE,OAAO,OAAO,KAAK,KAAK,IAAI,CAAC;AAC/B,CAAC;AAFD,4BAEC;AAED,SAAgB,UAAU,CAAc,KAAc,EAAE,IAAY;IAClE,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,kBAAW,IAAI,MAAG,CAAC;AACtE,CAAC;AAFD,gCAEC;AAED,SAAgB,YAAY,CAA2B,KAAc,EAAE,SAAY;IACjF,IAAI;QACF,OAAO,KAAK,YAAY,SAAS,CAAC;KACnC;IAAC,OAAO,GAAG,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7B,CAA6B,CAA6B,CAAC;AAEpF,QAAA,cAAc,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,EAAjC,CAAiC,CAA6B,CAAC;AAE5F,QAAA,gBAAgB,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC;AAElD,QAAA,SAAS,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,wBAAgB,IAAI,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,EAAhD,CAAgD,CAAwB,CAAC;AAEjG,QAAA,YAAY,GAAG,OAAO,GAAG,KAAK,WAAW,CAAC;AAE1C,QAAA,KAAK,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,oBAAY,IAAI,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,EAAxC,CAAwC,CAA8B,CAAC;AAE3F,QAAA,gBAAgB,GAAG,CAAC,UAAC,KAAK;IACrC,OAAA,IAAA,gBAAQ,EAAC,KAAK,CAAC;QACf,aAAa,IAAI,KAAK;QACtB,gBAAgB,IAAI,KAAK;QACzB,iBAAiB,IAAI,KAAK;AAH1B,CAG0B,CAAsB,CAAC;AAEnD,SAAgB,OAAO,CAAC,KAAU;IAChC,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,IAAI,CAAC;KACb;IAED,IAAI,IAAA,eAAO,EAAC,KAAK,CAAC,IAAI,IAAA,gBAAQ,EAAC,KAAK,CAAC,EAAE;QACrC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;KAC3B;IAED,IAAI,IAAA,gBAAQ,EAAC,KAAK,CAAC,EAAE;QACnB,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;KACxC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAdD,0BAcC","sourcesContent":["export type IsFnHelper<T = unknown> = (value: unknown) => value is T;\n\nexport function isTypeof<T = unknown>(value: unknown, type: string): value is T {\n return typeof value === type;\n}\n\nexport function isToString<T = unknown>(value: unknown, type: string): value is T {\n return Object.prototype.toString.call(value) === `[object ${type}]`;\n}\n\nexport function isInstanceOf<T extends Function = any>(value: unknown, reference: T): value is T {\n try {\n return value instanceof reference;\n } catch (err) {\n return false;\n }\n}\n\nexport const isUndefined = ((value) => isTypeof(value, 'undefined')) as IsFnHelper<undefined>;\n\nexport const isNull = ((value) => isTypeof(value, 'null')) as IsFnHelper<null>;\n\nexport const isString = ((value) => isTypeof(value, 'string')) as IsFnHelper<string>;\n\nexport const isNumber = ((value) =>\n (isTypeof<number>(value, 'number') && !isNaN(value)) || isTypeof(value, 'bigint')) as IsFnHelper<number | bigint>;\n\nexport const isInt = ((value) => isNumber(value) && Number.isInteger(value)) as IsFnHelper<number>;\n\nexport const isBoolean = ((value) => isTypeof(value, 'boolean')) as IsFnHelper<boolean>;\n\nexport const isSymbol = ((value) => isTypeof(value, 'symbol')) as IsFnHelper<Symbol>;\n\nexport const isObject = ((value) => !isNull(value) && isTypeof(value, 'object')) as IsFnHelper<object>;\n\nexport const isFunction = ((value) => isTypeof(value, 'function')) as IsFnHelper<Function>;\n\nexport const isArray = ((value) => isToString(value, 'Array')) as IsFnHelper<unknown[]>;\n\nexport const isRegExp = ((value) => isToString(value, 'RegExp')) as IsFnHelper<string>;\n\nexport const isThenable = ((value) => isFunction((value as any)?.then)) as IsFnHelper<{ then: Function }>;\n\nexport const isPrimitive = ((value) => !isObject(value) && !isFunction(value)) as IsFnHelper<\n string | number | bigint | boolean | symbol\n>;\n\nexport const isEventDefined = typeof Event !== 'undefined';\n\nexport const isEvent = ((value) => isEventDefined && isInstanceOf(value, Event)) as IsFnHelper<Event>;\n\nexport const isErrorDefined = typeof Error !== 'undefined';\n\nexport const isError = ((value) => isErrorDefined && isInstanceOf(value, Error)) as IsFnHelper<Error>;\n\nexport const isErrorEvent = ((value) => isToString(value, 'ErrorEvent')) as IsFnHelper<ErrorEvent>;\n\nexport const isDomError = ((value) => isToString(value, 'DOMError')) as IsFnHelper<DOMException>;\n\nexport const isDomException = ((value) => isToString(value, 'DOMException')) as IsFnHelper<DOMException>;\n\nexport const isElementDefined = typeof Element !== 'undefined';\n\nexport const isElement = ((value) => isElementDefined && isInstanceOf(value, Element)) as IsFnHelper<Element>;\n\nexport const isMapDefined = typeof Map !== 'undefined';\n\nexport const isMap = ((value) => isMapDefined && isInstanceOf(value, Map)) as IsFnHelper<Map<any, any>>;\n\nexport const isSyntheticEvent = ((value) =>\n isObject(value) &&\n 'nativeEvent' in value &&\n 'preventDefault' in value &&\n 'stopPropagation' in value) as IsFnHelper<Event>;\n\nexport function isEmpty(value: any): boolean {\n if (value == null) {\n return true;\n }\n\n if (isArray(value) || isString(value)) {\n return value.length === 0;\n }\n\n if (isObject(value)) {\n return Object.keys(value).length === 0;\n }\n\n return false;\n}\n"]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var is_1 = require("./is");
4
+ describe('Meta API', function () {
5
+ beforeEach(function () {
6
+ jest.resetAllMocks();
7
+ jest.restoreAllMocks();
8
+ });
9
+ it('isEmpty() determines the empty state of a given value', function () {
10
+ expect((0, is_1.isEmpty)(null)).toBe(true);
11
+ expect((0, is_1.isEmpty)(undefined)).toBe(true);
12
+ expect((0, is_1.isEmpty)('')).toBe(true);
13
+ expect((0, is_1.isEmpty)([])).toBe(true);
14
+ expect((0, is_1.isEmpty)({})).toBe(true);
15
+ expect((0, is_1.isEmpty)(0)).toBe(false);
16
+ expect((0, is_1.isEmpty)('0')).toBe(false);
17
+ expect((0, is_1.isEmpty)([0])).toBe(false);
18
+ expect((0, is_1.isEmpty)({ key: 'value' })).toBe(false);
19
+ });
20
+ });
21
+ //# sourceMappingURL=is.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is.test.js","sourceRoot":"","sources":["../../../../../src/utils/is.test.ts"],"names":[],"mappings":";;AAAA,2BAA+B;AAE/B,QAAQ,CAAC,UAAU,EAAE;IACnB,UAAU,CAAC;QACT,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE;QAC3D,MAAM,CAAC,IAAA,YAAO,EAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,CAAC,IAAA,YAAO,EAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,CAAC,IAAA,YAAO,EAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,CAAC,IAAA,YAAO,EAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,CAAC,IAAA,YAAO,EAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE/B,MAAM,CAAC,IAAA,YAAO,EAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,MAAM,CAAC,IAAA,YAAO,EAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,MAAM,CAAC,IAAA,YAAO,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,MAAM,CAAC,IAAA,YAAO,EAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { isEmpty } from './is';\n\ndescribe('Meta API', () => {\n beforeEach(() => {\n jest.resetAllMocks();\n jest.restoreAllMocks();\n });\n\n it('isEmpty() determines the empty state of a given value', () => {\n expect(isEmpty(null)).toBe(true);\n expect(isEmpty(undefined)).toBe(true);\n expect(isEmpty('')).toBe(true);\n expect(isEmpty([])).toBe(true);\n expect(isEmpty({})).toBe(true);\n\n expect(isEmpty(0)).toBe(false);\n expect(isEmpty('0')).toBe(false);\n expect(isEmpty([0])).toBe(false);\n expect(isEmpty({ key: 'value' })).toBe(false);\n });\n});\n"]}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stringifyExternalJson = exports.getCircularDependencyReplacer = void 0;
4
+ function getCircularDependencyReplacer() {
5
+ var valueSeen = new WeakSet();
6
+ return function (_key, value) {
7
+ if (typeof value === 'object' && value !== null) {
8
+ if (valueSeen.has(value)) {
9
+ return null;
10
+ }
11
+ valueSeen.add(value);
12
+ }
13
+ return value;
14
+ };
15
+ }
16
+ exports.getCircularDependencyReplacer = getCircularDependencyReplacer;
17
+ function stringifyExternalJson(json) {
18
+ if (json === void 0) { json = {}; }
19
+ return JSON.stringify(json !== null && json !== void 0 ? json : {}, getCircularDependencyReplacer());
20
+ }
21
+ exports.stringifyExternalJson = stringifyExternalJson;
22
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../../../../src/utils/json.ts"],"names":[],"mappings":";;;AAAA,SAAgB,6BAA6B;IAC3C,IAAM,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;IAChC,OAAO,UAAU,IAAqB,EAAE,KAAc;QACpD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE;YAC/C,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBACxB,OAAO,IAAI,CAAC;aACb;YACD,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACtB;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AAXD,sEAWC;AAQD,SAAgB,qBAAqB,CAAC,IAAc;IAAd,qBAAA,EAAA,SAAc;IAClD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,EAAE,6BAA6B,EAAE,CAAC,CAAC;AACrE,CAAC;AAFD,sDAEC","sourcesContent":["export function getCircularDependencyReplacer() {\n const valueSeen = new WeakSet();\n return function (_key: string | Symbol, value: unknown) {\n if (typeof value === 'object' && value !== null) {\n if (valueSeen.has(value)) {\n return null;\n }\n valueSeen.add(value);\n }\n return value;\n };\n}\n\ntype JSONObject = {\n [key: string]: JSONValue;\n};\ntype JSONArray = JSONValue[] & {};\ntype JSONValue = string | number | boolean | null | JSONObject | JSONArray;\n\nexport function stringifyExternalJson(json: any = {}) {\n return JSON.stringify(json ?? {}, getCircularDependencyReplacer());\n}\n"]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var json_1 = require("./json");
4
+ describe('json', function () {
5
+ it('replace circular references with null value', function () {
6
+ var replacer = (0, json_1.getCircularDependencyReplacer)();
7
+ var obj = { a: 1 };
8
+ obj.circular = obj;
9
+ expect(JSON.stringify(obj, replacer)).toBe('{"a":1,"circular":null}');
10
+ });
11
+ it('stringifyExternalJson function replaces circular references with null value', function () {
12
+ var obj = { a: 1 };
13
+ obj.circular = obj;
14
+ expect((0, json_1.stringifyExternalJson)(obj)).toBe('{"a":1,"circular":null}');
15
+ });
16
+ });
17
+ //# sourceMappingURL=json.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.test.js","sourceRoot":"","sources":["../../../../../src/utils/json.test.ts"],"names":[],"mappings":";;AAAA,+BAA8E;AAE9E,QAAQ,CAAC,MAAM,EAAE;IACf,EAAE,CAAC,6CAA6C,EAAE;QAChD,IAAM,QAAQ,GAAG,IAAA,oCAA6B,GAAE,CAAC;QAEjD,IAAM,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QACpB,GAAW,CAAC,QAAQ,GAAG,GAAG,CAAC;QAE5B,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6EAA6E,EAAE;QAChF,IAAM,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QACpB,GAAW,CAAC,QAAQ,GAAG,GAAG,CAAC;QAE5B,MAAM,CAAC,IAAA,4BAAqB,EAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { getCircularDependencyReplacer, stringifyExternalJson } from './json';\n\ndescribe('json', () => {\n it('replace circular references with null value', () => {\n const replacer = getCircularDependencyReplacer();\n\n const obj = { a: 1 };\n (obj as any).circular = obj;\n\n expect(JSON.stringify(obj, replacer)).toBe('{\"a\":1,\"circular\":null}');\n });\n\n it('stringifyExternalJson function replaces circular references with null value', () => {\n const obj = { a: 1 };\n (obj as any).circular = obj;\n\n expect(stringifyExternalJson(obj)).toBe('{\"a\":1,\"circular\":null}');\n });\n});\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 = '1.12.3';
5
+ exports.VERSION = '1.13.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,QAAQ,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '1.12.3';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../src/version.ts"],"names":[],"mappings":";;;AAAA,sCAAsC;AACzB,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// auto-generated by bin/genVersion.ts\nexport const VERSION = '1.13.0';\n"]}
@@ -1 +1,2 @@
1
1
  export declare const defaultExceptionType = "Error";
2
+ export declare const defaultErrorArgsSerializer: (args: [any?, ...any[]]) => string;
@@ -1,3 +1,3 @@
1
- export { defaultExceptionType } from './const';
1
+ export { defaultExceptionType, defaultErrorArgsSerializer } from './const';
2
2
  export { initializeExceptionsAPI } from './initialize';
3
3
  export type { ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, PushErrorOptions, Stacktrace, StacktraceParser, ErrorWithIndexProperties, } from './types';
@@ -1,7 +1,7 @@
1
1
  export { initializeAPI } from './initialize';
2
2
  export type { API, APIEvent } from './types';
3
3
  export type { EventAttributes, EventEvent, EventsAPI, PushEventOptions } from './events';
4
- export { defaultExceptionType } from './exceptions';
4
+ export { defaultExceptionType, defaultErrorArgsSerializer } from './exceptions';
5
5
  export type { ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, PushErrorOptions, Stacktrace, StacktraceParser, } from './exceptions';
6
6
  export { defaultLogArgsSerializer } from './logs';
7
7
  export type { LogContext, LogEvent, LogArgsSerializer, LogsAPI, PushLogOptions } from './logs';