@utk09/ui-observability 0.10.0 → 0.11.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 (186) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/README.md +50 -11
  3. package/dist/{batch-BHXypM1j.cjs → batch-C8OcWR2L.cjs} +2 -2
  4. package/dist/{batch-BHXypM1j.cjs.map → batch-C8OcWR2L.cjs.map} +1 -1
  5. package/dist/{batch-BMdT9mKm.js → batch-CL9uWYY3.js} +4 -5
  6. package/dist/{batch-BMdT9mKm.js.map → batch-CL9uWYY3.js.map} +1 -1
  7. package/dist/{bus-DKfBaica.js → bus-BZ0GldpT.js} +23 -27
  8. package/dist/{bus-DKfBaica.js.map → bus-BZ0GldpT.js.map} +1 -1
  9. package/dist/{bus-Dea9rVhy.cjs → bus-VWlmM5xs.cjs} +2 -2
  10. package/dist/{bus-Dea9rVhy.cjs.map → bus-VWlmM5xs.cjs.map} +1 -1
  11. package/dist/console-BPZCuSLc.cjs +2 -0
  12. package/dist/{console-DZEcs7FL.cjs.map → console-BPZCuSLc.cjs.map} +1 -1
  13. package/dist/{console-BX_0UCV7.js → console-BeCF7n59.js} +14 -15
  14. package/dist/{console-BX_0UCV7.js.map → console-BeCF7n59.js.map} +1 -1
  15. package/dist/{constants-CL0ZdI2f.cjs → constants-DqKJH_MP.cjs} +2 -2
  16. package/dist/{constants-CL0ZdI2f.cjs.map → constants-DqKJH_MP.cjs.map} +1 -1
  17. package/dist/{constants-CU60FG4w.js → constants-zyrqveN4.js} +3 -4
  18. package/dist/{constants-CU60FG4w.js.map → constants-zyrqveN4.js.map} +1 -1
  19. package/dist/context-storage-BjzeBSxH.cjs.map +1 -1
  20. package/dist/{context-storage-DxZf4Gfh.js → context-storage-BzkoHzkQ.js} +2 -3
  21. package/dist/{context-storage-DxZf4Gfh.js.map → context-storage-BzkoHzkQ.js.map} +1 -1
  22. package/dist/{deadline-5_PecIl5.js → deadline-BOjOxNHj.js} +3 -5
  23. package/dist/{deadline-5_PecIl5.js.map → deadline-BOjOxNHj.js.map} +1 -1
  24. package/dist/deadline-XSnm95pg.cjs.map +1 -1
  25. package/dist/{debug-bundle-yRkrU1ny.cjs → debug-bundle-BzJNpbF0.cjs} +2 -2
  26. package/dist/{debug-bundle-yRkrU1ny.cjs.map → debug-bundle-BzJNpbF0.cjs.map} +1 -1
  27. package/dist/{debug-bundle-CZZ6SQQh.js → debug-bundle-C7UkHZ-q.js} +5 -6
  28. package/dist/{debug-bundle-CZZ6SQQh.js.map → debug-bundle-C7UkHZ-q.js.map} +1 -1
  29. package/dist/doctor.cjs +1 -1
  30. package/dist/doctor.cjs.map +1 -1
  31. package/dist/doctor.js +3 -4
  32. package/dist/{emergency-queue-CQ-9acZf.cjs → emergency-queue-CNTRui5t.cjs} +2 -2
  33. package/dist/{emergency-queue-CQ-9acZf.cjs.map → emergency-queue-CNTRui5t.cjs.map} +1 -1
  34. package/dist/{emergency-queue-Cs8-i2xw.js → emergency-queue-Zy6lNafo.js} +15 -17
  35. package/dist/{emergency-queue-Cs8-i2xw.js.map → emergency-queue-Zy6lNafo.js.map} +1 -1
  36. package/dist/{error-like-Ywo5uRHo.js → error-like-B11pB4aL.js} +2 -3
  37. package/dist/{error-like-Ywo5uRHo.js.map → error-like-B11pB4aL.js.map} +1 -1
  38. package/dist/error-like-gGRx2s36.cjs.map +1 -1
  39. package/dist/{errors-oyxrpHjY.js → errors-Dh7kef0i.js} +5 -6
  40. package/dist/{errors-oyxrpHjY.js.map → errors-Dh7kef0i.js.map} +1 -1
  41. package/dist/{errors-CigX45pL.cjs → errors-tfEr48bS.cjs} +2 -2
  42. package/dist/{errors-CigX45pL.cjs.map → errors-tfEr48bS.cjs.map} +1 -1
  43. package/dist/{factory-Bgsky_e0.js → factory-BonqI3NL.js} +9 -13
  44. package/dist/{factory-Bgsky_e0.js.map → factory-BonqI3NL.js.map} +1 -1
  45. package/dist/{factory-BkjNzPYL.cjs → factory-CJXVYp0R.cjs} +2 -2
  46. package/dist/{factory-BkjNzPYL.cjs.map → factory-CJXVYp0R.cjs.map} +1 -1
  47. package/dist/fixed-window-CvESpFYV.cjs.map +1 -1
  48. package/dist/{fixed-window-CtaFHanJ.js → fixed-window-Dq3MLUUv.js} +2 -3
  49. package/dist/{fixed-window-CtaFHanJ.js.map → fixed-window-Dq3MLUUv.js.map} +1 -1
  50. package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
  51. package/dist/{global-scope-dp2jADRl.js → global-scope-D9I8s-oN.js} +2 -3
  52. package/dist/{global-scope-dp2jADRl.js.map → global-scope-D9I8s-oN.js.map} +1 -1
  53. package/dist/{guards-CpvOpJL6.js → guards-Cidk71ME.js} +2 -3
  54. package/dist/{guards-CpvOpJL6.js.map → guards-Cidk71ME.js.map} +1 -1
  55. package/dist/guards-nJ70syPt.cjs.map +1 -1
  56. package/dist/{identity-BMlKGHUM.cjs → identity-Cxgj6pZX.cjs} +2 -2
  57. package/dist/{identity-BMlKGHUM.cjs.map → identity-Cxgj6pZX.cjs.map} +1 -1
  58. package/dist/{identity-DOaHdfhT.js → identity-DT5VmvXy.js} +3 -4
  59. package/dist/{identity-DOaHdfhT.js.map → identity-DT5VmvXy.js.map} +1 -1
  60. package/dist/index.cjs +1 -1
  61. package/dist/index.cjs.map +1 -1
  62. package/dist/index.js +46 -56
  63. package/dist/index.js.map +1 -1
  64. package/dist/{indexeddb-storage-D-lUW_5P.js → indexeddb-storage-BJVtiQKm.js} +5 -6
  65. package/dist/{indexeddb-storage-D-lUW_5P.js.map → indexeddb-storage-BJVtiQKm.js.map} +1 -1
  66. package/dist/{indexeddb-storage-CaXGJqDD.cjs → indexeddb-storage-CIoW21Xd.cjs} +2 -2
  67. package/dist/{indexeddb-storage-CaXGJqDD.cjs.map → indexeddb-storage-CIoW21Xd.cjs.map} +1 -1
  68. package/dist/{interactions-CqDNrtIR.js → interactions-DTgKy_6K.js} +10 -11
  69. package/dist/{interactions-CqDNrtIR.js.map → interactions-DTgKy_6K.js.map} +1 -1
  70. package/dist/{interactions-8DgxtmgO.cjs → interactions-fEN6FbVo.cjs} +2 -2
  71. package/dist/{interactions-8DgxtmgO.cjs.map → interactions-fEN6FbVo.cjs.map} +1 -1
  72. package/dist/{journey-DgIjhrIc.js → journey-CuJrHzEg.js} +9 -10
  73. package/dist/{journey-DgIjhrIc.js.map → journey-CuJrHzEg.js.map} +1 -1
  74. package/dist/{journey-5tcxEbnG.cjs → journey-pffMVMfa.cjs} +2 -2
  75. package/dist/{journey-5tcxEbnG.cjs.map → journey-pffMVMfa.cjs.map} +1 -1
  76. package/dist/keys-BHhw_0Wh.cjs.map +1 -1
  77. package/dist/{keys-D5r_GH9q.js → keys-BU9j5YqW.js} +2 -3
  78. package/dist/{keys-D5r_GH9q.js.map → keys-BU9j5YqW.js.map} +1 -1
  79. package/dist/library-console-C1m6g1BR.js +13 -0
  80. package/dist/{library-console-CabK2j2-.js.map → library-console-C1m6g1BR.js.map} +1 -1
  81. package/dist/{library-console-g_VU-wzP.cjs → library-console-D2GY9Or6.cjs} +2 -2
  82. package/dist/{library-console-g_VU-wzP.cjs.map → library-console-D2GY9Or6.cjs.map} +1 -1
  83. package/dist/{library-request-FQaiWjCP.cjs → library-request-1BX_UlaX.cjs} +2 -2
  84. package/dist/{library-request-FQaiWjCP.cjs.map → library-request-1BX_UlaX.cjs.map} +1 -1
  85. package/dist/{library-request-CyC-9IOk.js → library-request-BQBT9N9Q.js} +4 -5
  86. package/dist/{library-request-CyC-9IOk.js.map → library-request-BQBT9N9Q.js.map} +1 -1
  87. package/dist/{lifecycle-C2z_d8OX.cjs → lifecycle-2EtUaRpo.cjs} +2 -2
  88. package/dist/{lifecycle-C2z_d8OX.cjs.map → lifecycle-2EtUaRpo.cjs.map} +1 -1
  89. package/dist/{lifecycle-BLC4VU7c.js → lifecycle-BaKx_-32.js} +3 -4
  90. package/dist/{lifecycle-BLC4VU7c.js.map → lifecycle-BaKx_-32.js.map} +1 -1
  91. package/dist/{log-record-CndanC-p.js → log-record-CAoGBBf3.js} +3 -4
  92. package/dist/{log-record-CndanC-p.js.map → log-record-CAoGBBf3.js.map} +1 -1
  93. package/dist/{log-record-DKvo-B-d.cjs → log-record-i9zOTkpQ.cjs} +2 -2
  94. package/dist/{log-record-DKvo-B-d.cjs.map → log-record-i9zOTkpQ.cjs.map} +1 -1
  95. package/dist/{long-frames-CV5ZG2cx.cjs → long-frames-BVg4i5SC.cjs} +2 -2
  96. package/dist/{long-frames-CV5ZG2cx.cjs.map → long-frames-BVg4i5SC.cjs.map} +1 -1
  97. package/dist/{long-frames-BQef9rXR.js → long-frames-Czk7IupC.js} +4 -5
  98. package/dist/{long-frames-BQef9rXR.js.map → long-frames-Czk7IupC.js.map} +1 -1
  99. package/dist/{network-CvkvYzRU.js → network-DBNwApoF.js} +22 -24
  100. package/dist/{network-CvkvYzRU.js.map → network-DBNwApoF.js.map} +1 -1
  101. package/dist/{network-CqnQOqon.cjs → network-xbbuvG_6.cjs} +2 -2
  102. package/dist/{network-CqnQOqon.cjs.map → network-xbbuvG_6.cjs.map} +1 -1
  103. package/dist/openfin-Bxelt0yg.js +7 -0
  104. package/dist/{openfin-BwEN0uj4.js.map → openfin-Bxelt0yg.js.map} +1 -1
  105. package/dist/openfin-DtH2f7zX.cjs.map +1 -1
  106. package/dist/{otlp-RVbkNQRh.cjs → otlp-BDvFrLnc.cjs} +2 -2
  107. package/dist/{otlp-RVbkNQRh.cjs.map → otlp-BDvFrLnc.cjs.map} +1 -1
  108. package/dist/{otlp-CYIL7MOE.js → otlp-BTJdIa6F.js} +4 -6
  109. package/dist/{otlp-CYIL7MOE.js.map → otlp-BTJdIa6F.js.map} +1 -1
  110. package/dist/patch-BX8KrPCT.cjs.map +1 -1
  111. package/dist/{patch-CCWfuEY7.js → patch-UdPz1ea8.js} +2 -3
  112. package/dist/{patch-CCWfuEY7.js.map → patch-UdPz1ea8.js.map} +1 -1
  113. package/dist/{platform-KMWkoI-v.cjs → platform-C2Ez5kDc.cjs} +2 -2
  114. package/dist/{platform-KMWkoI-v.cjs.map → platform-C2Ez5kDc.cjs.map} +1 -1
  115. package/dist/{platform-wcAkkv9F.js → platform-DkcuXwe-.js} +4 -5
  116. package/dist/{platform-wcAkkv9F.js.map → platform-DkcuXwe-.js.map} +1 -1
  117. package/dist/{remote-rules-CH_7PphT.js → remote-rules-Cfb4K-Nl.js} +5 -6
  118. package/dist/{remote-rules-CH_7PphT.js.map → remote-rules-Cfb4K-Nl.js.map} +1 -1
  119. package/dist/{remote-rules-BL8km4xk.cjs → remote-rules-vzvk7aKf.cjs} +2 -2
  120. package/dist/{remote-rules-BL8km4xk.cjs.map → remote-rules-vzvk7aKf.cjs.map} +1 -1
  121. package/dist/{reports-Bh_-KpZ2.cjs → reports-Dk2YhKIh.cjs} +2 -2
  122. package/dist/{reports-Bh_-KpZ2.cjs.map → reports-Dk2YhKIh.cjs.map} +1 -1
  123. package/dist/{reports-BOKyY3_A.js → reports-TA-zInnq.js} +4 -5
  124. package/dist/{reports-BOKyY3_A.js.map → reports-TA-zInnq.js.map} +1 -1
  125. package/dist/{resource-timing-BROnEJ0E.js → resource-timing-BLv3EA2A.js} +6 -7
  126. package/dist/{resource-timing-BROnEJ0E.js.map → resource-timing-BLv3EA2A.js.map} +1 -1
  127. package/dist/{resource-timing-CbgwNpog.cjs → resource-timing-Cysw1S1f.cjs} +2 -2
  128. package/dist/{resource-timing-CbgwNpog.cjs.map → resource-timing-Cysw1S1f.cjs.map} +1 -1
  129. package/dist/{sampling-BLO_pcV4.js → sampling-C4VV-1MS.js} +4 -5
  130. package/dist/{sampling-BLO_pcV4.js.map → sampling-C4VV-1MS.js.map} +1 -1
  131. package/dist/{sampling-ECGVYiDD.cjs → sampling-Ckh2yW9k.cjs} +2 -2
  132. package/dist/{sampling-ECGVYiDD.cjs.map → sampling-Ckh2yW9k.cjs.map} +1 -1
  133. package/dist/{sanitize-DS0G4_ea.js → sanitize-6ymPlVvP.js} +4 -5
  134. package/dist/{sanitize-DS0G4_ea.js.map → sanitize-6ymPlVvP.js.map} +1 -1
  135. package/dist/{sanitize-Bsn8HQWC.cjs → sanitize-BAWzkZt0.cjs} +2 -2
  136. package/dist/{sanitize-Bsn8HQWC.cjs.map → sanitize-BAWzkZt0.cjs.map} +1 -1
  137. package/dist/{select-DWO0-w8_.cjs → select-ZF4by-lF.cjs} +2 -2
  138. package/dist/{select-DWO0-w8_.cjs.map → select-ZF4by-lF.cjs.map} +1 -1
  139. package/dist/{select-wqt9Wxio.js → select-xtQaenIi.js} +7 -10
  140. package/dist/{select-wqt9Wxio.js.map → select-xtQaenIi.js.map} +1 -1
  141. package/dist/{sender-BkAVt-Rq.js → sender-CiMHC9YG.js} +92 -96
  142. package/dist/{sender-BkAVt-Rq.js.map → sender-CiMHC9YG.js.map} +1 -1
  143. package/dist/{sender-D82PxlCY.cjs → sender-D5wBoXA8.cjs} +2 -2
  144. package/dist/{sender-D82PxlCY.cjs.map → sender-D5wBoXA8.cjs.map} +1 -1
  145. package/dist/storage-BA9RqRO-.cjs.map +1 -1
  146. package/dist/{storage-w7Tslvlq.js → storage-DZwed89z.js} +2 -3
  147. package/dist/{storage-w7Tslvlq.js.map → storage-DZwed89z.js.map} +1 -1
  148. package/dist/{storm-DCEsqViG.cjs → storm-CYi9Swpx.cjs} +2 -2
  149. package/dist/{storm-DCEsqViG.cjs.map → storm-CYi9Swpx.cjs.map} +1 -1
  150. package/dist/{storm-DD4cUkoL.js → storm-VR024_QN.js} +4 -5
  151. package/dist/{storm-DD4cUkoL.js.map → storm-VR024_QN.js.map} +1 -1
  152. package/dist/{types-BR9t_w28.js → types-BAerHgCq.js} +2 -3
  153. package/dist/{types-BR9t_w28.js.map → types-BAerHgCq.js.map} +1 -1
  154. package/dist/types-C7WNpnG1.cjs.map +1 -1
  155. package/dist/{unclean-exit-BYZ5yaSI.js → unclean-exit-CwcUhFOn.js} +3 -4
  156. package/dist/{unclean-exit-BYZ5yaSI.js.map → unclean-exit-CwcUhFOn.js.map} +1 -1
  157. package/dist/{unclean-exit-CwdpbUDg.cjs → unclean-exit-DFUN57wY.cjs} +2 -2
  158. package/dist/{unclean-exit-CwdpbUDg.cjs.map → unclean-exit-DFUN57wY.cjs.map} +1 -1
  159. package/dist/{user-timing-C1kB3JEg.cjs → user-timing-C9kfRq3J.cjs} +2 -2
  160. package/dist/{user-timing-C1kB3JEg.cjs.map → user-timing-C9kfRq3J.cjs.map} +1 -1
  161. package/dist/{user-timing-Di2ra5DB.js → user-timing-_jZIhDKI.js} +4 -5
  162. package/dist/{user-timing-Di2ra5DB.js.map → user-timing-_jZIhDKI.js.map} +1 -1
  163. package/dist/{web-socket-DwBNhgre.cjs → web-socket-BWUoqBh8.cjs} +2 -2
  164. package/dist/{web-socket-DwBNhgre.cjs.map → web-socket-BWUoqBh8.cjs.map} +1 -1
  165. package/dist/{web-socket-B-5qqPy7.js → web-socket-CV7yIMnm.js} +14 -15
  166. package/dist/{web-socket-B-5qqPy7.js.map → web-socket-CV7yIMnm.js.map} +1 -1
  167. package/dist/{web-vitals-Bflr5jSA.js → web-vitals-Bq4WFHQo.js} +2 -3
  168. package/dist/{web-vitals-Bflr5jSA.js.map → web-vitals-Bq4WFHQo.js.map} +1 -1
  169. package/dist/web-vitals-DFuoTQbZ.cjs.map +1 -1
  170. package/dist/{worker-protocol-DXekoADQ.cjs → worker-protocol-Bai7GAIA.cjs} +2 -2
  171. package/dist/{worker-protocol-DXekoADQ.cjs.map → worker-protocol-Bai7GAIA.cjs.map} +1 -1
  172. package/dist/{worker-protocol-0HMf4-kY.js → worker-protocol-CrsdSDLn.js} +6 -7
  173. package/dist/{worker-protocol-0HMf4-kY.js.map → worker-protocol-CrsdSDLn.js.map} +1 -1
  174. package/dist/worker-server-BrIYkfoa.cjs +2 -0
  175. package/dist/{worker-server-BQK5z2yl.cjs.map → worker-server-BrIYkfoa.cjs.map} +1 -1
  176. package/dist/{worker-server-CKcmX5m5.js → worker-server-Dp5HYm4b.js} +25 -26
  177. package/dist/{worker-server-CKcmX5m5.js.map → worker-server-Dp5HYm4b.js.map} +1 -1
  178. package/dist/{worker-transport-Dj2yCQN5.cjs → worker-transport-Bwej4N2e.cjs} +2 -2
  179. package/dist/{worker-transport-Dj2yCQN5.cjs.map → worker-transport-Bwej4N2e.cjs.map} +1 -1
  180. package/dist/{worker-transport-2220ghFZ.js → worker-transport-D6jtgpqN.js} +9 -11
  181. package/dist/{worker-transport-2220ghFZ.js.map → worker-transport-D6jtgpqN.js.map} +1 -1
  182. package/package.json +27 -41
  183. package/dist/console-DZEcs7FL.cjs +0 -2
  184. package/dist/library-console-CabK2j2-.js +0 -14
  185. package/dist/openfin-BwEN0uj4.js +0 -8
  186. package/dist/worker-server-BQK5z2yl.cjs +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"storage-BA9RqRO-.cjs","names":["storageLimits","retention"],"sources":["../src/models/storage.ts"],"sourcesContent":["// src/models/storage.ts\n//\n// Storage interface for undelivered batches, with adapters for IndexedDB,\n// localStorage, memory, and a fallback that does nothing.\n\nimport type { LogBatch } from \"./batch\";\nimport type { RetentionOptions } from \"./config\";\n\n/**\n * State of the request for persistent storage. \"off\" means no request. \"pending\" waits for the\n * browser. \"unsupported\" means the browser has no `navigator.storage.persist()`.\n */\nexport type StoragePersistence = \"off\" | \"pending\" | \"granted\" | \"denied\" | \"unsupported\";\n\n/** Persistent batch storage interface. All methods must resolve and never throw. */\nexport interface StorageAdapter {\n /** Adapter identifier name. */\n readonly name: string;\n\n /**\n * Persists a batch to storage.\n * @param batch The batch to store.\n */\n save(batch: LogBatch): Promise<void>;\n\n /**\n * Reads up to `limit` batches in FIFO order without removing them.\n * @param limit Maximum number of batches to retrieve.\n * @returns Oldest persisted batches.\n */\n take(limit: number): Promise<LogBatch[]>;\n /**\n * Reads batches of one context without loading batches of other contexts.\n * @param id Delivery context id.\n * @param limit Maximum batches to return.\n * @returns Batches of this context, oldest first.\n */\n takeContext?(id: string, limit: number): Promise<LogBatch[]>;\n /**\n * Counts batches of one context without loading them.\n * @param id Delivery context id.\n * @returns Number of batches in this context.\n */\n countContext?(id: string): Promise<number>;\n\n /**\n * Removes a batch by ID. A call with an unknown ID resolves without error.\n * @param id Batch identifier.\n */\n remove(id: string): Promise<void>;\n\n /**\n * Updates the total delivery attempts for a batch.\n * @param id Batch identifier.\n * @param attempts Absolute attempt count.\n */\n bumpAttempts(id: string, attempts: number): Promise<void>;\n\n /**\n * Deletes expired and over-capacity batches.\n * @returns Prune summary metrics.\n */\n prune(): Promise<PruneResult>;\n\n /** Returns the total number of stored batches. */\n count(): Promise<number>;\n\n /** Deletes all batches in storage. */\n clear(): Promise<void>;\n\n /** Closes storage connections and releases resources. */\n close(): Promise<void>;\n}\n\n/** Capacity and retention thresholds enforced by a storage adapter. */\nexport interface StorageLimits {\n /** Maximum batch capacity before FIFO eviction. */\n maxBatches: number;\n /** Maximum time-to-live for a stored batch in milliseconds. */\n maxAgeMs: number;\n /** Maximum delivery attempts before dead-letter drop. */\n maxAttempts: number;\n}\n\n/**\n * Gives the storage limits of a retention setting. \"until-delivered\" has no age limit and no\n * attempt limit. The batch cap still applies.\n * @param retention Retention setting from the config.\n * @returns The limits for the storage adapters and the retry engine.\n */\nexport function storageLimits(retention: RetentionOptions): StorageLimits {\n const { maxBatches } = retention;\n\n if (retention.mode === \"until-delivered\") {\n return { maxBatches, maxAgeMs: Infinity, maxAttempts: Infinity };\n }\n\n return { maxBatches, maxAgeMs: retention.maxAgeMs, maxAttempts: retention.maxAttempts };\n}\n\n/** Metrics for batches and records dropped during storage pruning. */\nexport interface PruneResult {\n /** Total batches dropped. */\n batches: number;\n /** Total records dropped within evicted batches. */\n records: number;\n /**\n * Cause of the drop. If more than one rule applies, this is the last rule. \"not_stored\" means\n * that storage did not keep a batch after a failed send.\n */\n reason: \"expired\" | \"over_capacity\" | \"quota\" | \"not_stored\";\n}\n\n/**\n * Callback invoked when dropped records create a telemetry gap.\n * @param result Summary of evicted data.\n * @param dropped The dropped batches. A corrupt entry has no batch. The list then has none for it.\n */\nexport type GapReporter = (result: PruneResult, dropped: readonly LogBatch[]) => void;\n"],"mappings":"AA0FA,SAAgBA,EAAc,EAA4C,CACxE,GAAM,CAAE,cAAeC,EAMvB,OAJIA,EAAU,OAAS,kBACd,CAAE,aAAY,SAAU,IAAU,YAAa,GAAS,EAG1D,CAAE,aAAY,SAAUA,EAAU,SAAU,YAAaA,EAAU,WAAY,CACxF"}
