@utk09/ui-observability 0.9.5 → 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 (259) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +315 -99
  3. package/bin/uiobs.mjs +8 -0
  4. package/dist/{batch-BQFtb3i5.cjs → batch-C8OcWR2L.cjs} +2 -2
  5. package/dist/{batch-BQFtb3i5.cjs.map → batch-C8OcWR2L.cjs.map} +1 -1
  6. package/dist/{batch-BUJh-1jZ.js → batch-CL9uWYY3.js} +5 -6
  7. package/dist/{batch-BUJh-1jZ.js.map → batch-CL9uWYY3.js.map} +1 -1
  8. package/dist/bus/bus.d.ts +15 -0
  9. package/dist/{bus-DeOPHWaD.js → bus-BZ0GldpT.js} +125 -112
  10. package/dist/bus-BZ0GldpT.js.map +1 -0
  11. package/dist/bus-VWlmM5xs.cjs +2 -0
  12. package/dist/bus-VWlmM5xs.cjs.map +1 -0
  13. package/dist/capture/interactions.d.ts +18 -0
  14. package/dist/capture/lifecycle.d.ts +20 -0
  15. package/dist/capture/reports.d.ts +17 -0
  16. package/dist/capture/resource-timing.d.ts +14 -0
  17. package/dist/capture/server-timing.d.ts +19 -0
  18. package/dist/capture/types.d.ts +13 -0
  19. package/dist/capture/unclean-exit.d.ts +31 -0
  20. package/dist/capture/user-timing.d.ts +22 -0
  21. package/dist/console-BPZCuSLc.cjs +2 -0
  22. package/dist/console-BPZCuSLc.cjs.map +1 -0
  23. package/dist/{console-DbAZYJuy.js → console-BeCF7n59.js} +20 -20
  24. package/dist/{console-DbAZYJuy.js.map → console-BeCF7n59.js.map} +1 -1
  25. package/dist/constants-DqKJH_MP.cjs +2 -0
  26. package/dist/constants-DqKJH_MP.cjs.map +1 -0
  27. package/dist/constants-zyrqveN4.js +304 -0
  28. package/dist/constants-zyrqveN4.js.map +1 -0
  29. package/dist/constants.d.ts +58 -2
  30. package/dist/context-storage-BjzeBSxH.cjs.map +1 -1
  31. package/dist/{context-storage-DxZf4Gfh.js → context-storage-BzkoHzkQ.js} +2 -3
  32. package/dist/{context-storage-DxZf4Gfh.js.map → context-storage-BzkoHzkQ.js.map} +1 -1
  33. package/dist/core/debug-buffer.d.ts +34 -0
  34. package/dist/core/debug-bundle.d.ts +12 -0
  35. package/dist/core/deferred.d.ts +7 -0
  36. package/dist/core/logger.d.ts +7 -2
  37. package/dist/core/measure.d.ts +19 -0
  38. package/dist/core/pipeline.d.ts +6 -1
  39. package/dist/core/record.d.ts +20 -1
  40. package/dist/core/remote-sampling.d.ts +5 -1
  41. package/dist/core/runtime.d.ts +45 -2
  42. package/dist/core/sampling.d.ts +5 -4
  43. package/dist/core/sender.d.ts +3 -1
  44. package/dist/core/spans.d.ts +5 -0
  45. package/dist/{deadline-5_PecIl5.js → deadline-BOjOxNHj.js} +3 -5
  46. package/dist/{deadline-5_PecIl5.js.map → deadline-BOjOxNHj.js.map} +1 -1
  47. package/dist/deadline-XSnm95pg.cjs.map +1 -1
  48. package/dist/debug-bundle-BzJNpbF0.cjs +2 -0
  49. package/dist/debug-bundle-BzJNpbF0.cjs.map +1 -0
  50. package/dist/debug-bundle-C7UkHZ-q.js +25 -0
  51. package/dist/debug-bundle-C7UkHZ-q.js.map +1 -0
  52. package/dist/doctor.cjs +2 -0
  53. package/dist/doctor.cjs.map +1 -0
  54. package/dist/doctor.d.ts +23 -0
  55. package/dist/doctor.js +98 -0
  56. package/dist/doctor.js.map +1 -0
  57. package/dist/{emergency-queue-Cs1hrjsC.cjs → emergency-queue-CNTRui5t.cjs} +2 -2
  58. package/dist/{emergency-queue-Cs1hrjsC.cjs.map → emergency-queue-CNTRui5t.cjs.map} +1 -1
  59. package/dist/{emergency-queue-BYUyDHGD.js → emergency-queue-Zy6lNafo.js} +17 -19
  60. package/dist/{emergency-queue-BYUyDHGD.js.map → emergency-queue-Zy6lNafo.js.map} +1 -1
  61. package/dist/{error-like-Ywo5uRHo.js → error-like-B11pB4aL.js} +2 -3
  62. package/dist/{error-like-Ywo5uRHo.js.map → error-like-B11pB4aL.js.map} +1 -1
  63. package/dist/error-like-gGRx2s36.cjs.map +1 -1
  64. package/dist/{errors-BhC7HTSt.js → errors-Dh7kef0i.js} +5 -6
  65. package/dist/{errors-BhC7HTSt.js.map → errors-Dh7kef0i.js.map} +1 -1
  66. package/dist/{errors-CgY633cG.cjs → errors-tfEr48bS.cjs} +2 -2
  67. package/dist/{errors-CgY633cG.cjs.map → errors-tfEr48bS.cjs.map} +1 -1
  68. package/dist/{factory-C5TujXlU.js → factory-BonqI3NL.js} +16 -20
  69. package/dist/{factory-C5TujXlU.js.map → factory-BonqI3NL.js.map} +1 -1
  70. package/dist/{factory-CNj4DH3n.cjs → factory-CJXVYp0R.cjs} +2 -2
  71. package/dist/{factory-CNj4DH3n.cjs.map → factory-CJXVYp0R.cjs.map} +1 -1
  72. package/dist/fixed-window-CvESpFYV.cjs.map +1 -1
  73. package/dist/{fixed-window-CtaFHanJ.js → fixed-window-Dq3MLUUv.js} +2 -3
  74. package/dist/{fixed-window-CtaFHanJ.js.map → fixed-window-Dq3MLUUv.js.map} +1 -1
  75. package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
  76. package/dist/{global-scope-dp2jADRl.js → global-scope-D9I8s-oN.js} +2 -3
  77. package/dist/{global-scope-dp2jADRl.js.map → global-scope-D9I8s-oN.js.map} +1 -1
  78. package/dist/guards-Cidk71ME.js +7 -0
  79. package/dist/guards-Cidk71ME.js.map +1 -0
  80. package/dist/guards-nJ70syPt.cjs +2 -0
  81. package/dist/guards-nJ70syPt.cjs.map +1 -0
  82. package/dist/{identity-Da9TkuKd.cjs → identity-Cxgj6pZX.cjs} +2 -2
  83. package/dist/{identity-Da9TkuKd.cjs.map → identity-Cxgj6pZX.cjs.map} +1 -1
  84. package/dist/{identity-8vKkyAWm.js → identity-DT5VmvXy.js} +15 -16
  85. package/dist/{identity-8vKkyAWm.js.map → identity-DT5VmvXy.js.map} +1 -1
  86. package/dist/index.cjs +1 -1
  87. package/dist/index.cjs.map +1 -1
  88. package/dist/index.d.ts +27 -7
  89. package/dist/index.js +980 -604
  90. package/dist/index.js.map +1 -1
  91. package/dist/{indexeddb-storage-CCA1LvtO.js → indexeddb-storage-BJVtiQKm.js} +29 -30
  92. package/dist/{indexeddb-storage-CCA1LvtO.js.map → indexeddb-storage-BJVtiQKm.js.map} +1 -1
  93. package/dist/{indexeddb-storage-BTfIFRHF.cjs → indexeddb-storage-CIoW21Xd.cjs} +2 -2
  94. package/dist/{indexeddb-storage-BTfIFRHF.cjs.map → indexeddb-storage-CIoW21Xd.cjs.map} +1 -1
  95. package/dist/interactions-DTgKy_6K.js +119 -0
  96. package/dist/interactions-DTgKy_6K.js.map +1 -0
  97. package/dist/interactions-fEN6FbVo.cjs +2 -0
  98. package/dist/interactions-fEN6FbVo.cjs.map +1 -0
  99. package/dist/{journey-BUJ4WJxP.js → journey-CuJrHzEg.js} +18 -19
  100. package/dist/{journey-BUJ4WJxP.js.map → journey-CuJrHzEg.js.map} +1 -1
  101. package/dist/{journey-B_tTnvac.cjs → journey-pffMVMfa.cjs} +2 -2
  102. package/dist/{journey-B_tTnvac.cjs.map → journey-pffMVMfa.cjs.map} +1 -1
  103. package/dist/keys-BHhw_0Wh.cjs.map +1 -1
  104. package/dist/{keys-D5r_GH9q.js → keys-BU9j5YqW.js} +2 -3
  105. package/dist/{keys-D5r_GH9q.js.map → keys-BU9j5YqW.js.map} +1 -1
  106. package/dist/library-console-C1m6g1BR.js +13 -0
  107. package/dist/library-console-C1m6g1BR.js.map +1 -0
  108. package/dist/library-console-D2GY9Or6.cjs +2 -0
  109. package/dist/library-console-D2GY9Or6.cjs.map +1 -0
  110. package/dist/{library-request-BaZOi4eg.cjs → library-request-1BX_UlaX.cjs} +2 -2
  111. package/dist/{library-request-BaZOi4eg.cjs.map → library-request-1BX_UlaX.cjs.map} +1 -1
  112. package/dist/library-request-BQBT9N9Q.js +24 -0
  113. package/dist/{library-request-BKOcaKtQ.js.map → library-request-BQBT9N9Q.js.map} +1 -1
  114. package/dist/lifecycle-2EtUaRpo.cjs +2 -0
  115. package/dist/lifecycle-2EtUaRpo.cjs.map +1 -0
  116. package/dist/lifecycle-BaKx_-32.js +55 -0
  117. package/dist/lifecycle-BaKx_-32.js.map +1 -0
  118. package/dist/log-record-CAoGBBf3.js +16 -0
  119. package/dist/log-record-CAoGBBf3.js.map +1 -0
  120. package/dist/log-record-i9zOTkpQ.cjs +2 -0
  121. package/dist/log-record-i9zOTkpQ.cjs.map +1 -0
  122. package/dist/{long-frames-CF3qiSAX.cjs → long-frames-BVg4i5SC.cjs} +2 -2
  123. package/dist/{long-frames-CF3qiSAX.cjs.map → long-frames-BVg4i5SC.cjs.map} +1 -1
  124. package/dist/{long-frames-DI5ypfAF.js → long-frames-Czk7IupC.js} +4 -5
  125. package/dist/{long-frames-DI5ypfAF.js.map → long-frames-Czk7IupC.js.map} +1 -1
  126. package/dist/models/config.d.ts +168 -4
  127. package/dist/models/health.d.ts +25 -0
  128. package/dist/models/metric.d.ts +13 -0
  129. package/dist/models/storage.d.ts +5 -0
  130. package/dist/{network-DdzXDI3J.js → network-DBNwApoF.js} +117 -70
  131. package/dist/network-DBNwApoF.js.map +1 -0
  132. package/dist/network-xbbuvG_6.cjs +2 -0
  133. package/dist/network-xbbuvG_6.cjs.map +1 -0
  134. package/dist/openfin-Bxelt0yg.js +7 -0
  135. package/dist/{openfin-BwEN0uj4.js.map → openfin-Bxelt0yg.js.map} +1 -1
  136. package/dist/openfin-DtH2f7zX.cjs.map +1 -1
  137. package/dist/otlp-BDvFrLnc.cjs +2 -0
  138. package/dist/otlp-BDvFrLnc.cjs.map +1 -0
  139. package/dist/otlp-BTJdIa6F.js +81 -0
  140. package/dist/otlp-BTJdIa6F.js.map +1 -0
  141. package/dist/patch-BX8KrPCT.cjs.map +1 -1
  142. package/dist/{patch-CCWfuEY7.js → patch-UdPz1ea8.js} +2 -3
  143. package/dist/{patch-CCWfuEY7.js.map → patch-UdPz1ea8.js.map} +1 -1
  144. package/dist/{platform-DBSKTvFn.cjs → platform-C2Ez5kDc.cjs} +2 -2
  145. package/dist/{platform-DBSKTvFn.cjs.map → platform-C2Ez5kDc.cjs.map} +1 -1
  146. package/dist/{platform-Bw1btWCT.js → platform-DkcuXwe-.js} +5 -6
  147. package/dist/{platform-Bw1btWCT.js.map → platform-DkcuXwe-.js.map} +1 -1
  148. package/dist/remote-rules-Cfb4K-Nl.js +98 -0
  149. package/dist/remote-rules-Cfb4K-Nl.js.map +1 -0
  150. package/dist/remote-rules-vzvk7aKf.cjs +2 -0
  151. package/dist/remote-rules-vzvk7aKf.cjs.map +1 -0
  152. package/dist/reports-Dk2YhKIh.cjs +2 -0
  153. package/dist/reports-Dk2YhKIh.cjs.map +1 -0
  154. package/dist/reports-TA-zInnq.js +70 -0
  155. package/dist/reports-TA-zInnq.js.map +1 -0
  156. package/dist/resource-timing-BLv3EA2A.js +76 -0
  157. package/dist/resource-timing-BLv3EA2A.js.map +1 -0
  158. package/dist/resource-timing-Cysw1S1f.cjs +2 -0
  159. package/dist/resource-timing-Cysw1S1f.cjs.map +1 -0
  160. package/dist/sampling-C4VV-1MS.js +60 -0
  161. package/dist/sampling-C4VV-1MS.js.map +1 -0
  162. package/dist/sampling-Ckh2yW9k.cjs +2 -0
  163. package/dist/sampling-Ckh2yW9k.cjs.map +1 -0
  164. package/dist/sanitize-6ymPlVvP.js +112 -0
  165. package/dist/sanitize-6ymPlVvP.js.map +1 -0
  166. package/dist/sanitize-BAWzkZt0.cjs +2 -0
  167. package/dist/sanitize-BAWzkZt0.cjs.map +1 -0
  168. package/dist/select-ZF4by-lF.cjs +3 -0
  169. package/dist/select-ZF4by-lF.cjs.map +1 -0
  170. package/dist/select-xtQaenIi.js +270 -0
  171. package/dist/select-xtQaenIi.js.map +1 -0
  172. package/dist/{sender-DUUmSglb.js → sender-CiMHC9YG.js} +202 -509
  173. package/dist/sender-CiMHC9YG.js.map +1 -0
  174. package/dist/sender-D5wBoXA8.cjs +2 -0
  175. package/dist/sender-D5wBoXA8.cjs.map +1 -0
  176. package/dist/storage/persistence.d.ts +8 -0
  177. package/dist/storage-BA9RqRO-.cjs.map +1 -1
  178. package/dist/{storage-w7Tslvlq.js → storage-DZwed89z.js} +2 -3
  179. package/dist/storage-DZwed89z.js.map +1 -0
  180. package/dist/storm-CYi9Swpx.cjs +2 -0
  181. package/dist/{storm-CNZjsw4T.cjs.map → storm-CYi9Swpx.cjs.map} +1 -1
  182. package/dist/{storm-Daq2jGHU.js → storm-VR024_QN.js} +4 -5
  183. package/dist/{storm-Daq2jGHU.js.map → storm-VR024_QN.js.map} +1 -1
  184. package/dist/transport/headers.d.ts +8 -0
  185. package/dist/transport/http-transport.d.ts +2 -6
  186. package/dist/transport/serializers/otlp.d.ts +14 -0
  187. package/dist/transport/status-transport.d.ts +5 -2
  188. package/dist/transport/worker-client.d.ts +14 -0
  189. package/dist/transport/worker-entry.d.ts +5 -0
  190. package/dist/transport/worker-protocol.d.ts +36 -0
  191. package/dist/transport/worker-server.d.ts +3 -0
  192. package/dist/transport/worker-transport.d.ts +9 -0
  193. package/dist/{types-BR9t_w28.js → types-BAerHgCq.js} +2 -3
  194. package/dist/types-BAerHgCq.js.map +1 -0
  195. package/dist/types-C7WNpnG1.cjs.map +1 -1
  196. package/dist/unclean-exit-CwcUhFOn.js +62 -0
  197. package/dist/unclean-exit-CwcUhFOn.js.map +1 -0
  198. package/dist/unclean-exit-DFUN57wY.cjs +2 -0
  199. package/dist/unclean-exit-DFUN57wY.cjs.map +1 -0
  200. package/dist/user-timing-C9kfRq3J.cjs +2 -0
  201. package/dist/user-timing-C9kfRq3J.cjs.map +1 -0
  202. package/dist/user-timing-_jZIhDKI.js +63 -0
  203. package/dist/user-timing-_jZIhDKI.js.map +1 -0
  204. package/dist/{web-socket-BacvKOvD.cjs → web-socket-BWUoqBh8.cjs} +2 -2
  205. package/dist/{web-socket-BacvKOvD.cjs.map → web-socket-BWUoqBh8.cjs.map} +1 -1
  206. package/dist/{web-socket-CpsD8WAa.js → web-socket-CV7yIMnm.js} +7 -8
  207. package/dist/{web-socket-CpsD8WAa.js.map → web-socket-CV7yIMnm.js.map} +1 -1
  208. package/dist/{web-vitals-Bflr5jSA.js → web-vitals-Bq4WFHQo.js} +2 -3
  209. package/dist/{web-vitals-Bflr5jSA.js.map → web-vitals-Bq4WFHQo.js.map} +1 -1
  210. package/dist/web-vitals-DFuoTQbZ.cjs.map +1 -1
  211. package/dist/worker-protocol-Bai7GAIA.cjs +2 -0
  212. package/dist/worker-protocol-Bai7GAIA.cjs.map +1 -0
  213. package/dist/worker-protocol-CrsdSDLn.js +49 -0
  214. package/dist/worker-protocol-CrsdSDLn.js.map +1 -0
  215. package/dist/worker-server-BrIYkfoa.cjs +2 -0
  216. package/dist/worker-server-BrIYkfoa.cjs.map +1 -0
  217. package/dist/worker-server-Dp5HYm4b.js +83 -0
  218. package/dist/worker-server-Dp5HYm4b.js.map +1 -0
  219. package/dist/worker-transport-Bwej4N2e.cjs +2 -0
  220. package/dist/worker-transport-Bwej4N2e.cjs.map +1 -0
  221. package/dist/worker-transport-D6jtgpqN.js +199 -0
  222. package/dist/worker-transport-D6jtgpqN.js.map +1 -0
  223. package/package.json +31 -41
  224. package/dist/bus-BW6N-pY8.cjs +0 -2
  225. package/dist/bus-BW6N-pY8.cjs.map +0 -1
  226. package/dist/bus-DeOPHWaD.js.map +0 -1
  227. package/dist/console-Ce6heqZZ.cjs +0 -2
  228. package/dist/console-Ce6heqZZ.cjs.map +0 -1
  229. package/dist/constants-CN7GE1Lt.js +0 -246
  230. package/dist/constants-CN7GE1Lt.js.map +0 -1
  231. package/dist/constants-CW-MlHdY.cjs +0 -2
  232. package/dist/constants-CW-MlHdY.cjs.map +0 -1
  233. package/dist/interactions-BUDLxbv1.js +0 -74
  234. package/dist/interactions-BUDLxbv1.js.map +0 -1
  235. package/dist/interactions-NHbLKrqe.cjs +0 -2
  236. package/dist/interactions-NHbLKrqe.cjs.map +0 -1
  237. package/dist/library-request-BKOcaKtQ.js +0 -25
  238. package/dist/network-CF8UO5PK.cjs +0 -2
  239. package/dist/network-CF8UO5PK.cjs.map +0 -1
  240. package/dist/network-DdzXDI3J.js.map +0 -1
  241. package/dist/openfin-BwEN0uj4.js +0 -8
  242. package/dist/remote-rules-DIcC5vVC.js +0 -91
  243. package/dist/remote-rules-DIcC5vVC.js.map +0 -1
  244. package/dist/remote-rules-DpFmOef2.cjs +0 -2
  245. package/dist/remote-rules-DpFmOef2.cjs.map +0 -1
  246. package/dist/sampling-BVjspJWu.cjs +0 -2
  247. package/dist/sampling-BVjspJWu.cjs.map +0 -1
  248. package/dist/sampling-Cm3WhI0a.js +0 -76
  249. package/dist/sampling-Cm3WhI0a.js.map +0 -1
  250. package/dist/sanitize-C-ahCFsG.js +0 -123
  251. package/dist/sanitize-C-ahCFsG.js.map +0 -1
  252. package/dist/sanitize-DHucKGdi.cjs +0 -2
  253. package/dist/sanitize-DHucKGdi.cjs.map +0 -1
  254. package/dist/sender-D3fRCR8d.cjs +0 -3
  255. package/dist/sender-D3fRCR8d.cjs.map +0 -1
  256. package/dist/sender-DUUmSglb.js.map +0 -1
  257. package/dist/storage-w7Tslvlq.js.map +0 -1
  258. package/dist/storm-CNZjsw4T.cjs +0 -2
  259. package/dist/types-BR9t_w28.js.map +0 -1
