@utk09/ui-observability 0.10.0 → 0.12.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 (406) hide show
  1. package/CHANGELOG.md +77 -1
  2. package/README.md +323 -113
  3. package/bin/uiobs.mjs +1 -1
  4. package/dist/{batch-BMdT9mKm.js → batch-BjQUwjA6.js} +5 -6
  5. package/dist/batch-BjQUwjA6.js.map +1 -0
  6. package/dist/{batch-BHXypM1j.cjs → batch-D5LlU4Q9.cjs} +2 -2
  7. package/dist/batch-D5LlU4Q9.cjs.map +1 -0
  8. package/dist/bus/bus.d.ts +48 -47
  9. package/dist/bus/links.d.ts +4 -4
  10. package/dist/bus/validation.d.ts +1 -1
  11. package/dist/bus-D_7pd7RN.cjs +2 -0
  12. package/dist/bus-D_7pd7RN.cjs.map +1 -0
  13. package/dist/{bus-DKfBaica.js → bus-ecxUNTja.js} +105 -109
  14. package/dist/bus-ecxUNTja.js.map +1 -0
  15. package/dist/capture/console.d.ts +10 -10
  16. package/dist/capture/errors.d.ts +6 -6
  17. package/dist/capture/interactions.d.ts +14 -14
  18. package/dist/capture/lifecycle.d.ts +3 -3
  19. package/dist/capture/long-frames.d.ts +6 -6
  20. package/dist/capture/network.d.ts +17 -17
  21. package/dist/capture/profiler-frames.d.ts +44 -0
  22. package/dist/capture/replay-buffer.d.ts +46 -0
  23. package/dist/capture/replay-upload.d.ts +74 -0
  24. package/dist/capture/replay.d.ts +114 -0
  25. package/dist/capture/reports.d.ts +2 -2
  26. package/dist/capture/resource-timing.d.ts +1 -1
  27. package/dist/capture/server-timing.d.ts +3 -3
  28. package/dist/capture/storm.d.ts +3 -3
  29. package/dist/capture/types.d.ts +45 -33
  30. package/dist/capture/unclean-exit.d.ts +8 -8
  31. package/dist/capture/user-timing.d.ts +3 -3
  32. package/dist/capture/web-socket.d.ts +11 -11
  33. package/dist/capture/web-vitals.d.ts +20 -7
  34. package/dist/compression-AJJCMBOa.js +11 -0
  35. package/dist/compression-AJJCMBOa.js.map +1 -0
  36. package/dist/compression-lD9abCcO.cjs +2 -0
  37. package/dist/compression-lD9abCcO.cjs.map +1 -0
  38. package/dist/console-CLz_PvFn.cjs +2 -0
  39. package/dist/console-CLz_PvFn.cjs.map +1 -0
  40. package/dist/{console-BX_0UCV7.js → console-cwgHKXvM.js} +14 -15
  41. package/dist/console-cwgHKXvM.js.map +1 -0
  42. package/dist/constants-Bwl_YtQi.js +349 -0
  43. package/dist/constants-Bwl_YtQi.js.map +1 -0
  44. package/dist/constants-DakMxVB2.cjs +2 -0
  45. package/dist/constants-DakMxVB2.cjs.map +1 -0
  46. package/dist/constants.d.ts +150 -103
  47. package/dist/context-storage-BjzeBSxH.cjs.map +1 -1
  48. package/dist/{context-storage-DxZf4Gfh.js → context-storage-BzkoHzkQ.js} +2 -3
  49. package/dist/context-storage-BzkoHzkQ.js.map +1 -0
  50. package/dist/core/breadcrumbs.d.ts +16 -15
  51. package/dist/core/config.d.ts +3 -3
  52. package/dist/core/context.d.ts +7 -7
  53. package/dist/core/debug-buffer.d.ts +10 -10
  54. package/dist/core/debug-bundle.d.ts +3 -3
  55. package/dist/core/deferred.d.ts +2 -2
  56. package/dist/core/diagnostics.d.ts +24 -21
  57. package/dist/core/drops.d.ts +7 -7
  58. package/dist/core/hold-buffer.d.ts +1 -1
  59. package/dist/core/journey.d.ts +22 -23
  60. package/dist/core/logger.d.ts +22 -21
  61. package/dist/core/measure.d.ts +7 -7
  62. package/dist/core/meter.d.ts +25 -21
  63. package/dist/core/pipeline.d.ts +42 -41
  64. package/dist/core/profile-buckets.d.ts +31 -0
  65. package/dist/core/profiler.d.ts +218 -0
  66. package/dist/core/record.d.ts +23 -23
  67. package/dist/core/remote-rules.d.ts +4 -4
  68. package/dist/core/remote-sampling.d.ts +21 -20
  69. package/dist/core/runtime.d.ts +206 -137
  70. package/dist/core/sampling.d.ts +18 -18
  71. package/dist/core/sender.d.ts +22 -20
  72. package/dist/core/spans.d.ts +5 -5
  73. package/dist/{deadline-5_PecIl5.js → deadline-C4ccAuk5.js} +4 -9
  74. package/dist/deadline-C4ccAuk5.js.map +1 -0
  75. package/dist/deadline-CUGbto-y.cjs +2 -0
  76. package/dist/deadline-CUGbto-y.cjs.map +1 -0
  77. package/dist/{debug-bundle-CZZ6SQQh.js → debug-bundle-BOdYmCeV.js} +12 -6
  78. package/dist/debug-bundle-BOdYmCeV.js.map +1 -0
  79. package/dist/debug-bundle-Ex4L_LSP.cjs +2 -0
  80. package/dist/debug-bundle-Ex4L_LSP.cjs.map +1 -0
  81. package/dist/doctor.cjs +1 -1
  82. package/dist/doctor.cjs.map +1 -1
  83. package/dist/doctor.d.ts +16 -6
  84. package/dist/doctor.js +148 -54
  85. package/dist/doctor.js.map +1 -1
  86. package/dist/{emergency-queue-Cs8-i2xw.js → emergency-queue-B9WZxanZ.js} +15 -17
  87. package/dist/emergency-queue-B9WZxanZ.js.map +1 -0
  88. package/dist/{emergency-queue-CQ-9acZf.cjs → emergency-queue-HBpL5r3V.cjs} +2 -2
  89. package/dist/emergency-queue-HBpL5r3V.cjs.map +1 -0
  90. package/dist/{error-like-Ywo5uRHo.js → error-like-B11pB4aL.js} +2 -3
  91. package/dist/error-like-B11pB4aL.js.map +1 -0
  92. package/dist/error-like-gGRx2s36.cjs.map +1 -1
  93. package/dist/{errors-oyxrpHjY.js → errors-D6bwgJtO.js} +5 -6
  94. package/dist/errors-D6bwgJtO.js.map +1 -0
  95. package/dist/{errors-CigX45pL.cjs → errors-DCOCRdSi.cjs} +2 -2
  96. package/dist/errors-DCOCRdSi.cjs.map +1 -0
  97. package/dist/{factory-BkjNzPYL.cjs → factory-DLFDjdLv.cjs} +2 -2
  98. package/dist/factory-DLFDjdLv.cjs.map +1 -0
  99. package/dist/{factory-Bgsky_e0.js → factory-e9Qo3K0z.js} +18 -22
  100. package/dist/factory-e9Qo3K0z.js.map +1 -0
  101. package/dist/fixed-window-CvESpFYV.cjs.map +1 -1
  102. package/dist/{fixed-window-CtaFHanJ.js → fixed-window-Dq3MLUUv.js} +2 -3
  103. package/dist/fixed-window-Dq3MLUUv.js.map +1 -0
  104. package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
  105. package/dist/{global-scope-dp2jADRl.js → global-scope-D9I8s-oN.js} +2 -3
  106. package/dist/global-scope-D9I8s-oN.js.map +1 -0
  107. package/dist/{guards-CpvOpJL6.js → guards-Cidk71ME.js} +2 -3
  108. package/dist/guards-Cidk71ME.js.map +1 -0
  109. package/dist/guards-nJ70syPt.cjs.map +1 -1
  110. package/dist/{identity-BMlKGHUM.cjs → identity-BlvlgjrU.cjs} +2 -2
  111. package/dist/identity-BlvlgjrU.cjs.map +1 -0
  112. package/dist/{identity-DOaHdfhT.js → identity-BrQp_5J5.js} +20 -21
  113. package/dist/identity-BrQp_5J5.js.map +1 -0
  114. package/dist/index.cjs +1 -1
  115. package/dist/index.cjs.map +1 -1
  116. package/dist/index.d.ts +112 -79
  117. package/dist/index.js +797 -659
  118. package/dist/index.js.map +1 -1
  119. package/dist/{indexeddb-storage-CaXGJqDD.cjs → indexeddb-storage-CtLvZH1r.cjs} +2 -2
  120. package/dist/indexeddb-storage-CtLvZH1r.cjs.map +1 -0
  121. package/dist/{indexeddb-storage-D-lUW_5P.js → indexeddb-storage-DLXQzAGh.js} +5 -6
  122. package/dist/indexeddb-storage-DLXQzAGh.js.map +1 -0
  123. package/dist/{interactions-CqDNrtIR.js → interactions-B6z2I4tU.js} +10 -11
  124. package/dist/interactions-B6z2I4tU.js.map +1 -0
  125. package/dist/{interactions-8DgxtmgO.cjs → interactions-P6pz08Jn.cjs} +2 -2
  126. package/dist/interactions-P6pz08Jn.cjs.map +1 -0
  127. package/dist/{journey-DgIjhrIc.js → journey-35yCMNFo.js} +21 -21
  128. package/dist/journey-35yCMNFo.js.map +1 -0
  129. package/dist/journey-DAGh5h9k.cjs +2 -0
  130. package/dist/journey-DAGh5h9k.cjs.map +1 -0
  131. package/dist/keys-BHhw_0Wh.cjs.map +1 -1
  132. package/dist/{keys-D5r_GH9q.js → keys-BU9j5YqW.js} +2 -3
  133. package/dist/keys-BU9j5YqW.js.map +1 -0
  134. package/dist/{library-console-g_VU-wzP.cjs → library-console-BFWEuQsl.cjs} +2 -2
  135. package/dist/library-console-BFWEuQsl.cjs.map +1 -0
  136. package/dist/library-console-Dl_Ly6DQ.js +13 -0
  137. package/dist/library-console-Dl_Ly6DQ.js.map +1 -0
  138. package/dist/{library-request-FQaiWjCP.cjs → library-request-Da-CHKzT.cjs} +2 -2
  139. package/dist/library-request-Da-CHKzT.cjs.map +1 -0
  140. package/dist/{library-request-CyC-9IOk.js → library-request-nI6pvI6I.js} +4 -5
  141. package/dist/library-request-nI6pvI6I.js.map +1 -0
  142. package/dist/{lifecycle-C2z_d8OX.cjs → lifecycle-BGGOcN4N.cjs} +2 -2
  143. package/dist/lifecycle-BGGOcN4N.cjs.map +1 -0
  144. package/dist/{lifecycle-BLC4VU7c.js → lifecycle-CZ6RRXc6.js} +3 -4
  145. package/dist/lifecycle-CZ6RRXc6.js.map +1 -0
  146. package/dist/{log-record-DKvo-B-d.cjs → log-record-D7bA1RPb.cjs} +2 -2
  147. package/dist/log-record-D7bA1RPb.cjs.map +1 -0
  148. package/dist/{log-record-CndanC-p.js → log-record-DIA6McNr.js} +3 -4
  149. package/dist/log-record-DIA6McNr.js.map +1 -0
  150. package/dist/{long-frames-BQef9rXR.js → long-frames-430_85Da.js} +9 -8
  151. package/dist/long-frames-430_85Da.js.map +1 -0
  152. package/dist/long-frames-Dd8tsi2U.cjs +2 -0
  153. package/dist/long-frames-Dd8tsi2U.cjs.map +1 -0
  154. package/dist/models/batch.d.ts +14 -15
  155. package/dist/models/bus.d.ts +24 -24
  156. package/dist/models/config.d.ts +402 -216
  157. package/dist/models/drop.d.ts +13 -11
  158. package/dist/models/health.d.ts +13 -13
  159. package/dist/models/log-record.d.ts +13 -14
  160. package/dist/models/metric.d.ts +82 -17
  161. package/dist/models/plugin.d.ts +13 -13
  162. package/dist/models/replay.d.ts +60 -0
  163. package/dist/models/serializer.d.ts +2 -3
  164. package/dist/models/stats.d.ts +2 -2
  165. package/dist/models/storage.d.ts +12 -11
  166. package/dist/{network-CvkvYzRU.js → network-C7SkLf4v.js} +30 -32
  167. package/dist/network-C7SkLf4v.js.map +1 -0
  168. package/dist/{network-CqnQOqon.cjs → network-pEX3PAJv.cjs} +2 -2
  169. package/dist/network-pEX3PAJv.cjs.map +1 -0
  170. package/dist/openfin-Bxelt0yg.js +7 -0
  171. package/dist/openfin-Bxelt0yg.js.map +1 -0
  172. package/dist/openfin-DtH2f7zX.cjs.map +1 -1
  173. package/dist/otlp-2MCrC3kd.cjs +2 -0
  174. package/dist/otlp-2MCrC3kd.cjs.map +1 -0
  175. package/dist/{otlp-CYIL7MOE.js → otlp-COq033e3.js} +26 -35
  176. package/dist/otlp-COq033e3.js.map +1 -0
  177. package/dist/patch-BX8KrPCT.cjs.map +1 -1
  178. package/dist/{patch-CCWfuEY7.js → patch-UdPz1ea8.js} +2 -3
  179. package/dist/patch-UdPz1ea8.js.map +1 -0
  180. package/dist/{platform-KMWkoI-v.cjs → platform-12uR7kBQ.cjs} +2 -2
  181. package/dist/platform-12uR7kBQ.cjs.map +1 -0
  182. package/dist/{platform-wcAkkv9F.js → platform-CVewe4wQ.js} +9 -10
  183. package/dist/platform-CVewe4wQ.js.map +1 -0
  184. package/dist/profiler-BVWIOgnq.js +310 -0
  185. package/dist/profiler-BVWIOgnq.js.map +1 -0
  186. package/dist/profiler-eVCknCzS.cjs +2 -0
  187. package/dist/profiler-eVCknCzS.cjs.map +1 -0
  188. package/dist/profiler-frames-CLXlT_xL.js +86 -0
  189. package/dist/profiler-frames-CLXlT_xL.js.map +1 -0
  190. package/dist/profiler-frames-Dg2OebB2.cjs +2 -0
  191. package/dist/profiler-frames-Dg2OebB2.cjs.map +1 -0
  192. package/dist/{remote-rules-CH_7PphT.js → remote-rules-BJGDJGwA.js} +29 -30
  193. package/dist/remote-rules-BJGDJGwA.js.map +1 -0
  194. package/dist/{remote-rules-BL8km4xk.cjs → remote-rules-CJD3ToVk.cjs} +2 -2
  195. package/dist/remote-rules-CJD3ToVk.cjs.map +1 -0
  196. package/dist/replay-0zAJv9T3.js +338 -0
  197. package/dist/replay-0zAJv9T3.js.map +1 -0
  198. package/dist/replay-DomJpXqW.cjs +2 -0
  199. package/dist/replay-DomJpXqW.cjs.map +1 -0
  200. package/dist/{reports-Bh_-KpZ2.cjs → reports-BsbqmP8h.cjs} +2 -2
  201. package/dist/reports-BsbqmP8h.cjs.map +1 -0
  202. package/dist/{reports-BOKyY3_A.js → reports-BuXekPOS.js} +4 -5
  203. package/dist/reports-BuXekPOS.js.map +1 -0
  204. package/dist/{resource-timing-BROnEJ0E.js → resource-timing-CXGHwFRD.js} +6 -7
  205. package/dist/resource-timing-CXGHwFRD.js.map +1 -0
  206. package/dist/{resource-timing-CbgwNpog.cjs → resource-timing-DkycFGDa.cjs} +2 -2
  207. package/dist/resource-timing-DkycFGDa.cjs.map +1 -0
  208. package/dist/{sampling-ECGVYiDD.cjs → sampling-Dd0wllyq.cjs} +2 -2
  209. package/dist/sampling-Dd0wllyq.cjs.map +1 -0
  210. package/dist/{sampling-BLO_pcV4.js → sampling-UUDbi3K0.js} +11 -12
  211. package/dist/sampling-UUDbi3K0.js.map +1 -0
  212. package/dist/{sanitize-DS0G4_ea.js → sanitize-CNmsD9r3.js} +4 -5
  213. package/dist/sanitize-CNmsD9r3.js.map +1 -0
  214. package/dist/{sanitize-Bsn8HQWC.cjs → sanitize-ChLn97Ch.cjs} +2 -2
  215. package/dist/sanitize-ChLn97Ch.cjs.map +1 -0
  216. package/dist/{select-DWO0-w8_.cjs → select-CTk-K5mG.cjs} +3 -3
  217. package/dist/select-CTk-K5mG.cjs.map +1 -0
  218. package/dist/{select-wqt9Wxio.js → select-DPv_j6wq.js} +64 -67
  219. package/dist/select-DPv_j6wq.js.map +1 -0
  220. package/dist/{sender-BkAVt-Rq.js → sender-15zEsZpr.js} +98 -101
  221. package/dist/sender-15zEsZpr.js.map +1 -0
  222. package/dist/sender-Bfpv9tad.cjs +2 -0
  223. package/dist/sender-Bfpv9tad.cjs.map +1 -0
  224. package/dist/storage/context-storage.d.ts +34 -33
  225. package/dist/storage/emergency-queue.d.ts +9 -9
  226. package/dist/storage/eviction.d.ts +12 -12
  227. package/dist/storage/factory.d.ts +8 -7
  228. package/dist/storage/gap.d.ts +6 -6
  229. package/dist/storage/idb-driver.d.ts +31 -32
  230. package/dist/storage/indexeddb-storage.d.ts +26 -27
  231. package/dist/storage/keys.d.ts +7 -7
  232. package/dist/storage/local-storage.d.ts +38 -38
  233. package/dist/storage/memory-storage.d.ts +21 -22
  234. package/dist/storage/persistence.d.ts +1 -1
  235. package/dist/storage-BA9RqRO-.cjs.map +1 -1
  236. package/dist/{storage-w7Tslvlq.js → storage-DZwed89z.js} +2 -3
  237. package/dist/storage-DZwed89z.js.map +1 -0
  238. package/dist/{storm-DD4cUkoL.js → storm-BTSNTIWI.js} +4 -5
  239. package/dist/storm-BTSNTIWI.js.map +1 -0
  240. package/dist/{storm-DCEsqViG.cjs → storm-D0_qZOEg.cjs} +2 -2
  241. package/dist/storm-D0_qZOEg.cjs.map +1 -0
  242. package/dist/transport/compression.d.ts +2 -2
  243. package/dist/transport/errors.d.ts +7 -7
  244. package/dist/transport/exit-flush.d.ts +39 -39
  245. package/dist/transport/headers.d.ts +2 -2
  246. package/dist/transport/http-transport.d.ts +28 -27
  247. package/dist/transport/memory-transport.d.ts +6 -6
  248. package/dist/transport/retry-engine.d.ts +35 -34
  249. package/dist/transport/serializers/ecs.d.ts +1 -1
  250. package/dist/transport/serializers/otlp-metrics.d.ts +1 -1
  251. package/dist/transport/serializers/otlp-traces.d.ts +1 -1
  252. package/dist/transport/serializers/otlp.d.ts +16 -16
  253. package/dist/transport/serializers/select.d.ts +7 -7
  254. package/dist/transport/status-transport.d.ts +20 -20
  255. package/dist/transport/worker-protocol.d.ts +3 -3
  256. package/dist/{types-BR9t_w28.js → types-BAerHgCq.js} +2 -3
  257. package/dist/types-BAerHgCq.js.map +1 -0
  258. package/dist/types-C7WNpnG1.cjs.map +1 -1
  259. package/dist/{unclean-exit-CwdpbUDg.cjs → unclean-exit-ClGzrc2A.cjs} +2 -2
  260. package/dist/unclean-exit-ClGzrc2A.cjs.map +1 -0
  261. package/dist/{unclean-exit-BYZ5yaSI.js → unclean-exit-Cob_jyTv.js} +3 -4
  262. package/dist/unclean-exit-Cob_jyTv.js.map +1 -0
  263. package/dist/unref-CU9Nyz_9.cjs +2 -0
  264. package/dist/unref-CU9Nyz_9.cjs.map +1 -0
  265. package/dist/unref-DgHPQeWv.js +7 -0
  266. package/dist/unref-DgHPQeWv.js.map +1 -0
  267. package/dist/user-timing-CdYqx3PF.cjs +2 -0
  268. package/dist/user-timing-CdYqx3PF.cjs.map +1 -0
  269. package/dist/{user-timing-Di2ra5DB.js → user-timing-DgHubxCI.js} +7 -6
  270. package/dist/user-timing-DgHubxCI.js.map +1 -0
  271. package/dist/utils/console.d.ts +2 -2
  272. package/dist/utils/deadline.d.ts +4 -4
  273. package/dist/utils/error-like.d.ts +7 -7
  274. package/dist/utils/fixed-window.d.ts +9 -8
  275. package/dist/utils/global-scope.d.ts +8 -8
  276. package/dist/utils/guards.d.ts +2 -2
  277. package/dist/utils/identity.d.ts +17 -17
  278. package/dist/utils/library-console.d.ts +4 -4
  279. package/dist/utils/library-request.d.ts +10 -10
  280. package/dist/utils/lock.d.ts +10 -9
  281. package/dist/utils/openfin.d.ts +5 -5
  282. package/dist/utils/patch.d.ts +6 -6
  283. package/dist/utils/platform.d.ts +13 -11
  284. package/dist/utils/sanitize.d.ts +4 -4
  285. package/dist/utils/timer.d.ts +1 -1
  286. package/dist/utils/tracing.d.ts +38 -38
  287. package/dist/utils/unref.d.ts +3 -3
  288. package/dist/{web-socket-DwBNhgre.cjs → web-socket-BTuvYoJI.cjs} +2 -2
  289. package/dist/web-socket-BTuvYoJI.cjs.map +1 -0
  290. package/dist/{web-socket-B-5qqPy7.js → web-socket-DthJuSAg.js} +14 -15
  291. package/dist/web-socket-DthJuSAg.js.map +1 -0
  292. package/dist/web-vitals-Ch5BpDmo.cjs +2 -0
  293. package/dist/web-vitals-Ch5BpDmo.cjs.map +1 -0
  294. package/dist/web-vitals-CsGCWnUr.js +77 -0
  295. package/dist/web-vitals-CsGCWnUr.js.map +1 -0
  296. package/dist/{worker-protocol-0HMf4-kY.js → worker-protocol-B0_8rWy5.js} +6 -7
  297. package/dist/worker-protocol-B0_8rWy5.js.map +1 -0
  298. package/dist/{worker-protocol-DXekoADQ.cjs → worker-protocol-BjzFORfq.cjs} +2 -2
  299. package/dist/worker-protocol-BjzFORfq.cjs.map +1 -0
  300. package/dist/worker-server-4en-Lt-3.cjs +2 -0
  301. package/dist/worker-server-4en-Lt-3.cjs.map +1 -0
  302. package/dist/{worker-server-CKcmX5m5.js → worker-server-Cne9MX9I.js} +25 -26
  303. package/dist/{worker-server-CKcmX5m5.js.map → worker-server-Cne9MX9I.js.map} +1 -1
  304. package/dist/worker-transport-B-GF4Aqn.cjs +2 -0
  305. package/dist/worker-transport-B-GF4Aqn.cjs.map +1 -0
  306. package/dist/{worker-transport-2220ghFZ.js → worker-transport-C3SjJAEC.js} +64 -65
  307. package/dist/worker-transport-C3SjJAEC.js.map +1 -0
  308. package/package.json +33 -41
  309. package/dist/batch-BHXypM1j.cjs.map +0 -1
  310. package/dist/batch-BMdT9mKm.js.map +0 -1
  311. package/dist/bus-DKfBaica.js.map +0 -1
  312. package/dist/bus-Dea9rVhy.cjs +0 -2
  313. package/dist/bus-Dea9rVhy.cjs.map +0 -1
  314. package/dist/console-BX_0UCV7.js.map +0 -1
  315. package/dist/console-DZEcs7FL.cjs +0 -2
  316. package/dist/console-DZEcs7FL.cjs.map +0 -1
  317. package/dist/constants-CL0ZdI2f.cjs +0 -2
  318. package/dist/constants-CL0ZdI2f.cjs.map +0 -1
  319. package/dist/constants-CU60FG4w.js +0 -305
  320. package/dist/constants-CU60FG4w.js.map +0 -1
  321. package/dist/context-storage-DxZf4Gfh.js.map +0 -1
  322. package/dist/deadline-5_PecIl5.js.map +0 -1
  323. package/dist/deadline-XSnm95pg.cjs +0 -2
  324. package/dist/deadline-XSnm95pg.cjs.map +0 -1
  325. package/dist/debug-bundle-CZZ6SQQh.js.map +0 -1
  326. package/dist/debug-bundle-yRkrU1ny.cjs +0 -2
  327. package/dist/debug-bundle-yRkrU1ny.cjs.map +0 -1
  328. package/dist/emergency-queue-CQ-9acZf.cjs.map +0 -1
  329. package/dist/emergency-queue-Cs8-i2xw.js.map +0 -1
  330. package/dist/error-like-Ywo5uRHo.js.map +0 -1
  331. package/dist/errors-CigX45pL.cjs.map +0 -1
  332. package/dist/errors-oyxrpHjY.js.map +0 -1
  333. package/dist/factory-Bgsky_e0.js.map +0 -1
  334. package/dist/factory-BkjNzPYL.cjs.map +0 -1
  335. package/dist/fixed-window-CtaFHanJ.js.map +0 -1
  336. package/dist/global-scope-dp2jADRl.js.map +0 -1
  337. package/dist/guards-CpvOpJL6.js.map +0 -1
  338. package/dist/identity-BMlKGHUM.cjs.map +0 -1
  339. package/dist/identity-DOaHdfhT.js.map +0 -1
  340. package/dist/indexeddb-storage-CaXGJqDD.cjs.map +0 -1
  341. package/dist/indexeddb-storage-D-lUW_5P.js.map +0 -1
  342. package/dist/interactions-8DgxtmgO.cjs.map +0 -1
  343. package/dist/interactions-CqDNrtIR.js.map +0 -1
  344. package/dist/journey-5tcxEbnG.cjs +0 -2
  345. package/dist/journey-5tcxEbnG.cjs.map +0 -1
  346. package/dist/journey-DgIjhrIc.js.map +0 -1
  347. package/dist/keys-D5r_GH9q.js.map +0 -1
  348. package/dist/library-console-CabK2j2-.js +0 -14
  349. package/dist/library-console-CabK2j2-.js.map +0 -1
  350. package/dist/library-console-g_VU-wzP.cjs.map +0 -1
  351. package/dist/library-request-CyC-9IOk.js.map +0 -1
  352. package/dist/library-request-FQaiWjCP.cjs.map +0 -1
  353. package/dist/lifecycle-BLC4VU7c.js.map +0 -1
  354. package/dist/lifecycle-C2z_d8OX.cjs.map +0 -1
  355. package/dist/log-record-CndanC-p.js.map +0 -1
  356. package/dist/log-record-DKvo-B-d.cjs.map +0 -1
  357. package/dist/long-frames-BQef9rXR.js.map +0 -1
  358. package/dist/long-frames-CV5ZG2cx.cjs +0 -2
  359. package/dist/long-frames-CV5ZG2cx.cjs.map +0 -1
  360. package/dist/network-CqnQOqon.cjs.map +0 -1
  361. package/dist/network-CvkvYzRU.js.map +0 -1
  362. package/dist/openfin-BwEN0uj4.js +0 -8
  363. package/dist/openfin-BwEN0uj4.js.map +0 -1
  364. package/dist/otlp-CYIL7MOE.js.map +0 -1
  365. package/dist/otlp-RVbkNQRh.cjs +0 -2
  366. package/dist/otlp-RVbkNQRh.cjs.map +0 -1
  367. package/dist/patch-CCWfuEY7.js.map +0 -1
  368. package/dist/platform-KMWkoI-v.cjs.map +0 -1
  369. package/dist/platform-wcAkkv9F.js.map +0 -1
  370. package/dist/remote-rules-BL8km4xk.cjs.map +0 -1
  371. package/dist/remote-rules-CH_7PphT.js.map +0 -1
  372. package/dist/reports-BOKyY3_A.js.map +0 -1
  373. package/dist/reports-Bh_-KpZ2.cjs.map +0 -1
  374. package/dist/resource-timing-BROnEJ0E.js.map +0 -1
  375. package/dist/resource-timing-CbgwNpog.cjs.map +0 -1
  376. package/dist/sampling-BLO_pcV4.js.map +0 -1
  377. package/dist/sampling-ECGVYiDD.cjs.map +0 -1
  378. package/dist/sanitize-Bsn8HQWC.cjs.map +0 -1
  379. package/dist/sanitize-DS0G4_ea.js.map +0 -1
  380. package/dist/select-DWO0-w8_.cjs.map +0 -1
  381. package/dist/select-wqt9Wxio.js.map +0 -1
  382. package/dist/sender-BkAVt-Rq.js.map +0 -1
  383. package/dist/sender-D82PxlCY.cjs +0 -2
  384. package/dist/sender-D82PxlCY.cjs.map +0 -1
  385. package/dist/storage-w7Tslvlq.js.map +0 -1
  386. package/dist/storm-DCEsqViG.cjs.map +0 -1
  387. package/dist/storm-DD4cUkoL.js.map +0 -1
  388. package/dist/types-BR9t_w28.js.map +0 -1
  389. package/dist/unclean-exit-BYZ5yaSI.js.map +0 -1
  390. package/dist/unclean-exit-CwdpbUDg.cjs.map +0 -1
  391. package/dist/user-timing-C1kB3JEg.cjs +0 -2
  392. package/dist/user-timing-C1kB3JEg.cjs.map +0 -1
  393. package/dist/user-timing-Di2ra5DB.js.map +0 -1
  394. package/dist/web-socket-B-5qqPy7.js.map +0 -1
  395. package/dist/web-socket-DwBNhgre.cjs.map +0 -1
  396. package/dist/web-vitals-Bflr5jSA.js +0 -53
  397. package/dist/web-vitals-Bflr5jSA.js.map +0 -1
  398. package/dist/web-vitals-DFuoTQbZ.cjs +0 -2
  399. package/dist/web-vitals-DFuoTQbZ.cjs.map +0 -1
  400. package/dist/worker-protocol-0HMf4-kY.js.map +0 -1
  401. package/dist/worker-protocol-DXekoADQ.cjs.map +0 -1
  402. package/dist/worker-server-BQK5z2yl.cjs +0 -2
  403. package/dist/worker-server-BQK5z2yl.cjs.map +0 -1
  404. package/dist/worker-transport-2220ghFZ.js.map +0 -1
  405. package/dist/worker-transport-Dj2yCQN5.cjs +0 -2
  406. package/dist/worker-transport-Dj2yCQN5.cjs.map +0 -1
