@utk09/ui-observability 0.12.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (515) hide show
  1. package/CHANGELOG.md +420 -0
  2. package/README.md +72 -839
  3. package/dist/{batch-BjQUwjA6.js → batch-CXmPmTse.js} +4 -4
  4. package/dist/{batch-BjQUwjA6.js.map → batch-CXmPmTse.js.map} +1 -1
  5. package/dist/{batch-D5LlU4Q9.cjs → batch-mmPigCpi.cjs} +2 -2
  6. package/dist/{batch-D5LlU4Q9.cjs.map → batch-mmPigCpi.cjs.map} +1 -1
  7. package/dist/bus/bus.d.cts +331 -0
  8. package/dist/bus/bus.d.ts +60 -10
  9. package/dist/bus/links.d.cts +132 -0
  10. package/dist/bus/links.d.ts +18 -3
  11. package/dist/bus/validation.d.cts +16 -0
  12. package/dist/bus/validation.d.ts +10 -1
  13. package/dist/{bus-ecxUNTja.js → bus-C39wspFV.js} +308 -193
  14. package/dist/bus-C39wspFV.js.map +1 -0
  15. package/dist/bus-_EaOVPGq.cjs +2 -0
  16. package/dist/bus-_EaOVPGq.cjs.map +1 -0
  17. package/dist/capture/console.d.cts +37 -0
  18. package/dist/capture/console.d.ts +1 -1
  19. package/dist/capture/errors.d.cts +32 -0
  20. package/dist/capture/errors.d.ts +1 -1
  21. package/dist/capture/interactions.d.cts +48 -0
  22. package/dist/capture/interactions.d.ts +1 -1
  23. package/dist/capture/lifecycle.d.cts +20 -0
  24. package/dist/capture/lifecycle.d.ts +1 -1
  25. package/dist/capture/long-frames.d.cts +31 -0
  26. package/dist/capture/long-frames.d.ts +1 -1
  27. package/dist/capture/network.d.cts +57 -0
  28. package/dist/capture/network.d.ts +1 -1
  29. package/dist/capture/profiler-frames.d.cts +44 -0
  30. package/dist/capture/profiler-frames.d.ts +1 -1
  31. package/dist/capture/replay-buffer.d.cts +45 -0
  32. package/dist/capture/replay-buffer.d.ts +9 -10
  33. package/dist/capture/replay-upload.d.cts +79 -0
  34. package/dist/capture/replay-upload.d.ts +7 -2
  35. package/dist/capture/replay.d.cts +114 -0
  36. package/dist/capture/replay.d.ts +1 -1
  37. package/dist/capture/reports.d.cts +17 -0
  38. package/dist/capture/reports.d.ts +1 -1
  39. package/dist/capture/resource-timing.d.cts +14 -0
  40. package/dist/capture/resource-timing.d.ts +1 -1
  41. package/dist/capture/server-timing.d.cts +19 -0
  42. package/dist/capture/storm.d.cts +13 -0
  43. package/dist/capture/storm.d.ts +5 -5
  44. package/dist/capture/types.d.cts +128 -0
  45. package/dist/capture/types.d.ts +10 -9
  46. package/dist/capture/unclean-exit.d.cts +31 -0
  47. package/dist/capture/unclean-exit.d.ts +1 -1
  48. package/dist/capture/user-timing.d.cts +22 -0
  49. package/dist/capture/user-timing.d.ts +2 -2
  50. package/dist/capture/web-socket.d.cts +40 -0
  51. package/dist/capture/web-socket.d.ts +3 -3
  52. package/dist/capture/web-vitals.d.cts +40 -0
  53. package/dist/capture/web-vitals.d.ts +1 -1
  54. package/dist/{compression-lD9abCcO.cjs → compression-CvED_Jel.cjs} +2 -2
  55. package/dist/{compression-lD9abCcO.cjs.map → compression-CvED_Jel.cjs.map} +1 -1
  56. package/dist/{compression-AJJCMBOa.js → compression-tVtXwVjX.js} +2 -2
  57. package/dist/{compression-AJJCMBOa.js.map → compression-tVtXwVjX.js.map} +1 -1
  58. package/dist/config-DUs7uHHt.cjs +2 -0
  59. package/dist/config-DUs7uHHt.cjs.map +1 -0
  60. package/dist/config-SgQcCP1_.js +560 -0
  61. package/dist/config-SgQcCP1_.js.map +1 -0
  62. package/dist/console-BGgGnjSi.js +81 -0
  63. package/dist/console-BGgGnjSi.js.map +1 -0
  64. package/dist/console-CSZ5_Vx5.cjs +2 -0
  65. package/dist/console-CSZ5_Vx5.cjs.map +1 -0
  66. package/dist/constants-CUyd9cTZ.js +357 -0
  67. package/dist/constants-CUyd9cTZ.js.map +1 -0
  68. package/dist/constants-CqdJhTxH.cjs +2 -0
  69. package/dist/constants-CqdJhTxH.cjs.map +1 -0
  70. package/dist/constants.d.cts +751 -0
  71. package/dist/constants.d.ts +88 -20
  72. package/dist/core/breadcrumbs.d.cts +54 -0
  73. package/dist/core/breadcrumbs.d.ts +5 -0
  74. package/dist/core/config.d.cts +45 -0
  75. package/dist/core/config.d.ts +30 -2
  76. package/dist/core/context.d.cts +24 -0
  77. package/dist/core/context.d.ts +3 -8
  78. package/dist/core/debug-buffer.d.cts +34 -0
  79. package/dist/core/debug-buffer.d.ts +3 -3
  80. package/dist/core/debug-bundle.d.cts +12 -0
  81. package/dist/core/debug-bundle.d.ts +3 -3
  82. package/dist/core/deferred.d.cts +7 -0
  83. package/dist/core/deferred.d.ts +2 -2
  84. package/dist/core/diagnostics.d.cts +86 -0
  85. package/dist/core/diagnostics.d.ts +1 -1
  86. package/dist/core/drops.d.cts +39 -0
  87. package/dist/core/drops.d.ts +16 -6
  88. package/dist/core/hold-buffer.d.cts +36 -0
  89. package/dist/core/hold-buffer.d.ts +16 -7
  90. package/dist/core/journey.d.cts +148 -0
  91. package/dist/core/journey.d.ts +7 -7
  92. package/dist/core/logger.d.cts +141 -0
  93. package/dist/core/logger.d.ts +23 -30
  94. package/dist/core/measure.d.cts +30 -0
  95. package/dist/core/measure.d.ts +14 -3
  96. package/dist/core/meter.d.cts +78 -0
  97. package/dist/core/meter.d.ts +14 -8
  98. package/dist/core/pipeline.d.cts +227 -0
  99. package/dist/core/pipeline.d.ts +73 -10
  100. package/dist/core/profile-buckets.d.cts +31 -0
  101. package/dist/core/profiler.d.cts +218 -0
  102. package/dist/core/profiler.d.ts +2 -2
  103. package/dist/core/record.d.cts +190 -0
  104. package/dist/core/record.d.ts +44 -12
  105. package/dist/core/remote-rules.d.cts +17 -0
  106. package/dist/core/remote-rules.d.ts +3 -3
  107. package/dist/core/remote-sampling.d.cts +74 -0
  108. package/dist/core/remote-sampling.d.ts +3 -3
  109. package/dist/core/rotation.d.cts +75 -0
  110. package/dist/core/rotation.d.ts +75 -0
  111. package/dist/core/runtime.d.cts +765 -0
  112. package/dist/core/runtime.d.ts +245 -70
  113. package/dist/core/sampling.d.cts +86 -0
  114. package/dist/core/sampling.d.ts +5 -5
  115. package/dist/core/sender.d.cts +161 -0
  116. package/dist/core/sender.d.ts +59 -15
  117. package/dist/core/spans.d.cts +39 -0
  118. package/dist/core/spans.d.ts +1 -1
  119. package/dist/debug-bundle-BXIlwDKM.cjs +2 -0
  120. package/dist/debug-bundle-BXIlwDKM.cjs.map +1 -0
  121. package/dist/debug-bundle-CRpYV_ui.js +35 -0
  122. package/dist/debug-bundle-CRpYV_ui.js.map +1 -0
  123. package/dist/defineProperty-X1c4tIPD.cjs +1 -0
  124. package/dist/defineProperty-s2S8BXUc.js +35 -0
  125. package/dist/doctor.cjs +1 -1
  126. package/dist/doctor.cjs.map +1 -1
  127. package/dist/doctor.d.cts +36 -0
  128. package/dist/doctor.d.ts +5 -2
  129. package/dist/doctor.js +121 -89
  130. package/dist/doctor.js.map +1 -1
  131. package/dist/errors-BE_EZV7Q.js +86 -0
  132. package/dist/errors-BE_EZV7Q.js.map +1 -0
  133. package/dist/errors-CNPbesMs.cjs +3 -0
  134. package/dist/errors-CNPbesMs.cjs.map +1 -0
  135. package/dist/factory-CTi0Is3F.js +404 -0
  136. package/dist/factory-CTi0Is3F.js.map +1 -0
  137. package/dist/factory-hRrH32v5.cjs +2 -0
  138. package/dist/factory-hRrH32v5.cjs.map +1 -0
  139. package/dist/guards-BlYGRK4l.js +10 -0
  140. package/dist/guards-BlYGRK4l.js.map +1 -0
  141. package/dist/guards-EjG3ahFp.cjs +2 -0
  142. package/dist/guards-EjG3ahFp.cjs.map +1 -0
  143. package/dist/{identity-BrQp_5J5.js → identity-DdhKgrpk.js} +20 -24
  144. package/dist/identity-DdhKgrpk.js.map +1 -0
  145. package/dist/identity-DlWRIuwy.cjs +2 -0
  146. package/dist/identity-DlWRIuwy.cjs.map +1 -0
  147. package/dist/index.cjs +1 -1
  148. package/dist/index.cjs.map +1 -1
  149. package/dist/index.d.cts +300 -0
  150. package/dist/index.d.ts +89 -98
  151. package/dist/index.js +1173 -1506
  152. package/dist/index.js.map +1 -1
  153. package/dist/indexeddb-storage-CL9uqBCy.cjs +2 -0
  154. package/dist/indexeddb-storage-CL9uqBCy.cjs.map +1 -0
  155. package/dist/{indexeddb-storage-DLXQzAGh.js → indexeddb-storage-GHdl0t8A.js} +51 -47
  156. package/dist/indexeddb-storage-GHdl0t8A.js.map +1 -0
  157. package/dist/interactions-CUkzK8sR.cjs +2 -0
  158. package/dist/interactions-CUkzK8sR.cjs.map +1 -0
  159. package/dist/{interactions-B6z2I4tU.js → interactions-DiFvCosX.js} +41 -49
  160. package/dist/interactions-DiFvCosX.js.map +1 -0
  161. package/dist/journey-B4Adltjm.cjs +2 -0
  162. package/dist/journey-B4Adltjm.cjs.map +1 -0
  163. package/dist/{journey-35yCMNFo.js → journey-D2_sia57.js} +45 -48
  164. package/dist/journey-D2_sia57.js.map +1 -0
  165. package/dist/{library-console-Dl_Ly6DQ.js → library-console-Btrzt814.js} +2 -2
  166. package/dist/{library-console-Dl_Ly6DQ.js.map → library-console-Btrzt814.js.map} +1 -1
  167. package/dist/{library-console-BFWEuQsl.cjs → library-console-CPW6bvZH.cjs} +2 -2
  168. package/dist/{library-console-BFWEuQsl.cjs.map → library-console-CPW6bvZH.cjs.map} +1 -1
  169. package/dist/{library-request-nI6pvI6I.js → library-request-BJ9PLRaD.js} +2 -2
  170. package/dist/{library-request-nI6pvI6I.js.map → library-request-BJ9PLRaD.js.map} +1 -1
  171. package/dist/{library-request-Da-CHKzT.cjs → library-request-D7OvTxZV.cjs} +2 -2
  172. package/dist/{library-request-Da-CHKzT.cjs.map → library-request-D7OvTxZV.cjs.map} +1 -1
  173. package/dist/{lifecycle-CZ6RRXc6.js → lifecycle-22CUCrc9.js} +21 -29
  174. package/dist/lifecycle-22CUCrc9.js.map +1 -0
  175. package/dist/lifecycle-IaAm1mOC.cjs +2 -0
  176. package/dist/lifecycle-IaAm1mOC.cjs.map +1 -0
  177. package/dist/{log-record-DIA6McNr.js → log-record-BNiLfqtL.js} +8 -7
  178. package/dist/log-record-BNiLfqtL.js.map +1 -0
  179. package/dist/log-record-CkivuiEl.cjs +2 -0
  180. package/dist/log-record-CkivuiEl.cjs.map +1 -0
  181. package/dist/long-frames-BUUbXd-B.cjs +2 -0
  182. package/dist/long-frames-BUUbXd-B.cjs.map +1 -0
  183. package/dist/{long-frames-430_85Da.js → long-frames-DNFaRnC3.js} +18 -22
  184. package/dist/long-frames-DNFaRnC3.js.map +1 -0
  185. package/dist/models/batch.d.cts +57 -0
  186. package/dist/models/batch.d.ts +2 -2
  187. package/dist/models/bus.d.cts +158 -0
  188. package/dist/models/bus.d.ts +22 -2
  189. package/dist/models/config.d.cts +1540 -0
  190. package/dist/models/config.d.ts +360 -259
  191. package/dist/models/drop.d.cts +54 -0
  192. package/dist/models/drop.d.ts +16 -3
  193. package/dist/models/health.d.cts +148 -0
  194. package/dist/models/health.d.ts +108 -12
  195. package/dist/models/log-record.d.cts +61 -0
  196. package/dist/models/metric.d.cts +139 -0
  197. package/dist/models/metric.d.ts +13 -2
  198. package/dist/models/plugin.d.cts +47 -0
  199. package/dist/models/plugin.d.ts +3 -3
  200. package/dist/models/replay.d.cts +60 -0
  201. package/dist/models/serializer.d.cts +23 -0
  202. package/dist/models/serializer.d.ts +1 -1
  203. package/dist/models/storage.d.cts +95 -0
  204. package/dist/models/storage.d.ts +7 -5
  205. package/dist/network-CGMLQ-mA.cjs +2 -0
  206. package/dist/network-CGMLQ-mA.cjs.map +1 -0
  207. package/dist/{network-C7SkLf4v.js → network-on2zZT6H.js} +51 -51
  208. package/dist/network-on2zZT6H.js.map +1 -0
  209. package/dist/{otlp-2MCrC3kd.cjs → otlp-BENHf3g9.cjs} +2 -2
  210. package/dist/{otlp-2MCrC3kd.cjs.map → otlp-BENHf3g9.cjs.map} +1 -1
  211. package/dist/{otlp-COq033e3.js → otlp-DimfrRor.js} +12 -12
  212. package/dist/{otlp-COq033e3.js.map → otlp-DimfrRor.js.map} +1 -1
  213. package/dist/{platform-CVewe4wQ.js → platform-BaaFIPCU.js} +10 -10
  214. package/dist/{platform-CVewe4wQ.js.map → platform-BaaFIPCU.js.map} +1 -1
  215. package/dist/{platform-12uR7kBQ.cjs → platform-CfA3-7sJ.cjs} +2 -2
  216. package/dist/{platform-12uR7kBQ.cjs.map → platform-CfA3-7sJ.cjs.map} +1 -1
  217. package/dist/{profiler-BVWIOgnq.js → profiler-BAZoh7A4.js} +89 -107
  218. package/dist/profiler-BAZoh7A4.js.map +1 -0
  219. package/dist/profiler-D4tJpDRc.cjs +2 -0
  220. package/dist/profiler-D4tJpDRc.cjs.map +1 -0
  221. package/dist/profiler-frames-C4xr7KfH.cjs +2 -0
  222. package/dist/profiler-frames-C4xr7KfH.cjs.map +1 -0
  223. package/dist/{profiler-frames-CLXlT_xL.js → profiler-frames-cJMx9wNM.js} +29 -37
  224. package/dist/profiler-frames-cJMx9wNM.js.map +1 -0
  225. package/dist/remote-rules-Dz9MRAsB.js +95 -0
  226. package/dist/remote-rules-Dz9MRAsB.js.map +1 -0
  227. package/dist/remote-rules-_tY0zj5o.cjs +2 -0
  228. package/dist/remote-rules-_tY0zj5o.cjs.map +1 -0
  229. package/dist/replay-B3gFXIZd.cjs +2 -0
  230. package/dist/replay-B3gFXIZd.cjs.map +1 -0
  231. package/dist/replay-Ds-ANH34.js +310 -0
  232. package/dist/replay-Ds-ANH34.js.map +1 -0
  233. package/dist/reports-BDSe4dFH.cjs +2 -0
  234. package/dist/reports-BDSe4dFH.cjs.map +1 -0
  235. package/dist/{reports-BuXekPOS.js → reports-C-thq-bk.js} +25 -30
  236. package/dist/reports-C-thq-bk.js.map +1 -0
  237. package/dist/resource-timing-C576gFIQ.cjs +2 -0
  238. package/dist/resource-timing-C576gFIQ.cjs.map +1 -0
  239. package/dist/{resource-timing-CXGHwFRD.js → resource-timing-eUl2dNgC.js} +20 -23
  240. package/dist/resource-timing-eUl2dNgC.js.map +1 -0
  241. package/dist/response-body-YdNl-HkR.cjs +3 -0
  242. package/dist/response-body-YdNl-HkR.cjs.map +1 -0
  243. package/dist/response-body-eoSQpLiH.js +331 -0
  244. package/dist/response-body-eoSQpLiH.js.map +1 -0
  245. package/dist/rotation-Cwct4ckk.js +94 -0
  246. package/dist/rotation-Cwct4ckk.js.map +1 -0
  247. package/dist/rotation-D4qUAHAu.cjs +2 -0
  248. package/dist/rotation-D4qUAHAu.cjs.map +1 -0
  249. package/dist/sampling-BlrI8jor.js +63 -0
  250. package/dist/sampling-BlrI8jor.js.map +1 -0
  251. package/dist/sampling-mXt4dstx.cjs +2 -0
  252. package/dist/sampling-mXt4dstx.cjs.map +1 -0
  253. package/dist/{sanitize-CNmsD9r3.js → sanitize-Ba0KqU06.js} +2 -2
  254. package/dist/sanitize-Ba0KqU06.js.map +1 -0
  255. package/dist/{sanitize-ChLn97Ch.cjs → sanitize-DQyiI_KY.cjs} +2 -2
  256. package/dist/sanitize-DQyiI_KY.cjs.map +1 -0
  257. package/dist/sender-BdRuNVhF.cjs +2 -0
  258. package/dist/sender-BdRuNVhF.cjs.map +1 -0
  259. package/dist/sender-Dv8rAmpV.js +979 -0
  260. package/dist/sender-Dv8rAmpV.js.map +1 -0
  261. package/dist/storage/context-storage.d.cts +90 -0
  262. package/dist/storage/context-storage.d.ts +5 -5
  263. package/dist/storage/emergency-queue.d.cts +27 -0
  264. package/dist/storage/emergency-queue.d.ts +4 -4
  265. package/dist/storage/eviction.d.cts +40 -0
  266. package/dist/storage/eviction.d.ts +1 -1
  267. package/dist/storage/factory.d.cts +21 -0
  268. package/dist/storage/factory.d.ts +3 -3
  269. package/dist/storage/gap.d.cts +20 -0
  270. package/dist/storage/gap.d.ts +3 -3
  271. package/dist/storage/idb-driver.d.cts +93 -0
  272. package/dist/storage/idb-driver.d.ts +1 -1
  273. package/dist/storage/indexeddb-storage.d.cts +97 -0
  274. package/dist/storage/indexeddb-storage.d.ts +12 -4
  275. package/dist/storage/keys.d.cts +17 -0
  276. package/dist/storage/keys.d.ts +2 -2
  277. package/dist/storage/local-storage.d.cts +139 -0
  278. package/dist/storage/local-storage.d.ts +11 -4
  279. package/dist/storage/memory-storage.d.cts +73 -0
  280. package/dist/storage/memory-storage.d.ts +4 -3
  281. package/dist/storage/persistence.d.cts +8 -0
  282. package/dist/storage/persistence.d.ts +2 -2
  283. package/dist/storage/stored-context.d.cts +34 -0
  284. package/dist/storage/stored-context.d.ts +34 -0
  285. package/dist/stored-context-B2EzVuYm.js +51 -0
  286. package/dist/stored-context-B2EzVuYm.js.map +1 -0
  287. package/dist/stored-context-CXt7eHZL.cjs +2 -0
  288. package/dist/stored-context-CXt7eHZL.cjs.map +1 -0
  289. package/dist/storm-C-zYSdDX.cjs +2 -0
  290. package/dist/storm-C-zYSdDX.cjs.map +1 -0
  291. package/dist/storm-DjKetLKZ.js +9 -0
  292. package/dist/storm-DjKetLKZ.js.map +1 -0
  293. package/dist/transport/compression.d.cts +7 -0
  294. package/dist/transport/custom-transport.d.cts +22 -0
  295. package/dist/transport/custom-transport.d.ts +6 -5
  296. package/dist/transport/errors.d.cts +31 -0
  297. package/dist/transport/exit-flush.d.cts +135 -0
  298. package/dist/transport/exit-flush.d.ts +30 -13
  299. package/dist/transport/headers.d.cts +8 -0
  300. package/dist/transport/headers.d.ts +2 -2
  301. package/dist/transport/http-transport.d.cts +116 -0
  302. package/dist/transport/http-transport.d.ts +20 -8
  303. package/dist/transport/memory-transport.d.cts +30 -0
  304. package/dist/transport/memory-transport.d.ts +2 -2
  305. package/dist/transport/response-body.d.cts +49 -0
  306. package/dist/transport/response-body.d.ts +49 -0
  307. package/dist/transport/retry-engine.d.cts +129 -0
  308. package/dist/transport/retry-engine.d.ts +27 -9
  309. package/dist/transport/serializers/ecs.d.cts +3 -0
  310. package/dist/transport/serializers/ecs.d.ts +1 -1
  311. package/dist/transport/serializers/otlp-metrics.d.cts +3 -0
  312. package/dist/transport/serializers/otlp-metrics.d.ts +1 -1
  313. package/dist/transport/serializers/otlp-traces.d.cts +3 -0
  314. package/dist/transport/serializers/otlp-traces.d.ts +1 -1
  315. package/dist/transport/serializers/otlp.d.cts +47 -0
  316. package/dist/transport/serializers/otlp.d.ts +2 -2
  317. package/dist/transport/serializers/select.d.cts +38 -0
  318. package/dist/transport/serializers/select.d.ts +5 -5
  319. package/dist/transport/status-transport.d.cts +129 -0
  320. package/dist/transport/status-transport.d.ts +25 -8
  321. package/dist/transport/worker-client.d.cts +23 -0
  322. package/dist/transport/worker-client.d.ts +12 -3
  323. package/dist/transport/worker-entry.d.cts +5 -0
  324. package/dist/transport/worker-entry.d.ts +1 -1
  325. package/dist/transport/worker-protocol.d.cts +38 -0
  326. package/dist/transport/worker-protocol.d.ts +4 -2
  327. package/dist/transport/worker-server.d.cts +3 -0
  328. package/dist/transport/worker-server.d.ts +1 -1
  329. package/dist/transport/worker-transport.d.cts +10 -0
  330. package/dist/transport/worker-transport.d.ts +5 -4
  331. package/dist/types-BAerHgCq.js.map +1 -1
  332. package/dist/types-C7WNpnG1.cjs.map +1 -1
  333. package/dist/{unclean-exit-Cob_jyTv.js → unclean-exit-DQD1cT7c.js} +23 -30
  334. package/dist/unclean-exit-DQD1cT7c.js.map +1 -0
  335. package/dist/unclean-exit-py99ApzT.cjs +2 -0
  336. package/dist/unclean-exit-py99ApzT.cjs.map +1 -0
  337. package/dist/{user-timing-DgHubxCI.js → user-timing-BePqb1uN.js} +15 -17
  338. package/dist/user-timing-BePqb1uN.js.map +1 -0
  339. package/dist/user-timing-D6XTmpuM.cjs +2 -0
  340. package/dist/user-timing-D6XTmpuM.cjs.map +1 -0
  341. package/dist/utils/console.d.cts +36 -0
  342. package/dist/utils/console.d.ts +4 -4
  343. package/dist/utils/deadline.d.cts +14 -0
  344. package/dist/utils/error-like.d.cts +25 -0
  345. package/dist/utils/fixed-window.d.cts +25 -0
  346. package/dist/utils/global-scope.d.cts +20 -0
  347. package/dist/utils/guards.d.cts +14 -0
  348. package/dist/utils/guards.d.ts +8 -0
  349. package/dist/utils/identity.d.cts +109 -0
  350. package/dist/utils/identity.d.ts +3 -4
  351. package/dist/utils/library-console.d.cts +11 -0
  352. package/dist/utils/library-request.d.cts +24 -0
  353. package/dist/utils/lock.d.cts +24 -0
  354. package/dist/utils/lock.d.ts +1 -1
  355. package/dist/utils/openfin.d.cts +48 -0
  356. package/dist/utils/patch.d.cts +9 -0
  357. package/dist/utils/platform.d.cts +62 -0
  358. package/dist/utils/platform.d.ts +2 -2
  359. package/dist/utils/sanitize.d.cts +52 -0
  360. package/dist/utils/sanitize.d.ts +1 -1
  361. package/dist/utils/sequence.d.cts +10 -0
  362. package/dist/utils/tracing.d.cts +158 -0
  363. package/dist/utils/tracing.d.ts +11 -4
  364. package/dist/utils/unref.d.cts +9 -0
  365. package/dist/web-socket-CoIUBM3C.cjs +2 -0
  366. package/dist/{web-socket-DthJuSAg.js.map → web-socket-CoIUBM3C.cjs.map} +1 -1
  367. package/dist/{web-socket-DthJuSAg.js → web-socket-DSHgDiZ6.js} +23 -28
  368. package/dist/web-socket-DSHgDiZ6.js.map +1 -0
  369. package/dist/{web-vitals-CsGCWnUr.js → web-vitals-4pWACwaR.js} +15 -21
  370. package/dist/web-vitals-4pWACwaR.js.map +1 -0
  371. package/dist/web-vitals-__X7t4pj.cjs +2 -0
  372. package/dist/web-vitals-__X7t4pj.cjs.map +1 -0
  373. package/dist/worker-protocol-QbvqNazn.cjs +2 -0
  374. package/dist/worker-protocol-QbvqNazn.cjs.map +1 -0
  375. package/dist/{worker-protocol-B0_8rWy5.js → worker-protocol-x074Rpet.js} +14 -11
  376. package/dist/worker-protocol-x074Rpet.js.map +1 -0
  377. package/dist/worker-server-CFe4nvos.cjs +2 -0
  378. package/dist/worker-server-CFe4nvos.cjs.map +1 -0
  379. package/dist/worker-server-iUVSjH8L.js +94 -0
  380. package/dist/worker-server-iUVSjH8L.js.map +1 -0
  381. package/dist/worker-transport-CRAX-09c.cjs +2 -0
  382. package/dist/worker-transport-CRAX-09c.cjs.map +1 -0
  383. package/dist/worker-transport-Dy1KMA7t.js +190 -0
  384. package/dist/worker-transport-Dy1KMA7t.js.map +1 -0
  385. package/llms.txt +397 -0
  386. package/package.json +54 -46
  387. package/dist/bus-D_7pd7RN.cjs +0 -2
  388. package/dist/bus-D_7pd7RN.cjs.map +0 -1
  389. package/dist/bus-ecxUNTja.js.map +0 -1
  390. package/dist/console-CLz_PvFn.cjs +0 -2
  391. package/dist/console-CLz_PvFn.cjs.map +0 -1
  392. package/dist/console-cwgHKXvM.js +0 -82
  393. package/dist/console-cwgHKXvM.js.map +0 -1
  394. package/dist/constants-Bwl_YtQi.js +0 -349
  395. package/dist/constants-Bwl_YtQi.js.map +0 -1
  396. package/dist/constants-DakMxVB2.cjs +0 -2
  397. package/dist/constants-DakMxVB2.cjs.map +0 -1
  398. package/dist/context-storage-BjzeBSxH.cjs +0 -2
  399. package/dist/context-storage-BjzeBSxH.cjs.map +0 -1
  400. package/dist/context-storage-BzkoHzkQ.js +0 -51
  401. package/dist/context-storage-BzkoHzkQ.js.map +0 -1
  402. package/dist/debug-bundle-BOdYmCeV.js +0 -32
  403. package/dist/debug-bundle-BOdYmCeV.js.map +0 -1
  404. package/dist/debug-bundle-Ex4L_LSP.cjs +0 -2
  405. package/dist/debug-bundle-Ex4L_LSP.cjs.map +0 -1
  406. package/dist/emergency-queue-B9WZxanZ.js +0 -67
  407. package/dist/emergency-queue-B9WZxanZ.js.map +0 -1
  408. package/dist/emergency-queue-HBpL5r3V.cjs +0 -2
  409. package/dist/emergency-queue-HBpL5r3V.cjs.map +0 -1
  410. package/dist/errors-D6bwgJtO.js +0 -92
  411. package/dist/errors-D6bwgJtO.js.map +0 -1
  412. package/dist/errors-DCOCRdSi.cjs +0 -3
  413. package/dist/errors-DCOCRdSi.cjs.map +0 -1
  414. package/dist/factory-DLFDjdLv.cjs +0 -2
  415. package/dist/factory-DLFDjdLv.cjs.map +0 -1
  416. package/dist/factory-e9Qo3K0z.js +0 -276
  417. package/dist/factory-e9Qo3K0z.js.map +0 -1
  418. package/dist/guards-Cidk71ME.js +0 -7
  419. package/dist/guards-Cidk71ME.js.map +0 -1
  420. package/dist/guards-nJ70syPt.cjs +0 -2
  421. package/dist/guards-nJ70syPt.cjs.map +0 -1
  422. package/dist/identity-BlvlgjrU.cjs +0 -2
  423. package/dist/identity-BlvlgjrU.cjs.map +0 -1
  424. package/dist/identity-BrQp_5J5.js.map +0 -1
  425. package/dist/indexeddb-storage-CtLvZH1r.cjs +0 -2
  426. package/dist/indexeddb-storage-CtLvZH1r.cjs.map +0 -1
  427. package/dist/indexeddb-storage-DLXQzAGh.js.map +0 -1
  428. package/dist/interactions-B6z2I4tU.js.map +0 -1
  429. package/dist/interactions-P6pz08Jn.cjs +0 -2
  430. package/dist/interactions-P6pz08Jn.cjs.map +0 -1
  431. package/dist/journey-35yCMNFo.js.map +0 -1
  432. package/dist/journey-DAGh5h9k.cjs +0 -2
  433. package/dist/journey-DAGh5h9k.cjs.map +0 -1
  434. package/dist/keys-BHhw_0Wh.cjs +0 -2
  435. package/dist/keys-BHhw_0Wh.cjs.map +0 -1
  436. package/dist/keys-BU9j5YqW.js +0 -16
  437. package/dist/keys-BU9j5YqW.js.map +0 -1
  438. package/dist/lifecycle-BGGOcN4N.cjs +0 -2
  439. package/dist/lifecycle-BGGOcN4N.cjs.map +0 -1
  440. package/dist/lifecycle-CZ6RRXc6.js.map +0 -1
  441. package/dist/log-record-D7bA1RPb.cjs +0 -2
  442. package/dist/log-record-D7bA1RPb.cjs.map +0 -1
  443. package/dist/log-record-DIA6McNr.js.map +0 -1
  444. package/dist/long-frames-430_85Da.js.map +0 -1
  445. package/dist/long-frames-Dd8tsi2U.cjs +0 -2
  446. package/dist/long-frames-Dd8tsi2U.cjs.map +0 -1
  447. package/dist/models/stats.d.ts +0 -11
  448. package/dist/network-C7SkLf4v.js.map +0 -1
  449. package/dist/network-pEX3PAJv.cjs +0 -2
  450. package/dist/network-pEX3PAJv.cjs.map +0 -1
  451. package/dist/profiler-BVWIOgnq.js.map +0 -1
  452. package/dist/profiler-eVCknCzS.cjs +0 -2
  453. package/dist/profiler-eVCknCzS.cjs.map +0 -1
  454. package/dist/profiler-frames-CLXlT_xL.js.map +0 -1
  455. package/dist/profiler-frames-Dg2OebB2.cjs +0 -2
  456. package/dist/profiler-frames-Dg2OebB2.cjs.map +0 -1
  457. package/dist/remote-rules-BJGDJGwA.js +0 -98
  458. package/dist/remote-rules-BJGDJGwA.js.map +0 -1
  459. package/dist/remote-rules-CJD3ToVk.cjs +0 -2
  460. package/dist/remote-rules-CJD3ToVk.cjs.map +0 -1
  461. package/dist/replay-0zAJv9T3.js +0 -338
  462. package/dist/replay-0zAJv9T3.js.map +0 -1
  463. package/dist/replay-DomJpXqW.cjs +0 -2
  464. package/dist/replay-DomJpXqW.cjs.map +0 -1
  465. package/dist/reports-BsbqmP8h.cjs +0 -2
  466. package/dist/reports-BsbqmP8h.cjs.map +0 -1
  467. package/dist/reports-BuXekPOS.js.map +0 -1
  468. package/dist/resource-timing-CXGHwFRD.js.map +0 -1
  469. package/dist/resource-timing-DkycFGDa.cjs +0 -2
  470. package/dist/resource-timing-DkycFGDa.cjs.map +0 -1
  471. package/dist/sampling-Dd0wllyq.cjs +0 -2
  472. package/dist/sampling-Dd0wllyq.cjs.map +0 -1
  473. package/dist/sampling-UUDbi3K0.js +0 -60
  474. package/dist/sampling-UUDbi3K0.js.map +0 -1
  475. package/dist/sanitize-CNmsD9r3.js.map +0 -1
  476. package/dist/sanitize-ChLn97Ch.cjs.map +0 -1
  477. package/dist/select-CTk-K5mG.cjs +0 -3
  478. package/dist/select-CTk-K5mG.cjs.map +0 -1
  479. package/dist/select-DPv_j6wq.js +0 -270
  480. package/dist/select-DPv_j6wq.js.map +0 -1
  481. package/dist/sender-15zEsZpr.js +0 -857
  482. package/dist/sender-15zEsZpr.js.map +0 -1
  483. package/dist/sender-Bfpv9tad.cjs +0 -2
  484. package/dist/sender-Bfpv9tad.cjs.map +0 -1
  485. package/dist/storage-BA9RqRO-.cjs +0 -2
  486. package/dist/storage-BA9RqRO-.cjs.map +0 -1
  487. package/dist/storage-DZwed89z.js +0 -16
  488. package/dist/storage-DZwed89z.js.map +0 -1
  489. package/dist/storm-BTSNTIWI.js +0 -9
  490. package/dist/storm-BTSNTIWI.js.map +0 -1
  491. package/dist/storm-D0_qZOEg.cjs +0 -2
  492. package/dist/storm-D0_qZOEg.cjs.map +0 -1
  493. package/dist/unclean-exit-ClGzrc2A.cjs +0 -2
  494. package/dist/unclean-exit-ClGzrc2A.cjs.map +0 -1
  495. package/dist/unclean-exit-Cob_jyTv.js.map +0 -1
  496. package/dist/user-timing-CdYqx3PF.cjs +0 -2
  497. package/dist/user-timing-CdYqx3PF.cjs.map +0 -1
  498. package/dist/user-timing-DgHubxCI.js.map +0 -1
  499. package/dist/utils/timer.d.ts +0 -19
  500. package/dist/web-socket-BTuvYoJI.cjs +0 -2
  501. package/dist/web-socket-BTuvYoJI.cjs.map +0 -1
  502. package/dist/web-vitals-Ch5BpDmo.cjs +0 -2
  503. package/dist/web-vitals-Ch5BpDmo.cjs.map +0 -1
  504. package/dist/web-vitals-CsGCWnUr.js.map +0 -1
  505. package/dist/worker-protocol-B0_8rWy5.js.map +0 -1
  506. package/dist/worker-protocol-BjzFORfq.cjs +0 -2
  507. package/dist/worker-protocol-BjzFORfq.cjs.map +0 -1
  508. package/dist/worker-server-4en-Lt-3.cjs +0 -2
  509. package/dist/worker-server-4en-Lt-3.cjs.map +0 -1
  510. package/dist/worker-server-Cne9MX9I.js +0 -83
  511. package/dist/worker-server-Cne9MX9I.js.map +0 -1
  512. package/dist/worker-transport-B-GF4Aqn.cjs +0 -2
  513. package/dist/worker-transport-B-GF4Aqn.cjs.map +0 -1
  514. package/dist/worker-transport-C3SjJAEC.js +0 -200
  515. package/dist/worker-transport-C3SjJAEC.js.map +0 -1
