@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
@@ -1,107 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createCustomerDataTracker = exports.createCustomerDataTrackerManager = exports.BYTES_COMPUTATION_THROTTLING_DELAY = exports.CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT = exports.CUSTOMER_DATA_BYTES_LIMIT = void 0;
4
- var byteUtils_1 = require("../../tools/utils/byteUtils");
5
- var functionUtils_1 = require("../../tools/utils/functionUtils");
6
- var jsonStringify_1 = require("../../tools/serialisation/jsonStringify");
7
- var display_1 = require("../../tools/display");
8
- var objectUtils_1 = require("../../tools/utils/objectUtils");
9
- // RUM and logs batch bytes limit is 16KB
10
- // ensure that we leave room for other event attributes and maintain a decent amount of event per batch
11
- // (3KB (customer data) + 1KB (other attributes)) * 4 (events per batch) = 16KB
12
- exports.CUSTOMER_DATA_BYTES_LIMIT = 3 * byteUtils_1.ONE_KIBI_BYTE;
13
- // We observed that the compression ratio is around 8 in general, but we also want to keep a margin
14
- // because some data might not be compressed (ex: last view update on page exit). We chose 16KiB
15
- // because it is also the limit of the 'batchBytesCount' that we use for RUM and Logs data, but this
16
- // is a bit arbitrary.
17
- exports.CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT = 16 * byteUtils_1.ONE_KIBI_BYTE;
18
- exports.BYTES_COMPUTATION_THROTTLING_DELAY = 200;
19
- function createCustomerDataTrackerManager(compressionStatus) {
20
- if (compressionStatus === void 0) { compressionStatus = 2 /* CustomerDataCompressionStatus.Disabled */; }
21
- var customerDataTrackers = new Map();
22
- var alreadyWarned = false;
23
- function checkCustomerDataLimit(initialBytesCount) {
24
- if (initialBytesCount === void 0) { initialBytesCount = 0; }
25
- if (alreadyWarned || compressionStatus === 0 /* CustomerDataCompressionStatus.Unknown */) {
26
- return;
27
- }
28
- var bytesCountLimit = compressionStatus === 2 /* CustomerDataCompressionStatus.Disabled */
29
- ? exports.CUSTOMER_DATA_BYTES_LIMIT
30
- : exports.CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT;
31
- var bytesCount = initialBytesCount;
32
- customerDataTrackers.forEach(function (tracker) {
33
- bytesCount += tracker.getBytesCount();
34
- });
35
- if (bytesCount > bytesCountLimit) {
36
- displayCustomerDataLimitReachedWarning(bytesCountLimit);
37
- alreadyWarned = true;
38
- }
39
- }
40
- return {
41
- /**
42
- * Creates a detached tracker. The manager will not store a reference to that tracker, and the
43
- * bytes count will be counted independently from other detached trackers.
44
- *
45
- * This is particularly useful when we don't know when the tracker will be unused, so we don't
46
- * leak memory (ex: when used in Logger instances).
47
- */
48
- createDetachedTracker: function () {
49
- var tracker = createCustomerDataTracker(function () { return checkCustomerDataLimit(tracker.getBytesCount()); });
50
- return tracker;
51
- },
52
- /**
53
- * Creates a tracker if it doesn't exist, and returns it.
54
- */
55
- getOrCreateTracker: function (type) {
56
- if (!customerDataTrackers.has(type)) {
57
- customerDataTrackers.set(type, createCustomerDataTracker(checkCustomerDataLimit));
58
- }
59
- return customerDataTrackers.get(type);
60
- },
61
- setCompressionStatus: function (newCompressionStatus) {
62
- if (compressionStatus === 0 /* CustomerDataCompressionStatus.Unknown */) {
63
- compressionStatus = newCompressionStatus;
64
- checkCustomerDataLimit();
65
- }
66
- },
67
- getCompressionStatus: function () { return compressionStatus; },
68
- stop: function () {
69
- customerDataTrackers.forEach(function (tracker) { return tracker.stop(); });
70
- customerDataTrackers.clear();
71
- },
72
- };
73
- }
74
- exports.createCustomerDataTrackerManager = createCustomerDataTrackerManager;
75
- function createCustomerDataTracker(checkCustomerDataLimit) {
76
- var bytesCountCache = 0;
77
- // Throttle the bytes computation to minimize the impact on performance.
78
- // Especially useful if the user call context APIs synchronously multiple times in a row
79
- var _a = (0, functionUtils_1.throttle)(function (context) {
80
- bytesCountCache = (0, byteUtils_1.computeBytesCount)((0, jsonStringify_1.jsonStringify)(context));
81
- checkCustomerDataLimit();
82
- }, exports.BYTES_COMPUTATION_THROTTLING_DELAY), computeBytesCountThrottled = _a.throttled, cancelComputeBytesCount = _a.cancel;
83
- var resetBytesCount = function () {
84
- cancelComputeBytesCount();
85
- bytesCountCache = 0;
86
- };
87
- return {
88
- updateCustomerData: function (context) {
89
- if ((0, objectUtils_1.isEmptyObject)(context)) {
90
- resetBytesCount();
91
- }
92
- else {
93
- computeBytesCountThrottled(context);
94
- }
95
- },
96
- resetCustomerData: resetBytesCount,
97
- getBytesCount: function () { return bytesCountCache; },
98
- stop: function () {
99
- cancelComputeBytesCount();
100
- },
101
- };
102
- }
103
- exports.createCustomerDataTracker = createCustomerDataTracker;
104
- function displayCustomerDataLimitReachedWarning(bytesCountLimit) {
105
- display_1.display.warn("Customer data exceeds the recommended ".concat(bytesCountLimit / byteUtils_1.ONE_KIBI_BYTE, "KiB threshold. More details: https://docs.datadoghq.com/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-threshold-warning"));
106
- }
107
- //# sourceMappingURL=customerDataTracker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customerDataTracker.js","sourceRoot":"","sources":["../../../src/domain/context/customerDataTracker.ts"],"names":[],"mappings":";;;AAAA,yDAA8E;AAC9E,iEAA0D;AAE1D,yEAAuE;AACvE,+CAA6C;AAC7C,6DAA6D;AAG7D,yCAAyC;AACzC,uGAAuG;AACvG,+EAA+E;AAClE,QAAA,yBAAyB,GAAG,CAAC,GAAG,yBAAa,CAAA;AAE1D,mGAAmG;AACnG,gGAAgG;AAChG,oGAAoG;AACpG,sBAAsB;AACT,QAAA,oCAAoC,GAAG,EAAE,GAAG,yBAAa,CAAA;AAEzD,QAAA,kCAAkC,GAAG,GAAG,CAAA;AAWrD,SAAgB,gCAAgC,CAC9C,iBAAyF;IAAzF,kCAAA,EAAA,kEAAyF;IAEzF,IAAM,oBAAoB,GAAG,IAAI,GAAG,EAAyC,CAAA;IAE7E,IAAI,aAAa,GAAG,KAAK,CAAA;IACzB,SAAS,sBAAsB,CAAC,iBAAqB;QAArB,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O,CAAC,UAAC,OAAO,IAAK,OAAA,OAAO,CAAC,IAAI,EAAE,EAAd,CAAc,CAAC,CAAA;YACzD,oBAAoB,CAAC,KAAK,EAAE,CAAA;QAC9B,CAAC;KACF,CAAA;AACH,CAAC;AAhED,4EAgEC;AAED,SAAgB,yBAAyB,CAAC,sBAAkC;IAC1E,IAAI,eAAe,GAAG,CAAC,CAAA;IAEvB,wEAAwE;IACxE,wFAAwF;IAClF,IAAA,KAA6E,IAAA,wBAAQ,EAAC,UAAC,OAAgB;QAC3G,eAAe,GAAG,IAAA,6BAAiB,EAAC,IAAA,6BAAa,EAAC,OAAO,CAAE,CAAC,CAAA;QAC5D,sBAAsB,EAAE,CAAA;IAC1B,CAAC,EAAE,0CAAkC,CAAC,EAHnB,0BAA0B,eAAA,EAAU,uBAAuB,YAGxC,CAAA;IAEtC,IAAM,eAAe,GAAG;QACtB,uBAAuB,EAAE,CAAA;QACzB,eAAe,GAAG,CAAC,CAAA;IACrB,CAAC,CAAA;IAED,OAAO;QACL,kBAAkB,EAAE,UAAC,OAAgB;YACnC,IAAI,IAAA,2BAAa,EAAC,OAAO,CAAC,EAAE,CAAC;gBAC3B,eAAe,EAAE,CAAA;YACnB,CAAC;iBAAM,CAAC;gBACN,0BAA0B,CAAC,OAAO,CAAC,CAAA;YACrC,CAAC;QACH,CAAC;QACD,iBAAiB,EAAE,eAAe;QAClC,aAAa,EAAE,cAAM,OAAA,eAAe,EAAf,CAAe;QACpC,IAAI,EAAE;YACJ,uBAAuB,EAAE,CAAA;QAC3B,CAAC;KACF,CAAA;AACH,CAAC;AA7BD,8DA6BC;AAED,SAAS,sCAAsC,CAAC,eAAuB;IACrE,iBAAO,CAAC,IAAI,CACV,gDACE,eAAe,GAAG,yBAAa,kKAC8H,CAChK,CAAA;AACH,CAAC"}
@@ -1,6 +0,0 @@
1
- import type { Configuration } from '../configuration';
2
- import type { ContextManager } from './contextManager';
3
- import type { CustomerDataType } from './contextConstants';
4
- export declare function storeContextManager(configuration: Configuration, contextManager: ContextManager, productKey: string, customerDataType: CustomerDataType): void;
5
- export declare function buildStorageKey(productKey: string, customerDataType: CustomerDataType): string;
6
- export declare function removeStorageListeners(): void;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.removeStorageListeners = exports.buildStorageKey = exports.storeContextManager = void 0;
4
- var addEventListener_1 = require("../../browser/addEventListener");
5
- var mergeInto_1 = require("../../tools/mergeInto");
6
- var CONTEXT_STORE_KEY_PREFIX = '_oo_c';
7
- var storageListeners = [];
8
- function storeContextManager(configuration, contextManager, productKey, customerDataType) {
9
- var storageKey = buildStorageKey(productKey, customerDataType);
10
- storageListeners.push((0, addEventListener_1.addEventListener)(configuration, window, addEventListener_1.DOM_EVENT.STORAGE, function (_a) {
11
- var key = _a.key;
12
- if (storageKey === key) {
13
- synchronizeWithStorage();
14
- }
15
- }));
16
- contextManager.changeObservable.subscribe(dumpToStorage);
17
- contextManager.setContext((0, mergeInto_1.combine)(getFromStorage(), contextManager.getContext()));
18
- function synchronizeWithStorage() {
19
- contextManager.setContext(getFromStorage());
20
- }
21
- function dumpToStorage() {
22
- localStorage.setItem(storageKey, JSON.stringify(contextManager.getContext()));
23
- }
24
- function getFromStorage() {
25
- var rawContext = localStorage.getItem(storageKey);
26
- return rawContext !== null ? JSON.parse(rawContext) : {};
27
- }
28
- }
29
- exports.storeContextManager = storeContextManager;
30
- function buildStorageKey(productKey, customerDataType) {
31
- return "".concat(CONTEXT_STORE_KEY_PREFIX, "_").concat(productKey, "_").concat(customerDataType);
32
- }
33
- exports.buildStorageKey = buildStorageKey;
34
- function removeStorageListeners() {
35
- storageListeners.map(function (listener) { return listener.stop(); });
36
- }
37
- exports.removeStorageListeners = removeStorageListeners;
38
- //# sourceMappingURL=storeContextManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storeContextManager.js","sourceRoot":"","sources":["../../../src/domain/context/storeContextManager.ts"],"names":[],"mappings":";;;AAAA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AE,CAAA;AACxE,CAAC;AAFD,0CAEC;AAED,SAAgB,sBAAsB;IACpC,gBAAgB,CAAC,GAAG,CAAC,UAAC,QAAQ,IAAK,OAAA,QAAQ,CAAC,IAAI,EAAE,EAAf,CAAe,CAAC,CAAA;AACrD,CAAC;AAFD,wDAEC"}
@@ -1,33 +0,0 @@
1
- /**
2
- * Cross-browser stack trace computation.
3
- *
4
- * Reference implementation: https://github.com/csnover/TraceKit/blob/04530298073c3823de72deb0b97e7b38ca7bcb59/tracekit.js
5
- */
6
- export interface StackFrame {
7
- url?: string;
8
- func?: string;
9
- /** The arguments passed to the function, if known. */
10
- args?: string[];
11
- line?: number;
12
- column?: number;
13
- /** An array of source code lines; the middle element corresponds to the correct line. */
14
- context?: string[];
15
- }
16
- export interface StackTrace {
17
- name?: string;
18
- message?: string;
19
- url?: string;
20
- stack: StackFrame[];
21
- incomplete?: boolean;
22
- partial?: boolean;
23
- }
24
- export declare function computeStackTrace(ex: unknown): StackTrace;
25
- export declare function computeStackTraceFromOnErrorMessage(messageObj: unknown, url?: string, line?: number, column?: number): {
26
- name: string | undefined;
27
- message: string | undefined;
28
- stack: {
29
- url: string | undefined;
30
- column: number | undefined;
31
- line: number | undefined;
32
- }[];
33
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"computeStackTrace.js","sourceRoot":"","sources":["../../../src/domain/error/computeStackTrace.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,yDAAwD;AAsBxD,IAAM,gBAAgB,GAAG,GAAG,CAAA;AAE5B,SAAgB,iBAAiB,CAAC,EAAW;IAC3C,IAAM,KAAK,GAAiB,EAAE,CAAA;IAE9B,IAAI,aAAa,GAAG,cAAc,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IAC/C,IAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,CAAA;IAC3B,IAAI,aAAa,IAAI,IAAA,sBAAU,EAAC,aAAa,EAAE,QAAQ,CAAC,EAAE,CAAC;QACzD,aAAa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KAAK,GAAI,SAAsC,CAAC,QAAQ,CAAC,CAAA;IAC/D,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;AACtD,CAAC;AAED,SAAgB,mCAAmC,CAAC,UAAmB,EAAE,GAAY,EAAE,IAAa,EAAE,MAAe;IACnH,IAAM,KAAK,GAAG,CAAC,EAAE,GAAG,KAAA,EAAE,MAAM,QAAA,EAAE,IAAI,MAAA,EAAE,CAAC,CAAA;IAC/B,IAAA,KAAoB,iBAAiB,CAAC,UAAU,CAAC,EAA/C,IAAI,UAAA,EAAE,OAAO,aAAkC,CAAA;IACvD,OAAO;QACL,IAAI,MAAA;QACJ,OAAO,SAAA;QACP,KAAK,OAAA;KACN,CAAA;AACH,CAAC;AARD,kFAQC;AAED,qGAAqG;AACrG,IAAM,cAAc,GAClB,8GAA8G,CAAA;AAEhH,SAAS,iBAAiB,CAAC,UAAmB;;IAC5C,IAAI,IAAI,CAAA;IACR,IAAI,OAAO,CAAA;IACX,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,iBAAiB,EAAE,CAAC;QACvD,CAAC;QAAA,KAAoB,cAAc,CAAC,IAAI,CAAC,UAAoB,CAAE,EAA3D,IAAI,QAAA,EAAE,OAAO,QAAA,CAA8C;IACjE,CAAC;IACD,OAAO,EAAE,IAAI,MAAA,EAAE,OAAO,SAAA,EAAE,CAAA;AAC1B,CAAC"}
@@ -1,53 +0,0 @@
1
- export interface Encoder<Output extends string | Uint8Array = string | Uint8Array> {
2
- /**
3
- * Whether this encoder might call the provided callbacks asynchronously
4
- */
5
- isAsync: boolean;
6
- /**
7
- * Whether some data has been written since the last finish() or finishSync() call
8
- */
9
- isEmpty: boolean;
10
- /**
11
- * Write a string to be encoded.
12
- *
13
- * This operation can be synchronous or asynchronous depending on the encoder implementation.
14
- *
15
- * If specified, the callback will be invoked when the operation finishes, unless the operation is
16
- * asynchronous and finish() or finishSync() is called in the meantime.
17
- */
18
- write(data: string, callback?: (additionalEncodedBytesCount: number) => void): void;
19
- /**
20
- * Waits for pending data to be encoded and resets the encoder state.
21
- *
22
- * This operation can be synchronous or asynchronous depending on the encoder implementation.
23
- *
24
- * The callback will be invoked when the operation finishes, unless the operation is asynchronous
25
- * and another call to finish() or finishSync() occurs in the meantime.
26
- */
27
- finish(callback: (result: EncoderResult<Output>) => void): void;
28
- /**
29
- * Resets the encoder state then returns the encoded data and any potential pending data directly,
30
- * discarding all pending write operations and finish() callbacks.
31
- */
32
- finishSync(): EncoderResult<Output> & {
33
- pendingData: string;
34
- };
35
- /**
36
- * Returns a rough estimation of the bytes count if the data was encoded.
37
- */
38
- estimateEncodedBytesCount(data: string): number;
39
- }
40
- export interface EncoderResult<Output extends string | Uint8Array = string | Uint8Array> {
41
- output: Output;
42
- outputBytesCount: number;
43
- /**
44
- * An encoding type supported by HTTP Content-Encoding, if applicable.
45
- * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding#directives
46
- */
47
- encoding?: 'deflate';
48
- /**
49
- * Total bytes count of the input strings encoded to UTF-8.
50
- */
51
- rawBytesCount: number;
52
- }
53
- export declare function createIdentityEncoder(): Encoder<string>;
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createIdentityEncoder = void 0;
4
- var byteUtils_1 = require("./utils/byteUtils");
5
- function createIdentityEncoder() {
6
- var output = '';
7
- var outputBytesCount = 0;
8
- return {
9
- isAsync: false,
10
- get isEmpty() {
11
- return !output;
12
- },
13
- write: function (data, callback) {
14
- var additionalEncodedBytesCount = (0, byteUtils_1.computeBytesCount)(data);
15
- outputBytesCount += additionalEncodedBytesCount;
16
- output += data;
17
- if (callback) {
18
- callback(additionalEncodedBytesCount);
19
- }
20
- },
21
- finish: function (callback) {
22
- callback(this.finishSync());
23
- },
24
- finishSync: function () {
25
- var result = {
26
- output: output,
27
- outputBytesCount: outputBytesCount,
28
- rawBytesCount: outputBytesCount,
29
- pendingData: '',
30
- };
31
- output = '';
32
- outputBytesCount = 0;
33
- return result;
34
- },
35
- estimateEncodedBytesCount: function (data) {
36
- return data.length;
37
- },
38
- };
39
- }
40
- exports.createIdentityEncoder = createIdentityEncoder;
41
- //# sourceMappingURL=encoder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"encoder.js","sourceRoot":"","sources":["../../src/tools/encoder.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AA6DrD,SAAgB,qBAAqB;IACnC,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,IAAI,gBAAgB,GAAG,CAAC,CAAA;IAExB,OAAO;QACL,OAAO,EAAE,KAAK;QAEd,IAAI,OAAO;YACT,OAAO,CAAC,MAAM,CAAA;QAChB,CAAC;QAED,KAAK,YAAC,IAAI,EAAE,QAAQ;YAClB,IAAM,2BAA2B,GAAG,IAAA,6BAAiB,EAAC,IAAI,CAAC,CAAA;YAC3D,gBAAgB,IAAI,2BAA2B,CAAA;YAC/C,MAAM,IAAI,IAAI,CAAA;YACd,IAAI,QAAQ,EAAE,CAAC;gBACb,QAAQ,CAAC,2BAA2B,CAAC,CAAA;YACvC,CAAC;QACH,CAAC;QAED,MAAM,YAAC,QAAQ;YACb,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;QAC7B,CAAC;QAED,UAAU;YACR,IAAM,MAAM,GAAG;gBACb,MAAM,QAAA;gBACN,gBAAgB,kBAAA;gBAChB,aAAa,EAAE,gBAAgB;gBAC/B,WAAW,EAAE,EAAE;aAChB,CAAA;YACD,MAAM,GAAG,EAAE,CAAA;YACX,gBAAgB,GAAG,CAAC,CAAA;YACpB,OAAO,MAAM,CAAA;QACf,CAAC;QAED,yBAAyB,YAAC,IAAI;YAC5B,OAAO,IAAI,CAAC,MAAM,CAAA;QACpB,CAAC;KACF,CAAA;AACH,CAAC;AAxCD,sDAwCC"}
@@ -1,13 +0,0 @@
1
- export type NetworkInterface = 'bluetooth' | 'cellular' | 'ethernet' | 'none' | 'wifi' | 'wimax' | 'other' | 'unknown';
2
- export type EffectiveType = 'slow-2g' | '2g' | '3g' | '4g';
3
- export interface NetworkInformation {
4
- type?: NetworkInterface;
5
- effectiveType?: EffectiveType;
6
- }
7
- export interface Connectivity {
8
- status: 'connected' | 'not_connected';
9
- interfaces?: NetworkInterface[];
10
- effective_type?: EffectiveType;
11
- [key: string]: unknown;
12
- }
13
- export declare function getConnectivity(): Connectivity;
@@ -1,10 +0,0 @@
1
- export function getConnectivity() {
2
- var _a;
3
- var navigator = window.navigator;
4
- return {
5
- status: navigator.onLine ? 'connected' : 'not_connected',
6
- interfaces: navigator.connection && navigator.connection.type ? [navigator.connection.type] : undefined,
7
- effective_type: (_a = navigator.connection) === null || _a === void 0 ? void 0 : _a.effectiveType,
8
- };
9
- }
10
- //# sourceMappingURL=connectivity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connectivity.js","sourceRoot":"","sources":["../../../src/domain/connectivity/connectivity.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,eAAe;;IAC7B,IAAM,SAAS,GAAG,MAAM,CAAC,SAA6B,CAAA;IACtD,OAAO;QACL,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe;QACxD,UAAU,EAAE,SAAS,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;QACvG,cAAc,EAAE,MAAA,SAAS,CAAC,UAAU,0CAAE,aAAa;KACpD,CAAA;AACH,CAAC"}
@@ -1 +0,0 @@
1
- export * from './connectivity';
@@ -1,2 +0,0 @@
1
- export * from './connectivity';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/connectivity/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
@@ -1,5 +0,0 @@
1
- export declare const enum CustomerDataType {
2
- FeatureFlag = 0,
3
- User = 1,
4
- GlobalContext = 2
5
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=contextConstants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contextConstants.js","sourceRoot":"","sources":["../../../src/domain/context/contextConstants.ts"],"names":[],"mappings":""}
@@ -1,12 +0,0 @@
1
- import type { Context } from '../../tools/serialisation/context';
2
- import { Observable } from '../../tools/observable';
3
- import type { CustomerDataTracker } from './customerDataTracker';
4
- export type ContextManager = ReturnType<typeof createContextManager>;
5
- export declare function createContextManager(customerDataTracker: CustomerDataTracker): {
6
- getContext: () => Context;
7
- setContext: (newContext: Context) => void;
8
- setContextProperty: (key: string, property: any) => void;
9
- removeContextProperty: (key: string) => void;
10
- clearContext: () => void;
11
- changeObservable: Observable<void>;
12
- };
@@ -1,39 +0,0 @@
1
- import { deepClone } from '../../tools/mergeInto';
2
- import { getType } from '../../tools/utils/typeUtils';
3
- import { sanitize } from '../../tools/serialisation/sanitize';
4
- import { Observable } from '../../tools/observable';
5
- export function createContextManager(customerDataTracker) {
6
- var context = {};
7
- var changeObservable = new Observable();
8
- var contextManager = {
9
- getContext: function () { return deepClone(context); },
10
- setContext: function (newContext) {
11
- if (getType(newContext) === 'object') {
12
- context = sanitize(newContext);
13
- customerDataTracker.updateCustomerData(context);
14
- }
15
- else {
16
- contextManager.clearContext();
17
- }
18
- changeObservable.notify();
19
- },
20
- setContextProperty: function (key, property) {
21
- context[key] = sanitize(property);
22
- customerDataTracker.updateCustomerData(context);
23
- changeObservable.notify();
24
- },
25
- removeContextProperty: function (key) {
26
- delete context[key];
27
- customerDataTracker.updateCustomerData(context);
28
- changeObservable.notify();
29
- },
30
- clearContext: function () {
31
- context = {};
32
- customerDataTracker.resetCustomerData();
33
- changeObservable.notify();
34
- },
35
- changeObservable: changeObservable,
36
- };
37
- return contextManager;
38
- }
39
- //# sourceMappingURL=contextManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contextManager.js","sourceRoot":"","sources":["../../../src/domain/context/contextManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAA;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAKnD,MAAM,UAAU,oBAAoB,CAAC,mBAAwC;IAC3E,IAAI,OAAO,GAAY,EAAE,CAAA;IACzB,IAAM,gBAAgB,GAAG,IAAI,UAAU,EAAQ,CAAA;IAE/C,IAAM,cAAc,GAAG;QACrB,UAAU,EAAE,cAAM,OAAA,SAAS,CAAC,OAAO,CAAC,EAAlB,CAAkB;QAEpC,UAAU,EAAE,UAAC,UAAmB;YAC9B,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACrC,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAA;gBAC9B,mBAAmB,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;YACjD,CAAC;iBAAM,CAAC;gBACN,cAAc,CAAC,YAAY,EAAE,CAAA;YAC/B,CAAC;YACD,gBAAgB,CAAC,MAAM,EAAE,CAAA;QAC3B,CAAC;QAED,kBAAkB,EAAE,UAAC,GAAW,EAAE,QAAa;YAC7C,OAAO,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAA;YACjC,mBAAmB,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;YAC/C,gBAAgB,CAAC,MAAM,EAAE,CAAA;QAC3B,CAAC;QAED,qBAAqB,EAAE,UAAC,GAAW;YACjC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAA;YACnB,mBAAmB,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;YAC/C,gBAAgB,CAAC,MAAM,EAAE,CAAA;QAC3B,CAAC;QAED,YAAY,EAAE;YACZ,OAAO,GAAG,EAAE,CAAA;YACZ,mBAAmB,CAAC,iBAAiB,EAAE,CAAA;YACvC,gBAAgB,CAAC,MAAM,EAAE,CAAA;QAC3B,CAAC;QAED,gBAAgB,kBAAA;KACjB,CAAA;IACD,OAAO,cAAc,CAAA;AACvB,CAAC"}
@@ -1,45 +0,0 @@
1
- import type { Context } from '../../tools/serialisation/context';
2
- import type { CustomerDataType } from './contextConstants';
3
- export declare const CUSTOMER_DATA_BYTES_LIMIT: number;
4
- export declare const CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT: number;
5
- export declare const BYTES_COMPUTATION_THROTTLING_DELAY = 200;
6
- export type CustomerDataTracker = ReturnType<typeof createCustomerDataTracker>;
7
- export type CustomerDataTrackerManager = ReturnType<typeof createCustomerDataTrackerManager>;
8
- export declare const enum CustomerDataCompressionStatus {
9
- Unknown = 0,
10
- Enabled = 1,
11
- Disabled = 2
12
- }
13
- export declare function createCustomerDataTrackerManager(compressionStatus?: CustomerDataCompressionStatus): {
14
- /**
15
- * Creates a detached tracker. The manager will not store a reference to that tracker, and the
16
- * bytes count will be counted independently from other detached trackers.
17
- *
18
- * This is particularly useful when we don't know when the tracker will be unused, so we don't
19
- * leak memory (ex: when used in Logger instances).
20
- */
21
- createDetachedTracker: () => {
22
- updateCustomerData: (context: Context) => void;
23
- resetCustomerData: () => void;
24
- getBytesCount: () => number;
25
- stop: () => void;
26
- };
27
- /**
28
- * Creates a tracker if it doesn't exist, and returns it.
29
- */
30
- getOrCreateTracker: (type: CustomerDataType) => {
31
- updateCustomerData: (context: Context) => void;
32
- resetCustomerData: () => void;
33
- getBytesCount: () => number;
34
- stop: () => void;
35
- };
36
- setCompressionStatus: (newCompressionStatus: CustomerDataCompressionStatus) => void;
37
- getCompressionStatus: () => CustomerDataCompressionStatus;
38
- stop: () => void;
39
- };
40
- export declare function createCustomerDataTracker(checkCustomerDataLimit: () => void): {
41
- updateCustomerData: (context: Context) => void;
42
- resetCustomerData: () => void;
43
- getBytesCount: () => number;
44
- stop: () => void;
45
- };
@@ -1,102 +0,0 @@
1
- import { ONE_KIBI_BYTE, computeBytesCount } from '../../tools/utils/byteUtils';
2
- import { throttle } from '../../tools/utils/functionUtils';
3
- import { jsonStringify } from '../../tools/serialisation/jsonStringify';
4
- import { display } from '../../tools/display';
5
- import { isEmptyObject } from '../../tools/utils/objectUtils';
6
- // RUM and logs batch bytes limit is 16KB
7
- // ensure that we leave room for other event attributes and maintain a decent amount of event per batch
8
- // (3KB (customer data) + 1KB (other attributes)) * 4 (events per batch) = 16KB
9
- export var CUSTOMER_DATA_BYTES_LIMIT = 3 * ONE_KIBI_BYTE;
10
- // We observed that the compression ratio is around 8 in general, but we also want to keep a margin
11
- // because some data might not be compressed (ex: last view update on page exit). We chose 16KiB
12
- // because it is also the limit of the 'batchBytesCount' that we use for RUM and Logs data, but this
13
- // is a bit arbitrary.
14
- export var CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT = 16 * ONE_KIBI_BYTE;
15
- export var BYTES_COMPUTATION_THROTTLING_DELAY = 200;
16
- export function createCustomerDataTrackerManager(compressionStatus) {
17
- if (compressionStatus === void 0) { compressionStatus = 2 /* CustomerDataCompressionStatus.Disabled */; }
18
- var customerDataTrackers = new Map();
19
- var alreadyWarned = false;
20
- function checkCustomerDataLimit(initialBytesCount) {
21
- if (initialBytesCount === void 0) { initialBytesCount = 0; }
22
- if (alreadyWarned || compressionStatus === 0 /* CustomerDataCompressionStatus.Unknown */) {
23
- return;
24
- }
25
- var bytesCountLimit = compressionStatus === 2 /* CustomerDataCompressionStatus.Disabled */
26
- ? CUSTOMER_DATA_BYTES_LIMIT
27
- : CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT;
28
- var bytesCount = initialBytesCount;
29
- customerDataTrackers.forEach(function (tracker) {
30
- bytesCount += tracker.getBytesCount();
31
- });
32
- if (bytesCount > bytesCountLimit) {
33
- displayCustomerDataLimitReachedWarning(bytesCountLimit);
34
- alreadyWarned = true;
35
- }
36
- }
37
- return {
38
- /**
39
- * Creates a detached tracker. The manager will not store a reference to that tracker, and the
40
- * bytes count will be counted independently from other detached trackers.
41
- *
42
- * This is particularly useful when we don't know when the tracker will be unused, so we don't
43
- * leak memory (ex: when used in Logger instances).
44
- */
45
- createDetachedTracker: function () {
46
- var tracker = createCustomerDataTracker(function () { return checkCustomerDataLimit(tracker.getBytesCount()); });
47
- return tracker;
48
- },
49
- /**
50
- * Creates a tracker if it doesn't exist, and returns it.
51
- */
52
- getOrCreateTracker: function (type) {
53
- if (!customerDataTrackers.has(type)) {
54
- customerDataTrackers.set(type, createCustomerDataTracker(checkCustomerDataLimit));
55
- }
56
- return customerDataTrackers.get(type);
57
- },
58
- setCompressionStatus: function (newCompressionStatus) {
59
- if (compressionStatus === 0 /* CustomerDataCompressionStatus.Unknown */) {
60
- compressionStatus = newCompressionStatus;
61
- checkCustomerDataLimit();
62
- }
63
- },
64
- getCompressionStatus: function () { return compressionStatus; },
65
- stop: function () {
66
- customerDataTrackers.forEach(function (tracker) { return tracker.stop(); });
67
- customerDataTrackers.clear();
68
- },
69
- };
70
- }
71
- export function createCustomerDataTracker(checkCustomerDataLimit) {
72
- var bytesCountCache = 0;
73
- // Throttle the bytes computation to minimize the impact on performance.
74
- // Especially useful if the user call context APIs synchronously multiple times in a row
75
- var _a = throttle(function (context) {
76
- bytesCountCache = computeBytesCount(jsonStringify(context));
77
- checkCustomerDataLimit();
78
- }, BYTES_COMPUTATION_THROTTLING_DELAY), computeBytesCountThrottled = _a.throttled, cancelComputeBytesCount = _a.cancel;
79
- var resetBytesCount = function () {
80
- cancelComputeBytesCount();
81
- bytesCountCache = 0;
82
- };
83
- return {
84
- updateCustomerData: function (context) {
85
- if (isEmptyObject(context)) {
86
- resetBytesCount();
87
- }
88
- else {
89
- computeBytesCountThrottled(context);
90
- }
91
- },
92
- resetCustomerData: resetBytesCount,
93
- getBytesCount: function () { return bytesCountCache; },
94
- stop: function () {
95
- cancelComputeBytesCount();
96
- },
97
- };
98
- }
99
- function displayCustomerDataLimitReachedWarning(bytesCountLimit) {
100
- display.warn("Customer data exceeds the recommended ".concat(bytesCountLimit / ONE_KIBI_BYTE, "KiB threshold. More details: https://docs.datadoghq.com/real_user_monitoring/browser/troubleshooting/#customer-data-exceeds-the-recommended-threshold-warning"));
101
- }
102
- //# sourceMappingURL=customerDataTracker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customerDataTracker.js","sourceRoot":"","sources":["../../../src/domain/context/customerDataTracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAG7D,yCAAyC;AACzC,uGAAuG;AACvG,+EAA+E;AAC/E,MAAM,CAAC,IAAM,yBAAyB,GAAG,CAAC,GAAG,aAAa,CAAA;AAE1D,mGAAmG;AACnG,gGAAgG;AAChG,oGAAoG;AACpG,sBAAsB;AACtB,MAAM,CAAC,IAAM,oCAAoC,GAAG,EAAE,GAAG,aAAa,CAAA;AAEtE,MAAM,CAAC,IAAM,kCAAkC,GAAG,GAAG,CAAA;AAWrD,MAAM,UAAU,gCAAgC,CAC9C,iBAAyF;IAAzF,kCAAA,EAAA,kEAAyF;IAEzF,IAAM,oBAAoB,GAAG,IAAI,GAAG,EAAyC,CAAA;IAE7E,IAAI,aAAa,GAAG,KAAK,CAAA;IACzB,SAAS,sBAAsB,CAAC,iBAAqB;QAArB,kCAAA,EAAA,qBAAqB;QACnD,IAAI,aAAa,IAAI,iBAAiB,kDAA0C,EAAE,CA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AC,CAAA;YACzD,oBAAoB,CAAC,KAAK,EAAE,CAAA;QAC9B,CAAC;KACF,CAAA;AACH,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,sBAAkC;IAC1E,IAAI,eAAe,GAAG,CAAC,CAAA;IAEvB,wEAAwE;IACxE,wFAAwF;IAClF,IAAA,KAA6E,QAAQ,CAAC,UAAC,OAAgB;QAC3G,eAAe,GAAG,iBAAiB,CAAC,aAAa,CAAC,OAAO,CAAE,CAAC,CAAA;QAC5D,sBAAsB,EAAE,CAAA;IAC1B,CAAC,EAAE,kCAAkC,CAAC,EAHnB,0BAA0B,eAAA,EAAU,uBAAuB,YAGxC,CAAA;IAEtC,IAAM,eAAe,GAAG;QACtB,uBAAuB,EAAE,CAAA;QACzB,eAAe,GAAG,CAAC,CAAA;IACrB,CAAC,CAAA;IAED,OAAO;QACL,kBAAkB,EAAE,UAAC,OAAgB;YACnC,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC3B,eAAe,EAAE,CAAA;YACnB,CAAC;iBAAM,CAAC;gBACN,0BAA0B,CAAC,OAAO,CAAC,CAAA;YACrC,CAAC;QACH,CAAC;QACD,iBAAiB,EAAE,eAAe;QAClC,aAAa,EAAE,cAAM,OAAA,eAAe,EAAf,CAAe;QACpC,IAAI,EAAE;YACJ,uBAAuB,EAAE,CAAA;QAC3B,CAAC;KACF,CAAA;AACH,CAAC;AAED,SAAS,sCAAsC,CAAC,eAAuB;IACrE,OAAO,CAAC,IAAI,CACV,gDACE,eAAe,GAAG,aAAa,kKAC8H,CAChK,CAAA;AACH,CAAC"}
@@ -1,6 +0,0 @@
1
- import type { Configuration } from '../configuration';
2
- import type { ContextManager } from './contextManager';
3
- import type { CustomerDataType } from './contextConstants';
4
- export declare function storeContextManager(configuration: Configuration, contextManager: ContextManager, productKey: string, customerDataType: CustomerDataType): void;
5
- export declare function buildStorageKey(productKey: string, customerDataType: CustomerDataType): string;
6
- export declare function removeStorageListeners(): void;
@@ -1,32 +0,0 @@
1
- import { addEventListener, DOM_EVENT } from '../../browser/addEventListener';
2
- import { combine } from '../../tools/mergeInto';
3
- var CONTEXT_STORE_KEY_PREFIX = '_oo_c';
4
- var storageListeners = [];
5
- export function storeContextManager(configuration, contextManager, productKey, customerDataType) {
6
- var storageKey = buildStorageKey(productKey, customerDataType);
7
- storageListeners.push(addEventListener(configuration, window, DOM_EVENT.STORAGE, function (_a) {
8
- var key = _a.key;
9
- if (storageKey === key) {
10
- synchronizeWithStorage();
11
- }
12
- }));
13
- contextManager.changeObservable.subscribe(dumpToStorage);
14
- contextManager.setContext(combine(getFromStorage(), contextManager.getContext()));
15
- function synchronizeWithStorage() {
16
- contextManager.setContext(getFromStorage());
17
- }
18
- function dumpToStorage() {
19
- localStorage.setItem(storageKey, JSON.stringify(contextManager.getContext()));
20
- }
21
- function getFromStorage() {
22
- var rawContext = localStorage.getItem(storageKey);
23
- return rawContext !== null ? JSON.parse(rawContext) : {};
24
- }
25
- }
26
- export function buildStorageKey(productKey, customerDataType) {
27
- return "".concat(CONTEXT_STORE_KEY_PREFIX, "_").concat(productKey, "_").concat(customerDataType);
28
- }
29
- export function removeStorageListeners() {
30
- storageListeners.map(function (listener) { return listener.stop(); });
31
- }
32
- //# sourceMappingURL=storeContextManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storeContextManager.js","sourceRoot":"","sources":["../../../src/domain/context/storeContextManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAG5E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAI/C,IAAM,wBAAwB,GAAG,OAAO,CAAA;AAExC,IAAM,gBAAgB,GAAgC,EAAE,CAAA;AAExD,MAAM,UAAU,mBAAmB,CACjC,aAA4B,EAC5B,cAA8B,EAC9B,UAAkB,EAClB,gBAAkC;IAElC,IAAM,UAAU,GAAG,eAAe,CAAC,UAAU,EAAE,gBAAgB,CAA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