@utk09/ui-observability 1.1.0 → 1.2.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 (271) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/{batch-D3NHhF9L.js → batch-120Kc9jr.js} +3 -3
  3. package/dist/{batch-D3NHhF9L.js.map → batch-120Kc9jr.js.map} +1 -1
  4. package/dist/{batch-DnYRJqhU.cjs → batch-C3uNp5kU.cjs} +2 -2
  5. package/dist/{batch-DnYRJqhU.cjs.map → batch-C3uNp5kU.cjs.map} +1 -1
  6. package/dist/bus/bus.d.cts +5 -0
  7. package/dist/bus/bus.d.ts +5 -0
  8. package/dist/bus-Dj8IEVcC.cjs +2 -0
  9. package/dist/bus-Dj8IEVcC.cjs.map +1 -0
  10. package/dist/{bus-dw7T92sO.js → bus-DyNafxZN.js} +104 -94
  11. package/dist/bus-DyNafxZN.js.map +1 -0
  12. package/dist/capture/errors.d.cts +10 -0
  13. package/dist/capture/errors.d.ts +10 -0
  14. package/dist/capture/replay.d.cts +1 -1
  15. package/dist/capture/replay.d.ts +1 -1
  16. package/dist/capture/types.d.cts +5 -0
  17. package/dist/capture/types.d.ts +5 -0
  18. package/dist/capture/web-vitals.d.cts +1 -0
  19. package/dist/capture/web-vitals.d.ts +1 -0
  20. package/dist/{compression-SHPAvS4U.js → compression-BWkDWY3v.js} +2 -2
  21. package/dist/{compression-SHPAvS4U.js.map → compression-BWkDWY3v.js.map} +1 -1
  22. package/dist/{compression-C0hUHKR-.cjs → compression-CEVe7NPX.cjs} +2 -2
  23. package/dist/{compression-C0hUHKR-.cjs.map → compression-CEVe7NPX.cjs.map} +1 -1
  24. package/dist/config-C0PtemvC.cjs +2 -0
  25. package/dist/config-C0PtemvC.cjs.map +1 -0
  26. package/dist/{config-CSNcS7OZ.js → config-DK1Zf7jn.js} +83 -85
  27. package/dist/config-DK1Zf7jn.js.map +1 -0
  28. package/dist/{console-BsM-fSCQ.js → console-CAyCQOpm.js} +5 -5
  29. package/dist/{console-BsM-fSCQ.js.map → console-CAyCQOpm.js.map} +1 -1
  30. package/dist/{console-Dkxs6IVQ.cjs → console-Dk6GH4yj.cjs} +2 -2
  31. package/dist/{console-Dkxs6IVQ.cjs.map → console-Dk6GH4yj.cjs.map} +1 -1
  32. package/dist/{constants-BwJDXzj6.js → constants-CEHN6KuY.js} +42 -21
  33. package/dist/constants-CEHN6KuY.js.map +1 -0
  34. package/dist/constants-NtiQDWL_.cjs +2 -0
  35. package/dist/constants-NtiQDWL_.cjs.map +1 -0
  36. package/dist/constants.d.cts +11 -0
  37. package/dist/constants.d.ts +11 -0
  38. package/dist/core/config.d.cts +9 -3
  39. package/dist/core/config.d.ts +9 -3
  40. package/dist/core/diagnostics.d.cts +1 -1
  41. package/dist/core/diagnostics.d.ts +1 -1
  42. package/dist/core/pipeline.d.cts +11 -0
  43. package/dist/core/pipeline.d.ts +11 -0
  44. package/dist/core/record.d.cts +2 -2
  45. package/dist/core/record.d.ts +2 -2
  46. package/dist/core/sender.d.cts +3 -2
  47. package/dist/core/sender.d.ts +3 -2
  48. package/dist/{debug-bundle-B2v6Cym-.cjs → debug-bundle-DMzUfiQc.cjs} +2 -2
  49. package/dist/{debug-bundle-B2v6Cym-.cjs.map → debug-bundle-DMzUfiQc.cjs.map} +1 -1
  50. package/dist/{debug-bundle-Cs_YWzTa.js → debug-bundle-w78W46zr.js} +4 -4
  51. package/dist/{debug-bundle-Cs_YWzTa.js.map → debug-bundle-w78W46zr.js.map} +1 -1
  52. package/dist/doctor.cjs +1 -1
  53. package/dist/doctor.js +22 -22
  54. package/dist/doctor.js.map +1 -1
  55. package/dist/errors-07pmZ7VY.cjs +3 -0
  56. package/dist/errors-07pmZ7VY.cjs.map +1 -0
  57. package/dist/{errors-Q3Ng1ciC.js → errors-C-LYbqyB.js} +27 -24
  58. package/dist/errors-C-LYbqyB.js.map +1 -0
  59. package/dist/{factory-DV17sm2p.js → factory-BHYrcSaU.js} +42 -31
  60. package/dist/factory-BHYrcSaU.js.map +1 -0
  61. package/dist/factory-DsaNdcXp.cjs +2 -0
  62. package/dist/factory-DsaNdcXp.cjs.map +1 -0
  63. package/dist/{identity-BgtHyY4u.js → identity-Byh3gCdT.js} +11 -11
  64. package/dist/{identity-BgtHyY4u.js.map → identity-Byh3gCdT.js.map} +1 -1
  65. package/dist/{identity-CvuyqZk7.cjs → identity-BzAzdQyv.cjs} +2 -2
  66. package/dist/{identity-CvuyqZk7.cjs.map → identity-BzAzdQyv.cjs.map} +1 -1
  67. package/dist/index.cjs +1 -1
  68. package/dist/index.cjs.map +1 -1
  69. package/dist/index.js +539 -534
  70. package/dist/index.js.map +1 -1
  71. package/dist/{indexeddb-storage-e-13ZLWm.js → indexeddb-storage-BYywz-v6.js} +4 -4
  72. package/dist/{indexeddb-storage-e-13ZLWm.js.map → indexeddb-storage-BYywz-v6.js.map} +1 -1
  73. package/dist/{indexeddb-storage-D4KVcqdD.cjs → indexeddb-storage-BfqGkLFe.cjs} +2 -2
  74. package/dist/{indexeddb-storage-D4KVcqdD.cjs.map → indexeddb-storage-BfqGkLFe.cjs.map} +1 -1
  75. package/dist/{interactions-OK85T-Dk.cjs → interactions-BXzEel4F.cjs} +2 -2
  76. package/dist/interactions-BXzEel4F.cjs.map +1 -0
  77. package/dist/{interactions-Byxf1C82.js → interactions-DdKPMWIN.js} +12 -12
  78. package/dist/interactions-DdKPMWIN.js.map +1 -0
  79. package/dist/{journey-nMbob3OB.cjs → journey-BUmsrgaw.cjs} +2 -2
  80. package/dist/{journey-nMbob3OB.cjs.map → journey-BUmsrgaw.cjs.map} +1 -1
  81. package/dist/{journey-C93FTYcs.js → journey-Nu655gEO.js} +3 -3
  82. package/dist/{journey-C93FTYcs.js.map → journey-Nu655gEO.js.map} +1 -1
  83. package/dist/{library-console-DJUQzcgM.cjs → library-console-DdIlzzph.cjs} +2 -2
  84. package/dist/{library-console-DJUQzcgM.cjs.map → library-console-DdIlzzph.cjs.map} +1 -1
  85. package/dist/{library-console-DklSmucS.js → library-console-amePMnP8.js} +2 -2
  86. package/dist/{library-console-DklSmucS.js.map → library-console-amePMnP8.js.map} +1 -1
  87. package/dist/{library-request-UGEwOHpf.js → library-request-Cv7C05jf.js} +2 -2
  88. package/dist/{library-request-UGEwOHpf.js.map → library-request-Cv7C05jf.js.map} +1 -1
  89. package/dist/{library-request-kY9iTpIF.cjs → library-request-DO3Ec7KE.cjs} +2 -2
  90. package/dist/{library-request-kY9iTpIF.cjs.map → library-request-DO3Ec7KE.cjs.map} +1 -1
  91. package/dist/{lifecycle-DaMdH_X7.cjs → lifecycle-B5yfH5is.cjs} +2 -2
  92. package/dist/{lifecycle-DaMdH_X7.cjs.map → lifecycle-B5yfH5is.cjs.map} +1 -1
  93. package/dist/{lifecycle-B2PlIuQu.js → lifecycle-CMHz2Zbs.js} +2 -2
  94. package/dist/{lifecycle-B2PlIuQu.js.map → lifecycle-CMHz2Zbs.js.map} +1 -1
  95. package/dist/{log-record-DSt2P-Sr.js → log-record-B_nSqxoe.js} +2 -2
  96. package/dist/{log-record-DSt2P-Sr.js.map → log-record-B_nSqxoe.js.map} +1 -1
  97. package/dist/{log-record-Bmx6etMh.cjs → log-record-Bdywwg0k.cjs} +2 -2
  98. package/dist/{log-record-Bmx6etMh.cjs.map → log-record-Bdywwg0k.cjs.map} +1 -1
  99. package/dist/{long-frames-Bamjs1WV.js → long-frames-6NGl1-uN.js} +3 -3
  100. package/dist/{long-frames-Bamjs1WV.js.map → long-frames-6NGl1-uN.js.map} +1 -1
  101. package/dist/{long-frames-lhtONgGt.cjs → long-frames-D9DfSWqv.cjs} +2 -2
  102. package/dist/{long-frames-lhtONgGt.cjs.map → long-frames-D9DfSWqv.cjs.map} +1 -1
  103. package/dist/models/config.d.cts +4 -3
  104. package/dist/models/config.d.ts +4 -3
  105. package/dist/{network-BCn8Gn47.cjs → network-BNHBI0Fc.cjs} +2 -2
  106. package/dist/{network-BCn8Gn47.cjs.map → network-BNHBI0Fc.cjs.map} +1 -1
  107. package/dist/{network-Cg1L2w2r.js → network-Cc3tSB7e.js} +13 -13
  108. package/dist/{network-Cg1L2w2r.js.map → network-Cc3tSB7e.js.map} +1 -1
  109. package/dist/{observed-windows-BrwaJNlj.js → observed-windows-8JtCsIr1.js} +3 -3
  110. package/dist/{observed-windows-BrwaJNlj.js.map → observed-windows-8JtCsIr1.js.map} +1 -1
  111. package/dist/{observed-windows-B3gJkdql.cjs → observed-windows-BlE25nrn.cjs} +2 -2
  112. package/dist/{observed-windows-B3gJkdql.cjs.map → observed-windows-BlE25nrn.cjs.map} +1 -1
  113. package/dist/openfin-Bxelt0yg.js.map +1 -1
  114. package/dist/openfin-DtH2f7zX.cjs.map +1 -1
  115. package/dist/{otlp-D6dRZyB8.js → otlp-Btix3EBa.js} +7 -7
  116. package/dist/{otlp-D6dRZyB8.js.map → otlp-Btix3EBa.js.map} +1 -1
  117. package/dist/{otlp-CrAWkQdO.cjs → otlp-CFSW-Dno.cjs} +2 -2
  118. package/dist/{otlp-CrAWkQdO.cjs.map → otlp-CFSW-Dno.cjs.map} +1 -1
  119. package/dist/patch-DlcKzIi-.cjs +2 -0
  120. package/dist/patch-DlcKzIi-.cjs.map +1 -0
  121. package/dist/patch-Sr1wKg7W.js +9 -0
  122. package/dist/patch-Sr1wKg7W.js.map +1 -0
  123. package/dist/platform-BZjp9wp1.cjs +2 -0
  124. package/dist/platform-BZjp9wp1.cjs.map +1 -0
  125. package/dist/{platform-8DLhjddo.js → platform-Dba6R3Hp.js} +22 -9
  126. package/dist/platform-Dba6R3Hp.js.map +1 -0
  127. package/dist/{profiler-BaXSqCfz.js → profiler-DNKcqu09.js} +19 -19
  128. package/dist/{profiler-BaXSqCfz.js.map → profiler-DNKcqu09.js.map} +1 -1
  129. package/dist/{profiler-BvWW2kNM.cjs → profiler-DpoPi1hH.cjs} +2 -2
  130. package/dist/{profiler-BvWW2kNM.cjs.map → profiler-DpoPi1hH.cjs.map} +1 -1
  131. package/dist/{profiler-frames-DeaBiB-5.cjs → profiler-frames-C9zJNd8_.cjs} +2 -2
  132. package/dist/{profiler-frames-DeaBiB-5.cjs.map → profiler-frames-C9zJNd8_.cjs.map} +1 -1
  133. package/dist/{profiler-frames-C4ySHN0X.js → profiler-frames-CGXZeZ_3.js} +4 -4
  134. package/dist/{profiler-frames-C4ySHN0X.js.map → profiler-frames-CGXZeZ_3.js.map} +1 -1
  135. package/dist/{remote-rules-Dq9xe7Qn.js → remote-rules-DNK96vLa.js} +15 -15
  136. package/dist/{remote-rules-Dq9xe7Qn.js.map → remote-rules-DNK96vLa.js.map} +1 -1
  137. package/dist/{remote-rules-D7L6D_D2.cjs → remote-rules-DuMFRlit.cjs} +2 -2
  138. package/dist/{remote-rules-D7L6D_D2.cjs.map → remote-rules-DuMFRlit.cjs.map} +1 -1
  139. package/dist/replay-Cab-lSit.cjs +2 -0
  140. package/dist/replay-Cab-lSit.cjs.map +1 -0
  141. package/dist/{replay-B0M8kWz_.js → replay-Dy6OiaOZ.js} +89 -62
  142. package/dist/replay-Dy6OiaOZ.js.map +1 -0
  143. package/dist/{reports-ojuMKGO7.cjs → reports-CGK9YQch.cjs} +2 -2
  144. package/dist/{reports-ojuMKGO7.cjs.map → reports-CGK9YQch.cjs.map} +1 -1
  145. package/dist/{reports--8APRLa-.js → reports-CX57-S9s.js} +3 -3
  146. package/dist/{reports--8APRLa-.js.map → reports-CX57-S9s.js.map} +1 -1
  147. package/dist/{resource-timing-BzR05rE-.js → resource-timing-CWVDCbrY.js} +4 -4
  148. package/dist/{resource-timing-BzR05rE-.js.map → resource-timing-CWVDCbrY.js.map} +1 -1
  149. package/dist/{resource-timing-pAG3ZhB5.cjs → resource-timing-DalulXiR.cjs} +2 -2
  150. package/dist/{resource-timing-pAG3ZhB5.cjs.map → resource-timing-DalulXiR.cjs.map} +1 -1
  151. package/dist/response-body-Cpz5__4g.cjs +3 -0
  152. package/dist/response-body-Cpz5__4g.cjs.map +1 -0
  153. package/dist/{response-body-BWvwKQ2p.js → response-body-yi92Rpvo.js} +100 -100
  154. package/dist/response-body-yi92Rpvo.js.map +1 -0
  155. package/dist/{rotation-BylN1B9e.js → rotation-ChBbNDE2.js} +24 -24
  156. package/dist/rotation-ChBbNDE2.js.map +1 -0
  157. package/dist/rotation-fTnNJcfH.cjs +2 -0
  158. package/dist/rotation-fTnNJcfH.cjs.map +1 -0
  159. package/dist/{sampling-zXA6r-Nw.js → sampling-DZTOD28D.js} +6 -6
  160. package/dist/{sampling-zXA6r-Nw.js.map → sampling-DZTOD28D.js.map} +1 -1
  161. package/dist/{sampling-B46LW0cy.cjs → sampling-wAVJIZXp.cjs} +2 -2
  162. package/dist/{sampling-B46LW0cy.cjs.map → sampling-wAVJIZXp.cjs.map} +1 -1
  163. package/dist/{sanitize-DjnR6RXR.js → sanitize-B2GKlSFp.js} +2 -2
  164. package/dist/{sanitize-DjnR6RXR.js.map → sanitize-B2GKlSFp.js.map} +1 -1
  165. package/dist/{sanitize-Qj6LuZqp.cjs → sanitize-BZdhoghq.cjs} +2 -2
  166. package/dist/{sanitize-Qj6LuZqp.cjs.map → sanitize-BZdhoghq.cjs.map} +1 -1
  167. package/dist/{sender-Bdp-TAS4.js → sender-BRSpc7R8.js} +175 -161
  168. package/dist/sender-BRSpc7R8.js.map +1 -0
  169. package/dist/sender-CFu98DAB.cjs +2 -0
  170. package/dist/sender-CFu98DAB.cjs.map +1 -0
  171. package/dist/storage/emergency-queue.d.cts +3 -1
  172. package/dist/storage/emergency-queue.d.ts +3 -1
  173. package/dist/storage/stored-context.d.cts +3 -2
  174. package/dist/storage/stored-context.d.ts +3 -2
  175. package/dist/stored-context-CPLlzgpm.cjs +2 -0
  176. package/dist/stored-context-CPLlzgpm.cjs.map +1 -0
  177. package/dist/{stored-context-CSttrAsw.js → stored-context-df1dEnht.js} +10 -8
  178. package/dist/stored-context-df1dEnht.js.map +1 -0
  179. package/dist/{storm-DKlpv0FL.js → storm-U3_ek1nA.js} +2 -2
  180. package/dist/{storm-DKlpv0FL.js.map → storm-U3_ek1nA.js.map} +1 -1
  181. package/dist/{storm-BHgI12iS.cjs → storm-qiE_AMC7.cjs} +2 -2
  182. package/dist/{storm-BHgI12iS.cjs.map → storm-qiE_AMC7.cjs.map} +1 -1
  183. package/dist/transport/exit-flush.d.cts +23 -0
  184. package/dist/transport/exit-flush.d.ts +23 -0
  185. package/dist/transport/http-transport.d.cts +3 -2
  186. package/dist/transport/http-transport.d.ts +3 -2
  187. package/dist/transport/retry-engine.d.cts +11 -3
  188. package/dist/transport/retry-engine.d.ts +11 -3
  189. package/dist/types-BAerHgCq.js.map +1 -1
  190. package/dist/types-C7WNpnG1.cjs.map +1 -1
  191. package/dist/{unclean-exit-BcOB8A2e.js → unclean-exit-Bj6gYHeL.js} +2 -2
  192. package/dist/{unclean-exit-BcOB8A2e.js.map → unclean-exit-Bj6gYHeL.js.map} +1 -1
  193. package/dist/{unclean-exit-BYPYYkQ5.cjs → unclean-exit-CuBh-ee5.cjs} +2 -2
  194. package/dist/{unclean-exit-BYPYYkQ5.cjs.map → unclean-exit-CuBh-ee5.cjs.map} +1 -1
  195. package/dist/{user-timing-BsU2wQKE.cjs → user-timing-BWqzYF2Q.cjs} +2 -2
  196. package/dist/{user-timing-BsU2wQKE.cjs.map → user-timing-BWqzYF2Q.cjs.map} +1 -1
  197. package/dist/{user-timing-4KIJ74Vi.js → user-timing-Duz0d-OA.js} +2 -2
  198. package/dist/{user-timing-4KIJ74Vi.js.map → user-timing-Duz0d-OA.js.map} +1 -1
  199. package/dist/utils/lock.d.cts +3 -2
  200. package/dist/utils/lock.d.ts +3 -2
  201. package/dist/utils/openfin.d.cts +18 -6
  202. package/dist/utils/openfin.d.ts +18 -6
  203. package/dist/utils/patch.d.cts +1 -1
  204. package/dist/utils/patch.d.ts +1 -1
  205. package/dist/utils/platform.d.cts +6 -0
  206. package/dist/utils/platform.d.ts +6 -0
  207. package/dist/{web-socket-Zg0hj1LB.js → web-socket-CE_9Q22z.js} +5 -5
  208. package/dist/{web-socket-Zg0hj1LB.js.map → web-socket-CE_9Q22z.js.map} +1 -1
  209. package/dist/{web-socket-Cs1ZbmmN.cjs → web-socket-sm3rD-A_.cjs} +2 -2
  210. package/dist/{web-socket-Cs1ZbmmN.cjs.map → web-socket-sm3rD-A_.cjs.map} +1 -1
  211. package/dist/{web-vitals-4pWACwaR.js → web-vitals-CGwXGF-M.js} +4 -4
  212. package/dist/web-vitals-CGwXGF-M.js.map +1 -0
  213. package/dist/web-vitals-Df4Wsfx9.cjs +2 -0
  214. package/dist/web-vitals-Df4Wsfx9.cjs.map +1 -0
  215. package/dist/{worker-protocol-DFYXIFus.cjs → worker-protocol-D5VnCdWY.cjs} +2 -2
  216. package/dist/{worker-protocol-DFYXIFus.cjs.map → worker-protocol-D5VnCdWY.cjs.map} +1 -1
  217. package/dist/{worker-protocol-CYpAbrVl.js → worker-protocol-h4-tRWqy.js} +6 -6
  218. package/dist/{worker-protocol-CYpAbrVl.js.map → worker-protocol-h4-tRWqy.js.map} +1 -1
  219. package/dist/{worker-server--yGTadTA.cjs → worker-server-CF1yatXq.cjs} +2 -2
  220. package/dist/{worker-server--yGTadTA.cjs.map → worker-server-CF1yatXq.cjs.map} +1 -1
  221. package/dist/worker-server-FYfKHQhJ.js +94 -0
  222. package/dist/{worker-server-BokySIII.js.map → worker-server-FYfKHQhJ.js.map} +1 -1
  223. package/dist/{worker-transport-BdEvh_-a.cjs → worker-transport-COgY4RX8.cjs} +2 -2
  224. package/dist/{worker-transport-BdEvh_-a.cjs.map → worker-transport-COgY4RX8.cjs.map} +1 -1
  225. package/dist/{worker-transport-JK-Fby9J.js → worker-transport-jzX1IusG.js} +34 -34
  226. package/dist/{worker-transport-JK-Fby9J.js.map → worker-transport-jzX1IusG.js.map} +1 -1
  227. package/llms.txt +1 -2
  228. package/package.json +1 -1
  229. package/dist/bus-B__467mL.cjs +0 -2
  230. package/dist/bus-B__467mL.cjs.map +0 -1
  231. package/dist/bus-dw7T92sO.js.map +0 -1
  232. package/dist/config-CSNcS7OZ.js.map +0 -1
  233. package/dist/config-CybPP5VM.cjs +0 -2
  234. package/dist/config-CybPP5VM.cjs.map +0 -1
  235. package/dist/constants-BwJDXzj6.js.map +0 -1
  236. package/dist/constants-CtF52hIV.cjs +0 -2
  237. package/dist/constants-CtF52hIV.cjs.map +0 -1
  238. package/dist/errors-DP2RUm4V.cjs +0 -3
  239. package/dist/errors-DP2RUm4V.cjs.map +0 -1
  240. package/dist/errors-Q3Ng1ciC.js.map +0 -1
  241. package/dist/factory-DV17sm2p.js.map +0 -1
  242. package/dist/factory-K8O6gpux.cjs +0 -2
  243. package/dist/factory-K8O6gpux.cjs.map +0 -1
  244. package/dist/interactions-Byxf1C82.js.map +0 -1
  245. package/dist/interactions-OK85T-Dk.cjs.map +0 -1
  246. package/dist/patch-BX8KrPCT.cjs +0 -2
  247. package/dist/patch-BX8KrPCT.cjs.map +0 -1
  248. package/dist/patch-UdPz1ea8.js +0 -8
  249. package/dist/patch-UdPz1ea8.js.map +0 -1
  250. package/dist/platform-8DLhjddo.js.map +0 -1
  251. package/dist/platform-BqRc-7RO.cjs +0 -2
  252. package/dist/platform-BqRc-7RO.cjs.map +0 -1
  253. package/dist/replay-B0M8kWz_.js.map +0 -1
  254. package/dist/replay-QOFBpAXh.cjs +0 -2
  255. package/dist/replay-QOFBpAXh.cjs.map +0 -1
  256. package/dist/response-body-BWvwKQ2p.js.map +0 -1
  257. package/dist/response-body-CKEJ5itk.cjs +0 -3
  258. package/dist/response-body-CKEJ5itk.cjs.map +0 -1
  259. package/dist/rotation-BylN1B9e.js.map +0 -1
  260. package/dist/rotation-E2eKClIs.cjs +0 -2
  261. package/dist/rotation-E2eKClIs.cjs.map +0 -1
  262. package/dist/sender-Bdp-TAS4.js.map +0 -1
  263. package/dist/sender-DR7ZycZY.cjs +0 -2
  264. package/dist/sender-DR7ZycZY.cjs.map +0 -1
  265. package/dist/stored-context-BOu54M8Y.cjs +0 -2
  266. package/dist/stored-context-BOu54M8Y.cjs.map +0 -1
  267. package/dist/stored-context-CSttrAsw.js.map +0 -1
  268. package/dist/web-vitals-4pWACwaR.js.map +0 -1
  269. package/dist/web-vitals-__X7t4pj.cjs +0 -2
  270. package/dist/web-vitals-__X7t4pj.cjs.map +0 -1
  271. package/dist/worker-server-BokySIII.js +0 -94
