@utk09/ui-observability 0.11.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (557) hide show
  1. package/CHANGELOG.md +481 -0
  2. package/README.md +73 -669
  3. package/bin/uiobs.mjs +1 -1
  4. package/dist/{batch-CL9uWYY3.js → batch-CXmPmTse.js} +3 -3
  5. package/dist/batch-CXmPmTse.js.map +1 -0
  6. package/dist/{batch-C8OcWR2L.cjs → batch-mmPigCpi.cjs} +2 -2
  7. package/dist/batch-mmPigCpi.cjs.map +1 -0
  8. package/dist/bus/bus.d.cts +331 -0
  9. package/dist/bus/bus.d.ts +108 -57
  10. package/dist/bus/links.d.cts +132 -0
  11. package/dist/bus/links.d.ts +22 -7
  12. package/dist/bus/validation.d.cts +16 -0
  13. package/dist/bus/validation.d.ts +11 -2
  14. package/dist/bus-C39wspFV.js +775 -0
  15. package/dist/bus-C39wspFV.js.map +1 -0
  16. package/dist/bus-_EaOVPGq.cjs +2 -0
  17. package/dist/bus-_EaOVPGq.cjs.map +1 -0
  18. package/dist/capture/console.d.cts +37 -0
  19. package/dist/capture/console.d.ts +11 -11
  20. package/dist/capture/errors.d.cts +32 -0
  21. package/dist/capture/errors.d.ts +7 -7
  22. package/dist/capture/interactions.d.cts +48 -0
  23. package/dist/capture/interactions.d.ts +15 -15
  24. package/dist/capture/lifecycle.d.cts +20 -0
  25. package/dist/capture/lifecycle.d.ts +4 -4
  26. package/dist/capture/long-frames.d.cts +31 -0
  27. package/dist/capture/long-frames.d.ts +7 -7
  28. package/dist/capture/network.d.cts +57 -0
  29. package/dist/capture/network.d.ts +18 -18
  30. package/dist/capture/profiler-frames.d.cts +44 -0
  31. package/dist/capture/profiler-frames.d.ts +44 -0
  32. package/dist/capture/replay-buffer.d.cts +45 -0
  33. package/dist/capture/replay-buffer.d.ts +45 -0
  34. package/dist/capture/replay-upload.d.cts +79 -0
  35. package/dist/capture/replay-upload.d.ts +79 -0
  36. package/dist/capture/replay.d.cts +114 -0
  37. package/dist/capture/replay.d.ts +114 -0
  38. package/dist/capture/reports.d.cts +17 -0
  39. package/dist/capture/reports.d.ts +3 -3
  40. package/dist/capture/resource-timing.d.cts +14 -0
  41. package/dist/capture/resource-timing.d.ts +2 -2
  42. package/dist/capture/server-timing.d.cts +19 -0
  43. package/dist/capture/server-timing.d.ts +3 -3
  44. package/dist/capture/storm.d.cts +13 -0
  45. package/dist/capture/storm.d.ts +7 -7
  46. package/dist/capture/types.d.cts +128 -0
  47. package/dist/capture/types.d.ts +54 -41
  48. package/dist/capture/unclean-exit.d.cts +31 -0
  49. package/dist/capture/unclean-exit.d.ts +9 -9
  50. package/dist/capture/user-timing.d.cts +22 -0
  51. package/dist/capture/user-timing.d.ts +4 -4
  52. package/dist/capture/web-socket.d.cts +40 -0
  53. package/dist/capture/web-socket.d.ts +14 -14
  54. package/dist/capture/web-vitals.d.cts +40 -0
  55. package/dist/capture/web-vitals.d.ts +21 -8
  56. package/dist/compression-CvED_Jel.cjs +2 -0
  57. package/dist/compression-CvED_Jel.cjs.map +1 -0
  58. package/dist/compression-tVtXwVjX.js +11 -0
  59. package/dist/compression-tVtXwVjX.js.map +1 -0
  60. package/dist/config-DUs7uHHt.cjs +2 -0
  61. package/dist/config-DUs7uHHt.cjs.map +1 -0
  62. package/dist/config-SgQcCP1_.js +560 -0
  63. package/dist/config-SgQcCP1_.js.map +1 -0
  64. package/dist/console-BGgGnjSi.js +81 -0
  65. package/dist/console-BGgGnjSi.js.map +1 -0
  66. package/dist/console-CSZ5_Vx5.cjs +2 -0
  67. package/dist/console-CSZ5_Vx5.cjs.map +1 -0
  68. package/dist/constants-CUyd9cTZ.js +357 -0
  69. package/dist/constants-CUyd9cTZ.js.map +1 -0
  70. package/dist/constants-CqdJhTxH.cjs +2 -0
  71. package/dist/constants-CqdJhTxH.cjs.map +1 -0
  72. package/dist/constants.d.cts +751 -0
  73. package/dist/constants.d.ts +231 -116
  74. package/dist/core/breadcrumbs.d.cts +54 -0
  75. package/dist/core/breadcrumbs.d.ts +21 -15
  76. package/dist/core/config.d.cts +45 -0
  77. package/dist/core/config.d.ts +33 -5
  78. package/dist/core/context.d.cts +24 -0
  79. package/dist/core/context.d.ts +8 -13
  80. package/dist/core/debug-buffer.d.cts +34 -0
  81. package/dist/core/debug-buffer.d.ts +13 -13
  82. package/dist/core/debug-bundle.d.cts +12 -0
  83. package/dist/core/debug-bundle.d.ts +6 -6
  84. package/dist/core/deferred.d.cts +7 -0
  85. package/dist/core/deferred.d.ts +4 -4
  86. package/dist/core/diagnostics.d.cts +86 -0
  87. package/dist/core/diagnostics.d.ts +25 -22
  88. package/dist/core/drops.d.cts +39 -0
  89. package/dist/core/drops.d.ts +22 -12
  90. package/dist/core/hold-buffer.d.cts +36 -0
  91. package/dist/core/hold-buffer.d.ts +16 -7
  92. package/dist/core/journey.d.cts +148 -0
  93. package/dist/core/journey.d.ts +28 -29
  94. package/dist/core/logger.d.cts +141 -0
  95. package/dist/core/logger.d.ts +45 -51
  96. package/dist/core/measure.d.cts +30 -0
  97. package/dist/core/measure.d.ts +21 -10
  98. package/dist/core/meter.d.cts +78 -0
  99. package/dist/core/meter.d.ts +38 -28
  100. package/dist/core/pipeline.d.cts +227 -0
  101. package/dist/core/pipeline.d.ts +114 -50
  102. package/dist/core/profile-buckets.d.cts +31 -0
  103. package/dist/core/profile-buckets.d.ts +31 -0
  104. package/dist/core/profiler.d.cts +218 -0
  105. package/dist/core/profiler.d.ts +218 -0
  106. package/dist/core/record.d.cts +190 -0
  107. package/dist/core/record.d.ts +67 -35
  108. package/dist/core/remote-rules.d.cts +17 -0
  109. package/dist/core/remote-rules.d.ts +7 -7
  110. package/dist/core/remote-sampling.d.cts +74 -0
  111. package/dist/core/remote-sampling.d.ts +24 -23
  112. package/dist/core/rotation.d.cts +75 -0
  113. package/dist/core/rotation.d.ts +75 -0
  114. package/dist/core/runtime.d.cts +765 -0
  115. package/dist/core/runtime.d.ts +430 -186
  116. package/dist/core/sampling.d.cts +86 -0
  117. package/dist/core/sampling.d.ts +22 -22
  118. package/dist/core/sender.d.cts +161 -0
  119. package/dist/core/sender.d.ts +80 -34
  120. package/dist/core/spans.d.cts +39 -0
  121. package/dist/core/spans.d.ts +6 -6
  122. package/dist/{deadline-BOjOxNHj.js → deadline-C4ccAuk5.js} +3 -6
  123. package/dist/deadline-C4ccAuk5.js.map +1 -0
  124. package/dist/deadline-CUGbto-y.cjs +2 -0
  125. package/dist/deadline-CUGbto-y.cjs.map +1 -0
  126. package/dist/debug-bundle-BXIlwDKM.cjs +2 -0
  127. package/dist/debug-bundle-BXIlwDKM.cjs.map +1 -0
  128. package/dist/debug-bundle-CRpYV_ui.js +35 -0
  129. package/dist/debug-bundle-CRpYV_ui.js.map +1 -0
  130. package/dist/defineProperty-X1c4tIPD.cjs +1 -0
  131. package/dist/defineProperty-s2S8BXUc.js +35 -0
  132. package/dist/doctor.cjs +1 -1
  133. package/dist/doctor.cjs.map +1 -1
  134. package/dist/doctor.d.cts +36 -0
  135. package/dist/doctor.d.ts +19 -6
  136. package/dist/doctor.js +180 -53
  137. package/dist/doctor.js.map +1 -1
  138. package/dist/error-like-B11pB4aL.js.map +1 -1
  139. package/dist/error-like-gGRx2s36.cjs.map +1 -1
  140. package/dist/errors-BE_EZV7Q.js +86 -0
  141. package/dist/errors-BE_EZV7Q.js.map +1 -0
  142. package/dist/errors-CNPbesMs.cjs +3 -0
  143. package/dist/errors-CNPbesMs.cjs.map +1 -0
  144. package/dist/factory-CTi0Is3F.js +404 -0
  145. package/dist/factory-CTi0Is3F.js.map +1 -0
  146. package/dist/factory-hRrH32v5.cjs +2 -0
  147. package/dist/factory-hRrH32v5.cjs.map +1 -0
  148. package/dist/fixed-window-CvESpFYV.cjs.map +1 -1
  149. package/dist/fixed-window-Dq3MLUUv.js.map +1 -1
  150. package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
  151. package/dist/global-scope-D9I8s-oN.js.map +1 -1
  152. package/dist/guards-BlYGRK4l.js +10 -0
  153. package/dist/guards-BlYGRK4l.js.map +1 -0
  154. package/dist/guards-EjG3ahFp.cjs +2 -0
  155. package/dist/guards-EjG3ahFp.cjs.map +1 -0
  156. package/dist/{identity-DT5VmvXy.js → identity-DdhKgrpk.js} +11 -15
  157. package/dist/identity-DdhKgrpk.js.map +1 -0
  158. package/dist/identity-DlWRIuwy.cjs +2 -0
  159. package/dist/identity-DlWRIuwy.cjs.map +1 -0
  160. package/dist/index.cjs +1 -1
  161. package/dist/index.cjs.map +1 -1
  162. package/dist/index.d.cts +300 -0
  163. package/dist/index.d.ts +165 -141
  164. package/dist/index.js +1283 -1468
  165. package/dist/index.js.map +1 -1
  166. package/dist/indexeddb-storage-CL9uqBCy.cjs +2 -0
  167. package/dist/indexeddb-storage-CL9uqBCy.cjs.map +1 -0
  168. package/dist/{indexeddb-storage-BJVtiQKm.js → indexeddb-storage-GHdl0t8A.js} +51 -47
  169. package/dist/indexeddb-storage-GHdl0t8A.js.map +1 -0
  170. package/dist/interactions-CUkzK8sR.cjs +2 -0
  171. package/dist/interactions-CUkzK8sR.cjs.map +1 -0
  172. package/dist/{interactions-DTgKy_6K.js → interactions-DiFvCosX.js} +41 -49
  173. package/dist/interactions-DiFvCosX.js.map +1 -0
  174. package/dist/journey-B4Adltjm.cjs +2 -0
  175. package/dist/journey-B4Adltjm.cjs.map +1 -0
  176. package/dist/{journey-CuJrHzEg.js → journey-D2_sia57.js} +51 -53
  177. package/dist/journey-D2_sia57.js.map +1 -0
  178. package/dist/{library-console-C1m6g1BR.js → library-console-Btrzt814.js} +2 -2
  179. package/dist/library-console-Btrzt814.js.map +1 -0
  180. package/dist/{library-console-D2GY9Or6.cjs → library-console-CPW6bvZH.cjs} +2 -2
  181. package/dist/library-console-CPW6bvZH.cjs.map +1 -0
  182. package/dist/{library-request-BQBT9N9Q.js → library-request-BJ9PLRaD.js} +2 -2
  183. package/dist/library-request-BJ9PLRaD.js.map +1 -0
  184. package/dist/{library-request-1BX_UlaX.cjs → library-request-D7OvTxZV.cjs} +2 -2
  185. package/dist/library-request-D7OvTxZV.cjs.map +1 -0
  186. package/dist/{lifecycle-BaKx_-32.js → lifecycle-22CUCrc9.js} +21 -29
  187. package/dist/lifecycle-22CUCrc9.js.map +1 -0
  188. package/dist/lifecycle-IaAm1mOC.cjs +2 -0
  189. package/dist/lifecycle-IaAm1mOC.cjs.map +1 -0
  190. package/dist/{log-record-CAoGBBf3.js → log-record-BNiLfqtL.js} +8 -7
  191. package/dist/log-record-BNiLfqtL.js.map +1 -0
  192. package/dist/log-record-CkivuiEl.cjs +2 -0
  193. package/dist/log-record-CkivuiEl.cjs.map +1 -0
  194. package/dist/long-frames-BUUbXd-B.cjs +2 -0
  195. package/dist/long-frames-BUUbXd-B.cjs.map +1 -0
  196. package/dist/long-frames-DNFaRnC3.js +62 -0
  197. package/dist/long-frames-DNFaRnC3.js.map +1 -0
  198. package/dist/models/batch.d.cts +57 -0
  199. package/dist/models/batch.d.ts +16 -17
  200. package/dist/models/bus.d.cts +158 -0
  201. package/dist/models/bus.d.ts +46 -26
  202. package/dist/models/config.d.cts +1540 -0
  203. package/dist/models/config.d.ts +692 -405
  204. package/dist/models/drop.d.cts +54 -0
  205. package/dist/models/drop.d.ts +29 -14
  206. package/dist/models/health.d.cts +148 -0
  207. package/dist/models/health.d.ts +119 -23
  208. package/dist/models/log-record.d.cts +61 -0
  209. package/dist/models/log-record.d.ts +13 -14
  210. package/dist/models/metric.d.cts +139 -0
  211. package/dist/models/metric.d.ts +94 -18
  212. package/dist/models/plugin.d.cts +47 -0
  213. package/dist/models/plugin.d.ts +16 -16
  214. package/dist/models/replay.d.cts +60 -0
  215. package/dist/models/replay.d.ts +60 -0
  216. package/dist/models/serializer.d.cts +23 -0
  217. package/dist/models/serializer.d.ts +3 -4
  218. package/dist/models/storage.d.cts +95 -0
  219. package/dist/models/storage.d.ts +17 -14
  220. package/dist/network-CGMLQ-mA.cjs +2 -0
  221. package/dist/network-CGMLQ-mA.cjs.map +1 -0
  222. package/dist/{network-DBNwApoF.js → network-on2zZT6H.js} +57 -57
  223. package/dist/network-on2zZT6H.js.map +1 -0
  224. package/dist/openfin-Bxelt0yg.js.map +1 -1
  225. package/dist/openfin-DtH2f7zX.cjs.map +1 -1
  226. package/dist/otlp-BENHf3g9.cjs +2 -0
  227. package/dist/otlp-BENHf3g9.cjs.map +1 -0
  228. package/dist/{otlp-BTJdIa6F.js → otlp-DimfrRor.js} +22 -29
  229. package/dist/otlp-DimfrRor.js.map +1 -0
  230. package/dist/patch-BX8KrPCT.cjs.map +1 -1
  231. package/dist/patch-UdPz1ea8.js.map +1 -1
  232. package/dist/{platform-DkcuXwe-.js → platform-BaaFIPCU.js} +8 -8
  233. package/dist/platform-BaaFIPCU.js.map +1 -0
  234. package/dist/{platform-C2Ez5kDc.cjs → platform-CfA3-7sJ.cjs} +2 -2
  235. package/dist/platform-CfA3-7sJ.cjs.map +1 -0
  236. package/dist/profiler-BAZoh7A4.js +292 -0
  237. package/dist/profiler-BAZoh7A4.js.map +1 -0
  238. package/dist/profiler-D4tJpDRc.cjs +2 -0
  239. package/dist/profiler-D4tJpDRc.cjs.map +1 -0
  240. package/dist/profiler-frames-C4xr7KfH.cjs +2 -0
  241. package/dist/profiler-frames-C4xr7KfH.cjs.map +1 -0
  242. package/dist/profiler-frames-cJMx9wNM.js +78 -0
  243. package/dist/profiler-frames-cJMx9wNM.js.map +1 -0
  244. package/dist/remote-rules-Dz9MRAsB.js +95 -0
  245. package/dist/remote-rules-Dz9MRAsB.js.map +1 -0
  246. package/dist/remote-rules-_tY0zj5o.cjs +2 -0
  247. package/dist/remote-rules-_tY0zj5o.cjs.map +1 -0
  248. package/dist/replay-B3gFXIZd.cjs +2 -0
  249. package/dist/replay-B3gFXIZd.cjs.map +1 -0
  250. package/dist/replay-Ds-ANH34.js +310 -0
  251. package/dist/replay-Ds-ANH34.js.map +1 -0
  252. package/dist/reports-BDSe4dFH.cjs +2 -0
  253. package/dist/reports-BDSe4dFH.cjs.map +1 -0
  254. package/dist/{reports-TA-zInnq.js → reports-C-thq-bk.js} +25 -30
  255. package/dist/reports-C-thq-bk.js.map +1 -0
  256. package/dist/resource-timing-C576gFIQ.cjs +2 -0
  257. package/dist/resource-timing-C576gFIQ.cjs.map +1 -0
  258. package/dist/{resource-timing-BLv3EA2A.js → resource-timing-eUl2dNgC.js} +20 -23
  259. package/dist/resource-timing-eUl2dNgC.js.map +1 -0
  260. package/dist/response-body-YdNl-HkR.cjs +3 -0
  261. package/dist/response-body-YdNl-HkR.cjs.map +1 -0
  262. package/dist/response-body-eoSQpLiH.js +331 -0
  263. package/dist/response-body-eoSQpLiH.js.map +1 -0
  264. package/dist/rotation-Cwct4ckk.js +94 -0
  265. package/dist/rotation-Cwct4ckk.js.map +1 -0
  266. package/dist/rotation-D4qUAHAu.cjs +2 -0
  267. package/dist/rotation-D4qUAHAu.cjs.map +1 -0
  268. package/dist/sampling-BlrI8jor.js +63 -0
  269. package/dist/sampling-BlrI8jor.js.map +1 -0
  270. package/dist/sampling-mXt4dstx.cjs +2 -0
  271. package/dist/sampling-mXt4dstx.cjs.map +1 -0
  272. package/dist/{sanitize-6ymPlVvP.js → sanitize-Ba0KqU06.js} +2 -2
  273. package/dist/sanitize-Ba0KqU06.js.map +1 -0
  274. package/dist/{sanitize-BAWzkZt0.cjs → sanitize-DQyiI_KY.cjs} +2 -2
  275. package/dist/sanitize-DQyiI_KY.cjs.map +1 -0
  276. package/dist/sender-BdRuNVhF.cjs +2 -0
  277. package/dist/sender-BdRuNVhF.cjs.map +1 -0
  278. package/dist/sender-Dv8rAmpV.js +979 -0
  279. package/dist/sender-Dv8rAmpV.js.map +1 -0
  280. package/dist/storage/context-storage.d.cts +90 -0
  281. package/dist/storage/context-storage.d.ts +38 -37
  282. package/dist/storage/emergency-queue.d.cts +27 -0
  283. package/dist/storage/emergency-queue.d.ts +13 -13
  284. package/dist/storage/eviction.d.cts +40 -0
  285. package/dist/storage/eviction.d.ts +13 -13
  286. package/dist/storage/factory.d.cts +21 -0
  287. package/dist/storage/factory.d.ts +11 -10
  288. package/dist/storage/gap.d.cts +20 -0
  289. package/dist/storage/gap.d.ts +9 -9
  290. package/dist/storage/idb-driver.d.cts +93 -0
  291. package/dist/storage/idb-driver.d.ts +32 -33
  292. package/dist/storage/indexeddb-storage.d.cts +97 -0
  293. package/dist/storage/indexeddb-storage.d.ts +38 -31
  294. package/dist/storage/keys.d.cts +17 -0
  295. package/dist/storage/keys.d.ts +9 -9
  296. package/dist/storage/local-storage.d.cts +139 -0
  297. package/dist/storage/local-storage.d.ts +49 -42
  298. package/dist/storage/memory-storage.d.cts +73 -0
  299. package/dist/storage/memory-storage.d.ts +25 -25
  300. package/dist/storage/persistence.d.cts +8 -0
  301. package/dist/storage/persistence.d.ts +3 -3
  302. package/dist/storage/stored-context.d.cts +34 -0
  303. package/dist/storage/stored-context.d.ts +34 -0
  304. package/dist/stored-context-B2EzVuYm.js +51 -0
  305. package/dist/stored-context-B2EzVuYm.js.map +1 -0
  306. package/dist/stored-context-CXt7eHZL.cjs +2 -0
  307. package/dist/stored-context-CXt7eHZL.cjs.map +1 -0
  308. package/dist/storm-C-zYSdDX.cjs +2 -0
  309. package/dist/storm-C-zYSdDX.cjs.map +1 -0
  310. package/dist/storm-DjKetLKZ.js +9 -0
  311. package/dist/storm-DjKetLKZ.js.map +1 -0
  312. package/dist/transport/compression.d.cts +7 -0
  313. package/dist/transport/compression.d.ts +2 -2
  314. package/dist/transport/custom-transport.d.cts +22 -0
  315. package/dist/transport/custom-transport.d.ts +6 -5
  316. package/dist/transport/errors.d.cts +31 -0
  317. package/dist/transport/errors.d.ts +7 -7
  318. package/dist/transport/exit-flush.d.cts +135 -0
  319. package/dist/transport/exit-flush.d.ts +62 -45
  320. package/dist/transport/headers.d.cts +8 -0
  321. package/dist/transport/headers.d.ts +4 -4
  322. package/dist/transport/http-transport.d.cts +116 -0
  323. package/dist/transport/http-transport.d.ts +48 -35
  324. package/dist/transport/memory-transport.d.cts +30 -0
  325. package/dist/transport/memory-transport.d.ts +8 -8
  326. package/dist/transport/response-body.d.cts +49 -0
  327. package/dist/transport/response-body.d.ts +49 -0
  328. package/dist/transport/retry-engine.d.cts +129 -0
  329. package/dist/transport/retry-engine.d.ts +62 -43
  330. package/dist/transport/serializers/ecs.d.cts +3 -0
  331. package/dist/transport/serializers/ecs.d.ts +2 -2
  332. package/dist/transport/serializers/otlp-metrics.d.cts +3 -0
  333. package/dist/transport/serializers/otlp-metrics.d.ts +2 -2
  334. package/dist/transport/serializers/otlp-traces.d.cts +3 -0
  335. package/dist/transport/serializers/otlp-traces.d.ts +2 -2
  336. package/dist/transport/serializers/otlp.d.cts +47 -0
  337. package/dist/transport/serializers/otlp.d.ts +18 -18
  338. package/dist/transport/serializers/select.d.cts +38 -0
  339. package/dist/transport/serializers/select.d.ts +11 -11
  340. package/dist/transport/status-transport.d.cts +129 -0
  341. package/dist/transport/status-transport.d.ts +45 -28
  342. package/dist/transport/worker-client.d.cts +23 -0
  343. package/dist/transport/worker-client.d.ts +12 -3
  344. package/dist/transport/worker-entry.d.cts +5 -0
  345. package/dist/transport/worker-entry.d.ts +1 -1
  346. package/dist/transport/worker-protocol.d.cts +38 -0
  347. package/dist/transport/worker-protocol.d.ts +7 -5
  348. package/dist/transport/worker-server.d.cts +3 -0
  349. package/dist/transport/worker-server.d.ts +1 -1
  350. package/dist/transport/worker-transport.d.cts +10 -0
  351. package/dist/transport/worker-transport.d.ts +5 -4
  352. package/dist/types-BAerHgCq.js.map +1 -1
  353. package/dist/types-C7WNpnG1.cjs.map +1 -1
  354. package/dist/{unclean-exit-CwcUhFOn.js → unclean-exit-DQD1cT7c.js} +23 -30
  355. package/dist/unclean-exit-DQD1cT7c.js.map +1 -0
  356. package/dist/unclean-exit-py99ApzT.cjs +2 -0
  357. package/dist/unclean-exit-py99ApzT.cjs.map +1 -0
  358. package/dist/unref-CU9Nyz_9.cjs +2 -0
  359. package/dist/unref-CU9Nyz_9.cjs.map +1 -0
  360. package/dist/unref-DgHPQeWv.js +7 -0
  361. package/dist/unref-DgHPQeWv.js.map +1 -0
  362. package/dist/{user-timing-_jZIhDKI.js → user-timing-BePqb1uN.js} +18 -18
  363. package/dist/user-timing-BePqb1uN.js.map +1 -0
  364. package/dist/user-timing-D6XTmpuM.cjs +2 -0
  365. package/dist/user-timing-D6XTmpuM.cjs.map +1 -0
  366. package/dist/utils/console.d.cts +36 -0
  367. package/dist/utils/console.d.ts +6 -6
  368. package/dist/utils/deadline.d.cts +14 -0
  369. package/dist/utils/deadline.d.ts +4 -4
  370. package/dist/utils/error-like.d.cts +25 -0
  371. package/dist/utils/error-like.d.ts +7 -7
  372. package/dist/utils/fixed-window.d.cts +25 -0
  373. package/dist/utils/fixed-window.d.ts +9 -8
  374. package/dist/utils/global-scope.d.cts +20 -0
  375. package/dist/utils/global-scope.d.ts +8 -8
  376. package/dist/utils/guards.d.cts +14 -0
  377. package/dist/utils/guards.d.ts +10 -2
  378. package/dist/utils/identity.d.cts +109 -0
  379. package/dist/utils/identity.d.ts +20 -21
  380. package/dist/utils/library-console.d.cts +11 -0
  381. package/dist/utils/library-console.d.ts +4 -4
  382. package/dist/utils/library-request.d.cts +24 -0
  383. package/dist/utils/library-request.d.ts +10 -10
  384. package/dist/utils/lock.d.cts +24 -0
  385. package/dist/utils/lock.d.ts +11 -10
  386. package/dist/utils/openfin.d.cts +48 -0
  387. package/dist/utils/openfin.d.ts +5 -5
  388. package/dist/utils/patch.d.cts +9 -0
  389. package/dist/utils/patch.d.ts +6 -6
  390. package/dist/utils/platform.d.cts +62 -0
  391. package/dist/utils/platform.d.ts +15 -13
  392. package/dist/utils/sanitize.d.cts +52 -0
  393. package/dist/utils/sanitize.d.ts +5 -5
  394. package/dist/utils/sequence.d.cts +10 -0
  395. package/dist/utils/tracing.d.cts +158 -0
  396. package/dist/utils/tracing.d.ts +49 -42
  397. package/dist/utils/unref.d.cts +9 -0
  398. package/dist/utils/unref.d.ts +3 -3
  399. package/dist/web-socket-CoIUBM3C.cjs +2 -0
  400. package/dist/web-socket-CoIUBM3C.cjs.map +1 -0
  401. package/dist/{web-socket-CV7yIMnm.js → web-socket-DSHgDiZ6.js} +23 -28
  402. package/dist/web-socket-DSHgDiZ6.js.map +1 -0
  403. package/dist/web-vitals-4pWACwaR.js +71 -0
  404. package/dist/web-vitals-4pWACwaR.js.map +1 -0
  405. package/dist/web-vitals-__X7t4pj.cjs +2 -0
  406. package/dist/web-vitals-__X7t4pj.cjs.map +1 -0
  407. package/dist/worker-protocol-QbvqNazn.cjs +2 -0
  408. package/dist/worker-protocol-QbvqNazn.cjs.map +1 -0
  409. package/dist/{worker-protocol-CrsdSDLn.js → worker-protocol-x074Rpet.js} +14 -11
  410. package/dist/worker-protocol-x074Rpet.js.map +1 -0
  411. package/dist/worker-server-CFe4nvos.cjs +2 -0
  412. package/dist/worker-server-CFe4nvos.cjs.map +1 -0
  413. package/dist/worker-server-iUVSjH8L.js +94 -0
  414. package/dist/worker-server-iUVSjH8L.js.map +1 -0
  415. package/dist/worker-transport-CRAX-09c.cjs +2 -0
  416. package/dist/worker-transport-CRAX-09c.cjs.map +1 -0
  417. package/dist/worker-transport-Dy1KMA7t.js +190 -0
  418. package/dist/worker-transport-Dy1KMA7t.js.map +1 -0
  419. package/llms.txt +397 -0
  420. package/package.json +55 -41
  421. package/dist/batch-C8OcWR2L.cjs.map +0 -1
  422. package/dist/batch-CL9uWYY3.js.map +0 -1
  423. package/dist/bus-BZ0GldpT.js +0 -660
  424. package/dist/bus-BZ0GldpT.js.map +0 -1
  425. package/dist/bus-VWlmM5xs.cjs +0 -2
  426. package/dist/bus-VWlmM5xs.cjs.map +0 -1
  427. package/dist/console-BPZCuSLc.cjs +0 -2
  428. package/dist/console-BPZCuSLc.cjs.map +0 -1
  429. package/dist/console-BeCF7n59.js +0 -82
  430. package/dist/console-BeCF7n59.js.map +0 -1
  431. package/dist/constants-DqKJH_MP.cjs +0 -2
  432. package/dist/constants-DqKJH_MP.cjs.map +0 -1
  433. package/dist/constants-zyrqveN4.js +0 -304
  434. package/dist/constants-zyrqveN4.js.map +0 -1
  435. package/dist/context-storage-BjzeBSxH.cjs +0 -2
  436. package/dist/context-storage-BjzeBSxH.cjs.map +0 -1
  437. package/dist/context-storage-BzkoHzkQ.js +0 -51
  438. package/dist/context-storage-BzkoHzkQ.js.map +0 -1
  439. package/dist/deadline-BOjOxNHj.js.map +0 -1
  440. package/dist/deadline-XSnm95pg.cjs +0 -2
  441. package/dist/deadline-XSnm95pg.cjs.map +0 -1
  442. package/dist/debug-bundle-BzJNpbF0.cjs +0 -2
  443. package/dist/debug-bundle-BzJNpbF0.cjs.map +0 -1
  444. package/dist/debug-bundle-C7UkHZ-q.js +0 -25
  445. package/dist/debug-bundle-C7UkHZ-q.js.map +0 -1
  446. package/dist/emergency-queue-CNTRui5t.cjs +0 -2
  447. package/dist/emergency-queue-CNTRui5t.cjs.map +0 -1
  448. package/dist/emergency-queue-Zy6lNafo.js +0 -67
  449. package/dist/emergency-queue-Zy6lNafo.js.map +0 -1
  450. package/dist/errors-Dh7kef0i.js +0 -92
  451. package/dist/errors-Dh7kef0i.js.map +0 -1
  452. package/dist/errors-tfEr48bS.cjs +0 -3
  453. package/dist/errors-tfEr48bS.cjs.map +0 -1
  454. package/dist/factory-BonqI3NL.js +0 -276
  455. package/dist/factory-BonqI3NL.js.map +0 -1
  456. package/dist/factory-CJXVYp0R.cjs +0 -2
  457. package/dist/factory-CJXVYp0R.cjs.map +0 -1
  458. package/dist/guards-Cidk71ME.js +0 -7
  459. package/dist/guards-Cidk71ME.js.map +0 -1
  460. package/dist/guards-nJ70syPt.cjs +0 -2
  461. package/dist/guards-nJ70syPt.cjs.map +0 -1
  462. package/dist/identity-Cxgj6pZX.cjs +0 -2
  463. package/dist/identity-Cxgj6pZX.cjs.map +0 -1
  464. package/dist/identity-DT5VmvXy.js.map +0 -1
  465. package/dist/indexeddb-storage-BJVtiQKm.js.map +0 -1
  466. package/dist/indexeddb-storage-CIoW21Xd.cjs +0 -2
  467. package/dist/indexeddb-storage-CIoW21Xd.cjs.map +0 -1
  468. package/dist/interactions-DTgKy_6K.js.map +0 -1
  469. package/dist/interactions-fEN6FbVo.cjs +0 -2
  470. package/dist/interactions-fEN6FbVo.cjs.map +0 -1
  471. package/dist/journey-CuJrHzEg.js.map +0 -1
  472. package/dist/journey-pffMVMfa.cjs +0 -2
  473. package/dist/journey-pffMVMfa.cjs.map +0 -1
  474. package/dist/keys-BHhw_0Wh.cjs +0 -2
  475. package/dist/keys-BHhw_0Wh.cjs.map +0 -1
  476. package/dist/keys-BU9j5YqW.js +0 -16
  477. package/dist/keys-BU9j5YqW.js.map +0 -1
  478. package/dist/library-console-C1m6g1BR.js.map +0 -1
  479. package/dist/library-console-D2GY9Or6.cjs.map +0 -1
  480. package/dist/library-request-1BX_UlaX.cjs.map +0 -1
  481. package/dist/library-request-BQBT9N9Q.js.map +0 -1
  482. package/dist/lifecycle-2EtUaRpo.cjs +0 -2
  483. package/dist/lifecycle-2EtUaRpo.cjs.map +0 -1
  484. package/dist/lifecycle-BaKx_-32.js.map +0 -1
  485. package/dist/log-record-CAoGBBf3.js.map +0 -1
  486. package/dist/log-record-i9zOTkpQ.cjs +0 -2
  487. package/dist/log-record-i9zOTkpQ.cjs.map +0 -1
  488. package/dist/long-frames-BVg4i5SC.cjs +0 -2
  489. package/dist/long-frames-BVg4i5SC.cjs.map +0 -1
  490. package/dist/long-frames-Czk7IupC.js +0 -64
  491. package/dist/long-frames-Czk7IupC.js.map +0 -1
  492. package/dist/models/stats.d.ts +0 -11
  493. package/dist/network-DBNwApoF.js.map +0 -1
  494. package/dist/network-xbbuvG_6.cjs +0 -2
  495. package/dist/network-xbbuvG_6.cjs.map +0 -1
  496. package/dist/otlp-BDvFrLnc.cjs +0 -2
  497. package/dist/otlp-BDvFrLnc.cjs.map +0 -1
  498. package/dist/otlp-BTJdIa6F.js.map +0 -1
  499. package/dist/platform-C2Ez5kDc.cjs.map +0 -1
  500. package/dist/platform-DkcuXwe-.js.map +0 -1
  501. package/dist/remote-rules-Cfb4K-Nl.js +0 -98
  502. package/dist/remote-rules-Cfb4K-Nl.js.map +0 -1
  503. package/dist/remote-rules-vzvk7aKf.cjs +0 -2
  504. package/dist/remote-rules-vzvk7aKf.cjs.map +0 -1
  505. package/dist/reports-Dk2YhKIh.cjs +0 -2
  506. package/dist/reports-Dk2YhKIh.cjs.map +0 -1
  507. package/dist/reports-TA-zInnq.js.map +0 -1
  508. package/dist/resource-timing-BLv3EA2A.js.map +0 -1
  509. package/dist/resource-timing-Cysw1S1f.cjs +0 -2
  510. package/dist/resource-timing-Cysw1S1f.cjs.map +0 -1
  511. package/dist/sampling-C4VV-1MS.js +0 -60
  512. package/dist/sampling-C4VV-1MS.js.map +0 -1
  513. package/dist/sampling-Ckh2yW9k.cjs +0 -2
  514. package/dist/sampling-Ckh2yW9k.cjs.map +0 -1
  515. package/dist/sanitize-6ymPlVvP.js.map +0 -1
  516. package/dist/sanitize-BAWzkZt0.cjs.map +0 -1
  517. package/dist/select-ZF4by-lF.cjs +0 -3
  518. package/dist/select-ZF4by-lF.cjs.map +0 -1
  519. package/dist/select-xtQaenIi.js +0 -270
  520. package/dist/select-xtQaenIi.js.map +0 -1
  521. package/dist/sender-CiMHC9YG.js +0 -856
  522. package/dist/sender-CiMHC9YG.js.map +0 -1
  523. package/dist/sender-D5wBoXA8.cjs +0 -2
  524. package/dist/sender-D5wBoXA8.cjs.map +0 -1
  525. package/dist/storage-BA9RqRO-.cjs +0 -2
  526. package/dist/storage-BA9RqRO-.cjs.map +0 -1
  527. package/dist/storage-DZwed89z.js +0 -16
  528. package/dist/storage-DZwed89z.js.map +0 -1
  529. package/dist/storm-CYi9Swpx.cjs +0 -2
  530. package/dist/storm-CYi9Swpx.cjs.map +0 -1
  531. package/dist/storm-VR024_QN.js +0 -9
  532. package/dist/storm-VR024_QN.js.map +0 -1
  533. package/dist/unclean-exit-CwcUhFOn.js.map +0 -1
  534. package/dist/unclean-exit-DFUN57wY.cjs +0 -2
  535. package/dist/unclean-exit-DFUN57wY.cjs.map +0 -1
  536. package/dist/user-timing-C9kfRq3J.cjs +0 -2
  537. package/dist/user-timing-C9kfRq3J.cjs.map +0 -1
  538. package/dist/user-timing-_jZIhDKI.js.map +0 -1
  539. package/dist/utils/timer.d.ts +0 -19
  540. package/dist/web-socket-BWUoqBh8.cjs +0 -2
  541. package/dist/web-socket-BWUoqBh8.cjs.map +0 -1
  542. package/dist/web-socket-CV7yIMnm.js.map +0 -1
  543. package/dist/web-vitals-Bq4WFHQo.js +0 -52
  544. package/dist/web-vitals-Bq4WFHQo.js.map +0 -1
  545. package/dist/web-vitals-DFuoTQbZ.cjs +0 -2
  546. package/dist/web-vitals-DFuoTQbZ.cjs.map +0 -1
  547. package/dist/worker-protocol-Bai7GAIA.cjs +0 -2
  548. package/dist/worker-protocol-Bai7GAIA.cjs.map +0 -1
  549. package/dist/worker-protocol-CrsdSDLn.js.map +0 -1
  550. package/dist/worker-server-BrIYkfoa.cjs +0 -2
  551. package/dist/worker-server-BrIYkfoa.cjs.map +0 -1
  552. package/dist/worker-server-Dp5HYm4b.js +0 -83
  553. package/dist/worker-server-Dp5HYm4b.js.map +0 -1
  554. package/dist/worker-transport-Bwej4N2e.cjs +0 -2
  555. package/dist/worker-transport-Bwej4N2e.cjs.map +0 -1
  556. package/dist/worker-transport-D6jtgpqN.js +0 -199
  557. package/dist/worker-transport-D6jtgpqN.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants-zyrqveN4.js","names":["LIBRARY_LOG_PREFIX","DIAGNOSTIC_THROTTLE_MS","SESSION_ID_KEY","TAB_ID_KEY","ALIVE_KEY","ALIVE_UPDATE_MS","SESSION_IDLE_MS","SESSION_TOUCH_MS","OPENFIN_UA_PATTERN","ANDROID_WEBVIEW_UA_PATTERN","IOS_DEVICE_UA_PATTERN","MACINTOSH_UA_PATTERN","MOBILE_UA_PATTERN","WEBKIT_UA_TOKEN","SAFARI_UA_TOKEN","HIGH_SURROGATE_MIN","HIGH_SURROGATE_MAX","UTF8_TWO_BYTE_CEILING","SEVERITY_NUMBER","LEVEL_ORDER","ATTR_LOG_TYPE","ATTR_LOG_SEQ","ATTR_APP_NAMESPACE","ATTR_PAGE_URL","ATTR_URL_FULL","ATTR_JOURNEY_ID","ATTR_JOURNEY_NAME","ATTR_JOURNEY_PARENT_ID","ATTR_SANITIZE_FAILED","ATTR_ERROR_DATA","ATTR_BREADCRUMBS","ATTR_ATTRIBUTES_DROPPED","ATTR_ATTRIBUTES_BYTES","ATTR_CLOCK_OFFSET_MS","ATTR_DEBUG_BUFFER","RESOURCE_SERVICE_NAME","RESOURCE_SERVICE_VERSION","RESOURCE_DEPLOYMENT_ENVIRONMENT","RESOURCE_TELEMETRY_SDK_NAME","RESOURCE_TELEMETRY_SDK_VERSION","RESOURCE_TELEMETRY_SDK_LANGUAGE","RESOURCE_HOST_PLATFORM","RESOURCE_SESSION_ID","RESOURCE_TAB_ID","RESOURCE_CONTEXT_ID","RESOURCE_BROWSER_USER_AGENT","RESOURCE_OPENFIN_UUID","RESOURCE_OPENFIN_NAME","TELEMETRY_SDK_NAME","TELEMETRY_SDK_VERSION","TELEMETRY_SDK_LANGUAGE","SERIALIZER_NAME_OTLP","ECS_LEVEL_NAMES","ECS_VERSION","CONTENT_TYPE_JSON","CONTENT_TYPE_NDJSON","NANOS_PER_MILLI","NANOS_PATTERN","HEADER_CONTENT_TYPE","HEADER_CONTENT_ENCODING","HEADER_RETRY_AFTER","HEADER_BATCH_ID","HEADER_ATTEMPT","HEADER_SAMPLING","HEADER_DATE","ENCODING_GZIP","MILLIS_PER_SECOND","BEACON_LIMIT_BYTES","CONTENT_TYPE_TEXT_PLAIN","QUERY_PARAM_BATCH_ID","QUERY_PARAM_EXIT_REASON","BATCH_STORAGE_KEY_PREFIX","EMERGENCY_STORAGE_KEY_PREFIX","STORAGE_PROBE_KEY","QUOTA_EXCEEDED_ERROR","INDEXEDDB_STORE_NAME","INDEXEDDB_CREATED_AT_INDEX","STORAGE_NAME_INDEXEDDB","STORAGE_NAME_LOCAL","STORAGE_NAME_MEMORY","STORAGE_NAME_NONE","DRAIN_LOCK_NAME","EMERGENCY_LOCK_NAME","JOURNEY_STORAGE_KEY","JOURNEY_ID_PATTERN","JOURNEY_CLOCK_SKEW_MS","OPENFIN_OPTIONS_TIMEOUT_MS","OPENFIN_JOURNEY_CUSTOM_DATA_KEY","BASE64_PLUS_PATTERN","BASE64_SLASH_PATTERN","BASE64_PADDING_PATTERN","BASE64URL_DASH_PATTERN","BASE64URL_UNDERSCORE_PATTERN","TRACE_MAX_AGE_MS","TRACEPARENT_HEADER","FNV_OFFSET_BASIS","FNV_PRIME","UINT32_MAX","LEVEL_BYPASS_TYPES","LOG_TYPE_METRIC","LOG_TYPE_ACTION","LOG_TYPE_SPAN","BUS_PROTOCOL","BUS_TYPE","RUNTIME_GLOBAL_KEY","RUNTIME_STOPPED_KEY","LIBRARY_REQUEST_KEY","LIBRARY_CONSOLE_KEY","TRANSPORT_CALL_KEY","ERROR_STORM_WINDOW_MS","ACTION_ATTRIBUTE_DEFAULT","RAGE_CLICK_WINDOW_MS","DEAD_CLICK_MS","DEAD_CLICK_CONTROLS","CONSOLE_DEFAULT_STYLES","DURATION_PRECISION","GAP_REPORT_THROTTLE_MS","CAPTURE_NAMESPACE","STORAGE_NAMESPACE","DIAGNOSTICS_NAMESPACE","DEFAULT_METRIC_UNIT","METRIC_NAMESPACE","ATTR_METRIC_OVERFLOW","METRIC_DEFAULT_BOUNDARIES","METRIC_KEYS","TRACE_NAMESPACE","SPAN_KEYS","TRANSPORT_WORKER_PROTOCOL","TRANSPORT_WORKER_TYPE","TRANSPORT_WORKER_REFUSAL","DEFER_IDLE_TIMEOUT_MS","DEFER_QUEUE_LIMIT","RESOURCE_SLOW_MS","SERVER_TIMING_HEADER","SERVER_TIMING_MAX_CHARS","REMOTE_CAPTURE_FLAGS","UNKNOWN_SERVICE_NAME","REMOTE_SAMPLING_MAX_CHARS","REMOTE_SAMPLING_MAX_TTL_MS","REMOTE_SAMPLING_POLL_MS","UNDEFAULTED_CONFIG_KEYS","CONFIG_SECTIONS","UNDEFAULTED_SECTION_KEYS","CONSOLE_DEFAULT_LEVEL","LOG_FLUSH_INTERVAL_MS","METRIC_FLUSH_INTERVAL_MS","REQUEST_TIMEOUT_MS","COMPRESSION_THRESHOLD_BYTES","STORAGE_DB_NAME","STORAGE_LIMITS","STORAGE_DEADLINE_MS","RETRY_BASE_DELAY_MS","RETRY_MAX_DELAY_MS","RETRY_IDLE_DELAY_MS","JOURNEY_MAX_AGE_MS","JOURNEY_URL_PARAM","BUS_CHANNEL_NAME","BUS_HANDSHAKE_TIMEOUT_MS","BUS_MAX_BOOT_BUFFER_ACTIONS","ERROR_DEDUPE_MS","RECORD_LIMITS","DEFAULT_CONFIG"],"sources":["../src/constants.ts"],"sourcesContent":["// src/constants.ts\n//\n// Defines all limits, thresholds, timing windows, storage keys, patterns, and\n// defaults that the library uses.\n\nimport type { ConsoleStyles, ResolvedConfig } from \"./models/config\";\nimport type { LogLevel, LogType } from \"./models/log-record\";\nimport type { StorageLimits } from \"./models/storage\";\n\n// ----------------------------------\n// Library-wide\n// ----------------------------------\n\n/** Prefix on console messages this library writes. */\nexport const LIBRARY_LOG_PREFIX = \"[ui-observability]\";\n\n// ----------------------------------\n// Diagnostics\n// ----------------------------------\n\n/**\n * Throttle window for each diagnostic code, in milliseconds. It limits how often an error\n * loop calls the handler.\n */\nexport const DIAGNOSTIC_THROTTLE_MS = 1000;\n\n// ----------------------------------\n// Identity\n// ----------------------------------\n\n/** `localStorage` key for the session id and its last-seen time. */\nexport const SESSION_ID_KEY = \"ui-observability.session\";\n\n/** `sessionStorage` key for the tab id. */\nexport const TAB_ID_KEY = \"ui-observability.tab\";\n\n/** sessionStorage key of the marker of a page that is alive. A clean close removes it. */\nexport const ALIVE_KEY = \"ui-observability.alive\";\n\n/** Interval of the updates of the alive marker, in milliseconds. */\nexport const ALIVE_UPDATE_MS = 30_000;\n\n/** Session idle timeout, in milliseconds. */\nexport const SESSION_IDLE_MS = 30 * 60 * 1000;\n\n/** Min gap between session last-seen writes, in milliseconds. */\nexport const SESSION_TOUCH_MS = 60_000;\n\n/** Random id length, in bytes, used when `crypto.randomUUID` is unavailable. */\nexport const ID_BYTE_LENGTH = 16;\n\n/** Distinct values in one byte (256). */\nexport const BYTE_VALUE_COUNT = 256;\n\n// ----------------------------------\n// Platform detection\n// ----------------------------------\n\n/** Matches OpenFin's user agent. */\nexport const OPENFIN_UA_PATTERN = /OpenFin/i;\n\n/** Matches Android's webview token (`wv`). */\nexport const ANDROID_WEBVIEW_UA_PATTERN = /\\bwv\\b/;\n\n/** Matches iOS hardware: iPhone, iPad, iPod. */\nexport const IOS_DEVICE_UA_PATTERN = /\\b(iPhone|iPad|iPod)\\b/;\n\n/** Matches desktop macOS in a user agent. */\nexport const MACINTOSH_UA_PATTERN = /\\bMacintosh\\b/;\n\n/** Matches the mobile token. */\nexport const MOBILE_UA_PATTERN = /\\bMobile\\b/;\n\n/** WebKit engine token, present in every WebKit browser including webviews. */\nexport const WEBKIT_UA_TOKEN = \"AppleWebKit\";\n\n/** Safari token sent by real iOS browsers, not in-app webviews. */\nexport const SAFARI_UA_TOKEN = \"Safari/\";\n\n// ----------------------------------\n// Sanitizing and size estimation\n// ----------------------------------\n\n/** First UTF-16 high surrogate code unit. */\nexport const HIGH_SURROGATE_MIN = 0xd800;\n\n/** Last UTF-16 high surrogate code unit. */\nexport const HIGH_SURROGATE_MAX = 0xdbff;\n\n/** Code units below this encode as one UTF-8 byte. */\nexport const UTF8_ONE_BYTE_CEILING = 0x80;\n\n/** Code units below this, and at or above the one-byte ceiling, encode as two UTF-8 bytes. */\nexport const UTF8_TWO_BYTE_CEILING = 0x800;\n\n/** Class names kept in a `describeNode` selector. */\nexport const MAX_NODE_CLASS_NAMES = 3;\n\n/** Byte cost of a null or undefined value. */\nexport const BYTES_PER_NULL = 4;\n\n/** Byte cost of a number (flat estimate). */\nexport const BYTES_PER_NUMBER = 8;\n\n/** Byte cost of a boolean. */\nexport const BYTES_PER_BOOLEAN = 5;\n\n/** Byte cost of an object or array's wrapping braces or brackets. */\nexport const BYTES_PER_CONTAINER = 2;\n\n/** Byte cost of a string's wrapping quotes. */\nexport const BYTES_PER_QUOTED_STRING = 2;\n\n/** Byte cost of one key's punctuation: quotes, colon, comma. */\nexport const BYTES_PER_KEY_OVERHEAD = 4;\n\n// ----------------------------------\n// Record model\n// ----------------------------------\n\n/**\n * Maps each log level to its OpenTelemetry severity number.\n * @see {@link LEVEL_ORDER}\n */\nexport const SEVERITY_NUMBER: Record<LogLevel, number> = {\n TRACE: 1,\n DEBUG: 5,\n INFO: 9,\n WARN: 13,\n ERROR: 17,\n FATAL: 21,\n};\n\n/**\n * Alias for `SEVERITY_NUMBER`, used by the level filter.\n * @see {@link SEVERITY_NUMBER}\n */\nexport const LEVEL_ORDER: Record<LogLevel, number> = SEVERITY_NUMBER;\n\n// ----------------------------------\n// Attribute and resource keys\n// ----------------------------------\n//\n// Attribute and resource key names that records carry in the payload. The names\n// follow OpenTelemetry conventions. The `uiobs.` prefix marks the fields of this library.\n\n/** Record kind attribute key. */\nexport const ATTR_LOG_TYPE = \"log.type\";\n\n/** Record sequence number in its context. It starts at 1. */\nexport const ATTR_LOG_SEQ = \"log.seq\";\n\n/** Logger namespace attribute key. */\nexport const ATTR_APP_NAMESPACE = \"app.namespace\";\n\n/** Document URL when the library built the record. */\nexport const ATTR_PAGE_URL = \"page.url\";\n\n/**\n * HTTP request URL attribute key. Network capture sets it. Do not reuse `ATTR_PAGE_URL`.\n * The page URL overwrites the request target under that key.\n * @see {@link ATTR_PAGE_URL}\n */\nexport const ATTR_URL_FULL = \"url.full\";\n\n/** Journey id attribute key. */\nexport const ATTR_JOURNEY_ID = \"journey.id\";\n\n/** Journey name attribute key. */\nexport const ATTR_JOURNEY_NAME = \"journey.name\";\n\n/** Parent journey id, present only on a child journey. */\nexport const ATTR_JOURNEY_PARENT_ID = \"journey.parent_id\";\n\n/** Marks a record whose attributes failed to sanitize. */\nexport const ATTR_SANITIZE_FAILED = \"uiobs.sanitize_failed\";\n\n/** Own fields of an Error reason, or the whole reason when it is not an Error. */\nexport const ATTR_ERROR_DATA = \"error.data\";\n\n/** Breadcrumb history of an error record. */\nexport const ATTR_BREADCRUMBS = \"breadcrumbs\";\n\n/**\n * Marks a record when the library drops its attributes because they exceed the byte budget.\n * @see {@link ATTR_ATTRIBUTES_BYTES}\n */\nexport const ATTR_ATTRIBUTES_DROPPED = \"uiobs.attributes_dropped\";\n\n/**\n * Byte size of the dropped attributes.\n * @see {@link ATTR_ATTRIBUTES_DROPPED}\n */\nexport const ATTR_ATTRIBUTES_BYTES = \"uiobs.attributes_bytes\";\n\n/** Server time minus client time, in milliseconds, from the Date header of an accepted answer. */\nexport const ATTR_CLOCK_OFFSET_MS = \"uiobs.clock_offset_ms\";\n\n/** Marks a record that the debug buffer kept until an error. */\nexport const ATTR_DEBUG_BUFFER = \"uiobs.debug_buffer\";\n\n/** Half the resolution of the HTTP Date header. It centers the error of the clock offset. */\nexport const DATE_HEADER_HALF_STEP_MS = 500;\n\n/** Application name resource key. */\nexport const RESOURCE_SERVICE_NAME = \"service.name\";\n\n/** Application build version resource key. */\nexport const RESOURCE_SERVICE_VERSION = \"service.version\";\n\n/** Deployment environment resource key. */\nexport const RESOURCE_DEPLOYMENT_ENVIRONMENT = \"deployment.environment\";\n\n/**\n * Producer library name resource key.\n * @see {@link TELEMETRY_SDK_NAME}\n */\nexport const RESOURCE_TELEMETRY_SDK_NAME = \"telemetry.sdk.name\";\n\n/**\n * Producer library version resource key.\n * @see {@link TELEMETRY_SDK_VERSION}\n */\nexport const RESOURCE_TELEMETRY_SDK_VERSION = \"telemetry.sdk.version\";\n\n/**\n * Producer SDK language resource key.\n * @see {@link TELEMETRY_SDK_LANGUAGE}\n */\nexport const RESOURCE_TELEMETRY_SDK_LANGUAGE = \"telemetry.sdk.language\";\n\n/** Host platform resource key: browser, webview, or OpenFin. */\nexport const RESOURCE_HOST_PLATFORM = \"host.platform\";\n\n/** Session id resource key. */\nexport const RESOURCE_SESSION_ID = \"session.id\";\n\n/** Tab id resource key. */\nexport const RESOURCE_TAB_ID = \"tab.id\";\n\n/** Context (realm) id resource key. */\nexport const RESOURCE_CONTEXT_ID = \"context.id\";\n\n/** Raw user agent resource key. */\nexport const RESOURCE_BROWSER_USER_AGENT = \"browser.user_agent\";\n\n/** OpenFin application uuid resource key. */\nexport const RESOURCE_OPENFIN_UUID = \"openfin.uuid\";\n\n/** OpenFin window or view name resource key. */\nexport const RESOURCE_OPENFIN_NAME = \"openfin.name\";\n\n/**\n * Value of `telemetry.sdk.name`.\n * @see {@link RESOURCE_TELEMETRY_SDK_NAME}\n */\nexport const TELEMETRY_SDK_NAME = \"@utk09/ui-observability\";\n\n/**\n * Value of `telemetry.sdk.version`. The build writes the version of package.json here.\n * @see {@link RESOURCE_TELEMETRY_SDK_VERSION}\n */\nexport const TELEMETRY_SDK_VERSION = __UIOBS_VERSION__;\n\n/**\n * Value of `telemetry.sdk.language`.\n * @see {@link RESOURCE_TELEMETRY_SDK_LANGUAGE}\n */\nexport const TELEMETRY_SDK_LANGUAGE = \"webjs\";\n\n// ----------------------------------\n// Serializers\n// ----------------------------------\n\n/** OTLP/JSON serializer name. */\nexport const SERIALIZER_NAME_OTLP = \"otlp\";\n\n/** ECS serializer name. */\nexport const SERIALIZER_NAME_ECS = \"ecs\";\n\n/**\n * ECS `log.level` names that differ from the lowercase severity text. ECS spells\n * the warning level in full. All other levels match in lowercase.\n * @see {@link SERIALIZER_NAME_ECS}\n */\nexport const ECS_LEVEL_NAMES: Partial<Record<LogLevel, string>> = { WARN: \"warning\" };\n\n/** ECS version of the documents. The Elastic ECS logging libraries write this version. */\nexport const ECS_VERSION = \"8.10.0\";\n\n/** Content type for an OTLP/JSON body. */\nexport const CONTENT_TYPE_JSON = \"application/json\";\n\n/** Content type for newline-delimited JSON. */\nexport const CONTENT_TYPE_NDJSON = \"application/x-ndjson\";\n\n/** Nanoseconds per millisecond. */\nexport const NANOS_PER_MILLI = 1000000n;\n\n/**\n * Matches a nanosecond epoch in decimal digits, for example \"1755543600123000000\".\n * @see {@link NANOS_PER_MILLI}\n */\nexport const NANOS_PATTERN = /^\\d+$/;\n\n// ----------------------------------\n// HTTP transport\n// ----------------------------------\n\n/** Content-Type header name. */\nexport const HEADER_CONTENT_TYPE = \"Content-Type\";\n\n/** Content-Encoding header name. */\nexport const HEADER_CONTENT_ENCODING = \"Content-Encoding\";\n\n/** Retry-After header name. */\nexport const HEADER_RETRY_AFTER = \"Retry-After\";\n\n/**\n * Batch deduplication key header name.\n * @see {@link QUERY_PARAM_BATCH_ID}\n */\nexport const HEADER_BATCH_ID = \"X-UiObs-Batch-Id\";\n\n/** Delivery attempt number header name. */\nexport const HEADER_ATTEMPT = \"X-UiObs-Attempt\";\n\n/** Response header that carries sampling rules from the ingest server. */\nexport const HEADER_SAMPLING = \"X-UiObs-Sampling\";\n\n/** Response header that gives the server time. The server must expose it to CORS. */\nexport const HEADER_DATE = \"Date\";\n\n/** Gzip encoding name. */\nexport const ENCODING_GZIP = \"gzip\";\n\n/** Lowest valid HTTP status code. */\nexport const HTTP_STATUS_MIN = 100;\n\n/** Highest valid HTTP status code. */\nexport const HTTP_STATUS_MAX = 599;\n\n/** Lowest HTTP status code that accepts a batch. */\nexport const HTTP_SUCCESS_MIN = 200;\n\n/** Lowest HTTP status code above the success range. */\nexport const HTTP_SUCCESS_END = 300;\n\n/** 401, credentials missing or rejected. */\nexport const HTTP_UNAUTHORIZED = 401;\n\n/** 403, valid credentials but access denied. */\nexport const HTTP_FORBIDDEN = 403;\n\n/** 408, the server closed the connection after a timeout. The transport can retry. */\nexport const HTTP_REQUEST_TIMEOUT = 408;\n\n/** 413, payload too large. The transport must split the batch. */\nexport const HTTP_PAYLOAD_TOO_LARGE = 413;\n\n/** 429, backpressure. */\nexport const HTTP_TOO_MANY_REQUESTS = 429;\n\n/** 500, floor for server-side errors. */\nexport const HTTP_SERVER_ERROR_MIN = 500;\n\n/** 503, temporary unavailability. */\nexport const HTTP_SERVICE_UNAVAILABLE = 503;\n\n/** Milliseconds per second. */\nexport const MILLIS_PER_SECOND = 1000;\n\n// ----------------------------------\n// Exit flush\n// ----------------------------------\n\n/** Max exit payload size, in bytes (`sendBeacon`/`fetch(keepalive)` shared budget). */\nexport const BEACON_LIMIT_BYTES = 60_000;\n\n/** Content type for an exit payload. It is CORS-safelisted and does not cause a preflight. */\nexport const CONTENT_TYPE_TEXT_PLAIN = \"text/plain;charset=UTF-8\";\n\n/**\n * Batch id query param name, for the exit path.\n * @see {@link HEADER_BATCH_ID}\n */\nexport const QUERY_PARAM_BATCH_ID = \"uiobs_batch_id\";\n\n/** Exit reason query param name, for logs only. */\nexport const QUERY_PARAM_EXIT_REASON = \"uiobs_exit\";\n\n// ----------------------------------\n// Storage\n// ----------------------------------\n\n/** localStorage key prefix for a stored batch. */\nexport const BATCH_STORAGE_KEY_PREFIX = \"ui-observability.batch.\";\n\n/** Zero-padded digit width for the creation time in a batch key. */\nexport const BATCH_KEY_TIME_WIDTH = 14;\n\n/** localStorage key prefix for a batch that exit flush stores. */\nexport const EMERGENCY_STORAGE_KEY_PREFIX = \"ui-observability.emergency.\";\n\n/** Maximum number of exit batches in the emergency queue. */\nexport const EMERGENCY_MAX_ENTRIES = 20;\n\n/** Key that the library writes to test if localStorage accepts writes. */\nexport const STORAGE_PROBE_KEY = \"ui-observability.probe\";\n\n/** Fraction of the store to evict on a quota error (1 in N). */\nexport const QUOTA_EVICTION_DIVISOR = 4;\n\n/** DOMException name for a full store. */\nexport const QUOTA_EXCEEDED_ERROR = \"QuotaExceededError\";\n\n/**\n * Native IndexedDB version. Version 11 replaced Dexie. Version 12 adds the context index.\n * Dexie opened this database at ten times its declared version. A version below 11 makes\n * open() fail with VersionError for an existing installation. Then no code can read its batches.\n */\nexport const INDEXEDDB_SCHEMA_VERSION = 12;\n\n/** IndexedDB object store that holds batches. Dexie set this name before the library removed it. */\nexport const INDEXEDDB_STORE_NAME = \"batches\";\n\n/** Index on the batch store that orders reads by creation time. */\nexport const INDEXEDDB_CREATED_AT_INDEX = \"createdAt\";\n\n/** IndexedDB adapter/strategy name. */\nexport const STORAGE_NAME_INDEXEDDB = \"indexeddb\";\n\n/** localStorage adapter/strategy name. */\nexport const STORAGE_NAME_LOCAL = \"localstorage\";\n\n/** In-memory adapter/strategy name. */\nexport const STORAGE_NAME_MEMORY = \"memory\";\n\n/** Name of the storage adapter that keeps nothing. */\nexport const STORAGE_NAME_NONE = \"none\";\n\n// ----------------------------------\n// Retry\n// ----------------------------------\n\n/**\n * Origin-wide lock name a drain runs under.\n * @see {@link EMERGENCY_LOCK_NAME}\n */\nexport const DRAIN_LOCK_NAME = \"ui-observability.drain\";\n\n/**\n * Lock name startup recovery runs under.\n * @see {@link DRAIN_LOCK_NAME}\n */\nexport const EMERGENCY_LOCK_NAME = \"ui-observability.emergency\";\n\n/** Batches sent per drain tick. */\nexport const BATCHES_PER_DRAIN = 20;\n\n// ----------------------------------\n// Journey\n// ----------------------------------\n\n/** `sessionStorage` key for the current journey. */\nexport const JOURNEY_STORAGE_KEY = \"ui-observability.journey\";\n\n/**\n * Max journey name length in a token, in characters.\n * @see {@link JOURNEY_TOKEN_MAX_CHARS}\n */\nexport const JOURNEY_TOKEN_NAME_MAX_CHARS = 64;\n\n/**\n * Max length of a journey id from startJourney(), in characters. The token of a journey with this\n * id and a full name stays below the token limit.\n * @see {@link JOURNEY_TOKEN_MAX_CHARS}\n */\nexport const JOURNEY_ID_MAX_CHARS = 64;\n\n/**\n * Accepted journey id from startJourney(): letters, digits, \"_\", \".\", \":\" and \"-\". Each character\n * is one byte in UTF-8. A multibyte id makes the token larger than its limit.\n */\nexport const JOURNEY_ID_PATTERN = new RegExp(`^[\\\\w.:-]{1,${String(JOURNEY_ID_MAX_CHARS)}}$`);\n\n/**\n * Time that the start of a journey token can be ahead of this clock, in milliseconds. Two machines\n * can disagree on the time. A token further ahead never expires.\n */\nexport const JOURNEY_CLOCK_SKEW_MS = 5 * 60 * 1000;\n\n/**\n * Max whole-token length, in characters. It rejects an oversized token. It does not\n * validate the token content.\n * @see {@link JOURNEY_TOKEN_NAME_MAX_CHARS}\n */\nexport const JOURNEY_TOKEN_MAX_CHARS = 256;\n\n/**\n * Time to wait for `fin.me.getOptions()`, in milliseconds. After this time, the\n * runtime continues without a seeded journey.\n * @see {@link OPENFIN_JOURNEY_CUSTOM_DATA_KEY}\n */\nexport const OPENFIN_OPTIONS_TIMEOUT_MS = 2000;\n\n/** Key under an OpenFin window's `customData` carrying a seeded journey token. */\nexport const OPENFIN_JOURNEY_CUSTOM_DATA_KEY = \"uiObsJourney\";\n\n/** Matches `+` in standard base64 (`-` in URL-safe). */\nexport const BASE64_PLUS_PATTERN = /\\+/g;\n\n/** Matches `/` in standard base64 (`_` in URL-safe). */\nexport const BASE64_SLASH_PATTERN = /\\//g;\n\n/** Matches trailing `=` padding. */\nexport const BASE64_PADDING_PATTERN = /=+$/;\n\n/** Matches `-` in URL-safe base64 (`+` in standard). */\nexport const BASE64URL_DASH_PATTERN = /-/g;\n\n/** Matches `_` in URL-safe base64 (`/` in standard). */\nexport const BASE64URL_UNDERSCORE_PATTERN = /_/g;\n\n/** Base64 characters per 3-byte group. */\nexport const BASE64_GROUP_CHARS = 4;\n\n// ----------------------------------\n// Tracing\n// ----------------------------------\n\n/** W3C trace id width, in bytes. */\nexport const TRACE_ID_BYTES = 16;\n\n/** W3C span id width, in bytes. */\nexport const SPAN_ID_BYTES = 8;\n\n/** Max ambient trace lifetime with no activity, in milliseconds. */\nexport const TRACE_MAX_AGE_MS = 5 * 60 * 1000;\n\n/** trace-flags value with the sampled bit set. */\nexport const TRACE_FLAGS_SAMPLED = 1;\n\n/** Mask for the one-byte trace-flags field. */\nexport const TRACE_FLAGS_MASK = 0xff;\n\n/**\n * W3C trace context header name\n * @see {@link TRACEPARENT_VERSION}\n */\nexport const TRACEPARENT_HEADER = \"traceparent\";\n\n/** traceparent header version prefix. */\nexport const TRACEPARENT_VERSION = \"00\";\n\n// ----------------------------------\n// Breadcrumbs\n// ----------------------------------\n\n/** Smallest valid breadcrumb buffer capacity. */\nexport const BREADCRUMB_MIN_CAPACITY = 1;\n\n// ----------------------------------\n// Sampling\n// ----------------------------------\n//\n// FNV-1a hash constants. The sampler uses them to change a sampling key into a\n// stable 0-1 fraction.\n\n/** FNV-1a 32-bit offset basis. */\nexport const FNV_OFFSET_BASIS = 0x811c9dc5;\n\n/** FNV-1a 32-bit prime. */\nexport const FNV_PRIME = 0x01000193;\n\n/** Largest 32-bit unsigned value. */\nexport const UINT32_MAX = 0xffffffff;\n\n/**\n * Types that minLevel does not drop. An action is an audit fact. A metric and a span are measurements.\n * The remote rate cap for records below minLevel does not apply to them.\n */\nexport const LEVEL_BYPASS_TYPES: readonly LogType[] = [\"action\", \"metric\", \"span\"];\n\n// ----------------------------------\n// Pipeline\n// ----------------------------------\n\n/** Record kind routed to the metric stream. */\nexport const LOG_TYPE_METRIC: LogType = \"metric\";\n\n/** Record kind of an audit fact. Storage and the hold buffers drop it last. */\nexport const LOG_TYPE_ACTION: LogType = \"action\";\n\n/** Record kind routed to the trace stream. */\nexport const LOG_TYPE_SPAN: LogType = \"span\";\n\n// ----------------------------------\n// Bus\n// ----------------------------------\n\n/** Protocol identifier for bus envelopes. The bus drops an envelope with a different version. */\nexport const BUS_PROTOCOL = \"ui-observability/2\";\n\n/**\n * Type tag of each bus message. Every frame must use the same values. The prefix makes a message\n * easy to identify in a postMessage log. The envelope tag BUS_PROTOCOL still separates the bus\n * from other traffic.\n */\nexport const BUS_TYPE = {\n hello: \"ui-observability.message.hello\",\n welcome: \"ui-observability.message.welcome\",\n records: \"ui-observability.message.records\",\n securityContext: \"ui-observability.message.security-context\",\n journey: \"ui-observability.message.journey\",\n journeyRequest: \"ui-observability.message.journey-request\",\n sampling: \"ui-observability.message.sampling\",\n samplingRequest: \"ui-observability.message.sampling-request\",\n tab: \"ui-observability.message.tab\",\n} as const;\n\n/** Global window property key used to locate a same-origin runtime instance. */\nexport const RUNTIME_GLOBAL_KEY = \"ui-observability.runtime\";\n\n/** Global key of the runtime that shutdown() stopped. Calls go to it until the next configure(). */\nexport const RUNTIME_STOPPED_KEY = \"ui-observability.stopped\";\n\n/** Global symbol key of the library request scope count. All library copies on a page share it. */\nexport const LIBRARY_REQUEST_KEY = \"ui-observability.request-scope\";\n\n/** Global symbol key of the library console scope count. All library copies on a page share it. */\nexport const LIBRARY_CONSOLE_KEY = \"ui-observability.console-scope\";\n\n/** Global symbol key of the count of custom transport calls that wait for an answer. */\nexport const TRANSPORT_CALL_KEY = \"ui-observability.transport-calls\";\n\n// ----------------------------------\n// Capture\n// ----------------------------------\n\n/** Maximum error records captured per throttling window before suppression. */\nexport const ERROR_STORM_MAX_PER_WINDOW = 20;\n\n/** Error rate-limiting window duration in milliseconds. */\nexport const ERROR_STORM_WINDOW_MS = 10_000;\n\n/**\n * Max ERROR and FATAL records that the pipeline admits in each storm window.\n * It is a safety limit for a render loop. It does not shape normal traffic.\n * ERROR and FATAL records skip sampling. A direct logger.error call has no other limit.\n */\nexport const ERROR_CEILING_MAX_PER_WINDOW = 500;\n\n/** Default minimum duration of a long frame that the library records, in milliseconds. */\nexport const LONG_FRAME_THRESHOLD_MS = 100;\n\n/** Maximum long frames recorded in each storm window. A frozen tab cannot flood the pipeline. */\nexport const LONG_FRAME_MAX_PER_WINDOW = 20;\n\n/** Maximum WebSocket events recorded in each storm window. A reconnect loop cannot flood the pipeline. */\nexport const WEBSOCKET_MAX_PER_WINDOW = 20;\n\n/** Maximum character length of a console breadcrumb message. */\nexport const CONSOLE_BREADCRUMB_MAX_CHARS = 200;\n\n/** Maximum distinct error signatures tracked for deduplication before LRU eviction. */\nexport const MAX_TRACKED_ERROR_SIGNATURES = 200;\n\n/** Maximum character length retained from clicked element text in breadcrumbs. */\nexport const CLICK_TEXT_MAX_CHARS = 50;\n\n/** Attribute that names a click action when the app sets no other attribute. */\nexport const ACTION_ATTRIBUTE_DEFAULT = \"data-observability-action\";\n\n/** Clicks on one element that make a rage click, by default. */\nexport const RAGE_CLICK_COUNT = 3;\n\n/** Time in which the clicks of a rage click occur, in milliseconds, by default. */\nexport const RAGE_CLICK_WINDOW_MS = 1000;\n\n/** Wait for a visible response to a click before it counts as a dead click, in milliseconds. */\nexport const DEAD_CLICK_MS = 1000;\n\n/** Controls whose click must give a visible response. Only these get a dead click check. */\nexport const DEAD_CLICK_CONTROLS =\n 'a, button, summary, input[type=\"button\"], input[type=\"submit\"], input[type=\"reset\"], [role=\"button\"], [role=\"link\"], [role=\"menuitem\"], [role=\"tab\"]';\n\n/** Maximum character length retained from an aria-label attribute in generated selectors. */\nexport const ARIA_LABEL_MAX_CHARS = 40;\n\n/** Maximum class names included per element in generated CSS selectors. */\nexport const SELECTOR_MAX_CLASSES = 2;\n\n/** Default CSS of the console prefix. The colors are readable on light and dark devtools. */\nexport const CONSOLE_DEFAULT_STYLES: Readonly<Required<ConsoleStyles>> = {\n namespace: \"color:#888\",\n TRACE: \"color:#888;font-weight:bold\",\n DEBUG: \"color:#888;font-weight:bold\",\n INFO: \"color:#1e6fd9;font-weight:bold\",\n WARN: \"color:#c77700;font-weight:bold\",\n ERROR: \"color:#d32f2f;font-weight:bold\",\n FATAL: \"color:#d32f2f;font-weight:bold\",\n};\n\n/** Scaling factor for rounding duration measurements to three decimal places. */\nexport const DURATION_PRECISION = 1000;\n\n// ----------------------------------\n// Runtime\n// ----------------------------------\n\n/** Minimum duration in milliseconds between storage gap warning reports. */\nexport const GAP_REPORT_THROTTLE_MS = 60_000;\n\n/** Default namespace for telemetry records emitted by auto-capture modules. */\nexport const CAPTURE_NAMESPACE = \"uiobs.capture\";\n\n/** Default namespace for telemetry records emitted by storage subsystems. */\nexport const STORAGE_NAMESPACE = \"uiobs.storage\";\n\n/** Namespace of the records that `diagnostics.records` gives. */\nexport const DIAGNOSTICS_NAMESPACE = \"uiobs.diagnostics\";\n\n/** Measurement unit that the library uses when the call gives no unit. */\nexport const DEFAULT_METRIC_UNIT = \"count\";\n\n/** Namespace of the points that the counter and histogram instruments give. */\nexport const METRIC_NAMESPACE = \"uiobs.metrics\";\n\n/** Maximum attribute sets of one instrument in one interval. More sets go to one overflow set. */\nexport const METRIC_MAX_SERIES = 100;\n\n/** Maximum bucket boundaries of one histogram. More boundaries make a large point. */\nexport const METRIC_MAX_BOUNDARIES = 50;\n\n/** Attribute of the overflow set. OpenTelemetry uses the same key. */\nexport const ATTR_METRIC_OVERFLOW = \"otel.metric.overflow\";\n\n/** Default histogram boundaries. They are the OpenTelemetry default boundaries. */\nexport const METRIC_DEFAULT_BOUNDARIES: readonly number[] = [\n 0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000,\n];\n\n/**\n * Attribute keys of an aggregated metric point. The OTLP metrics serializer reads them.\n * Sampling keeps each record with a start time. A sample of a sum gives a false sum.\n */\nexport const METRIC_KEYS = {\n start: \"metric.start_time_unix_nano\",\n attributeKeys: \"metric.attribute_keys\",\n count: \"metric.count\",\n sum: \"metric.sum\",\n min: \"metric.min\",\n max: \"metric.max\",\n bounds: \"metric.bounds\",\n buckets: \"metric.bucket_counts\",\n} as const;\n\n/** Namespace of the span records. */\nexport const TRACE_NAMESPACE = \"uiobs.traces\";\n\n/** Attribute keys of the span fields of a span record. The traces serializer reads them. */\nexport const SPAN_KEYS = {\n kind: \"span.kind\",\n parentId: \"span.parent_id\",\n start: \"span.start_time_unix_nano\",\n end: \"span.end_time_unix_nano\",\n status: \"span.status\",\n linkTraceId: \"span.link.trace_id\",\n linkSpanId: \"span.link.span_id\",\n} as const;\n\n// ----------------------------------\n// Configuration\n// ----------------------------------\n\n/** Protocol of the private transport worker channel. */\nexport const TRANSPORT_WORKER_PROTOCOL = \"ui-observability.transport/1\";\n\n/** Type tags of the private transport worker messages. */\nexport const TRANSPORT_WORKER_TYPE = {\n connect: \"connect\",\n ready: \"ready\",\n send: \"send\",\n result: \"result\",\n cancel: \"cancel\",\n} as const;\n\n/** Refusal of the worker entry. A constant keeps the protocol code out of the main chunk. */\nexport const TRANSPORT_WORKER_REFUSAL = {\n p: TRANSPORT_WORKER_PROTOCOL,\n v: TELEMETRY_SDK_VERSION,\n t: TRANSPORT_WORKER_TYPE.ready,\n ok: false,\n} as const;\n\n/** Maximum requests in one transport worker. */\nexport const TRANSPORT_WORKER_MAX_JOBS = 64;\n\n/** Maximum wait for idle time before the deferred logger builds its records. */\nexport const DEFER_IDLE_TIMEOUT_MS = 1000;\n\n/** Maximum pending payload references of one runtime. A full queue builds its records first. */\nexport const DEFER_QUEUE_LIMIT = 1000;\n\n/** Default minimum duration of a slow resource event, in milliseconds. */\nexport const RESOURCE_SLOW_MS = 1000;\n\n/** Response header with server duration entries. */\nexport const SERVER_TIMING_HEADER = \"Server-Timing\";\n\n/** Maximum Server-Timing header length and entry count. */\nexport const SERVER_TIMING_MAX_CHARS = 4096;\nexport const SERVER_TIMING_MAX_ENTRIES = 32;\n\n/** Capture switches that a remote rule can change. Privacy controls stay local. */\nexport const REMOTE_CAPTURE_FLAGS = [\n \"errors\",\n \"rejections\",\n \"resourceErrors\",\n \"fetch\",\n \"xhr\",\n \"httpMetrics\",\n \"navigation\",\n \"webVitals\",\n \"longFrames\",\n \"interactions\",\n \"console\",\n \"webSocket\",\n \"uncleanExit\",\n \"userTiming\",\n \"serverTiming\",\n \"reports\",\n \"resourceTiming\",\n \"lifecycle\",\n] as const;\n\n/** Default `service.name` when a consumer sets none. */\nexport const UNKNOWN_SERVICE_NAME = \"unknown-service\";\n\n/** Lowest sampling rate (drop everything). */\nexport const SAMPLING_RATE_MIN = 0;\n\n/** Highest sampling rate (keep everything). */\nexport const SAMPLING_RATE_MAX = 1;\n\n/**\n * Fallback for an invalid sampling rate (keep everything).\n * @see {@link SAMPLING_RATE_MAX}\n */\nexport const SAMPLING_RATE_FALLBACK = 1;\n\n/** Version of the remote sampling rules that the library accepts. */\nexport const REMOTE_SAMPLING_VERSION = 1;\n\n/** Maximum length of the sampling header, in characters. */\nexport const REMOTE_SAMPLING_MAX_CHARS = 4096;\n\n/** Maximum time that remote sampling rules stay in force, in milliseconds. */\nexport const REMOTE_SAMPLING_MAX_TTL_MS = 60 * 60 * 1000;\n\n/** Maximum namespace rates in one set of remote sampling rules. */\nexport const REMOTE_SAMPLING_MAX_RATES = 100;\n\n/** Time between two requests of a forwarder for the remote sampling rules, in milliseconds. */\nexport const REMOTE_SAMPLING_POLL_MS = 30_000;\n\n/**\n * Config keys with no default, excluded from `DEFAULT_CONFIG`.\n * @see {@link DEFAULT_CONFIG}\n */\nexport const UNDEFAULTED_CONFIG_KEYS = [\n \"contextProvider\",\n \"redact\",\n \"onDiagnostic\",\n \"onDrop\",\n \"headers\",\n \"serializer\",\n \"otelLoader\",\n \"transport\",\n \"transportOnExit\",\n \"transportWorker\",\n] as const;\n\n/**\n * Nested config section keys.\n * @see {@link ResolvedConfig}\n */\nexport const CONFIG_SECTIONS = [\n \"capturePolicy\",\n \"metadata\",\n \"persistence\",\n \"diagnostics\",\n \"correlation\",\n \"metrics\",\n \"buffering\",\n \"delivery\",\n \"loggerCache\",\n \"securityContext\",\n \"sampling\",\n \"bus\",\n \"journey\",\n \"batching\",\n \"retention\",\n \"limits\",\n \"capture\",\n \"debugBuffer\",\n] as const;\n\n/**\n * Section keys with no default, excluded from their section of `DEFAULT_CONFIG`.\n * @see {@link UNDEFAULTED_CONFIG_KEYS}\n */\nexport const UNDEFAULTED_SECTION_KEYS: Record<(typeof CONFIG_SECTIONS)[number], string[]> = {\n capturePolicy: [],\n metadata: [],\n persistence: [],\n diagnostics: [],\n correlation: [],\n metrics: [],\n buffering: [],\n delivery: [],\n loggerCache: [],\n securityContext: [],\n sampling: [],\n bus: [],\n journey: [],\n batching: [],\n retention: [],\n limits: [],\n capture: [\"webVitalsLoader\", \"urlTransform\"],\n debugBuffer: [],\n};\n\n/** Console mirroring level used when a consumer passes `console: true`. */\nexport const CONSOLE_DEFAULT_LEVEL: LogLevel = \"DEBUG\";\n\n// ----------------------------------\n// Batching\n// ----------------------------------\n\n/** Max time a partial log batch waits before the pipeline sends it, in milliseconds. */\nexport const LOG_FLUSH_INTERVAL_MS = 2000;\n\n/** Max records per log batch. At this count, the pipeline sends the batch early. */\nexport const LOG_BATCH_SIZE = 100;\n\n/**\n * Max time a partial metric batch waits before the pipeline sends it, in milliseconds.\n * Metric batches wait longer than log batches. Metrics have a higher volume, and no\n * caller waits for them.\n */\nexport const METRIC_FLUSH_INTERVAL_MS = 10_000;\n\n/** Max records per metric batch. At this count, the pipeline sends the batch early. */\nexport const METRIC_BATCH_SIZE = 500;\n\n/** Max concurrent ingest requests, across both streams. */\nexport const MAX_CONCURRENT_REQUESTS = 2;\n\n// ----------------------------------\n// HTTP transport\n// ----------------------------------\n\n/** Max time for one ingest request, in milliseconds. Then the transport aborts and retries it. */\nexport const REQUEST_TIMEOUT_MS = 15_000;\n\n/** Min payload size to compress, in bytes. */\nexport const COMPRESSION_THRESHOLD_BYTES = 1024;\n\n// ----------------------------------\n// Storage retention\n// ----------------------------------\n\n/** IndexedDB database name. */\nexport const STORAGE_DB_NAME = \"UiObservability\";\n\n/** Capacity and retention thresholds every storage adapter enforces. */\nexport const STORAGE_LIMITS: StorageLimits = {\n maxBatches: 500,\n maxAgeMs: 24 * 60 * 60 * 1000,\n maxAttempts: 5,\n};\n\n/**\n * Max time for one storage call, in milliseconds. Then the library treats the call as failed.\n * A call that does not settle keeps a dispatch slot or the drain flag.\n */\nexport const STORAGE_DEADLINE_MS = 10_000;\n\n// ----------------------------------\n// Retry backoff\n// ----------------------------------\n\n/** First backoff step, in milliseconds. Each attempt doubles it. */\nexport const RETRY_BASE_DELAY_MS = 2000;\n\n/** Backoff ceiling, in milliseconds. */\nexport const RETRY_MAX_DELAY_MS = 60_000;\n\n/** How often to check for stored work when nothing has failed recently, in milliseconds. */\nexport const RETRY_IDLE_DELAY_MS = 30_000;\n\n// ----------------------------------\n// Journey lifetime\n// ----------------------------------\n\n/** Max time a journey stays open, in milliseconds. Then the library treats it as abandoned. */\nexport const JOURNEY_MAX_AGE_MS = 30 * 60 * 1000;\n\n/** True if the journey ends for all contexts when the owning context closes. */\nexport const JOURNEY_END_ON_OWNER_CLOSE = false;\n\n/** Query parameter checked at boot for a seeded journey token. */\nexport const JOURNEY_URL_PARAM = \"__uiobs_journey\";\n\n// ----------------------------------\n// Bus handshake\n// ----------------------------------\n\n/** BroadcastChannel name for the control plane. */\nexport const BUS_CHANNEL_NAME = \"ui_observability_control\";\n\n/** Max time a forwarder waits for an owner to answer before it promotes itself, in milliseconds. */\nexport const BUS_HANDSHAKE_TIMEOUT_MS = 1500;\n\n/** Handshake attempts allowed before a cross-origin forwarder promotes itself to sender. */\nexport const BUS_MAX_HANDSHAKE_ATTEMPTS = 3;\n\n/** Max records that are not actions in one hold buffer. A full buffer drops the oldest. */\nexport const BUS_MAX_BOOT_BUFFER_RECORDS = 500;\n\n/** Max action records in one hold buffer. Actions have their own cap. A log storm cannot push one out. */\nexport const BUS_MAX_BOOT_BUFFER_ACTIONS = 2000;\n\n/** Max different values in each list of an onDrop summary. */\nexport const DROP_SUMMARY_MAX_ITEMS = 20;\n\n/**\n * Max characters of an untrusted message type in a diagnostic detail. The sender sets the text.\n * The longest BUS_TYPE value has 41 characters. Each valid type then fits.\n */\nexport const BUS_TYPE_DETAIL_MAX_CHARS = 48;\n\n// ----------------------------------\n// Capture\n// ----------------------------------\n\n/** Breadcrumbs kept as context for the next error. */\nexport const MAX_BREADCRUMBS = 50;\n\n/**\n * Time window in which the library counts identical errors but does not send them again,\n * in milliseconds.\n */\nexport const ERROR_DEDUPE_MS = 5000;\n\n// ----------------------------------\n// Per-record size caps\n// ----------------------------------\n\n/** Size caps for every record. The library applies them after sanitize and after redact. */\nexport const RECORD_LIMITS = {\n maxBodyChars: 4096,\n maxAttributeChars: 8192,\n maxAttributeCount: 128,\n maxStackChars: 8192,\n maxDepth: 6,\n maxArrayLength: 100,\n maxNodes: 10_000,\n maxRecordBytes: 32_768,\n};\n\n// ----------------------------------\n// Config defaults\n// ----------------------------------\n\n/**\n * Default runtime config before the consumer calls `configure()`. It excludes `serializer`.\n * `resolveConfig` supplies that default to prevent a circular import.\n * It comes after the constants that it reads. A const cannot be read before its line.\n * @see {@link ResolvedConfig}\n * @see {@link UNDEFAULTED_CONFIG_KEYS}\n */\nexport const DEFAULT_CONFIG: Omit<ResolvedConfig, \"serializer\"> = {\n capturePolicy: {\n breadcrumbs: MAX_BREADCRUMBS,\n errorDedupeMs: ERROR_DEDUPE_MS,\n maxErrorSignatures: MAX_TRACKED_ERROR_SIGNATURES,\n errorsPerWindow: 20,\n consolePerWindow: 20,\n longFramesPerWindow: 20,\n webSocketPerWindow: 20,\n reportsPerWindow: 20,\n resourcesPerWindow: 100,\n lifecyclePerWindow: 20,\n windowMs: 10000,\n errorCeiling: ERROR_CEILING_MAX_PER_WINDOW,\n },\n metadata: { pageUrl: true, userAgent: true, openfin: true, clockOffset: true },\n debugBuffer: { enabled: false, maxRecords: 200, maxAgeMs: 60_000 },\n persistence: { namespace: \"\", requestPersistent: false },\n diagnostics: { throttleMs: 1000, consoleFallback: false, records: false },\n correlation: {\n sessionIdleMs: SESSION_IDLE_MS,\n sessionTouchMs: SESSION_TOUCH_MS,\n traceMaxAgeMs: TRACE_MAX_AGE_MS,\n },\n metrics: {\n maxSeries: METRIC_MAX_SERIES,\n maxInstruments: 1000,\n maxHistogramBoundaries: METRIC_MAX_BOUNDARIES,\n },\n buffering: { maxPendingRecords: 10000, maxPendingBytes: 16777216, overflow: \"drop-oldest\" },\n delivery: {\n requestTimeoutMs: REQUEST_TIMEOUT_MS,\n maxConcurrentRequests: MAX_CONCURRENT_REQUESTS,\n retryBaseDelayMs: RETRY_BASE_DELAY_MS,\n retryMaxDelayMs: RETRY_MAX_DELAY_MS,\n retryIdleDelayMs: RETRY_IDLE_DELAY_MS,\n batchesPerDrain: BATCHES_PER_DRAIN,\n priority: \"low\",\n },\n lockConfiguration: false,\n loggerCache: { maxEntries: 256 },\n securityContext: { id: \"\", isolation: true },\n endpoint: \"\",\n metricsEndpoint: \"\",\n tracesEndpoint: \"\",\n serviceName: \"\",\n serviceVersion: \"\",\n environment: \"\",\n enabled: true,\n payloadMode: \"copy\",\n minLevel: \"INFO\",\n minLevels: {},\n processors: [],\n compression: \"gzip\",\n credentials: \"omit\",\n storage: \"auto\",\n identity: \"storage\",\n sampling: {\n defaultRate: 1,\n rates: {},\n alwaysSampleTypes: [\"action\"],\n alwaysSampleFrom: \"ERROR\",\n remote: false,\n remoteMaxRate: 1,\n },\n bus: {\n mode: \"auto\",\n trustedOrigins: [],\n openFinRole: \"auto\",\n sourcePolicy: \"registered\",\n validation: \"strict\",\n maxMessageBytes: 262144,\n maxRecordsPerMessage: 100,\n maxMessagesPerSecond: 100,\n maxTrackedSources: 256,\n },\n journey: { scope: \"auto\", maxAgeMs: JOURNEY_MAX_AGE_MS },\n batching: {\n logFlushIntervalMs: LOG_FLUSH_INTERVAL_MS,\n logBatchSize: LOG_BATCH_SIZE,\n metricFlushIntervalMs: METRIC_FLUSH_INTERVAL_MS,\n metricBatchSize: METRIC_BATCH_SIZE,\n },\n retention: { mode: \"limited\", ...STORAGE_LIMITS },\n limits: { ...RECORD_LIMITS },\n capture: {\n errors: true,\n rejections: true,\n resourceErrors: false,\n fetch: false,\n xhr: false,\n httpMetrics: true,\n interactions: false,\n navigation: false,\n webVitals: false,\n longFrames: false,\n longFrameThresholdMs: LONG_FRAME_THRESHOLD_MS,\n console: false,\n fullUrls: false,\n ignoreUrls: [],\n propagateTraceHeaderTo: [],\n webSocket: false,\n uncleanExit: false,\n userTiming: false,\n remoteToggles: [],\n serverTiming: false,\n reports: false,\n resourceTiming: false,\n lifecycle: false,\n userTimingInclude: [],\n plugins: [],\n },\n console: { level: null, styles: CONSOLE_DEFAULT_STYLES },\n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;CACV,WAAW,CAAC;CACZ,YAAY,CAAC;CACb,aAAa;CACb,aAAa;CACb,SAAS;CACT,UAAU;CACV,UAAU;EACR,aAAa;EACb,OAAO,CAAC;EACR,mBAAmB,CAAC,QAAQ;EAC5B,kBAAkB;EAClB,QAAQ;EACR,eAAe;CACjB;CACA,KAAK;EACH,MAAM;EACN,gBAAgB,CAAC;EACjB,aAAa;EACb,cAAc;EACd,YAAY;EACZ,iBAAiB;EACjB,sBAAsB;EACtB,sBAAsB;EACtB,mBAAmB;CACrB;CACA,SAAS;EAAE,OAAO;EAAQ,UAAUC;CAAmB;CACvD,UAAU;EACR,oBAAoBV;EACpB,cAAA;EACA,uBAAuBC;EACvB,iBAAA;CACF;CACA,WAAW;EAAE,MAAM;EAAW,GAAGI;CAAe;CAChD,QAAQ,EAAE,GAAGW,EAAc;CAC3B,SAAS;EACP,QAAQ;EACR,YAAY;EACZ,gBAAgB;EAChB,OAAO;EACP,KAAK;EACL,aAAa;EACb,cAAc;EACd,YAAY;EACZ,WAAW;EACX,YAAY;EACZ,sBAAA;EACA,SAAS;EACT,UAAU;EACV,YAAY,CAAC;EACb,wBAAwB,CAAC;EACzB,WAAW;EACX,aAAa;EACb,YAAY;EACZ,eAAe,CAAC;EAChB,cAAc;EACd,SAAS;EACT,gBAAgB;EAChB,WAAW;EACX,mBAAmB,CAAC;EACpB,SAAS,CAAC;CACZ;CACA,SAAS;EAAE,OAAO;EAAM,QAAQ9C;CAAuB;AACzD"}
