@utk09/ui-observability 0.12.0 → 1.1.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 (523) hide show
  1. package/CHANGELOG.md +280 -10
  2. package/README.md +70 -839
  3. package/dist/{batch-BjQUwjA6.js → batch-D3NHhF9L.js} +4 -4
  4. package/dist/{batch-BjQUwjA6.js.map → batch-D3NHhF9L.js.map} +1 -1
  5. package/dist/{batch-D5LlU4Q9.cjs → batch-DnYRJqhU.cjs} +2 -2
  6. package/dist/{batch-D5LlU4Q9.cjs.map → batch-DnYRJqhU.cjs.map} +1 -1
  7. package/dist/bus/bus.d.cts +355 -0
  8. package/dist/bus/bus.d.ts +86 -12
  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-B__467mL.cjs +2 -0
  14. package/dist/bus-B__467mL.cjs.map +1 -0
  15. package/dist/bus-dw7T92sO.js +788 -0
  16. package/dist/bus-dw7T92sO.js.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 +80 -0
  22. package/dist/capture/interactions.d.ts +36 -4
  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/observed-windows.d.cts +51 -0
  30. package/dist/capture/observed-windows.d.ts +51 -0
  31. package/dist/capture/profiler-frames.d.cts +44 -0
  32. package/dist/capture/profiler-frames.d.ts +1 -1
  33. package/dist/capture/replay-buffer.d.cts +45 -0
  34. package/dist/capture/replay-buffer.d.ts +9 -10
  35. package/dist/capture/replay-upload.d.cts +79 -0
  36. package/dist/capture/replay-upload.d.ts +7 -2
  37. package/dist/capture/replay.d.cts +114 -0
  38. package/dist/capture/replay.d.ts +1 -1
  39. package/dist/capture/reports.d.cts +17 -0
  40. package/dist/capture/reports.d.ts +1 -1
  41. package/dist/capture/resource-timing.d.cts +14 -0
  42. package/dist/capture/resource-timing.d.ts +1 -1
  43. package/dist/capture/server-timing.d.cts +19 -0
  44. package/dist/capture/storm.d.cts +13 -0
  45. package/dist/capture/storm.d.ts +5 -5
  46. package/dist/capture/types.d.cts +128 -0
  47. package/dist/capture/types.d.ts +10 -9
  48. package/dist/capture/unclean-exit.d.cts +31 -0
  49. package/dist/capture/unclean-exit.d.ts +1 -1
  50. package/dist/capture/user-timing.d.cts +22 -0
  51. package/dist/capture/user-timing.d.ts +2 -2
  52. package/dist/capture/web-socket.d.cts +40 -0
  53. package/dist/capture/web-socket.d.ts +3 -3
  54. package/dist/capture/web-vitals.d.cts +40 -0
  55. package/dist/capture/web-vitals.d.ts +1 -1
  56. package/dist/{compression-lD9abCcO.cjs → compression-C0hUHKR-.cjs} +2 -2
  57. package/dist/{compression-lD9abCcO.cjs.map → compression-C0hUHKR-.cjs.map} +1 -1
  58. package/dist/{compression-AJJCMBOa.js → compression-SHPAvS4U.js} +2 -2
  59. package/dist/{compression-AJJCMBOa.js.map → compression-SHPAvS4U.js.map} +1 -1
  60. package/dist/config-CSNcS7OZ.js +558 -0
  61. package/dist/config-CSNcS7OZ.js.map +1 -0
  62. package/dist/config-CybPP5VM.cjs +2 -0
  63. package/dist/config-CybPP5VM.cjs.map +1 -0
  64. package/dist/console-BsM-fSCQ.js +81 -0
  65. package/dist/console-BsM-fSCQ.js.map +1 -0
  66. package/dist/console-Dkxs6IVQ.cjs +2 -0
  67. package/dist/console-Dkxs6IVQ.cjs.map +1 -0
  68. package/dist/constants-BwJDXzj6.js +357 -0
  69. package/dist/constants-BwJDXzj6.js.map +1 -0
  70. package/dist/constants-CtF52hIV.cjs +2 -0
  71. package/dist/constants-CtF52hIV.cjs.map +1 -0
  72. package/dist/constants.d.cts +763 -0
  73. package/dist/constants.d.ts +100 -20
  74. package/dist/core/breadcrumbs.d.cts +54 -0
  75. package/dist/core/breadcrumbs.d.ts +5 -0
  76. package/dist/core/config.d.cts +45 -0
  77. package/dist/core/config.d.ts +30 -2
  78. package/dist/core/context.d.cts +24 -0
  79. package/dist/core/context.d.ts +3 -8
  80. package/dist/core/debug-buffer.d.cts +34 -0
  81. package/dist/core/debug-buffer.d.ts +3 -3
  82. package/dist/core/debug-bundle.d.cts +12 -0
  83. package/dist/core/debug-bundle.d.ts +3 -3
  84. package/dist/core/deferred.d.cts +7 -0
  85. package/dist/core/deferred.d.ts +2 -2
  86. package/dist/core/diagnostics.d.cts +86 -0
  87. package/dist/core/diagnostics.d.ts +1 -1
  88. package/dist/core/drops.d.cts +39 -0
  89. package/dist/core/drops.d.ts +16 -6
  90. package/dist/core/hold-buffer.d.cts +36 -0
  91. package/dist/core/hold-buffer.d.ts +16 -7
  92. package/dist/core/journey.d.cts +148 -0
  93. package/dist/core/journey.d.ts +7 -7
  94. package/dist/core/logger.d.cts +141 -0
  95. package/dist/core/logger.d.ts +23 -30
  96. package/dist/core/measure.d.cts +30 -0
  97. package/dist/core/measure.d.ts +14 -3
  98. package/dist/core/meter.d.cts +78 -0
  99. package/dist/core/meter.d.ts +14 -8
  100. package/dist/core/pipeline.d.cts +227 -0
  101. package/dist/core/pipeline.d.ts +73 -10
  102. package/dist/core/profile-buckets.d.cts +31 -0
  103. package/dist/core/profiler.d.cts +218 -0
  104. package/dist/core/profiler.d.ts +2 -2
  105. package/dist/core/record.d.cts +190 -0
  106. package/dist/core/record.d.ts +44 -12
  107. package/dist/core/remote-rules.d.cts +17 -0
  108. package/dist/core/remote-rules.d.ts +3 -3
  109. package/dist/core/remote-sampling.d.cts +74 -0
  110. package/dist/core/remote-sampling.d.ts +3 -3
  111. package/dist/core/rotation.d.cts +99 -0
  112. package/dist/core/rotation.d.ts +99 -0
  113. package/dist/core/runtime.d.cts +774 -0
  114. package/dist/core/runtime.d.ts +254 -70
  115. package/dist/core/sampling.d.cts +86 -0
  116. package/dist/core/sampling.d.ts +5 -5
  117. package/dist/core/sender.d.cts +161 -0
  118. package/dist/core/sender.d.ts +59 -15
  119. package/dist/core/spans.d.cts +39 -0
  120. package/dist/core/spans.d.ts +1 -1
  121. package/dist/debug-bundle-B2v6Cym-.cjs +2 -0
  122. package/dist/debug-bundle-B2v6Cym-.cjs.map +1 -0
  123. package/dist/debug-bundle-Cs_YWzTa.js +35 -0
  124. package/dist/debug-bundle-Cs_YWzTa.js.map +1 -0
  125. package/dist/defineProperty-X1c4tIPD.cjs +1 -0
  126. package/dist/defineProperty-s2S8BXUc.js +35 -0
  127. package/dist/doctor.cjs +1 -1
  128. package/dist/doctor.cjs.map +1 -1
  129. package/dist/doctor.d.cts +36 -0
  130. package/dist/doctor.d.ts +5 -2
  131. package/dist/doctor.js +119 -87
  132. package/dist/doctor.js.map +1 -1
  133. package/dist/errors-DP2RUm4V.cjs +3 -0
  134. package/dist/errors-DP2RUm4V.cjs.map +1 -0
  135. package/dist/errors-Q3Ng1ciC.js +86 -0
  136. package/dist/errors-Q3Ng1ciC.js.map +1 -0
  137. package/dist/factory-DV17sm2p.js +404 -0
  138. package/dist/factory-DV17sm2p.js.map +1 -0
  139. package/dist/factory-K8O6gpux.cjs +2 -0
  140. package/dist/factory-K8O6gpux.cjs.map +1 -0
  141. package/dist/guards-BlYGRK4l.js +10 -0
  142. package/dist/guards-BlYGRK4l.js.map +1 -0
  143. package/dist/guards-EjG3ahFp.cjs +2 -0
  144. package/dist/guards-EjG3ahFp.cjs.map +1 -0
  145. package/dist/{identity-BrQp_5J5.js → identity-BgtHyY4u.js} +33 -26
  146. package/dist/identity-BgtHyY4u.js.map +1 -0
  147. package/dist/identity-CvuyqZk7.cjs +2 -0
  148. package/dist/identity-CvuyqZk7.cjs.map +1 -0
  149. package/dist/index.cjs +1 -1
  150. package/dist/index.cjs.map +1 -1
  151. package/dist/index.d.cts +301 -0
  152. package/dist/index.d.ts +90 -98
  153. package/dist/index.js +1253 -1555
  154. package/dist/index.js.map +1 -1
  155. package/dist/indexeddb-storage-D4KVcqdD.cjs +2 -0
  156. package/dist/indexeddb-storage-D4KVcqdD.cjs.map +1 -0
  157. package/dist/{indexeddb-storage-DLXQzAGh.js → indexeddb-storage-e-13ZLWm.js} +61 -57
  158. package/dist/indexeddb-storage-e-13ZLWm.js.map +1 -0
  159. package/dist/interactions-Byxf1C82.js +207 -0
  160. package/dist/interactions-Byxf1C82.js.map +1 -0
  161. package/dist/interactions-OK85T-Dk.cjs +2 -0
  162. package/dist/interactions-OK85T-Dk.cjs.map +1 -0
  163. package/dist/{journey-35yCMNFo.js → journey-C93FTYcs.js} +46 -49
  164. package/dist/journey-C93FTYcs.js.map +1 -0
  165. package/dist/journey-nMbob3OB.cjs +2 -0
  166. package/dist/journey-nMbob3OB.cjs.map +1 -0
  167. package/dist/{library-console-BFWEuQsl.cjs → library-console-DJUQzcgM.cjs} +2 -2
  168. package/dist/{library-console-BFWEuQsl.cjs.map → library-console-DJUQzcgM.cjs.map} +1 -1
  169. package/dist/{library-console-Dl_Ly6DQ.js → library-console-DklSmucS.js} +2 -2
  170. package/dist/{library-console-Dl_Ly6DQ.js.map → library-console-DklSmucS.js.map} +1 -1
  171. package/dist/{library-request-nI6pvI6I.js → library-request-UGEwOHpf.js} +2 -2
  172. package/dist/{library-request-nI6pvI6I.js.map → library-request-UGEwOHpf.js.map} +1 -1
  173. package/dist/{library-request-Da-CHKzT.cjs → library-request-kY9iTpIF.cjs} +2 -2
  174. package/dist/{library-request-Da-CHKzT.cjs.map → library-request-kY9iTpIF.cjs.map} +1 -1
  175. package/dist/{lifecycle-CZ6RRXc6.js → lifecycle-B2PlIuQu.js} +21 -29
  176. package/dist/lifecycle-B2PlIuQu.js.map +1 -0
  177. package/dist/lifecycle-DaMdH_X7.cjs +2 -0
  178. package/dist/lifecycle-DaMdH_X7.cjs.map +1 -0
  179. package/dist/log-record-Bmx6etMh.cjs +2 -0
  180. package/dist/log-record-Bmx6etMh.cjs.map +1 -0
  181. package/dist/{log-record-DIA6McNr.js → log-record-DSt2P-Sr.js} +8 -7
  182. package/dist/log-record-DSt2P-Sr.js.map +1 -0
  183. package/dist/{long-frames-430_85Da.js → long-frames-Bamjs1WV.js} +18 -22
  184. package/dist/long-frames-Bamjs1WV.js.map +1 -0
  185. package/dist/long-frames-lhtONgGt.cjs +2 -0
  186. package/dist/long-frames-lhtONgGt.cjs.map +1 -0
  187. package/dist/models/batch.d.cts +57 -0
  188. package/dist/models/batch.d.ts +2 -2
  189. package/dist/models/bus.d.cts +163 -0
  190. package/dist/models/bus.d.ts +28 -3
  191. package/dist/models/config.d.cts +1555 -0
  192. package/dist/models/config.d.ts +377 -261
  193. package/dist/models/drop.d.cts +54 -0
  194. package/dist/models/drop.d.ts +16 -3
  195. package/dist/models/health.d.cts +148 -0
  196. package/dist/models/health.d.ts +108 -12
  197. package/dist/models/log-record.d.cts +61 -0
  198. package/dist/models/metric.d.cts +139 -0
  199. package/dist/models/metric.d.ts +13 -2
  200. package/dist/models/plugin.d.cts +47 -0
  201. package/dist/models/plugin.d.ts +3 -3
  202. package/dist/models/replay.d.cts +60 -0
  203. package/dist/models/serializer.d.cts +25 -0
  204. package/dist/models/serializer.d.ts +4 -2
  205. package/dist/models/storage.d.cts +95 -0
  206. package/dist/models/storage.d.ts +7 -5
  207. package/dist/network-BCn8Gn47.cjs +2 -0
  208. package/dist/network-BCn8Gn47.cjs.map +1 -0
  209. package/dist/{network-C7SkLf4v.js → network-Cg1L2w2r.js} +57 -57
  210. package/dist/network-Cg1L2w2r.js.map +1 -0
  211. package/dist/observed-windows-B3gJkdql.cjs +2 -0
  212. package/dist/observed-windows-B3gJkdql.cjs.map +1 -0
  213. package/dist/observed-windows-BrwaJNlj.js +64 -0
  214. package/dist/observed-windows-BrwaJNlj.js.map +1 -0
  215. package/dist/{otlp-2MCrC3kd.cjs → otlp-CrAWkQdO.cjs} +2 -2
  216. package/dist/{otlp-2MCrC3kd.cjs.map → otlp-CrAWkQdO.cjs.map} +1 -1
  217. package/dist/{otlp-COq033e3.js → otlp-D6dRZyB8.js} +9 -9
  218. package/dist/{otlp-COq033e3.js.map → otlp-D6dRZyB8.js.map} +1 -1
  219. package/dist/{platform-CVewe4wQ.js → platform-8DLhjddo.js} +9 -9
  220. package/dist/{platform-CVewe4wQ.js.map → platform-8DLhjddo.js.map} +1 -1
  221. package/dist/{platform-12uR7kBQ.cjs → platform-BqRc-7RO.cjs} +2 -2
  222. package/dist/{platform-12uR7kBQ.cjs.map → platform-BqRc-7RO.cjs.map} +1 -1
  223. package/dist/{profiler-BVWIOgnq.js → profiler-BaXSqCfz.js} +78 -96
  224. package/dist/profiler-BaXSqCfz.js.map +1 -0
  225. package/dist/profiler-BvWW2kNM.cjs +2 -0
  226. package/dist/profiler-BvWW2kNM.cjs.map +1 -0
  227. package/dist/{profiler-frames-CLXlT_xL.js → profiler-frames-C4ySHN0X.js} +21 -29
  228. package/dist/profiler-frames-C4ySHN0X.js.map +1 -0
  229. package/dist/profiler-frames-DeaBiB-5.cjs +2 -0
  230. package/dist/profiler-frames-DeaBiB-5.cjs.map +1 -0
  231. package/dist/remote-rules-D7L6D_D2.cjs +2 -0
  232. package/dist/remote-rules-D7L6D_D2.cjs.map +1 -0
  233. package/dist/remote-rules-Dq9xe7Qn.js +95 -0
  234. package/dist/remote-rules-Dq9xe7Qn.js.map +1 -0
  235. package/dist/replay-B0M8kWz_.js +310 -0
  236. package/dist/replay-B0M8kWz_.js.map +1 -0
  237. package/dist/replay-QOFBpAXh.cjs +2 -0
  238. package/dist/replay-QOFBpAXh.cjs.map +1 -0
  239. package/dist/{reports-BuXekPOS.js → reports--8APRLa-.js} +25 -30
  240. package/dist/reports--8APRLa-.js.map +1 -0
  241. package/dist/reports-ojuMKGO7.cjs +2 -0
  242. package/dist/reports-ojuMKGO7.cjs.map +1 -0
  243. package/dist/{resource-timing-CXGHwFRD.js → resource-timing-BzR05rE-.js} +20 -23
  244. package/dist/resource-timing-BzR05rE-.js.map +1 -0
  245. package/dist/resource-timing-pAG3ZhB5.cjs +2 -0
  246. package/dist/resource-timing-pAG3ZhB5.cjs.map +1 -0
  247. package/dist/response-body-BWvwKQ2p.js +331 -0
  248. package/dist/response-body-BWvwKQ2p.js.map +1 -0
  249. package/dist/response-body-CKEJ5itk.cjs +3 -0
  250. package/dist/response-body-CKEJ5itk.cjs.map +1 -0
  251. package/dist/rotation-BylN1B9e.js +93 -0
  252. package/dist/rotation-BylN1B9e.js.map +1 -0
  253. package/dist/rotation-E2eKClIs.cjs +2 -0
  254. package/dist/rotation-E2eKClIs.cjs.map +1 -0
  255. package/dist/sampling-B46LW0cy.cjs +2 -0
  256. package/dist/sampling-B46LW0cy.cjs.map +1 -0
  257. package/dist/sampling-zXA6r-Nw.js +63 -0
  258. package/dist/sampling-zXA6r-Nw.js.map +1 -0
  259. package/dist/{sanitize-CNmsD9r3.js → sanitize-DjnR6RXR.js} +2 -2
  260. package/dist/sanitize-DjnR6RXR.js.map +1 -0
  261. package/dist/{sanitize-ChLn97Ch.cjs → sanitize-Qj6LuZqp.cjs} +2 -2
  262. package/dist/sanitize-Qj6LuZqp.cjs.map +1 -0
  263. package/dist/sender-Bdp-TAS4.js +979 -0
  264. package/dist/sender-Bdp-TAS4.js.map +1 -0
  265. package/dist/sender-DR7ZycZY.cjs +2 -0
  266. package/dist/sender-DR7ZycZY.cjs.map +1 -0
  267. package/dist/storage/context-storage.d.cts +90 -0
  268. package/dist/storage/context-storage.d.ts +5 -5
  269. package/dist/storage/emergency-queue.d.cts +27 -0
  270. package/dist/storage/emergency-queue.d.ts +4 -4
  271. package/dist/storage/eviction.d.cts +40 -0
  272. package/dist/storage/eviction.d.ts +1 -1
  273. package/dist/storage/factory.d.cts +21 -0
  274. package/dist/storage/factory.d.ts +3 -3
  275. package/dist/storage/gap.d.cts +20 -0
  276. package/dist/storage/gap.d.ts +3 -3
  277. package/dist/storage/idb-driver.d.cts +93 -0
  278. package/dist/storage/idb-driver.d.ts +1 -1
  279. package/dist/storage/indexeddb-storage.d.cts +97 -0
  280. package/dist/storage/indexeddb-storage.d.ts +12 -4
  281. package/dist/storage/keys.d.cts +17 -0
  282. package/dist/storage/keys.d.ts +2 -2
  283. package/dist/storage/local-storage.d.cts +139 -0
  284. package/dist/storage/local-storage.d.ts +11 -4
  285. package/dist/storage/memory-storage.d.cts +73 -0
  286. package/dist/storage/memory-storage.d.ts +4 -3
  287. package/dist/storage/persistence.d.cts +8 -0
  288. package/dist/storage/persistence.d.ts +2 -2
  289. package/dist/storage/stored-context.d.cts +34 -0
  290. package/dist/storage/stored-context.d.ts +34 -0
  291. package/dist/stored-context-BOu54M8Y.cjs +2 -0
  292. package/dist/stored-context-BOu54M8Y.cjs.map +1 -0
  293. package/dist/stored-context-CSttrAsw.js +51 -0
  294. package/dist/stored-context-CSttrAsw.js.map +1 -0
  295. package/dist/storm-BHgI12iS.cjs +2 -0
  296. package/dist/storm-BHgI12iS.cjs.map +1 -0
  297. package/dist/storm-DKlpv0FL.js +9 -0
  298. package/dist/storm-DKlpv0FL.js.map +1 -0
  299. package/dist/transport/compression.d.cts +7 -0
  300. package/dist/transport/custom-transport.d.cts +22 -0
  301. package/dist/transport/custom-transport.d.ts +6 -5
  302. package/dist/transport/errors.d.cts +31 -0
  303. package/dist/transport/exit-flush.d.cts +135 -0
  304. package/dist/transport/exit-flush.d.ts +30 -13
  305. package/dist/transport/headers.d.cts +8 -0
  306. package/dist/transport/headers.d.ts +2 -2
  307. package/dist/transport/http-transport.d.cts +116 -0
  308. package/dist/transport/http-transport.d.ts +20 -8
  309. package/dist/transport/memory-transport.d.cts +30 -0
  310. package/dist/transport/memory-transport.d.ts +2 -2
  311. package/dist/transport/response-body.d.cts +49 -0
  312. package/dist/transport/response-body.d.ts +49 -0
  313. package/dist/transport/retry-engine.d.cts +129 -0
  314. package/dist/transport/retry-engine.d.ts +27 -9
  315. package/dist/transport/serializers/ecs.d.cts +3 -0
  316. package/dist/transport/serializers/ecs.d.ts +1 -1
  317. package/dist/transport/serializers/otlp-metrics.d.cts +3 -0
  318. package/dist/transport/serializers/otlp-metrics.d.ts +1 -1
  319. package/dist/transport/serializers/otlp-traces.d.cts +3 -0
  320. package/dist/transport/serializers/otlp-traces.d.ts +1 -1
  321. package/dist/transport/serializers/otlp.d.cts +47 -0
  322. package/dist/transport/serializers/otlp.d.ts +2 -2
  323. package/dist/transport/serializers/select.d.cts +38 -0
  324. package/dist/transport/serializers/select.d.ts +5 -5
  325. package/dist/transport/status-transport.d.cts +129 -0
  326. package/dist/transport/status-transport.d.ts +25 -8
  327. package/dist/transport/worker-client.d.cts +23 -0
  328. package/dist/transport/worker-client.d.ts +12 -3
  329. package/dist/transport/worker-entry.d.cts +5 -0
  330. package/dist/transport/worker-entry.d.ts +1 -1
  331. package/dist/transport/worker-protocol.d.cts +38 -0
  332. package/dist/transport/worker-protocol.d.ts +4 -2
  333. package/dist/transport/worker-server.d.cts +3 -0
  334. package/dist/transport/worker-server.d.ts +1 -1
  335. package/dist/transport/worker-transport.d.cts +10 -0
  336. package/dist/transport/worker-transport.d.ts +5 -4
  337. package/dist/types-BAerHgCq.js.map +1 -1
  338. package/dist/types-C7WNpnG1.cjs.map +1 -1
  339. package/dist/unclean-exit-BYPYYkQ5.cjs +2 -0
  340. package/dist/unclean-exit-BYPYYkQ5.cjs.map +1 -0
  341. package/dist/{unclean-exit-Cob_jyTv.js → unclean-exit-BcOB8A2e.js} +23 -30
  342. package/dist/unclean-exit-BcOB8A2e.js.map +1 -0
  343. package/dist/{user-timing-DgHubxCI.js → user-timing-4KIJ74Vi.js} +15 -17
  344. package/dist/user-timing-4KIJ74Vi.js.map +1 -0
  345. package/dist/user-timing-BsU2wQKE.cjs +2 -0
  346. package/dist/user-timing-BsU2wQKE.cjs.map +1 -0
  347. package/dist/utils/console.d.cts +36 -0
  348. package/dist/utils/console.d.ts +4 -4
  349. package/dist/utils/deadline.d.cts +14 -0
  350. package/dist/utils/error-like.d.cts +25 -0
  351. package/dist/utils/fixed-window.d.cts +25 -0
  352. package/dist/utils/global-scope.d.cts +20 -0
  353. package/dist/utils/guards.d.cts +14 -0
  354. package/dist/utils/guards.d.ts +8 -0
  355. package/dist/utils/identity.d.cts +114 -0
  356. package/dist/utils/identity.d.ts +8 -4
  357. package/dist/utils/library-console.d.cts +11 -0
  358. package/dist/utils/library-request.d.cts +24 -0
  359. package/dist/utils/lock.d.cts +24 -0
  360. package/dist/utils/lock.d.ts +1 -1
  361. package/dist/utils/openfin.d.cts +48 -0
  362. package/dist/utils/patch.d.cts +9 -0
  363. package/dist/utils/platform.d.cts +62 -0
  364. package/dist/utils/platform.d.ts +2 -2
  365. package/dist/utils/sanitize.d.cts +52 -0
  366. package/dist/utils/sanitize.d.ts +1 -1
  367. package/dist/utils/sequence.d.cts +10 -0
  368. package/dist/utils/tracing.d.cts +158 -0
  369. package/dist/utils/tracing.d.ts +11 -4
  370. package/dist/utils/unref.d.cts +9 -0
  371. package/dist/web-socket-Cs1ZbmmN.cjs +2 -0
  372. package/dist/{web-socket-DthJuSAg.js.map → web-socket-Cs1ZbmmN.cjs.map} +1 -1
  373. package/dist/{web-socket-DthJuSAg.js → web-socket-Zg0hj1LB.js} +23 -28
  374. package/dist/web-socket-Zg0hj1LB.js.map +1 -0
  375. package/dist/{web-vitals-CsGCWnUr.js → web-vitals-4pWACwaR.js} +15 -21
  376. package/dist/web-vitals-4pWACwaR.js.map +1 -0
  377. package/dist/web-vitals-__X7t4pj.cjs +2 -0
  378. package/dist/web-vitals-__X7t4pj.cjs.map +1 -0
  379. package/dist/{worker-protocol-B0_8rWy5.js → worker-protocol-CYpAbrVl.js} +14 -11
  380. package/dist/worker-protocol-CYpAbrVl.js.map +1 -0
  381. package/dist/worker-protocol-DFYXIFus.cjs +2 -0
  382. package/dist/worker-protocol-DFYXIFus.cjs.map +1 -0
  383. package/dist/worker-server--yGTadTA.cjs +2 -0
  384. package/dist/worker-server--yGTadTA.cjs.map +1 -0
  385. package/dist/worker-server-BokySIII.js +94 -0
  386. package/dist/worker-server-BokySIII.js.map +1 -0
  387. package/dist/worker-transport-BdEvh_-a.cjs +2 -0
  388. package/dist/worker-transport-BdEvh_-a.cjs.map +1 -0
  389. package/dist/worker-transport-JK-Fby9J.js +194 -0
  390. package/dist/worker-transport-JK-Fby9J.js.map +1 -0
  391. package/llms.txt +400 -0
  392. package/package.json +65 -49
  393. package/dist/bus-D_7pd7RN.cjs +0 -2
  394. package/dist/bus-D_7pd7RN.cjs.map +0 -1
  395. package/dist/bus-ecxUNTja.js +0 -660
  396. package/dist/bus-ecxUNTja.js.map +0 -1
  397. package/dist/console-CLz_PvFn.cjs +0 -2
  398. package/dist/console-CLz_PvFn.cjs.map +0 -1
  399. package/dist/console-cwgHKXvM.js +0 -82
  400. package/dist/console-cwgHKXvM.js.map +0 -1
  401. package/dist/constants-Bwl_YtQi.js +0 -349
  402. package/dist/constants-Bwl_YtQi.js.map +0 -1
  403. package/dist/constants-DakMxVB2.cjs +0 -2
  404. package/dist/constants-DakMxVB2.cjs.map +0 -1
  405. package/dist/context-storage-BjzeBSxH.cjs +0 -2
  406. package/dist/context-storage-BjzeBSxH.cjs.map +0 -1
  407. package/dist/context-storage-BzkoHzkQ.js +0 -51
  408. package/dist/context-storage-BzkoHzkQ.js.map +0 -1
  409. package/dist/debug-bundle-BOdYmCeV.js +0 -32
  410. package/dist/debug-bundle-BOdYmCeV.js.map +0 -1
  411. package/dist/debug-bundle-Ex4L_LSP.cjs +0 -2
  412. package/dist/debug-bundle-Ex4L_LSP.cjs.map +0 -1
  413. package/dist/emergency-queue-B9WZxanZ.js +0 -67
  414. package/dist/emergency-queue-B9WZxanZ.js.map +0 -1
  415. package/dist/emergency-queue-HBpL5r3V.cjs +0 -2
  416. package/dist/emergency-queue-HBpL5r3V.cjs.map +0 -1
  417. package/dist/errors-D6bwgJtO.js +0 -92
  418. package/dist/errors-D6bwgJtO.js.map +0 -1
  419. package/dist/errors-DCOCRdSi.cjs +0 -3
  420. package/dist/errors-DCOCRdSi.cjs.map +0 -1
  421. package/dist/factory-DLFDjdLv.cjs +0 -2
  422. package/dist/factory-DLFDjdLv.cjs.map +0 -1
  423. package/dist/factory-e9Qo3K0z.js +0 -276
  424. package/dist/factory-e9Qo3K0z.js.map +0 -1
  425. package/dist/guards-Cidk71ME.js +0 -7
  426. package/dist/guards-Cidk71ME.js.map +0 -1
  427. package/dist/guards-nJ70syPt.cjs +0 -2
  428. package/dist/guards-nJ70syPt.cjs.map +0 -1
  429. package/dist/identity-BlvlgjrU.cjs +0 -2
  430. package/dist/identity-BlvlgjrU.cjs.map +0 -1
  431. package/dist/identity-BrQp_5J5.js.map +0 -1
  432. package/dist/indexeddb-storage-CtLvZH1r.cjs +0 -2
  433. package/dist/indexeddb-storage-CtLvZH1r.cjs.map +0 -1
  434. package/dist/indexeddb-storage-DLXQzAGh.js.map +0 -1
  435. package/dist/interactions-B6z2I4tU.js +0 -119
  436. package/dist/interactions-B6z2I4tU.js.map +0 -1
  437. package/dist/interactions-P6pz08Jn.cjs +0 -2
  438. package/dist/interactions-P6pz08Jn.cjs.map +0 -1
  439. package/dist/journey-35yCMNFo.js.map +0 -1
  440. package/dist/journey-DAGh5h9k.cjs +0 -2
  441. package/dist/journey-DAGh5h9k.cjs.map +0 -1
  442. package/dist/keys-BHhw_0Wh.cjs +0 -2
  443. package/dist/keys-BHhw_0Wh.cjs.map +0 -1
  444. package/dist/keys-BU9j5YqW.js +0 -16
  445. package/dist/keys-BU9j5YqW.js.map +0 -1
  446. package/dist/lifecycle-BGGOcN4N.cjs +0 -2
  447. package/dist/lifecycle-BGGOcN4N.cjs.map +0 -1
  448. package/dist/lifecycle-CZ6RRXc6.js.map +0 -1
  449. package/dist/log-record-D7bA1RPb.cjs +0 -2
  450. package/dist/log-record-D7bA1RPb.cjs.map +0 -1
  451. package/dist/log-record-DIA6McNr.js.map +0 -1
  452. package/dist/long-frames-430_85Da.js.map +0 -1
  453. package/dist/long-frames-Dd8tsi2U.cjs +0 -2
  454. package/dist/long-frames-Dd8tsi2U.cjs.map +0 -1
  455. package/dist/models/stats.d.ts +0 -11
  456. package/dist/network-C7SkLf4v.js.map +0 -1
  457. package/dist/network-pEX3PAJv.cjs +0 -2
  458. package/dist/network-pEX3PAJv.cjs.map +0 -1
  459. package/dist/profiler-BVWIOgnq.js.map +0 -1
  460. package/dist/profiler-eVCknCzS.cjs +0 -2
  461. package/dist/profiler-eVCknCzS.cjs.map +0 -1
  462. package/dist/profiler-frames-CLXlT_xL.js.map +0 -1
  463. package/dist/profiler-frames-Dg2OebB2.cjs +0 -2
  464. package/dist/profiler-frames-Dg2OebB2.cjs.map +0 -1
  465. package/dist/remote-rules-BJGDJGwA.js +0 -98
  466. package/dist/remote-rules-BJGDJGwA.js.map +0 -1
  467. package/dist/remote-rules-CJD3ToVk.cjs +0 -2
  468. package/dist/remote-rules-CJD3ToVk.cjs.map +0 -1
  469. package/dist/replay-0zAJv9T3.js +0 -338
  470. package/dist/replay-0zAJv9T3.js.map +0 -1
  471. package/dist/replay-DomJpXqW.cjs +0 -2
  472. package/dist/replay-DomJpXqW.cjs.map +0 -1
  473. package/dist/reports-BsbqmP8h.cjs +0 -2
  474. package/dist/reports-BsbqmP8h.cjs.map +0 -1
  475. package/dist/reports-BuXekPOS.js.map +0 -1
  476. package/dist/resource-timing-CXGHwFRD.js.map +0 -1
  477. package/dist/resource-timing-DkycFGDa.cjs +0 -2
  478. package/dist/resource-timing-DkycFGDa.cjs.map +0 -1
  479. package/dist/sampling-Dd0wllyq.cjs +0 -2
  480. package/dist/sampling-Dd0wllyq.cjs.map +0 -1
  481. package/dist/sampling-UUDbi3K0.js +0 -60
  482. package/dist/sampling-UUDbi3K0.js.map +0 -1
  483. package/dist/sanitize-CNmsD9r3.js.map +0 -1
  484. package/dist/sanitize-ChLn97Ch.cjs.map +0 -1
  485. package/dist/select-CTk-K5mG.cjs +0 -3
  486. package/dist/select-CTk-K5mG.cjs.map +0 -1
  487. package/dist/select-DPv_j6wq.js +0 -270
  488. package/dist/select-DPv_j6wq.js.map +0 -1
  489. package/dist/sender-15zEsZpr.js +0 -857
  490. package/dist/sender-15zEsZpr.js.map +0 -1
  491. package/dist/sender-Bfpv9tad.cjs +0 -2
  492. package/dist/sender-Bfpv9tad.cjs.map +0 -1
  493. package/dist/storage-BA9RqRO-.cjs +0 -2
  494. package/dist/storage-BA9RqRO-.cjs.map +0 -1
  495. package/dist/storage-DZwed89z.js +0 -16
  496. package/dist/storage-DZwed89z.js.map +0 -1
  497. package/dist/storm-BTSNTIWI.js +0 -9
  498. package/dist/storm-BTSNTIWI.js.map +0 -1
  499. package/dist/storm-D0_qZOEg.cjs +0 -2
  500. package/dist/storm-D0_qZOEg.cjs.map +0 -1
  501. package/dist/unclean-exit-ClGzrc2A.cjs +0 -2
  502. package/dist/unclean-exit-ClGzrc2A.cjs.map +0 -1
  503. package/dist/unclean-exit-Cob_jyTv.js.map +0 -1
  504. package/dist/user-timing-CdYqx3PF.cjs +0 -2
  505. package/dist/user-timing-CdYqx3PF.cjs.map +0 -1
  506. package/dist/user-timing-DgHubxCI.js.map +0 -1
  507. package/dist/utils/timer.d.ts +0 -19
  508. package/dist/web-socket-BTuvYoJI.cjs +0 -2
  509. package/dist/web-socket-BTuvYoJI.cjs.map +0 -1
  510. package/dist/web-vitals-Ch5BpDmo.cjs +0 -2
  511. package/dist/web-vitals-Ch5BpDmo.cjs.map +0 -1
  512. package/dist/web-vitals-CsGCWnUr.js.map +0 -1
  513. package/dist/worker-protocol-B0_8rWy5.js.map +0 -1
  514. package/dist/worker-protocol-BjzFORfq.cjs +0 -2
  515. package/dist/worker-protocol-BjzFORfq.cjs.map +0 -1
  516. package/dist/worker-server-4en-Lt-3.cjs +0 -2
  517. package/dist/worker-server-4en-Lt-3.cjs.map +0 -1
  518. package/dist/worker-server-Cne9MX9I.js +0 -83
  519. package/dist/worker-server-Cne9MX9I.js.map +0 -1
  520. package/dist/worker-transport-B-GF4Aqn.cjs +0 -2
  521. package/dist/worker-transport-B-GF4Aqn.cjs.map +0 -1
  522. package/dist/worker-transport-C3SjJAEC.js +0 -200
  523. package/dist/worker-transport-C3SjJAEC.js.map +0 -1