@@ -40,15 +40,33 @@ export declare class ExitFlush {
40
40
  private readonly deps;
41
41
  /** True while we are listening for the unload events. */
42
42
  private installed;
43
+ /**
44
+ * True after a pagehide with no later pageshow. The batch timers won't fire in a closing
45
+ * document, so a record that arrives now has to take the exit path.
46
+ */
47
+ private left;
48
+ /** True while a late exit flush waits on its microtask, so one task's records go together. */
49
+ private lateQueued;
50
+ /** Late flushes in this page leave, up to LATE_FLUSH_LIMIT. */
51
+ private lateFlushes;
52
+ /** True while beforeExit pushes the open metric points, which the running flush then takes. */
53
+ private collecting;
43
54
  /**
44
55
  * Bytes in flight against the browser's one budget for beacons and keepalive fetches. It
45
56
  * starts at the transport's keepalive sends, and each batch of the current exit flush adds to it.
46
57
  */
47
58
  private keepaliveBytes;
59
+ /**
60
+ * Bytes that the exit sends of this page leave put in flight. A late flush adds them, because
61
+ * nothing tracks an exit send's completion and the browser rejects a send over its budget.
62
+ */
63
+ private leaveBytes;
48
64
  /** Flushes on visibilitychange when the document becomes hidden. */
49
65
  private readonly onVisibility;
50
66
  /** Flushes on the window's pagehide event. */
51
67
  private readonly onPageHide;
68
+ /** Returns to the normal path when the back/forward cache restores the page. */
69
+ private readonly onPageShow;
52
70
  /** Flushes on the document's freeze event. */
53
71
  private readonly onFreeze;
54
72
  /** Flushes on the OpenFin close-requested event. */
@@ -61,6 +79,11 @@ export declare class ExitFlush {
61
79
  install(): void;
62
80
  /** Removes all unload listeners and subscriptions. */
63
81
  uninstall(): void;
82
+ /**
83
+ * Sends a record that reached the sender after pagehide with an exit send on a microtask, so
84
+ * all records of one task go in one send. A web-vitals report arrives this late on a page leave.
85
+ */
86
+ flushLate(): void;
64
87
  /**
65
88
  * Drains pending records synchronously and sends them with a beacon, a keepalive fetch or
66
89
  * emergency storage. A hidden document gets a normal flush. Never awaits and never throws,
@@ -40,15 +40,33 @@ export declare class ExitFlush {
40
40
  private readonly deps;
41
41
  /** True while we are listening for the unload events. */
42
42
  private installed;
43
+ /**
44
+ * True after a pagehide with no later pageshow. The batch timers won't fire in a closing
45
+ * document, so a record that arrives now has to take the exit path.
46
+ */
47
+ private left;
48
+ /** True while a late exit flush waits on its microtask, so one task's records go together. */
49
+ private lateQueued;
50
+ /** Late flushes in this page leave, up to LATE_FLUSH_LIMIT. */
51
+ private lateFlushes;
52
+ /** True while beforeExit pushes the open metric points, which the running flush then takes. */
53
+ private collecting;
43
54
  /**
44
55
  * Bytes in flight against the browser's one budget for beacons and keepalive fetches. It
45
56
  * starts at the transport's keepalive sends, and each batch of the current exit flush adds to it.
46
57
  */
47
58
  private keepaliveBytes;
59
+ /**
60
+ * Bytes that the exit sends of this page leave put in flight. A late flush adds them, because
61
+ * nothing tracks an exit send's completion and the browser rejects a send over its budget.
62
+ */
63
+ private leaveBytes;
48
64
  /** Flushes on visibilitychange when the document becomes hidden. */
49
65
  private readonly onVisibility;
50
66
  /** Flushes on the window's pagehide event. */
51
67
  private readonly onPageHide;
68
+ /** Returns to the normal path when the back/forward cache restores the page. */
69
+ private readonly onPageShow;
52
70
  /** Flushes on the document's freeze event. */
53
71
  private readonly onFreeze;
54
72
  /** Flushes on the OpenFin close-requested event. */
@@ -61,6 +79,11 @@ export declare class ExitFlush {
61
79
  install(): void;
62
80
  /** Removes all unload listeners and subscriptions. */
63
81
  uninstall(): void;
82
+ /**
83
+ * Sends a record that reached the sender after pagehide with an exit send on a microtask, so
84
+ * all records of one task go in one send. A web-vitals report arrives this late on a page leave.
85
+ */
86
+ flushLate(): void;
64
87
  /**
65
88
  * Drains pending records synchronously and sends them with a beacon, a keepalive fetch or
66
89
  * emergency storage. A hidden document gets a normal flush. Never awaits and never throws,
@@ -96,9 +96,10 @@ export declare class HttpTransport extends StatusTransport {
96
96
  /**
97
97
  * Checks whether a send uses keepalive. A mobile OS can stop a hidden page without a
98
98
  * pagehide, and a keepalive request continues after that. The browser limits the keepalive
99
- * bodies in flight.
99
+ * bodies in flight, and rejects one over that budget after the page may already be gone.
100
100
  * @param bytes Size of the request body.
101
- * @returns True for a hidden document and a body of BEACON_LIMIT_BYTES or less.
101
+ * @returns True for a hidden document when the body fits next to the keepalive bytes in
102
+ * flight, within BEACON_LIMIT_BYTES.
102
103
  */
103
104
  private keepalive;
104
105
  /**
@@ -96,9 +96,10 @@ export declare class HttpTransport extends StatusTransport {
96
96
  /**
97
97
  * Checks whether a send uses keepalive. A mobile OS can stop a hidden page without a
98
98
  * pagehide, and a keepalive request continues after that. The browser limits the keepalive
99
- * bodies in flight.
99
+ * bodies in flight, and rejects one over that budget after the page may already be gone.
100
100
  * @param bytes Size of the request body.
101
- * @returns True for a hidden document and a body of BEACON_LIMIT_BYTES or less.
101
+ * @returns True for a hidden document when the body fits next to the keepalive bytes in
102
+ * flight, within BEACON_LIMIT_BYTES.
102
103
  */
103
104
  private keepalive;
104
105
  /**
@@ -33,6 +33,8 @@ export declare class RetryEngine {
33
33
  private readonly onLoss;
34
34
  /** The active retry timer handle, or null when no timer is running. */
35
35
  private timer;
36
+ /** True while the armed timer is the idle poll. A nudge may bring only that one forward. */
37
+ private idle;
36
38
  /** Consecutive failed deliveries. Feeds the backoff calculation. */
37
39
  private attempt;
38
40
  /** True while a storage drain is running. */
@@ -54,7 +56,10 @@ export declare class RetryEngine {
54
56
  constructor(storage: StorageAdapter, transport: BatchTransport, diagnostics: Diagnostics, config: ResolvedConfig, batchesPerDrain?: number, onLoss?: LossReporter);
55
57
  /** Starts the engine. Listens for online events and arms the first timer. */
56
58
  start(): void;
57
- /** Schedules an earlier retry when storage receives a new offline batch. */
59
+ /**
60
+ * Schedules an earlier retry when storage receives a new offline batch. It never cuts a
61
+ * backoff or a Retry-After short, otherwise each failed live send would post to that server.
62
+ */
58
63
  nudge(): void;
59
64
  /**
60
65
  * Stores a batch that failed outside the drain loop, under the same rules as the drain.
@@ -77,6 +82,7 @@ export declare class RetryEngine {
77
82
  /**
78
83
  * Clears the pending timer, then schedules a drain after the delay.
79
84
  * @param delayMs Delay duration in milliseconds.
85
+ * @param idle True for the idle poll, the one wait that a nudge may bring forward.
80
86
  */
81
87
  private schedule;
82
88
  /**
@@ -107,8 +113,9 @@ export declare class RetryEngine {
107
113
  * Tries to deliver one batch. Removes it on success, and on failure applies the rule for
108
114
  * the failure kind.
109
115
  * @param batch Log batch to deliver.
110
- * @returns "next" to continue with the next batch, "stop" to stop the current drain, or a
111
- * delay in milliseconds that blocks the batch's kind until the next drain.
116
+ * @returns "next" to continue with the next batch, "split" when storage holds the halves of a
117
+ * refused batch, "stop" to stop the current drain, or a delay in milliseconds that blocks the
118
+ * batch's kind until the next drain.
112
119
  */
113
120
  private deliver;
114
121
  /**
@@ -116,6 +123,7 @@ export declare class RetryEngine {
116
123
  * or nothing after a permanent refusal.
117
124
  * @param batch Rejected log batch, already held in storage.
118
125
  * @param error Failure thrown by the transport.
126
+ * @returns True when storage kept at least one half.
119
127
  */
120
128
  private replaceStored;
121
129
  /**
@@ -33,6 +33,8 @@ export declare class RetryEngine {
33
33
  private readonly onLoss;
34
34
  /** The active retry timer handle, or null when no timer is running. */
35
35
  private timer;
36
+ /** True while the armed timer is the idle poll. A nudge may bring only that one forward. */
37
+ private idle;
36
38
  /** Consecutive failed deliveries. Feeds the backoff calculation. */
37
39
  private attempt;
38
40
  /** True while a storage drain is running. */
@@ -54,7 +56,10 @@ export declare class RetryEngine {
54
56
  constructor(storage: StorageAdapter, transport: BatchTransport, diagnostics: Diagnostics, config: ResolvedConfig, batchesPerDrain?: number, onLoss?: LossReporter);
55
57
  /** Starts the engine. Listens for online events and arms the first timer. */
56
58
  start(): void;
57
- /** Schedules an earlier retry when storage receives a new offline batch. */
59
+ /**
60
+ * Schedules an earlier retry when storage receives a new offline batch. It never cuts a
61
+ * backoff or a Retry-After short, otherwise each failed live send would post to that server.
62
+ */
58
63
  nudge(): void;
59
64
  /**
60
65
  * Stores a batch that failed outside the drain loop, under the same rules as the drain.
@@ -77,6 +82,7 @@ export declare class RetryEngine {
77
82
  /**
78
83
  * Clears the pending timer, then schedules a drain after the delay.
79
84
  * @param delayMs Delay duration in milliseconds.
85
+ * @param idle True for the idle poll, the one wait that a nudge may bring forward.
80
86
  */
81
87
  private schedule;
82
88
  /**
@@ -107,8 +113,9 @@ export declare class RetryEngine {
107
113
  * Tries to deliver one batch. Removes it on success, and on failure applies the rule for
108
114
  * the failure kind.
109
115
  * @param batch Log batch to deliver.
110
- * @returns "next" to continue with the next batch, "stop" to stop the current drain, or a
111
- * delay in milliseconds that blocks the batch's kind until the next drain.
116
+ * @returns "next" to continue with the next batch, "split" when storage holds the halves of a
117
+ * refused batch, "stop" to stop the current drain, or a delay in milliseconds that blocks the
118
+ * batch's kind until the next drain.
112
119
  */
113
120
  private deliver;
114
121
  /**
@@ -116,6 +123,7 @@ export declare class RetryEngine {
116
123
  * or nothing after a permanent refusal.
117
124
  * @param batch Rejected log batch, already held in storage.
118
125
  * @param error Failure thrown by the transport.
126
+ * @returns True when storage kept at least one half.
119
127
  */
120
128
  private replaceStored;
121
129
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types-BAerHgCq.js","names":["matchesAny","url","patterns","pattern"],"sources":["../src/capture/types.ts"],"sourcesContent":["// src/capture/types.ts\n//\n// Shared interfaces, the logger abstraction and helpers for the auto-capture modules.\n\nimport type { BreadcrumbBuffer } from \"../core/breadcrumbs\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { SpanData } from \"../core/spans\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { LogRecord, MetricType } from \"../models/log-record\";\nimport type { InstrumentDef, MetricAttributes } from \"../models/metric\";\nimport type { TraceEngine } from \"../utils/tracing\";\n\n/**\n * The logging interface the auto-capture modules use. Referring to the runtime class here\n * would create an import cycle, because the runtime installs the capture modules.\n */\nexport interface CaptureLogger {\n /**\n * Logs an error event, with the error or reason behind it.\n * @param message Error description.\n * @param error The caught error or reason.\n * @param payload Optional attributes.\n */\n error(message: string, error?: unknown, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a warning event.\n * @param message Warning description.\n * @param payload Optional attributes.\n */\n warn(message: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a single lifecycle or user event.\n * @param name Event identifier.\n * @param payload Optional attributes.\n */\n logEvent(name: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a numeric metric measurement.\n * @param name Metric name.\n * @param value The measurement.\n * @param unit Unit of measurement.\n * @param type Metric type.\n * @param attrs Optional metric attributes. With metricsEndpoint they're point attributes.\n * @param recordOnly Optional attributes for the record only, never on the OTLP point.\n */\n logMetric(\n name: string,\n value: number,\n unit?: string,\n type?: MetricType,\n attrs?: Record<string, unknown>,\n recordOnly?: Record<string, unknown>,\n ): void;\n\n /**\n * Logs a debug message.\n * @param message Debug message.\n * @param payload Optional attributes.\n */\n debug(message: string, payload?: Record<string, unknown>): void;\n}\n\n/**\n * Capture work that runs once per document, not once per install. A reconfigure\n * builds new capture instances, so instance state can't hold these flags.\n * web-vitals has no unsubscribe, and a second subscription would report every\n * metric twice.\n */\nexport interface CaptureOnce {\n /** True once the web-vitals reporters are subscribed. */\n webVitals: boolean;\n /** True once navigation timing has been reported. */\n navigationTiming: boolean;\n /** True after the first long frame install. Only that install reads buffered frames. */\n longFrames: boolean;\n /** True once we've read the previous page's alive marker. */\n uncleanExit: boolean;\n /** True after the first user timing install. Only that install reads buffered entries. */\n userTiming: boolean;\n /** True after the first resource timing install. Later installs skip buffered entries. */\n resourceTiming?: boolean;\n /** Page state and when it started. A reinstall keeps them, so it logs no false transition. */\n lifecycle?: { state: string; enteredAt: number };\n /** Set once the frame phases capture has reported a browser without long animation frames. */\n framePhases?: boolean;\n /** Set once the profiler's frame pacing has reported a context without frame callbacks. */\n framePacing?: boolean;\n /** Set once session replay has reported why it can't record in this document. */\n replay?: boolean;\n}\n\n/** Runtime dependencies shared by all auto-capture instances. */\nexport interface CaptureContext {\n /** False while the runtime is stopping or changing its security context. */\n isActive?: () => boolean;\n /** Active runtime configuration. */\n config: ResolvedConfig;\n /** Diagnostics reporter for capture faults. */\n diagnostics: Diagnostics;\n /** Logger for the telemetry the captures record. */\n logger: CaptureLogger;\n /** Breadcrumb buffer. */\n breadcrumbs: BreadcrumbBuffer;\n /** Active trace context provider. */\n tracing: TraceEngine;\n /** Guards for capture work that a reinstall must not repeat. */\n once: CaptureOnce;\n /** Adds a value to one of the runtime's counters or histograms. */\n recordMetric: (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;\n /** Records a span. The runtime drops it when spans are off. */\n recordSpan: (span: SpanData) => void;\n /** Returns the current session id. */\n sessionId: () => string;\n /** Sets or clears the hook that receives every ERROR and FATAL record from the runtime. */\n onError?: (hook: ((record: LogRecord) => void) | undefined) => void;\n /** Sets an ambient attribute on every later record. Undefined removes it. */\n setContext?: (key: string, value: string | undefined) => void;\n /** True after startReplay(), false after stopReplay(), undefined if neither was called. */\n replayConsent?: () => boolean | undefined;\n}\n\n/** Lifecycle interface for the browser instrumentation modules. */\nexport interface Capture {\n /** Module identifier used in diagnostics. */\n readonly name: string;\n /**\n * Attaches the instrumentation listeners and patches the target APIs. Patching an\n * already patched function adds a second wrapper and doubles every record, so a\n * second call must do nothing.\n */\n install(): void;\n /** Restores the native APIs and removes the listeners. */\n uninstall(): void;\n}\n\n/**\n * Checks whether a URL matches any of the substring or regular expression patterns.\n * @param url URL to test. A value that isn't a string matches nothing.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: unknown, patterns: (string | RegExp)[]): boolean {\n // Guard against a URL that isn't a string. includes() on it would throw inside the host's call.\n if (typeof url !== \"string\") {\n return false;\n }\n\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n"],"mappings":";AAgJA,SAAgBA,EAAW,GAAc,GAAwC;CAM/E,OAJI,OAAOC,KAAQ,YAIZC,EAAS,MAAM,MACpB,OAAOC,KAAY,WAAWF,EAAI,SAASE,CAAO,IAAIA,EAAQ,KAAKF,CAAG,CACxE;AACF"}
1
+ {"version":3,"file":"types-BAerHgCq.js","names":["matchesAny","url","patterns","pattern"],"sources":["../src/capture/types.ts"],"sourcesContent":["// src/capture/types.ts\n//\n// Shared interfaces, the logger abstraction and helpers for the auto-capture modules.\n\nimport type { BreadcrumbBuffer } from \"../core/breadcrumbs\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { SpanData } from \"../core/spans\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { LogRecord, MetricType } from \"../models/log-record\";\nimport type { InstrumentDef, MetricAttributes } from \"../models/metric\";\nimport type { TraceEngine } from \"../utils/tracing\";\n\n/**\n * The logging interface the auto-capture modules use. Referring to the runtime class here\n * would create an import cycle, because the runtime installs the capture modules.\n */\nexport interface CaptureLogger {\n /**\n * Logs an error event, with the error or reason behind it.\n * @param message Error description.\n * @param error The caught error or reason.\n * @param payload Optional attributes.\n */\n error(message: string, error?: unknown, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a warning event.\n * @param message Warning description.\n * @param payload Optional attributes.\n */\n warn(message: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a single lifecycle or user event.\n * @param name Event identifier.\n * @param payload Optional attributes.\n */\n logEvent(name: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a numeric metric measurement.\n * @param name Metric name.\n * @param value The measurement.\n * @param unit Unit of measurement.\n * @param type Metric type.\n * @param attrs Optional metric attributes. With metricsEndpoint they're point attributes.\n * @param recordOnly Optional attributes for the record only, never on the OTLP point.\n */\n logMetric(\n name: string,\n value: number,\n unit?: string,\n type?: MetricType,\n attrs?: Record<string, unknown>,\n recordOnly?: Record<string, unknown>,\n ): void;\n\n /**\n * Logs a debug message.\n * @param message Debug message.\n * @param payload Optional attributes.\n */\n debug(message: string, payload?: Record<string, unknown>): void;\n}\n\n/**\n * Capture work that runs once per document, not once per install. A reconfigure\n * builds new capture instances, so instance state can't hold these flags.\n * web-vitals has no unsubscribe, and a second subscription would report every\n * metric twice.\n */\nexport interface CaptureOnce {\n /** True once the web-vitals reporters are subscribed. */\n webVitals: boolean;\n /**\n * True while a web-vitals capture is installed. The reporters check it when a metric fires,\n * because they can't unsubscribe and a switched-off capture must record nothing.\n */\n webVitalsOn?: boolean;\n /** True once navigation timing has been reported. */\n navigationTiming: boolean;\n /** True after the first long frame install. Only that install reads buffered frames. */\n longFrames: boolean;\n /** True once we've read the previous page's alive marker. */\n uncleanExit: boolean;\n /** True after the first user timing install. Only that install reads buffered entries. */\n userTiming: boolean;\n /** True after the first resource timing install. Later installs skip buffered entries. */\n resourceTiming?: boolean;\n /** Page state and when it started. A reinstall keeps them, so it logs no false transition. */\n lifecycle?: { state: string; enteredAt: number };\n /** Set once the frame phases capture has reported a browser without long animation frames. */\n framePhases?: boolean;\n /** Set once the profiler's frame pacing has reported a context without frame callbacks. */\n framePacing?: boolean;\n /** Set once session replay has reported why it can't record in this document. */\n replay?: boolean;\n}\n\n/** Runtime dependencies shared by all auto-capture instances. */\nexport interface CaptureContext {\n /** False while the runtime is stopping or changing its security context. */\n isActive?: () => boolean;\n /** Active runtime configuration. */\n config: ResolvedConfig;\n /** Diagnostics reporter for capture faults. */\n diagnostics: Diagnostics;\n /** Logger for the telemetry the captures record. */\n logger: CaptureLogger;\n /** Breadcrumb buffer. */\n breadcrumbs: BreadcrumbBuffer;\n /** Active trace context provider. */\n tracing: TraceEngine;\n /** Guards for capture work that a reinstall must not repeat. */\n once: CaptureOnce;\n /** Adds a value to one of the runtime's counters or histograms. */\n recordMetric: (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;\n /** Records a span. The runtime drops it when spans are off. */\n recordSpan: (span: SpanData) => void;\n /** Returns the current session id. */\n sessionId: () => string;\n /** Sets or clears the hook that receives every ERROR and FATAL record from the runtime. */\n onError?: (hook: ((record: LogRecord) => void) | undefined) => void;\n /** Sets an ambient attribute on every later record. Undefined removes it. */\n setContext?: (key: string, value: string | undefined) => void;\n /** True after startReplay(), false after stopReplay(), undefined if neither was called. */\n replayConsent?: () => boolean | undefined;\n}\n\n/** Lifecycle interface for the browser instrumentation modules. */\nexport interface Capture {\n /** Module identifier used in diagnostics. */\n readonly name: string;\n /**\n * Attaches the instrumentation listeners and patches the target APIs. Patching an\n * already patched function adds a second wrapper and doubles every record, so a\n * second call must do nothing.\n */\n install(): void;\n /** Restores the native APIs and removes the listeners. */\n uninstall(): void;\n}\n\n/**\n * Checks whether a URL matches any of the substring or regular expression patterns.\n * @param url URL to test. A value that isn't a string matches nothing.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: unknown, patterns: (string | RegExp)[]): boolean {\n // Guard against a URL that isn't a string. includes() on it would throw inside the host's call.\n if (typeof url !== \"string\") {\n return false;\n }\n\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n"],"mappings":";AAqJA,SAAgBA,EAAW,GAAc,GAAwC;CAM/E,OAJI,OAAOC,KAAQ,YAIZC,EAAS,MAAM,MACpB,OAAOC,KAAY,WAAWF,EAAI,SAASE,CAAO,IAAIA,EAAQ,KAAKF,CAAG,CACxE;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"types-C7WNpnG1.cjs","names":["matchesAny","url","patterns","pattern"],"sources":["../src/capture/types.ts"],"sourcesContent":["// src/capture/types.ts\n//\n// Shared interfaces, the logger abstraction and helpers for the auto-capture modules.\n\nimport type { BreadcrumbBuffer } from \"../core/breadcrumbs\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { SpanData } from \"../core/spans\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { LogRecord, MetricType } from \"../models/log-record\";\nimport type { InstrumentDef, MetricAttributes } from \"../models/metric\";\nimport type { TraceEngine } from \"../utils/tracing\";\n\n/**\n * The logging interface the auto-capture modules use. Referring to the runtime class here\n * would create an import cycle, because the runtime installs the capture modules.\n */\nexport interface CaptureLogger {\n /**\n * Logs an error event, with the error or reason behind it.\n * @param message Error description.\n * @param error The caught error or reason.\n * @param payload Optional attributes.\n */\n error(message: string, error?: unknown, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a warning event.\n * @param message Warning description.\n * @param payload Optional attributes.\n */\n warn(message: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a single lifecycle or user event.\n * @param name Event identifier.\n * @param payload Optional attributes.\n */\n logEvent(name: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a numeric metric measurement.\n * @param name Metric name.\n * @param value The measurement.\n * @param unit Unit of measurement.\n * @param type Metric type.\n * @param attrs Optional metric attributes. With metricsEndpoint they're point attributes.\n * @param recordOnly Optional attributes for the record only, never on the OTLP point.\n */\n logMetric(\n name: string,\n value: number,\n unit?: string,\n type?: MetricType,\n attrs?: Record<string, unknown>,\n recordOnly?: Record<string, unknown>,\n ): void;\n\n /**\n * Logs a debug message.\n * @param message Debug message.\n * @param payload Optional attributes.\n */\n debug(message: string, payload?: Record<string, unknown>): void;\n}\n\n/**\n * Capture work that runs once per document, not once per install. A reconfigure\n * builds new capture instances, so instance state can't hold these flags.\n * web-vitals has no unsubscribe, and a second subscription would report every\n * metric twice.\n */\nexport interface CaptureOnce {\n /** True once the web-vitals reporters are subscribed. */\n webVitals: boolean;\n /** True once navigation timing has been reported. */\n navigationTiming: boolean;\n /** True after the first long frame install. Only that install reads buffered frames. */\n longFrames: boolean;\n /** True once we've read the previous page's alive marker. */\n uncleanExit: boolean;\n /** True after the first user timing install. Only that install reads buffered entries. */\n userTiming: boolean;\n /** True after the first resource timing install. Later installs skip buffered entries. */\n resourceTiming?: boolean;\n /** Page state and when it started. A reinstall keeps them, so it logs no false transition. */\n lifecycle?: { state: string; enteredAt: number };\n /** Set once the frame phases capture has reported a browser without long animation frames. */\n framePhases?: boolean;\n /** Set once the profiler's frame pacing has reported a context without frame callbacks. */\n framePacing?: boolean;\n /** Set once session replay has reported why it can't record in this document. */\n replay?: boolean;\n}\n\n/** Runtime dependencies shared by all auto-capture instances. */\nexport interface CaptureContext {\n /** False while the runtime is stopping or changing its security context. */\n isActive?: () => boolean;\n /** Active runtime configuration. */\n config: ResolvedConfig;\n /** Diagnostics reporter for capture faults. */\n diagnostics: Diagnostics;\n /** Logger for the telemetry the captures record. */\n logger: CaptureLogger;\n /** Breadcrumb buffer. */\n breadcrumbs: BreadcrumbBuffer;\n /** Active trace context provider. */\n tracing: TraceEngine;\n /** Guards for capture work that a reinstall must not repeat. */\n once: CaptureOnce;\n /** Adds a value to one of the runtime's counters or histograms. */\n recordMetric: (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;\n /** Records a span. The runtime drops it when spans are off. */\n recordSpan: (span: SpanData) => void;\n /** Returns the current session id. */\n sessionId: () => string;\n /** Sets or clears the hook that receives every ERROR and FATAL record from the runtime. */\n onError?: (hook: ((record: LogRecord) => void) | undefined) => void;\n /** Sets an ambient attribute on every later record. Undefined removes it. */\n setContext?: (key: string, value: string | undefined) => void;\n /** True after startReplay(), false after stopReplay(), undefined if neither was called. */\n replayConsent?: () => boolean | undefined;\n}\n\n/** Lifecycle interface for the browser instrumentation modules. */\nexport interface Capture {\n /** Module identifier used in diagnostics. */\n readonly name: string;\n /**\n * Attaches the instrumentation listeners and patches the target APIs. Patching an\n * already patched function adds a second wrapper and doubles every record, so a\n * second call must do nothing.\n */\n install(): void;\n /** Restores the native APIs and removes the listeners. */\n uninstall(): void;\n}\n\n/**\n * Checks whether a URL matches any of the substring or regular expression patterns.\n * @param url URL to test. A value that isn't a string matches nothing.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: unknown, patterns: (string | RegExp)[]): boolean {\n // Guard against a URL that isn't a string. includes() on it would throw inside the host's call.\n if (typeof url !== \"string\") {\n return false;\n }\n\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n"],"mappings":"AAgJA,SAAgBA,EAAW,EAAc,EAAwC,CAM/E,OAJI,OAAOC,GAAQ,UAIZC,EAAS,KAAM,GACpB,OAAOC,GAAY,SAAWF,EAAI,SAASE,CAAO,EAAIA,EAAQ,KAAKF,CAAG,CACxE,CACF,C"}
1
+ {"version":3,"file":"types-C7WNpnG1.cjs","names":["matchesAny","url","patterns","pattern"],"sources":["../src/capture/types.ts"],"sourcesContent":["// src/capture/types.ts\n//\n// Shared interfaces, the logger abstraction and helpers for the auto-capture modules.\n\nimport type { BreadcrumbBuffer } from \"../core/breadcrumbs\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { SpanData } from \"../core/spans\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { LogRecord, MetricType } from \"../models/log-record\";\nimport type { InstrumentDef, MetricAttributes } from \"../models/metric\";\nimport type { TraceEngine } from \"../utils/tracing\";\n\n/**\n * The logging interface the auto-capture modules use. Referring to the runtime class here\n * would create an import cycle, because the runtime installs the capture modules.\n */\nexport interface CaptureLogger {\n /**\n * Logs an error event, with the error or reason behind it.\n * @param message Error description.\n * @param error The caught error or reason.\n * @param payload Optional attributes.\n */\n error(message: string, error?: unknown, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a warning event.\n * @param message Warning description.\n * @param payload Optional attributes.\n */\n warn(message: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a single lifecycle or user event.\n * @param name Event identifier.\n * @param payload Optional attributes.\n */\n logEvent(name: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a numeric metric measurement.\n * @param name Metric name.\n * @param value The measurement.\n * @param unit Unit of measurement.\n * @param type Metric type.\n * @param attrs Optional metric attributes. With metricsEndpoint they're point attributes.\n * @param recordOnly Optional attributes for the record only, never on the OTLP point.\n */\n logMetric(\n name: string,\n value: number,\n unit?: string,\n type?: MetricType,\n attrs?: Record<string, unknown>,\n recordOnly?: Record<string, unknown>,\n ): void;\n\n /**\n * Logs a debug message.\n * @param message Debug message.\n * @param payload Optional attributes.\n */\n debug(message: string, payload?: Record<string, unknown>): void;\n}\n\n/**\n * Capture work that runs once per document, not once per install. A reconfigure\n * builds new capture instances, so instance state can't hold these flags.\n * web-vitals has no unsubscribe, and a second subscription would report every\n * metric twice.\n */\nexport interface CaptureOnce {\n /** True once the web-vitals reporters are subscribed. */\n webVitals: boolean;\n /**\n * True while a web-vitals capture is installed. The reporters check it when a metric fires,\n * because they can't unsubscribe and a switched-off capture must record nothing.\n */\n webVitalsOn?: boolean;\n /** True once navigation timing has been reported. */\n navigationTiming: boolean;\n /** True after the first long frame install. Only that install reads buffered frames. */\n longFrames: boolean;\n /** True once we've read the previous page's alive marker. */\n uncleanExit: boolean;\n /** True after the first user timing install. Only that install reads buffered entries. */\n userTiming: boolean;\n /** True after the first resource timing install. Later installs skip buffered entries. */\n resourceTiming?: boolean;\n /** Page state and when it started. A reinstall keeps them, so it logs no false transition. */\n lifecycle?: { state: string; enteredAt: number };\n /** Set once the frame phases capture has reported a browser without long animation frames. */\n framePhases?: boolean;\n /** Set once the profiler's frame pacing has reported a context without frame callbacks. */\n framePacing?: boolean;\n /** Set once session replay has reported why it can't record in this document. */\n replay?: boolean;\n}\n\n/** Runtime dependencies shared by all auto-capture instances. */\nexport interface CaptureContext {\n /** False while the runtime is stopping or changing its security context. */\n isActive?: () => boolean;\n /** Active runtime configuration. */\n config: ResolvedConfig;\n /** Diagnostics reporter for capture faults. */\n diagnostics: Diagnostics;\n /** Logger for the telemetry the captures record. */\n logger: CaptureLogger;\n /** Breadcrumb buffer. */\n breadcrumbs: BreadcrumbBuffer;\n /** Active trace context provider. */\n tracing: TraceEngine;\n /** Guards for capture work that a reinstall must not repeat. */\n once: CaptureOnce;\n /** Adds a value to one of the runtime's counters or histograms. */\n recordMetric: (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;\n /** Records a span. The runtime drops it when spans are off. */\n recordSpan: (span: SpanData) => void;\n /** Returns the current session id. */\n sessionId: () => string;\n /** Sets or clears the hook that receives every ERROR and FATAL record from the runtime. */\n onError?: (hook: ((record: LogRecord) => void) | undefined) => void;\n /** Sets an ambient attribute on every later record. Undefined removes it. */\n setContext?: (key: string, value: string | undefined) => void;\n /** True after startReplay(), false after stopReplay(), undefined if neither was called. */\n replayConsent?: () => boolean | undefined;\n}\n\n/** Lifecycle interface for the browser instrumentation modules. */\nexport interface Capture {\n /** Module identifier used in diagnostics. */\n readonly name: string;\n /**\n * Attaches the instrumentation listeners and patches the target APIs. Patching an\n * already patched function adds a second wrapper and doubles every record, so a\n * second call must do nothing.\n */\n install(): void;\n /** Restores the native APIs and removes the listeners. */\n uninstall(): void;\n}\n\n/**\n * Checks whether a URL matches any of the substring or regular expression patterns.\n * @param url URL to test. A value that isn't a string matches nothing.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: unknown, patterns: (string | RegExp)[]): boolean {\n // Guard against a URL that isn't a string. includes() on it would throw inside the host's call.\n if (typeof url !== \"string\") {\n return false;\n }\n\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n"],"mappings":"AAqJA,SAAgBA,EAAW,EAAc,EAAwC,CAM/E,OAJI,OAAOC,GAAQ,UAIZC,EAAS,KAAM,GACpB,OAAOC,GAAY,SAAWF,EAAI,SAASE,CAAO,EAAIA,EAAQ,KAAKF,CAAG,CACxE,CACF,C"}
@@ -1,4 +1,4 @@
1
- import { n as e, r as t } from "./constants-BwJDXzj6.js";
1
+ import { n as e, r as t } from "./constants-CEHN6KuY.js";
2
2
  import { t as n } from "./defineProperty-s2S8BXUc.js";
3
3
  // src/capture/unclean-exit.ts
4
4
  function r(e) {
@@ -52,4 +52,4 @@ var i = class {
52
52
  };
53
53
  export { i as UncleanExitCapture };
54
54
 
55
- //# sourceMappingURL=unclean-exit-BcOB8A2e.js.map
55
+ //# sourceMappingURL=unclean-exit-Bj6gYHeL.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unclean-exit-BcOB8A2e.js","names":["ALIVE_KEY","ALIVE_UPDATE_MS","_defineProperty","readMarker","value","text","sessionId","at","visibility","UncleanExitCapture","marker","event","ctx"],"sources":["../src/capture/unclean-exit.ts"],"sourcesContent":["// src/capture/unclean-exit.ts\n//\n// Detects a page in this tab that ended without a clean close, for example after a crash. The\n// top document keeps a marker in sessionStorage and a clean close removes it, so if the tab's\n// next page finds a marker, it reports it.\n\nimport { ALIVE_KEY, ALIVE_UPDATE_MS } from \"../constants\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Marker left by a page that is alive. */\ninterface AliveMarker {\n /** The page's session id. */\n sessionId: string;\n /** When the marker was last updated, in epoch milliseconds. */\n at: number;\n /** The page's visibility at the last update. */\n visibility: string;\n}\n\n/** A document with the flag the browser sets on a page it discarded to free memory. */\ninterface DiscardDocument {\n wasDiscarded?: boolean;\n}\n\n/**\n * Reads a marker from its sessionStorage text.\n * @param text Stored text, or null when there is no marker.\n * @returns The marker, or null if there is none or it has the wrong shape.\n * @throws SyntaxError for text that isn't JSON. The caller reports it.\n */\nfunction readMarker(text: string | null): AliveMarker | null {\n const value: unknown = text === null ? null : JSON.parse(text);\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n\n const { sessionId, at, visibility } = value as Partial<Record<keyof AliveMarker, unknown>>;\n const valid =\n typeof sessionId === \"string\" && Number.isFinite(at) && typeof visibility === \"string\";\n\n return valid ? { sessionId, at: at as number, visibility } : null;\n}\n\n/** Reports the previous page's unclean exit, and maintains this page's marker. */\nexport class UncleanExitCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"uncleanExit\";\n\n /** Prevents duplicate listener registration. */\n private installed = false;\n\n /** Timer that updates the marker. */\n private timer: ReturnType<typeof setInterval> | undefined;\n\n /** True after pagehide. Needed because the browser fires visibilitychange after pagehide. */\n private closing = false;\n\n /**\n * @param ctx Capture context with the config, diagnostics, logger and session id.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Reports the previous page's marker once, then starts maintaining this page's own. */\n install(): void {\n // Only the top document keeps the marker, because a same-origin frame shares its\n // sessionStorage.\n if (this.installed || typeof document === \"undefined\" || window.parent !== window) {\n return;\n }\n\n // The marker holds the session id, and memory identity writes nothing to the device.\n if (this.ctx.config.identity === \"memory\") {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n 'capture.uncleanExit needs sessionStorage. identity: \"memory\" turns it off.',\n );\n return;\n }\n this.installed = true;\n\n if (!this.ctx.once.uncleanExit) {\n this.ctx.once.uncleanExit = true;\n // A popup copies its live opener's sessionStorage, so that marker isn't a crash.\n if (!window.opener) {\n this.reportPrevious();\n }\n }\n\n this.mark();\n addEventListener(\"pagehide\", this.onPageHide);\n addEventListener(\"pageshow\", this.onPageShow);\n document.addEventListener(\"visibilitychange\", this.mark);\n this.timer = setInterval(this.mark, ALIVE_UPDATE_MS);\n }\n\n /** Removes the listeners, the timer and the marker, since the capture stopped without a crash. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n removeEventListener(\"pagehide\", this.onPageHide);\n removeEventListener(\"pageshow\", this.onPageShow);\n document.removeEventListener(\"visibilitychange\", this.mark);\n clearInterval(this.timer);\n this.clear();\n }\n\n /** Logs WARN `ui.unclean_exit` if this tab's previous page left its marker behind. */\n private reportPrevious(): void {\n const marker = this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not read the alive marker in sessionStorage.\",\n () => readMarker(sessionStorage.getItem(ALIVE_KEY)),\n );\n if (!marker) {\n return;\n }\n\n this.ctx.logger.warn(\"ui.unclean_exit\", {\n \"exit.session_id\": marker.sessionId,\n \"exit.last_seen_ms\": marker.at,\n \"exit.visibility\": marker.visibility,\n \"exit.discarded\": (document as DiscardDocument).wasDiscarded === true,\n });\n }\n\n /** Writes this page's marker with the current time and visibility. */\n private readonly mark = (): void => {\n if (this.closing) {\n return;\n }\n\n const marker: AliveMarker = {\n sessionId: this.ctx.sessionId(),\n at: Date.now(),\n visibility: document.visibilityState,\n };\n\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not write the alive marker to sessionStorage.\",\n () => {\n sessionStorage.setItem(ALIVE_KEY, JSON.stringify(marker));\n },\n );\n };\n\n /** Removes this page's marker. */\n private clear(): void {\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not remove the alive marker from sessionStorage.\",\n () => {\n sessionStorage.removeItem(ALIVE_KEY);\n },\n );\n }\n\n /** A clean close removes the marker. The page may still live on in the back-forward cache. */\n private readonly onPageHide = (): void => {\n this.closing = true;\n this.clear();\n };\n\n /** A page that comes back from the back-forward cache is alive again. */\n private readonly onPageShow = (event: Event): void => {\n if ((event as PageTransitionEvent).persisted) {\n this.closing = false;\n this.mark();\n }\n };\n}\n"],"mappings":";;;AA8BA,SAASG,EAAW,GAAyC;CAC3D,IAAMC,IAAiBC,MAAS,OAAO,OAAO,KAAK,MAAMA,CAAI;CAC7D,IAAI,OAAOD,KAAU,aAAYA,GAC/B,OAAO;CAGT,IAAM,EAAE,cAAW,OAAI,kBAAeA;CAItC,OAFE,OAAOE,KAAc,YAAY,OAAO,SAASC,CAAE,KAAK,OAAOC,KAAe,WAEjE;EAAE;EAAe;EAAc;CAAW,IAAI;AAC/D;AAGA,IAAaC,IAAb,MAAmD;CAgBjD,YAAY,GAAsC;EAArB,AAAAP,EAAA,MAAA,OAAA,KAAA,CAAA,GAd7BA,EAAA,MAAA,QAAgB,aAAA,GAGhBA,EAAA,MAAA,aAAoB,EAAA,GAGpBA,EAAA,MAAA,SAAA,KAAA,CAAA,GAGAA,EAAA,MAAA,WAAkB,EAAA,GA0ElBA,EAAA,MAAA,cAAoC;GAClC,IAAI,KAAK,SACP;GAGF,IAAMQ,IAAsB;IAC1B,WAAW,KAAK,IAAI,UAAU;IAC9B,IAAI,KAAK,IAAI;IACb,YAAY,SAAS;GAC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H;CAwBA,QAAsB;EACpB,KAAK,IAAI,YAAY,MACnB,uBACA,4EACM;GACJ,eAAe,WAAWV,CAAS;EACrC,CACF;CACF;AAeF"}
1
+ {"version":3,"file":"unclean-exit-Bj6gYHeL.js","names":["ALIVE_KEY","ALIVE_UPDATE_MS","_defineProperty","readMarker","value","text","sessionId","at","visibility","UncleanExitCapture","marker","event","ctx"],"sources":["../src/capture/unclean-exit.ts"],"sourcesContent":["// src/capture/unclean-exit.ts\n//\n// Detects a page in this tab that ended without a clean close, for example after a crash. The\n// top document keeps a marker in sessionStorage and a clean close removes it, so if the tab's\n// next page finds a marker, it reports it.\n\nimport { ALIVE_KEY, ALIVE_UPDATE_MS } from \"../constants\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Marker left by a page that is alive. */\ninterface AliveMarker {\n /** The page's session id. */\n sessionId: string;\n /** When the marker was last updated, in epoch milliseconds. */\n at: number;\n /** The page's visibility at the last update. */\n visibility: string;\n}\n\n/** A document with the flag the browser sets on a page it discarded to free memory. */\ninterface DiscardDocument {\n wasDiscarded?: boolean;\n}\n\n/**\n * Reads a marker from its sessionStorage text.\n * @param text Stored text, or null when there is no marker.\n * @returns The marker, or null if there is none or it has the wrong shape.\n * @throws SyntaxError for text that isn't JSON. The caller reports it.\n */\nfunction readMarker(text: string | null): AliveMarker | null {\n const value: unknown = text === null ? null : JSON.parse(text);\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n\n const { sessionId, at, visibility } = value as Partial<Record<keyof AliveMarker, unknown>>;\n const valid =\n typeof sessionId === \"string\" && Number.isFinite(at) && typeof visibility === \"string\";\n\n return valid ? { sessionId, at: at as number, visibility } : null;\n}\n\n/** Reports the previous page's unclean exit, and maintains this page's marker. */\nexport class UncleanExitCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"uncleanExit\";\n\n /** Prevents duplicate listener registration. */\n private installed = false;\n\n /** Timer that updates the marker. */\n private timer: ReturnType<typeof setInterval> | undefined;\n\n /** True after pagehide. Needed because the browser fires visibilitychange after pagehide. */\n private closing = false;\n\n /**\n * @param ctx Capture context with the config, diagnostics, logger and session id.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Reports the previous page's marker once, then starts maintaining this page's own. */\n install(): void {\n // Only the top document keeps the marker, because a same-origin frame shares its\n // sessionStorage.\n if (this.installed || typeof document === \"undefined\" || window.parent !== window) {\n return;\n }\n\n // The marker holds the session id, and memory identity writes nothing to the device.\n if (this.ctx.config.identity === \"memory\") {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n 'capture.uncleanExit needs sessionStorage. identity: \"memory\" turns it off.',\n );\n return;\n }\n this.installed = true;\n\n if (!this.ctx.once.uncleanExit) {\n this.ctx.once.uncleanExit = true;\n // A popup copies its live opener's sessionStorage, so that marker isn't a crash.\n if (!window.opener) {\n this.reportPrevious();\n }\n }\n\n this.mark();\n addEventListener(\"pagehide\", this.onPageHide);\n addEventListener(\"pageshow\", this.onPageShow);\n document.addEventListener(\"visibilitychange\", this.mark);\n this.timer = setInterval(this.mark, ALIVE_UPDATE_MS);\n }\n\n /** Removes the listeners, the timer and the marker, since the capture stopped without a crash. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n removeEventListener(\"pagehide\", this.onPageHide);\n removeEventListener(\"pageshow\", this.onPageShow);\n document.removeEventListener(\"visibilitychange\", this.mark);\n clearInterval(this.timer);\n this.clear();\n }\n\n /** Logs WARN `ui.unclean_exit` if this tab's previous page left its marker behind. */\n private reportPrevious(): void {\n const marker = this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not read the alive marker in sessionStorage.\",\n () => readMarker(sessionStorage.getItem(ALIVE_KEY)),\n );\n if (!marker) {\n return;\n }\n\n this.ctx.logger.warn(\"ui.unclean_exit\", {\n \"exit.session_id\": marker.sessionId,\n \"exit.last_seen_ms\": marker.at,\n \"exit.visibility\": marker.visibility,\n \"exit.discarded\": (document as DiscardDocument).wasDiscarded === true,\n });\n }\n\n /** Writes this page's marker with the current time and visibility. */\n private readonly mark = (): void => {\n if (this.closing) {\n return;\n }\n\n const marker: AliveMarker = {\n sessionId: this.ctx.sessionId(),\n at: Date.now(),\n visibility: document.visibilityState,\n };\n\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not write the alive marker to sessionStorage.\",\n () => {\n sessionStorage.setItem(ALIVE_KEY, JSON.stringify(marker));\n },\n );\n };\n\n /** Removes this page's marker. */\n private clear(): void {\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not remove the alive marker from sessionStorage.\",\n () => {\n sessionStorage.removeItem(ALIVE_KEY);\n },\n );\n }\n\n /** A clean close removes the marker. The page may still live on in the back-forward cache. */\n private readonly onPageHide = (): void => {\n this.closing = true;\n this.clear();\n };\n\n /** A page that comes back from the back-forward cache is alive again. */\n private readonly onPageShow = (event: Event): void => {\n if ((event as PageTransitionEvent).persisted) {\n this.closing = false;\n this.mark();\n }\n };\n}\n"],"mappings":";;;AA8BA,SAASG,EAAW,GAAyC;CAC3D,IAAMC,IAAiBC,MAAS,OAAO,OAAO,KAAK,MAAMA,CAAI;CAC7D,IAAI,OAAOD,KAAU,aAAYA,GAC/B,OAAO;CAGT,IAAM,EAAE,cAAW,OAAI,kBAAeA;CAItC,OAFE,OAAOE,KAAc,YAAY,OAAO,SAASC,CAAE,KAAK,OAAOC,KAAe,WAEjE;EAAE;EAAe;EAAc;CAAW,IAAI;AAC/D;AAGA,IAAaC,IAAb,MAAmD;CAgBjD,YAAY,GAAsC;EAArB,AAAAP,EAAA,MAAA,OAAA,KAAA,CAAA,GAd7BA,EAAA,MAAA,QAAgB,aAAA,GAGhBA,EAAA,MAAA,aAAoB,EAAA,GAGpBA,EAAA,MAAA,SAAA,KAAA,CAAA,GAGAA,EAAA,MAAA,WAAkB,EAAA,GA0ElBA,EAAA,MAAA,cAAoC;GAClC,IAAI,KAAK,SACP;GAGF,IAAMQ,IAAsB;IAC1B,WAAW,KAAK,IAAI,UAAU;IAC9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,kBAAmB,SAA6B,iBAAiB;EACnE,CAAC;CACH;CAwBA,QAAsB;EACpB,KAAK,IAAI,YAAY,MACnB,uBACA,4EACM;GACJ,eAAe,WAAWV,CAAS;EACrC,CACF;CACF;AAeF"}
@@ -1,2 +1,2 @@
1
- const e=require("./constants-CtF52hIV.cjs"),t=require("./defineProperty-X1c4tIPD.cjs");function n(e){let t=e===null?null:JSON.parse(e);if(typeof t!=`object`||!t)return null;let{sessionId:n,at:r,visibility:i}=t;return typeof n==`string`&&Number.isFinite(r)&&typeof i==`string`?{sessionId:n,at:r,visibility:i}:null}var r=class{constructor(n){t.t(this,`ctx`,void 0),t.t(this,`name`,`uncleanExit`),t.t(this,`installed`,!1),t.t(this,`timer`,void 0),t.t(this,`closing`,!1),t.t(this,`mark`,()=>{if(this.closing)return;let t={sessionId:this.ctx.sessionId(),at:Date.now(),visibility:document.visibilityState};this.ctx.diagnostics.guard(`storage.unavailable`,`The library could not write the alive marker to sessionStorage.`,()=>{sessionStorage.setItem(e.n,JSON.stringify(t))})}),t.t(this,`onPageHide`,()=>{this.closing=!0,this.clear()}),t.t(this,`onPageShow`,e=>{e.persisted&&(this.closing=!1,this.mark())}),this.ctx=n}install(){this.installed||typeof document>`u`||window.parent!==window||(this.ctx.config.identity===`memory`?this.ctx.diagnostics.report(`capture.install_failed`,`capture.uncleanExit needs sessionStorage. identity: "memory" turns it off.`):(this.installed=!0,this.ctx.once.uncleanExit||(this.ctx.once.uncleanExit=!0,window.opener||this.reportPrevious()),this.mark(),addEventListener(`pagehide`,this.onPageHide),addEventListener(`pageshow`,this.onPageShow),document.addEventListener(`visibilitychange`,this.mark),this.timer=setInterval(this.mark,e.r)))}uninstall(){this.installed&&(this.installed=!1,removeEventListener(`pagehide`,this.onPageHide),removeEventListener(`pageshow`,this.onPageShow),document.removeEventListener(`visibilitychange`,this.mark),clearInterval(this.timer),this.clear())}reportPrevious(){let t=this.ctx.diagnostics.guard(`storage.unavailable`,`The library could not read the alive marker in sessionStorage.`,()=>n(sessionStorage.getItem(e.n)));t&&this.ctx.logger.warn(`ui.unclean_exit`,{"exit.session_id":t.sessionId,"exit.last_seen_ms":t.at,"exit.visibility":t.visibility,"exit.discarded":document.wasDiscarded===!0})}clear(){this.ctx.diagnostics.guard(`storage.unavailable`,`The library could not remove the alive marker from sessionStorage.`,()=>{sessionStorage.removeItem(e.n)})}};exports.UncleanExitCapture=r;
2
- //# sourceMappingURL=unclean-exit-BYPYYkQ5.cjs.map
1
+ const e=require("./constants-NtiQDWL_.cjs"),t=require("./defineProperty-X1c4tIPD.cjs");function n(e){let t=e===null?null:JSON.parse(e);if(typeof t!=`object`||!t)return null;let{sessionId:n,at:r,visibility:i}=t;return typeof n==`string`&&Number.isFinite(r)&&typeof i==`string`?{sessionId:n,at:r,visibility:i}:null}var r=class{constructor(n){t.t(this,`ctx`,void 0),t.t(this,`name`,`uncleanExit`),t.t(this,`installed`,!1),t.t(this,`timer`,void 0),t.t(this,`closing`,!1),t.t(this,`mark`,()=>{if(this.closing)return;let t={sessionId:this.ctx.sessionId(),at:Date.now(),visibility:document.visibilityState};this.ctx.diagnostics.guard(`storage.unavailable`,`The library could not write the alive marker to sessionStorage.`,()=>{sessionStorage.setItem(e.n,JSON.stringify(t))})}),t.t(this,`onPageHide`,()=>{this.closing=!0,this.clear()}),t.t(this,`onPageShow`,e=>{e.persisted&&(this.closing=!1,this.mark())}),this.ctx=n}install(){this.installed||typeof document>`u`||window.parent!==window||(this.ctx.config.identity===`memory`?this.ctx.diagnostics.report(`capture.install_failed`,`capture.uncleanExit needs sessionStorage. identity: "memory" turns it off.`):(this.installed=!0,this.ctx.once.uncleanExit||(this.ctx.once.uncleanExit=!0,window.opener||this.reportPrevious()),this.mark(),addEventListener(`pagehide`,this.onPageHide),addEventListener(`pageshow`,this.onPageShow),document.addEventListener(`visibilitychange`,this.mark),this.timer=setInterval(this.mark,e.r)))}uninstall(){this.installed&&(this.installed=!1,removeEventListener(`pagehide`,this.onPageHide),removeEventListener(`pageshow`,this.onPageShow),document.removeEventListener(`visibilitychange`,this.mark),clearInterval(this.timer),this.clear())}reportPrevious(){let t=this.ctx.diagnostics.guard(`storage.unavailable`,`The library could not read the alive marker in sessionStorage.`,()=>n(sessionStorage.getItem(e.n)));t&&this.ctx.logger.warn(`ui.unclean_exit`,{"exit.session_id":t.sessionId,"exit.last_seen_ms":t.at,"exit.visibility":t.visibility,"exit.discarded":document.wasDiscarded===!0})}clear(){this.ctx.diagnostics.guard(`storage.unavailable`,`The library could not remove the alive marker from sessionStorage.`,()=>{sessionStorage.removeItem(e.n)})}};exports.UncleanExitCapture=r;
2
+ //# sourceMappingURL=unclean-exit-CuBh-ee5.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"unclean-exit-BYPYYkQ5.cjs","names":["ALIVE_KEY","ALIVE_UPDATE_MS","require_constants","require_defineProperty","readMarker","value","text","sessionId","at","visibility","UncleanExitCapture","marker","event","ctx"],"sources":["../src/capture/unclean-exit.ts"],"sourcesContent":["// src/capture/unclean-exit.ts\n//\n// Detects a page in this tab that ended without a clean close, for example after a crash. The\n// top document keeps a marker in sessionStorage and a clean close removes it, so if the tab's\n// next page finds a marker, it reports it.\n\nimport { ALIVE_KEY, ALIVE_UPDATE_MS } from \"../constants\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Marker left by a page that is alive. */\ninterface AliveMarker {\n /** The page's session id. */\n sessionId: string;\n /** When the marker was last updated, in epoch milliseconds. */\n at: number;\n /** The page's visibility at the last update. */\n visibility: string;\n}\n\n/** A document with the flag the browser sets on a page it discarded to free memory. */\ninterface DiscardDocument {\n wasDiscarded?: boolean;\n}\n\n/**\n * Reads a marker from its sessionStorage text.\n * @param text Stored text, or null when there is no marker.\n * @returns The marker, or null if there is none or it has the wrong shape.\n * @throws SyntaxError for text that isn't JSON. The caller reports it.\n */\nfunction readMarker(text: string | null): AliveMarker | null {\n const value: unknown = text === null ? null : JSON.parse(text);\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n\n const { sessionId, at, visibility } = value as Partial<Record<keyof AliveMarker, unknown>>;\n const valid =\n typeof sessionId === \"string\" && Number.isFinite(at) && typeof visibility === \"string\";\n\n return valid ? { sessionId, at: at as number, visibility } : null;\n}\n\n/** Reports the previous page's unclean exit, and maintains this page's marker. */\nexport class UncleanExitCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"uncleanExit\";\n\n /** Prevents duplicate listener registration. */\n private installed = false;\n\n /** Timer that updates the marker. */\n private timer: ReturnType<typeof setInterval> | undefined;\n\n /** True after pagehide. Needed because the browser fires visibilitychange after pagehide. */\n private closing = false;\n\n /**\n * @param ctx Capture context with the config, diagnostics, logger and session id.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Reports the previous page's marker once, then starts maintaining this page's own. */\n install(): void {\n // Only the top document keeps the marker, because a same-origin frame shares its\n // sessionStorage.\n if (this.installed || typeof document === \"undefined\" || window.parent !== window) {\n return;\n }\n\n // The marker holds the session id, and memory identity writes nothing to the device.\n if (this.ctx.config.identity === \"memory\") {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n 'capture.uncleanExit needs sessionStorage. identity: \"memory\" turns it off.',\n );\n return;\n }\n this.installed = true;\n\n if (!this.ctx.once.uncleanExit) {\n this.ctx.once.uncleanExit = true;\n // A popup copies its live opener's sessionStorage, so that marker isn't a crash.\n if (!window.opener) {\n this.reportPrevious();\n }\n }\n\n this.mark();\n addEventListener(\"pagehide\", this.onPageHide);\n addEventListener(\"pageshow\", this.onPageShow);\n document.addEventListener(\"visibilitychange\", this.mark);\n this.timer = setInterval(this.mark, ALIVE_UPDATE_MS);\n }\n\n /** Removes the listeners, the timer and the marker, since the capture stopped without a crash. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n removeEventListener(\"pagehide\", this.onPageHide);\n removeEventListener(\"pageshow\", this.onPageShow);\n document.removeEventListener(\"visibilitychange\", this.mark);\n clearInterval(this.timer);\n this.clear();\n }\n\n /** Logs WARN `ui.unclean_exit` if this tab's previous page left its marker behind. */\n private reportPrevious(): void {\n const marker = this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not read the alive marker in sessionStorage.\",\n () => readMarker(sessionStorage.getItem(ALIVE_KEY)),\n );\n if (!marker) {\n return;\n }\n\n this.ctx.logger.warn(\"ui.unclean_exit\", {\n \"exit.session_id\": marker.sessionId,\n \"exit.last_seen_ms\": marker.at,\n \"exit.visibility\": marker.visibility,\n \"exit.discarded\": (document as DiscardDocument).wasDiscarded === true,\n });\n }\n\n /** Writes this page's marker with the current time and visibility. */\n private readonly mark = (): void => {\n if (this.closing) {\n return;\n }\n\n const marker: AliveMarker = {\n sessionId: this.ctx.sessionId(),\n at: Date.now(),\n visibility: document.visibilityState,\n };\n\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not write the alive marker to sessionStorage.\",\n () => {\n sessionStorage.setItem(ALIVE_KEY, JSON.stringify(marker));\n },\n );\n };\n\n /** Removes this page's marker. */\n private clear(): void {\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not remove the alive marker from sessionStorage.\",\n () => {\n sessionStorage.removeItem(ALIVE_KEY);\n },\n );\n }\n\n /** A clean close removes the marker. The page may still live on in the back-forward cache. */\n private readonly onPageHide = (): void => {\n this.closing = true;\n this.clear();\n };\n\n /** A page that comes back from the back-forward cache is alive again. */\n private readonly onPageShow = (event: Event): void => {\n if ((event as PageTransitionEvent).persisted) {\n this.closing = false;\n this.mark();\n }\n };\n}\n"],"mappings":"A,uFA8BA,SAASI,EAAW,EAAyC,CAC3D,IAAMC,EAAiBC,IAAS,KAAO,KAAO,KAAK,MAAMA,CAAI,EAC7D,GAAI,OAAOD,GAAU,WAAYA,EAC/B,OAAO,KAGT,GAAM,CAAE,YAAW,KAAI,cAAeA,EAItC,OAFE,OAAOE,GAAc,UAAY,OAAO,SAASC,CAAE,GAAK,OAAOC,GAAe,SAEjE,CAAE,YAAe,KAAc,YAAW,EAAI,IAC/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WAAY,KAAK,UAAU,EAC/C,oBAAoB,WAAY,KAAK,UAAU,EAC/C,SAAS,oBAAoB,mBAAoB,KAAK,IAAI,EAC1D,cAAc,KAAK,KAAK,EACxB,KAAK,MAAM,EACb,CAGA,gBAA+B,CAC7B,IAAMU,EAAS,KAAK,IAAI,YAAY,MAClC,sBACA,qEACMP,EAAW,eAAe,QAAQJ,EAAAA,CAAS,CAAC,CACpD,EACKW,GAIL,KAAK,IAAI,OAAO,KAAK,kBAAmB,CACtC,kBAAmBA,EAAO,UAC1B,oBAAqBA,EAAO,GAC5B,kBAAmBA,EAAO,WAC1B,iBAAmB,SAA6B,eAAiB,EACnE,CAAC,CACH,CAwBA,OAAsB,CACpB,KAAK,IAAI,YAAY,MACnB,sBACA,yEACM,CACJ,eAAe,WAAWX,EAAAA,CAAS,CACrC,CACF,CACF,CAeF,E"}
1
+ {"version":3,"file":"unclean-exit-CuBh-ee5.cjs","names":["ALIVE_KEY","ALIVE_UPDATE_MS","require_constants","require_defineProperty","readMarker","value","text","sessionId","at","visibility","UncleanExitCapture","marker","event","ctx"],"sources":["../src/capture/unclean-exit.ts"],"sourcesContent":["// src/capture/unclean-exit.ts\n//\n// Detects a page in this tab that ended without a clean close, for example after a crash. The\n// top document keeps a marker in sessionStorage and a clean close removes it, so if the tab's\n// next page finds a marker, it reports it.\n\nimport { ALIVE_KEY, ALIVE_UPDATE_MS } from \"../constants\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Marker left by a page that is alive. */\ninterface AliveMarker {\n /** The page's session id. */\n sessionId: string;\n /** When the marker was last updated, in epoch milliseconds. */\n at: number;\n /** The page's visibility at the last update. */\n visibility: string;\n}\n\n/** A document with the flag the browser sets on a page it discarded to free memory. */\ninterface DiscardDocument {\n wasDiscarded?: boolean;\n}\n\n/**\n * Reads a marker from its sessionStorage text.\n * @param text Stored text, or null when there is no marker.\n * @returns The marker, or null if there is none or it has the wrong shape.\n * @throws SyntaxError for text that isn't JSON. The caller reports it.\n */\nfunction readMarker(text: string | null): AliveMarker | null {\n const value: unknown = text === null ? null : JSON.parse(text);\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n\n const { sessionId, at, visibility } = value as Partial<Record<keyof AliveMarker, unknown>>;\n const valid =\n typeof sessionId === \"string\" && Number.isFinite(at) && typeof visibility === \"string\";\n\n return valid ? { sessionId, at: at as number, visibility } : null;\n}\n\n/** Reports the previous page's unclean exit, and maintains this page's marker. */\nexport class UncleanExitCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"uncleanExit\";\n\n /** Prevents duplicate listener registration. */\n private installed = false;\n\n /** Timer that updates the marker. */\n private timer: ReturnType<typeof setInterval> | undefined;\n\n /** True after pagehide. Needed because the browser fires visibilitychange after pagehide. */\n private closing = false;\n\n /**\n * @param ctx Capture context with the config, diagnostics, logger and session id.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Reports the previous page's marker once, then starts maintaining this page's own. */\n install(): void {\n // Only the top document keeps the marker, because a same-origin frame shares its\n // sessionStorage.\n if (this.installed || typeof document === \"undefined\" || window.parent !== window) {\n return;\n }\n\n // The marker holds the session id, and memory identity writes nothing to the device.\n if (this.ctx.config.identity === \"memory\") {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n 'capture.uncleanExit needs sessionStorage. identity: \"memory\" turns it off.',\n );\n return;\n }\n this.installed = true;\n\n if (!this.ctx.once.uncleanExit) {\n this.ctx.once.uncleanExit = true;\n // A popup copies its live opener's sessionStorage, so that marker isn't a crash.\n if (!window.opener) {\n this.reportPrevious();\n }\n }\n\n this.mark();\n addEventListener(\"pagehide\", this.onPageHide);\n addEventListener(\"pageshow\", this.onPageShow);\n document.addEventListener(\"visibilitychange\", this.mark);\n this.timer = setInterval(this.mark, ALIVE_UPDATE_MS);\n }\n\n /** Removes the listeners, the timer and the marker, since the capture stopped without a crash. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n removeEventListener(\"pagehide\", this.onPageHide);\n removeEventListener(\"pageshow\", this.onPageShow);\n document.removeEventListener(\"visibilitychange\", this.mark);\n clearInterval(this.timer);\n this.clear();\n }\n\n /** Logs WARN `ui.unclean_exit` if this tab's previous page left its marker behind. */\n private reportPrevious(): void {\n const marker = this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not read the alive marker in sessionStorage.\",\n () => readMarker(sessionStorage.getItem(ALIVE_KEY)),\n );\n if (!marker) {\n return;\n }\n\n this.ctx.logger.warn(\"ui.unclean_exit\", {\n \"exit.session_id\": marker.sessionId,\n \"exit.last_seen_ms\": marker.at,\n \"exit.visibility\": marker.visibility,\n \"exit.discarded\": (document as DiscardDocument).wasDiscarded === true,\n });\n }\n\n /** Writes this page's marker with the current time and visibility. */\n private readonly mark = (): void => {\n if (this.closing) {\n return;\n }\n\n const marker: AliveMarker = {\n sessionId: this.ctx.sessionId(),\n at: Date.now(),\n visibility: document.visibilityState,\n };\n\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not write the alive marker to sessionStorage.\",\n () => {\n sessionStorage.setItem(ALIVE_KEY, JSON.stringify(marker));\n },\n );\n };\n\n /** Removes this page's marker. */\n private clear(): void {\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not remove the alive marker from sessionStorage.\",\n () => {\n sessionStorage.removeItem(ALIVE_KEY);\n },\n );\n }\n\n /** A clean close removes the marker. The page may still live on in the back-forward cache. */\n private readonly onPageHide = (): void => {\n this.closing = true;\n this.clear();\n };\n\n /** A page that comes back from the back-forward cache is alive again. */\n private readonly onPageShow = (event: Event): void => {\n if ((event as PageTransitionEvent).persisted) {\n this.closing = false;\n this.mark();\n }\n };\n}\n"],"mappings":"A,uFA8BA,SAASI,EAAW,EAAyC,CAC3D,IAAMC,EAAiBC,IAAS,KAAO,KAAO,KAAK,MAAMA,CAAI,EAC7D,GAAI,OAAOD,GAAU,WAAYA,EAC/B,OAAO,KAGT,GAAM,CAAE,YAAW,KAAI,cAAeA,EAItC,OAFE,OAAOE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,KAAK,KAAMZ,EAAAA,CAAe,GACrD,CAGA,WAAkB,CACX,KAAK,YAGV,KAAK,UAAY,GAEjB,oBAAoB,WAAY,KAAK,UAAU,EAC/C,oBAAoB,WAAY,KAAK,UAAU,EAC/C,SAAS,oBAAoB,mBAAoB,KAAK,IAAI,EAC1D,cAAc,KAAK,KAAK,EACxB,KAAK,MAAM,EACb,CAGA,gBAA+B,CAC7B,IAAMU,EAAS,KAAK,IAAI,YAAY,MAClC,sBACA,qEACMP,EAAW,eAAe,QAAQJ,EAAAA,CAAS,CAAC,CACpD,EACKW,GAIL,KAAK,IAAI,OAAO,KAAK,kBAAmB,CACtC,kBAAmBA,EAAO,UAC1B,oBAAqBA,EAAO,GAC5B,kBAAmBA,EAAO,WAC1B,iBAAmB,SAA6B,eAAiB,EACnE,CAAC,CACH,CAwBA,OAAsB,CACpB,KAAK,IAAI,YAAY,MACnB,sBACA,yEACM,CACJ,eAAe,WAAWX,EAAAA,CAAS,CACrC,CACF,CACF,CAeF,E"}
@@ -1,2 +1,2 @@
1
- const e=require("./platform-BqRc-7RO.cjs"),t=require("./types-C7WNpnG1.cjs"),n=require("./defineProperty-X1c4tIPD.cjs");var r={name:`ui.user_timing.duration`,kind:`histogram`,unit:`ms`,boundaries:[1,5,10,25,50,100,250,500,1e3,2500,5e3,1e4]},i=class{constructor(e){n.t(this,`ctx`,void 0),n.t(this,`name`,`userTiming`),n.t(this,`observer`,void 0),this.ctx=e}install(){if(this.observer)return;let{once:e}=this.ctx,t=!e.userTiming;e.userTiming=!0;let n=typeof PerformanceObserver>`u`?void 0:PerformanceObserver.supportedEntryTypes;n?.includes(`measure`)?(this.observer=new PerformanceObserver(e=>{this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record a user timing entry.`,()=>{this.record(e.getEntries())})}),this.observer.observe({type:`measure`,buffered:t}),n.includes(`mark`)&&this.observer.observe({type:`mark`,buffered:t})):t&&this.ctx.diagnostics.report(`capture.install_failed`,`The browser does not report User Timing entries. The user timing capture is off.`)}uninstall(){this.observer?.disconnect(),this.observer=void 0}record(n){if(this.ctx.isActive?.()===!1)return;let{fullUrls:i,userTiming:a}=this.ctx.config.capture,o=typeof a==`object`?a.include:void 0;for(let a of n){if(o!==void 0&&o.length>0&&!t.t(a.name,o))continue;let n=e.i(a.name,i);a.entryType===`measure`?this.ctx.recordMetric(r,a.duration,{"user_timing.name":n}):this.ctx.breadcrumbs.push({t:Math.round(performance.timeOrigin+a.startTime),category:`event`,message:n.slice(0,this.ctx.config.limits.maxBodyChars)})}}};exports.UserTimingCapture=i;
2
- //# sourceMappingURL=user-timing-BsU2wQKE.cjs.map
1
+ const e=require("./platform-BZjp9wp1.cjs"),t=require("./types-C7WNpnG1.cjs"),n=require("./defineProperty-X1c4tIPD.cjs");var r={name:`ui.user_timing.duration`,kind:`histogram`,unit:`ms`,boundaries:[1,5,10,25,50,100,250,500,1e3,2500,5e3,1e4]},i=class{constructor(e){n.t(this,`ctx`,void 0),n.t(this,`name`,`userTiming`),n.t(this,`observer`,void 0),this.ctx=e}install(){if(this.observer)return;let{once:e}=this.ctx,t=!e.userTiming;e.userTiming=!0;let n=typeof PerformanceObserver>`u`?void 0:PerformanceObserver.supportedEntryTypes;n?.includes(`measure`)?(this.observer=new PerformanceObserver(e=>{this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record a user timing entry.`,()=>{this.record(e.getEntries())})}),this.observer.observe({type:`measure`,buffered:t}),n.includes(`mark`)&&this.observer.observe({type:`mark`,buffered:t})):t&&this.ctx.diagnostics.report(`capture.install_failed`,`The browser does not report User Timing entries. The user timing capture is off.`)}uninstall(){this.observer?.disconnect(),this.observer=void 0}record(n){if(this.ctx.isActive?.()===!1)return;let{fullUrls:i,userTiming:a}=this.ctx.config.capture,o=typeof a==`object`?a.include:void 0;for(let a of n){if(o!==void 0&&o.length>0&&!t.t(a.name,o))continue;let n=e.a(a.name,i);a.entryType===`measure`?this.ctx.recordMetric(r,a.duration,{"user_timing.name":n}):this.ctx.breadcrumbs.push({t:Math.round(performance.timeOrigin+a.startTime),category:`event`,message:n.slice(0,this.ctx.config.limits.maxBodyChars)})}}};exports.UserTimingCapture=i;
2
+ //# sourceMappingURL=user-timing-BWqzYF2Q.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"user-timing-BsU2wQKE.cjs","names":["matchesAny","recordedUrl","require_platform","require_types","require_defineProperty","USER_TIMING_DURATION","UserTimingCapture","ctx","first","once","supported","list","include","userTiming","entry","entries","name","fullUrls"],"sources":["../src/capture/user-timing.ts"],"sourcesContent":["// src/capture/user-timing.ts\n//\n// Records the app's marks and measures from the User Timing API. A measure goes into a\n// histogram, and a mark adds a breadcrumb.\n\nimport type { InstrumentDef } from \"../models/metric\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { type Capture, type CaptureContext, matchesAny } from \"./types\";\n\n/** Histogram of the app's measures, in milliseconds. */\nconst USER_TIMING_DURATION: InstrumentDef = {\n name: \"ui.user_timing.duration\",\n kind: \"histogram\",\n unit: \"ms\",\n boundaries: [1, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000],\n};\n\n/** Observes the app's marks and measures. */\nexport class UserTimingCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"userTiming\";\n\n /** Observer for the mark and measure entries. */\n private observer: PerformanceObserver | undefined;\n\n /**\n * @param ctx Capture context with the config, the meter and the breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Observes marks and measures. Only the first install in a document reads buffered entries. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n const { once } = this.ctx;\n const first = !once.userTiming;\n once.userTiming = true;\n\n // Older browsers have no supportedEntryTypes, and the capture stays off there.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n if (!supported?.includes(\"measure\")) {\n if (first) {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report User Timing entries. The user timing capture is off.\",\n );\n }\n return;\n }\n\n this.observer = new PerformanceObserver((list) => {\n // The browser calls this directly, so anything we throw is an uncaught error on the page.\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not record a user timing entry.\",\n () => {\n this.record(list.getEntries());\n },\n );\n });\n // Buffered entries include the marks and measures made before this chunk loaded.\n this.observer.observe({ type: \"measure\", buffered: first });\n if (supported.includes(\"mark\")) {\n this.observer.observe({ type: \"mark\", buffered: first });\n }\n }\n\n /** Disconnects the observer. */\n uninstall(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n /**\n * Records the entries whose name `userTiming.include` selects.\n * @param entries Mark and measure entries.\n */\n private record(entries: PerformanceEntryList): void {\n if (this.ctx.isActive?.() === false) {\n return;\n }\n\n const { fullUrls, userTiming } = this.ctx.config.capture;\n const include = typeof userTiming === \"object\" ? userTiming.include : undefined;\n for (const entry of entries) {\n if (include !== undefined && include.length > 0 && !matchesAny(entry.name, include)) {\n continue;\n }\n\n // A third-party script can write any name, so a name can hold a URL with a token.\n const name = recordedUrl(entry.name, fullUrls);\n if (entry.entryType === \"measure\") {\n this.ctx.recordMetric(USER_TIMING_DURATION, entry.duration, { \"user_timing.name\": name });\n } else {\n this.ctx.breadcrumbs.push({\n // A buffered entry reaches the observer late, and the trail needs the mark's own time.\n t: Math.round(performance.timeOrigin + entry.startTime),\n category: \"event\",\n message: name.slice(0, this.ctx.config.limits.maxBodyChars),\n });\n }\n }\n }\n}\n"],"mappings":"A,wHAUA,IAAMK,EAAsC,CAC1C,KAAM,0BACN,KAAM,YACN,KAAM,KACN,WAAY,CAAC,EAAG,EAAG,GAAI,GAAI,GAAI,IAAK,IAAK,IAAK,IAAM,KAAM,IAAM,GAAK,CACvE,EAGaC,EAAb,KAAkD,CAUhD,YAAY,EAAsC,CAArBF,EAAA,EAAA,KAAA,MAAA,IAAA,EAAA,EAR7BA,EAAA,EAAA,KAAA,OAAgB,YAAA,EAGhBA,EAAA,EAAA,KAAA,WAAA,IAAA,EAAA,EAK6B,K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CAC5D,CAAC,CAEL,CACF,CACF,E"}
1
+ {"version":3,"file":"user-timing-BWqzYF2Q.cjs","names":["matchesAny","recordedUrl","require_platform","require_types","require_defineProperty","USER_TIMING_DURATION","UserTimingCapture","ctx","first","once","supported","list","include","userTiming","entry","entries","name","fullUrls"],"sources":["../src/capture/user-timing.ts"],"sourcesContent":["// src/capture/user-timing.ts\n//\n// Records the app's marks and measures from the User Timing API. A measure goes into a\n// histogram, and a mark adds a breadcrumb.\n\nimport type { InstrumentDef } from \"../models/metric\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { type Capture, type CaptureContext, matchesAny } from \"./types\";\n\n/** Histogram of the app's measures, in milliseconds. */\nconst USER_TIMING_DURATION: InstrumentDef = {\n name: \"ui.user_timing.duration\",\n kind: \"histogram\",\n unit: \"ms\",\n boundaries: [1, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000],\n};\n\n/** Observes the app's marks and measures. */\nexport class UserTimingCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"userTiming\";\n\n /** Observer for the mark and measure entries. */\n private observer: PerformanceObserver | undefined;\n\n /**\n * @param ctx Capture context with the config, the meter and the breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Observes marks and measures. Only the first install in a document reads buffered entries. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n const { once } = this.ctx;\n const first = !once.userTiming;\n once.userTiming = true;\n\n // Older browsers have no supportedEntryTypes, and the capture stays off there.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n if (!supported?.includes(\"measure\")) {\n if (first) {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report User Timing entries. The user timing capture is off.\",\n );\n }\n return;\n }\n\n this.observer = new PerformanceObserver((list) => {\n // The browser calls this directly, so anything we throw is an uncaught error on the page.\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not record a user timing entry.\",\n () => {\n this.record(list.getEntries());\n },\n );\n });\n // Buffered entries include the marks and measures made before this chunk loaded.\n this.observer.observe({ type: \"measure\", buffered: first });\n if (supported.includes(\"mark\")) {\n this.observer.observe({ type: \"mark\", buffered: first });\n }\n }\n\n /** Disconnects the observer. */\n uninstall(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n /**\n * Records the entries whose name `userTiming.include` selects.\n * @param entries Mark and measure entries.\n */\n private record(entries: PerformanceEntryList): void {\n if (this.ctx.isActive?.() === false) {\n return;\n }\n\n const { fullUrls, userTiming } = this.ctx.config.capture;\n const include = typeof userTiming === \"object\" ? userTiming.include : undefined;\n for (const entry of entries) {\n if (include !== undefined && include.length > 0 && !matchesAny(entry.name, include)) {\n continue;\n }\n\n // A third-party script can write any name, so a name can hold a URL with a token.\n const name = recordedUrl(entry.name, fullUrls);\n if (entry.entryType === \"measure\") {\n this.ctx.recordMetric(USER_TIMING_DURATION, entry.duration, { \"user_timing.name\": name });\n } else {\n this.ctx.breadcrumbs.push({\n // A buffered entry reaches the observer late, and the trail needs the mark's own time.\n t: Math.round(performance.timeOrigin + entry.startTime),\n category: \"event\",\n message: name.slice(0, this.ctx.config.limits.maxBodyChars),\n });\n }\n }\n }\n}\n"],"mappings":"A,wHAUA,IAAMK,EAAsC,CAC1C,KAAM,0BACN,KAAM,YACN,KAAM,KACN,WAAY,CAAC,EAAG,EAAG,GAAI,GAAI,GAAI,IAAK,IAAK,IAAK,IAAM,KAAM,IAAM,GAAK,CACvE,EAGaC,EAAb,KAAkD,CAUhD,YAAY,EAAsC,CAArBF,EAAA,EAAA,KAAA,MAAA,IAAA,EAAA,EAR7BA,EAAA,EAAA,KAAA,OAAgB,YAAA,EAGhBA,EAAA,EAAA,KAAA,WAAA,IAAA,EAAA,EAK6B,KAAA,IAAAG,CAAsB,CAGnD,SAAgB,CACd,GAAI,KAAK,SACP,OAGF,GAAM,CAAE,QAAS,KAAK,IAChBC,EAAQ,CAACC,EAAK,WACpB,EAAK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
  import { t } from "./types-BAerHgCq.js";
3
3
  import { t as n } from "./defineProperty-s2S8BXUc.js";
4
4
  // src/capture/user-timing.ts
@@ -60,4 +60,4 @@ var r = {
60
60
  };
61
61
  export { i as UserTimingCapture };
62
62
 
63
- //# sourceMappingURL=user-timing-4KIJ74Vi.js.map
63
+ //# sourceMappingURL=user-timing-Duz0d-OA.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"user-timing-4KIJ74Vi.js","names":["recordedUrl","_defineProperty","USER_TIMING_DURATION","UserTimingCapture","ctx","first","once","supported","list","include","userTiming","entry","entries","matchesAny","name","fullUrls"],"sources":["../src/capture/user-timing.ts"],"sourcesContent":["// src/capture/user-timing.ts\n//\n// Records the app's marks and measures from the User Timing API. A measure goes into a\n// histogram, and a mark adds a breadcrumb.\n\nimport type { InstrumentDef } from \"../models/metric\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { type Capture, type CaptureContext, matchesAny } from \"./types\";\n\n/** Histogram of the app's measures, in milliseconds. */\nconst USER_TIMING_DURATION: InstrumentDef = {\n name: \"ui.user_timing.duration\",\n kind: \"histogram\",\n unit: \"ms\",\n boundaries: [1, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000],\n};\n\n/** Observes the app's marks and measures. */\nexport class UserTimingCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"userTiming\";\n\n /** Observer for the mark and measure entries. */\n private observer: PerformanceObserver | undefined;\n\n /**\n * @param ctx Capture context with the config, the meter and the breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Observes marks and measures. Only the first install in a document reads buffered entries. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n const { once } = this.ctx;\n const first = !once.userTiming;\n once.userTiming = true;\n\n // Older browsers have no supportedEntryTypes, and the capture stays off there.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n if (!supported?.includes(\"measure\")) {\n if (first) {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report User Timing entries. The user timing capture is off.\",\n );\n }\n return;\n }\n\n this.observer = new PerformanceObserver((list) => {\n // The browser calls this directly, so anything we throw is an uncaught error on the page.\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not record a user timing entry.\",\n () => {\n this.record(list.getEntries());\n },\n );\n });\n // Buffered entries include the marks and measures made before this chunk loaded.\n this.observer.observe({ type: \"measure\", buffered: first });\n if (supported.includes(\"mark\")) {\n this.observer.observe({ type: \"mark\", buffered: first });\n }\n }\n\n /** Disconnects the observer. */\n uninstall(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n /**\n * Records the entries whose name `userTiming.include` selects.\n * @param entries Mark and measure entries.\n */\n private record(entries: PerformanceEntryList): void {\n if (this.ctx.isActive?.() === false) {\n return;\n }\n\n const { fullUrls, userTiming } = this.ctx.config.capture;\n const include = typeof userTiming === \"object\" ? userTiming.include : undefined;\n for (const entry of entries) {\n if (include !== undefined && include.length > 0 && !matchesAny(entry.name, include)) {\n continue;\n }\n\n // A third-party script can write any name, so a name can hold a URL with a token.\n const name = recordedUrl(entry.name, fullUrls);\n if (entry.entryType === \"measure\") {\n this.ctx.recordMetric(USER_TIMING_DURATION, entry.duration, { \"user_timing.name\": name });\n } else {\n this.ctx.breadcrumbs.push({\n // A buffered entry reaches the observer late, and the trail needs the mark's own time.\n t: Math.round(performance.timeOrigin + entry.startTime),\n category: \"event\",\n message: name.slice(0, this.ctx.config.limits.maxBodyChars),\n });\n }\n }\n }\n}\n"],"mappings":";;;;AAUA,IAAME,IAAsC;CAC1C,MAAM;CACN,MAAM;CACN,MAAM;CACN,YAAY;EAAC;EAAG;EAAG;EAAI;EAAI;EAAI;EAAK;EAAK;EAAK;EAAM;EAAM;EAAM;CAAK;AACvE,GAGaC,IAAb,MAAkD;CAUhD,YAAY,GAAsC;EAArB,AAAAF,EAAA,MAAA,OAAA,KAAA,CAAA,GAR7BA,EAAA,MAAA,Q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UAAU;IACV,SAASG,EAAK,MAAM,GAAG,KAAK,IAAI,OAAO,OAAO,YAAY;GAC5D,CAAC;EAEL;CACF;AACF"}
1
+ {"version":3,"file":"user-timing-Duz0d-OA.js","names":["recordedUrl","_defineProperty","USER_TIMING_DURATION","UserTimingCapture","ctx","first","once","supported","list","include","userTiming","entry","entries","matchesAny","name","fullUrls"],"sources":["../src/capture/user-timing.ts"],"sourcesContent":["// src/capture/user-timing.ts\n//\n// Records the app's marks and measures from the User Timing API. A measure goes into a\n// histogram, and a mark adds a breadcrumb.\n\nimport type { InstrumentDef } from \"../models/metric\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { type Capture, type CaptureContext, matchesAny } from \"./types\";\n\n/** Histogram of the app's measures, in milliseconds. */\nconst USER_TIMING_DURATION: InstrumentDef = {\n name: \"ui.user_timing.duration\",\n kind: \"histogram\",\n unit: \"ms\",\n boundaries: [1, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000],\n};\n\n/** Observes the app's marks and measures. */\nexport class UserTimingCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"userTiming\";\n\n /** Observer for the mark and measure entries. */\n private observer: PerformanceObserver | undefined;\n\n /**\n * @param ctx Capture context with the config, the meter and the breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Observes marks and measures. Only the first install in a document reads buffered entries. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n const { once } = this.ctx;\n const first = !once.userTiming;\n once.userTiming = true;\n\n // Older browsers have no supportedEntryTypes, and the capture stays off there.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n if (!supported?.includes(\"measure\")) {\n if (first) {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report User Timing entries. The user timing capture is off.\",\n );\n }\n return;\n }\n\n this.observer = new PerformanceObserver((list) => {\n // The browser calls this directly, so anything we throw is an uncaught error on the page.\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not record a user timing entry.\",\n () => {\n this.record(list.getEntries());\n },\n );\n });\n // Buffered entries include the marks and measures made before this chunk loaded.\n this.observer.observe({ type: \"measure\", buffered: first });\n if (supported.includes(\"mark\")) {\n this.observer.observe({ type: \"mark\", buffered: first });\n }\n }\n\n /** Disconnects the observer. */\n uninstall(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n /**\n * Records the entries whose name `userTiming.include` selects.\n * @param entries Mark and measure entries.\n */\n private record(entries: PerformanceEntryList): void {\n if (this.ctx.isActive?.() === false) {\n return;\n }\n\n const { fullUrls, userTiming } = this.ctx.config.capture;\n const include = typeof userTiming === \"object\" ? userTiming.include : undefined;\n for (const entry of entries) {\n if (include !== undefined && include.length > 0 && !matchesAny(entry.name, include)) {\n continue;\n }\n\n // A third-party script can write any name, so a name can hold a URL with a token.\n const name = recordedUrl(entry.name, fullUrls);\n if (entry.entryType === \"measure\") {\n this.ctx.recordMetric(USER_TIMING_DURATION, entry.duration, { \"user_timing.name\": name });\n } else {\n this.ctx.breadcrumbs.push({\n // A buffered entry reaches the observer late, and the trail needs the mark's own time.\n t: Math.round(performance.timeOrigin + entry.startTime),\n category: \"event\",\n message: name.slice(0, this.ctx.config.limits.maxBodyChars),\n });\n }\n }\n }\n}\n"],"mappings":";;;;AAUA,IAAME,IAAsC;CAC1C,MAAM;CACN,MAAM;CACN,MAAM;CACN,YAAY;EAAC;EAAG;EAAG;EAAI;EAAI;EAAI;EAAK;EAAK;EAAK;EAAM;EAAM;EAAM;CAAK;AACvE,GAGaC,IAAb,MAAkD;CAUhD,YAAY,GAAsC;EAArB,AAAAF,EAAA,MAAA,OAAA,KAAA,CAAA,GAR7BA,EAAA,MAAA,QAAgB,YAAA,GAGhBA,EAAA,MAAA,YAAA,KAAA,CAAA,GAK6B,KAAA,MAAAG;CAAsB;CAGnD,UAAgB;EACd,IAAI,KAAK,UACP;EAGF,IAAM,EAAE,YAAS,KAAK,KAChB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s";
2
2
  /**
3
3
  * Runs an async function under an origin-wide Web Locks API lock. Runs the task directly when
4
- * the Web Locks API isn't available.
4
+ * the Web Locks API isn't available, or when the lock request fails before it grants anything.
5
5
  * @param name Origin-scoped lock identifier.
6
6
  * @param diagnostics Diagnostics reporter.
7
7
  * @param fn The async task to run while holding the lock.
8
8
  * @param options Lock acquisition options.
9
9
  * @param options.skipIfBusy When true, the task doesn't run if another context holds the lock.
10
10
  * @returns A promise of the task's result. Resolves to undefined when another context holds
11
- * the lock. A caller that reads undefined as a task result stops rescheduling.
11
+ * the lock, or when the task rejects under the lock. A caller that reads undefined as a task
12
+ * result stops rescheduling.
12
13
  */
13
14
  export declare function withDrainLock<T>(name: string, diagnostics: Diagnostics, fn: () => Promise<T>, { skipIfBusy }?: {
14
15
  skipIfBusy?: boolean;
@@ -1,14 +1,15 @@
1
1
  import type { Diagnostics } from "../core/diagnostics.js";
2
2
  /**
3
3
  * Runs an async function under an origin-wide Web Locks API lock. Runs the task directly when
4
- * the Web Locks API isn't available.
4
+ * the Web Locks API isn't available, or when the lock request fails before it grants anything.
5
5
  * @param name Origin-scoped lock identifier.
6
6
  * @param diagnostics Diagnostics reporter.
7
7
  * @param fn The async task to run while holding the lock.
8
8
  * @param options Lock acquisition options.
9
9
  * @param options.skipIfBusy When true, the task doesn't run if another context holds the lock.
10
10
  * @returns A promise of the task's result. Resolves to undefined when another context holds
11
- * the lock. A caller that reads undefined as a task result stops rescheduling.
11
+ * the lock, or when the task rejects under the lock. A caller that reads undefined as a task
12
+ * result stops rescheduling.
12
13
  */
13
14
  export declare function withDrainLock<T>(name: string, diagnostics: Diagnostics, fn: () => Promise<T>, { skipIfBusy }?: {
14
15
  skipIfBusy?: boolean;
@@ -1,11 +1,5 @@
1
1
  /** The InterApplicationBus operations that the bus link uses. */
2
2
  export interface FinIab {
3
- /**
4
- * Publishes a message to all topic subscribers.
5
- * @param topic Topic name.
6
- * @param message Message payload.
7
- */
8
- publish(topic: string, message: unknown): Promise<void>;
9
3
  /**
10
4
  * Subscribes a listener to a topic for matching application identities.
11
5
  * @param identity Target application identity.
@@ -15,6 +9,24 @@ export interface FinIab {
15
9
  subscribe(identity: {
16
10
  uuid: string;
17
11
  }, topic: string, listener: (message: unknown, uuid?: string, name?: string) => void): Promise<void>;
12
+ /**
13
+ * Sends a message to the topic subscribers of one application.
14
+ * @param destination Target application identity.
15
+ * @param topic Topic name.
16
+ * @param message Message payload.
17
+ */
18
+ send(destination: {
19
+ uuid: string;
20
+ }, topic: string, message: unknown): Promise<void>;
21
+ /**
22
+ * Removes a listener that subscribe() added. An older runtime may not have it.
23
+ * @param identity The identity that subscribe() got.
24
+ * @param topic The topic that subscribe() got.
25
+ * @param listener The listener that subscribe() got.
26
+ */
27
+ unsubscribe?(identity: {
28
+ uuid: string;
29
+ }, topic: string, listener: (message: unknown, uuid?: string, name?: string) => void): Promise<void>;
18
30
  }
19
31
  /** The fin.me members that the library reads. */
20
32
  export interface FinMe {
@@ -1,11 +1,5 @@
1
1
  /** The InterApplicationBus operations that the bus link uses. */
2
2
  export interface FinIab {
3
- /**
4
- * Publishes a message to all topic subscribers.
5
- * @param topic Topic name.
6
- * @param message Message payload.
7
- */
8
- publish(topic: string, message: unknown): Promise<void>;
9
3
  /**
10
4
  * Subscribes a listener to a topic for matching application identities.
11
5
  * @param identity Target application identity.
@@ -15,6 +9,24 @@ export interface FinIab {
15
9
  subscribe(identity: {
16
10
  uuid: string;
17
11
  }, topic: string, listener: (message: unknown, uuid?: string, name?: string) => void): Promise<void>;
12
+ /**
13
+ * Sends a message to the topic subscribers of one application.
14
+ * @param destination Target application identity.
15
+ * @param topic Topic name.
16
+ * @param message Message payload.
17
+ */
18
+ send(destination: {
19
+ uuid: string;
20
+ }, topic: string, message: unknown): Promise<void>;
21
+ /**
22
+ * Removes a listener that subscribe() added. An older runtime may not have it.
23
+ * @param identity The identity that subscribe() got.
24
+ * @param topic The topic that subscribe() got.
25
+ * @param listener The listener that subscribe() got.
26
+ */
27
+ unsubscribe?(identity: {
28
+ uuid: string;
29
+ }, topic: string, listener: (message: unknown, uuid?: string, name?: string) => void): Promise<void>;
18
30
  }
19
31
  /** The fin.me members that the library reads. */
20
32
  export interface FinMe {