@grafana/faro-core 1.0.0-beta4 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/README.md +5 -4
  2. package/dist/bundle/faro-core.iife.js +1 -1
  3. package/dist/cjs/api/events/initialize.js +1 -1
  4. package/dist/cjs/api/events/initialize.js.map +1 -1
  5. package/dist/cjs/api/exceptions/initialize.js +1 -1
  6. package/dist/cjs/api/exceptions/initialize.js.map +1 -1
  7. package/dist/cjs/api/initialize.js +3 -3
  8. package/dist/cjs/api/initialize.js.map +1 -1
  9. package/dist/cjs/api/logs/initialize.js +1 -1
  10. package/dist/cjs/api/logs/initialize.js.map +1 -1
  11. package/dist/cjs/api/measurements/initialize.js +4 -3
  12. package/dist/cjs/api/measurements/initialize.js.map +1 -1
  13. package/dist/cjs/api/measurements/types.js.map +1 -1
  14. package/dist/cjs/api/meta/initialize.js +14 -1
  15. package/dist/cjs/api/meta/initialize.js.map +1 -1
  16. package/dist/cjs/api/meta/types.js.map +1 -1
  17. package/dist/cjs/api/traces/initialize.js +1 -1
  18. package/dist/cjs/api/traces/initialize.js.map +1 -1
  19. package/dist/cjs/config/types.js.map +1 -1
  20. package/dist/cjs/{utils/extensions.js → extensions/baseExtension.js} +15 -17
  21. package/dist/cjs/extensions/baseExtension.js.map +1 -0
  22. package/dist/cjs/extensions/index.js +6 -0
  23. package/dist/cjs/extensions/index.js.map +1 -0
  24. package/dist/cjs/extensions/types.js +3 -0
  25. package/dist/cjs/extensions/types.js.map +1 -0
  26. package/dist/cjs/index.js +12 -11
  27. package/dist/cjs/index.js.map +1 -1
  28. package/dist/cjs/initialize.js +11 -21
  29. package/dist/cjs/initialize.js.map +1 -1
  30. package/dist/cjs/instrumentations/base.js +6 -3
  31. package/dist/cjs/instrumentations/base.js.map +1 -1
  32. package/dist/cjs/instrumentations/index.js +3 -1
  33. package/dist/cjs/instrumentations/index.js.map +1 -1
  34. package/dist/cjs/instrumentations/initialize.js +8 -2
  35. package/dist/cjs/instrumentations/initialize.js.map +1 -1
  36. package/dist/cjs/instrumentations/registerInitial.js +9 -0
  37. package/dist/cjs/instrumentations/registerInitial.js.map +1 -0
  38. package/dist/cjs/instrumentations/types.js.map +1 -1
  39. package/dist/cjs/internalLogger/const.js.map +1 -1
  40. package/dist/cjs/internalLogger/createInternalLogger.js.map +1 -1
  41. package/dist/cjs/internalLogger/index.js +2 -1
  42. package/dist/cjs/internalLogger/index.js.map +1 -1
  43. package/dist/cjs/internalLogger/initialize.js.map +1 -1
  44. package/dist/cjs/metas/index.js +3 -1
  45. package/dist/cjs/metas/index.js.map +1 -1
  46. package/dist/cjs/metas/initialize.js +4 -30
  47. package/dist/cjs/metas/initialize.js.map +1 -1
  48. package/dist/cjs/metas/registerInitial.js +42 -0
  49. package/dist/cjs/metas/registerInitial.js.map +1 -0
  50. package/dist/cjs/metas/types.js.map +1 -1
  51. package/dist/cjs/sdk/faroGlobalObject.js.map +1 -1
  52. package/dist/cjs/sdk/index.js +3 -3
  53. package/dist/cjs/sdk/index.js.map +1 -1
  54. package/dist/cjs/sdk/internalFaroGlobalObject.js.map +1 -1
  55. package/dist/cjs/sdk/{register.js → registerFaro.js} +13 -3
  56. package/dist/cjs/sdk/registerFaro.js.map +1 -0
  57. package/dist/cjs/semantic.js +1 -0
  58. package/dist/cjs/semantic.js.map +1 -1
  59. package/dist/cjs/testUtils/mockConfig.js.map +1 -1
  60. package/dist/cjs/transports/base.js +2 -2
  61. package/dist/cjs/transports/base.js.map +1 -1
  62. package/dist/cjs/transports/index.js +3 -1
  63. package/dist/cjs/transports/index.js.map +1 -1
  64. package/dist/cjs/transports/initialize.js +5 -4
  65. package/dist/cjs/transports/initialize.js.map +1 -1
  66. package/dist/cjs/transports/registerInitial.js +11 -0
  67. package/dist/cjs/transports/registerInitial.js.map +1 -0
  68. package/dist/cjs/transports/types.js.map +1 -1
  69. package/dist/cjs/unpatchedConsole/initialize.js.map +1 -1
  70. package/dist/cjs/utils/index.js +1 -3
  71. package/dist/cjs/utils/index.js.map +1 -1
  72. package/dist/cjs/utils/shortId.js.map +1 -1
  73. package/dist/cjs/version.js +1 -1
  74. package/dist/cjs/version.js.map +1 -1
  75. package/dist/esm/api/events/initialize.js +1 -1
  76. package/dist/esm/api/events/initialize.js.map +1 -1
  77. package/dist/esm/api/exceptions/initialize.js +1 -1
  78. package/dist/esm/api/exceptions/initialize.js.map +1 -1
  79. package/dist/esm/api/initialize.js +3 -3
  80. package/dist/esm/api/initialize.js.map +1 -1
  81. package/dist/esm/api/logs/initialize.js +1 -1
  82. package/dist/esm/api/logs/initialize.js.map +1 -1
  83. package/dist/esm/api/measurements/initialize.js +4 -3
  84. package/dist/esm/api/measurements/initialize.js.map +1 -1
  85. package/dist/esm/api/measurements/types.js.map +1 -1
  86. package/dist/esm/api/meta/initialize.js +14 -1
  87. package/dist/esm/api/meta/initialize.js.map +1 -1
  88. package/dist/esm/api/meta/types.js.map +1 -1
  89. package/dist/esm/api/traces/initialize.js +1 -1
  90. package/dist/esm/api/traces/initialize.js.map +1 -1
  91. package/dist/esm/config/types.js.map +1 -1
  92. package/dist/esm/extensions/baseExtension.js +23 -0
  93. package/dist/esm/extensions/baseExtension.js.map +1 -0
  94. package/dist/esm/extensions/index.js +2 -0
  95. package/dist/esm/extensions/index.js.map +1 -0
  96. package/dist/esm/extensions/types.js +2 -0
  97. package/dist/esm/extensions/types.js.map +1 -0
  98. package/dist/esm/index.js +4 -3
  99. package/dist/esm/index.js.map +1 -1
  100. package/dist/esm/initialize.js +14 -23
  101. package/dist/esm/initialize.js.map +1 -1
  102. package/dist/esm/instrumentations/base.js +6 -1
  103. package/dist/esm/instrumentations/base.js.map +1 -1
  104. package/dist/esm/instrumentations/index.js +1 -0
  105. package/dist/esm/instrumentations/index.js.map +1 -1
  106. package/dist/esm/instrumentations/initialize.js +8 -2
  107. package/dist/esm/instrumentations/initialize.js.map +1 -1
  108. package/dist/esm/instrumentations/registerInitial.js +4 -0
  109. package/dist/esm/instrumentations/registerInitial.js.map +1 -0
  110. package/dist/esm/instrumentations/types.js.map +1 -1
  111. package/dist/esm/internalLogger/const.js.map +1 -1
  112. package/dist/esm/internalLogger/createInternalLogger.js.map +1 -1
  113. package/dist/esm/internalLogger/index.js +1 -1
  114. package/dist/esm/internalLogger/index.js.map +1 -1
  115. package/dist/esm/internalLogger/initialize.js.map +1 -1
  116. package/dist/esm/metas/index.js +1 -0
  117. package/dist/esm/metas/index.js.map +1 -1
  118. package/dist/esm/metas/initialize.js +4 -18
  119. package/dist/esm/metas/initialize.js.map +1 -1
  120. package/dist/esm/metas/registerInitial.js +25 -0
  121. package/dist/esm/metas/registerInitial.js.map +1 -0
  122. package/dist/esm/metas/types.js.map +1 -1
  123. package/dist/esm/sdk/faroGlobalObject.js.map +1 -1
  124. package/dist/esm/sdk/index.js +1 -1
  125. package/dist/esm/sdk/index.js.map +1 -1
  126. package/dist/esm/sdk/internalFaroGlobalObject.js.map +1 -1
  127. package/dist/esm/sdk/registerFaro.js +21 -0
  128. package/dist/esm/sdk/registerFaro.js.map +1 -0
  129. package/dist/esm/semantic.js +1 -0
  130. package/dist/esm/semantic.js.map +1 -1
  131. package/dist/esm/testUtils/mockConfig.js.map +1 -1
  132. package/dist/esm/transports/base.js +1 -1
  133. package/dist/esm/transports/base.js.map +1 -1
  134. package/dist/esm/transports/index.js +1 -0
  135. package/dist/esm/transports/index.js.map +1 -1
  136. package/dist/esm/transports/initialize.js +5 -4
  137. package/dist/esm/transports/initialize.js.map +1 -1
  138. package/dist/esm/transports/registerInitial.js +6 -0
  139. package/dist/esm/transports/registerInitial.js.map +1 -0
  140. package/dist/esm/transports/types.js.map +1 -1
  141. package/dist/esm/unpatchedConsole/initialize.js.map +1 -1
  142. package/dist/esm/utils/index.js +0 -1
  143. package/dist/esm/utils/index.js.map +1 -1
  144. package/dist/esm/utils/shortId.js.map +1 -1
  145. package/dist/esm/version.js +1 -1
  146. package/dist/esm/version.js.map +1 -1
  147. package/dist/types/api/events/initialize.d.ts +2 -1
  148. package/dist/types/api/exceptions/initialize.d.ts +2 -1
  149. package/dist/types/api/initialize.d.ts +2 -1
  150. package/dist/types/api/logs/initialize.d.ts +2 -1
  151. package/dist/types/api/measurements/initialize.d.ts +2 -1
  152. package/dist/types/api/measurements/types.d.ts +2 -1
  153. package/dist/types/api/meta/initialize.d.ts +2 -1
  154. package/dist/types/api/meta/types.d.ts +5 -3
  155. package/dist/types/api/traces/initialize.d.ts +2 -1
  156. package/dist/types/config/types.d.ts +2 -1
  157. package/dist/types/extensions/baseExtension.d.ts +15 -0
  158. package/dist/types/extensions/index.d.ts +2 -0
  159. package/dist/types/extensions/types.d.ts +16 -0
  160. package/dist/types/index.d.ts +7 -5
  161. package/dist/types/instrumentations/base.d.ts +5 -1
  162. package/dist/types/instrumentations/index.d.ts +1 -0
  163. package/dist/types/instrumentations/initialize.d.ts +5 -1
  164. package/dist/types/instrumentations/registerInitial.d.ts +2 -0
  165. package/dist/types/instrumentations/types.d.ts +5 -1
  166. package/dist/types/internalLogger/index.d.ts +1 -1
  167. package/dist/types/metas/index.d.ts +2 -1
  168. package/dist/types/metas/initialize.d.ts +2 -1
  169. package/dist/types/metas/registerInitial.d.ts +2 -0
  170. package/dist/types/metas/types.d.ts +6 -1
  171. package/dist/types/sdk/index.d.ts +1 -1
  172. package/dist/types/sdk/registerFaro.d.ts +10 -0
  173. package/dist/types/semantic.d.ts +1 -0
  174. package/dist/types/testUtils/mockTransport.d.ts +1 -1
  175. package/dist/types/transports/base.d.ts +1 -1
  176. package/dist/types/transports/index.d.ts +1 -0
  177. package/dist/types/transports/initialize.d.ts +3 -1
  178. package/dist/types/transports/registerInitial.d.ts +2 -0
  179. package/dist/types/transports/types.d.ts +1 -1
  180. package/dist/types/utils/index.d.ts +0 -2
  181. package/dist/types/version.d.ts +1 -1
  182. package/package.json +4 -4
  183. package/dist/cjs/sdk/register.js.map +0 -1
  184. package/dist/cjs/utils/extensions.js.map +0 -1
  185. package/dist/esm/sdk/register.js +0 -11
  186. package/dist/esm/sdk/register.js.map +0 -1
  187. package/dist/esm/utils/extensions.js +0 -23
  188. package/dist/esm/utils/extensions.js.map +0 -1
  189. package/dist/types/sdk/register.d.ts +0 -4
  190. package/dist/types/utils/extensions.d.ts +0 -19