@@ -0,0 +1,161 @@
1
+ import type { LogBatch } from "../models/batch.cjs";
2
+ import type { ResolvedConfig } from "../models/config.cjs";
3
+ import type { LossReporter } from "../models/drop.cjs";
4
+ import type { DeliveryHealth } from "../models/health.cjs";
5
+ import type { LogRecord } from "../models/log-record.cjs";
6
+ import { type GapReporter, type StorageAdapter, type StoragePersistence } from "../models/storage.cjs";
7
+ import type { Diagnostics } from "./diagnostics.cjs";
8
+ import { type FlushCounts } from "./pipeline.cjs";
9
+ import type { RemoteSlot } from "./remote-sampling.cjs";
10
+ /** Inputs to build the delivery stack. */
11
+ export interface SenderDeps {
12
+ /** Memory store that this runtime keeps when the security context changes. */
13
+ storage?: StorageAdapter;
14
+ onStorage?: (storage: StorageAdapter) => void;
15
+ /** Receives the state of the persistent-storage request. */
16
+ onPersistence?: (state: StoragePersistence) => void;
17
+ /** Active configuration instance. */
18
+ config: ResolvedConfig;
19
+ /** Diagnostics reporter. */
20
+ diagnostics: Diagnostics;
21
+ /** Receives a report when storage drops batches before delivery. */
22
+ onGap: GapReporter;
23
+ /** Receives the records lost by the transport, the retry engine and the exit flush. */
24
+ onLoss: LossReporter;
25
+ /** The runtime's slot for the sampling rules from the ingest server. */
26
+ remote: RemoteSlot;
27
+ /** Sends the open metric interval's points before the exit flush drains the buffers. */
28
+ beforeExit?: () => void;
29
+ /**
30
+ * Receives the time of the last accepted batch after a send. The runtime keeps it across a
31
+ * rotation, which builds a new sender.
32
+ */
33
+ onSent?: (at: number) => void;
34
+ }
35
+ /** What the sender adds to getHealth().delivery. The runtime adds the rest. */
36
+ export type SenderStats = Pick<DeliveryHealth, "pending" | "inFlight" | "lastFailureAt" | "consecutiveFailures" | "throttledUntil">;
37
+ /** Delivery stack for one sender runtime. */
38
+ export declare class Sender {
39
+ private readonly storage;
40
+ private readonly retry;
41
+ private readonly pipeline;
42
+ private readonly exitFlush;
43
+ private readonly diagnostics;
44
+ private readonly transport;
45
+ private readonly outcomes;
46
+ /** True after retire(), so a late emergency import doesn't wake the retry engine. */
47
+ private retired;
48
+ /** Emergency queue import. retire() waits for it before reading storage. */
49
+ private emergencyImport;
50
+ /**
51
+ * @param storage Storage adapter for undelivered batches.
52
+ * @param retry Retry engine for stored batches.
53
+ * @param pipeline Pipeline that batches records.
54
+ * @param exitFlush Handler that sends pending records on unload.
55
+ * @param diagnostics Diagnostics reporter.
56
+ * @param transport The transport that the pipeline and the retry engine use.
57
+ * @param outcomes Counts the failed sends of the pipeline and the retry engine.
58
+ */
59
+ private constructor();
60
+ /**
61
+ * Builds the delivery stack and starts the retry loop. The emergency queue import runs
62
+ * after the start, so a slow IndexedDB open doesn't hold up the boot buffer.
63
+ * @param deps Configuration, diagnostics and gap reporter.
64
+ * @returns Promise that resolves to the started sender.
65
+ */
66
+ static create(deps: SenderDeps): Promise<Sender>;
67
+ /**
68
+ * Adds a record to the pipeline.
69
+ * @param record Record to deliver.
70
+ */
71
+ push(record: LogRecord): void;
72
+ /**
73
+ * Stops every send while `enabled` is false, or starts again. The records stay in memory and
74
+ * the stored batches stay in storage, so they go out after the pause.
75
+ * @param on True to stop.
76
+ */
77
+ hold(on: boolean): void;
78
+ /**
79
+ * Lists the records that only memory holds. Nothing sends them during a pause.
80
+ * @returns The pipeline's records.
81
+ */
82
+ records(): LogRecord[];
83
+ /**
84
+ * Sends the records in the stream buffers, then waits for every batch in flight.
85
+ * @returns Promise that resolves once the pipeline has sent or stored every batch.
86
+ */
87
+ flush(): Promise<void>;
88
+ /**
89
+ * Sends the records in the stream buffers, then waits for this call's batches until each one
90
+ * ends or the deadline passes.
91
+ * @param expired Resolves at the caller's deadline.
92
+ * @returns The records of the call's batches by their state when the wait ends.
93
+ */
94
+ flushUntil(expired: Promise<void>): Promise<FlushCounts>;
95
+ /**
96
+ * Counts the batches held in storage.
97
+ * @returns Promise that resolves to the batch count, or 0 if storage fails.
98
+ */
99
+ queueDepth(): Promise<number>;
100
+ /**
101
+ * Reads the delivery state of the pipeline and the transport.
102
+ * @returns Waiting records, records in requests, the failures and the throttle end.
103
+ */
104
+ stats(): SenderStats;
105
+ /**
106
+ * Sends pending records with a normal flush, then with the exit flush, then stops all
107
+ * timers and listeners and closes storage. The normal flush keeps the headers, gzip and
108
+ * the retry. The exit flush picks up the records the normal flush didn't confirm.
109
+ * @returns Promise that resolves when storage closes.
110
+ */
111
+ destroy(): Promise<void>;
112
+ /**
113
+ * Stops every send without a flush or an exit flush, for a discard at shutdown. A request in
114
+ * flight can still reach the server, but its result writes nothing and schedules no retry,
115
+ * because the store accepts no write after this.
116
+ * @returns Promise that resolves to the records in the buffers and the queue, once the
117
+ * emergency import is done and the store is closed.
118
+ */
119
+ discard(): Promise<LogRecord[]>;
120
+ /**
121
+ * Stops every send after a rotation fails, and stores the records from memory under the old
122
+ * id. The store stays open, so the next rotation that succeeds can apply its rule to them.
123
+ * @param contextId Identity of the closed delivery context.
124
+ * @returns Promise that resolves once the records are stored.
125
+ */
126
+ pause(contextId: string): Promise<void>;
127
+ /**
128
+ * Stores whole batches under a context id. One batch per record would fill
129
+ * retention.maxBatches.
130
+ * @param batches Batches from the pipeline.
131
+ * @param contextId Identity of their delivery context.
132
+ * @returns Promise that resolves once each batch is stored.
133
+ */
134
+ private keep;
135
+ /**
136
+ * Stops this sender before a new delivery identity takes effect. Does not run exit delivery.
137
+ * @param policy Rule for the old records.
138
+ * @param timeoutMs Maximum wait for a flush, in milliseconds.
139
+ * @param contextId Identity of the old delivery context.
140
+ * @returns The records that were in memory and the batches that were stored, after the
141
+ * delivery attempt.
142
+ */
143
+ retire(policy: "discard" | "flush" | "retain" | "carry", timeoutMs: number, contextId: string): Promise<{
144
+ buffered: LogRecord[];
145
+ stored: LogBatch[];
146
+ }>;
147
+ /**
148
+ * Stores an earlier context's batches under this context, and the retry engine then sends
149
+ * them. They don't go through the live buffer, because a large backlog would exceed its
150
+ * budget.
151
+ * @param batches The earlier context's stored batches.
152
+ * @param contextId Identity of this delivery context.
153
+ * @returns Promise that resolves when the batches are stored.
154
+ */
155
+ adopt(batches: readonly LogBatch[], contextId: string): Promise<void>;
156
+ /**
157
+ * Moves the emergency queue's batches into storage, then wakes the retry engine.
158
+ * The previous page load parked them during its unload.
159
+ */
160
+ private importEmergency;
161
+ }
@@ -1,11 +1,12 @@
1
- import type { LogBatch } from "../models/batch";
2
- import type { ResolvedConfig } from "../models/config";
3
- import type { LossReporter } from "../models/drop";
4
- import type { LogRecord } from "../models/log-record";
5
- import type { DeliveryStats } from "../models/stats";
6
- import { type GapReporter, type StorageAdapter, type StoragePersistence } from "../models/storage";
7
- import type { Diagnostics } from "./diagnostics";
8
- import type { RemoteSlot } from "./remote-sampling";
1
+ import type { LogBatch } from "../models/batch.js";
2
+ import type { ResolvedConfig } from "../models/config.js";
3
+ import type { LossReporter } from "../models/drop.js";
4
+ import type { DeliveryHealth } from "../models/health.js";
5
+ import type { LogRecord } from "../models/log-record.js";
6
+ import { type GapReporter, type StorageAdapter, type StoragePersistence } from "../models/storage.js";
7
+ import type { Diagnostics } from "./diagnostics.js";
8
+ import { type FlushCounts } from "./pipeline.js";
9
+ import type { RemoteSlot } from "./remote-sampling.js";
9
10
  /** Inputs to build the delivery stack. */
