@openobserve/browser-core 0.2.11-rc1 → 0.2.11

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 (393) hide show
  1. package/cjs/boot/init.js +1 -1
  2. package/cjs/boot/init.js.map +1 -1
  3. package/cjs/browser/addEventListener.d.ts +4 -12
  4. package/cjs/browser/addEventListener.js +8 -50
  5. package/cjs/browser/addEventListener.js.map +1 -1
  6. package/cjs/browser/cookie.d.ts +0 -7
  7. package/cjs/browser/cookie.js +2 -19
  8. package/cjs/browser/cookie.js.map +1 -1
  9. package/cjs/browser/fetchObservable.js +19 -14
  10. package/cjs/browser/fetchObservable.js.map +1 -1
  11. package/cjs/browser/pageExitObservable.js +7 -6
  12. package/cjs/browser/pageExitObservable.js.map +1 -1
  13. package/cjs/browser/runOnReadyState.js +1 -1
  14. package/cjs/browser/runOnReadyState.js.map +1 -1
  15. package/cjs/browser/xhrObservable.d.ts +2 -1
  16. package/cjs/browser/xhrObservable.js +34 -26
  17. package/cjs/browser/xhrObservable.js.map +1 -1
  18. package/cjs/domain/configuration/configuration.d.ts +12 -17
  19. package/cjs/domain/configuration/configuration.js +9 -8
  20. package/cjs/domain/configuration/configuration.js.map +1 -1
  21. package/cjs/domain/configuration/endpointBuilder.d.ts +10 -6
  22. package/cjs/domain/configuration/endpointBuilder.js +33 -23
  23. package/cjs/domain/configuration/endpointBuilder.js.map +1 -1
  24. package/cjs/domain/configuration/index.d.ts +1 -2
  25. package/cjs/domain/configuration/index.js +1 -3
  26. package/cjs/domain/configuration/index.js.map +1 -1
  27. package/cjs/domain/configuration/tags.js.map +1 -1
  28. package/cjs/domain/configuration/transportConfiguration.js +1 -1
  29. package/cjs/domain/configuration/transportConfiguration.js.map +1 -1
  30. package/cjs/domain/console/consoleObservable.js +7 -4
  31. package/cjs/domain/console/consoleObservable.js.map +1 -1
  32. package/cjs/domain/deflate/index.d.ts +1 -0
  33. package/cjs/domain/{connectivity → deflate}/index.js +1 -1
  34. package/cjs/domain/deflate/index.js.map +1 -0
  35. package/cjs/domain/deflate/types.d.ts +26 -0
  36. package/cjs/domain/error/error.d.ts +1 -1
  37. package/cjs/domain/error/error.js +3 -3
  38. package/cjs/domain/error/error.js.map +1 -1
  39. package/cjs/domain/error/error.types.d.ts +2 -2
  40. package/cjs/domain/error/error.types.js.map +1 -1
  41. package/cjs/domain/error/trackRuntimeError.d.ts +0 -8
  42. package/cjs/domain/error/trackRuntimeError.js +6 -39
  43. package/cjs/domain/error/trackRuntimeError.js.map +1 -1
  44. package/cjs/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -1
  45. package/cjs/domain/report/browser.types.d.ts +0 -10
  46. package/cjs/domain/report/reportObservable.d.ts +0 -2
  47. package/cjs/domain/report/reportObservable.js +7 -7
  48. package/cjs/domain/report/reportObservable.js.map +1 -1
  49. package/cjs/domain/session/oldCookiesMigration.js +4 -4
  50. package/cjs/domain/session/oldCookiesMigration.js.map +1 -1
  51. package/cjs/domain/session/sessionManager.js +2 -2
  52. package/cjs/domain/session/sessionManager.js.map +1 -1
  53. package/cjs/domain/session/sessionState.js.map +1 -1
  54. package/cjs/domain/session/sessionStore.js.map +1 -1
  55. package/cjs/domain/session/sessionStoreOperations.d.ts +5 -0
  56. package/cjs/domain/session/sessionStoreOperations.js +14 -6
  57. package/cjs/domain/session/sessionStoreOperations.js.map +1 -1
  58. package/cjs/domain/session/storeStrategies/sessionInCookie.js +2 -13
  59. package/cjs/domain/session/storeStrategies/sessionInCookie.js.map +1 -1
  60. package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js +0 -1
  61. package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -1
  62. package/cjs/domain/session/storeStrategies/sessionStoreStrategy.d.ts +0 -1
  63. package/cjs/domain/synthetics/syntheticsWorkerValues.js +3 -3
  64. package/cjs/domain/synthetics/syntheticsWorkerValues.js.map +1 -1
  65. package/cjs/domain/telemetry/rawTelemetryEvent.types.d.ts +0 -4
  66. package/cjs/domain/telemetry/telemetry.d.ts +1 -5
  67. package/cjs/domain/telemetry/telemetry.js +6 -17
  68. package/cjs/domain/telemetry/telemetry.js.map +1 -1
  69. package/cjs/domain/telemetry/telemetryEvent.types.d.ts +2 -18
  70. package/cjs/domain/tracekit/computeStackTrace.d.ts +5 -0
  71. package/cjs/domain/{error → tracekit}/computeStackTrace.js +4 -28
  72. package/cjs/domain/tracekit/computeStackTrace.js.map +1 -0
  73. package/cjs/domain/tracekit/index.d.ts +3 -0
  74. package/cjs/domain/tracekit/index.js +8 -0
  75. package/cjs/domain/tracekit/index.js.map +1 -0
  76. package/cjs/domain/tracekit/tracekit.d.ts +35 -0
  77. package/cjs/domain/tracekit/tracekit.js +95 -0
  78. package/cjs/domain/tracekit/tracekit.js.map +1 -0
  79. package/cjs/domain/tracekit/types.d.ts +44 -0
  80. package/cjs/domain/{context/contextConstants.js → tracekit/types.js} +1 -1
  81. package/cjs/domain/tracekit/types.js.map +1 -0
  82. package/cjs/domain/user/user.js.map +1 -1
  83. package/cjs/index.d.ts +63 -0
  84. package/cjs/index.js +155 -0
  85. package/cjs/index.js.map +1 -0
  86. package/cjs/tools/abstractLifeCycle.js.map +1 -1
  87. package/cjs/tools/boundedBuffer.js.map +1 -1
  88. package/cjs/tools/catchUserErrors.js.map +1 -1
  89. package/cjs/tools/display.d.ts +2 -2
  90. package/cjs/tools/display.js +17 -13
  91. package/cjs/tools/display.js.map +1 -1
  92. package/cjs/tools/experimentalFeatures.d.ts +5 -3
  93. package/cjs/tools/experimentalFeatures.js +4 -2
  94. package/cjs/tools/experimentalFeatures.js.map +1 -1
  95. package/cjs/tools/getGlobalObject.js.map +1 -1
  96. package/cjs/tools/getZoneJsOriginalValue.js.map +1 -1
  97. package/cjs/tools/instrumentMethod.d.ts +10 -50
  98. package/cjs/tools/instrumentMethod.js +36 -59
  99. package/cjs/tools/instrumentMethod.js.map +1 -1
  100. package/cjs/tools/matchOption.js.map +1 -1
  101. package/cjs/tools/mergeInto.js.map +1 -1
  102. package/cjs/tools/monitor.d.ts +2 -1
  103. package/cjs/tools/monitor.js +6 -6
  104. package/cjs/tools/monitor.js.map +1 -1
  105. package/cjs/tools/observable.d.ts +1 -1
  106. package/cjs/tools/observable.js +3 -2
  107. package/cjs/tools/observable.js.map +1 -1
  108. package/cjs/tools/readBytesFromStream.js.map +1 -1
  109. package/cjs/tools/sendToExtension.js.map +1 -1
  110. package/cjs/tools/serialisation/contextManager.d.ts +21 -0
  111. package/cjs/tools/serialisation/contextManager.js +70 -0
  112. package/cjs/tools/serialisation/contextManager.js.map +1 -0
  113. package/cjs/tools/serialisation/heavyCustomerDataWarning.d.ts +8 -0
  114. package/cjs/tools/serialisation/heavyCustomerDataWarning.js +18 -0
  115. package/cjs/tools/serialisation/heavyCustomerDataWarning.js.map +1 -0
  116. package/cjs/tools/serialisation/jsonStringify.d.ts +2 -1
  117. package/cjs/tools/serialisation/jsonStringify.js.map +1 -1
  118. package/cjs/tools/serialisation/sanitize.js.map +1 -1
  119. package/cjs/tools/utils/browserDetection.d.ts +0 -8
  120. package/cjs/tools/utils/browserDetection.js +3 -33
  121. package/cjs/tools/utils/browserDetection.js.map +1 -1
  122. package/cjs/tools/utils/byteUtils.js.map +1 -1
  123. package/cjs/tools/utils/functionUtils.js.map +1 -1
  124. package/cjs/tools/utils/objectUtils.js.map +1 -1
  125. package/cjs/tools/utils/polyfills.js.map +1 -1
  126. package/cjs/tools/utils/responseUtils.js.map +1 -1
  127. package/cjs/tools/utils/stringUtils.d.ts +0 -1
  128. package/cjs/tools/utils/stringUtils.js +4 -31
  129. package/cjs/tools/utils/stringUtils.js.map +1 -1
  130. package/cjs/tools/utils/timeUtils.js.map +1 -1
  131. package/cjs/tools/utils/typeUtils.js.map +1 -1
  132. package/cjs/tools/utils/urlPolyfill.js.map +1 -1
  133. package/cjs/tools/valueHistory.js.map +1 -1
  134. package/cjs/transport/batch.d.ts +3 -5
  135. package/cjs/transport/batch.js +29 -73
  136. package/cjs/transport/batch.js.map +1 -1
  137. package/cjs/transport/eventBridge.js.map +1 -1
  138. package/cjs/transport/flushController.d.ts +2 -12
  139. package/cjs/transport/flushController.js +7 -22
  140. package/cjs/transport/flushController.js.map +1 -1
  141. package/cjs/transport/httpRequest.d.ts +2 -3
  142. package/cjs/transport/httpRequest.js +17 -21
  143. package/cjs/transport/httpRequest.js.map +1 -1
  144. package/cjs/transport/sendWithRetryStrategy.d.ts +2 -2
  145. package/cjs/transport/sendWithRetryStrategy.js +9 -9
  146. package/cjs/transport/sendWithRetryStrategy.js.map +1 -1
  147. package/cjs/transport/startBatchWithReplica.d.ts +4 -9
  148. package/cjs/transport/startBatchWithReplica.js +4 -9
  149. package/cjs/transport/startBatchWithReplica.js.map +1 -1
  150. package/esm/boot/init.js +1 -1
  151. package/esm/boot/init.js.map +1 -1
  152. package/esm/browser/addEventListener.d.ts +4 -12
  153. package/esm/browser/addEventListener.js +7 -49
  154. package/esm/browser/addEventListener.js.map +1 -1
  155. package/esm/browser/cookie.d.ts +0 -7
  156. package/esm/browser/cookie.js +2 -17
  157. package/esm/browser/cookie.js.map +1 -1
  158. package/esm/browser/fetchObservable.js +20 -15
  159. package/esm/browser/fetchObservable.js.map +1 -1
  160. package/esm/browser/pageExitObservable.js +8 -7
  161. package/esm/browser/pageExitObservable.js.map +1 -1
  162. package/esm/browser/runOnReadyState.js +2 -2
  163. package/esm/browser/runOnReadyState.js.map +1 -1
  164. package/esm/browser/xhrObservable.d.ts +2 -1
  165. package/esm/browser/xhrObservable.js +36 -28
  166. package/esm/browser/xhrObservable.js.map +1 -1
  167. package/esm/domain/configuration/configuration.d.ts +12 -17
  168. package/esm/domain/configuration/configuration.js +9 -8
  169. package/esm/domain/configuration/configuration.js.map +1 -1
  170. package/esm/domain/configuration/endpointBuilder.d.ts +10 -6
  171. package/esm/domain/configuration/endpointBuilder.js +32 -22
  172. package/esm/domain/configuration/endpointBuilder.js.map +1 -1
  173. package/esm/domain/configuration/index.d.ts +1 -2
  174. package/esm/domain/configuration/index.js +0 -1
  175. package/esm/domain/configuration/index.js.map +1 -1
  176. package/esm/domain/configuration/tags.js.map +1 -1
  177. package/esm/domain/configuration/transportConfiguration.js +1 -1
  178. package/esm/domain/configuration/transportConfiguration.js.map +1 -1
  179. package/esm/domain/console/consoleObservable.js +5 -2
  180. package/esm/domain/console/consoleObservable.js.map +1 -1
  181. package/esm/domain/deflate/types.d.ts +0 -12
  182. package/esm/domain/error/error.d.ts +1 -1
  183. package/esm/domain/error/error.js +1 -1
  184. package/esm/domain/error/error.js.map +1 -1
  185. package/esm/domain/error/error.types.d.ts +2 -2
  186. package/esm/domain/error/error.types.js.map +1 -1
  187. package/esm/domain/error/trackRuntimeError.d.ts +0 -8
  188. package/esm/domain/error/trackRuntimeError.js +4 -35
  189. package/esm/domain/error/trackRuntimeError.js.map +1 -1
  190. package/esm/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -1
  191. package/esm/domain/report/browser.types.d.ts +0 -10
  192. package/esm/domain/report/reportObservable.d.ts +0 -2
  193. package/esm/domain/report/reportObservable.js +8 -8
  194. package/esm/domain/report/reportObservable.js.map +1 -1
  195. package/esm/domain/session/oldCookiesMigration.js +5 -5
  196. package/esm/domain/session/oldCookiesMigration.js.map +1 -1
  197. package/esm/domain/session/sessionManager.js +3 -3
  198. package/esm/domain/session/sessionManager.js.map +1 -1
  199. package/esm/domain/session/sessionState.js.map +1 -1
  200. package/esm/domain/session/sessionStore.js.map +1 -1
  201. package/esm/domain/session/sessionStoreOperations.d.ts +5 -0
  202. package/esm/domain/session/sessionStoreOperations.js +12 -5
  203. package/esm/domain/session/sessionStoreOperations.js.map +1 -1
  204. package/esm/domain/session/storeStrategies/sessionInCookie.js +2 -13
  205. package/esm/domain/session/storeStrategies/sessionInCookie.js.map +1 -1
  206. package/esm/domain/session/storeStrategies/sessionInLocalStorage.js +0 -1
  207. package/esm/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -1
  208. package/esm/domain/session/storeStrategies/sessionStoreStrategy.d.ts +0 -1
  209. package/esm/domain/synthetics/syntheticsWorkerValues.js +4 -4
  210. package/esm/domain/synthetics/syntheticsWorkerValues.js.map +1 -1
  211. package/esm/domain/telemetry/rawTelemetryEvent.types.d.ts +0 -4
  212. package/esm/domain/telemetry/telemetry.d.ts +1 -5
  213. package/esm/domain/telemetry/telemetry.js +5 -16
  214. package/esm/domain/telemetry/telemetry.js.map +1 -1
  215. package/esm/domain/telemetry/telemetryEvent.types.d.ts +2 -18
  216. package/esm/domain/tracekit/computeStackTrace.d.ts +5 -0
  217. package/esm/domain/{error → tracekit}/computeStackTrace.js +3 -26
  218. package/esm/domain/tracekit/computeStackTrace.js.map +1 -0
  219. package/esm/domain/tracekit/index.d.ts +3 -0
  220. package/esm/domain/tracekit/index.js +3 -0
  221. package/esm/domain/tracekit/index.js.map +1 -0
  222. package/esm/domain/tracekit/tracekit.d.ts +35 -0
  223. package/esm/domain/tracekit/tracekit.js +91 -0
  224. package/esm/domain/tracekit/tracekit.js.map +1 -0
  225. package/esm/domain/tracekit/types.d.ts +44 -0
  226. package/esm/domain/tracekit/types.js +2 -0
  227. package/esm/domain/tracekit/types.js.map +1 -0
  228. package/esm/domain/user/user.js.map +1 -1
  229. package/esm/index.d.ts +5 -9
  230. package/esm/index.js +5 -8
  231. package/esm/index.js.map +1 -1
  232. package/esm/tools/abstractLifeCycle.js.map +1 -1
  233. package/esm/tools/boundedBuffer.js.map +1 -1
  234. package/esm/tools/catchUserErrors.js.map +1 -1
  235. package/esm/tools/display.d.ts +2 -2
  236. package/esm/tools/display.js +15 -12
  237. package/esm/tools/display.js.map +1 -1
  238. package/esm/tools/experimentalFeatures.d.ts +5 -3
  239. package/esm/tools/experimentalFeatures.js +4 -2
  240. package/esm/tools/experimentalFeatures.js.map +1 -1
  241. package/esm/tools/getGlobalObject.js.map +1 -1
  242. package/esm/tools/getZoneJsOriginalValue.js.map +1 -1
  243. package/esm/tools/instrumentMethod.d.ts +10 -50
  244. package/esm/tools/instrumentMethod.js +34 -58
  245. package/esm/tools/instrumentMethod.js.map +1 -1
  246. package/esm/tools/matchOption.js.map +1 -1
  247. package/esm/tools/mergeInto.js.map +1 -1
  248. package/esm/tools/monitor.d.ts +2 -1
  249. package/esm/tools/monitor.js +7 -7
  250. package/esm/tools/monitor.js.map +1 -1
  251. package/esm/tools/observable.d.ts +1 -1
  252. package/esm/tools/observable.js +3 -2
  253. package/esm/tools/observable.js.map +1 -1
  254. package/esm/tools/readBytesFromStream.js.map +1 -1
  255. package/esm/tools/sendToExtension.js.map +1 -1
  256. package/esm/tools/serialisation/contextManager.d.ts +21 -0
  257. package/esm/tools/serialisation/contextManager.js +66 -0
  258. package/esm/tools/serialisation/contextManager.js.map +1 -0
  259. package/esm/tools/serialisation/heavyCustomerDataWarning.d.ts +8 -0
  260. package/esm/tools/serialisation/heavyCustomerDataWarning.js +14 -0
  261. package/esm/tools/serialisation/heavyCustomerDataWarning.js.map +1 -0
  262. package/esm/tools/serialisation/jsonStringify.d.ts +2 -1
  263. package/esm/tools/serialisation/jsonStringify.js.map +1 -1
  264. package/esm/tools/serialisation/sanitize.js.map +1 -1
  265. package/esm/tools/utils/browserDetection.d.ts +0 -8
  266. package/esm/tools/utils/browserDetection.js +2 -30
  267. package/esm/tools/utils/browserDetection.js.map +1 -1
  268. package/esm/tools/utils/byteUtils.js.map +1 -1
  269. package/esm/tools/utils/functionUtils.js.map +1 -1
  270. package/esm/tools/utils/objectUtils.js.map +1 -1
  271. package/esm/tools/utils/polyfills.js.map +1 -1
  272. package/esm/tools/utils/responseUtils.js.map +1 -1
  273. package/esm/tools/utils/stringUtils.d.ts +0 -1
  274. package/esm/tools/utils/stringUtils.js +3 -29
  275. package/esm/tools/utils/stringUtils.js.map +1 -1
  276. package/esm/tools/utils/timeUtils.js.map +1 -1
  277. package/esm/tools/utils/typeUtils.js.map +1 -1
  278. package/esm/tools/utils/urlPolyfill.js.map +1 -1
  279. package/esm/tools/valueHistory.js.map +1 -1
  280. package/esm/transport/batch.d.ts +3 -5
  281. package/esm/transport/batch.js +29 -73
  282. package/esm/transport/batch.js.map +1 -1
  283. package/esm/transport/eventBridge.js.map +1 -1
  284. package/esm/transport/flushController.d.ts +2 -12
  285. package/esm/transport/flushController.js +7 -22
  286. package/esm/transport/flushController.js.map +1 -1
  287. package/esm/transport/httpRequest.d.ts +2 -3
  288. package/esm/transport/httpRequest.js +17 -21
  289. package/esm/transport/httpRequest.js.map +1 -1
  290. package/esm/transport/sendWithRetryStrategy.d.ts +2 -2
  291. package/esm/transport/sendWithRetryStrategy.js +9 -9
  292. package/esm/transport/sendWithRetryStrategy.js.map +1 -1
  293. package/esm/transport/startBatchWithReplica.d.ts +4 -9
  294. package/esm/transport/startBatchWithReplica.js +4 -9
  295. package/esm/transport/startBatchWithReplica.js.map +1 -1
  296. package/package.json +1 -1
  297. package/src/browser/addEventListener.ts +31 -37
  298. package/src/browser/cookie.ts +2 -21
  299. package/src/browser/fetchObservable.ts +25 -21
  300. package/src/browser/pageExitObservable.ts +3 -1
  301. package/src/browser/xhrObservable.ts +37 -31
  302. package/src/domain/configuration/configuration.ts +22 -24
  303. package/src/domain/configuration/endpointBuilder.ts +46 -33
  304. package/src/domain/configuration/index.ts +1 -2
  305. package/src/domain/configuration/transportConfiguration.ts +1 -1
  306. package/src/domain/console/consoleObservable.ts +7 -3
  307. package/src/domain/deflate/types.ts +0 -14
  308. package/src/domain/error/error.ts +2 -2
  309. package/src/domain/error/error.types.ts +2 -11
  310. package/src/domain/error/trackRuntimeError.ts +12 -44
  311. package/src/domain/report/browser.types.ts +0 -12
  312. package/src/domain/report/reportObservable.ts +6 -8
  313. package/src/domain/session/oldCookiesMigration.ts +5 -5
  314. package/src/domain/session/sessionStoreOperations.ts +13 -5
  315. package/src/domain/session/storeStrategies/sessionInCookie.ts +2 -13
  316. package/src/domain/session/storeStrategies/sessionInLocalStorage.ts +0 -1
  317. package/src/domain/session/storeStrategies/sessionStoreStrategy.ts +0 -1
  318. package/src/domain/synthetics/syntheticsWorkerValues.ts +4 -4
  319. package/src/domain/telemetry/rawTelemetryEvent.types.ts +0 -5
  320. package/src/domain/telemetry/telemetry.ts +7 -22
  321. package/src/domain/telemetry/telemetryEvent.types.ts +2 -18
  322. package/src/domain/{error → tracekit}/computeStackTrace.ts +4 -49
  323. package/src/domain/tracekit/index.ts +3 -0
  324. package/src/domain/tracekit/tracekit.ts +96 -0
  325. package/src/domain/tracekit/types.ts +47 -0
  326. package/src/index.ts +7 -13
  327. package/src/tools/display.ts +13 -14
  328. package/src/tools/experimentalFeatures.ts +4 -2
  329. package/src/tools/instrumentMethod.ts +59 -103
  330. package/src/tools/mergeInto.ts +16 -16
  331. package/src/tools/monitor.ts +5 -5
  332. package/src/tools/observable.ts +5 -3
  333. package/src/tools/serialisation/contextManager.ts +79 -0
  334. package/src/tools/serialisation/heavyCustomerDataWarning.ts +26 -0
  335. package/src/tools/utils/browserDetection.ts +2 -43
  336. package/src/tools/utils/polyfills.ts +4 -1
  337. package/src/tools/utils/stringUtils.ts +4 -30
  338. package/src/transport/batch.ts +31 -86
  339. package/src/transport/flushController.ts +7 -22
  340. package/src/transport/httpRequest.ts +16 -23
  341. package/src/transport/sendWithRetryStrategy.ts +10 -10
  342. package/src/transport/startBatchWithReplica.ts +6 -22
  343. package/cjs/domain/connectivity/connectivity.d.ts +0 -13
  344. package/cjs/domain/connectivity/connectivity.js +0 -14
  345. package/cjs/domain/connectivity/connectivity.js.map +0 -1
  346. package/cjs/domain/connectivity/index.d.ts +0 -1
  347. package/cjs/domain/connectivity/index.js.map +0 -1
  348. package/cjs/domain/context/contextConstants.d.ts +0 -5
  349. package/cjs/domain/context/contextConstants.js.map +0 -1
  350. package/cjs/domain/context/contextManager.d.ts +0 -12
  351. package/cjs/domain/context/contextManager.js +0 -43
  352. package/cjs/domain/context/contextManager.js.map +0 -1
  353. package/cjs/domain/context/customerDataTracker.d.ts +0 -45
  354. package/cjs/domain/context/customerDataTracker.js +0 -107
  355. package/cjs/domain/context/customerDataTracker.js.map +0 -1
  356. package/cjs/domain/context/storeContextManager.d.ts +0 -6
  357. package/cjs/domain/context/storeContextManager.js +0 -38
  358. package/cjs/domain/context/storeContextManager.js.map +0 -1
  359. package/cjs/domain/error/computeStackTrace.d.ts +0 -33
  360. package/cjs/domain/error/computeStackTrace.js.map +0 -1
  361. package/cjs/tools/encoder.d.ts +0 -53
  362. package/cjs/tools/encoder.js +0 -41
  363. package/cjs/tools/encoder.js.map +0 -1
  364. package/esm/domain/connectivity/connectivity.d.ts +0 -13
  365. package/esm/domain/connectivity/connectivity.js +0 -10
  366. package/esm/domain/connectivity/connectivity.js.map +0 -1
  367. package/esm/domain/connectivity/index.d.ts +0 -1
  368. package/esm/domain/connectivity/index.js +0 -2
  369. package/esm/domain/connectivity/index.js.map +0 -1
  370. package/esm/domain/context/contextConstants.d.ts +0 -5
  371. package/esm/domain/context/contextConstants.js +0 -2
  372. package/esm/domain/context/contextConstants.js.map +0 -1
  373. package/esm/domain/context/contextManager.d.ts +0 -12
  374. package/esm/domain/context/contextManager.js +0 -39
  375. package/esm/domain/context/contextManager.js.map +0 -1
  376. package/esm/domain/context/customerDataTracker.d.ts +0 -45
  377. package/esm/domain/context/customerDataTracker.js +0 -102
  378. package/esm/domain/context/customerDataTracker.js.map +0 -1
  379. package/esm/domain/context/storeContextManager.d.ts +0 -6
  380. package/esm/domain/context/storeContextManager.js +0 -32
  381. package/esm/domain/context/storeContextManager.js.map +0 -1
  382. package/esm/domain/error/computeStackTrace.d.ts +0 -33
  383. package/esm/domain/error/computeStackTrace.js.map +0 -1
  384. package/esm/tools/encoder.d.ts +0 -53
  385. package/esm/tools/encoder.js +0 -37
  386. package/esm/tools/encoder.js.map +0 -1
  387. package/src/domain/connectivity/connectivity.ts +0 -27
  388. package/src/domain/connectivity/index.ts +0 -1
  389. package/src/domain/context/contextConstants.ts +0 -5
  390. package/src/domain/context/contextManager.ts +0 -48
  391. package/src/domain/context/customerDataTracker.ts +0 -134
  392. package/src/domain/context/storeContextManager.ts +0 -51
  393. package/src/tools/encoder.ts +0 -102