@@ -1,2 +0,0 @@
1
- var e=class{store;policy;namespace;name;active=!0;discard=!1;constructor(e,t,n=``){this.store=e,this.policy=t,this.namespace=n,this.name=e.name}accepts(e){return(e.persistenceNamespace??``)===this.namespace&&(!this.policy.isolation||!this.policy.id||e.routingContextId===this.policy.id)}async save(e){this.active&&this.accepts(e)&&(await this.store.save(e),this.discard&&await this.store.remove(e.id))}async take(e){return this.isolated()?this.store.takeContext?this.store.takeContext(this.policy.id,e):(await this.store.take(4294967295)).filter(e=>this.accepts(e)).slice(0,e):(await this.store.take(e)).filter(e=>this.accepts(e))}isolated(){return this.policy.isolation&&this.policy.id!==``}remove(e){return this.store.remove(e)}bumpAttempts(e,t){return this.store.bumpAttempts(e,t)}prune(){return this.store.prune()}async count(){return this.isolated()?this.store.countContext?this.store.countContext(this.policy.id):(await this.take(2**53-1)).length:this.store.count()}async clear(){for(let e of await this.take(2**53-1))await this.store.remove(e.id)}async retire(e){this.active=!1,this.discard=e,e&&await this.clear(),this.name!==`memory`&&await this.close()}clearNamespace(){return this.store.clear()}close(){return this.store.close()}};exports.ContextStorage=e;
2
- //# sourceMappingURL=context-storage-BjzeBSxH.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context-storage-BjzeBSxH.cjs","names":["ContextStorage","store","policy","namespace","batch","limit","id","attempts","discard"],"sources":["../src/storage/context-storage.ts"],"sourcesContent":["// src/storage/context-storage.ts\n//\n// Gives access to stored batches of one delivery context and one application namespace.\n\nimport type { SecurityContextOptions } from \"../models/config\";\nimport type { LogBatch } from \"../models/batch\";\nimport type { StorageAdapter } from \"../models/storage\";\n\n/** Gives access to one part of the shared store. Records of other contexts stay stored. */\nexport class ContextStorage implements StorageAdapter {\n /** Adapter name of the underlying store. */\n readonly name: string;\n /** False after this context store stops accepting writes. */\n private active = true;\n /** True if a late save must remove its batch after it completes. */\n private discard = false;\n\n /**\n * Builds access to one application namespace and delivery context.\n * @param store Underlying batch store.\n * @param policy Active context id and isolation rule.\n * @param namespace Application storage namespace.\n */\n constructor(\n private readonly store: StorageAdapter,\n private readonly policy: SecurityContextOptions,\n readonly namespace = \"\",\n ) {\n this.name = store.name;\n }\n\n /**\n * Checks if a batch belongs to the permitted namespace and context.\n * @param batch Batch to check.\n * @returns True if this adapter can accept the batch.\n */\n accepts(batch: LogBatch): boolean {\n return (\n (batch.persistenceNamespace ?? \"\") === this.namespace &&\n (!this.policy.isolation || !this.policy.id || batch.routingContextId === this.policy.id)\n );\n }\n\n /**\n * Stores a batch of this context. A late save removes its batch after a discard.\n * @param batch Batch to store.\n * @returns Promise that resolves when the save and any removal complete.\n */\n async save(batch: LogBatch): Promise<void> {\n if (!this.active || !this.accepts(batch)) return;\n await this.store.save(batch);\n // A slow save can complete after the context change cleared these records.\n if (this.discard) await this.store.remove(batch.id);\n }\n\n /**\n * Reads stored batches of this context, oldest first.\n * @param limit Maximum batches to return.\n * @returns Batches in creation order. The method does not remove them.\n */\n async take(limit: number): Promise<LogBatch[]> {\n // Read only this part of the store. A full read on each retry pass parses all contexts.\n if (!this.isolated()) {\n return (await this.store.take(limit)).filter((batch) => this.accepts(batch));\n }\n\n if (this.store.takeContext) {\n return this.store.takeContext(this.policy.id, limit);\n }\n\n const all = await this.store.take(0xffffffff);\n return all.filter((batch) => this.accepts(batch)).slice(0, limit);\n }\n\n /**\n * Checks if reads are limited to the active context.\n * @returns True if isolation is on and the context has an id.\n */\n private isolated(): boolean {\n return this.policy.isolation && this.policy.id !== \"\";\n }\n\n /**\n * Removes one stored batch.\n * @param id Batch id.\n * @returns Promise that resolves when removal completes.\n */\n remove(id: string): Promise<void> {\n return this.store.remove(id);\n }\n\n /**\n * Changes the attempt count of a stored batch.\n * @param id Batch id.\n * @param attempts Total attempt count to store.\n * @returns Promise that resolves when the change completes.\n */\n bumpAttempts(id: string, attempts: number): Promise<void> {\n return this.store.bumpAttempts(id, attempts);\n }\n\n /**\n * Applies the retention and capacity limits of the underlying store.\n * @returns Summary of the batches and records removed.\n */\n prune(): ReturnType<StorageAdapter[\"prune\"]> {\n return this.store.prune();\n }\n\n /**\n * Counts stored batches of this context.\n * @returns Number of batches in this context.\n */\n async count(): Promise<number> {\n if (!this.isolated()) {\n return this.store.count();\n }\n\n if (this.store.countContext) {\n return this.store.countContext(this.policy.id);\n }\n\n return (await this.take(Number.MAX_SAFE_INTEGER)).length;\n }\n\n /**\n * Removes stored batches of this context.\n * @returns Promise that resolves when removal completes.\n */\n async clear(): Promise<void> {\n for (const batch of await this.take(Number.MAX_SAFE_INTEGER)) await this.store.remove(batch.id);\n }\n\n /**\n * Stops new writes and clears this context if required. Other contexts can keep the memory store.\n * @param discard True to remove this context before closing the store.\n * @returns Promise that resolves when removal and closure complete.\n */\n async retire(discard: boolean): Promise<void> {\n this.active = false;\n this.discard = discard;\n if (discard) await this.clear();\n // Keep the memory store for later context changes. It can hold records of other contexts.\n if (this.name !== \"memory\") await this.close();\n }\n\n /**\n * Removes all batches in the application namespace.\n * @returns Promise that resolves when removal completes.\n */\n clearNamespace(): Promise<void> {\n return this.store.clear();\n }\n\n /**\n * Closes the underlying store.\n * @returns Promise that resolves when closure completes.\n */\n close(): Promise<void> {\n return this.store.close();\n }\n}\n"],"mappings":"AASA,IAAaA,EAAb,KAAsD,CAejC,MACA,OACR,UAfX,KAEA,OAAiB,GAEjB,QAAkB,GAQlB,YACE,EACA,EACA,EAAqB,GACrB,CAHiB,KAAA,MAAAC,EACA,KAAA,OAAAC,EACR,KAAA,UAAAC,EAET,KAAK,KAAOF,EAAM,IACpB,CAOA,QAAQ,EAA0B,CAChC,OACGG,EAAM,sBAAwB,MAAQ,KAAK,YAC3C,CAAC,KAAK,OAAO,WAAa,CAAC,KAAK,OAAO,IAAMA,EAAM,mBAAqB,KAAK,OAAO,GAEzF,CAOA,MAAM,KAAK,EAAgC,CACpC,KAAK,QAAW,KAAK,QAAQA,CAAK,IACvC,MAAM,KAAK,MAAM,KAAKA,CAAK,EAEvB,KAAK,SAAS,MAAM,KAAK,MAAM,OAAOA,EAAM,EAAE,EACpD,CAOA,MAAM,KAAK,EAAoC,CAW7C,OATK,KAAK,SAAS,EAIf,KAAK,MAAM,YACN,KAAK,MAAM,YAAY,KAAK,OAAO,GAAIC,CAAK,GAI9C,MADW,KAAK,MAAM,KAAK,UAAU,EAAA,CACjC,OAAQ,GAAU,KAAK,QAAQD,CAAK,CAAC,CAAC,CAAC,MAAM,EAAGC,CAAK,GARtD,MAAM,KAAK,MAAM,KAAKA,CAAK,EAAA,CAAG,OAAQ,GAAU,KAAK,QAAQD,CAAK,CAAC,CAS/E,CAMA,UAA4B,CAC1B,OAAO,KAAK,OAAO,WAAa,KAAK,OAAO,KAAO,EACrD,CAOA,OAAO,EAA2B,CAChC,OAAO,KAAK,MAAM,OAAOE,CAAE,CAC7B,CAQA,aAAa,EAAY,EAAiC,CACxD,OAAO,KAAK,MAAM,aAAaA,EAAIC,CAAQ,CAC7C,CAMA,OAA6C,CAC3C,OAAO,KAAK,MAAM,MAAM,CAC1B,CAMA,MAAM,OAAyB,CAS7B,OARK,KAAK,SAAS,EAIf,KAAK,MAAM,aACN,KAAK,MAAM,aAAa,KAAK,OAAO,EAAE,GAGvC,MAAM,KAAK,YAA4B,EAAA,CAAG,OAPzC,KAAK,MAAM,MAAM,CAQ5B,CAMA,MAAM,OAAuB,CAC3B,IAAK,IAAMH,KAAS,MAAM,KAAK,YAA4B,EAAG,MAAM,KAAK,MAAM,OAAOA,EAAM,EAAE,CAChG,CAOA,MAAM,OAAO,EAAiC,CAC5C,KAAK,OAAS,GACd,KAAK,QAAUI,EACXA,GAAS,MAAM,KAAK,MAAM,EAE1B,KAAK,OAAS,UAAU,MAAM,KAAK,MAAM,CAC/C,CAMA,gBAAgC,CAC9B,OAAO,KAAK,MAAM,MAAM,CAC1B,CAMA,OAAuB,CACrB,OAAO,KAAK,MAAM,MAAM,CAC1B,CACF,E"}
@@ -1,51 +0,0 @@
1
- // src/storage/context-storage.ts
2
- var e = class {
3
- store;
4
- policy;
5
- namespace;
6
- name;
7
- active = !0;
8
- discard = !1;
9
- constructor(e, t, n = "") {
10
- this.store = e, this.policy = t, this.namespace = n, this.name = e.name;
11
- }
12
- accepts(e) {
13
- return (e.persistenceNamespace ?? "") === this.namespace && (!this.policy.isolation || !this.policy.id || e.routingContextId === this.policy.id);
14
- }
15
- async save(e) {
16
- this.active && this.accepts(e) && (await this.store.save(e), this.discard && await this.store.remove(e.id));
17
- }
18
- async take(e) {
19
- return this.isolated() ? this.store.takeContext ? this.store.takeContext(this.policy.id, e) : (await this.store.take(4294967295)).filter((e) => this.accepts(e)).slice(0, e) : (await this.store.take(e)).filter((e) => this.accepts(e));
20
- }
21
- isolated() {
22
- return this.policy.isolation && this.policy.id !== "";
23
- }
24
- remove(e) {
25
- return this.store.remove(e);
26
- }
27
- bumpAttempts(e, t) {
28
- return this.store.bumpAttempts(e, t);
29
- }
30
- prune() {
31
- return this.store.prune();
32
- }
33
- async count() {
34
- return this.isolated() ? this.store.countContext ? this.store.countContext(this.policy.id) : (await this.take(2 ** 53 - 1)).length : this.store.count();
35
- }
36
- async clear() {
37
- for (let e of await this.take(2 ** 53 - 1)) await this.store.remove(e.id);
38
- }
39
- async retire(e) {
40
- this.active = !1, this.discard = e, e && await this.clear(), this.name !== "memory" && await this.close();
41
- }
42
- clearNamespace() {
43
- return this.store.clear();
44
- }
45
- close() {
46
- return this.store.close();
47
- }
48
- };
49
- export { e as ContextStorage };
50
-
51
- //# sourceMappingURL=context-storage-BzkoHzkQ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context-storage-BzkoHzkQ.js","names":["ContextStorage","store","policy","namespace","batch","limit","id","attempts","discard"],"sources":["../src/storage/context-storage.ts"],"sourcesContent":["// src/storage/context-storage.ts\n//\n// Gives access to stored batches of one delivery context and one application namespace.\n\nimport type { SecurityContextOptions } from \"../models/config\";\nimport type { LogBatch } from \"../models/batch\";\nimport type { StorageAdapter } from \"../models/storage\";\n\n/** Gives access to one part of the shared store. Records of other contexts stay stored. */\nexport class ContextStorage implements StorageAdapter {\n /** Adapter name of the underlying store. */\n readonly name: string;\n /** False after this context store stops accepting writes. */\n private active = true;\n /** True if a late save must remove its batch after it completes. */\n private discard = false;\n\n /**\n * Builds access to one application namespace and delivery context.\n * @param store Underlying batch store.\n * @param policy Active context id and isolation rule.\n * @param namespace Application storage namespace.\n */\n constructor(\n private readonly store: StorageAdapter,\n private readonly policy: SecurityContextOptions,\n readonly namespace = \"\",\n ) {\n this.name = store.name;\n }\n\n /**\n * Checks if a batch belongs to the permitted namespace and context.\n * @param batch Batch to check.\n * @returns True if this adapter can accept the batch.\n */\n accepts(batch: LogBatch): boolean {\n return (\n (batch.persistenceNamespace ?? \"\") === this.namespace &&\n (!this.policy.isolation || !this.policy.id || batch.routingContextId === this.policy.id)\n );\n }\n\n /**\n * Stores a batch of this context. A late save removes its batch after a discard.\n * @param batch Batch to store.\n * @returns Promise that resolves when the save and any removal complete.\n */\n async save(batch: LogBatch): Promise<void> {\n if (!this.active || !this.accepts(batch)) return;\n await this.store.save(batch);\n // A slow save can complete after the context change cleared these records.\n if (this.discard) await this.store.remove(batch.id);\n }\n\n /**\n * Reads stored batches of this context, oldest first.\n * @param limit Maximum batches to return.\n * @returns Batches in creation order. The method does not remove them.\n */\n async take(limit: number): Promise<LogBatch[]> {\n // Read only this part of the store. A full read on each retry pass parses all contexts.\n if (!this.isolated()) {\n return (await this.store.take(limit)).filter((batch) => this.accepts(batch));\n }\n\n if (this.store.takeContext) {\n return this.store.takeContext(this.policy.id, limit);\n }\n\n const all = await this.store.take(0xffffffff);\n return all.filter((batch) => this.accepts(batch)).slice(0, limit);\n }\n\n /**\n * Checks if reads are limited to the active context.\n * @returns True if isolation is on and the context has an id.\n */\n private isolated(): boolean {\n return this.policy.isolation && this.policy.id !== \"\";\n }\n\n /**\n * Removes one stored batch.\n * @param id Batch id.\n * @returns Promise that resolves when removal completes.\n */\n remove(id: string): Promise<void> {\n return this.store.remove(id);\n }\n\n /**\n * Changes the attempt count of a stored batch.\n * @param id Batch id.\n * @param attempts Total attempt count to store.\n * @returns Promise that resolves when the change completes.\n */\n bumpAttempts(id: string, attempts: number): Promise<void> {\n return this.store.bumpAttempts(id, attempts);\n }\n\n /**\n * Applies the retention and capacity limits of the underlying store.\n * @returns Summary of the batches and records removed.\n */\n prune(): ReturnType<StorageAdapter[\"prune\"]> {\n return this.store.prune();\n }\n\n /**\n * Counts stored batches of this context.\n * @returns Number of batches in this context.\n */\n async count(): Promise<number> {\n if (!this.isolated()) {\n return this.store.count();\n }\n\n if (this.store.countContext) {\n return this.store.countContext(this.policy.id);\n }\n\n return (await this.take(Number.MAX_SAFE_INTEGER)).length;\n }\n\n /**\n * Removes stored batches of this context.\n * @returns Promise that resolves when removal completes.\n */\n async clear(): Promise<void> {\n for (const batch of await this.take(Number.MAX_SAFE_INTEGER)) await this.store.remove(batch.id);\n }\n\n /**\n * Stops new writes and clears this context if required. Other contexts can keep the memory store.\n * @param discard True to remove this context before closing the store.\n * @returns Promise that resolves when removal and closure complete.\n */\n async retire(discard: boolean): Promise<void> {\n this.active = false;\n this.discard = discard;\n if (discard) await this.clear();\n // Keep the memory store for later context changes. It can hold records of other contexts.\n if (this.name !== \"memory\") await this.close();\n }\n\n /**\n * Removes all batches in the application namespace.\n * @returns Promise that resolves when removal completes.\n */\n clearNamespace(): Promise<void> {\n return this.store.clear();\n }\n\n /**\n * Closes the underlying store.\n * @returns Promise that resolves when closure completes.\n */\n close(): Promise<void> {\n return this.store.close();\n }\n}\n"],"mappings":";AASA,IAAaA,IAAb,MAAsD;CAejC;CACA;CACR;CAfX;CAEA,SAAiB;CAEjB,UAAkB;CAQlB,YACE,GACA,GACA,IAAqB,IACrB;EACA,AAJiB,KAAA,QAAAC,GACA,KAAA,SAAAC,GACR,KAAA,YAAAC,GAET,KAAK,OAAOF,EAAM;CACpB;CAOA,QAAQ,GAA0B;EAChC,QACGG,EAAM,wBAAwB,QAAQ,KAAK,cAC3C,CAAC,KAAK,OAAO,aAAa,CAAC,KAAK,OAAO,MAAMA,EAAM,qBAAqB,KAAK,OAAO;CAEzF;CAOA,MAAM,KAAK,GAAgC;EACzC,AAAK,KAAK,UAAW,KAAK,QAAQA,CAAK,MACvC,MAAM,KAAK,MAAM,KAAKA,CAAK,GAEvB,KAAK,WAAS,MAAM,KAAK,MAAM,OAAOA,EAAM,EAAE;CACpD;CAOA,MAAM,KAAK,GAAoC;EAW7C,OATK,KAAK,SAAS,IAIf,KAAK,MAAM,cACN,KAAK,MAAM,YAAY,KAAK,OAAO,IAAIC,CAAK,KAI9C,MADW,KAAK,MAAM,KAAK,UAAU,EAAA,CACjC,QAAQ,MAAU,KAAK,QAAQD,CAAK,CAAC,CAAC,CAAC,MAAM,GAAGC,CAAK,KARtD,MAAM,KAAK,MAAM,KAAKA,CAAK,EAAA,CAAG,QAAQ,MAAU,KAAK,QAAQD,CAAK,CAAC;CAS/E;CAMA,WAA4B;EAC1B,OAAO,KAAK,OAAO,aAAa,KAAK,OAAO,OAAO;CACrD;CAOA,OAAO,GAA2B;EAChC,OAAO,KAAK,MAAM,OAAOE,CAAE;CAC7B;CAQA,aAAa,GAAY,GAAiC;EACxD,OAAO,KAAK,MAAM,aAAaA,GAAIC,CAAQ;CAC7C;CAMA,QAA6C;EAC3C,OAAO,KAAK,MAAM,MAAM;CAC1B;CAMA,MAAM,QAAyB;EAS7B,OARK,KAAK,SAAS,IAIf,KAAK,MAAM,eACN,KAAK,MAAM,aAAa,KAAK,OAAO,EAAE,KAGvC,MAAM,KAAK,gBAA4B,EAAA,CAAG,SAPzC,KAAK,MAAM,MAAM;CAQ5B;CAMA,MAAM,QAAuB;EAC3B,KAAK,IAAMH,KAAS,MAAM,KAAK,gBAA4B,GAAG,MAAM,KAAK,MAAM,OAAOA,EAAM,EAAE;CAChG;CAOA,MAAM,OAAO,GAAiC;EAK5C,AAJA,KAAK,SAAS,IACd,KAAK,UAAUI,GACXA,KAAS,MAAM,KAAK,MAAM,GAE1B,KAAK,SAAS,YAAU,MAAM,KAAK,MAAM;CAC/C;CAMA,iBAAgC;EAC9B,OAAO,KAAK,MAAM,MAAM;CAC1B;CAMA,QAAuB;EACrB,OAAO,KAAK,MAAM,MAAM;CAC1B;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"deadline-BOjOxNHj.js","names":["unrefTimer","timer","DeadlineError","ms","withDeadline","expire","deadline","work"],"sources":["../src/utils/unref.ts","../src/utils/deadline.ts"],"sourcesContent":["// src/utils/unref.ts\n//\n// Unreferences timer handles in Node and browser environments. A pending timer\n// keeps a Node process alive under SSR and in tests.\n\n/** Timer handle. It is a number in a browser and a Timeout object in Node. */\nexport type TimerHandle = number | { unref?: () => void };\n\n/**\n * Unreferences a timer handle. A pending timer then does not keep a Node.js process alive.\n * @param timer Timer handle returned by setTimeout.\n */\nexport function unrefTimer(timer: TimerHandle): void {\n if (typeof timer !== \"number\") {\n timer.unref?.();\n }\n}\n","// src/utils/deadline.ts\n//\n// Sets a deadline for a promise that can stay pending. A pending promise raises no\n// diagnostics event. Without a deadline, its caller waits forever and keeps its slot.\n\nimport { unrefTimer } from \"./unref\";\n\n/** Error of a promise that did not settle before its deadline. */\nexport class DeadlineError extends Error {\n /**\n * @param ms Deadline in milliseconds.\n */\n constructor(ms: number) {\n super(`The operation took longer than ${String(ms)} ms.`);\n this.name = \"DeadlineError\";\n }\n}\n\n/**\n * Rejects when a promise does not settle within a deadline.\n * @param work Promise to bound.\n * @param ms Deadline in milliseconds.\n * @returns The value of the promise, or a rejection after the deadline.\n */\nexport function withDeadline<T>(work: Promise<T>, ms: number): Promise<T> {\n let expire: ReturnType<typeof setTimeout> | undefined;\n\n const deadline = new Promise<never>((_resolve, reject) => {\n const timer = setTimeout(() => {\n reject(new DeadlineError(ms));\n }, ms);\n\n expire = timer;\n unrefTimer(timer);\n });\n\n // Clear the timer on success and on failure. If not, each storage call leaves an armed timer.\n return Promise.race([work, deadline]).finally(() => {\n clearTimeout(expire);\n });\n}\n"],"mappings":";AAYA,SAAgBA,EAAW,GAA0B;CACnD,AAAI,OAAOC,KAAU,YACnBA,EAAM,QAAQ;AAElB;;ACRA,IAAaC,IAAb,cAAmC,MAAM;CAIvC,YAAY,GAAY;EAEtB,AADA,MAAM,kCAAkC,OAAOC,CAAE,EAAE,KAAK,GACxD,KAAK,OAAO;CACd;AACF;AAQA,SAAgBC,EAAgB,GAAkB,GAAwB;CACxE,IAAIC,GAEEC,IAAW,IAAI,SAAgB,GAAU,MAAW;EACxD,IAAML,IAAQ,iBAAiB;GAC7B,EAAO,IAAIC,EAAcC,CAAE,CAAC;EAC9B,GAAGA,CAAE;EAGL,AADA,IAASF,GACTD,EAAWC,CAAK;CAClB,CAAC;CAGD,OAAO,QAAQ,KAAK,CAACM,GAAMD,CAAQ,CAAC,CAAC,CAAC,cAAc;EAClD,aAAaD,CAAM;CACrB,CAAC;AACH"}
@@ -1,2 +0,0 @@
1
- function e(e){typeof e!=`number`&&e.unref?.()}var t=class extends Error{constructor(e){super(`The operation took longer than ${String(e)} ms.`),this.name=`DeadlineError`}};function n(n,r){let i,a=new Promise((n,a)=>{let o=setTimeout(()=>{a(new t(r))},r);i=o,e(o)});return Promise.race([n,a]).finally(()=>{clearTimeout(i)})}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
2
- //# sourceMappingURL=deadline-XSnm95pg.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deadline-XSnm95pg.cjs","names":["unrefTimer","timer","DeadlineError","ms","withDeadline","expire","deadline","reject","work"],"sources":["../src/utils/unref.ts","../src/utils/deadline.ts"],"sourcesContent":["// src/utils/unref.ts\n//\n// Unreferences timer handles in Node and browser environments. A pending timer\n// keeps a Node process alive under SSR and in tests.\n\n/** Timer handle. It is a number in a browser and a Timeout object in Node. */\nexport type TimerHandle = number | { unref?: () => void };\n\n/**\n * Unreferences a timer handle. A pending timer then does not keep a Node.js process alive.\n * @param timer Timer handle returned by setTimeout.\n */\nexport function unrefTimer(timer: TimerHandle): void {\n if (typeof timer !== \"number\") {\n timer.unref?.();\n }\n}\n","// src/utils/deadline.ts\n//\n// Sets a deadline for a promise that can stay pending. A pending promise raises no\n// diagnostics event. Without a deadline, its caller waits forever and keeps its slot.\n\nimport { unrefTimer } from \"./unref\";\n\n/** Error of a promise that did not settle before its deadline. */\nexport class DeadlineError extends Error {\n /**\n * @param ms Deadline in milliseconds.\n */\n constructor(ms: number) {\n super(`The operation took longer than ${String(ms)} ms.`);\n this.name = \"DeadlineError\";\n }\n}\n\n/**\n * Rejects when a promise does not settle within a deadline.\n * @param work Promise to bound.\n * @param ms Deadline in milliseconds.\n * @returns The value of the promise, or a rejection after the deadline.\n */\nexport function withDeadline<T>(work: Promise<T>, ms: number): Promise<T> {\n let expire: ReturnType<typeof setTimeout> | undefined;\n\n const deadline = new Promise<never>((_resolve, reject) => {\n const timer = setTimeout(() => {\n reject(new DeadlineError(ms));\n }, ms);\n\n expire = timer;\n unrefTimer(timer);\n });\n\n // Clear the timer on success and on failure. If not, each storage call leaves an armed timer.\n return Promise.race([work, deadline]).finally(() => {\n clearTimeout(expire);\n });\n}\n"],"mappings":"AAYA,SAAgBA,EAAW,EAA0B,CAC/C,OAAOC,GAAU,UACnBA,EAAM,QAAQ,CAElB,CCRA,IAAaC,EAAb,cAAmC,KAAM,CAIvC,YAAY,EAAY,CACtB,MAAM,kCAAkC,OAAOC,CAAE,EAAE,KAAK,EACxD,KAAK,KAAO,eACd,CACF,EAQA,SAAgBC,EAAgB,EAAkB,EAAwB,CACxE,IAAIC,EAEEC,EAAW,IAAI,SAAgB,EAAU,IAAW,CACxD,IAAML,EAAQ,eAAiB,CAC7BM,EAAO,IAAIL,EAAcC,CAAE,CAAC,CAC9B,EAAGA,CAAE,EAEL,EAASF,EACTD,EAAWC,CAAK,CAClB,CAAC,EAGD,OAAO,QAAQ,KAAK,CAACO,EAAMF,CAAQ,CAAC,CAAC,CAAC,YAAc,CAClD,aAAaD,CAAM,CACrB,CAAC,CACH,C"}
@@ -1,2 +0,0 @@
1
- const e=require("./guards-nJ70syPt.cjs"),t=require("./platform-C2Ez5kDc.cjs"),n=require("./sanitize-BAWzkZt0.cjs");function r(n){return typeof n==`string`?/^[a-z][a-z\d+.-]*:\/\//i.test(n)?t.i(n,!1):n:Array.isArray(n)?n.map(r):e.t(n)?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,r(t)])):n}function i(e,i,a){let o=e=>typeof e==`string`?t.i(e,!1):e,{capture:s,serializer:c}=e,l={...e,endpoint:o(e.endpoint),metricsEndpoint:o(e.metricsEndpoint),tracesEndpoint:o(e.tracesEndpoint),serializer:typeof c==`string`?c:c.name,capture:{...s,ignoreUrls:s.ignoreUrls.map(o),plugins:s.plugins.map(e=>e.name)}};return Reflect.deleteProperty(l,`headers`),r(n.n(l,i,a))}exports.configSummary=i;
2
- //# sourceMappingURL=debug-bundle-BzJNpbF0.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"debug-bundle-BzJNpbF0.cjs","names":["recordedUrl","isObject","sanitize","require_guards","require_platform","require_sanitize","stripUrls","value","key","entry","configSummary","cut","config","copy","serializer","capture","plugin","limits","diagnostics"],"sources":["../src/core/debug-bundle.ts"],"sourcesContent":["// src/core/debug-bundle.ts\n//\n// Makes the config summary of a debug bundle. The runtime loads this module only when the app\n// asks for a bundle.\n\nimport type { ResolvedConfig } from \"../models/config\";\nimport { isObject } from \"../utils/guards\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { sanitize, type SanitizeLimits } from \"../utils/sanitize\";\nimport type { Diagnostics } from \"./diagnostics\";\n\n/**\n * Removes the user info, query and fragment of each absolute URL in a JSON-safe value. The\n * library also puts the endpoints into `capture.ignoreUrls`.\n * @param value JSON-safe value.\n * @returns The value with each URL cut.\n */\nfunction stripUrls(value: unknown): unknown {\n if (typeof value === \"string\") {\n return /^[a-z][a-z\\d+.-]*:\\/\\//i.test(value) ? recordedUrl(value, false) : value;\n }\n\n if (Array.isArray(value)) {\n return value.map(stripUrls);\n }\n\n if (isObject(value)) {\n return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, stripUrls(entry)]));\n }\n\n return value;\n}\n\n/**\n * Copies the config for a support ticket. It leaves out the headers and cuts each URL. A function\n * becomes its name, and a RegExp its text.\n * @param config Active configuration.\n * @param limits Limits of the copy, as for record attributes.\n * @param diagnostics Diagnostics reporter.\n * @returns JSON-safe copy of the config.\n */\nexport function configSummary(\n config: ResolvedConfig,\n limits: SanitizeLimits,\n diagnostics: Diagnostics,\n): Record<string, unknown> {\n // A relative endpoint has no scheme. stripUrls() does not see it as a URL.\n const cut = (value: unknown): unknown =>\n typeof value === \"string\" ? recordedUrl(value, false) : value;\n const { capture, serializer } = config;\n const copy: Record<string, unknown> = {\n ...config,\n endpoint: cut(config.endpoint),\n metricsEndpoint: cut(config.metricsEndpoint),\n tracesEndpoint: cut(config.tracesEndpoint),\n // An object of the app can hold a key in any field. Only its name goes out.\n serializer: typeof serializer === \"string\" ? serializer : serializer.name,\n capture: {\n ...capture,\n ignoreUrls: capture.ignoreUrls.map(cut),\n plugins: capture.plugins.map((plugin) => plugin.name),\n },\n };\n // Static headers can hold a token.\n Reflect.deleteProperty(copy, \"headers\");\n\n return stripUrls(sanitize(copy, limits, diagnostics)) as Record<string, unknown>;\n}\n"],"mappings":"A,mHAiBA,SAASM,EAAU,EAAyB,CAa1C,OAZI,OAAOC,GAAU,SACZ,0BAA0B,KAAKA,CAAK,EAAIP,EAAAA,EAAYO,EAAO,EAAK,EAAIA,EAGzE,MAAM,QAAQA,CAAK,EACdA,EAAM,IAAID,CAAS,EAGxBL,EAAAA,EAASM,CAAK,EACT,OAAO,YAAY,OAAO,QAAQA,CAAK,CAAC,CAAC,KAAK,CAACC,EAAKC,KAAW,CAACD,EAAKF,EAAUG,CAAK,CAAC,CAAC,CAAC,EAGzFF,CACT,CAUA,SAAgBG,EACd,EACA,EACA,EACyB,CAEzB,IAAMC,EAAO,GACX,OAAOJ,GAAU,SAAWP,EAAAA,EAAYO,EAAO,EAAK,EAAIA,EACpD,CAAE,UAAS,cAAeK,EAC1BC,EAAgC,CACpC,GAAGD,EACH,SAAUD,EAAIC,EAAO,QAAQ,EAC7B,gBAAiBD,EAAIC,EAAO,eAAe,EAC3C,eAAgBD,EAAIC,EAAO,cAAc,EAEzC,WAAY,OAAOE,GAAe,SAAWA,EAAaA,EAAW,KACrE,QAAS,CACP,GAAGC,EACH,WAAYA,EAAQ,WAAW,IAAIJ,CAAG,EACtC,QAASI,EAAQ,QAAQ,IAAK,GAAWC,EAAO,IAAI,CACtD,CACF,EAIA,OAFA,QAAQ,eAAeH,EAAM,SAAS,EAE/BP,EAAUJ,EAAAA,EAASW,EAAMI,EAAQC,CAAW,CAAC,CACtD,C"}
@@ -1,25 +0,0 @@
1
- import { t as e } from "./guards-Cidk71ME.js";
2
- import { i as t } from "./platform-DkcuXwe-.js";
3
- import { n } from "./sanitize-6ymPlVvP.js";
4
- // src/core/debug-bundle.ts
5
- function r(n) {
6
- return typeof n == "string" ? /^[a-z][a-z\d+.-]*:\/\//i.test(n) ? t(n, !1) : n : Array.isArray(n) ? n.map(r) : e(n) ? Object.fromEntries(Object.entries(n).map(([e, t]) => [e, r(t)])) : n;
7
- }
8
- function i(e, i, a) {
9
- let o = (e) => typeof e == "string" ? t(e, !1) : e, { capture: s, serializer: c } = e, l = {
10
- ...e,
11
- endpoint: o(e.endpoint),
12
- metricsEndpoint: o(e.metricsEndpoint),
13
- tracesEndpoint: o(e.tracesEndpoint),
14
- serializer: typeof c == "string" ? c : c.name,
15
- capture: {
16
- ...s,
17
- ignoreUrls: s.ignoreUrls.map(o),
18
- plugins: s.plugins.map((e) => e.name)
19
- }
20
- };
21
- return Reflect.deleteProperty(l, "headers"), r(n(l, i, a));
22
- }
23
- export { i as configSummary };
24
-
25
- //# sourceMappingURL=debug-bundle-C7UkHZ-q.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"debug-bundle-C7UkHZ-q.js","names":["isObject","recordedUrl","stripUrls","value","key","entry","configSummary","cut","config","copy","serializer","capture","plugin","sanitize","limits","diagnostics"],"sources":["../src/core/debug-bundle.ts"],"sourcesContent":["// src/core/debug-bundle.ts\n//\n// Makes the config summary of a debug bundle. The runtime loads this module only when the app\n// asks for a bundle.\n\nimport type { ResolvedConfig } from \"../models/config\";\nimport { isObject } from \"../utils/guards\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { sanitize, type SanitizeLimits } from \"../utils/sanitize\";\nimport type { Diagnostics } from \"./diagnostics\";\n\n/**\n * Removes the user info, query and fragment of each absolute URL in a JSON-safe value. The\n * library also puts the endpoints into `capture.ignoreUrls`.\n * @param value JSON-safe value.\n * @returns The value with each URL cut.\n */\nfunction stripUrls(value: unknown): unknown {\n if (typeof value === \"string\") {\n return /^[a-z][a-z\\d+.-]*:\\/\\//i.test(value) ? recordedUrl(value, false) : value;\n }\n\n if (Array.isArray(value)) {\n return value.map(stripUrls);\n }\n\n if (isObject(value)) {\n return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, stripUrls(entry)]));\n }\n\n return value;\n}\n\n/**\n * Copies the config for a support ticket. It leaves out the headers and cuts each URL. A function\n * becomes its name, and a RegExp its text.\n * @param config Active configuration.\n * @param limits Limits of the copy, as for record attributes.\n * @param diagnostics Diagnostics reporter.\n * @returns JSON-safe copy of the config.\n */\nexport function configSummary(\n config: ResolvedConfig,\n limits: SanitizeLimits,\n diagnostics: Diagnostics,\n): Record<string, unknown> {\n // A relative endpoint has no scheme. stripUrls() does not see it as a URL.\n const cut = (value: unknown): unknown =>\n typeof value === \"string\" ? recordedUrl(value, false) : value;\n const { capture, serializer } = config;\n const copy: Record<string, unknown> = {\n ...config,\n endpoint: cut(config.endpoint),\n metricsEndpoint: cut(config.metricsEndpoint),\n tracesEndpoint: cut(config.tracesEndpoint),\n // An object of the app can hold a key in any field. Only its name goes out.\n serializer: typeof serializer === \"string\" ? serializer : serializer.name,\n capture: {\n ...capture,\n ignoreUrls: capture.ignoreUrls.map(cut),\n plugins: capture.plugins.map((plugin) => plugin.name),\n },\n };\n // Static headers can hold a token.\n Reflect.deleteProperty(copy, \"headers\");\n\n return stripUrls(sanitize(copy, limits, diagnostics)) as Record<string, unknown>;\n}\n"],"mappings":";;;;AAiBA,SAASE,EAAU,GAAyB;CAa1C,OAZI,OAAOC,KAAU,WACZ,0BAA0B,KAAKA,CAAK,IAAIF,EAAYE,GAAO,EAAK,IAAIA,IAGzE,MAAM,QAAQA,CAAK,IACdA,EAAM,IAAID,CAAS,IAGxBF,EAASG,CAAK,IACT,OAAO,YAAY,OAAO,QAAQA,CAAK,CAAC,CAAC,KAAK,CAACC,GAAKC,OAAW,CAACD,GAAKF,EAAUG,CAAK,CAAC,CAAC,CAAC,IAGzFF;AACT;AAUA,SAAgBG,EACd,GACA,GACA,GACyB;CAEzB,IAAMC,KAAO,MACX,OAAOJ,KAAU,WAAWF,EAAYE,GAAO,EAAK,IAAIA,GACpD,EAAE,YAAS,kBAAeK,GAC1BC,IAAgC;EACpC,GAAGD;EACH,UAAUD,EAAIC,EAAO,QAAQ;EAC7B,iBAAiBD,EAAIC,EAAO,eAAe;EAC3C,gBAAgBD,EAAIC,EAAO,cAAc;EAEzC,YAAY,OAAOE,KAAe,WAAWA,IAAaA,EAAW;EACrE,SAAS;GACP,GAAGC;GACH,YAAYA,EAAQ,WAAW,IAAIJ,CAAG;GACtC,SAASI,EAAQ,QAAQ,KAAK,MAAWC,EAAO,IAAI;EACtD;CACF;CAIA,OAFA,QAAQ,eAAeH,GAAM,SAAS,GAE/BP,EAAUW,EAASJ,GAAMK,GAAQC,CAAW,CAAC;AACtD"}
@@ -1,2 +0,0 @@
1
- const e=require("./constants-DqKJH_MP.cjs"),t=require("./batch-C8OcWR2L.cjs"),n=require("./deadline-XSnm95pg.cjs"),r=require("./keys-BHhw_0Wh.cjs");function i(e,t,n,{skipIfBusy:r=!0}={}){let i=globalThis.navigator?.locks;return i?.request?t.guardAsync(`storage.degraded`,`The library could not get the lock ${e}.`,()=>i.request(e,{ifAvailable:r},e=>e?n():Promise.resolve(void 0))):n()}function a(e,t){return t?`${e}:${encodeURIComponent(t)}`:e}function o(e,n){let r=n.guard(`storage.degraded`,`An emergency entry is not valid JSON. The library dropped it.`,()=>JSON.parse(e));return r===void 0?null:t.i(r)?r:(n.report(`storage.degraded`,`An emergency entry is not a batch. The library dropped it.`),null)}async function s(t,i,a,s){let c=0;for(let l of r.n(s,i)){let r=i.guard(`storage.unavailable`,`The library could not read the emergency queue.`,()=>{let e=localStorage.getItem(l),t=e?o(e,i):null;return t&&!a(t)?null:(localStorage.removeItem(l),t)});if(r)try{await n.n(t.save(r),e.Cn),c++}catch(e){i.report(`storage.degraded`,`The library could not recover an emergency batch.`,{key:l},e)}}return c}function c(e,t,n){let i=d(e.persistenceNamespace),a=`writing the emergency queue, ${String(e.records.length)} records`,s=[],c=t.guard(`storage.quota_exceeded`,a,()=>{let n=r.n(i,t);for(let e of n.slice(0,Math.max(0,n.length-20+1))){let n=o(String(localStorage.getItem(e)),t);n!==null&&s.push(n),localStorage.removeItem(e)}return localStorage.setItem(r.t(i,e),JSON.stringify(e)),!0});t.guard(`pipeline.crashed`,`The loss report of the emergency queue failed.`,()=>{if(s.length>0){let e=s.flatMap(e=>e.records);n?.(`exit_queue_full`,e,s.map(e=>e.id))}c!==!0&&n?.(`quota`,e.records,[e.id])})}async function l(e,t,n=()=>!0,r=``){return await i(a(`ui-observability.emergency`,r),t,()=>s(e,t,n,d(r)),{skipIfBusy:!1})??0}function u(e,t,n=``,i=!1){let a=d(n);t.guard(`storage.unavailable`,`The library could not clear the retired emergency queue.`,()=>{for(let n of r.n(a,t)){let r=localStorage.getItem(n);r&&(i||o(r,t)?.routingContextId===e)&&localStorage.removeItem(n)}})}function d(t=``){return t?`ui-observability:namespaced:${encodeURIComponent(t)}:emergency:`:e.et}exports.clearEmergencyContext=u,exports.drainEmergencyQueue=l,exports.n=i,exports.saveToEmergencyQueue=c,exports.t=a;
2
- //# sourceMappingURL=emergency-queue-CNTRui5t.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emergency-queue-CNTRui5t.cjs","names":["isLogBatch","keysWithPrefix","withDeadline","STORAGE_DEADLINE_MS","batchKey","EMERGENCY_STORAGE_KEY_PREFIX","require_constants","require_batch","require_deadline","require_keys","withDrainLock","locks","diagnostics","name","skipIfBusy","lock","fn","lockName","namespace","readBatch","parsed","raw","importAll","moved","key","prefix","batch","value","accepts","storage","error","saveToEmergencyQueue","emergencyPrefix","context","evicted","saved","keys","old","dropped","records","one","onLoss","drainEmergencyQueue","clearEmergencyContext","all","id"],"sources":["../src/utils/lock.ts","../src/storage/emergency-queue.ts"],"sourcesContent":["// src/utils/lock.ts\n//\n// Coordinates origin-wide batch draining operations using the Web Locks API.\n// Without the lock, every window on the origin drains and sends the same batches.\n\nimport type { Diagnostics } from \"../core/diagnostics\";\n\n/** Lock grant object, or null when the lock is not available. */\ntype LockGrant = { name: string } | null;\n\n/** Structural interface for navigator.locks operations. */\ninterface LockManagerLike {\n /**\n * Requests a lock and executes a callback under the acquired lock grant.\n * @param name Lock name.\n * @param options Lock request options.\n * @param callback Callback that runs with the lock grant.\n */\n request<T>(\n name: string,\n options: { ifAvailable?: boolean },\n callback: (lock: LockGrant) => Promise<T>,\n ): Promise<T>;\n}\n\n/**\n * Executes an asynchronous function under a Web Locks API origin-wide lock.\n * It runs the task directly when the Web Locks API is not available.\n * @param name Origin-scoped lock identifier.\n * @param diagnostics Diagnostics reporter.\n * @param fn Asynchronous task to execute while holding the lock.\n * @param options Lock acquisition options.\n * @param options.skipIfBusy When true, the task does not run if another context holds the lock.\n * @returns Promise of the task result. It resolves to undefined when another context holds the\n * lock. A caller that reads undefined as a task result stops rescheduling.\n */\nexport function withDrainLock<T>(\n name: string,\n diagnostics: Diagnostics,\n fn: () => Promise<T>,\n { skipIfBusy = true }: { skipIfBusy?: boolean } = {},\n): Promise<T | undefined> {\n const locks = (globalThis as { navigator?: { locks?: LockManagerLike } }).navigator?.locks;\n\n // Run the task without a lock when the Web Locks API is not available.\n if (!locks?.request) {\n return fn();\n }\n\n return diagnostics.guardAsync(\n \"storage.degraded\",\n `The library could not get the lock ${name}.`,\n () =>\n locks.request(name, { ifAvailable: skipIfBusy }, (lock) =>\n lock ? fn() : Promise.resolve(undefined),\n ),\n );\n}\n\n/**\n * Gives the lock name of one application namespace. Two namespaces on one origin then do not wait for each other.\n * Without it, the retry pass of one application skips while the other holds the lock.\n * @param name Base lock name.\n * @param namespace Application storage namespace. An empty value keeps the base name.\n * @returns Lock name for this namespace.\n */\nexport function lockName(name: string, namespace: string): string {\n return namespace ? `${name}:${encodeURIComponent(namespace)}` : name;\n}\n","// src/storage/emergency-queue.ts\n//\n// This module keeps a synchronous localStorage queue. It holds oversized batches during unload.\n// Startup recovers them. The code is synchronous and never throws. It runs while the browser\n// destroys the document. No promise settles at that time.\n\nimport {\n EMERGENCY_LOCK_NAME,\n EMERGENCY_MAX_ENTRIES,\n EMERGENCY_STORAGE_KEY_PREFIX,\n STORAGE_DEADLINE_MS,\n} from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { isLogBatch, type LogBatch } from \"../models/batch\";\nimport type { LossReporter } from \"../models/drop\";\nimport type { StorageAdapter } from \"../models/storage\";\nimport { withDeadline } from \"../utils/deadline\";\nimport { lockName, withDrainLock } from \"../utils/lock\";\nimport { batchKey, keysWithPrefix } from \"./keys\";\n\n/**\n * Parses a raw storage string and validates it as a LogBatch.\n * @param raw Raw serialized storage string.\n * @param diagnostics Diagnostics reporter.\n * @returns Validated LogBatch or null if unparseable or malformed.\n */\nfunction readBatch(raw: string, diagnostics: Diagnostics): LogBatch | null {\n const parsed = diagnostics.guard(\n \"storage.degraded\",\n \"An emergency entry is not valid JSON. The library dropped it.\",\n () => JSON.parse(raw) as unknown,\n );\n\n // The guard above already reported a parse failure.\n if (parsed === undefined) {\n return null;\n }\n\n if (!isLogBatch(parsed)) {\n diagnostics.report(\n \"storage.degraded\",\n \"An emergency entry is not a batch. The library dropped it.\",\n );\n return null;\n }\n\n return parsed;\n}\n\n/**\n * Imports all emergency queue entries into the target adapter in FIFO order.\n * @param storage Destination storage adapter.\n * @param diagnostics Diagnostics reporter.\n * @returns Total number of recovered batches.\n */\nasync function importAll(\n storage: StorageAdapter,\n diagnostics: Diagnostics,\n accepts: (batch: LogBatch) => boolean,\n prefix: string,\n): Promise<number> {\n let moved = 0;\n\n for (const key of keysWithPrefix(prefix, diagnostics)) {\n // Read and remove the key in one synchronous step, before the async save. A second window\n // that imports at the same time cannot take the same batch. Parse each entry one time.\n // A batch of another context stays in the queue.\n const batch = diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not read the emergency queue.\",\n (): LogBatch | null => {\n const value = localStorage.getItem(key);\n const parsed = value ? readBatch(value, diagnostics) : null;\n if (parsed && !accepts(parsed)) {\n return null;\n }\n localStorage.removeItem(key);\n return parsed;\n },\n );\n\n if (!batch) {\n continue;\n }\n\n try {\n // Set a deadline. This code runs during startup. A save that does not settle keeps the\n // runtime not ready. Each record then goes to the boot buffer.\n await withDeadline(storage.save(batch), STORAGE_DEADLINE_MS);\n moved++;\n } catch (error) {\n diagnostics.report(\n \"storage.degraded\",\n \"The library could not recover an emergency batch.\",\n { key },\n error,\n );\n }\n }\n\n return moved;\n}\n\n/**\n * Writes an unsent batch to the emergency queue synchronously during unload.\n * @param batch Oversized log batch.\n * @param diagnostics Diagnostics reporter.\n * @param onLoss Receives the records of the old entries that the queue drops, and of a\n * batch that the store refuses.\n */\nexport function saveToEmergencyQueue(\n batch: LogBatch,\n diagnostics: Diagnostics,\n onLoss?: LossReporter,\n): void {\n // Name the record count. A full localStorage drops this batch permanently. Removal of\n // emergency keys cannot free quota that the keys of other applications use.\n const prefix = emergencyPrefix(batch.persistenceNamespace);\n const context = `writing the emergency queue, ${String(batch.records.length)} records`;\n const evicted: LogBatch[] = [];\n\n const saved = diagnostics.guard(\"storage.quota_exceeded\", context, () => {\n const keys = keysWithPrefix(prefix, diagnostics);\n\n // Remove the oldest entries to keep the queue within its capacity.\n for (const old of keys.slice(0, Math.max(0, keys.length - EMERGENCY_MAX_ENTRIES + 1))) {\n // A key that another window removed gives null. readBatch then rejects it.\n const dropped = readBatch(String(localStorage.getItem(old)), diagnostics);\n if (dropped !== null) {\n evicted.push(dropped);\n }\n localStorage.removeItem(old);\n }\n\n localStorage.setItem(batchKey(prefix, batch), JSON.stringify(batch));\n return true;\n });\n\n // The exit flush calls this function. A throw here skips the shutdown of the sender.\n diagnostics.guard(\"pipeline.crashed\", \"The loss report of the emergency queue failed.\", () => {\n if (evicted.length > 0) {\n const records = evicted.flatMap((one) => one.records);\n onLoss?.(\n \"exit_queue_full\",\n records,\n evicted.map((one) => one.id),\n );\n }\n\n if (saved !== true) {\n onLoss?.(\"quota\", batch.records, [batch.id]);\n }\n });\n}\n\n/**\n * Recovers the batches that earlier shutdowns saved to emergency storage.\n * @param storage Destination storage adapter.\n * @param diagnostics Diagnostics reporter.\n * @returns Promise that resolves to the number of recovered batches.\n */\nexport async function drainEmergencyQueue(\n storage: StorageAdapter,\n diagnostics: Diagnostics,\n accepts: (batch: LogBatch) => boolean = () => true,\n namespace = \"\",\n): Promise<number> {\n const moved = await withDrainLock(\n lockName(EMERGENCY_LOCK_NAME, namespace),\n diagnostics,\n () => importAll(storage, diagnostics, accepts, emergencyPrefix(namespace)),\n { skipIfBusy: false },\n );\n\n return moved ?? 0;\n}\n\n/**\n * Removes emergency entries of one context, or all entries in its namespace.\n * @param id Delivery context id.\n * @param diagnostics Diagnostics reporter.\n * @param namespace Application storage namespace.\n * @param all True to remove entries of all contexts in this namespace.\n */\nexport function clearEmergencyContext(\n id: string,\n diagnostics: Diagnostics,\n namespace = \"\",\n all = false,\n): void {\n const prefix = emergencyPrefix(namespace);\n diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not clear the retired emergency queue.\",\n () => {\n for (const key of keysWithPrefix(prefix, diagnostics)) {\n const raw = localStorage.getItem(key);\n if (raw && (all || readBatch(raw, diagnostics)?.routingContextId === id))\n localStorage.removeItem(key);\n }\n },\n );\n}\n\n/**\n * Gives the emergency storage prefix of one application namespace.\n * @param namespace Application namespace. An empty value uses the previous prefix.\n * @returns Prefix for this application emergency queue.\n */\nfunction emergencyPrefix(namespace = \"\"): string {\n return namespace\n ? `ui-observability:namespaced:${encodeURIComponent(namespace)}:emergency:`\n : EMERGENCY_STORAGE_KEY_PREFIX;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aAAa,QAAQG,CAAG,EAChCH,IAAQuB,GAAOzB,EAAUE,EAAKT,CAAW,CAAC,EAAE,mBAAqBiC,IACnE,aAAa,WAAWrB,CAAG,CAC/B,CACF,CACF,CACF,CAOA,SAASQ,EAAgB,EAAY,GAAY,CAC/C,OAAOd,EACH,+BAA+B,mBAAmBA,CAAS,EAAE,aAC7Db,EAAAA,EACN,C"}
@@ -1,67 +0,0 @@
1
- import { Cn as e, et as t } from "./constants-zyrqveN4.js";
2
- import { i as n } from "./batch-CL9uWYY3.js";
3
- import { n as r } from "./deadline-BOjOxNHj.js";
4
- import { n as i, t as a } from "./keys-BU9j5YqW.js";
5
- // src/utils/lock.ts
6
- function o(e, t, n, { skipIfBusy: r = !0 } = {}) {
7
- let i = globalThis.navigator?.locks;
8
- return i?.request ? t.guardAsync("storage.degraded", `The library could not get the lock ${e}.`, () => i.request(e, { ifAvailable: r }, (e) => e ? n() : Promise.resolve(void 0))) : n();
9
- }
10
- function s(e, t) {
11
- return t ? `${e}:${encodeURIComponent(t)}` : e;
12
- }
13
- // src/storage/emergency-queue.ts
14
- function c(e, t) {
15
- let r = t.guard("storage.degraded", "An emergency entry is not valid JSON. The library dropped it.", () => JSON.parse(e));
16
- return r === void 0 ? null : n(r) ? r : (t.report("storage.degraded", "An emergency entry is not a batch. The library dropped it."), null);
17
- }
18
- async function l(t, n, a, o) {
19
- let s = 0;
20
- for (let l of i(o, n)) {
21
- let i = n.guard("storage.unavailable", "The library could not read the emergency queue.", () => {
22
- let e = localStorage.getItem(l), t = e ? c(e, n) : null;
23
- return t && !a(t) ? null : (localStorage.removeItem(l), t);
24
- });
25
- if (i) try {
26
- await r(t.save(i), e), s++;
27
- } catch (e) {
28
- n.report("storage.degraded", "The library could not recover an emergency batch.", { key: l }, e);
29
- }
30
- }
31
- return s;
32
- }
33
- function u(e, t, n) {
34
- let r = p(e.persistenceNamespace), o = `writing the emergency queue, ${String(e.records.length)} records`, s = [], l = t.guard("storage.quota_exceeded", o, () => {
35
- let n = i(r, t);
36
- for (let e of n.slice(0, Math.max(0, n.length - 20 + 1))) {
37
- let n = c(String(localStorage.getItem(e)), t);
38
- n !== null && s.push(n), localStorage.removeItem(e);
39
- }
40
- return localStorage.setItem(a(r, e), JSON.stringify(e)), !0;
41
- });
42
- t.guard("pipeline.crashed", "The loss report of the emergency queue failed.", () => {
43
- if (s.length > 0) {
44
- let e = s.flatMap((e) => e.records);
45
- n?.("exit_queue_full", e, s.map((e) => e.id));
46
- }
47
- l !== !0 && n?.("quota", e.records, [e.id]);
48
- });
49
- }
50
- async function d(e, t, n = () => !0, r = "") {
51
- return await o(s("ui-observability.emergency", r), t, () => l(e, t, n, p(r)), { skipIfBusy: !1 }) ?? 0;
52
- }
53
- function f(e, t, n = "", r = !1) {
54
- let a = p(n);
55
- t.guard("storage.unavailable", "The library could not clear the retired emergency queue.", () => {
56
- for (let n of i(a, t)) {
57
- let i = localStorage.getItem(n);
58
- i && (r || c(i, t)?.routingContextId === e) && localStorage.removeItem(n);
59
- }
60
- });
61
- }
62
- function p(e = "") {
63
- return e ? `ui-observability:namespaced:${encodeURIComponent(e)}:emergency:` : t;
64
- }
65
- export { f as clearEmergencyContext, d as drainEmergencyQueue, o as n, u as saveToEmergencyQueue, s as t };
66
-
67
- //# sourceMappingURL=emergency-queue-Zy6lNafo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emergency-queue-Zy6lNafo.js","names":["STORAGE_DEADLINE_MS","EMERGENCY_STORAGE_KEY_PREFIX","isLogBatch","withDeadline","keysWithPrefix","batchKey","withDrainLock","locks","diagnostics","name","skipIfBusy","lock","fn","lockName","namespace","readBatch","parsed","raw","importAll","moved","key","prefix","batch","value","accepts","storage","error","saveToEmergencyQueue","emergencyPrefix","context","evicted","saved","keys","old","dropped","records","one","onLoss","drainEmergencyQueue","clearEmergencyContext","all","id"],"sources":["../src/utils/lock.ts","../src/storage/emergency-queue.ts"],"sourcesContent":["// src/utils/lock.ts\n//\n// Coordinates origin-wide batch draining operations using the Web Locks API.\n// Without the lock, every window on the origin drains and sends the same batches.\n\nimport type { Diagnostics } from \"../core/diagnostics\";\n\n/** Lock grant object, or null when the lock is not available. */\ntype LockGrant = { name: string } | null;\n\n/** Structural interface for navigator.locks operations. */\ninterface LockManagerLike {\n /**\n * Requests a lock and executes a callback under the acquired lock grant.\n * @param name Lock name.\n * @param options Lock request options.\n * @param callback Callback that runs with the lock grant.\n */\n request<T>(\n name: string,\n options: { ifAvailable?: boolean },\n callback: (lock: LockGrant) => Promise<T>,\n ): Promise<T>;\n}\n\n/**\n * Executes an asynchronous function under a Web Locks API origin-wide lock.\n * It runs the task directly when the Web Locks API is not available.\n * @param name Origin-scoped lock identifier.\n * @param diagnostics Diagnostics reporter.\n * @param fn Asynchronous task to execute while holding the lock.\n * @param options Lock acquisition options.\n * @param options.skipIfBusy When true, the task does not run if another context holds the lock.\n * @returns Promise of the task result. It resolves to undefined when another context holds the\n * lock. A caller that reads undefined as a task result stops rescheduling.\n */\nexport function withDrainLock<T>(\n name: string,\n diagnostics: Diagnostics,\n fn: () => Promise<T>,\n { skipIfBusy = true }: { skipIfBusy?: boolean } = {},\n): Promise<T | undefined> {\n const locks = (globalThis as { navigator?: { locks?: LockManagerLike } }).navigator?.locks;\n\n // Run the task without a lock when the Web Locks API is not available.\n if (!locks?.request) {\n return fn();\n }\n\n return diagnostics.guardAsync(\n \"storage.degraded\",\n `The library could not get the lock ${name}.`,\n () =>\n locks.request(name, { ifAvailable: skipIfBusy }, (lock) =>\n lock ? fn() : Promise.resolve(undefined),\n ),\n );\n}\n\n/**\n * Gives the lock name of one application namespace. Two namespaces on one origin then do not wait for each other.\n * Without it, the retry pass of one application skips while the other holds the lock.\n * @param name Base lock name.\n * @param namespace Application storage namespace. An empty value keeps the base name.\n * @returns Lock name for this namespace.\n */\nexport function lockName(name: string, namespace: string): string {\n return namespace ? `${name}:${encodeURIComponent(namespace)}` : name;\n}\n","// src/storage/emergency-queue.ts\n//\n// This module keeps a synchronous localStorage queue. It holds oversized batches during unload.\n// Startup recovers them. The code is synchronous and never throws. It runs while the browser\n// destroys the document. No promise settles at that time.\n\nimport {\n EMERGENCY_LOCK_NAME,\n EMERGENCY_MAX_ENTRIES,\n EMERGENCY_STORAGE_KEY_PREFIX,\n STORAGE_DEADLINE_MS,\n} from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { isLogBatch, type LogBatch } from \"../models/batch\";\nimport type { LossReporter } from \"../models/drop\";\nimport type { StorageAdapter } from \"../models/storage\";\nimport { withDeadline } from \"../utils/deadline\";\nimport { lockName, withDrainLock } from \"../utils/lock\";\nimport { batchKey, keysWithPrefix } from \"./keys\";\n\n/**\n * Parses a raw storage string and validates it as a LogBatch.\n * @param raw Raw serialized storage string.\n * @param diagnostics Diagnostics reporter.\n * @returns Validated LogBatch or null if unparseable or malformed.\n */\nfunction readBatch(raw: string, diagnostics: Diagnostics): LogBatch | null {\n const parsed = diagnostics.guard(\n \"storage.degraded\",\n \"An emergency entry is not valid JSON. The library dropped it.\",\n () => JSON.parse(raw) as unknown,\n );\n\n // The guard above already reported a parse failure.\n if (parsed === undefined) {\n return null;\n }\n\n if (!isLogBatch(parsed)) {\n diagnostics.report(\n \"storage.degraded\",\n \"An emergency entry is not a batch. The library dropped it.\",\n );\n return null;\n }\n\n return parsed;\n}\n\n/**\n * Imports all emergency queue entries into the target adapter in FIFO order.\n * @param storage Destination storage adapter.\n * @param diagnostics Diagnostics reporter.\n * @returns Total number of recovered batches.\n */\nasync function importAll(\n storage: StorageAdapter,\n diagnostics: Diagnostics,\n accepts: (batch: LogBatch) => boolean,\n prefix: string,\n): Promise<number> {\n let moved = 0;\n\n for (const key of keysWithPrefix(prefix, diagnostics)) {\n // Read and remove the key in one synchronous step, before the async save. A second window\n // that imports at the same time cannot take the same batch. Parse each entry one time.\n // A batch of another context stays in the queue.\n const batch = diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not read the emergency queue.\",\n (): LogBatch | null => {\n const value = localStorage.getItem(key);\n const parsed = value ? readBatch(value, diagnostics) : null;\n if (parsed && !accepts(parsed)) {\n return null;\n }\n localStorage.removeItem(key);\n return parsed;\n },\n );\n\n if (!batch) {\n continue;\n }\n\n try {\n // Set a deadline. This code runs during startup. A save that does not settle keeps the\n // runtime not ready. Each record then goes to the boot buffer.\n await withDeadline(storage.save(batch), STORAGE_DEADLINE_MS);\n moved++;\n } catch (error) {\n diagnostics.report(\n \"storage.degraded\",\n \"The library could not recover an emergency batch.\",\n { key },\n error,\n );\n }\n }\n\n return moved;\n}\n\n/**\n * Writes an unsent batch to the emergency queue synchronously during unload.\n * @param batch Oversized log batch.\n * @param diagnostics Diagnostics reporter.\n * @param onLoss Receives the records of the old entries that the queue drops, and of a\n * batch that the store refuses.\n */\nexport function saveToEmergencyQueue(\n batch: LogBatch,\n diagnostics: Diagnostics,\n onLoss?: LossReporter,\n): void {\n // Name the record count. A full localStorage drops this batch permanently. Removal of\n // emergency keys cannot free quota that the keys of other applications use.\n const prefix = emergencyPrefix(batch.persistenceNamespace);\n const context = `writing the emergency queue, ${String(batch.records.length)} records`;\n const evicted: LogBatch[] = [];\n\n const saved = diagnostics.guard(\"storage.quota_exceeded\", context, () => {\n const keys = keysWithPrefix(prefix, diagnostics);\n\n // Remove the oldest entries to keep the queue within its capacity.\n for (const old of keys.slice(0, Math.max(0, keys.length - EMERGENCY_MAX_ENTRIES + 1))) {\n // A key that another window removed gives null. readBatch then rejects it.\n const dropped = readBatch(String(localStorage.getItem(old)), diagnostics);\n if (dropped !== null) {\n evicted.push(dropped);\n }\n localStorage.removeItem(old);\n }\n\n localStorage.setItem(batchKey(prefix, batch), JSON.stringify(batch));\n return true;\n });\n\n // The exit flush calls this function. A throw here skips the shutdown of the sender.\n diagnostics.guard(\"pipeline.crashed\", \"The loss report of the emergency queue failed.\", () => {\n if (evicted.length > 0) {\n const records = evicted.flatMap((one) => one.records);\n onLoss?.(\n \"exit_queue_full\",\n records,\n evicted.map((one) => one.id),\n );\n }\n\n if (saved !== true) {\n onLoss?.(\"quota\", batch.records, [batch.id]);\n }\n });\n}\n\n/**\n * Recovers the batches that earlier shutdowns saved to emergency storage.\n * @param storage Destination storage adapter.\n * @param diagnostics Diagnostics reporter.\n * @returns Promise that resolves to the number of recovered batches.\n */\nexport async function drainEmergencyQueue(\n storage: StorageAdapter,\n diagnostics: Diagnostics,\n accepts: (batch: LogBatch) => boolean = () => true,\n namespace = \"\",\n): Promise<number> {\n const moved = await withDrainLock(\n lockName(EMERGENCY_LOCK_NAME, namespace),\n diagnostics,\n () => importAll(storage, diagnostics, accepts, emergencyPrefix(namespace)),\n { skipIfBusy: false },\n );\n\n return moved ?? 0;\n}\n\n/**\n * Removes emergency entries of one context, or all entries in its namespace.\n * @param id Delivery context id.\n * @param diagnostics Diagnostics reporter.\n * @param namespace Application storage namespace.\n * @param all True to remove entries of all contexts in this namespace.\n */\nexport function clearEmergencyContext(\n id: string,\n diagnostics: Diagnostics,\n namespace = \"\",\n all = false,\n): void {\n const prefix = emergencyPrefix(namespace);\n diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not clear the retired emergency queue.\",\n () => {\n for (const key of keysWithPrefix(prefix, diagnostics)) {\n const raw = localStorage.getItem(key);\n if (raw && (all || readBatch(raw, diagnostics)?.routingContextId === id))\n localStorage.removeItem(key);\n }\n },\n );\n}\n\n/**\n * Gives the emergency storage prefix of one application namespace.\n * @param namespace Application namespace. An empty value uses the previous prefix.\n * @returns Prefix for this application emergency queue.\n */\nfunction emergencyPrefix(namespace = \"\"): string {\n return namespace\n ? `ui-observability:namespaced:${encodeURIComponent(namespace)}:emergency:`\n : EMERGENCY_STORAGE_KEY_PREFIX;\n}\n"],"mappings":";;;;;AAoCA,SAAgBM,EACd,GACA,GACA,GACA,EAAE,gBAAa,OAAmC,CAAC,GAC3B;CACxB,IAAMC,IAAS,WAA2D,WAAW;CAOrF,OAJKA,GAAO,UAILC,EAAY,WACjB,oBACA,sCAAsCC,EAAK,UAEzCF,EAAM,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AACN"}
@@ -1,92 +0,0 @@
1
- import { r as e } from "./error-like-B11pB4aL.js";
2
- import { i as t } from "./platform-DkcuXwe-.js";
3
- import { t as n } from "./storm-VR024_QN.js";
4
- // src/capture/errors.ts
5
- function r(t) {
6
- if (e(t)) {
7
- let e = (t.stack ?? "").split("\n")[1] ?? "";
8
- return {
9
- message: t.message,
10
- key: `${t.name}|${t.message}|${e}`
11
- };
12
- }
13
- let n = String(t);
14
- return {
15
- message: n,
16
- key: `${typeof t}|${n}|`
17
- };
18
- }
19
- var i = class {
20
- ctx;
21
- name = "errors";
22
- installed = !1;
23
- seen = /* @__PURE__ */ new Map();
24
- window = {
25
- start: 0,
26
- count: 0
27
- };
28
- constructor(e) {
29
- this.ctx = e;
30
- }
31
- install() {
32
- this.installed || typeof addEventListener > "u" || (this.installed = !0, addEventListener("error", this.onError, !0), addEventListener("unhandledrejection", this.onRejection));
33
- }
34
- uninstall() {
35
- this.installed && (this.installed = !1, removeEventListener("error", this.onError, !0), removeEventListener("unhandledrejection", this.onRejection), this.seen.clear());
36
- }
37
- onError = (e) => {
38
- let n = e.target, r = n?.src ?? n?.href ?? "";
39
- if (n !== null && n !== globalThis && r !== "") {
40
- if (!this.ctx.config.capture.resourceErrors) return;
41
- let e = t(r, this.ctx.config.capture.fullUrls, this.ctx.config.capture.urlTransform, this.ctx.diagnostics);
42
- this.ctx.breadcrumbs.push({
43
- t: Date.now(),
44
- category: "http",
45
- message: `resource failed: ${e}`
46
- }), this.ctx.logger.warn("resource failed to load", {
47
- "error.type": "resource",
48
- "resource.url": e,
49
- "resource.tag": n.tagName.toLowerCase()
50
- });
51
- return;
52
- }
53
- if (!this.ctx.config.capture.errors) return;
54
- let i = e, a = i.message === "" ? "unknown error" : i.message, o = i.error ?? Error(a);
55
- this.report("window.onerror", o, {
56
- "error.source": t(i.filename, this.ctx.config.capture.fullUrls, this.ctx.config.capture.urlTransform, this.ctx.diagnostics),
57
- "error.line": i.lineno,
58
- "error.column": i.colno
59
- });
60
- };
61
- onRejection = (e) => {
62
- this.ctx.config.capture.rejections && this.report("unhandledrejection", e.reason, { "error.type": "unhandledrejection" });
63
- };
64
- report(e, t, i) {
65
- if (!n(this.window, this.ctx.config.capturePolicy.errorsPerWindow, this.ctx.diagnostics, "errors", this.ctx.config.capturePolicy.windowMs)) return;
66
- let a = Date.now(), { message: o, key: s } = this.ctx.diagnostics.guard("capture.record_failed", "The library could not read the error reason. It records the error without its message.", () => r(t)) ?? {
67
- message: "",
68
- key: `${typeof t}||`
69
- }, c = this.seen.get(s);
70
- if (c && a - c.at < this.ctx.config.capturePolicy.errorDedupeMs) {
71
- c.count++, c.at = a;
72
- return;
73
- }
74
- let l = c ? c.count - 1 : 0;
75
- if (this.seen.delete(s), this.seen.set(s, {
76
- at: a,
77
- count: 1
78
- }), this.ctx.config.capturePolicy.maxErrorSignatures > 0 && this.seen.size > this.ctx.config.capturePolicy.maxErrorSignatures) {
79
- let [e] = this.seen.keys();
80
- this.seen.delete(e);
81
- }
82
- let u = t === void 0 ? Error(o) : t;
83
- this.ctx.logger.error(o === "" ? e : o, u, {
84
- ...i,
85
- "error.captured_by": e,
86
- "error.suppressed_count": l
87
- });
88
- }
89
- };
90
- export { i as ErrorCapture };
91
-
92
- //# sourceMappingURL=errors-Dh7kef0i.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors-Dh7kef0i.js","names":["isErrorLike","recordedUrl","allowInWindow","signatureOf","value","frame","message","ErrorCapture","ctx","target","event","resourceUrl","url","errorEvent","fallback","error","now","previous","key","suppressed","oldest","reason","source","extra"],"sources":["../src/capture/errors.ts"],"sourcesContent":["// src/capture/errors.ts\n//\n// Captures uncaught errors, unhandled rejections and failed resource loads.\n\nimport { isErrorLike } from \"../utils/error-like\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Tracking metadata for a deduplicated error signature. */\ninterface SeenError {\n /** Time of the last report for the signature, in epoch milliseconds. */\n at: number;\n /** Occurrences recorded since the last report. */\n count: number;\n}\n\n/** Message and deduplication key of a thrown value. */\ninterface Signature {\n /** Message of the record. */\n message: string;\n /** Deduplication key. */\n key: string;\n}\n\n/**\n * Reads the message and the deduplication key of a thrown value.\n * Duck typing reads an error from another realm. That error fails `instanceof Error`.\n * @param value Thrown value or rejection reason.\n * @returns The signature.\n * @throws When a getter or the text form of the value throws. Call it inside a guard.\n */\nfunction signatureOf(value: unknown): Signature {\n if (isErrorLike(value)) {\n const frame = (value.stack ?? \"\").split(\"\\n\")[1] ?? \"\";\n return { message: value.message, key: `${value.name}|${value.message}|${frame}` };\n }\n\n const message = String(value);\n return { message, key: `${typeof value}|${message}|` };\n}\n\n/** Captures uncaught exceptions, unhandled promise rejections, and failed resource loads. */\nexport class ErrorCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"errors\";\n\n /** Prevents duplicate listener registration. */\n private installed = false;\n\n /** Recently reported error signatures in LRU order. */\n private readonly seen = new Map<string, SeenError>();\n\n /** Rate limit of this capture. Console noise has its own window and cannot use it. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param ctx Capture context containing configuration, diagnostics, logger, and breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Subscribes to global error and unhandledrejection events. */\n install(): void {\n if (this.installed || typeof addEventListener === \"undefined\") {\n return;\n }\n this.installed = true;\n\n // Uses capture phase to observe non-bubbling resource load errors.\n addEventListener(\"error\", this.onError, true);\n addEventListener(\"unhandledrejection\", this.onRejection);\n }\n\n /** Removes event listeners and clears tracked error signatures. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n removeEventListener(\"error\", this.onError, true);\n removeEventListener(\"unhandledrejection\", this.onRejection);\n this.seen.clear();\n }\n\n /** Routes resource load failures and uncaught script errors. */\n private readonly onError = (event: ErrorEvent | Event): void => {\n const target = event.target as (HTMLElement & { src?: string; href?: string }) | null;\n const resourceUrl = target?.src ?? target?.href ?? \"\";\n\n // Filters element-level resource load failures from script errors.\n if (\n target !== null &&\n target !== (globalThis as unknown as EventTarget) &&\n resourceUrl !== \"\"\n ) {\n if (!this.ctx.config.capture.resourceErrors) {\n return;\n }\n\n // A cache buster is noise. A signed URL is a credential.\n // The record keeps neither unless you set fullUrls.\n const url = recordedUrl(\n resourceUrl,\n this.ctx.config.capture.fullUrls,\n this.ctx.config.capture.urlTransform,\n this.ctx.diagnostics,\n );\n\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"http\",\n message: `resource failed: ${url}`,\n });\n this.ctx.logger.warn(\"resource failed to load\", {\n \"error.type\": \"resource\",\n \"resource.url\": url,\n \"resource.tag\": target.tagName.toLowerCase(),\n });\n return;\n }\n\n if (!this.ctx.config.capture.errors) {\n return;\n }\n\n const errorEvent = event as ErrorEvent;\n const fallback = errorEvent.message === \"\" ? \"unknown error\" : errorEvent.message;\n const thrown: unknown = errorEvent.error;\n const error = thrown ?? new Error(fallback);\n\n this.report(\"window.onerror\", error, {\n // A signed script URL is a credential.\n \"error.source\": recordedUrl(\n errorEvent.filename,\n this.ctx.config.capture.fullUrls,\n this.ctx.config.capture.urlTransform,\n this.ctx.diagnostics,\n ),\n \"error.line\": errorEvent.lineno,\n \"error.column\": errorEvent.colno,\n });\n };\n\n /** Captures unhandled promise rejections. */\n private readonly onRejection = (event: PromiseRejectionEvent): void => {\n if (!this.ctx.config.capture.rejections) {\n return;\n }\n\n this.report(\"unhandledrejection\", event.reason, {\n \"error.type\": \"unhandledrejection\",\n });\n };\n\n /**\n * Rate limits, deduplicates, and logs captured errors.\n * @param source Originating capture event name.\n * @param error Caught error instance or thrown value.\n * @param extra Contextual error attributes.\n */\n private report(source: string, error: unknown, extra: Record<string, unknown>): void {\n if (\n !allowInWindow(\n this.window,\n this.ctx.config.capturePolicy.errorsPerWindow,\n this.ctx.diagnostics,\n \"errors\",\n this.ctx.config.capturePolicy.windowMs,\n )\n ) {\n return;\n }\n\n const now = Date.now();\n // A reason with no text form, for example a null-prototype object, gets an empty message.\n // The record then uses the source as its message.\n const { message, key } = this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not read the error reason. It records the error without its message.\",\n () => signatureOf(error),\n ) ?? { message: \"\", key: `${typeof error}||` };\n const previous = this.seen.get(key);\n\n if (previous && now - previous.at < this.ctx.config.capturePolicy.errorDedupeMs) {\n previous.count++;\n previous.at = now;\n return;\n }\n\n // This is the number of occurrences that deduplication dropped since the last report.\n // Without this count, many errors look like few errors.\n const suppressed = previous ? previous.count - 1 : 0;\n\n // Delete, then set, to move the key to the end of the map. The map stays in\n // least-recently-reported order. The eviction below needs this order.\n this.seen.delete(key);\n this.seen.set(key, { at: now, count: 1 });\n\n // A page can throw with a new message at each render, for example from a template literal\n // in a loop. Without this cap, the map grows until the document closes.\n if (\n this.ctx.config.capturePolicy.maxErrorSignatures > 0 &&\n this.seen.size > this.ctx.config.capturePolicy.maxErrorSignatures\n ) {\n const [oldest] = this.seen.keys();\n this.seen.delete(oldest);\n }\n\n // Give the original value to the logger. It converts the reason and keeps its data.\n // Without a reason, the record still needs error.message and error.stack_trace.\n const reason = error === undefined ? new Error(message) : error;\n this.ctx.logger.error(message === \"\" ? source : message, reason, {\n ...extra,\n \"error.captured_by\": source,\n \"error.suppressed_count\": suppressed,\n });\n }\n}\n"],"mappings":";;;;AAgCA,SAASG,EAAY,GAA2B;CAC9C,IAAIH,EAAYI,CAAK,GAAG;EACtB,IAAMC,KAASD,EAAM,SAAS,GAAA,CAAI,MAAM,IAAI,CAAC,CAAC,MAAM;EACpD,OAAO;GAAE,SAASA,EAAM;GAAS,KAAK,GAAGA,EAAM,KAAK,GAAGA,EAAM,QAAQ,GAAGC;EAAQ;CAClF;CAEA,IAAMC,IAAU,OAAOF,CAAK;CAC5B,OAAO;EAAE;EAAS,KAAK,GAAG,OAAOA,EAAM,GAAGE,EAAQ;CAAG;AACvD;AAGA,IAAaC,IAAb,MAA6C;CAgBd;CAd7B,OAA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;AACF"}
@@ -1,3 +0,0 @@
1
- const e=require("./error-like-gGRx2s36.cjs"),t=require("./platform-C2Ez5kDc.cjs"),n=require("./storm-CYi9Swpx.cjs");function r(t){if(e.r(t)){let e=(t.stack??``).split(`
2
- `)[1]??``;return{message:t.message,key:`${t.name}|${t.message}|${e}`}}let n=String(t);return{message:n,key:`${typeof t}|${n}|`}}var i=class{ctx;name=`errors`;installed=!1;seen=new Map;window={start:0,count:0};constructor(e){this.ctx=e}install(){this.installed||typeof addEventListener>`u`||(this.installed=!0,addEventListener(`error`,this.onError,!0),addEventListener(`unhandledrejection`,this.onRejection))}uninstall(){this.installed&&(this.installed=!1,removeEventListener(`error`,this.onError,!0),removeEventListener(`unhandledrejection`,this.onRejection),this.seen.clear())}onError=e=>{let n=e.target,r=n?.src??n?.href??``;if(n!==null&&n!==globalThis&&r!==``){if(!this.ctx.config.capture.resourceErrors)return;let e=t.i(r,this.ctx.config.capture.fullUrls,this.ctx.config.capture.urlTransform,this.ctx.diagnostics);this.ctx.breadcrumbs.push({t:Date.now(),category:`http`,message:`resource failed: ${e}`}),this.ctx.logger.warn(`resource failed to load`,{"error.type":`resource`,"resource.url":e,"resource.tag":n.tagName.toLowerCase()});return}if(!this.ctx.config.capture.errors)return;let i=e,a=i.message===``?`unknown error`:i.message,o=i.error??Error(a);this.report(`window.onerror`,o,{"error.source":t.i(i.filename,this.ctx.config.capture.fullUrls,this.ctx.config.capture.urlTransform,this.ctx.diagnostics),"error.line":i.lineno,"error.column":i.colno})};onRejection=e=>{this.ctx.config.capture.rejections&&this.report(`unhandledrejection`,e.reason,{"error.type":`unhandledrejection`})};report(e,t,i){if(!n.t(this.window,this.ctx.config.capturePolicy.errorsPerWindow,this.ctx.diagnostics,`errors`,this.ctx.config.capturePolicy.windowMs))return;let a=Date.now(),{message:o,key:s}=this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not read the error reason. It records the error without its message.`,()=>r(t))??{message:``,key:`${typeof t}||`},c=this.seen.get(s);if(c&&a-c.at<this.ctx.config.capturePolicy.errorDedupeMs){c.count++,c.at=a;return}let l=c?c.count-1:0;if(this.seen.delete(s),this.seen.set(s,{at:a,count:1}),this.ctx.config.capturePolicy.maxErrorSignatures>0&&this.seen.size>this.ctx.config.capturePolicy.maxErrorSignatures){let[e]=this.seen.keys();this.seen.delete(e)}let u=t===void 0?Error(o):t;this.ctx.logger.error(o===``?e:o,u,{...i,"error.captured_by":e,"error.suppressed_count":l})}};exports.ErrorCapture=i;
3
- //# sourceMappingURL=errors-tfEr48bS.cjs.map