package/bin/uiobs.mjs ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ // bin/uiobs.mjs
3
+ //
4
+ // Runs the command line tool of the package. The code is in dist/doctor.js.
5
+
6
+ import { main } from "../dist/doctor.js";
7
+
8
+ process.exitCode = await main(process.argv.slice(2), console.log);
@@ -1,2 +1,2 @@
1
- const e=require("./constants-CW-MlHdY.cjs"),t=require("./identity-Da9TkuKd.cjs");function n(e){if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`id`),n=Reflect.get(e,`createdAt`),r=Reflect.get(e,`attempts`),i=Reflect.get(e,`records`);return typeof t==`string`&&typeof n==`number`&&typeof r==`number`&&Array.isArray(i)}function r(e,n){if(e.records.length<2)return null;let r=Math.floor(e.records.length/2),i=r=>({id:t.i(n),records:r,createdAt:e.createdAt,attempts:e.attempts,routingContextId:e.routingContextId,persistenceNamespace:e.persistenceNamespace});return[i(e.records.slice(0,r)),i(e.records.slice(r))]}function i(e,t){let n=e;if(typeof n!=`object`||!n)return;let r=Reflect.get(n,`attributes`);if(typeof r==`object`&&r)return Reflect.get(r,t)}function a(t){return i(t,e.f)===e.vt}function o(e){return e.reduce((e,t)=>e+t.records.length,0)}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
2
- //# sourceMappingURL=batch-BQFtb3i5.cjs.map
1
+ const e=require("./constants-DqKJH_MP.cjs"),t=require("./identity-Cxgj6pZX.cjs");function n(e){if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`id`),n=Reflect.get(e,`createdAt`),r=Reflect.get(e,`attempts`),i=Reflect.get(e,`records`);return typeof t==`string`&&typeof n==`number`&&typeof r==`number`&&Array.isArray(i)}function r(e,n){if(e.records.length<2)return null;let r=Math.floor(e.records.length/2),i=r=>({id:t.i(n),records:r,createdAt:e.createdAt,attempts:e.attempts,routingContextId:e.routingContextId,persistenceNamespace:e.persistenceNamespace});return[i(e.records.slice(0,r)),i(e.records.slice(r))]}function i(e,t){let n=e;if(typeof n!=`object`||!n)return;let r=Reflect.get(n,`attributes`);if(typeof r==`object`&&r)return Reflect.get(r,t)}function a(t){return i(t,e.g)===e.Ot}function o(e){return e.reduce((e,t)=>e+t.records.length,0)}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
2
+ //# sourceMappingURL=batch-C8OcWR2L.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"batch-BQFtb3i5.cjs","names":["newId","ATTR_LOG_TYPE","LOG_TYPE_ACTION","require_constants","require_identity","isLogBatch","value","id","createdAt","attempts","records","splitBatch","batch","middle","halve","diagnostics","attributeOf","record","attributes","key","isActionRecord","countRecords","batches","total"],"sources":["../src/models/batch.ts"],"sourcesContent":["// src/models/batch.ts\n//\n// A batch of log records for delivery to the ingest endpoint.\n\nimport { ATTR_LOG_TYPE, LOG_TYPE_ACTION } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { newId } from \"../utils/identity\";\nimport type { LogRecord } from \"./log-record\";\n\n/**\n * A batch of records with a stable id used for server-side deduplication across retries.\n * @see {@link splitBatch}\n */\nexport interface LogBatch {\n /** Application namespace that owns this stored batch. */\n readonly persistenceNamespace?: string;\n /** Delivery context id. It does not change. With isolation, a batch without this id stays stored. */\n readonly routingContextId?: string;\n /** Deduplication key. It stays the same across retries and reloads. */\n id: string;\n /** Records to deliver, in log order. */\n records: LogRecord[];\n /** Batch creation time, in epoch milliseconds. */\n createdAt: number;\n /** Delivery attempts so far. */\n attempts: number;\n}\n\n/**\n * Tells if a value from storage has all fields of a batch. `keyOf` cannot match\n * an entry without `id` after delivery. The library then retries that entry with no\n * end, and the entry blocks each batch behind it. An entry without `attempts` counts\n * as NaN. That count never reaches `maxAttempts`. Thus the library never drops the\n * entry as a dead letter.\n * @param value Parsed storage entry.\n * @returns True when each required field is present and has the correct type.\n */\nexport function isLogBatch(value: unknown): value is LogBatch {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const id: unknown = Reflect.get(value, \"id\");\n const createdAt: unknown = Reflect.get(value, \"createdAt\");\n const attempts: unknown = Reflect.get(value, \"attempts\");\n const records: unknown = Reflect.get(value, \"records\");\n\n return (\n typeof id === \"string\" &&\n typeof createdAt === \"number\" &&\n typeof attempts === \"number\" &&\n Array.isArray(records)\n );\n}\n\n/**\n * Splits a batch that the server rejected as too large into two halves.\n * Each half gets a new id. Each half keeps the age and attempts of the original batch.\n * @param batch The rejected batch.\n * @param diagnostics Diagnostics reporter for the new batch ids.\n * @returns Two batches, or `null` if a single record is already over the limit.\n */\nexport function splitBatch(batch: LogBatch, diagnostics: Diagnostics): [LogBatch, LogBatch] | null {\n if (batch.records.length < 2) {\n return null;\n }\n\n const middle = Math.floor(batch.records.length / 2);\n const halve = (records: LogRecord[]): LogBatch => ({\n id: newId(diagnostics),\n records,\n createdAt: batch.createdAt,\n attempts: batch.attempts,\n routingContextId: batch.routingContextId,\n persistenceNamespace: batch.persistenceNamespace,\n });\n\n return [halve(batch.records.slice(0, middle)), halve(batch.records.slice(middle))];\n}\n\n/**\n * Reads one attribute of a record. A record from storage can be corrupt. It can be null or have\n * no attributes.\n * @param record Record to read.\n * @param key Attribute key.\n * @returns The attribute value, or undefined for a corrupt record.\n */\nexport function attributeOf(record: LogRecord, key: string): unknown {\n const value: unknown = record;\n if (typeof value !== \"object\" || value === null) {\n return undefined;\n }\n\n const attributes: unknown = Reflect.get(value, \"attributes\");\n if (typeof attributes !== \"object\" || attributes === null) {\n return undefined;\n }\n\n return Reflect.get(attributes, key);\n}\n\n/**\n * Tests if a record is an action. A corrupt record from storage is not an action.\n * @param record Record to test.\n * @returns True for an action record.\n */\nexport function isActionRecord(record: LogRecord): boolean {\n return attributeOf(record, ATTR_LOG_TYPE) === LOG_TYPE_ACTION;\n}\n\n/**\n * Returns the total record count of the batches.\n * @param batches Batches to measure.\n * @returns Total record count.\n */\nexport function countRecords(batches: readonly LogBatch[]): number {\n return batches.reduce((total, batch) => total + batch.records.length, 0);\n}\n"],"mappings":"iFAqCA,SAAgBK,EAAW,EAAmC,CAC5D,GAAI,OAAOC,GAAU,WAAYA,EAC/B,MAAO,GAGT,IAAMC,EAAc,QAAQ,IAAID,EAAO,IAAI,EACrCE,EAAqB,QAAQ,IAAIF,EAAO,WAAW,EACnDG,EAAoB,QAAQ,IAAIH,EAAO,UAAU,EACjDI,EAAmB,QAAQ,IAAIJ,EAAO,SAAS,EAErD,OACE,OAAOC,GAAO,UACd,OAAOC,GAAc,UACrB,OAAOC,GAAa,UACpB,MAAM,QAAQC,CAAO,CAEzB,CASA,SAAgBC,EAAW,EAAiB,EAAuD,CACjG,GAAIC,EAAM,QAAQ,OAAS,EACzB,OAAO,KAGT,IAAMC,EAAS,KAAK,MAAMD,EAAM,QAAQ,OAAS,CAAC,EAC5CE,EAAS,IAAoC,CACjD,GAAId,EAAAA,EAAMe,CAAW,EACrB,UACA,UAAWH,EAAM,UACjB,SAAUA,EAAM,SAChB,iBAAkBA,EAAM,iBACxB,qBAAsBA,EAAM,oBAC9B,GAEA,MAAO,CAACE,EAAMF,EAAM,QAAQ,MAAM,EAAGC,CAAM,CAAC,EAAGC,EAAMF,EAAM,QAAQ,MAAMC,CAAM,CAAC,CAAC,CACnF,CASA,SAAgBG,EAAY,EAAmB,EAAsB,CACnE,IAAMV,EAAiBW,EACvB,GAAI,OAAOX,GAAU,WAAYA,EAC/B,OAGF,IAAMY,EAAsB,QAAQ,IAAIZ,EAAO,YAAY,EAC3D,GAAI,OAAOY,GAAe,UAAYA,EAItC,OAAO,QAAQ,IAAIA,EAAYC,CAAG,CACpC,CAOA,SAAgBC,EAAe,EAA4B,CACzD,OAAOJ,EAAYC,EAAQhB,EAAAA,CAAa,IAAMC,EAAAA,EAChD,CAOA,SAAgBmB,EAAa,EAAsC,CACjE,OAAOC,EAAQ,QAAQ,EAAO,IAAUC,EAAQX,EAAM,QAAQ,OAAQ,CAAC,CACzE"}
1
+ {"version":3,"file":"batch-C8OcWR2L.cjs","names":["newId","ATTR_LOG_TYPE","LOG_TYPE_ACTION","require_constants","require_identity","isLogBatch","value","id","createdAt","attempts","records","splitBatch","batch","middle","halve","diagnostics","attributeOf","record","attributes","key","isActionRecord","countRecords","batches","total"],"sources":["../src/models/batch.ts"],"sourcesContent":["// src/models/batch.ts\n//\n// A batch of log records for delivery to the ingest endpoint.\n\nimport { ATTR_LOG_TYPE, LOG_TYPE_ACTION } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { newId } from \"../utils/identity\";\nimport type { LogRecord } from \"./log-record\";\n\n/**\n * A batch of records with a stable id used for server-side deduplication across retries.\n * @see {@link splitBatch}\n */\nexport interface LogBatch {\n /** Application namespace that owns this stored batch. */\n readonly persistenceNamespace?: string;\n /** Delivery context id. It does not change. With isolation, a batch without this id stays stored. */\n readonly routingContextId?: string;\n /** Deduplication key. It stays the same across retries and reloads. */\n id: string;\n /** Records to deliver, in log order. */\n records: LogRecord[];\n /** Batch creation time, in epoch milliseconds. */\n createdAt: number;\n /** Delivery attempts so far. */\n attempts: number;\n}\n\n/**\n * Tells if a value from storage has all fields of a batch. `keyOf` cannot match\n * an entry without `id` after delivery. The library then retries that entry with no\n * end, and the entry blocks each batch behind it. An entry without `attempts` counts\n * as NaN. That count never reaches `maxAttempts`. Thus the library never drops the\n * entry as a dead letter.\n * @param value Parsed storage entry.\n * @returns True when each required field is present and has the correct type.\n */\nexport function isLogBatch(value: unknown): value is LogBatch {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const id: unknown = Reflect.get(value, \"id\");\n const createdAt: unknown = Reflect.get(value, \"createdAt\");\n const attempts: unknown = Reflect.get(value, \"attempts\");\n const records: unknown = Reflect.get(value, \"records\");\n\n return (\n typeof id === \"string\" &&\n typeof createdAt === \"number\" &&\n typeof attempts === \"number\" &&\n Array.isArray(records)\n );\n}\n\n/**\n * Splits a batch that the server rejected as too large into two halves.\n * Each half gets a new id. Each half keeps the age and attempts of the original batch.\n * @param batch The rejected batch.\n * @param diagnostics Diagnostics reporter for the new batch ids.\n * @returns Two batches, or `null` if a single record is already over the limit.\n */\nexport function splitBatch(batch: LogBatch, diagnostics: Diagnostics): [LogBatch, LogBatch] | null {\n if (batch.records.length < 2) {\n return null;\n }\n\n const middle = Math.floor(batch.records.length / 2);\n const halve = (records: LogRecord[]): LogBatch => ({\n id: newId(diagnostics),\n records,\n createdAt: batch.createdAt,\n attempts: batch.attempts,\n routingContextId: batch.routingContextId,\n persistenceNamespace: batch.persistenceNamespace,\n });\n\n return [halve(batch.records.slice(0, middle)), halve(batch.records.slice(middle))];\n}\n\n/**\n * Reads one attribute of a record. A record from storage can be corrupt. It can be null or have\n * no attributes.\n * @param record Record to read.\n * @param key Attribute key.\n * @returns The attribute value, or undefined for a corrupt record.\n */\nexport function attributeOf(record: LogRecord, key: string): unknown {\n const value: unknown = record;\n if (typeof value !== \"object\" || value === null) {\n return undefined;\n }\n\n const attributes: unknown = Reflect.get(value, \"attributes\");\n if (typeof attributes !== \"object\" || attributes === null) {\n return undefined;\n }\n\n return Reflect.get(attributes, key);\n}\n\n/**\n * Tests if a record is an action. A corrupt record from storage is not an action.\n * @param record Record to test.\n * @returns True for an action record.\n */\nexport function isActionRecord(record: LogRecord): boolean {\n return attributeOf(record, ATTR_LOG_TYPE) === LOG_TYPE_ACTION;\n}\n\n/**\n * Returns the total record count of the batches.\n * @param batches Batches to measure.\n * @returns Total record count.\n */\nexport function countRecords(batches: readonly LogBatch[]): number {\n return batches.reduce((total, batch) => total + batch.records.length, 0);\n}\n"],"mappings":"A,iFAqCA,SAAgBK,EAAW,EAAmC,CAC5D,GAAI,OAAOC,GAAU,WAAYA,EAC/B,MAAO,GAGT,IAAMC,EAAc,QAAQ,IAAID,EAAO,IAAI,EACrCE,EAAqB,QAAQ,IAAIF,EAAO,WAAW,EACnDG,EAAoB,QAAQ,IAAIH,EAAO,UAAU,EACjDI,EAAmB,QAAQ,IAAIJ,EAAO,SAAS,EAErD,OACE,OAAOC,GAAO,UACd,OAAOC,GAAc,UACrB,OAAOC,GAAa,UACpB,MAAM,QAAQC,CAAO,CAEzB,CASA,SAAgBC,EAAW,EAAiB,EAAuD,CACjG,GAAIC,EAAM,QAAQ,OAAS,EACzB,OAAO,KAGT,IAAMC,EAAS,KAAK,MAAMD,EAAM,QAAQ,OAAS,CAAC,EAC5CE,EAAS,IAAoC,CACjD,GAAId,EAAAA,EAAMe,CAAW,EACrB,UACA,UAAWH,EAAM,UACjB,SAAUA,EAAM,SAChB,iBAAkBA,EAAM,iBACxB,qBAAsBA,EAAM,oBAC9B,GAEA,MAAO,CAACE,EAAMF,EAAM,QAAQ,MAAM,EAAGC,CAAM,CAAC,EAAGC,EAAMF,EAAM,QAAQ,MAAMC,CAAM,CAAC,CAAC,CACnF,CASA,SAAgBG,EAAY,EAAmB,EAAsB,CACnE,IAAMV,EAAiBW,EACvB,GAAI,OAAOX,GAAU,WAAYA,EAC/B,OAGF,IAAMY,EAAsB,QAAQ,IAAIZ,EAAO,YAAY,EAC3D,GAAI,OAAOY,GAAe,UAAYA,EAItC,OAAO,QAAQ,IAAIA,EAAYC,CAAG,CACpC,CAOA,SAAgBC,EAAe,EAA4B,CACzD,OAAOJ,EAAYC,EAAQhB,EAAAA,CAAa,IAAMC,EAAAA,EAChD,CAOA,SAAgBmB,EAAa,EAAsC,CACjE,OAAOC,EAAQ,QAAQ,EAAO,IAAUC,EAAQX,EAAM,QAAQ,OAAQ,CAAC,CACzE,C"}
@@ -1,6 +1,6 @@
1
- import { f as e, vt as t } from "./constants-CN7GE1Lt.js";
2
- import { i as n } from "./identity-8vKkyAWm.js";
3
- //#region src/models/batch.ts
1
+ import { Ot as e, g as t } from "./constants-zyrqveN4.js";
2
+ import { i as n } from "./identity-DT5VmvXy.js";
3
+ // src/models/batch.ts
4
4
  function r(e) {
5
5
  if (typeof e != "object" || !e) return !1;
6
6
  let t = Reflect.get(e, "id"), n = Reflect.get(e, "createdAt"), r = Reflect.get(e, "attempts"), i = Reflect.get(e, "records");
@@ -25,12 +25,11 @@ function a(e, t) {
25
25
  if (typeof r == "object" && r) return Reflect.get(r, t);
26
26
  }
27
27
  function o(n) {
28
- return a(n, e) === t;
28
+ return a(n, t) === e;
29
29
  }
30
30
  function s(e) {
31
31
  return e.reduce((e, t) => e + t.records.length, 0);
32
32
  }
33
- //#endregion
34
33
  export { i as a, r as i, s as n, o as r, a as t };
35
34
 
36
- //# sourceMappingURL=batch-BUJh-1jZ.js.map
35
+ //# sourceMappingURL=batch-CL9uWYY3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"batch-BUJh-1jZ.js","names":["ATTR_LOG_TYPE","LOG_TYPE_ACTION","newId","isLogBatch","value","id","createdAt","attempts","records","splitBatch","batch","middle","halve","diagnostics","attributeOf","record","attributes","key","isActionRecord","countRecords","batches","total"],"sources":["../src/models/batch.ts"],"sourcesContent":["// src/models/batch.ts\n//\n// A batch of log records for delivery to the ingest endpoint.\n\nimport { ATTR_LOG_TYPE, LOG_TYPE_ACTION } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { newId } from \"../utils/identity\";\nimport type { LogRecord } from \"./log-record\";\n\n/**\n * A batch of records with a stable id used for server-side deduplication across retries.\n * @see {@link splitBatch}\n */\nexport interface LogBatch {\n /** Application namespace that owns this stored batch. */\n readonly persistenceNamespace?: string;\n /** Delivery context id. It does not change. With isolation, a batch without this id stays stored. */\n readonly routingContextId?: string;\n /** Deduplication key. It stays the same across retries and reloads. */\n id: string;\n /** Records to deliver, in log order. */\n records: LogRecord[];\n /** Batch creation time, in epoch milliseconds. */\n createdAt: number;\n /** Delivery attempts so far. */\n attempts: number;\n}\n\n/**\n * Tells if a value from storage has all fields of a batch. `keyOf` cannot match\n * an entry without `id` after delivery. The library then retries that entry with no\n * end, and the entry blocks each batch behind it. An entry without `attempts` counts\n * as NaN. That count never reaches `maxAttempts`. Thus the library never drops the\n * entry as a dead letter.\n * @param value Parsed storage entry.\n * @returns True when each required field is present and has the correct type.\n */\nexport function isLogBatch(value: unknown): value is LogBatch {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const id: unknown = Reflect.get(value, \"id\");\n const createdAt: unknown = Reflect.get(value, \"createdAt\");\n const attempts: unknown = Reflect.get(value, \"attempts\");\n const records: unknown = Reflect.get(value, \"records\");\n\n return (\n typeof id === \"string\" &&\n typeof createdAt === \"number\" &&\n typeof attempts === \"number\" &&\n Array.isArray(records)\n );\n}\n\n/**\n * Splits a batch that the server rejected as too large into two halves.\n * Each half gets a new id. Each half keeps the age and attempts of the original batch.\n * @param batch The rejected batch.\n * @param diagnostics Diagnostics reporter for the new batch ids.\n * @returns Two batches, or `null` if a single record is already over the limit.\n */\nexport function splitBatch(batch: LogBatch, diagnostics: Diagnostics): [LogBatch, LogBatch] | null {\n if (batch.records.length < 2) {\n return null;\n }\n\n const middle = Math.floor(batch.records.length / 2);\n const halve = (records: LogRecord[]): LogBatch => ({\n id: newId(diagnostics),\n records,\n createdAt: batch.createdAt,\n attempts: batch.attempts,\n routingContextId: batch.routingContextId,\n persistenceNamespace: batch.persistenceNamespace,\n });\n\n return [halve(batch.records.slice(0, middle)), halve(batch.records.slice(middle))];\n}\n\n/**\n * Reads one attribute of a record. A record from storage can be corrupt. It can be null or have\n * no attributes.\n * @param record Record to read.\n * @param key Attribute key.\n * @returns The attribute value, or undefined for a corrupt record.\n */\nexport function attributeOf(record: LogRecord, key: string): unknown {\n const value: unknown = record;\n if (typeof value !== \"object\" || value === null) {\n return undefined;\n }\n\n const attributes: unknown = Reflect.get(value, \"attributes\");\n if (typeof attributes !== \"object\" || attributes === null) {\n return undefined;\n }\n\n return Reflect.get(attributes, key);\n}\n\n/**\n * Tests if a record is an action. A corrupt record from storage is not an action.\n * @param record Record to test.\n * @returns True for an action record.\n */\nexport function isActionRecord(record: LogRecord): boolean {\n return attributeOf(record, ATTR_LOG_TYPE) === LOG_TYPE_ACTION;\n}\n\n/**\n * Returns the total record count of the batches.\n * @param batches Batches to measure.\n * @returns Total record count.\n */\nexport function countRecords(batches: readonly LogBatch[]): number {\n return batches.reduce((total, batch) => total + batch.records.length, 0);\n}\n"],"mappings":";;;AAqCA,SAAgBG,EAAW,GAAmC;CAC5D,IAAI,OAAOC,KAAU,aAAYA,GAC/B,OAAO;CAGT,IAAMC,IAAc,QAAQ,IAAID,GAAO,IAAI,GACrCE,IAAqB,QAAQ,IAAIF,GAAO,WAAW,GACnDG,IAAoB,QAAQ,IAAIH,GAAO,UAAU,GACjDI,IAAmB,QAAQ,IAAIJ,GAAO,SAAS;CAErD,OACE,OAAOC,KAAO,YACd,OAAOC,KAAc,YACrB,OAAOC,KAAa,YACpB,MAAM,QAAQC,CAAO;AAEzB;AASA,SAAgBC,EAAW,GAAiB,GAAuD;CACjG,IAAIC,EAAM,QAAQ,SAAS,GACzB,OAAO;CAGT,IAAMC,IAAS,KAAK,MAAMD,EAAM,QAAQ,SAAS,CAAC,GAC5CE,KAAS,OAAoC;EACjD,IAAIV,EAAMW,CAAW;EACrB;EACA,WAAWH,EAAM;EACjB,UAAUA,EAAM;EAChB,kBAAkBA,EAAM;EACxB,sBAAsBA,EAAM;CAC9B;CAEA,OAAO,CAACE,EAAMF,EAAM,QAAQ,MAAM,GAAGC,CAAM,CAAC,GAAGC,EAAMF,EAAM,QAAQ,MAAMC,CAAM,CAAC,CAAC;AACnF;AASA,SAAgBG,EAAY,GAAmB,GAAsB;CACnE,IAAMV,IAAiBW;CACvB,IAAI,OAAOX,KAAU,aAAYA,GAC/B;CAGF,IAAMY,IAAsB,QAAQ,IAAIZ,GAAO,YAAY;CAC3D,IAAI,OAAOY,KAAe,YAAYA,GAItC,OAAO,QAAQ,IAAIA,GAAYC,CAAG;AACpC;AAOA,SAAgBC,EAAe,GAA4B;CACzD,OAAOJ,EAAYC,GAAQf,CAAa,MAAMC;AAChD;AAOA,SAAgBkB,EAAa,GAAsC;CACjE,OAAOC,EAAQ,QAAQ,GAAO,MAAUC,IAAQX,EAAM,QAAQ,QAAQ,CAAC;AACzE"}
1
+ {"version":3,"file":"batch-CL9uWYY3.js","names":["LOG_TYPE_ACTION","ATTR_LOG_TYPE","newId","isLogBatch","value","id","createdAt","attempts","records","splitBatch","batch","middle","halve","diagnostics","attributeOf","record","attributes","key","isActionRecord","countRecords","batches","total"],"sources":["../src/models/batch.ts"],"sourcesContent":["// src/models/batch.ts\n//\n// A batch of log records for delivery to the ingest endpoint.\n\nimport { ATTR_LOG_TYPE, LOG_TYPE_ACTION } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { newId } from \"../utils/identity\";\nimport type { LogRecord } from \"./log-record\";\n\n/**\n * A batch of records with a stable id used for server-side deduplication across retries.\n * @see {@link splitBatch}\n */\nexport interface LogBatch {\n /** Application namespace that owns this stored batch. */\n readonly persistenceNamespace?: string;\n /** Delivery context id. It does not change. With isolation, a batch without this id stays stored. */\n readonly routingContextId?: string;\n /** Deduplication key. It stays the same across retries and reloads. */\n id: string;\n /** Records to deliver, in log order. */\n records: LogRecord[];\n /** Batch creation time, in epoch milliseconds. */\n createdAt: number;\n /** Delivery attempts so far. */\n attempts: number;\n}\n\n/**\n * Tells if a value from storage has all fields of a batch. `keyOf` cannot match\n * an entry without `id` after delivery. The library then retries that entry with no\n * end, and the entry blocks each batch behind it. An entry without `attempts` counts\n * as NaN. That count never reaches `maxAttempts`. Thus the library never drops the\n * entry as a dead letter.\n * @param value Parsed storage entry.\n * @returns True when each required field is present and has the correct type.\n */\nexport function isLogBatch(value: unknown): value is LogBatch {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const id: unknown = Reflect.get(value, \"id\");\n const createdAt: unknown = Reflect.get(value, \"createdAt\");\n const attempts: unknown = Reflect.get(value, \"attempts\");\n const records: unknown = Reflect.get(value, \"records\");\n\n return (\n typeof id === \"string\" &&\n typeof createdAt === \"number\" &&\n typeof attempts === \"number\" &&\n Array.isArray(records)\n );\n}\n\n/**\n * Splits a batch that the server rejected as too large into two halves.\n * Each half gets a new id. Each half keeps the age and attempts of the original batch.\n * @param batch The rejected batch.\n * @param diagnostics Diagnostics reporter for the new batch ids.\n * @returns Two batches, or `null` if a single record is already over the limit.\n */\nexport function splitBatch(batch: LogBatch, diagnostics: Diagnostics): [LogBatch, LogBatch] | null {\n if (batch.records.length < 2) {\n return null;\n }\n\n const middle = Math.floor(batch.records.length / 2);\n const halve = (records: LogRecord[]): LogBatch => ({\n id: newId(diagnostics),\n records,\n createdAt: batch.createdAt,\n attempts: batch.attempts,\n routingContextId: batch.routingContextId,\n persistenceNamespace: batch.persistenceNamespace,\n });\n\n return [halve(batch.records.slice(0, middle)), halve(batch.records.slice(middle))];\n}\n\n/**\n * Reads one attribute of a record. A record from storage can be corrupt. It can be null or have\n * no attributes.\n * @param record Record to read.\n * @param key Attribute key.\n * @returns The attribute value, or undefined for a corrupt record.\n */\nexport function attributeOf(record: LogRecord, key: string): unknown {\n const value: unknown = record;\n if (typeof value !== \"object\" || value === null) {\n return undefined;\n }\n\n const attributes: unknown = Reflect.get(value, \"attributes\");\n if (typeof attributes !== \"object\" || attributes === null) {\n return undefined;\n }\n\n return Reflect.get(attributes, key);\n}\n\n/**\n * Tests if a record is an action. A corrupt record from storage is not an action.\n * @param record Record to test.\n * @returns True for an action record.\n */\nexport function isActionRecord(record: LogRecord): boolean {\n return attributeOf(record, ATTR_LOG_TYPE) === LOG_TYPE_ACTION;\n}\n\n/**\n * Returns the total record count of the batches.\n * @param batches Batches to measure.\n * @returns Total record count.\n */\nexport function countRecords(batches: readonly LogBatch[]): number {\n return batches.reduce((total, batch) => total + batch.records.length, 0);\n}\n"],"mappings":";;;AAqCA,SAAgBG,EAAW,GAAmC;CAC5D,IAAI,OAAOC,KAAU,aAAYA,GAC/B,OAAO;CAGT,IAAMC,IAAc,QAAQ,IAAID,GAAO,IAAI,GACrCE,IAAqB,QAAQ,IAAIF,GAAO,WAAW,GACnDG,IAAoB,QAAQ,IAAIH,GAAO,UAAU,GACjDI,IAAmB,QAAQ,IAAIJ,GAAO,SAAS;CAErD,OACE,OAAOC,KAAO,YACd,OAAOC,KAAc,YACrB,OAAOC,KAAa,YACpB,MAAM,QAAQC,CAAO;AAEzB;AASA,SAAgBC,EAAW,GAAiB,GAAuD;CACjG,IAAIC,EAAM,QAAQ,SAAS,GACzB,OAAO;CAGT,IAAMC,IAAS,KAAK,MAAMD,EAAM,QAAQ,SAAS,CAAC,GAC5CE,KAAS,OAAoC;EACjD,IAAIV,EAAMW,CAAW;EACrB;EACA,WAAWH,EAAM;EACjB,UAAUA,EAAM;EAChB,kBAAkBA,EAAM;EACxB,sBAAsBA,EAAM;CAC9B;CAEA,OAAO,CAACE,EAAMF,EAAM,QAAQ,MAAM,GAAGC,CAAM,CAAC,GAAGC,EAAMF,EAAM,QAAQ,MAAMC,CAAM,CAAC,CAAC;AACnF;AASA,SAAgBG,EAAY,GAAmB,GAAsB;CACnE,IAAMV,IAAiBW;CACvB,IAAI,OAAOX,KAAU,aAAYA,GAC/B;CAGF,IAAMY,IAAsB,QAAQ,IAAIZ,GAAO,YAAY;CAC3D,IAAI,OAAOY,KAAe,YAAYA,GAItC,OAAO,QAAQ,IAAIA,GAAYC,CAAG;AACpC;AAOA,SAAgBC,EAAe,GAA4B;CACzD,OAAOJ,EAAYC,GAAQd,CAAa,MAAMD;AAChD;AAOA,SAAgBmB,EAAa,GAAsC;CACjE,OAAOC,EAAQ,QAAQ,GAAO,MAAUC,IAAQX,EAAM,QAAQ,QAAQ,CAAC;AACzE"}
package/dist/bus/bus.d.ts CHANGED
@@ -46,6 +46,8 @@ export declare class Bus {
46
46
  private readonly rates;
47
47
  /** Message counts for each named source or link in the current rate window. */
48
48
  private readonly channelRates;
49
+ /** Reply of each same-origin child on the direct link. A weak reply frees a navigated frame. */
50
+ private readonly directReplies;
49
51
  /**
50
52
  * Checks if this source can receive a control message. A window can read a message
51
53
  * even when its address names another window.
@@ -78,6 +80,19 @@ export declare class Bus {
78
80
  * @param openFin True to send it to OpenFin views too.
79
81
  */
80
82
  private passContext;
83
+ /**
84
+ * Sends a security context message to each same-origin child on the direct link.
85
+ * It drops a child that is closed, freed or no longer permitted.
86
+ * @param message Security context message.
87
+ */
88
+ private postToDirectChildren;
89
+ /**
90
+ * Keeps the reply of a direct child for the next context id. It drops each closed child.
91
+ * A removed frame then does not keep its document in memory.
92
+ * @param peer Window of the child.
93
+ * @param reply Reply callback of the child.
94
+ */
95
+ private keepDirectReply;
81
96
  /** Current bus role. The default is "sender". */
82
97
  private role;
83
98
  /** Upstream forwarding link, or null when acting as sender. */
@@ -1,35 +1,34 @@
1
- import { D as e, O as t, Qt as n, Rt as r, T as i, an as a, w as o } from "./constants-CN7GE1Lt.js";
2
- import { c as s, s as c } from "./sampling-Cm3WhI0a.js";
3
- import { r as l } from "./deadline-5_PecIl5.js";
4
- import { t as u } from "./openfin-BwEN0uj4.js";
5
- import { r as d } from "./journey-BUJ4WJxP.js";
6
- import { n as f, t as p } from "./fixed-window-CtaFHanJ.js";
7
- import { n as m, t as h } from "./remote-rules-DIcC5vVC.js";
8
- //#region src/bus/validation.ts
9
- function g(e) {
10
- if (typeof e != "object" || !e) return !1;
11
- let n = e;
1
+ import { M as e, O as t, Xt as n, bn as r, dn as i, j as a, k as o } from "./constants-zyrqveN4.js";
2
+ import { r as s } from "./journey-CuJrHzEg.js";
3
+ import { n as c, t as l } from "./remote-rules-Cfb4K-Nl.js";
4
+ import { n as u, t as d } from "./log-record-CAoGBBf3.js";
5
+ import { t as f } from "./openfin-Bxelt0yg.js";
6
+ import { n as p, t as m } from "./fixed-window-Dq3MLUUv.js";
7
+ import { r as h } from "./deadline-BOjOxNHj.js";
8
+ // src/bus/validation.ts
9
+ function g(t) {
10
+ if (typeof t != "object" || !t) return !1;
11
+ let n = t;
12
12
  if (typeof n.from != "string" || !n.from || typeof n.t != "string") return !1;
13
- let r = (e) => typeof n[e] == "string";
13
+ let i = (e) => typeof n[e] == "string";
14
14
  switch (n.t) {
15
- case t.hello:
16
- case t.tab: return r("tabId");
17
- case t.welcome: return r("to") && r("tabId") && (n.routingContextId === void 0 || r("routingContextId"));
18
- case t.journeyRequest:
19
- case t.samplingRequest: return !0;
20
- case t.securityContext: return r("id") && n.id !== "";
21
- case t.journey: return (n.to === void 0 || r("to")) && "journey" in n;
22
- case t.sampling: return r("to") && "rules" in n;
23
- case t.records: return Array.isArray(n.records) && (n.routingContextId === void 0 || r("routingContextId")) && n.records.every((e) => !s(e) || !c(e.severityText) ? !1 : !Array.isArray(e.attributes) && !Array.isArray(e.resource) && /^\d+$/.test(e.timeUnixNano) && (e.observedTimeUnixNano === void 0 || /^\d+$/.test(e.observedTimeUnixNano)) && typeof e.traceId == "string" && /^(?:[a-f\d]{32})?$/.test(e.traceId) && typeof e.spanId == "string" && /^(?:[a-f\d]{16})?$/.test(e.spanId) && Number.isInteger(e.traceFlags) && e.traceFlags >= 0 && e.traceFlags <= 255 && e.severityNumber === a[e.severityText]);
15
+ case e.hello:
16
+ case e.tab: return i("tabId");
17
+ case e.welcome: return i("to") && i("tabId") && (n.routingContextId === void 0 || i("routingContextId"));
18
+ case e.journeyRequest:
19
+ case e.samplingRequest: return !0;
20
+ case e.securityContext: return i("id") && n.id !== "";
21
+ case e.journey: return (n.to === void 0 || i("to")) && "journey" in n;
22
+ case e.sampling: return i("to") && "rules" in n;
23
+ case e.records: return Array.isArray(n.records) && (n.routingContextId === void 0 || i("routingContextId")) && n.records.every((e) => !u(e) || !d(e.severityText) ? !1 : !Array.isArray(e.attributes) && !Array.isArray(e.resource) && /^\d+$/.test(e.timeUnixNano) && (e.observedTimeUnixNano === void 0 || /^\d+$/.test(e.observedTimeUnixNano)) && typeof e.traceId == "string" && /^(?:[a-f\d]{32})?$/.test(e.traceId) && typeof e.spanId == "string" && /^(?:[a-f\d]{16})?$/.test(e.spanId) && Number.isInteger(e.traceFlags) && e.traceFlags >= 0 && e.traceFlags <= 255 && e.severityNumber === r[e.severityText]);
24
24
  default: return !1;
25
25
  }
26
26
  }
27
- //#endregion
28
- //#region src/models/bus.ts
29
- function _(t) {
27
+ // src/models/bus.ts
28
+ function _(e) {
30
29
  return {
31
- p: e,
32
- m: t
30
+ p: a,
31
+ m: e
33
32
  };
34
33
  }
35
34
  function v(e) {
@@ -39,9 +38,8 @@ function v(e) {
39
38
  let n = t.m;
40
39
  return typeof n.t == "string" ? n : null;
41
40
  }
42
- //#endregion
43
- //#region src/bus/links.ts
44
- var y = Symbol.for(n), b = "null";
41
+ // src/bus/links.ts
42
+ var y = Symbol.for(i), b = "null";
45
43
  function x(e, t) {
46
44
  return e === b ? `The bus ignored ${t} from a sandboxed frame. The frame has an opaque origin. Set bus.mode: "sender" in the frame. Add allow-same-origin to the sandbox attribute only for content that you trust.` : `The bus ignored ${t} from ${e}. If you own this origin, add it to bus.trustedOrigins.`;
47
45
  }
@@ -183,7 +181,7 @@ function E(e, t, n) {
183
181
  }) : null;
184
182
  }
185
183
  function D(e, t, n, r) {
186
- let i = u()?.InterApplicationBus;
184
+ let i = f()?.InterApplicationBus;
187
185
  if (!i) return null;
188
186
  if (!t) return r.report("openfin.unavailable", "OpenFin gives no application uuid. The InterApplicationBus link stays closed."), null;
189
187
  let a = `${e}.${t}`;
@@ -241,10 +239,9 @@ function k(e, t, n) {
241
239
  }
242
240
  };
243
241
  }
244
- //#endregion
245
- //#region src/bus/bus.ts
242
+ // src/bus/bus.ts
246
243
  var A = {
247
- timeoutMs: i,
244
+ timeoutMs: o,
248
245
  maxAttempts: 3
249
246
  }, j = [
250
247
  "children",
@@ -261,9 +258,10 @@ var A = {
261
258
  sources = /* @__PURE__ */ new Map();
262
259
  rates = /* @__PURE__ */ new WeakMap();
263
260
  channelRates = /* @__PURE__ */ new Map();
264
- mayPost(e, n) {
261
+ directReplies = /* @__PURE__ */ new Map();
262
+ mayPost(t, n) {
265
263
  let r = this.sources.get(n)?.permissions;
266
- return r ? e.t === t.journey ? r.includes("journey:read") : e.t === t.journeyRequest ? r.includes("journey:write") : e.t !== t.sampling || r.includes("sampling:read") : this.config.bus.sourcePolicy === "trusted-origin";
264
+ return r ? t.t === e.journey ? r.includes("journey:read") : t.t === e.journeyRequest ? r.includes("journey:write") : t.t !== e.sampling || r.includes("sampling:read") : this.config.bus.sourcePolicy === "trusted-origin";
267
265
  }
268
266
  registerFrame(e, t) {
269
267
  let n = typeof HTMLIFrameElement > "u" ? void 0 : HTMLIFrameElement, r = n && e instanceof n ? e.contentWindow : e;
@@ -284,13 +282,29 @@ var A = {
284
282
  rotateContext() {
285
283
  this.passContext(this.role === "sender");
286
284
  }
287
- passContext(e) {
285
+ passContext(t) {
288
286
  let n = {
289
- t: t.securityContext,
287
+ t: e.securityContext,
290
288
  from: this.contextId,
291
289
  id: this.config.securityContext.id
292
290
  };
293
- this.postOver("children", n), this.postOver("worker", n), e && this.postOver("openfin", n);
291
+ this.postOver("children", n), this.postOver("worker", n), this.postToDirectChildren(n), t && this.postOver("openfin", n);
292
+ }
293
+ postToDirectChildren(e) {
294
+ for (let [t, n] of this.directReplies) {
295
+ let r = n.deref();
296
+ !r || t.closed || !this.isRegistered(t, location.origin) ? this.directReplies.delete(t) : this.diagnostics.guard("bus.send_failed", "The reply to a direct child failed.", () => {
297
+ r(e, {
298
+ link: "direct",
299
+ origin: "same-origin",
300
+ peer: t
301
+ });
302
+ });
303
+ }
304
+ }
305
+ keepDirectReply(e, t) {
306
+ for (let e of this.directReplies.keys()) e.closed && this.directReplies.delete(e);
307
+ this.directReplies.set(e, new WeakRef(t));
294
308
  }
295
309
  role = "sender";
296
310
  upstream = null;
@@ -330,25 +344,25 @@ var A = {
330
344
  via: i ? n.kind : "none"
331
345
  }), this.announce(), this.role;
332
346
  }
333
- sendRecords(e) {
334
- let { maxRecordsPerMessage: n, maxMessageBytes: r } = this.config.bus, i = new TextEncoder(), a = (e) => r ? i.encode(JSON.stringify(e)).length : 0, o = (e) => ({
335
- t: t.records,
347
+ sendRecords(t) {
348
+ let { maxRecordsPerMessage: n, maxMessageBytes: r } = this.config.bus, i = new TextEncoder(), a = (e) => r ? i.encode(JSON.stringify(e)).length : 0, o = (t) => ({
349
+ t: e.records,
336
350
  from: this.contextId,
337
- records: e,
351
+ records: t,
338
352
  routingContextId: this.config.securityContext.id || void 0
339
353
  }), s = a(o([])), c = [], l = s;
340
- for (let t of e) {
341
- let e = a(t);
342
- if (r && s + e > r) {
354
+ for (let e of t) {
355
+ let t = a(e);
356
+ if (r && s + t > r) {
343
357
  this.diagnostics.count("bus.rejected_message");
344
358
  continue;
345
359
  }
346
360
  let i = +(c.length > 0);
347
- (n && c.length >= n || r && l + i + e > r) && (this.upstream?.post(o(c)), c = [], l = s), l += +(c.length > 0) + e, c.push(t);
361
+ (n && c.length >= n || r && l + i + t > r) && (this.upstream?.post(o(c)), c = [], l = s), l += +(c.length > 0) + t, c.push(e);
348
362
  }
349
363
  c.length > 0 && this.upstream?.post(o(c));
350
364
  }
351
- acceptDirect(e, n, r) {
365
+ acceptDirect(t, n, r) {
352
366
  let i = {
353
367
  link: "direct",
354
368
  origin: "same-origin",
@@ -359,11 +373,11 @@ var A = {
359
373
  n(e, i);
360
374
  }
361
375
  };
362
- this.acceptsMessage(e, a, !0) && e.from !== this.contextId && (e.t === t.samplingRequest ? n(this.rulesAnswer(e.from), i) : (e.t === t.records && !this.awaitingWelcome && e.routingContextId !== this.config.securityContext.id && n({
363
- t: t.securityContext,
376
+ this.acceptsMessage(t, a, !0) && t.from !== this.contextId && (r && this.keepDirectReply(r, n), t.t === e.samplingRequest ? n(this.rulesAnswer(t.from), i) : (t.t === e.records && !this.awaitingWelcome && t.routingContextId !== this.config.securityContext.id && n({
377
+ t: e.securityContext,
364
378
  from: this.contextId,
365
379
  id: this.config.securityContext.id
366
- }, i), this.routeMessage(e, a)));
380
+ }, i), this.routeMessage(t, a)));
367
381
  }
368
382
  attachWorker(e, t = {}) {
369
383
  let n = {
@@ -383,15 +397,15 @@ var A = {
383
397
  t >= 0 && this.links.splice(t, 1), this.sources.get(e) === n && this.sources.delete(e);
384
398
  };
385
399
  }
386
- broadcastJourney(e) {
400
+ broadcastJourney(t) {
387
401
  this.postJourney({
388
- t: t.journey,
402
+ t: e.journey,
389
403
  from: this.contextId,
390
- journey: e
404
+ journey: t
391
405
  });
392
406
  }
393
407
  destroy() {
394
- this.sources.clear(), this.destroyed = !0, clearInterval(this.rulesPoll), this.rulesPoll = void 0;
408
+ this.sources.clear(), this.directReplies.clear(), this.destroyed = !0, clearInterval(this.rulesPoll), this.rulesPoll = void 0;
395
409
  for (let e of this.allLinks()) e.close();
396
410
  this.links.length = 0, this.upstream = null, this.ownerId = null, this.openFinLink = null;
397
411
  }
@@ -418,7 +432,7 @@ var A = {
418
432
  }
419
433
  return r || this.diagnostics.count("bus.rejected_message"), r;
420
434
  }
421
- passesChecks(e, n, r) {
435
+ passesChecks(t, n, r) {
422
436
  let { bus: i } = this.config, a = typeof n.peer == "object" ? this.sources.get(n.peer) : void 0;
423
437
  if (r && i.sourcePolicy === "registered" && !a) return !1;
424
438
  let o = typeof n.peer == "object" ? n.peer : void 0, s = typeof n.peer == "string" ? n.peer : n.link, c = Date.now(), l = (o ? this.rates.get(o) : this.channelRates.get(s)) ?? {
@@ -427,72 +441,72 @@ var A = {
427
441
  };
428
442
  if (o) this.rates.set(o, l);
429
443
  else {
430
- for (let [e, t] of this.channelRates) f(t, 1e3, c) && this.channelRates.delete(e);
444
+ for (let [e, t] of this.channelRates) p(t, 1e3, c) && this.channelRates.delete(e);
431
445
  if (i.maxTrackedSources && this.channelRates.size >= i.maxTrackedSources && !this.channelRates.has(s)) return !1;
432
446
  this.channelRates.set(s, l);
433
447
  }
434
- if (!p(l, i.maxMessagesPerSecond || Infinity, 1e3)) return !1;
435
- let u = JSON.stringify(e, (e, t) => {
448
+ if (!m(l, i.maxMessagesPerSecond || Infinity, 1e3)) return !1;
449
+ let u = JSON.stringify(t, (e, t) => {
436
450
  if (i.validation === "strict" && typeof t == "number" && !Number.isFinite(t)) throw Error("Non-finite value");
437
451
  return t;
438
452
  });
439
- if (i.maxMessageBytes && new TextEncoder().encode(u).length > i.maxMessageBytes || i.validation === "strict" && !g(e) || e.t === t.records && i.maxRecordsPerMessage && e.records.length > i.maxRecordsPerMessage) return !1;
453
+ if (i.maxMessageBytes && new TextEncoder().encode(u).length > i.maxMessageBytes || i.validation === "strict" && !g(t) || t.t === e.records && i.maxRecordsPerMessage && t.records.length > i.maxRecordsPerMessage) return !1;
440
454
  if (a) {
441
- let n = e.t === t.records ? "records" : e.t === t.journey ? "journey:write" : e.t === t.journeyRequest ? "journey:read" : e.t === t.samplingRequest ? "sampling:read" : void 0;
455
+ let n = t.t === e.records ? "records" : t.t === e.journey ? "journey:write" : t.t === e.journeyRequest ? "journey:read" : t.t === e.samplingRequest ? "sampling:read" : void 0;
442
456
  if (n && !a.permissions?.includes(n)) return !1;
443
457
  }
444
- return r && (e.t === t.sampling || e.t === t.securityContext) ? !1 : i.sourcePolicy !== "registered" || n.link !== "broadcast" || e.t !== t.records;
458
+ return r && (t.t === e.sampling || t.t === e.securityContext) ? !1 : i.sourcePolicy !== "registered" || n.link !== "broadcast" || t.t !== e.records;
445
459
  }
446
- routeMessage(e, n) {
447
- if (e.from !== this.contextId) switch (e.t) {
448
- case t.hello:
460
+ routeMessage(t, n) {
461
+ if (t.from !== this.contextId) switch (t.t) {
462
+ case e.hello:
449
463
  this.canOwn(n.link) && this.answer(n, {
450
- t: t.welcome,
464
+ t: e.welcome,
451
465
  from: this.contextId,
452
- to: e.from,
466
+ to: t.from,
453
467
  tabId: this.tabId,
454
468
  routingContextId: this.awaitingWelcome ? void 0 : this.config.securityContext.id || void 0
455
469
  });
456
470
  break;
457
- case t.welcome:
458
- if (e.to !== this.contextId) break;
471
+ case e.welcome:
472
+ if (t.to !== this.contextId) break;
459
473
  if (this.awaitingWelcome?.link === n.link || this.upstream?.kind === n.link && this.ownerId === null) {
460
- this.ownerId = e.from, this.ownerPeer = n.peer;
461
- let t = this.config.securityContext.id;
462
- if (e.routingContextId && this.handlers.onSecurityContext?.(e.routingContextId) === !1) break;
463
- this.config.securityContext.id !== t && this.passContext(!1), this.awaitingWelcome?.settle(!0);
474
+ this.ownerId = t.from, this.ownerPeer = n.peer;
475
+ let e = this.config.securityContext.id;
476
+ if (t.routingContextId && this.handlers.onSecurityContext?.(t.routingContextId) === !1) break;
477
+ this.config.securityContext.id !== e && this.passContext(!1), this.awaitingWelcome?.settle(!0);
464
478
  }
465
479
  break;
466
- case t.records:
467
- if (this.config.securityContext.isolation && this.config.securityContext.id && e.routingContextId !== this.config.securityContext.id) {
480
+ case e.records:
481
+ if (this.config.securityContext.isolation && this.config.securityContext.id && t.routingContextId !== this.config.securityContext.id) {
468
482
  this.diagnostics.count("security.context_mismatch");
469
483
  break;
470
484
  }
471
- this.role === "sender" ? this.handlers.onRecords(e.records) : this.upstream && this.canRelay(n.link) && this.upstream.post(e);
485
+ this.role === "sender" ? this.handlers.onRecords(t.records) : this.upstream && this.canRelay(n.link) && this.upstream.post(t);
472
486
  break;
473
- case t.securityContext:
474
- n.link === this.upstream?.kind && this.ownerId === e.from && this.ownerPeer === n.peer && this.handlers.onSecurityContext?.(e.id) !== !1 && this.rotateContext();
487
+ case e.securityContext:
488
+ n.link === this.upstream?.kind && this.ownerId === t.from && this.ownerPeer === n.peer && this.handlers.onSecurityContext?.(t.id) !== !1 && this.rotateContext();
475
489
  break;
476
- case t.journey:
477
- this.acceptsJourney(e, n) && this.applyJourney(e.journey);
490
+ case e.journey:
491
+ this.acceptsJourney(t, n) && this.applyJourney(t.journey);
478
492
  break;
479
- case t.journeyRequest: {
493
+ case e.journeyRequest: {
480
494
  let r = this.handlers.onJourneyRequest();
481
495
  r && this.journeyLink(n.link) && this.answer(n, {
482
- t: t.journey,
496
+ t: e.journey,
483
497
  from: this.contextId,
484
- to: e.from,
498
+ to: t.from,
485
499
  journey: r
486
500
  });
487
501
  break;
488
502
  }
489
- case t.samplingRequest:
490
- (this.role === "forwarder" ? n.link !== this.upstream?.kind : this.canOwn(n.link)) && this.answer(n, this.rulesAnswer(e.from));
503
+ case e.samplingRequest:
504
+ (this.role === "forwarder" ? n.link !== this.upstream?.kind : this.canOwn(n.link)) && this.answer(n, this.rulesAnswer(t.from));
491
505
  break;
492
- case t.sampling:
493
- this.acceptsRules(e.to, n) && this.applyRules(e.rules);
506
+ case e.sampling:
507
+ this.acceptsRules(t.to, n) && this.applyRules(t.rules);
494
508
  break;
495
- case t.tab: n.link === "broadcast" && e.tabId === this.tabId && this.contextId > e.from && this.handlers.onTabConflict();
509
+ case e.tab: n.link === "broadcast" && t.tabId === this.tabId && this.contextId > t.from && this.handlers.onTabConflict();
496
510
  }
497
511
  }
498
512
  answer(e, t) {
@@ -508,7 +522,7 @@ var A = {
508
522
  let e = this.config.bus.openFinRole;
509
523
  if (e !== "auto") return e === "provider";
510
524
  if (this.platform.platform !== "openfin" && this.platform.platform !== "openfin_web") return !1;
511
- let t = u()?.me;
525
+ let t = f()?.me;
512
526
  return !t?.identity || t.isView ? !1 : !!(t.identity.name && t.identity.name === t.identity.uuid);
513
527
  }
514
528
  orphanPolicy() {
@@ -529,7 +543,7 @@ var A = {
529
543
  let e = (e) => {
530
544
  e && this.links.push(e);
531
545
  };
532
- this.platform.isWorker || this.ensureChildrenLink(), this.platform.isTopLevelDocument && e(E(o, this.receive, this.diagnostics)), (this.platform.platform === "openfin" || this.platform.platform === "openfin_web") && e(this.ensureOpenFinLink());
546
+ this.platform.isWorker || this.ensureChildrenLink(), this.platform.isTopLevelDocument && e(E(t, this.receive, this.diagnostics)), (this.platform.platform === "openfin" || this.platform.platform === "openfin_web") && e(this.ensureOpenFinLink());
533
547
  }
534
548
  ensureChildrenLink() {
535
549
  if (this.links.some((e) => e.kind === "children")) return;
@@ -545,22 +559,22 @@ var A = {
545
559
  e && this.links.push(e);
546
560
  }
547
561
  ensureOpenFinLink() {
548
- return this.openFinLink ??= D(o, this.platform.openfinUuid, this.receive, this.diagnostics), this.openFinLink;
562
+ return this.openFinLink ??= D(t, this.platform.openfinUuid, this.receive, this.diagnostics), this.openFinLink;
549
563
  }
550
- handshake(e) {
564
+ handshake(t) {
551
565
  return new Promise((n) => {
552
566
  let r = !1, i = (e) => {
553
567
  r || (r = !0, this.awaitingWelcome = null, clearTimeout(a), n(e));
554
568
  };
555
569
  this.awaitingWelcome = {
556
- link: e.kind,
570
+ link: t.kind,
557
571
  settle: i
558
572
  };
559
573
  let a = setTimeout(() => {
560
574
  i(!1);
561
575
  }, this.handshakeOptions.timeoutMs);
562
- l(a), e.post({
563
- t: t.hello,
576
+ h(a), t.post({
577
+ t: e.hello,
564
578
  from: this.contextId,
565
579
  tabId: this.tabId
566
580
  });
@@ -568,15 +582,15 @@ var A = {
568
582
  }
569
583
  announce() {
570
584
  this.postOver("broadcast", {
571
- t: t.tab,
585
+ t: e.tab,
572
586
  from: this.contextId,
573
587
  tabId: this.tabId
574
588
  }), this.upstream && this.ownerId === null && this.upstream.post({
575
- t: t.hello,
589
+ t: e.hello,
576
590
  from: this.contextId,
577
591
  tabId: this.tabId
578
592
  }), this.postJourney({
579
- t: t.journeyRequest,
593
+ t: e.journeyRequest,
580
594
  from: this.contextId
581
595
  }), this.pollRules(), this.passContext(!1);
582
596
  }
@@ -601,15 +615,15 @@ var A = {
601
615
  this.handlers.onJourney(null);
602
616
  return;
603
617
  }
604
- let t = d(e);
618
+ let t = s(e);
605
619
  t === null ? this.diagnostics.report("record.dropped_malformed", "The bus dropped a journey message. Its payload is not a journey.", { type: "journey" }) : this.handlers.onJourney(t);
606
620
  }
607
- rulesAnswer(e) {
621
+ rulesAnswer(t) {
608
622
  let n = this.handlers.remote.sampling?.wire() ?? null;
609
623
  return {
610
- t: t.sampling,
624
+ t: e.sampling,
611
625
  from: this.contextId,
612
- to: e,
626
+ to: t,
613
627
  rules: n
614
628
  };
615
629
  }
@@ -623,25 +637,24 @@ var A = {
623
637
  }
624
638
  applyRules(e) {
625
639
  if (e === null) {
626
- h(this.handlers.remote, this.config, null);
640
+ l(this.handlers.remote, this.config, null);
627
641
  return;
628
642
  }
629
- let t = m(e, this.diagnostics);
630
- t && h(this.handlers.remote, this.config, t);
643
+ let t = c(e, this.diagnostics);
644
+ t && l(this.handlers.remote, this.config, t);
631
645
  }
632
646
  pollRules() {
633
- let { upstream: e } = this;
634
- if (this.destroyed || this.role !== "forwarder" || !e) return;
635
- let n = () => {
636
- this.config.sampling.remote && e.post({
637
- t: t.samplingRequest,
647
+ let { upstream: t } = this;
648
+ if (this.destroyed || this.role !== "forwarder" || !t) return;
649
+ let r = () => {
650
+ this.config.sampling.remote && t.post({
651
+ t: e.samplingRequest,
638
652
  from: this.contextId
639
653
  });
640
654
  };
641
- n(), this.rulesPoll = setInterval(n, r), l(this.rulesPoll);
655
+ r(), this.rulesPoll = setInterval(r, n), h(this.rulesPoll);
642
656
  }
643
657
  };
644
- //#endregion
645
658
  export { M as Bus };
646
659
 
647
- //# sourceMappingURL=bus-DeOPHWaD.js.map
660
+ //# sourceMappingURL=bus-BZ0GldpT.js.map