@utk09/ui-observability 1.0.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 (298) hide show
  1. package/CHANGELOG.md +111 -219
  2. package/README.md +24 -26
  3. package/dist/{batch-CXmPmTse.js → batch-120Kc9jr.js} +3 -3
  4. package/dist/{batch-CXmPmTse.js.map → batch-120Kc9jr.js.map} +1 -1
  5. package/dist/{batch-mmPigCpi.cjs → batch-C3uNp5kU.cjs} +2 -2
  6. package/dist/{batch-mmPigCpi.cjs.map → batch-C3uNp5kU.cjs.map} +1 -1
  7. package/dist/bus/bus.d.cts +31 -2
  8. package/dist/bus/bus.d.ts +31 -2
  9. package/dist/bus-Dj8IEVcC.cjs +2 -0
  10. package/dist/bus-Dj8IEVcC.cjs.map +1 -0
  11. package/dist/{bus-C39wspFV.js → bus-DyNafxZN.js} +127 -104
  12. package/dist/bus-DyNafxZN.js.map +1 -0
  13. package/dist/capture/errors.d.cts +10 -0
  14. package/dist/capture/errors.d.ts +10 -0
  15. package/dist/capture/interactions.d.cts +35 -3
  16. package/dist/capture/interactions.d.ts +35 -3
  17. package/dist/capture/observed-windows.d.cts +51 -0
  18. package/dist/capture/observed-windows.d.ts +51 -0
  19. package/dist/capture/replay.d.cts +1 -1
  20. package/dist/capture/replay.d.ts +1 -1
  21. package/dist/capture/types.d.cts +5 -0
  22. package/dist/capture/types.d.ts +5 -0
  23. package/dist/capture/web-vitals.d.cts +1 -0
  24. package/dist/capture/web-vitals.d.ts +1 -0
  25. package/dist/{compression-tVtXwVjX.js → compression-BWkDWY3v.js} +2 -2
  26. package/dist/{compression-tVtXwVjX.js.map → compression-BWkDWY3v.js.map} +1 -1
  27. package/dist/{compression-CvED_Jel.cjs → compression-CEVe7NPX.cjs} +2 -2
  28. package/dist/{compression-CvED_Jel.cjs.map → compression-CEVe7NPX.cjs.map} +1 -1
  29. package/dist/config-C0PtemvC.cjs +2 -0
  30. package/dist/config-C0PtemvC.cjs.map +1 -0
  31. package/dist/config-DK1Zf7jn.js +556 -0
  32. package/dist/config-DK1Zf7jn.js.map +1 -0
  33. package/dist/{console-BGgGnjSi.js → console-CAyCQOpm.js} +5 -5
  34. package/dist/{console-BGgGnjSi.js.map → console-CAyCQOpm.js.map} +1 -1
  35. package/dist/{console-CSZ5_Vx5.cjs → console-Dk6GH4yj.cjs} +2 -2
  36. package/dist/{console-CSZ5_Vx5.cjs.map → console-Dk6GH4yj.cjs.map} +1 -1
  37. package/dist/{constants-CUyd9cTZ.js → constants-CEHN6KuY.js} +46 -25
  38. package/dist/constants-CEHN6KuY.js.map +1 -0
  39. package/dist/constants-NtiQDWL_.cjs +2 -0
  40. package/dist/constants-NtiQDWL_.cjs.map +1 -0
  41. package/dist/constants.d.cts +23 -0
  42. package/dist/constants.d.ts +23 -0
  43. package/dist/core/config.d.cts +9 -3
  44. package/dist/core/config.d.ts +9 -3
  45. package/dist/core/diagnostics.d.cts +1 -1
  46. package/dist/core/diagnostics.d.ts +1 -1
  47. package/dist/core/pipeline.d.cts +11 -0
  48. package/dist/core/pipeline.d.ts +11 -0
  49. package/dist/core/record.d.cts +2 -2
  50. package/dist/core/record.d.ts +2 -2
  51. package/dist/core/rotation.d.cts +26 -2
  52. package/dist/core/rotation.d.ts +26 -2
  53. package/dist/core/runtime.d.cts +9 -0
  54. package/dist/core/runtime.d.ts +9 -0
  55. package/dist/core/sender.d.cts +3 -2
  56. package/dist/core/sender.d.ts +3 -2
  57. package/dist/{debug-bundle-BXIlwDKM.cjs → debug-bundle-DMzUfiQc.cjs} +2 -2
  58. package/dist/{debug-bundle-BXIlwDKM.cjs.map → debug-bundle-DMzUfiQc.cjs.map} +1 -1
  59. package/dist/{debug-bundle-CRpYV_ui.js → debug-bundle-w78W46zr.js} +4 -4
  60. package/dist/{debug-bundle-CRpYV_ui.js.map → debug-bundle-w78W46zr.js.map} +1 -1
  61. package/dist/doctor.cjs +1 -1
  62. package/dist/doctor.js +36 -36
  63. package/dist/doctor.js.map +1 -1
  64. package/dist/errors-07pmZ7VY.cjs +3 -0
  65. package/dist/errors-07pmZ7VY.cjs.map +1 -0
  66. package/dist/{errors-BE_EZV7Q.js → errors-C-LYbqyB.js} +27 -24
  67. package/dist/errors-C-LYbqyB.js.map +1 -0
  68. package/dist/{factory-CTi0Is3F.js → factory-BHYrcSaU.js} +39 -28
  69. package/dist/factory-BHYrcSaU.js.map +1 -0
  70. package/dist/factory-DsaNdcXp.cjs +2 -0
  71. package/dist/factory-DsaNdcXp.cjs.map +1 -0
  72. package/dist/{identity-DdhKgrpk.js → identity-Byh3gCdT.js} +35 -24
  73. package/dist/identity-Byh3gCdT.js.map +1 -0
  74. package/dist/identity-BzAzdQyv.cjs +2 -0
  75. package/dist/identity-BzAzdQyv.cjs.map +1 -0
  76. package/dist/index.cjs +1 -1
  77. package/dist/index.cjs.map +1 -1
  78. package/dist/index.d.cts +1 -0
  79. package/dist/index.d.ts +1 -0
  80. package/dist/index.js +453 -417
  81. package/dist/index.js.map +1 -1
  82. package/dist/{indexeddb-storage-GHdl0t8A.js → indexeddb-storage-BYywz-v6.js} +17 -17
  83. package/dist/{indexeddb-storage-GHdl0t8A.js.map → indexeddb-storage-BYywz-v6.js.map} +1 -1
  84. package/dist/{indexeddb-storage-CL9uqBCy.cjs → indexeddb-storage-BfqGkLFe.cjs} +2 -2
  85. package/dist/{indexeddb-storage-CL9uqBCy.cjs.map → indexeddb-storage-BfqGkLFe.cjs.map} +1 -1
  86. package/dist/interactions-BXzEel4F.cjs +2 -0
  87. package/dist/interactions-BXzEel4F.cjs.map +1 -0
  88. package/dist/interactions-DdKPMWIN.js +207 -0
  89. package/dist/interactions-DdKPMWIN.js.map +1 -0
  90. package/dist/{journey-B4Adltjm.cjs → journey-BUmsrgaw.cjs} +2 -2
  91. package/dist/{journey-B4Adltjm.cjs.map → journey-BUmsrgaw.cjs.map} +1 -1
  92. package/dist/{journey-D2_sia57.js → journey-Nu655gEO.js} +14 -14
  93. package/dist/{journey-D2_sia57.js.map → journey-Nu655gEO.js.map} +1 -1
  94. package/dist/{library-console-CPW6bvZH.cjs → library-console-DdIlzzph.cjs} +2 -2
  95. package/dist/{library-console-CPW6bvZH.cjs.map → library-console-DdIlzzph.cjs.map} +1 -1
  96. package/dist/{library-console-Btrzt814.js → library-console-amePMnP8.js} +2 -2
  97. package/dist/{library-console-Btrzt814.js.map → library-console-amePMnP8.js.map} +1 -1
  98. package/dist/{library-request-BJ9PLRaD.js → library-request-Cv7C05jf.js} +2 -2
  99. package/dist/{library-request-BJ9PLRaD.js.map → library-request-Cv7C05jf.js.map} +1 -1
  100. package/dist/{library-request-D7OvTxZV.cjs → library-request-DO3Ec7KE.cjs} +2 -2
  101. package/dist/{library-request-D7OvTxZV.cjs.map → library-request-DO3Ec7KE.cjs.map} +1 -1
  102. package/dist/{lifecycle-IaAm1mOC.cjs → lifecycle-B5yfH5is.cjs} +2 -2
  103. package/dist/{lifecycle-IaAm1mOC.cjs.map → lifecycle-B5yfH5is.cjs.map} +1 -1
  104. package/dist/{lifecycle-22CUCrc9.js → lifecycle-CMHz2Zbs.js} +2 -2
  105. package/dist/{lifecycle-22CUCrc9.js.map → lifecycle-CMHz2Zbs.js.map} +1 -1
  106. package/dist/{log-record-BNiLfqtL.js → log-record-B_nSqxoe.js} +2 -2
  107. package/dist/{log-record-BNiLfqtL.js.map → log-record-B_nSqxoe.js.map} +1 -1
  108. package/dist/{log-record-CkivuiEl.cjs → log-record-Bdywwg0k.cjs} +2 -2
  109. package/dist/{log-record-CkivuiEl.cjs.map → log-record-Bdywwg0k.cjs.map} +1 -1
  110. package/dist/{long-frames-DNFaRnC3.js → long-frames-6NGl1-uN.js} +3 -3
  111. package/dist/{long-frames-DNFaRnC3.js.map → long-frames-6NGl1-uN.js.map} +1 -1
  112. package/dist/{long-frames-BUUbXd-B.cjs → long-frames-D9DfSWqv.cjs} +2 -2
  113. package/dist/{long-frames-BUUbXd-B.cjs.map → long-frames-D9DfSWqv.cjs.map} +1 -1
  114. package/dist/models/bus.d.cts +6 -1
  115. package/dist/models/bus.d.ts +6 -1
  116. package/dist/models/config.d.cts +27 -11
  117. package/dist/models/config.d.ts +27 -11
  118. package/dist/models/serializer.d.cts +3 -1
  119. package/dist/models/serializer.d.ts +3 -1
  120. package/dist/{network-CGMLQ-mA.cjs → network-BNHBI0Fc.cjs} +2 -2
  121. package/dist/{network-CGMLQ-mA.cjs.map → network-BNHBI0Fc.cjs.map} +1 -1
  122. package/dist/{network-on2zZT6H.js → network-Cc3tSB7e.js} +5 -5
  123. package/dist/{network-on2zZT6H.js.map → network-Cc3tSB7e.js.map} +1 -1
  124. package/dist/observed-windows-8JtCsIr1.js +64 -0
  125. package/dist/observed-windows-8JtCsIr1.js.map +1 -0
  126. package/dist/observed-windows-BlE25nrn.cjs +2 -0
  127. package/dist/observed-windows-BlE25nrn.cjs.map +1 -0
  128. package/dist/openfin-Bxelt0yg.js.map +1 -1
  129. package/dist/openfin-DtH2f7zX.cjs.map +1 -1
  130. package/dist/{otlp-DimfrRor.js → otlp-Btix3EBa.js} +7 -7
  131. package/dist/{otlp-DimfrRor.js.map → otlp-Btix3EBa.js.map} +1 -1
  132. package/dist/{otlp-BENHf3g9.cjs → otlp-CFSW-Dno.cjs} +2 -2
  133. package/dist/{otlp-BENHf3g9.cjs.map → otlp-CFSW-Dno.cjs.map} +1 -1
  134. package/dist/patch-DlcKzIi-.cjs +2 -0
  135. package/dist/patch-DlcKzIi-.cjs.map +1 -0
  136. package/dist/patch-Sr1wKg7W.js +9 -0
  137. package/dist/patch-Sr1wKg7W.js.map +1 -0
  138. package/dist/platform-BZjp9wp1.cjs +2 -0
  139. package/dist/platform-BZjp9wp1.cjs.map +1 -0
  140. package/dist/platform-Dba6R3Hp.js +75 -0
  141. package/dist/platform-Dba6R3Hp.js.map +1 -0
  142. package/dist/{profiler-BAZoh7A4.js → profiler-DNKcqu09.js} +60 -60
  143. package/dist/{profiler-BAZoh7A4.js.map → profiler-DNKcqu09.js.map} +1 -1
  144. package/dist/{profiler-D4tJpDRc.cjs → profiler-DpoPi1hH.cjs} +2 -2
  145. package/dist/{profiler-D4tJpDRc.cjs.map → profiler-DpoPi1hH.cjs.map} +1 -1
  146. package/dist/{profiler-frames-C4xr7KfH.cjs → profiler-frames-C9zJNd8_.cjs} +2 -2
  147. package/dist/{profiler-frames-C4xr7KfH.cjs.map → profiler-frames-C9zJNd8_.cjs.map} +1 -1
  148. package/dist/{profiler-frames-cJMx9wNM.js → profiler-frames-CGXZeZ_3.js} +16 -16
  149. package/dist/{profiler-frames-cJMx9wNM.js.map → profiler-frames-CGXZeZ_3.js.map} +1 -1
  150. package/dist/{remote-rules-Dz9MRAsB.js → remote-rules-DNK96vLa.js} +25 -25
  151. package/dist/{remote-rules-Dz9MRAsB.js.map → remote-rules-DNK96vLa.js.map} +1 -1
  152. package/dist/{remote-rules-_tY0zj5o.cjs → remote-rules-DuMFRlit.cjs} +2 -2
  153. package/dist/{remote-rules-_tY0zj5o.cjs.map → remote-rules-DuMFRlit.cjs.map} +1 -1
  154. package/dist/replay-Cab-lSit.cjs +2 -0
  155. package/dist/replay-Cab-lSit.cjs.map +1 -0
  156. package/dist/{replay-Ds-ANH34.js → replay-Dy6OiaOZ.js} +104 -77
  157. package/dist/replay-Dy6OiaOZ.js.map +1 -0
  158. package/dist/{reports-BDSe4dFH.cjs → reports-CGK9YQch.cjs} +2 -2
  159. package/dist/{reports-BDSe4dFH.cjs.map → reports-CGK9YQch.cjs.map} +1 -1
  160. package/dist/{reports-C-thq-bk.js → reports-CX57-S9s.js} +3 -3
  161. package/dist/{reports-C-thq-bk.js.map → reports-CX57-S9s.js.map} +1 -1
  162. package/dist/{resource-timing-eUl2dNgC.js → resource-timing-CWVDCbrY.js} +4 -4
  163. package/dist/{resource-timing-eUl2dNgC.js.map → resource-timing-CWVDCbrY.js.map} +1 -1
  164. package/dist/{resource-timing-C576gFIQ.cjs → resource-timing-DalulXiR.cjs} +2 -2
  165. package/dist/{resource-timing-C576gFIQ.cjs.map → resource-timing-DalulXiR.cjs.map} +1 -1
  166. package/dist/response-body-Cpz5__4g.cjs +3 -0
  167. package/dist/response-body-Cpz5__4g.cjs.map +1 -0
  168. package/dist/{response-body-eoSQpLiH.js → response-body-yi92Rpvo.js} +109 -109
  169. package/dist/response-body-yi92Rpvo.js.map +1 -0
  170. package/dist/{rotation-Cwct4ckk.js → rotation-ChBbNDE2.js} +27 -28
  171. package/dist/rotation-ChBbNDE2.js.map +1 -0
  172. package/dist/rotation-fTnNJcfH.cjs +2 -0
  173. package/dist/rotation-fTnNJcfH.cjs.map +1 -0
  174. package/dist/{sampling-BlrI8jor.js → sampling-DZTOD28D.js} +16 -16
  175. package/dist/{sampling-BlrI8jor.js.map → sampling-DZTOD28D.js.map} +1 -1
  176. package/dist/{sampling-mXt4dstx.cjs → sampling-wAVJIZXp.cjs} +2 -2
  177. package/dist/{sampling-mXt4dstx.cjs.map → sampling-wAVJIZXp.cjs.map} +1 -1
  178. package/dist/{sanitize-Ba0KqU06.js → sanitize-B2GKlSFp.js} +2 -2
  179. package/dist/{sanitize-Ba0KqU06.js.map → sanitize-B2GKlSFp.js.map} +1 -1
  180. package/dist/{sanitize-DQyiI_KY.cjs → sanitize-BZdhoghq.cjs} +2 -2
  181. package/dist/{sanitize-DQyiI_KY.cjs.map → sanitize-BZdhoghq.cjs.map} +1 -1
  182. package/dist/{sender-Dv8rAmpV.js → sender-BRSpc7R8.js} +192 -178
  183. package/dist/sender-BRSpc7R8.js.map +1 -0
  184. package/dist/sender-CFu98DAB.cjs +2 -0
  185. package/dist/sender-CFu98DAB.cjs.map +1 -0
  186. package/dist/storage/emergency-queue.d.cts +3 -1
  187. package/dist/storage/emergency-queue.d.ts +3 -1
  188. package/dist/storage/stored-context.d.cts +3 -2
  189. package/dist/storage/stored-context.d.ts +3 -2
  190. package/dist/stored-context-CPLlzgpm.cjs +2 -0
  191. package/dist/stored-context-CPLlzgpm.cjs.map +1 -0
  192. package/dist/{stored-context-B2EzVuYm.js → stored-context-df1dEnht.js} +12 -10
  193. package/dist/stored-context-df1dEnht.js.map +1 -0
  194. package/dist/{storm-DjKetLKZ.js → storm-U3_ek1nA.js} +2 -2
  195. package/dist/{storm-DjKetLKZ.js.map → storm-U3_ek1nA.js.map} +1 -1
  196. package/dist/{storm-C-zYSdDX.cjs → storm-qiE_AMC7.cjs} +2 -2
  197. package/dist/{storm-C-zYSdDX.cjs.map → storm-qiE_AMC7.cjs.map} +1 -1
  198. package/dist/transport/exit-flush.d.cts +23 -0
  199. package/dist/transport/exit-flush.d.ts +23 -0
  200. package/dist/transport/http-transport.d.cts +3 -2
  201. package/dist/transport/http-transport.d.ts +3 -2
  202. package/dist/transport/retry-engine.d.cts +11 -3
  203. package/dist/transport/retry-engine.d.ts +11 -3
  204. package/dist/types-BAerHgCq.js.map +1 -1
  205. package/dist/types-C7WNpnG1.cjs.map +1 -1
  206. package/dist/{unclean-exit-DQD1cT7c.js → unclean-exit-Bj6gYHeL.js} +2 -2
  207. package/dist/{unclean-exit-DQD1cT7c.js.map → unclean-exit-Bj6gYHeL.js.map} +1 -1
  208. package/dist/{unclean-exit-py99ApzT.cjs → unclean-exit-CuBh-ee5.cjs} +2 -2
  209. package/dist/{unclean-exit-py99ApzT.cjs.map → unclean-exit-CuBh-ee5.cjs.map} +1 -1
  210. package/dist/{user-timing-D6XTmpuM.cjs → user-timing-BWqzYF2Q.cjs} +2 -2
  211. package/dist/{user-timing-D6XTmpuM.cjs.map → user-timing-BWqzYF2Q.cjs.map} +1 -1
  212. package/dist/{user-timing-BePqb1uN.js → user-timing-Duz0d-OA.js} +2 -2
  213. package/dist/{user-timing-BePqb1uN.js.map → user-timing-Duz0d-OA.js.map} +1 -1
  214. package/dist/utils/identity.d.cts +5 -0
  215. package/dist/utils/identity.d.ts +5 -0
  216. package/dist/utils/lock.d.cts +3 -2
  217. package/dist/utils/lock.d.ts +3 -2
  218. package/dist/utils/openfin.d.cts +18 -6
  219. package/dist/utils/openfin.d.ts +18 -6
  220. package/dist/utils/patch.d.cts +1 -1
  221. package/dist/utils/patch.d.ts +1 -1
  222. package/dist/utils/platform.d.cts +6 -0
  223. package/dist/utils/platform.d.ts +6 -0
  224. package/dist/{web-socket-DSHgDiZ6.js → web-socket-CE_9Q22z.js} +5 -5
  225. package/dist/{web-socket-DSHgDiZ6.js.map → web-socket-CE_9Q22z.js.map} +1 -1
  226. package/dist/{web-socket-CoIUBM3C.cjs → web-socket-sm3rD-A_.cjs} +2 -2
  227. package/dist/{web-socket-CoIUBM3C.cjs.map → web-socket-sm3rD-A_.cjs.map} +1 -1
  228. package/dist/{web-vitals-4pWACwaR.js → web-vitals-CGwXGF-M.js} +4 -4
  229. package/dist/web-vitals-CGwXGF-M.js.map +1 -0
  230. package/dist/web-vitals-Df4Wsfx9.cjs +2 -0
  231. package/dist/web-vitals-Df4Wsfx9.cjs.map +1 -0
  232. package/dist/{worker-protocol-QbvqNazn.cjs → worker-protocol-D5VnCdWY.cjs} +2 -2
  233. package/dist/{worker-protocol-QbvqNazn.cjs.map → worker-protocol-D5VnCdWY.cjs.map} +1 -1
  234. package/dist/{worker-protocol-x074Rpet.js → worker-protocol-h4-tRWqy.js} +6 -6
  235. package/dist/{worker-protocol-x074Rpet.js.map → worker-protocol-h4-tRWqy.js.map} +1 -1
  236. package/dist/{worker-server-CFe4nvos.cjs → worker-server-CF1yatXq.cjs} +2 -2
  237. package/dist/{worker-server-CFe4nvos.cjs.map → worker-server-CF1yatXq.cjs.map} +1 -1
  238. package/dist/worker-server-FYfKHQhJ.js +94 -0
  239. package/dist/{worker-server-iUVSjH8L.js.map → worker-server-FYfKHQhJ.js.map} +1 -1
  240. package/dist/worker-transport-COgY4RX8.cjs +2 -0
  241. package/dist/worker-transport-COgY4RX8.cjs.map +1 -0
  242. package/dist/{worker-transport-Dy1KMA7t.js → worker-transport-jzX1IusG.js} +49 -45
  243. package/dist/worker-transport-jzX1IusG.js.map +1 -0
  244. package/llms.txt +14 -12
  245. package/package.json +13 -5
  246. package/dist/bus-C39wspFV.js.map +0 -1
  247. package/dist/bus-_EaOVPGq.cjs +0 -2
  248. package/dist/bus-_EaOVPGq.cjs.map +0 -1
  249. package/dist/config-DUs7uHHt.cjs +0 -2
  250. package/dist/config-DUs7uHHt.cjs.map +0 -1
  251. package/dist/config-SgQcCP1_.js +0 -560
  252. package/dist/config-SgQcCP1_.js.map +0 -1
  253. package/dist/constants-CUyd9cTZ.js.map +0 -1
  254. package/dist/constants-CqdJhTxH.cjs +0 -2
  255. package/dist/constants-CqdJhTxH.cjs.map +0 -1
  256. package/dist/errors-BE_EZV7Q.js.map +0 -1
  257. package/dist/errors-CNPbesMs.cjs +0 -3
  258. package/dist/errors-CNPbesMs.cjs.map +0 -1
  259. package/dist/factory-CTi0Is3F.js.map +0 -1
  260. package/dist/factory-hRrH32v5.cjs +0 -2
  261. package/dist/factory-hRrH32v5.cjs.map +0 -1
  262. package/dist/identity-DdhKgrpk.js.map +0 -1
  263. package/dist/identity-DlWRIuwy.cjs +0 -2
  264. package/dist/identity-DlWRIuwy.cjs.map +0 -1
  265. package/dist/interactions-CUkzK8sR.cjs +0 -2
  266. package/dist/interactions-CUkzK8sR.cjs.map +0 -1
  267. package/dist/interactions-DiFvCosX.js +0 -111
  268. package/dist/interactions-DiFvCosX.js.map +0 -1
  269. package/dist/patch-BX8KrPCT.cjs +0 -2
  270. package/dist/patch-BX8KrPCT.cjs.map +0 -1
  271. package/dist/patch-UdPz1ea8.js +0 -8
  272. package/dist/patch-UdPz1ea8.js.map +0 -1
  273. package/dist/platform-BaaFIPCU.js +0 -62
  274. package/dist/platform-BaaFIPCU.js.map +0 -1
  275. package/dist/platform-CfA3-7sJ.cjs +0 -2
  276. package/dist/platform-CfA3-7sJ.cjs.map +0 -1
  277. package/dist/replay-B3gFXIZd.cjs +0 -2
  278. package/dist/replay-B3gFXIZd.cjs.map +0 -1
  279. package/dist/replay-Ds-ANH34.js.map +0 -1
  280. package/dist/response-body-YdNl-HkR.cjs +0 -3
  281. package/dist/response-body-YdNl-HkR.cjs.map +0 -1
  282. package/dist/response-body-eoSQpLiH.js.map +0 -1
  283. package/dist/rotation-Cwct4ckk.js.map +0 -1
  284. package/dist/rotation-D4qUAHAu.cjs +0 -2
  285. package/dist/rotation-D4qUAHAu.cjs.map +0 -1
  286. package/dist/sender-BdRuNVhF.cjs +0 -2
  287. package/dist/sender-BdRuNVhF.cjs.map +0 -1
  288. package/dist/sender-Dv8rAmpV.js.map +0 -1
  289. package/dist/stored-context-B2EzVuYm.js.map +0 -1
  290. package/dist/stored-context-CXt7eHZL.cjs +0 -2
  291. package/dist/stored-context-CXt7eHZL.cjs.map +0 -1
  292. package/dist/web-vitals-4pWACwaR.js.map +0 -1
  293. package/dist/web-vitals-__X7t4pj.cjs +0 -2
  294. package/dist/web-vitals-__X7t4pj.cjs.map +0 -1
  295. package/dist/worker-server-iUVSjH8L.js +0 -94
  296. package/dist/worker-transport-CRAX-09c.cjs +0 -2
  297. package/dist/worker-transport-CRAX-09c.cjs.map +0 -1
  298. package/dist/worker-transport-Dy1KMA7t.js.map +0 -1
