@utk09/ui-observability 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (383) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +273 -102
  3. package/bin/uiobs.mjs +1 -1
  4. package/dist/{batch-CL9uWYY3.js → batch-BjQUwjA6.js} +4 -4
  5. package/dist/batch-BjQUwjA6.js.map +1 -0
  6. package/dist/{batch-C8OcWR2L.cjs → batch-D5LlU4Q9.cjs} +2 -2
  7. package/dist/batch-D5LlU4Q9.cjs.map +1 -0
  8. package/dist/bus/bus.d.ts +48 -47
  9. package/dist/bus/links.d.ts +4 -4
  10. package/dist/bus/validation.d.ts +1 -1
  11. package/dist/bus-D_7pd7RN.cjs +2 -0
  12. package/dist/bus-D_7pd7RN.cjs.map +1 -0
  13. package/dist/{bus-BZ0GldpT.js → bus-ecxUNTja.js} +91 -91
  14. package/dist/bus-ecxUNTja.js.map +1 -0
  15. package/dist/capture/console.d.ts +10 -10
  16. package/dist/capture/errors.d.ts +6 -6
  17. package/dist/capture/interactions.d.ts +14 -14
  18. package/dist/capture/lifecycle.d.ts +3 -3
  19. package/dist/capture/long-frames.d.ts +6 -6
  20. package/dist/capture/network.d.ts +17 -17
  21. package/dist/capture/profiler-frames.d.ts +44 -0
  22. package/dist/capture/replay-buffer.d.ts +46 -0
  23. package/dist/capture/replay-upload.d.ts +74 -0
  24. package/dist/capture/replay.d.ts +114 -0
  25. package/dist/capture/reports.d.ts +2 -2
  26. package/dist/capture/resource-timing.d.ts +1 -1
  27. package/dist/capture/server-timing.d.ts +3 -3
  28. package/dist/capture/storm.d.ts +3 -3
  29. package/dist/capture/types.d.ts +45 -33
  30. package/dist/capture/unclean-exit.d.ts +8 -8
  31. package/dist/capture/user-timing.d.ts +3 -3
  32. package/dist/capture/web-socket.d.ts +11 -11
  33. package/dist/capture/web-vitals.d.ts +20 -7
  34. package/dist/compression-AJJCMBOa.js +11 -0
  35. package/dist/compression-AJJCMBOa.js.map +1 -0
  36. package/dist/compression-lD9abCcO.cjs +2 -0
  37. package/dist/compression-lD9abCcO.cjs.map +1 -0
  38. package/dist/{console-BPZCuSLc.cjs → console-CLz_PvFn.cjs} +2 -2
  39. package/dist/console-CLz_PvFn.cjs.map +1 -0
  40. package/dist/{console-BeCF7n59.js → console-cwgHKXvM.js} +4 -4
  41. package/dist/console-cwgHKXvM.js.map +1 -0
  42. package/dist/constants-Bwl_YtQi.js +349 -0
  43. package/dist/constants-Bwl_YtQi.js.map +1 -0
  44. package/dist/constants-DakMxVB2.cjs +2 -0
  45. package/dist/constants-DakMxVB2.cjs.map +1 -0
  46. package/dist/constants.d.ts +150 -103
  47. package/dist/context-storage-BjzeBSxH.cjs.map +1 -1
  48. package/dist/context-storage-BzkoHzkQ.js.map +1 -1
  49. package/dist/core/breadcrumbs.d.ts +16 -15
  50. package/dist/core/config.d.ts +3 -3
  51. package/dist/core/context.d.ts +7 -7
  52. package/dist/core/debug-buffer.d.ts +10 -10
  53. package/dist/core/debug-bundle.d.ts +3 -3
  54. package/dist/core/deferred.d.ts +2 -2
  55. package/dist/core/diagnostics.d.ts +24 -21
  56. package/dist/core/drops.d.ts +7 -7
  57. package/dist/core/hold-buffer.d.ts +1 -1
  58. package/dist/core/journey.d.ts +22 -23
  59. package/dist/core/logger.d.ts +22 -21
  60. package/dist/core/measure.d.ts +7 -7
  61. package/dist/core/meter.d.ts +25 -21
  62. package/dist/core/pipeline.d.ts +42 -41
  63. package/dist/core/profile-buckets.d.ts +31 -0
  64. package/dist/core/profiler.d.ts +218 -0
  65. package/dist/core/record.d.ts +23 -23
  66. package/dist/core/remote-rules.d.ts +4 -4
  67. package/dist/core/remote-sampling.d.ts +21 -20
  68. package/dist/core/runtime.d.ts +206 -137
  69. package/dist/core/sampling.d.ts +18 -18
  70. package/dist/core/sender.d.ts +22 -20
  71. package/dist/core/spans.d.ts +5 -5
  72. package/dist/{deadline-BOjOxNHj.js → deadline-C4ccAuk5.js} +3 -6
  73. package/dist/deadline-C4ccAuk5.js.map +1 -0
  74. package/dist/deadline-CUGbto-y.cjs +2 -0
  75. package/dist/deadline-CUGbto-y.cjs.map +1 -0
  76. package/dist/{debug-bundle-C7UkHZ-q.js → debug-bundle-BOdYmCeV.js} +10 -3
  77. package/dist/debug-bundle-BOdYmCeV.js.map +1 -0
  78. package/dist/debug-bundle-Ex4L_LSP.cjs +2 -0
  79. package/dist/debug-bundle-Ex4L_LSP.cjs.map +1 -0
  80. package/dist/doctor.cjs +1 -1
  81. package/dist/doctor.cjs.map +1 -1
  82. package/dist/doctor.d.ts +16 -6
  83. package/dist/doctor.js +147 -52
  84. package/dist/doctor.js.map +1 -1
  85. package/dist/{emergency-queue-Zy6lNafo.js → emergency-queue-B9WZxanZ.js} +4 -4
  86. package/dist/emergency-queue-B9WZxanZ.js.map +1 -0
  87. package/dist/{emergency-queue-CNTRui5t.cjs → emergency-queue-HBpL5r3V.cjs} +2 -2
  88. package/dist/emergency-queue-HBpL5r3V.cjs.map +1 -0
  89. package/dist/error-like-B11pB4aL.js.map +1 -1
  90. package/dist/error-like-gGRx2s36.cjs.map +1 -1
  91. package/dist/{errors-Dh7kef0i.js → errors-D6bwgJtO.js} +3 -3
  92. package/dist/errors-D6bwgJtO.js.map +1 -0
  93. package/dist/{errors-tfEr48bS.cjs → errors-DCOCRdSi.cjs} +2 -2
  94. package/dist/errors-DCOCRdSi.cjs.map +1 -0
  95. package/dist/{factory-CJXVYp0R.cjs → factory-DLFDjdLv.cjs} +2 -2
  96. package/dist/factory-DLFDjdLv.cjs.map +1 -0
  97. package/dist/{factory-BonqI3NL.js → factory-e9Qo3K0z.js} +13 -13
  98. package/dist/factory-e9Qo3K0z.js.map +1 -0
  99. package/dist/fixed-window-CvESpFYV.cjs.map +1 -1
  100. package/dist/fixed-window-Dq3MLUUv.js.map +1 -1
  101. package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
  102. package/dist/global-scope-D9I8s-oN.js.map +1 -1
  103. package/dist/guards-Cidk71ME.js.map +1 -1
  104. package/dist/guards-nJ70syPt.cjs.map +1 -1
  105. package/dist/{identity-Cxgj6pZX.cjs → identity-BlvlgjrU.cjs} +2 -2
  106. package/dist/identity-BlvlgjrU.cjs.map +1 -0
  107. package/dist/{identity-DT5VmvXy.js → identity-BrQp_5J5.js} +19 -19
  108. package/dist/identity-BrQp_5J5.js.map +1 -0
  109. package/dist/index.cjs +1 -1
  110. package/dist/index.cjs.map +1 -1
  111. package/dist/index.d.ts +112 -79
  112. package/dist/index.js +783 -635
  113. package/dist/index.js.map +1 -1
  114. package/dist/{indexeddb-storage-CIoW21Xd.cjs → indexeddb-storage-CtLvZH1r.cjs} +2 -2
  115. package/dist/indexeddb-storage-CtLvZH1r.cjs.map +1 -0
  116. package/dist/{indexeddb-storage-BJVtiQKm.js → indexeddb-storage-DLXQzAGh.js} +4 -4
  117. package/dist/indexeddb-storage-DLXQzAGh.js.map +1 -0
  118. package/dist/{interactions-DTgKy_6K.js → interactions-B6z2I4tU.js} +3 -3
  119. package/dist/interactions-B6z2I4tU.js.map +1 -0
  120. package/dist/{interactions-fEN6FbVo.cjs → interactions-P6pz08Jn.cjs} +2 -2
  121. package/dist/interactions-P6pz08Jn.cjs.map +1 -0
  122. package/dist/{journey-CuJrHzEg.js → journey-35yCMNFo.js} +20 -19
  123. package/dist/journey-35yCMNFo.js.map +1 -0
  124. package/dist/journey-DAGh5h9k.cjs +2 -0
  125. package/dist/journey-DAGh5h9k.cjs.map +1 -0
  126. package/dist/keys-BHhw_0Wh.cjs.map +1 -1
  127. package/dist/keys-BU9j5YqW.js.map +1 -1
  128. package/dist/{library-console-D2GY9Or6.cjs → library-console-BFWEuQsl.cjs} +2 -2
  129. package/dist/library-console-BFWEuQsl.cjs.map +1 -0
  130. package/dist/{library-console-C1m6g1BR.js → library-console-Dl_Ly6DQ.js} +2 -2
  131. package/dist/library-console-Dl_Ly6DQ.js.map +1 -0
  132. package/dist/{library-request-1BX_UlaX.cjs → library-request-Da-CHKzT.cjs} +2 -2
  133. package/dist/library-request-Da-CHKzT.cjs.map +1 -0
  134. package/dist/{library-request-BQBT9N9Q.js → library-request-nI6pvI6I.js} +2 -2
  135. package/dist/library-request-nI6pvI6I.js.map +1 -0
  136. package/dist/{lifecycle-2EtUaRpo.cjs → lifecycle-BGGOcN4N.cjs} +2 -2
  137. package/dist/lifecycle-BGGOcN4N.cjs.map +1 -0
  138. package/dist/{lifecycle-BaKx_-32.js → lifecycle-CZ6RRXc6.js} +2 -2
  139. package/dist/lifecycle-CZ6RRXc6.js.map +1 -0
  140. package/dist/{log-record-i9zOTkpQ.cjs → log-record-D7bA1RPb.cjs} +2 -2
  141. package/dist/log-record-D7bA1RPb.cjs.map +1 -0
  142. package/dist/{log-record-CAoGBBf3.js → log-record-DIA6McNr.js} +2 -2
  143. package/dist/log-record-DIA6McNr.js.map +1 -0
  144. package/dist/{long-frames-Czk7IupC.js → long-frames-430_85Da.js} +8 -6
  145. package/dist/long-frames-430_85Da.js.map +1 -0
  146. package/dist/long-frames-Dd8tsi2U.cjs +2 -0
  147. package/dist/long-frames-Dd8tsi2U.cjs.map +1 -0
  148. package/dist/models/batch.d.ts +14 -15
  149. package/dist/models/bus.d.ts +24 -24
  150. package/dist/models/config.d.ts +402 -216
  151. package/dist/models/drop.d.ts +13 -11
  152. package/dist/models/health.d.ts +13 -13
  153. package/dist/models/log-record.d.ts +13 -14
  154. package/dist/models/metric.d.ts +82 -17
  155. package/dist/models/plugin.d.ts +13 -13
  156. package/dist/models/replay.d.ts +60 -0
  157. package/dist/models/serializer.d.ts +2 -3
  158. package/dist/models/stats.d.ts +2 -2
  159. package/dist/models/storage.d.ts +12 -11
  160. package/dist/{network-DBNwApoF.js → network-C7SkLf4v.js} +12 -12
  161. package/dist/network-C7SkLf4v.js.map +1 -0
  162. package/dist/{network-xbbuvG_6.cjs → network-pEX3PAJv.cjs} +2 -2
  163. package/dist/network-pEX3PAJv.cjs.map +1 -0
  164. package/dist/openfin-Bxelt0yg.js.map +1 -1
  165. package/dist/openfin-DtH2f7zX.cjs.map +1 -1
  166. package/dist/otlp-2MCrC3kd.cjs +2 -0
  167. package/dist/otlp-2MCrC3kd.cjs.map +1 -0
  168. package/dist/{otlp-BTJdIa6F.js → otlp-COq033e3.js} +25 -32
  169. package/dist/otlp-COq033e3.js.map +1 -0
  170. package/dist/patch-BX8KrPCT.cjs.map +1 -1
  171. package/dist/patch-UdPz1ea8.js.map +1 -1
  172. package/dist/{platform-C2Ez5kDc.cjs → platform-12uR7kBQ.cjs} +2 -2
  173. package/dist/platform-12uR7kBQ.cjs.map +1 -0
  174. package/dist/{platform-DkcuXwe-.js → platform-CVewe4wQ.js} +7 -7
  175. package/dist/platform-CVewe4wQ.js.map +1 -0
  176. package/dist/profiler-BVWIOgnq.js +310 -0
  177. package/dist/profiler-BVWIOgnq.js.map +1 -0
  178. package/dist/profiler-eVCknCzS.cjs +2 -0
  179. package/dist/profiler-eVCknCzS.cjs.map +1 -0
  180. package/dist/profiler-frames-CLXlT_xL.js +86 -0
  181. package/dist/profiler-frames-CLXlT_xL.js.map +1 -0
  182. package/dist/profiler-frames-Dg2OebB2.cjs +2 -0
  183. package/dist/profiler-frames-Dg2OebB2.cjs.map +1 -0
  184. package/dist/{remote-rules-Cfb4K-Nl.js → remote-rules-BJGDJGwA.js} +27 -27
  185. package/dist/remote-rules-BJGDJGwA.js.map +1 -0
  186. package/dist/{remote-rules-vzvk7aKf.cjs → remote-rules-CJD3ToVk.cjs} +2 -2
  187. package/dist/remote-rules-CJD3ToVk.cjs.map +1 -0
  188. package/dist/replay-0zAJv9T3.js +338 -0
  189. package/dist/replay-0zAJv9T3.js.map +1 -0
  190. package/dist/replay-DomJpXqW.cjs +2 -0
  191. package/dist/replay-DomJpXqW.cjs.map +1 -0
  192. package/dist/{reports-Dk2YhKIh.cjs → reports-BsbqmP8h.cjs} +2 -2
  193. package/dist/reports-BsbqmP8h.cjs.map +1 -0
  194. package/dist/{reports-TA-zInnq.js → reports-BuXekPOS.js} +3 -3
  195. package/dist/reports-BuXekPOS.js.map +1 -0
  196. package/dist/{resource-timing-BLv3EA2A.js → resource-timing-CXGHwFRD.js} +4 -4
  197. package/dist/resource-timing-CXGHwFRD.js.map +1 -0
  198. package/dist/{resource-timing-Cysw1S1f.cjs → resource-timing-DkycFGDa.cjs} +2 -2
  199. package/dist/resource-timing-DkycFGDa.cjs.map +1 -0
  200. package/dist/{sampling-Ckh2yW9k.cjs → sampling-Dd0wllyq.cjs} +2 -2
  201. package/dist/sampling-Dd0wllyq.cjs.map +1 -0
  202. package/dist/{sampling-C4VV-1MS.js → sampling-UUDbi3K0.js} +9 -9
  203. package/dist/sampling-UUDbi3K0.js.map +1 -0
  204. package/dist/{sanitize-6ymPlVvP.js → sanitize-CNmsD9r3.js} +2 -2
  205. package/dist/sanitize-CNmsD9r3.js.map +1 -0
  206. package/dist/{sanitize-BAWzkZt0.cjs → sanitize-ChLn97Ch.cjs} +2 -2
  207. package/dist/sanitize-ChLn97Ch.cjs.map +1 -0
  208. package/dist/{select-ZF4by-lF.cjs → select-CTk-K5mG.cjs} +3 -3
  209. package/dist/select-CTk-K5mG.cjs.map +1 -0
  210. package/dist/{select-xtQaenIi.js → select-DPv_j6wq.js} +61 -61
  211. package/dist/select-DPv_j6wq.js.map +1 -0
  212. package/dist/{sender-CiMHC9YG.js → sender-15zEsZpr.js} +61 -60
  213. package/dist/sender-15zEsZpr.js.map +1 -0
  214. package/dist/sender-Bfpv9tad.cjs +2 -0
  215. package/dist/sender-Bfpv9tad.cjs.map +1 -0
  216. package/dist/storage/context-storage.d.ts +34 -33
  217. package/dist/storage/emergency-queue.d.ts +9 -9
  218. package/dist/storage/eviction.d.ts +12 -12
  219. package/dist/storage/factory.d.ts +8 -7
  220. package/dist/storage/gap.d.ts +6 -6
  221. package/dist/storage/idb-driver.d.ts +31 -32
  222. package/dist/storage/indexeddb-storage.d.ts +26 -27
  223. package/dist/storage/keys.d.ts +7 -7
  224. package/dist/storage/local-storage.d.ts +38 -38
  225. package/dist/storage/memory-storage.d.ts +21 -22
  226. package/dist/storage/persistence.d.ts +1 -1
  227. package/dist/storage-BA9RqRO-.cjs.map +1 -1
  228. package/dist/storage-DZwed89z.js.map +1 -1
  229. package/dist/{storm-VR024_QN.js → storm-BTSNTIWI.js} +2 -2
  230. package/dist/storm-BTSNTIWI.js.map +1 -0
  231. package/dist/{storm-CYi9Swpx.cjs → storm-D0_qZOEg.cjs} +2 -2
  232. package/dist/storm-D0_qZOEg.cjs.map +1 -0
  233. package/dist/transport/compression.d.ts +2 -2
  234. package/dist/transport/errors.d.ts +7 -7
  235. package/dist/transport/exit-flush.d.ts +39 -39
  236. package/dist/transport/headers.d.ts +2 -2
  237. package/dist/transport/http-transport.d.ts +28 -27
  238. package/dist/transport/memory-transport.d.ts +6 -6
  239. package/dist/transport/retry-engine.d.ts +35 -34
  240. package/dist/transport/serializers/ecs.d.ts +1 -1
  241. package/dist/transport/serializers/otlp-metrics.d.ts +1 -1
  242. package/dist/transport/serializers/otlp-traces.d.ts +1 -1
  243. package/dist/transport/serializers/otlp.d.ts +16 -16
  244. package/dist/transport/serializers/select.d.ts +7 -7
  245. package/dist/transport/status-transport.d.ts +20 -20
  246. package/dist/transport/worker-protocol.d.ts +3 -3
  247. package/dist/types-BAerHgCq.js.map +1 -1
  248. package/dist/types-C7WNpnG1.cjs.map +1 -1
  249. package/dist/{unclean-exit-DFUN57wY.cjs → unclean-exit-ClGzrc2A.cjs} +2 -2
  250. package/dist/unclean-exit-ClGzrc2A.cjs.map +1 -0
  251. package/dist/{unclean-exit-CwcUhFOn.js → unclean-exit-Cob_jyTv.js} +2 -2
  252. package/dist/unclean-exit-Cob_jyTv.js.map +1 -0
  253. package/dist/unref-CU9Nyz_9.cjs +2 -0
  254. package/dist/unref-CU9Nyz_9.cjs.map +1 -0
  255. package/dist/unref-DgHPQeWv.js +7 -0
  256. package/dist/unref-DgHPQeWv.js.map +1 -0
  257. package/dist/user-timing-CdYqx3PF.cjs +2 -0
  258. package/dist/user-timing-CdYqx3PF.cjs.map +1 -0
  259. package/dist/{user-timing-_jZIhDKI.js → user-timing-DgHubxCI.js} +5 -3
  260. package/dist/user-timing-DgHubxCI.js.map +1 -0
  261. package/dist/utils/console.d.ts +2 -2
  262. package/dist/utils/deadline.d.ts +4 -4
  263. package/dist/utils/error-like.d.ts +7 -7
  264. package/dist/utils/fixed-window.d.ts +9 -8
  265. package/dist/utils/global-scope.d.ts +8 -8
  266. package/dist/utils/guards.d.ts +2 -2
  267. package/dist/utils/identity.d.ts +17 -17
  268. package/dist/utils/library-console.d.ts +4 -4
  269. package/dist/utils/library-request.d.ts +10 -10
  270. package/dist/utils/lock.d.ts +10 -9
  271. package/dist/utils/openfin.d.ts +5 -5
  272. package/dist/utils/patch.d.ts +6 -6
  273. package/dist/utils/platform.d.ts +13 -11
  274. package/dist/utils/sanitize.d.ts +4 -4
  275. package/dist/utils/timer.d.ts +1 -1
  276. package/dist/utils/tracing.d.ts +38 -38
  277. package/dist/utils/unref.d.ts +3 -3
  278. package/dist/{web-socket-BWUoqBh8.cjs → web-socket-BTuvYoJI.cjs} +2 -2
  279. package/dist/web-socket-BTuvYoJI.cjs.map +1 -0
  280. package/dist/{web-socket-CV7yIMnm.js → web-socket-DthJuSAg.js} +4 -4
  281. package/dist/web-socket-DthJuSAg.js.map +1 -0
  282. package/dist/web-vitals-Ch5BpDmo.cjs +2 -0
  283. package/dist/web-vitals-Ch5BpDmo.cjs.map +1 -0
  284. package/dist/web-vitals-CsGCWnUr.js +77 -0
  285. package/dist/web-vitals-CsGCWnUr.js.map +1 -0
  286. package/dist/{worker-protocol-CrsdSDLn.js → worker-protocol-B0_8rWy5.js} +4 -4
  287. package/dist/worker-protocol-B0_8rWy5.js.map +1 -0
  288. package/dist/{worker-protocol-Bai7GAIA.cjs → worker-protocol-BjzFORfq.cjs} +2 -2
  289. package/dist/worker-protocol-BjzFORfq.cjs.map +1 -0
  290. package/dist/worker-server-4en-Lt-3.cjs +2 -0
  291. package/dist/worker-server-4en-Lt-3.cjs.map +1 -0
  292. package/dist/{worker-server-Dp5HYm4b.js → worker-server-Cne9MX9I.js} +8 -8
  293. package/dist/{worker-server-Dp5HYm4b.js.map → worker-server-Cne9MX9I.js.map} +1 -1
  294. package/dist/worker-transport-B-GF4Aqn.cjs +2 -0
  295. package/dist/worker-transport-B-GF4Aqn.cjs.map +1 -0
  296. package/dist/{worker-transport-D6jtgpqN.js → worker-transport-C3SjJAEC.js} +62 -61
  297. package/dist/worker-transport-C3SjJAEC.js.map +1 -0
  298. package/package.json +8 -2
  299. package/dist/batch-C8OcWR2L.cjs.map +0 -1
  300. package/dist/batch-CL9uWYY3.js.map +0 -1
  301. package/dist/bus-BZ0GldpT.js.map +0 -1
  302. package/dist/bus-VWlmM5xs.cjs +0 -2
  303. package/dist/bus-VWlmM5xs.cjs.map +0 -1
  304. package/dist/console-BPZCuSLc.cjs.map +0 -1
  305. package/dist/console-BeCF7n59.js.map +0 -1
  306. package/dist/constants-DqKJH_MP.cjs +0 -2
  307. package/dist/constants-DqKJH_MP.cjs.map +0 -1
  308. package/dist/constants-zyrqveN4.js +0 -304
  309. package/dist/constants-zyrqveN4.js.map +0 -1
  310. package/dist/deadline-BOjOxNHj.js.map +0 -1
  311. package/dist/deadline-XSnm95pg.cjs +0 -2
  312. package/dist/deadline-XSnm95pg.cjs.map +0 -1
  313. package/dist/debug-bundle-BzJNpbF0.cjs +0 -2
  314. package/dist/debug-bundle-BzJNpbF0.cjs.map +0 -1
  315. package/dist/debug-bundle-C7UkHZ-q.js.map +0 -1
  316. package/dist/emergency-queue-CNTRui5t.cjs.map +0 -1
  317. package/dist/emergency-queue-Zy6lNafo.js.map +0 -1
  318. package/dist/errors-Dh7kef0i.js.map +0 -1
  319. package/dist/errors-tfEr48bS.cjs.map +0 -1
  320. package/dist/factory-BonqI3NL.js.map +0 -1
  321. package/dist/factory-CJXVYp0R.cjs.map +0 -1
  322. package/dist/identity-Cxgj6pZX.cjs.map +0 -1
  323. package/dist/identity-DT5VmvXy.js.map +0 -1
  324. package/dist/indexeddb-storage-BJVtiQKm.js.map +0 -1
  325. package/dist/indexeddb-storage-CIoW21Xd.cjs.map +0 -1
  326. package/dist/interactions-DTgKy_6K.js.map +0 -1
  327. package/dist/interactions-fEN6FbVo.cjs.map +0 -1
  328. package/dist/journey-CuJrHzEg.js.map +0 -1
  329. package/dist/journey-pffMVMfa.cjs +0 -2
  330. package/dist/journey-pffMVMfa.cjs.map +0 -1
  331. package/dist/library-console-C1m6g1BR.js.map +0 -1
  332. package/dist/library-console-D2GY9Or6.cjs.map +0 -1
  333. package/dist/library-request-1BX_UlaX.cjs.map +0 -1
  334. package/dist/library-request-BQBT9N9Q.js.map +0 -1
  335. package/dist/lifecycle-2EtUaRpo.cjs.map +0 -1
  336. package/dist/lifecycle-BaKx_-32.js.map +0 -1
  337. package/dist/log-record-CAoGBBf3.js.map +0 -1
  338. package/dist/log-record-i9zOTkpQ.cjs.map +0 -1
  339. package/dist/long-frames-BVg4i5SC.cjs +0 -2
  340. package/dist/long-frames-BVg4i5SC.cjs.map +0 -1
  341. package/dist/long-frames-Czk7IupC.js.map +0 -1
  342. package/dist/network-DBNwApoF.js.map +0 -1
  343. package/dist/network-xbbuvG_6.cjs.map +0 -1
  344. package/dist/otlp-BDvFrLnc.cjs +0 -2
  345. package/dist/otlp-BDvFrLnc.cjs.map +0 -1
  346. package/dist/otlp-BTJdIa6F.js.map +0 -1
  347. package/dist/platform-C2Ez5kDc.cjs.map +0 -1
  348. package/dist/platform-DkcuXwe-.js.map +0 -1
  349. package/dist/remote-rules-Cfb4K-Nl.js.map +0 -1
  350. package/dist/remote-rules-vzvk7aKf.cjs.map +0 -1
  351. package/dist/reports-Dk2YhKIh.cjs.map +0 -1
  352. package/dist/reports-TA-zInnq.js.map +0 -1
  353. package/dist/resource-timing-BLv3EA2A.js.map +0 -1
  354. package/dist/resource-timing-Cysw1S1f.cjs.map +0 -1
  355. package/dist/sampling-C4VV-1MS.js.map +0 -1
  356. package/dist/sampling-Ckh2yW9k.cjs.map +0 -1
  357. package/dist/sanitize-6ymPlVvP.js.map +0 -1
  358. package/dist/sanitize-BAWzkZt0.cjs.map +0 -1
  359. package/dist/select-ZF4by-lF.cjs.map +0 -1
  360. package/dist/select-xtQaenIi.js.map +0 -1
  361. package/dist/sender-CiMHC9YG.js.map +0 -1
  362. package/dist/sender-D5wBoXA8.cjs +0 -2
  363. package/dist/sender-D5wBoXA8.cjs.map +0 -1
  364. package/dist/storm-CYi9Swpx.cjs.map +0 -1
  365. package/dist/storm-VR024_QN.js.map +0 -1
  366. package/dist/unclean-exit-CwcUhFOn.js.map +0 -1
  367. package/dist/unclean-exit-DFUN57wY.cjs.map +0 -1
  368. package/dist/user-timing-C9kfRq3J.cjs +0 -2
  369. package/dist/user-timing-C9kfRq3J.cjs.map +0 -1
  370. package/dist/user-timing-_jZIhDKI.js.map +0 -1
  371. package/dist/web-socket-BWUoqBh8.cjs.map +0 -1
  372. package/dist/web-socket-CV7yIMnm.js.map +0 -1
  373. package/dist/web-vitals-Bq4WFHQo.js +0 -52
  374. package/dist/web-vitals-Bq4WFHQo.js.map +0 -1
  375. package/dist/web-vitals-DFuoTQbZ.cjs +0 -2
  376. package/dist/web-vitals-DFuoTQbZ.cjs.map +0 -1
  377. package/dist/worker-protocol-Bai7GAIA.cjs.map +0 -1
  378. package/dist/worker-protocol-CrsdSDLn.js.map +0 -1
  379. package/dist/worker-server-BrIYkfoa.cjs +0 -2
  380. package/dist/worker-server-BrIYkfoa.cjs.map +0 -1
  381. package/dist/worker-transport-Bwej4N2e.cjs +0 -2
  382. package/dist/worker-transport-Bwej4N2e.cjs.map +0 -1
  383. package/dist/worker-transport-D6jtgpqN.js.map +0 -1
