@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
@@ -2,24 +2,21 @@ import { display } from '../tools/display'
2
2
  import type { Context } from '../tools/serialisation/context'
3
3
  import { objectValues } from '../tools/utils/polyfills'
4
4
  import { isPageExitReason } from '../browser/pageExitObservable'
5
- import { jsonStringify } from '../tools/serialisation/jsonStringify'
6
- import type { Subscription } from '../tools/observable'
7
- import type { Encoder, EncoderResult } from '../tools/encoder'
8
5
  import { computeBytesCount } from '../tools/utils/byteUtils'
9
- import type { HttpRequest, Payload } from './httpRequest'
6
+ import { jsonStringify } from '../tools/serialisation/jsonStringify'
7
+ import type { HttpRequest } from './httpRequest'
10
8
  import type { FlushController, FlushEvent } from './flushController'
11
9
 
12
10
  export class Batch {
11
+ private pushOnlyBuffer: string[] = []
13
12
  private upsertBuffer: { [key: string]: string } = {}
14
- private flushSubscription: Subscription
15
13
 
16
14
  constructor(
17
- private encoder: Encoder,
18
15
  private request: HttpRequest,
19
16
  public flushController: FlushController,
20
17
  private messageBytesLimit: number
21
18
  ) {
22
- this.flushSubscription = this.flushController.flushObservable.subscribe((event) => this.flush(event))
19
+ this.flushController.flushObservable.subscribe((event) => this.flush(event))
23
20
  }
24
21
 
25
22
  add(message: Context) {
@@ -30,57 +27,24 @@ export class Batch {
30
27
  this.addOrUpdate(message, key)
31
28
  }
32
29
 
33
- stop() {
34
- this.flushSubscription.unsubscribe()
35
- }
36
-
37
30
  private flush(event: FlushEvent) {
38
- const upsertMessages = objectValues(this.upsertBuffer).join('\n')
31
+ const messages = this.pushOnlyBuffer.concat(objectValues(this.upsertBuffer))
32
+
33
+ this.pushOnlyBuffer = []
39
34
  this.upsertBuffer = {}
40
35
 
41
- const isPageExit = isPageExitReason(event.reason)
42
- const send = isPageExit ? this.request.sendOnExit : this.request.send
43
-
44
- if (
45
- isPageExit &&
46
- // Note: checking that the encoder is async is not strictly needed, but it's an optimization:
47
- // if the encoder is async we need to send two requests in some cases (one for encoded data
48
- // and the other for non-encoded data). But if it's not async, we don't have to worry about
49
- // it and always send a single request.
50
- this.encoder.isAsync
51
- ) {
52
- const encoderResult = this.encoder.finishSync()
53
-
54
- // Send encoded messages
55
- if (encoderResult.outputBytesCount) {
56
- send(formatPayloadFromEncoder(encoderResult, event))
57
- }
58
-
59
- // Send messages that are not yet encoded at this point
60
- const pendingMessages = [encoderResult.pendingData, upsertMessages].filter(Boolean).join('\n')
61
- if (pendingMessages) {
62
- send({
63
- data: pendingMessages,
64
- bytesCount: computeBytesCount(pendingMessages),
65
- flushReason: event.reason,
66
- })
67
- }
36
+ const payload = { data: messages.join('\n'), bytesCount: event.bytesCount, flushReason: event.reason }
37
+ if (isPageExitReason(event.reason)) {
38
+ this.request.sendOnExit(payload)
68
39
  } else {
69
- if (upsertMessages) {
70
- this.encoder.write(this.encoder.isEmpty ? upsertMessages : `\n${upsertMessages}`)
71
- }
72
- this.encoder.finish((encoderResult) => {
73
- send(formatPayloadFromEncoder(encoderResult, event))
74
- })
40
+ this.request.send(payload)
75
41
  }
76
42
  }
77
43
 
78
44
  private addOrUpdate(message: Context, key?: string) {
79
- const serializedMessage = jsonStringify(message)!
80
-
81
- const estimatedMessageBytesCount = this.encoder.estimateEncodedBytesCount(serializedMessage)
45
+ const { processedMessage, messageBytesCount } = this.process(message)
82
46
 
83
- if (estimatedMessageBytesCount >= this.messageBytesLimit) {
47
+ if (messageBytesCount >= this.messageBytesLimit) {
84
48
  display.warn(
85
49
  `Discarded a message whose size was bigger than the maximum allowed size ${this.messageBytesLimit}KB.`
86
50
  )
@@ -91,57 +55,38 @@ export class Batch {
91
55
  this.remove(key)
92
56
  }
93
57
 
94
- this.push(serializedMessage, estimatedMessageBytesCount, key)
58
+ this.push(processedMessage, messageBytesCount, key)
59
+ }
60
+
61
+ private process(message: Context) {
62
+ const processedMessage = jsonStringify(message)!
63
+ const messageBytesCount = computeBytesCount(processedMessage)
64
+ return { processedMessage, messageBytesCount }
95
65
  }
96
66
 
97
- private push(serializedMessage: string, estimatedMessageBytesCount: number, key?: string) {
98
- this.flushController.notifyBeforeAddMessage(estimatedMessageBytesCount)
67
+ private push(processedMessage: string, messageBytesCount: number, key?: string) {
68
+ // If there are other messages, a '\n' will be added at serialization
69
+ const separatorBytesCount = this.flushController.messagesCount > 0 ? 1 : 0
99
70
 
71
+ this.flushController.notifyBeforeAddMessage(messageBytesCount + separatorBytesCount)
100
72
  if (key !== undefined) {
101
- this.upsertBuffer[key] = serializedMessage
102
- this.flushController.notifyAfterAddMessage()
73
+ this.upsertBuffer[key] = processedMessage
103
74
  } else {
104
- this.encoder.write(
105
- this.encoder.isEmpty ? serializedMessage : `\n${serializedMessage}`,
106
- (realMessageBytesCount) => {
107
- this.flushController.notifyAfterAddMessage(realMessageBytesCount - estimatedMessageBytesCount)
108
- }
109
- )
75
+ this.pushOnlyBuffer.push(processedMessage)
110
76
  }
77
+ this.flushController.notifyAfterAddMessage()
111
78
  }
112
79
 
113
80
  private remove(key: string) {
114
81
  const removedMessage = this.upsertBuffer[key]
115
82
  delete this.upsertBuffer[key]
116
- const messageBytesCount = this.encoder.estimateEncodedBytesCount(removedMessage)
117
- this.flushController.notifyAfterRemoveMessage(messageBytesCount)
83
+ const messageBytesCount = computeBytesCount(removedMessage)
84
+ // If there are other messages, a '\n' will be added at serialization
85
+ const separatorBytesCount = this.flushController.messagesCount > 1 ? 1 : 0
86
+ this.flushController.notifyAfterRemoveMessage(messageBytesCount + separatorBytesCount)
118
87
  }
119
88
 
120
89
  private hasMessageFor(key?: string): key is string {
121
90
  return key !== undefined && this.upsertBuffer[key] !== undefined
122
91
  }
123
92
  }
124
-
125
- function formatPayloadFromEncoder(encoderResult: EncoderResult, flushEvent: FlushEvent): Payload {
126
- let data: string | Blob
127
- if (typeof encoderResult.output === 'string') {
128
- data = encoderResult.output
129
- } else {
130
- data = new Blob([encoderResult.output], {
131
- // This will set the 'Content-Type: text/plain' header. Reasoning:
132
- // * The intake rejects the request if there is no content type.
133
- // * The browser will issue CORS preflight requests if we set it to 'application/json', which
134
- // could induce higher intake load (and maybe has other impacts).
135
- // * Also it's not quite JSON, since we are concatenating multiple JSON objects separated by
136
- // new lines.
137
- type: 'text/plain',
138
- })
139
- }
140
-
141
- return {
142
- data,
143
- bytesCount: encoderResult.outputBytesCount,
144
- encoding: encoderResult.encoding,
145
- flushReason: flushEvent.reason,
146
- }
147
- }
@@ -33,13 +33,10 @@ export function createFlushController({
33
33
  pageExitObservable,
34
34
  sessionExpireObservable,
35
35
  }: FlushControllerOptions) {
36
- const pageExitSubscription = pageExitObservable.subscribe((event) => flush(event.reason))
37
- const sessionExpireSubscription = sessionExpireObservable.subscribe(() => flush('session_expire'))
36
+ const flushObservable = new Observable<FlushEvent>()
38
37
 
39
- const flushObservable = new Observable<FlushEvent>(() => () => {
40
- pageExitSubscription.unsubscribe()
41
- sessionExpireSubscription.unsubscribe()
42
- })
38
+ pageExitObservable.subscribe((event) => flush(event.reason))
39
+ sessionExpireObservable.subscribe(() => flush('session_expire'))
43
40
 
44
41
  let currentBytesCount = 0
45
42
  let currentMessagesCount = 0
@@ -88,19 +85,16 @@ export function createFlushController({
88
85
  *
89
86
  * This function needs to be called synchronously, right before adding the message, so no flush
90
87
  * event can happen after `notifyBeforeAddMessage` and before adding the message.
91
- *
92
- * @param estimatedMessageBytesCount: an estimation of the message bytes count once it is
93
- * actually added.
94
88
  */
95
- notifyBeforeAddMessage(estimatedMessageBytesCount: number) {
96
- if (currentBytesCount + estimatedMessageBytesCount >= bytesLimit) {
89
+ notifyBeforeAddMessage(messageBytesCount: number) {
90
+ if (currentBytesCount + messageBytesCount >= bytesLimit) {
97
91
  flush('bytes_limit')
98
92
  }
99
93
  // Consider the message to be added now rather than in `notifyAfterAddMessage`, because if no
100
94
  // message was added yet and `notifyAfterAddMessage` is called asynchronously, we still want
101
95
  // to notify when a flush is needed (for example on page exit).
102
96
  currentMessagesCount += 1
103
- currentBytesCount += estimatedMessageBytesCount
97
+ currentBytesCount += messageBytesCount
104
98
  scheduleDurationLimitTimeout()
105
99
  },
106
100
 
@@ -109,13 +103,8 @@ export function createFlushController({
109
103
  *
110
104
  * This function can be called asynchronously after the message was added, but in this case it
111
105
  * should not be called if a flush event occurred in between.
112
- *
113
- * @param messageBytesCountDiff: the difference between the estimated message bytes count and
114
- * its actual bytes count once added to the pool.
115
106
  */
116
- notifyAfterAddMessage(messageBytesCountDiff = 0) {
117
- currentBytesCount += messageBytesCountDiff
118
-
107
+ notifyAfterAddMessage() {
119
108
  if (currentMessagesCount >= messagesLimit) {
120
109
  flush('messages_limit')
121
110
  } else if (currentBytesCount >= bytesLimit) {
@@ -128,10 +117,6 @@ export function createFlushController({
128
117
  *
129
118
  * This function needs to be called synchronously, right after removing the message, so no flush
130
119
  * event can happen after removing the message and before `notifyAfterRemoveMessage`.
131
- *
132
- * @param messageBytesCount: the message bytes count that was added to the pool. Should
133
- * correspond to the sum of bytes counts passed to `notifyBeforeAddMessage` and
134
- * `notifyAfterAddMessage`.
135
120
  */
136
121
  notifyAfterRemoveMessage(messageBytesCount: number) {
137
122
  currentBytesCount -= messageBytesCount
@@ -24,11 +24,10 @@ export interface HttpResponse extends Context {
24
24
  }
25
25
 
26
26
  export interface Payload {
27
- data: string | FormData | Blob
27
+ data: string | FormData
28
28
  bytesCount: number
29
29
  retry?: RetryInfo
30
30
  flushReason?: FlushReason
31
- encoding?: 'deflate'
32
31
  }
33
32
 
34
33
  export interface RetryInfo {
@@ -48,7 +47,7 @@ export function createHttpRequest(
48
47
 
49
48
  return {
50
49
  send: (payload: Payload) => {
51
- sendWithRetryStrategy(payload, retryState, sendStrategyForRetry, endpointBuilder.trackType, reportError)
50
+ sendWithRetryStrategy(payload, retryState, sendStrategyForRetry, endpointBuilder.endpointType, reportError)
52
51
  },
53
52
  /**
54
53
  * Since fetch keepalive behaves like regular fetch on Firefox,
@@ -64,13 +63,13 @@ function sendBeaconStrategy(
64
63
  configuration: Configuration,
65
64
  endpointBuilder: EndpointBuilder,
66
65
  bytesLimit: number,
67
- payload: Payload
66
+ { data, bytesCount, flushReason }: Payload
68
67
  ) {
69
- const canUseBeacon = !!navigator.sendBeacon && payload.bytesCount < bytesLimit
68
+ const canUseBeacon = !!navigator.sendBeacon && bytesCount < bytesLimit
70
69
  if (canUseBeacon) {
71
70
  try {
72
- const beaconUrl = endpointBuilder.build('beacon', payload)
73
- const isQueued = navigator.sendBeacon(beaconUrl, payload.data)
71
+ const beaconUrl = endpointBuilder.build('beacon', flushReason)
72
+ const isQueued = navigator.sendBeacon(beaconUrl, data)
74
73
 
75
74
  if (isQueued) {
76
75
  return
@@ -80,8 +79,8 @@ function sendBeaconStrategy(
80
79
  }
81
80
  }
82
81
 
83
- const xhrUrl = endpointBuilder.build('xhr', payload)
84
- sendXHR(configuration, xhrUrl, payload.data)
82
+ const xhrUrl = endpointBuilder.build('xhr', flushReason)
83
+ sendXHR(configuration, xhrUrl, data)
85
84
  }
86
85
 
87
86
  let hasReportedBeaconError = false
@@ -97,23 +96,23 @@ export function fetchKeepAliveStrategy(
97
96
  configuration: Configuration,
98
97
  endpointBuilder: EndpointBuilder,
99
98
  bytesLimit: number,
100
- payload: Payload,
99
+ { data, bytesCount, flushReason, retry }: Payload,
101
100
  onResponse?: (r: HttpResponse) => void
102
101
  ) {
103
- const canUseKeepAlive = isKeepAliveSupported() && payload.bytesCount < bytesLimit
102
+ const canUseKeepAlive = isKeepAliveSupported() && bytesCount < bytesLimit
104
103
  if (canUseKeepAlive) {
105
- const fetchUrl = endpointBuilder.build('fetch', payload)
106
- fetch(fetchUrl, { method: 'POST', body: payload.data, keepalive: true, mode: 'cors' }).then(
104
+ const fetchUrl = endpointBuilder.build('fetch', flushReason, retry)
105
+ fetch(fetchUrl, { method: 'POST', body: data, keepalive: true, mode: 'cors' }).then(
107
106
  monitor((response: Response) => onResponse?.({ status: response.status, type: response.type })),
108
107
  monitor(() => {
109
- const xhrUrl = endpointBuilder.build('xhr', payload)
108
+ const xhrUrl = endpointBuilder.build('xhr', flushReason, retry)
110
109
  // failed to queue the request
111
- sendXHR(configuration, xhrUrl, payload.data, onResponse)
110
+ sendXHR(configuration, xhrUrl, data, onResponse)
112
111
  })
113
112
  )
114
113
  } else {
115
- const xhrUrl = endpointBuilder.build('xhr', payload)
116
- sendXHR(configuration, xhrUrl, payload.data, onResponse)
114
+ const xhrUrl = endpointBuilder.build('xhr', flushReason, retry)
115
+ sendXHR(configuration, xhrUrl, data, onResponse)
117
116
  }
118
117
  }
119
118
 
@@ -134,12 +133,6 @@ export function sendXHR(
134
133
  ) {
135
134
  const request = new XMLHttpRequest()
136
135
  request.open('POST', url, true)
137
- if (data instanceof Blob) {
138
- // When using a Blob instance, IE does not use its 'type' to define the 'Content-Type' header
139
- // automatically, so the intake request ends up being rejected with an HTTP status 415
140
- // Defining the header manually fixes this issue.
141
- request.setRequestHeader('Content-Type', data.type)
142
- }
143
136
  addEventListener(
144
137
  configuration,
145
138
  request,
@@ -1,4 +1,4 @@
1
- import type { TrackType } from '../domain/configuration'
1
+ import type { EndpointType } from '../domain/configuration'
2
2
  import { setTimeout } from '../tools/timer'
3
3
  import { clocksNow, ONE_MINUTE, ONE_SECOND } from '../tools/utils/timeUtils'
4
4
  import { ONE_MEBI_BYTE, ONE_KIBI_BYTE } from '../tools/utils/byteUtils'
@@ -38,7 +38,7 @@ export function sendWithRetryStrategy(
38
38
  payload: Payload,
39
39
  state: RetryState,
40
40
  sendStrategy: SendStrategy,
41
- trackType: TrackType,
41
+ endpointType: EndpointType,
42
42
  reportError: (error: RawError) => void
43
43
  ) {
44
44
  if (
@@ -47,10 +47,10 @@ export function sendWithRetryStrategy(
47
47
  state.bandwidthMonitor.canHandle(payload)
48
48
  ) {
49
49
  send(payload, state, sendStrategy, {
50
- onSuccess: () => retryQueuedPayloads(RetryReason.AFTER_SUCCESS, state, sendStrategy, trackType, reportError),
50
+ onSuccess: () => retryQueuedPayloads(RetryReason.AFTER_SUCCESS, state, sendStrategy, endpointType, reportError),
51
51
  onFailure: () => {
52
52
  state.queuedPayloads.enqueue(payload)
53
- scheduleRetry(state, sendStrategy, trackType, reportError)
53
+ scheduleRetry(state, sendStrategy, endpointType, reportError)
54
54
  },
55
55
  })
56
56
  } else {
@@ -61,7 +61,7 @@ export function sendWithRetryStrategy(
61
61
  function scheduleRetry(
62
62
  state: RetryState,
63
63
  sendStrategy: SendStrategy,
64
- trackType: TrackType,
64
+ endpointType: EndpointType,
65
65
  reportError: (error: RawError) => void
66
66
  ) {
67
67
  if (state.transportStatus !== TransportStatus.DOWN) {
@@ -73,11 +73,11 @@ function scheduleRetry(
73
73
  onSuccess: () => {
74
74
  state.queuedPayloads.dequeue()
75
75
  state.currentBackoffTime = INITIAL_BACKOFF_TIME
76
- retryQueuedPayloads(RetryReason.AFTER_RESUME, state, sendStrategy, trackType, reportError)
76
+ retryQueuedPayloads(RetryReason.AFTER_RESUME, state, sendStrategy, endpointType, reportError)
77
77
  },
78
78
  onFailure: () => {
79
79
  state.currentBackoffTime = Math.min(MAX_BACKOFF_TIME, state.currentBackoffTime * 2)
80
- scheduleRetry(state, sendStrategy, trackType, reportError)
80
+ scheduleRetry(state, sendStrategy, endpointType, reportError)
81
81
  },
82
82
  })
83
83
  }, state.currentBackoffTime)
@@ -112,12 +112,12 @@ function retryQueuedPayloads(
112
112
  reason: RetryReason,
113
113
  state: RetryState,
114
114
  sendStrategy: SendStrategy,
115
- trackType: TrackType,
115
+ endpointType: EndpointType,
116
116
  reportError: (error: RawError) => void
117
117
  ) {
118
118
  if (reason === RetryReason.AFTER_SUCCESS && state.queuedPayloads.isFull() && !state.queueFullReported) {
119
119
  reportError({
120
- message: `Reached max ${trackType} events size queued for upload: ${MAX_QUEUE_BYTES_COUNT / ONE_MEBI_BYTE}MiB`,
120
+ message: `Reached max ${endpointType} events size queued for upload: ${MAX_QUEUE_BYTES_COUNT / ONE_MEBI_BYTE}MiB`,
121
121
  source: ErrorSource.AGENT,
122
122
  startClocks: clocksNow(),
123
123
  })
@@ -126,7 +126,7 @@ function retryQueuedPayloads(
126
126
  const previousQueue = state.queuedPayloads
127
127
  state.queuedPayloads = newPayloadQueue()
128
128
  while (previousQueue.size() > 0) {
129
- sendWithRetryStrategy(previousQueue.dequeue()!, state, sendStrategy, trackType, reportError)
129
+ sendWithRetryStrategy(previousQueue.dequeue()!, state, sendStrategy, endpointType, reportError)
130
130
  }
131
131
  }
132
132
 
@@ -3,35 +3,24 @@ import type { Context } from '../tools/serialisation/context'
3
3
  import type { Observable } from '../tools/observable'
4
4
  import type { PageExitEvent } from '../browser/pageExitObservable'
5
5
  import type { RawError } from '../domain/error/error.types'
6
- import type { Encoder } from '../tools/encoder'
7
6
  import { Batch } from './batch'
8
7
  import { createHttpRequest } from './httpRequest'
9
8
  import { createFlushController } from './flushController'
10
9
 
11
- export interface BatchConfiguration {
12
- endpoint: EndpointBuilder
13
- encoder: Encoder
14
- }
15
-
16
- interface ReplicaBatchConfiguration<T> extends BatchConfiguration {
17
- transformMessage?: (message: T) => T
18
- }
19
-
20
10
  export function startBatchWithReplica<T extends Context>(
21
11
  configuration: Configuration,
22
- primary: BatchConfiguration,
23
- replica: ReplicaBatchConfiguration<T> | undefined,
12
+ primary: { endpoint: EndpointBuilder },
13
+ replica: { endpoint: EndpointBuilder; transformMessage?: (message: T) => T } | undefined,
24
14
  reportError: (error: RawError) => void,
25
15
  pageExitObservable: Observable<PageExitEvent>,
26
16
  sessionExpireObservable: Observable<void>
27
17
  ) {
28
- const primaryBatch = createBatch(configuration, primary)
29
- const replicaBatch = replica && createBatch(configuration, replica)
18
+ const primaryBatch = createBatch(configuration, primary.endpoint)
19
+ const replicaBatch = replica && createBatch(configuration, replica.endpoint)
30
20
 
31
- function createBatch(configuration: Configuration, { endpoint, encoder }: BatchConfiguration) {
21
+ function createBatch(configuration: Configuration, endpointBuilder: EndpointBuilder) {
32
22
  return new Batch(
33
- encoder,
34
- createHttpRequest(configuration, endpoint, configuration.batchBytesLimit, reportError),
23
+ createHttpRequest(configuration, endpointBuilder, configuration.batchBytesLimit, reportError),
35
24
  createFlushController({
36
25
  messagesLimit: configuration.batchMessagesLimit,
37
26
  bytesLimit: configuration.batchBytesLimit,
@@ -59,10 +48,5 @@ export function startBatchWithReplica<T extends Context>(
59
48
  replicaBatch.upsert(replica.transformMessage ? replica.transformMessage(message) : message, key)
60
49
  }
61
50
  },
62
-
63
- stop: () => {
64
- primaryBatch.stop()
65
- replicaBatch?.stop()
66
- },
67
51
  }
68
52
  }
@@ -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,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getConnectivity = void 0;
4
- function getConnectivity() {
5
- var _a;
6
- var navigator = window.navigator;
7
- return {
8
- status: navigator.onLine ? 'connected' : 'not_connected',
9
- interfaces: navigator.connection && navigator.connection.type ? [navigator.connection.type] : undefined,
10
- effective_type: (_a = navigator.connection) === null || _a === void 0 ? void 0 : _a.effectiveType,
11
- };
12
- }
13
- exports.getConnectivity = getConnectivity;
14
- //# sourceMappingURL=connectivity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connectivity.js","sourceRoot":"","sources":["../../../src/domain/connectivity/connectivity.ts"],"names":[],"mappings":";;;AAmBA,SAAgB,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;AAPD,0CAOC"}
@@ -1 +0,0 @@
1
- export * from './connectivity';
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/connectivity/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B"}
@@ -1,5 +0,0 @@
1
- export declare const enum CustomerDataType {
2
- FeatureFlag = 0,
3
- User = 1,
4
- GlobalContext = 2
5
- }
@@ -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,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createContextManager = void 0;
4
- var mergeInto_1 = require("../../tools/mergeInto");
5
- var typeUtils_1 = require("../../tools/utils/typeUtils");
6
- var sanitize_1 = require("../../tools/serialisation/sanitize");
7
- var observable_1 = require("../../tools/observable");
8
- function createContextManager(customerDataTracker) {
9
- var context = {};
10
- var changeObservable = new observable_1.Observable();
11
- var contextManager = {
12
- getContext: function () { return (0, mergeInto_1.deepClone)(context); },
13
- setContext: function (newContext) {
14
- if ((0, typeUtils_1.getType)(newContext) === 'object') {
15
- context = (0, sanitize_1.sanitize)(newContext);
16
- customerDataTracker.updateCustomerData(context);
17
- }
18
- else {
19
- contextManager.clearContext();
20
- }
21
- changeObservable.notify();
22
- },
23
- setContextProperty: function (key, property) {
24
- context[key] = (0, sanitize_1.sanitize)(property);
25
- customerDataTracker.updateCustomerData(context);
26
- changeObservable.notify();
27
- },
28
- removeContextProperty: function (key) {
29
- delete context[key];
30
- customerDataTracker.updateCustomerData(context);
31
- changeObservable.notify();
32
- },
33
- clearContext: function () {
34
- context = {};
35
- customerDataTracker.resetCustomerData();
36
- changeObservable.notify();
37
- },
38
- changeObservable: changeObservable,
39
- };
40
- return contextManager;
41
- }
42
- exports.createContextManager = createContextManager;
43
- //# sourceMappingURL=contextManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contextManager.js","sourceRoot":"","sources":["../../../src/domain/context/contextManager.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AACjD,yDAAqD;AACrD,+DAA6D;AAE7D,qDAAmD;AAKnD,SAAgB,oBAAoB,CAAC,mBAAwC;IAC3E,IAAI,OAAO,GAAY,EAAE,CAAA;IACzB,IAAM,gBAAgB,GAAG,IAAI,uBAAU,EAAQ,CAAA;IAE/C,IAAM,cAAc,GAAG;QACrB,UAAU,EAAE,cAAM,OAAA,IAAA,qBAAS,EAAC,OAAO,CAAC,EAAlB,CAAkB;QAEpC,UAAU,EAAE,UAAC,UAAmB;YAC9B,IAAI,IAAA,mBAAO,EAAC,UAAU,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACrC,OAAO,GAAG,IAAA,mBAAQ,EAAC,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,IAAA,mBAAQ,EAAC,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;AAtCD,oDAsCC"}
@@ -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
- };