@@ -1,11 +1,12 @@
1
- import { Dn as e, On as t } from "./constants-Bwl_YtQi.js";
1
+ import { Bn as e, zn as t } from "./constants-BwJDXzj6.js";
2
2
  import { r as n } from "./error-like-B11pB4aL.js";
3
- import { n as r, t as i } from "./library-request-nI6pvI6I.js";
3
+ import { n as r, t as i } from "./library-request-UGEwOHpf.js";
4
4
  import { t as a } from "./patch-UdPz1ea8.js";
5
- import { i as o } from "./platform-CVewe4wQ.js";
5
+ import { i as o } from "./platform-8DLhjddo.js";
6
6
  import { t as s } from "./types-BAerHgCq.js";
7
+ import { t as c } from "./defineProperty-s2S8BXUc.js";
7
8
  // src/capture/server-timing.ts
8
- function c(e, t) {
9
+ function l(e, t) {
9
10
  let n = [], r = 0, i = !1, a = !1;
10
11
  for (let o = 0; o < e.length; o++) {
11
12
  let s = e[o];
@@ -13,14 +14,14 @@ function c(e, t) {
13
14
  }
14
15
  return n.push(e.slice(r)), n;
15
16
  }
16
- function l(e) {
17
+ function u(e) {
17
18
  return /^server-timing:(.*)$/im.exec(e)?.[1] ?? null;
18
19
  }
19
- function u(e) {
20
+ function d(t) {
20
21
  let n = { entries: [] };
21
- if (!e) return n;
22
- for (let r of c(e.slice(0, t), ",").slice(0, 32)) {
23
- let [e, ...t] = c(r, ";"), i = e.trim();
22
+ if (!t) return n;
23
+ for (let r of l(t.slice(0, e), ",").slice(0, 32)) {
24
+ let [e, ...t] = l(r, ";"), i = e.trim();
24
25
  if (!/^[!#$%&'*+.^_`|~\da-z-]+$/i.test(i)) continue;
25
26
  let a = {
26
27
  name: i,
@@ -50,7 +51,7 @@ function u(e) {
50
51
  return n;
51
52
  }
52
53
  // src/capture/network.ts
53
- var d = 1e3, f = {
54
+ var f = 1e3, p = {
54
55
  name: "http.client.request.duration",
55
56
  kind: "histogram",
56
57
  unit: "s",
@@ -71,7 +72,7 @@ var d = 1e3, f = {
71
72
  10
72
73
  ]
73
74
  };
74
- function p(e, t, r, i) {
75
+ function m(e, t, r, i) {
75
76
  let a = typeof location < "u" ? location.href : void 0, o = {
76
77
  "http.request.method": e,
77
78
  "server.address": new URL(t, a).hostname
@@ -82,10 +83,10 @@ function p(e, t, r, i) {
82
83
  }
83
84
  return o["http.response.status_code"] = r, r >= 400 && (o["error.type"] = String(r)), o;
84
85
  }
85
- function m() {
86
+ function h() {
86
87
  return XMLHttpRequest.prototype;
87
88
  }
88
- function h(e) {
89
+ function g(e) {
89
90
  if (typeof e == "string") return e;
90
91
  if (e instanceof URL) return e.href;
91
92
  if (typeof e == "object" && e) {
@@ -94,24 +95,22 @@ function h(e) {
94
95
  }
95
96
  return String(e);
96
97
  }
97
- function g(e, t) {
98
+ function _(e, t) {
98
99
  let n = t?.method;
99
- return n === void 0 && typeof e == "object" && e && (n = e.method), v(n ?? "GET");
100
+ return n === void 0 && typeof e == "object" && e && (n = e.method), b(n ?? "GET");
100
101
  }
101
- function _(e) {
102
+ function v(e) {
102
103
  return typeof e == "object" && !(e instanceof URL) && !(e instanceof Request);
103
104
  }
104
- function v(e) {
105
+ function y(e) {
106
+ return e === void 0 || Object.values(e).every((e) => e === void 0);
107
+ }
108
+ function b(e) {
105
109
  return typeof e == "string" ? e.toUpperCase() : String(e);
106
110
  }
107
- var y = class {
108
- ctx;
109
- name = "network";
110
- installed = !1;
111
- restores = [];
112
- warnedTransport = !1;
111
+ var x = class {
113
112
  constructor(e) {
114
- this.ctx = e;
113
+ c(this, "ctx", void 0), c(this, "name", "network"), c(this, "installed", !1), c(this, "restores", []), c(this, "warnedTransport", !1), this.ctx = e;
115
114
  }
116
115
  install() {
117
116
  this.installed || (this.installed = !0, this.ctx.config.capture.fetch && this.installFetch(), this.ctx.config.capture.xhr && this.installXhr());
@@ -133,31 +132,31 @@ var y = class {
133
132
  }
134
133
  installFetch() {
135
134
  if (typeof globalThis.fetch != "function") return;
136
- let t = !0, n = (e, t) => this.prepareFetch(e, t), r = (e, t, n, r, i) => {
135
+ let e = !0, n = (e, t) => this.prepareFetch(e, t), r = (e, t, n, r, i) => {
137
136
  this.record(e.method, e.url, t, n, r, e.span, e.routingContextId, i);
138
137
  }, i = a(globalThis, "fetch", (i) => {
139
138
  let a = i.bind(globalThis);
140
139
  return async function(i, o) {
141
- let s = t ? n(i, o) : void 0;
140
+ let s = e ? n(i, o) : void 0;
142
141
  if (!s) return a(i, o);
143
142
  let c = performance.now();
144
143
  try {
145
- let t = await a(s.input, s.init);
146
- return r(s, t.status, performance.now() - c, void 0, () => t.headers.get(e)), t;
144
+ let e = await a(s.input, s.init);
145
+ return r(s, e.status, performance.now() - c, void 0, () => e.headers.get(t)), e;
147
146
  } catch (e) {
148
147
  throw r(s, 0, performance.now() - c, e), e;
149
148
  }
150
149
  };
151
150
  });
152
151
  this.restores.push(() => {
153
- t = !1, i();
152
+ e = !1, i();
154
153
  });
155
154
  }
156
155
  prepareFetch(e, t) {
157
156
  let n = this.ctx.diagnostics.guard("capture.record_failed", "The library could not read a fetch request. It sends the request unchanged.", () => {
158
- let n = h(e);
157
+ let n = g(e);
159
158
  if (!this.ignored(n)) return {
160
- method: g(e, t),
159
+ method: _(e, t),
161
160
  url: n,
162
161
  propagate: this.propagates(n)
163
162
  };
@@ -170,22 +169,23 @@ var y = class {
170
169
  init: t,
171
170
  routingContextId: this.ctx.config.securityContext.id
172
171
  };
173
- if (!n.propagate || _(e)) return a;
172
+ if (!n.propagate || v(e)) return a;
174
173
  try {
175
- let n = this.ctx.tracing.request(), r = Object.entries(n.headers);
174
+ let n = e instanceof Request ? e.headers : void 0, r = new Headers(t?.headers ?? n);
175
+ if (r.has("traceparent")) return this.ctx.diagnostics.report("capture.trace_header_kept", "The request already has a traceparent header. The library keeps it and records no client span.", { url: i }), a;
176
+ let o = this.ctx.tracing.request();
177
+ for (let [e, t] of Object.entries(o.headers)) r.set(e, t);
176
178
  if (e instanceof Request) {
177
- let t = new Headers(e.headers);
178
- for (let [e, n] of r) t.set(e, n);
179
- a.input = new Request(e, { headers: t });
180
- } else {
181
- let e = new Headers(t?.headers);
182
- for (let [t, n] of r) e.set(t, n);
183
- a.init = {
179
+ let n = {
184
180
  ...t,
185
- headers: e
181
+ headers: r
186
182
  };
187
- }
188
- a.span = n.span;
183
+ y(t) && (n.referrer = e.referrer, n.referrerPolicy = e.referrerPolicy), a.input = new Request(e, n), a.init = void 0;
184
+ } else a.init = {
185
+ ...t,
186
+ headers: r
187
+ };
188
+ a.span = o.span;
189
189
  } catch (n) {
190
190
  a.input = e, a.init = t, this.ctx.diagnostics.report("capture.header_failed", "The library could not add the traceparent header. It sends the request unchanged.", { url: i }, n);
191
191
  }
@@ -195,11 +195,11 @@ var y = class {
195
195
  if (typeof XMLHttpRequest > "u") return;
196
196
  let e = !0, t = this.ctx, n = (e) => this.ignored(e), r = (e) => this.propagates(e), i = (e, t, n, r) => {
197
197
  this.record(e.method, e.url, t, n, void 0, e.span, e.routingContextId, r);
198
- }, o = m(), s = a(o, "open", (n) => function(r, i, ...a) {
198
+ }, o = h(), s = a(o, "open", (n) => function(r, i, ...a) {
199
199
  e && t.diagnostics.guard("capture.record_failed", "The library could not read an XMLHttpRequest. It does not record the request.", () => {
200
200
  this.__uiobs = {
201
- method: v(r),
202
- url: h(i),
201
+ method: b(r),
202
+ url: g(i),
203
203
  startedAt: 0
204
204
  };
205
205
  }), n.apply(this, [
@@ -211,8 +211,8 @@ var y = class {
211
211
  let s = e ? this.__uiobs : void 0;
212
212
  s && t.diagnostics.guard("capture.record_failed", `The library could not record ${s.method} ${s.url}.`, () => {
213
213
  n(s.url) || (s.startedAt = performance.now(), s.routingContextId = t.config.securityContext.id, this.addEventListener("loadend", () => {
214
- i(s, this.status, performance.now() - s.startedAt, () => l(this.getAllResponseHeaders()));
215
- }, { once: !0 }), r(s.url) && (s.span = b(this, s.url, t)));
214
+ i(s, this.status, performance.now() - s.startedAt, () => u(this.getAllResponseHeaders()));
215
+ }, { once: !0 }), r(s.url) && (s.span = S(this, s.url, t)));
216
216
  }), a.apply(this, o);
217
217
  });
218
218
  this.restores.push(() => {
@@ -221,22 +221,22 @@ var y = class {
221
221
  }
222
222
  record(e, t, n, i, a, s, c, l) {
223
223
  if (this.ctx.isActive?.() === !1 || this.ctx.config.securityContext.isolation && c !== void 0 && c !== this.ctx.config.securityContext.id) return;
224
- let m = this.ctx.config.capture.serverTiming && l ? this.ctx.diagnostics.guard("capture.record_failed", "The library could not read the Server-Timing response header.", () => u(l())) : void 0, h = o(t, this.ctx.config.capture.fullUrls, this.ctx.config.capture.urlTransform, this.ctx.diagnostics);
224
+ let u = this.ctx.config.capture.serverTiming && l ? this.ctx.diagnostics.guard("capture.record_failed", "The library could not read the Server-Timing response header.", () => d(l())) : void 0, h = o(t, this.ctx.config.capture.fullUrls, this.ctx.config.capture.urlTransform, this.ctx.diagnostics);
225
225
  !this.warnedTransport && r() && (this.warnedTransport = !0, this.ctx.diagnostics.report("capture.transport_request", `Network capture saw ${e} ${h} during a custom transport call. If the transport sends this request, add its URL to capture.ignoreUrls.`)), this.ctx.config.capture.httpMetrics && this.ctx.diagnostics.guard("capture.record_failed", `The library could not record the duration of ${e} ${h}.`, () => {
226
- let r = p(e, t, n, a);
227
- this.ctx.recordMetric(f, i / d, r);
226
+ let r = m(e, t, n, a);
227
+ this.ctx.recordMetric(p, i / f, r);
228
228
  }), s && this.ctx.diagnostics.guard("capture.record_failed", `The library could not record the span of ${e} ${h}.`, () => {
229
229
  let r = Date.now();
230
230
  this.ctx.recordSpan({
231
231
  ...s,
232
- link: m?.link,
232
+ link: u?.link,
233
233
  name: e,
234
234
  kind: "client",
235
235
  startMs: r - i,
236
236
  endMs: r,
237
237
  error: n === 0 || n >= 400,
238
238
  attributes: {
239
- ...p(e, t, n, a),
239
+ ...m(e, t, n, a),
240
240
  "url.full": h
241
241
  }
242
242
  });
@@ -253,13 +253,13 @@ var y = class {
253
253
  "url.full": h,
254
254
  "http.response.status_code": n,
255
255
  "http.duration_ms": t,
256
- ...m && m.entries.length > 0 ? { "server.timing": m.entries } : {}
256
+ ...u && u.entries.length > 0 ? { "server.timing": u.entries } : {}
257
257
  };
258
258
  n === 0 ? this.ctx.logger.error(`${e} ${h} failed`, a, r) : n >= 400 ? this.ctx.logger.warn(`${e} ${h} returned ${String(n)}`, r) : this.ctx.logger.debug(`${e} ${h}`, r);
259
259
  });
260
260
  }
261
261
  };
262
- function b(e, t, n) {
262
+ function S(e, t, n) {
263
263
  try {
264
264
  let t = n.tracing.request();
265
265
  for (let [n, r] of Object.entries(t.headers)) e.setRequestHeader(n, r);
@@ -269,6 +269,6 @@ function b(e, t, n) {
269
269
  return;
270
270
  }
271
271
  }
272
- export { y as NetworkCapture };
272
+ export { x as NetworkCapture };
273
273
 
274
- //# sourceMappingURL=network-C7SkLf4v.js.map
274
+ //# sourceMappingURL=network-Cg1L2w2r.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network-Cg1L2w2r.js","names":["SERVER_TIMING_MAX_CHARS","SERVER_TIMING_HEADER","isErrorLike","isTransportPending","isLibraryRequest","patch","recordedUrl","matchesAny","_defineProperty","splitHeader","parts","start","quoted","escaped","i","text","char","separator","xhrServerTiming","headers","readServerTiming","result","header","part","rawName","params","name","entry","seen","param","equal","key","value","duration","match","MS_PER_SECOND","HTTP_DURATION","durationAttributes","base","attributes","method","url","status","error","xhrMethods","readUrl","input","readFetchMethod","requested","init","toMethod","isForeignInput","isEmptyInit","NetworkCapture","ctx","restore","targets","origin","target","active","prepare","record","plan","durationMs","readTiming","call","original","startedAt","response","read","own","trace","rebuilt","ignored","propagates","meta","proto","restoreOpen","rest","originalOpen","restoreSend","args","addTraceHeaders","originalSend","routingContextId","timing","span","endMs","rounded"],"sources":["../src/capture/server-timing.ts","../src/capture/network.ts"],"sourcesContent":["import { SERVER_TIMING_MAX_CHARS, SERVER_TIMING_MAX_ENTRIES } from \"../constants\";\n\n/** One duration entry from the Server-Timing response header. */\ninterface ServerTimingEntry {\n name: string;\n duration: number;\n description: string;\n}\n\n/** Server duration entries, plus the server span they name. */\nexport interface ServerTiming {\n entries: ServerTimingEntry[];\n link?: { traceId: string; spanId: string };\n}\n\n/** Splits a header on separators outside quoted strings. An escaped quote doesn't end a string. */\nfunction splitHeader(text: string, separator: string): string[] {\n const parts: string[] = [];\n let start = 0;\n let quoted = false;\n let escaped = false;\n\n for (let i = 0; i < text.length; i++) {\n const char = text[i];\n if (escaped) {\n escaped = false;\n } else if (quoted && char === \"\\\\\") {\n escaped = true;\n } else if (char === '\"') {\n quoted = !quoted;\n } else if (!quoted && char === separator) {\n parts.push(text.slice(start, i));\n start = i + 1;\n }\n }\n\n parts.push(text.slice(start));\n return parts;\n}\n\n/** Finds the header in an XHR header list. Reading a hidden header directly logs a Chrome error. */\nexport function xhrServerTiming(headers: string): string | null {\n return /^server-timing:(.*)$/im.exec(headers)?.[1] ?? null;\n}\n\n/** Reads a bounded number of server duration entries. A missing header gives none. */\nexport function readServerTiming(header: string | null): ServerTiming {\n const result: ServerTiming = { entries: [] };\n if (!header) {\n return result;\n }\n\n for (const part of splitHeader(header.slice(0, SERVER_TIMING_MAX_CHARS), \",\").slice(\n 0,\n SERVER_TIMING_MAX_ENTRIES,\n )) {\n const [rawName, ...params] = splitHeader(part, \";\");\n const name = rawName.trim();\n if (!/^[!#$%&'*+.^_`|~\\da-z-]+$/i.test(name)) {\n continue;\n }\n\n const entry: ServerTimingEntry = { name, duration: 0, description: \"\" };\n const seen = new Set<string>();\n for (const param of params) {\n const equal = param.indexOf(\"=\");\n if (equal < 0) {\n continue;\n }\n\n const key = param.slice(0, equal).trim().toLowerCase();\n if (seen.has(key)) {\n continue;\n }\n seen.add(key);\n\n let value = param.slice(equal + 1).trim();\n if (value.startsWith('\"') && value.endsWith('\"')) {\n value = value.slice(1, -1).replace(/\\\\(.)/g, \"$1\");\n }\n\n if (key === \"dur\") {\n const duration = Number(value);\n if (Number.isFinite(duration) && duration >= 0) {\n entry.duration = duration;\n }\n } else if (key === \"desc\") {\n entry.description = value;\n }\n }\n\n result.entries.push(entry);\n if (name.toLowerCase() === \"traceparent\") {\n const match = /^00-([\\da-f]{32})-([\\da-f]{16})-[\\da-f]{2}$/.exec(entry.description);\n if (match && /[1-9a-f]/.test(match[1]) && /[1-9a-f]/.test(match[2])) {\n result.link = { traceId: match[1], spanId: match[2] };\n }\n }\n }\n\n return result;\n}\n","// src/capture/network.ts\n//\n// Instruments fetch and XMLHttpRequest to record the outcome and timing of network requests.\n\nimport { SERVER_TIMING_HEADER, TRACEPARENT_HEADER } from \"../constants\";\nimport { readServerTiming, xhrServerTiming } from \"./server-timing\";\nimport type { InstrumentDef, MetricAttributes } from \"../models/metric\";\nimport { isErrorLike } from \"../utils/error-like\";\nimport { isLibraryRequest, isTransportPending } from \"../utils/library-request\";\nimport { patch } from \"../utils/patch\";\nimport { recordedUrl } from \"../utils/platform\";\nimport type { ClientSpan } from \"../utils/tracing\";\nimport { type Capture, type CaptureContext, matchesAny } from \"./types\";\n\n/** Signature of the global fetch function. */\ntype FetchFn = typeof fetch;\n\n/** Milliseconds in one second. The histogram is in seconds, as its OpenTelemetry name says. */\nconst MS_PER_SECOND = 1000;\n\n/**\n * The HTTP client duration histogram from the OpenTelemetry semantic conventions, with the\n * boundaries the conventions recommend.\n */\nconst HTTP_DURATION: InstrumentDef = {\n name: \"http.client.request.duration\",\n kind: \"histogram\",\n unit: \"s\",\n boundaries: [0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10],\n};\n\n/**\n * Builds the low-cardinality attributes for one request. The path and the query stay out,\n * because every distinct attribute value creates a new series in the backend.\n * @param method Uppercase HTTP method.\n * @param url Request URL.\n * @param status HTTP status code, or 0 when no response came.\n * @param error What failed, for a request with no response.\n * @returns The attribute set.\n */\nfunction durationAttributes(\n method: string,\n url: string,\n status: number,\n error: unknown,\n): MetricAttributes {\n // A relative URL needs the page URL as its base. A worker has a location too.\n const base = typeof location !== \"undefined\" ? location.href : undefined;\n const attributes: MetricAttributes = {\n \"http.request.method\": method,\n \"server.address\": new URL(url, base).hostname,\n };\n\n if (status === 0) {\n // A request with no response takes its error's type, for example TypeError.\n const name = isErrorLike(error) ? error.name : \"\";\n attributes[\"error.type\"] = name === \"\" ? \"_OTHER\" : name;\n return attributes;\n }\n\n attributes[\"http.response.status_code\"] = status;\n if (status >= 400) {\n attributes[\"error.type\"] = String(status);\n }\n\n return attributes;\n}\n\n/** Request data the XHR wrapper keeps from open to send. */\ninterface XhrMeta {\n /** The delivery context when the request started. */\n routingContextId?: string;\n /** Uppercase HTTP method. */\n method: string;\n /** Request target URL. */\n url: string;\n /** Performance timestamp at send. */\n startedAt: number;\n /** The client span the traceparent names. */\n span?: ClientSpan;\n}\n\n/** An XMLHttpRequest with our tracking metadata attached. */\ntype Tracked = XMLHttpRequest & {\n __uiobs?: XhrMeta;\n};\n\n/** The XMLHttpRequest prototype methods we wrap, kept unbound. */\ninterface XhrMethods {\n open: (this: XMLHttpRequest, ...args: never[]) => void;\n send: (this: XMLHttpRequest, ...args: never[]) => void;\n}\n\n/** Returns the XMLHttpRequest prototype. */\nfunction xhrMethods(): XhrMethods {\n return XMLHttpRequest.prototype;\n}\n\n/** The fetch call to make, and the method and URL to record. */\ninterface FetchPlan {\n /** The delivery context when the request started. */\n routingContextId?: string;\n /** Uppercase HTTP method. */\n method: string;\n /** Request target URL. */\n url: string;\n /** Input to pass to the original fetch. */\n input: RequestInfo | URL;\n /** Init to pass to the original fetch. */\n init: RequestInit | undefined;\n /** The client span the traceparent names. */\n span?: ClientSpan;\n}\n\n/**\n * Reads the URL from a fetch input or an XHR URL argument.\n * A Request from another realm fails `instanceof Request`, but its `url` property still works.\n * @param input String, URL, Request, or an object with a text form.\n * @returns The URL.\n * @throws TypeError when the input has no text form. Call it inside a diagnostics guard.\n */\nfunction readUrl(input: unknown): string {\n if (typeof input === \"string\") {\n return input;\n }\n\n if (input instanceof URL) {\n return input.href;\n }\n\n if (typeof input === \"object\" && input !== null) {\n const { url } = input as { url?: unknown };\n if (typeof url === \"string\") {\n return url;\n }\n }\n\n // fetch accepts anything with a text form.\n return String(input);\n}\n\n/**\n * Reads the method of a fetch call. The init's method wins over the Request's.\n * @param input Fetch input.\n * @param init Fetch init.\n * @returns Uppercase method. Defaults to GET.\n */\nfunction readFetchMethod(input: unknown, init: RequestInit | undefined): string {\n let requested: unknown = init?.method;\n\n if (requested === undefined && typeof input === \"object\" && input !== null) {\n requested = (input as { method?: unknown }).method;\n }\n\n return toMethod(requested ?? \"GET\");\n}\n\n/**\n * Checks whether a fetch input is an object that isn't a Request or a URL from this realm,\n * for example a Request from an iframe.\n * @param input Fetch input.\n * @returns True for a foreign object.\n */\nfunction isForeignInput(input: unknown): boolean {\n return typeof input === \"object\" && !(input instanceof URL) && !(input instanceof Request);\n}\n\n/**\n * Checks whether a fetch init sets nothing, for example {}. Like fetch(request), the call\n * fetch(request, {}) keeps the Request's referrer, and any other init resets it.\n * @param init The caller's fetch init.\n * @returns True when no member has a value.\n */\nfunction isEmptyInit(init: RequestInit | undefined): boolean {\n return init === undefined || Object.values(init).every((value) => value === undefined);\n}\n\n/**\n * Converts a method argument to text. Never throws on a method that isn't a string.\n * @param method The caller's method argument.\n * @returns The uppercase method for a string, or the text form of anything else.\n */\nfunction toMethod(method: unknown): string {\n return typeof method === \"string\" ? method.toUpperCase() : String(method);\n}\n\n/** Instruments global fetch and XMLHttpRequest to capture request durations and outcomes. */\nexport class NetworkCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"network\";\n\n /** Guards against wrapping a function twice. */\n private installed = false;\n\n /** Restore functions for the installed wrappers. */\n private readonly restores: (() => void)[] = [];\n\n /** True once we've reported a request made during a custom transport call. Reported once. */\n private warnedTransport = false;\n\n /**\n * @param ctx Capture context: configuration, diagnostics, logger, breadcrumbs and tracing.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Instruments the network APIs the configuration selects. */\n install(): void {\n if (this.installed) {\n return;\n }\n this.installed = true;\n\n if (this.ctx.config.capture.fetch) {\n this.installFetch();\n }\n if (this.ctx.config.capture.xhr) {\n this.installXhr();\n }\n }\n\n /**\n * Restores every host function that still holds this capture's wrapper.\n * A wrapper that another script wrapped again stays in place and records nothing.\n */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n for (const restore of this.restores.splice(0)) {\n restore();\n }\n }\n\n /**\n * Checks whether a URL matches the ignore patterns.\n * @param url Request target URL.\n * @returns True if the URL must stay out of the telemetry.\n */\n private ignored(url: string): boolean {\n // resolveConfig always adds the endpoint to ignoreUrls. Otherwise a failed POST becomes a\n // log record, the record causes a new POST, and the loop never stops.\n // A custom transport has no known URL, but its request starts inside the library scope.\n return isLibraryRequest() || matchesAny(url, this.ctx.config.capture.ignoreUrls);\n }\n\n /**\n * Checks whether a request gets the trace headers.\n * @param url Request target URL.\n * @returns True if the URL is in propagateTraceHeaderTo.\n */\n private propagates(url: string): boolean {\n // Only add headers to allowlisted URLs. A traceparent on a third-party request triggers\n // a CORS preflight that the third party doesn't answer, and its API stops working.\n const targets = this.ctx.config.capture.propagateTraceHeaderTo;\n if (targets.length === 0) {\n return false;\n }\n\n // A string target is an origin. A relative URL resolves against the page.\n const origin = this.ctx.diagnostics.guard(\n \"capture.header_failed\",\n \"The library could not read the origin of a request URL. Only a RegExp target can match it.\",\n () => new URL(url, location.href).origin,\n );\n\n return targets.some((target) =>\n typeof target === \"string\" ? target === origin : target.test(url),\n );\n }\n\n /** Wraps globalThis.fetch to inject the trace headers and log the outcome. */\n private installFetch(): void {\n if (typeof globalThis.fetch !== \"function\") {\n return;\n }\n\n // Uninstall clears the flag, so a wrapper that stays in place only calls the original.\n let active = true;\n const prepare = (input: RequestInfo | URL, init: RequestInit | undefined) =>\n this.prepareFetch(input, init);\n const record = (\n plan: FetchPlan,\n status: number,\n durationMs: number,\n error: unknown,\n readTiming?: () => string | null,\n ): void => {\n this.record(\n plan.method,\n plan.url,\n status,\n durationMs,\n error,\n plan.span,\n plan.routingContextId,\n readTiming,\n );\n };\n\n const restore = patch(globalThis, \"fetch\", (original: FetchFn) => {\n const call = original.bind(globalThis);\n\n return async function instrumentedFetch(input, init) {\n const plan = active ? prepare(input, init) : undefined;\n if (!plan) {\n return call(input, init);\n }\n\n const startedAt = performance.now();\n try {\n const response = await call(plan.input, plan.init);\n record(plan, response.status, performance.now() - startedAt, undefined, () =>\n response.headers.get(SERVER_TIMING_HEADER),\n );\n return response;\n } catch (error) {\n record(plan, 0, performance.now() - startedAt, error);\n throw error;\n }\n };\n });\n\n this.restores.push(() => {\n active = false;\n restore();\n });\n }\n\n /**\n * Reads a fetch call and adds the trace headers to an allowlisted request.\n * @param input The caller's fetch input.\n * @param init The caller's fetch init.\n * @returns The plan, or undefined to send the request unchanged and record nothing.\n */\n private prepareFetch(\n input: RequestInfo | URL,\n init: RequestInit | undefined,\n ): FetchPlan | undefined {\n // This read runs inside the caller's fetch call, so a throw must not fail the request.\n const read = this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not read a fetch request. It sends the request unchanged.\",\n (): { method: string; url: string; propagate: boolean } | undefined => {\n const url = readUrl(input);\n if (this.ignored(url)) {\n return undefined;\n }\n\n return { method: readFetchMethod(input, init), url, propagate: this.propagates(url) };\n },\n );\n\n if (!read) {\n return undefined;\n }\n\n const { method, url } = read;\n const plan: FetchPlan = {\n method,\n url,\n input,\n init,\n routingContextId: this.ctx.config.securityContext.id,\n };\n // An init with headers replaces every header on a foreign Request, Authorization\n // included. So a foreign input goes out without the trace headers.\n if (!read.propagate || isForeignInput(input)) {\n return plan;\n }\n\n try {\n // fetch(request, init) builds new Request(request, init), and init.headers then replaces\n // every header the Request had. So work on the headers that actually go out.\n const own = input instanceof Request ? input.headers : undefined;\n const headers = new Headers(init?.headers ?? own);\n\n // The caller runs its own trace, for example with OpenTelemetry, so don't break it.\n if (headers.has(TRACEPARENT_HEADER)) {\n this.ctx.diagnostics.report(\n \"capture.trace_header_kept\",\n \"The request already has a traceparent header. The library keeps it and records no \" +\n \"client span.\",\n { url },\n );\n return plan;\n }\n\n const trace = this.ctx.tracing.request();\n for (const [key, value] of Object.entries(trace.headers)) {\n headers.set(key, value);\n }\n\n if (input instanceof Request) {\n const rebuilt: RequestInit = { ...init, headers };\n // Our rebuild has headers, which resets the referrer, so keep it when the caller's didn't.\n if (isEmptyInit(init)) {\n rebuilt.referrer = input.referrer;\n rebuilt.referrerPolicy = input.referrerPolicy;\n }\n\n // Build the Request once with the caller's whole init, as fetch would, and pass no init\n // next to it. Otherwise fetch builds it again and reads the body twice, which throws.\n plan.input = new Request(input, rebuilt);\n plan.init = undefined;\n } else {\n plan.init = { ...init, headers };\n }\n\n // Only record the client span for a request that actually carries its traceparent.\n plan.span = trace.span;\n } catch (error) {\n // Send exactly what the caller gave us. A missing header is better than a failed\n // request.\n plan.input = input;\n plan.init = init;\n this.ctx.diagnostics.report(\n \"capture.header_failed\",\n \"The library could not add the traceparent header. It sends the request unchanged.\",\n { url },\n error,\n );\n }\n\n return plan;\n }\n\n /** Wraps the open and send methods on the XMLHttpRequest prototype. */\n private installXhr(): void {\n if (typeof XMLHttpRequest === \"undefined\") {\n return;\n }\n\n // Uninstall clears the flag, so a wrapper that stays in place only calls the original.\n let active = true;\n const ctx = this.ctx;\n const ignored = (url: string): boolean => this.ignored(url);\n const propagates = (url: string): boolean => this.propagates(url);\n const record = (\n meta: XhrMeta,\n status: number,\n durationMs: number,\n readTiming: () => string | null,\n ): void => {\n this.record(\n meta.method,\n meta.url,\n status,\n durationMs,\n undefined,\n meta.span,\n meta.routingContextId,\n readTiming,\n );\n };\n\n const proto = xhrMethods();\n\n const restoreOpen = patch(\n proto,\n \"open\",\n (originalOpen) =>\n function (this: Tracked, method: unknown, url: unknown, ...rest: never[]) {\n if (active) {\n // This read runs inside the caller's open call, so a throw must not fail it.\n ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not read an XMLHttpRequest. It does not record the request.\",\n () => {\n this.__uiobs = { method: toMethod(method), url: readUrl(url), startedAt: 0 };\n },\n );\n }\n originalOpen.apply(this, [method, url, ...rest] as never[]);\n },\n );\n\n const restoreSend = patch(\n proto,\n \"send\",\n (originalSend) =>\n function (this: Tracked, ...args: never[]) {\n const meta = active ? this.__uiobs : undefined;\n if (meta) {\n ctx.diagnostics.guard(\n \"capture.record_failed\",\n `The library could not record ${meta.method} ${meta.url}.`,\n () => {\n if (ignored(meta.url)) {\n return;\n }\n\n meta.startedAt = performance.now();\n meta.routingContextId = ctx.config.securityContext.id;\n // A reused XHR gets a new listener on every send, so the old one must not\n // fire again.\n this.addEventListener(\n \"loadend\",\n () => {\n record(meta, this.status, performance.now() - meta.startedAt, () =>\n xhrServerTiming(this.getAllResponseHeaders()),\n );\n },\n { once: true },\n );\n\n // setRequestHeader only works between open and send.\n if (propagates(meta.url)) {\n meta.span = addTraceHeaders(this, meta.url, ctx);\n }\n },\n );\n }\n originalSend.apply(this, args);\n },\n );\n\n this.restores.push(() => {\n active = false;\n restoreOpen();\n restoreSend();\n });\n }\n\n /**\n * Records the outcome of a request as attributes and a breadcrumb.\n * @param method Uppercase HTTP method.\n * @param target Request target URL. The query is removed here unless you set fullUrls.\n * @param status HTTP response status code, or 0 on failure.\n * @param durationMs Request duration in milliseconds.\n * @param error The caught error, for a failed request.\n * @param span The client span the request's traceparent names.\n */\n private record(\n method: string,\n target: string,\n status: number,\n durationMs: number,\n error: unknown,\n span?: ClientSpan,\n routingContextId?: string,\n readTiming?: () => string | null,\n ): void {\n if (\n this.ctx.isActive?.() === false ||\n (this.ctx.config.securityContext.isolation &&\n routingContextId !== undefined &&\n routingContextId !== this.ctx.config.securityContext.id)\n ) {\n return;\n }\n\n const timing =\n this.ctx.config.capture.serverTiming && readTiming\n ? this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not read the Server-Timing response header.\",\n () => readServerTiming(readTiming()),\n )\n : undefined;\n\n // Strip the query here, not at the call sites. ignoreUrls and propagateTraceHeaderTo\n // match on the full URL, and only the recorded URL loses its query string.\n const url = recordedUrl(\n target,\n this.ctx.config.capture.fullUrls,\n this.ctx.config.capture.urlTransform,\n this.ctx.diagnostics,\n );\n\n // A transport request made after an await gets recorded, and that record causes the next\n // send.\n if (!this.warnedTransport && isTransportPending()) {\n this.warnedTransport = true;\n this.ctx.diagnostics.report(\n \"capture.transport_request\",\n `Network capture saw ${method} ${url} during a custom transport call. If the transport sends this request, add its URL to capture.ignoreUrls.`,\n );\n }\n\n // The histogram has its own guard, so a URL that doesn't parse can't stop the record.\n if (this.ctx.config.capture.httpMetrics) {\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n `The library could not record the duration of ${method} ${url}.`,\n () => {\n const attributes = durationAttributes(method, target, status, error);\n this.ctx.recordMetric(HTTP_DURATION, durationMs / MS_PER_SECOND, attributes);\n },\n );\n }\n\n if (span) {\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n `The library could not record the span of ${method} ${url}.`,\n () => {\n const endMs = Date.now();\n this.ctx.recordSpan({\n ...span,\n link: timing?.link,\n name: method,\n kind: \"client\",\n startMs: endMs - durationMs,\n endMs,\n error: status === 0 || status >= 400,\n attributes: { ...durationAttributes(method, target, status, error), \"url.full\": url },\n });\n },\n );\n }\n\n // This runs inside the caller's fetch call, so an error here must not fail the caller's\n // request.\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n `The library could not record ${method} ${url}.`,\n () => {\n const rounded = Math.round(durationMs);\n\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"http\",\n message: `${method} ${url} ${status === 0 ? \"failed\" : String(status)}`,\n data: { durationMs: rounded },\n });\n\n const attributes = {\n \"http.request.method\": method,\n \"url.full\": url,\n \"http.response.status_code\": status,\n \"http.duration_ms\": rounded,\n ...(timing && timing.entries.length > 0 ? { \"server.timing\": timing.entries } : {}),\n };\n\n if (status === 0) {\n this.ctx.logger.error(`${method} ${url} failed`, error, attributes);\n return;\n }\n if (status >= 400) {\n this.ctx.logger.warn(`${method} ${url} returned ${String(status)}`, attributes);\n return;\n }\n\n // Log a success at DEBUG, which the default minLevel of INFO drops. That way only\n // failures use bandwidth.\n this.ctx.logger.debug(`${method} ${url}`, attributes);\n },\n );\n }\n}\n\n/**\n * Adds the trace headers to an open XHR. If that fails, the request goes out without them.\n * @param xhr A request between open and send.\n * @param url Request target URL, for the diagnostic.\n * @param ctx Capture context with tracing and diagnostics.\n * @returns The client span the traceparent names, or undefined.\n */\nfunction addTraceHeaders(\n xhr: XMLHttpRequest,\n url: string,\n ctx: CaptureContext,\n): ClientSpan | undefined {\n try {\n const trace = ctx.tracing.request();\n for (const [key, value] of Object.entries(trace.headers)) {\n xhr.setRequestHeader(key, value);\n }\n return trace.span;\n } catch (error) {\n ctx.diagnostics.report(\n \"capture.header_failed\",\n \"The library could not add the traceparent header. It sends the request unchanged.\",\n { url },\n error,\n );\n return undefined;\n }\n}\n"],"mappings":";;;;;;;;AAgBA,SAASS,EAAY,GAAc,GAA6B;CAC9D,IAAMC,IAAkB,CAAC,GACrBC,IAAQ,GACRC,IAAS,IACTC,IAAU;CAEd,KAAK,IAAIC,IAAI,GAAGA,IAAIC,EAAK,QAAQ,KAAK;EACpC,IAAMC,IAAOD,EAAKD;EAClB,AAAID,IACF,IAAU,KACDD,KAAUI,MAAS,OAC5B,IAAU,KACDA,MAAS,OAClB,IAAS,CAACJ,IACD,CAACA,KAAUI,MAASC,MAC7BP,EAAM,KAAKK,EAAK,MAAMJ,GAAOG,CAAC,CAAC,GAC/B,IAAQA,IAAI;CAEhB;CAGA,OADAJ,EAAM,KAAKK,EAAK,MAAMJ,CAAK,CAAC,GACrBD;AACT;AAGA,SAAgBQ,EAAgB,GAAgC;CAC9D,OAAO,yBAAyB,KAAKC,CAAO,CAAC,GAAG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;GAC9B,CAAC;GAED,IAAMjD,IAAa;IACjB,uBAAuBC;IACvB,YAAYC;IACZ,6BAA6BC;IAC7B,oBAAoB8C;IACpB,GAAIH,KAAUA,EAAO,QAAQ,SAAS,IAAI,EAAE,iBAAiBA,EAAO,QAAQ,IAAI,CAAC;GACnF;GAEA,AAAI3C,MAAW,IACb,KAAK,IAAI,OAAO,MAAM,GAAGF,EAAO,GAAGC,EAAI,UAAUE,GAAOJ,CAAU,IAGhEG,KAAU,MACZ,KAAK,IAAI,OAAO,KAAK,GAAGF,EAAO,GAAGC,EAAI,YAAY,OAAOC,CAAM,KAAKH,CAAU,IAMhF,KAAK,IAAI,OAAO,MAAM,GAAGC,EAAO,GAAGC,KAAOF,CAAU;EACtD,CACF;CACF;AACF;AASA,SAAS2C,EACP,GACA,GACA,GACwB;CACxB,IAAI;EACF,IAAMX,IAAQjB,EAAI,QAAQ,QAAQ;EAClC,KAAK,IAAM,CAACvB,GAAKC,MAAU,OAAO,QAAQuC,EAAM,OAAO,GACrD,EAAI,iBAAiBxC,GAAKC,CAAK;EAEjC,OAAOuC,EAAM;CACf,SAAS5B,GAAO;EACd,EAAI,YAAY,OACd,yBACA,qFACA,EAAE,OAAI,GACNA,CACF;EACA;CACF;AACF"}
@@ -0,0 +1,2 @@
1
+ const e=require("./constants-CtF52hIV.cjs");var t=Symbol.for(`${e.qt}@${e.rr}`);function n(){let e=globalThis,n=e[t];if(n?.windows instanceof Set&&n.observers instanceof Set)return n;let r={windows:new Set,observers:new Set};return e[t]=r,r}function r(e){if(typeof e!=`object`||!e)return!1;try{let{document:t,addEventListener:n}=e;return typeof t==`object`&&!!t&&typeof n==`function`}catch{return!0}}function i(e){try{return e.closed}catch{return!1}}function a(){for(let e of n().windows)i(e)&&s(e)}function o(e,t){e.attach(t)||n().windows.delete(t)}function s(e){let{windows:t,observers:r}=n();if(t.delete(e))for(let t of r)t.detach(e)}function c(){return a(),[...n().windows]}function l(e){a();let{windows:t,observers:r}=n();r.add(e);for(let n of t)o(e,n);return()=>{r.delete(e);for(let n of t)e.detach(n)}}function u(e){if(e===globalThis||!r(e))return()=>void 0;a();let{windows:t,observers:i}=n();t.add(e);for(let t of i)o(t,e);return()=>{s(e)}}Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
2
+ //# sourceMappingURL=observed-windows-B3gJkdql.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observed-windows-B3gJkdql.cjs","names":["OBSERVED_WINDOWS_KEY","TELEMETRY_SDK_VERSION","require_constants","REGISTRY_KEY","registry","scope","found","fresh","windowLike","value","document","addEventListener","isClosed","win","pruneClosed","forgetWindow","attachTo","observer","windows","observers","observedWindows","addWindowObserver","observeWindow","target"],"sources":["../src/capture/observed-windows.ts"],"sourcesContent":["// src/capture/observed-windows.ts\n//\n// Keeps the windows that the app asks the library to observe, for example a dockview popout\n// whose code runs in this page. The list lives outside the runtime and the capture, so a window\n// observed before configure() or across shutdown() gets attached when the click capture installs.\n// This module is in the main graph, so it must not import the lazy click capture.\n\nimport { OBSERVED_WINDOWS_KEY, TELEMETRY_SDK_VERSION } from \"../constants\";\n\n/** An installed click capture, as the registry sees it. */\nexport interface WindowObserver {\n /**\n * Starts listening in one window.\n * @param win The window.\n * @returns False when the window can't be observed, so the registry forgets it.\n */\n attach(win: Window): boolean;\n /**\n * Stops listening in one window.\n * @param win The window.\n */\n detach(win: Window): void;\n}\n\n/** The windows that the app observes now, and the click captures that are installed now. */\ninterface Registry {\n windows: Set<Window>;\n observers: Set<WindowObserver>;\n}\n\n/** The registry's global key. The version in it keeps another version's copy apart. */\nconst REGISTRY_KEY = Symbol.for(`${OBSERVED_WINDOWS_KEY}@${TELEMETRY_SDK_VERSION}`);\n\n/**\n * Returns the page's registry. Two copies of one version share one runtime, so they share this\n * too. Otherwise a copy's observeWindow() would never reach the other copy's click capture. Any\n * page script can write the key, so a value of another shape gets a fresh registry instead of a\n * throw in observeWindow() or install().\n * @returns The registry.\n */\nfunction registry(): Registry {\n const scope = globalThis as Record<symbol, unknown>;\n const found = scope[REGISTRY_KEY] as Partial<Registry> | null | undefined;\n if (found?.windows instanceof Set && found.observers instanceof Set) {\n return found as Registry;\n }\n\n const fresh: Registry = { windows: new Set(), observers: new Set() };\n scope[REGISTRY_KEY] = fresh;\n return fresh;\n}\n\n/**\n * Checks whether a value can be a window. A window from another origin throws on the read, and\n * that's the expected answer. The fallback is true, so the capture reports it at attach.\n * @param value The value the app passed.\n * @returns True for an object with a document and an addEventListener function, or for one that\n * blocks the read.\n */\nfunction windowLike(value: unknown): value is Window {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n try {\n const { document, addEventListener } = value as {\n document?: unknown;\n addEventListener?: unknown;\n };\n return (\n typeof document === \"object\" && document !== null && typeof addEventListener === \"function\"\n );\n } catch {\n return true;\n }\n}\n\n/**\n * Checks whether a window has closed. A window that throws on the read can't say, and that's the\n * expected answer. The fallback is false, so the capture tries it and reports it.\n * @param win The window.\n * @returns True if the window has closed.\n */\nfunction isClosed(win: Window): boolean {\n try {\n return win.closed;\n } catch {\n return false;\n }\n}\n\n/**\n * Forgets each closed window. Its pagehide can't do it while clicks are off, and a user-closed\n * about:blank popout still reads open at its pagehide.\n */\nfunction pruneClosed(): void {\n for (const win of registry().windows) {\n if (isClosed(win)) {\n forgetWindow(win);\n }\n }\n}\n\n/**\n * Attaches one window to one capture. A window that can't be observed leaves the list, so the\n * next install doesn't report it again.\n * @param observer The capture.\n * @param win The window.\n */\nfunction attachTo(observer: WindowObserver, win: Window): void {\n if (!observer.attach(win)) {\n registry().windows.delete(win);\n }\n}\n\n/**\n * Removes a window from the list and from each installed capture.\n * @param win The window.\n */\nexport function forgetWindow(win: Window): void {\n const { windows, observers } = registry();\n if (!windows.delete(win)) {\n return;\n }\n\n for (const observer of observers) {\n observer.detach(win);\n }\n}\n\n/**\n * Returns the windows that the app observes now. It forgets each closed window first, so a\n * dead click check never watches one.\n * @returns A copy of the list, so a caller can hold it while the list changes.\n */\nexport function observedWindows(): Window[] {\n pruneClosed();\n return [...registry().windows];\n}\n\n/**\n * Adds an installed click capture and attaches each window that's observed now.\n * @param observer The capture.\n * @returns Function that detaches each window from the capture and removes it.\n */\nexport function addWindowObserver(observer: WindowObserver): () => void {\n pruneClosed();\n const { windows, observers } = registry();\n observers.add(observer);\n for (const win of windows) {\n attachTo(observer, win);\n }\n\n return () => {\n observers.delete(observer);\n for (const win of windows) {\n observer.detach(win);\n }\n };\n}\n\n/**\n * Captures clicks in another window of this page, for example a popout whose code runs here.\n * The window gets click breadcrumbs, rage clicks and dead clicks, with the same rules as this\n * page. It gets no navigation capture. The window must have this page's origin. A window from\n * another origin reports `capture.install_failed` and records nothing. The result of\n * `window.open()` works at once, because the `pagehide` of its initial about:blank doesn't end\n * the capture while the window is open.\n *\n * The library listens only while `capture.interactions` is on, and it keeps the window across\n * `shutdown()` and the next `configure()`. The window leaves at the stop function. While\n * `capture.interactions` is on, it also leaves at its `pagehide`. A closed window, also a closed\n * about:blank popout, leaves at the next read of the list: a dead click check, an install or an\n * observeWindow() call. Observe the window again after it reloads, and after the app fills\n * about:blank and then loads a page in it. A window that opens to another origin and is observed\n * at once gets no report, and the library forgets it at its next dead click check. This page's\n * own window and a value that isn't a window do nothing. A call never throws.\n * @param target The window to observe, for example the result of `window.open()`.\n * @returns Function that stops observing the window. A second call does nothing.\n */\nexport function observeWindow(target: Window): () => void {\n if ((target as unknown) === globalThis || !windowLike(target)) {\n return () => undefined;\n }\n\n pruneClosed();\n const { windows, observers } = registry();\n // Attach a listed window again. A page that loads after the app filled about:blank can get a\n // new Window object behind the same handle, without our listeners. A repeat add does nothing.\n windows.add(target);\n for (const observer of observers) {\n attachTo(observer, target);\n }\n\n return () => {\n forgetWindow(target);\n };\n}\n"],"mappings":"A,4CA+BA,I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,UAAa,CACXM,EAAU,OAAOF,CAAQ,EACzB,IAAK,IAAMJ,KAAOK,EAChBD,EAAS,OAAOJ,CAAG,CAEvB,CACF,CAqBA,SAAgBS,EAAc,EAA4B,CACxD,GAAKC,IAAuB,YAAc,CAACf,EAAWe,CAAM,EAC1D,UAAa,IAAA,GAGfT,EAAY,EACZ,GAAM,CAAE,UAAS,aAAcV,EAAS,EAGxCc,EAAQ,IAAIK,CAAM,EAClB,IAAK,IAAMN,KAAYE,EACrBH,EAASC,EAAUM,CAAM,EAG3B,UAAa,CACXR,EAAaQ,CAAM,CACrB,CACF,C"}
@@ -0,0 +1,64 @@
1
+ import { qt as e, rr as t } from "./constants-BwJDXzj6.js";
2
+ // src/capture/observed-windows.ts
3
+ var n = Symbol.for(`${e}@${t}`);
4
+ function r() {
5
+ let e = globalThis, t = e[n];
6
+ if (t?.windows instanceof Set && t.observers instanceof Set) return t;
7
+ let r = {
8
+ windows: /* @__PURE__ */ new Set(),
9
+ observers: /* @__PURE__ */ new Set()
10
+ };
11
+ return e[n] = r, r;
12
+ }
13
+ function i(e) {
14
+ if (typeof e != "object" || !e) return !1;
15
+ try {
16
+ let { document: t, addEventListener: n } = e;
17
+ return typeof t == "object" && !!t && typeof n == "function";
18
+ } catch {
19
+ return !0;
20
+ }
21
+ }
22
+ function a(e) {
23
+ try {
24
+ return e.closed;
25
+ } catch {
26
+ return !1;
27
+ }
28
+ }
29
+ function o() {
30
+ for (let e of r().windows) a(e) && c(e);
31
+ }
32
+ function s(e, t) {
33
+ e.attach(t) || r().windows.delete(t);
34
+ }
35
+ function c(e) {
36
+ let { windows: t, observers: n } = r();
37
+ if (t.delete(e)) for (let t of n) t.detach(e);
38
+ }
39
+ function l() {
40
+ return o(), [...r().windows];
41
+ }
42
+ function u(e) {
43
+ o();
44
+ let { windows: t, observers: n } = r();
45
+ n.add(e);
46
+ for (let n of t) s(e, n);
47
+ return () => {
48
+ n.delete(e);
49
+ for (let n of t) e.detach(n);
50
+ };
51
+ }
52
+ function d(e) {
53
+ if (e === globalThis || !i(e)) return () => void 0;
54
+ o();
55
+ let { windows: t, observers: n } = r();
56
+ t.add(e);
57
+ for (let t of n) s(t, e);
58
+ return () => {
59
+ c(e);
60
+ };
61
+ }
62
+ export { l as i, c as n, d as r, u as t };
63
+
64
+ //# sourceMappingURL=observed-windows-BrwaJNlj.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observed-windows-BrwaJNlj.js","names":["OBSERVED_WINDOWS_KEY","TELEMETRY_SDK_VERSION","REGISTRY_KEY","registry","scope","found","fresh","windowLike","value","document","addEventListener","isClosed","win","pruneClosed","forgetWindow","attachTo","observer","windows","observers","observedWindows","addWindowObserver","observeWindow","target"],"sources":["../src/capture/observed-windows.ts"],"sourcesContent":["// src/capture/observed-windows.ts\n//\n// Keeps the windows that the app asks the library to observe, for example a dockview popout\n// whose code runs in this page. The list lives outside the runtime and the capture, so a window\n// observed before configure() or across shutdown() gets attached when the click capture installs.\n// This module is in the main graph, so it must not import the lazy click capture.\n\nimport { OBSERVED_WINDOWS_KEY, TELEMETRY_SDK_VERSION } from \"../constants\";\n\n/** An installed click capture, as the registry sees it. */\nexport interface WindowObserver {\n /**\n * Starts listening in one window.\n * @param win The window.\n * @returns False when the window can't be observed, so the registry forgets it.\n */\n attach(win: Window): boolean;\n /**\n * Stops listening in one window.\n * @param win The window.\n */\n detach(win: Window): void;\n}\n\n/** The windows that the app observes now, and the click captures that are installed now. */\ninterface Registry {\n windows: Set<Window>;\n observers: Set<WindowObserver>;\n}\n\n/** The registry's global key. The version in it keeps another version's copy apart. */\nconst REGISTRY_KEY = Symbol.for(`${OBSERVED_WINDOWS_KEY}@${TELEMETRY_SDK_VERSION}`);\n\n/**\n * Returns the page's registry. Two copies of one version share one runtime, so they share this\n * too. Otherwise a copy's observeWindow() would never reach the other copy's click capture. Any\n * page script can write the key, so a value of another shape gets a fresh registry instead of a\n * throw in observeWindow() or install().\n * @returns The registry.\n */\nfunction registry(): Registry {\n const scope = globalThis as Record<symbol, unknown>;\n const found = scope[REGISTRY_KEY] as Partial<Registry> | null | undefined;\n if (found?.windows instanceof Set && found.observers instanceof Set) {\n return found as Registry;\n }\n\n const fresh: Registry = { windows: new Set(), observers: new Set() };\n scope[REGISTRY_KEY] = fresh;\n return fresh;\n}\n\n/**\n * Checks whether a value can be a window. A window from another origin throws on the read, and\n * that's the expected answer. The fallback is true, so the capture reports it at attach.\n * @param value The value the app passed.\n * @returns True for an object with a document and an addEventListener function, or for one that\n * blocks the read.\n */\nfunction windowLike(value: unknown): value is Window {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n try {\n const { document, addEventListener } = value as {\n document?: unknown;\n addEventListener?: unknown;\n };\n return (\n typeof document === \"object\" && document !== null && typeof addEventListener === \"function\"\n );\n } catch {\n return true;\n }\n}\n\n/**\n * Checks whether a window has closed. A window that throws on the read can't say, and that's the\n * expected answer. The fallback is false, so the capture tries it and reports it.\n * @param win The window.\n * @returns True if the window has closed.\n */\nfunction isClosed(win: Window): boolean {\n try {\n return win.closed;\n } catch {\n return false;\n }\n}\n\n/**\n * Forgets each closed window. Its pagehide can't do it while clicks are off, and a user-closed\n * about:blank popout still reads open at its pagehide.\n */\nfunction pruneClosed(): void {\n for (const win of registry().windows) {\n if (isClosed(win)) {\n forgetWindow(win);\n }\n }\n}\n\n/**\n * Attaches one window to one capture. A window that can't be observed leaves the list, so the\n * next install doesn't report it again.\n * @param observer The capture.\n * @param win The window.\n */\nfunction attachTo(observer: WindowObserver, win: Window): void {\n if (!observer.attach(win)) {\n registry().windows.delete(win);\n }\n}\n\n/**\n * Removes a window from the list and from each installed capture.\n * @param win The window.\n */\nexport function forgetWindow(win: Window): void {\n const { windows, observers } = registry();\n if (!windows.delete(win)) {\n return;\n }\n\n for (const observer of observers) {\n observer.detach(win);\n }\n}\n\n/**\n * Returns the windows that the app observes now. It forgets each closed window first, so a\n * dead click check never watches one.\n * @returns A copy of the list, so a caller can hold it while the list changes.\n */\nexport function observedWindows(): Window[] {\n pruneClosed();\n return [...registry().windows];\n}\n\n/**\n * Adds an installed click capture and attaches each window that's observed now.\n * @param observer The capture.\n * @returns Function that detaches each window from the capture and removes it.\n */\nexport function addWindowObserver(observer: WindowObserver): () => void {\n pruneClosed();\n const { windows, observers } = registry();\n observers.add(observer);\n for (const win of windows) {\n attachTo(observer, win);\n }\n\n return () => {\n observers.delete(observer);\n for (const win of windows) {\n observer.detach(win);\n }\n };\n}\n\n/**\n * Captures clicks in another window of this page, for example a popout whose code runs here.\n * The window gets click breadcrumbs, rage clicks and dead clicks, with the same rules as this\n * page. It gets no navigation capture. The window must have this page's origin. A window from\n * another origin reports `capture.install_failed` and records nothing. The result of\n * `window.open()` works at once, because the `pagehide` of its initial about:blank doesn't end\n * the capture while the window is open.\n *\n * The library listens only while `capture.interactions` is on, and it keeps the window across\n * `shutdown()` and the next `configure()`. The window leaves at the stop function. While\n * `capture.interactions` is on, it also leaves at its `pagehide`. A closed window, also a closed\n * about:blank popout, leaves at the next read of the list: a dead click check, an install or an\n * observeWindow() call. Observe the window again after it reloads, and after the app fills\n * about:blank and then loads a page in it. A window that opens to another origin and is observed\n * at once gets no report, and the library forgets it at its next dead click check. This page's\n * own window and a value that isn't a window do nothing. A call never throws.\n * @param target The window to observe, for example the result of `window.open()`.\n * @returns Function that stops observing the window. A second call does nothing.\n */\nexport function observeWindow(target: Window): () => void {\n if ((target as unknown) === globalThis || !windowLike(target)) {\n return () => undefined;\n }\n\n pruneClosed();\n const { windows, observers } = registry();\n // Attach a listed window again. A page that loads after the app filled about:blank can get a\n // new Window object behind the same handle, without our listeners. A repeat add does nothing.\n windows.add(target);\n for (const observer of observers) {\n attachTo(observer, target);\n }\n\n return () => {\n forgetWindow(target);\n };\n}\n"],"mappings":";;AA+BA,IAAME,IAAe,OAAO,IAAI,GAAGF,EAAqB,GAAGC,GAAuB;AASlF,SAASE,IAAqB;CAC5B,IAAMC,IAAQ,YACRC,IAAQD,EAAMF;CACpB,IAAIG,G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,GAA4B;CACxD,IAAKC,MAAuB,cAAc,CAACf,EAAWe,CAAM,GAC1D,aAAa,KAAA;CAGf,EAAY;CACZ,IAAM,EAAE,YAAS,iBAAcnB,EAAS;CAGxC,EAAQ,IAAImB,CAAM;CAClB,KAAK,IAAMN,KAAYE,GACrB,EAASF,GAAUM,CAAM;CAG3B,aAAa;EACX,EAAaA,CAAM;CACrB;AACF"}
@@ -1,2 +1,2 @@
1
- const e=require("./constants-DakMxVB2.cjs");function t(e){return e==null?null:typeof e==`string`?{stringValue:e}:typeof e==`boolean`?{boolValue:e}:typeof e==`number`?Number.isSafeInteger(e)?{intValue:String(e)}:{doubleValue:e}:typeof e==`bigint`?{intValue:e.toString()}:Array.isArray(e)?{arrayValue:{values:e.map(t).filter(e=>e!==null)}}:typeof e==`object`?{kvlistValue:{values:n(e)}}:null}function n(e){let n=[];for(let[r,i]of Object.entries(e)){let e=t(i);e&&n.push({key:r,value:e})}return n}var r=new WeakMap;function i(e){let t=r.get(e);if(t!==void 0)return t;let n=JSON.stringify(e);return r.set(e,n),n}function a(e){let t=new Map;for(let n of e){let e=i(n.resource),r=t.get(e);r?r.records.push(n):t.set(e,{resource:n.resource,records:[n]})}return[...t.values()]}function o(t){let n=new Map;for(let r of t){let t=r.attributes[e.a],i=typeof t==`string`&&t?t:e.Wn,a=n.get(i);a?a.push(r):n.set(i,[r])}return[...n].map(([e,t])=>({name:e,records:t}))}var s={name:e.En,serialize(t){let r=a(t).map(e=>({resource:{attributes:n(e.resource)},scopeLogs:o(e.records).map(e=>({scope:{name:e.name},logRecords:e.records.map(e=>({timeUnixNano:e.timeUnixNano,observedTimeUnixNano:e.observedTimeUnixNano??e.timeUnixNano,severityNumber:e.severityNumber,severityText:e.severityText,body:{stringValue:e.body},traceId:e.traceId,spanId:e.spanId,flags:e.traceFlags,attributes:n(e.attributes)}))}))}));return{body:JSON.stringify({resourceLogs:r}),contentType:e.R}}};Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
2
- //# sourceMappingURL=otlp-2MCrC3kd.cjs.map
1
+ const e=require("./constants-CtF52hIV.cjs");function t(e){return e==null?null:typeof e==`string`?{stringValue:e}:typeof e==`boolean`?{boolValue:e}:typeof e==`number`?Number.isSafeInteger(e)?{intValue:String(e)}:{doubleValue:e}:typeof e==`bigint`?{intValue:e.toString()}:Array.isArray(e)?{arrayValue:{values:e.map(t).filter(e=>e!==null)}}:typeof e==`object`?{kvlistValue:{values:n(e)}}:null}function n(e){let n=[];for(let[r,i]of Object.entries(e)){let e=t(i);e&&n.push({key:r,value:e})}return n}var r=new WeakMap;function i(e){let t=r.get(e);if(t!==void 0)return t;let n=JSON.stringify(e);return r.set(e,n),n}function a(e){let t=new Map;for(let n of e){let e=i(n.resource),r=t.get(e);r?r.records.push(n):t.set(e,{resource:n.resource,records:[n]})}return[...t.values()]}function o(t){let n=new Map;for(let r of t){let t=r.attributes[e.a],i=typeof t==`string`&&t?t:e.nr,a=n.get(i);a?a.push(r):n.set(i,[r])}return[...n].map(([e,t])=>({name:e,records:t}))}var s={name:e.Rn,serialize(t){let r=a(t).map(e=>({resource:{attributes:n(e.resource)},scopeLogs:o(e.records).map(e=>({scope:{name:e.name},logRecords:e.records.map(e=>({timeUnixNano:e.timeUnixNano,observedTimeUnixNano:e.observedTimeUnixNano??e.timeUnixNano,severityNumber:e.severityNumber,severityText:e.severityText,body:{stringValue:e.body},traceId:e.traceId,spanId:e.spanId,flags:e.traceFlags,attributes:n(e.attributes)}))}))}));return{body:JSON.stringify({resourceLogs:r}),contentType:e.z}}};Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
2
+ //# sourceMappingURL=otlp-CrAWkQdO.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"otlp-2MCrC3kd.cjs","names":["items","nested","ATTR_APP_NAMESPACE","TELEMETRY_SDK_NAME","SERIALIZER_NAME_OTLP","CONTENT_TYPE_JSON","require_constants","toAnyValue","value","item","toKeyValues","out","key","raw","source","resourceKeys","resourceKey","cached","resource","groupByResource","groups","record","records","group","groupByScope","namespace","name","scoped","otlpSerializer","resourceLogs","scope"],"sources":["../src/transport/serializers/otlp.ts"],"sourcesContent":["// src/transport/serializers/otlp.ts\n//\n// Serializes log batches as OTLP/JSON log records. Records are grouped by resource, and each\n// logger namespace gets its own instrumentation scope.\n// The OTLP metrics serializer reuses the value encoding and the resource grouping from here.\n\nimport {\n ATTR_APP_NAMESPACE,\n CONTENT_TYPE_JSON,\n SERIALIZER_NAME_OTLP,\n TELEMETRY_SDK_NAME,\n} from \"../../constants\";\nimport type { LogRecord } from \"../../models/log-record\";\nimport type { LogSerializer, SerializedBatch } from \"../../models/serializer\";\n\n/** An OTLP AnyValue with typed value wrappers. */\ntype AnyValue = Record<string, unknown>;\n\n/** An OTLP KeyValue pair. */\nexport interface KeyValue {\n /** The attribute key. */\n key: string;\n /** The typed AnyValue. */\n value: AnyValue;\n}\n\n/** Records that share the same resource attributes. */\nexport interface ResourceGroup {\n /** The resource attribute map. */\n resource: Record<string, unknown>;\n /** The resource's log records. */\n records: LogRecord[];\n}\n\n/**\n * Wraps a JavaScript value in an OTLP AnyValue.\n * @param value Raw attribute or resource value.\n * @returns Typed AnyValue object or null if unsupported.\n */\nfunction toAnyValue(value: unknown): AnyValue | null {\n if (value === null || value === undefined) {\n return null;\n }\n\n if (typeof value === \"string\") {\n return { stringValue: value };\n }\n\n if (typeof value === \"boolean\") {\n return { boolValue: value };\n }\n\n // Encode int64 as a decimal string, as the OTLP protobuf JSON mapping requires. A conforming\n // collector answers a number with a 400 status, and the response doesn't give the cause.\n // An integer above MAX_SAFE_INTEGER goes to doubleValue, because its text can be \"1e+21\" or\n // overflow int64.\n if (typeof value === \"number\") {\n return Number.isSafeInteger(value) ? { intValue: String(value) } : { doubleValue: value };\n }\n\n // Convert a BigInt to a decimal string. JSON.stringify throws on a BigInt and would lose\n // the batch.\n if (typeof value === \"bigint\") {\n return { intValue: value.toString() };\n }\n\n if (Array.isArray(value)) {\n const items: readonly unknown[] = value;\n const values = items.map(toAnyValue).filter((item): item is AnyValue => item !== null);\n\n return { arrayValue: { values } };\n }\n\n if (typeof value === \"object\") {\n const nested = value as Record<string, unknown>;\n return { kvlistValue: { values: toKeyValues(nested) } };\n }\n\n return null;\n}\n\n/**\n * Converts a plain object to an array of OTLP KeyValue pairs.\n * @param source Key-value attribute object.\n * @returns Array of valid KeyValue pairs.\n */\nexport function toKeyValues(source: Record<string, unknown>): KeyValue[] {\n const out: KeyValue[] = [];\n\n for (const [key, raw] of Object.entries(source)) {\n const value = toAnyValue(raw);\n if (value) {\n out.push({ key, value });\n }\n }\n\n return out;\n}\n\n/** Caches the JSON key of every resource object, which avoids a repeated stringify. */\nconst resourceKeys = new WeakMap<object, string>();\n\n/**\n * Returns the stable JSON key of a resource object, and caches it.\n * @param resource Resource attribute object.\n * @returns JSON key string.\n */\nfunction resourceKey(resource: Record<string, unknown>): string {\n const cached = resourceKeys.get(resource);\n if (cached !== undefined) {\n return cached;\n }\n\n const key = JSON.stringify(resource);\n resourceKeys.set(resource, key);\n\n return key;\n}\n\n/**\n * Groups records by their resource attributes, keeping the record order within each group.\n * @param records Records to group.\n * @returns One group per resource.\n */\nexport function groupByResource(records: LogRecord[]): ResourceGroup[] {\n const groups = new Map<string, ResourceGroup>();\n\n for (const record of records) {\n const key = resourceKey(record.resource);\n const group = groups.get(key);\n\n if (group) {\n group.records.push(record);\n continue;\n }\n\n groups.set(key, { resource: record.resource, records: [record] });\n }\n\n return [...groups.values()];\n}\n\n/** The records of one instrumentation scope. */\nexport interface ScopeGroup {\n /** The scope name, which is the logger namespace. */\n name: string;\n /** The scope's records. */\n records: LogRecord[];\n}\n\n/**\n * Groups records by their logger namespace, keeping the record order within each group.\n * A record without a namespace goes to the library's own scope.\n * @param records Records of one resource.\n * @returns One group per namespace.\n */\nexport function groupByScope(records: LogRecord[]): ScopeGroup[] {\n const groups = new Map<string, LogRecord[]>();\n\n for (const record of records) {\n const namespace: unknown = record.attributes[ATTR_APP_NAMESPACE];\n const name = typeof namespace === \"string\" && namespace ? namespace : TELEMETRY_SDK_NAME;\n const group = groups.get(name);\n\n if (group) {\n group.push(record);\n continue;\n }\n\n groups.set(name, [record]);\n }\n\n return [...groups].map(([name, scoped]) => ({ name, records: scoped }));\n}\n\n/** Writes log records as OTLP/JSON payloads. */\nexport const otlpSerializer: LogSerializer = {\n /** The format name. */\n name: SERIALIZER_NAME_OTLP,\n\n /**\n * Groups records by resource and encodes them as an OTLP\n * ExportLogsServiceRequest JSON payload.\n * @param records Array of log records to serialize.\n * @returns Serialized JSON batch payload.\n */\n serialize(records: LogRecord[]): SerializedBatch {\n const resourceLogs = groupByResource(records).map((group) => ({\n resource: { attributes: toKeyValues(group.resource) },\n scopeLogs: groupByScope(group.records).map((scope) => ({\n scope: { name: scope.name },\n logRecords: scope.records.map((record) => ({\n timeUnixNano: record.timeUnixNano,\n // Use timeUnixNano when observedTimeUnixNano is not set.\n observedTimeUnixNano: record.observedTimeUnixNano ?? record.timeUnixNano,\n severityNumber: record.severityNumber,\n severityText: record.severityText,\n body: { stringValue: record.body },\n traceId: record.traceId,\n spanId: record.spanId,\n flags: record.traceFlags,\n attributes: toKeyValues(record.attributes),\n })),\n })),\n }));\n\n return {\n body: JSON.stringify({ resourceLogs }),\n contentType: CONTENT_TYPE_JSON,\n };\n },\n};\n"],"mappings":"A,4CAuCA,SAASO,EAAW,EAAiC,CAuCnD,OAtCIC,GAAU,KACL,KAGL,OAAOA,GAAU,SACZ,CAAE,YAAaA,CAAM,EAG1B,OAAOA,GAAU,UACZ,CAAE,UAAWA,CAAM,EAOx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EnB,IAAK,IAAMC,KAAUC,EAAS,CAC5B,IAAMG,EAAqBJ,EAAO,WAAWnB,EAAAA,GACvCwB,EAAO,OAAOD,GAAc,UAAYA,EAAYA,EAAYtB,EAAAA,GAChEoB,EAAQH,EAAO,IAAIM,CAAI,EAEzBH,EACFA,EAAM,KAAKF,CAAM,EAInBD,EAAO,IAAIM,EAAM,CAACL,CAAM,CAAC,CAC3B,CAEA,MAAO,CAAC,GAAGD,CAAM,CAAC,CAAC,KAAK,CAACM,EAAMC,MAAa,CAAE,OAAM,QAASA,CAAO,EAAE,CACxE,CAGA,IAAaC,EAAgC,CAE3C,KAAMxB,EAAAA,GAQN,UAAU,EAAuC,CAC/C,IAAMyB,EAAeV,EAAgBG,CAAO,CAAC,CAAC,IAAK,IAAW,CAC5D,SAAU,CAAE,WAAYZ,EAAYa,EAAM,QAAQ,CAAE,EACpD,UAAWC,EAAaD,EAAM,OAAO,CAAC,CAAC,IAAK,IAAW,CACrD,MAAO,CAAE,KAAMO,EAAM,IAAK,EAC1B,WAAYA,EAAM,QAAQ,IAAK,IAAY,CACzC,aAAcT,EAAO,aAErB,qBAAsBA,EAAO,sBAAwBA,EAAO,aAC5D,eAAgBA,EAAO,eACvB,aAAcA,EAAO,aACrB,KAAM,CAAE,YAAaA,EAAO,IAAK,EACjC,QAASA,EAAO,QAChB,OAAQA,EAAO,OACf,MAAOA,EAAO,WACd,WAAYX,EAAYW,EAAO,UAAU,CAC3C,EAAE,CACJ,EAAE,CACJ,EAAE,EAEF,MAAO,CACL,KAAM,KAAK,UAAU,CAAE,cAAa,CAAC,EACrC,YAAahB,EAAAA,CACf,CACF,CACF,E"}
1
+ {"version":3,"file":"otlp-CrAWkQdO.cjs","names":["items","nested","ATTR_APP_NAMESPACE","TELEMETRY_SDK_NAME","SERIALIZER_NAME_OTLP","CONTENT_TYPE_JSON","require_constants","toAnyValue","value","item","toKeyValues","out","key","raw","source","resourceKeys","resourceKey","cached","resource","groupByResource","groups","record","records","group","groupByScope","namespace","name","scoped","otlpSerializer","resourceLogs","scope"],"sources":["../src/transport/serializers/otlp.ts"],"sourcesContent":["// src/transport/serializers/otlp.ts\n//\n// Serializes log batches as OTLP/JSON log records. Records are grouped by resource, and each\n// logger namespace gets its own instrumentation scope.\n// The OTLP metrics serializer reuses the value encoding and the resource grouping from here.\n\nimport {\n ATTR_APP_NAMESPACE,\n CONTENT_TYPE_JSON,\n SERIALIZER_NAME_OTLP,\n TELEMETRY_SDK_NAME,\n} from \"../../constants\";\nimport type { LogRecord } from \"../../models/log-record\";\nimport type { LogSerializer, SerializedBatch } from \"../../models/serializer\";\n\n/** An OTLP AnyValue with typed value wrappers. */\ntype AnyValue = Record<string, unknown>;\n\n/** An OTLP KeyValue pair. */\nexport interface KeyValue {\n /** The attribute key. */\n key: string;\n /** The typed AnyValue. */\n value: AnyValue;\n}\n\n/** Records that share the same resource attributes. */\nexport interface ResourceGroup {\n /** The resource attribute map. */\n resource: Record<string, unknown>;\n /** The resource's log records. */\n records: LogRecord[];\n}\n\n/**\n * Wraps a JavaScript value in an OTLP AnyValue.\n * @param value Raw attribute or resource value.\n * @returns Typed AnyValue object or null if unsupported.\n */\nfunction toAnyValue(value: unknown): AnyValue | null {\n if (value === null || value === undefined) {\n return null;\n }\n\n if (typeof value === \"string\") {\n return { stringValue: value };\n }\n\n if (typeof value === \"boolean\") {\n return { boolValue: value };\n }\n\n // Encode int64 as a decimal string, as the OTLP protobuf JSON mapping requires. A conforming\n // collector answers a number with a 400 status, and the response doesn't give the cause.\n // An integer above MAX_SAFE_INTEGER goes to doubleValue, because its text can be \"1e+21\" or\n // overflow int64.\n if (typeof value === \"number\") {\n return Number.isSafeInteger(value) ? { intValue: String(value) } : { doubleValue: value };\n }\n\n // Convert a BigInt to a decimal string. JSON.stringify throws on a BigInt and would lose\n // the batch.\n if (typeof value === \"bigint\") {\n return { intValue: value.toString() };\n }\n\n if (Array.isArray(value)) {\n const items: readonly unknown[] = value;\n const values = items.map(toAnyValue).filter((item): item is AnyValue => item !== null);\n\n return { arrayValue: { values } };\n }\n\n if (typeof value === \"object\") {\n const nested = value as Record<string, unknown>;\n return { kvlistValue: { values: toKeyValues(nested) } };\n }\n\n return null;\n}\n\n/**\n * Converts a plain object to an array of OTLP KeyValue pairs.\n * @param source Key-value attribute object.\n * @returns Array of valid KeyValue pairs.\n */\nexport function toKeyValues(source: Record<string, unknown>): KeyValue[] {\n const out: KeyValue[] = [];\n\n for (const [key, raw] of Object.entries(source)) {\n const value = toAnyValue(raw);\n if (value) {\n out.push({ key, value });\n }\n }\n\n return out;\n}\n\n/** Caches the JSON key of every resource object, which avoids a repeated stringify. */\nconst resourceKeys = new WeakMap<object, string>();\n\n/**\n * Returns the stable JSON key of a resource object, and caches it.\n * @param resource Resource attribute object.\n * @returns JSON key string.\n */\nfunction resourceKey(resource: Record<string, unknown>): string {\n const cached = resourceKeys.get(resource);\n if (cached !== undefined) {\n return cached;\n }\n\n const key = JSON.stringify(resource);\n resourceKeys.set(resource, key);\n\n return key;\n}\n\n/**\n * Groups records by their resource attributes, keeping the record order within each group.\n * @param records Records to group.\n * @returns One group per resource.\n */\nexport function groupByResource(records: LogRecord[]): ResourceGroup[] {\n const groups = new Map<string, ResourceGroup>();\n\n for (const record of records) {\n const key = resourceKey(record.resource);\n const group = groups.get(key);\n\n if (group) {\n group.records.push(record);\n continue;\n }\n\n groups.set(key, { resource: record.resource, records: [record] });\n }\n\n return [...groups.values()];\n}\n\n/** The records of one instrumentation scope. */\nexport interface ScopeGroup {\n /** The scope name, which is the logger namespace. */\n name: string;\n /** The scope's records. */\n records: LogRecord[];\n}\n\n/**\n * Groups records by their logger namespace, keeping the record order within each group.\n * A record without a namespace goes to the library's own scope.\n * @param records Records of one resource.\n * @returns One group per namespace.\n */\nexport function groupByScope(records: LogRecord[]): ScopeGroup[] {\n const groups = new Map<string, LogRecord[]>();\n\n for (const record of records) {\n const namespace: unknown = record.attributes[ATTR_APP_NAMESPACE];\n const name = typeof namespace === \"string\" && namespace ? namespace : TELEMETRY_SDK_NAME;\n const group = groups.get(name);\n\n if (group) {\n group.push(record);\n continue;\n }\n\n groups.set(name, [record]);\n }\n\n return [...groups].map(([name, scoped]) => ({ name, records: scoped }));\n}\n\n/** Writes log records as OTLP/JSON payloads. */\nexport const otlpSerializer: LogSerializer = {\n /** The format name. */\n name: SERIALIZER_NAME_OTLP,\n\n /**\n * Groups records by resource and encodes them as an OTLP\n * ExportLogsServiceRequest JSON payload.\n * @param records Array of log records to serialize.\n * @returns Serialized JSON batch payload.\n */\n serialize(records: LogRecord[]): SerializedBatch {\n const resourceLogs = groupByResource(records).map((group) => ({\n resource: { attributes: toKeyValues(group.resource) },\n scopeLogs: groupByScope(group.records).map((scope) => ({\n scope: { name: scope.name },\n logRecords: scope.records.map((record) => ({\n timeUnixNano: record.timeUnixNano,\n // Use timeUnixNano when observedTimeUnixNano is not set.\n observedTimeUnixNano: record.observedTimeUnixNano ?? record.timeUnixNano,\n severityNumber: record.severityNumber,\n severityText: record.severityText,\n body: { stringValue: record.body },\n traceId: record.traceId,\n spanId: record.spanId,\n flags: record.traceFlags,\n attributes: toKeyValues(record.attributes),\n })),\n })),\n }));\n\n return {\n body: JSON.stringify({ resourceLogs }),\n contentType: CONTENT_TYPE_JSON,\n };\n },\n};\n"],"mappings":"A,4CAuCA,SAASO,EAAW,EAAiC,CAuCnD,OAtCIC,GAAU,KACL,KAGL,OAAOA,GAAU,SACZ,CAAE,YAAaA,CAAM,EAG1B,OAAOA,GAAU,UACZ,CAAE,UAAWA,CAAM,EAOxB,OAAOA,GAAU,SACZ,OAAO,cAAcA,CAAK,EAAI,CAAE,SAAU,OAAOA,CAAK,CAAE,EAAI,CAAE,YAAaA,CAAM,EAKtF,OAAOA,GAAU,SACZ,CAAE,SAAUA,EAAM,SAAS,CAAE,EAGlC,MAAM,QAAQA,CAAK,EAId,CAAE,WAAY,CAAE,OAFRR,EAAM,IAAIO,CAAU,CAAC,CAAC,OAAQ,GAA2BE,IAAS,IAE1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AGD,CAAM,CAAC,CAAC,KAAK,CAACM,EAAMC,MAAa,CAAE,OAAM,QAASA,CAAO,EAAE,CACxE,CAGA,IAAaC,EAAgC,CAE3C,KAAMxB,EAAAA,GAQN,UAAU,EAAuC,CAC/C,IAAMyB,EAAeV,EAAgBG,CAAO,CAAC,CAAC,IAAK,IAAW,CAC5D,SAAU,CAAE,WAAYZ,EAAYa,EAAM,QAAQ,CAAE,EACpD,UAAWC,EAAaD,EAAM,OAAO,CAAC,CAAC,IAAK,IAAW,CACrD,MAAO,CAAE,KAAMO,EAAM,IAAK,EAC1B,WAAYA,EAAM,QAAQ,IAAK,IAAY,CACzC,aAAcT,EAAO,aAErB,qBAAsBA,EAAO,sBAAwBA,EAAO,aAC5D,eAAgBA,EAAO,eACvB,aAAcA,EAAO,aACrB,KAAM,CAAE,YAAaA,EAAO,IAAK,EACjC,QAASA,EAAO,QAChB,OAAQA,EAAO,OACf,MAAOA,EAAO,WACd,WAAYX,EAAYW,EAAO,UAAU,CAC3C,EAAE,CACJ,EAAE,CACJ,EAAE,EAEF,MAAO,CACL,KAAM,KAAK,UAAU,CAAE,cAAa,CAAC,EACrC,YAAahB,EAAAA,CACf,CACF,CACF,E"}
@@ -1,4 +1,4 @@
1
- import { En as e, R as t, Wn as n, a as r } from "./constants-Bwl_YtQi.js";
1
+ import { Rn as e, a as t, nr as n, z as r } from "./constants-BwJDXzj6.js";
2
2
  // src/transport/serializers/otlp.ts
3
3
  function i(e) {
4
4
  return e == null ? null : typeof e == "string" ? { stringValue: e } : typeof e == "boolean" ? { boolValue: e } : typeof e == "number" ? Number.isSafeInteger(e) ? { intValue: String(e) } : { doubleValue: e } : typeof e == "bigint" ? { intValue: e.toString() } : Array.isArray(e) ? { arrayValue: { values: e.map(i).filter((e) => e !== null) } } : typeof e == "object" ? { kvlistValue: { values: a(e) } } : null;
@@ -33,12 +33,12 @@ function c(e) {
33
33
  return [...t.values()];
34
34
  }
35
35
  function l(e) {
36
- let t = /* @__PURE__ */ new Map();
36
+ let r = /* @__PURE__ */ new Map();
37
37
  for (let i of e) {
38
- let e = i.attributes[r], a = typeof e == "string" && e ? e : n, o = t.get(a);
39
- o ? o.push(i) : t.set(a, [i]);
38
+ let e = i.attributes[t], a = typeof e == "string" && e ? e : n, o = r.get(a);
39
+ o ? o.push(i) : r.set(a, [i]);
40
40
  }
41
- return [...t].map(([e, t]) => ({
41
+ return [...r].map(([e, t]) => ({
42
42
  name: e,
43
43
  records: t
44
44
  }));
@@ -46,7 +46,7 @@ function l(e) {
46
46
  var u = {
47
47
  name: e,
48
48
  serialize(e) {
49
- let n = c(e).map((e) => ({
49
+ let t = c(e).map((e) => ({
50
50
  resource: { attributes: a(e.resource) },
51
51
  scopeLogs: l(e.records).map((e) => ({
52
52
  scope: { name: e.name },
@@ -64,11 +64,11 @@ var u = {
64
64
  }))
65
65
  }));
66
66
  return {
67
- body: JSON.stringify({ resourceLogs: n }),
68
- contentType: t
67
+ body: JSON.stringify({ resourceLogs: t }),
68
+ contentType: r
69
69
  };
70
70
  }
71
71
  };
72
72
  export { a as i, l as n, u as r, c as t };
73
73
 
74
- //# sourceMappingURL=otlp-COq033e3.js.map
74
+ //# sourceMappingURL=otlp-D6dRZyB8.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"otlp-COq033e3.js","names":["items","nested","SERIALIZER_NAME_OTLP","CONTENT_TYPE_JSON","TELEMETRY_SDK_NAME","ATTR_APP_NAMESPACE","toAnyValue","value","item","toKeyValues","out","key","raw","source","resourceKeys","resourceKey","cached","resource","groupByResource","groups","record","records","group","groupByScope","namespace","name","scoped","otlpSerializer","resourceLogs","scope"],"sources":["../src/transport/serializers/otlp.ts"],"sourcesContent":["// src/transport/serializers/otlp.ts\n//\n// Serializes log batches as OTLP/JSON log records. Records are grouped by resource, and each\n// logger namespace gets its own instrumentation scope.\n// The OTLP metrics serializer reuses the value encoding and the resource grouping from here.\n\nimport {\n ATTR_APP_NAMESPACE,\n CONTENT_TYPE_JSON,\n SERIALIZER_NAME_OTLP,\n TELEMETRY_SDK_NAME,\n} from \"../../constants\";\nimport type { LogRecord } from \"../../models/log-record\";\nimport type { LogSerializer, SerializedBatch } from \"../../models/serializer\";\n\n/** An OTLP AnyValue with typed value wrappers. */\ntype AnyValue = Record<string, unknown>;\n\n/** An OTLP KeyValue pair. */\nexport interface KeyValue {\n /** The attribute key. */\n key: string;\n /** The typed AnyValue. */\n value: AnyValue;\n}\n\n/** Records that share the same resource attributes. */\nexport interface ResourceGroup {\n /** The resource attribute map. */\n resource: Record<string, unknown>;\n /** The resource's log records. */\n records: LogRecord[];\n}\n\n/**\n * Wraps a JavaScript value in an OTLP AnyValue.\n * @param value Raw attribute or resource value.\n * @returns Typed AnyValue object or null if unsupported.\n */\nfunction toAnyValue(value: unknown): AnyValue | null {\n if (value === null || value === undefined) {\n return null;\n }\n\n if (typeof value === \"string\") {\n return { stringValue: value };\n }\n\n if (typeof value === \"boolean\") {\n return { boolValue: value };\n }\n\n // Encode int64 as a decimal string, as the OTLP protobuf JSON mapping requires. A conforming\n // collector answers a number with a 400 status, and the response doesn't give the cause.\n // An integer above MAX_SAFE_INTEGER goes to doubleValue, because its text can be \"1e+21\" or\n // overflow int64.\n if (typeof value === \"number\") {\n return Number.isSafeInteger(value) ? { intValue: String(value) } : { doubleValue: value };\n }\n\n // Convert a BigInt to a decimal string. JSON.stringify throws on a BigInt and would lose\n // the batch.\n if (typeof value === \"bigint\") {\n return { intValue: value.toString() };\n }\n\n if (Array.isArray(value)) {\n const items: readonly unknown[] = value;\n const values = items.map(toAnyValue).filter((item): item is AnyValue => item !== null);\n\n return { arrayValue: { values } };\n }\n\n if (typeof value === \"object\") {\n const nested = value as Record<string, unknown>;\n return { kvlistValue: { values: toKeyValues(nested) } };\n }\n\n return null;\n}\n\n/**\n * Converts a plain object to an array of OTLP KeyValue pairs.\n * @param source Key-value attribute object.\n * @returns Array of valid KeyValue pairs.\n */\nexport function toKeyValues(source: Record<string, unknown>): KeyValue[] {\n const out: KeyValue[] = [];\n\n for (const [key, raw] of Object.entries(source)) {\n const value = toAnyValue(raw);\n if (value) {\n out.push({ key, value });\n }\n }\n\n return out;\n}\n\n/** Caches the JSON key of every resource object, which avoids a repeated stringify. */\nconst resourceKeys = new WeakMap<object, string>();\n\n/**\n * Returns the stable JSON key of a resource object, and caches it.\n * @param resource Resource attribute object.\n * @returns JSON key string.\n */\nfunction resourceKey(resource: Record<string, unknown>): string {\n const cached = resourceKeys.get(resource);\n if (cached !== undefined) {\n return cached;\n }\n\n const key = JSON.stringify(resource);\n resourceKeys.set(resource, key);\n\n return key;\n}\n\n/**\n * Groups records by their resource attributes, keeping the record order within each group.\n * @param records Records to group.\n * @returns One group per resource.\n */\nexport function groupByResource(records: LogRecord[]): ResourceGroup[] {\n const groups = new Map<string, ResourceGroup>();\n\n for (const record of records) {\n const key = resourceKey(record.resource);\n const group = groups.get(key);\n\n if (group) {\n group.records.push(record);\n continue;\n }\n\n groups.set(key, { resource: record.resource, records: [record] });\n }\n\n return [...groups.values()];\n}\n\n/** The records of one instrumentation scope. */\nexport interface ScopeGroup {\n /** The scope name, which is the logger namespace. */\n name: string;\n /** The scope's records. */\n records: LogRecord[];\n}\n\n/**\n * Groups records by their logger namespace, keeping the record order within each group.\n * A record without a namespace goes to the library's own scope.\n * @param records Records of one resource.\n * @returns One group per namespace.\n */\nexport function groupByScope(records: LogRecord[]): ScopeGroup[] {\n const groups = new Map<string, LogRecord[]>();\n\n for (const record of records) {\n const namespace: unknown = record.attributes[ATTR_APP_NAMESPACE];\n const name = typeof namespace === \"string\" && namespace ? namespace : TELEMETRY_SDK_NAME;\n const group = groups.get(name);\n\n if (group) {\n group.push(record);\n continue;\n }\n\n groups.set(name, [record]);\n }\n\n return [...groups].map(([name, scoped]) => ({ name, records: scoped }));\n}\n\n/** Writes log records as OTLP/JSON payloads. */\nexport const otlpSerializer: LogSerializer = {\n /** The format name. */\n name: SERIALIZER_NAME_OTLP,\n\n /**\n * Groups records by resource and encodes them as an OTLP\n * ExportLogsServiceRequest JSON payload.\n * @param records Array of log records to serialize.\n * @returns Serialized JSON batch payload.\n */\n serialize(records: LogRecord[]): SerializedBatch {\n const resourceLogs = groupByResource(records).map((group) => ({\n resource: { attributes: toKeyValues(group.resource) },\n scopeLogs: groupByScope(group.records).map((scope) => ({\n scope: { name: scope.name },\n logRecords: scope.records.map((record) => ({\n timeUnixNano: record.timeUnixNano,\n // Use timeUnixNano when observedTimeUnixNano is not set.\n observedTimeUnixNano: record.observedTimeUnixNano ?? record.timeUnixNano,\n severityNumber: record.severityNumber,\n severityText: record.severityText,\n body: { stringValue: record.body },\n traceId: record.traceId,\n spanId: record.spanId,\n flags: record.traceFlags,\n attributes: toKeyValues(record.attributes),\n })),\n })),\n }));\n\n return {\n body: JSON.stringify({ resourceLogs }),\n contentType: CONTENT_TYPE_JSON,\n };\n },\n};\n"],"mappings":";;AAuCA,SAASM,EAAW,GAAiC;CAuCnD,OAtCIC,KAAU,OACL,OAGL,OAAOA,KAAU,WACZ,EAAE,aAAaA,EAAM,IAG1B,OAAOA,KAAU,YACZ,EAAE,WAAWA,EAAM,IAOxB,OAAOA,KAAU,WACZ,OAAO,cAAcA,CAAK,IAAI,EAAE,UAAU,OAAOA,CAAK,EAAE,IAAI,EAAE,aAAaA,EAAM,IAKtF,OAAOA,KAAU,WACZ,EAAE,UAAUA,EAAM,SAAS,EAAE,IAGlC,MAAM,QAAQA,CAAK,IAId,EAAE,YAAY,EAAE,QAFRP,EAAM,IAAIM,CAAU,CAAC,CAAC,QAAQ,MAA2BE,MAAS,IAE1D,EAAO,EAAE,IAG9B,OAAOD,KAAU,WAEZ,EAAE,aAAa,EAAE,QAAQE,EAAYR,CAAM,EAAE,EAAE,IAGjD;AACT;AAOA,SAAgBQ,EAAY,GAA6C;CACvE,IAAMC,IAAkB,CAAC;CAEzB,KAAK,IAAM,CAACC,GAAKC,MAAQ,OAAO,QAAQC,CAAM,GAAG;EAC/C,IAAMN,IAAQD,EAAWM,CAAG;EAC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Ya,EAAM,QAAQ,EAAE;GACpD,WAAWC,EAAaD,EAAM,OAAO,CAAC,CAAC,KAAK,OAAW;IACrD,OAAO,EAAE,MAAMO,EAAM,KAAK;IAC1B,YAAYA,EAAM,QAAQ,KAAK,OAAY;KACzC,cAAcT,EAAO;KAErB,sBAAsBA,EAAO,wBAAwBA,EAAO;KAC5D,gBAAgBA,EAAO;KACvB,cAAcA,EAAO;KACrB,MAAM,EAAE,aAAaA,EAAO,KAAK;KACjC,SAASA,EAAO;KAChB,QAAQA,EAAO;KACf,OAAOA,EAAO;KACd,YAAYX,EAAYW,EAAO,UAAU;IAC3C,EAAE;GACJ,EAAE;EACJ,EAAE;EAEF,OAAO;GACL,MAAM,KAAK,UAAU,EAAE,gBAAa,CAAC;GACrC,aAAajB;EACf;CACF;AACF"}
1
+ {"version":3,"file":"otlp-D6dRZyB8.js","names":["items","nested","SERIALIZER_NAME_OTLP","ATTR_APP_NAMESPACE","TELEMETRY_SDK_NAME","CONTENT_TYPE_JSON","toAnyValue","value","item","toKeyValues","out","key","raw","source","resourceKeys","resourceKey","cached","resource","groupByResource","groups","record","records","group","groupByScope","namespace","name","scoped","otlpSerializer","resourceLogs","scope"],"sources":["../src/transport/serializers/otlp.ts"],"sourcesContent":["// src/transport/serializers/otlp.ts\n//\n// Serializes log batches as OTLP/JSON log records. Records are grouped by resource, and each\n// logger namespace gets its own instrumentation scope.\n// The OTLP metrics serializer reuses the value encoding and the resource grouping from here.\n\nimport {\n ATTR_APP_NAMESPACE,\n CONTENT_TYPE_JSON,\n SERIALIZER_NAME_OTLP,\n TELEMETRY_SDK_NAME,\n} from \"../../constants\";\nimport type { LogRecord } from \"../../models/log-record\";\nimport type { LogSerializer, SerializedBatch } from \"../../models/serializer\";\n\n/** An OTLP AnyValue with typed value wrappers. */\ntype AnyValue = Record<string, unknown>;\n\n/** An OTLP KeyValue pair. */\nexport interface KeyValue {\n /** The attribute key. */\n key: string;\n /** The typed AnyValue. */\n value: AnyValue;\n}\n\n/** Records that share the same resource attributes. */\nexport interface ResourceGroup {\n /** The resource attribute map. */\n resource: Record<string, unknown>;\n /** The resource's log records. */\n records: LogRecord[];\n}\n\n/**\n * Wraps a JavaScript value in an OTLP AnyValue.\n * @param value Raw attribute or resource value.\n * @returns Typed AnyValue object or null if unsupported.\n */\nfunction toAnyValue(value: unknown): AnyValue | null {\n if (value === null || value === undefined) {\n return null;\n }\n\n if (typeof value === \"string\") {\n return { stringValue: value };\n }\n\n if (typeof value === \"boolean\") {\n return { boolValue: value };\n }\n\n // Encode int64 as a decimal string, as the OTLP protobuf JSON mapping requires. A conforming\n // collector answers a number with a 400 status, and the response doesn't give the cause.\n // An integer above MAX_SAFE_INTEGER goes to doubleValue, because its text can be \"1e+21\" or\n // overflow int64.\n if (typeof value === \"number\") {\n return Number.isSafeInteger(value) ? { intValue: String(value) } : { doubleValue: value };\n }\n\n // Convert a BigInt to a decimal string. JSON.stringify throws on a BigInt and would lose\n // the batch.\n if (typeof value === \"bigint\") {\n return { intValue: value.toString() };\n }\n\n if (Array.isArray(value)) {\n const items: readonly unknown[] = value;\n const values = items.map(toAnyValue).filter((item): item is AnyValue => item !== null);\n\n return { arrayValue: { values } };\n }\n\n if (typeof value === \"object\") {\n const nested = value as Record<string, unknown>;\n return { kvlistValue: { values: toKeyValues(nested) } };\n }\n\n return null;\n}\n\n/**\n * Converts a plain object to an array of OTLP KeyValue pairs.\n * @param source Key-value attribute object.\n * @returns Array of valid KeyValue pairs.\n */\nexport function toKeyValues(source: Record<string, unknown>): KeyValue[] {\n const out: KeyValue[] = [];\n\n for (const [key, raw] of Object.entries(source)) {\n const value = toAnyValue(raw);\n if (value) {\n out.push({ key, value });\n }\n }\n\n return out;\n}\n\n/** Caches the JSON key of every resource object, which avoids a repeated stringify. */\nconst resourceKeys = new WeakMap<object, string>();\n\n/**\n * Returns the stable JSON key of a resource object, and caches it.\n * @param resource Resource attribute object.\n * @returns JSON key string.\n */\nfunction resourceKey(resource: Record<string, unknown>): string {\n const cached = resourceKeys.get(resource);\n if (cached !== undefined) {\n return cached;\n }\n\n const key = JSON.stringify(resource);\n resourceKeys.set(resource, key);\n\n return key;\n}\n\n/**\n * Groups records by their resource attributes, keeping the record order within each group.\n * @param records Records to group.\n * @returns One group per resource.\n */\nexport function groupByResource(records: LogRecord[]): ResourceGroup[] {\n const groups = new Map<string, ResourceGroup>();\n\n for (const record of records) {\n const key = resourceKey(record.resource);\n const group = groups.get(key);\n\n if (group) {\n group.records.push(record);\n continue;\n }\n\n groups.set(key, { resource: record.resource, records: [record] });\n }\n\n return [...groups.values()];\n}\n\n/** The records of one instrumentation scope. */\nexport interface ScopeGroup {\n /** The scope name, which is the logger namespace. */\n name: string;\n /** The scope's records. */\n records: LogRecord[];\n}\n\n/**\n * Groups records by their logger namespace, keeping the record order within each group.\n * A record without a namespace goes to the library's own scope.\n * @param records Records of one resource.\n * @returns One group per namespace.\n */\nexport function groupByScope(records: LogRecord[]): ScopeGroup[] {\n const groups = new Map<string, LogRecord[]>();\n\n for (const record of records) {\n const namespace: unknown = record.attributes[ATTR_APP_NAMESPACE];\n const name = typeof namespace === \"string\" && namespace ? namespace : TELEMETRY_SDK_NAME;\n const group = groups.get(name);\n\n if (group) {\n group.push(record);\n continue;\n }\n\n groups.set(name, [record]);\n }\n\n return [...groups].map(([name, scoped]) => ({ name, records: scoped }));\n}\n\n/** Writes log records as OTLP/JSON payloads. */\nexport const otlpSerializer: LogSerializer = {\n /** The format name. */\n name: SERIALIZER_NAME_OTLP,\n\n /**\n * Groups records by resource and encodes them as an OTLP\n * ExportLogsServiceRequest JSON payload.\n * @param records Array of log records to serialize.\n * @returns Serialized JSON batch payload.\n */\n serialize(records: LogRecord[]): SerializedBatch {\n const resourceLogs = groupByResource(records).map((group) => ({\n resource: { attributes: toKeyValues(group.resource) },\n scopeLogs: groupByScope(group.records).map((scope) => ({\n scope: { name: scope.name },\n logRecords: scope.records.map((record) => ({\n timeUnixNano: record.timeUnixNano,\n // Use timeUnixNano when observedTimeUnixNano is not set.\n observedTimeUnixNano: record.observedTimeUnixNano ?? record.timeUnixNano,\n severityNumber: record.severityNumber,\n severityText: record.severityText,\n body: { stringValue: record.body },\n traceId: record.traceId,\n spanId: record.spanId,\n flags: record.traceFlags,\n attributes: toKeyValues(record.attributes),\n })),\n })),\n }));\n\n return {\n body: JSON.stringify({ resourceLogs }),\n contentType: CONTENT_TYPE_JSON,\n };\n },\n};\n"],"mappings":";;AAuCA,SAASM,EAAW,GAAiC;CAuCnD,OAtCIC,KAAU,OACL,OAGL,OAAOA,KAAU,WACZ,EAAE,aAAaA,EAAM,IAG1B,OAAOA,KAAU,YACZ,EAAE,WAAWA,EAAM,IAOxB,OAAOA,KAAU,WACZ,OAAO,cAAcA,CAAK,IAAI,EAAE,UAAU,OAAOA,CAAK,EAAE,IAAI,EAAE,aAAaA,EAAM,IAKtF,OAAOA,KAAU,WACZ,EAAE,UAAUA,EAAM,SAAS,EAAE,IAGlC,MAAM,QAAQA,CAAK,IAId,EAAE,YAAY,EAAE,QAFRP,EAAM,IAAIM,CAAU,CAAC,CAAC,QAAQ,MAA2BE,MAAS,IAE1D,EAAO,EAAE,IAG9B,OAAOD,KAAU,WAEZ,EAAE,aAAa,EAAE,QAAQE,EAAYR,CAAM,EAAE,EAAE,IAGjD;AACT;AAOA,SAAgBQ,EAAY,GAA6C;CACvE,IAAMC,IAAkB,CAAC;CAEzB,KAAK,IAAM,CAACC,GAAKC,MAAQ,OAAO,QAAQC,CAAM,GAAG;EAC/C,IAAMN,IAAQD,EAAWM,CAAG;EAC5B,AAAIL,KACFG,EAAI,KAAK;GAAE;GAAK;EAAM,CAAC;CAE3B;CAEA,OAAOA;AACT;AAGA,IAAMI,oBAAe,IAAI,QAAwB;AAOjD,SAASC,EAAY,GAA2C;CAC9D,IAAMC,IAASF,EAAa,IAAIG,CAAQ;CACxC,IAAID,MAAW,KAAA,GACb,OAAOA;CAGT,IAAML,IAAM,KAAK,UAAUM,CAAQ;CAGnC,OAFAH,E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