@@ -3,7 +3,7 @@ import type { LogLevel, LogRecord } from "../models/log-record";
3
3
  import type { RemoteRules } from "./remote-sampling";
4
4
  /** Value of the longest prefix that matches a namespace. */
5
5
  interface PrefixMatch<T> {
6
- /** Value of the prefix, for example a rate or a level. */
6
+ /** The prefix's value, for example a rate or a level. */
7
7
  value: T;
8
8
  /** Length of the prefix. */
9
9
  length: number;
@@ -17,15 +17,15 @@ interface PrefixMatch<T> {
17
17
  */
18
18
  export declare function longestPrefix<T>(namespace: string, values: Record<string, T>): PrefixMatch<T> | undefined;
19
19
  /**
20
- * Finds the minimum level of a namespace in the config. The longest matching prefix of
21
- * `minLevels` wins. A namespace with no match uses `minLevel`.
20
+ * Finds a namespace's minimum level in the config. The longest matching prefix in
21
+ * `minLevels` wins, and a namespace with no match uses `minLevel`.
22
22
  * @param namespace Target application namespace.
23
23
  * @param config Active configuration instance.
24
- * @returns The minimum level of the namespace.
24
+ * @returns The namespace's minimum level.
25
25
  */
26
26
  export declare function levelFor(namespace: string, config: ResolvedConfig): LogLevel;
27
27
  /**
28
- * Decides if sampling keeps a key at a rate. One key always gives the same result.
28
+ * Decides whether sampling keeps a key at a rate. The same key always gets the same result.
29
29
  * @param key Journey ID or trace ID.
30
30
  * @param rate Sampling rate, 0..1.
31
31
  * @returns True if sampling keeps the key.
@@ -39,44 +39,44 @@ export interface SampleInput {
39
39
  type: string;
40
40
  /** Originating application namespace. */
41
41
  namespace: string;
42
- /** Active journey ID. It is empty when no journey runs. */
42
+ /** Active journey ID. Empty when no journey is running. */
43
43
  journeyId: string;
44
- /** Trace ID. It is the sampling key when no journey runs. */
44
+ /** Trace ID. Used as the sampling key when no journey is running. */
45
45
  traceId: string;
46
- /** True for a point of a counter or histogram. A sample of a sum gives a false sum. */
46
+ /** True for a counter or histogram point. Sampling a sum would give a false sum. */
47
47
  aggregated?: boolean;
48
48
  }
49
49
  /**
50
- * Decides if sampling keeps an entry. It reads fields, not a record.
51
- * This lets the caller drop an entry before the attribute walk runs.
50
+ * Decides whether sampling keeps an entry. Reads fields, not a record, so the caller can
51
+ * drop an entry before the attribute walk runs.
52
52
  * @param input Fields the sampling decision reads.
53
53
  * @param config Active configuration instance.
54
- * @param remote Remote rules in force, or null.
54
+ * @param remote Current remote rules, or null.
55
55
  * @returns True if the runtime keeps and sends the entry.
56
56
  */
57
57
  export declare function shouldSampleInput(input: SampleInput, config: ResolvedConfig, remote: RemoteRules | null): boolean;
58
58
  /**
59
- * Decides if sampling keeps a built log record. The runtime uses it for records
59
+ * Decides whether sampling keeps a built log record. The runtime uses it for records
60
60
  * that a child context sends over the bus.
61
61
  * @param record Record to evaluate.
62
62
  * @param config Active configuration instance.
63
- * @param remote Remote rules in force, or null.
63
+ * @param remote Current remote rules, or null.
64
64
  * @returns True if the runtime keeps and sends the record.
65
65
  */
66
66
  export declare function shouldSample(record: LogRecord, config: ResolvedConfig, remote?: RemoteRules | null): boolean;
67
67
  /**
68
- * Sets a fixed-window limit on the records that bypass sampling by their level.
68
+ * Puts a fixed-window limit on the records that bypass sampling because of their level.
69
69
  *
70
- * ErrorCapture already limits auto-captured errors. This class limits the remaining case.
71
- * An example is application code that calls logger.error in a render loop.
70
+ * ErrorCapture already limits auto-captured errors. This class covers what is left, for
71
+ * example application code that calls logger.error in a render loop.
72
72
  */
73
73
  export declare class ErrorCeiling {
74
74
  /** Records at or above the threshold level admitted in the current window. */
75
75
  private readonly window;
76
76
  /**
77
- * Checks a record against the limit. It counts only records at or above `from`.
77
+ * Checks a record against the limit. Only records at or above `from` are counted.
78
78
  * @param record Record about to enter a stream.
79
- * @param limit Maximum records in one window. Set 0 for no limit.
79
+ * @param limit Maximum records in one window. Pass 0 for no limit.
80
80
  * @param windowMs Rate limit window, in milliseconds.
81
81
  * @param from Lowest level that bypasses sampling.
82
82
  * @returns False when the window has no allowance left. The caller must drop the record.
@@ -11,7 +11,7 @@ export interface SenderDeps {
11
11
  /** Memory store that this runtime keeps when the security context changes. */
12
12
  storage?: StorageAdapter;
13
13
  onStorage?: (storage: StorageAdapter) => void;
14
- /** Receives the state of the request for persistent storage. */
14
+ /** Receives the state of the persistent-storage request. */
15
15
  onPersistence?: (state: StoragePersistence) => void;
16
16
  /** Active configuration instance. */
17
17
  config: ResolvedConfig;
@@ -19,11 +19,11 @@ export interface SenderDeps {
19
19
  diagnostics: Diagnostics;
20
20
  /** Receives a report when storage drops batches before delivery. */
21
21
  onGap: GapReporter;
22
- /** Receives the records that the transport, the retry engine and the exit flush lose. */
22
+ /** Receives the records lost by the transport, the retry engine and the exit flush. */
23
23
  onLoss: LossReporter;
24
- /** Slot of the runtime for the sampling rules from the ingest server. */
24
+ /** The runtime's slot for the sampling rules from the ingest server. */
25
25
  remote: RemoteSlot;
26
- /** Sends the points of the open metric interval before the exit flush drains the buffers. */
26
+ /** Sends the open metric interval's points before the exit flush drains the buffers. */
27
27
  beforeExit?: () => void;
28
28
  }
29
29
  /** Delivery stack for one sender runtime. */
@@ -34,9 +34,9 @@ export declare class Sender {
34
34
  private readonly exitFlush;
35
35
  private readonly diagnostics;
36
36
  private readonly transport;
37
- /** True after retire(). A late emergency import then does not wake the retry engine. */
37
+ /** True after retire(), so a late emergency import doesn't wake the retry engine. */
38
38
  private retired;
39
- /** Emergency queue import. retire() waits for it before it reads storage. */
39
+ /** Emergency queue import. retire() waits for it before reading storage. */
40
40
  private emergencyImport;
41
41
  /**
42
42
  * @param storage Storage adapter for undelivered batches.
@@ -44,12 +44,12 @@ export declare class Sender {
44
44
  * @param pipeline Pipeline that batches records.
45
45
  * @param exitFlush Handler that sends pending records on unload.
46
46
  * @param diagnostics Diagnostics reporter.
47
- * @param transport Transport of the pipeline and the retry engine.
47
+ * @param transport The transport that the pipeline and the retry engine use.
48
48
  */
49
49
  private constructor();
50
50
  /**
51
51
  * Builds the delivery stack and starts the retry loop. The emergency queue import runs
52
- * after the start. A slow IndexedDB open then does not hold the boot buffer.
52
+ * after the start, so a slow IndexedDB open doesn't hold up the boot buffer.
53
53
  * @param deps Configuration, diagnostics and gap reporter.
54
54
  * @returns Promise that resolves to the started sender.
55
55
  */
@@ -60,8 +60,8 @@ export declare class Sender {
60
60
  */
61
61
  push(record: LogRecord): void;
62
62
  /**
63
- * Sends the records in the stream buffers. Then it waits for each batch in flight.
64
- * @returns Promise that resolves when the pipeline sends or stores each batch.
63
+ * Sends the records in the stream buffers, then waits for every batch in flight.
64
+ * @returns Promise that resolves once the pipeline has sent or stored every batch.
65
65
  */
66
66
  flush(): Promise<void>;
67
67
  /**
@@ -78,37 +78,39 @@ export declare class Sender {
78
78
  queueDepth(): Promise<number>;
79
79
  /**
80
80
  * Reads the delivery state of the pipeline and the transport.
81
- * @returns Records that wait, records in requests and the last accepted send.
81
+ * @returns Waiting records, records in requests and the last accepted send.
82
82
  */
83
83
  stats(): Omit<DeliveryStats, "stored">;
84
84
  /**
85
- * Sends pending records with a normal flush, then with the exit flush. Then it stops all
86
- * timers and listeners. Then it closes storage. The normal flush keeps the headers, gzip
87
- * and the retry. The exit flush takes the records that the normal flush did not confirm.
85
+ * Sends pending records with a normal flush, then with the exit flush, then stops all
86
+ * timers and listeners and closes storage. The normal flush keeps the headers, gzip and
87
+ * the retry. The exit flush picks up the records the normal flush didn't confirm.
88
88
  * @returns Promise that resolves when storage closes.
89
89
  */
90
90
  destroy(): Promise<void>;
91
91
  /**
92
- * Stops this sender before a new delivery identity takes effect. It does not run exit delivery.
92
+ * Stops this sender before a new delivery identity takes effect. Does not run exit delivery.
93
93
  * @param policy Rule for the old records.
94
94
  * @param timeoutMs Maximum wait for a flush, in milliseconds.
95
95
  * @param contextId Identity of the old delivery context.
96
- * @returns Records that were in memory, and the batches that were stored, after the delivery attempt.
96
+ * @returns The records that were in memory and the batches that were stored, after the
97
+ * delivery attempt.
97
98
  */
98
99
  retire(policy: "discard" | "flush" | "retain" | "carry", timeoutMs: number, contextId: string): Promise<{
99
100
  buffered: LogRecord[];
100
101
  stored: LogBatch[];
101
102
  }>;
102
103
  /**
103
- * Stores batches of an earlier context under this context. Then the retry engine sends them.
104
- * The live buffer does not take them. A large backlog would exceed its budget.
105
- * @param batches Stored batches of the earlier context.
104
+ * Stores an earlier context's batches under this context, and the retry engine then sends
105
+ * them. They don't go through the live buffer, because a large backlog would exceed its
106
+ * budget.
107
+ * @param batches The earlier context's stored batches.
106
108
  * @param contextId Identity of this delivery context.
107
109
  * @returns Promise that resolves when the batches are stored.
108
110
  */
109
111
  adopt(batches: readonly LogBatch[], contextId: string): Promise<void>;
110
112
  /**
111
- * Moves the batches of the emergency queue into storage, then wakes the retry engine.
113
+ * Moves the emergency queue's batches into storage, then wakes the retry engine.
112
114
  * The previous page load parked them during its unload.
113
115
  */
114
116
  private importEmergency;
@@ -1,5 +1,5 @@
1
1
  import type { EndedTrace } from "../utils/tracing";
2
- /** One span that the runtime records. */
2
+ /** One span recorded by the runtime. */
3
3
  export interface SpanData {
4
4
  /** Span name. */
5
5
  name: string;
@@ -9,7 +9,7 @@ export interface SpanData {
9
9
  traceId: string;
10
10
  /** Span ID. */
11
11
  spanId: string;
12
- /** Span ID of the parent, or "" for a root span. */
12
+ /** The parent's span ID, or "" for a root span. */
13
13
  parentSpanId: string;
14
14
  /** Start time in epoch milliseconds. */
15
15
  startMs: number;
@@ -17,7 +17,7 @@ export interface SpanData {
17
17
  endMs: number;
18
18
  /** True for a failed operation. */
19
19
  error: boolean;
20
- /** Attributes of the span. */
20
+ /** The span's attributes. */
21
21
  attributes: Record<string, unknown>;
22
22
  /** Server span linked through a response traceparent entry. */
23
23
  link?: {
@@ -26,13 +26,13 @@ export interface SpanData {
26
26
  };
27
27
  }
28
28
  /**
29
- * Builds the root span of an ambient trace that ended.
29
+ * Builds the root span for an ambient trace that has ended.
30
30
  * @param ended The trace.
31
31
  * @returns The span data.
32
32
  */
33
33
  export declare function rootSpan(ended: EndedTrace): SpanData;
34
34
  /**
35
- * Builds the span fields of a span record. The record limits do not cut them.
35
+ * Builds the span fields for a span record. The record limits don't trim them.
36
36
  * @param span The span data.
37
37
  * @returns The fields.
38
38
  */
@@ -1,7 +1,4 @@
1
- // src/utils/unref.ts
2
- function e(e) {
3
- typeof e != "number" && e.unref?.();
4
- }
1
+ import { t as e } from "./unref-DgHPQeWv.js";
5
2
  // src/utils/deadline.ts
6
3
  var t = class extends Error {
7
4
  constructor(e) {
@@ -19,6 +16,6 @@ function n(n, r) {
19
16
  clearTimeout(i);
20
17
  });
21
18
  }
22
- export { n, e as r, t };
19
+ export { n, t };
23
20
 
24
- //# sourceMappingURL=deadline-BOjOxNHj.js.map
21
+ //# sourceMappingURL=deadline-C4ccAuk5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deadline-C4ccAuk5.js","names":["unrefTimer","DeadlineError","ms","withDeadline","expire","deadline","timer","work"],"sources":["../src/utils/deadline.ts"],"sourcesContent":["// src/utils/deadline.ts\n//\n// Puts a deadline on a promise that could stay pending. A pending promise raises no\n// diagnostics event, so without a deadline its caller waits forever and keeps its slot.\n\nimport { unrefTimer } from \"./unref\";\n\n/** The error for a promise that didn't settle before its deadline. */\nexport class DeadlineError extends Error {\n /**\n * @param ms Deadline in milliseconds.\n */\n constructor(ms: number) {\n super(`The operation took longer than ${String(ms)} ms.`);\n this.name = \"DeadlineError\";\n }\n}\n\n/**\n * Rejects when a promise doesn't settle within a deadline.\n * @param work The promise to bound.\n * @param ms Deadline in milliseconds.\n * @returns The promise's value, or a rejection after the deadline.\n */\nexport function withDeadline<T>(work: Promise<T>, ms: number): Promise<T> {\n let expire: ReturnType<typeof setTimeout> | undefined;\n\n const deadline = new Promise<never>((_resolve, reject) => {\n const timer = setTimeout(() => {\n reject(new DeadlineError(ms));\n }, ms);\n\n expire = timer;\n unrefTimer(timer);\n });\n\n // Clear the timer on success and on failure. Otherwise every storage call leaves an armed timer.\n return Promise.race([work, deadline]).finally(() => {\n clearTimeout(expire);\n });\n}\n"],"mappings":";;AAQA,IAAaC,IAAb,cAAmC,MAAM;CAIvC,YAAY,GAAY;EAEtB,AADA,MAAM,kCAAkC,OAAOC,CAAE,EAAE,KAAK,GACxD,KAAK,OAAO;CACd;AACF;AAQA,SAAgBC,EAAgB,GAAkB,GAAwB;CACxE,IAAIC,GAEEC,IAAW,IAAI,SAAgB,GAAU,MAAW;EACxD,IAAMC,IAAQ,iBAAiB;GAC7B,EAAO,IAAIL,EAAcC,CAAE,CAAC;EAC9B,GAAGA,CAAE;EAGL,AADA,IAASI,GACTN,EAAWM,CAAK;CAClB,CAAC;CAGD,OAAO,QAAQ,KAAK,CAACC,GAAMF,CAAQ,CAAC,CAAC,CAAC,cAAc;EAClD,aAAaD,CAAM;CACrB,CAAC;AACH"}
@@ -0,0 +1,2 @@
1
+ const e=require("./unref-CU9Nyz_9.cjs");var t=class extends Error{constructor(e){super(`The operation took longer than ${String(e)} ms.`),this.name=`DeadlineError`}};function n(n,r){let i,a=new Promise((n,a)=>{let o=setTimeout(()=>{a(new t(r))},r);i=o,e.t(o)});return Promise.race([n,a]).finally(()=>{clearTimeout(i)})}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
2
+ //# sourceMappingURL=deadline-CUGbto-y.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deadline-CUGbto-y.cjs","names":["require_unref","DeadlineError","ms","withDeadline","expire","deadline","timer","reject","work"],"sources":["../src/utils/deadline.ts"],"sourcesContent":["// src/utils/deadline.ts\n//\n// Puts a deadline on a promise that could stay pending. A pending promise raises no\n// diagnostics event, so without a deadline its caller waits forever and keeps its slot.\n\nimport { unrefTimer } from \"./unref\";\n\n/** The error for a promise that didn't settle before its deadline. */\nexport class DeadlineError extends Error {\n /**\n * @param ms Deadline in milliseconds.\n */\n constructor(ms: number) {\n super(`The operation took longer than ${String(ms)} ms.`);\n this.name = \"DeadlineError\";\n }\n}\n\n/**\n * Rejects when a promise doesn't settle within a deadline.\n * @param work The promise to bound.\n * @param ms Deadline in milliseconds.\n * @returns The promise's value, or a rejection after the deadline.\n */\nexport function withDeadline<T>(work: Promise<T>, ms: number): Promise<T> {\n let expire: ReturnType<typeof setTimeout> | undefined;\n\n const deadline = new Promise<never>((_resolve, reject) => {\n const timer = setTimeout(() => {\n reject(new DeadlineError(ms));\n }, ms);\n\n expire = timer;\n unrefTimer(timer);\n });\n\n // Clear the timer on success and on failure. Otherwise every storage call leaves an armed timer.\n return Promise.race([work, deadline]).finally(() => {\n clearTimeout(expire);\n });\n}\n"],"mappings":"A,wCAQA,IAAaC,EAAb,cAAmC,KAAM,CAIvC,YAAY,EAAY,CACtB,MAAM,kCAAkC,OAAOC,CAAE,EAAE,KAAK,EACxD,KAAK,KAAO,eACd,CACF,EAQA,SAAgBC,EAAgB,EAAkB,EAAwB,CACxE,IAAIC,EAEEC,EAAW,IAAI,SAAgB,EAAU,IAAW,CACxD,IAAMC,EAAQ,eAAiB,CAC7BC,EAAO,IAAIN,EAAcC,CAAE,CAAC,CAC9B,EAAGA,CAAE,EAEL,EAASI,EACTN,EAAA,EAAWM,CAAK,CAClB,CAAC,EAGD,OAAO,QAAQ,KAAK,CAACE,EAAMH,CAAQ,CAAC,CAAC,CAAC,YAAc,CAClD,aAAaD,CAAM,CACrB,CAAC,CACH,C"}
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./guards-Cidk71ME.js";
2
- import { i as t } from "./platform-DkcuXwe-.js";
3
- import { n } from "./sanitize-6ymPlVvP.js";
2
+ import { i as t } from "./platform-CVewe4wQ.js";
3
+ import { n } from "./sanitize-CNmsD9r3.js";
4
4
  // src/core/debug-bundle.ts
5
5
  function r(n) {
6
6
  return typeof n == "string" ? /^[a-z][a-z\d+.-]*:\/\//i.test(n) ? t(n, !1) : n : Array.isArray(n) ? n.map(r) : e(n) ? Object.fromEntries(Object.entries(n).map(([e, t]) => [e, r(t)])) : n;
@@ -16,10 +16,17 @@ function i(e, i, a) {
16
16
  ...s,
17
17
  ignoreUrls: s.ignoreUrls.map(o),
18
18
  plugins: s.plugins.map((e) => e.name)
19
+ },
20
+ replay: {
21
+ ...e.replay,
22
+ endpoint: o(e.replay.endpoint),
23
+ headers: e.replay.headers !== null,
24
+ plugins: e.replay.plugins.length,
25
+ recordOptions: Object.keys(e.replay.recordOptions)
19
26
  }
20
27
  };
21
28
  return Reflect.deleteProperty(l, "headers"), r(n(l, i, a));
22
29
  }
23
30
  export { i as configSummary };
24
31
 
25
- //# sourceMappingURL=debug-bundle-C7UkHZ-q.js.map
32
+ //# sourceMappingURL=debug-bundle-BOdYmCeV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-bundle-BOdYmCeV.js","names":["isObject","recordedUrl","stripUrls","value","key","entry","configSummary","cut","config","copy","serializer","capture","plugin","sanitize","limits","diagnostics"],"sources":["../src/core/debug-bundle.ts"],"sourcesContent":["// src/core/debug-bundle.ts\n//\n// 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 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 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":";;;;AAiBA,SAASE,EAAU,GAAyB;CAa1C,OAZI,OAAOC,KAAU,WACZ,0BAA0B,KAAKA,CAAK,IAAIF,EAAYE,GAAO,EAAK,IAAIA,IAGzE,MAAM,QAAQA,CAAK,IACdA,EAAM,IAAID,CAAS,IAGxBF,EAASG,CAAK,IACT,OAAO,YAAY,OAAO,QAAQA,CAAK,CAAC,CAAC,KAAK,CAACC,GAAKC,OAAW,CAACD,GAAKF,EAAUG,CAAK,CAAC,CAAC,CAAC,IAGzFF;AACT;AAUA,SAAgBG,EACd,GACA,GACA,GACyB;CAEzB,IAAMC,KAAO,MACX,OAAOJ,KAAU,WAAWF,EAAYE,GAAO,EAAK,IAAIA,GACpD,EAAE,YAAS,kBAAeK,GAC1BC,IAAgC;EACpC,GAAGD;EACH,UAAUD,EAAIC,EAAO,QAAQ;EAC7B,iBAAiBD,EAAIC,EAAO,eAAe;EAC3C,gBAAgBD,EAAIC,EAAO,cAAc;EAEzC,YAAY,OAAOE,KAAe,WAAWA,IAAaA,EAAW;EACrE,SAAS;GACP,GAAGC;GACH,YAAYA,EAAQ,WAAW,IAAIJ,CAAG;GACtC,SAASI,EAAQ,QAAQ,KAAK,MAAWC,EAAO,IAAI;EACtD;EAEA,QAAQ;GACN,GAAGJ,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,EAAUW,EAASJ,GAAMK,GAAQC,CAAW,CAAC;AACtD"}
@@ -0,0 +1,2 @@
1
+ const e=require("./guards-nJ70syPt.cjs"),t=require("./platform-12uR7kBQ.cjs"),n=require("./sanitize-ChLn97Ch.cjs");function r(n){return typeof n==`string`?/^[a-z][a-z\d+.-]*:\/\//i.test(n)?t.i(n,!1):n:Array.isArray(n)?n.map(r):e.t(n)?Object.fromEntries(Object.entries(n).map(([e,t])=>[e,r(t)])):n}function i(e,i,a){let o=e=>typeof e==`string`?t.i(e,!1):e,{capture:s,serializer:c}=e,l={...e,endpoint:o(e.endpoint),metricsEndpoint:o(e.metricsEndpoint),tracesEndpoint:o(e.tracesEndpoint),serializer:typeof c==`string`?c:c.name,capture:{...s,ignoreUrls:s.ignoreUrls.map(o),plugins:s.plugins.map(e=>e.name)},replay:{...e.replay,endpoint:o(e.replay.endpoint),headers:e.replay.headers!==null,plugins:e.replay.plugins.length,recordOptions:Object.keys(e.replay.recordOptions)}};return Reflect.deleteProperty(l,`headers`),r(n.n(l,i,a))}exports.configSummary=i;
2
+ //# sourceMappingURL=debug-bundle-Ex4L_LSP.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-bundle-Ex4L_LSP.cjs","names":["recordedUrl","isObject","sanitize","require_guards","require_platform","require_sanitize","stripUrls","value","key","entry","configSummary","cut","config","copy","serializer","capture","plugin","limits","diagnostics"],"sources":["../src/core/debug-bundle.ts"],"sourcesContent":["// src/core/debug-bundle.ts\n//\n// 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 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 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,mHAiBA,SAASM,EAAU,EAAyB,CAa1C,OAZI,OAAOC,GAAU,SACZ,0BAA0B,KAAKA,CAAK,EAAIP,EAAAA,EAAYO,EAAO,EAAK,EAAIA,EAGzE,MAAM,QAAQA,CAAK,EACdA,EAAM,IAAID,CAAS,EAGxBL,EAAAA,EAASM,CAAK,EACT,OAAO,YAAY,OAAO,QAAQA,CAAK,CAAC,CAAC,KAAK,CAACC,EAAKC,KAAW,CAACD,EAAKF,EAAUG,CAAK,CAAC,CAAC,CAAC,EAGzFF,CACT,CAUA,SAAgBG,EACd,EACA,EACA,EACyB,CAEzB,IAAMC,EAAO,GACX,OAAOJ,GAAU,SAAWP,EAAAA,EAAYO,EAAO,EAAK,EAAIA,EACpD,CAAE,UAAS,cAAeK,EAC1BC,EAAgC,CACpC,GAAGD,EACH,SAAUD,EAAIC,EAAO,QAAQ,EAC7B,gBAAiBD,EAAIC,EAAO,eAAe,EAC3C,eAAgBD,EAAIC,EAAO,cAAc,EAEzC,WAAY,OAAOE,GAAe,SAAWA,EAAaA,EAAW,KACrE,QAAS,CACP,GAAGC,EACH,WAAYA,EAAQ,WAAW,IAAIJ,CAAG,EACtC,QAASI,EAAQ,QAAQ,IAAK,GAAWC,EAAO,IAAI,CACtD,EAEA,OAAQ,CACN,GAAGJ,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,EAAUJ,EAAAA,EAASW,EAAMI,EAAQC,CAAW,CAAC,CACtD,C"}
package/dist/doctor.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./constants-DqKJH_MP.cjs"),t=require("./otlp-BDvFrLnc.cjs");var n=1e4,r=0,i=1,a=2,o=`Usage: uiobs doctor <url> --origin <origin>. An origin has no path and no trailing slash.`,s=`Access-Control-Expose-Headers`,c=[e.lt,e.ct,e.st,e.ot].map(e=>e.toLowerCase()),l=[e.ft,e.ut].map(e=>e.toLowerCase());function u(){let t=crypto.randomUUID().replaceAll(`-`,``);return{timeUnixNano:`${String(Date.now())}000000`,traceId:t,spanId:t.slice(0,16),traceFlags:1,severityNumber:e.bn.INFO,severityText:`INFO`,body:`uiobs doctor test record`,attributes:{},resource:{"service.name":`uiobs-doctor`}}}async function d(e,t){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 f(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 p=e=>e.ok?void 0:`The server returned ${String(e.status)}.`;function m(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}}async function h(n,r){let i=e=>{let t=e.headers.get(`Access-Control-Allow-Origin`);return t===r||t===`*`?void 0:`Access-Control-Allow-Origin is ${String(t)}. It must allow ${r}.`},a=await d(n,{method:`OPTIONS`,headers:{Origin:r,"Access-Control-Request-Method":`POST`,"Access-Control-Request-Headers":c.join(`, `)}}),{body:o,contentType:h}=t.r.serialize([u()]),g=(t,i,a,o={})=>d(n,{method:`POST`,headers:{Origin:r,[e.lt]:h,[e.st]:t,[e.ot]:String(i),...o},body:a}),_=crypto.randomUUID(),v=await g(_,0,o),y=await g(_,1,o),b=await t.a(o),x=b?await g(crypto.randomUUID(),0,b,{[e.ct]:e.tt}):`This Node version has no CompressionStream.`,S=typeof v==`string`?[]:f(v,s,l),C=S.length>0?` Optional headers stay hidden: ${S.join(`, `)}.`:``;return[m(`preflight`,a,`The server permits POST from this origin.`,p,i),m(`allowed headers`,a,`The server allows each request header of the library.`,e=>{let t=f(e,`Access-Control-Allow-Headers`,c);return t.length>0?`Access-Control-Allow-Headers must include ${t.join(`, `)}.`:void 0}),m(`test batch`,v,`The server accepted a test batch.`,p,i),m(`exposed headers`,v,`The server exposes Retry-After.${C}`,e=>f(e,s,[`retry-after`]).length>0?`${s} must include retry-after.`:void 0),m(`gzip`,x,`The server accepted a gzip batch.`,p),m(`deduplication`,y,`The server accepted a repeated batch id. A client cannot see if it stored the batch again.`,p)]}function g(e){return/^https?:\/\//i.test(e)&&URL.canParse(e)}function _(e){return URL.canParse(e)&&new URL(e).origin===e}async function v(e,t){let[n,s,c,l]=e;if(n!==`doctor`||c!==`--origin`||!g(s)||!_(l))return t(o),t(`Received: ${JSON.stringify(e)}`),a;let u=await h(s,l);for(let{rule:e,pass:n,detail:r}of u)t(`${n?`PASS`:`FAIL`} ${e}: ${r}`);return u.every(({pass:e})=>e)?r:i}exports.main=v,exports.runDoctor=h;
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;
2
2
  //# sourceMappingURL=doctor.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.cjs","names":["HEADER_CONTENT_TYPE","HEADER_CONTENT_ENCODING","HEADER_BATCH_ID","HEADER_ATTEMPT","HEADER_SAMPLING","HEADER_DATE","SEVERITY_NUMBER","otlpSerializer","gzip","ENCODING_GZIP","require_constants","require_otlp","REQUEST_TIMEOUT_MS","EXIT_PASS","EXIT_FAIL","EXIT_USAGE","USAGE","EXPOSE_HEADERS","REQUEST_HEADERS","name","OPTIONAL_EXPOSED","testRecord","traceId","request","url","init","error","reason","absent","values","response","value","wanted","statusProblem","judge","tests","problem","answer","test","found","passed","runDoctor","originProblem","allowed","origin","preflight","post","contentType","id","attempt","extra","payload","batchId","first","body","repeated","compressed","zipped","hidden","note","missing","isHttpUrl","isOrigin","main","command","flag","args","print","results","pass","rule","detail"],"sources":["../src/doctor.ts"],"sourcesContent":["// src/doctor.ts\n//\n// Checks an ingest server against the ingest contract in the README. The `uiobs doctor` command\n// calls main(). The code uses web APIs only. The browser build replaces each \"node:\" import.\n\nimport {\n ENCODING_GZIP,\n HEADER_ATTEMPT,\n HEADER_BATCH_ID,\n HEADER_CONTENT_ENCODING,\n HEADER_CONTENT_TYPE,\n HEADER_DATE,\n HEADER_RETRY_AFTER,\n HEADER_SAMPLING,\n SEVERITY_NUMBER,\n} from \"./constants\";\nimport type { LogRecord } from \"./models/log-record\";\nimport { gzip } from \"./transport/compression\";\nimport { otlpSerializer } from \"./transport/serializers/otlp\";\n\n/** Maximum wait for one answer, in milliseconds. */\nconst REQUEST_TIMEOUT_MS = 10000;\n\n/** Exit code when each rule passes. */\nconst EXIT_PASS = 0;\n\n/** Exit code when a rule fails. */\nconst EXIT_FAIL = 1;\n\n/** Exit code of a wrong command. */\nconst EXIT_USAGE = 2;\n\n/** Text of a wrong command. */\nconst USAGE =\n \"Usage: uiobs doctor <url> --origin <origin>. An origin has no path and no trailing slash.\";\n\n/** Response header that lists the headers a page can read. */\nconst EXPOSE_HEADERS = \"Access-Control-Expose-Headers\";\n\n/** Request headers of the library. The server must allow each one. */\nconst REQUEST_HEADERS = [\n HEADER_CONTENT_TYPE,\n HEADER_CONTENT_ENCODING,\n HEADER_BATCH_ID,\n HEADER_ATTEMPT,\n].map((name) => name.toLowerCase());\n\n/** Response headers that only an optional feature reads. */\nconst OPTIONAL_EXPOSED = [HEADER_SAMPLING, HEADER_DATE].map((name) => name.toLowerCase());\n\n/** Result of one rule of the ingest contract. */\nexport interface DoctorResult {\n /** Rule name. */\n rule: string;\n /** True when the server meets the rule. */\n pass: boolean;\n /** Reason of the result. */\n detail: string;\n}\n\n/** An HTTP answer, or the text of a failed request. */\ntype Answer = Response | string;\n\n/** Gives the text of a problem, or undefined when the answer meets the test. */\ntype AnswerTest = (response: Response) => string | undefined;\n\n/** Builds the test record. The server stores it as an ordinary record. */\nfunction testRecord(): LogRecord {\n const traceId = crypto.randomUUID().replaceAll(\"-\", \"\");\n\n return {\n timeUnixNano: `${String(Date.now())}000000`,\n traceId,\n spanId: traceId.slice(0, 16),\n traceFlags: 1,\n severityNumber: SEVERITY_NUMBER.INFO,\n severityText: \"INFO\",\n body: \"uiobs doctor test record\",\n attributes: {},\n resource: { \"service.name\": \"uiobs-doctor\" },\n };\n}\n\n/** Sends one request. The result line reports a failure. The tool has no diagnostics instance. */\nasync function request(url: string, init: RequestInit): Promise<Answer> {\n try {\n // A browser refuses a preflight that redirects. A redirect can also name another host.\n return await fetch(url, {\n ...init,\n redirect: \"manual\",\n signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),\n });\n } catch (error) {\n // Node gives only \"fetch failed\". The cause holds the reason, for example ECONNREFUSED.\n const reason: unknown = error instanceof Error ? (error.cause ?? error) : error;\n\n return `The request failed. ${reason instanceof Error ? reason.message : String(reason)}`;\n }\n}\n\n/** Gives the wanted values that a comma-separated header omits. A wildcard has each value. */\nfunction absent(response: Response, name: string, wanted: readonly string[]): string[] {\n const values = (response.headers.get(name) ?? \"\")\n .toLowerCase()\n .split(\",\")\n .map((value) => value.trim());\n\n return values.includes(\"*\") ? [] : wanted.filter((value) => !values.includes(value));\n}\n\n/** Tests the status of an answer. */\nconst statusProblem: AnswerTest = (response) =>\n response.ok ? undefined : `The server returned ${String(response.status)}.`;\n\n/** Builds the result of one rule. The first problem is the detail. */\nfunction judge(rule: string, answer: Answer, passed: string, ...tests: AnswerTest[]): DoctorResult {\n const problem =\n typeof answer === \"string\"\n ? answer\n : tests.map((test) => test(answer)).find((found) => found !== undefined);\n\n return { rule, pass: problem === undefined, detail: problem ?? passed };\n}\n\n/**\n * Sends the requests of each rule, one at a time. Two requests with one batch id must not overlap.\n * @param url Ingest URL.\n * @param origin Origin of the app.\n * @returns One result for each rule.\n */\nexport async function runDoctor(url: string, origin: string): Promise<DoctorResult[]> {\n const originProblem: AnswerTest = (response) => {\n const allowed = response.headers.get(\"Access-Control-Allow-Origin\");\n\n return allowed === origin || allowed === \"*\"\n ? undefined\n : `Access-Control-Allow-Origin is ${String(allowed)}. It must allow ${origin}.`;\n };\n\n const preflight = await request(url, {\n method: \"OPTIONS\",\n headers: {\n Origin: origin,\n \"Access-Control-Request-Method\": \"POST\",\n \"Access-Control-Request-Headers\": REQUEST_HEADERS.join(\", \"),\n },\n });\n\n const { body, contentType } = otlpSerializer.serialize([testRecord()]);\n const post = (\n id: string,\n attempt: number,\n payload: BodyInit,\n extra: Record<string, string> = {},\n ): Promise<Answer> =>\n request(url, {\n method: \"POST\",\n headers: {\n Origin: origin,\n [HEADER_CONTENT_TYPE]: contentType,\n [HEADER_BATCH_ID]: id,\n [HEADER_ATTEMPT]: String(attempt),\n ...extra,\n },\n body: payload,\n });\n\n const batchId = crypto.randomUUID();\n const first = await post(batchId, 0, body);\n const repeated = await post(batchId, 1, body);\n const compressed = await gzip(body);\n const zipped = compressed\n ? await post(crypto.randomUUID(), 0, compressed, {\n [HEADER_CONTENT_ENCODING]: ENCODING_GZIP,\n })\n : \"This Node version has no CompressionStream.\";\n\n const hidden = typeof first === \"string\" ? [] : absent(first, EXPOSE_HEADERS, OPTIONAL_EXPOSED);\n const note = hidden.length > 0 ? ` Optional headers stay hidden: ${hidden.join(\", \")}.` : \"\";\n\n return [\n judge(\n \"preflight\",\n preflight,\n \"The server permits POST from this origin.\",\n statusProblem,\n originProblem,\n ),\n judge(\n \"allowed headers\",\n preflight,\n \"The server allows each request header of the library.\",\n (response) => {\n const missing = absent(response, \"Access-Control-Allow-Headers\", REQUEST_HEADERS);\n\n return missing.length > 0\n ? `Access-Control-Allow-Headers must include ${missing.join(\", \")}.`\n : undefined;\n },\n ),\n judge(\"test batch\", first, \"The server accepted a test batch.\", statusProblem, originProblem),\n judge(\"exposed headers\", first, `The server exposes Retry-After.${note}`, (response) =>\n absent(response, EXPOSE_HEADERS, [HEADER_RETRY_AFTER.toLowerCase()]).length > 0\n ? `${EXPOSE_HEADERS} must include retry-after.`\n : undefined,\n ),\n judge(\"gzip\", zipped, \"The server accepted a gzip batch.\", statusProblem),\n judge(\n \"deduplication\",\n repeated,\n \"The server accepted a repeated batch id. A client cannot see if it stored the batch again.\",\n statusProblem,\n ),\n ];\n}\n\n/** Tests an HTTP URL. */\nfunction isHttpUrl(value: string): boolean {\n return /^https?:\\/\\//i.test(value) && URL.canParse(value);\n}\n\n/** Tests an exact browser origin. A path or a trailing slash does not match. */\nfunction isOrigin(value: string): boolean {\n return URL.canParse(value) && new URL(value).origin === value;\n}\n\n/**\n * Runs the command line tool.\n * @param args Arguments after the program name.\n * @param print Writes one line of output.\n * @returns The exit code.\n */\nexport async function main(\n args: readonly string[],\n print: (line: string) => void,\n): Promise<number> {\n const [command, url, flag, origin] = args;\n\n if (command !== \"doctor\" || flag !== \"--origin\" || !isHttpUrl(url) || !isOrigin(origin)) {\n print(USAGE);\n print(`Received: ${JSON.stringify(args)}`);\n return EXIT_USAGE;\n }\n\n const results = await runDoctor(url, origin);\n\n for (const { rule, pass, detail } of results) {\n print(`${pass ? \"PASS\" : \"FAIL\"} ${rule}: ${detail}`);\n }\n\n return results.every(({ pass }) => pass) ? EXIT_PASS : EXIT_FAIL;\n}\n"],"mappings":"A,gJAqBA,IAAMY,EAAqB,IAGrBC,EAAY,EAGZC,EAAY,EAGZC,EAAa,EAGbC,EACJ,4FAGIC,EAAiB,gCAGjBC,EAAkB,CACtBlB,EAAAA,GACAC,EAAAA,GACAC,EAAAA,GACAC,EAAAA,EACF,CAAC,CAAC,IAAK,GAASgB,EAAK,YAAY,CAAC,EAG5BC,EAAmB,CAAChB,EAAAA,GAAiBC,EAAAA,EAAW,CAAC,CAAC,IAAK,GAASc,EAAK,YAAY,CAAC,EAmBxF,SAASE,GAAwB,CAC/B,IAAMC,EAAU,OAAO,WAAW,CAAC,CAAC,WAAW,IAAK,EAAE,EAEtD,MAAO,CACL,aAAc,GAAG,OAAO,KAAK,IAAI,CAAC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FR,EAAM,kBAAmBmB,EAAO,kCAAkCM,IAAS,GACzE/B,EAAOE,EAAUb,EAAgB,CAAA,aAAiC,CAAC,CAAC,CAAC,OAAS,EAC1E,GAAGA,EAAe,4BAClB,IAAA,EACN,EACAiB,EAAM,OAAQuB,EAAQ,oCAAqCxB,CAAa,EACxEC,EACE,gBACAqB,EACA,6FACAtB,CACF,CACF,CACF,CAGA,SAAS4B,EAAU,EAAwB,CACzC,MAAO,gBAAgB,KAAK9B,CAAK,GAAK,IAAI,SAASA,CAAK,CAC1D,CAGA,SAAS+B,EAAS,EAAwB,CACxC,OAAO,IAAI,SAAS/B,CAAK,GAAK,IAAI,IAAIA,CAAK,CAAC,CAAC,SAAWA,CAC1D,CAQA,eAAsBgC,EACpB,EACA,EACiB,CACjB,GAAM,CAACC,EAASxC,EAAKyC,EAAMrB,GAAUsB,EAErC,GAAIF,IAAY,UAAYC,IAAS,YAAc,CAACJ,EAAUrC,CAAG,GAAK,CAACsC,EAASlB,CAAM,EAGpF,OAFAuB,EAAMnD,CAAK,EACXmD,EAAM,aAAa,KAAK,UAAUD,CAAI,GAAG,EAClCnD,EAGT,IAAMqD,EAAU,MAAM3B,EAAUjB,EAAKoB,CAAM,EAE3C,IAAK,GAAM,CAAE,OAAM,OAAM,YAAYwB,EACnCD,EAAM,GAAGE,EAAO,OAAS,OAAO,GAAGC,EAAK,IAAIC,GAAQ,EAGtD,OAAOH,EAAQ,OAAO,CAAE,UAAWC,CAAI,EAAIxD,EAAYC,CACzD,C"}
1
+ {"version":3,"file":"doctor.cjs","names":["HEADER_CONTENT_TYPE","HEADER_CONTENT_ENCODING","HEADER_BATCH_ID","HEADER_ATTEMPT","HEADER_SAMPLING","HEADER_DATE","SEVERITY_NUMBER","gzip","ENCODING_GZIP","otlpSerializer","QUERY_PARAM_BATCH_ID","QUERY_PARAM_EXIT_REASON","CONTENT_TYPE_TEXT_PLAIN","CONTENT_TYPE_JSON","LIBRARY_TIMEOUT_MS","require_constants","require_compression","require_otlp","REQUEST_TIMEOUT_MS","EXIT_PASS","EXIT_FAIL","EXIT_USAGE","USAGE","HEADER_FLAG","REPLAY_FLAG","LARGE_EVENT_CHARS","CUSTOM_EVENT","DOCTOR_NAME","HEADER_PATTERN","HIDDEN","EXPOSE_HEADERS","REQUEST_HEADERS","name","RESERVED_HEADERS","OPTIONAL_EXPOSED","testRecord","traceId","request","url","init","timeoutMs","error","reason","absent","values","response","value","wanted","statusProblem","judge","tests","problem","answer","test","found","passed","targetOf","customNames","custom","originTest","allowed","origin","sendPreflight","requestHeaders","preflightResults","preflight","target","missing","poster","contentType","id","attempt","extra","payload","postZipped","compressed","body","post","runDoctor","originProblem","batchId","first","repeated","zipped","beaconUrl","beacon","hidden","note","runReplayDoctor","replayId","head","segment","events","text","idOf","sequence","small","large","customHeaders","pairs","index","args","match","isHttpUrl","username","password","SHOWN_WORDS","shownArgument","arg","pathname","isOrigin","main","command","flag","rest","replay","headers","print","results","pass","rule","detail"],"sources":["../src/doctor.ts"],"sourcesContent":["// src/doctor.ts\n//\n// Checks an ingest server, or a replay endpoint, against its contract in the README. The\n// `uiobs doctor` command calls main(). Only web APIs are used here, and the browser build\n// replaces every \"node:\" import.\n\nimport {\n CONTENT_TYPE_JSON,\n CONTENT_TYPE_TEXT_PLAIN,\n ENCODING_GZIP,\n HEADER_ATTEMPT,\n HEADER_BATCH_ID,\n HEADER_CONTENT_ENCODING,\n HEADER_CONTENT_TYPE,\n HEADER_DATE,\n HEADER_RETRY_AFTER,\n HEADER_SAMPLING,\n QUERY_PARAM_BATCH_ID,\n QUERY_PARAM_EXIT_REASON,\n REQUEST_TIMEOUT_MS as LIBRARY_TIMEOUT_MS,\n SEVERITY_NUMBER,\n} from \"./constants\";\nimport type { LogRecord } from \"./models/log-record\";\nimport { gzip } from \"./transport/compression\";\nimport { otlpSerializer } from \"./transport/serializers/otlp\";\n\n/** How long to wait for one answer, in milliseconds. */\nconst REQUEST_TIMEOUT_MS = 10000;\n\n/** Exit code when every rule passes. */\nconst EXIT_PASS = 0;\n\n/** Exit code when a rule fails. */\nconst EXIT_FAIL = 1;\n\n/** Exit code for a wrong command. */\nconst EXIT_USAGE = 2;\n\n/** Printed for a wrong command. */\nconst USAGE =\n '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.';\n\n/** Adds a request header, e.g. an Authorization header. */\nconst HEADER_FLAG = \"--header\";\n\n/** Says that the URL is a replay endpoint, so the tool sends segments instead of batches. */\nconst REPLAY_FLAG = \"--replay\";\n\n/**\n * Size of the event in the large test segment, in characters. The first segment of a real\n * upload holds a full snapshot, and one of a page with 35,000 table cells measured 4.7 MB.\n */\nconst LARGE_EVENT_CHARS = 5_000_000;\n\n/** The recorder's custom event type. A player skips a custom event it doesn't know. */\nconst CUSTOM_EVENT = 5;\n\n/** Marks everything the tool stores, so an operator can find and delete it. */\nconst DOCTOR_NAME = \"uiobs-doctor\";\n\n/** A header name, a colon, then a value of printable ASCII. */\nconst HEADER_PATTERN = /^([\\w!#$%&'*+.^`|~-]+): *([\\x20-\\x7e]+)$/;\n\n/** Printed in place of any argument that might contain a secret. */\nconst HIDDEN = \"<hidden>\";\n\n/** Response header that lists the headers a page can read. */\nconst EXPOSE_HEADERS = \"Access-Control-Expose-Headers\";\n\n/** The library's request headers. The server must allow every one of them. */\nconst REQUEST_HEADERS = [\n HEADER_CONTENT_TYPE,\n HEADER_CONTENT_ENCODING,\n HEADER_BATCH_ID,\n HEADER_ATTEMPT,\n].map((name) => name.toLowerCase());\n\n/** Headers the tool sets itself. A custom header can't reuse one of these names. */\nconst RESERVED_HEADERS = [...REQUEST_HEADERS, \"origin\"];\n\n/** Response headers that only an optional feature reads. */\nconst OPTIONAL_EXPOSED = [HEADER_SAMPLING, HEADER_DATE].map((name) => name.toLowerCase());\n\n/** The result of one ingest contract rule. */\nexport interface DoctorResult {\n /** Rule name. */\n rule: string;\n /** True when the server meets the rule. */\n pass: boolean;\n /** Why the rule passed or failed. */\n detail: string;\n}\n\n/** An HTTP answer, or the text of a failed request. */\ntype Answer = Response | string;\n\n/** Returns a description of the problem, or undefined when the answer passes the test. */\ntype AnswerTest = (response: Response) => string | undefined;\n\n/** Builds the test record. The server stores it like any other record. */\nfunction testRecord(): LogRecord {\n const traceId = crypto.randomUUID().replaceAll(\"-\", \"\");\n\n return {\n timeUnixNano: `${String(Date.now())}000000`,\n traceId,\n spanId: traceId.slice(0, 16),\n traceFlags: 1,\n severityNumber: SEVERITY_NUMBER.INFO,\n severityText: \"INFO\",\n body: \"uiobs doctor test record\",\n attributes: {},\n resource: { \"service.name\": DOCTOR_NAME },\n };\n}\n\n/** Sends one request. A failure shows up in the result line, as the tool has no diagnostics. */\nasync function request(\n url: string,\n init: RequestInit,\n timeoutMs = REQUEST_TIMEOUT_MS,\n): Promise<Answer> {\n try {\n // A browser refuses a preflight that redirects, and a redirect can also name another host.\n return await fetch(url, {\n ...init,\n redirect: \"manual\",\n signal: AbortSignal.timeout(timeoutMs),\n });\n } catch (error) {\n // Node only says \"fetch failed\". The cause holds the real reason, for example ECONNREFUSED.\n const reason: unknown = error instanceof Error ? (error.cause ?? error) : error;\n\n return `The request failed. ${reason instanceof Error ? reason.message : String(reason)}`;\n }\n}\n\n/** Returns the wanted values a comma-separated header leaves out. A wildcard covers them all. */\nfunction absent(response: Response, name: string, wanted: readonly string[]): string[] {\n const values = (response.headers.get(name) ?? \"\")\n .toLowerCase()\n .split(\",\")\n .map((value) => value.trim());\n\n return values.includes(\"*\") ? [] : wanted.filter((value) => !values.includes(value));\n}\n\n/** Checks an answer's status. */\nconst statusProblem: AnswerTest = (response) =>\n response.ok ? undefined : `The server returned ${String(response.status)}.`;\n\n/** Builds the result for one rule. The first problem found becomes the detail. */\nfunction judge(rule: string, answer: Answer, passed: string, ...tests: AnswerTest[]): DoctorResult {\n const problem =\n typeof answer === \"string\"\n ? answer\n : tests.map((test) => test(answer)).find((found) => found !== undefined);\n\n return { rule, pass: problem === undefined, detail: problem ?? passed };\n}\n\n/** One endpoint under test: where it is, who calls it and with which headers. */\ninterface Target {\n /** Endpoint URL. */\n url: string;\n /** The app's origin. */\n origin: string;\n /** The app's headers for each POST, e.g. an Authorization header. */\n custom: Readonly<Record<string, string>>;\n /** Lowercase names of every header a POST carries. The preflight asks for them. */\n requestHeaders: string[];\n}\n\n/** Sends one POST the way the library does. Extra headers go on top. */\ntype Post = (\n id: string,\n attempt: number,\n payload: BodyInit,\n extra?: Record<string, string>,\n) => Promise<Answer>;\n\n/** Builds the target for one run. */\nfunction targetOf(url: string, origin: string, custom: Readonly<Record<string, string>>): Target {\n const customNames = Object.keys(custom).map((name) => name.toLowerCase());\n\n return { url, origin, custom, requestHeaders: [...REQUEST_HEADERS, ...customNames] };\n}\n\n/** Builds the test that an answer lets the app's origin read it. */\nfunction originTest(origin: string): AnswerTest {\n return (response) => {\n const allowed = response.headers.get(\"Access-Control-Allow-Origin\");\n\n return allowed === origin || allowed === \"*\"\n ? undefined\n : `Access-Control-Allow-Origin is ${String(allowed)}. It must allow ${origin}.`;\n };\n}\n\n/** Sends the preflight a browser sends before the library's POST. */\nfunction sendPreflight({ url, origin, requestHeaders }: Target): Promise<Answer> {\n return request(url, {\n method: \"OPTIONS\",\n headers: {\n Origin: origin,\n \"Access-Control-Request-Method\": \"POST\",\n \"Access-Control-Request-Headers\": requestHeaders.join(\", \"),\n },\n });\n}\n\n/** Builds the two results every preflight gives. */\nfunction preflightResults(preflight: Answer, target: Target): DoctorResult[] {\n return [\n judge(\n \"preflight\",\n preflight,\n \"The server permits POST from this origin.\",\n statusProblem,\n originTest(target.origin),\n ),\n judge(\n \"allowed headers\",\n preflight,\n \"The server allows each request header of the library.\",\n (response) => {\n const missing = absent(response, \"Access-Control-Allow-Headers\", target.requestHeaders);\n\n return missing.length > 0\n ? `Access-Control-Allow-Headers must include ${missing.join(\", \")}.`\n : undefined;\n },\n ),\n ];\n}\n\n/** Builds the POST function for one target and content type. */\nfunction poster({ url, origin, custom }: Target, contentType: string, timeoutMs?: number): Post {\n return (id, attempt, payload, extra = {}) =>\n request(\n url,\n {\n method: \"POST\",\n headers: {\n ...custom,\n Origin: origin,\n [HEADER_CONTENT_TYPE]: contentType,\n [HEADER_BATCH_ID]: id,\n [HEADER_ATTEMPT]: String(attempt),\n ...extra,\n },\n body: payload,\n },\n timeoutMs,\n );\n}\n\n/** Sends a body with gzip. Gives the text of the problem if this Node can't compress. */\nasync function postZipped(post: Post, id: string, body: string): Promise<Answer> {\n const compressed = await gzip(body);\n\n return compressed\n ? post(id, 0, compressed, { [HEADER_CONTENT_ENCODING]: ENCODING_GZIP })\n : \"This Node version has no CompressionStream.\";\n}\n\n/**\n * Runs each rule's requests one at a time. Two requests with the same batch id must not overlap.\n * @param url Ingest URL.\n * @param origin The app's origin.\n * @param custom The app's headers for each batch, e.g. an Authorization header.\n * @returns One result per rule.\n */\nexport async function runDoctor(\n url: string,\n origin: string,\n custom: Readonly<Record<string, string>> = {},\n): Promise<DoctorResult[]> {\n const target = targetOf(url, origin, custom);\n const originProblem = originTest(origin);\n const preflight = await sendPreflight(target);\n\n const { body, contentType } = otlpSerializer.serialize([testRecord()]);\n const post = poster(target, contentType);\n\n const batchId = crypto.randomUUID();\n const first = await post(batchId, 0, body);\n const repeated = await post(batchId, 1, body);\n const zipped = await postZipped(post, crypto.randomUUID(), body);\n\n // sendBeacon can't set headers, so the id and the reason go in the query, like the exit flush.\n const beaconUrl = new URL(url);\n beaconUrl.searchParams.set(QUERY_PARAM_BATCH_ID, crypto.randomUUID());\n beaconUrl.searchParams.set(QUERY_PARAM_EXIT_REASON, \"pagehide\");\n\n // With custom headers the library's exit flush uses a keepalive fetch instead of a beacon.\n const beacon =\n target.requestHeaders.length > REQUEST_HEADERS.length\n ? undefined\n : await request(beaconUrl.toString(), {\n method: \"POST\",\n headers: { Origin: origin, [HEADER_CONTENT_TYPE]: CONTENT_TYPE_TEXT_PLAIN },\n body,\n });\n\n const hidden = typeof first === \"string\" ? [] : absent(first, EXPOSE_HEADERS, OPTIONAL_EXPOSED);\n const note = hidden.length > 0 ? ` Optional headers stay hidden: ${hidden.join(\", \")}.` : \"\";\n\n return [\n ...preflightResults(preflight, target),\n judge(\"test batch\", first, \"The server accepted a test batch.\", statusProblem, originProblem),\n judge(\"exposed headers\", first, `The server exposes Retry-After.${note}`, (response) =>\n absent(response, EXPOSE_HEADERS, [HEADER_RETRY_AFTER.toLowerCase()]).length > 0\n ? `${EXPOSE_HEADERS} must include retry-after.`\n : undefined,\n ),\n judge(\"gzip\", zipped, \"The server accepted a gzip batch.\", statusProblem),\n judge(\n \"deduplication\",\n repeated,\n \"The server accepted a repeated batch id. A client cannot see if it stored the batch again.\",\n statusProblem,\n ),\n beacon === undefined\n ? {\n rule: \"beacon\",\n pass: true,\n detail: \"The library sends no beacon with custom headers. The tool sent no beacon.\",\n }\n : judge(\"beacon\", beacon, \"The server accepted a text/plain batch.\", statusProblem),\n ];\n}\n\n/**\n * Checks a replay endpoint the way runDoctor() checks an ingest server. A segment has its own\n * body and its own batch id form, and its first one can be several megabytes.\n * @param url Replay endpoint URL, the value of replay.endpoint.\n * @param origin The app's origin.\n * @param custom The app's replay.headers, e.g. an Authorization header.\n * @returns One result per rule.\n */\nexport async function runReplayDoctor(\n url: string,\n origin: string,\n custom: Readonly<Record<string, string>> = {},\n): Promise<DoctorResult[]> {\n const target = targetOf(url, origin, custom);\n const originProblem = originTest(origin);\n const preflight = await sendPreflight(target);\n\n const replayId = crypto.randomUUID();\n const head = {\n \"replay.id\": replayId,\n \"session.id\": crypto.randomUUID(),\n \"tab.id\": crypto.randomUUID(),\n \"service.name\": DOCTOR_NAME,\n };\n // The body the uploader sends: the ids, the sequence, the JSON length of the events, and the\n // events themselves.\n const segment = (sequence: number, text: string): string => {\n const events = [\n { type: CUSTOM_EVENT, timestamp: Date.now(), data: { tag: DOCTOR_NAME, payload: text } },\n ];\n\n return JSON.stringify({ ...head, sequence, bytes: JSON.stringify(events).length, events });\n };\n // The uploader's batch id is the replay id plus the sequence.\n const idOf = (sequence: number): string => `${replayId}-${String(sequence)}`;\n const post = poster(target, CONTENT_TYPE_JSON);\n const small = segment(0, \"uiobs doctor test event\");\n\n const first = await post(idOf(0), 0, small);\n const repeated = await post(idOf(0), 1, small);\n const zipped = await postZipped(post, idOf(1), segment(1, \"uiobs doctor gzip event\"));\n // No gzip here. That is the worst case: compression off, or a browser without\n // CompressionStream. The library gives a segment delivery.requestTimeoutMs, so the tool\n // waits for the default of that. A shorter wait would fail a slow link the library can use.\n const large = await poster(target, CONTENT_TYPE_JSON, LIBRARY_TIMEOUT_MS)(\n idOf(2),\n 0,\n segment(2, \"x\".repeat(LARGE_EVENT_CHARS)),\n );\n\n return [\n ...preflightResults(preflight, target),\n judge(\n \"test segment\",\n first,\n \"The server accepted a test segment.\",\n statusProblem,\n originProblem,\n ),\n judge(\"gzip\", zipped, \"The server accepted a gzip segment.\", statusProblem),\n judge(\n \"large segment\",\n large,\n `The server accepted a segment of ${String(LARGE_EVENT_CHARS)} bytes without gzip.`,\n // The library drops a segment after a 413, so a low body limit loses every replay.\n (response) =>\n response.ok\n ? undefined\n : `The server returned ${String(response.status)} for a segment of ${String(LARGE_EVENT_CHARS)} bytes. The first segment of an upload has a full snapshot of the page. Raise the body limit of the server.`,\n ),\n judge(\n \"deduplication\",\n repeated,\n \"The server accepted a repeated batch id. A client cannot see if it stored the segment again.\",\n statusProblem,\n ),\n ];\n}\n\n/**\n * Parses the header options. Each one is the flag followed by a \"Name: value\" argument.\n * @param args The arguments after the origin.\n * @returns The headers, or undefined if an option is malformed.\n */\nfunction customHeaders(args: readonly string[]): Record<string, string> | undefined {\n const pairs: [string, string][] = [];\n\n for (let index = 0; index < args.length; index += 2) {\n // A flag without a value leaves undefined here, which exec() treats as text with no colon.\n const match = args[index] === HEADER_FLAG ? HEADER_PATTERN.exec(args[index + 1]) : null;\n\n if (!match || RESERVED_HEADERS.includes(match[1].toLowerCase())) {\n return undefined;\n }\n\n pairs.push([match[1], match[2]]);\n }\n\n return Object.fromEntries(pairs);\n}\n\n/** True for an HTTP URL without a user name or password. Result lines print the URL. */\nfunction isHttpUrl(value: string): boolean {\n if (!/^https?:\\/\\//i.test(value) || !URL.canParse(value)) {\n return false;\n }\n\n const { username, password } = new URL(value);\n return username === \"\" && password === \"\";\n}\n\n/** Command line words that are safe to print. */\nconst SHOWN_WORDS = [\"doctor\", \"--origin\", REPLAY_FLAG, HEADER_FLAG];\n\n/**\n * Turns an argument into something safe to print in the usage message. An argument can be a\n * token, a URL can carry one in its query or user info, and the output may land in a shared log.\n * @param arg Command line argument.\n * @returns The word itself, a URL without query or user info, or a placeholder.\n */\nfunction shownArgument(arg: string): string {\n if (SHOWN_WORDS.includes(arg)) {\n return arg;\n }\n\n if (/^https?:\\/\\//i.test(arg) && URL.canParse(arg)) {\n const { origin, pathname } = new URL(arg);\n return `${origin}${pathname === \"/\" && !arg.endsWith(\"/\") ? \"\" : pathname}`;\n }\n\n return HIDDEN;\n}\n\n/** Checks for an exact browser origin. A path or a trailing slash doesn't match. */\nfunction isOrigin(value: string): boolean {\n return URL.canParse(value) && new URL(value).origin === value;\n}\n\n/**\n * Runs the command line tool.\n * @param args Arguments after the program name.\n * @param print Writes one line of output.\n * @returns The exit code.\n */\nexport async function main(\n args: readonly string[],\n print: (line: string) => void,\n): Promise<number> {\n const [command, url, flag, origin, ...rest] = args;\n // The replay flag comes right after the origin, before any header option.\n const replay = rest[0] === REPLAY_FLAG;\n const headers = customHeaders(replay ? rest.slice(1) : rest);\n\n if (\n command !== \"doctor\" ||\n flag !== \"--origin\" ||\n !isHttpUrl(url) ||\n !isOrigin(origin) ||\n !headers\n ) {\n print(USAGE);\n print(`Received: ${JSON.stringify(args.map(shownArgument))}`);\n return EXIT_USAGE;\n }\n\n const results = await (replay ? runReplayDoctor : runDoctor)(url, origin, headers);\n\n for (const { rule, pass, detail } of results) {\n print(`${pass ? \"PASS\" : \"FAIL\"} ${rule}: ${detail}`);\n }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EAGT,IAAMiG,EAAU,MAAOH,EAAS3B,EAAkBV,EAAA,CAAWxC,EAAKuB,EAAQuD,CAAO,EAEjF,IAAK,GAAM,CAAE,OAAM,OAAM,YAAYE,EACnCD,EAAM,GAAGE,EAAO,OAAS,OAAO,GAAGC,EAAK,IAAIC,GAAQ,EAGtD,OAAOH,EAAQ,OAAO,CAAE,UAAWC,CAAI,EAAIpG,EAAYC,CACzD,C"}
package/dist/doctor.d.ts CHANGED
@@ -1,19 +1,29 @@
1
- /** Result of one rule of the ingest contract. */
1
+ /** The result of one ingest contract rule. */
2
2
  export interface DoctorResult {
3
3
  /** Rule name. */
4
4
  rule: string;
5
5
  /** True when the server meets the rule. */
6
6
  pass: boolean;
7
- /** Reason of the result. */
7
+ /** Why the rule passed or failed. */
8
8
  detail: string;
9
9
  }
10
10
  /**
11
- * Sends the requests of each rule, one at a time. Two requests with one batch id must not overlap.
11
+ * Runs each rule's requests one at a time. Two requests with the same batch id must not overlap.
12
12
  * @param url Ingest URL.
13
- * @param origin Origin of the app.
14
- * @returns One result for each rule.
13
+ * @param origin The app's origin.
14
+ * @param custom The app's headers for each batch, e.g. an Authorization header.
15
+ * @returns One result per rule.
15
16
  */
16
- export declare function runDoctor(url: string, origin: string): Promise<DoctorResult[]>;
17
+ export declare function runDoctor(url: string, origin: string, custom?: Readonly<Record<string, string>>): Promise<DoctorResult[]>;
18
+ /**
19
+ * Checks a replay endpoint the way runDoctor() checks an ingest server. A segment has its own
20
+ * body and its own batch id form, and its first one can be several megabytes.
21
+ * @param url Replay endpoint URL, the value of replay.endpoint.
22
+ * @param origin The app's origin.
23
+ * @param custom The app's replay.headers, e.g. an Authorization header.
24
+ * @returns One result per rule.
25
+ */
26
+ export declare function runReplayDoctor(url: string, origin: string, custom?: Readonly<Record<string, string>>): Promise<DoctorResult[]>;
17
27
  /**
18
28
  * Runs the command line tool.
19
29
  * @param args Arguments after the program name.