@grafana/faro-core 1.14.3 → 1.15.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 (284) hide show
  1. package/dist/bundle/faro-core.iife.js +1 -1
  2. package/dist/bundle/types/api/const.d.ts +4 -3
  3. package/dist/bundle/types/api/index.d.ts +2 -2
  4. package/dist/bundle/types/api/logs/initialize.d.ts +1 -1
  5. package/dist/bundle/types/api/measurements/initialize.d.ts +1 -2
  6. package/dist/bundle/types/api/traces/initialize.d.ts +1 -1
  7. package/dist/bundle/types/api/types.d.ts +16 -6
  8. package/dist/bundle/types/extensions/baseExtension.d.ts +1 -1
  9. package/dist/bundle/types/globalObject/globalObject.d.ts +1 -2
  10. package/dist/bundle/types/index.d.ts +3 -3
  11. package/dist/bundle/types/testUtils/mockTransport.d.ts +1 -1
  12. package/dist/bundle/types/utils/index.d.ts +1 -1
  13. package/dist/bundle/types/utils/reactive.d.ts +12 -41
  14. package/dist/bundle/types/version.d.ts +1 -1
  15. package/dist/cjs/api/ItemBuffer.js.map +1 -1
  16. package/dist/cjs/api/const.js +5 -4
  17. package/dist/cjs/api/const.js.map +1 -1
  18. package/dist/cjs/api/events/initialize.js +2 -3
  19. package/dist/cjs/api/events/initialize.js.map +1 -1
  20. package/dist/cjs/api/exceptions/const.js.map +1 -1
  21. package/dist/cjs/api/exceptions/initialize.js +2 -3
  22. package/dist/cjs/api/exceptions/initialize.js.map +1 -1
  23. package/dist/cjs/api/index.js +5 -4
  24. package/dist/cjs/api/index.js.map +1 -1
  25. package/dist/cjs/api/initialize.js +2 -2
  26. package/dist/cjs/api/initialize.js.map +1 -1
  27. package/dist/cjs/api/logs/const.js.map +1 -1
  28. package/dist/cjs/api/logs/initialize.js +2 -3
  29. package/dist/cjs/api/logs/initialize.js.map +1 -1
  30. package/dist/cjs/api/measurements/initialize.js +2 -3
  31. package/dist/cjs/api/measurements/initialize.js.map +1 -1
  32. package/dist/cjs/api/meta/initialize.js +1 -2
  33. package/dist/cjs/api/meta/initialize.js.map +1 -1
  34. package/dist/cjs/api/traces/initialize.js +1 -2
  35. package/dist/cjs/api/traces/initialize.js.map +1 -1
  36. package/dist/cjs/api/types.js.map +1 -1
  37. package/dist/cjs/api/userActionLifecycleHandler.js +4 -5
  38. package/dist/cjs/api/userActionLifecycleHandler.js.map +1 -1
  39. package/dist/cjs/api/utils.js +1 -2
  40. package/dist/cjs/api/utils.js.map +1 -1
  41. package/dist/cjs/index.js +6 -6
  42. package/dist/cjs/index.js.map +1 -1
  43. package/dist/cjs/initialize.js +1 -2
  44. package/dist/cjs/initialize.js.map +1 -1
  45. package/dist/cjs/instrumentations/base.js.map +1 -1
  46. package/dist/cjs/instrumentations/initialize.js +1 -2
  47. package/dist/cjs/instrumentations/initialize.js.map +1 -1
  48. package/dist/cjs/instrumentations/registerInitial.js +1 -2
  49. package/dist/cjs/instrumentations/registerInitial.js.map +1 -1
  50. package/dist/cjs/internalLogger/const.js +1 -1
  51. package/dist/cjs/internalLogger/const.js.map +1 -1
  52. package/dist/cjs/internalLogger/createInternalLogger.js +1 -2
  53. package/dist/cjs/internalLogger/createInternalLogger.js.map +1 -1
  54. package/dist/cjs/internalLogger/initialize.js +2 -2
  55. package/dist/cjs/internalLogger/initialize.js.map +1 -1
  56. package/dist/cjs/metas/initialize.js +1 -2
  57. package/dist/cjs/metas/initialize.js.map +1 -1
  58. package/dist/cjs/metas/registerInitial.js +1 -2
  59. package/dist/cjs/metas/registerInitial.js.map +1 -1
  60. package/dist/cjs/sdk/faroGlobalObject.js +1 -2
  61. package/dist/cjs/sdk/faroGlobalObject.js.map +1 -1
  62. package/dist/cjs/sdk/internalFaroGlobalObject.js +3 -4
  63. package/dist/cjs/sdk/internalFaroGlobalObject.js.map +1 -1
  64. package/dist/cjs/sdk/registerFaro.js +2 -2
  65. package/dist/cjs/sdk/registerFaro.js.map +1 -1
  66. package/dist/cjs/testUtils/mockConfig.js +1 -2
  67. package/dist/cjs/testUtils/mockConfig.js.map +1 -1
  68. package/dist/cjs/testUtils/mockStacktraceParser.js.map +1 -1
  69. package/dist/cjs/testUtils/mockTransport.js.map +1 -1
  70. package/dist/cjs/testUtils/testPromise.js +1 -2
  71. package/dist/cjs/testUtils/testPromise.js.map +1 -1
  72. package/dist/cjs/transports/batchExecutor.js.map +1 -1
  73. package/dist/cjs/transports/const.js +1 -1
  74. package/dist/cjs/transports/const.js.map +1 -1
  75. package/dist/cjs/transports/initialize.js +1 -2
  76. package/dist/cjs/transports/initialize.js.map +1 -1
  77. package/dist/cjs/transports/registerInitial.js +1 -2
  78. package/dist/cjs/transports/registerInitial.js.map +1 -1
  79. package/dist/cjs/transports/utils.js +2 -3
  80. package/dist/cjs/transports/utils.js.map +1 -1
  81. package/dist/cjs/unpatchedConsole/initialize.js +2 -2
  82. package/dist/cjs/unpatchedConsole/initialize.js.map +1 -1
  83. package/dist/cjs/utils/date.js +3 -4
  84. package/dist/cjs/utils/date.js.map +1 -1
  85. package/dist/cjs/utils/deepEqual.js +1 -2
  86. package/dist/cjs/utils/deepEqual.js.map +1 -1
  87. package/dist/cjs/utils/index.js +1 -2
  88. package/dist/cjs/utils/index.js.map +1 -1
  89. package/dist/cjs/utils/is.js +5 -5
  90. package/dist/cjs/utils/is.js.map +1 -1
  91. package/dist/cjs/utils/json.js +3 -4
  92. package/dist/cjs/utils/json.js.map +1 -1
  93. package/dist/cjs/utils/logLevels.js +1 -1
  94. package/dist/cjs/utils/logLevels.js.map +1 -1
  95. package/dist/cjs/utils/noop.js +1 -2
  96. package/dist/cjs/utils/noop.js.map +1 -1
  97. package/dist/cjs/utils/promiseBuffer.js +1 -2
  98. package/dist/cjs/utils/promiseBuffer.js.map +1 -1
  99. package/dist/cjs/utils/reactive.js +61 -75
  100. package/dist/cjs/utils/reactive.js.map +1 -1
  101. package/dist/cjs/utils/shortId.js +1 -2
  102. package/dist/cjs/utils/shortId.js.map +1 -1
  103. package/dist/cjs/utils/sourceMaps.js +1 -2
  104. package/dist/cjs/utils/sourceMaps.js.map +1 -1
  105. package/dist/cjs/version.js +1 -1
  106. package/dist/cjs/version.js.map +1 -1
  107. package/dist/esm/api/ItemBuffer.js.map +1 -1
  108. package/dist/esm/api/const.js +4 -3
  109. package/dist/esm/api/const.js.map +1 -1
  110. package/dist/esm/api/events/initialize.js +2 -2
  111. package/dist/esm/api/events/initialize.js.map +1 -1
  112. package/dist/esm/api/exceptions/const.js.map +1 -1
  113. package/dist/esm/api/exceptions/initialize.js +2 -2
  114. package/dist/esm/api/exceptions/initialize.js.map +1 -1
  115. package/dist/esm/api/index.js +1 -1
  116. package/dist/esm/api/index.js.map +1 -1
  117. package/dist/esm/api/logs/const.js.map +1 -1
  118. package/dist/esm/api/logs/initialize.js +2 -2
  119. package/dist/esm/api/logs/initialize.js.map +1 -1
  120. package/dist/esm/api/measurements/initialize.js +2 -2
  121. package/dist/esm/api/measurements/initialize.js.map +1 -1
  122. package/dist/esm/api/meta/initialize.js.map +1 -1
  123. package/dist/esm/api/traces/initialize.js.map +1 -1
  124. package/dist/esm/api/types.js.map +1 -1
  125. package/dist/esm/api/userActionLifecycleHandler.js +4 -4
  126. package/dist/esm/api/userActionLifecycleHandler.js.map +1 -1
  127. package/dist/esm/index.js +2 -2
  128. package/dist/esm/index.js.map +1 -1
  129. package/dist/esm/initialize.js.map +1 -1
  130. package/dist/esm/instrumentations/initialize.js.map +1 -1
  131. package/dist/esm/internalLogger/createInternalLogger.js.map +1 -1
  132. package/dist/esm/metas/initialize.js.map +1 -1
  133. package/dist/esm/metas/registerInitial.js.map +1 -1
  134. package/dist/esm/sdk/faroGlobalObject.js.map +1 -1
  135. package/dist/esm/sdk/internalFaroGlobalObject.js.map +1 -1
  136. package/dist/esm/testUtils/mockStacktraceParser.js.map +1 -1
  137. package/dist/esm/transports/batchExecutor.js.map +1 -1
  138. package/dist/esm/transports/initialize.js.map +1 -1
  139. package/dist/esm/transports/utils.js.map +1 -1
  140. package/dist/esm/utils/deepEqual.js.map +1 -1
  141. package/dist/esm/utils/index.js +1 -1
  142. package/dist/esm/utils/index.js.map +1 -1
  143. package/dist/esm/utils/is.js.map +1 -1
  144. package/dist/esm/utils/json.js.map +1 -1
  145. package/dist/esm/utils/promiseBuffer.js.map +1 -1
  146. package/dist/esm/utils/reactive.js +55 -69
  147. package/dist/esm/utils/reactive.js.map +1 -1
  148. package/dist/esm/version.js +1 -1
  149. package/dist/esm/version.js.map +1 -1
  150. package/dist/spec/core/src/api/ItemBuffer.js.map +1 -1
  151. package/dist/spec/core/src/api/const.js +5 -4
  152. package/dist/spec/core/src/api/const.js.map +1 -1
  153. package/dist/spec/core/src/api/events/initialize.js +2 -3
  154. package/dist/spec/core/src/api/events/initialize.js.map +1 -1
  155. package/dist/spec/core/src/api/events/initialize.test.js +3 -3
  156. package/dist/spec/core/src/api/events/initialize.test.js.map +1 -1
  157. package/dist/spec/core/src/api/exceptions/const.js.map +1 -1
  158. package/dist/spec/core/src/api/exceptions/initialize.js +2 -3
  159. package/dist/spec/core/src/api/exceptions/initialize.js.map +1 -1
  160. package/dist/spec/core/src/api/exceptions/initialize.test.js +3 -3
  161. package/dist/spec/core/src/api/exceptions/initialize.test.js.map +1 -1
  162. package/dist/spec/core/src/api/index.js +5 -4
  163. package/dist/spec/core/src/api/index.js.map +1 -1
  164. package/dist/spec/core/src/api/initialize.js +2 -2
  165. package/dist/spec/core/src/api/initialize.js.map +1 -1
  166. package/dist/spec/core/src/api/initialize.test.js +17 -7
  167. package/dist/spec/core/src/api/initialize.test.js.map +1 -1
  168. package/dist/spec/core/src/api/logs/const.js.map +1 -1
  169. package/dist/spec/core/src/api/logs/initialize.js +2 -3
  170. package/dist/spec/core/src/api/logs/initialize.js.map +1 -1
  171. package/dist/spec/core/src/api/logs/initialize.test.js +3 -3
  172. package/dist/spec/core/src/api/logs/initialize.test.js.map +1 -1
  173. package/dist/spec/core/src/api/measurements/initialize.js +2 -3
  174. package/dist/spec/core/src/api/measurements/initialize.js.map +1 -1
  175. package/dist/spec/core/src/api/measurements/initialize.test.js +3 -3
  176. package/dist/spec/core/src/api/measurements/initialize.test.js.map +1 -1
  177. package/dist/spec/core/src/api/meta/initialize.js +1 -2
  178. package/dist/spec/core/src/api/meta/initialize.js.map +1 -1
  179. package/dist/spec/core/src/api/traces/initialize.js +1 -2
  180. package/dist/spec/core/src/api/traces/initialize.js.map +1 -1
  181. package/dist/spec/core/src/api/types.js.map +1 -1
  182. package/dist/spec/core/src/api/userActionLifecycleHandler.js +4 -5
  183. package/dist/spec/core/src/api/userActionLifecycleHandler.js.map +1 -1
  184. package/dist/spec/core/src/api/userActionLifecycleHandler.test.js +26 -9
  185. package/dist/spec/core/src/api/userActionLifecycleHandler.test.js.map +1 -1
  186. package/dist/spec/core/src/api/utils.js +1 -2
  187. package/dist/spec/core/src/api/utils.js.map +1 -1
  188. package/dist/spec/core/src/index.js +6 -6
  189. package/dist/spec/core/src/index.js.map +1 -1
  190. package/dist/spec/core/src/initialize.js +1 -2
  191. package/dist/spec/core/src/initialize.js.map +1 -1
  192. package/dist/spec/core/src/instrumentations/base.js.map +1 -1
  193. package/dist/spec/core/src/instrumentations/initialize.js +1 -2
  194. package/dist/spec/core/src/instrumentations/initialize.js.map +1 -1
  195. package/dist/spec/core/src/instrumentations/registerInitial.js +1 -2
  196. package/dist/spec/core/src/instrumentations/registerInitial.js.map +1 -1
  197. package/dist/spec/core/src/internalLogger/const.js +1 -1
  198. package/dist/spec/core/src/internalLogger/const.js.map +1 -1
  199. package/dist/spec/core/src/internalLogger/createInternalLogger.js +1 -2
  200. package/dist/spec/core/src/internalLogger/createInternalLogger.js.map +1 -1
  201. package/dist/spec/core/src/internalLogger/initialize.js +2 -2
  202. package/dist/spec/core/src/internalLogger/initialize.js.map +1 -1
  203. package/dist/spec/core/src/metas/initialize.js +1 -2
  204. package/dist/spec/core/src/metas/initialize.js.map +1 -1
  205. package/dist/spec/core/src/metas/registerInitial.js +1 -2
  206. package/dist/spec/core/src/metas/registerInitial.js.map +1 -1
  207. package/dist/spec/core/src/sdk/faroGlobalObject.js +1 -2
  208. package/dist/spec/core/src/sdk/faroGlobalObject.js.map +1 -1
  209. package/dist/spec/core/src/sdk/internalFaroGlobalObject.js +3 -4
  210. package/dist/spec/core/src/sdk/internalFaroGlobalObject.js.map +1 -1
  211. package/dist/spec/core/src/sdk/registerFaro.js +2 -2
  212. package/dist/spec/core/src/sdk/registerFaro.js.map +1 -1
  213. package/dist/spec/core/src/testUtils/mockConfig.js +1 -2
  214. package/dist/spec/core/src/testUtils/mockConfig.js.map +1 -1
  215. package/dist/spec/core/src/testUtils/mockStacktraceParser.js.map +1 -1
  216. package/dist/spec/core/src/testUtils/mockTransport.js.map +1 -1
  217. package/dist/spec/core/src/testUtils/testPromise.js +1 -2
  218. package/dist/spec/core/src/testUtils/testPromise.js.map +1 -1
  219. package/dist/spec/core/src/transports/batchExecutor.js.map +1 -1
  220. package/dist/spec/core/src/transports/const.js +1 -1
  221. package/dist/spec/core/src/transports/const.js.map +1 -1
  222. package/dist/spec/core/src/transports/initialize.js +1 -2
  223. package/dist/spec/core/src/transports/initialize.js.map +1 -1
  224. package/dist/spec/core/src/transports/registerInitial.js +1 -2
  225. package/dist/spec/core/src/transports/registerInitial.js.map +1 -1
  226. package/dist/spec/core/src/transports/transports.test.js.map +1 -1
  227. package/dist/spec/core/src/transports/utils.js +2 -3
  228. package/dist/spec/core/src/transports/utils.js.map +1 -1
  229. package/dist/spec/core/src/unpatchedConsole/initialize.js +2 -2
  230. package/dist/spec/core/src/unpatchedConsole/initialize.js.map +1 -1
  231. package/dist/spec/core/src/utils/date.js +3 -4
  232. package/dist/spec/core/src/utils/date.js.map +1 -1
  233. package/dist/spec/core/src/utils/deepEqual.js +1 -2
  234. package/dist/spec/core/src/utils/deepEqual.js.map +1 -1
  235. package/dist/spec/core/src/utils/index.js +1 -2
  236. package/dist/spec/core/src/utils/index.js.map +1 -1
  237. package/dist/spec/core/src/utils/is.js +5 -5
  238. package/dist/spec/core/src/utils/is.js.map +1 -1
  239. package/dist/spec/core/src/utils/json.js +3 -4
  240. package/dist/spec/core/src/utils/json.js.map +1 -1
  241. package/dist/spec/core/src/utils/logLevels.js +1 -1
  242. package/dist/spec/core/src/utils/logLevels.js.map +1 -1
  243. package/dist/spec/core/src/utils/noop.js +1 -2
  244. package/dist/spec/core/src/utils/noop.js.map +1 -1
  245. package/dist/spec/core/src/utils/promiseBuffer.js +1 -2
  246. package/dist/spec/core/src/utils/promiseBuffer.js.map +1 -1
  247. package/dist/spec/core/src/utils/promiseBuffer.test.js +2 -2
  248. package/dist/spec/core/src/utils/reactive.js +61 -75
  249. package/dist/spec/core/src/utils/reactive.js.map +1 -1
  250. package/dist/spec/core/src/utils/reactive.test.js +32 -19
  251. package/dist/spec/core/src/utils/reactive.test.js.map +1 -1
  252. package/dist/spec/core/src/utils/shortId.js +1 -2
  253. package/dist/spec/core/src/utils/shortId.js.map +1 -1
  254. package/dist/spec/core/src/utils/sourceMaps.js +1 -2
  255. package/dist/spec/core/src/utils/sourceMaps.js.map +1 -1
  256. package/dist/spec/core/src/version.js +1 -1
  257. package/dist/spec/core/src/version.js.map +1 -1
  258. package/dist/types/api/const.d.ts +4 -3
  259. package/dist/types/api/index.d.ts +2 -2
  260. package/dist/types/api/logs/initialize.d.ts +1 -1
  261. package/dist/types/api/measurements/initialize.d.ts +1 -2
  262. package/dist/types/api/traces/initialize.d.ts +1 -1
  263. package/dist/types/api/types.d.ts +16 -6
  264. package/dist/types/core/src/api/const.d.ts +4 -3
  265. package/dist/types/core/src/api/index.d.ts +2 -2
  266. package/dist/types/core/src/api/logs/initialize.d.ts +1 -1
  267. package/dist/types/core/src/api/measurements/initialize.d.ts +1 -2
  268. package/dist/types/core/src/api/traces/initialize.d.ts +1 -1
  269. package/dist/types/core/src/api/types.d.ts +16 -6
  270. package/dist/types/core/src/extensions/baseExtension.d.ts +1 -1
  271. package/dist/types/core/src/globalObject/globalObject.d.ts +1 -2
  272. package/dist/types/core/src/index.d.ts +3 -3
  273. package/dist/types/core/src/testUtils/mockTransport.d.ts +1 -1
  274. package/dist/types/core/src/utils/index.d.ts +1 -1
  275. package/dist/types/core/src/utils/reactive.d.ts +12 -41
  276. package/dist/types/core/src/version.d.ts +1 -1
  277. package/dist/types/extensions/baseExtension.d.ts +1 -1
  278. package/dist/types/globalObject/globalObject.d.ts +1 -2
  279. package/dist/types/index.d.ts +3 -3
  280. package/dist/types/testUtils/mockTransport.d.ts +1 -1
  281. package/dist/types/utils/index.d.ts +1 -1
  282. package/dist/types/utils/reactive.d.ts +12 -41
  283. package/dist/types/version.d.ts +1 -1
  284. package/package.json +2 -2