@@ -9,33 +9,23 @@ var sdk_1 = require("./sdk");
9
9
  var transports_1 = require("./transports");
10
10
  var unpatchedConsole_1 = require("./unpatchedConsole");
11
11
  function initializeFaro(config) {
12
- var _a;
13
12
  var unpatchedConsole = (0, unpatchedConsole_1.initializeUnpatchedConsole)(config);
14
13
  var internalLogger = (0, internalLogger_1.initializeInternalLogger)(unpatchedConsole, config);
15
- internalLogger.debug('Initializing');
16
14
  if ((0, sdk_1.isInternalFaroOnGlobalObject)() && !config.isolate) {
17
15
  internalLogger.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');
18
16
  return undefined;
19
17
  }
20
- var metas = (0, metas_1.initializeMetas)(internalLogger, config);
21
- var transports = (0, transports_1.initializeTransports)(internalLogger, config);
22
- var api = (0, api_1.initializeAPI)(internalLogger, config, transports, metas);
23
- if (config.session) {
24
- api.setSession(config.session);
25
- }
26
- var faro = (0, sdk_1.registerFaro)(internalLogger, {
27
- api: api,
28
- config: config,
29
- internalLogger: internalLogger,
30
- metas: metas,
31
- pause: transports.pause,
32
- transports: transports,
33
- unpatchedConsole: unpatchedConsole,
34
- unpause: transports.unpause,
35
- instrumentations: (0, instrumentations_1.initializeInstrumentations)(internalLogger, config),
36
- });
37
- // make sure Faro is initialized before initializing instrumentations
38
- (_a = faro.instrumentations).add.apply(_a, config.instrumentations);
18
+ internalLogger.debug('Initializing');
19
+ // Initializing the APIs
20
+ var metas = (0, metas_1.initializeMetas)(unpatchedConsole, internalLogger, config);
21
+ var transports = (0, transports_1.initializeTransports)(unpatchedConsole, internalLogger, config, metas);
22
+ var api = (0, api_1.initializeAPI)(unpatchedConsole, internalLogger, config, metas, transports);
23
+ var instrumentations = (0, instrumentations_1.initializeInstrumentations)(unpatchedConsole, internalLogger, config, metas, transports, api);
24
+ var faro = (0, sdk_1.registerFaro)(unpatchedConsole, internalLogger, config, metas, transports, api, instrumentations);
25
+ // make sure Faro is initialized before registering default metas, instrumentations, transports etc.
26
+ (0, metas_1.registerInitialMetas)(faro);
27
+ (0, transports_1.registerInitialTransports)(faro);
28
+ (0, instrumentations_1.registerInitialInstrumentations)(faro);
39
29
  return faro;
40
30
  }