10
11
  export interface SenderDeps {
11
12
  /** Memory store that this runtime keeps when the security context changes. */
@@ -25,7 +26,14 @@ export interface SenderDeps {
25
26
  remote: RemoteSlot;
26
27
  /** Sends the open metric interval's points before the exit flush drains the buffers. */
27
28
  beforeExit?: () => void;
29
+ /**
30
+ * Receives the time of the last accepted batch after a send. The runtime keeps it across a
31
+ * rotation, which builds a new sender.
32
+ */
33
+ onSent?: (at: number) => void;
28
34
  }
35
+ /** What the sender adds to getHealth().delivery. The runtime adds the rest. */
36
+ export type SenderStats = Pick<DeliveryHealth, "pending" | "inFlight" | "lastFailureAt" | "consecutiveFailures" | "throttledUntil">;
29
37
  /** Delivery stack for one sender runtime. */
30
38
  export declare class Sender {
31
39
  private readonly storage;
@@ -34,6 +42,7 @@ export declare class Sender {
34
42
  private readonly exitFlush;
35
43
  private readonly diagnostics;
36
44
  private readonly transport;
45
+ private readonly outcomes;
37
46
  /** True after retire(), so a late emergency import doesn't wake the retry engine. */
38
47
  private retired;
39
48
  /** Emergency queue import. retire() waits for it before reading storage. */
@@ -45,6 +54,7 @@ export declare class Sender {
45
54
  * @param exitFlush Handler that sends pending records on unload.
46
55
  * @param diagnostics Diagnostics reporter.
47
56
  * @param transport The transport that the pipeline and the retry engine use.
57
+ * @param outcomes Counts the failed sends of the pipeline and the retry engine.
48
58
  */
49
59
  private constructor();
50
60
  /**
@@ -59,18 +69,29 @@ export declare class Sender {
59
69
  * @param record Record to deliver.
60
70
  */
61
71
  push(record: LogRecord): void;
72
+ /**
73
+ * Stops every send while `enabled` is false, or starts again. The records stay in memory and
74
+ * the stored batches stay in storage, so they go out after the pause.
75
+ * @param on True to stop.
76
+ */
77
+ hold(on: boolean): void;
78
+ /**
79
+ * Lists the records that only memory holds. Nothing sends them during a pause.
80
+ * @returns The pipeline's records.
81
+ */
82
+ records(): LogRecord[];
62
83
  /**
63
84
  * Sends the records in the stream buffers, then waits for every batch in flight.
64
85
  * @returns Promise that resolves once the pipeline has sent or stored every batch.
65
86
  */
66
87
  flush(): Promise<void>;
67
88
  /**
68
- * Removes stored normal and emergency batches without sending them.
69
- * @param scope Part of storage to clear.
70
- * @param contextId Active delivery context id.
71
- * @returns Promise that resolves when removal completes.
89
+ * Sends the records in the stream buffers, then waits for this call's batches until each one
90
+ * ends or the deadline passes.
91
+ * @param expired Resolves at the caller's deadline.
92
+ * @returns The records of the call's batches by their state when the wait ends.
72
93
  */
73
- clearPersisted(scope: "context" | "namespace", contextId: string): Promise<void>;
94
+ flushUntil(expired: Promise<void>): Promise<FlushCounts>;
74
95
  /**
75
96
  * Counts the batches held in storage.
76
97
  * @returns Promise that resolves to the batch count, or 0 if storage fails.
@@ -78,9 +99,9 @@ export declare class Sender {
78
99
  queueDepth(): Promise<number>;
79
100
  /**
80
101
  * Reads the delivery state of the pipeline and the transport.
81
- * @returns Waiting records, records in requests and the last accepted send.
102
+ * @returns Waiting records, records in requests, the failures and the throttle end.
82
103
  */
83
- stats(): Omit<DeliveryStats, "stored">;
104
+ stats(): SenderStats;
84
105
  /**
85
106
  * Sends pending records with a normal flush, then with the exit flush, then stops all
86
107
  * timers and listeners and closes storage. The normal flush keeps the headers, gzip and
@@ -88,6 +109,29 @@ export declare class Sender {
88
109
  * @returns Promise that resolves when storage closes.
89
110
  */
90
111
  destroy(): Promise<void>;
112
+ /**
113
+ * Stops every send without a flush or an exit flush, for a discard at shutdown. A request in
114
+ * flight can still reach the server, but its result writes nothing and schedules no retry,
115
+ * because the store accepts no write after this.
116
+ * @returns Promise that resolves to the records in the buffers and the queue, once the
117
+ * emergency import is done and the store is closed.
118
+ */
119
+ discard(): Promise<LogRecord[]>;
120
+ /**
121
+ * Stops every send after a rotation fails, and stores the records from memory under the old
122
+ * id. The store stays open, so the next rotation that succeeds can apply its rule to them.
123
+ * @param contextId Identity of the closed delivery context.
124
+ * @returns Promise that resolves once the records are stored.
125
+ */
126
+ pause(contextId: string): Promise<void>;
127
+ /**
128
+ * Stores whole batches under a context id. One batch per record would fill
129
+ * retention.maxBatches.
130
+ * @param batches Batches from the pipeline.
131
+ * @param contextId Identity of their delivery context.
132
+ * @returns Promise that resolves once each batch is stored.
133
+ */
134
+ private keep;
91
135
  /**
92
136
  * Stops this sender before a new delivery identity takes effect. Does not run exit delivery.
93
137
  * @param policy Rule for the old records.
@@ -0,0 +1,39 @@
1
+ import type { EndedTrace } from "../utils/tracing.cjs";
2
+ /** One span recorded by the runtime. */
3
+ export interface SpanData {
4
+ /** Span name. */
5
+ name: string;
6
+ /** "internal" for a root span, "client" for a request. */
7
+ kind: "internal" | "client";
8
+ /** Trace ID. */
9
+ traceId: string;
10
+ /** Span ID. */
11
+ spanId: string;
12
+ /** The parent's span ID, or "" for a root span. */
13
+ parentSpanId: string;
14
+ /** Start time in epoch milliseconds. */
15
+ startMs: number;
16
+ /** End time in epoch milliseconds. */
17
+ endMs: number;
18
+ /** True for a failed operation. */
19
+ error: boolean;
20
+ /** The span's attributes. */
21
+ attributes: Record<string, unknown>;
22
+ /** Server span linked through a response traceparent entry. */
23
+ link?: {
24
+ traceId: string;
25
+ spanId: string;
26
+ };
27
+ }
28
+ /**
29
+ * Builds the root span for an ambient trace that has ended.
30
+ * @param ended The trace.
31
+ * @returns The span data.
32
+ */
33
+ export declare function rootSpan(ended: EndedTrace): SpanData;
34
+ /**
35
+ * Builds the span fields for a span record. The record limits don't trim them.
36
+ * @param span The span data.
37
+ * @returns The fields.
38
+ */
39
+ export declare function spanFields(span: SpanData): Record<string, unknown>;
@@ -1,4 +1,4 @@
1
- import type { EndedTrace } from "../utils/tracing";
1
+ import type { EndedTrace } from "../utils/tracing.js";
2
2
  /** One span recorded by the runtime. */
3
3
  export interface SpanData {
4
4
  /** Span name. */
@@ -0,0 +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
@@ -0,0 +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"}
@@ -0,0 +1,35 @@
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";
5
+ // src/core/debug-bundle.ts
6
+ function i(n) {
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;
8
+ }
9
+ function a(e, a, o) {
10
+ let s = (e) => typeof e == "string" ? t(e, !1) : e, { capture: c, serializer: l } = e, u = {
11
+ ...e,
12
+ endpoint: s(e.endpoint),
13
+ metricsEndpoint: s(e.metricsEndpoint),
14
+ tracesEndpoint: s(e.tracesEndpoint),
15
+ serializer: typeof l == "string" ? l : l.name,
16
+ redact: e.redact === r ? "refused" : e.redact,
17
+ processors: e.processors.map((e) => e === r ? "refused" : e),
18
+ capture: {
19
+ ...c,
20
+ ignoreUrls: c.ignoreUrls.map(s),
21
+ plugins: c.plugins.map((e) => e.name)
22
+ },
23
+ replay: {
24
+ ...e.replay,
25
+ endpoint: s(e.replay.endpoint),
26
+ headers: e.replay.headers !== null,
27
+ plugins: e.replay.plugins.length,
28
+ recordOptions: Object.keys(e.replay.recordOptions)
29
+ }
30
+ };
31
+ return Reflect.deleteProperty(u, "headers"), i(n(u, a, o));
32
+ }
33
+ export { a as configSummary };
34
+
35
+ //# sourceMappingURL=debug-bundle-CRpYV_ui.js.map
@@ -0,0 +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"}
@@ -0,0 +1 @@
1
+ function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}function t(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}function n(n){var r=t(n,`string`);return e(r)==`symbol`?r:r+``}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
@@ -0,0 +1,35 @@
1
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/typeof.js
2
+ function e(t) {
3
+ "@babel/helpers - typeof";
4
+ return e = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
5
+ return typeof e;
6
+ } : function(e) {
7
+ return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
8
+ }, e(t);
9
+ }
10
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/toPrimitive.js
11
+ function t(t, n) {
12
+ if (e(t) != "object" || !t) return t;
13
+ var r = t[Symbol.toPrimitive];
14
+ if (r !== void 0) {
15
+ var i = r.call(t, n || "default");
16
+ if (e(i) != "object") return i;
17
+ throw TypeError("@@toPrimitive must return a primitive value.");
18
+ }
19
+ return (n === "string" ? String : Number)(t);
20
+ }
21
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/toPropertyKey.js
22
+ function n(n) {
23
+ var r = t(n, "string");
24
+ return e(r) == "symbol" ? r : r + "";
25
+ }
26
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/defineProperty.js
27
+ function r(e, t, r) {
28
+ return (t = n(t)) in e ? Object.defineProperty(e, t, {
29
+ value: r,
30
+ enumerable: !0,
31
+ configurable: !0,
32
+ writable: !0
33
+ }) : e[t] = r, e;
34
+ }
35
+ export { r as t };
package/dist/doctor.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./constants-DakMxVB2.cjs"),t=require("./compression-lD9abCcO.cjs"),n=require("./otlp-2MCrC3kd.cjs");var r=1e4,i=0,a=1,o=2,s=`Usage: uiobs doctor <url> --origin <origin> [--replay] [--header "Name: value"]. An origin has no path and no trailing slash. With --replay, the URL is a replay endpoint.`,c=`--header`,l=`--replay`,u=5e6,d=5,f=`uiobs-doctor`,p=/^([\w!#$%&'*+.^`|~-]+): *([\x20-\x7e]+)$/,m=`<hidden>`,h=`Access-Control-Expose-Headers`,g=[e.lt,e.ct,e.st,e.ot].map(e=>e.toLowerCase()),_=[...g,`origin`],v=[e.ft,e.ut].map(e=>e.toLowerCase());function y(){let t=crypto.randomUUID().replaceAll(`-`,``);return{timeUnixNano:`${String(Date.now())}000000`,traceId:t,spanId:t.slice(0,16),traceFlags:1,severityNumber:e.Mn.INFO,severityText:`INFO`,body:`uiobs doctor test record`,attributes:{},resource:{"service.name":f}}}async function b(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 x(e,t,n){let r=(e.headers.get(t)??``).toLowerCase().split(`,`).map(e=>e.trim());return r.includes(`*`)?[]:n.filter(e=>!r.includes(e))}var S=e=>e.ok?void 0:`The server returned ${String(e.status)}.`;function C(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 w(e,t,n){let r=Object.keys(n).map(e=>e.toLowerCase());return{url:e,origin:t,custom:n,requestHeaders:[...g,...r]}}function T(e){return t=>{let n=t.headers.get(`Access-Control-Allow-Origin`);return n===e||n===`*`?void 0:`Access-Control-Allow-Origin is ${String(n)}. It must allow ${e}.`}}function E({url:e,origin:t,requestHeaders:n}){return b(e,{method:`OPTIONS`,headers:{Origin:t,"Access-Control-Request-Method":`POST`,"Access-Control-Request-Headers":n.join(`, `)}})}function D(e,t){return[C(`preflight`,e,`The server permits POST from this origin.`,S,T(t.origin)),C(`allowed headers`,e,`The server allows each request header of the library.`,e=>{let n=x(e,`Access-Control-Allow-Headers`,t.requestHeaders);return n.length>0?`Access-Control-Allow-Headers must include ${n.join(`, `)}.`:void 0})]}function O({url:t,origin:n,custom:r},i,a){return(o,s,c,l={})=>b(t,{method:`POST`,headers:{...r,Origin:n,[e.lt]:i,[e.st]:o,[e.ot]:String(s),...l},body:c},a)}async function k(n,r,i){let a=await t.t(i);return a?n(r,0,a,{[e.ct]:e.tt}):`This Node version has no CompressionStream.`}async function A(t,r,i={}){let a=w(t,r,i),o=T(r),s=await E(a),{body:c,contentType:l}=n.r.serialize([y()]),u=O(a,l),d=crypto.randomUUID(),f=await u(d,0,c),p=await u(d,1,c),m=await k(u,crypto.randomUUID(),c),_=new URL(t);_.searchParams.set(e.Zt,crypto.randomUUID()),_.searchParams.set(e.Qt,`pagehide`);let A=a.requestHeaders.length>g.length?void 0:await b(_.toString(),{method:`POST`,headers:{Origin:r,[e.lt]:e.B},body:c}),j=typeof f==`string`?[]:x(f,h,v),M=j.length>0?` Optional headers stay hidden: ${j.join(`, `)}.`:``;return[...D(s,a),C(`test batch`,f,`The server accepted a test batch.`,S,o),C(`exposed headers`,f,`The server exposes Retry-After.${M}`,e=>x(e,h,[`retry-after`]).length>0?`${h} must include retry-after.`:void 0),C(`gzip`,m,`The server accepted a gzip batch.`,S),C(`deduplication`,p,`The server accepted a repeated batch id. A client cannot see if it stored the batch again.`,S),A===void 0?{rule:`beacon`,pass:!0,detail:`The library sends no beacon with custom headers. The tool sent no beacon.`}:C(`beacon`,A,`The server accepted a text/plain batch.`,S)]}async function j(t,n,r={}){let i=w(t,n,r),a=T(n),o=await E(i),s=crypto.randomUUID(),c={"replay.id":s,"session.id":crypto.randomUUID(),"tab.id":crypto.randomUUID(),"service.name":f},l=(e,t)=>{let n=[{type:d,timestamp:Date.now(),data:{tag:f,payload:t}}];return JSON.stringify({...c,sequence:e,bytes:JSON.stringify(n).length,events:n})},p=e=>`${s}-${String(e)}`,m=O(i,e.R),h=l(0,`uiobs doctor test event`),g=await m(p(0),0,h),_=await m(p(0),1,h),v=await k(m,p(1),l(1,`uiobs doctor gzip event`)),y=await O(i,e.R,e.cn)(p(2),0,l(2,`x`.repeat(u)));return[...D(o,i),C(`test segment`,g,`The server accepted a test segment.`,S,a),C(`gzip`,v,`The server accepted a gzip segment.`,S),C(`large segment`,y,`The server accepted a segment of ${String(u)} bytes without gzip.`,e=>e.ok?void 0:`The server returned ${String(e.status)} for a segment of ${String(u)} bytes. The first segment of an upload has a full snapshot of the page. Raise the body limit of the server.`),C(`deduplication`,_,`The server accepted a repeated batch id. A client cannot see if it stored the segment again.`,S)]}function M(e){let t=[];for(let n=0;n<e.length;n+=2){let r=e[n]===c?p.exec(e[n+1]):null;if(!r||_.includes(r[1].toLowerCase()))return;t.push([r[1],r[2]])}return Object.fromEntries(t)}function N(e){if(!/^https?:\/\//i.test(e)||!URL.canParse(e))return!1;let{username:t,password:n}=new URL(e);return t===``&&n===``}var P=[`doctor`,`--origin`,l,c];function F(e){if(P.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 m}function I(e){return URL.canParse(e)&&new URL(e).origin===e}async function L(e,t){let[n,r,c,u,...d]=e,f=d[0]===l,p=M(f?d.slice(1):d);if(n!==`doctor`||c!==`--origin`||!N(r)||!I(u)||!p)return t(s),t(`Received: ${JSON.stringify(e.map(F))}`),o;let m=await(f?j:A)(r,u,p);for(let{rule:e,pass:n,detail:r}of m)t(`${n?`PASS`:`FAIL`} ${e}: ${r}`);return m.every(({pass:e})=>e)?i:a}exports.main=L,exports.runDoctor=A,exports.runReplayDoctor=j;
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;
2
2
  //# sourceMappingURL=doctor.cjs.map