@@ -1 +1 @@
1
- var GrafanaFaroCore=function(e){"use strict";function t(e,t){return typeof e===t}function n(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function r(e,t){try{return e instanceof t}catch(e){return!1}}const s=e=>t(e,"null"),i=e=>t(e,"string"),a=e=>t(e,"number")&&!isNaN(e)||t(e,"bigint"),o=e=>!s(e)&&t(e,"object"),u=e=>t(e,"function"),l=e=>n(e,"Array"),c="undefined"!=typeof Event,g="undefined"!=typeof Error,d=e=>g&&r(e,Error),p="undefined"!=typeof Element,f="undefined"!=typeof Map;function b(e){return null==e||(l(e)||i(e)?0===e.length:!!o(e)&&0===Object.keys(e).length)}function m(e,n){if(e===n)return!0;if(t(e,"number")&&isNaN(e))return t(n,"number")&&isNaN(n);const r=l(e),s=l(n);if(r!==s)return!1;if(r&&s){const t=e.length;if(t!==n.length)return!1;for(let r=t;0!=r--;)if(!m(e[r],n[r]))return!1;return!0}const i=o(e),a=o(n);if(i!==a)return!1;if(e&&n&&i&&a){const t=Object.keys(e),r=Object.keys(n);if(t.length!==r.length)return!1;for(let e of t)if(!r.includes(e))return!1;for(let r of t)if(!m(e[r],n[r]))return!1;return!0}return!1}function v(){return(new Date).toISOString()}function h(e){return new Date(e).toISOString()}var E;e.LogLevel=void 0,(E=e.LogLevel||(e.LogLevel={})).TRACE="trace",E.DEBUG="debug",E.INFO="info",E.LOG="log",E.WARN="warn",E.ERROR="error";const y=e.LogLevel.LOG,I=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function T(){}const O="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";const L="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;function S(){const e=new WeakSet;return function(t,n){if(o(n)&&null!==n){if(e.has(n))return null;e.add(n)}return n}}function A(e={}){return JSON.stringify(null!=e?e:{},S())}function N(e={}){const t={};for(const[n,r]of Object.entries(e))t[n]=o(r)&&null!==r?A(r):String(r);return t}class j{constructor(){this.subscribers=[]}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>this.unsubscribe(e)}}notify(e){this.subscribers.forEach((t=>t(e)))}first(e){const t=this.subscribe((n=>{e(n),t.unsubscribe()}));return t}takeWhile(e){const t=new j,n=this.subscribe((r=>{e(r)?t.notify(r):n.unsubscribe()}));return t}unsubscribeAll(){this.subscribers=[]}unsubscribe(e){this.subscribers=this.subscribers.filter((t=>t!==e))}}class R{constructor(e,t){var n,r;this.signalBuffer=[],this.itemLimit=null!==(n=null==t?void 0:t.itemLimit)&&void 0!==n?n:50,this.sendTimeout=null!==(r=null==t?void 0:t.sendTimeout)&&void 0!==r?r:250,this.paused=(null==t?void 0:t.paused)||!1,this.sendFn=e,this.flushInterval=-1,this.paused||this.start(),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&this.flush()}))}addItem(e){this.paused||(this.signalBuffer.push(e),this.signalBuffer.length>=this.itemLimit&&this.flush())}start(){this.paused=!1,this.sendTimeout>0&&(this.flushInterval=window.setInterval((()=>this.flush()),this.sendTimeout))}pause(){this.paused=!0,clearInterval(this.flushInterval)}groupItems(e){const t=new Map;return e.forEach((e=>{const n=JSON.stringify(e.meta);let r=t.get(n);r=void 0===r?[e]:[...r,e],t.set(n,r)})),Array.from(t.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}function x(e,t,n,r){var s;t.debug("Initializing transports");const i=[];let a=n.paused,o=[];const u=e=>{let t=e;for(const e of o){const n=t.map(e).filter(Boolean);if(0===n.length)return[];t=n}return t},l=e=>{const n=u(e);if(0!==n.length)for(const e of i)t.debug(`Transporting item using ${e.name}\n`,n),e.isBatched()&&e.send(n)};let c;(null===(s=n.batching)||void 0===s?void 0:s.enabled)&&(c=new R(l,{sendTimeout:n.batching.sendTimeout,itemLimit:n.batching.itemLimit,paused:a}));return{add:(...s)=>{t.debug("Adding transports"),s.forEach((s=>{t.debug(`Adding "${s.name}" transport`);i.some((e=>e===s))?t.warn(`Transport ${s.name} is already added`):(s.unpatchedConsole=e,s.internalLogger=t,s.config=n,s.metas=r,i.push(s))}))},addBeforeSendHooks:(...e)=>{t.debug("Adding beforeSendHooks\n",o),e.forEach((e=>{e&&o.push(e)}))},getBeforeSendHooks:()=>[...o],execute:e=>{var r;a||((null===(r=n.batching)||void 0===r?void 0:r.enabled)&&(null==c||c.addItem(e)),(e=>{var r,s;if((null===(r=n.batching)||void 0===r?void 0:r.enabled)&&i.every((e=>e.isBatched())))return;const[a]=u([e]);if(void 0!==a)for(const e of i)t.debug(`Transporting item using ${e.name}\n`,a),e.isBatched()?(null===(s=n.batching)||void 0===s?void 0:s.enabled)||e.send([a]):e.send(a)})(e))},isPaused:()=>a,pause:()=>{t.debug("Pausing transports"),null==c||c.pause(),a=!0},remove:(...e)=>{t.debug("Removing transports"),e.forEach((e=>{t.debug(`Removing "${e.name}" transport`);const n=i.indexOf(e);-1!==n?i.splice(n,1):t.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{o.filter((t=>!e.includes(t)))},get transports(){return[...i]},unpause:()=>{t.debug("Unpausing transports"),null==c||c.start(),a=!1}}}var _;e.InternalLoggerLevel=void 0,(_=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[_.OFF=0]="OFF",_[_.ERROR=1]="ERROR",_[_.WARN=2]="WARN",_[_.INFO=3]="INFO",_[_.VERBOSE=4]="VERBOSE";const w={debug:T,error:T,info:T,prefix:"Faro",warn:T},C=e.InternalLoggerLevel.ERROR,k=Object.assign({},console);let B=k;function M(e){var t;return B=null!==(t=e.unpatchedConsole)&&void 0!==t?t:B,B}function P(t=k,n=C){const r=w;return n>e.InternalLoggerLevel.OFF&&(r.error=n>=e.InternalLoggerLevel.ERROR?function(...e){t.error(`${r.prefix}\n`,...e)}:T,r.warn=n>=e.InternalLoggerLevel.WARN?function(...e){t.warn(`${r.prefix}\n`,...e)}:T,r.info=n>=e.InternalLoggerLevel.INFO?function(...e){t.info(`${r.prefix}\n`,...e)}:T,r.debug=n>=e.InternalLoggerLevel.VERBOSE?function(...e){t.debug(`${r.prefix}\n`,...e)}:T),r}let D=w;function F(e,t){return D=P(e,t.internalLoggerLevel),D}class G{constructor(){this.unpatchedConsole=k,this.internalLogger=w,this.config={},this.metas={}}logDebug(...e){this.internalLogger.debug(`${this.name}\n`,...e)}logInfo(...e){this.internalLogger.info(`${this.name}\n`,...e)}logWarn(...e){this.internalLogger.warn(`${this.name}\n`,...e)}logError(...e){this.internalLogger.error(`${this.name}\n`,...e)}}var V;e.TransportItemType=void 0,(V=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",V.LOG="log",V.MEASUREMENT="measurement",V.TRACE="trace",V.EVENT="event";const $={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function z(e,t){var n,r;if(void 0===t)return e;if(void 0===e)return{resourceSpans:t};const s=null===(n=e.resourceSpans)||void 0===n?void 0:n[0];if(void 0===s)return e;const i=(null==s?void 0:s.scopeSpans)||[],a=(null===(r=null==t?void 0:t[0])||void 0===r?void 0:r.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},s),{scopeSpans:[...i,...a]})]})}const U="user-action-start",W="user-action-end",K="user-action-cancel";const H="Error";let X;function J({internalLogger:t,config:n,metas:r,transports:a,tracesApi:u,actionBuffer:c,getMessage:g}){var p;t.debug("Initializing exceptions API");let f=null;X=null!==(p=n.parseStacktrace)&&void 0!==p?p:X;const E=e=>{t.debug("Changing stacktrace parser"),X=null!=e?e:X},{ignoreErrors:y=[]}=n;return E(n.parseStacktrace),{changeStacktraceParser:E,getStacktraceParser:()=>X,pushError:(p,{skipDedupe:E,stackFrames:I,type:T,context:O,spanContext:L,timestampOverwriteMs:S}={})=>{if(!function(e,t){const{message:n,name:r,stack:s}=t;return a=e,o=n+" "+r+" "+s,a.some((e=>i(e)?o.includes(e):!!o.match(e)));var a,o}(y,p))try{const i=N(Object.assign(Object.assign({},function(e){let t=e.cause;d(t)?t=e.cause.toString():null!==t&&(o(e.cause)||l(e.cause))?t=A(e.cause):null!=t&&(t=e.cause.toString());return null==t?{}:{cause:t}}(p)),null!=O?O:{})),y={meta:r.value,payload:{type:T||p.name||H,value:p.message,timestamp:S?h(S):v(),trace:L?{trace_id:L.traceId,span_id:L.spanId}:u.getTraceContext(),context:b(i)?void 0:i},type:e.TransportItemType.EXCEPTION};(null==(I=null!=I?I:p.stack?null==X?void 0:X(p).frames:void 0)?void 0:I.length)&&(y.payload.stacktrace={frames:I});const j={type:y.payload.type,value:y.payload.value,stackTrace:y.payload.stacktrace,context:y.payload.context};if(!E&&n.dedupe&&!s(f)&&m(j,f))return void t.debug("Skipping error push because it is the same as the last one\n",y.payload);f=j,t.debug("Pushing exception\n",y);const R=g();R&&R.type===U?c.addItem(y):a.execute(y)}catch(e){t.error("Error pushing event",e)}}}}const Y=e=>e.map((e=>{try{return String(e)}catch(e){return""}})).join(" ");class q{constructor(){this.buffer=[]}addItem(e){this.buffer.push(e)}flushBuffer(e){if(u(e))for(const t of this.buffer)e(t);this.buffer.length=0}size(){return this.buffer.length}}function Q({apiMessageBus:t,transports:n,config:r}){const s=new q,i=r.trackUserActionsExcludeItem;let a;t.subscribe((t=>{if(t.type!==U){if(t.type===W){const{id:r,name:o}=t;return s.flushBuffer((t=>{if(function(t,n){return(null==n?void 0:n(t))||t.type===e.TransportItemType.MEASUREMENT&&"web-vitals"===t.payload.type}(t,i))return void n.execute(t);const s=Object.assign(Object.assign({},t),{payload:Object.assign(Object.assign({},t.payload),{action:{parentId:r,name:o}})});n.execute(s)})),void(a=void 0)}t.type===K&&(a=void 0,s.flushBuffer((e=>{n.execute(e)})))}else a=t}));return{actionBuffer:s,getMessage:()=>a}}const Z=new j;function ee(t,n,r,a,o){n.debug("Initializing API");const{actionBuffer:u,getMessage:l}=Q({apiMessageBus:Z,transports:o,config:r}),c=function(t,n,r,s,i){let a;return n.debug("Initializing traces API"),{getOTEL:()=>a,getTraceContext:()=>{const e=null==a?void 0:a.trace.getSpanContext(a.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,t)=>{n.debug("Initializing OpenTelemetry"),a={trace:e,context:t}},isOTELInitialized:()=>!!a,pushTraces:t=>{try{const r={type:e.TransportItemType.TRACE,payload:t,meta:s.value};n.debug("Pushing trace\n",r),i.execute(r)}catch(e){n.error("Error pushing trace\n",e)}}}}(0,n,0,a,o),g={unpatchedConsole:t,internalLogger:n,config:r,metas:a,transports:o,tracesApi:c,actionBuffer:u,getMessage:l};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},c),J(g)),function({internalLogger:e,metas:t}){let n,r,s,a;e.debug("Initializing meta API");const o=e=>{r&&t.remove(r),r={user:e},t.add(r)},u=(e,r)=>{var s;const i=null==r?void 0:r.overrides,a=i?{overrides:Object.assign(Object.assign({},null===(s=null==n?void 0:n.session)||void 0===s?void 0:s.overrides),i)}:{};n&&t.remove(n),n={session:Object.assign(Object.assign({},b(e)?void 0:e),a)},t.add(n)},l=()=>t.value.session,c=()=>t.value.page;return{setUser:o,resetUser:o,setSession:u,resetSession:u,getSession:l,setView:(e,n)=>{var r;if((null==n?void 0:n.overrides)&&u(l(),{overrides:n.overrides}),(null===(r=null==s?void 0:s.view)||void 0===r?void 0:r.name)===(null==e?void 0:e.name))return;const i=s;s={view:e},t.add(s),i&&t.remove(i)},getView:()=>t.value.view,setPage:e=>{var n;const r=i(e)?Object.assign(Object.assign({},null!==(n=null==a?void 0:a.page)&&void 0!==n?n:c()),{id:e}):e;a&&t.remove(a),a={page:r},t.add(a)},getPage:c}}(g)),function({internalLogger:t,config:n,metas:r,transports:i,tracesApi:a,actionBuffer:o,getMessage:u}){var l;t.debug("Initializing logs API");let c=null;const g=null!==(l=n.logArgsSerializer)&&void 0!==l?l:Y;return{pushLog:(l,{context:d,level:p,skipDedupe:f,spanContext:E,timestampOverwriteMs:I}={})=>{try{const T=N(d),O={type:e.TransportItemType.LOG,payload:{message:g(l),level:null!=p?p:y,context:b(T)?void 0:T,timestamp:I?h(I):v(),trace:E?{trace_id:E.traceId,span_id:E.spanId}:a.getTraceContext()},meta:r.value},L={message:O.payload.message,level:O.payload.level,context:O.payload.context};if(!f&&n.dedupe&&!s(c)&&m(L,c))return void t.debug("Skipping log push because it is the same as the last one\n",O.payload);c=L,t.debug("Pushing log\n",O);const S=u();S&&S.type===U?o.addItem(O):i.execute(O)}catch(e){t.error("Error pushing log\n",e)}}}}(g)),function({internalLogger:t,config:n,metas:r,transports:i,tracesApi:a,actionBuffer:o,getMessage:u}){t.debug("Initializing measurements API");let l=null;return{pushMeasurement:(c,{skipDedupe:g,context:d,spanContext:p,timestampOverwriteMs:f}={})=>{try{const E=N(d),y={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},c),{trace:p?{trace_id:p.traceId,span_id:p.spanId}:a.getTraceContext(),timestamp:f?h(f):v(),context:b(E)?void 0:E}),meta:r.value},I={type:y.payload.type,values:y.payload.values,context:y.payload.context};if(!g&&n.dedupe&&!s(l)&&m(I,l))return void t.debug("Skipping measurement push because it is the same as the last one\n",y.payload);l=I,t.debug("Pushing measurement\n",y);const T=u();T&&T.type===U?o.addItem(y):i.execute(y)}catch(e){t.error("Error pushing measurement\n",e)}}}}(g)),function({internalLogger:t,config:n,metas:r,transports:i,tracesApi:a,actionBuffer:o,getMessage:u}){let l=null;return{pushEvent:(c,g,d,{skipDedupe:p,spanContext:f,timestampOverwriteMs:E,customPayloadTransformer:y=e=>e}={})=>{try{const I=N(g),T={meta:r.value,payload:y({name:c,domain:null!=d?d:n.eventDomain,attributes:b(I)?void 0:I,timestamp:E?h(E):v(),trace:f?{trace_id:f.traceId,span_id:f.spanId}:a.getTraceContext()}),type:e.TransportItemType.EVENT},O={name:T.payload.name,attributes:T.payload.attributes,domain:T.payload.domain};if(!p&&n.dedupe&&!s(l)&&m(O,l))return void t.debug("Skipping event push because it is the same as the last one\n",T.payload);l=O,t.debug("Pushing event\n",T);const L=u();L&&L.type===U?o.addItem(T):i.execute(T)}catch(e){t.error("Error pushing event",e)}}}}(g))}const te="1.14.3";const ne="_faroInternal";function re(e){e.config.isolate?e.internalLogger.debug("Skipping registering internal Faro instance on global object"):(e.internalLogger.debug("Registering internal Faro instance on global object"),Object.defineProperty(L,ne,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function se(){return ne in L}function ie(t,n,r,s,i,a,o){return n.debug("Initializing Faro"),e.faro={api:a,config:r,instrumentations:o,internalLogger:n,metas:s,pause:i.pause,transports:i,unpatchedConsole:t,unpause:i.unpause},re(e.faro),function(e){if(e.config.preventGlobalExposure)e.internalLogger.debug("Skipping registering public Faro instance in the global scope");else{if(e.internalLogger.debug(`Registering public faro reference in the global scope using "${e.config.globalObjectKey}" key`),e.config.globalObjectKey in L)return void e.internalLogger.warn(`Skipping global registration due to key "${e.config.globalObjectKey}" being used already. Please set "globalObjectKey" to something else or set "preventGlobalExposure" to "true"`);Object.defineProperty(L,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}e.faro={};return e.BaseExtension=G,e.BaseInstrumentation=class extends G{constructor(){super(...arguments),this.api={},this.transports={}}},e.BaseTransport=class extends G{isBatched(){return!1}getIgnoreUrls(){return[]}},e.Conventions={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start",VIEW_CHANGED:"view_changed"}},e.EVENT_CLICK="click",e.EVENT_NAVIGATION="navigation",e.EVENT_OVERRIDES_SERVICE_NAME="service_name_override",e.EVENT_ROUTE_CHANGE="route_change",e.EVENT_SESSION_EXTEND="session_extend",e.EVENT_SESSION_RESUME="session_resume",e.EVENT_SESSION_START="session_start",e.EVENT_VIEW_CHANGED="view_changed",e.Observable=j,e.USER_ACTION_CANCEL_MESSAGE_TYPE=K,e.USER_ACTION_END_MESSAGE_TYPE=W,e.USER_ACTION_START_MESSAGE_TYPE=U,e.VERSION=te,e.allLogLevels=I,e.apiMessageBus=Z,e.createInternalLogger=P,e.createPromiseBuffer=function(e){const{size:t,concurrency:n}=e,r=[];let s=0;const i=()=>{if(s<n&&r.length){const{producer:e,resolve:t,reject:n}=r.shift();s++,e().then((e=>{s--,i(),t(e)}),(e=>{s--,i(),n(e)}))}};return{add:e=>{if(r.length+s>=t)throw new Error("Task buffer full");return new Promise(((t,n)=>{r.push({producer:e,resolve:t,reject:n}),i()}))}}},e.dateNow=function(){return Date.now()},e.deepEqual=m,e.defaultBatchingConfig={enabled:!0,sendTimeout:250,itemLimit:50},e.defaultErrorArgsSerializer=e=>e.map((e=>o(e)?A(e):String(e))).join(" "),e.defaultExceptionType=H,e.defaultGlobalObjectKey="faro",e.defaultInternalLoggerLevel=C,e.defaultLogArgsSerializer=Y,e.defaultLogLevel=y,e.defaultUnpatchedConsole=k,e.genShortID=function(e=10){return Array.from(Array(e)).map((()=>O[Math.floor(59*Math.random())])).join("")},e.getCircularDependencyReplacer=S,e.getCurrentTimestamp=v,e.getInternalFaroFromGlobalObject=function(){return L[ne]},e.getTransportBody=function(t){let n={meta:{}};return void 0!==t[0]&&(n.meta=t[0].meta),t.forEach((t=>{switch(t.type){case e.TransportItemType.LOG:case e.TransportItemType.EVENT:case e.TransportItemType.EXCEPTION:case e.TransportItemType.MEASUREMENT:const r=$[t.type],s=n[r];n=Object.assign(Object.assign({},n),{[r]:void 0===s?[t.payload]:[...s,t.payload]});break;case e.TransportItemType.TRACE:n=Object.assign(Object.assign({},n),{traces:z(n.traces,t.payload.resourceSpans)})}})),n},e.globalObject=L,e.initializeFaro=function(e){const t=M(e),n=F(t,e);if(se()&&!e.isolate)return void n.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');n.debug("Initializing");const r=function(e,t){let n=[],r=[];const s=()=>n.reduce(((e,t)=>Object.assign(e,u(t)?t():t)),{}),i=()=>{if(r.length){const e=s();r.forEach((t=>t(e)))}};return{add:(...e)=>{t.debug("Adding metas\n",e),n.push(...e),i()},remove:(...e)=>{t.debug("Removing metas\n",e),n=n.filter((t=>!e.includes(t))),i()},addListener:e=>{t.debug("Adding metas listener\n",e),r.push(e)},removeListener:e=>{t.debug("Removing metas listener\n",e),r=r.filter((t=>t!==e))},get value(){return s()}}}(0,n),s=x(t,n,e,r),i=ee(t,n,e,r,s),a=function(e,t,n,r,s,i){t.debug("Initializing instrumentations");const a=[];return{add:(...o)=>{t.debug("Adding instrumentations"),o.forEach((o=>{t.debug(`Adding "${o.name}" instrumentation`),a.some((e=>e.name===o.name))?t.warn(`Instrumentation ${o.name} is already added`):(o.unpatchedConsole=e,o.internalLogger=t,o.config=n,o.metas=r,o.transports=s,o.api=i,a.push(o),o.initialize())}))},get instrumentations(){return[...a]},remove:(...e)=>{t.debug("Removing instrumentations"),e.forEach((e=>{var n,r;t.debug(`Removing "${e.name}" instrumentation`);const s=a.reduce(((t,n,r)=>null===t&&n.name===e.name?r:null),null);s?(null===(r=(n=a[s]).destroy)||void 0===r||r.call(n),a.splice(s,1)):t.warn(`Instrumentation "${e.name}" is not added`)}))}}}(t,n,e,r,s,i),o=ie(t,n,e,r,s,i,a);return function(e){var t,n;const r={sdk:{version:te},app:{bundleId:e.config.app.name&&(s=e.config.app.name,null==L?void 0:L[`__faroBundleId_${s}`])}};var s;const i=null===(t=e.config.sessionTracking)||void 0===t?void 0:t.session;i&&e.api.setSession(i),e.config.app&&(r.app=Object.assign(Object.assign({},e.config.app),r.app)),e.config.user&&(r.user=e.config.user),e.config.view&&(r.view=e.config.view),e.metas.add(r,...null!==(n=e.config.metas)&&void 0!==n?n:[])}(o),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend)}(o),function(e){e.instrumentations.add(...e.config.instrumentations)}(o),o},e.internalGlobalObjectKey=ne,e.isArray=l,e.isBoolean=e=>t(e,"boolean"),e.isDomError=e=>n(e,"DOMError"),e.isDomException=e=>n(e,"DOMException"),e.isElement=e=>p&&r(e,Element),e.isElementDefined=p,e.isEmpty=b,e.isError=d,e.isErrorDefined=g,e.isErrorEvent=e=>n(e,"ErrorEvent"),e.isEvent=e=>c&&r(e,Event),e.isEventDefined=c,e.isFunction=u,e.isInstanceOf=r,e.isInt=e=>a(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=se,e.isMap=e=>f&&r(e,Map),e.isMapDefined=f,e.isNull=s,e.isNumber=a,e.isObject=o,e.isPrimitive=e=>!o(e)&&!u(e),e.isRegExp=e=>n(e,"RegExp"),e.isString=i,e.isSymbol=e=>t(e,"symbol"),e.isSyntheticEvent=e=>o(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>u(null==e?void 0:e.then),e.isToString=n,e.isTypeof=t,e.isUndefined=e=>t(e,"undefined"),e.merge=function(...e){const t=new j;return e.forEach((e=>{e.subscribe((e=>{t.notify(e)}))})),{subscribe:t.subscribe.bind(t),takeWhile:t.takeWhile.bind(t),first:t.first.bind(t),notify:t.notify.bind(t),unsubscribeAll:()=>{e.forEach((e=>{e.unsubscribeAll()}))}}},e.noop=T,e.setInternalFaroOnGlobalObject=re,e.stringifyExternalJson=A,e.stringifyObjectValues=N,e.transportItemTypeToBodyKey=$,e.unknownString="unknown",e}({});
1
+ var GrafanaFaroCore=function(e){"use strict";function n(e,n){return typeof e===n}function t(e,n){return Object.prototype.toString.call(e)===`[object ${n}]`}function r(e,n){try{return e instanceof n}catch(e){return!1}}const s=e=>n(e,"null"),i=e=>n(e,"string"),a=e=>n(e,"number")&&!isNaN(e)||n(e,"bigint"),o=e=>!s(e)&&n(e,"object"),u=e=>n(e,"function"),c=e=>t(e,"Array"),l="undefined"!=typeof Event,g="undefined"!=typeof Error,d=e=>g&&r(e,Error),p="undefined"!=typeof Element,f="undefined"!=typeof Map;function b(e){return null==e||(c(e)||i(e)?0===e.length:!!o(e)&&0===Object.keys(e).length)}function m(e,t){if(e===t)return!0;if(n(e,"number")&&isNaN(e))return n(t,"number")&&isNaN(t);const r=c(e),s=c(t);if(r!==s)return!1;if(r&&s){const n=e.length;if(n!==t.length)return!1;for(let r=n;0!=r--;)if(!m(e[r],t[r]))return!1;return!0}const i=o(e),a=o(t);if(i!==a)return!1;if(e&&t&&i&&a){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;for(let r of n)if(!m(e[r],t[r]))return!1;return!0}return!1}function v(){return(new Date).toISOString()}function h(e){return new Date(e).toISOString()}var E;e.LogLevel=void 0,(E=e.LogLevel||(e.LogLevel={})).TRACE="trace",E.DEBUG="debug",E.INFO="info",E.LOG="log",E.WARN="warn",E.ERROR="error";const y=e.LogLevel.LOG,I=[e.LogLevel.TRACE,e.LogLevel.DEBUG,e.LogLevel.INFO,e.LogLevel.LOG,e.LogLevel.WARN,e.LogLevel.ERROR];function T(){}const O="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";const L="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof self?self:void 0;function S(){const e=new WeakSet;return function(n,t){if(o(t)&&null!==t){if(e.has(t))return null;e.add(t)}return t}}function N(e={}){return JSON.stringify(null!=e?e:{},S())}function A(e={}){const n={};for(const[t,r]of Object.entries(e))n[t]=o(r)&&null!==r?N(r):String(r);return n}class j{constructor(){this.subscribers=[]}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>this.unsubscribe(e)}}unsubscribe(e){this.subscribers=this.subscribers.filter((n=>n!==e))}notify(e){this.subscribers.forEach((n=>n(e)))}first(){const e=new j,n=n=>{e.notify(n),t.unsubscribe()},t=this.subscribe(n),r=e.unsubscribe.bind(e);return this.withUnsubscribeOverride(e,r,n)}takeWhile(e){const n=new j,t=r=>{e(r)?n.notify(r):n.unsubscribe(t)};this.subscribe(t);const r=n.unsubscribe.bind(n);return this.withUnsubscribeOverride(n,r,t)}filter(e){const n=new j,t=t=>{e(t)&&n.notify(t)};this.subscribe(t);const r=n.unsubscribe.bind(n);return this.withUnsubscribeOverride(n,r,t)}merge(...e){const n=new j,t=[];e.forEach((e=>{const r=e.subscribe((e=>{n.notify(e)}));t.push(r)}));const r=n.unsubscribeAll.bind(n);return n.unsubscribe=()=>{t.forEach((e=>e.unsubscribe())),r()},n}withUnsubscribeOverride(e,n,t){return e.unsubscribe=e=>{n(e),this.unsubscribe(t)},e}unsubscribeAll(){this.subscribers=[]}}class R{constructor(e,n){var t,r;this.signalBuffer=[],this.itemLimit=null!==(t=null==n?void 0:n.itemLimit)&&void 0!==t?t:50,this.sendTimeout=null!==(r=null==n?void 0:n.sendTimeout)&&void 0!==r?r:250,this.paused=(null==n?void 0:n.paused)||!1,this.sendFn=e,this.flushInterval=-1,this.paused||this.start(),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&this.flush()}))}addItem(e){this.paused||(this.signalBuffer.push(e),this.signalBuffer.length>=this.itemLimit&&this.flush())}start(){this.paused=!1,this.sendTimeout>0&&(this.flushInterval=window.setInterval((()=>this.flush()),this.sendTimeout))}pause(){this.paused=!0,clearInterval(this.flushInterval)}groupItems(e){const n=new Map;return e.forEach((e=>{const t=JSON.stringify(e.meta);let r=n.get(t);r=void 0===r?[e]:[...r,e],n.set(t,r)})),Array.from(n.values())}flush(){if(this.paused||0===this.signalBuffer.length)return;this.groupItems(this.signalBuffer).forEach(this.sendFn),this.signalBuffer=[]}}function x(e,n,t,r){var s;n.debug("Initializing transports");const i=[];let a=t.paused,o=[];const u=e=>{let n=e;for(const e of o){const t=n.map(e).filter(Boolean);if(0===t.length)return[];n=t}return n},c=e=>{const t=u(e);if(0!==t.length)for(const e of i)n.debug(`Transporting item using ${e.name}\n`,t),e.isBatched()&&e.send(t)};let l;(null===(s=t.batching)||void 0===s?void 0:s.enabled)&&(l=new R(c,{sendTimeout:t.batching.sendTimeout,itemLimit:t.batching.itemLimit,paused:a}));return{add:(...s)=>{n.debug("Adding transports"),s.forEach((s=>{n.debug(`Adding "${s.name}" transport`);i.some((e=>e===s))?n.warn(`Transport ${s.name} is already added`):(s.unpatchedConsole=e,s.internalLogger=n,s.config=t,s.metas=r,i.push(s))}))},addBeforeSendHooks:(...e)=>{n.debug("Adding beforeSendHooks\n",o),e.forEach((e=>{e&&o.push(e)}))},getBeforeSendHooks:()=>[...o],execute:e=>{var r;a||((null===(r=t.batching)||void 0===r?void 0:r.enabled)&&(null==l||l.addItem(e)),(e=>{var r,s;if((null===(r=t.batching)||void 0===r?void 0:r.enabled)&&i.every((e=>e.isBatched())))return;const[a]=u([e]);if(void 0!==a)for(const e of i)n.debug(`Transporting item using ${e.name}\n`,a),e.isBatched()?(null===(s=t.batching)||void 0===s?void 0:s.enabled)||e.send([a]):e.send(a)})(e))},isPaused:()=>a,pause:()=>{n.debug("Pausing transports"),null==l||l.pause(),a=!0},remove:(...e)=>{n.debug("Removing transports"),e.forEach((e=>{n.debug(`Removing "${e.name}" transport`);const t=i.indexOf(e);-1!==t?i.splice(t,1):n.warn(`Transport "${e.name}" is not added`)}))},removeBeforeSendHooks:(...e)=>{o.filter((n=>!e.includes(n)))},get transports(){return[...i]},unpause:()=>{n.debug("Unpausing transports"),null==l||l.start(),a=!1}}}var w;e.InternalLoggerLevel=void 0,(w=e.InternalLoggerLevel||(e.InternalLoggerLevel={}))[w.OFF=0]="OFF",w[w.ERROR=1]="ERROR",w[w.WARN=2]="WARN",w[w.INFO=3]="INFO",w[w.VERBOSE=4]="VERBOSE";const C={debug:T,error:T,info:T,prefix:"Faro",warn:T},_=e.InternalLoggerLevel.ERROR,k=Object.assign({},console);let B=k;function M(e){var n;return B=null!==(n=e.unpatchedConsole)&&void 0!==n?n:B,B}function P(n=k,t=_){const r=C;return t>e.InternalLoggerLevel.OFF&&(r.error=t>=e.InternalLoggerLevel.ERROR?function(...e){n.error(`${r.prefix}\n`,...e)}:T,r.warn=t>=e.InternalLoggerLevel.WARN?function(...e){n.warn(`${r.prefix}\n`,...e)}:T,r.info=t>=e.InternalLoggerLevel.INFO?function(...e){n.info(`${r.prefix}\n`,...e)}:T,r.debug=t>=e.InternalLoggerLevel.VERBOSE?function(...e){n.debug(`${r.prefix}\n`,...e)}:T),r}let D=C;function F(e,n){return D=P(e,n.internalLoggerLevel),D}class V{constructor(){this.unpatchedConsole=k,this.internalLogger=C,this.config={},this.metas={}}logDebug(...e){this.internalLogger.debug(`${this.name}\n`,...e)}logInfo(...e){this.internalLogger.info(`${this.name}\n`,...e)}logWarn(...e){this.internalLogger.warn(`${this.name}\n`,...e)}logError(...e){this.internalLogger.error(`${this.name}\n`,...e)}}var U;e.TransportItemType=void 0,(U=e.TransportItemType||(e.TransportItemType={})).EXCEPTION="exception",U.LOG="log",U.MEASUREMENT="measurement",U.TRACE="trace",U.EVENT="event";const G={[e.TransportItemType.EXCEPTION]:"exceptions",[e.TransportItemType.LOG]:"logs",[e.TransportItemType.MEASUREMENT]:"measurements",[e.TransportItemType.TRACE]:"traces",[e.TransportItemType.EVENT]:"events"};function $(e,n){var t,r;if(void 0===n)return e;if(void 0===e)return{resourceSpans:n};const s=null===(t=e.resourceSpans)||void 0===t?void 0:t[0];if(void 0===s)return e;const i=(null==s?void 0:s.scopeSpans)||[],a=(null===(r=null==n?void 0:n[0])||void 0===r?void 0:r.scopeSpans)||[];return Object.assign(Object.assign({},e),{resourceSpans:[Object.assign(Object.assign({},s),{scopeSpans:[...i,...a]})]})}const z="user-action-start",K="user-action-end",W="user-action-cancel",H="user-action-halt";const X="Error";let J;function q({internalLogger:n,config:t,metas:r,transports:a,tracesApi:u,actionBuffer:l,getMessage:g}){var p;n.debug("Initializing exceptions API");let f=null;J=null!==(p=t.parseStacktrace)&&void 0!==p?p:J;const E=e=>{n.debug("Changing stacktrace parser"),J=null!=e?e:J},{ignoreErrors:y=[]}=t;return E(t.parseStacktrace),{changeStacktraceParser:E,getStacktraceParser:()=>J,pushError:(p,{skipDedupe:E,stackFrames:I,type:T,context:O,spanContext:L,timestampOverwriteMs:S}={})=>{if(!function(e,n){const{message:t,name:r,stack:s}=n;return a=e,o=t+" "+r+" "+s,a.some((e=>i(e)?o.includes(e):!!o.match(e)));var a,o}(y,p))try{const i=A(Object.assign(Object.assign({},function(e){let n=e.cause;d(n)?n=e.cause.toString():null!==n&&(o(e.cause)||c(e.cause))?n=N(e.cause):null!=n&&(n=e.cause.toString());return null==n?{}:{cause:n}}(p)),null!=O?O:{})),y={meta:r.value,payload:{type:T||p.name||X,value:p.message,timestamp:S?h(S):v(),trace:L?{trace_id:L.traceId,span_id:L.spanId}:u.getTraceContext(),context:b(i)?void 0:i},type:e.TransportItemType.EXCEPTION};(null==(I=null!=I?I:p.stack?null==J?void 0:J(p).frames:void 0)?void 0:I.length)&&(y.payload.stacktrace={frames:I});const j={type:y.payload.type,value:y.payload.value,stackTrace:y.payload.stacktrace,context:y.payload.context};if(!E&&t.dedupe&&!s(f)&&m(j,f))return void n.debug("Skipping error push because it is the same as the last one\n",y.payload);f=j,n.debug("Pushing exception\n",y);const R=g();R&&R.type===z?l.addItem(y):a.execute(y)}catch(e){n.error("Error pushing event",e)}}}}const Q=e=>e.map((e=>{try{return String(e)}catch(e){return""}})).join(" ");class Y{constructor(){this.buffer=[]}addItem(e){this.buffer.push(e)}flushBuffer(e){if(u(e))for(const n of this.buffer)e(n);this.buffer.length=0}size(){return this.buffer.length}}function Z({apiMessageBus:n,transports:t,config:r}){const s=new Y,i=r.trackUserActionsExcludeItem;let a;n.subscribe((n=>{if(z!==n.type&&H!==n.type){if(n.type===K){const{id:r,name:o}=n;return s.flushBuffer((n=>{if(function(n,t){return(null==t?void 0:t(n))||n.type===e.TransportItemType.MEASUREMENT&&"web-vitals"===n.payload.type}(n,i))return void t.execute(n);const s=Object.assign(Object.assign({},n),{payload:Object.assign(Object.assign({},n.payload),{action:{parentId:r,name:o}})});t.execute(s)})),void(a=void 0)}n.type===W&&(a=void 0,s.flushBuffer((e=>{t.execute(e)})))}else a=n}));return{actionBuffer:s,getMessage:()=>a}}const ee=new j;function ne(n,t,r,a,o){t.debug("Initializing API");const{actionBuffer:u,getMessage:c}=Z({apiMessageBus:ee,transports:o,config:r}),l=function(n,t,r,s,i){let a;return t.debug("Initializing traces API"),{getOTEL:()=>a,getTraceContext:()=>{const e=null==a?void 0:a.trace.getSpanContext(a.context.active());return e?{trace_id:e.traceId,span_id:e.spanId}:void 0},initOTEL:(e,n)=>{t.debug("Initializing OpenTelemetry"),a={trace:e,context:n}},isOTELInitialized:()=>!!a,pushTraces:n=>{try{const r={type:e.TransportItemType.TRACE,payload:n,meta:s.value};t.debug("Pushing trace\n",r),i.execute(r)}catch(e){t.error("Error pushing trace\n",e)}}}}(0,t,0,a,o),g={unpatchedConsole:n,internalLogger:t,config:r,metas:a,transports:o,tracesApi:l,actionBuffer:u,getMessage:c};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l),q(g)),function({internalLogger:e,metas:n}){let t,r,s,a;e.debug("Initializing meta API");const o=e=>{r&&n.remove(r),r={user:e},n.add(r)},u=(e,r)=>{var s;const i=null==r?void 0:r.overrides,a=i?{overrides:Object.assign(Object.assign({},null===(s=null==t?void 0:t.session)||void 0===s?void 0:s.overrides),i)}:{};t&&n.remove(t),t={session:Object.assign(Object.assign({},b(e)?void 0:e),a)},n.add(t)},c=()=>n.value.session,l=()=>n.value.page;return{setUser:o,resetUser:o,setSession:u,resetSession:u,getSession:c,setView:(e,t)=>{var r;if((null==t?void 0:t.overrides)&&u(c(),{overrides:t.overrides}),(null===(r=null==s?void 0:s.view)||void 0===r?void 0:r.name)===(null==e?void 0:e.name))return;const i=s;s={view:e},n.add(s),i&&n.remove(i)},getView:()=>n.value.view,setPage:e=>{var t;const r=i(e)?Object.assign(Object.assign({},null!==(t=null==a?void 0:a.page)&&void 0!==t?t:l()),{id:e}):e;a&&n.remove(a),a={page:r},n.add(a)},getPage:l}}(g)),function({internalLogger:n,config:t,metas:r,transports:i,tracesApi:a,actionBuffer:o,getMessage:u}){var c;n.debug("Initializing logs API");let l=null;const g=null!==(c=t.logArgsSerializer)&&void 0!==c?c:Q;return{pushLog:(c,{context:d,level:p,skipDedupe:f,spanContext:E,timestampOverwriteMs:I}={})=>{try{const T=A(d),O={type:e.TransportItemType.LOG,payload:{message:g(c),level:null!=p?p:y,context:b(T)?void 0:T,timestamp:I?h(I):v(),trace:E?{trace_id:E.traceId,span_id:E.spanId}:a.getTraceContext()},meta:r.value},L={message:O.payload.message,level:O.payload.level,context:O.payload.context};if(!f&&t.dedupe&&!s(l)&&m(L,l))return void n.debug("Skipping log push because it is the same as the last one\n",O.payload);l=L,n.debug("Pushing log\n",O);const S=u();S&&S.type===z?o.addItem(O):i.execute(O)}catch(e){n.error("Error pushing log\n",e)}}}}(g)),function({internalLogger:n,config:t,metas:r,transports:i,tracesApi:a,actionBuffer:o,getMessage:u}){n.debug("Initializing measurements API");let c=null;return{pushMeasurement:(l,{skipDedupe:g,context:d,spanContext:p,timestampOverwriteMs:f}={})=>{try{const E=A(d),y={type:e.TransportItemType.MEASUREMENT,payload:Object.assign(Object.assign({},l),{trace:p?{trace_id:p.traceId,span_id:p.spanId}:a.getTraceContext(),timestamp:f?h(f):v(),context:b(E)?void 0:E}),meta:r.value},I={type:y.payload.type,values:y.payload.values,context:y.payload.context};if(!g&&t.dedupe&&!s(c)&&m(I,c))return void n.debug("Skipping measurement push because it is the same as the last one\n",y.payload);c=I,n.debug("Pushing measurement\n",y);const T=u();T&&T.type===z?o.addItem(y):i.execute(y)}catch(e){n.error("Error pushing measurement\n",e)}}}}(g)),function({internalLogger:n,config:t,metas:r,transports:i,tracesApi:a,actionBuffer:o,getMessage:u}){let c=null;return{pushEvent:(l,g,d,{skipDedupe:p,spanContext:f,timestampOverwriteMs:E,customPayloadTransformer:y=e=>e}={})=>{try{const I=A(g),T={meta:r.value,payload:y({name:l,domain:null!=d?d:t.eventDomain,attributes:b(I)?void 0:I,timestamp:E?h(E):v(),trace:f?{trace_id:f.traceId,span_id:f.spanId}:a.getTraceContext()}),type:e.TransportItemType.EVENT},O={name:T.payload.name,attributes:T.payload.attributes,domain:T.payload.domain};if(!p&&t.dedupe&&!s(c)&&m(O,c))return void n.debug("Skipping event push because it is the same as the last one\n",T.payload);c=O,n.debug("Pushing event\n",T);const L=u();L&&L.type===z?o.addItem(T):i.execute(T)}catch(e){n.error("Error pushing event",e)}}}}(g))}const te="1.15.0";const re="_faroInternal";function se(e){e.config.isolate?e.internalLogger.debug("Skipping registering internal Faro instance on global object"):(e.internalLogger.debug("Registering internal Faro instance on global object"),Object.defineProperty(L,re,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function ie(){return re in L}function ae(n,t,r,s,i,a,o){return t.debug("Initializing Faro"),e.faro={api:a,config:r,instrumentations:o,internalLogger:t,metas:s,pause:i.pause,transports:i,unpatchedConsole:n,unpause:i.unpause},se(e.faro),function(e){if(e.config.preventGlobalExposure)e.internalLogger.debug("Skipping registering public Faro instance in the global scope");else{if(e.internalLogger.debug(`Registering public faro reference in the global scope using "${e.config.globalObjectKey}" key`),e.config.globalObjectKey in L)return void e.internalLogger.warn(`Skipping global registration due to key "${e.config.globalObjectKey}" being used already. Please set "globalObjectKey" to something else or set "preventGlobalExposure" to "true"`);Object.defineProperty(L,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}(e.faro),e.faro}e.faro={};return e.BaseExtension=V,e.BaseInstrumentation=class extends V{constructor(){super(...arguments),this.api={},this.transports={}}},e.BaseTransport=class extends V{isBatched(){return!1}getIgnoreUrls(){return[]}},e.Conventions={EventNames:{CLICK:"click",NAVIGATION:"navigation",SESSION_START:"session_start",VIEW_CHANGED:"view_changed"}},e.EVENT_CLICK="click",e.EVENT_NAVIGATION="navigation",e.EVENT_OVERRIDES_SERVICE_NAME="service_name_override",e.EVENT_ROUTE_CHANGE="route_change",e.EVENT_SESSION_EXTEND="session_extend",e.EVENT_SESSION_RESUME="session_resume",e.EVENT_SESSION_START="session_start",e.EVENT_VIEW_CHANGED="view_changed",e.Observable=j,e.USER_ACTION_CANCEL=W,e.USER_ACTION_END=K,e.USER_ACTION_HALT=H,e.USER_ACTION_START=z,e.VERSION=te,e.allLogLevels=I,e.apiMessageBus=ee,e.createInternalLogger=P,e.createPromiseBuffer=function(e){const{size:n,concurrency:t}=e,r=[];let s=0;const i=()=>{if(s<t&&r.length){const{producer:e,resolve:n,reject:t}=r.shift();s++,e().then((e=>{s--,i(),n(e)}),(e=>{s--,i(),t(e)}))}};return{add:e=>{if(r.length+s>=n)throw new Error("Task buffer full");return new Promise(((n,t)=>{r.push({producer:e,resolve:n,reject:t}),i()}))}}},e.dateNow=function(){return Date.now()},e.deepEqual=m,e.defaultBatchingConfig={enabled:!0,sendTimeout:250,itemLimit:50},e.defaultErrorArgsSerializer=e=>e.map((e=>o(e)?N(e):String(e))).join(" "),e.defaultExceptionType=X,e.defaultGlobalObjectKey="faro",e.defaultInternalLoggerLevel=_,e.defaultLogArgsSerializer=Q,e.defaultLogLevel=y,e.defaultUnpatchedConsole=k,e.genShortID=function(e=10){return Array.from(Array(e)).map((()=>O[Math.floor(59*Math.random())])).join("")},e.getCircularDependencyReplacer=S,e.getCurrentTimestamp=v,e.getInternalFaroFromGlobalObject=function(){return L[re]},e.getTransportBody=function(n){let t={meta:{}};return void 0!==n[0]&&(t.meta=n[0].meta),n.forEach((n=>{switch(n.type){case e.TransportItemType.LOG:case e.TransportItemType.EVENT:case e.TransportItemType.EXCEPTION:case e.TransportItemType.MEASUREMENT:const r=G[n.type],s=t[r];t=Object.assign(Object.assign({},t),{[r]:void 0===s?[n.payload]:[...s,n.payload]});break;case e.TransportItemType.TRACE:t=Object.assign(Object.assign({},t),{traces:$(t.traces,n.payload.resourceSpans)})}})),t},e.globalObject=L,e.initializeFaro=function(e){const n=M(e),t=F(n,e);if(ie()&&!e.isolate)return void t.error('Faro is already registered. Either add instrumentations, transports etc. to the global faro instance or use the "isolate" property');t.debug("Initializing");const r=function(e,n){let t=[],r=[];const s=()=>t.reduce(((e,n)=>Object.assign(e,u(n)?n():n)),{}),i=()=>{if(r.length){const e=s();r.forEach((n=>n(e)))}};return{add:(...e)=>{n.debug("Adding metas\n",e),t.push(...e),i()},remove:(...e)=>{n.debug("Removing metas\n",e),t=t.filter((n=>!e.includes(n))),i()},addListener:e=>{n.debug("Adding metas listener\n",e),r.push(e)},removeListener:e=>{n.debug("Removing metas listener\n",e),r=r.filter((n=>n!==e))},get value(){return s()}}}(0,t),s=x(n,t,e,r),i=ne(n,t,e,r,s),a=function(e,n,t,r,s,i){n.debug("Initializing instrumentations");const a=[];return{add:(...o)=>{n.debug("Adding instrumentations"),o.forEach((o=>{n.debug(`Adding "${o.name}" instrumentation`),a.some((e=>e.name===o.name))?n.warn(`Instrumentation ${o.name} is already added`):(o.unpatchedConsole=e,o.internalLogger=n,o.config=t,o.metas=r,o.transports=s,o.api=i,a.push(o),o.initialize())}))},get instrumentations(){return[...a]},remove:(...e)=>{n.debug("Removing instrumentations"),e.forEach((e=>{var t,r;n.debug(`Removing "${e.name}" instrumentation`);const s=a.reduce(((n,t,r)=>null===n&&t.name===e.name?r:null),null);s?(null===(r=(t=a[s]).destroy)||void 0===r||r.call(t),a.splice(s,1)):n.warn(`Instrumentation "${e.name}" is not added`)}))}}}(n,t,e,r,s,i),o=ae(n,t,e,r,s,i,a);return function(e){var n,t;const r={sdk:{version:te},app:{bundleId:e.config.app.name&&(s=e.config.app.name,null==L?void 0:L[`__faroBundleId_${s}`])}};var s;const i=null===(n=e.config.sessionTracking)||void 0===n?void 0:n.session;i&&e.api.setSession(i),e.config.app&&(r.app=Object.assign(Object.assign({},e.config.app),r.app)),e.config.user&&(r.user=e.config.user),e.config.view&&(r.view=e.config.view),e.metas.add(r,...null!==(t=e.config.metas)&&void 0!==t?t:[])}(o),function(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend)}(o),function(e){e.instrumentations.add(...e.config.instrumentations)}(o),o},e.internalGlobalObjectKey=re,e.isArray=c,e.isBoolean=e=>n(e,"boolean"),e.isDomError=e=>t(e,"DOMError"),e.isDomException=e=>t(e,"DOMException"),e.isElement=e=>p&&r(e,Element),e.isElementDefined=p,e.isEmpty=b,e.isError=d,e.isErrorDefined=g,e.isErrorEvent=e=>t(e,"ErrorEvent"),e.isEvent=e=>l&&r(e,Event),e.isEventDefined=l,e.isFunction=u,e.isInstanceOf=r,e.isInt=e=>a(e)&&Number.isInteger(e),e.isInternalFaroOnGlobalObject=ie,e.isMap=e=>f&&r(e,Map),e.isMapDefined=f,e.isNull=s,e.isNumber=a,e.isObject=o,e.isPrimitive=e=>!o(e)&&!u(e),e.isRegExp=e=>t(e,"RegExp"),e.isString=i,e.isSymbol=e=>n(e,"symbol"),e.isSyntheticEvent=e=>o(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e,e.isThenable=e=>u(null==e?void 0:e.then),e.isToString=t,e.isTypeof=n,e.isUndefined=e=>n(e,"undefined"),e.noop=T,e.setInternalFaroOnGlobalObject=se,e.stringifyExternalJson=N,e.stringifyObjectValues=A,e.transportItemTypeToBodyKey=G,e.unknownString="unknown",e}({});
@@ -1,3 +1,4 @@
1
- export declare const USER_ACTION_START_MESSAGE_TYPE = "user-action-start";
2
- export declare const USER_ACTION_END_MESSAGE_TYPE = "user-action-end";
3
- export declare const USER_ACTION_CANCEL_MESSAGE_TYPE = "user-action-cancel";
1
+ export declare const USER_ACTION_START = "user-action-start";
2
+ export declare const USER_ACTION_END = "user-action-end";
3
+ export declare const USER_ACTION_CANCEL = "user-action-cancel";
4
+ export declare const USER_ACTION_HALT = "user-action-halt";
@@ -1,5 +1,5 @@
1
1
  export { initializeAPI } from './initialize';
2
- export type { API, APIEvent, ApiMessageBusMessages, UserActionCancelMessage, UserActionEndMessage, UserActionStartMessage, UserAction, } from './types';
2
+ export type { API, APIEvent, ApiMessageBusMessages, UserActionCancelMessage, UserActionEndMessage, UserActionStartMessage, UserActionHaltMessage, UserAction, } from './types';
3
3
  export type { EventAttributes, EventEvent, EventsAPI, PushEventOptions } from './events';
4
4
  export { defaultExceptionType, defaultErrorArgsSerializer } from './exceptions';
5
5
  export type { ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, PushErrorOptions, Stacktrace, StacktraceParser, } from './exceptions';
@@ -9,4 +9,4 @@ export type { MeasurementEvent, MeasurementsAPI, PushMeasurementOptions } from '
9
9
  export type { MetaAPI } from './meta';
10
10
  export type { OTELApi, TraceContext, TraceEvent, TracesAPI } from './traces';
11
11
  export { apiMessageBus } from './initialize';
12
- export { USER_ACTION_CANCEL_MESSAGE_TYPE, USER_ACTION_END_MESSAGE_TYPE, USER_ACTION_START_MESSAGE_TYPE } from './const';
12
+ export { USER_ACTION_CANCEL, USER_ACTION_END, USER_ACTION_START, USER_ACTION_HALT } from './const';
@@ -1,7 +1,7 @@
1
1
  import type { Config } from '../../config';
2
2
  import type { InternalLogger } from '../../internalLogger';
3
3
  import type { Metas } from '../../metas';
4
- import { TransportItem, Transports } from '../../transports';
4
+ import type { TransportItem, Transports } from '../../transports';
5
5
  import type { UnpatchedConsole } from '../../unpatchedConsole';
6
6
  import type { ItemBuffer } from '../ItemBuffer';
7
7
  import type { TracesAPI } from '../traces';
@@ -1,8 +1,7 @@
1
1
  import type { Config } from '../../config';
2
2
  import type { InternalLogger } from '../../internalLogger';
3
3
  import type { Metas } from '../../metas';
4
- import { TransportItem } from '../../transports';
5
- import type { Transports } from '../../transports';
4
+ import type { TransportItem, Transports } from '../../transports';
6
5
  import type { UnpatchedConsole } from '../../unpatchedConsole';
7
6
  import type { ItemBuffer } from '../ItemBuffer';
8
7
  import type { TracesAPI } from '../traces';
@@ -1,7 +1,7 @@
1
1
  import type { Config } from '../../config';
2
2
  import type { InternalLogger } from '../../internalLogger';
3
3
  import type { Metas } from '../../metas';
4
- import { Transports } from '../../transports';
4
+ import type { Transports } from '../../transports/types';
5
5
  import type { UnpatchedConsole } from '../../unpatchedConsole';
6
6
  import type { TracesAPI } from './types';
7
7
  export declare function initializeTracesAPI(_unpatchedConsole: UnpatchedConsole, internalLogger: InternalLogger, _config: Config, metas: Metas, transports: Transports): TracesAPI;
@@ -1,4 +1,4 @@
1
- import type { USER_ACTION_CANCEL_MESSAGE_TYPE, USER_ACTION_END_MESSAGE_TYPE, USER_ACTION_START_MESSAGE_TYPE } from './const';
1
+ import type { USER_ACTION_CANCEL, USER_ACTION_END, USER_ACTION_HALT, USER_ACTION_START } from './const';
2
2
  import type { EventEvent, EventsAPI } from './events';
3
3
  import type { ExceptionEvent, ExceptionsAPI } from './exceptions';
4
4
  import type { LogEvent, LogsAPI } from './logs';
@@ -7,10 +7,10 @@ import type { MetaAPI } from './meta';
7
7
  import type { TraceEvent, TracesAPI } from './traces';
8
8
  export type APIEvent = LogEvent | ExceptionEvent | MeasurementEvent | TraceEvent | EventEvent;
9
9
  export type API = LogsAPI & ExceptionsAPI & MeasurementsAPI & TracesAPI & MetaAPI & EventsAPI;
10
- export type ApiMessageBusMessages = UserActionStartMessage | UserActionEndMessage | UserActionCancelMessage;
11
- export type UserActionMessageType = typeof USER_ACTION_START_MESSAGE_TYPE | typeof USER_ACTION_END_MESSAGE_TYPE | typeof USER_ACTION_CANCEL_MESSAGE_TYPE;
10
+ export type ApiMessageBusMessages = UserActionStartMessage | UserActionEndMessage | UserActionCancelMessage | UserActionHaltMessage;
11
+ export type UserActionMessageType = typeof USER_ACTION_START | typeof USER_ACTION_END | typeof USER_ACTION_CANCEL | typeof USER_ACTION_HALT;
12
12
  export type UserActionStartMessage = {
13
- type: typeof USER_ACTION_START_MESSAGE_TYPE;
13
+ type: typeof USER_ACTION_START;
14
14
  name: string;
15
15
  startTime: number;
16
16
  /**
@@ -19,7 +19,7 @@ export type UserActionStartMessage = {
19
19
  parentId: string;
20
20
  };
21
21
  export type UserActionEndMessage = {
22
- type: typeof USER_ACTION_END_MESSAGE_TYPE;
22
+ type: typeof USER_ACTION_END;
23
23
  name: string;
24
24
  startTime: number;
25
25
  endTime: number;
@@ -31,13 +31,23 @@ export type UserActionEndMessage = {
31
31
  id: string;
32
32
  };
33
33
  export type UserActionCancelMessage = {
34
- type: typeof USER_ACTION_CANCEL_MESSAGE_TYPE;
34
+ type: typeof USER_ACTION_CANCEL;
35
35
  name: string;
36
36
  /**
37
37
  * Unique identifier of the parent user action to which this action belongs.
38
38
  */
39
39
  parentId?: string;
40
40
  };
41
+ export type UserActionHaltMessage = {
42
+ type: typeof USER_ACTION_HALT;
43
+ name: string;
44
+ reason: 'pending-requests';
45
+ haltTime: number;
46
+ /**
47
+ * Unique identifier of the parent user action to which this action belongs.
48
+ */
49
+ parentId?: string;
50
+ };
41
51
  export type UserAction = {
42
52
  name: string;
43
53
  id?: string;
@@ -6,7 +6,7 @@ export declare abstract class BaseExtension implements Extension {
6
6
  abstract readonly version: string;
7
7
  unpatchedConsole: Console;
8
8
  internalLogger: import("../internalLogger").InternalLogger;
9
- config: Config<import("..").APIEvent>;
9
+ config: Config;
10
10
  metas: Metas;
11
11
  logDebug(...args: unknown[]): void;
12
12
  logInfo(...args: unknown[]): void;
@@ -1,7 +1,6 @@
1
- /// <reference types="node" />
2
1
  import type { Faro, internalGlobalObjectKey } from '../sdk';
3
2
  export type GlobalObject<T = typeof globalThis | typeof global | typeof self> = T & {
4
3
  [label: string]: Faro;
5
4
  [internalGlobalObjectKey]: Faro;
6
5
  };
7
- export declare const globalObject: GlobalObject<typeof globalThis | (Window & typeof globalThis)>;
6
+ export declare const globalObject: GlobalObject;
@@ -1,5 +1,5 @@
1
- export { defaultExceptionType, defaultLogArgsSerializer, defaultErrorArgsSerializer, apiMessageBus, USER_ACTION_CANCEL_MESSAGE_TYPE, USER_ACTION_END_MESSAGE_TYPE, USER_ACTION_START_MESSAGE_TYPE, } from './api';
2
- export type { API, APIEvent, EventAttributes, EventEvent, EventsAPI, ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, LogArgsSerializer, LogContext, LogEvent, LogsAPI, MeasurementEvent, MeasurementsAPI, MetaAPI, OTELApi, PushErrorOptions, PushEventOptions, PushLogOptions, PushMeasurementOptions, Stacktrace, StacktraceParser, TraceContext, TraceEvent, TracesAPI, ApiMessageBusMessages, UserActionStartMessage, UserActionEndMessage, UserActionCancelMessage, UserAction, } from './api';
1
+ export { defaultExceptionType, defaultLogArgsSerializer, defaultErrorArgsSerializer, apiMessageBus, USER_ACTION_CANCEL, USER_ACTION_END, USER_ACTION_START, USER_ACTION_HALT, } from './api';
2
+ export type { API, APIEvent, EventAttributes, EventEvent, EventsAPI, ExceptionEvent, ExceptionStackFrame, ExceptionsAPI, ExtendedError, LogArgsSerializer, LogContext, LogEvent, LogsAPI, MeasurementEvent, MeasurementsAPI, MetaAPI, OTELApi, PushErrorOptions, PushEventOptions, PushLogOptions, PushMeasurementOptions, Stacktrace, StacktraceParser, TraceContext, TraceEvent, TracesAPI, ApiMessageBusMessages, UserActionStartMessage, UserActionEndMessage, UserActionCancelMessage, UserActionHaltMessage, UserAction, } from './api';
3
3
  export { BaseExtension } from './extensions';
4
4
  export type { Extension } from './extensions';
5
5
  export { globalObject } from './globalObject';
@@ -19,7 +19,7 @@ export { BaseTransport, getTransportBody, TransportItemType, transportItemTypeTo
19
19
  export type { BeforeSendHook, SendFn, Transport, TransportBody, TransportItem, TransportItemPayload, Transports, } from './transports';
20
20
  export { defaultUnpatchedConsole } from './unpatchedConsole';
21
21
  export type { UnpatchedConsole } from './unpatchedConsole';
22
- export { allLogLevels, createPromiseBuffer, deepEqual, defaultLogLevel, genShortID, getCurrentTimestamp, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, LogLevel, noop, dateNow, isEmpty, getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues, Observable, merge, } from './utils';
22
+ export { allLogLevels, createPromiseBuffer, deepEqual, defaultLogLevel, genShortID, getCurrentTimestamp, isArray, isBoolean, isDomError, isDomException, isElement, isElementDefined, isError, isErrorDefined, isErrorEvent, isEvent, isEventDefined, isFunction, isInstanceOf, isInt, isMap, isMapDefined, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isSyntheticEvent, isThenable, isToString, isTypeof, isUndefined, LogLevel, noop, dateNow, isEmpty, getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues, Observable, } from './utils';
23
23
  export type { BaseObject, BaseObjectKey, BaseObjectPrimitiveValue, BaseObjectValue, BufferItem, PromiseBuffer, PromiseBufferOptions, PromiseProducer, Subscription, } from './utils';
24
24
  export { VERSION } from './version';
25
25
  export { unknownString } from './consts';
@@ -4,7 +4,7 @@ import type { Transport, TransportItem } from '../transports';
4
4
  export declare class MockTransport extends BaseTransport implements Transport {
5
5
  private ignoreURLs;
6
6
  readonly name = "@grafana/transport-mock";
7
- readonly version = "1.14.3";
7
+ readonly version = "1.15.0";
8
8
  items: TransportItem[];
9
9
  constructor(ignoreURLs?: Patterns);
10
10
  send(items: TransportItem[]): void | Promise<void>;
@@ -11,5 +11,5 @@ export { genShortID } from './shortId';
11
11
  export { getBundleId } from './sourceMaps';
12
12
  export { dateNow } from './date';
13
13
  export { getCircularDependencyReplacer, stringifyExternalJson, stringifyObjectValues } from './json';
14
- export { Observable, merge } from './reactive';
14
+ export { Observable } from './reactive';
15
15
  export type { Subscription } from './reactive';
@@ -1,46 +1,17 @@
1
- export interface Subscription {
1
+ export type Subscription = {
2
2
  unsubscribe: () => void;
3
- }
3
+ };
4
+ type Subscriber<T> = (value: T) => void;
4
5
  export declare class Observable<T = any> {
5
6
  private subscribers;
6
- constructor();
7
- /**
8
- * Subscribes a callback function to the observable.
9
- * @param callback - The function to call when the observable emits a value.
10
- * @returns A subscription object with an unsubscribe method to cancel the subscription.
11
- */
12
- subscribe(callback: (data: T) => void): Subscription;
13
- /**
14
- * Notifies all subscribers with the given data.
15
- * @param data - The data to emit to all subscribers.
16
- */
17
- notify(data: T): void;
18
- /**
19
- * Subscribes a callback function to the observable and automatically unsubscribes after the first emission.
20
- * @param callback - The function to call when the observable emits a value.
21
- * @returns A subscription object with an unsubscribe method to cancel the subscription.
22
- */
23
- first(callback: (data: T) => void): Subscription;
24
- /**
25
- * Emits values from the source observable until the provided predicate function returns false.
26
- * @param predicate - A function that evaluates each value emitted by the source observable.
27
- * @returns A new observable that emits values from the source observable while the predicate returns true.
28
- */
7
+ subscribe(subscriber: Subscriber<T>): Subscription;
8
+ unsubscribe(subscriber: Subscriber<T>): void;
9
+ notify(value: T): void;
10
+ first(): Observable<T>;
29
11
  takeWhile(predicate: (value: T) => boolean): Observable<T>;
30
- /**
31
- * Unsubscribes all subscribers by clearing the subscribers array.
32
- *
33
- * @remarks
34
- * This method sets the `subscribers` array to an empty array, effectively removing all current subscribers.
35
- */
36
- unsubscribeAll(): void;
37
- private unsubscribe;
12
+ filter(predicate: (value: T) => boolean): Observable<T>;
13
+ merge(...observables: Array<Observable<T>>): Observable<T>;
14
+ private withUnsubscribeOverride;
15
+ private unsubscribeAll;
38
16
  }
39
- /**
40
- * Merges multiple observables into a single observable.
41
- *
42
- * @template T - The type of the values emitted by the observables.
43
- * @param {...Observable[]} observables - The observables to merge.
44
- * @returns {Observable} A new observable that emits values from all input observables.
45
- */
46
- export declare function merge<T>(...observables: Array<Observable<T>>): Observable<T>;
17
+ export {};
@@ -1 +1 @@
1
- export declare const VERSION = "1.14.3";
1
+ export declare const VERSION = "1.15.0";
@@ -1 +1 @@
1
- {"version":3,"file":"ItemBuffer.js","sourceRoot":"","sources":["../../../src/api/ItemBuffer.ts"],"names":[],"mappings":";;;AAAA,kCAAyC;AAEzC;IAGE;QACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,4BAAO,GAAP,UAAQ,IAAO;QACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,gCAAW,GAAX,UAAY,EAAsB;QAChC,IAAI,IAAA,eAAU,EAAC,EAAE,CAAC,EAAE;YAClB,KAAmB,UAAW,EAAX,KAAA,IAAI,CAAC,MAAM,EAAX,cAAW,EAAX,IAAW,EAAE;gBAA3B,IAAM,IAAI,SAAA;gBACb,EAAE,CAAC,IAAI,CAAC,CAAC;aACV;SACF;QAED,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IACzB,CAAC;IAED,yBAAI,GAAJ;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;IACH,iBAAC;AAAD,CAAC,AAxBD,IAwBC;AAxBY,gCAAU","sourcesContent":["import { isFunction } from '../utils/is';\n\nexport class ItemBuffer<T> {\n private buffer: T[];\n\n constructor() {\n this.buffer = [];\n }\n\n addItem(item: T) {\n this.buffer.push(item);\n }\n\n flushBuffer(cb?: (item: T) => void) {\n if (isFunction(cb)) {\n for (const item of this.buffer) {\n cb(item);\n }\n }\n\n this.buffer.length = 0;\n }\n\n size() {\n return this.buffer.length;\n }\n}\n"]}
1
+ {"version":3,"file":"ItemBuffer.js","sourceRoot":"","sources":["../../../src/api/ItemBuffer.ts"],"names":[],"mappings":";;;AAAA,kCAAyC;AAEzC;IAGE;QACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,4BAAO,GAAP,UAAQ,IAAO;QACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,gCAAW,GAAX,UAAY,EAAsB;QAChC,IAAI,IAAA,eAAU,EAAC,EAAE,CAAC,EAAE,CAAC;YACnB,KAAmB,UAAW,EAAX,KAAA,IAAI,CAAC,MAAM,EAAX,cAAW,EAAX,IAAW,EAAE,CAAC;gBAA5B,IAAM,IAAI,SAAA;gBACb,EAAE,CAAC,IAAI,CAAC,CAAC;YACX,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IACzB,CAAC;IAED,yBAAI,GAAJ;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;IACH,iBAAC;AAAD,CAAC,AAxBD,IAwBC;AAxBY,gCAAU","sourcesContent":["import { isFunction } from '../utils/is';\n\nexport class ItemBuffer<T> {\n private buffer: T[];\n\n constructor() {\n this.buffer = [];\n }\n\n addItem(item: T) {\n this.buffer.push(item);\n }\n\n flushBuffer(cb?: (item: T) => void) {\n if (isFunction(cb)) {\n for (const item of this.buffer) {\n cb(item);\n }\n }\n\n this.buffer.length = 0;\n }\n\n size() {\n return this.buffer.length;\n }\n}\n"]}
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.USER_ACTION_CANCEL_MESSAGE_TYPE = exports.USER_ACTION_END_MESSAGE_TYPE = exports.USER_ACTION_START_MESSAGE_TYPE = void 0;
4
- exports.USER_ACTION_START_MESSAGE_TYPE = 'user-action-start';
5
- exports.USER_ACTION_END_MESSAGE_TYPE = 'user-action-end';
6
- exports.USER_ACTION_CANCEL_MESSAGE_TYPE = 'user-action-cancel';
3
+ exports.USER_ACTION_HALT = exports.USER_ACTION_CANCEL = exports.USER_ACTION_END = exports.USER_ACTION_START = void 0;
4
+ exports.USER_ACTION_START = 'user-action-start';
5
+ exports.USER_ACTION_END = 'user-action-end';
6
+ exports.USER_ACTION_CANCEL = 'user-action-cancel';
7
+ exports.USER_ACTION_HALT = 'user-action-halt';
7
8
  //# sourceMappingURL=const.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["../../../src/api/const.ts"],"names":[],"mappings":";;;AAAa,QAAA,8BAA8B,GAAG,mBAAmB,CAAC;AACrD,QAAA,4BAA4B,GAAG,iBAAiB,CAAC;AACjD,QAAA,+BAA+B,GAAG,oBAAoB,CAAC","sourcesContent":["export const USER_ACTION_START_MESSAGE_TYPE = 'user-action-start';\nexport const USER_ACTION_END_MESSAGE_TYPE = 'user-action-end';\nexport const USER_ACTION_CANCEL_MESSAGE_TYPE = 'user-action-cancel';\n"]}
1
+ {"version":3,"file":"const.js","sourceRoot":"","sources":["../../../src/api/const.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,mBAAmB,CAAC;AACxC,QAAA,eAAe,GAAG,iBAAiB,CAAC;AACpC,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,gBAAgB,GAAG,kBAAkB,CAAC","sourcesContent":["export const USER_ACTION_START = 'user-action-start';\nexport const USER_ACTION_END = 'user-action-end';\nexport const USER_ACTION_CANCEL = 'user-action-cancel';\nexport const USER_ACTION_HALT = 'user-action-halt';\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initializeEventsAPI = void 0;
3
+ exports.initializeEventsAPI = initializeEventsAPI;
4
4
  var transports_1 = require("../../transports");
5
5
  var utils_1 = require("../../utils");
6
6
  var date_1 = require("../../utils/date");
@@ -40,7 +40,7 @@ function initializeEventsAPI(_a) {
40
40
  lastPayload = testingPayload;
41
41
  internalLogger.debug('Pushing event\n', item);
42
42
  var msg = getMessage();
43
- if (msg && msg.type === const_1.USER_ACTION_START_MESSAGE_TYPE) {
43
+ if (msg && msg.type === const_1.USER_ACTION_START) {
44
44
  actionBuffer.addItem(item);
45
45
  }
46
46
  else {
@@ -55,5 +55,4 @@ function initializeEventsAPI(_a) {
55
55
  pushEvent: pushEvent,
56
56
  };
57
57
  }
58
- exports.initializeEventsAPI = initializeEventsAPI;
59
58
  //# sourceMappingURL=initialize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/events/initialize.ts"],"names":[],"mappings":";;;AAGA,+CAAqD;AAGrD,qCAAqG;AACrG,yCAAwD;AACxD,kCAA0D;AAO1D,SAAgB,mBAAmB,CAAC,EAiBnC;QAhBC,cAAc,oBAAA,EACd,MAAM,YAAA,EACN,KAAK,WAAA,EACL,UAAU,gBAAA,EACV,SAAS,eAAA,EACT,YAAY,kBAAA,EACZ,UAAU,gBAAA;IAWV,IAAI,WAAW,GAA8D,IAAI,CAAC;IAElF,IAAM,SAAS,GAA2B,UACxC,IAAI,EACJ,UAAU,EACV,MAAM,EACN,EAAmH;YAAnH,qBAAiH,EAAE,KAAA,EAAjH,UAAU,gBAAA,EAAE,WAAW,iBAAA,EAAE,oBAAoB,0BAAA,EAAE,gCAA2D,EAA3D,wBAAwB,mBAAG,UAAC,OAAmB,IAAK,OAAA,OAAO,EAAP,CAAO,KAAA;QAE5G,IAAI;YACF,IAAM,KAAK,GAAG,IAAA,6BAAqB,EAAC,UAAU,CAAC,CAAC;YAEhD,IAAM,IAAI,GAA8B;gBACtC,IAAI,EAAE,KAAK,CAAC,KAAK;gBACjB,OAAO,EAAE,wBAAwB,CAAC;oBAChC,IAAI,MAAA;oBACJ,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,MAAM,CAAC,WAAW;oBACpC,UAAU,EAAE,IAAA,eAAO,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK;oBAC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WAAA;KACV,CAAC;AACJ,CAAC;AA5ED,kDA4EC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport { deepEqual, getCurrentTimestamp, isEmpty, isNull, stringifyObjectValues } from '../../utils';\nimport { timestampToIsoString } from '../../utils/date';\nimport { USER_ACTION_START_MESSAGE_TYPE } from '../const';\nimport type { ItemBuffer } from '../ItemBuffer';\nimport type { TracesAPI } from '../traces';\nimport type { ApiMessageBusMessages } from '../types';\n\nimport type { EventEvent, EventsAPI } from './types';\n\nexport function initializeEventsAPI({\n internalLogger,\n config,\n metas,\n transports,\n tracesApi,\n actionBuffer,\n getMessage,\n}: {\n unpatchedConsole: UnpatchedConsole;\n internalLogger: InternalLogger;\n config: Config;\n metas: Metas;\n transports: Transports;\n tracesApi: TracesAPI;\n actionBuffer: ItemBuffer<TransportItem>;\n getMessage: () => ApiMessageBusMessages | undefined;\n}): EventsAPI {\n let lastPayload: Pick<EventEvent, 'name' | 'domain' | 'attributes'> | null = null;\n\n const pushEvent: EventsAPI['pushEvent'] = (\n name,\n attributes,\n domain,\n { skipDedupe, spanContext, timestampOverwriteMs, customPayloadTransformer = (payload: EventEvent) => payload } = {}\n ) => {\n try {\n const attrs = stringifyObjectValues(attributes);\n\n const item: TransportItem<EventEvent> = {\n meta: metas.value,\n payload: customPayloadTransformer({\n name,\n domain: domain ?? config.eventDomain,\n attributes: isEmpty(attrs) ? undefined : attrs,\n timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),\n trace: spanContext\n ? {\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n }\n : tracesApi.getTraceContext(),\n }),\n type: TransportItemType.EVENT,\n };\n\n const testingPayload = {\n name: item.payload.name,\n attributes: item.payload.attributes,\n domain: item.payload.domain,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping event push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing event\\n', item);\n\n const msg = getMessage();\n if (msg && msg.type === USER_ACTION_START_MESSAGE_TYPE) {\n actionBuffer.addItem(item);\n } else {\n transports.execute(item);\n }\n } catch (err) {\n internalLogger.error('Error pushing event', err);\n }\n };\n\n return {\n pushEvent,\n };\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/events/initialize.ts"],"names":[],"mappings":";;AAeA,kDA4EC;AAxFD,+CAAqD;AAGrD,qCAAqG;AACrG,yCAAwD;AACxD,kCAA6C;AAO7C,SAAgB,mBAAmB,CAAC,EAiBnC;QAhBC,cAAc,oBAAA,EACd,MAAM,YAAA,EACN,KAAK,WAAA,EACL,UAAU,gBAAA,EACV,SAAS,eAAA,EACT,YAAY,kBAAA,EACZ,UAAU,gBAAA;IAWV,IAAI,WAAW,GAA8D,IAAI,CAAC;IAElF,IAAM,SAAS,GAA2B,UACxC,IAAI,EACJ,UAAU,EACV,MAAM,EACN,EAAmH;YAAnH,qBAAiH,EAAE,KAAA,EAAjH,UAAU,gBAAA,EAAE,WAAW,iBAAA,EAAE,oBAAoB,0BAAA,EAAE,gCAA2D,EAA3D,wBAAwB,mBAAG,UAAC,OAAmB,IAAK,OAAA,OAAO,EAAP,CAAO,KAAA;QAE5G,IAAI,CAAC;YACH,IAAM,KAAK,GAAG,IAAA,6BAAqB,EAAC,UAAU,CAAC,CAAC;YAEhD,IAAM,IAAI,GAA8B;gBACtC,IAAI,EAAE,KAAK,CAAC,KAAK;gBACjB,OAAO,EAAE,wBAAwB,CAAC;oBAChC,IAAI,MAAA;oBACJ,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,MAAM,CAAC,WAAW;oBACpC,UAAU,EAAE,IAAA,eA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AG,EAAE,CAAC;YACb,cAAc,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;QACnD,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,SAAS,WAAA;KACV,CAAC;AACJ,CAAC","sourcesContent":["import type { Config } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport { deepEqual, getCurrentTimestamp, isEmpty, isNull, stringifyObjectValues } from '../../utils';\nimport { timestampToIsoString } from '../../utils/date';\nimport { USER_ACTION_START } from '../const';\nimport type { ItemBuffer } from '../ItemBuffer';\nimport type { TracesAPI } from '../traces';\nimport type { ApiMessageBusMessages } from '../types';\n\nimport type { EventEvent, EventsAPI } from './types';\n\nexport function initializeEventsAPI({\n internalLogger,\n config,\n metas,\n transports,\n tracesApi,\n actionBuffer,\n getMessage,\n}: {\n unpatchedConsole: UnpatchedConsole;\n internalLogger: InternalLogger;\n config: Config;\n metas: Metas;\n transports: Transports;\n tracesApi: TracesAPI;\n actionBuffer: ItemBuffer<TransportItem>;\n getMessage: () => ApiMessageBusMessages | undefined;\n}): EventsAPI {\n let lastPayload: Pick<EventEvent, 'name' | 'domain' | 'attributes'> | null = null;\n\n const pushEvent: EventsAPI['pushEvent'] = (\n name,\n attributes,\n domain,\n { skipDedupe, spanContext, timestampOverwriteMs, customPayloadTransformer = (payload: EventEvent) => payload } = {}\n ) => {\n try {\n const attrs = stringifyObjectValues(attributes);\n\n const item: TransportItem<EventEvent> = {\n meta: metas.value,\n payload: customPayloadTransformer({\n name,\n domain: domain ?? config.eventDomain,\n attributes: isEmpty(attrs) ? undefined : attrs,\n timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),\n trace: spanContext\n ? {\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n }\n : tracesApi.getTraceContext(),\n }),\n type: TransportItemType.EVENT,\n };\n\n const testingPayload = {\n name: item.payload.name,\n attributes: item.payload.attributes,\n domain: item.payload.domain,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping event push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing event\\n', item);\n\n const msg = getMessage();\n if (msg && msg.type === USER_ACTION_START) {\n actionBuffer.addItem(item);\n } else {\n transports.execute(item);\n }\n } catch (err) {\n internalLogger.error('Error pushing event', err);\n }\n };\n\n return {\n pushEvent,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../src/api/exceptions/const.ts"],"names":[],"mappings":";;;AAAA,qCAA8D;AAEjD,QAAA,oBAAoB,GAAG,OAAO,CAAC;AAErC,IAAM,0BAA0B,GAAG,UAAC,IAAsB;IAC/D,OAAO,IAAI;SACR,GAAG,CAAC,UAAC,GAAG;QACP,IAAI,IAAA,gBAAQ,EAAC,GAAG,CAAC,EAAE;YACjB,OAAO,IAAA,6BAAqB,EAAC,GAAG,CAAC,CAAC;SACnC;QAED,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC,CAAC;AAVW,QAAA,0BAA0B,8BAUrC","sourcesContent":["import { isObject, stringifyExternalJson } from '../../utils';\n\nexport const defaultExceptionType = 'Error';\n\nexport const defaultErrorArgsSerializer = (args: [any?, ...any[]]) => {\n return args\n .map((arg) => {\n if (isObject(arg)) {\n return stringifyExternalJson(arg);\n }\n\n return String(arg);\n })\n .join(' ');\n};\n"]}
1
+ {"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../src/api/exceptions/const.ts"],"names":[],"mappings":";;;AAAA,qCAA8D;AAEjD,QAAA,oBAAoB,GAAG,OAAO,CAAC;AAErC,IAAM,0BAA0B,GAAG,UAAC,IAAsB;IAC/D,OAAO,IAAI;SACR,GAAG,CAAC,UAAC,GAAG;QACP,IAAI,IAAA,gBAAQ,EAAC,GAAG,CAAC,EAAE,CAAC;YAClB,OAAO,IAAA,6BAAqB,EAAC,GAAG,CAAC,CAAC;QACpC,CAAC;QAED,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC,CAAC;AAVW,QAAA,0BAA0B,8BAUrC","sourcesContent":["import { isObject, stringifyExternalJson } from '../../utils';\n\nexport const defaultExceptionType = 'Error';\n\nexport const defaultErrorArgsSerializer = (args: [any?, ...any[]]) => {\n return args\n .map((arg) => {\n if (isObject(arg)) {\n return stringifyExternalJson(arg);\n }\n\n return String(arg);\n })\n .join(' ');\n};\n"]}
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.initializeExceptionsAPI = void 0;
14
+ exports.initializeExceptionsAPI = initializeExceptionsAPI;
15
15
  var transports_1 = require("../../transports");
16
16
  var utils_1 = require("../../utils");
17
17
  var date_1 = require("../../utils/date");
@@ -73,7 +73,7 @@ function initializeExceptionsAPI(_a) {
73
73
  lastPayload = testingPayload;
74
74
  internalLogger.debug('Pushing exception\n', item);
75
75
  var msg = getMessage();
76
- if (msg && msg.type === const_1.USER_ACTION_START_MESSAGE_TYPE) {
76
+ if (msg && msg.type === const_1.USER_ACTION_START) {
77
77
  actionBuffer.addItem(item);
78
78
  }
79
79
  else {
@@ -91,7 +91,6 @@ function initializeExceptionsAPI(_a) {
91
91
  pushError: pushError,
92
92
  };
93
93
  }
94
- exports.initializeExceptionsAPI = initializeExceptionsAPI;
95
94
  function parseCause(error) {
96
95
  var cause = error.cause;
97
96
  if ((0, utils_1.isError)(cause)) {
@@ -1 +1 @@
1
- {"version":3,"file":"init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,GAAG,IAAA,6BAAqB,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KAC5C;SAAM,IAAI,KAAK,IAAI,IAAI,EAAE;QACxB,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;KAChC;IAED,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC;AACxC,CAAC;AAED,SAAS,cAAc,CAAC,YAAsB,EAAE,KAA+B;IACrE,IAAA,OAAO,GAAkB,KAAK,QAAvB,EAAE,IAAI,GAAY,KAAK,KAAjB,EAAE,KAAK,GAAK,KAAK,MAAV,CAAW;IACvC,OAAO,IAAA,yBAAiB,EAAC,YAAY,EAAE,OAAO,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import type { Config, Patterns } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport {\n deepEqual,\n getCurrentTimestamp,\n isArray,\n isEmpty,\n isError,\n isNull,\n isObject,\n stringifyExternalJson,\n stringifyObjectValues,\n} from '../../utils';\nimport { timestampToIsoString } from '../../utils/date';\nimport { USER_ACTION_START_MESSAGE_TYPE } from '../const';\nimport type { ItemBuffer } from '../ItemBuffer';\nimport type { TracesAPI } from '../traces';\nimport type { ApiMessageBusMessages } from '../types';\nimport { shouldIgnoreEvent } from '../utils';\n\nimport { defaultExceptionType } from './const';\nimport type { ErrorWithIndexProperties, ExceptionEvent, ExceptionsAPI, StacktraceParser } from './types';\n\nlet stacktraceParser: StacktraceParser | undefined;\n\nexport function initializeExceptionsAPI({\n internalLogger,\n config,\n metas,\n transports,\n tracesApi,\n actionBuffer,\n getMessage,\n}: {\n unpatchedConsole: UnpatchedConsole;\n internalLogger: InternalLogger;\n config: Config;\n metas: Metas;\n transports: Transports;\n tracesApi: TracesAPI;\n actionBuffer: ItemBuffer<TransportItem>;\n getMessage: () => ApiMessageBusMessages | undefined;\n}): ExceptionsAPI {\n internalLogger.debug('Initializing exceptions API');\n\n let lastPayload: Pick<ExceptionEvent, 'type' | 'value' | 'stacktrace' | 'context'> | null = null;\n\n stacktraceParser = config.parseStacktrace ?? stacktraceParser;\n\n const changeStacktraceParser: ExceptionsAPI['changeStacktraceParser'] = (newStacktraceParser) => {\n internalLogger.debug('Changing stacktrace parser');\n\n stacktraceParser = newStacktraceParser ?? stacktraceParser;\n };\n\n const getStacktraceParser: ExceptionsAPI['getStacktraceParser'] = () => stacktraceParser;\n\n const { ignoreErrors = [] } = config;\n\n const pushError: ExceptionsAPI['pushError'] = (\n error,\n { skipDedupe, stackFrames, type, context, spanContext, timestampOverwriteMs } = {}\n ) => {\n if (isErrorIgnored(ignoreErrors, error)) {\n return;\n }\n try {\n const ctx = stringifyObjectValues({\n ...parseCause(error),\n ...(context ?? {}),\n });\n\n const item: TransportItem<ExceptionEvent> = {\n meta: metas.value,\n payload: {\n type: type || error.name || defaultExceptionType,\n value: error.message,\n timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),\n trace: spanContext\n ? {\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n }\n : tracesApi.getTraceContext(),\n context: isEmpty(ctx) ? undefined : ctx,\n },\n type: TransportItemType.EXCEPTION,\n };\n\n stackFrames = stackFrames ?? (error.stack ? stacktraceParser?.(error).frames : undefined);\n\n if (stackFrames?.length) {\n item.payload.stacktrace = {\n frames: stackFrames,\n };\n }\n\n const testingPayload = {\n type: item.payload.type,\n value: item.payload.value,\n stackTrace: item.payload.stacktrace,\n context: item.payload.context,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping error push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing exception\\n', item);\n\n const msg = getMessage();\n if (msg && msg.type === USER_ACTION_START_MESSAGE_TYPE) {\n actionBuffer.addItem(item);\n } else {\n transports.execute(item);\n }\n } catch (err) {\n internalLogger.error('Error pushing event', err);\n }\n };\n\n changeStacktraceParser(config.parseStacktrace);\n\n return {\n changeStacktraceParser,\n getStacktraceParser,\n pushError,\n };\n}\n\nfunction parseCause(error: ErrorWithIndexProperties): {} | { cause: string } {\n let cause = error.cause;\n\n if (isError(cause)) {\n cause = error.cause.toString();\n // typeof operator on null returns \"object\". This is a well-known quirk in JavaScript and is considered a bug that cannot be fixed due to backward compatibility issues.\n // MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#typeof_null\n } else if (cause !== null && (isObject(error.cause) || isArray(error.cause))) {\n cause = stringifyExternalJson(error.cause);\n } else if (cause != null) {\n cause = error.cause.toString();\n }\n\n return cause == null ? {} : { cause };\n}\n\nfunction isErrorIgnored(ignoreErrors: Patterns, error: ErrorWithIndexProperties): boolean {\n const { message, name, stack } = error;\n return shouldIgnoreEvent(ignoreErrors, message + ' ' + name + ' ' + stack);\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../../src/api/exceptions/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;;AA6BA,0DA2GC;AArID,+CAAqD;AAGrD,qCAUqB;AACrB,yCAAwD;AACxD,kCAA6C;AAI7C,kCAA6C;AAE7C,iCAA+C;AAG/C,IAAI,gBAA8C,CAAC;AAEnD,SAAgB,uBAAuB,CAAC,EAiBvC;;QAhBC,cAAc,oBAAA,EACd,MAAM,YAAA,EACN,KAAK,WAAA,EACL,UAAU,gBAAA,EACV,SAAS,eAAA,EACT,YAAY,kBAAA,EACZ,UAAU,gBAAA;IAWV,cAAc,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAEpD,IAAI,WAAW,GAA6E,IAAI,CAA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AO,GAAkB,KAAK,QAAvB,EAAE,IAAI,GAAY,KAAK,KAAjB,EAAE,KAAK,GAAK,KAAK,MAAV,CAAW;IACvC,OAAO,IAAA,yBAAiB,EAAC,YAAY,EAAE,OAAO,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import type { Config, Patterns } from '../../config';\nimport type { InternalLogger } from '../../internalLogger';\nimport type { Metas } from '../../metas';\nimport { TransportItemType } from '../../transports';\nimport type { TransportItem, Transports } from '../../transports';\nimport type { UnpatchedConsole } from '../../unpatchedConsole';\nimport {\n deepEqual,\n getCurrentTimestamp,\n isArray,\n isEmpty,\n isError,\n isNull,\n isObject,\n stringifyExternalJson,\n stringifyObjectValues,\n} from '../../utils';\nimport { timestampToIsoString } from '../../utils/date';\nimport { USER_ACTION_START } from '../const';\nimport type { ItemBuffer } from '../ItemBuffer';\nimport type { TracesAPI } from '../traces';\nimport type { ApiMessageBusMessages } from '../types';\nimport { shouldIgnoreEvent } from '../utils';\n\nimport { defaultExceptionType } from './const';\nimport type { ErrorWithIndexProperties, ExceptionEvent, ExceptionsAPI, StacktraceParser } from './types';\n\nlet stacktraceParser: StacktraceParser | undefined;\n\nexport function initializeExceptionsAPI({\n internalLogger,\n config,\n metas,\n transports,\n tracesApi,\n actionBuffer,\n getMessage,\n}: {\n unpatchedConsole: UnpatchedConsole;\n internalLogger: InternalLogger;\n config: Config;\n metas: Metas;\n transports: Transports;\n tracesApi: TracesAPI;\n actionBuffer: ItemBuffer<TransportItem>;\n getMessage: () => ApiMessageBusMessages | undefined;\n}): ExceptionsAPI {\n internalLogger.debug('Initializing exceptions API');\n\n let lastPayload: Pick<ExceptionEvent, 'type' | 'value' | 'stacktrace' | 'context'> | null = null;\n\n stacktraceParser = config.parseStacktrace ?? stacktraceParser;\n\n const changeStacktraceParser: ExceptionsAPI['changeStacktraceParser'] = (newStacktraceParser) => {\n internalLogger.debug('Changing stacktrace parser');\n\n stacktraceParser = newStacktraceParser ?? stacktraceParser;\n };\n\n const getStacktraceParser: ExceptionsAPI['getStacktraceParser'] = () => stacktraceParser;\n\n const { ignoreErrors = [] } = config;\n\n const pushError: ExceptionsAPI['pushError'] = (\n error,\n { skipDedupe, stackFrames, type, context, spanContext, timestampOverwriteMs } = {}\n ) => {\n if (isErrorIgnored(ignoreErrors, error)) {\n return;\n }\n try {\n const ctx = stringifyObjectValues({\n ...parseCause(error),\n ...(context ?? {}),\n });\n\n const item: TransportItem<ExceptionEvent> = {\n meta: metas.value,\n payload: {\n type: type || error.name || defaultExceptionType,\n value: error.message,\n timestamp: timestampOverwriteMs ? timestampToIsoString(timestampOverwriteMs) : getCurrentTimestamp(),\n trace: spanContext\n ? {\n trace_id: spanContext.traceId,\n span_id: spanContext.spanId,\n }\n : tracesApi.getTraceContext(),\n context: isEmpty(ctx) ? undefined : ctx,\n },\n type: TransportItemType.EXCEPTION,\n };\n\n stackFrames = stackFrames ?? (error.stack ? stacktraceParser?.(error).frames : undefined);\n\n if (stackFrames?.length) {\n item.payload.stacktrace = {\n frames: stackFrames,\n };\n }\n\n const testingPayload = {\n type: item.payload.type,\n value: item.payload.value,\n stackTrace: item.payload.stacktrace,\n context: item.payload.context,\n };\n\n if (!skipDedupe && config.dedupe && !isNull(lastPayload) && deepEqual(testingPayload, lastPayload)) {\n internalLogger.debug('Skipping error push because it is the same as the last one\\n', item.payload);\n\n return;\n }\n\n lastPayload = testingPayload;\n\n internalLogger.debug('Pushing exception\\n', item);\n\n const msg = getMessage();\n if (msg && msg.type === USER_ACTION_START) {\n actionBuffer.addItem(item);\n } else {\n transports.execute(item);\n }\n } catch (err) {\n internalLogger.error('Error pushing event', err);\n }\n };\n\n changeStacktraceParser(config.parseStacktrace);\n\n return {\n changeStacktraceParser,\n getStacktraceParser,\n pushError,\n };\n}\n\nfunction parseCause(error: ErrorWithIndexProperties): {} | { cause: string } {\n let cause = error.cause;\n\n if (isError(cause)) {\n cause = error.cause.toString();\n // typeof operator on null returns \"object\". This is a well-known quirk in JavaScript and is considered a bug that cannot be fixed due to backward compatibility issues.\n // MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#typeof_null\n } else if (cause !== null && (isObject(error.cause) || isArray(error.cause))) {\n cause = stringifyExternalJson(error.cause);\n } else if (cause != null) {\n cause = error.cause.toString();\n }\n\n return cause == null ? {} : { cause };\n}\n\nfunction isErrorIgnored(ignoreErrors: Patterns, error: ErrorWithIndexProperties): boolean {\n const { message, name, stack } = error;\n return shouldIgnoreEvent(ignoreErrors, message + ' ' + name + ' ' + stack);\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.USER_ACTION_START_MESSAGE_TYPE = exports.USER_ACTION_END_MESSAGE_TYPE = exports.USER_ACTION_CANCEL_MESSAGE_TYPE = exports.apiMessageBus = exports.defaultLogArgsSerializer = exports.defaultErrorArgsSerializer = exports.defaultExceptionType = exports.initializeAPI = void 0;
3
+ exports.USER_ACTION_HALT = exports.USER_ACTION_START = exports.USER_ACTION_END = exports.USER_ACTION_CANCEL = exports.apiMessageBus = exports.defaultLogArgsSerializer = exports.defaultErrorArgsSerializer = exports.defaultExceptionType = exports.initializeAPI = void 0;
4
4
  var initialize_1 = require("./initialize");
5
5
  Object.defineProperty(exports, "initializeAPI", { enumerable: true, get: function () { return initialize_1.initializeAPI; } });
6
6
  var exceptions_1 = require("./exceptions");
@@ -11,7 +11,8 @@ Object.defineProperty(exports, "defaultLogArgsSerializer", { enumerable: true, g
11
11
  var initialize_2 = require("./initialize");
12
12
  Object.defineProperty(exports, "apiMessageBus", { enumerable: true, get: function () { return initialize_2.apiMessageBus; } });
13
13
  var const_1 = require("./const");
14
- Object.defineProperty(exports, "USER_ACTION_CANCEL_MESSAGE_TYPE", { enumerable: true, get: function () { return const_1.USER_ACTION_CANCEL_MESSAGE_TYPE; } });
15
- Object.defineProperty(exports, "USER_ACTION_END_MESSAGE_TYPE", { enumerable: true, get: function () { return const_1.USER_ACTION_END_MESSAGE_TYPE; } });
16
- Object.defineProperty(exports, "USER_ACTION_START_MESSAGE_TYPE", { enumerable: true, get: function () { return const_1.USER_ACTION_START_MESSAGE_TYPE; } });
14
+ Object.defineProperty(exports, "USER_ACTION_CANCEL", { enumerable: true, get: function () { return const_1.USER_ACTION_CANCEL; } });
15
+ Object.defineProperty(exports, "USER_ACTION_END", { enumerable: true, get: function () { return const_1.USER_ACTION_END; } });
16
+ Object.defineProperty(exports, "USER_ACTION_START", { enumerable: true, get: function () { return const_1.USER_ACTION_START; } });
17
+ Object.defineProperty(exports, "USER_ACTION_HALT", { enumerable: true, get: function () { return const_1.USER_ACTION_HALT; } });
17
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AAatB,2CAAgF;AAAvE,kHAAA,oBAAoB,OAAA;AAAE,wHAAA,0BAA0B,OAAA;AAWzD,+BAAkD;AAAzC,gHAAA,wBAAwB,OAAA;AASjC,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AAEtB,iCAAwH;AAA/G,wHAAA,+BAA+B,OAAA;AAAE,qHAAA,4BAA4B,OAAA;AAAE,uHAAA,8BAA8B,OAAA","sourcesContent":["export { initializeAPI } from './initialize';\nexport type {\n API,\n APIEvent,\n ApiMessageBusMessages,\n UserActionCancelMessage,\n UserActionEndMessage,\n UserActionStartMessage,\n UserAction,\n} 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\nexport { apiMessageBus } from './initialize';\n\nexport { USER_ACTION_CANCEL_MESSAGE_TYPE, USER_ACTION_END_MESSAGE_TYPE, USER_ACTION_START_MESSAGE_TYPE } from './const';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AActB,2CAAgF;AAAvE,kHAAA,oBAAoB,OAAA;AAAE,wHAAA,0BAA0B,OAAA;AAWzD,+BAAkD;AAAzC,gHAAA,wBAAwB,OAAA;AASjC,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AAEtB,iCAAmG;AAA1F,2GAAA,kBAAkB,OAAA;AAAE,wGAAA,eAAe,OAAA;AAAE,0GAAA,iBAAiB,OAAA;AAAE,yGAAA,gBAAgB,OAAA","sourcesContent":["export { initializeAPI } from './initialize';\nexport type {\n API,\n APIEvent,\n ApiMessageBusMessages,\n UserActionCancelMessage,\n UserActionEndMessage,\n UserActionStartMessage,\n UserActionHaltMessage,\n UserAction,\n} 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\nexport { apiMessageBus } from './initialize';\n\nexport { USER_ACTION_CANCEL, USER_ACTION_END, USER_ACTION_START, USER_ACTION_HALT } from './const';\n"]}
@@ -11,7 +11,8 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.initializeAPI = exports.apiMessageBus = void 0;
14
+ exports.apiMessageBus = void 0;
15
+ exports.initializeAPI = initializeAPI;
15
16
  var utils_1 = require("../utils");
16
17
  var events_1 = require("./events");
17
18
  var exceptions_1 = require("./exceptions");
@@ -37,5 +38,4 @@ function initializeAPI(unpatchedConsole, internalLogger, config, metas, transpor
37
38
  };
38
39
  return __assign(__assign(__assign(__assign(__assign(__assign({}, tracesApi), (0, exceptions_1.initializeExceptionsAPI)(props)), (0, meta_1.initializeMetaAPI)(props)), (0, logs_1.initializeLogsAPI)(props)), (0, measurements_1.initializeMeasurementsAPI)(props)), (0, events_1.initializeEventsAPI)(props));
39
40
  }
40
- exports.initializeAPI = initializeAPI;
41
41
  //# sourceMappingURL=initialize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/api/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAKA,kCAAsC;AAEtC,mCAA+C;AAC/C,2CAAuD;AACvD,+BAA2C;AAC3C,+CAA2D;AAC3D,+BAA2C;AAC3C,mCAA+C;AAE/C,2EAAgF;AAEnE,QAAA,aAAa,GAAG,IAAI,kBAAU,EAAyB,CAAC;AAErE,SAAgB,aAAa,CAC3B,gBAAkC,EAClC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB;IAEtB,cAAc,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAEnC,IAAA,KAA+B,IAAA,6DAAgC,EAAC,EAAE,aAAa,uBAAA,EAAE,UAAU,YAAA,EAAE,MAAM,QAAA,EAAE,CAAC,EAApG,YAAY,kBAAA,EAAE,UAAU,gBAA4E,CAAC;IAE7G,IAAM,SAAS,GAAG,IAAA,4BAAmB,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IAEnG,IAAM,KAAK,GAAG;QACZ,gBAAgB,kBAAA;QAChB,cAAc,gBAAA;QACd,MAAM,QAAA;QACN,KAAK,OAAA;QACL,UAAU,YAAA;QACV,SAAS,WAAA;QACT,YAAY,cAAA;QACZ,UAAU,YAAA;KACX,CAAC;IAEF,iEACK,SAAS,GACT,IAAA,oCAAuB,EAAC,KAAK,CAAC,GAC9B,IAAA,wBAAiB,EAAC,KAAK,CAAC,GACxB,IAAA,wBAAiB,EAAC,KAAK,CAAC,GACxB,IAAA,wCAAyB,EAAC,KAAK,CAAC,GAChC,IAAA,4BAAmB,EAAC,KAAK,CAAC,EAC7B;AACJ,CAAC;AAhCD,sCAgCC","sourcesContent":["import type { Config } from '../config';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { Transports } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\nimport { Observable } from '../utils';\n\nimport { initializeEventsAPI } from './events';\nimport { initializeExceptionsAPI } from './exceptions';\nimport { initializeLogsAPI } from './logs';\nimport { initializeMeasurementsAPI } from './measurements';\nimport { initializeMetaAPI } from './meta';\nimport { initializeTracesAPI } from './traces';\nimport type { API, ApiMessageBusMessages } from './types';\nimport { createUserActionLifecycleHandler } from './userActionLifecycleHandler';\n\nexport const apiMessageBus = new Observable<ApiMessageBusMessages>();\n\nexport function initializeAPI(\n unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports\n): API {\n internalLogger.debug('Initializing API');\n\n const { actionBuffer, getMessage } = createUserActionLifecycleHandler({ apiMessageBus, transports, config });\n\n const tracesApi = initializeTracesAPI(unpatchedConsole, internalLogger, config, metas, transports);\n\n const props = {\n unpatchedConsole,\n internalLogger,\n config,\n metas,\n transports,\n tracesApi,\n actionBuffer,\n getMessage,\n };\n\n return {\n ...tracesApi,\n ...initializeExceptionsAPI(props),\n ...initializeMetaAPI(props),\n ...initializeLogsAPI(props),\n ...initializeMeasurementsAPI(props),\n ...initializeEventsAPI(props),\n };\n}\n"]}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/api/initialize.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAkBA,sCAgCC;AA7CD,kCAAsC;AAEtC,mCAA+C;AAC/C,2CAAuD;AACvD,+BAA2C;AAC3C,+CAA2D;AAC3D,+BAA2C;AAC3C,mCAA+C;AAE/C,2EAAgF;AAEnE,QAAA,aAAa,GAAG,IAAI,kBAAU,EAAyB,CAAC;AAErE,SAAgB,aAAa,CAC3B,gBAAkC,EAClC,cAA8B,EAC9B,MAAc,EACd,KAAY,EACZ,UAAsB;IAEtB,cAAc,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAEnC,IAAA,KAA+B,IAAA,6DAAgC,EAAC,EAAE,aAAa,uBAAA,EAAE,UAAU,YAAA,EAAE,MAAM,QAAA,EAAE,CAAC,EAApG,YAAY,kBAAA,EAAE,UAAU,gBAA4E,CAAC;IAE7G,IAAM,SAAS,GAAG,IAAA,4BAAmB,EAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IAEnG,IAAM,KAAK,GAAG;QACZ,gBAAgB,kBAAA;QAChB,cAAc,gBAAA;QACd,MAAM,QAAA;QACN,KAAK,OAAA;QACL,UAAU,YAAA;QACV,SAAS,WAAA;QACT,YAAY,cAAA;QACZ,UAAU,YAAA;KACX,CAAC;IAEF,iEACK,SAAS,GACT,IAAA,oCAAuB,EAAC,KAAK,CAAC,GAC9B,IAAA,wBAAiB,EAAC,KAAK,CAAC,GACxB,IAAA,wBAAiB,EAAC,KAAK,CAAC,GACxB,IAAA,wCAAyB,EAAC,KAAK,CAAC,GAChC,IAAA,4BAAmB,EAAC,KAAK,CAAC,EAC7B;AACJ,CAAC","sourcesContent":["import type { Config } from '../config';\nimport type { InternalLogger } from '../internalLogger';\nimport type { Metas } from '../metas';\nimport type { Transports } from '../transports';\nimport type { UnpatchedConsole } from '../unpatchedConsole';\nimport { Observable } from '../utils';\n\nimport { initializeEventsAPI } from './events';\nimport { initializeExceptionsAPI } from './exceptions';\nimport { initializeLogsAPI } from './logs';\nimport { initializeMeasurementsAPI } from './measurements';\nimport { initializeMetaAPI } from './meta';\nimport { initializeTracesAPI } from './traces';\nimport type { API, ApiMessageBusMessages } from './types';\nimport { createUserActionLifecycleHandler } from './userActionLifecycleHandler';\n\nexport const apiMessageBus = new Observable<ApiMessageBusMessages>();\n\nexport function initializeAPI(\n unpatchedConsole: UnpatchedConsole,\n internalLogger: InternalLogger,\n config: Config,\n metas: Metas,\n transports: Transports\n): API {\n internalLogger.debug('Initializing API');\n\n const { actionBuffer, getMessage } = createUserActionLifecycleHandler({ apiMessageBus, transports, config });\n\n const tracesApi = initializeTracesAPI(unpatchedConsole, internalLogger, config, metas, transports);\n\n const props = {\n unpatchedConsole,\n internalLogger,\n config,\n metas,\n transports,\n tracesApi,\n actionBuffer,\n getMessage,\n };\n\n return {\n ...tracesApi,\n ...initializeExceptionsAPI(props),\n ...initializeMetaAPI(props),\n ...initializeLogsAPI(props),\n ...initializeMeasurementsAPI(props),\n ...initializeEventsAPI(props),\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../src/api/logs/const.ts"],"names":[],"mappings":";;;AAEO,IAAM,wBAAwB,GAAsB,UAAC,IAAI;IAC9D,OAAA,IAAI;SACD,GAAG,CAAC,UAAC,GAAG;QACP,IAAI;YACF,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;SACpB;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,EAAE,CAAC;SACX;IACH,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC;AARZ,CAQY,CAAC;AATF,QAAA,wBAAwB,4BAStB","sourcesContent":["import type { LogArgsSerializer } from './types';\n\nexport const defaultLogArgsSerializer: LogArgsSerializer = (args) =>\n args\n .map((arg) => {\n try {\n return String(arg);\n } catch (err) {\n return '';\n }\n })\n .join(' ');\n"]}
1
+ {"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../src/api/logs/const.ts"],"names":[],"mappings":";;;AAEO,IAAM,wBAAwB,GAAsB,UAAC,IAAI;IAC9D,OAAA,IAAI;SACD,GAAG,CAAC,UAAC,GAAG;QACP,IAAI,CAAC;YACH,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC;AARZ,CAQY,CAAC;AATF,QAAA,wBAAwB,4BAStB","sourcesContent":["import type { LogArgsSerializer } from './types';\n\nexport const defaultLogArgsSerializer: LogArgsSerializer = (args) =>\n args\n .map((arg) => {\n try {\n return String(arg);\n } catch (err) {\n return '';\n }\n })\n .join(' ');\n"]}