@@ -399,6 +399,11 @@ export declare const BUS_TYPE: {
399
399
  export declare const RUNTIME_GLOBAL_KEY = "ui-observability.runtime";
400
400
  /** Global key for the runtime shutdown() stopped. Calls go to it until the next configure(). */
401
401
  export declare const RUNTIME_STOPPED_KEY = "ui-observability.stopped";
402
+ /**
403
+ * Global key prefix for the observed window list. The key adds the version, so two copies of one
404
+ * version share the list, as they share the runtime, and another version keeps its own.
405
+ */
406
+ export declare const OBSERVED_WINDOWS_KEY = "ui-observability.observed-windows";
402
407
  /** Global symbol key for the library request scope count, shared by every copy on the page. */
403
408
  export declare const LIBRARY_REQUEST_KEY = "ui-observability.request-scope";
404
409
  /** Global symbol key for the library console scope count, shared by every copy on the page. */
@@ -437,6 +442,13 @@ export declare const ACTION_ATTRIBUTE_DEFAULT = "data-observability-action";
437
442
  * default, and session replay always blocks them, so a hidden region can't leak through either.
438
443
  */
439
444
  export declare const IGNORE_SELECTOR = "[data-observability-ignore]";
445
+ /**
446
+ * Selector for the regions that change on their own, such as a live price grid. A change or a
447
+ * scroll inside one isn't the page answering a click, so it doesn't stop a dead click.
448
+ */
449
+ export declare const DEAD_CLICK_IGNORE_SELECTOR = "[data-observability-live]";
450
+ /** Attributes that React rewrites in one batch with no net change, so only that change counts. */
451
+ export declare const NET_CHANGE_ATTRIBUTES: readonly string[];
440
452
  /** How many clicks on one element make a rage click, by default. */
441
453
  export declare const RAGE_CLICK_COUNT = 3;
442
454
  /** The time window a rage click's clicks must fall within, in milliseconds, by default. */
@@ -490,6 +502,17 @@ export declare const METRIC_KEYS: {
490
502
  * them off a point's attributes, because the record holds the library's value under that name.
491
503
  */
492
504
  export declare const METRIC_FIELD_KEYS: readonly string[];
505
+ /**
506
+ * Minimum key limit for a forwarded resource. A child can send keys that its message text doesn't
507
+ * show, because JSON drops an undefined value and structured clone keeps the key.
508
+ */
509
+ export declare const RESOURCE_KEY_LIMIT = 128;
510
+ /**
511
+ * Every key the record builder writes itself: the attributes it sets after the payload merge,
512
+ * and the resource block. The OTLP metrics serializer keeps them off a point's attributes,
513
+ * otherwise a session id would start a new series for every session.
514
+ */
515
+ export declare const RECORD_FIELD_KEYS: readonly string[];
493
516
  /** Precision of the profiler histogram: 2^4 = 16 sub-buckets per power of two. */
494
517
  export declare const PROFILE_SUB_BITS = 4;
495
518
  /** Buckets per probe: 16 for 0 to 15 us, then 16 for each exponent from 4 to 25. */
@@ -399,6 +399,11 @@ export declare const BUS_TYPE: {
399
399
  export declare const RUNTIME_GLOBAL_KEY = "ui-observability.runtime";
400
400
  /** Global key for the runtime shutdown() stopped. Calls go to it until the next configure(). */
401
401
  export declare const RUNTIME_STOPPED_KEY = "ui-observability.stopped";
402
+ /**
403
+ * Global key prefix for the observed window list. The key adds the version, so two copies of one
404
+ * version share the list, as they share the runtime, and another version keeps its own.
405
+ */
406
+ export declare const OBSERVED_WINDOWS_KEY = "ui-observability.observed-windows";
402
407
  /** Global symbol key for the library request scope count, shared by every copy on the page. */
403
408
  export declare const LIBRARY_REQUEST_KEY = "ui-observability.request-scope";
404
409
  /** Global symbol key for the library console scope count, shared by every copy on the page. */
@@ -437,6 +442,13 @@ export declare const ACTION_ATTRIBUTE_DEFAULT = "data-observability-action";
437
442
  * default, and session replay always blocks them, so a hidden region can't leak through either.
438
443
  */
439
444
  export declare const IGNORE_SELECTOR = "[data-observability-ignore]";
445
+ /**
446
+ * Selector for the regions that change on their own, such as a live price grid. A change or a
447
+ * scroll inside one isn't the page answering a click, so it doesn't stop a dead click.
448
+ */
449
+ export declare const DEAD_CLICK_IGNORE_SELECTOR = "[data-observability-live]";
450
+ /** Attributes that React rewrites in one batch with no net change, so only that change counts. */
451
+ export declare const NET_CHANGE_ATTRIBUTES: readonly string[];
440
452
  /** How many clicks on one element make a rage click, by default. */
441
453
  export declare const RAGE_CLICK_COUNT = 3;
442
454
  /** The time window a rage click's clicks must fall within, in milliseconds, by default. */
@@ -490,6 +502,17 @@ export declare const METRIC_KEYS: {
490
502
  * them off a point's attributes, because the record holds the library's value under that name.
491
503
  */
492
504
  export declare const METRIC_FIELD_KEYS: readonly string[];
505
+ /**
506
+ * Minimum key limit for a forwarded resource. A child can send keys that its message text doesn't
507
+ * show, because JSON drops an undefined value and structured clone keeps the key.
508
+ */
509
+ export declare const RESOURCE_KEY_LIMIT = 128;
510
+ /**
511
+ * Every key the record builder writes itself: the attributes it sets after the payload merge,
512
+ * and the resource block. The OTLP metrics serializer keeps them off a point's attributes,
513
+ * otherwise a session id would start a new series for every session.
514
+ */
515
+ export declare const RECORD_FIELD_KEYS: readonly string[];
493
516
  /** Precision of the profiler histogram: 2^4 = 16 sub-buckets per power of two. */
494
517
  export declare const PROFILE_SUB_BITS = 4;
495
518
  /** Buckets per probe: 16 for 0 to 15 us, then 16 for each exponent from 4 to 25. */
@@ -8,9 +8,11 @@ import type { Diagnostics } from "./diagnostics.cjs";
8
8
  * @param value The value the consumer passed.
9
9
  * @param fallback The current destination.
10
10
  * @param diagnostics Diagnostics reporter.
11
+ * @param current The URL the runtime sends to now. A relative URL that resolves to it isn't
12
+ * reported again.
11
13
  * @returns The URL, null when it's off, or the fallback for a refused value.
12
14
  */
13
- export declare function resolveDestination(key: string, value: unknown, fallback: unknown, diagnostics: Diagnostics): unknown;
15
+ export declare function resolveDestination(key: string, value: unknown, fallback: unknown, diagnostics: Diagnostics, current?: unknown): unknown;
14
16
  /**
15
17
  * Reads the endpoint. "" stays "", the value for "not set", so resolveConfig reports a missing
16
18
  * endpoint. A blank string is refused, because it would send to the page itself. A rotation
@@ -18,9 +20,11 @@ export declare function resolveDestination(key: string, value: unknown, fallback
18
20
  * @param value The value the consumer passed.
19
21
  * @param fallback The current endpoint.
20
22
  * @param diagnostics Diagnostics reporter.
23
+ * @param current The URL the runtime sends to now. A relative URL that resolves to it isn't
24
+ * reported again.
21
25
  * @returns The endpoint, null for console-only mode, or the fallback for a refused value.
22
26
  */
23
- export declare function resolveEndpoint(value: unknown, fallback: unknown, diagnostics: Diagnostics): unknown;
27
+ export declare function resolveEndpoint(value: unknown, fallback: unknown, diagnostics: Diagnostics, current?: unknown): unknown;
24
28
  /**
25
29
  * Stands in for a redact value that isn't a function when no redact hook was set before. The
26
30
  * record builder drops each record while it's the hook, so a record the app meant to redact
@@ -33,9 +37,11 @@ export declare const REFUSE_RECORDS: () => null;
33
37
  * @param input Partial consumer configuration options.
34
38
  * @param diagnostics Diagnostics reporter.
35
39
  * @param previous The active configuration, for an incremental reconfigure.
40
+ * @param live The config the runtime sends with now. A rotation passes it, because its previous
41
+ * has no routing values, and each relative endpoint would be reported again.
36
42
  * @returns Complete, validated configuration object.
37
43
  */
38
- export declare function resolveConfig(input: Partial<ObservabilityConfig>, diagnostics: Diagnostics, previous?: ResolvedConfig): ResolvedConfig;
44
+ export declare function resolveConfig(input: Partial<ObservabilityConfig>, diagnostics: Diagnostics, previous?: ResolvedConfig, live?: ResolvedConfig | undefined): ResolvedConfig;
39
45
  /**
40
46
  * Changes the active configuration object in place, so subsystems holding a section
41
47
  * reference see the update.
@@ -8,9 +8,11 @@ import type { Diagnostics } from "./diagnostics.js";
8
8
  * @param value The value the consumer passed.
9
9
  * @param fallback The current destination.
10
10
  * @param diagnostics Diagnostics reporter.
11
+ * @param current The URL the runtime sends to now. A relative URL that resolves to it isn't
12
+ * reported again.
11
13
  * @returns The URL, null when it's off, or the fallback for a refused value.
12
14
  */
13
- export declare function resolveDestination(key: string, value: unknown, fallback: unknown, diagnostics: Diagnostics): unknown;
15
+ export declare function resolveDestination(key: string, value: unknown, fallback: unknown, diagnostics: Diagnostics, current?: unknown): unknown;
14
16
  /**
15
17
  * Reads the endpoint. "" stays "", the value for "not set", so resolveConfig reports a missing
16
18
  * endpoint. A blank string is refused, because it would send to the page itself. A rotation
@@ -18,9 +20,11 @@ export declare function resolveDestination(key: string, value: unknown, fallback
18
20
  * @param value The value the consumer passed.
19
21
  * @param fallback The current endpoint.
20
22
  * @param diagnostics Diagnostics reporter.
23
+ * @param current The URL the runtime sends to now. A relative URL that resolves to it isn't
24
+ * reported again.
21
25
  * @returns The endpoint, null for console-only mode, or the fallback for a refused value.
22
26
  */
23
- export declare function resolveEndpoint(value: unknown, fallback: unknown, diagnostics: Diagnostics): unknown;
27
+ export declare function resolveEndpoint(value: unknown, fallback: unknown, diagnostics: Diagnostics, current?: unknown): unknown;
24
28
  /**
25
29
  * Stands in for a redact value that isn't a function when no redact hook was set before. The
26
30
  * record builder drops each record while it's the hook, so a record the app meant to redact
@@ -33,9 +37,11 @@ export declare const REFUSE_RECORDS: () => null;
33
37
  * @param input Partial consumer configuration options.
34
38
  * @param diagnostics Diagnostics reporter.
35
39
  * @param previous The active configuration, for an incremental reconfigure.
40
+ * @param live The config the runtime sends with now. A rotation passes it, because its previous
41
+ * has no routing values, and each relative endpoint would be reported again.
36
42
  * @returns Complete, validated configuration object.
37
43
  */
38
- export declare function resolveConfig(input: Partial<ObservabilityConfig>, diagnostics: Diagnostics, previous?: ResolvedConfig): ResolvedConfig;
44
+ export declare function resolveConfig(input: Partial<ObservabilityConfig>, diagnostics: Diagnostics, previous?: ResolvedConfig, live?: ResolvedConfig | undefined): ResolvedConfig;
39
45
  /**
40
46
  * Changes the active configuration object in place, so subsystems holding a section
41
47
  * reference see the update.
@@ -1,5 +1,5 @@
1
1
  /** Closed set of diagnostic event codes emitted by library subsystems. */
2
- export type DiagnosticCode = "config.locked" | "security.rotated" | "security.rotation_failed" | "security.context_mismatch" | "record.dropped_during_rotation" | "bus.rejected_message" | "config.invalid" | "config.reconfigured" | "record.sanitize_failed" | "record.truncated" | "record.dropped_by_level" | "record.dropped_by_sampling" | "record.dropped_by_ceiling" | "record.dropped_by_processor" | "record.dropped_by_redact" | "record.dropped_boot_buffer_full" | "record.dropped_malformed" | "record.dropped_no_destination" | "runtime.version_mismatch" | "journey.expired" | "journey.adopted" | "journey.token_too_large" | "trace.otel_failed" | "bus.role_resolved" | "bus.no_owner" | "bus.handshake_timeout" | "bus.untrusted_origin" | "bus.send_failed" | "bus.protocol_mismatch" | "transport.http_error" | "transport.timeout" | "transport.batch_split" | "transport.partial_success" | "transport.throttled" | "transport.dropped_permanent" | "transport.rejected_credentials" | "transport.serialize_failed" | "storage.unavailable" | "storage.degraded" | "storage.quota_exceeded" | "storage.evicted" | "storage.dead_lettered" | "pipeline.crashed" | "capture.install_failed" | "capture.rate_limited" | "capture.header_failed" | "capture.trace_header_kept" | "capture.record_failed" | "capture.transport_request" | "openfin.unavailable" | "platform.api_blocked" | "handler.threw";
2
+ export type DiagnosticCode = "config.locked" | "security.rotated" | "security.rotation_failed" | "security.context_mismatch" | "record.dropped_during_rotation" | "bus.rejected_message" | "bus.journey_denied" | "config.invalid" | "config.reconfigured" | "record.sanitize_failed" | "record.truncated" | "record.dropped_by_level" | "record.dropped_by_sampling" | "record.dropped_by_ceiling" | "record.dropped_by_processor" | "record.dropped_by_redact" | "record.dropped_boot_buffer_full" | "record.dropped_malformed" | "record.dropped_no_destination" | "runtime.version_mismatch" | "journey.expired" | "journey.adopted" | "journey.token_too_large" | "trace.otel_failed" | "bus.role_resolved" | "bus.tab_id_changed" | "bus.no_owner" | "bus.handshake_timeout" | "bus.untrusted_origin" | "bus.send_failed" | "bus.protocol_mismatch" | "transport.http_error" | "transport.timeout" | "transport.batch_split" | "transport.partial_success" | "transport.throttled" | "transport.dropped_permanent" | "transport.rejected_credentials" | "transport.serialize_failed" | "storage.unavailable" | "storage.degraded" | "storage.quota_exceeded" | "storage.evicted" | "storage.dead_lettered" | "pipeline.crashed" | "capture.install_failed" | "capture.rate_limited" | "capture.header_failed" | "capture.trace_header_kept" | "capture.record_failed" | "capture.transport_request" | "openfin.unavailable" | "platform.api_blocked" | "handler.threw";
3
3
  /** Diagnostic event payload dispatched to consumer handlers. */
4
4
  export interface DiagnosticEvent {
5
5
  /** Diagnostic fault code. */
@@ -1,5 +1,5 @@
1
1
  /** Closed set of diagnostic event codes emitted by library subsystems. */
2
- export type DiagnosticCode = "config.locked" | "security.rotated" | "security.rotation_failed" | "security.context_mismatch" | "record.dropped_during_rotation" | "bus.rejected_message" | "config.invalid" | "config.reconfigured" | "record.sanitize_failed" | "record.truncated" | "record.dropped_by_level" | "record.dropped_by_sampling" | "record.dropped_by_ceiling" | "record.dropped_by_processor" | "record.dropped_by_redact" | "record.dropped_boot_buffer_full" | "record.dropped_malformed" | "record.dropped_no_destination" | "runtime.version_mismatch" | "journey.expired" | "journey.adopted" | "journey.token_too_large" | "trace.otel_failed" | "bus.role_resolved" | "bus.no_owner" | "bus.handshake_timeout" | "bus.untrusted_origin" | "bus.send_failed" | "bus.protocol_mismatch" | "transport.http_error" | "transport.timeout" | "transport.batch_split" | "transport.partial_success" | "transport.throttled" | "transport.dropped_permanent" | "transport.rejected_credentials" | "transport.serialize_failed" | "storage.unavailable" | "storage.degraded" | "storage.quota_exceeded" | "storage.evicted" | "storage.dead_lettered" | "pipeline.crashed" | "capture.install_failed" | "capture.rate_limited" | "capture.header_failed" | "capture.trace_header_kept" | "capture.record_failed" | "capture.transport_request" | "openfin.unavailable" | "platform.api_blocked" | "handler.threw";
2
+ export type DiagnosticCode = "config.locked" | "security.rotated" | "security.rotation_failed" | "security.context_mismatch" | "record.dropped_during_rotation" | "bus.rejected_message" | "bus.journey_denied" | "config.invalid" | "config.reconfigured" | "record.sanitize_failed" | "record.truncated" | "record.dropped_by_level" | "record.dropped_by_sampling" | "record.dropped_by_ceiling" | "record.dropped_by_processor" | "record.dropped_by_redact" | "record.dropped_boot_buffer_full" | "record.dropped_malformed" | "record.dropped_no_destination" | "runtime.version_mismatch" | "journey.expired" | "journey.adopted" | "journey.token_too_large" | "trace.otel_failed" | "bus.role_resolved" | "bus.tab_id_changed" | "bus.no_owner" | "bus.handshake_timeout" | "bus.untrusted_origin" | "bus.send_failed" | "bus.protocol_mismatch" | "transport.http_error" | "transport.timeout" | "transport.batch_split" | "transport.partial_success" | "transport.throttled" | "transport.dropped_permanent" | "transport.rejected_credentials" | "transport.serialize_failed" | "storage.unavailable" | "storage.degraded" | "storage.quota_exceeded" | "storage.evicted" | "storage.dead_lettered" | "pipeline.crashed" | "capture.install_failed" | "capture.rate_limited" | "capture.header_failed" | "capture.trace_header_kept" | "capture.record_failed" | "capture.transport_request" | "openfin.unavailable" | "platform.api_blocked" | "handler.threw";
3
3
  /** Diagnostic event payload dispatched to consumer handlers. */
4
4
  export interface DiagnosticEvent {
5
5
  /** Diagnostic fault code. */
@@ -45,6 +45,11 @@ export declare class LogPipeline {
45
45
  private readonly streams;
46
46
  /** In-flight batches with no delivery confirmation yet. The exit flush sends them again. */
47
47
  private readonly unconfirmed;
48
+ /**
49
+ * In-flight batches whose request went out with keepalive. The exit flush skips them, because
50
+ * that request outlives the page. A retire aborts the request, so it takes them back.
51
+ */
52
+ private readonly keptAlive;
48
53
  /** Closed batches waiting for a free dispatch slot. */
49
54
  private readonly queue;
50
55
  /** Every batch in the queue or in flight. flushPending waits on them, destroy() resolves them. */
@@ -113,6 +118,12 @@ export declare class LogPipeline {
113
118
  * A mixed batch would send a metric to the logs endpoint.
114
119
  */
115
120
  drainForExit(): LogBatch[];
121
+ /**
122
+ * Drains like drainForExit(), and adds the batches of the open keepalive requests. A retire
123
+ * calls it after the transport stop aborted those requests, otherwise their records are lost.
124
+ * @returns The keepalive batches first, because they're older, then the exit batches.
125
+ */
126
+ drainForRetire(): LogBatch[];
116
127
  /**
117
128
  * Sends the buffered records through the normal dispatch path, then waits for every batch
118
129
  * in the queue and in flight. The throttle check and the concurrency limit apply. A direct
@@ -45,6 +45,11 @@ export declare class LogPipeline {
45
45
  private readonly streams;
46
46
  /** In-flight batches with no delivery confirmation yet. The exit flush sends them again. */
47
47
  private readonly unconfirmed;
48
+ /**
49
+ * In-flight batches whose request went out with keepalive. The exit flush skips them, because
50
+ * that request outlives the page. A retire aborts the request, so it takes them back.
51
+ */
52
+ private readonly keptAlive;
48
53
  /** Closed batches waiting for a free dispatch slot. */
49
54
  private readonly queue;
50
55
  /** Every batch in the queue or in flight. flushPending waits on them, destroy() resolves them. */
@@ -113,6 +118,12 @@ export declare class LogPipeline {
113
118
  * A mixed batch would send a metric to the logs endpoint.
114
119
  */
115
120
  drainForExit(): LogBatch[];
121
+ /**
122
+ * Drains like drainForExit(), and adds the batches of the open keepalive requests. A retire
123
+ * calls it after the transport stop aborted those requests, otherwise their records are lost.
124
+ * @returns The keepalive batches first, because they're older, then the exit batches.
125
+ */
126
+ drainForRetire(): LogBatch[];
116
127
  /**
117
128
  * Sends the buffered records through the normal dispatch path, then waits for every batch
118
129
  * in the queue and in flight. The throttle check and the concurrency limit apply. A direct
@@ -130,8 +130,8 @@ export declare class RecordBuilder {
130
130
  */
131
131
  build(input: BuildInput, forConsole?: boolean): BuildResult;
132
132
  /**
133
- * Runs the redact hook on a record from another context. A child context without redact
134
- * forwards raw records, so the sender is the last privacy gate.
133
+ * Applies this context's limits and redact hook to a record from another context. A child
134
+ * context without redact forwards raw records, so the sender is the last privacy gate.
135
135
  * @param record Forwarded record.
136
136
  * @returns The record to deliver, or null when the hook drops it.
137
137
  */
@@ -130,8 +130,8 @@ export declare class RecordBuilder {
130
130
  */
131
131
  build(input: BuildInput, forConsole?: boolean): BuildResult;
132
132
  /**
133
- * Runs the redact hook on a record from another context. A child context without redact
134
- * forwards raw records, so the sender is the last privacy gate.
133
+ * Applies this context's limits and redact hook to a record from another context. A child
134
+ * context without redact forwards raw records, so the sender is the last privacy gate.
135
135
  * @param record Forwarded record.
136
136
  * @returns The record to deliver, or null when the hook drops it.
137
137
  */
@@ -1,10 +1,12 @@
1
1
  import type { LogBatch } from "../models/batch.cjs";
2
- import type { ObservabilityConfig, SecurityContextRotationOptions, SecurityContextUpdate } from "../models/config.cjs";
2
+ import type { ObservabilityConfig, ResolvedConfig, SecurityContextRotationOptions, SecurityContextUpdate } from "../models/config.cjs";
3
3
  import type { LogRecord } from "../models/log-record.cjs";
4
4
  import type { Diagnostics } from "./diagnostics.cjs";
5
5
  import type { ObservabilityRuntime } from "./runtime.cjs";
6
6
  import type { Sender } from "./sender.cjs";
7
7
  import { type StoreAccess } from "../storage/stored-context.cjs";
8
+ /** What to do with the old context's records. */
9
+ type PendingRule = NonNullable<SecurityContextRotationOptions["pending"]>;
8
10
  /**
9
11
  * The runtime's private state that a rotation changes. The runtime's fields stay private, and
10
12
  * the rotation can only make these changes.
@@ -16,6 +18,13 @@ export interface RotationHost {
16
18
  quiet: Diagnostics;
17
19
  /** Waits for a delivery stack load in progress. */
18
20
  senderLoaded(): Promise<void>;
21
+ /**
22
+ * Runs the plan and holds the diagnostic records it raises until endRotation(), because the
23
+ * logger drops every call during a rotation and these records belong to the next context.
24
+ * @param plan Checks the next context's settings. It's synchronous, so nothing else is held.
25
+ * @returns The plan's result.
26
+ */
27
+ holdRecords(plan: () => RotationPlan): RotationPlan;
19
28
  /**
20
29
  * Removes the routing settings in a console-only runtime.
21
30
  * @param input The settings of the next context.
@@ -48,7 +57,8 @@ export interface RotationHost {
48
57
  /** Opens delivery again and loads the new context's sender. */
49
58
  openDelivery(): Promise<void>;
50
59
  /**
51
- * Lets records through again, unless a later rotation waits.
60
+ * Lets records through again and writes the held diagnostic records. If a later rotation
61
+ * waits, records stay blocked and the held ones are dropped, because they describe this context.
52
62
  * @param seq Number of this rotation call.
53
63
  */
54
64
  endRotation(seq: number): void;
@@ -63,6 +73,19 @@ export interface RotationHost {
63
73
  */
64
74
  adopt(stored: LogBatch[]): Promise<void>;
65
75
  }
76
+ /** A checked rotation, ready to apply. */
77
+ interface RotationPlan {
78
+ /** The config of the next context. */
79
+ next: ResolvedConfig;
80
+ /** The next context's ambient attributes, or undefined to clear them. */
81
+ context: Record<string, unknown> | undefined;
82
+ /** What to do with the old context's records. */
83
+ pending: PendingRule;
84
+ /** Maximum wait for an old-context flush, in milliseconds. */
85
+ timeoutMs: number;
86
+ /** The old context's id. */
87
+ previous: string;
88
+ }
66
89
  /**
67
90
  * Checks the new settings, stops the old delivery and starts the new context. A rejection
68
91
  * closes the old context's delivery, because the app asked to leave it.
@@ -73,3 +96,4 @@ export interface RotationHost {
73
96
  * @returns Promise that resolves when the context change completes.
74
97
  */
75
98
  export declare function rotateContext(host: RotationHost, update: SecurityContextUpdate, options: SecurityContextRotationOptions, seq: number): Promise<void>;
99
+ export {};
@@ -1,10 +1,12 @@
1
1
  import type { LogBatch } from "../models/batch.js";
2
- import type { ObservabilityConfig, SecurityContextRotationOptions, SecurityContextUpdate } from "../models/config.js";
2
+ import type { ObservabilityConfig, ResolvedConfig, SecurityContextRotationOptions, SecurityContextUpdate } from "../models/config.js";
3
3
  import type { LogRecord } from "../models/log-record.js";
4
4
  import type { Diagnostics } from "./diagnostics.js";
5
5
  import type { ObservabilityRuntime } from "./runtime.js";
6
6
  import type { Sender } from "./sender.js";
7
7
  import { type StoreAccess } from "../storage/stored-context.js";
8
+ /** What to do with the old context's records. */
9
+ type PendingRule = NonNullable<SecurityContextRotationOptions["pending"]>;
8
10
  /**
9
11
  * The runtime's private state that a rotation changes. The runtime's fields stay private, and
10
12
  * the rotation can only make these changes.
@@ -16,6 +18,13 @@ export interface RotationHost {
16
18
  quiet: Diagnostics;
17
19
  /** Waits for a delivery stack load in progress. */
18
20
  senderLoaded(): Promise<void>;
21
+ /**
22
+ * Runs the plan and holds the diagnostic records it raises until endRotation(), because the
23
+ * logger drops every call during a rotation and these records belong to the next context.
24
+ * @param plan Checks the next context's settings. It's synchronous, so nothing else is held.
25
+ * @returns The plan's result.
26
+ */
27
+ holdRecords(plan: () => RotationPlan): RotationPlan;
19
28
  /**
20
29
  * Removes the routing settings in a console-only runtime.
21
30
  * @param input The settings of the next context.
@@ -48,7 +57,8 @@ export interface RotationHost {
48
57
  /** Opens delivery again and loads the new context's sender. */
49
58
  openDelivery(): Promise<void>;
50
59
  /**
51
- * Lets records through again, unless a later rotation waits.
60
+ * Lets records through again and writes the held diagnostic records. If a later rotation
61
+ * waits, records stay blocked and the held ones are dropped, because they describe this context.
52
62
  * @param seq Number of this rotation call.
53
63
  */
54
64
  endRotation(seq: number): void;
@@ -63,6 +73,19 @@ export interface RotationHost {
63
73
  */
64
74
  adopt(stored: LogBatch[]): Promise<void>;
65
75
  }
76
+ /** A checked rotation, ready to apply. */
77
+ interface RotationPlan {
78
+ /** The config of the next context. */
79
+ next: ResolvedConfig;
80
+ /** The next context's ambient attributes, or undefined to clear them. */
81
+ context: Record<string, unknown> | undefined;
82
+ /** What to do with the old context's records. */
83
+ pending: PendingRule;
84
+ /** Maximum wait for an old-context flush, in milliseconds. */
85
+ timeoutMs: number;
86
+ /** The old context's id. */
87
+ previous: string;
88
+ }
66
89
  /**
67
90
  * Checks the new settings, stops the old delivery and starts the new context. A rejection
68
91
  * closes the old context's delivery, because the app asked to leave it.
@@ -73,3 +96,4 @@ export interface RotationHost {
73
96
  * @returns Promise that resolves when the context change completes.
74
97
  */
75
98
  export declare function rotateContext(host: RotationHost, update: SecurityContextUpdate, options: SecurityContextRotationOptions, seq: number): Promise<void>;
99
+ export {};
@@ -41,6 +41,10 @@ export declare class ObservabilityRuntime {
41
41
  private storagePersistence;
42
42
  /** True while a diagnostic record goes out. Diagnostics raised meanwhile produce no record. */
43
43
  private recordingDiagnostic;
44
+ /** True while a rotation checks the next context's settings, so their records wait for it. */
45
+ private holdingRecords;
46
+ /** Diagnostics from that check. Their records go out when the new context opens. */
47
+ private heldDiagnostics;
44
48
  /** Logger for the records that diagnostics.records produces. */
45
49
  private readonly diagnosticLogger;
46
50
  /** Records that minLevel or sampling dropped. An error in this context sends them first. */
@@ -242,6 +246,11 @@ export declare class ObservabilityRuntime {
242
246
  * @param event Diagnostic event.
243
247
  */
244
248
  private recordDiagnostic;
249
+ /**
250
+ * Drops the held diagnostic records of a rotation that didn't open its context, and counts
251
+ * each one as the logger counts a call during a rotation.
252
+ */
253
+ private dropHeldRecords;
245
254
  /**
246
255
  * Adds a breadcrumb from app code. The data is copied now, so a later change to the app's
247
256
  * object doesn't change the trail.
@@ -41,6 +41,10 @@ export declare class ObservabilityRuntime {
41
41
  private storagePersistence;
42
42
  /** True while a diagnostic record goes out. Diagnostics raised meanwhile produce no record. */
43
43
  private recordingDiagnostic;
44
+ /** True while a rotation checks the next context's settings, so their records wait for it. */
45
+ private holdingRecords;
46
+ /** Diagnostics from that check. Their records go out when the new context opens. */
47
+ private heldDiagnostics;
44
48
  /** Logger for the records that diagnostics.records produces. */
45
49
  private readonly diagnosticLogger;
46
50
  /** Records that minLevel or sampling dropped. An error in this context sends them first. */
@@ -242,6 +246,11 @@ export declare class ObservabilityRuntime {
242
246
  * @param event Diagnostic event.
243
247
  */
244
248
  private recordDiagnostic;
249
+ /**
250
+ * Drops the held diagnostic records of a rotation that didn't open its context, and counts
251
+ * each one as the logger counts a call during a rotation.
252
+ */
253
+ private dropHeldRecords;
245
254
  /**
246
255
  * Adds a breadcrumb from app code. The data is copied now, so a later change to the app's
247
256
  * object doesn't change the trail.
@@ -65,7 +65,8 @@ export declare class Sender {
65
65
  */
66
66
  static create(deps: SenderDeps): Promise<Sender>;
67
67
  /**
68
- * Adds a record to the pipeline.
68
+ * Adds a record to the pipeline. After a pagehide the exit flush sends it, because the batch
69
+ * timer won't fire in a closing document.
69
70
  * @param record Record to deliver.
70
71
  */
71
72
  push(record: LogRecord): void;
@@ -138,7 +139,7 @@ export declare class Sender {
138
139
  * @param timeoutMs Maximum wait for a flush, in milliseconds.
139
140
  * @param contextId Identity of the old delivery context.
140
141
  * @returns The records that were in memory and the batches that were stored, after the
141
- * delivery attempt.
142
+ * delivery attempt. A discard or a flush adds the context's emergency entries it removed.
142
143
  */
143
144
  retire(policy: "discard" | "flush" | "retain" | "carry", timeoutMs: number, contextId: string): Promise<{
144
145
  buffered: LogRecord[];
@@ -65,7 +65,8 @@ export declare class Sender {
65
65
  */
66
66
  static create(deps: SenderDeps): Promise<Sender>;
67
67
  /**
68
- * Adds a record to the pipeline.
68
+ * Adds a record to the pipeline. After a pagehide the exit flush sends it, because the batch
69
+ * timer won't fire in a closing document.
69
70
  * @param record Record to deliver.
70
71
  */
71
72
  push(record: LogRecord): void;
@@ -138,7 +139,7 @@ export declare class Sender {
138
139
  * @param timeoutMs Maximum wait for a flush, in milliseconds.
139
140
  * @param contextId Identity of the old delivery context.
140
141
  * @returns The records that were in memory and the batches that were stored, after the
141
- * delivery attempt.
142
+ * delivery attempt. A discard or a flush adds the context's emergency entries it removed.
142
143
  */
143
144
  retire(policy: "discard" | "flush" | "retain" | "carry", timeoutMs: number, contextId: string): Promise<{
144
145
  buffered: LogRecord[];
@@ -1,2 +1,2 @@
1
- const e=require("./guards-EjG3ahFp.cjs"),t=require("./platform-CfA3-7sJ.cjs"),n=require("./sanitize-DQyiI_KY.cjs"),r=require("./config-DUs7uHHt.cjs");function i(n){return typeof n==`string`?/^[a-z][a-z\d+.-]*:\/\//i.test(n)?t.i(n,!1):n:Array.isArray(n)?n.map(i):e.n(n)?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,i(t)])):n}function a(e,a,o){let s=e=>typeof e==`string`?t.i(e,!1):e,{capture:c,serializer:l}=e,u={...e,endpoint:s(e.endpoint),metricsEndpoint:s(e.metricsEndpoint),tracesEndpoint:s(e.tracesEndpoint),serializer:typeof l==`string`?l:l.name,redact:e.redact===r.t?`refused`:e.redact,processors:e.processors.map(e=>e===r.t?`refused`:e),capture:{...c,ignoreUrls:c.ignoreUrls.map(s),plugins:c.plugins.map(e=>e.name)},replay:{...e.replay,endpoint:s(e.replay.endpoint),headers:e.replay.headers!==null,plugins:e.replay.plugins.length,recordOptions:Object.keys(e.replay.recordOptions)}};return Reflect.deleteProperty(u,`headers`),i(n.n(u,a,o))}exports.configSummary=a;
2
- //# sourceMappingURL=debug-bundle-BXIlwDKM.cjs.map
1
+ const e=require("./guards-EjG3ahFp.cjs"),t=require("./platform-BZjp9wp1.cjs"),n=require("./sanitize-BZdhoghq.cjs"),r=require("./config-C0PtemvC.cjs");function i(n){return typeof n==`string`?/^[a-z][a-z\d+.-]*:\/\//i.test(n)?t.a(n,!1):n:Array.isArray(n)?n.map(i):e.n(n)?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,i(t)])):n}function a(e,a,o){let s=e=>typeof e==`string`?t.a(e,!1):e,{capture:c,serializer:l}=e,u={...e,endpoint:s(e.endpoint),metricsEndpoint:s(e.metricsEndpoint),tracesEndpoint:s(e.tracesEndpoint),serializer:typeof l==`string`?l:l.name,redact:e.redact===r.t?`refused`:e.redact,processors:e.processors.map(e=>e===r.t?`refused`:e),capture:{...c,ignoreUrls:c.ignoreUrls.map(s),plugins:c.plugins.map(e=>e.name)},replay:{...e.replay,endpoint:s(e.replay.endpoint),headers:e.replay.headers!==null,plugins:e.replay.plugins.length,recordOptions:Object.keys(e.replay.recordOptions)}};return Reflect.deleteProperty(u,`headers`),i(n.n(u,a,o))}exports.configSummary=a;
2
+ //# sourceMappingURL=debug-bundle-DMzUfiQc.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"debug-bundle-BXIlwDKM.cjs","names":["recordedUrl","isObject","REFUSE_RECORDS","sanitize","require_guards","require_platform","require_sanitize","require_config","stripUrls","value","key","entry","configSummary","cut","config","copy","serializer","hook","capture","plugin","limits","diagnostics"],"sources":["../src/core/debug-bundle.ts"],"sourcesContent":["// src/core/debug-bundle.ts\n//\n// Builds the config summary for a debug bundle. The runtime loads this module only when the\n// app asks for a bundle.\n\nimport type { ResolvedConfig } from \"../models/config\";\nimport { isObject } from \"../utils/guards\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { sanitize, type SanitizeLimits } from \"../utils/sanitize\";\nimport { REFUSE_RECORDS } from \"./config\";\nimport type { Diagnostics } from \"./diagnostics\";\n\n/**\n * Strips the user info, query and fragment from every absolute URL in a JSON-safe value. The\n * endpoints also end up in `capture.ignoreUrls`, where the library puts them.\n * @param value JSON-safe value.\n * @returns The value with every URL trimmed.\n */\nfunction stripUrls(value: unknown): unknown {\n if (typeof value === \"string\") {\n return /^[a-z][a-z\\d+.-]*:\\/\\//i.test(value) ? recordedUrl(value, false) : value;\n }\n\n if (Array.isArray(value)) {\n return value.map(stripUrls);\n }\n\n if (isObject(value)) {\n return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, stripUrls(entry)]));\n }\n\n return value;\n}\n\n/**\n * Copies the config for a support ticket, without the headers and with every URL trimmed. A\n * function becomes its name and a RegExp its text.\n * @param config Active configuration.\n * @param limits Limits for the copy, the same as for record attributes.\n * @param diagnostics Diagnostics reporter.\n * @returns JSON-safe copy of the config.\n */\nexport function configSummary(\n config: ResolvedConfig,\n limits: SanitizeLimits,\n diagnostics: Diagnostics,\n): Record<string, unknown> {\n // A relative endpoint has no scheme, so stripUrls() doesn't see it as a URL.\n const cut = (value: unknown): unknown =>\n typeof value === \"string\" ? recordedUrl(value, false) : value;\n const { capture, serializer } = config;\n const copy: Record<string, unknown> = {\n ...config,\n endpoint: cut(config.endpoint),\n metricsEndpoint: cut(config.metricsEndpoint),\n tracesEndpoint: cut(config.tracesEndpoint),\n // An object from the app can hold a key in any field, so only its name goes out.\n serializer: typeof serializer === \"string\" ? serializer : serializer.name,\n // The stand-in for a bad hook value shows as \"refused\", so the bundle says why nothing sends.\n redact: config.redact === REFUSE_RECORDS ? \"refused\" : config.redact,\n processors: config.processors.map((hook) => (hook === REFUSE_RECORDS ? \"refused\" : hook)),\n capture: {\n ...capture,\n ignoreUrls: capture.ignoreUrls.map(cut),\n plugins: capture.plugins.map((plugin) => plugin.name),\n },\n // The replay headers can carry a token, and recordOptions is the app's own object.\n replay: {\n ...config.replay,\n endpoint: cut(config.replay.endpoint),\n headers: config.replay.headers !== null,\n plugins: config.replay.plugins.length,\n recordOptions: Object.keys(config.replay.recordOptions),\n },\n };\n // Static headers can hold a token.\n Reflect.deleteProperty(copy, \"headers\");\n\n return stripUrls(sanitize(copy, limits, diagnostics)) as Record<string, unknown>;\n}\n"],"mappings":"A,sJAkBA,SAASQ,EAAU,EAAyB,CAa1C,OAZI,OAAOC,GAAU,SACZ,0BAA0B,KAAKA,CAAK,EAAIT,EAAAA,EAAYS,EAAO,EAAK,EAAIA,EAGzE,MAAM,QAAQA,CAAK,EACdA,EAAM,IAAID,CAAS,EAGxBP,EAAAA,EAASQ,CAAK,EACT,OAAO,YAAY,OAAO,QAAQA,CAAK,CAAC,CAAC,KAAK,CAACC,EAAKC,KAAW,CAACD,EAAKF,EAAUG,CAAK,CAAC,CAAC,CAAC,EAGzFF,CACT,CAUA,SAAgBG,EACd,EACA,EACA,EACyB,CAEzB,IAAMC,EAAO,GACX,OAAOJ,GAAU,SAAWT,EAAAA,EAAYS,EAAO,EAAK,EAAIA,EACpD,CAAE,UAAS,cAAeK,EAC1BC,EAAgC,CACpC,GAAGD,EACH,SAAUD,EAAIC,EAAO,QAAQ,EAC7B,gBAAiBD,EAAIC,EAAO,eAAe,EAC3C,eAAgBD,EAAIC,EAAO,cAAc,EAEzC,WAAY,OAAOE,GAAe,SAAWA,EAAaA,EAAW,KAErE,OAAQF,EAAO,SAAWZ,EAAAA,EAAiB,UAAYY,EAAO,OAC9D,WAAYA,EAAO,WAAW,IAAK,GAAUG,IAASf,EAAAA,EAAiB,UAAYe,CAAK,EACxF,QAAS,CACP,GAAGC,EACH,WAAYA,EAAQ,WAAW,IAAIL,CAAG,EACtC,QAASK,EAAQ,QAAQ,IAAK,GAAWC,EAAO,IAAI,CACtD,EAEA,OAAQ,CACN,GAAGL,EAAO,OACV,SAAUD,EAAIC,EAAO,OAAO,QAAQ,EACpC,QAASA,EAAO,OAAO,UAAY,KACnC,QAASA,EAAO,OAAO,QAAQ,OAC/B,cAAe,OAAO,KAAKA,EAAO,OAAO,aAAa,CACxD,CACF,EAIA,OAFA,QAAQ,eAAeC,EAAM,SAAS,EAE/BP,EAAUL,EAAAA,EAASY,EAAMK,EAAQC,CAAW,CAAC,CACtD,C"}
1
+ {"version":3,"file":"debug-bundle-DMzUfiQc.cjs","names":["recordedUrl","isObject","REFUSE_RECORDS","sanitize","require_guards","require_platform","require_sanitize","require_config","stripUrls","value","key","entry","configSummary","cut","config","copy","serializer","hook","capture","plugin","limits","diagnostics"],"sources":["../src/core/debug-bundle.ts"],"sourcesContent":["// src/core/debug-bundle.ts\n//\n// Builds the config summary for a debug bundle. The runtime loads this module only when the\n// app asks for a bundle.\n\nimport type { ResolvedConfig } from \"../models/config\";\nimport { isObject } from \"../utils/guards\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { sanitize, type SanitizeLimits } from \"../utils/sanitize\";\nimport { REFUSE_RECORDS } from \"./config\";\nimport type { Diagnostics } from \"./diagnostics\";\n\n/**\n * Strips the user info, query and fragment from every absolute URL in a JSON-safe value. The\n * endpoints also end up in `capture.ignoreUrls`, where the library puts them.\n * @param value JSON-safe value.\n * @returns The value with every URL trimmed.\n */\nfunction stripUrls(value: unknown): unknown {\n if (typeof value === \"string\") {\n return /^[a-z][a-z\\d+.-]*:\\/\\//i.test(value) ? recordedUrl(value, false) : value;\n }\n\n if (Array.isArray(value)) {\n return value.map(stripUrls);\n }\n\n if (isObject(value)) {\n return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, stripUrls(entry)]));\n }\n\n return value;\n}\n\n/**\n * Copies the config for a support ticket, without the headers and with every URL trimmed. A\n * function becomes its name and a RegExp its text.\n * @param config Active configuration.\n * @param limits Limits for the copy, the same as for record attributes.\n * @param diagnostics Diagnostics reporter.\n * @returns JSON-safe copy of the config.\n */\nexport function configSummary(\n config: ResolvedConfig,\n limits: SanitizeLimits,\n diagnostics: Diagnostics,\n): Record<string, unknown> {\n // A relative endpoint has no scheme, so stripUrls() doesn't see it as a URL.\n const cut = (value: unknown): unknown =>\n typeof value === \"string\" ? recordedUrl(value, false) : value;\n const { capture, serializer } = config;\n const copy: Record<string, unknown> = {\n ...config,\n endpoint: cut(config.endpoint),\n metricsEndpoint: cut(config.metricsEndpoint),\n tracesEndpoint: cut(config.tracesEndpoint),\n // An object from the app can hold a key in any field, so only its name goes out.\n serializer: typeof serializer === \"string\" ? serializer : serializer.name,\n // The stand-in for a bad hook value shows as \"refused\", so the bundle says why nothing sends.\n redact: config.redact === REFUSE_RECORDS ? \"refused\" : config.redact,\n processors: config.processors.map((hook) => (hook === REFUSE_RECORDS ? \"refused\" : hook)),\n capture: {\n ...capture,\n ignoreUrls: capture.ignoreUrls.map(cut),\n plugins: capture.plugins.map((plugin) => plugin.name),\n },\n // The replay headers can carry a token, and recordOptions is the app's own object.\n replay: {\n ...config.replay,\n endpoint: cut(config.replay.endpoint),\n headers: config.replay.headers !== null,\n plugins: config.replay.plugins.length,\n recordOptions: Object.keys(config.replay.recordOptions),\n },\n };\n // Static headers can hold a token.\n Reflect.deleteProperty(copy, \"headers\");\n\n return stripUrls(sanitize(copy, limits, diagnostics)) as Record<string, unknown>;\n}\n"],"mappings":"A,sJAkBA,SAASQ,EAAU,EAAyB,CAa1C,OAZI,OAAOC,GAAU,SACZ,0BAA0B,KAAKA,CAAK,EAAIT,EAAAA,EAAYS,EAAO,EAAK,EAAIA,EAGzE,MAAM,QAAQA,CAAK,EACdA,EAAM,IAAID,CAAS,EAGxBP,EAAAA,EAASQ,CAAK,EACT,OAAO,YAAY,OAAO,QAAQA,CAAK,CAAC,CAAC,KAAK,CAACC,EAAKC,KAAW,CAACD,EAAKF,EAAUG,CAAK,CAAC,CAAC,CAAC,EAGzFF,CACT,CAUA,SAAgBG,EACd,EACA,EACA,EACyB,CAEzB,IAAMC,EAAO,GACX,OAAOJ,GAAU,SAAWT,EAAAA,EAAYS,EAAO,EAAK,EAAIA,EACpD,CAAE,UAAS,cAAeK,EAC1BC,EAAgC,CACpC,GAAGD,EACH,SAAUD,EAAIC,EAAO,QAAQ,EAC7B,gBAAiBD,EAAIC,EAAO,eAAe,EAC3C,eAAgBD,EAAIC,EAAO,cAAc,EAEzC,WAAY,OAAOE,GAAe,SAAWA,EAAaA,EAAW,KAErE,OAAQF,EAAO,SAAWZ,EAAAA,EAAiB,UAAYY,EAAO,OAC9D,WAAYA,EAAO,WAAW,IAAK,GAAUG,IAASf,EAAAA,EAAiB,UAAYe,CAAK,EACxF,QAAS,CACP,GAAGC,EACH,WAAYA,EAAQ,WAAW,IAAIL,CAAG,EACtC,QAASK,EAAQ,QAAQ,IAAK,GAAWC,EAAO,IAAI,CACtD,EAEA,OAAQ,CACN,GAAGL,EAAO,OACV,SAAUD,EAAIC,EAAO,OAAO,QAAQ,EACpC,QAASA,EAAO,OAAO,UAAY,KACnC,QAASA,EAAO,OAAO,QAAQ,OAC/B,cAAe,OAAO,KAAKA,EAAO,OAAO,aAAa,CACxD,CACF,EAIA,OAFA,QAAQ,eAAeC,EAAM,SAAS,EAE/BP,EAAUL,EAAAA,EAASY,EAAMK,EAAQC,CAAW,CAAC,CACtD,C"}
@@ -1,7 +1,7 @@
1
1
  import { n as e } from "./guards-BlYGRK4l.js";
2
- import { i as t } from "./platform-BaaFIPCU.js";
3
- import { n } from "./sanitize-Ba0KqU06.js";
4
- import { t as r } from "./config-SgQcCP1_.js";
2
+ import { a as t } from "./platform-Dba6R3Hp.js";
3
+ import { n } from "./sanitize-B2GKlSFp.js";
4
+ import { t as r } from "./config-DK1Zf7jn.js";
5
5
  // src/core/debug-bundle.ts
6
6
  function i(n) {
7
7
  return typeof n == "string" ? /^[a-z][a-z\d+.-]*:\/\//i.test(n) ? t(n, !1) : n : Array.isArray(n) ? n.map(i) : e(n) ? Object.fromEntries(Object.entries(n).map(([e, t]) => [e, i(t)])) : n;
@@ -32,4 +32,4 @@ function a(e, a, o) {
32
32
  }
33
33
  export { a as configSummary };
34
34
 
35
- //# sourceMappingURL=debug-bundle-CRpYV_ui.js.map
35
+ //# sourceMappingURL=debug-bundle-w78W46zr.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"debug-bundle-CRpYV_ui.js","names":["isObject","recordedUrl","REFUSE_RECORDS","stripUrls","value","key","entry","configSummary","cut","config","copy","serializer","hook","capture","plugin","sanitize","limits","diagnostics"],"sources":["../src/core/debug-bundle.ts"],"sourcesContent":["// src/core/debug-bundle.ts\n//\n// Builds the config summary for a debug bundle. The runtime loads this module only when the\n// app asks for a bundle.\n\nimport type { ResolvedConfig } from \"../models/config\";\nimport { isObject } from \"../utils/guards\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { sanitize, type SanitizeLimits } from \"../utils/sanitize\";\nimport { REFUSE_RECORDS } from \"./config\";\nimport type { Diagnostics } from \"./diagnostics\";\n\n/**\n * Strips the user info, query and fragment from every absolute URL in a JSON-safe value. The\n * endpoints also end up in `capture.ignoreUrls`, where the library puts them.\n * @param value JSON-safe value.\n * @returns The value with every URL trimmed.\n */\nfunction stripUrls(value: unknown): unknown {\n if (typeof value === \"string\") {\n return /^[a-z][a-z\\d+.-]*:\\/\\//i.test(value) ? recordedUrl(value, false) : value;\n }\n\n if (Array.isArray(value)) {\n return value.map(stripUrls);\n }\n\n if (isObject(value)) {\n return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, stripUrls(entry)]));\n }\n\n return value;\n}\n\n/**\n * Copies the config for a support ticket, without the headers and with every URL trimmed. A\n * function becomes its name and a RegExp its text.\n * @param config Active configuration.\n * @param limits Limits for the copy, the same as for record attributes.\n * @param diagnostics Diagnostics reporter.\n * @returns JSON-safe copy of the config.\n */\nexport function configSummary(\n config: ResolvedConfig,\n limits: SanitizeLimits,\n diagnostics: Diagnostics,\n): Record<string, unknown> {\n // A relative endpoint has no scheme, so stripUrls() doesn't see it as a URL.\n const cut = (value: unknown): unknown =>\n typeof value === \"string\" ? recordedUrl(value, false) : value;\n const { capture, serializer } = config;\n const copy: Record<string, unknown> = {\n ...config,\n endpoint: cut(config.endpoint),\n metricsEndpoint: cut(config.metricsEndpoint),\n tracesEndpoint: cut(config.tracesEndpoint),\n // An object from the app can hold a key in any field, so only its name goes out.\n serializer: typeof serializer === \"string\" ? serializer : serializer.name,\n // The stand-in for a bad hook value shows as \"refused\", so the bundle says why nothing sends.\n redact: config.redact === REFUSE_RECORDS ? \"refused\" : config.redact,\n processors: config.processors.map((hook) => (hook === REFUSE_RECORDS ? \"refused\" : hook)),\n capture: {\n ...capture,\n ignoreUrls: capture.ignoreUrls.map(cut),\n plugins: capture.plugins.map((plugin) => plugin.name),\n },\n // The replay headers can carry a token, and recordOptions is the app's own object.\n replay: {\n ...config.replay,\n endpoint: cut(config.replay.endpoint),\n headers: config.replay.headers !== null,\n plugins: config.replay.plugins.length,\n recordOptions: Object.keys(config.replay.recordOptions),\n },\n };\n // Static headers can hold a token.\n Reflect.deleteProperty(copy, \"headers\");\n\n return stripUrls(sanitize(copy, limits, diagnostics)) as Record<string, unknown>;\n}\n"],"mappings":";;;;;AAkBA,SAASG,EAAU,GAAyB;CAa1C,OAZI,OAAOC,KAAU,WACZ,0BAA0B,KAAKA,CAAK,IAAIH,EAAYG,GAAO,EAAK,IAAIA,IAGzE,MAAM,QAAQA,CAAK,IACdA,EAAM,IAAID,CAAS,IAGxBH,EAASI,CAAK,IACT,OAAO,YAAY,OAAO,QAAQA,CAAK,CAAC,CAAC,KAAK,CAACC,GAAKC,OAAW,CAACD,GAAKF,EAAUG,CAAK,CAAC,CAAC,CAAC,IAGzFF;AACT;AAUA,SAAgBG,EACd,GACA,GACA,GACyB;CAEzB,IAAMC,KAAO,MACX,OAAOJ,KAAU,WAAWH,EAAYG,GAAO,EAAK,IAAIA,GACpD,EAAE,YAAS,kBAAeK,GAC1BC,IAAgC;EACpC,GAAGD;EACH,UAAUD,EAAIC,EAAO,QAAQ;EAC7B,iBAAiBD,EAAIC,EAAO,eAAe;EAC3C,gBAAgBD,EAAIC,EAAO,cAAc;EAEzC,YAAY,OAAOE,KAAe,WAAWA,IAAaA,EAAW;EAErE,QAAQF,EAAO,WAAWP,IAAiB,YAAYO,EAAO;EAC9D,YAAYA,EAAO,WAAW,KAAK,MAAUG,MAASV,IAAiB,YAAYU,CAAK;EACxF,SAAS;GACP,GAAGC;GACH,YAAYA,EAAQ,WAAW,IAAIL,CAAG;GACtC,SAASK,EAAQ,QAAQ,KAAK,MAAWC,EAAO,IAAI;EACtD;EAEA,QAAQ;GACN,GAAGL,EAAO;GACV,UAAUD,EAAIC,EAAO,OAAO,QAAQ;GACpC,SAASA,EAAO,OAAO,YAAY;GACnC,SAASA,EAAO,OAAO,QAAQ;GAC/B,eAAe,OAAO,KAAKA,EAAO,OAAO,aAAa;EACxD;CACF;CAIA,OAFA,QAAQ,eAAeC,GAAM,SAAS,GAE/BP,EAAUY,EAASL,GAAMM,GAAQC,CAAW,CAAC;AACtD"}
1
+ {"version":3,"file":"debug-bundle-w78W46zr.js","names":["isObject","recordedUrl","REFUSE_RECORDS","stripUrls","value","key","entry","configSummary","cut","config","copy","serializer","hook","capture","plugin","sanitize","limits","diagnostics"],"sources":["../src/core/debug-bundle.ts"],"sourcesContent":["// src/core/debug-bundle.ts\n//\n// Builds the config summary for a debug bundle. The runtime loads this module only when the\n// app asks for a bundle.\n\nimport type { ResolvedConfig } from \"../models/config\";\nimport { isObject } from \"../utils/guards\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { sanitize, type SanitizeLimits } from \"../utils/sanitize\";\nimport { REFUSE_RECORDS } from \"./config\";\nimport type { Diagnostics } from \"./diagnostics\";\n\n/**\n * Strips the user info, query and fragment from every absolute URL in a JSON-safe value. The\n * endpoints also end up in `capture.ignoreUrls`, where the library puts them.\n * @param value JSON-safe value.\n * @returns The value with every URL trimmed.\n */\nfunction stripUrls(value: unknown): unknown {\n if (typeof value === \"string\") {\n return /^[a-z][a-z\\d+.-]*:\\/\\//i.test(value) ? recordedUrl(value, false) : value;\n }\n\n if (Array.isArray(value)) {\n return value.map(stripUrls);\n }\n\n if (isObject(value)) {\n return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, stripUrls(entry)]));\n }\n\n return value;\n}\n\n/**\n * Copies the config for a support ticket, without the headers and with every URL trimmed. A\n * function becomes its name and a RegExp its text.\n * @param config Active configuration.\n * @param limits Limits for the copy, the same as for record attributes.\n * @param diagnostics Diagnostics reporter.\n * @returns JSON-safe copy of the config.\n */\nexport function configSummary(\n config: ResolvedConfig,\n limits: SanitizeLimits,\n diagnostics: Diagnostics,\n): Record<string, unknown> {\n // A relative endpoint has no scheme, so stripUrls() doesn't see it as a URL.\n const cut = (value: unknown): unknown =>\n typeof value === \"string\" ? recordedUrl(value, false) : value;\n const { capture, serializer } = config;\n const copy: Record<string, unknown> = {\n ...config,\n endpoint: cut(config.endpoint),\n metricsEndpoint: cut(config.metricsEndpoint),\n tracesEndpoint: cut(config.tracesEndpoint),\n // An object from the app can hold a key in any field, so only its name goes out.\n serializer: typeof serializer === \"string\" ? serializer : serializer.name,\n // The stand-in for a bad hook value shows as \"refused\", so the bundle says why nothing sends.\n redact: config.redact === REFUSE_RECORDS ? \"refused\" : config.redact,\n processors: config.processors.map((hook) => (hook === REFUSE_RECORDS ? \"refused\" : hook)),\n capture: {\n ...capture,\n ignoreUrls: capture.ignoreUrls.map(cut),\n plugins: capture.plugins.map((plugin) => plugin.name),\n },\n // The replay headers can carry a token, and recordOptions is the app's own object.\n replay: {\n ...config.replay,\n endpoint: cut(config.replay.endpoint),\n headers: config.replay.headers !== null,\n plugins: config.replay.plugins.length,\n recordOptions: Object.keys(config.replay.recordOptions),\n },\n };\n // Static headers can hold a token.\n Reflect.deleteProperty(copy, \"headers\");\n\n return stripUrls(sanitize(copy, limits, diagnostics)) as Record<string, unknown>;\n}\n"],"mappings":";;;;;AAkBA,SAASG,EAAU,GAAyB;CAa1C,OAZI,OAAOC,KAAU,WACZ,0BAA0B,KAAKA,CAAK,IAAIH,EAAYG,GAAO,EAAK,IAAIA,IAGzE,MAAM,QAAQA,CAAK,IACdA,EAAM,IAAID,CAAS,IAGxBH,EAASI,CAAK,IACT,OAAO,YAAY,OAAO,QAAQA,CAAK,CAAC,CAAC,KAAK,CAACC,GAAKC,OAAW,CAACD,GAAKF,EAAUG,CAAK,CAAC,CAAC,CAAC,IAGzFF;AACT;AAUA,SAAgBG,EACd,GACA,GACA,GACyB;CAEzB,IAAMC,KAAO,MACX,OAAOJ,KAAU,WAAWH,EAAYG,GAAO,EAAK,IAAIA,GACpD,EAAE,YAAS,kBAAeK,GAC1BC,IAAgC;EACpC,GAAGD;EACH,UAAUD,EAAIC,EAAO,QAAQ;EAC7B,iBAAiBD,EAAIC,EAAO,eAAe;EAC3C,gBAAgBD,EAAIC,EAAO,cAAc;EAEzC,YAAY,OAAOE,KAAe,WAAWA,IAAaA,EAAW;EAErE,QAAQF,EAAO,WAAWP,IAAiB,YAAYO,EAAO;EAC9D,YAAYA,EAAO,WAAW,KAAK,MAAUG,MAASV,IAAiB,YAAYU,CAAK;EACxF,SAAS;GACP,GAAGC;GACH,YAAYA,EAAQ,WAAW,IAAIL,CAAG;GACtC,SAASK,EAAQ,QAAQ,KAAK,MAAWC,EAAO,IAAI;EACtD;EAEA,QAAQ;GACN,GAAGL,EAAO;GACV,UAAUD,EAAIC,EAAO,OAAO,QAAQ;GACpC,SAASA,EAAO,OAAO,YAAY;GACnC,SAASA,EAAO,OAAO,QAAQ;GAC/B,eAAe,OAAO,KAAKA,EAAO,OAAO,aAAa;EACxD;CACF;CAIA,OAFA,QAAQ,eAAeC,GAAM,SAAS,GAE/BP,EAAUY,EAASL,GAAMM,GAAQC,CAAW,CAAC;AACtD"}
package/dist/doctor.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./constants-CqdJhTxH.cjs"),t=require("./compression-CvED_Jel.cjs"),n=require("./otlp-BENHf3g9.cjs");var r=1e4,i=0,a=1,o=2,s=`Usage: uiobs doctor <url> --origin <origin> [--replay] [--credentials include] [--header "Name: value"]. An origin has no path and no trailing slash. With --replay, the URL is a replay endpoint. With --credentials include, a * in a CORS header fails.`,c=`--header`,l=`--replay`,u=`--credentials`,d=`include`,f=5e6,p=5,m=`uiobs-doctor`,h=/^([\w!#$%&'*+.^`|~-]+): *([\x20-\x7e]+)$/,g=`<hidden>`,_=`Access-Control-Expose-Headers`,v=`Access-Control-Allow-Origin`,y=`Access-Control-Allow-Headers`,b=`Access-Control-Allow-Credentials`,x=`A browser refuses * with credentials: "include".`,S=`A browser does not read * as a wildcard with credentials: "include".`,C=`A browser never lets * cover authorization.`,w=`Add --credentials include to check that case.`,T=[e.ft,e.dt,e.ut,e.lt].map(e=>e.toLowerCase()),E=[...T,`origin`],D=[e.ht,e.pt].map(e=>e.toLowerCase()),O=`authorization`,k=[e.mt.toLowerCase()],A=[...k,...D];function j(){let t=crypto.randomUUID().replaceAll(`-`,``);return{timeUnixNano:`${String(Date.now())}000000`,traceId:t,spanId:t.slice(0,16),traceFlags:1,severityNumber:e.Vn.INFO,severityText:`INFO`,body:`uiobs doctor test record`,attributes:{},resource:{"service.name":m}}}async function M(e,t,n=r){try{return await fetch(e,{...t,redirect:`manual`,signal:AbortSignal.timeout(n)})}catch(e){let t=e instanceof Error?e.cause??e:e;return`The request failed. ${t instanceof Error?t.message:String(t)}`}}function N(e,t){return(e.headers.get(t)??``).toLowerCase().split(`,`).map(e=>e.trim())}function P(e,t,n,r){let i=N(e,t),a=r&&i.includes(`*`);return n.filter(e=>!i.includes(e)&&!(a&&e!==O))}var F=e=>e.ok?void 0:`The server returned ${String(e.status)}.`,I=e=>e.status===415?`The server returned ${String(e.status)} to a text/plain batch, as a stock OpenTelemetry Collector does. The library loses the exit batches of a page on another origin. Set headers in the app, or put a same-origin proxy in front of the server.`:void 0;function L(e,t,n,...r){let i=typeof t==`string`?t:r.map(e=>e(t)).find(e=>e!==void 0);return{rule:e,pass:i===void 0,detail:i??n}}function R(e,t,n,r){let i=Object.keys(n).map(e=>e.toLowerCase());return{url:e,origin:t,custom:n,requestHeaders:[...T,...i],credentials:r}}function z({origin:e,credentials:t}){return n=>{let r=n.headers.get(v);return r===`*`&&t?`${v} is *. ${x} It must be ${e}.`:r!==e&&r!==`*`?`${v} is ${String(r)}. It must allow ${e}.`:t?B(n):void 0}}var B=e=>{let t=e.headers.get(b);return t===`true`?void 0:`${b} is ${String(t)}. It must be true with credentials: "include".`};function V(e){return typeof e==`string`?null:e.headers.get(v)}function H(e,{credentials:t},n=x){return e&&!t?` ${n} ${w}`:``}function U(e,t,{credentials:n}){return n&&N(e,t).includes(`*`)?` ${S}`:``}function W(e,t,n){return typeof e!=`string`&&N(e,t).includes(`*`)&&P(e,t,n,!1).length>0}function G({url:e,origin:t,requestHeaders:n}){return M(e,{method:`OPTIONS`,headers:{Origin:t,"Access-Control-Request-Method":`POST`,"Access-Control-Request-Headers":n.join(`, `)}})}function K(e,t){let n=H(V(e)===`*`,t),r=H(W(e,y,t.requestHeaders),t,S);return[L(`preflight`,e,`The server permits POST from this origin.${n}`,F,z(t)),L(`allowed headers`,e,`The server allows each request header of the library.${r}`,e=>{let n=P(e,y,t.requestHeaders,!t.credentials);if(n.length===0)return;let r=U(e,y,t),i=n.includes(O)&&N(e,y).includes(`*`)?` ${C}`:``;return`${y} must include ${n.join(`, `)}.${r}${i}`})]}function q({url:t,origin:n,custom:r},i,a){return(o,s,c,l={})=>M(t,{method:`POST`,headers:{...r,Origin:n,[e.ft]:i,[e.ut]:o,[e.lt]:String(s),...l},body:c},a)}async function J(n,r,i){let a=await t.t(i);return a?n(r,0,a,{[e.dt]:e.tt}):`This Node version has no CompressionStream.`}async function Y(t,r,i={},a=!1){let o=R(t,r,i,a),s=z(o),c=await G(o),{body:l,contentType:u}=n.r.serialize([j()]),d=q(o,u),f=crypto.randomUUID(),p=await d(f,0,l),m=await d(f,1,l),h=await J(d,crypto.randomUUID(),l),g=new URL(t);g.searchParams.set(e.nn,crypto.randomUUID()),g.searchParams.set(e.rn,`pagehide`);let v=o.requestHeaders.length>T.length?void 0:await M(g.toString(),{method:`POST`,headers:{Origin:r,[e.ft]:e.V},body:l}),y=typeof p==`string`?[]:P(p,_,D,!o.credentials),b=y.length>0?` Optional headers stay hidden: ${y.join(`, `)}.`:``,x=H(W(p,_,A),o,S);return[...K(c,o),L(`test batch`,p,`The server accepted a test batch.${H(V(p)===`*`,o)}`,F,s),L(`exposed headers`,p,`The server exposes Retry-After.${b}${x}`,e=>P(e,_,k,!o.credentials).length===0?void 0:`${_} must include retry-after.${U(e,_,o)}`),L(`gzip`,h,`The server accepted a gzip batch.`,F),L(`deduplication`,m,`The server accepted a repeated batch id. A client cannot see if it stored the batch again.`,F),v===void 0?{rule:`beacon`,pass:!0,detail:`The library sends no beacon with custom headers. The tool sent no beacon.`}:L(`beacon`,v,`The server accepted a text/plain batch.`,I,F)]}async function X(t,n,r={},i=!1){let a=R(t,n,r,i),o=z(a),s=await G(a),c=crypto.randomUUID(),l={"replay.id":c,"session.id":crypto.randomUUID(),"tab.id":crypto.randomUUID(),"service.name":m},u=(e,t)=>{let n=[{type:p,timestamp:Date.now(),data:{tag:m,payload:t}}];return JSON.stringify({...l,sequence:e,bytes:JSON.stringify(n).length,events:n})},d=e=>`${c}-${String(e)}`,h=q(a,e.z),g=u(0,`uiobs doctor test event`),_=await h(d(0),0,g),v=await h(d(0),1,g),y=await J(h,d(1),u(1,`uiobs doctor gzip event`)),b=await q(a,e.z,e.pn)(d(2),0,u(2,`x`.repeat(f)));return[...K(s,a),L(`test segment`,_,`The server accepted a test segment.${H(V(_)===`*`,a)}`,F,o),L(`gzip`,y,`The server accepted a gzip segment.`,F),L(`large segment`,b,`The server accepted a segment of ${String(f)} bytes without gzip.`,e=>e.ok?void 0:`The server returned ${String(e.status)} for a segment of ${String(f)} bytes. The first segment of an upload has a full snapshot of the page. Raise the body limit of the server.`),L(`deduplication`,v,`The server accepted a repeated batch id. A client cannot see if it stored the segment again.`,F)]}function Z(e){let t=[],n=!1;for(let r=0;r<e.length;r+=2){if(e[r]===u&&e[r+1]===d){n=!0;continue}let i=e[r]===c?h.exec(e[r+1]):null;if(!i||E.includes(i[1].toLowerCase()))return;t.push([i[1],i[2]])}return{headers:Object.fromEntries(t),credentials:n}}function Q(e){if(!/^https?:\/\//i.test(e)||!URL.canParse(e))return!1;let{username:t,password:n}=new URL(e);return t===``&&n===``}var $=[`doctor`,`--origin`,l,c,u,d];function ee(e){if($.includes(e))return e;if(/^https?:\/\//i.test(e)&&URL.canParse(e)){let{origin:t,pathname:n}=new URL(e);return`${t}${n===`/`&&!e.endsWith(`/`)?``:n}`}return g}function te(e){return URL.canParse(e)&&new URL(e).origin===e}async function ne(e,t){let[n,r,c,u,...d]=e,f=d[0]===l,p=Z(f?d.slice(1):d);if(n!==`doctor`||c!==`--origin`||!Q(r)||!te(u)||!p)return t(s),t(`Received: ${JSON.stringify(e.map(ee))}`),o;let{headers:m,credentials:h}=p,g=await(f?X:Y)(r,u,m,h);for(let{rule:e,pass:n,detail:r}of g)t(`${n?`PASS`:`FAIL`} ${e}: ${r}`);return g.every(({pass:e})=>e)?i:a}exports.main=ne,exports.runDoctor=Y,exports.runReplayDoctor=X;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./constants-NtiQDWL_.cjs"),t=require("./compression-CEVe7NPX.cjs"),n=require("./otlp-CFSW-Dno.cjs");var r=1e4,i=0,a=1,o=2,s=`Usage: uiobs doctor <url> --origin <origin> [--replay] [--credentials include] [--header "Name: value"]. An origin has no path and no trailing slash. With --replay, the URL is a replay endpoint. With --credentials include, a * in a CORS header fails.`,c=`--header`,l=`--replay`,u=`--credentials`,d=`include`,f=5e6,p=5,m=`uiobs-doctor`,h=/^([\w!#$%&'*+.^`|~-]+): *([\x20-\x7e]+)$/,g=`<hidden>`,_=`Access-Control-Expose-Headers`,v=`Access-Control-Allow-Origin`,y=`Access-Control-Allow-Headers`,b=`Access-Control-Allow-Credentials`,x=`A browser refuses * with credentials: "include".`,S=`A browser does not read * as a wildcard with credentials: "include".`,C=`A browser never lets * cover authorization.`,w=`Add --credentials include to check that case.`,T=[e.pt,e.ft,e.dt,e.ut].map(e=>e.toLowerCase()),E=[...T,`origin`],D=[e.gt,e.mt].map(e=>e.toLowerCase()),O=`authorization`,k=[e.ht.toLowerCase()],A=[...k,...D];function j(){let t=crypto.randomUUID().replaceAll(`-`,``);return{timeUnixNano:`${String(Date.now())}000000`,traceId:t,spanId:t.slice(0,16),traceFlags:1,severityNumber:e.Gn.INFO,severityText:`INFO`,body:`uiobs doctor test record`,attributes:{},resource:{"service.name":m}}}async function M(e,t,n=r){try{return await fetch(e,{...t,redirect:`manual`,signal:AbortSignal.timeout(n)})}catch(e){let t=e instanceof Error?e.cause??e:e;return`The request failed. ${t instanceof Error?t.message:String(t)}`}}function N(e,t){return(e.headers.get(t)??``).toLowerCase().split(`,`).map(e=>e.trim())}function P(e,t,n,r){let i=N(e,t),a=r&&i.includes(`*`);return n.filter(e=>!i.includes(e)&&!(a&&e!==O))}var F=e=>e.ok?void 0:`The server returned ${String(e.status)}.`,I=e=>e.status===415?`The server returned ${String(e.status)} to a text/plain batch, as a stock OpenTelemetry Collector does. The library loses the exit batches of a page on another origin. Set headers in the app, or put a same-origin proxy in front of the server.`:void 0;function L(e,t,n,...r){let i=typeof t==`string`?t:r.map(e=>e(t)).find(e=>e!==void 0);return{rule:e,pass:i===void 0,detail:i??n}}function R(e,t,n,r){let i=Object.keys(n).map(e=>e.toLowerCase());return{url:e,origin:t,custom:n,requestHeaders:[...T,...i],credentials:r}}function z({origin:e,credentials:t}){return n=>{let r=n.headers.get(v);return r===`*`&&t?`${v} is *. ${x} It must be ${e}.`:r!==e&&r!==`*`?`${v} is ${String(r)}. It must allow ${e}.`:t?B(n):void 0}}var B=e=>{let t=e.headers.get(b);return t===`true`?void 0:`${b} is ${String(t)}. It must be true with credentials: "include".`};function V(e){return typeof e==`string`?null:e.headers.get(v)}function H(e,{credentials:t},n=x){return e&&!t?` ${n} ${w}`:``}function U(e,t,{credentials:n}){return n&&N(e,t).includes(`*`)?` ${S}`:``}function W(e,t,n){return typeof e!=`string`&&N(e,t).includes(`*`)&&P(e,t,n,!1).length>0}function G({url:e,origin:t,requestHeaders:n}){return M(e,{method:`OPTIONS`,headers:{Origin:t,"Access-Control-Request-Method":`POST`,"Access-Control-Request-Headers":n.join(`, `)}})}function K(e,t){let n=H(V(e)===`*`,t),r=H(W(e,y,t.requestHeaders),t,S);return[L(`preflight`,e,`The server permits POST from this origin.${n}`,F,z(t)),L(`allowed headers`,e,`The server allows each request header of the library.${r}`,e=>{let n=P(e,y,t.requestHeaders,!t.credentials);if(n.length===0)return;let r=U(e,y,t),i=n.includes(O)&&N(e,y).includes(`*`)?` ${C}`:``;return`${y} must include ${n.join(`, `)}.${r}${i}`})]}function q({url:t,origin:n,custom:r},i,a){return(o,s,c,l={})=>M(t,{method:`POST`,headers:{...r,Origin:n,[e.pt]:i,[e.dt]:o,[e.ut]:String(s),...l},body:c},a)}async function J(n,r,i){let a=await t.t(i);return a?n(r,0,a,{[e.ft]:e.nt}):`This Node version has no CompressionStream.`}async function Y(t,r,i={},a=!1){let o=R(t,r,i,a),s=z(o),c=await G(o),{body:l,contentType:u}=n.r.serialize([j()]),d=q(o,u),f=crypto.randomUUID(),p=await d(f,0,l),m=await d(f,1,l),h=await J(d,crypto.randomUUID(),l),g=new URL(t);g.searchParams.set(e.an,crypto.randomUUID()),g.searchParams.set(e.on,`pagehide`);let v=o.requestHeaders.length>T.length?void 0:await M(g.toString(),{method:`POST`,headers:{Origin:r,[e.pt]:e.V},body:l}),y=typeof p==`string`?[]:P(p,_,D,!o.credentials),b=y.length>0?` Optional headers stay hidden: ${y.join(`, `)}.`:``,x=H(W(p,_,A),o,S);return[...K(c,o),L(`test batch`,p,`The server accepted a test batch.${H(V(p)===`*`,o)}`,F,s),L(`exposed headers`,p,`The server exposes Retry-After.${b}${x}`,e=>P(e,_,k,!o.credentials).length===0?void 0:`${_} must include retry-after.${U(e,_,o)}`),L(`gzip`,h,`The server accepted a gzip batch.`,F),L(`deduplication`,m,`The server accepted a repeated batch id. A client cannot see if it stored the batch again.`,F),v===void 0?{rule:`beacon`,pass:!0,detail:`The library sends no beacon with custom headers. The tool sent no beacon.`}:L(`beacon`,v,`The server accepted a text/plain batch.`,I,F)]}async function X(t,n,r={},i=!1){let a=R(t,n,r,i),o=z(a),s=await G(a),c=crypto.randomUUID(),l={"replay.id":c,"session.id":crypto.randomUUID(),"tab.id":crypto.randomUUID(),"service.name":m},u=(e,t)=>{let n=[{type:p,timestamp:Date.now(),data:{tag:m,payload:t}}];return JSON.stringify({...l,sequence:e,bytes:JSON.stringify(n).length,events:n})},d=e=>`${c}-${String(e)}`,h=q(a,e.z),g=u(0,`uiobs doctor test event`),_=await h(d(0),0,g),v=await h(d(0),1,g),y=await J(h,d(1),u(1,`uiobs doctor gzip event`)),b=await q(a,e.z,e._n)(d(2),0,u(2,`x`.repeat(f)));return[...K(s,a),L(`test segment`,_,`The server accepted a test segment.${H(V(_)===`*`,a)}`,F,o),L(`gzip`,y,`The server accepted a gzip segment.`,F),L(`large segment`,b,`The server accepted a segment of ${String(f)} bytes without gzip.`,e=>e.ok?void 0:`The server returned ${String(e.status)} for a segment of ${String(f)} bytes. The first segment of an upload has a full snapshot of the page. Raise the body limit of the server.`),L(`deduplication`,v,`The server accepted a repeated batch id. A client cannot see if it stored the segment again.`,F)]}function Z(e){let t=[],n=!1;for(let r=0;r<e.length;r+=2){if(e[r]===u&&e[r+1]===d){n=!0;continue}let i=e[r]===c?h.exec(e[r+1]):null;if(!i||E.includes(i[1].toLowerCase()))return;t.push([i[1],i[2]])}return{headers:Object.fromEntries(t),credentials:n}}function Q(e){if(!/^https?:\/\//i.test(e)||!URL.canParse(e))return!1;let{username:t,password:n}=new URL(e);return t===``&&n===``}var $=[`doctor`,`--origin`,l,c,u,d];function ee(e){if($.includes(e))return e;if(/^https?:\/\//i.test(e)&&URL.canParse(e)){let{origin:t,pathname:n}=new URL(e);return`${t}${n===`/`&&!e.endsWith(`/`)?``:n}`}return g}function te(e){return URL.canParse(e)&&new URL(e).origin===e}async function ne(e,t){let[n,r,c,u,...d]=e,f=d[0]===l,p=Z(f?d.slice(1):d);if(n!==`doctor`||c!==`--origin`||!Q(r)||!te(u)||!p)return t(s),t(`Received: ${JSON.stringify(e.map(ee))}`),o;let{headers:m,credentials:h}=p,g=await(f?X:Y)(r,u,m,h);for(let{rule:e,pass:n,detail:r}of g)t(`${n?`PASS`:`FAIL`} ${e}: ${r}`);return g.every(({pass:e})=>e)?i:a}exports.main=ne,exports.runDoctor=Y,exports.runReplayDoctor=X;
2
2
  //# sourceMappingURL=doctor.cjs.map