@@ -1,10 +1,11 @@
1
- import { Bn as e, ot as t, st as n } from "./constants-CU60FG4w.js";
2
- import { n as r, r as i, t as a } from "./deadline-5_PecIl5.js";
3
- import { r as o } from "./platform-wcAkkv9F.js";
4
- import { n as s, s as c, t as l } from "./select-wqt9Wxio.js";
5
- import { a as u, i as d, n as f, r as p, t as m } from "./sender-BkAVt-Rq.js";
6
- import { i as h, n as g, r as _ } from "./worker-protocol-0HMf4-kY.js";
7
- //#region src/transport/worker-client.ts
1
+ import { Qn as e, ot as t, st as n } from "./constants-Bwl_YtQi.js";
2
+ import { n as r, t as i } from "./deadline-C4ccAuk5.js";
3
+ import { r as a } from "./platform-CVewe4wQ.js";
4
+ import { n as o, s, t as c } from "./select-DPv_j6wq.js";
5
+ import { a as l, i as u, n as d, r as f, t as p } from "./sender-15zEsZpr.js";
6
+ import { t as m } from "./unref-DgHPQeWv.js";
7
+ import { i as h, n as g, r as _ } from "./worker-protocol-B0_8rWy5.js";
8
+ // src/transport/worker-client.ts
8
9
  var v = class extends Error {
9
10
  kind;
10
11
  constructor(e) {
@@ -12,7 +13,7 @@ var v = class extends Error {
12
13
  }
13
14
  };
14
15
  function y(t, n) {
15
- let r, a = !1, o = 0, s = (e) => a || e.aborted, c = () => {
16
+ let r, i = !1, a = 0, o = (e) => i || e.aborted, s = () => {
16
17
  let e = r;
17
18
  if (r = void 0, e) {
18
19
  n.guard("transport.http_error", "The transport worker could not be closed.", () => {
@@ -25,16 +26,16 @@ function y(t, n) {
25
26
  for (let t of e.pending.values()) t.reject(new v("channel"));
26
27
  e.pending.clear();
27
28
  }
28
- }, l = (t, r, i) => {
29
+ }, c = (t, r, i) => {
29
30
  try {
30
31
  t.port.postMessage(h(e.send, {
31
32
  id: r,
32
33
  job: i
33
34
  }));
34
35
  } catch (e) {
35
- n.report("transport.http_error", "The transport worker could not clone its batch.", void 0, e), c();
36
+ n.report("transport.http_error", "The transport worker could not clone its batch.", void 0, e), s();
36
37
  }
37
- }, u = () => {
38
+ }, l = () => {
38
39
  if (r) return r;
39
40
  let i;
40
41
  try {
@@ -49,64 +50,63 @@ function y(t, n) {
49
50
  r = a;
50
51
  let o = (t) => {
51
52
  let n = t.data;
52
- if (!g(n)) c();
53
+ if (!g(n)) s();
53
54
  else if (n.t === e.ready) {
54
55
  if (n.ok !== !0) {
55
- c();
56
+ s();
56
57
  return;
57
58
  }
58
59
  if (!a.ready) {
59
60
  a.ready = !0;
60
- for (let [e, t] of a.pending) l(a, e, t.job);
61
+ for (let [e, t] of a.pending) c(a, e, t.job);
61
62
  }
62
- } else n.t !== e.result || typeof n.id != "number" || !_(n.result) ? c() : a.pending.get(n.id)?.resolve(n.result);
63
- }, s = () => {
64
- c();
63
+ } else n.t !== e.result || typeof n.id != "number" || !_(n.result) ? s() : a.pending.get(n.id)?.resolve(n.result);
64
+ }, l = () => {
65
+ s();
65
66
  };
66
- return a.port.addEventListener("message", o), a.port.addEventListener("messageerror", s), i.addEventListener("error", s), i.addEventListener("messageerror", s), a.detach = () => {
67
- a.port.removeEventListener("message", o), a.port.removeEventListener("messageerror", s), a.worker.removeEventListener("error", s), a.worker.removeEventListener("messageerror", s);
67
+ return a.port.addEventListener("message", o), a.port.addEventListener("messageerror", l), i.addEventListener("error", l), i.addEventListener("messageerror", l), a.detach = () => {
68
+ a.port.removeEventListener("message", o), a.port.removeEventListener("messageerror", l), a.worker.removeEventListener("error", l), a.worker.removeEventListener("messageerror", l);
68
69
  }, a.port.start(), i.postMessage(h(e.connect), [n.port2]), a;
69
70
  } catch (e) {
70
- throw n.report("transport.http_error", "The transport worker could not start.", void 0, e), c(), n.guard("transport.http_error", "The transport worker could not stop.", () => i?.terminate()), new v("channel");
71
+ throw n.report("transport.http_error", "The transport worker could not start.", void 0, e), s(), n.guard("transport.http_error", "The transport worker could not stop.", () => i?.terminate()), new v("channel");
71
72
  }
72
73
  };
73
74
  return {
74
- send: async (t, r, a) => {
75
- if (s(r)) throw new v("cancelled");
76
- let d = u();
77
- if (s(r)) throw c(), new v("cancelled");
78
- let f = ++o, p;
75
+ send: async (t, r, i) => {
76
+ if (o(r)) throw new v("cancelled");
77
+ let u = l();
78
+ if (o(r)) throw s(), new v("cancelled");
79
+ let d = ++a, f;
79
80
  try {
80
- return await new Promise((o, s) => {
81
- let u = (t) => {
82
- d.pending.delete(f), n.guard("transport.http_error", "The transport worker request could not be cancelled.", () => {
83
- d.port.postMessage(h(e.cancel, { id: f }));
84
- }), s(new v(t));
85
- }, m = () => {
86
- u("cancelled");
81
+ return await new Promise((a, o) => {
82
+ let l = (t) => {
83
+ u.pending.delete(d), n.guard("transport.http_error", "The transport worker request could not be cancelled.", () => {
84
+ u.port.postMessage(h(e.cancel, { id: d }));
85
+ }), o(new v(t));
86
+ }, p = () => {
87
+ l("cancelled");
87
88
  }, g = setTimeout(() => {
88
- d.ready ? u("timeout") : c();
89
- }, a);
90
- i(g), p = () => {
91
- clearTimeout(g), r.removeEventListener("abort", m), d.pending.delete(f);
92
- }, d.pending.set(f, {
89
+ u.ready ? l("timeout") : s();
90
+ }, i);
91
+ m(g), f = () => {
92
+ clearTimeout(g), r.removeEventListener("abort", p), u.pending.delete(d);
93
+ }, u.pending.set(d, {
93
94
  job: t,
94
- resolve: o,
95
- reject: s
96
- }), r.addEventListener("abort", m, { once: !0 }), d.ready && l(d, f, t);
95
+ resolve: a,
96
+ reject: o
97
+ }), r.addEventListener("abort", p, { once: !0 }), u.ready && c(u, d, t);
97
98
  });
98
99
  } finally {
99
- p();
100
+ f();
100
101
  }
101
102
  },
102
103
  close: () => {
103
- a = !0, c();
104
+ i = !0, s();
104
105
  }
105
106
  };
106
107
  }
107
- //#endregion
108
- //#region src/transport/worker-transport.ts
109
- var b = class extends u {
108
+ // src/transport/worker-transport.ts
109
+ var b = class extends l {
110
110
  http;
111
111
  loss;
112
112
  client;
@@ -117,27 +117,27 @@ var b = class extends u {
117
117
  }
118
118
  async send(e, t) {
119
119
  this.assertContext(e);
120
- let n = l(e, this.config), r = s(n, this.config);
120
+ let n = c(e, this.config), r = o(n, this.config);
121
121
  if (!r) {
122
122
  this.diagnostics.count("record.dropped_no_destination");
123
123
  return;
124
124
  }
125
125
  if (e.records.length === 0) return;
126
- let i = this.workerClient(), u = typeof document < "u" && document.visibilityState === "hidden";
127
- if (!i || typeof this.config.serializer != "string" || u) {
126
+ let l = this.workerClient(), u = typeof document < "u" && document.visibilityState === "hidden";
127
+ if (!l || typeof this.config.serializer != "string" || u) {
128
128
  await this.http.send(e, t);
129
129
  return;
130
130
  }
131
131
  let d;
132
132
  try {
133
- if (d = await this.attempt(i, e, n, r, this.config.serializer), this.assertContext(e), "status" in d && (d.status === 401 || d.status === 403) && typeof this.config.headers == "function" && (p(this.http), d = await this.attempt(i, e, n, r, this.config.serializer), this.assertContext(e)), "failure" in d && d.failure === "protocol") throw new v("channel");
133
+ if (d = await this.attempt(l, e, n, r, this.config.serializer), this.assertContext(e), "status" in d && (d.status === 401 || d.status === 403) && typeof this.config.headers == "function" && (f(this.http), d = await this.attempt(l, e, n, r, this.config.serializer), this.assertContext(e)), "failure" in d && d.failure === "protocol") throw new v("channel");
134
134
  } catch (n) {
135
- if (this.diagnostics.report("transport.http_error", "The transport worker request failed.", void 0, n), this.assertContext(e), n instanceof a || n instanceof v && n.kind === "timeout") throw this.diagnostics.report("transport.timeout", "The transport worker request exceeded its time limit."), new c("timeout", "The transport worker request exceeded its time limit.");
135
+ if (this.diagnostics.report("transport.http_error", "The transport worker request failed.", void 0, n), this.assertContext(e), n instanceof i || n instanceof v && n.kind === "timeout") throw this.diagnostics.report("transport.timeout", "The transport worker request exceeded its time limit."), new s("timeout", "The transport worker request exceeded its time limit.");
136
136
  if (n instanceof v && n.kind === "channel") {
137
- this.client === i && (this.disabled = !0, i.close()), await this.http.send(e, t);
137
+ this.client === l && (this.disabled = !0, l.close()), await this.http.send(e, t);
138
138
  return;
139
139
  }
140
- throw new c("transient", "The transport worker request failed.");
140
+ throw new s("transient", "The transport worker request failed.");
141
141
  }
142
142
  if ("failure" in d) {
143
143
  if (d.failure === "serialize") {
@@ -145,13 +145,13 @@ var b = class extends u {
145
145
  return;
146
146
  }
147
147
  let t = d.failure === "timeout";
148
- throw this.diagnostics.report(t ? "transport.timeout" : "transport.http_error", "The transport worker did not send its batch."), new c(t ? "timeout" : o() ? "transient" : "offline", "The transport worker did not send its batch.");
148
+ throw this.diagnostics.report(t ? "transport.timeout" : "transport.http_error", "The transport worker did not send its batch."), new s(t ? "timeout" : a() ? "transient" : "offline", "The transport worker did not send its batch.");
149
149
  }
150
150
  if (d.compressionFailed && this.diagnostics.report("transport.http_error", "The transport worker sent its batch without gzip after a compression failure."), d.status >= 200 && d.status < 300) this.accept(n, d.sampling, d.date);
151
151
  else throw this.reject(d.status, e.id, n, {
152
152
  retryAfterMs: d.retryAfterMs,
153
153
  maxBytes: d.maxBytes,
154
- advice: m
154
+ advice: p
155
155
  });
156
156
  }
157
157
  throttledForMs(e) {
@@ -168,14 +168,14 @@ var b = class extends u {
168
168
  let e = this.config.transportWorker;
169
169
  if (e !== this.source && (this.client?.close(), this.client = void 0, this.source = e, this.disabled = !1), e && !this.disabled) return this.client ??= y(e, this.diagnostics), this.client;
170
170
  }
171
- async attempt(e, i, o, s, c) {
172
- let l = this.config.delivery.requestTimeoutMs, u = Date.now() + l, f = await r(this.untilCancelled(d(this.http, this.config, this.diagnostics)), l);
173
- this.assertContext(i);
174
- let p = u - Date.now();
175
- if (p <= 0) throw new a(l);
171
+ async attempt(e, a, o, s, c) {
172
+ let l = this.config.delivery.requestTimeoutMs, d = Date.now() + l, f = await r(this.untilCancelled(u(this.http, this.config, this.diagnostics)), l);
173
+ this.assertContext(a);
174
+ let p = d - Date.now();
175
+ if (p <= 0) throw new i(l);
176
176
  let m = new Headers(f);
177
- return m.set(n, i.id), m.set(t, String(i.attempts)), e.send({
178
- batch: i,
177
+ return m.set(n, a.id), m.set(t, String(a.attempts)), e.send({
178
+ batch: a,
179
179
  kind: o,
180
180
  endpoint: s,
181
181
  serializer: c,
@@ -184,18 +184,17 @@ var b = class extends u {
184
184
  credentials: this.config.credentials,
185
185
  priority: this.config.delivery.priority,
186
186
  timeoutMs: p,
187
- deadlineMs: u
187
+ deadlineMs: d
188
188
  }, this.cancellation.signal, p);
189
189
  }
190
190
  };
191
191
  function x(e, t, n, r, i) {
192
- let a = new f(e, t, n, r, i);
192
+ let a = new d(e, t, n, r, i);
193
193
  return {
194
194
  transport: new b(e, t, a, n, r, i),
195
195
  exitHeaders: () => a.lastHeaders()
196
196
  };
197
197
  }
198
- //#endregion
199
198
  export { x as createWorkerTransport };
200
199
 
201
- //# sourceMappingURL=worker-transport-2220ghFZ.js.map
200
+ //# sourceMappingURL=worker-transport-C3SjJAEC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-transport-C3SjJAEC.js","names":["TRANSPORT_WORKER_TYPE","HEADER_ATTEMPT","HEADER_BATCH_ID","withDeadline","DeadlineError","isOnline","endpointFor","batchKind","StatusTransport","resolveHeaders","HttpTransport","resetHeaders","CREDENTIAL_ADVICE","unrefTimer","workerMessage","isWorkerMessage","isWorkerResult","WorkerFault","kind","createWorkerClient","session","closed","sequence","inactive","signal","fail","old","diagnostics","pending","post","error","connect","worker","factory","channel","current","onMessage","message","event","id","onError","finish","cancel","reject","abort","timer","timeoutMs","job","WorkerTransport","config","onSampling","loss","onClock","http","batch","endpoint","client","hidden","onKeepalive","result","TransportError","timeout","last","deadline","values","remaining","headers","createWorkerTransport","onLoss"],"sources":["../src/transport/worker-client.ts","../src/transport/worker-transport.ts"],"sourcesContent":["import { TRANSPORT_WORKER_TYPE } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { unrefTimer } from \"../utils/unref\";\nimport {\n isWorkerMessage,\n isWorkerResult,\n workerMessage,\n type WorkerJob,\n type WorkerResult,\n} from \"./worker-protocol\";\n\n/** A channel failure permits HTTP fallback. A timeout keeps the retry policy. */\nexport class WorkerFault extends Error {\n constructor(readonly kind: \"channel\" | \"timeout\" | \"cancelled\") {\n super(\"The transport worker did not complete the request.\");\n }\n}\n\n/** One pending request on the private channel. */\ninterface Pending {\n job: WorkerJob;\n resolve: (result: WorkerResult) => void;\n reject: (error: WorkerFault) => void;\n}\n\n/** One connection to one worker. */\ninterface Session {\n worker: Worker;\n port: MessagePort;\n ready: boolean;\n pending: Map<number, Pending>;\n detach: () => void;\n}\n\n/** Private channel operations of the HTTP worker adapter. */\nexport interface WorkerClient {\n send(job: WorkerJob, signal: AbortSignal, timeoutMs: number): Promise<WorkerResult>;\n close(): void;\n}\n\n/** Opens a private message port. The worker factory stays on the main thread. */\nexport function createWorkerClient(factory: () => Worker, diagnostics: Diagnostics): WorkerClient {\n let session: Session | undefined;\n let closed = false;\n let sequence = 0;\n\n const inactive = (signal: AbortSignal): boolean => closed || signal.aborted;\n\n const fail = (): void => {\n const old = session;\n session = undefined;\n if (!old) {\n return;\n }\n diagnostics.guard(\"transport.http_error\", \"The transport worker could not be closed.\", () => {\n old.detach();\n });\n diagnostics.guard(\"transport.http_error\", \"The transport port could not be closed.\", () => {\n old.port.close();\n });\n diagnostics.guard(\n \"transport.http_error\",\n \"The transport worker could not be terminated.\",\n () => {\n old.worker.terminate();\n },\n );\n for (const pending of old.pending.values()) {\n pending.reject(new WorkerFault(\"channel\"));\n }\n old.pending.clear();\n };\n\n const post = (current: Session, id: number, job: WorkerJob): void => {\n try {\n current.port.postMessage(workerMessage(TRANSPORT_WORKER_TYPE.send, { id, job }));\n } catch (error) {\n diagnostics.report(\n \"transport.http_error\",\n \"The transport worker could not clone its batch.\",\n undefined,\n error,\n );\n fail();\n }\n };\n\n const connect = (): Session => {\n if (session) {\n return session;\n }\n let worker: Worker | undefined;\n try {\n worker = factory();\n const channel = new MessageChannel();\n const current: Session = {\n worker,\n port: channel.port1,\n ready: false,\n pending: new Map(),\n detach: () => undefined,\n };\n session = current;\n const onMessage = (event: MessageEvent<unknown>): void => {\n const message = event.data;\n if (!isWorkerMessage(message)) {\n fail();\n return;\n }\n if (message.t === TRANSPORT_WORKER_TYPE.ready) {\n if (message.ok !== true) {\n fail();\n return;\n }\n if (!current.ready) {\n current.ready = true;\n for (const [id, pending] of current.pending) {\n post(current, id, pending.job);\n }\n }\n return;\n }\n if (\n message.t !== TRANSPORT_WORKER_TYPE.result ||\n typeof message.id !== \"number\" ||\n !isWorkerResult(message.result)\n ) {\n fail();\n return;\n }\n\n current.pending.get(message.id)?.resolve(message.result);\n };\n const onError = (): void => {\n fail();\n };\n current.port.addEventListener(\"message\", onMessage);\n current.port.addEventListener(\"messageerror\", onError);\n worker.addEventListener(\"error\", onError);\n worker.addEventListener(\"messageerror\", onError);\n current.detach = () => {\n current.port.removeEventListener(\"message\", onMessage);\n current.port.removeEventListener(\"messageerror\", onError);\n current.worker.removeEventListener(\"error\", onError);\n current.worker.removeEventListener(\"messageerror\", onError);\n };\n current.port.start();\n worker.postMessage(workerMessage(TRANSPORT_WORKER_TYPE.connect), [channel.port2]);\n return current;\n } catch (error) {\n diagnostics.report(\n \"transport.http_error\",\n \"The transport worker could not start.\",\n undefined,\n error,\n );\n fail();\n diagnostics.guard(\"transport.http_error\", \"The transport worker could not stop.\", () =>\n worker?.terminate(),\n );\n throw new WorkerFault(\"channel\");\n }\n };\n\n return {\n send: async (job, signal, timeoutMs) => {\n if (inactive(signal)) {\n throw new WorkerFault(\"cancelled\");\n }\n const current = connect();\n if (inactive(signal)) {\n fail();\n throw new WorkerFault(\"cancelled\");\n }\n const id = ++sequence;\n let finish!: () => void;\n try {\n return await new Promise<WorkerResult>((resolve, reject) => {\n const cancel = (kind: \"timeout\" | \"cancelled\"): void => {\n current.pending.delete(id);\n diagnostics.guard(\n \"transport.http_error\",\n \"The transport worker request could not be cancelled.\",\n () => {\n current.port.postMessage(workerMessage(TRANSPORT_WORKER_TYPE.cancel, { id }));\n },\n );\n reject(new WorkerFault(kind));\n };\n const abort = (): void => {\n cancel(\"cancelled\");\n };\n const timer = setTimeout(() => {\n // A worker that hasn't answered ready hasn't started, so HTTP can't duplicate its\n // unsent job.\n if (current.ready) {\n cancel(\"timeout\");\n } else {\n fail();\n }\n }, timeoutMs);\n unrefTimer(timer);\n finish = () => {\n clearTimeout(timer);\n signal.removeEventListener(\"abort\", abort);\n current.pending.delete(id);\n };\n current.pending.set(id, { job, resolve, reject });\n signal.addEventListener(\"abort\", abort, { once: true });\n if (current.ready) {\n post(current, id, job);\n }\n });\n } finally {\n finish();\n }\n },\n close: () => {\n closed = true;\n fail();\n },\n };\n}\n","import {\n HEADER_ATTEMPT,\n HEADER_BATCH_ID,\n HTTP_FORBIDDEN,\n HTTP_SUCCESS_END,\n HTTP_SUCCESS_MIN,\n HTTP_UNAUTHORIZED,\n} from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { LogBatch } from \"../models/batch\";\nimport type { BatchKind, ResolvedConfig } from \"../models/config\";\nimport type { LossReporter } from \"../models/drop\";\nimport { DeadlineError, withDeadline } from \"../utils/deadline\";\nimport { isOnline } from \"../utils/platform\";\nimport { TransportError } from \"./errors\";\nimport { resetHeaders, resolveHeaders } from \"./headers\";\nimport { CREDENTIAL_ADVICE, HttpTransport } from \"./http-transport\";\nimport { batchKind, endpointFor } from \"./serializers/select\";\nimport { StatusTransport } from \"./status-transport\";\nimport { createWorkerClient, WorkerFault, type WorkerClient } from \"./worker-client\";\nimport type { WorkerResult } from \"./worker-protocol\";\n\n/** Main-thread policy around the private worker channel. */\nclass WorkerTransport extends StatusTransport {\n private client: WorkerClient | undefined;\n\n private source: ResolvedConfig[\"transportWorker\"];\n\n private disabled = false;\n\n constructor(\n config: ResolvedConfig,\n diagnostics: Diagnostics,\n private readonly http: HttpTransport,\n onSampling: (raw: unknown) => void,\n private readonly loss: LossReporter,\n onClock: (offsetMs: number) => void,\n ) {\n super(config, diagnostics, onSampling, loss, onClock);\n }\n\n /** Encodes and sends in the worker. Hidden pages keep the main HTTP keepalive path. */\n async send(batch: LogBatch, onKeepalive?: () => void): Promise<void> {\n this.assertContext(batch);\n const kind = batchKind(batch, this.config);\n const endpoint = endpointFor(kind, this.config);\n if (!endpoint) {\n this.diagnostics.count(\"record.dropped_no_destination\");\n return;\n }\n if (batch.records.length === 0) {\n return;\n }\n\n const client = this.workerClient();\n const hidden = typeof document !== \"undefined\" && document.visibilityState === \"hidden\";\n if (!client || typeof this.config.serializer !== \"string\" || hidden) {\n await this.http.send(batch, onKeepalive);\n return;\n }\n\n let result: WorkerResult;\n try {\n result = await this.attempt(client, batch, kind, endpoint, this.config.serializer);\n this.assertContext(batch);\n if (\n \"status\" in result &&\n (result.status === HTTP_UNAUTHORIZED || result.status === HTTP_FORBIDDEN) &&\n typeof this.config.headers === \"function\"\n ) {\n resetHeaders(this.http);\n result = await this.attempt(client, batch, kind, endpoint, this.config.serializer);\n this.assertContext(batch);\n }\n if (\"failure\" in result && result.failure === \"protocol\") {\n throw new WorkerFault(\"channel\");\n }\n } catch (error) {\n this.diagnostics.report(\n \"transport.http_error\",\n \"The transport worker request failed.\",\n undefined,\n error,\n );\n this.assertContext(batch);\n if (\n error instanceof DeadlineError ||\n (error instanceof WorkerFault && error.kind === \"timeout\")\n ) {\n this.diagnostics.report(\n \"transport.timeout\",\n \"The transport worker request exceeded its time limit.\",\n );\n throw new TransportError(\n \"timeout\",\n \"The transport worker request exceeded its time limit.\",\n );\n }\n if (error instanceof WorkerFault && error.kind === \"channel\") {\n if (this.client === client) {\n this.disabled = true;\n client.close();\n }\n await this.http.send(batch, onKeepalive);\n return;\n }\n throw new TransportError(\"transient\", \"The transport worker request failed.\");\n }\n\n if (\"failure\" in result) {\n if (result.failure === \"serialize\") {\n this.diagnostics.report(\n \"transport.serialize_failed\",\n \"The transport worker could not serialize its batch.\",\n { batchId: batch.id },\n );\n this.loss(\"unserializable\", batch.records, [batch.id]);\n return;\n }\n const timeout = result.failure === \"timeout\";\n this.diagnostics.report(\n timeout ? \"transport.timeout\" : \"transport.http_error\",\n \"The transport worker did not send its batch.\",\n );\n // An offline failure must not use up a stored attempt. The HTTP path applies the same rule.\n throw new TransportError(\n timeout ? \"timeout\" : isOnline() ? \"transient\" : \"offline\",\n \"The transport worker did not send its batch.\",\n );\n }\n if (result.compressionFailed) {\n this.diagnostics.report(\n \"transport.http_error\",\n \"The transport worker sent its batch without gzip after a compression failure.\",\n );\n }\n if (result.status >= HTTP_SUCCESS_MIN && result.status < HTTP_SUCCESS_END) {\n this.accept(kind, result.sampling, result.date);\n return;\n }\n throw this.reject(result.status, batch.id, kind, {\n retryAfterMs: result.retryAfterMs,\n maxBytes: result.maxBytes,\n advice: CREDENTIAL_ADVICE,\n });\n }\n\n /** Keeps throttle state from both the worker and the hidden-page HTTP path. */\n override throttledForMs(batch: LogBatch): number {\n return Math.max(super.throttledForMs(batch), this.http.throttledForMs(batch));\n }\n\n /** Returns the last accepted send from either path. */\n override lastSendAt(): number | null {\n const last = Math.max(super.lastSendAt() ?? -Infinity, this.http.lastSendAt() ?? -Infinity);\n return Number.isFinite(last) ? last : null;\n }\n\n /** Stops both paths before a delivery identity change or shutdown. */\n override stop(): void {\n super.stop();\n this.client?.close();\n this.http.stop();\n }\n\n private workerClient(): WorkerClient | undefined {\n const factory = this.config.transportWorker;\n if (factory !== this.source) {\n this.client?.close();\n this.client = undefined;\n this.source = factory;\n this.disabled = false;\n }\n if (!factory || this.disabled) {\n return undefined;\n }\n this.client ??= createWorkerClient(factory, this.diagnostics);\n return this.client;\n }\n\n /** One deadline covers the main headers function and the worker operation. */\n private async attempt(\n client: WorkerClient,\n batch: LogBatch,\n kind: BatchKind,\n endpoint: string,\n serializer: \"otlp\" | \"ecs\",\n ): Promise<WorkerResult> {\n const timeoutMs = this.config.delivery.requestTimeoutMs;\n const deadline = Date.now() + timeoutMs;\n const values = await withDeadline(\n this.untilCancelled(resolveHeaders(this.http, this.config, this.diagnostics)),\n timeoutMs,\n );\n this.assertContext(batch);\n const remaining = deadline - Date.now();\n if (remaining <= 0) {\n throw new DeadlineError(timeoutMs);\n }\n const headers = new Headers(values);\n headers.set(HEADER_BATCH_ID, batch.id);\n headers.set(HEADER_ATTEMPT, String(batch.attempts));\n return client.send(\n {\n batch,\n kind,\n endpoint,\n serializer,\n headers: Object.fromEntries(headers),\n compression: this.config.compression,\n credentials: this.config.credentials,\n priority: this.config.delivery.priority,\n timeoutMs: remaining,\n deadlineMs: deadline,\n },\n this.cancellation.signal,\n remaining,\n );\n }\n}\n\n/** Creates the worker adapter without adding a package entry point or a runtime dependency. */\nexport function createWorkerTransport(\n config: ResolvedConfig,\n diagnostics: Diagnostics,\n onSampling: (raw: unknown) => void,\n onLoss: LossReporter,\n onClock: (offsetMs: number) => void,\n): { transport: StatusTransport; exitHeaders: () => Record<string, string> | undefined } {\n const http = new HttpTransport(config, diagnostics, onSampling, onLoss, onClock);\n return {\n transport: new WorkerTransport(config, diagnostics, http, onSampling, onLoss, onClock),\n exitHeaders: () => http.lastHeaders(),\n };\n}\n"],"mappings":";;;;;;;;AAYA,IAAaiB,IAAb,cAAiC,MAAM;CAChB;CAArB,YAAY,GAAoD;EAA3C,AACnB,MAAM,oDAAoD,GADvC,KAAA,OAAAC;CAErB;AACF;AAyBA,SAAgBC,EAAmB,GAAuB,GAAwC;CAChG,IAAIC,GACAC,IAAS,IACTC,IAAW,GAETC,KAAY,MAAiCF,KAAUG,EAAO,SAE9DC,UAAmB;EACvB,IAAMC,IAAMN;EAEZ,IADA,IAAU,KAAA,GACLM,GAGL;GAMA,AANAC,EAAY,MAAM,wBAAwB,mDAAmD;IAC3F,EAAI,OAAO;GACb,CAAC,GACDA,EAAY,MAAM,wBAAwB,iDAAiD;IACzF,EAAI,KAAK,MAAM;GACjB,CAAC,GACDA,EAAY,MACV,wBACA,uDACM;IACJ,EAAI,OAAO,UAAU;GACvB,CACF;GACA,KAAK,IAAMC,KAAWF,EAAI,QAAQ,OAAO,GACvC,EAAQ,OAAO,IAAIT,EAAY,SAAS,CAAC;GAE3C,EAAI,QAAQ,MAAM;EAdjB;CAeH,GAEMY,KAAQ,GAAkB,GAAY,MAAyB;EACnE,IAAI;GACF,EAAQ,KAAK,YAAYf,EAAcd,EAAsB,MAAM;IAAE;IAAI;GAAI,CAAC,CAAC;EACjF,SAAS8B,GAAO;GAOd,AANAH,EAAY,OACV,wBACA,mDACA,KAAA,GACAG,CACF,GACAL,EAAK;EACP;CACF,GAEMM,UAAyB;EAC7B,IAAIX,GACF,OAAOA;EAET,IAAIY;EACJ,IAAI;GACF,IAASC,EAAQ;GACjB,IAAMC,IAAU,IAAI,eAAe,GAC7BC,IAAmB;IACvB;IACA,MAAMD,EAAQ;IACd,OAAO;IACP,yBAAS,IAAI,IAAI;IACjB,cAAc,KAAA;GAChB;GACA,IAAUC;GACV,IAAMC,KAAa,MAAuC;IACxD,IAA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,GACd,KAAK,WAAW,KAEbA,KAAW,MAAK,UAIrB,OADA,KAAK,WAAWd,EAAmBc,GAAS,KAAK,WAAW,GACrD,KAAK;CACd;CAGA,MAAc,QACZ,GACA,GACA,GACA,GACA,GACuB;EACvB,IAAMa,IAAY,KAAK,OAAO,SAAS,kBACjCiB,IAAW,KAAK,IAAI,IAAIjB,GACxBkB,IAAS,MAAM7D,EACnB,KAAK,eAAeM,EAAe,KAAK,MAAM,KAAK,QAAQ,KAAK,WAAW,CAAC,GAC5EqC,CACF;EACA,KAAK,cAAcQ,CAAK;EACxB,IAAMW,IAAYF,IAAW,KAAK,IAAI;EACtC,IAAIE,KAAa,GACf,MAAM,IAAI7D,EAAc0C,CAAS;EAEnC,IAAMoB,IAAU,IAAI,QAAQF,CAAM;EAGlC,OAFAE,EAAQ,IAAIhE,GAAiBoD,EAAM,EAAE,GACrCY,EAAQ,IAAIjE,GAAgB,OAAOqD,EAAM,QAAQ,CAAC,GAC3CE,EAAO,KACZ;GACE;GACA;GACA;GACA;GACA,SAAS,OAAO,YAAYU,CAAO;GACnC,aAAa,KAAK,OAAO;GACzB,aAAa,KAAK,OAAO;GACzB,UAAU,KAAK,OAAO,SAAS;GAC/B,WAAWD;GACX,YAAYF;EACd,GACA,KAAK,aAAa,QAClBE,CACF;CACF;AACF;AAGA,SAAgBE,EACd,GACA,GACA,GACA,GACA,GACuF;CACvF,IAAMd,IAAO,IAAI3C,EAAcuC,GAAQtB,GAAauB,GAAYkB,GAAQhB,CAAO;CAC/E,OAAO;EACL,WAAW,IAAIJ,EAAgBC,GAAQtB,GAAa0B,GAAMH,GAAYkB,GAAQhB,CAAO;EACrF,mBAAmBC,EAAK,YAAY;CACtC;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utk09/ui-observability",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "description": "UI observability and logging for browser, OpenFin and webview applications",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -29,7 +29,7 @@
29
29
  "type": "module",
30
30
  "sideEffects": false,
31
31
  "engines": {
32
- "node": ">=20.19.0"
32
+ "node": ">=22.22.3"
33
33
  },
34
34
  "bin": {
35
35
  "uiobs": "bin/uiobs.mjs"
@@ -50,23 +50,15 @@
50
50
  },
51
51
  "./package.json": "./package.json"
52
52
  },
53
- "workspaces": [
54
- "playground/react",
55
- "playground/angular",
56
- "playground/microfrontend/host",
57
- "playground/microfrontend/remote-blotter",
58
- "playground/microfrontend/remote-ticket",
59
- "playground/console-only"
60
- ],
61
53
  "scripts": {
62
- "dev": "concurrently -k \"npm:dev:*\"",
63
- "dev:vanilla": "vite",
54
+ "dev": "concurrently -k \"pnpm run dev:vanilla\" \"pnpm run dev:ingest\" \"pnpm run dev:cross-origin\"",
55
+ "dev:vanilla": "pnpm --filter @example/vanilla run dev",
64
56
  "dev:ingest": "node tools/mock-ingest-server.mjs",
65
57
  "dev:cross-origin": "vite --config vite.cross-origin.config.ts",
66
- "example:react": "npm run dev --workspace @example/react",
67
- "example:angular": "npm run dev --workspace @example/angular",
68
- "example:microfrontend": "concurrently -k \"npm run dev --workspace @example/mf-blotter\" \"npm run dev --workspace @example/mf-ticket\" \"npm run dev --workspace @example/mf-host\"",
69
- "example:console-only": "npm run dev --workspace @example/console-only",
58
+ "example:react": "pnpm --filter @example/react run dev",
59
+ "example:angular": "pnpm --filter @example/angular run dev",
60
+ "example:microfrontend": "concurrently -k \"pnpm --filter @example/mf-blotter run dev\" \"pnpm --filter @example/mf-ticket run dev\" \"pnpm --filter @example/mf-host run dev\"",
61
+ "example:console-only": "pnpm --filter @example/console-only run dev",
70
62
  "build": "rimraf dist && tsc --project tsconfig.build.json && vite build",
71
63
  "build:watch": "vite build --watch",
72
64
  "lint": "eslint .",
@@ -80,44 +72,44 @@
80
72
  "check:peers": "node tools/check-peer-imports.mjs",
81
73
  "check:size": "node tools/check-size.mjs",
82
74
  "check:dev": "node tools/check-dev-server.mjs",
83
- "verify": "npm run format:check && npm run typecheck && npm run build && npm run lint && npm run check:peers && npm run check:size && npm run check:dev && npm run test:coverage",
84
- "prepublishOnly": "npm run verify"
75
+ "prepare": "pnpm run build",
76
+ "fix": "pnpm run lint:fix && pnpm run format",
77
+ "verify": "pnpm run format:check && pnpm run typecheck && pnpm run build && pnpm run lint && pnpm run check:peers && pnpm run check:size && pnpm run check:dev && pnpm run test:coverage",
78
+ "prepublishOnly": "pnpm run verify"
85
79
  },
86
80
  "peerDependencies": {
87
81
  "@opentelemetry/api": "^1",
82
+ "@rrweb/record": "^2",
88
83
  "web-vitals": "^4 || ^5 || ^6"
89
84
  },
90
85
  "peerDependenciesMeta": {
91
86
  "@opentelemetry/api": {
92
87
  "optional": true
93
88
  },
89
+ "@rrweb/record": {
90
+ "optional": true
91
+ },
94
92
  "web-vitals": {
95
93
  "optional": true
96
94
  }
97
95
  },
98
96
  "devDependencies": {
99
- "@eslint/js": "10.0.1",
100
- "@opentelemetry/api": "1.9.1",
101
- "@types/node": "26.6.5",
102
- "@vitest/coverage-istanbul": "4.1.11",
103
- "concurrently": "10.0.6",
104
- "eslint": "10.12.0",
105
- "eslint-config-prettier": "10.1.8",
106
- "fake-indexeddb": "6.2.5",
107
- "happy-dom": "20.14.6",
108
- "prettier": "3.9.10",
109
- "rimraf": "6.1.3",
110
- "typescript": "~5.9.3",
111
- "typescript-eslint": "8.71.1",
112
- "vite": "8.3.4",
113
- "vitest": "4.1.11",
114
- "web-vitals": "6.2.3"
97
+ "@eslint/js": "catalog:library",
98
+ "@opentelemetry/api": "catalog:library",
99
+ "@types/node": "catalog:library",
100
+ "@vitest/coverage-istanbul": "catalog:library",
101
+ "concurrently": "catalog:library",
102
+ "eslint": "catalog:library",
103
+ "eslint-config-prettier": "catalog:library",
104
+ "fake-indexeddb": "catalog:library",
105
+ "happy-dom": "catalog:library",
106
+ "prettier": "catalog:library",
107
+ "rimraf": "catalog:library",
108
+ "typescript": "catalog:library",
109
+ "typescript-eslint": "catalog:library",
110
+ "vite": "catalog:library",
111
+ "vitest": "catalog:library",
112
+ "web-vitals": "catalog:library"
115
113
  },
116
- "allowScripts": {
117
- "@parcel/watcher@2.6.0": true,
118
- "esbuild@0.28.1": true,
119
- "lmdb@3.5.1": true,
120
- "msgpackr-extract@3.0.4": true,
121
- "fsevents@2.3.3": true
122
- }
114
+ "packageManager": "pnpm@12.21.0"
123
115
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"batch-BHXypM1j.cjs","names":["newId","ATTR_LOG_TYPE","LOG_TYPE_ACTION","require_constants","require_identity","isLogBatch","value","id","createdAt","attempts","records","splitBatch","batch","middle","halve","diagnostics","attributeOf","record","attributes","key","isActionRecord","countRecords","batches","total"],"sources":["../src/models/batch.ts"],"sourcesContent":["// src/models/batch.ts\n//\n// A batch of log records for delivery to the ingest endpoint.\n\nimport { ATTR_LOG_TYPE, LOG_TYPE_ACTION } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { newId } from \"../utils/identity\";\nimport type { LogRecord } from \"./log-record\";\n\n/**\n * A batch of records with a stable id used for server-side deduplication across retries.\n * @see {@link splitBatch}\n */\nexport interface LogBatch {\n /** Application namespace that owns this stored batch. */\n readonly persistenceNamespace?: string;\n /** Delivery context id. It does not change. With isolation, a batch without this id stays stored. */\n readonly routingContextId?: string;\n /** Deduplication key. It stays the same across retries and reloads. */\n id: string;\n /** Records to deliver, in log order. */\n records: LogRecord[];\n /** Batch creation time, in epoch milliseconds. */\n createdAt: number;\n /** Delivery attempts so far. */\n attempts: number;\n}\n\n/**\n * Tells if a value from storage has all fields of a batch. `keyOf` cannot match\n * an entry without `id` after delivery. The library then retries that entry with no\n * end, and the entry blocks each batch behind it. An entry without `attempts` counts\n * as NaN. That count never reaches `maxAttempts`. Thus the library never drops the\n * entry as a dead letter.\n * @param value Parsed storage entry.\n * @returns True when each required field is present and has the correct type.\n */\nexport function isLogBatch(value: unknown): value is LogBatch {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const id: unknown = Reflect.get(value, \"id\");\n const createdAt: unknown = Reflect.get(value, \"createdAt\");\n const attempts: unknown = Reflect.get(value, \"attempts\");\n const records: unknown = Reflect.get(value, \"records\");\n\n return (\n typeof id === \"string\" &&\n typeof createdAt === \"number\" &&\n typeof attempts === \"number\" &&\n Array.isArray(records)\n );\n}\n\n/**\n * Splits a batch that the server rejected as too large into two halves.\n * Each half gets a new id. Each half keeps the age and attempts of the original batch.\n * @param batch The rejected batch.\n * @param diagnostics Diagnostics reporter for the new batch ids.\n * @returns Two batches, or `null` if a single record is already over the limit.\n */\nexport function splitBatch(batch: LogBatch, diagnostics: Diagnostics): [LogBatch, LogBatch] | null {\n if (batch.records.length < 2) {\n return null;\n }\n\n const middle = Math.floor(batch.records.length / 2);\n const halve = (records: LogRecord[]): LogBatch => ({\n id: newId(diagnostics),\n records,\n createdAt: batch.createdAt,\n attempts: batch.attempts,\n routingContextId: batch.routingContextId,\n persistenceNamespace: batch.persistenceNamespace,\n });\n\n return [halve(batch.records.slice(0, middle)), halve(batch.records.slice(middle))];\n}\n\n/**\n * Reads one attribute of a record. A record from storage can be corrupt. It can be null or have\n * no attributes.\n * @param record Record to read.\n * @param key Attribute key.\n * @returns The attribute value, or undefined for a corrupt record.\n */\nexport function attributeOf(record: LogRecord, key: string): unknown {\n const value: unknown = record;\n if (typeof value !== \"object\" || value === null) {\n return undefined;\n }\n\n const attributes: unknown = Reflect.get(value, \"attributes\");\n if (typeof attributes !== \"object\" || attributes === null) {\n return undefined;\n }\n\n return Reflect.get(attributes, key);\n}\n\n/**\n * Tests if a record is an action. A corrupt record from storage is not an action.\n * @param record Record to test.\n * @returns True for an action record.\n */\nexport function isActionRecord(record: LogRecord): boolean {\n return attributeOf(record, ATTR_LOG_TYPE) === LOG_TYPE_ACTION;\n}\n\n/**\n * Returns the total record count of the batches.\n * @param batches Batches to measure.\n * @returns Total record count.\n */\nexport function countRecords(batches: readonly LogBatch[]): number {\n return batches.reduce((total, batch) => total + batch.records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-BMdT9mKm.js","names":["LOG_TYPE_ACTION","ATTR_LOG_TYPE","newId","isLogBatch","value","id","createdAt","attempts","records","splitBatch","batch","middle","halve","diagnostics","attributeOf","record","attributes","key","isActionRecord","countRecords","batches","total"],"sources":["../src/models/batch.ts"],"sourcesContent":["// src/models/batch.ts\n//\n// A batch of log records for delivery to the ingest endpoint.\n\nimport { ATTR_LOG_TYPE, LOG_TYPE_ACTION } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { newId } from \"../utils/identity\";\nimport type { LogRecord } from \"./log-record\";\n\n/**\n * A batch of records with a stable id used for server-side deduplication across retries.\n * @see {@link splitBatch}\n */\nexport interface LogBatch {\n /** Application namespace that owns this stored batch. */\n readonly persistenceNamespace?: string;\n /** Delivery context id. It does not change. With isolation, a batch without this id stays stored. */\n readonly routingContextId?: string;\n /** Deduplication key. It stays the same across retries and reloads. */\n id: string;\n /** Records to deliver, in log order. */\n records: LogRecord[];\n /** Batch creation time, in epoch milliseconds. */\n createdAt: number;\n /** Delivery attempts so far. */\n attempts: number;\n}\n\n/**\n * Tells if a value from storage has all fields of a batch. `keyOf` cannot match\n * an entry without `id` after delivery. The library then retries that entry with no\n * end, and the entry blocks each batch behind it. An entry without `attempts` counts\n * as NaN. That count never reaches `maxAttempts`. Thus the library never drops the\n * entry as a dead letter.\n * @param value Parsed storage entry.\n * @returns True when each required field is present and has the correct type.\n */\nexport function isLogBatch(value: unknown): value is LogBatch {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const id: unknown = Reflect.get(value, \"id\");\n const createdAt: unknown = Reflect.get(value, \"createdAt\");\n const attempts: unknown = Reflect.get(value, \"attempts\");\n const records: unknown = Reflect.get(value, \"records\");\n\n return (\n typeof id === \"string\" &&\n typeof createdAt === \"number\" &&\n typeof attempts === \"number\" &&\n Array.isArray(records)\n );\n}\n\n/**\n * Splits a batch that the server rejected as too large into two halves.\n * Each half gets a new id. Each half keeps the age and attempts of the original batch.\n * @param batch The rejected batch.\n * @param diagnostics Diagnostics reporter for the new batch ids.\n * @returns Two batches, or `null` if a single record is already over the limit.\n */\nexport function splitBatch(batch: LogBatch, diagnostics: Diagnostics): [LogBatch, LogBatch] | null {\n if (batch.records.length < 2) {\n return null;\n }\n\n const middle = Math.floor(batch.records.length / 2);\n const halve = (records: LogRecord[]): LogBatch => ({\n id: newId(diagnostics),\n records,\n createdAt: batch.createdAt,\n attempts: batch.attempts,\n routingContextId: batch.routingContextId,\n persistenceNamespace: batch.persistenceNamespace,\n });\n\n return [halve(batch.records.slice(0, middle)), halve(batch.records.slice(middle))];\n}\n\n/**\n * Reads one attribute of a record. A record from storage can be corrupt. It can be null or have\n * no attributes.\n * @param record Record to read.\n * @param key Attribute key.\n * @returns The attribute value, or undefined for a corrupt record.\n */\nexport function attributeOf(record: LogRecord, key: string): unknown {\n const value: unknown = record;\n if (typeof value !== \"object\" || value === null) {\n return undefined;\n }\n\n const attributes: unknown = Reflect.get(value, \"attributes\");\n if (typeof attributes !== \"object\" || attributes === null) {\n return undefined;\n }\n\n return Reflect.get(attributes, key);\n}\n\n/**\n * Tests if a record is an action. A corrupt record from storage is not an action.\n * @param record Record to test.\n * @returns True for an action record.\n */\nexport function isActionRecord(record: LogRecord): boolean {\n return attributeOf(record, ATTR_LOG_TYPE) === LOG_TYPE_ACTION;\n}\n\n/**\n * Returns the total record count of the batches.\n * @param batches Batches to measure.\n * @returns Total record count.\n */\nexport function countRecords(batches: readonly LogBatch[]): number {\n return batches.reduce((total, batch) => total + batch.records.length, 0);\n}\n"],"mappings":";;;AAqCA,SAAgBG,EAAW,GAAmC;CAC5D,IAAI,OAAOC,KAAU,aAAYA,GAC/B,OAAO;CAGT,IAAMC,IAAc,QAAQ,IAAID,GAAO,IAAI,GACrCE,IAAqB,QAAQ,IAAIF,GAAO,WAAW,GACnDG,IAAoB,QAAQ,IAAIH,GAAO,UAAU,GACjDI,IAAmB,QAAQ,IAAIJ,GAAO,SAAS;CAErD,OACE,OAAOC,KAAO,YACd,OAAOC,KAAc,YACrB,OAAOC,KAAa,YACpB,MAAM,QAAQC,CAAO;AAEzB;AASA,SAAgBC,EAAW,GAAiB,GAAuD;CACjG,IAAIC,EAAM,QAAQ,SAAS,GACzB,OAAO;CAGT,IAAMC,IAAS,KAAK,MAAMD,EAAM,QAAQ,SAAS,CAAC,GAC5CE,KAAS,OAAoC;EACjD,IAAIV,EAAMW,CAAW;EACrB;EACA,WAAWH,EAAM;EACjB,UAAUA,EAAM;EAChB,kBAAkBA,EAAM;EACxB,sBAAsBA,EAAM;CAC9B;CAEA,OAAO,CAACE,EAAMF,EAAM,QAAQ,MAAM,GAAGC,CAAM,CAAC,GAAGC,EAAMF,EAAM,QAAQ,MAAMC,CAAM,CAAC,CAAC;AACnF;AASA,SAAgBG,EAAY,GAAmB,GAAsB;CACnE,IAAMV,IAAiBW;CACvB,IAAI,OAAOX,KAAU,aAAYA,GAC/B;CAGF,IAAMY,IAAsB,QAAQ,IAAIZ,GAAO,YAAY;CAC3D,IAAI,OAAOY,KAAe,YAAYA,GAItC,OAAO,QAAQ,IAAIA,GAAYC,CAAG;AACpC;AAOA,SAAgBC,EAAe,GAA4B;CACzD,OAAOJ,EAAYC,GAAQd,CAAa,MAAMD;AAChD;AAOA,SAAgBmB,EAAa,GAAsC;CACjE,OAAOC,EAAQ,QAAQ,GAAO,MAAUC,IAAQX,EAAM,QAAQ,QAAQ,CAAC;AACzE"}