@@ -24,15 +24,22 @@ export interface InitConfiguration {
24
24
  // global options
25
25
  clientToken: string
26
26
  beforeSend?: GenericBeforeSendCallback | undefined
27
+ /**
28
+ * @deprecated use sessionSampleRate instead
29
+ */
30
+ sampleRate?: number | undefined
27
31
  sessionSampleRate?: number | undefined
28
32
  telemetrySampleRate?: number | undefined
29
33
  silentMultipleInit?: boolean | undefined
30
- allowFallbackToLocalStorage?: boolean | undefined
31
- allowUntrustedEvents?: boolean | undefined
32
- storeContextsAcrossPages?: boolean | undefined
34
+ trackResources?: boolean | undefined
35
+ trackLongTasks?: boolean | undefined
33
36
 
34
37
  // transport options
35
- proxy?: string | ProxyFn | undefined
38
+ proxy?: string | undefined
39
+ /**
40
+ * @deprecated use `proxy` instead
41
+ */
42
+ proxyUrl?: string | undefined
36
43
  site?: string | undefined
37
44
 
38
45
  // tag and context options
@@ -41,19 +48,17 @@ export interface InitConfiguration {
41
48
  version: string | undefined
42
49
 
43
50
  // cookie options
44
- /**
45
- * @deprecated use usePartitionedCrossSiteSessionCookie instead
46
- */
47
51
  useCrossSiteSessionCookie?: boolean | undefined
48
- usePartitionedCrossSiteSessionCookie?: boolean | undefined
49
52
  useSecureSessionCookie?: boolean | undefined
50
53
  trackSessionAcrossSubdomains?: boolean | undefined
51
54
 
55
+ // alternate storage option
56
+ allowFallbackToLocalStorage?: boolean | undefined
57
+
52
58
  // internal options
53
59
  enableExperimentalFeatures?: string[] | undefined
54
60
  replica?: ReplicaUserConfiguration | undefined
55
61
  datacenter?: string
56
- // TODO next major: remove this option and replace usages by proxyFn
57
62
  internalAnalyticsSubdomain?: string
58
63
 
59
64
  telemetryConfigurationSampleRate?: number
@@ -67,12 +72,6 @@ export interface InitConfiguration {
67
72
  // for this option.
68
73
  type GenericBeforeSendCallback = (event: any, context?: any) => unknown
69
74
 
70
- /**
71
- * path: /api/vX/product
72
- * parameters: xxx=yyy&zzz=aaa
73
- */
74
- type ProxyFn = (options: { path: string; parameters: string }) => string
75
-
76
75
  interface ReplicaUserConfiguration {
77
76
  applicationId?: string
78
77
  clientToken: string
@@ -87,7 +86,6 @@ export interface Configuration extends TransportConfiguration {
87
86
  telemetryConfigurationSampleRate: number
88
87
  service: string | undefined
89
88
  silentMultipleInit: boolean
90
- allowUntrustedEvents: boolean
91
89
 
92
90
  // Event limits
93
91
  eventRateLimiterThreshold: number // Limit the maximum number of actions, errors and logs per minutes
@@ -106,7 +104,8 @@ export function validateAndBuildConfiguration(initConfiguration: InitConfigurati
106
104
  return
107
105
  }
108
106
 
109
- if (initConfiguration.sessionSampleRate !== undefined && !isPercentage(initConfiguration.sessionSampleRate)) {
107
+ const sessionSampleRate = initConfiguration.sessionSampleRate ?? initConfiguration.sampleRate
108
+ if (sessionSampleRate !== undefined && !isPercentage(sessionSampleRate)) {
110
109
  display.error('Session Sample Rate should be a number between 0 and 100')
111
110
  return
112
111
  }
@@ -138,12 +137,11 @@ export function validateAndBuildConfiguration(initConfiguration: InitConfigurati
138
137
  beforeSend:
139
138
  initConfiguration.beforeSend && catchUserErrors(initConfiguration.beforeSend, 'beforeSend threw an error:'),
140
139
  sessionStoreStrategyType: selectSessionStoreStrategyType(initConfiguration),
141
- sessionSampleRate: initConfiguration.sessionSampleRate ?? 100,
140
+ sessionSampleRate: sessionSampleRate ?? 100,
142
141
  telemetrySampleRate: initConfiguration.telemetrySampleRate ?? 20,
143
142
  telemetryConfigurationSampleRate: initConfiguration.telemetryConfigurationSampleRate ?? 5,
144
143
  service: initConfiguration.service,
145
144
  silentMultipleInit: !!initConfiguration.silentMultipleInit,
146
- allowUntrustedEvents: !!initConfiguration.allowUntrustedEvents,
147
145
 
148
146
  /**
149
147
  * beacon payload max queue size implementation is 64kb
@@ -175,19 +173,19 @@ export function validateAndBuildConfiguration(initConfiguration: InitConfigurati
175
173
  }
176
174
 
177
175
  export function serializeConfiguration(initConfiguration: InitConfiguration): Partial<RawTelemetryConfiguration> {
176
+ const proxy = initConfiguration.proxy ?? initConfiguration.proxyUrl
178
177
  return {
179
- session_sample_rate: initConfiguration.sessionSampleRate,
178
+ session_sample_rate: initConfiguration.sessionSampleRate ?? initConfiguration.sampleRate,
180
179
  telemetry_sample_rate: initConfiguration.telemetrySampleRate,
181
180
  telemetry_configuration_sample_rate: initConfiguration.telemetryConfigurationSampleRate,
182
181
  use_before_send: !!initConfiguration.beforeSend,
183
182
  use_cross_site_session_cookie: initConfiguration.useCrossSiteSessionCookie,
184
- use_partitioned_cross_site_session_cookie: initConfiguration.usePartitionedCrossSiteSessionCookie,
185
183
  use_secure_session_cookie: initConfiguration.useSecureSessionCookie,
186
- use_proxy: !!initConfiguration.proxy,
184
+ use_proxy: proxy !== undefined ? !!proxy : undefined,
187
185
  silent_multiple_init: initConfiguration.silentMultipleInit,
188
186
  track_session_across_subdomains: initConfiguration.trackSessionAcrossSubdomains,
187
+ track_resources: initConfiguration.trackResources,
188
+ track_long_task: initConfiguration.trackLongTasks,
189
189
  allow_fallback_to_local_storage: !!initConfiguration.allowFallbackToLocalStorage,
190
- store_contexts_across_pages: !!initConfiguration.storeContextsAcrossPages,
191
- allow_untrusted_events: !!initConfiguration.allowUntrustedEvents,
192
190
  }
193
191
  }
@@ -1,39 +1,51 @@
1
- import type { Payload } from '../../transport'
1
+ import type { RetryInfo, FlushReason } from '../../transport'
2
2
  import { timeStampNow } from '../../tools/utils/timeUtils'
3
3
  import { normalizeUrl } from '../../tools/utils/urlPolyfill'
4
4
  import { ExperimentalFeature, isExperimentalFeatureEnabled } from '../../tools/experimentalFeatures'
5
5
  import { generateUUID } from '../../tools/utils/stringUtils'
6
6
  import type { InitConfiguration } from './configuration'
7
- import { INTAKE_SITE_US1 } from './intakeSites'
7
+ import { INTAKE_SITE_AP1, INTAKE_SITE_US1 } from './intakeSites'
8
8
 
9
9
  // replaced at build time
10
10
  declare const __BUILD_ENV__SDK_VERSION__: string
11
11
 
12
- export type TrackType = 'logs' | 'rum' | 'replay'
13
- export type ApiType =
14
- | 'xhr'
15
- | 'fetch'
16
- | 'beacon'
17
- // 'manual' reflects that the request have been sent manually, outside of the SDK (ex: via curl or
18
- // a Node.js script).
19
- | 'manual'
12
+ export const ENDPOINTS = {
13
+ logs: 'logs',
14
+ rum: 'rum',
15
+ sessionReplay: 'session-replay',
16
+ } as const
17
+
18
+ const INTAKE_TRACKS = {
19
+ logs: 'logs',
20
+ rum: 'rum',
21
+ sessionReplay: 'replay',
22
+ }
23
+
24
+ export type EndpointType = keyof typeof ENDPOINTS
20
25
 
21
26
  export type EndpointBuilder = ReturnType<typeof createEndpointBuilder>
22
27
 
23
28
  export function createEndpointBuilder(
24
29
  initConfiguration: InitConfiguration,
25
- trackType: TrackType,
30
+ endpointType: EndpointType,
26
31
  configurationTags: string[]
27
32
  ) {
28
- const buildUrlWithParameters = createEndpointUrlWithParametersBuilder(initConfiguration, trackType)
33
+ const buildUrlWithParameters = createEndpointUrlWithParametersBuilder(initConfiguration, endpointType)
29
34
 
30
35
  return {
31
- build(api: ApiType, payload: Payload) {
32
- const parameters = buildEndpointParameters(initConfiguration, trackType, configurationTags, api, payload)
36
+ build(api: 'xhr' | 'fetch' | 'beacon', flushReason?: FlushReason, retry?: RetryInfo) {
37
+ const parameters = buildEndpointParameters(
38
+ initConfiguration,
39
+ endpointType,
40
+ configurationTags,
41
+ api,
42
+ flushReason,
43
+ retry
44
+ )
33
45
  return buildUrlWithParameters(parameters)
34
46
  },
35
47
  urlPrefix: buildUrlWithParameters(''),
36
- trackType,
48
+ endpointType,
37
49
  }
38
50
  }
39
51
 
@@ -44,26 +56,32 @@ export function createEndpointBuilder(
44
56
  */
45
57
  function createEndpointUrlWithParametersBuilder(
46
58
  initConfiguration: InitConfiguration,
47
- trackType: TrackType
59
+ endpointType: EndpointType
48
60
  ): (parameters: string) => string {
49
- const { proxy, apiVersion, organizationIdentifier, insecureHTTP } = initConfiguration
61
+ const { proxy, proxyUrl, apiVersion, organizationIdentifier, insecureHTTP } = initConfiguration
50
62
 
51
- const path = `/rum/${apiVersion}/${organizationIdentifier}/${trackType}`
63
+ const path = `/rum/${apiVersion}/${organizationIdentifier}/${INTAKE_TRACKS[endpointType]}`
52
64
 
53
65
  if (proxy) {
54
66
  const normalizedProxyUrl = normalizeUrl(proxy)
55
- return (parameters) => `${normalizedProxyUrl}?o2forward=${encodeURIComponent(`${path}?${parameters}`)}`
67
+ return (parameters) => `${normalizedProxyUrl}?ooforward=${encodeURIComponent(`${path}?${parameters}`)}`
56
68
  }
57
- if (typeof proxy === 'function') {
58
- return (parameters) => proxy({ path, parameters })
69
+
70
+ const host = buildEndpointHost(initConfiguration, endpointType)
71
+
72
+ if (proxy === undefined && proxyUrl) {
73
+ // TODO: remove this in a future major.
74
+ const normalizedProxyUrl = normalizeUrl(proxyUrl)
75
+ return (parameters) =>
76
+ `${normalizedProxyUrl}?ooforward=${encodeURIComponent(`https://${host}${path}?${parameters}`)}`
59
77
  }
60
- const host = buildEndpointHost(initConfiguration)
78
+
61
79
  const protocol = insecureHTTP ? 'http' : 'https'
62
80
 
63
81
  return (parameters) => `${protocol}://${host}${path}?${parameters}`
64
82
  }
65
83
 
66
- function buildEndpointHost(initConfiguration: InitConfiguration) {
84
+ function buildEndpointHost(initConfiguration: InitConfiguration, endpointType: EndpointType) {
67
85
  const { site = INTAKE_SITE_US1, internalAnalyticsSubdomain } = initConfiguration
68
86
 
69
87
  return site
@@ -83,10 +101,11 @@ function buildEndpointHost(initConfiguration: InitConfiguration) {
83
101
  */
84
102
  function buildEndpointParameters(
85
103
  { clientToken, internalAnalyticsSubdomain }: InitConfiguration,
86
- trackType: TrackType,
104
+ endpointType: EndpointType,
87
105
  configurationTags: string[],
88
- api: ApiType,
89
- { retry, flushReason, encoding }: Payload
106
+ api: 'xhr' | 'fetch' | 'beacon',
107
+ flushReason: FlushReason | undefined,
108
+ retry: RetryInfo | undefined
90
109
  ) {
91
110
  const tags = [`sdk_version:${__BUILD_ENV__SDK_VERSION__}`, `api:${api}`].concat(configurationTags)
92
111
  if (flushReason && isExperimentalFeatureEnabled(ExperimentalFeature.COLLECT_FLUSH_REASON)) {
@@ -95,7 +114,6 @@ function buildEndpointParameters(
95
114
  if (retry) {
96
115
  tags.push(`retry_count:${retry.count}`, `retry_after:${retry.lastFailureStatus}`)
97
116
  }
98
-
99
117
  const parameters = [
100
118
  'o2source=browser',
101
119
  `o2tags=${encodeURIComponent(tags.join(','))}`,
@@ -105,14 +123,9 @@ function buildEndpointParameters(
105
123
  `o2-request-id=${generateUUID()}`,
106
124
  ]
107
125
 
108
- if (encoding) {
109
- parameters.push(`o2-evp-encoding=${encoding}`)
110
- }
111
-
112
- if (trackType === 'rum') {
126
+ if (endpointType === 'rum') {
113
127
  parameters.push(`batch_time=${timeStampNow()}`)
114
128
  }
115
-
116
129
  if (internalAnalyticsSubdomain) {
117
130
  parameters.reverse()
118
131
  }
@@ -5,6 +5,5 @@ export {
5
5
  validateAndBuildConfiguration,
6
6
  serializeConfiguration,
7
7
  } from './configuration'
8
- export { createEndpointBuilder, EndpointBuilder, TrackType } from './endpointBuilder'
8
+ export { createEndpointBuilder, EndpointBuilder, EndpointType } from './endpointBuilder'
9
9
  export * from './intakeSites'
10
- export { computeTransportConfiguration } from './transportConfiguration'
@@ -42,7 +42,7 @@ function computeEndpointBuilders(initConfiguration: InitConfiguration, tags: str
42
42
  return {
43
43
  logsEndpointBuilder: createEndpointBuilder(initConfiguration, 'logs', tags),
44
44
  rumEndpointBuilder: createEndpointBuilder(initConfiguration, 'rum', tags),
45
- sessionReplayEndpointBuilder: createEndpointBuilder(initConfiguration, 'replay', tags),
45
+ sessionReplayEndpointBuilder: createEndpointBuilder(initConfiguration, 'sessionReplay', tags),
46
46
  }
47
47
  }
48
48
 
@@ -1,3 +1,4 @@
1
+ import { computeStackTrace } from '../tracekit'
1
2
  import { createHandlingStack, formatErrorMessage, toStackTraceString, tryToGetFingerprint } from '../error/error'
2
3
  import { mergeObservables, Observable } from '../../tools/observable'
3
4
  import { ConsoleApiName, globalConsole } from '../../tools/display'
@@ -5,7 +6,6 @@ import { callMonitored } from '../../tools/monitor'
5
6
  import { sanitize } from '../../tools/serialisation/sanitize'
6
7
  import { find } from '../../tools/utils/polyfills'
7
8
  import { jsonStringify } from '../../tools/serialisation/jsonStringify'
8
- import { computeStackTrace } from '../error/computeStackTrace'
9
9
 
10
10
  export interface ConsoleLog {
11
11
  message: string
@@ -33,7 +33,7 @@ export function resetConsoleObservable() {
33
33
  }
34
34
 
35
35
  function createConsoleObservable(api: ConsoleApiName) {
36
- return new Observable<ConsoleLog>((observable) => {
36
+ const observable = new Observable<ConsoleLog>(() => {
37
37
  const originalConsoleApi = globalConsole[api]
38
38
 
39
39
  globalConsole[api] = (...params: unknown[]) => {
@@ -49,10 +49,13 @@ function createConsoleObservable(api: ConsoleApiName) {
49
49
  globalConsole[api] = originalConsoleApi
50
50
  }
51
51
  })
52
+
53
+ return observable
52
54
  }
53
55
 
54
56
  function buildConsoleLog(params: unknown[], api: ConsoleApiName, handlingStack: string): ConsoleLog {
55
- const message = params.map((param) => formatConsoleParameters(param)).join(' ')
57
+ // Todo: remove console error prefix in the next major version
58
+ let message = params.map((param) => formatConsoleParameters(param)).join(' ')
56
59
  let stack
57
60
  let fingerprint
58
61
 
@@ -60,6 +63,7 @@ function buildConsoleLog(params: unknown[], api: ConsoleApiName, handlingStack:
60
63
  const firstErrorParam = find(params, (param: unknown): param is Error => param instanceof Error)
61
64
  stack = firstErrorParam ? toStackTraceString(computeStackTrace(firstErrorParam)) : undefined
62
65
  fingerprint = tryToGetFingerprint(firstErrorParam)
66
+ message = `console error: ${message}`
63
67
  }
64
68
 
65
69
  return {
@@ -1,5 +1,3 @@
1
- import type { Encoder } from '../../tools/encoder'
2
-
3
1
  export type DeflateWorkerAction =
4
2
  // Action to send when creating the worker to check if the communication is working correctly.
5
3
  // The worker should respond with a 'initialized' response.
@@ -41,15 +39,3 @@ export type DeflateWorkerResponse =
41
39
  streamId?: number
42
40
  error: Error | string
43
41
  }
44
-
45
- export interface DeflateWorker extends Worker {
46
- postMessage(message: DeflateWorkerAction): void
47
- }
48
-
49
- export type DeflateEncoder = Encoder<Uint8Array> & { stop: () => void }
50
-
51
- export const enum DeflateEncoderStreamId {
52
- REPLAY = 1,
53
- RUM = 2,
54
- RUM_REPLICA = 3,
55
- }
@@ -1,11 +1,11 @@
1
+ import type { StackTrace } from '../tracekit'
2
+ import { computeStackTrace } from '../tracekit'
1
3
  import { callMonitored } from '../../tools/monitor'
2
4
  import { sanitize } from '../../tools/serialisation/sanitize'
3
5
  import type { ClocksState } from '../../tools/utils/timeUtils'
4
6
  import { noop } from '../../tools/utils/functionUtils'
5
7
  import { jsonStringify } from '../../tools/serialisation/jsonStringify'
6
8
  import type { ErrorSource, ErrorHandling, RawError, RawErrorCause, ErrorWithCause, NonErrorPrefix } from './error.types'
7
- import type { StackTrace } from './computeStackTrace'
8
- import { computeStackTrace } from './computeStackTrace'
9
9
 
10
10
  export const NO_ERROR_STACK_PRESENT_MESSAGE = 'No stack, consider using an instance of Error'
11
11
 
@@ -1,16 +1,7 @@
1
1
  import type { ClocksState } from '../../tools/utils/timeUtils'
2
2
 
3
- // TS v4.6 introduced Error.cause[1] typed as `Error`. TS v4.8 changed Error.cause to be
4
- // `unknown`[2].
5
- //
6
- // Because we still support TS 3.8, we need to declare our own type. We can remove it once we drop
7
- // support for TS v4.7 and before. The 'cause' property defined by TS needs to be omitted because
8
- // we define it with a type `unknown` which is incompatible with TS 4.6 and 4.7.
9
- //
10
- // [1]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-6/#target-es2022
11
- // [2]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/#lib-d-ts-updates
12
- export interface ErrorWithCause extends Omit<Error, 'cause'> {
13
- cause?: unknown
3
+ export interface ErrorWithCause extends Error {
4
+ cause?: Error
14
5
  }
15
6
 
16
7
  export type RawErrorCause = {
@@ -1,53 +1,21 @@
1
- import { instrumentMethod } from '../../tools/instrumentMethod'
2
1
  import type { Observable } from '../../tools/observable'
3
2
  import { clocksNow } from '../../tools/utils/timeUtils'
4
- import type { StackTrace } from './computeStackTrace'
5
- import { computeStackTrace, computeStackTraceFromOnErrorMessage } from './computeStackTrace'
3
+ import { startUnhandledErrorCollection } from '../tracekit'
6
4
  import { computeRawError } from './error'
7
5
  import type { RawError } from './error.types'
8
6
  import { ErrorHandling, ErrorSource, NonErrorPrefix } from './error.types'
9
7
 
10
- export type UnhandledErrorCallback = (stackTrace: StackTrace, originalError?: any) => any
11
-
12
8
  export function trackRuntimeError(errorObservable: Observable<RawError>) {
13
- const handleRuntimeError = (stackTrace: StackTrace, originalError?: any) => {
14
- const test = computeRawError({
15
- stackTrace,
16
- originalError,
17
- startClocks: clocksNow(),
18
- nonErrorPrefix: NonErrorPrefix.UNCAUGHT,
19
- source: ErrorSource.SOURCE,
20
- handling: ErrorHandling.UNHANDLED,
21
- })
22
- errorObservable.notify(test)
23
- }
24
- const { stop: stopInstrumentingOnError } = instrumentOnError(handleRuntimeError)
25
- const { stop: stopInstrumentingOnUnhandledRejection } = instrumentUnhandledRejection(handleRuntimeError)
26
-
27
- return {
28
- stop: () => {
29
- stopInstrumentingOnError()
30
- stopInstrumentingOnUnhandledRejection()
31
- },
32
- }
33
- }
34
-
35
- export function instrumentOnError(callback: UnhandledErrorCallback) {
36
- return instrumentMethod(window, 'onerror', ({ parameters: [messageObj, url, line, column, errorObj] }) => {
37
- let stackTrace
38
- if (errorObj instanceof Error) {
39
- stackTrace = computeStackTrace(errorObj)
40
- } else {
41
- stackTrace = computeStackTraceFromOnErrorMessage(messageObj, url, line, column)
42
- }
43
- callback(stackTrace, errorObj ?? messageObj)
44
- })
45
- }
46
-
47
- export function instrumentUnhandledRejection(callback: UnhandledErrorCallback) {
48
- return instrumentMethod(window, 'onunhandledrejection', ({ parameters: [e] }) => {
49
- const reason = e.reason || 'Empty reason'
50
- const stack = computeStackTrace(reason)
51
- callback(stack, reason)
9
+ return startUnhandledErrorCollection((stackTrace, originalError) => {
10
+ errorObservable.notify(
11
+ computeRawError({
12
+ stackTrace,
13
+ originalError,
14
+ startClocks: clocksNow(),
15
+ nonErrorPrefix: NonErrorPrefix.UNCAUGHT,
16
+ source: ErrorSource.SOURCE,
17
+ handling: ErrorHandling.UNHANDLED,
18
+ })
19
+ )
52
20
  })
53
21
  }
@@ -1,16 +1,5 @@
1
1
  export type ReportType = DeprecationReport['type'] | InterventionReport['type']
2
2
 
3
- interface Report {
4
- type: ReportType
5
- url: string
6
- body: DeprecationReportBody | InterventionReportBody
7
- toJSON(): any
8
- }
9
-
10
- interface ReportBody {
11
- toJSON(): any
12
- }
13
-
14
3
  export interface DeprecationReport extends Report {
15
4
  type: 'deprecation'
16
5
  body: DeprecationReportBody
@@ -28,7 +17,6 @@ export interface InterventionReport extends Report {
28
17
  type: 'intervention'
29
18
  body: InterventionReportBody
30
19
  }
31
-
32
20
  export interface InterventionReportBody extends ReportBody {
33
21
  id: string
34
22
  message: string
@@ -19,7 +19,6 @@ export interface RawReport {
19
19
  type: RawReportType
20
20
  subtype: string
21
21
  message: string
22
- originalReport: SecurityPolicyViolationEvent | DeprecationReport | InterventionReport
23
22
  stack?: string
24
23
  }
25
24
 
@@ -39,7 +38,7 @@ export function initReportObservable(configuration: Configuration, apis: RawRepo
39
38
  }
40
39
 
41
40
  function createReportObservable(reportTypes: ReportType[]) {
42
- return new Observable<RawReport>((observable) => {
41
+ const observable = new Observable<RawReport>(() => {
43
42
  if (!window.ReportingObserver) {
44
43
  return
45
44
  }
@@ -60,26 +59,26 @@ function createReportObservable(reportTypes: ReportType[]) {
60
59
  observer.disconnect()
61
60
  }
62
61
  })
62
+
63
+ return observable
63
64
  }
64
65
 
65
66
  function createCspViolationReportObservable(configuration: Configuration) {
66
- return new Observable<RawReport>((observable) => {
67
+ const observable = new Observable<RawReport>(() => {
67
68
  const { stop } = addEventListener(configuration, document, DOM_EVENT.SECURITY_POLICY_VIOLATION, (event) => {
68
69
  observable.notify(buildRawReportFromCspViolation(event))
69
70
  })
70
71
 
71
72
  return stop
72
73
  })
74
+ return observable
73
75
  }
74
76
 
75
- function buildRawReportFromReport(report: DeprecationReport | InterventionReport): RawReport {
76
- const { type, body } = report
77
-
77
+ function buildRawReportFromReport({ type, body }: DeprecationReport | InterventionReport): RawReport {
78
78
  return {
79
79
  type,
80
80
  subtype: body.id,
81
81
  message: `${type}: ${body.message}`,
82
- originalReport: report,
83
82
  stack: buildStack(body.id, body.message, body.sourceFile, body.lineNumber, body.columnNumber),
84
83
  }
85
84
  }
@@ -100,7 +99,6 @@ function buildRawReportFromCspViolation(event: SecurityPolicyViolationEvent): Ra
100
99
  event.lineNumber,
101
100
  event.columnNumber
102
101
  ),
103
- originalReport: event,
104
102
  }
105
103
  }
106
104
 
@@ -1,4 +1,4 @@
1
- import { getInitCookie } from '../../browser/cookie'
1
+ import { getCookie } from '../../browser/cookie'
2
2
  import type { SessionStoreStrategy } from './storeStrategies/sessionStoreStrategy'
3
3
  import { SESSION_STORE_KEY } from './storeStrategies/sessionStoreStrategy'
4
4
  import type { SessionState } from './sessionState'
@@ -17,11 +17,11 @@ export const LOGS_SESSION_KEY = 'logs'
17
17
  * to allow older sdk versions to be upgraded to newer versions without compatibility issues.
18
18
  */
19
19
  export function tryOldCookiesMigration(cookieStoreStrategy: SessionStoreStrategy) {
20
- const sessionString = getInitCookie(SESSION_STORE_KEY)
20
+ const sessionString = getCookie(SESSION_STORE_KEY)
21
21
  if (!sessionString) {
22
- const oldSessionId = getInitCookie(OLD_SESSION_COOKIE_NAME)
23
- const oldRumType = getInitCookie(OLD_RUM_COOKIE_NAME)
24
- const oldLogsType = getInitCookie(OLD_LOGS_COOKIE_NAME)
22
+ const oldSessionId = getCookie(OLD_SESSION_COOKIE_NAME)
23
+ const oldRumType = getCookie(OLD_RUM_COOKIE_NAME)
24
+ const oldLogsType = getCookie(OLD_LOGS_COOKIE_NAME)
25
25
  const session: SessionState = {}
26
26
 
27
27
  if (oldSessionId) {
@@ -1,5 +1,6 @@
1
1
  import { setTimeout } from '../../tools/timer'
2
2
  import { generateUUID } from '../../tools/utils/stringUtils'
3
+ import { isChromium } from '../../tools/utils/browserDetection'
3
4
  import type { SessionStoreStrategy } from './storeStrategies/sessionStoreStrategy'
4
5
  import type { SessionState } from './sessionState'
5
6
  import { expandSessionState, isSessionInExpiredState } from './sessionState'
@@ -19,7 +20,8 @@ export function processSessionStoreOperations(
19
20
  sessionStoreStrategy: SessionStoreStrategy,
20
21
  numberOfRetries = 0
21
22
  ) {
22
- const { isLockEnabled, retrieveSession, persistSession, clearSession } = sessionStoreStrategy
23
+ const { retrieveSession, persistSession, clearSession } = sessionStoreStrategy
24
+ const lockEnabled = isLockEnabled()
23
25
 
24
26
  if (!ongoingOperations) {
25
27
  ongoingOperations = operations
@@ -28,13 +30,13 @@ export function processSessionStoreOperations(
28
30
  bufferedOperations.push(operations)
29
31
  return
30
32
  }
31
- if (isLockEnabled && numberOfRetries >= LOCK_MAX_TRIES) {
33
+ if (lockEnabled && numberOfRetries >= LOCK_MAX_TRIES) {
32
34
  next(sessionStoreStrategy)
33
35
  return
34
36
  }
35
37
  let currentLock: string
36
38
  let currentSession = retrieveSession()
37
- if (isLockEnabled) {
39
+ if (lockEnabled) {
38
40
  // if someone has lock, retry later
39
41
  if (currentSession.lock) {
40
42
  retryLater(operations, sessionStoreStrategy, numberOfRetries)
@@ -52,7 +54,7 @@ export function processSessionStoreOperations(
52
54
  }
53
55
  }
54
56
  let processedSession = operations.process(currentSession)
55
- if (isLockEnabled) {
57
+ if (lockEnabled) {
56
58
  // if lock corrupted after process, retry later
57
59
  currentSession = retrieveSession()
58
60
  if (currentSession.lock !== currentLock!) {
@@ -68,7 +70,7 @@ export function processSessionStoreOperations(
68
70
  persistSession(processedSession)
69
71
  }
70
72
  }
71
- if (isLockEnabled) {
73
+ if (lockEnabled) {
72
74
  // correctly handle lock around expiration would require to handle this case properly at several levels
73
75
  // since we don't have evidence of lock issues around expiration, let's just not do the corruption check for it
74
76
  if (!(processedSession && isSessionInExpiredState(processedSession))) {
@@ -89,6 +91,12 @@ export function processSessionStoreOperations(
89
91
  next(sessionStoreStrategy)
90
92
  }
91
93
 
94
+ /**
95
+ * Lock strategy allows mitigating issues due to concurrent access to cookie.
96
+ * This issue concerns only chromium browsers and enabling this on firefox increases cookie write failures.
97
+ */
98
+ export const isLockEnabled = () => isChromium()
99
+
92
100
  function retryLater(operations: Operations, sessionStore: SessionStoreStrategy, currentNumberOfRetries: number) {
93
101
  setTimeout(() => {
94
102
  processSessionStoreOperations(operations, sessionStore, currentNumberOfRetries + 1)
@@ -1,4 +1,3 @@
1
- import { isChromium } from '../../../tools/utils/browserDetection'
2
1
  import type { CookieOptions } from '../../../browser/cookie'
3
2
  import { getCurrentSite, areCookiesAuthorized, deleteCookie, getCookie, setCookie } from '../../../browser/cookie'
4
3
  import type { InitConfiguration } from '../../configuration'
@@ -16,11 +15,6 @@ export function selectCookieStrategy(initConfiguration: InitConfiguration): Sess
16
15
 
17
16
  export function initCookieStrategy(cookieOptions: CookieOptions): SessionStoreStrategy {
18
17
  const cookieStore = {
19
- /**
20
- * Lock strategy allows mitigating issues due to concurrent access to cookie.
21
- * This issue concerns only chromium browsers and enabling this on firefox increases cookie write failures.
22
- */
23
- isLockEnabled: isChromium(),
24
18
  persistSession: persistSessionCookie(cookieOptions),
25
19
  retrieveSession: retrieveSessionCookie,
26
20
  clearSession: deleteSessionCookie(cookieOptions),
@@ -51,13 +45,8 @@ function deleteSessionCookie(options: CookieOptions) {
51
45
  export function buildCookieOptions(initConfiguration: InitConfiguration) {
52
46
  const cookieOptions: CookieOptions = {}
53
47
 
54
- cookieOptions.secure =
55
- !!initConfiguration.useSecureSessionCookie ||
56
- !!initConfiguration.usePartitionedCrossSiteSessionCookie ||
57
- !!initConfiguration.useCrossSiteSessionCookie
58
- cookieOptions.crossSite =
59
- !!initConfiguration.usePartitionedCrossSiteSessionCookie || !!initConfiguration.useCrossSiteSessionCookie
60
- cookieOptions.partitioned = !!initConfiguration.usePartitionedCrossSiteSessionCookie
48
+ cookieOptions.secure = !!initConfiguration.useSecureSessionCookie || !!initConfiguration.useCrossSiteSessionCookie
49
+ cookieOptions.crossSite = !!initConfiguration.useCrossSiteSessionCookie
61
50
 
62
51
  if (initConfiguration.trackSessionAcrossSubdomains) {
63
52
  cookieOptions.domain = getCurrentSite()
@@ -21,7 +21,6 @@ export function selectLocalStorageStrategy(): SessionStoreStrategyType | undefin
21
21
 
22
22
  export function initLocalStorageStrategy(): SessionStoreStrategy {
23
23
  return {
24
- isLockEnabled: false,
25
24
  persistSession: persistInLocalStorage,
26
25
  retrieveSession: retrieveSessionFromLocalStorage,
27
26
  clearSession: clearSessionFromLocalStorage,