41
31
  exports.initializeFaro = initializeFaro;
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":";;;AAAA,6BAAsC;AAEtC,uDAAgE;AAChE,mDAA4D;AAC5D,iCAA0C;AAE1C,6BAAmE;AACnE,2CAAoD;AACpD,uDAAgE;AAEhE,SAAgB,cAAc,CAAC,MAAc;;IAC3C,IAAM,gBAAgB,GAAG,IAAA,6CAA0B,EAAC,MAAM,CAAC,CAAC;IAC5D,IAAM,cAAc,GAAG,IAAA,yCAAwB,EAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAE1E,cAAc,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAErC,IAAI,IAAA,kCAA4B,GAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACrD,cAAc,CAAC,KAAK,CAClB,oIAAoI,CACrI,CAAC;QAEF,OAAO,SAAU,CAAC;KACnB;IAED,IAAM,KAAK,GAAG,IAAA,uBAAe,EAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IACtD,IAAM,UAAU,GAAG,IAAA,iCAAoB,EAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IAChE,IAAM,GAAG,GAAG,IAAA,mBAAa,EAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAErE,IAAI,MAAM,CAAC,OAAO,EAAE;QAClB,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;KAChC;IAED,IAAM,IAAI,GAAG,IAAA,kBAAY,EAAC,cAAc,EAAE;QACxC,GAAG,KAAA;QACH,MAAM,QAAA;QACN,cAAc,gBAAA;QACd,KAAK,OAAA;QACL,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,UAAU,YAAA;QACV,gBAAgB,kBAAA;QAChB,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,gBAAgB,EAAE,IAAA,6CAA0B,EAAC,cAAc,EAAE,MAAM,CAAC;KACrE,CAAC,CAAC;IAEH,qEAAqE;IACrE,CAAA,KAAA,IAAI,CAAC,gBAAgB,CAAA,CAAC,GAAG,WAAI,MAAM,CAAC,gBAAgB,EAAE;IAEtD,OAAO,IAAI,CAAC;AACd,CAAC;AAtCD,wCAsCC","sourcesContent":["import { initializeAPI } from './api';\nimport type { Config } from './config';\nimport { initializeInstrumentations } from './instrumentations';\nimport { initializeInternalLogger } from './internalLogger';\nimport { initializeMetas } from './metas';\nimport type { Faro } from './sdk';\nimport { isInternalFaroOnGlobalObject, registerFaro } from './sdk';\nimport { initializeTransports } from './transports';\nimport { initializeUnpatchedConsole } from './unpatchedConsole';\n\nexport function initializeFaro(config: Config): Faro {\n const unpatchedConsole = initializeUnpatchedConsole(config);\n const internalLogger = initializeInternalLogger(unpatchedConsole, config);\n\n internalLogger.debug('Initializing');\n\n if (isInternalFaroOnGlobalObject() && !config.isolate) {\n internalLogger.error(\n 'Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the \"isolate\" property'\n );\n\n return undefined!;\n }\n\n const metas = initializeMetas(internalLogger, config);\n const transports = initializeTransports(internalLogger, config);\n const api = initializeAPI(internalLogger, config, transports, metas);\n\n if (config.session) {\n api.setSession(config.session);\n }\n\n const faro = registerFaro(internalLogger, {\n api,\n config,\n internalLogger,\n metas,\n pause: transports.pause,\n transports,\n unpatchedConsole,\n unpause: transports.unpause,\n instrumentations: initializeInstrumentations(internalLogger, config),\n });\n\n // make sure Faro is initialized before initializing instrumentations\n faro.instrumentations.add(...config.instrumentations);\n\n return faro;\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../src/initialize.ts"],"names":[],"mappings":";;;AAAA,6BAAsC;AAEtC,uDAAiG;AACjG,mDAA4D;AAC5D,iCAAgE;AAChE,6BAAmE;AAEnE,2CAA+E;AAC/E,uDAAgE;AAEhE,SAAgB,cAAc,CAAC,MAAc;IAC3C,IAAM,gBAAgB,GAAG,IAAA,6CAA0B,EAAC,MAAM,CAAC,CAAC;IAC5D,IAAM,cAAc,GAAG,IAAA,yCAAwB,EAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAE1E,IAAI,IAAA,kCAA4B,GAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACrD,cAAc,CAAC,KAAK,CAClB,oIAAoI,CACrI,CAAC;QAEF,OAAO,SAAU,CAAC;KACnB;IAED,cAAc,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAErC,wBAAwB;IACxB,IAAM,KAAK,GAAG,IAAA,uBAAe,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IACxE,IAAM,UAAU,GAAG,IAAA,iCAAoB,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACzF,IAAM,GAAG,GAAG,IAAA,mBAAa,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IACvF,IAAM,gBAAgB,GAAG,IAAA,6CAA0B,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;IACtH,IAAM,IAAI,GAAG,IAAA,kBAAY,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAE9G,oGAAoG;IACpG,IAAA,4BAAoB,EAAC,IAAI,CAAC,CAAC;IAC3B,IAAA,sCAAyB,EAAC,IAAI,CAAC,CAAC;IAChC,IAAA,kDAA+B,EAAC,IAAI,CAAC,CAAC;IAEtC,OAAO,IAAI,CAAC;AACd,CAAC;AA3BD,wCA2BC","sourcesContent":["import { initializeAPI } from './api';\nimport type { Config } from './config';\nimport { initializeInstrumentations, registerInitialInstrumentations } from './instrumentations';\nimport { initializeInternalLogger } from './internalLogger';\nimport { initializeMetas, registerInitialMetas } from './metas';\nimport { isInternalFaroOnGlobalObject, registerFaro } from './sdk';\nimport type { Faro } from './sdk';\nimport { initializeTransports, registerInitialTransports } from './transports';\nimport { initializeUnpatchedConsole } from './unpatchedConsole';\n\nexport function initializeFaro(config: Config): Faro {\n const unpatchedConsole = initializeUnpatchedConsole(config);\n const internalLogger = initializeInternalLogger(unpatchedConsole, config);\n\n if (isInternalFaroOnGlobalObject() && !config.isolate) {\n internalLogger.error(\n 'Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the \"isolate\" property'\n );\n\n return undefined!;\n }\n\n internalLogger.debug('Initializing');\n\n // Initializing the APIs\n const metas = initializeMetas(unpatchedConsole, internalLogger, config);\n const transports = initializeTransports(unpatchedConsole, internalLogger, config, metas);\n const api = initializeAPI(unpatchedConsole, internalLogger, config, metas, transports);\n const instrumentations = initializeInstrumentations(unpatchedConsole, internalLogger, config, metas, transports, api);\n const faro = registerFaro(unpatchedConsole, internalLogger, config, metas, transports, api, instrumentations);\n\n // make sure Faro is initialized before registering default metas, instrumentations, transports etc.\n registerInitialMetas(faro);\n registerInitialTransports(faro);\n registerInitialInstrumentations(faro);\n\n return faro;\n}\n"]}
@@ -16,13 +16,16 @@ var __extends = (this && this.__extends) || (function () {
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.BaseInstrumentation = void 0;
19
- var utils_1 = require("../utils");
19
+ var extensions_1 = require("../extensions");
20
20
  var BaseInstrumentation = /** @class */ (function (_super) {
21
21
  __extends(BaseInstrumentation, _super);
22
22
  function BaseInstrumentation() {
23
- return _super !== null && _super.apply(this, arguments) || this;
23
+ var _this = _super !== null && _super.apply(this, arguments) || this;
24
+ _this.api = {};
25
+ _this.transports = {};
26
+ return _this;
24
27
  }
25
28
  return BaseInstrumentation;
26
- }(utils_1.BaseExtension));
29
+ }(extensions_1.BaseExtension));
27
30
  exports.BaseInstrumentation = BaseInstrumentation;
28
31
  //# sourceMappingURL=base.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/instrumentations/base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,kCAAyC;AAGzC;IAAkD,uCAAa;IAA/D;;IAEA,CAAC;IAAD,0BAAC;AAAD,CAAC,AAFD,CAAkD,qBAAa,GAE9D;AAFqB,kDAAmB","sourcesContent":["import { BaseExtension } from '../utils';\nimport type { Instrumentation } from './types';\n\nexport abstract class BaseInstrumentation extends BaseExtension implements Instrumentation {\n abstract initialize(): void;\n}\n"]}
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/instrumentations/base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,4CAA8C;AAK9C;IAAkD,uCAAa;IAA/D;QAAA,qEAKC;QAJC,SAAG,GAAQ,EAAS,CAAC;QACrB,gBAAU,GAAe,EAAgB,CAAC;;IAG5C,CAAC;IAAD,0BAAC;AAAD,CAAC,AALD,CAAkD,0BAAa,GAK9D;AALqB,kDAAmB","sourcesContent":["import type { API } from '../api';\nimport { BaseExtension } from '../extensions';\nimport type { Transports } from '../transports';\n\nimport type { Instrumentation } from './types';\n\nexport abstract class BaseInstrumentation extends BaseExtension implements Instrumentation {\n api: API = {} as API;\n transports: Transports = {} as Transports;\n\n abstract initialize(): void;\n}\n"]}
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initializeInstrumentations = exports.BaseInstrumentation = void 0;
3
+ exports.registerInitialInstrumentations = exports.initializeInstrumentations = exports.BaseInstrumentation = void 0;
4
4
  var base_1 = require("./base");
5
5
  Object.defineProperty(exports, "BaseInstrumentation", { enumerable: true, get: function () { return base_1.BaseInstrumentation; } });
6
6
  var initialize_1 = require("./initialize");
7
7
  Object.defineProperty(exports, "initializeInstrumentations", { enumerable: true, get: function () { return initialize_1.initializeInstrumentations; } });
8
+ var registerInitial_1 = require("./registerInitial");
9
+ Object.defineProperty(exports, "registerInitialInstrumentations", { enumerable: true, get: function () { return registerInitial_1.registerInitialInstrumentations; } });
8
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/instrumentations/index.ts"],"names":[],"mappings":";;;AAAA,+BAA6C;AAApC,2GAAA,mBAAmB,OAAA;AAE5B,2CAA0D;AAAjD,wHAAA,0BAA0B,OAAA","sourcesContent":["export { BaseInstrumentation } from './base';\n\nexport { initializeInstrumentations } from './initialize';\n\nexport type { Instrumentation, Instrumentations } from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/instrumentations/index.ts"],"names":[],"mappings":";;;AAAA,+BAA6C;AAApC,2GAAA,mBAAmB,OAAA;AAE5B,2CAA0D;AAAjD,wHAAA,0BAA0B,OAAA;AAEnC,qDAAoE;AAA3D,kIAAA,+BAA+B,OAAA","sourcesContent":["export { BaseInstrumentation } from './base';\n\nexport { initializeInstrumentations } from './initialize';\n\nexport { registerInitialInstrumentations } from './registerInitial';\n\nexport type { Instrumentation, Instrumentations } from './types';\n"]}
@@ -10,7 +10,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.initializeInstrumentations = void 0;
13
- function initializeInstrumentations(internalLogger, _config) {
13
+ function initializeInstrumentations(unpatchedConsole, internalLogger, config, metas, transports, api) {
14
14
  internalLogger.debug('Initializing instrumentations');
15
15
  var instrumentations = [];
16
16
  var add = function () {
@@ -23,9 +23,15 @@ function initializeInstrumentations(internalLogger, _config) {
23
23
  internalLogger.debug("Adding \"".concat(newInstrumentation.name, "\" instrumentation"));
24
24
  var exists = instrumentations.some(function (existingInstrumentation) { return existingInstrumentation.name === newInstrumentation.name; });
25
25
  if (exists) {
26
- internalLogger.warn("Transport ".concat(newInstrumentation.name, " is already added"));
26
+ internalLogger.warn("Instrumentation ".concat(newInstrumentation.name, " is already added"));
27
27
  return;
28
28
  }
29
+ newInstrumentation.unpatchedConsole = unpatchedConsole;
30
+ newInstrumentation.internalLogger = internalLogger;
31
+ newInstrumentation.config = config;
32
+ newInstrumentation.metas = metas;
33
+ newInstrumentation.transports = transports;
34
+ newInstrumentation.api = api;
29
35
  instrumentations.push(newInstrumentation);
30
36
  newInstrumentation.initialize();
31
37
  });
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/instrumentations/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,SAAgB,0BAA0B,CAAC,cAA8B,EAAE,OAAe;IACxF,cAAc,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAEtD,IAAM,gBAAgB,GAAsB,EAAE,CAAC;IAE/C,IAAM,GAAG,GAA4B;QAAC,6BAAsB;aAAtB,UAAsB,EAAtB,qBAAsB,EAAtB,IAAsB;YAAtB,wCAAsB;;QAC1D,cAAc,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAEhD,mBAAmB,CAAC,OAAO,CAAC,UAAC,kBAAkB;YAC7C,cAAc,CAAC,KAAK,CAAC,mBAAW,kBAAkB,CAAC,IAAI,uBAAmB,CAAC,CAAC;YAE5E,IAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAClC,UAAC,uBAAuB,IAAK,OAAA,uBAAuB,CAAC,IAAI,KAAK,kBAAkB,CAAC,IAAI,EAAxD,CAAwD,CACtF,CAAC;YAEF,IAAI,MAAM,EAAE;gBACV,cAAc,CAAC,IAAI,CAAC,oBAAa,kBAAkB,C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ger } from '../internalLogger';\nimport type { Instrumentation, Instrumentations } from './types';\n\nexport function initializeInstrumentations(internalLogger: InternalLogger, _config: Config): Instrumentations {\n internalLogger.debug('Initializing instrumentations');\n\n const instrumentations: Instrumentation[] = [];\n\n const add: Instrumentations['add'] = (...newInstrumentations) => {\n internalLogger.debug('Adding instrumentations');\n\n newInstrumentations.forEach((newInstrumentation) => {\n internalLogger.debug(`Adding \"${newInstrumentation.name}\" instrumentation`);\n\n const exists = instrumentations.some(\n (existingInstrumentation) => existingInstrumentation.name === newInstrumentation.name\n );\n\n if (exists) {\n internalLogger.warn(`Transport ${newInstrumentation.name} is already added`);\n\n return;\n }\n\n instrumentations.push(newInstrumentation);\n newInstrumentation.initialize();\n });\n };\n\n const remove: Instrumentations['remove'] = (...instrumentationsToRemove) => {\n internalLogger.debug('Removing instrumentations');\n\n instrumentationsToRemove.forEach((instrumentationToRemove) => {\n internalLogger.debug(`Removing \"${instrumentationToRemove.name}\" instrumentation`);\n\n const existingInstrumentationIndex = instrumentations.reduce<number | null>(\n (acc, existingInstrumentation, existingTransportIndex) => {\n if (acc === null && existingInstrumentation.name === instrumentationToRemove.name) {\n return existingTransportIndex;\n }\n\n return null;\n },\n null\n );\n\n if (!existingInstrumentationIndex) {\n internalLogger.warn(`Instrumentation \"${instrumentationToRemove.name}\" is not added`);\n\n return;\n }\n\n instrumentations[existingInstrumentationIndex]!.destroy?.();\n instrumentations.splice(existingInstrumentationIndex, 1);\n });\n };\n\n return {\n add,\n get instrumentations() {\n return [...instrumentations];\n },\n remove,\n };\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/instrumentations/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;AASA,SAAgB,0BAA0B,CACxC,gBAAkC,EAClC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB,EACtB,GAAQ;IAER,cAAc,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAEtD,IAAM,gBAAgB,GAA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AI,uBAAmB,CAAC,CAAC;YAEnF,IAAM,4BAA4B,GAAG,gBAAgB,CAAC,MAAM,CAC1D,UAAC,GAAG,EAAE,uBAAuB,EAAE,sBAAsB;gBACnD,IAAI,GAAG,KAAK,IAAI,IAAI,uBAAuB,CAAC,IAAI,KAAK,uBAAuB,CAAC,IAAI,EAAE;oBACjF,OAAO,sBAAsB,CAAC;iBAC/B;gBAED,OAAO,IAAI,CAAC;YACd,CAAC,EACD,IAAI,CACL,CAAC;YAEF,IAAI,CAAC,4BAA4B,EAAE;gBACjC,cAAc,CAAC,IAAI,CAAC,4BAAoB,uBAAuB,CAAC,IAAI,oBAAgB,CAAC,CAAC;gBAEtF,OAAO;aACR;YAED,MAAA,MAAA,gBAAgB,CAAC,4BAA4B,CAAE,EAAC,OAAO,kDAAI,CAAC;YAE5D,gBAAgB,CAAC,MAAM,CAAC,4BAA4B,EAAE,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;QACL,GAAG,KAAA;QACH,IAAI,gBAAgB;YAClB,yBAAW,gBAAgB,QAAE;QAC/B,CAAC;QACD,MAAM,QAAA;KACP,CAAC;AACJ,CAAC;AA7ED,gEA6EC","sourcesContent":["import type { API } from '../api';\nimport type { Config } from '../config';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { Transports } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nimport type { Instrumentation, Instrumentations } from './types';\n\nexport function initializeInstrumentations(\n unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports,\n api: API\n): Instrumentations {\n internalLogger.debug('Initializing instrumentations');\n\n const instrumentations: Instrumentation[] = [];\n\n const add: Instrumentations['add'] = (...newInstrumentations) => {\n internalLogger.debug('Adding instrumentations');\n\n newInstrumentations.forEach((newInstrumentation) => {\n internalLogger.debug(`Adding \"${newInstrumentation.name}\" instrumentation`);\n\n const exists = instrumentations.some(\n (existingInstrumentation) => existingInstrumentation.name === newInstrumentation.name\n );\n\n if (exists) {\n internalLogger.warn(`Instrumentation ${newInstrumentation.name} is already added`);\n\n return;\n }\n\n newInstrumentation.unpatchedConsole = unpatchedConsole;\n newInstrumentation.internalLogger = internalLogger;\n newInstrumentation.config = config;\n newInstrumentation.metas = metas;\n newInstrumentation.transports = transports;\n newInstrumentation.api = api;\n\n instrumentations.push(newInstrumentation);\n\n newInstrumentation.initialize();\n });\n };\n\n const remove: Instrumentations['remove'] = (...instrumentationsToRemove) => {\n internalLogger.debug('Removing instrumentations');\n\n instrumentationsToRemove.forEach((instrumentationToRemove) => {\n internalLogger.debug(`Removing \"${instrumentationToRemove.name}\" instrumentation`);\n\n const existingInstrumentationIndex = instrumentations.reduce<number | null>(\n (acc, existingInstrumentation, existingTransportIndex) => {\n if (acc === null && existingInstrumentation.name === instrumentationToRemove.name) {\n return existingTransportIndex;\n }\n\n return null;\n },\n null\n );\n\n if (!existingInstrumentationIndex) {\n internalLogger.warn(`Instrumentation \"${instrumentationToRemove.name}\" is not added`);\n\n return;\n }\n\n instrumentations[existingInstrumentationIndex]!.destroy?.();\n\n instrumentations.splice(existingInstrumentationIndex, 1);\n });\n };\n\n return {\n add,\n get instrumentations() {\n return [...instrumentations];\n },\n remove,\n };\n}\n"]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerInitialInstrumentations = void 0;
4
+ function registerInitialInstrumentations(faro) {
5
+ var _a;
6
+ (_a = faro.instrumentations).add.apply(_a, faro.config.instrumentations);
7
+ }
8
+ exports.registerInitialInstrumentations = registerInitialInstrumentations;
9
+ //# sourceMappingURL=registerInitial.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerInitial.js","sourceRoot":"","sources":["../../../src/instrumentations/registerInitial.ts"],"names":[],"mappings":";;;AAEA,SAAgB,+BAA+B,CAAC,IAAU;;IACxD,CAAA,KAAA,IAAI,CAAC,gBAAgB,CAAA,CAAC,GAAG,WAAI,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE;AAC7D,CAAC;AAFD,0EAEC","sourcesContent":["import type { Faro } from '../sdk';\n\nexport function registerInitialInstrumentations(faro: Faro): void {\n faro.instrumentations.add(...faro.config.instrumentations);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/instrumentations/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Extension } from '../utils';\n\nexport interface Instrumentation extends Extension {\n initialize: VoidFunction;\n\n destroy?: VoidFunction;\n}\n\nexport interface Instrumentations {\n add: (...instrumentations: Instrumentation[]) => void;\n instrumentations: Instrumentation[];\n remove: (...instrumentations: Instrumentation[]) => void;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/instrumentations/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { API } from '../api';\nimport type { Extension } from '../extensions';\nimport type { Transports } from '../transports';\n\nexport interface Instrumentation extends Extension {\n api: API;\n transports: Transports;\n\n initialize: VoidFunction;\n\n destroy?: VoidFunction;\n}\n\nexport interface Instrumentations {\n add: (...instrumentations: Instrumentation[]) => void;\n instrumentations: Instrumentation[];\n remove: (...instrumentations: Instrumentation[]) => void;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["../../../src/internalLogger/const.ts"],"names":[],"mappings":";;;AAAA,kCAAgC;AAGhC,IAAY,mBAMX;AAND,WAAY,mBAAmB;IAC7B,2DAAO,CAAA;IACP,+DAAS,CAAA;IACT,6DAAQ,CAAA;IACR,6DAAQ,CAAA;IACR,mEAAW,CAAA;AACb,CAAC,EANW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAM9B;AAEY,QAAA,2BAA2B,GAAG,MAAM,CAAC;AAErC,QAAA,qBAAqB,GAAmB;IACnD,KAAK,EAAE,YAAI;IACX,KAAK,EAAE,YAAI;IACX,IAAI,EAAE,YAAI;IACV,MAAM,EAAE,mCAA2B;IACnC,IAAI,EAAE,YAAI;CACF,CAAC;AAEE,QAAA,0BAA0B,GAAG,mBAAmB,CAAC,KAAK,CAAC","sourcesContent":["import { noop } from '../utils';\nimport type { InternalLogger } from './types';\n\nexport enum InternalLoggerLevel {\n OFF = 0,\n ERROR = 1,\n WARN = 2,\n INFO = 3,\n VERBOSE = 4,\n}\n\nexport const defaultInternalLoggerPrefix = 'Faro';\n\nexport const defaultInternalLogger: InternalLogger = {\n debug: noop,\n error: noop,\n info: noop,\n prefix: defaultInternalLoggerPrefix,\n warn: noop,\n} as const;\n\nexport const defaultInternalLoggerLevel = InternalLoggerLevel.ERROR;\n"]}
1
+ {"version":3,"file":"const.js","sourceRoot":"","sources":["../../../src/internalLogger/const.ts"],"names":[],"mappings":";;;AAAA,kCAAgC;AAIhC,IAAY,mBAMX;AAND,WAAY,mBAAmB;IAC7B,2DAAO,CAAA;IACP,+DAAS,CAAA;IACT,6DAAQ,CAAA;IACR,6DAAQ,CAAA;IACR,mEAAW,CAAA;AACb,CAAC,EANW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAM9B;AAEY,QAAA,2BAA2B,GAAG,MAAM,CAAC;AAErC,QAAA,qBAAqB,GAAmB;IACnD,KAAK,EAAE,YAAI;IACX,KAAK,EAAE,YAAI;IACX,IAAI,EAAE,YAAI;IACV,MAAM,EAAE,mCAA2B;IACnC,IAAI,EAAE,YAAI;CACF,CAAC;AAEE,QAAA,0BAA0B,GAAG,mBAAmB,CAAC,KAAK,CAAC","sourcesContent":["import { noop } from '../utils';\n\nimport type { InternalLogger } from './types';\n\nexport enum InternalLoggerLevel {\n OFF = 0,\n ERROR = 1,\n WARN = 2,\n INFO = 3,\n VERBOSE = 4,\n}\n\nexport const defaultInternalLoggerPrefix = 'Faro';\n\nexport const defaultInternalLogger: InternalLogger = {\n debug: noop,\n error: noop,\n info: noop,\n prefix: defaultInternalLoggerPrefix,\n warn: noop,\n} as const;\n\nexport const defaultInternalLoggerLevel = InternalLoggerLevel.ERROR;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"createInternalLogger.js","sourceRoot":"","sources":["../../../src/internalLogger/createInternalLogger.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wDAA8D;AAE9D,kCAAgC;AAChC,iCAAiG;AAGjG,SAAgB,oBAAoB,CAClC,gBAA4D,EAC5D,mBAAgD;IADhD,iCAAA,EAAA,mBAAqC,0CAAuB;IAC5D,oCAAA,EAAA,sBAAsB,kCAA0B;IAEhD,IAAM,cAAc,GAAG,6BAAqB,CAAC;IAE7C,IAAI,mBAAmB,GAAG,2BAAmB,CAAC,GAAG,EAAE;QACjD,cAAc,CAAC,KAAK;YAClB,mBAAmB,IAAI,2BAAmB,CAAC,KAAK;gBAC9C,CAAC,CAAC;oBAAU,cAAO;yBAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;wBAAP,yBAAO;;oBACf,gBAAgB,CAAC,KAAK,OAAtB,gBAAgB,iBAAO,UAAG,cAAc,CAAC,MAAM,OAAI,GAAK,IAAI,UAAE;gBAChE,CAAC;gBACH,CAAC,CAAC,YAAI,CAAC;QAEX,cAAc,CAAC,IAAI;YACjB,mBAAmB,IAAI,2BAAmB,CAAC,IAAI;gBAC7C,CAAC,CAAC;oBAAU,cAAO;yBAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;wBAAP,yBAAO;;oBACf,gBAAgB,CAAC,IAAI,OAArB,gBAAgB,iBAAM,UAAG,cAAc,CAAC,MAAM,OAAI,GAAK,IAAI,UAAE;gBAC/D,CAAC;gBACH,CAAC,CAAC,YAAI,CAAC;QAEX,cAAc,CAAC,IAAI;YACjB,mBAAmB,IAAI,2BAAmB,CAAC,IAAI;gBAC7C,CAAC,CAAC;oBAAU,cAAO;yBAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;wBAAP,yBAAO;;oBACf,gBAAgB,CAAC,IAAI,OAArB,gBAAgB,iBAAM,UAAG,cAAc,CAAC,MAAM,OAAI,GAAK,IAAI,UAAE;gBAC/D,CAAC;gBACH,CAAC,CAAC,YAAI,CAAC;QAEX,cAAc,CAAC,KAAK;YAClB,mBAAmB,IAAI,2BAAmB,CAAC,OAAO;gBAChD,CAAC,CAAC;oBAAU,cAAO;yBAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;wBAAP,yBAAO;;oBACf,gBAAgB,CAAC,KAAK,OAAtB,gBAAgB,iBAAO,UAAG,cAAc,CAAC,MAAM,OAAI,GAAK,IAAI,UAAE;gBAChE,CAAC;gBACH,CAAC,CAAC,YAAI,CAAC;KACZ;IAED,OAAO,cAAc,CAAC;AACxB,CAAC;AArCD,oDAqCC","sourcesContent":["import { defaultUnpatchedConsole } from '../unpatchedConsole';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\nimport { noop } from '../utils';\nimport { defaultInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './const';\nimport type { InternalLogger } from './types';\n\nexport function createInternalLogger(\n unpatchedConsole: UnpatchedConsole = defaultUnpatchedConsole,\n internalLoggerLevel = defaultInternalLoggerLevel\n): InternalLogger {\n const internalLogger = defaultInternalLogger;\n\n if (internalLoggerLevel > InternalLoggerLevel.OFF) {\n internalLogger.error =\n internalLoggerLevel >= InternalLoggerLevel.ERROR\n ? function (...args) {\n unpatchedConsole.error(`${internalLogger.prefix}\\n`, ...args);\n }\n : noop;\n\n internalLogger.warn =\n internalLoggerLevel >= InternalLoggerLevel.WARN\n ? function (...args) {\n unpatchedConsole.warn(`${internalLogger.prefix}\\n`, ...args);\n }\n : noop;\n\n internalLogger.info =\n internalLoggerLevel >= InternalLoggerLevel.INFO\n ? function (...args) {\n unpatchedConsole.info(`${internalLogger.prefix}\\n`, ...args);\n }\n : noop;\n\n internalLogger.debug =\n internalLoggerLevel >= InternalLoggerLevel.VERBOSE\n ? function (...args) {\n unpatchedConsole.debug(`${internalLogger.prefix}\\n`, ...args);\n }\n : noop;\n }\n\n return internalLogger;\n}\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,CAAC,YAAI,CAAC;QAEX,cAAc,CAAC,KAAK;YAClB,mBAAmB,IAAI,2BAAmB,CAAC,OAAO;gBAChD,CAAC,CAAC;oBAAU,cAAO;yBAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;wBAAP,yBAAO;;oBACf,gBAAgB,CAAC,KAAK,OAAtB,gBAAgB,iBAAO,UAAG,cAAc,CAAC,MAAM,OAAI,GAAK,IAAI,UAAE;gBAChE,CAAC;gBACH,CAAC,CAAC,YAAI,CAAC;KACZ;IAED,OAAO,cAAc,CAAC;AACxB,CAAC;AArCD,oDAqCC","sourcesContent":["import { defaultUnpatchedConsole } from '../unpatchedConsole';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\nimport { noop } from '../utils';\n\nimport { defaultInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './const';\nimport type { InternalLogger } from './types';\n\nexport function createInternalLogger(\n unpatchedConsole: UnpatchedConsole = defaultUnpatchedConsole,\n internalLoggerLevel = defaultInternalLoggerLevel\n): InternalLogger {\n const internalLogger = defaultInternalLogger;\n\n if (internalLoggerLevel > InternalLoggerLevel.OFF) {\n internalLogger.error =\n internalLoggerLevel >= InternalLoggerLevel.ERROR\n ? function (...args) {\n unpatchedConsole.error(`${internalLogger.prefix}\\n`, ...args);\n }\n : noop;\n\n internalLogger.warn =\n internalLoggerLevel >= InternalLoggerLevel.WARN\n ? function (...args) {\n unpatchedConsole.warn(`${internalLogger.prefix}\\n`, ...args);\n }\n : noop;\n\n internalLogger.info =\n internalLoggerLevel >= InternalLoggerLevel.INFO\n ? function (...args) {\n unpatchedConsole.info(`${internalLogger.prefix}\\n`, ...args);\n }\n : noop;\n\n internalLogger.debug =\n internalLoggerLevel >= InternalLoggerLevel.VERBOSE\n ? function (...args) {\n unpatchedConsole.debug(`${internalLogger.prefix}\\n`, ...args);\n }\n : noop;\n }\n\n return internalLogger;\n}\n"]}
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.internalLogger = exports.initializeInternalLogger = exports.createInternalLogger = exports.InternalLoggerLevel = exports.defaultInternalLoggerLevel = void 0;
3
+ exports.internalLogger = exports.initializeInternalLogger = exports.createInternalLogger = exports.InternalLoggerLevel = exports.defaultInternalLoggerLevel = exports.defaultInternalLogger = void 0;
4
4
  var const_1 = require("./const");
5
+ Object.defineProperty(exports, "defaultInternalLogger", { enumerable: true, get: function () { return const_1.defaultInternalLogger; } });
5
6
  Object.defineProperty(exports, "defaultInternalLoggerLevel", { enumerable: true, get: function () { return const_1.defaultInternalLoggerLevel; } });
6
7
  Object.defineProperty(exports, "InternalLoggerLevel", { enumerable: true, get: function () { return const_1.InternalLoggerLevel; } });
7
8
  var createInternalLogger_1 = require("./createInternalLogger");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internalLogger/index.ts"],"names":[],"mappings":";;;AAAA,iCAA0E;AAAjE,mHAAA,0BAA0B,OAAA;AAAE,4GAAA,mBAAmB,OAAA;AAExD,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAE7B,2CAAwE;AAA/D,sHAAA,wBAAwB,OAAA;AAAE,4GAAA,cAAc,OAAA","sourcesContent":["export { defaultInternalLoggerLevel, InternalLoggerLevel } from './const';\n\nexport { createInternalLogger } from './createInternalLogger';\n\nexport { initializeInternalLogger, internalLogger } from './initialize';\n\nexport type { InternalLogger } from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/internalLogger/index.ts"],"names":[],"mappings":";;;AAAA,iCAAiG;AAAxF,8GAAA,qBAAqB,OAAA;AAAE,mHAAA,0BAA0B,OAAA;AAAE,4GAAA,mBAAmB,OAAA;AAE/E,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAE7B,2CAAwE;AAA/D,sHAAA,wBAAwB,OAAA;AAAE,4GAAA,cAAc,OAAA","sourcesContent":["export { defaultInternalLogger, defaultInternalLoggerLevel, InternalLoggerLevel } from './const';\n\nexport { createInternalLogger } from './createInternalLogger';\n\nexport { initializeInternalLogger, internalLogger } from './initialize';\n\nexport type { InternalLogger } from './types';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/internalLogger/initialize.ts"],"names":[],"mappings":";;;AAEA,iCAAgD;AAChD,+DAA8D;AAGnD,QAAA,cAAc,GAAmB,6BAAqB,CAAC;AAElE,SAAgB,wBAAwB,CAAC,gBAAkC,EAAE,MAAc;IACzF,sBAAc,GAAG,IAAA,2CAAoB,EAAC,gBAAgB,EAAE,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAEpF,OAAO,sBAAc,CAAC;AACxB,CAAC;AAJD,4DAIC","sourcesContent":["import type { Config } from '../config';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\nimport { defaultInternalLogger } from './const';\nimport { createInternalLogger } from './createInternalLogger';\nimport type { InternalLogger } from './types';\n\nexport let internalLogger: InternalLogger = defaultInternalLogger;\n\nexport function initializeInternalLogger(unpatchedConsole: UnpatchedConsole, config: Config): InternalLogger {\n internalLogger = createInternalLogger(unpatchedConsole, config.internalLoggerLevel);\n\n return internalLogger;\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/internalLogger/initialize.ts"],"names":[],"mappings":";;;AAGA,iCAAgD;AAChD,+DAA8D;AAGnD,QAAA,cAAc,GAAmB,6BAAqB,CAAC;AAElE,SAAgB,wBAAwB,CAAC,gBAAkC,EAAE,MAAc;IACzF,sBAAc,GAAG,IAAA,2CAAoB,EAAC,gBAAgB,EAAE,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAEpF,OAAO,sBAAc,CAAC;AACxB,CAAC;AAJD,4DAIC","sourcesContent":["import type { Config } from '../config';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\n\nimport { defaultInternalLogger } from './const';\nimport { createInternalLogger } from './createInternalLogger';\nimport type { InternalLogger } from './types';\n\nexport let internalLogger: InternalLogger = defaultInternalLogger;\n\nexport function initializeInternalLogger(unpatchedConsole: UnpatchedConsole, config: Config): InternalLogger {\n internalLogger = createInternalLogger(unpatchedConsole, config.internalLoggerLevel);\n\n return internalLogger;\n}\n"]}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initializeMetas = void 0;
3
+ exports.registerInitialMetas = exports.initializeMetas = void 0;
4
4
  var initialize_1 = require("./initialize");
5
5
  Object.defineProperty(exports, "initializeMetas", { enumerable: true, get: function () { return initialize_1.initializeMetas; } });
6
+ var registerInitial_1 = require("./registerInitial");
7
+ Object.defineProperty(exports, "registerInitialMetas", { enumerable: true, get: function () { return registerInitial_1.registerInitialMetas; } });
6
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/metas/index.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAAtC,6GAAA,eAAe,OAAA","sourcesContent":["export { initializeMetas } from './initialize';\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} 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 MetaPage,\n Metas,\n MetaSDK,\n MetaSDKIntegration,\n MetaSession,\n MetaUser,\n MetaView,\n} from './types';\n"]}
@@ -1,19 +1,8 @@
1
1
  "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.initializeMetas = void 0;
13
4
  var utils_1 = require("../utils");
14
- var version_1 = require("../version");
15
- function initializeMetas(internalLogger, config) {
16
- var _a;
5
+ function initializeMetas(_unpatchedConsole, internalLogger, _config) {
17
6
  var items = [];
18
7
  var listeners = [];
19
8
  var getValue = function () { return items.reduce(function (acc, item) { return Object.assign(acc, (0, utils_1.isFunction)(item) ? item() : item); }, {}); };
@@ -41,28 +30,13 @@ function initializeMetas(internalLogger, config) {
41
30
  items = items.filter(function (currentItem) { return !itemsToRemove.includes(currentItem); });
42
31
  notifyListeners();
43
32
  };
44
- var initial = {
45
- sdk: {
46
- name: '@grafana/faro-core',
47
- version: version_1.VERSION,
48
- integrations: config.instrumentations.map(function (_a) {
49
- var name = _a.name, version = _a.version;
50
- return ({ name: name, version: version });
51
- }),
52
- },
53
- };
54
- if (config.app) {
55
- initial.app = config.app;
56
- }
57
- if (config.user) {
58
- initial.user = config.user;
59
- }
60
- add.apply(void 0, __spreadArray([initial], ((_a = config.metas) !== null && _a !== void 0 ? _a : []), false));
61
33
  var addListener = function (listener) {
34
+ internalLogger.debug('Adding metas listener\n', listener);
62
35
  listeners.push(listener);
63
36
  };
64
37
  var removeListener = function (listener) {
65
- listeners = listeners.filter(function (l) { return l !== listener; });
38
+ internalLogger.debug('Removing metas listener\n', listener);
39
+ listeners = listeners.filter(function (currentListener) { return currentListener !== listener; });
66
40
  };
67
41
  return {
68
42
  add: add,
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/metas/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,kCAAsC;AACtC,sCAAqC;AAGrC,SAAgB,e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AS;QACpB,GAAG,EAAE;YACH,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,iBAAO;YAChB,YAAY,EAAE,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAC,EAAiB;oBAAf,IAAI,UAAA,EAAE,OAAO,aAAA;gBAAO,OAAA,CAAC,EAAE,IAAI,MAAA,EAAE,OAAO,SAAA,EAAE,CAAC;YAAnB,CAAmB,CAAC;SACtF;KACF,CAAC;IAEF,IAAI,MAAM,CAAC,GAAG,EAAE;QACd,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;KAC1B;IAED,IAAI,MAAM,CAAC,IAAI,EAAE;QACf,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;KAC5B;IAED,GAAG,8BAAC,OAAO,GAAK,CAAC,MAAA,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAC,UAAE;IAEtC,IAAM,WAAW,GAAyB,UAAC,QAAQ;QACjD,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC,CAAC;IAEF,IAAM,cAAc,GAA4B,UAAC,QAAQ;QACvD,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,KAAK,QAAQ,EAAd,CAAc,CAAC,CAAC;IACtD,CAAC,CAAC;IAEF,OAAO;QACL,GAAG,KAAA;QACH,MAAM,QAAA;QACN,WAAW,aAAA;QACX,cAAc,gBAAA;QACd,IAAI,KAAK;YACP,OAAO,QAAQ,EAAE,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC;AA5DD,0CA4DC","sourcesContent":["import type { Config } from '../config';\nimport type { InternalLogger } from '../internalLogger';\nimport { isFunction } from '../utils';\nimport { VERSION } from '../version';\nimport type { Meta, MetaItem, Metas, MetasListener } from './types';\n\nexport function initializeMetas(internalLogger: InternalLogger, config: Config): Metas {\n let items: MetaItem[] = [];\n let listeners: MetasListener[] = [];\n\n const getValue = () => items.reduce<Meta>((acc, item) => Object.assign(acc, isFunction(item) ? item() : item), {});\n\n const notifyListeners = () => {\n if (listeners.length) {\n const value = getValue();\n listeners.forEach((listener) => listener(value));\n }\n };\n\n const add: Metas['add'] = (...newItems) => {\n internalLogger.debug('Adding metas\\n', newItems);\n items.push(...newItems);\n notifyListeners();\n };\n\n const remove: Metas['remove'] = (...itemsToRemove) => {\n internalLogger.debug('Removing metas\\n', itemsToRemove);\n items = items.filter((currentItem) => !itemsToRemove.includes(currentItem));\n notifyListeners();\n };\n\n const initial: Meta = {\n sdk: {\n name: '@grafana/faro-core',\n version: VERSION,\n integrations: config.instrumentations.map(({ name, version }) => ({ name, version })),\n },\n };\n\n if (config.app) {\n initial.app = config.app;\n }\n\n if (config.user) {\n initial.user = config.user;\n }\n\n add(initial, ...(config.metas ?? []));\n\n const addListener: Metas['addListener'] = (listener) => {\n listeners.push(listener);\n };\n\n const removeListener: Metas['removeListener'] = (listener) => {\n listeners = listeners.filter((l) => l !== listener);\n };\n\n return {\n add,\n remove,\n addListener,\n removeListener,\n get value() {\n return getValue();\n },\n };\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/metas/initialize.ts"],"names":[],"mappings":";;;AAGA,kCAAsC;AAItC,SAAgB,eAAe,CAC7B,iBAAmC,EACnC,cAA8B,EAC9B,OAAe;IAEf,IAAI,KAAK,GAAe,EAAE,CAAC;IAC3B,IAAI,SAAS,GAAoB,EAAE,CAAC;IAEpC,IAAM,QAAQ,GAAG,cAAM,OAAA,KAAK,CAAC,MAAM,CAAO,UAAC,GAAG,EAAE,IAAI,IAAK,OAAA,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,IAAA,kBAAU,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAApD,CAAoD,EAAE,EAAE,CAAC,EAA3F,CAA2F,CAAC;IAEnH,IAAM,eAAe,GAAG;QACtB,IAAI,SA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M,QAAA;QACN,WAAW,aAAA;QACX,cAAc,gBAAA;QACd,IAAI,KAAK;YACP,OAAO,QAAQ,EAAE,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC;AAvDD,0CAuDC","sourcesContent":["import type { Config } from '../config';\nimport type { InternalLogger } from '../internalLogger';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\nimport { isFunction } from '../utils';\n\nimport type { Meta, MetaItem, Metas, MetasListener } from './types';\n\nexport function initializeMetas(\n _unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n _config: Config\n): Metas {\n let items: MetaItem[] = [];\n let listeners: MetasListener[] = [];\n\n const getValue = () => items.reduce<Meta>((acc, item) => Object.assign(acc, isFunction(item) ? item() : item), {});\n\n const notifyListeners = () => {\n if (listeners.length) {\n const value = getValue();\n\n listeners.forEach((listener) => listener(value));\n }\n };\n\n const add: Metas['add'] = (...newItems) => {\n internalLogger.debug('Adding metas\\n', newItems);\n\n items.push(...newItems);\n\n notifyListeners();\n };\n\n const remove: Metas['remove'] = (...itemsToRemove) => {\n internalLogger.debug('Removing metas\\n', itemsToRemove);\n\n items = items.filter((currentItem) => !itemsToRemove.includes(currentItem));\n\n notifyListeners();\n };\n\n const addListener: Metas['addListener'] = (listener) => {\n internalLogger.debug('Adding metas listener\\n', listener);\n\n listeners.push(listener);\n };\n\n const removeListener: Metas['removeListener'] = (listener) => {\n internalLogger.debug('Removing metas listener\\n', listener);\n\n listeners = listeners.filter((currentListener) => currentListener !== listener);\n };\n\n return {\n add,\n remove,\n addListener,\n removeListener,\n get value() {\n return getValue();\n },\n };\n}\n"]}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.registerInitialMetas = void 0;
13
+ var version_1 = require("../version");
14
+ function registerInitialMetas(faro) {
15
+ var _a;
16
+ var _b;
17
+ var initial = {
18
+ sdk: {
19
+ name: '@grafana/faro-core',
20
+ version: version_1.VERSION,
21
+ integrations: faro.config.instrumentations.map(function (_a) {
22
+ var name = _a.name, version = _a.version;
23
+ return ({ name: name, version: version });
24
+ }),
25
+ },
26
+ };
27
+ if (faro.config.session) {
28
+ faro.api.setSession(faro.config.session);
29
+ }
30
+ if (faro.config.app) {
31
+ initial.app = faro.config.app;
32
+ }
33
+ if (faro.config.user) {
34
+ initial.user = faro.config.user;
35
+ }
36
+ if (faro.config.view) {
37
+ initial.view = faro.config.view;
38
+ }
39
+ (_a = faro.metas).add.apply(_a, __spreadArray([initial], ((_b = faro.config.metas) !== null && _b !== void 0 ? _b : []), false));
40
+ }
41
+ exports.registerInitialMetas = registerInitialMetas;
42
+ //# sourceMappingURL=registerInitial.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerInitial.js","sourceRoot":"","sources":["../../../src/metas/registerInitial.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,sCAAqC;AAIrC,SAAgB,oBAAoB,CAAC,IAAU;;;IAC7C,IAAM,OAAO,GAAS;QACpB,GAAG,EAAE;YACH,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,iBAAO;YAChB,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAC,EAAiB;oBAAf,IAAI,UAAA,EAAE,OAAO,aAAA;gBAAO,OAAA,CAAC,EAAE,IAAI,MAAA,EAAE,OAAO,SAAA,EAAE,CAAC;YAAnB,CAAmB,CAAC;SAC3F;KACF,CAAC;IAEF,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACvB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;KAC1C;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;QACnB,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;KAC/B;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;QACpB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;KACjC;IAED,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;QACpB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;KACjC;IAED,CAAA,KAAA,IAAI,CAAC,KAAK,CAAA,CAAC,GAAG,0BAAC,OAAO,GAAK,CAAC,MAAA,IAAI,CAAC,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAC,UAAE;AACxD,CAAC;AA1BD,oDA0BC","sourcesContent":["import type { Faro } from '../sdk';\nimport { VERSION } from '../version';\n\nimport type { Meta } from './types';\n\nexport function registerInitialMetas(faro: Faro): void {\n const initial: Meta = {\n sdk: {\n name: '@grafana/faro-core',\n version: VERSION,\n integrations: faro.config.instrumentations.map(({ name, version }) => ({ name, version })),\n },\n };\n\n if (faro.config.session) {\n faro.api.setSession(faro.config.session);\n }\n\n if (faro.config.app) {\n initial.app = faro.config.app;\n }\n\n if (faro.config.user) {\n initial.user = faro.config.user;\n }\n\n if (faro.config.view) {\n initial.view = faro.config.view;\n }\n\n faro.metas.add(initial, ...(faro.config.metas ?? []));\n}\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 release?: string;\n version?: string;\n environment?: 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 started?: string;\n attributes?: MetaAttributes;\n}\n\nexport interface MetaPage {\n id?: string;\n url?: string;\n attributes?: MetaAttributes;\n}\n\nexport interface MetaBrowser {\n name?: string;\n version?: string;\n os?: string;\n mobile?: boolean;\n}\n\nexport interface Meta {\n sdk?: MetaSDK;\n app?: MetaApp;\n user?: MetaUser;\n session?: MetaSession;\n page?: MetaPage;\n browser?: MetaBrowser;\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 release?: string;\n version?: string;\n environment?: 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\nexport interface MetaBrowser {\n name?: string;\n version?: string;\n os?: string;\n mobile?: boolean;\n userAgent?: string;\n language?: string;\n}\n\nexport interface MetaView {\n name: 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}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"faroGlobalObject.js","sourceRoot":"","sources":["../../../src/sdk/faroGlobalObject.ts"],"names":[],"mappings":";;;AAAA,gDAA+C;AAG/C,SAAgB,qBAAqB,CAAC,IAAU;IAC9C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,qBAAqB,EAAE;QACtC,IAAI,CAAC,cAAc,CAAC,KAAK,CACvB,wEAAgE,IAAI,CAAC,MAAM,CAAC,eAAe,WAAO,CACnG,CAAC;QAEF,IAAI,IAAI,CAAC,MAAM,CAAC,eAAe,IAAI,2BAAY,EAAE;YAC/C,IAAI,CAAC,cAAc,CAAC,IAAI,CACtB,oDAA4C,IAAI,CAAC,MAAM,CAAC,eAAe,yHAA+G,CACvL,CAAC;YAEF,OAAO;SACR;QAED,MAAM,CAAC,cAAc,CAAC,2BAAY,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE;YAC/D,YAAY,EAAE,KAAK;YACnB,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;KACJ;SAAM;QACL,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAC;KAC5F;AACH,CAAC;AAtBD,sDAsBC","sourcesContent":["import { globalObject } from '../globalObject';\nimport type { Faro } from './types';\n\nexport function setFaroOnGlobalObject(faro: Faro): void {\n if (!faro.config.preventGlobalExposure) {\n faro.internalLogger.debug(\n `Registering public faro reference in the global scope using \"${faro.config.globalObjectKey}\" key`\n );\n\n if (faro.config.globalObjectKey in globalObject) {\n faro.internalLogger.warn(\n `Skipping global registration due to key \"${faro.config.globalObjectKey}\" being used already. Please set \"globalObjectKey\" to something else or set \"preventGlobalExposure\" to \"true\"`\n );\n\n return;\n }\n\n Object.defineProperty(globalObject, faro.config.globalObjectKey, {\n configurable: false,\n writable: false,\n value: faro,\n });\n } else {\n faro.internalLogger.debug('Skipping registering public Faro instance in the global scope');\n }\n}\n"]}
1
+ {"version":3,"file":"faroGlobalObject.js","sourceRoot":"","sources":["../../../src/sdk/faroGlobalObject.ts"],"names":[],"mappings":";;;AAAA,gDAA+C;AAI/C,SAAgB,qBAAqB,CAAC,IAAU;IAC9C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,qBAAqB,EAAE;QACtC,IAAI,CAAC,cAAc,CAAC,KAAK,CACvB,wEAAgE,IAAI,CAAC,MAAM,CAAC,eAAe,WAAO,CACnG,CAAC;QAEF,IAAI,IAAI,CAAC,MAAM,CAAC,eAAe,IAAI,2BAAY,EAAE;YAC/C,IAAI,CAAC,cAAc,CAAC,IAAI,CACtB,oDAA4C,IAAI,CAAC,MAAM,CAAC,eAAe,yHAA+G,CACvL,CAAC;YAEF,OAAO;SACR;QAED,MAAM,CAAC,cAAc,CAAC,2BAAY,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE;YAC/D,YAAY,EAAE,KAAK;YACnB,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;KACJ;SAAM;QACL,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAC;KAC5F;AACH,CAAC;AAtBD,sDAsBC","sourcesContent":["import { globalObject } from '../globalObject';\n\nimport type { Faro } from './types';\n\nexport function setFaroOnGlobalObject(faro: Faro): void {\n if (!faro.config.preventGlobalExposure) {\n faro.internalLogger.debug(\n `Registering public faro reference in the global scope using \"${faro.config.globalObjectKey}\" key`\n );\n\n if (faro.config.globalObjectKey in globalObject) {\n faro.internalLogger.warn(\n `Skipping global registration due to key \"${faro.config.globalObjectKey}\" being used already. Please set \"globalObjectKey\" to something else or set \"preventGlobalExposure\" to \"true\"`\n );\n\n return;\n }\n\n Object.defineProperty(globalObject, faro.config.globalObjectKey, {\n configurable: false,\n writable: false,\n value: faro,\n });\n } else {\n faro.internalLogger.debug('Skipping registering public Faro instance in the global scope');\n }\n}\n"]}
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setInternalFaroOnGlobalObject = exports.isInternalFaroOnGlobalObject = exports.getInternalFaroFromGlobalObject = exports.registerFaro = exports.faro = exports.internalGlobalObjectKey = void 0;
4
4
  var const_1 = require("./const");
5
5
  Object.defineProperty(exports, "internalGlobalObjectKey", { enumerable: true, get: function () { return const_1.internalGlobalObjectKey; } });
6
- var register_1 = require("./register");
7
- Object.defineProperty(exports, "faro", { enumerable: true, get: function () { return register_1.faro; } });
8
- Object.defineProperty(exports, "registerFaro", { enumerable: true, get: function () { return register_1.registerFaro; } });
6
+ var registerFaro_1 = require("./registerFaro");
7
+ Object.defineProperty(exports, "faro", { enumerable: true, get: function () { return registerFaro_1.faro; } });
8
+ Object.defineProperty(exports, "registerFaro", { enumerable: true, get: function () { return registerFaro_1.registerFaro; } });
9
9
  var internalFaroGlobalObject_1 = require("./internalFaroGlobalObject");
10
10
  Object.defineProperty(exports, "getInternalFaroFromGlobalObject", { enumerable: true, get: function () { return internalFaroGlobalObject_1.getInternalFromGlobalObject; } });
11
11
  Object.defineProperty(exports, "isInternalFaroOnGlobalObject", { enumerable: true, get: function () { return internalFaroGlobalObject_1.isInternalFaroOnGlobalObject; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sdk/index.ts"],"names":[],"mappings":";;;AAAA,iCAAkD;AAAzC,gHAAA,uBAAuB,OAAA;AAEhC,uCAAgD;AAAvC,gGAAA,IAAI,OAAA;AAAE,wGAAA,YAAY,OAAA;AAE3B,uEAIoC;AAHlC,2IAAA,2BAA2B,OAAmC;AAC9D,wIAAA,4BAA4B,OAAgC;AAC5D,yIAAA,6BAA6B,OAAiC","sourcesContent":["export { internalGlobalObjectKey } from './const';\n\nexport { faro, registerFaro } from './register';\n\nexport {\n getInternalFromGlobalObject as getInternalFaroFromGlobalObject,\n isInternalFaroOnGlobalObject as isInternalFaroOnGlobalObject,\n setInternalFaroOnGlobalObject as setInternalFaroOnGlobalObject,\n} from './internalFaroGlobalObject';\n\nexport type { Faro } from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sdk/index.ts"],"names":[],"mappings":";;;AAAA,iCAAkD;AAAzC,gHAAA,uBAAuB,OAAA;AAEhC,+CAAoD;AAA3C,oGAAA,IAAI,OAAA;AAAE,4GAAA,YAAY,OAAA;AAE3B,uEAIoC;AAHlC,2IAAA,2BAA2B,OAAmC;AAC9D,wIAAA,4BAA4B,OAAgC;AAC5D,yIAAA,6BAA6B,OAAiC","sourcesContent":["export { internalGlobalObjectKey } from './const';\n\nexport { faro, registerFaro } from './registerFaro';\n\nexport {\n getInternalFromGlobalObject as getInternalFaroFromGlobalObject,\n isInternalFaroOnGlobalObject as isInternalFaroOnGlobalObject,\n setInternalFaroOnGlobalObject as setInternalFaroOnGlobalObject,\n} from './internalFaroGlobalObject';\n\nexport type { Faro } from './types';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internalFaroGlobalObject.js","sourceRoot":"","sources":["../../../src/sdk/internalFaroGlobalObject.ts"],"names":[],"mappings":";;;AAAA,gDAA+C;AAC/C,iCAAkD;AAGlD,SAAgB,2BAA2B;IACzC,OAAO,2BAAY,CAAC,+BAAuB,CAAC,CAAC;AAC/C,CAAC;AAFD,kEAEC;AAED,SAAgB,6BAA6B,CAAC,IAAU;IACtD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACxB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;QAEjF,MAAM,CAAC,cAAc,CAAC,2BAAY,EAAE,+BAAuB,EAAE;YAC3D,YAAY,EAAE,KAAK;YACnB,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;KACJ;SAAM;QACL,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,8DAA8D,CAAC,CAAC;KAC3F;AACH,CAAC;AAbD,sEAaC;AAED,SAAgB,4BAA4B;IAC1C,OAAO,+BAAuB,IAAI,2BAAY,CAAC;AACjD,CAAC;AAFD,oEAEC","sourcesContent":["import { globalObject } from '../globalObject';\nimport { internalGlobalObjectKey } from './const';\nimport type { Faro } from './types';\n\nexport function getInternalFromGlobalObject(): Faro | undefined {\n return globalObject[internalGlobalObjectKey];\n}\n\nexport function setInternalFaroOnGlobalObject(faro: Faro): void {\n if (!faro.config.isolate) {\n faro.internalLogger.debug('Registering internal Faro instance on global object');\n\n Object.defineProperty(globalObject, internalGlobalObjectKey, {\n configurable: false,\n enumerable: false,\n writable: false,\n value: faro,\n });\n } else {\n faro.internalLogger.debug('Skipping registering internal Faro instance on global object');\n }\n}\n\nexport function isInternalFaroOnGlobalObject(): boolean {\n return internalGlobalObjectKey in globalObject;\n}\n"]}
1
+ {"version":3,"file":"internalFaroGlobalObject.js","sourceRoot":"","sources":["../../../src/sdk/internalFaroGlobalObject.ts"],"names":[],"mappings":";;;AAAA,gDAA+C;AAE/C,iCAAkD;AAGlD,SAAgB,2BAA2B;IACzC,OAAO,2BAAY,CAAC,+BAAuB,CAAC,CAAC;AAC/C,CAAC;AAFD,kEAEC;AAED,SAAgB,6BAA6B,CAAC,IAAU;IACtD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACxB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;QAEjF,MAAM,CAAC,cAAc,CAAC,2BAAY,EAAE,+BAAuB,EAAE;YAC3D,YAAY,EAAE,KAAK;YACnB,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;KACJ;SAAM;QACL,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,8DAA8D,CAAC,CAAC;KAC3F;AACH,CAAC;AAbD,sEAaC;AAED,SAAgB,4BAA4B;IAC1C,OAAO,+BAAuB,IAAI,2BAAY,CAAC;AACjD,CAAC;AAFD,oEAEC","sourcesContent":["import { globalObject } from '../globalObject';\n\nimport { internalGlobalObjectKey } from './const';\nimport type { Faro } from './types';\n\nexport function getInternalFromGlobalObject(): Faro | undefined {\n return globalObject[internalGlobalObjectKey];\n}\n\nexport function setInternalFaroOnGlobalObject(faro: Faro): void {\n if (!faro.config.isolate) {\n faro.internalLogger.debug('Registering internal Faro instance on global object');\n\n Object.defineProperty(globalObject, internalGlobalObjectKey, {\n configurable: false,\n enumerable: false,\n writable: false,\n value: faro,\n });\n } else {\n faro.internalLogger.debug('Skipping registering internal Faro instance on global object');\n }\n}\n\nexport function isInternalFaroOnGlobalObject(): boolean {\n return internalGlobalObjectKey in globalObject;\n}\n"]}
@@ -4,12 +4,22 @@ exports.registerFaro = exports.faro = void 0;
4
4
  var faroGlobalObject_1 = require("./faroGlobalObject");
5
5
  var internalFaroGlobalObject_1 = require("./internalFaroGlobalObject");
6
6
  exports.faro = {};
7
- function registerFaro(internalLogger, newFaro) {
7
+ function registerFaro(unpatchedConsole, internalLogger, config, metas, transports, api, instrumentations) {
8
8
  internalLogger.debug('Initializing Faro');
9
- exports.faro = newFaro;
9
+ exports.faro = {
10
+ api: api,
11
+ config: config,
12
+ instrumentations: instrumentations,
13
+ internalLogger: internalLogger,
14
+ metas: metas,
15
+ pause: transports.pause,
16
+ transports: transports,
17
+ unpatchedConsole: unpatchedConsole,
18
+ unpause: transports.unpause,
19
+ };
10
20
  (0, internalFaroGlobalObject_1.setInternalFaroOnGlobalObject)(exports.faro);
11
21
  (0, faroGlobalObject_1.setFaroOnGlobalObject)(exports.faro);
12
22
  return exports.faro;
13
23
  }
14
24
  exports.registerFaro = registerFaro;
15
- //# sourceMappingURL=register.js.map
25
+ //# sourceMappingURL=registerFaro.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerFaro.js","sourceRoot":"","sources":["../../../src/sdk/registerFaro.ts"],"names":[],"mappings":";;;AAQA,uDAA2D;AAC3D,uEAA2E;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,KAAA;QACH,MAAM,QAAA;QACN,gBAAgB,kBAAA;QAChB,cAAc,gBAAA;QACd,KAAK,OAAA;QACL,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,UAAU,YAAA;QACV,gBAAgB,kBAAA;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;AA5BD,oCA4BC","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"]}
@@ -6,6 +6,7 @@ exports.Conventions = {
6
6
  CLICK: 'click',
7
7
  NAVIGATION: 'navigation',
8
8
  SESSION_START: 'session_start',
9
+ VIEW_CHANGED: 'view_changed',
9
10
  },
10
11
  };
11
12
  //# sourceMappingURL=semantic.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"semantic.js","sourceRoot":"","sources":["../../src/semantic.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IACzB,UAAU,EAAE;QACV,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,YAAY;QACxB,aAAa,EAAE,eAAe;KAC/B;CACO,CAAC","sourcesContent":["export const Conventions = {\n EventNames: {\n CLICK: 'click',\n NAVIGATION: 'navigation',\n SESSION_START: 'session_start',\n },\n} as const;\n"]}
1
+ {"version":3,"file":"semantic.js","sourceRoot":"","sources":["../../src/semantic.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IACzB,UAAU,EAAE;QACV,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,YAAY;QACxB,aAAa,EAAE,eAAe;QAC9B,YAAY,EAAE,cAAc;KAC7B;CACO,CAAC","sourcesContent":["export const Conventions = {\n EventNames: {\n CLICK: 'click',\n NAVIGATION: 'navigation',\n SESSION_START: 'session_start',\n VIEW_CHANGED: 'view_changed',\n },\n} as const;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mockConfig.js","sourceRoot":"","sources":["../../../src/testUtils/mockConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,oDAA+D;AAC/D,+DAA8D;AAE9D,SAAgB,UAAU,CAAC,SAA+B;IAA/B,0BAAA,EAAA,cAA+B;IACxD,kBACE,GAAG,EAAE;YACH,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,OAAO;SACjB,EACD,MAAM,EAAE,IAAI,EACZ,eAAe,EAAE,MAAM,EACvB,mBAAmB,EAAE,2CAA0B,EAC/C,gBAAgB,EAAE,EAAE,EACpB,OAAO,EAAE,IAAI,EACb,KAAK,EAAE,EAAE,EACT,eAAe,EAAE,2CAAoB,EACrC,MAAM,EAAE,KAAK,EACb,qBAAqB,EAAE,IAAI,EAC3B,UAAU,EAAE,EAAE,EACd,gBAAgB,EAAE,OAAO,IACtB,SAAS,EACZ;AACJ,CAAC;AAnBD,gCAmBC","sourcesContent":["import type { Config } from '../config';\nimport { defaultInternalLoggerLevel } from '../internalLogger';\nimport { mockStacktraceParser } from './mockStacktraceParser';\n\nexport function mockConfig(overrides: Partial<Config> = {}): Config {\n return {\n app: {\n name: 'test',\n version: '1.0.0',\n },\n dedupe: true,\n globalObjectKey: 'faro',\n internalLoggerLevel: defaultInternalLoggerLevel,\n instrumentations: [],\n isolate: true,\n metas: [],\n parseStacktrace: mockStacktraceParser,\n paused: false,\n preventGlobalExposure: true,\n transports: [],\n unpatchedConsole: console,\n ...overrides,\n };\n}\n"]}
1
+ {"version":3,"file":"mockConfig.js","sourceRoot":"","sources":["../../../src/testUtils/mockConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,oDAA+D;AAE/D,+DAA8D;AAE9D,SAAgB,UAAU,CAAC,SAA+B;IAA/B,0BAAA,EAAA,cAA+B;IACxD,kBACE,GAAG,EAAE;YACH,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,OAAO;SACjB,EACD,MAAM,EAAE,IAAI,EACZ,eAAe,EAAE,MAAM,EACvB,mBAAmB,EAAE,2CAA0B,EAC/C,gBAAgB,EAAE,EAAE,EACpB,OAAO,EAAE,IAAI,EACb,KAAK,EAAE,EAAE,EACT,eAAe,EAAE,2CAAoB,EACrC,MAAM,EAAE,KAAK,EACb,qBAAqB,EAAE,IAAI,EAC3B,UAAU,EAAE,EAAE,EACd,gBAAgB,EAAE,OAAO,IACtB,SAAS,EACZ;AACJ,CAAC;AAnBD,gCAmBC","sourcesContent":["import type { Config } from '../config';\nimport { defaultInternalLoggerLevel } from '../internalLogger';\n\nimport { mockStacktraceParser } from './mockStacktraceParser';\n\nexport function mockConfig(overrides: Partial<Config> = {}): Config {\n return {\n app: {\n name: 'test',\n version: '1.0.0',\n },\n dedupe: true,\n globalObjectKey: 'faro',\n internalLoggerLevel: defaultInternalLoggerLevel,\n instrumentations: [],\n isolate: true,\n metas: [],\n parseStacktrace: mockStacktraceParser,\n paused: false,\n preventGlobalExposure: true,\n transports: [],\n unpatchedConsole: console,\n ...overrides,\n };\n}\n"]}
@@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () {
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.BaseTransport = void 0;
19
- var utils_1 = require("../utils");
19
+ var extensions_1 = require("../extensions");
20
20
  var BaseTransport = /** @class */ (function (_super) {
21
21
  __extends(BaseTransport, _super);
22
22
  function BaseTransport() {
@@ -26,6 +26,6 @@ var BaseTransport = /** @class */ (function (_super) {
26
26
  return [];
27
27
  };
28
28
  return BaseTransport;
29
- }(utils_1.BaseExtension));
29
+ }(extensions_1.BaseExtension));
30
30
  exports.BaseTransport = BaseTransport;
31
31
  //# sourceMappingURL=base.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/transports/base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,kCAAyC;AAGzC;IAA4C,iCAAa;IAAzD;;IAMA,CAAC;IAHC,qCAAa,GAAb;QACE,OAAO,EAAE,CAAC;IACZ,CAAC;IACH,oBAAC;AAAD,CAAC,AAND,CAA4C,qBAAa,GAMxD;AANqB,sCAAa","sourcesContent":["import { BaseExtension } from '../utils';\nimport type { Transport, TransportItem } from './types';\n\nexport abstract class BaseTransport extends BaseExtension implements Transport {\n abstract send(item: TransportItem): void | Promise<void>;\n\n getIgnoreUrls(): Array<string | RegExp> {\n return [];\n }\n}\n"]}
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/transports/base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,4CAA8C;AAI9C;IAA4C,iCAAa;IAAzD;;IAMA,CAAC;IAHC,qCAAa,GAAb;QACE,OAAO,EAAE,CAAC;IACZ,CAAC;IACH,oBAAC;AAAD,CAAC,AAND,CAA4C,0BAAa,GAMxD;AANqB,sCAAa","sourcesContent":["import { BaseExtension } from '../extensions';\n\nimport type { Transport, TransportItem } from './types';\n\nexport abstract class BaseTransport extends BaseExtension implements Transport {\n abstract send(item: TransportItem): void | Promise<void>;\n\n getIgnoreUrls(): Array<string | RegExp> {\n return [];\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTransportBody = exports.transportItemTypeToBodyKey = exports.TransportItemType = exports.BaseTransport = exports.initializeTransports = void 0;
3
+ exports.getTransportBody = exports.registerInitialTransports = exports.transportItemTypeToBodyKey = exports.TransportItemType = exports.BaseTransport = exports.initializeTransports = void 0;
4
4
  var initialize_1 = require("./initialize");
5
5
  Object.defineProperty(exports, "initializeTransports", { enumerable: true, get: function () { return initialize_1.initializeTransports; } });
6
6
  var base_1 = require("./base");
@@ -8,6 +8,8 @@ Object.defineProperty(exports, "BaseTransport", { enumerable: true, get: functio
8
8
  var const_1 = require("./const");
9
9
  Object.defineProperty(exports, "TransportItemType", { enumerable: true, get: function () { return const_1.TransportItemType; } });
10
10
  Object.defineProperty(exports, "transportItemTypeToBodyKey", { enumerable: true, get: function () { return const_1.transportItemTypeToBodyKey; } });
11
+ var registerInitial_1 = require("./registerInitial");
12
+ Object.defineProperty(exports, "registerInitialTransports", { enumerable: true, get: function () { return registerInitial_1.registerInitialTransports; } });
11
13
  var utils_1 = require("./utils");
12
14
  Object.defineProperty(exports, "getTransportBody", { enumerable: true, get: function () { return utils_1.getTransportBody; } });
13
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transports/index.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AAA3C,kHAAA,oBAAoB,OAAA;AAE7B,+BAAuC;AAA9B,qGAAA,aAAa,OAAA;AAEtB,iCAAwE;AAA/D,0GAAA,iBAAiB,OAAA;AAAE,mHAAA,0BAA0B,OAAA;AAWtD,iCAA2C;AAAlC,yGAAA,gBAAgB,OAAA","sourcesContent":["export { initializeTransports } from './initialize';\n\nexport { BaseTransport } from './base';\n\nexport { TransportItemType, transportItemTypeToBodyKey } from './const';\n\nexport type {\n BeforeSendHook,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n} from './types';\n\nexport { getTransportBody } from './utils';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transports/index.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AAA3C,kHAAA,oBAAoB,OAAA;AAE7B,+BAAuC;AAA9B,qGAAA,aAAa,OAAA;AAEtB,iCAAwE;AAA/D,0GAAA,iBAAiB,OAAA;AAAE,mHAAA,0BAA0B,OAAA;AAEtD,qDAA8D;AAArD,4HAAA,yBAAyB,OAAA;AAWlC,iCAA2C;AAAlC,yGAAA,gBAAgB,OAAA","sourcesContent":["export { initializeTransports } from './initialize';\n\nexport { BaseTransport } from './base';\n\nexport { TransportItemType, transportItemTypeToBodyKey } from './const';\n\nexport { registerInitialTransports } from './registerInitial';\n\nexport type {\n BeforeSendHook,\n Transport,\n TransportBody,\n TransportItem,\n TransportItemPayload,\n Transports,\n} from './types';\n\nexport { getTransportBody } from './utils';\n"]}
@@ -31,7 +31,7 @@ function createBeforeSendHookFromIgnorePatterns(patterns) {
31
31
  };
32
32
  }
33
33
  exports.createBeforeSendHookFromIgnorePatterns = createBeforeSendHookFromIgnorePatterns;
34
- function initializeTransports(internalLogger, config) {
34
+ function initializeTransports(unpatchedConsole, internalLogger, config, metas) {
35
35
  internalLogger.debug('Initializing transports');
36
36
  var transports = [];
37
37
  var paused = config.paused;
@@ -49,6 +49,10 @@ function initializeTransports(internalLogger, config) {
49
49
  internalLogger.warn("Transport ".concat(newTransport.name, " is already added"));
50
50
  return;
51
51
  }
52
+ newTransport.unpatchedConsole = unpatchedConsole;
53
+ newTransport.internalLogger = internalLogger;
54
+ newTransport.config = config;
55
+ newTransport.metas = metas;
52
56
  transports.push(newTransport);
53
57
  });
54
58
  };
@@ -127,9 +131,6 @@ function initializeTransports(internalLogger, config) {
127
131
  internalLogger.debug('Unpausing transports');
128
132
  paused = false;
129
133
  };
130
- add.apply(void 0, config.transports);
131
- addBeforeSendHooks(config.beforeSend);
132
- addIgnoreErrorsPatterns(config.ignoreErrors);
133
134
  return {
134
135
  add: add,
135
136
  addBeforeSendHooks: addBeforeSendHooks,