1
+ {"version":3,"file":"storage-BA9RqRO-.cjs","names":["storageLimits","retention"],"sources":["../src/models/storage.ts"],"sourcesContent":["// src/models/storage.ts\n//\n// Storage interface for undelivered batches, with adapters for IndexedDB,\n// localStorage, memory, and a fallback that does nothing.\n\nimport type { LogBatch } from \"./batch\";\nimport type { RetentionOptions } from \"./config\";\n\n/**\n * State of the request for persistent storage. \"off\" means no request. \"pending\" waits for the\n * browser. \"unsupported\" means the browser has no `navigator.storage.persist()`.\n */\nexport type StoragePersistence = \"off\" | \"pending\" | \"granted\" | \"denied\" | \"unsupported\";\n\n/** Persistent batch storage interface. All methods must resolve and never throw. */\nexport interface StorageAdapter {\n /** Adapter identifier name. */\n readonly name: string;\n\n /**\n * Persists a batch to storage.\n * @param batch The batch to store.\n */\n save(batch: LogBatch): Promise<void>;\n\n /**\n * Reads up to `limit` batches in FIFO order without removing them.\n * @param limit Maximum number of batches to retrieve.\n * @returns Oldest persisted batches.\n */\n take(limit: number): Promise<LogBatch[]>;\n /**\n * Reads batches of one context without loading batches of other contexts.\n * @param id Delivery context id.\n * @param limit Maximum batches to return.\n * @returns Batches of this context, oldest first.\n */\n takeContext?(id: string, limit: number): Promise<LogBatch[]>;\n /**\n * Counts batches of one context without loading them.\n * @param id Delivery context id.\n * @returns Number of batches in this context.\n */\n countContext?(id: string): Promise<number>;\n\n /**\n * Removes a batch by ID. A call with an unknown ID resolves without error.\n * @param id Batch identifier.\n */\n remove(id: string): Promise<void>;\n\n /**\n * Updates the total delivery attempts for a batch.\n * @param id Batch identifier.\n * @param attempts Absolute attempt count.\n */\n bumpAttempts(id: string, attempts: number): Promise<void>;\n\n /**\n * Deletes expired and over-capacity batches.\n * @returns Prune summary metrics.\n */\n prune(): Promise<PruneResult>;\n\n /** Returns the total number of stored batches. */\n count(): Promise<number>;\n\n /** Deletes all batches in storage. */\n clear(): Promise<void>;\n\n /** Closes storage connections and releases resources. */\n close(): Promise<void>;\n}\n\n/** Capacity and retention thresholds enforced by a storage adapter. */\nexport interface StorageLimits {\n /** Maximum batch capacity before FIFO eviction. */\n maxBatches: number;\n /** Maximum time-to-live for a stored batch in milliseconds. */\n maxAgeMs: number;\n /** Maximum delivery attempts before dead-letter drop. */\n maxAttempts: number;\n}\n\n/**\n * Gives the storage limits of a retention setting. \"until-delivered\" has no age limit and no\n * attempt limit. The batch cap still applies.\n * @param retention Retention setting from the config.\n * @returns The limits for the storage adapters and the retry engine.\n */\nexport function storageLimits(retention: RetentionOptions): StorageLimits {\n const { maxBatches } = retention;\n\n if (retention.mode === \"until-delivered\") {\n return { maxBatches, maxAgeMs: Infinity, maxAttempts: Infinity };\n }\n\n return { maxBatches, maxAgeMs: retention.maxAgeMs, maxAttempts: retention.maxAttempts };\n}\n\n/** Metrics for batches and records dropped during storage pruning. */\nexport interface PruneResult {\n /** Total batches dropped. */\n batches: number;\n /** Total records dropped within evicted batches. */\n records: number;\n /**\n * Cause of the drop. If more than one rule applies, this is the last rule. \"not_stored\" means\n * that storage did not keep a batch after a failed send.\n */\n reason: \"expired\" | \"over_capacity\" | \"quota\" | \"not_stored\";\n}\n\n/**\n * Callback invoked when dropped records create a telemetry gap.\n * @param result Summary of evicted data.\n * @param dropped The dropped batches. A corrupt entry has no batch. The list then has none for it.\n */\nexport type GapReporter = (result: PruneResult, dropped: readonly LogBatch[]) => void;\n"],"mappings":"AA0FA,SAAgBA,EAAc,EAA4C,CACxE,GAAM,CAAE,cAAeC,EAMvB,OAJIA,EAAU,OAAS,kBACd,CAAE,aAAY,SAAU,IAAU,YAAa,GAAS,EAG1D,CAAE,aAAY,SAAUA,EAAU,SAAU,YAAaA,EAAU,WAAY,CACxF,C"}
@@ -1,4 +1,4 @@
1
- //#region src/models/storage.ts
1
+ // src/models/storage.ts
2
2
  function e(e) {
3
3
  let { maxBatches: t } = e;
4
4
  return e.mode === "until-delivered" ? {
@@ -11,7 +11,6 @@ function e(e) {
11
11
  maxAttempts: e.maxAttempts
12
12
  };
13
13
  }
14
- //#endregion
15
14
  export { e as storageLimits };
16
15
 
17
- //# sourceMappingURL=storage-w7Tslvlq.js.map
16
+ //# sourceMappingURL=storage-DZwed89z.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage-w7Tslvlq.js","names":["storageLimits","retention"],"sources":["../src/models/storage.ts"],"sourcesContent":["// src/models/storage.ts\n//\n// Storage interface for undelivered batches, with adapters for IndexedDB,\n// localStorage, memory, and a fallback that does nothing.\n\nimport type { LogBatch } from \"./batch\";\nimport type { RetentionOptions } from \"./config\";\n\n/**\n * State of the request for persistent storage. \"off\" means no request. \"pending\" waits for the\n * browser. \"unsupported\" means the browser has no `navigator.storage.persist()`.\n */\nexport type StoragePersistence = \"off\" | \"pending\" | \"granted\" | \"denied\" | \"unsupported\";\n\n/** Persistent batch storage interface. All methods must resolve and never throw. */\nexport interface StorageAdapter {\n /** Adapter identifier name. */\n readonly name: string;\n\n /**\n * Persists a batch to storage.\n * @param batch The batch to store.\n */\n save(batch: LogBatch): Promise<void>;\n\n /**\n * Reads up to `limit` batches in FIFO order without removing them.\n * @param limit Maximum number of batches to retrieve.\n * @returns Oldest persisted batches.\n */\n take(limit: number): Promise<LogBatch[]>;\n /**\n * Reads batches of one context without loading batches of other contexts.\n * @param id Delivery context id.\n * @param limit Maximum batches to return.\n * @returns Batches of this context, oldest first.\n */\n takeContext?(id: string, limit: number): Promise<LogBatch[]>;\n /**\n * Counts batches of one context without loading them.\n * @param id Delivery context id.\n * @returns Number of batches in this context.\n */\n countContext?(id: string): Promise<number>;\n\n /**\n * Removes a batch by ID. A call with an unknown ID resolves without error.\n * @param id Batch identifier.\n */\n remove(id: string): Promise<void>;\n\n /**\n * Updates the total delivery attempts for a batch.\n * @param id Batch identifier.\n * @param attempts Absolute attempt count.\n */\n bumpAttempts(id: string, attempts: number): Promise<void>;\n\n /**\n * Deletes expired and over-capacity batches.\n * @returns Prune summary metrics.\n */\n prune(): Promise<PruneResult>;\n\n /** Returns the total number of stored batches. */\n count(): Promise<number>;\n\n /** Deletes all batches in storage. */\n clear(): Promise<void>;\n\n /** Closes storage connections and releases resources. */\n close(): Promise<void>;\n}\n\n/** Capacity and retention thresholds enforced by a storage adapter. */\nexport interface StorageLimits {\n /** Maximum batch capacity before FIFO eviction. */\n maxBatches: number;\n /** Maximum time-to-live for a stored batch in milliseconds. */\n maxAgeMs: number;\n /** Maximum delivery attempts before dead-letter drop. */\n maxAttempts: number;\n}\n\n/**\n * Gives the storage limits of a retention setting. \"until-delivered\" has no age limit and no\n * attempt limit. The batch cap still applies.\n * @param retention Retention setting from the config.\n * @returns The limits for the storage adapters and the retry engine.\n */\nexport function storageLimits(retention: RetentionOptions): StorageLimits {\n const { maxBatches } = retention;\n\n if (retention.mode === \"until-delivered\") {\n return { maxBatches, maxAgeMs: Infinity, maxAttempts: Infinity };\n }\n\n return { maxBatches, maxAgeMs: retention.maxAgeMs, maxAttempts: retention.maxAttempts };\n}\n\n/** Metrics for batches and records dropped during storage pruning. */\nexport interface PruneResult {\n /** Total batches dropped. */\n batches: number;\n /** Total records dropped within evicted batches. */\n records: number;\n /**\n * Cause of the drop. If more than one rule applies, this is the last rule. \"not_stored\" means\n * that storage did not keep a batch after a failed send.\n */\n reason: \"expired\" | \"over_capacity\" | \"quota\" | \"not_stored\";\n}\n\n/**\n * Callback invoked when dropped records create a telemetry gap.\n * @param result Summary of evicted data.\n * @param dropped The dropped batches. A corrupt entry has no batch. The list then has none for it.\n */\nexport type GapReporter = (result: PruneResult, dropped: readonly LogBatch[]) => void;\n"],"mappings":";AA0FA,SAAgBA,EAAc,GAA4C;CACxE,IAAM,EAAE,kBAAeC;CAMvB,OAJIA,EAAU,SAAS,oBACd;EAAE;EAAY,UAAU;EAAU,aAAa;CAAS,IAG1D;EAAE;EAAY,UAAUA,EAAU;EAAU,aAAaA,EAAU;CAAY;AACxF"}
1
+ {"version":3,"file":"storage-DZwed89z.js","names":["storageLimits","retention"],"sources":["../src/models/storage.ts"],"sourcesContent":["// src/models/storage.ts\n//\n// Storage interface for undelivered batches, with adapters for IndexedDB,\n// localStorage, memory, and a fallback that does nothing.\n\nimport type { LogBatch } from \"./batch\";\nimport type { RetentionOptions } from \"./config\";\n\n/**\n * State of the request for persistent storage. \"off\" means no request. \"pending\" waits for the\n * browser. \"unsupported\" means the browser has no `navigator.storage.persist()`.\n */\nexport type StoragePersistence = \"off\" | \"pending\" | \"granted\" | \"denied\" | \"unsupported\";\n\n/** Persistent batch storage interface. All methods must resolve and never throw. */\nexport interface StorageAdapter {\n /** Adapter identifier name. */\n readonly name: string;\n\n /**\n * Persists a batch to storage.\n * @param batch The batch to store.\n */\n save(batch: LogBatch): Promise<void>;\n\n /**\n * Reads up to `limit` batches in FIFO order without removing them.\n * @param limit Maximum number of batches to retrieve.\n * @returns Oldest persisted batches.\n */\n take(limit: number): Promise<LogBatch[]>;\n /**\n * Reads batches of one context without loading batches of other contexts.\n * @param id Delivery context id.\n * @param limit Maximum batches to return.\n * @returns Batches of this context, oldest first.\n */\n takeContext?(id: string, limit: number): Promise<LogBatch[]>;\n /**\n * Counts batches of one context without loading them.\n * @param id Delivery context id.\n * @returns Number of batches in this context.\n */\n countContext?(id: string): Promise<number>;\n\n /**\n * Removes a batch by ID. A call with an unknown ID resolves without error.\n * @param id Batch identifier.\n */\n remove(id: string): Promise<void>;\n\n /**\n * Updates the total delivery attempts for a batch.\n * @param id Batch identifier.\n * @param attempts Absolute attempt count.\n */\n bumpAttempts(id: string, attempts: number): Promise<void>;\n\n /**\n * Deletes expired and over-capacity batches.\n * @returns Prune summary metrics.\n */\n prune(): Promise<PruneResult>;\n\n /** Returns the total number of stored batches. */\n count(): Promise<number>;\n\n /** Deletes all batches in storage. */\n clear(): Promise<void>;\n\n /** Closes storage connections and releases resources. */\n close(): Promise<void>;\n}\n\n/** Capacity and retention thresholds enforced by a storage adapter. */\nexport interface StorageLimits {\n /** Maximum batch capacity before FIFO eviction. */\n maxBatches: number;\n /** Maximum time-to-live for a stored batch in milliseconds. */\n maxAgeMs: number;\n /** Maximum delivery attempts before dead-letter drop. */\n maxAttempts: number;\n}\n\n/**\n * Gives the storage limits of a retention setting. \"until-delivered\" has no age limit and no\n * attempt limit. The batch cap still applies.\n * @param retention Retention setting from the config.\n * @returns The limits for the storage adapters and the retry engine.\n */\nexport function storageLimits(retention: RetentionOptions): StorageLimits {\n const { maxBatches } = retention;\n\n if (retention.mode === \"until-delivered\") {\n return { maxBatches, maxAgeMs: Infinity, maxAttempts: Infinity };\n }\n\n return { maxBatches, maxAgeMs: retention.maxAgeMs, maxAttempts: retention.maxAttempts };\n}\n\n/** Metrics for batches and records dropped during storage pruning. */\nexport interface PruneResult {\n /** Total batches dropped. */\n batches: number;\n /** Total records dropped within evicted batches. */\n records: number;\n /**\n * Cause of the drop. If more than one rule applies, this is the last rule. \"not_stored\" means\n * that storage did not keep a batch after a failed send.\n */\n reason: \"expired\" | \"over_capacity\" | \"quota\" | \"not_stored\";\n}\n\n/**\n * Callback invoked when dropped records create a telemetry gap.\n * @param result Summary of evicted data.\n * @param dropped The dropped batches. A corrupt entry has no batch. The list then has none for it.\n */\nexport type GapReporter = (result: PruneResult, dropped: readonly LogBatch[]) => void;\n"],"mappings":";AA0FA,SAAgBA,EAAc,GAA4C;CACxE,IAAM,EAAE,kBAAeC;CAMvB,OAJIA,EAAU,SAAS,oBACd;EAAE;EAAY,UAAU;EAAU,aAAa;CAAS,IAG1D;EAAE;EAAY,UAAUA,EAAU;EAAU,aAAaA,EAAU;CAAY;AACxF"}
@@ -1,2 +1,2 @@
1
- const e=require("./constants-CL0ZdI2f.cjs"),t=require("./fixed-window-CvESpFYV.cjs");function n(n,r,i,a,o=e.nt){return r===0||t.t(n,r,o)?!0:(i.report(`capture.rate_limited`,`More than ${String(r)} ${a} occurred in ${String(o)} ms. The library ignores the other ${a} in this window.`),!1)}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
2
- //# sourceMappingURL=storm-DCEsqViG.cjs.map
1
+ const e=require("./constants-DqKJH_MP.cjs"),t=require("./fixed-window-CvESpFYV.cjs");function n(n,r,i,a,o=e.nt){return r===0||t.t(n,r,o)?!0:(i.report(`capture.rate_limited`,`More than ${String(r)} ${a} occurred in ${String(o)} ms. The library ignores the other ${a} in this window.`),!1)}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
2
+ //# sourceMappingURL=storm-CYi9Swpx.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"storm-DCEsqViG.cjs","names":["ERROR_STORM_WINDOW_MS","countInWindow","require_constants","require_fixed_window","allowInWindow","limit","window","windowMs","diagnostics","what"],"sources":["../src/capture/storm.ts"],"sourcesContent":["// src/capture/storm.ts\n//\n// Fixed-window rate limit for the capture modules. A render loop that throws or freezes\n// makes thousands of events each second. Sending all of them floods the ingest endpoint.\n\nimport { ERROR_STORM_WINDOW_MS } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { countInWindow, type StormWindow } from \"../utils/fixed-window\";\n\nexport type { StormWindow } from \"../utils/fixed-window\";\n\n/**\n * Counts one event in a fixed window. It reports each event over the limit.\n * @param window Window state to change.\n * @param limit Maximum events in each window.\n * @param diagnostics Diagnostics reporter.\n * @param what Plural name of the events, for the diagnostic message.\n * @param windowMs Rate limit window, in milliseconds.\n * @returns False when the window has no allowance left. The caller must drop the event.\n */\nexport function allowInWindow(\n window: StormWindow,\n limit: number,\n diagnostics: Diagnostics,\n what: string,\n windowMs = ERROR_STORM_WINDOW_MS,\n): boolean {\n if (limit === 0 || countInWindow(window, limit, windowMs)) {\n return true;\n }\n\n diagnostics.report(\n \"capture.rate_limited\",\n `More than ${String(limit)} ${what} occurred in ${String(windowMs)} ms. The library ignores the other ${what} in this window.`,\n );\n return false;\n}\n"],"mappings":"qFAoBA,SAAgBI,EACd,EACA,EACA,EACA,EACA,EAAWJ,EAAAA,GACF,CAST,OARIK,IAAU,GAAKJ,EAAAA,EAAcK,EAAQD,EAAOE,CAAQ,EAC/C,IAGTC,EAAY,OACV,uBACA,aAAa,OAAOH,CAAK,EAAE,GAAGI,EAAK,eAAe,OAAOF,CAAQ,EAAE,qCAAqCE,EAAK,iBAC/G,EACO,GACT"}
1
+ {"version":3,"file":"storm-CYi9Swpx.cjs","names":["ERROR_STORM_WINDOW_MS","countInWindow","require_constants","require_fixed_window","allowInWindow","limit","window","windowMs","diagnostics","what"],"sources":["../src/capture/storm.ts"],"sourcesContent":["// src/capture/storm.ts\n//\n// Fixed-window rate limit for the capture modules. A render loop that throws or freezes\n// makes thousands of events each second. Sending all of them floods the ingest endpoint.\n\nimport { ERROR_STORM_WINDOW_MS } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { countInWindow, type StormWindow } from \"../utils/fixed-window\";\n\nexport type { StormWindow } from \"../utils/fixed-window\";\n\n/**\n * Counts one event in a fixed window. It reports each event over the limit.\n * @param window Window state to change.\n * @param limit Maximum events in each window.\n * @param diagnostics Diagnostics reporter.\n * @param what Plural name of the events, for the diagnostic message.\n * @param windowMs Rate limit window, in milliseconds.\n * @returns False when the window has no allowance left. The caller must drop the event.\n */\nexport function allowInWindow(\n window: StormWindow,\n limit: number,\n diagnostics: Diagnostics,\n what: string,\n windowMs = ERROR_STORM_WINDOW_MS,\n): boolean {\n if (limit === 0 || countInWindow(window, limit, windowMs)) {\n return true;\n }\n\n diagnostics.report(\n \"capture.rate_limited\",\n `More than ${String(limit)} ${what} occurred in ${String(windowMs)} ms. The library ignores the other ${what} in this window.`,\n );\n return false;\n}\n"],"mappings":"A,qFAoBA,SAAgBI,EACd,EACA,EACA,EACA,EACA,EAAWJ,EAAAA,GACF,CAST,OARIK,IAAU,GAAKJ,EAAAA,EAAcK,EAAQD,EAAOE,CAAQ,EAC/C,IAGTC,EAAY,OACV,uBACA,aAAa,OAAOH,CAAK,EAAE,GAAGI,EAAK,eAAe,OAAOF,CAAQ,EAAE,qCAAqCE,EAAK,iBAC/G,EACO,GACT,C"}
@@ -1,10 +1,9 @@
1
- import { nt as e } from "./constants-CU60FG4w.js";
2
- import { t } from "./fixed-window-CtaFHanJ.js";
3
- //#region src/capture/storm.ts
1
+ import { nt as e } from "./constants-zyrqveN4.js";
2
+ import { t } from "./fixed-window-Dq3MLUUv.js";
3
+ // src/capture/storm.ts
4
4
  function n(n, r, i, a, o = e) {
5
5
  return r === 0 || t(n, r, o) ? !0 : (i.report("capture.rate_limited", `More than ${String(r)} ${a} occurred in ${String(o)} ms. The library ignores the other ${a} in this window.`), !1);
6
6
  }
7
- //#endregion
8
7
  export { n as t };
9
8
 
10
- //# sourceMappingURL=storm-DD4cUkoL.js.map
9
+ //# sourceMappingURL=storm-VR024_QN.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storm-DD4cUkoL.js","names":["ERROR_STORM_WINDOW_MS","allowInWindow","limit","countInWindow","window","windowMs","diagnostics","what"],"sources":["../src/capture/storm.ts"],"sourcesContent":["// src/capture/storm.ts\n//\n// Fixed-window rate limit for the capture modules. A render loop that throws or freezes\n// makes thousands of events each second. Sending all of them floods the ingest endpoint.\n\nimport { ERROR_STORM_WINDOW_MS } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { countInWindow, type StormWindow } from \"../utils/fixed-window\";\n\nexport type { StormWindow } from \"../utils/fixed-window\";\n\n/**\n * Counts one event in a fixed window. It reports each event over the limit.\n * @param window Window state to change.\n * @param limit Maximum events in each window.\n * @param diagnostics Diagnostics reporter.\n * @param what Plural name of the events, for the diagnostic message.\n * @param windowMs Rate limit window, in milliseconds.\n * @returns False when the window has no allowance left. The caller must drop the event.\n */\nexport function allowInWindow(\n window: StormWindow,\n limit: number,\n diagnostics: Diagnostics,\n what: string,\n windowMs = ERROR_STORM_WINDOW_MS,\n): boolean {\n if (limit === 0 || countInWindow(window, limit, windowMs)) {\n return true;\n }\n\n diagnostics.report(\n \"capture.rate_limited\",\n `More than ${String(limit)} ${what} occurred in ${String(windowMs)} ms. The library ignores the other ${what} in this window.`,\n );\n return false;\n}\n"],"mappings":";;;AAoBA,SAAgBC,EACd,GACA,GACA,GACA,GACA,IAAWD,GACF;CAST,OARIE,MAAU,KAAKC,EAAcC,GAAQF,GAAOG,CAAQ,IAC/C,MAGTC,EAAY,OACV,wBACA,aAAa,OAAOJ,CAAK,EAAE,GAAGK,EAAK,eAAe,OAAOF,CAAQ,EAAE,qCAAqCE,EAAK,iBAC/G,GACO;AACT"}
1
+ {"version":3,"file":"storm-VR024_QN.js","names":["ERROR_STORM_WINDOW_MS","allowInWindow","limit","countInWindow","window","windowMs","diagnostics","what"],"sources":["../src/capture/storm.ts"],"sourcesContent":["// src/capture/storm.ts\n//\n// Fixed-window rate limit for the capture modules. A render loop that throws or freezes\n// makes thousands of events each second. Sending all of them floods the ingest endpoint.\n\nimport { ERROR_STORM_WINDOW_MS } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { countInWindow, type StormWindow } from \"../utils/fixed-window\";\n\nexport type { StormWindow } from \"../utils/fixed-window\";\n\n/**\n * Counts one event in a fixed window. It reports each event over the limit.\n * @param window Window state to change.\n * @param limit Maximum events in each window.\n * @param diagnostics Diagnostics reporter.\n * @param what Plural name of the events, for the diagnostic message.\n * @param windowMs Rate limit window, in milliseconds.\n * @returns False when the window has no allowance left. The caller must drop the event.\n */\nexport function allowInWindow(\n window: StormWindow,\n limit: number,\n diagnostics: Diagnostics,\n what: string,\n windowMs = ERROR_STORM_WINDOW_MS,\n): boolean {\n if (limit === 0 || countInWindow(window, limit, windowMs)) {\n return true;\n }\n\n diagnostics.report(\n \"capture.rate_limited\",\n `More than ${String(limit)} ${what} occurred in ${String(windowMs)} ms. The library ignores the other ${what} in this window.`,\n );\n return false;\n}\n"],"mappings":";;;AAoBA,SAAgBC,EACd,GACA,GACA,GACA,GACA,IAAWD,GACF;CAST,OARIE,MAAU,KAAKC,EAAcC,GAAQF,GAAOG,CAAQ,IAC/C,MAGTC,EAAY,OACV,wBACA,aAAa,OAAOJ,CAAK,EAAE,GAAGK,EAAK,eAAe,OAAOF,CAAQ,EAAE,qCAAqCE,EAAK,iBAC/G,GACO;AACT"}
@@ -1,8 +1,7 @@
1
- //#region src/capture/types.ts
1
+ // src/capture/types.ts
2
2
  function e(e, t) {
3
3
  return typeof e == "string" && t.some((t) => typeof t == "string" ? e.includes(t) : t.test(e));
4
4
  }
5
- //#endregion
6
5
  export { e as t };
7
6
 
8
- //# sourceMappingURL=types-BR9t_w28.js.map
7
+ //# sourceMappingURL=types-BAerHgCq.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-BR9t_w28.js","names":["matchesAny","url","patterns","pattern"],"sources":["../src/capture/types.ts"],"sourcesContent":["// src/capture/types.ts\n//\n// Shared interfaces, logger abstractions, and utility helpers for auto-capture modules.\n\nimport type { BreadcrumbBuffer } from \"../core/breadcrumbs\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { SpanData } from \"../core/spans\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { MetricType } from \"../models/log-record\";\nimport type { InstrumentDef, MetricAttributes } from \"../models/metric\";\nimport type { TraceEngine } from \"../utils/tracing\";\n\n/**\n * Logging interface that auto-capture modules use. A reference to the runtime class\n * here causes an import cycle. The runtime installs the capture modules.\n */\nexport interface CaptureLogger {\n /**\n * Logs an error event with an associated error instance or reason.\n * @param message Error description.\n * @param error Caught error instance or reason.\n * @param payload Optional attributes.\n */\n error(message: string, error?: unknown, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a warning event.\n * @param message Warning description.\n * @param payload Optional attributes.\n */\n warn(message: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a discrete lifecycle or user event.\n * @param name Event identifier.\n * @param payload Optional attributes.\n */\n logEvent(name: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a numerical metric measurement.\n * @param name Metric name.\n * @param value Numerical measurement.\n * @param unit Unit of measurement.\n * @param type Metric type classification.\n * @param attrs Optional metric attributes.\n */\n logMetric(\n name: string,\n value: number,\n unit?: string,\n type?: MetricType,\n attrs?: Record<string, unknown>,\n ): void;\n\n /**\n * Logs a diagnostic debug message.\n * @param message Debug message.\n * @param payload Optional attributes.\n */\n debug(message: string, payload?: Record<string, unknown>): void;\n}\n\n/**\n * Capture work that runs one time for each document, not one time for each\n * install. A reconfigure builds new capture instances. Thus instance state\n * cannot hold these flags. web-vitals has no unsubscribe. A second subscription\n * reports each metric two times.\n */\nexport interface CaptureOnce {\n /** True after the library subscribes the web-vitals reporters. */\n webVitals: boolean;\n /** True after the library reports navigation timing. */\n navigationTiming: boolean;\n /** True after the first long frame install. Only that install reads buffered frames. */\n longFrames: boolean;\n /** True after the library reads the alive marker of the previous page. */\n uncleanExit: boolean;\n /** True after the first user timing install. Only that install reads buffered entries. */\n userTiming: boolean;\n /** True after the first resource timing install. Later installs exclude buffered entries. */\n resourceTiming?: boolean;\n /** Page state and its start time. A reinstall keeps them and logs no false transition. */\n lifecycle?: { state: string; enteredAt: number };\n}\n\n/** Shared runtime dependencies provided to auto-capture instances. */\nexport interface CaptureContext {\n /** False while the runtime stops or changes its security context. */\n isActive?: () => boolean;\n /** Active runtime configuration. */\n config: ResolvedConfig;\n /** Diagnostics reporter for capture faults. */\n diagnostics: Diagnostics;\n /** Logger instance for recorded telemetry. */\n logger: CaptureLogger;\n /** Buffer for recording contextual breadcrumbs. */\n breadcrumbs: BreadcrumbBuffer;\n /** Active trace context provider. */\n tracing: TraceEngine;\n /** Guards for the capture work that a reinstall must not repeat. */\n once: CaptureOnce;\n /** Adds a value to a counter or a histogram of the runtime. */\n recordMetric: (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;\n /** Records a span. The runtime drops it when spans are off. */\n recordSpan: (span: SpanData) => void;\n /** Gives the session id in force. */\n sessionId: () => string;\n}\n\n/** Lifecycle interface for browser instrumentation modules. */\nexport interface Capture {\n /** Module identifier used in diagnostics. */\n readonly name: string;\n /**\n * Attaches instrumentation listeners and patches target APIs. A second patch on a\n * patched function adds a second wrapper and doubles each record. A second call\n * must do nothing.\n */\n install(): void;\n /** Restores native APIs and removes registered listeners. */\n uninstall(): void;\n}\n\n/**\n * Tests if a URL matches any string substring or regular expression pattern.\n * @param url Target URL to test. A value that is not a string matches nothing.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: unknown, patterns: (string | RegExp)[]): boolean {\n // Guard against a URL that is not a string. includes() on it throws in the call of the host.\n if (typeof url !== \"string\") {\n return false;\n }\n\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n"],"mappings":";AAkIA,SAAgBA,EAAW,GAAc,GAAwC;CAM/E,OAJI,OAAOC,KAAQ,YAIZC,EAAS,MAAM,MACpB,OAAOC,KAAY,WAAWF,EAAI,SAASE,CAAO,IAAIA,EAAQ,KAAKF,CAAG,CACxE;AACF"}
1
+ {"version":3,"file":"types-BAerHgCq.js","names":["matchesAny","url","patterns","pattern"],"sources":["../src/capture/types.ts"],"sourcesContent":["// src/capture/types.ts\n//\n// Shared interfaces, logger abstractions, and utility helpers for auto-capture modules.\n\nimport type { BreadcrumbBuffer } from \"../core/breadcrumbs\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { SpanData } from \"../core/spans\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { MetricType } from \"../models/log-record\";\nimport type { InstrumentDef, MetricAttributes } from \"../models/metric\";\nimport type { TraceEngine } from \"../utils/tracing\";\n\n/**\n * Logging interface that auto-capture modules use. A reference to the runtime class\n * here causes an import cycle. The runtime installs the capture modules.\n */\nexport interface CaptureLogger {\n /**\n * Logs an error event with an associated error instance or reason.\n * @param message Error description.\n * @param error Caught error instance or reason.\n * @param payload Optional attributes.\n */\n error(message: string, error?: unknown, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a warning event.\n * @param message Warning description.\n * @param payload Optional attributes.\n */\n warn(message: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a discrete lifecycle or user event.\n * @param name Event identifier.\n * @param payload Optional attributes.\n */\n logEvent(name: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a numerical metric measurement.\n * @param name Metric name.\n * @param value Numerical measurement.\n * @param unit Unit of measurement.\n * @param type Metric type classification.\n * @param attrs Optional metric attributes.\n */\n logMetric(\n name: string,\n value: number,\n unit?: string,\n type?: MetricType,\n attrs?: Record<string, unknown>,\n ): void;\n\n /**\n * Logs a diagnostic debug message.\n * @param message Debug message.\n * @param payload Optional attributes.\n */\n debug(message: string, payload?: Record<string, unknown>): void;\n}\n\n/**\n * Capture work that runs one time for each document, not one time for each\n * install. A reconfigure builds new capture instances. Thus instance state\n * cannot hold these flags. web-vitals has no unsubscribe. A second subscription\n * reports each metric two times.\n */\nexport interface CaptureOnce {\n /** True after the library subscribes the web-vitals reporters. */\n webVitals: boolean;\n /** True after the library reports navigation timing. */\n navigationTiming: boolean;\n /** True after the first long frame install. Only that install reads buffered frames. */\n longFrames: boolean;\n /** True after the library reads the alive marker of the previous page. */\n uncleanExit: boolean;\n /** True after the first user timing install. Only that install reads buffered entries. */\n userTiming: boolean;\n /** True after the first resource timing install. Later installs exclude buffered entries. */\n resourceTiming?: boolean;\n /** Page state and its start time. A reinstall keeps them and logs no false transition. */\n lifecycle?: { state: string; enteredAt: number };\n}\n\n/** Shared runtime dependencies provided to auto-capture instances. */\nexport interface CaptureContext {\n /** False while the runtime stops or changes its security context. */\n isActive?: () => boolean;\n /** Active runtime configuration. */\n config: ResolvedConfig;\n /** Diagnostics reporter for capture faults. */\n diagnostics: Diagnostics;\n /** Logger instance for recorded telemetry. */\n logger: CaptureLogger;\n /** Buffer for recording contextual breadcrumbs. */\n breadcrumbs: BreadcrumbBuffer;\n /** Active trace context provider. */\n tracing: TraceEngine;\n /** Guards for the capture work that a reinstall must not repeat. */\n once: CaptureOnce;\n /** Adds a value to a counter or a histogram of the runtime. */\n recordMetric: (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;\n /** Records a span. The runtime drops it when spans are off. */\n recordSpan: (span: SpanData) => void;\n /** Gives the session id in force. */\n sessionId: () => string;\n}\n\n/** Lifecycle interface for browser instrumentation modules. */\nexport interface Capture {\n /** Module identifier used in diagnostics. */\n readonly name: string;\n /**\n * Attaches instrumentation listeners and patches target APIs. A second patch on a\n * patched function adds a second wrapper and doubles each record. A second call\n * must do nothing.\n */\n install(): void;\n /** Restores native APIs and removes registered listeners. */\n uninstall(): void;\n}\n\n/**\n * Tests if a URL matches any string substring or regular expression pattern.\n * @param url Target URL to test. A value that is not a string matches nothing.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: unknown, patterns: (string | RegExp)[]): boolean {\n // Guard against a URL that is not a string. includes() on it throws in the call of the host.\n if (typeof url !== \"string\") {\n return false;\n }\n\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n"],"mappings":";AAkIA,SAAgBA,EAAW,GAAc,GAAwC;CAM/E,OAJI,OAAOC,KAAQ,YAIZC,EAAS,MAAM,MACpB,OAAOC,KAAY,WAAWF,EAAI,SAASE,CAAO,IAAIA,EAAQ,KAAKF,CAAG,CACxE;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"types-C7WNpnG1.cjs","names":["matchesAny","url","patterns","pattern"],"sources":["../src/capture/types.ts"],"sourcesContent":["// src/capture/types.ts\n//\n// Shared interfaces, logger abstractions, and utility helpers for auto-capture modules.\n\nimport type { BreadcrumbBuffer } from \"../core/breadcrumbs\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { SpanData } from \"../core/spans\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { MetricType } from \"../models/log-record\";\nimport type { InstrumentDef, MetricAttributes } from \"../models/metric\";\nimport type { TraceEngine } from \"../utils/tracing\";\n\n/**\n * Logging interface that auto-capture modules use. A reference to the runtime class\n * here causes an import cycle. The runtime installs the capture modules.\n */\nexport interface CaptureLogger {\n /**\n * Logs an error event with an associated error instance or reason.\n * @param message Error description.\n * @param error Caught error instance or reason.\n * @param payload Optional attributes.\n */\n error(message: string, error?: unknown, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a warning event.\n * @param message Warning description.\n * @param payload Optional attributes.\n */\n warn(message: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a discrete lifecycle or user event.\n * @param name Event identifier.\n * @param payload Optional attributes.\n */\n logEvent(name: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a numerical metric measurement.\n * @param name Metric name.\n * @param value Numerical measurement.\n * @param unit Unit of measurement.\n * @param type Metric type classification.\n * @param attrs Optional metric attributes.\n */\n logMetric(\n name: string,\n value: number,\n unit?: string,\n type?: MetricType,\n attrs?: Record<string, unknown>,\n ): void;\n\n /**\n * Logs a diagnostic debug message.\n * @param message Debug message.\n * @param payload Optional attributes.\n */\n debug(message: string, payload?: Record<string, unknown>): void;\n}\n\n/**\n * Capture work that runs one time for each document, not one time for each\n * install. A reconfigure builds new capture instances. Thus instance state\n * cannot hold these flags. web-vitals has no unsubscribe. A second subscription\n * reports each metric two times.\n */\nexport interface CaptureOnce {\n /** True after the library subscribes the web-vitals reporters. */\n webVitals: boolean;\n /** True after the library reports navigation timing. */\n navigationTiming: boolean;\n /** True after the first long frame install. Only that install reads buffered frames. */\n longFrames: boolean;\n /** True after the library reads the alive marker of the previous page. */\n uncleanExit: boolean;\n /** True after the first user timing install. Only that install reads buffered entries. */\n userTiming: boolean;\n /** True after the first resource timing install. Later installs exclude buffered entries. */\n resourceTiming?: boolean;\n /** Page state and its start time. A reinstall keeps them and logs no false transition. */\n lifecycle?: { state: string; enteredAt: number };\n}\n\n/** Shared runtime dependencies provided to auto-capture instances. */\nexport interface CaptureContext {\n /** False while the runtime stops or changes its security context. */\n isActive?: () => boolean;\n /** Active runtime configuration. */\n config: ResolvedConfig;\n /** Diagnostics reporter for capture faults. */\n diagnostics: Diagnostics;\n /** Logger instance for recorded telemetry. */\n logger: CaptureLogger;\n /** Buffer for recording contextual breadcrumbs. */\n breadcrumbs: BreadcrumbBuffer;\n /** Active trace context provider. */\n tracing: TraceEngine;\n /** Guards for the capture work that a reinstall must not repeat. */\n once: CaptureOnce;\n /** Adds a value to a counter or a histogram of the runtime. */\n recordMetric: (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;\n /** Records a span. The runtime drops it when spans are off. */\n recordSpan: (span: SpanData) => void;\n /** Gives the session id in force. */\n sessionId: () => string;\n}\n\n/** Lifecycle interface for browser instrumentation modules. */\nexport interface Capture {\n /** Module identifier used in diagnostics. */\n readonly name: string;\n /**\n * Attaches instrumentation listeners and patches target APIs. A second patch on a\n * patched function adds a second wrapper and doubles each record. A second call\n * must do nothing.\n */\n install(): void;\n /** Restores native APIs and removes registered listeners. */\n uninstall(): void;\n}\n\n/**\n * Tests if a URL matches any string substring or regular expression pattern.\n * @param url Target URL to test. A value that is not a string matches nothing.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: unknown, patterns: (string | RegExp)[]): boolean {\n // Guard against a URL that is not a string. includes() on it throws in the call of the host.\n if (typeof url !== \"string\") {\n return false;\n }\n\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n"],"mappings":"AAkIA,SAAgBA,EAAW,EAAc,EAAwC,CAM/E,OAJI,OAAOC,GAAQ,UAIZC,EAAS,KAAM,GACpB,OAAOC,GAAY,SAAWF,EAAI,SAASE,CAAO,EAAIA,EAAQ,KAAKF,CAAG,CACxE,CACF"}
1
+ {"version":3,"file":"types-C7WNpnG1.cjs","names":["matchesAny","url","patterns","pattern"],"sources":["../src/capture/types.ts"],"sourcesContent":["// src/capture/types.ts\n//\n// Shared interfaces, logger abstractions, and utility helpers for auto-capture modules.\n\nimport type { BreadcrumbBuffer } from \"../core/breadcrumbs\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { SpanData } from \"../core/spans\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { MetricType } from \"../models/log-record\";\nimport type { InstrumentDef, MetricAttributes } from \"../models/metric\";\nimport type { TraceEngine } from \"../utils/tracing\";\n\n/**\n * Logging interface that auto-capture modules use. A reference to the runtime class\n * here causes an import cycle. The runtime installs the capture modules.\n */\nexport interface CaptureLogger {\n /**\n * Logs an error event with an associated error instance or reason.\n * @param message Error description.\n * @param error Caught error instance or reason.\n * @param payload Optional attributes.\n */\n error(message: string, error?: unknown, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a warning event.\n * @param message Warning description.\n * @param payload Optional attributes.\n */\n warn(message: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a discrete lifecycle or user event.\n * @param name Event identifier.\n * @param payload Optional attributes.\n */\n logEvent(name: string, payload?: Record<string, unknown>): void;\n\n /**\n * Logs a numerical metric measurement.\n * @param name Metric name.\n * @param value Numerical measurement.\n * @param unit Unit of measurement.\n * @param type Metric type classification.\n * @param attrs Optional metric attributes.\n */\n logMetric(\n name: string,\n value: number,\n unit?: string,\n type?: MetricType,\n attrs?: Record<string, unknown>,\n ): void;\n\n /**\n * Logs a diagnostic debug message.\n * @param message Debug message.\n * @param payload Optional attributes.\n */\n debug(message: string, payload?: Record<string, unknown>): void;\n}\n\n/**\n * Capture work that runs one time for each document, not one time for each\n * install. A reconfigure builds new capture instances. Thus instance state\n * cannot hold these flags. web-vitals has no unsubscribe. A second subscription\n * reports each metric two times.\n */\nexport interface CaptureOnce {\n /** True after the library subscribes the web-vitals reporters. */\n webVitals: boolean;\n /** True after the library reports navigation timing. */\n navigationTiming: boolean;\n /** True after the first long frame install. Only that install reads buffered frames. */\n longFrames: boolean;\n /** True after the library reads the alive marker of the previous page. */\n uncleanExit: boolean;\n /** True after the first user timing install. Only that install reads buffered entries. */\n userTiming: boolean;\n /** True after the first resource timing install. Later installs exclude buffered entries. */\n resourceTiming?: boolean;\n /** Page state and its start time. A reinstall keeps them and logs no false transition. */\n lifecycle?: { state: string; enteredAt: number };\n}\n\n/** Shared runtime dependencies provided to auto-capture instances. */\nexport interface CaptureContext {\n /** False while the runtime stops or changes its security context. */\n isActive?: () => boolean;\n /** Active runtime configuration. */\n config: ResolvedConfig;\n /** Diagnostics reporter for capture faults. */\n diagnostics: Diagnostics;\n /** Logger instance for recorded telemetry. */\n logger: CaptureLogger;\n /** Buffer for recording contextual breadcrumbs. */\n breadcrumbs: BreadcrumbBuffer;\n /** Active trace context provider. */\n tracing: TraceEngine;\n /** Guards for the capture work that a reinstall must not repeat. */\n once: CaptureOnce;\n /** Adds a value to a counter or a histogram of the runtime. */\n recordMetric: (def: InstrumentDef, value: number, attributes?: MetricAttributes) => void;\n /** Records a span. The runtime drops it when spans are off. */\n recordSpan: (span: SpanData) => void;\n /** Gives the session id in force. */\n sessionId: () => string;\n}\n\n/** Lifecycle interface for browser instrumentation modules. */\nexport interface Capture {\n /** Module identifier used in diagnostics. */\n readonly name: string;\n /**\n * Attaches instrumentation listeners and patches target APIs. A second patch on a\n * patched function adds a second wrapper and doubles each record. A second call\n * must do nothing.\n */\n install(): void;\n /** Restores native APIs and removes registered listeners. */\n uninstall(): void;\n}\n\n/**\n * Tests if a URL matches any string substring or regular expression pattern.\n * @param url Target URL to test. A value that is not a string matches nothing.\n * @param patterns Substrings and regular expressions to test against.\n * @returns True if any pattern matches the URL.\n */\nexport function matchesAny(url: unknown, patterns: (string | RegExp)[]): boolean {\n // Guard against a URL that is not a string. includes() on it throws in the call of the host.\n if (typeof url !== \"string\") {\n return false;\n }\n\n return patterns.some((pattern) =>\n typeof pattern === \"string\" ? url.includes(pattern) : pattern.test(url),\n );\n}\n"],"mappings":"AAkIA,SAAgBA,EAAW,EAAc,EAAwC,CAM/E,OAJI,OAAOC,GAAQ,UAIZC,EAAS,KAAM,GACpB,OAAOC,GAAY,SAAWF,EAAI,SAASE,CAAO,EAAIA,EAAQ,KAAKF,CAAG,CACxE,CACF,C"}
@@ -1,5 +1,5 @@
1
- import { n as e, r as t } from "./constants-CU60FG4w.js";
2
- //#region src/capture/unclean-exit.ts
1
+ import { n as e, r as t } from "./constants-zyrqveN4.js";
2
+ // src/capture/unclean-exit.ts
3
3
  function n(e) {
4
4
  let t = e === null ? null : JSON.parse(e);
5
5
  if (typeof t != "object" || !t) return null;
@@ -57,7 +57,6 @@ var r = class {
57
57
  e.persisted && (this.closing = !1, this.mark());
58
58
  };
59
59
  };
60
- //#endregion
61
60
  export { r as UncleanExitCapture };
62
61
 
63
- //# sourceMappingURL=unclean-exit-BYZ5yaSI.js.map
62
+ //# sourceMappingURL=unclean-exit-CwcUhFOn.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unclean-exit-BYZ5yaSI.js","names":["ALIVE_KEY","ALIVE_UPDATE_MS","readMarker","value","text","sessionId","at","visibility","UncleanExitCapture","ctx","marker","event"],"sources":["../src/capture/unclean-exit.ts"],"sourcesContent":["// src/capture/unclean-exit.ts\n//\n// Finds a page of this tab that stopped without a clean close, for example after a crash. The top\n// document keeps a marker in sessionStorage. A clean close removes it. The next page of the tab\n// reports a marker that it finds.\n\nimport { ALIVE_KEY, ALIVE_UPDATE_MS } from \"../constants\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Marker of a page that is alive. */\ninterface AliveMarker {\n /** Session id of the page. */\n sessionId: string;\n /** Epoch time in milliseconds of the last update. */\n at: number;\n /** Visibility of the page at the last update. */\n visibility: string;\n}\n\n/** Document with the flag of a page that the browser discarded to free memory. */\ninterface DiscardDocument {\n wasDiscarded?: boolean;\n}\n\n/**\n * Reads a marker from its sessionStorage text.\n * @param text Stored text, or null without a marker.\n * @returns The marker, or null for no marker or a marker of another shape.\n * @throws SyntaxError for text that is not JSON. The caller reports it.\n */\nfunction readMarker(text: string | null): AliveMarker | null {\n const value: unknown = text === null ? null : JSON.parse(text);\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n\n const { sessionId, at, visibility } = value as Partial<Record<keyof AliveMarker, unknown>>;\n const valid =\n typeof sessionId === \"string\" && Number.isFinite(at) && typeof visibility === \"string\";\n\n return valid ? { sessionId, at: at as number, visibility } : null;\n}\n\n/** Reports the unclean exit of the previous page, and keeps the marker of this page. */\nexport class UncleanExitCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"uncleanExit\";\n\n /** Prevents duplicate listener registration. */\n private installed = false;\n\n /** Timer that updates the marker. */\n private timer: ReturnType<typeof setInterval> | undefined;\n\n /** True after pagehide. The browser fires visibilitychange after pagehide. */\n private closing = false;\n\n /**\n * @param ctx Capture context with the config, diagnostics, logger and session id.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Reports the marker of the previous page one time. Then it keeps the marker of this page. */\n install(): void {\n // Only the top document keeps the marker. A same-origin frame shares its sessionStorage.\n if (this.installed || typeof document === \"undefined\" || window.parent !== window) {\n return;\n }\n\n // The marker holds the session id. Memory identity writes nothing to the device.\n if (this.ctx.config.identity === \"memory\") {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n 'capture.uncleanExit needs sessionStorage. identity: \"memory\" turns it off.',\n );\n return;\n }\n this.installed = true;\n\n if (!this.ctx.once.uncleanExit) {\n this.ctx.once.uncleanExit = true;\n // A popup copies the sessionStorage of its live opener. That marker is not a crash.\n if (!window.opener) {\n this.reportPrevious();\n }\n }\n\n this.mark();\n addEventListener(\"pagehide\", this.onPageHide);\n addEventListener(\"pageshow\", this.onPageShow);\n document.addEventListener(\"visibilitychange\", this.mark);\n this.timer = setInterval(this.mark, ALIVE_UPDATE_MS);\n }\n\n /** Removes the listeners, the timer and the marker. The capture stopped with no crash. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n removeEventListener(\"pagehide\", this.onPageHide);\n removeEventListener(\"pageshow\", this.onPageShow);\n document.removeEventListener(\"visibilitychange\", this.mark);\n clearInterval(this.timer);\n this.clear();\n }\n\n /** Logs WARN `ui.unclean_exit` when the previous page of this tab left its marker. */\n private reportPrevious(): void {\n const marker = this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not read the alive marker in sessionStorage.\",\n () => readMarker(sessionStorage.getItem(ALIVE_KEY)),\n );\n if (!marker) {\n return;\n }\n\n this.ctx.logger.warn(\"ui.unclean_exit\", {\n \"exit.session_id\": marker.sessionId,\n \"exit.last_seen_ms\": marker.at,\n \"exit.visibility\": marker.visibility,\n \"exit.discarded\": (document as DiscardDocument).wasDiscarded === true,\n });\n }\n\n /** Writes the marker of this page with the time and the visibility of now. */\n private readonly mark = (): void => {\n if (this.closing) {\n return;\n }\n\n const marker: AliveMarker = {\n sessionId: this.ctx.sessionId(),\n at: Date.now(),\n visibility: document.visibilityState,\n };\n\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not write the alive marker to sessionStorage.\",\n () => {\n sessionStorage.setItem(ALIVE_KEY, JSON.stringify(marker));\n },\n );\n };\n\n /** Removes the marker of this page. */\n private clear(): void {\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not remove the alive marker from sessionStorage.\",\n () => {\n sessionStorage.removeItem(ALIVE_KEY);\n },\n );\n }\n\n /** A clean close removes the marker. The back-forward cache can keep the page. */\n private readonly onPageHide = (): void => {\n this.closing = true;\n this.clear();\n };\n\n /** A page that comes back from the back-forward cache is alive again. */\n private readonly onPageShow = (event: Event): void => {\n if ((event as PageTransitionEvent).persisted) {\n this.closing = false;\n this.mark();\n }\n };\n}\n"],"mappings":";;AA8BA,SAASE,EAAW,GAAyC;CAC3D,IAAMC,IAAiBC,MAAS,OAAO,OAAO,KAAK,MAAMA,CAAI;CAC7D,IAAI,OAAOD,KAAU,aAAYA,GAC/B,OAAO;CAGT,IAAM,EAAE,cAAW,OAAI,kBAA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AAI,UAAU;GAC9B,IAAI,KAAK,IAAI;GACb,YAAY,SAAS;EACvB;EAEA,KAAK,IAAI,YAAY,MACnB,uBACA,yEACM;GACJ,eAAe,QAAQV,GAAW,KAAK,UAAUU,CAAM,CAAC;EAC1D,CACF;CACF;CAGA,QAAsB;EACpB,KAAK,IAAI,YAAY,MACnB,uBACA,4EACM;GACJ,eAAe,WAAWV,CAAS;EACrC,CACF;CACF;CAGA,mBAA0C;EAExC,AADA,KAAK,UAAU,IACf,KAAK,MAAM;CACb;CAGA,cAA+B,MAAuB;EACpD,AAAKW,EAA8B,cACjC,KAAK,UAAU,IACf,KAAK,KAAK;CAEd;AACF"}
1
+ {"version":3,"file":"unclean-exit-CwcUhFOn.js","names":["ALIVE_KEY","ALIVE_UPDATE_MS","readMarker","value","text","sessionId","at","visibility","UncleanExitCapture","ctx","marker","event"],"sources":["../src/capture/unclean-exit.ts"],"sourcesContent":["// src/capture/unclean-exit.ts\n//\n// Finds a page of this tab that stopped without a clean close, for example after a crash. The top\n// document keeps a marker in sessionStorage. A clean close removes it. The next page of the tab\n// reports a marker that it finds.\n\nimport { ALIVE_KEY, ALIVE_UPDATE_MS } from \"../constants\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Marker of a page that is alive. */\ninterface AliveMarker {\n /** Session id of the page. */\n sessionId: string;\n /** Epoch time in milliseconds of the last update. */\n at: number;\n /** Visibility of the page at the last update. */\n visibility: string;\n}\n\n/** Document with the flag of a page that the browser discarded to free memory. */\ninterface DiscardDocument {\n wasDiscarded?: boolean;\n}\n\n/**\n * Reads a marker from its sessionStorage text.\n * @param text Stored text, or null without a marker.\n * @returns The marker, or null for no marker or a marker of another shape.\n * @throws SyntaxError for text that is not JSON. The caller reports it.\n */\nfunction readMarker(text: string | null): AliveMarker | null {\n const value: unknown = text === null ? null : JSON.parse(text);\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n\n const { sessionId, at, visibility } = value as Partial<Record<keyof AliveMarker, unknown>>;\n const valid =\n typeof sessionId === \"string\" && Number.isFinite(at) && typeof visibility === \"string\";\n\n return valid ? { sessionId, at: at as number, visibility } : null;\n}\n\n/** Reports the unclean exit of the previous page, and keeps the marker of this page. */\nexport class UncleanExitCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"uncleanExit\";\n\n /** Prevents duplicate listener registration. */\n private installed = false;\n\n /** Timer that updates the marker. */\n private timer: ReturnType<typeof setInterval> | undefined;\n\n /** True after pagehide. The browser fires visibilitychange after pagehide. */\n private closing = false;\n\n /**\n * @param ctx Capture context with the config, diagnostics, logger and session id.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Reports the marker of the previous page one time. Then it keeps the marker of this page. */\n install(): void {\n // Only the top document keeps the marker. A same-origin frame shares its sessionStorage.\n if (this.installed || typeof document === \"undefined\" || window.parent !== window) {\n return;\n }\n\n // The marker holds the session id. Memory identity writes nothing to the device.\n if (this.ctx.config.identity === \"memory\") {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n 'capture.uncleanExit needs sessionStorage. identity: \"memory\" turns it off.',\n );\n return;\n }\n this.installed = true;\n\n if (!this.ctx.once.uncleanExit) {\n this.ctx.once.uncleanExit = true;\n // A popup copies the sessionStorage of its live opener. That marker is not a crash.\n if (!window.opener) {\n this.reportPrevious();\n }\n }\n\n this.mark();\n addEventListener(\"pagehide\", this.onPageHide);\n addEventListener(\"pageshow\", this.onPageShow);\n document.addEventListener(\"visibilitychange\", this.mark);\n this.timer = setInterval(this.mark, ALIVE_UPDATE_MS);\n }\n\n /** Removes the listeners, the timer and the marker. The capture stopped with no crash. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n removeEventListener(\"pagehide\", this.onPageHide);\n removeEventListener(\"pageshow\", this.onPageShow);\n document.removeEventListener(\"visibilitychange\", this.mark);\n clearInterval(this.timer);\n this.clear();\n }\n\n /** Logs WARN `ui.unclean_exit` when the previous page of this tab left its marker. */\n private reportPrevious(): void {\n const marker = this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not read the alive marker in sessionStorage.\",\n () => readMarker(sessionStorage.getItem(ALIVE_KEY)),\n );\n if (!marker) {\n return;\n }\n\n this.ctx.logger.warn(\"ui.unclean_exit\", {\n \"exit.session_id\": marker.sessionId,\n \"exit.last_seen_ms\": marker.at,\n \"exit.visibility\": marker.visibility,\n \"exit.discarded\": (document as DiscardDocument).wasDiscarded === true,\n });\n }\n\n /** Writes the marker of this page with the time and the visibility of now. */\n private readonly mark = (): void => {\n if (this.closing) {\n return;\n }\n\n const marker: AliveMarker = {\n sessionId: this.ctx.sessionId(),\n at: Date.now(),\n visibility: document.visibilityState,\n };\n\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not write the alive marker to sessionStorage.\",\n () => {\n sessionStorage.setItem(ALIVE_KEY, JSON.stringify(marker));\n },\n );\n };\n\n /** Removes the marker of this page. */\n private clear(): void {\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not remove the alive marker from sessionStorage.\",\n () => {\n sessionStorage.removeItem(ALIVE_KEY);\n },\n );\n }\n\n /** A clean close removes the marker. The back-forward cache can keep the page. */\n private readonly onPageHide = (): void => {\n this.closing = true;\n this.clear();\n };\n\n /** A page that comes back from the back-forward cache is alive again. */\n private readonly onPageShow = (event: Event): void => {\n if ((event as PageTransitionEvent).persisted) {\n this.closing = false;\n this.mark();\n }\n };\n}\n"],"mappings":";;AA8BA,SAASE,EAAW,GAAyC;CAC3D,IAAMC,IAAiBC,MAAS,OAAO,OAAO,KAAK,MAAMA,CAAI;CAC7D,IAAI,OAAOD,KAAU,aAAYA,GAC/B,OAAO;CAGT,IAAM,EAAE,cAAW,OAAI,kBAAeA;CAItC,OAFE,OAAOE,KAAc,YAAY,OAAO,SAASC,CAAE,KAAK,OAAOC,KAAe,WAEjE;EAAE;EAAe;EAAc;CAAW,IAAI;AAC/D;AAGA,IAAaC,IAAb,MAAmD;CAgBpB;CAd7B,OAAgB;CAGhB,YAAo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sB;EACpB,KAAK,IAAI,YAAY,MACnB,uBACA,4EACM;GACJ,eAAe,WAAWV,CAAS;EACrC,CACF;CACF;CAGA,mBAA0C;EAExC,AADA,KAAK,UAAU,IACf,KAAK,MAAM;CACb;CAGA,cAA+B,MAAuB;EACpD,AAAKW,EAA8B,cACjC,KAAK,UAAU,IACf,KAAK,KAAK;CAEd;AACF"}
@@ -1,2 +1,2 @@
1
- const e=require("./constants-CL0ZdI2f.cjs");function t(e){let t=e===null?null:JSON.parse(e);if(typeof t!=`object`||!t)return null;let{sessionId:n,at:r,visibility:i}=t;return typeof n==`string`&&Number.isFinite(r)&&typeof i==`string`?{sessionId:n,at:r,visibility:i}:null}var n=class{ctx;name=`uncleanExit`;installed=!1;timer;closing=!1;constructor(e){this.ctx=e}install(){this.installed||typeof document>`u`||window.parent!==window||(this.ctx.config.identity===`memory`?this.ctx.diagnostics.report(`capture.install_failed`,`capture.uncleanExit needs sessionStorage. identity: "memory" turns it off.`):(this.installed=!0,this.ctx.once.uncleanExit||(this.ctx.once.uncleanExit=!0,window.opener||this.reportPrevious()),this.mark(),addEventListener(`pagehide`,this.onPageHide),addEventListener(`pageshow`,this.onPageShow),document.addEventListener(`visibilitychange`,this.mark),this.timer=setInterval(this.mark,e.r)))}uninstall(){this.installed&&(this.installed=!1,removeEventListener(`pagehide`,this.onPageHide),removeEventListener(`pageshow`,this.onPageShow),document.removeEventListener(`visibilitychange`,this.mark),clearInterval(this.timer),this.clear())}reportPrevious(){let n=this.ctx.diagnostics.guard(`storage.unavailable`,`The library could not read the alive marker in sessionStorage.`,()=>t(sessionStorage.getItem(e.n)));n&&this.ctx.logger.warn(`ui.unclean_exit`,{"exit.session_id":n.sessionId,"exit.last_seen_ms":n.at,"exit.visibility":n.visibility,"exit.discarded":document.wasDiscarded===!0})}mark=()=>{if(this.closing)return;let t={sessionId:this.ctx.sessionId(),at:Date.now(),visibility:document.visibilityState};this.ctx.diagnostics.guard(`storage.unavailable`,`The library could not write the alive marker to sessionStorage.`,()=>{sessionStorage.setItem(e.n,JSON.stringify(t))})};clear(){this.ctx.diagnostics.guard(`storage.unavailable`,`The library could not remove the alive marker from sessionStorage.`,()=>{sessionStorage.removeItem(e.n)})}onPageHide=()=>{this.closing=!0,this.clear()};onPageShow=e=>{e.persisted&&(this.closing=!1,this.mark())}};exports.UncleanExitCapture=n;
2
- //# sourceMappingURL=unclean-exit-CwdpbUDg.cjs.map
1
+ const e=require("./constants-DqKJH_MP.cjs");function t(e){let t=e===null?null:JSON.parse(e);if(typeof t!=`object`||!t)return null;let{sessionId:n,at:r,visibility:i}=t;return typeof n==`string`&&Number.isFinite(r)&&typeof i==`string`?{sessionId:n,at:r,visibility:i}:null}var n=class{ctx;name=`uncleanExit`;installed=!1;timer;closing=!1;constructor(e){this.ctx=e}install(){this.installed||typeof document>`u`||window.parent!==window||(this.ctx.config.identity===`memory`?this.ctx.diagnostics.report(`capture.install_failed`,`capture.uncleanExit needs sessionStorage. identity: "memory" turns it off.`):(this.installed=!0,this.ctx.once.uncleanExit||(this.ctx.once.uncleanExit=!0,window.opener||this.reportPrevious()),this.mark(),addEventListener(`pagehide`,this.onPageHide),addEventListener(`pageshow`,this.onPageShow),document.addEventListener(`visibilitychange`,this.mark),this.timer=setInterval(this.mark,e.r)))}uninstall(){this.installed&&(this.installed=!1,removeEventListener(`pagehide`,this.onPageHide),removeEventListener(`pageshow`,this.onPageShow),document.removeEventListener(`visibilitychange`,this.mark),clearInterval(this.timer),this.clear())}reportPrevious(){let n=this.ctx.diagnostics.guard(`storage.unavailable`,`The library could not read the alive marker in sessionStorage.`,()=>t(sessionStorage.getItem(e.n)));n&&this.ctx.logger.warn(`ui.unclean_exit`,{"exit.session_id":n.sessionId,"exit.last_seen_ms":n.at,"exit.visibility":n.visibility,"exit.discarded":document.wasDiscarded===!0})}mark=()=>{if(this.closing)return;let t={sessionId:this.ctx.sessionId(),at:Date.now(),visibility:document.visibilityState};this.ctx.diagnostics.guard(`storage.unavailable`,`The library could not write the alive marker to sessionStorage.`,()=>{sessionStorage.setItem(e.n,JSON.stringify(t))})};clear(){this.ctx.diagnostics.guard(`storage.unavailable`,`The library could not remove the alive marker from sessionStorage.`,()=>{sessionStorage.removeItem(e.n)})}onPageHide=()=>{this.closing=!0,this.clear()};onPageShow=e=>{e.persisted&&(this.closing=!1,this.mark())}};exports.UncleanExitCapture=n;
2
+ //# sourceMappingURL=unclean-exit-DFUN57wY.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"unclean-exit-CwdpbUDg.cjs","names":["ALIVE_UPDATE_MS","ALIVE_KEY","require_constants","readMarker","value","text","sessionId","at","visibility","UncleanExitCapture","ctx","marker","event"],"sources":["../src/capture/unclean-exit.ts"],"sourcesContent":["// src/capture/unclean-exit.ts\n//\n// Finds a page of this tab that stopped without a clean close, for example after a crash. The top\n// document keeps a marker in sessionStorage. A clean close removes it. The next page of the tab\n// reports a marker that it finds.\n\nimport { ALIVE_KEY, ALIVE_UPDATE_MS } from \"../constants\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Marker of a page that is alive. */\ninterface AliveMarker {\n /** Session id of the page. */\n sessionId: string;\n /** Epoch time in milliseconds of the last update. */\n at: number;\n /** Visibility of the page at the last update. */\n visibility: string;\n}\n\n/** Document with the flag of a page that the browser discarded to free memory. */\ninterface DiscardDocument {\n wasDiscarded?: boolean;\n}\n\n/**\n * Reads a marker from its sessionStorage text.\n * @param text Stored text, or null without a marker.\n * @returns The marker, or null for no marker or a marker of another shape.\n * @throws SyntaxError for text that is not JSON. The caller reports it.\n */\nfunction readMarker(text: string | null): AliveMarker | null {\n const value: unknown = text === null ? null : JSON.parse(text);\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n\n const { sessionId, at, visibility } = value as Partial<Record<keyof AliveMarker, unknown>>;\n const valid =\n typeof sessionId === \"string\" && Number.isFinite(at) && typeof visibility === \"string\";\n\n return valid ? { sessionId, at: at as number, visibility } : null;\n}\n\n/** Reports the unclean exit of the previous page, and keeps the marker of this page. */\nexport class UncleanExitCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"uncleanExit\";\n\n /** Prevents duplicate listener registration. */\n private installed = false;\n\n /** Timer that updates the marker. */\n private timer: ReturnType<typeof setInterval> | undefined;\n\n /** True after pagehide. The browser fires visibilitychange after pagehide. */\n private closing = false;\n\n /**\n * @param ctx Capture context with the config, diagnostics, logger and session id.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Reports the marker of the previous page one time. Then it keeps the marker of this page. */\n install(): void {\n // Only the top document keeps the marker. A same-origin frame shares its sessionStorage.\n if (this.installed || typeof document === \"undefined\" || window.parent !== window) {\n return;\n }\n\n // The marker holds the session id. Memory identity writes nothing to the device.\n if (this.ctx.config.identity === \"memory\") {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n 'capture.uncleanExit needs sessionStorage. identity: \"memory\" turns it off.',\n );\n return;\n }\n this.installed = true;\n\n if (!this.ctx.once.uncleanExit) {\n this.ctx.once.uncleanExit = true;\n // A popup copies the sessionStorage of its live opener. That marker is not a crash.\n if (!window.opener) {\n this.reportPrevious();\n }\n }\n\n this.mark();\n addEventListener(\"pagehide\", this.onPageHide);\n addEventListener(\"pageshow\", this.onPageShow);\n document.addEventListener(\"visibilitychange\", this.mark);\n this.timer = setInterval(this.mark, ALIVE_UPDATE_MS);\n }\n\n /** Removes the listeners, the timer and the marker. The capture stopped with no crash. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n removeEventListener(\"pagehide\", this.onPageHide);\n removeEventListener(\"pageshow\", this.onPageShow);\n document.removeEventListener(\"visibilitychange\", this.mark);\n clearInterval(this.timer);\n this.clear();\n }\n\n /** Logs WARN `ui.unclean_exit` when the previous page of this tab left its marker. */\n private reportPrevious(): void {\n const marker = this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not read the alive marker in sessionStorage.\",\n () => readMarker(sessionStorage.getItem(ALIVE_KEY)),\n );\n if (!marker) {\n return;\n }\n\n this.ctx.logger.warn(\"ui.unclean_exit\", {\n \"exit.session_id\": marker.sessionId,\n \"exit.last_seen_ms\": marker.at,\n \"exit.visibility\": marker.visibility,\n \"exit.discarded\": (document as DiscardDocument).wasDiscarded === true,\n });\n }\n\n /** Writes the marker of this page with the time and the visibility of now. */\n private readonly mark = (): void => {\n if (this.closing) {\n return;\n }\n\n const marker: AliveMarker = {\n sessionId: this.ctx.sessionId(),\n at: Date.now(),\n visibility: document.visibilityState,\n };\n\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not write the alive marker to sessionStorage.\",\n () => {\n sessionStorage.setItem(ALIVE_KEY, JSON.stringify(marker));\n },\n );\n };\n\n /** Removes the marker of this page. */\n private clear(): void {\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not remove the alive marker from sessionStorage.\",\n () => {\n sessionStorage.removeItem(ALIVE_KEY);\n },\n );\n }\n\n /** A clean close removes the marker. The back-forward cache can keep the page. */\n private readonly onPageHide = (): void => {\n this.closing = true;\n this.clear();\n };\n\n /** A page that comes back from the back-forward cache is alive again. */\n private readonly onPageShow = (event: Event): void => {\n if ((event as PageTransitionEvent).persisted) {\n this.closing = false;\n this.mark();\n }\n };\n}\n"],"mappings":"4CA8BA,SAASG,EAAW,EAAyC,CAC3D,IAAMC,EAAiBC,IAAS,KAAO,KAAO,KAAK,MAAMA,CAAI,EAC7D,GAAI,OAAOD,GAAU,WAAYA,EAC/B,OAAO,KAGT,GAAM,CAAE,YAAW,KAAI,cAAeA,EAItC,OAFE,OAAOE,GAAc,UAAY,OAAO,SAASC,CAAE,GAAK,OAAOC,GAAe,SAEjE,CAAE,YAAe,KAAc,YAAW,EAAI,IAC/D,CAGA,IAAaC,EAAb,KAAmD,CAgBpB,IAd7B,KAAgB,cAGhB,UAAoB,GAGpB,MAGA,QAAkB,GAKlB,YAAY,EAAsC,CAArB,KAAA,IAAAC,CAAsB,CAGnD,SAAgB,CAEV,KAAK,WAAa,OAAO,SAAa,KAAe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QAAU,GACf,KAAK,MAAM,CACb,EAGA,WAA+B,GAAuB,CAC/CW,EAA8B,YACjC,KAAK,QAAU,GACf,KAAK,KAAK,EAEd,CACF"}
1
+ {"version":3,"file":"unclean-exit-DFUN57wY.cjs","names":["ALIVE_UPDATE_MS","ALIVE_KEY","require_constants","readMarker","value","text","sessionId","at","visibility","UncleanExitCapture","ctx","marker","event"],"sources":["../src/capture/unclean-exit.ts"],"sourcesContent":["// src/capture/unclean-exit.ts\n//\n// Finds a page of this tab that stopped without a clean close, for example after a crash. The top\n// document keeps a marker in sessionStorage. A clean close removes it. The next page of the tab\n// reports a marker that it finds.\n\nimport { ALIVE_KEY, ALIVE_UPDATE_MS } from \"../constants\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Marker of a page that is alive. */\ninterface AliveMarker {\n /** Session id of the page. */\n sessionId: string;\n /** Epoch time in milliseconds of the last update. */\n at: number;\n /** Visibility of the page at the last update. */\n visibility: string;\n}\n\n/** Document with the flag of a page that the browser discarded to free memory. */\ninterface DiscardDocument {\n wasDiscarded?: boolean;\n}\n\n/**\n * Reads a marker from its sessionStorage text.\n * @param text Stored text, or null without a marker.\n * @returns The marker, or null for no marker or a marker of another shape.\n * @throws SyntaxError for text that is not JSON. The caller reports it.\n */\nfunction readMarker(text: string | null): AliveMarker | null {\n const value: unknown = text === null ? null : JSON.parse(text);\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n\n const { sessionId, at, visibility } = value as Partial<Record<keyof AliveMarker, unknown>>;\n const valid =\n typeof sessionId === \"string\" && Number.isFinite(at) && typeof visibility === \"string\";\n\n return valid ? { sessionId, at: at as number, visibility } : null;\n}\n\n/** Reports the unclean exit of the previous page, and keeps the marker of this page. */\nexport class UncleanExitCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"uncleanExit\";\n\n /** Prevents duplicate listener registration. */\n private installed = false;\n\n /** Timer that updates the marker. */\n private timer: ReturnType<typeof setInterval> | undefined;\n\n /** True after pagehide. The browser fires visibilitychange after pagehide. */\n private closing = false;\n\n /**\n * @param ctx Capture context with the config, diagnostics, logger and session id.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Reports the marker of the previous page one time. Then it keeps the marker of this page. */\n install(): void {\n // Only the top document keeps the marker. A same-origin frame shares its sessionStorage.\n if (this.installed || typeof document === \"undefined\" || window.parent !== window) {\n return;\n }\n\n // The marker holds the session id. Memory identity writes nothing to the device.\n if (this.ctx.config.identity === \"memory\") {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n 'capture.uncleanExit needs sessionStorage. identity: \"memory\" turns it off.',\n );\n return;\n }\n this.installed = true;\n\n if (!this.ctx.once.uncleanExit) {\n this.ctx.once.uncleanExit = true;\n // A popup copies the sessionStorage of its live opener. That marker is not a crash.\n if (!window.opener) {\n this.reportPrevious();\n }\n }\n\n this.mark();\n addEventListener(\"pagehide\", this.onPageHide);\n addEventListener(\"pageshow\", this.onPageShow);\n document.addEventListener(\"visibilitychange\", this.mark);\n this.timer = setInterval(this.mark, ALIVE_UPDATE_MS);\n }\n\n /** Removes the listeners, the timer and the marker. The capture stopped with no crash. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n removeEventListener(\"pagehide\", this.onPageHide);\n removeEventListener(\"pageshow\", this.onPageShow);\n document.removeEventListener(\"visibilitychange\", this.mark);\n clearInterval(this.timer);\n this.clear();\n }\n\n /** Logs WARN `ui.unclean_exit` when the previous page of this tab left its marker. */\n private reportPrevious(): void {\n const marker = this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not read the alive marker in sessionStorage.\",\n () => readMarker(sessionStorage.getItem(ALIVE_KEY)),\n );\n if (!marker) {\n return;\n }\n\n this.ctx.logger.warn(\"ui.unclean_exit\", {\n \"exit.session_id\": marker.sessionId,\n \"exit.last_seen_ms\": marker.at,\n \"exit.visibility\": marker.visibility,\n \"exit.discarded\": (document as DiscardDocument).wasDiscarded === true,\n });\n }\n\n /** Writes the marker of this page with the time and the visibility of now. */\n private readonly mark = (): void => {\n if (this.closing) {\n return;\n }\n\n const marker: AliveMarker = {\n sessionId: this.ctx.sessionId(),\n at: Date.now(),\n visibility: document.visibilityState,\n };\n\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not write the alive marker to sessionStorage.\",\n () => {\n sessionStorage.setItem(ALIVE_KEY, JSON.stringify(marker));\n },\n );\n };\n\n /** Removes the marker of this page. */\n private clear(): void {\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not remove the alive marker from sessionStorage.\",\n () => {\n sessionStorage.removeItem(ALIVE_KEY);\n },\n );\n }\n\n /** A clean close removes the marker. The back-forward cache can keep the page. */\n private readonly onPageHide = (): void => {\n this.closing = true;\n this.clear();\n };\n\n /** A page that comes back from the back-forward cache is alive again. */\n private readonly onPageShow = (event: Event): void => {\n if ((event as PageTransitionEvent).persisted) {\n this.closing = false;\n this.mark();\n }\n };\n}\n"],"mappings":"A,4CA8BA,SAASG,EAAW,EAAyC,CAC3D,IAAMC,EAAiBC,IAAS,KAAO,KAAO,KAAK,MAAMA,CAAI,EAC7D,GAAI,OAAOD,GAAU,WAAYA,EAC/B,OAAO,KAGT,GAAM,CAAE,YAAW,KAAI,cAAeA,EAItC,OAFE,OAAOE,GAAc,UAAY,OAAO,SAASC,CAAE,GAAK,OAAOC,GAAe,SAEjE,CAAE,YAAe,KAAc,YAAW,EAAI,IAC/D,CAGA,IAAaC,EAAb,KAAmD,CAgBpB,IAd7B,KAAgB,cAGhB,UAAoB,GAGpB,MAGA,QAAkB,GAKlB,YAAY,EAAsC,CAArB,KAAA,IAAAC,CAAsB,CAGnD,SAAgB,CAEV,KAAK,WAAa,OAAO,SAAa,KAAe,OAAO,SAAW,SAKvE,KAAK,IAAI,OAAO,WAAa,SAC/B,KAAK,IAAI,YAAY,OACnB,yBACA,4EACF,GAGF,KAAK,UAAY,GAEZ,KAAK,IAAI,KAAK,cACjB,KAAK,IAAI,KAAK,YAAc,GAEvB,OAAO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C7WNpnG1.cjs");var n={name:`ui.user_timing.duration`,kind:`histogram`,unit:`ms`,boundaries:[1,5,10,25,50,100,250,500,1e3,2500,5e3,1e4]},r=class{ctx;name=`userTiming`;observer;constructor(e){this.ctx=e}install(){if(this.observer)return;let{once:e}=this.ctx,t=!e.userTiming;e.userTiming=!0;let n=typeof PerformanceObserver>`u`?void 0:PerformanceObserver.supportedEntryTypes;n?.includes(`measure`)?(this.observer=new PerformanceObserver(e=>{this.record(e.getEntries())}),this.observer.observe({type:`measure`,buffered:t}),n.includes(`mark`)&&this.observer.observe({type:`mark`,buffered:t})):t&&this.ctx.diagnostics.report(`capture.install_failed`,`The browser does not report User Timing entries. The user timing capture is off.`)}uninstall(){this.observer?.disconnect(),this.observer=void 0}record(r){if(this.ctx.isActive?.()===!1)return;let{fullUrls:i,userTimingInclude:a}=this.ctx.config.capture;for(let o of r){if(a.length>0&&!t.t(o.name,a))continue;let r=e.i(o.name,i);o.entryType===`measure`?this.ctx.recordMetric(n,o.duration,{"user_timing.name":r}):this.ctx.breadcrumbs.push({t:Math.round(performance.timeOrigin+o.startTime),category:`event`,message:r.slice(0,this.ctx.config.limits.maxBodyChars)})}}};exports.UserTimingCapture=r;
2
- //# sourceMappingURL=user-timing-C1kB3JEg.cjs.map
1
+ const e=require("./platform-C2Ez5kDc.cjs"),t=require("./types-C7WNpnG1.cjs");var n={name:`ui.user_timing.duration`,kind:`histogram`,unit:`ms`,boundaries:[1,5,10,25,50,100,250,500,1e3,2500,5e3,1e4]},r=class{ctx;name=`userTiming`;observer;constructor(e){this.ctx=e}install(){if(this.observer)return;let{once:e}=this.ctx,t=!e.userTiming;e.userTiming=!0;let n=typeof PerformanceObserver>`u`?void 0:PerformanceObserver.supportedEntryTypes;n?.includes(`measure`)?(this.observer=new PerformanceObserver(e=>{this.record(e.getEntries())}),this.observer.observe({type:`measure`,buffered:t}),n.includes(`mark`)&&this.observer.observe({type:`mark`,buffered:t})):t&&this.ctx.diagnostics.report(`capture.install_failed`,`The browser does not report User Timing entries. The user timing capture is off.`)}uninstall(){this.observer?.disconnect(),this.observer=void 0}record(r){if(this.ctx.isActive?.()===!1)return;let{fullUrls:i,userTimingInclude:a}=this.ctx.config.capture;for(let o of r){if(a.length>0&&!t.t(o.name,a))continue;let r=e.i(o.name,i);o.entryType===`measure`?this.ctx.recordMetric(n,o.duration,{"user_timing.name":r}):this.ctx.breadcrumbs.push({t:Math.round(performance.timeOrigin+o.startTime),category:`event`,message:r.slice(0,this.ctx.config.limits.maxBodyChars)})}}};exports.UserTimingCapture=r;
2
+ //# sourceMappingURL=user-timing-C9kfRq3J.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"user-timing-C1kB3JEg.cjs","names":["matchesAny","recordedUrl","require_platform","require_types","USER_TIMING_DURATION","UserTimingCapture","ctx","first","once","supported","list","entry","entries","userTimingInclude","name","fullUrls"],"sources":["../src/capture/user-timing.ts"],"sourcesContent":["// src/capture/user-timing.ts\n//\n// Records the marks and measures of the app from the User Timing API. A measure goes into a\n// histogram. A mark adds a breadcrumb.\n\nimport type { InstrumentDef } from \"../models/metric\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { type Capture, type CaptureContext, matchesAny } from \"./types\";\n\n/** Histogram of the measures of the app, in milliseconds. */\nconst USER_TIMING_DURATION: InstrumentDef = {\n name: \"ui.user_timing.duration\",\n kind: \"histogram\",\n unit: \"ms\",\n boundaries: [1, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000],\n};\n\n/** Observes the marks and measures of the app. */\nexport class UserTimingCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"userTiming\";\n\n /** Observer of the mark and measure entries. */\n private observer: PerformanceObserver | undefined;\n\n /**\n * @param ctx Capture context with the config, the meter and the breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Observes marks and measures. Only the first install in a document reads buffered entries. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n const { once } = this.ctx;\n const first = !once.userTiming;\n once.userTiming = true;\n\n // Older browsers have no supportedEntryTypes. The capture is then off.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n if (!supported?.includes(\"measure\")) {\n if (first) {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report User Timing entries. The user timing capture is off.\",\n );\n }\n return;\n }\n\n this.observer = new PerformanceObserver((list) => {\n this.record(list.getEntries());\n });\n // Buffered entries include the marks and measures before this chunk loads.\n this.observer.observe({ type: \"measure\", buffered: first });\n if (supported.includes(\"mark\")) {\n this.observer.observe({ type: \"mark\", buffered: first });\n }\n }\n\n /** Disconnects the observer. */\n uninstall(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n /**\n * Records the entries with a name that `userTimingInclude` selects.\n * @param entries Mark and measure entries.\n */\n private record(entries: PerformanceEntryList): void {\n if (this.ctx.isActive?.() === false) {\n return;\n }\n\n const { fullUrls, userTimingInclude } = this.ctx.config.capture;\n for (const entry of entries) {\n if (userTimingInclude.length > 0 && !matchesAny(entry.name, userTimingInclude)) {\n continue;\n }\n\n // A name can hold a URL with a token. A third-party script can write any name.\n const name = recordedUrl(entry.name, fullUrls);\n if (entry.entryType === \"measure\") {\n this.ctx.recordMetric(USER_TIMING_DURATION, entry.duration, { \"user_timing.name\": name });\n } else {\n this.ctx.breadcrumbs.push({\n // A buffered entry reaches the observer late. The trail needs the time of the mark.\n t: Math.round(performance.timeOrigin + entry.startTime),\n category: \"event\",\n message: name.slice(0, this.ctx.config.limits.maxBodyChars),\n });\n }\n }\n }\n}\n"],"mappings":"6EAUA,IAAMI,EAAsC,CAC1C,KAAM,0BACN,KAAM,YACN,KAAM,KACN,WAAY,CAAC,EAAG,EAAG,GAAI,GAAI,GAAI,IAAK,IAAK,IAAK,IAAM,KAAM,IAAM,GAAK,CACvE,EAGaC,EAAb,KAAkD,CAUnB,IAR7B,KAAgB,aAGhB,SAKA,YAAY,EAAsC,CAArB,KAAA,IAAAC,CAAsB,CAGnD,SAAgB,CACd,GAAI,KAAK,SACP,OAGF,GAAM,CAAE,QAAS,KAAK,IAChBC,EAAQ,CAACC,EAAK,WACpB,EAAK,WAAa,GAGlB,IAAMC,EACJ,OAAO,oBAAwB,IAC3B,IAAA,GACA,oBAAoB,oBACrBA,GAAW,SAAS,SAAS,GAUlC,KAAK,SAAW,IAAI,oBAAqB,GAAS,CAChD,KAAK,OAAOC,EAAK,WAAW,CAAC,CAC/B,CAAC,EAED,KAAK,SAAS,QAAQ,CAAE,KAAM,UAAW,SAAUH,CAAM,CAAC,EACtDE,EAAU,SAAS,MAAM,GAC3B,KAAK,SAAS,QAAQ,CAAE,KAAM,OAAQ,SAAUF,CAAM,CAAC,GAfnDA,GACF,KAAK,IAAI,YAAY,OACnB,yBACA,kFACF,CAaN,CAGA,WAAkB,CAChB,KAAK,UAAU,WAAW,EAC1B,KAAK,SAAW,IAAA,EAClB,CAMA,OAAe,EAAqC,CAClD,GAAI,KAAK,IAAI,WAAW,IAAM,GAC5B,OAGF,GAAM,CAAE,WAAU,qBAAsB,KAAK,IAAI,OAAO,QACxD,IAAK,IAAMI,KAASC,EAAS,CAC3B,GAAIC,EAAkB,OAAS,GAAK,CAACb,EAAAA,EAAWW,EAAM,KAAME,CAAiB,EAC3E,SAIF,IAAMC,EAAOb,EAAAA,EAAYU,EAAM,KAAMI,CAAQ,EACzCJ,EAAM,YAAc,UACtB,KAAK,IAAI,aAAaP,EAAsBO,EAAM,SAAU,CAAE,mBAAoBG,CAAK,CAAC,EAExF,KAAK,IAAI,YAAY,KAAK,CAExB,EAAG,KAAK,MAAM,YAAY,WAAaH,EAAM,SAAS,EACtD,SAAU,QACV,QAASG,EAAK,MAAM,EAAG,KAAK,IAAI,OAAO,OAAO,YAAY,CAC5D,CAAC,CAEL,CACF,CACF"}
1
+ {"version":3,"file":"user-timing-C9kfRq3J.cjs","names":["matchesAny","recordedUrl","require_platform","require_types","USER_TIMING_DURATION","UserTimingCapture","ctx","first","once","supported","list","entry","entries","userTimingInclude","name","fullUrls"],"sources":["../src/capture/user-timing.ts"],"sourcesContent":["// src/capture/user-timing.ts\n//\n// Records the marks and measures of the app from the User Timing API. A measure goes into a\n// histogram. A mark adds a breadcrumb.\n\nimport type { InstrumentDef } from \"../models/metric\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { type Capture, type CaptureContext, matchesAny } from \"./types\";\n\n/** Histogram of the measures of the app, in milliseconds. */\nconst USER_TIMING_DURATION: InstrumentDef = {\n name: \"ui.user_timing.duration\",\n kind: \"histogram\",\n unit: \"ms\",\n boundaries: [1, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000],\n};\n\n/** Observes the marks and measures of the app. */\nexport class UserTimingCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"userTiming\";\n\n /** Observer of the mark and measure entries. */\n private observer: PerformanceObserver | undefined;\n\n /**\n * @param ctx Capture context with the config, the meter and the breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Observes marks and measures. Only the first install in a document reads buffered entries. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n const { once } = this.ctx;\n const first = !once.userTiming;\n once.userTiming = true;\n\n // Older browsers have no supportedEntryTypes. The capture is then off.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n if (!supported?.includes(\"measure\")) {\n if (first) {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report User Timing entries. The user timing capture is off.\",\n );\n }\n return;\n }\n\n this.observer = new PerformanceObserver((list) => {\n this.record(list.getEntries());\n });\n // Buffered entries include the marks and measures before this chunk loads.\n this.observer.observe({ type: \"measure\", buffered: first });\n if (supported.includes(\"mark\")) {\n this.observer.observe({ type: \"mark\", buffered: first });\n }\n }\n\n /** Disconnects the observer. */\n uninstall(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n /**\n * Records the entries with a name that `userTimingInclude` selects.\n * @param entries Mark and measure entries.\n */\n private record(entries: PerformanceEntryList): void {\n if (this.ctx.isActive?.() === false) {\n return;\n }\n\n const { fullUrls, userTimingInclude } = this.ctx.config.capture;\n for (const entry of entries) {\n if (userTimingInclude.length > 0 && !matchesAny(entry.name, userTimingInclude)) {\n continue;\n }\n\n // A name can hold a URL with a token. A third-party script can write any name.\n const name = recordedUrl(entry.name, fullUrls);\n if (entry.entryType === \"measure\") {\n this.ctx.recordMetric(USER_TIMING_DURATION, entry.duration, { \"user_timing.name\": name });\n } else {\n this.ctx.breadcrumbs.push({\n // A buffered entry reaches the observer late. The trail needs the time of the mark.\n t: Math.round(performance.timeOrigin + entry.startTime),\n category: \"event\",\n message: name.slice(0, this.ctx.config.limits.maxBodyChars),\n });\n }\n }\n }\n}\n"],"mappings":"A,6EAUA,IAAMI,EAAsC,CAC1C,KAAM,0BACN,KAAM,YACN,KAAM,KACN,WAAY,CAAC,EAAG,EAAG,GAAI,GAAI,GAAI,IAAK,IAAK,IAAK,IAAM,KAAM,IAAM,GAAK,CACvE,EAGaC,EAAb,KAAkD,CAUnB,IAR7B,KAAgB,aAGhB,SAKA,YAAY,EAAsC,CAArB,KAAA,IAAAC,CAAsB,CAGnD,SAAgB,CACd,GAAI,KAAK,SACP,OAGF,GAAM,CAAE,QAAS,KAAK,IAChBC,EAAQ,CAACC,EAAK,WACpB,EAAK,WAAa,GAGlB,IAAMC,EACJ,OAAO,oBAAwB,IAC3B,IAAA,GACA,oBAAoB,oBACrBA,GAAW,SAAS,SAAS,GAUlC,KAAK,SAAW,IAAI,oBAAqB,GAAS,CAChD,KAAK,OAAOC,EAAK,WAAW,CAAC,CAC/B,CAAC,EAED,KAAK,SAAS,QAAQ,CAAE,KAAM,UAAW,SAAUH,CAAM,CAAC,EACtDE,EAAU,SAAS,MAAM,GAC3B,KAAK,SAAS,QAAQ,CAAE,KAAM,OAAQ,SAAUF,CAAM,CAAC,GAfnDA,GACF,KAAK,IAAI,YAAY,OACnB,yBACA,kFACF,CAaN,CAGA,WAAkB,CAChB,KAAK,UAAU,WAAW,EAC1B,KAAK,SAAW,IAAA,EAClB,CAMA,OAAe,EAAqC,CAClD,GAAI,KAAK,IAAI,WAAW,IAAM,GAC5B,OAGF,GAAM,CAAE,WAAU,qBAAsB,KAAK,IAAI,OAAO,QACxD,IAAK,IAAMI,KAASC,EAAS,CAC3B,GAAIC,EAAkB,OAAS,GAAK,CAACb,EAAAA,EAAWW,EAAM,KAAME,CAAiB,EAC3E,SAIF,IAAMC,EAAOb,EAAAA,EAAYU,EAAM,KAAMI,CAAQ,EACzCJ,EAAM,YAAc,UACtB,KAAK,IAAI,aAAaP,EAAsBO,EAAM,SAAU,CAAE,mBAAoBG,CAAK,CAAC,EAExF,KAAK,IAAI,YAAY,KAAK,CAExB,EAAG,KAAK,MAAM,YAAY,WAAaH,EAAM,SAAS,EACtD,SAAU,QACV,QAASG,EAAK,MAAM,EAAG,KAAK,IAAI,OAAO,OAAO,YAAY,CAC5D,CAAC,CAEL,CACF,CACF,E"}
@@ -1,6 +1,6 @@
1
- import { i as e } from "./platform-wcAkkv9F.js";
2
- import { t } from "./types-BR9t_w28.js";
3
- //#region src/capture/user-timing.ts
1
+ import { i as e } from "./platform-DkcuXwe-.js";
2
+ import { t } from "./types-BAerHgCq.js";
3
+ // src/capture/user-timing.ts
4
4
  var n = {
5
5
  name: "ui.user_timing.duration",
6
6
  kind: "histogram",
@@ -58,7 +58,6 @@ var n = {
58
58
  }
59
59
  }
60
60
  };
61
- //#endregion
62
61
  export { r as UserTimingCapture };
63
62
 
64
- //# sourceMappingURL=user-timing-Di2ra5DB.js.map
63
+ //# sourceMappingURL=user-timing-_jZIhDKI.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"user-timing-Di2ra5DB.js","names":["recordedUrl","USER_TIMING_DURATION","UserTimingCapture","ctx","first","once","supported","list","entry","entries","userTimingInclude","matchesAny","name","fullUrls"],"sources":["../src/capture/user-timing.ts"],"sourcesContent":["// src/capture/user-timing.ts\n//\n// Records the marks and measures of the app from the User Timing API. A measure goes into a\n// histogram. A mark adds a breadcrumb.\n\nimport type { InstrumentDef } from \"../models/metric\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { type Capture, type CaptureContext, matchesAny } from \"./types\";\n\n/** Histogram of the measures of the app, in milliseconds. */\nconst USER_TIMING_DURATION: InstrumentDef = {\n name: \"ui.user_timing.duration\",\n kind: \"histogram\",\n unit: \"ms\",\n boundaries: [1, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000],\n};\n\n/** Observes the marks and measures of the app. */\nexport class UserTimingCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"userTiming\";\n\n /** Observer of the mark and measure entries. */\n private observer: PerformanceObserver | undefined;\n\n /**\n * @param ctx Capture context with the config, the meter and the breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Observes marks and measures. Only the first install in a document reads buffered entries. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n const { once } = this.ctx;\n const first = !once.userTiming;\n once.userTiming = true;\n\n // Older browsers have no supportedEntryTypes. The capture is then off.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n if (!supported?.includes(\"measure\")) {\n if (first) {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report User Timing entries. The user timing capture is off.\",\n );\n }\n return;\n }\n\n this.observer = new PerformanceObserver((list) => {\n this.record(list.getEntries());\n });\n // Buffered entries include the marks and measures before this chunk loads.\n this.observer.observe({ type: \"measure\", buffered: first });\n if (supported.includes(\"mark\")) {\n this.observer.observe({ type: \"mark\", buffered: first });\n }\n }\n\n /** Disconnects the observer. */\n uninstall(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n /**\n * Records the entries with a name that `userTimingInclude` selects.\n * @param entries Mark and measure entries.\n */\n private record(entries: PerformanceEntryList): void {\n if (this.ctx.isActive?.() === false) {\n return;\n }\n\n const { fullUrls, userTimingInclude } = this.ctx.config.capture;\n for (const entry of entries) {\n if (userTimingInclude.length > 0 && !matchesAny(entry.name, userTimingInclude)) {\n continue;\n }\n\n // A name can hold a URL with a token. A third-party script can write any name.\n const name = recordedUrl(entry.name, fullUrls);\n if (entry.entryType === \"measure\") {\n this.ctx.recordMetric(USER_TIMING_DURATION, entry.duration, { \"user_timing.name\": name });\n } else {\n this.ctx.breadcrumbs.push({\n // A buffered entry reaches the observer late. The trail needs the time of the mark.\n t: Math.round(performance.timeOrigin + entry.startTime),\n category: \"event\",\n message: name.slice(0, this.ctx.config.limits.maxBodyChars),\n });\n }\n }\n }\n}\n"],"mappings":";;;AAUA,IAAMC,IAAsC;CAC1C,MAAM;CACN,MAAM;CACN,MAAM;CACN,YAAY;EAAC;EAAG;EAAG;EAAI;EAAI;EAAI;EAAK;EAAK;EAAK;EAAM;EAAM;EAAM;CAAK;AACvE,GAGaC,IAAb,MAAkD;CAUnB;CAR7B,OAAgB;CAGhB;CAKA,YAAY,GAAsC;EAArB,KAAA,MAAAC;CAAsB;CAGnD,UAAgB;EACd,IAAI,KAAK,UACP;EAGF,IAAM,EAAE,YAAS,KAAK,KAChBC,IAAQ,CAACC,EAAK;EACpB,EAAK,aAAa;EAGlB,IAAMC,IACJ,OAAO,sBAAwB,MAC3B,KAAA,IACA,oBAAoB;EAC1B,AAAKA,GAAW,SAAS,SAAS,KAUlC,KAAK,WAAW,IAAI,qBAAqB,MAAS;GAChD,KAAK,OAAOC,EAAK,WAAW,CAAC;EAC/B,CAAC,GAED,KAAK,SAAS,QAAQ;GAAE,MAAM;GAAW,UAAUH;EAAM,CAAC,GACtDE,EAAU,SAAS,MAAM,KAC3B,KAAK,SAAS,QAAQ;GAAE,MAAM;GAAQ,UAAUF;EAAM,CAAC,KAfnDA,KACF,KAAK,IAAI,YAAY,OACnB,0BACA,kFACF;CAaN;CAGA,YAAkB;EAEhB,AADA,KAAK,UAAU,WAAW,GAC1B,KAAK,WAAW,KAAA;CAClB;CAMA,OAAe,GAAqC;EAClD,IAAI,KAAK,IAAI,WAAW,MAAM,IAC5B;EAGF,IAAM,EAAE,aAAU,yBAAsB,KAAK,IAAI,OAAO;EACxD,KAAK,IAAMI,KAASC,GAAS;GAC3B,IAAIC,EAAkB,SAAS,KAAK,CAACC,EAAWH,EAAM,MAAME,CAAiB,GAC3E;GAIF,IAAME,IAAOZ,EAAYQ,EAAM,MAAMK,CAAQ;GAC7C,AAAIL,EAAM,cAAc,YACtB,KAAK,IAAI,aAAaP,GAAsBO,EAAM,UAAU,EAAE,oBAAoBI,EAAK,CAAC,IAExF,KAAK,IAAI,YAAY,KAAK;IAExB,GAAG,KAAK,MAAM,YAAY,aAAaJ,EAAM,SAAS;IACtD,UAAU;IACV,SAASI,EAAK,MAAM,GAAG,KAAK,IAAI,OAAO,OAAO,YAAY;GAC5D,CAAC;EAEL;CACF;AACF"}
1
+ {"version":3,"file":"user-timing-_jZIhDKI.js","names":["recordedUrl","USER_TIMING_DURATION","UserTimingCapture","ctx","first","once","supported","list","entry","entries","userTimingInclude","matchesAny","name","fullUrls"],"sources":["../src/capture/user-timing.ts"],"sourcesContent":["// src/capture/user-timing.ts\n//\n// Records the marks and measures of the app from the User Timing API. A measure goes into a\n// histogram. A mark adds a breadcrumb.\n\nimport type { InstrumentDef } from \"../models/metric\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { type Capture, type CaptureContext, matchesAny } from \"./types\";\n\n/** Histogram of the measures of the app, in milliseconds. */\nconst USER_TIMING_DURATION: InstrumentDef = {\n name: \"ui.user_timing.duration\",\n kind: \"histogram\",\n unit: \"ms\",\n boundaries: [1, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000],\n};\n\n/** Observes the marks and measures of the app. */\nexport class UserTimingCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"userTiming\";\n\n /** Observer of the mark and measure entries. */\n private observer: PerformanceObserver | undefined;\n\n /**\n * @param ctx Capture context with the config, the meter and the breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Observes marks and measures. Only the first install in a document reads buffered entries. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n const { once } = this.ctx;\n const first = !once.userTiming;\n once.userTiming = true;\n\n // Older browsers have no supportedEntryTypes. The capture is then off.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n if (!supported?.includes(\"measure\")) {\n if (first) {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report User Timing entries. The user timing capture is off.\",\n );\n }\n return;\n }\n\n this.observer = new PerformanceObserver((list) => {\n this.record(list.getEntries());\n });\n // Buffered entries include the marks and measures before this chunk loads.\n this.observer.observe({ type: \"measure\", buffered: first });\n if (supported.includes(\"mark\")) {\n this.observer.observe({ type: \"mark\", buffered: first });\n }\n }\n\n /** Disconnects the observer. */\n uninstall(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n /**\n * Records the entries with a name that `userTimingInclude` selects.\n * @param entries Mark and measure entries.\n */\n private record(entries: PerformanceEntryList): void {\n if (this.ctx.isActive?.() === false) {\n return;\n }\n\n const { fullUrls, userTimingInclude } = this.ctx.config.capture;\n for (const entry of entries) {\n if (userTimingInclude.length > 0 && !matchesAny(entry.name, userTimingInclude)) {\n continue;\n }\n\n // A name can hold a URL with a token. A third-party script can write any name.\n const name = recordedUrl(entry.name, fullUrls);\n if (entry.entryType === \"measure\") {\n this.ctx.recordMetric(USER_TIMING_DURATION, entry.duration, { \"user_timing.name\": name });\n } else {\n this.ctx.breadcrumbs.push({\n // A buffered entry reaches the observer late. The trail needs the time of the mark.\n t: Math.round(performance.timeOrigin + entry.startTime),\n category: \"event\",\n message: name.slice(0, this.ctx.config.limits.maxBodyChars),\n });\n }\n }\n }\n}\n"],"mappings":";;;AAUA,IAAMC,IAAsC;CAC1C,MAAM;CACN,MAAM;CACN,MAAM;CACN,YAAY;EAAC;EAAG;EAAG;EA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AI,OAAO,OAAO,YAAY;GAC5D,CAAC;EAEL;CACF;AACF"}
@@ -1,2 +1,2 @@
1
- const e=require("./platform-KMWkoI-v.cjs"),t=require("./library-request-FQaiWjCP.cjs"),n=require("./patch-BX8KrPCT.cjs"),r=require("./storm-DCEsqViG.cjs"),i=require("./types-C7WNpnG1.cjs");var a=`ui.websocket.messages`;function o(t,n,r){let i=new URL(t);return{target:e.i(t,!1,n.capture.urlTransform,r),server:i.hostname}}function s(e,n,r){let i=e.servers.get(n),a=r===`transmit`&&t.t();if(!e.active||i===void 0||a||e.config.securityContext.isolation&&e.contexts.get(n)!==e.config.securityContext.id)return;let o={"network.io.direction":r,"server.address":i};e.messages.add(1,o)}var c=class{diagnostics;config;name=`websocket`;restore;state;window={start:0,count:0};constructor(e,t){this.diagnostics=e,this.config=t}install(e){if(this.restore||typeof WebSocket>`u`)return;let t={active:!0,ctx:e,messages:e.counter(a),servers:new WeakMap,contexts:new WeakMap,config:this.config};this.state=t;let r=e=>{this.track(e,t)};this.restore=n.t(globalThis,`WebSocket`,e=>class extends e{static[Symbol.hasInstance](t){return t instanceof e}constructor(e,t){super(e,t),r(this)}send(e){super.send(e),s(t,this,`transmit`)}})}uninstall(){this.state&&(this.state.active=!1),this.restore&&!this.restore()&&this.diagnostics.report(`capture.install_failed`,`Another script wrapped WebSocket after the library. The library keeps that wrapper.`),this.restore=void 0,this.state=void 0}track(e,t){t.active&&this.diagnostics.guard(`capture.record_failed`,`The library could not track a WebSocket. The socket works without capture.`,()=>{if(i.t(e.url,this.config.capture.ignoreUrls))return;let{target:n,server:r}=o(e.url,this.config,this.diagnostics),a={"url.full":n,"server.address":r},{logger:c}=t.ctx;t.servers.set(e,r),t.contexts.set(e,this.config.securityContext.id);let l=n=>{(!this.config.securityContext.isolation||t.contexts.get(e)===this.config.securityContext.id)&&this.allow(t)&&n()};e.addEventListener(`open`,()=>{l(()=>{c.logEvent(`websocket.open`,a)})}),e.addEventListener(`error`,()=>{l(()=>{c.warn(`websocket.error`,a)})}),e.addEventListener(`close`,e=>{l(()=>{c.logEvent(`websocket.close`,{...a,"websocket.close.code":e.code,"websocket.close.clean":e.wasClean})})}),e.addEventListener(`message`,()=>{s(t,e,`receive`)})})}allow(e){return e.active&&r.t(this.window,this.config.capturePolicy.webSocketPerWindow,this.diagnostics,`WebSocket events`,this.config.capturePolicy.windowMs)}};exports.WebSocketCapture=c;
2
- //# sourceMappingURL=web-socket-DwBNhgre.cjs.map
1
+ const e=require("./library-request-1BX_UlaX.cjs"),t=require("./platform-C2Ez5kDc.cjs"),n=require("./patch-BX8KrPCT.cjs"),r=require("./storm-CYi9Swpx.cjs"),i=require("./types-C7WNpnG1.cjs");var a=`ui.websocket.messages`;function o(e,n,r){let i=new URL(e);return{target:t.i(e,!1,n.capture.urlTransform,r),server:i.hostname}}function s(t,n,r){let i=t.servers.get(n),a=r===`transmit`&&e.t();if(!t.active||i===void 0||a||t.config.securityContext.isolation&&t.contexts.get(n)!==t.config.securityContext.id)return;let o={"network.io.direction":r,"server.address":i};t.messages.add(1,o)}var c=class{diagnostics;config;name=`websocket`;restore;state;window={start:0,count:0};constructor(e,t){this.diagnostics=e,this.config=t}install(e){if(this.restore||typeof WebSocket>`u`)return;let t={active:!0,ctx:e,messages:e.counter(a),servers:new WeakMap,contexts:new WeakMap,config:this.config};this.state=t;let r=e=>{this.track(e,t)};this.restore=n.t(globalThis,`WebSocket`,e=>class extends e{static[Symbol.hasInstance](t){return t instanceof e}constructor(e,t){super(e,t),r(this)}send(e){super.send(e),s(t,this,`transmit`)}})}uninstall(){this.state&&(this.state.active=!1),this.restore&&!this.restore()&&this.diagnostics.report(`capture.install_failed`,`Another script wrapped WebSocket after the library. The library keeps that wrapper.`),this.restore=void 0,this.state=void 0}track(e,t){t.active&&this.diagnostics.guard(`capture.record_failed`,`The library could not track a WebSocket. The socket works without capture.`,()=>{if(i.t(e.url,this.config.capture.ignoreUrls))return;let{target:n,server:r}=o(e.url,this.config,this.diagnostics),a={"url.full":n,"server.address":r},{logger:c}=t.ctx;t.servers.set(e,r),t.contexts.set(e,this.config.securityContext.id);let l=n=>{(!this.config.securityContext.isolation||t.contexts.get(e)===this.config.securityContext.id)&&this.allow(t)&&n()};e.addEventListener(`open`,()=>{l(()=>{c.logEvent(`websocket.open`,a)})}),e.addEventListener(`error`,()=>{l(()=>{c.warn(`websocket.error`,a)})}),e.addEventListener(`close`,e=>{l(()=>{c.logEvent(`websocket.close`,{...a,"websocket.close.code":e.code,"websocket.close.clean":e.wasClean})})}),e.addEventListener(`message`,()=>{s(t,e,`receive`)})})}allow(e){return e.active&&r.t(this.window,this.config.capturePolicy.webSocketPerWindow,this.diagnostics,`WebSocket events`,this.config.capturePolicy.windowMs)}};exports.WebSocketCapture=c;
2
+ //# sourceMappingURL=web-socket-BWUoqBh8.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-socket-DwBNhgre.cjs","names":["recordedUrl","isLibraryRequest","patch","matchesAny","allowInWindow","require_platform","require_library_request","require_patch","require_storm","require_types","MESSAGES_METRIC","socketTarget","parsed","url","config","diagnostics","count","server","state","socket","own","direction","attributes","WebSocketCapture","ctx","track","Original","value","protocols","data","target","lifecycle","write","logger","event"],"sources":["../src/capture/web-socket.ts"],"sourcesContent":["// src/capture/web-socket.ts\n//\n// Records the open, close and error events of each WebSocket. It counts the messages by direction\n// and server. It never reads the content of a message. It is a capture plugin, and the runtime\n// loads it as a separate chunk.\n\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { Counter, MetricAttributes } from \"../models/metric\";\nimport type { CapturePlugin, PluginContext } from \"../models/plugin\";\nimport { isLibraryRequest } from \"../utils/library-request\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { patch } from \"../utils/patch\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport { matchesAny } from \"./types\";\n\n/** Name of the message counter. */\nconst MESSAGES_METRIC = \"ui.websocket.messages\";\n\n/** Data of one WebSocket.send call. */\ntype SendData = Parameters<WebSocket[\"send\"]>[0];\n\n/** State of one install. A wrapper that stays after uninstall reads it and records nothing. */\ninterface InstallState {\n /** False after uninstall. */\n active: boolean;\n /** Tools of the plugin. */\n ctx: PluginContext;\n /** Counter of the messages. */\n messages: Counter;\n /** Server host name of each tracked socket. */\n servers: WeakMap<WebSocket, string>;\n /** Delivery context in force when each socket opened. */\n contexts: WeakMap<WebSocket, string>;\n /** Active capture settings and isolation rule. */\n config: ResolvedConfig;\n}\n\n/**\n * Removes the user info, the query and the fragment from a socket URL. They can hold a token.\n * @param url Absolute URL of the socket.\n * @param config Active capture settings.\n * @param diagnostics Diagnostics reporter for a URL transform that throws.\n * @returns The URL to record and the host name of the server.\n */\nfunction socketTarget(\n url: string,\n config: ResolvedConfig,\n diagnostics: Diagnostics,\n): { target: string; server: string } {\n const parsed = new URL(url);\n\n return {\n // Ignore fullUrls. A browser cannot set a header on a socket. Thus apps often put a token in\n // the query. Only urlTransform can record more of the URL.\n target: recordedUrl(url, false, config.capture.urlTransform, diagnostics),\n server: parsed.hostname,\n };\n}\n\n/**\n * Counts one message of a tracked socket.\n * @param state State of the install that made the socket.\n * @param socket Socket of the message.\n * @param direction Direction of the message.\n */\nfunction count(state: InstallState, socket: WebSocket, direction: \"transmit\" | \"receive\"): void {\n const server = state.servers.get(socket);\n\n // A send of the library, for example a custom transport, must not make the next send.\n const own = direction === \"transmit\" && isLibraryRequest();\n if (\n !state.active ||\n server === undefined ||\n own ||\n (state.config.securityContext.isolation &&\n state.contexts.get(socket) !== state.config.securityContext.id)\n ) {\n return;\n }\n\n const attributes: MetricAttributes = {\n \"network.io.direction\": direction,\n \"server.address\": server,\n };\n state.messages.add(1, attributes);\n}\n\n/** Records the lifecycle and the message counts of each WebSocket that the app opens. */\nexport class WebSocketCapture implements CapturePlugin {\n /** Capture module identifier. */\n readonly name = \"websocket\";\n\n /** Restores the WebSocket constructor. Undefined when the capture is not installed. */\n private restore: (() => boolean) | undefined;\n\n /** State of the active install. */\n private state: InstallState | undefined;\n\n /** Rate limit of the lifecycle records. A reconnect loop must not flood the pipeline. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param diagnostics Diagnostics reporter.\n * @param config Active configuration. The capture reads `capture.ignoreUrls`.\n */\n constructor(\n private readonly diagnostics: Diagnostics,\n private readonly config: ResolvedConfig,\n ) {}\n\n /**\n * Replaces the WebSocket constructor with a subclass that tracks each socket.\n * @param ctx Tools of the plugin.\n */\n install(ctx: PluginContext): void {\n if (this.restore || typeof WebSocket === \"undefined\") {\n return;\n }\n\n const state: InstallState = {\n active: true,\n ctx,\n messages: ctx.counter(MESSAGES_METRIC),\n servers: new WeakMap(),\n contexts: new WeakMap(),\n config: this.config,\n };\n this.state = state;\n\n const track = (socket: WebSocket): void => {\n this.track(socket, state);\n };\n\n this.restore = patch(\n globalThis,\n \"WebSocket\",\n (Original) =>\n class TrackedWebSocket extends Original {\n /**\n * Keeps instanceof true for a socket that the app opened before the install.\n * @param value Value to test.\n * @returns True for each native socket.\n */\n static override [Symbol.hasInstance](value: unknown): boolean {\n return value instanceof Original;\n }\n\n /**\n * @param url URL of the server.\n * @param protocols Sub-protocols of the app.\n */\n constructor(url: string | URL, protocols?: string | string[]) {\n super(url, protocols);\n track(this);\n }\n\n /**\n * Sends the data, then counts one message. A send that throws counts nothing.\n * @param data Data of the app. The library does not read it.\n */\n override send(data: SendData): void {\n super.send(data);\n count(state, this, \"transmit\");\n }\n },\n );\n }\n\n /** Restores the WebSocket constructor and stops each tracked socket from recording. */\n uninstall(): void {\n if (this.state) {\n this.state.active = false;\n }\n\n // Another script can wrap the constructor after the library. Keep its wrapper.\n if (this.restore && !this.restore()) {\n this.diagnostics.report(\n \"capture.install_failed\",\n \"Another script wrapped WebSocket after the library. The library keeps that wrapper.\",\n );\n }\n\n this.restore = undefined;\n this.state = undefined;\n }\n\n /**\n * Adds the listeners that record the lifecycle and the received messages of one socket.\n * @param socket New socket of the app.\n * @param state State of the install that made the socket.\n */\n private track(socket: WebSocket, state: InstallState): void {\n if (!state.active) {\n return;\n }\n\n // A read here runs inside the constructor call of the app. A throw must not fail it.\n this.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not track a WebSocket. The socket works without capture.\",\n () => {\n // ignoreUrls matches the full URL. A custom transport can send over its own socket.\n if (matchesAny(socket.url, this.config.capture.ignoreUrls)) {\n return;\n }\n\n const { target, server } = socketTarget(socket.url, this.config, this.diagnostics);\n const attributes = { \"url.full\": target, \"server.address\": server };\n const { logger } = state.ctx;\n state.servers.set(socket, server);\n state.contexts.set(socket, this.config.securityContext.id);\n\n const lifecycle = (write: () => void): void => {\n if (\n (!this.config.securityContext.isolation ||\n state.contexts.get(socket) === this.config.securityContext.id) &&\n this.allow(state)\n ) {\n write();\n }\n };\n\n socket.addEventListener(\"open\", () => {\n lifecycle(() => {\n logger.logEvent(\"websocket.open\", attributes);\n });\n });\n socket.addEventListener(\"error\", () => {\n lifecycle(() => {\n logger.warn(\"websocket.error\", attributes);\n });\n });\n socket.addEventListener(\"close\", (event) => {\n lifecycle(() => {\n logger.logEvent(\"websocket.close\", {\n ...attributes,\n \"websocket.close.code\": event.code,\n \"websocket.close.clean\": event.wasClean,\n });\n });\n });\n socket.addEventListener(\"message\", () => {\n count(state, socket, \"receive\");\n });\n },\n );\n }\n\n /**\n * Tests if a lifecycle record can go out.\n * @param state State of the install that made the socket.\n * @returns False after uninstall, or when the window has no allowance left.\n */\n private allow(state: InstallState): boolean {\n return (\n state.active &&\n allowInWindow(\n this.window,\n this.config.capturePolicy.webSocketPerWindow,\n this.diagnostics,\n \"WebSocket events\",\n this.config.capturePolicy.windowMs,\n )\n );\n }\n}\n"],"mappings":"6LAiBA,IAAMU,EAAkB,wBA4BxB,SAASC,EACP,EACA,EACA,EACoC,CACpC,IAAMC,EAAS,IAAI,IAAIC,CAAG,EAE1B,MAAO,CAGL,OAAQb,EAAAA,EAAYa,EAAK,GAAOC,EAAO,QAAQ,aAAcC,CAAW,EACxE,OAAQ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KAAK,OAAO,cAAc,QAC5B,CAEJ,CACF"}
1
+ {"version":3,"file":"web-socket-BWUoqBh8.cjs","names":["recordedUrl","isLibraryRequest","patch","matchesAny","allowInWindow","require_library_request","require_platform","require_patch","require_storm","require_types","MESSAGES_METRIC","socketTarget","parsed","url","config","diagnostics","count","server","state","socket","own","direction","attributes","WebSocketCapture","ctx","track","Original","value","protocols","data","target","lifecycle","write","logger","event"],"sources":["../src/capture/web-socket.ts"],"sourcesContent":["// src/capture/web-socket.ts\n//\n// Records the open, close and error events of each WebSocket. It counts the messages by direction\n// and server. It never reads the content of a message. It is a capture plugin, and the runtime\n// loads it as a separate chunk.\n\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { Counter, MetricAttributes } from \"../models/metric\";\nimport type { CapturePlugin, PluginContext } from \"../models/plugin\";\nimport { isLibraryRequest } from \"../utils/library-request\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { patch } from \"../utils/patch\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport { matchesAny } from \"./types\";\n\n/** Name of the message counter. */\nconst MESSAGES_METRIC = \"ui.websocket.messages\";\n\n/** Data of one WebSocket.send call. */\ntype SendData = Parameters<WebSocket[\"send\"]>[0];\n\n/** State of one install. A wrapper that stays after uninstall reads it and records nothing. */\ninterface InstallState {\n /** False after uninstall. */\n active: boolean;\n /** Tools of the plugin. */\n ctx: PluginContext;\n /** Counter of the messages. */\n messages: Counter;\n /** Server host name of each tracked socket. */\n servers: WeakMap<WebSocket, string>;\n /** Delivery context in force when each socket opened. */\n contexts: WeakMap<WebSocket, string>;\n /** Active capture settings and isolation rule. */\n config: ResolvedConfig;\n}\n\n/**\n * Removes the user info, the query and the fragment from a socket URL. They can hold a token.\n * @param url Absolute URL of the socket.\n * @param config Active capture settings.\n * @param diagnostics Diagnostics reporter for a URL transform that throws.\n * @returns The URL to record and the host name of the server.\n */\nfunction socketTarget(\n url: string,\n config: ResolvedConfig,\n diagnostics: Diagnostics,\n): { target: string; server: string } {\n const parsed = new URL(url);\n\n return {\n // Ignore fullUrls. A browser cannot set a header on a socket. Thus apps often put a token in\n // the query. Only urlTransform can record more of the URL.\n target: recordedUrl(url, false, config.capture.urlTransform, diagnostics),\n server: parsed.hostname,\n };\n}\n\n/**\n * Counts one message of a tracked socket.\n * @param state State of the install that made the socket.\n * @param socket Socket of the message.\n * @param direction Direction of the message.\n */\nfunction count(state: InstallState, socket: WebSocket, direction: \"transmit\" | \"receive\"): void {\n const server = state.servers.get(socket);\n\n // A send of the library, for example a custom transport, must not make the next send.\n const own = direction === \"transmit\" && isLibraryRequest();\n if (\n !state.active ||\n server === undefined ||\n own ||\n (state.config.securityContext.isolation &&\n state.contexts.get(socket) !== state.config.securityContext.id)\n ) {\n return;\n }\n\n const attributes: MetricAttributes = {\n \"network.io.direction\": direction,\n \"server.address\": server,\n };\n state.messages.add(1, attributes);\n}\n\n/** Records the lifecycle and the message counts of each WebSocket that the app opens. */\nexport class WebSocketCapture implements CapturePlugin {\n /** Capture module identifier. */\n readonly name = \"websocket\";\n\n /** Restores the WebSocket constructor. Undefined when the capture is not installed. */\n private restore: (() => boolean) | undefined;\n\n /** State of the active install. */\n private state: InstallState | undefined;\n\n /** Rate limit of the lifecycle records. A reconnect loop must not flood the pipeline. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param diagnostics Diagnostics reporter.\n * @param config Active configuration. The capture reads `capture.ignoreUrls`.\n */\n constructor(\n private readonly diagnostics: Diagnostics,\n private readonly config: ResolvedConfig,\n ) {}\n\n /**\n * Replaces the WebSocket constructor with a subclass that tracks each socket.\n * @param ctx Tools of the plugin.\n */\n install(ctx: PluginContext): void {\n if (this.restore || typeof WebSocket === \"undefined\") {\n return;\n }\n\n const state: InstallState = {\n active: true,\n ctx,\n messages: ctx.counter(MESSAGES_METRIC),\n servers: new WeakMap(),\n contexts: new WeakMap(),\n config: this.config,\n };\n this.state = state;\n\n const track = (socket: WebSocket): void => {\n this.track(socket, state);\n };\n\n this.restore = patch(\n globalThis,\n \"WebSocket\",\n (Original) =>\n class TrackedWebSocket extends Original {\n /**\n * Keeps instanceof true for a socket that the app opened before the install.\n * @param value Value to test.\n * @returns True for each native socket.\n */\n static override [Symbol.hasInstance](value: unknown): boolean {\n return value instanceof Original;\n }\n\n /**\n * @param url URL of the server.\n * @param protocols Sub-protocols of the app.\n */\n constructor(url: string | URL, protocols?: string | string[]) {\n super(url, protocols);\n track(this);\n }\n\n /**\n * Sends the data, then counts one message. A send that throws counts nothing.\n * @param data Data of the app. The library does not read it.\n */\n override send(data: SendData): void {\n super.send(data);\n count(state, this, \"transmit\");\n }\n },\n );\n }\n\n /** Restores the WebSocket constructor and stops each tracked socket from recording. */\n uninstall(): void {\n if (this.state) {\n this.state.active = false;\n }\n\n // Another script can wrap the constructor after the library. Keep its wrapper.\n if (this.restore && !this.restore()) {\n this.diagnostics.report(\n \"capture.install_failed\",\n \"Another script wrapped WebSocket after the library. The library keeps that wrapper.\",\n );\n }\n\n this.restore = undefined;\n this.state = undefined;\n }\n\n /**\n * Adds the listeners that record the lifecycle and the received messages of one socket.\n * @param socket New socket of the app.\n * @param state State of the install that made the socket.\n */\n private track(socket: WebSocket, state: InstallState): void {\n if (!state.active) {\n return;\n }\n\n // A read here runs inside the constructor call of the app. A throw must not fail it.\n this.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not track a WebSocket. The socket works without capture.\",\n () => {\n // ignoreUrls matches the full URL. A custom transport can send over its own socket.\n if (matchesAny(socket.url, this.config.capture.ignoreUrls)) {\n return;\n }\n\n const { target, server } = socketTarget(socket.url, this.config, this.diagnostics);\n const attributes = { \"url.full\": target, \"server.address\": server };\n const { logger } = state.ctx;\n state.servers.set(socket, server);\n state.contexts.set(socket, this.config.securityContext.id);\n\n const lifecycle = (write: () => void): void => {\n if (\n (!this.config.securityContext.isolation ||\n state.contexts.get(socket) === this.config.securityContext.id) &&\n this.allow(state)\n ) {\n write();\n }\n };\n\n socket.addEventListener(\"open\", () => {\n lifecycle(() => {\n logger.logEvent(\"websocket.open\", attributes);\n });\n });\n socket.addEventListener(\"error\", () => {\n lifecycle(() => {\n logger.warn(\"websocket.error\", attributes);\n });\n });\n socket.addEventListener(\"close\", (event) => {\n lifecycle(() => {\n logger.logEvent(\"websocket.close\", {\n ...attributes,\n \"websocket.close.code\": event.code,\n \"websocket.close.clean\": event.wasClean,\n });\n });\n });\n socket.addEventListener(\"message\", () => {\n count(state, socket, \"receive\");\n });\n },\n );\n }\n\n /**\n * Tests if a lifecycle record can go out.\n * @param state State of the install that made the socket.\n * @returns False after uninstall, or when the window has no allowance left.\n */\n private allow(state: InstallState): boolean {\n return (\n state.active &&\n allowInWindow(\n this.window,\n this.config.capturePolicy.webSocketPerWindow,\n this.diagnostics,\n \"WebSocket events\",\n this.config.capturePolicy.windowMs,\n )\n );\n }\n}\n"],"mappings":"A,6LAiBA,IAAMU,EAAkB,wBA4BxB,SAASC,EACP,EACA,EACA,EACoC,CACpC,IAAMC,EAAS,IAAI,IAAIC,CAAG,EAE1B,MAAO,CAGL,OAAQb,EAAAA,EAAYa,EAAK,GAAOC,EAAO,QAAQ,aAAcC,CAAW,EACxE,OAAQH,EAAO,QACjB,CACF,CAQA,SAASI,EAAM,EAAqB,EAAmB,EAAyC,CAC9F,IAAMC,EAASC,EAAM,QAAQ,IAAIC,CAAM,EAGjCC,EAAMC,IAAc,YAAcpB,EAAAA,EAAiB,EACzD,GACE,CAACiB,EAAM,QACPD,IAAW,IAAA,IACXG,GACCF,EAAM,OAAO,gBAAgB,WAC5BA,EAAM,SAAS,IAAIC,CAAM,IAAMD,EAAM,OAAO,gBAAgB,GAE9D,OAGF,IAAMI,EAA+B,CACnC,uBAAwBD,EACxB,iBAAkBJ,CACpB,EACAC,EAAM,SAAS,IAAI,EAAGI,CAAU,CAClC,CAGA,IAAaC,EAAb,KAAuD,CAkBlC,YACA,OAjBnB,KAAgB,YAGhB,QAGA,MAGA,OAAuC,C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K,OAAO,gBAAgB,EAAE,EAEzD,IAAMY,EAAa,GAA4B,EAE1C,CAAC,KAAK,OAAO,gBAAgB,WAC5Bb,EAAM,SAAS,IAAIC,CAAM,IAAM,KAAK,OAAO,gBAAgB,KAC7D,KAAK,MAAMD,CAAK,GAEhBc,EAAM,CAEV,EAEAb,EAAO,iBAAiB,WAAc,CACpCY,MAAgB,CACdE,EAAO,SAAS,iBAAkBX,CAAU,CAC9C,CAAC,CACH,CAAC,EACDH,EAAO,iBAAiB,YAAe,CACrCY,MAAgB,CACdE,EAAO,KAAK,kBAAmBX,CAAU,CAC3C,CAAC,CACH,CAAC,EACDH,EAAO,iBAAiB,QAAU,GAAU,CAC1CY,MAAgB,CACdE,EAAO,SAAS,kBAAmB,CACjC,GAAGX,EACH,uBAAwBY,EAAM,KAC9B,wBAAyBA,EAAM,QACjC,CAAC,CACH,CAAC,CACH,CAAC,EACDf,EAAO,iBAAiB,cAAiB,CACvCH,EAAME,EAAOC,EAAQ,SAAS,CAChC,CAAC,CACH,CACF,CACF,CAOA,MAAc,EAA8B,CAC1C,OACED,EAAM,QACNd,EAAAA,EACE,KAAK,OACL,KAAK,OAAO,cAAc,mBAC1B,KAAK,YACL,mBACA,KAAK,OAAO,cAAc,QAC5B,CAEJ,CACF,E"}
@@ -1,25 +1,25 @@
1
- import { i as e } from "./platform-wcAkkv9F.js";
2
- import { t } from "./library-request-CyC-9IOk.js";
3
- import { t as n } from "./patch-CCWfuEY7.js";
4
- import { t as r } from "./storm-DD4cUkoL.js";
5
- import { t as i } from "./types-BR9t_w28.js";
6
- //#region src/capture/web-socket.ts
1
+ import { t as e } from "./library-request-BQBT9N9Q.js";
2
+ import { i as t } from "./platform-DkcuXwe-.js";
3
+ import { t as n } from "./patch-UdPz1ea8.js";
4
+ import { t as r } from "./storm-VR024_QN.js";
5
+ import { t as i } from "./types-BAerHgCq.js";
6
+ // src/capture/web-socket.ts
7
7
  var a = "ui.websocket.messages";
8
- function o(t, n, r) {
9
- let i = new URL(t);
8
+ function o(e, n, r) {
9
+ let i = new URL(e);
10
10
  return {
11
- target: e(t, !1, n.capture.urlTransform, r),
11
+ target: t(e, !1, n.capture.urlTransform, r),
12
12
  server: i.hostname
13
13
  };
14
14
  }
15
- function s(e, n, r) {
16
- let i = e.servers.get(n), a = r === "transmit" && t();
17
- if (!e.active || i === void 0 || a || e.config.securityContext.isolation && e.contexts.get(n) !== e.config.securityContext.id) return;
15
+ function s(t, n, r) {
16
+ let i = t.servers.get(n), a = r === "transmit" && e();
17
+ if (!t.active || i === void 0 || a || t.config.securityContext.isolation && t.contexts.get(n) !== t.config.securityContext.id) return;
18
18
  let o = {
19
19
  "network.io.direction": r,
20
20
  "server.address": i
21
21
  };
22
- e.messages.add(1, o);
22
+ t.messages.add(1, o);
23
23
  }
24
24
  var c = class {
25
25
  diagnostics;
@@ -99,7 +99,6 @@ var c = class {
99
99
  return e.active && r(this.window, this.config.capturePolicy.webSocketPerWindow, this.diagnostics, "WebSocket events", this.config.capturePolicy.windowMs);
100
100
  }
101
101
  };
102
- //#endregion
103
102
  export { c as WebSocketCapture };
104
103
 
105
- //# sourceMappingURL=web-socket-B-5qqPy7.js.map
104
+ //# sourceMappingURL=web-socket-CV7yIMnm.js.map