@utk09/ui-observability 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +77 -1
- package/README.md +323 -113
- package/bin/uiobs.mjs +1 -1
- package/dist/{batch-BMdT9mKm.js → batch-BjQUwjA6.js} +5 -6
- package/dist/batch-BjQUwjA6.js.map +1 -0
- package/dist/{batch-BHXypM1j.cjs → batch-D5LlU4Q9.cjs} +2 -2
- package/dist/batch-D5LlU4Q9.cjs.map +1 -0
- package/dist/bus/bus.d.ts +48 -47
- package/dist/bus/links.d.ts +4 -4
- package/dist/bus/validation.d.ts +1 -1
- package/dist/bus-D_7pd7RN.cjs +2 -0
- package/dist/bus-D_7pd7RN.cjs.map +1 -0
- package/dist/{bus-DKfBaica.js → bus-ecxUNTja.js} +105 -109
- package/dist/bus-ecxUNTja.js.map +1 -0
- package/dist/capture/console.d.ts +10 -10
- package/dist/capture/errors.d.ts +6 -6
- package/dist/capture/interactions.d.ts +14 -14
- package/dist/capture/lifecycle.d.ts +3 -3
- package/dist/capture/long-frames.d.ts +6 -6
- package/dist/capture/network.d.ts +17 -17
- package/dist/capture/profiler-frames.d.ts +44 -0
- package/dist/capture/replay-buffer.d.ts +46 -0
- package/dist/capture/replay-upload.d.ts +74 -0
- package/dist/capture/replay.d.ts +114 -0
- package/dist/capture/reports.d.ts +2 -2
- package/dist/capture/resource-timing.d.ts +1 -1
- package/dist/capture/server-timing.d.ts +3 -3
- package/dist/capture/storm.d.ts +3 -3
- package/dist/capture/types.d.ts +45 -33
- package/dist/capture/unclean-exit.d.ts +8 -8
- package/dist/capture/user-timing.d.ts +3 -3
- package/dist/capture/web-socket.d.ts +11 -11
- package/dist/capture/web-vitals.d.ts +20 -7
- package/dist/compression-AJJCMBOa.js +11 -0
- package/dist/compression-AJJCMBOa.js.map +1 -0
- package/dist/compression-lD9abCcO.cjs +2 -0
- package/dist/compression-lD9abCcO.cjs.map +1 -0
- package/dist/console-CLz_PvFn.cjs +2 -0
- package/dist/console-CLz_PvFn.cjs.map +1 -0
- package/dist/{console-BX_0UCV7.js → console-cwgHKXvM.js} +14 -15
- package/dist/console-cwgHKXvM.js.map +1 -0
- package/dist/constants-Bwl_YtQi.js +349 -0
- package/dist/constants-Bwl_YtQi.js.map +1 -0
- package/dist/constants-DakMxVB2.cjs +2 -0
- package/dist/constants-DakMxVB2.cjs.map +1 -0
- package/dist/constants.d.ts +150 -103
- package/dist/context-storage-BjzeBSxH.cjs.map +1 -1
- package/dist/{context-storage-DxZf4Gfh.js → context-storage-BzkoHzkQ.js} +2 -3
- package/dist/context-storage-BzkoHzkQ.js.map +1 -0
- package/dist/core/breadcrumbs.d.ts +16 -15
- package/dist/core/config.d.ts +3 -3
- package/dist/core/context.d.ts +7 -7
- package/dist/core/debug-buffer.d.ts +10 -10
- package/dist/core/debug-bundle.d.ts +3 -3
- package/dist/core/deferred.d.ts +2 -2
- package/dist/core/diagnostics.d.ts +24 -21
- package/dist/core/drops.d.ts +7 -7
- package/dist/core/hold-buffer.d.ts +1 -1
- package/dist/core/journey.d.ts +22 -23
- package/dist/core/logger.d.ts +22 -21
- package/dist/core/measure.d.ts +7 -7
- package/dist/core/meter.d.ts +25 -21
- package/dist/core/pipeline.d.ts +42 -41
- package/dist/core/profile-buckets.d.ts +31 -0
- package/dist/core/profiler.d.ts +218 -0
- package/dist/core/record.d.ts +23 -23
- package/dist/core/remote-rules.d.ts +4 -4
- package/dist/core/remote-sampling.d.ts +21 -20
- package/dist/core/runtime.d.ts +206 -137
- package/dist/core/sampling.d.ts +18 -18
- package/dist/core/sender.d.ts +22 -20
- package/dist/core/spans.d.ts +5 -5
- package/dist/{deadline-5_PecIl5.js → deadline-C4ccAuk5.js} +4 -9
- package/dist/deadline-C4ccAuk5.js.map +1 -0
- package/dist/deadline-CUGbto-y.cjs +2 -0
- package/dist/deadline-CUGbto-y.cjs.map +1 -0
- package/dist/{debug-bundle-CZZ6SQQh.js → debug-bundle-BOdYmCeV.js} +12 -6
- package/dist/debug-bundle-BOdYmCeV.js.map +1 -0
- package/dist/debug-bundle-Ex4L_LSP.cjs +2 -0
- package/dist/debug-bundle-Ex4L_LSP.cjs.map +1 -0
- package/dist/doctor.cjs +1 -1
- package/dist/doctor.cjs.map +1 -1
- package/dist/doctor.d.ts +16 -6
- package/dist/doctor.js +148 -54
- package/dist/doctor.js.map +1 -1
- package/dist/{emergency-queue-Cs8-i2xw.js → emergency-queue-B9WZxanZ.js} +15 -17
- package/dist/emergency-queue-B9WZxanZ.js.map +1 -0
- package/dist/{emergency-queue-CQ-9acZf.cjs → emergency-queue-HBpL5r3V.cjs} +2 -2
- package/dist/emergency-queue-HBpL5r3V.cjs.map +1 -0
- package/dist/{error-like-Ywo5uRHo.js → error-like-B11pB4aL.js} +2 -3
- package/dist/error-like-B11pB4aL.js.map +1 -0
- package/dist/error-like-gGRx2s36.cjs.map +1 -1
- package/dist/{errors-oyxrpHjY.js → errors-D6bwgJtO.js} +5 -6
- package/dist/errors-D6bwgJtO.js.map +1 -0
- package/dist/{errors-CigX45pL.cjs → errors-DCOCRdSi.cjs} +2 -2
- package/dist/errors-DCOCRdSi.cjs.map +1 -0
- package/dist/{factory-BkjNzPYL.cjs → factory-DLFDjdLv.cjs} +2 -2
- package/dist/factory-DLFDjdLv.cjs.map +1 -0
- package/dist/{factory-Bgsky_e0.js → factory-e9Qo3K0z.js} +18 -22
- package/dist/factory-e9Qo3K0z.js.map +1 -0
- package/dist/fixed-window-CvESpFYV.cjs.map +1 -1
- package/dist/{fixed-window-CtaFHanJ.js → fixed-window-Dq3MLUUv.js} +2 -3
- package/dist/fixed-window-Dq3MLUUv.js.map +1 -0
- package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
- package/dist/{global-scope-dp2jADRl.js → global-scope-D9I8s-oN.js} +2 -3
- package/dist/global-scope-D9I8s-oN.js.map +1 -0
- package/dist/{guards-CpvOpJL6.js → guards-Cidk71ME.js} +2 -3
- package/dist/guards-Cidk71ME.js.map +1 -0
- package/dist/guards-nJ70syPt.cjs.map +1 -1
- package/dist/{identity-BMlKGHUM.cjs → identity-BlvlgjrU.cjs} +2 -2
- package/dist/identity-BlvlgjrU.cjs.map +1 -0
- package/dist/{identity-DOaHdfhT.js → identity-BrQp_5J5.js} +20 -21
- package/dist/identity-BrQp_5J5.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +112 -79
- package/dist/index.js +797 -659
- package/dist/index.js.map +1 -1
- package/dist/{indexeddb-storage-CaXGJqDD.cjs → indexeddb-storage-CtLvZH1r.cjs} +2 -2
- package/dist/indexeddb-storage-CtLvZH1r.cjs.map +1 -0
- package/dist/{indexeddb-storage-D-lUW_5P.js → indexeddb-storage-DLXQzAGh.js} +5 -6
- package/dist/indexeddb-storage-DLXQzAGh.js.map +1 -0
- package/dist/{interactions-CqDNrtIR.js → interactions-B6z2I4tU.js} +10 -11
- package/dist/interactions-B6z2I4tU.js.map +1 -0
- package/dist/{interactions-8DgxtmgO.cjs → interactions-P6pz08Jn.cjs} +2 -2
- package/dist/interactions-P6pz08Jn.cjs.map +1 -0
- package/dist/{journey-DgIjhrIc.js → journey-35yCMNFo.js} +21 -21
- package/dist/journey-35yCMNFo.js.map +1 -0
- package/dist/journey-DAGh5h9k.cjs +2 -0
- package/dist/journey-DAGh5h9k.cjs.map +1 -0
- package/dist/keys-BHhw_0Wh.cjs.map +1 -1
- package/dist/{keys-D5r_GH9q.js → keys-BU9j5YqW.js} +2 -3
- package/dist/keys-BU9j5YqW.js.map +1 -0
- package/dist/{library-console-g_VU-wzP.cjs → library-console-BFWEuQsl.cjs} +2 -2
- package/dist/library-console-BFWEuQsl.cjs.map +1 -0
- package/dist/library-console-Dl_Ly6DQ.js +13 -0
- package/dist/library-console-Dl_Ly6DQ.js.map +1 -0
- package/dist/{library-request-FQaiWjCP.cjs → library-request-Da-CHKzT.cjs} +2 -2
- package/dist/library-request-Da-CHKzT.cjs.map +1 -0
- package/dist/{library-request-CyC-9IOk.js → library-request-nI6pvI6I.js} +4 -5
- package/dist/library-request-nI6pvI6I.js.map +1 -0
- package/dist/{lifecycle-C2z_d8OX.cjs → lifecycle-BGGOcN4N.cjs} +2 -2
- package/dist/lifecycle-BGGOcN4N.cjs.map +1 -0
- package/dist/{lifecycle-BLC4VU7c.js → lifecycle-CZ6RRXc6.js} +3 -4
- package/dist/lifecycle-CZ6RRXc6.js.map +1 -0
- package/dist/{log-record-DKvo-B-d.cjs → log-record-D7bA1RPb.cjs} +2 -2
- package/dist/log-record-D7bA1RPb.cjs.map +1 -0
- package/dist/{log-record-CndanC-p.js → log-record-DIA6McNr.js} +3 -4
- package/dist/log-record-DIA6McNr.js.map +1 -0
- package/dist/{long-frames-BQef9rXR.js → long-frames-430_85Da.js} +9 -8
- package/dist/long-frames-430_85Da.js.map +1 -0
- package/dist/long-frames-Dd8tsi2U.cjs +2 -0
- package/dist/long-frames-Dd8tsi2U.cjs.map +1 -0
- package/dist/models/batch.d.ts +14 -15
- package/dist/models/bus.d.ts +24 -24
- package/dist/models/config.d.ts +402 -216
- package/dist/models/drop.d.ts +13 -11
- package/dist/models/health.d.ts +13 -13
- package/dist/models/log-record.d.ts +13 -14
- package/dist/models/metric.d.ts +82 -17
- package/dist/models/plugin.d.ts +13 -13
- package/dist/models/replay.d.ts +60 -0
- package/dist/models/serializer.d.ts +2 -3
- package/dist/models/stats.d.ts +2 -2
- package/dist/models/storage.d.ts +12 -11
- package/dist/{network-CvkvYzRU.js → network-C7SkLf4v.js} +30 -32
- package/dist/network-C7SkLf4v.js.map +1 -0
- package/dist/{network-CqnQOqon.cjs → network-pEX3PAJv.cjs} +2 -2
- package/dist/network-pEX3PAJv.cjs.map +1 -0
- package/dist/openfin-Bxelt0yg.js +7 -0
- package/dist/openfin-Bxelt0yg.js.map +1 -0
- package/dist/openfin-DtH2f7zX.cjs.map +1 -1
- package/dist/otlp-2MCrC3kd.cjs +2 -0
- package/dist/otlp-2MCrC3kd.cjs.map +1 -0
- package/dist/{otlp-CYIL7MOE.js → otlp-COq033e3.js} +26 -35
- package/dist/otlp-COq033e3.js.map +1 -0
- package/dist/patch-BX8KrPCT.cjs.map +1 -1
- package/dist/{patch-CCWfuEY7.js → patch-UdPz1ea8.js} +2 -3
- package/dist/patch-UdPz1ea8.js.map +1 -0
- package/dist/{platform-KMWkoI-v.cjs → platform-12uR7kBQ.cjs} +2 -2
- package/dist/platform-12uR7kBQ.cjs.map +1 -0
- package/dist/{platform-wcAkkv9F.js → platform-CVewe4wQ.js} +9 -10
- package/dist/platform-CVewe4wQ.js.map +1 -0
- package/dist/profiler-BVWIOgnq.js +310 -0
- package/dist/profiler-BVWIOgnq.js.map +1 -0
- package/dist/profiler-eVCknCzS.cjs +2 -0
- package/dist/profiler-eVCknCzS.cjs.map +1 -0
- package/dist/profiler-frames-CLXlT_xL.js +86 -0
- package/dist/profiler-frames-CLXlT_xL.js.map +1 -0
- package/dist/profiler-frames-Dg2OebB2.cjs +2 -0
- package/dist/profiler-frames-Dg2OebB2.cjs.map +1 -0
- package/dist/{remote-rules-CH_7PphT.js → remote-rules-BJGDJGwA.js} +29 -30
- package/dist/remote-rules-BJGDJGwA.js.map +1 -0
- package/dist/{remote-rules-BL8km4xk.cjs → remote-rules-CJD3ToVk.cjs} +2 -2
- package/dist/remote-rules-CJD3ToVk.cjs.map +1 -0
- package/dist/replay-0zAJv9T3.js +338 -0
- package/dist/replay-0zAJv9T3.js.map +1 -0
- package/dist/replay-DomJpXqW.cjs +2 -0
- package/dist/replay-DomJpXqW.cjs.map +1 -0
- package/dist/{reports-Bh_-KpZ2.cjs → reports-BsbqmP8h.cjs} +2 -2
- package/dist/reports-BsbqmP8h.cjs.map +1 -0
- package/dist/{reports-BOKyY3_A.js → reports-BuXekPOS.js} +4 -5
- package/dist/reports-BuXekPOS.js.map +1 -0
- package/dist/{resource-timing-BROnEJ0E.js → resource-timing-CXGHwFRD.js} +6 -7
- package/dist/resource-timing-CXGHwFRD.js.map +1 -0
- package/dist/{resource-timing-CbgwNpog.cjs → resource-timing-DkycFGDa.cjs} +2 -2
- package/dist/resource-timing-DkycFGDa.cjs.map +1 -0
- package/dist/{sampling-ECGVYiDD.cjs → sampling-Dd0wllyq.cjs} +2 -2
- package/dist/sampling-Dd0wllyq.cjs.map +1 -0
- package/dist/{sampling-BLO_pcV4.js → sampling-UUDbi3K0.js} +11 -12
- package/dist/sampling-UUDbi3K0.js.map +1 -0
- package/dist/{sanitize-DS0G4_ea.js → sanitize-CNmsD9r3.js} +4 -5
- package/dist/sanitize-CNmsD9r3.js.map +1 -0
- package/dist/{sanitize-Bsn8HQWC.cjs → sanitize-ChLn97Ch.cjs} +2 -2
- package/dist/sanitize-ChLn97Ch.cjs.map +1 -0
- package/dist/{select-DWO0-w8_.cjs → select-CTk-K5mG.cjs} +3 -3
- package/dist/select-CTk-K5mG.cjs.map +1 -0
- package/dist/{select-wqt9Wxio.js → select-DPv_j6wq.js} +64 -67
- package/dist/select-DPv_j6wq.js.map +1 -0
- package/dist/{sender-BkAVt-Rq.js → sender-15zEsZpr.js} +98 -101
- package/dist/sender-15zEsZpr.js.map +1 -0
- package/dist/sender-Bfpv9tad.cjs +2 -0
- package/dist/sender-Bfpv9tad.cjs.map +1 -0
- package/dist/storage/context-storage.d.ts +34 -33
- package/dist/storage/emergency-queue.d.ts +9 -9
- package/dist/storage/eviction.d.ts +12 -12
- package/dist/storage/factory.d.ts +8 -7
- package/dist/storage/gap.d.ts +6 -6
- package/dist/storage/idb-driver.d.ts +31 -32
- package/dist/storage/indexeddb-storage.d.ts +26 -27
- package/dist/storage/keys.d.ts +7 -7
- package/dist/storage/local-storage.d.ts +38 -38
- package/dist/storage/memory-storage.d.ts +21 -22
- package/dist/storage/persistence.d.ts +1 -1
- package/dist/storage-BA9RqRO-.cjs.map +1 -1
- package/dist/{storage-w7Tslvlq.js → storage-DZwed89z.js} +2 -3
- package/dist/storage-DZwed89z.js.map +1 -0
- package/dist/{storm-DD4cUkoL.js → storm-BTSNTIWI.js} +4 -5
- package/dist/storm-BTSNTIWI.js.map +1 -0
- package/dist/{storm-DCEsqViG.cjs → storm-D0_qZOEg.cjs} +2 -2
- package/dist/storm-D0_qZOEg.cjs.map +1 -0
- package/dist/transport/compression.d.ts +2 -2
- package/dist/transport/errors.d.ts +7 -7
- package/dist/transport/exit-flush.d.ts +39 -39
- package/dist/transport/headers.d.ts +2 -2
- package/dist/transport/http-transport.d.ts +28 -27
- package/dist/transport/memory-transport.d.ts +6 -6
- package/dist/transport/retry-engine.d.ts +35 -34
- package/dist/transport/serializers/ecs.d.ts +1 -1
- package/dist/transport/serializers/otlp-metrics.d.ts +1 -1
- package/dist/transport/serializers/otlp-traces.d.ts +1 -1
- package/dist/transport/serializers/otlp.d.ts +16 -16
- package/dist/transport/serializers/select.d.ts +7 -7
- package/dist/transport/status-transport.d.ts +20 -20
- package/dist/transport/worker-protocol.d.ts +3 -3
- package/dist/{types-BR9t_w28.js → types-BAerHgCq.js} +2 -3
- package/dist/types-BAerHgCq.js.map +1 -0
- package/dist/types-C7WNpnG1.cjs.map +1 -1
- package/dist/{unclean-exit-CwdpbUDg.cjs → unclean-exit-ClGzrc2A.cjs} +2 -2
- package/dist/unclean-exit-ClGzrc2A.cjs.map +1 -0
- package/dist/{unclean-exit-BYZ5yaSI.js → unclean-exit-Cob_jyTv.js} +3 -4
- package/dist/unclean-exit-Cob_jyTv.js.map +1 -0
- package/dist/unref-CU9Nyz_9.cjs +2 -0
- package/dist/unref-CU9Nyz_9.cjs.map +1 -0
- package/dist/unref-DgHPQeWv.js +7 -0
- package/dist/unref-DgHPQeWv.js.map +1 -0
- package/dist/user-timing-CdYqx3PF.cjs +2 -0
- package/dist/user-timing-CdYqx3PF.cjs.map +1 -0
- package/dist/{user-timing-Di2ra5DB.js → user-timing-DgHubxCI.js} +7 -6
- package/dist/user-timing-DgHubxCI.js.map +1 -0
- package/dist/utils/console.d.ts +2 -2
- package/dist/utils/deadline.d.ts +4 -4
- package/dist/utils/error-like.d.ts +7 -7
- package/dist/utils/fixed-window.d.ts +9 -8
- package/dist/utils/global-scope.d.ts +8 -8
- package/dist/utils/guards.d.ts +2 -2
- package/dist/utils/identity.d.ts +17 -17
- package/dist/utils/library-console.d.ts +4 -4
- package/dist/utils/library-request.d.ts +10 -10
- package/dist/utils/lock.d.ts +10 -9
- package/dist/utils/openfin.d.ts +5 -5
- package/dist/utils/patch.d.ts +6 -6
- package/dist/utils/platform.d.ts +13 -11
- package/dist/utils/sanitize.d.ts +4 -4
- package/dist/utils/timer.d.ts +1 -1
- package/dist/utils/tracing.d.ts +38 -38
- package/dist/utils/unref.d.ts +3 -3
- package/dist/{web-socket-DwBNhgre.cjs → web-socket-BTuvYoJI.cjs} +2 -2
- package/dist/web-socket-BTuvYoJI.cjs.map +1 -0
- package/dist/{web-socket-B-5qqPy7.js → web-socket-DthJuSAg.js} +14 -15
- package/dist/web-socket-DthJuSAg.js.map +1 -0
- package/dist/web-vitals-Ch5BpDmo.cjs +2 -0
- package/dist/web-vitals-Ch5BpDmo.cjs.map +1 -0
- package/dist/web-vitals-CsGCWnUr.js +77 -0
- package/dist/web-vitals-CsGCWnUr.js.map +1 -0
- package/dist/{worker-protocol-0HMf4-kY.js → worker-protocol-B0_8rWy5.js} +6 -7
- package/dist/worker-protocol-B0_8rWy5.js.map +1 -0
- package/dist/{worker-protocol-DXekoADQ.cjs → worker-protocol-BjzFORfq.cjs} +2 -2
- package/dist/worker-protocol-BjzFORfq.cjs.map +1 -0
- package/dist/worker-server-4en-Lt-3.cjs +2 -0
- package/dist/worker-server-4en-Lt-3.cjs.map +1 -0
- package/dist/{worker-server-CKcmX5m5.js → worker-server-Cne9MX9I.js} +25 -26
- package/dist/{worker-server-CKcmX5m5.js.map → worker-server-Cne9MX9I.js.map} +1 -1
- package/dist/worker-transport-B-GF4Aqn.cjs +2 -0
- package/dist/worker-transport-B-GF4Aqn.cjs.map +1 -0
- package/dist/{worker-transport-2220ghFZ.js → worker-transport-C3SjJAEC.js} +64 -65
- package/dist/worker-transport-C3SjJAEC.js.map +1 -0
- package/package.json +33 -41
- package/dist/batch-BHXypM1j.cjs.map +0 -1
- package/dist/batch-BMdT9mKm.js.map +0 -1
- package/dist/bus-DKfBaica.js.map +0 -1
- package/dist/bus-Dea9rVhy.cjs +0 -2
- package/dist/bus-Dea9rVhy.cjs.map +0 -1
- package/dist/console-BX_0UCV7.js.map +0 -1
- package/dist/console-DZEcs7FL.cjs +0 -2
- package/dist/console-DZEcs7FL.cjs.map +0 -1
- package/dist/constants-CL0ZdI2f.cjs +0 -2
- package/dist/constants-CL0ZdI2f.cjs.map +0 -1
- package/dist/constants-CU60FG4w.js +0 -305
- package/dist/constants-CU60FG4w.js.map +0 -1
- package/dist/context-storage-DxZf4Gfh.js.map +0 -1
- package/dist/deadline-5_PecIl5.js.map +0 -1
- package/dist/deadline-XSnm95pg.cjs +0 -2
- package/dist/deadline-XSnm95pg.cjs.map +0 -1
- package/dist/debug-bundle-CZZ6SQQh.js.map +0 -1
- package/dist/debug-bundle-yRkrU1ny.cjs +0 -2
- package/dist/debug-bundle-yRkrU1ny.cjs.map +0 -1
- package/dist/emergency-queue-CQ-9acZf.cjs.map +0 -1
- package/dist/emergency-queue-Cs8-i2xw.js.map +0 -1
- package/dist/error-like-Ywo5uRHo.js.map +0 -1
- package/dist/errors-CigX45pL.cjs.map +0 -1
- package/dist/errors-oyxrpHjY.js.map +0 -1
- package/dist/factory-Bgsky_e0.js.map +0 -1
- package/dist/factory-BkjNzPYL.cjs.map +0 -1
- package/dist/fixed-window-CtaFHanJ.js.map +0 -1
- package/dist/global-scope-dp2jADRl.js.map +0 -1
- package/dist/guards-CpvOpJL6.js.map +0 -1
- package/dist/identity-BMlKGHUM.cjs.map +0 -1
- package/dist/identity-DOaHdfhT.js.map +0 -1
- package/dist/indexeddb-storage-CaXGJqDD.cjs.map +0 -1
- package/dist/indexeddb-storage-D-lUW_5P.js.map +0 -1
- package/dist/interactions-8DgxtmgO.cjs.map +0 -1
- package/dist/interactions-CqDNrtIR.js.map +0 -1
- package/dist/journey-5tcxEbnG.cjs +0 -2
- package/dist/journey-5tcxEbnG.cjs.map +0 -1
- package/dist/journey-DgIjhrIc.js.map +0 -1
- package/dist/keys-D5r_GH9q.js.map +0 -1
- package/dist/library-console-CabK2j2-.js +0 -14
- package/dist/library-console-CabK2j2-.js.map +0 -1
- package/dist/library-console-g_VU-wzP.cjs.map +0 -1
- package/dist/library-request-CyC-9IOk.js.map +0 -1
- package/dist/library-request-FQaiWjCP.cjs.map +0 -1
- package/dist/lifecycle-BLC4VU7c.js.map +0 -1
- package/dist/lifecycle-C2z_d8OX.cjs.map +0 -1
- package/dist/log-record-CndanC-p.js.map +0 -1
- package/dist/log-record-DKvo-B-d.cjs.map +0 -1
- package/dist/long-frames-BQef9rXR.js.map +0 -1
- package/dist/long-frames-CV5ZG2cx.cjs +0 -2
- package/dist/long-frames-CV5ZG2cx.cjs.map +0 -1
- package/dist/network-CqnQOqon.cjs.map +0 -1
- package/dist/network-CvkvYzRU.js.map +0 -1
- package/dist/openfin-BwEN0uj4.js +0 -8
- package/dist/openfin-BwEN0uj4.js.map +0 -1
- package/dist/otlp-CYIL7MOE.js.map +0 -1
- package/dist/otlp-RVbkNQRh.cjs +0 -2
- package/dist/otlp-RVbkNQRh.cjs.map +0 -1
- package/dist/patch-CCWfuEY7.js.map +0 -1
- package/dist/platform-KMWkoI-v.cjs.map +0 -1
- package/dist/platform-wcAkkv9F.js.map +0 -1
- package/dist/remote-rules-BL8km4xk.cjs.map +0 -1
- package/dist/remote-rules-CH_7PphT.js.map +0 -1
- package/dist/reports-BOKyY3_A.js.map +0 -1
- package/dist/reports-Bh_-KpZ2.cjs.map +0 -1
- package/dist/resource-timing-BROnEJ0E.js.map +0 -1
- package/dist/resource-timing-CbgwNpog.cjs.map +0 -1
- package/dist/sampling-BLO_pcV4.js.map +0 -1
- package/dist/sampling-ECGVYiDD.cjs.map +0 -1
- package/dist/sanitize-Bsn8HQWC.cjs.map +0 -1
- package/dist/sanitize-DS0G4_ea.js.map +0 -1
- package/dist/select-DWO0-w8_.cjs.map +0 -1
- package/dist/select-wqt9Wxio.js.map +0 -1
- package/dist/sender-BkAVt-Rq.js.map +0 -1
- package/dist/sender-D82PxlCY.cjs +0 -2
- package/dist/sender-D82PxlCY.cjs.map +0 -1
- package/dist/storage-w7Tslvlq.js.map +0 -1
- package/dist/storm-DCEsqViG.cjs.map +0 -1
- package/dist/storm-DD4cUkoL.js.map +0 -1
- package/dist/types-BR9t_w28.js.map +0 -1
- package/dist/unclean-exit-BYZ5yaSI.js.map +0 -1
- package/dist/unclean-exit-CwdpbUDg.cjs.map +0 -1
- package/dist/user-timing-C1kB3JEg.cjs +0 -2
- package/dist/user-timing-C1kB3JEg.cjs.map +0 -1
- package/dist/user-timing-Di2ra5DB.js.map +0 -1
- package/dist/web-socket-B-5qqPy7.js.map +0 -1
- package/dist/web-socket-DwBNhgre.cjs.map +0 -1
- package/dist/web-vitals-Bflr5jSA.js +0 -53
- package/dist/web-vitals-Bflr5jSA.js.map +0 -1
- package/dist/web-vitals-DFuoTQbZ.cjs +0 -2
- package/dist/web-vitals-DFuoTQbZ.cjs.map +0 -1
- package/dist/worker-protocol-0HMf4-kY.js.map +0 -1
- package/dist/worker-protocol-DXekoADQ.cjs.map +0 -1
- package/dist/worker-server-BQK5z2yl.cjs +0 -2
- package/dist/worker-server-BQK5z2yl.cjs.map +0 -1
- package/dist/worker-transport-2220ghFZ.js.map +0 -1
- package/dist/worker-transport-Dj2yCQN5.cjs +0 -2
- package/dist/worker-transport-Dj2yCQN5.cjs.map +0 -1
package/bin/uiobs.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as n } from "./identity-
|
|
3
|
-
|
|
1
|
+
import { g as e, kt as t } from "./constants-Bwl_YtQi.js";
|
|
2
|
+
import { i as n } from "./identity-BrQp_5J5.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,
|
|
28
|
+
return a(n, e) === t;
|
|
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-
|
|
35
|
+
//# sourceMappingURL=batch-BjQUwjA6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-BjQUwjA6.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. Never changes. With isolation, a batch without one stays stored. */\n readonly routingContextId?: string;\n /** Deduplication key. 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 * Checks whether a value from storage has every field of a batch. `keyOf` can't match an entry\n * without `id` after delivery, so that entry would be retried forever and block every batch\n * behind it. An entry without `attempts` counts as NaN, which never reaches `maxAttempts`, so\n * it would never be dropped as a dead letter.\n * @param value Parsed storage entry.\n * @returns True when every 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. Each half gets a new\n * id but keeps the original batch's age and attempts.\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, either null or\n * missing its 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 * Checks whether a record is an action. A corrupt record from storage is not an action.\n * @param record Record to check.\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 * Counts the records across all 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":";;;AAoCA,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,2 +1,2 @@
|
|
|
1
|
-
const e=require("./constants-
|
|
2
|
-
//# sourceMappingURL=batch-
|
|
1
|
+
const e=require("./constants-DakMxVB2.cjs"),t=require("./identity-BlvlgjrU.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.kt}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-D5LlU4Q9.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-D5LlU4Q9.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. Never changes. With isolation, a batch without one stays stored. */\n readonly routingContextId?: string;\n /** Deduplication key. 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 * Checks whether a value from storage has every field of a batch. `keyOf` can't match an entry\n * without `id` after delivery, so that entry would be retried forever and block every batch\n * behind it. An entry without `attempts` counts as NaN, which never reaches `maxAttempts`, so\n * it would never be dropped as a dead letter.\n * @param value Parsed storage entry.\n * @returns True when every 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. Each half gets a new\n * id but keeps the original batch's age and attempts.\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, either null or\n * missing its 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 * Checks whether a record is an action. A corrupt record from storage is not an action.\n * @param record Record to check.\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 * Counts the records across all 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,iFAoCA,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"}
|
package/dist/bus/bus.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { PlatformMetadata } from "../utils/platform";
|
|
|
9
9
|
import { type Receive, type WorkerLike } from "./links";
|
|
10
10
|
/** Handshake timing for a forwarder waiting on an owner. */
|
|
11
11
|
export interface HandshakeOptions {
|
|
12
|
-
/**
|
|
12
|
+
/** How long a forwarder waits for an owner to answer, in milliseconds. */
|
|
13
13
|
timeoutMs: number;
|
|
14
14
|
/** Attempts allowed before a cross-origin forwarder promotes itself to sender. */
|
|
15
15
|
maxAttempts: number;
|
|
@@ -18,7 +18,7 @@ export interface HandshakeOptions {
|
|
|
18
18
|
export declare const HANDSHAKE_OPTIONS: HandshakeOptions;
|
|
19
19
|
/** Callbacks for handling records and journey events from connected realms. */
|
|
20
20
|
export interface BusHandlers {
|
|
21
|
-
/** Adopts the delivery context
|
|
21
|
+
/** Adopts the owner's delivery context. Returning false refuses a different identity. */
|
|
22
22
|
onSecurityContext?: (id: string) => boolean;
|
|
23
23
|
/** Processes records forwarded from child contexts. */
|
|
24
24
|
onRecords: (records: LogRecord[]) => void;
|
|
@@ -28,7 +28,7 @@ export interface BusHandlers {
|
|
|
28
28
|
onJourneyRequest: () => Journey | null;
|
|
29
29
|
/** Runs when two windows use the same tab identifier. */
|
|
30
30
|
onTabConflict: () => void;
|
|
31
|
-
/**
|
|
31
|
+
/** The runtime's slot for the remote sampling rules. The bus both reads and fills it. */
|
|
32
32
|
remote: RemoteSlot;
|
|
33
33
|
}
|
|
34
34
|
/** Coordinates cross-realm communication, role resolution, and message dispatch. */
|
|
@@ -46,11 +46,11 @@ 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
|
-
/**
|
|
49
|
+
/** Each same-origin direct child's reply. Held weakly so a navigated frame can be freed. */
|
|
50
50
|
private readonly directReplies;
|
|
51
51
|
/**
|
|
52
|
-
* Checks
|
|
53
|
-
* even when
|
|
52
|
+
* Checks whether this source may receive a control message. A window can read a message
|
|
53
|
+
* even when it is addressed to another window.
|
|
54
54
|
* @param message Control message to send.
|
|
55
55
|
* @param peer Window or worker that receives the message.
|
|
56
56
|
* @returns True if the source has the required permission.
|
|
@@ -81,19 +81,19 @@ export declare class Bus {
|
|
|
81
81
|
*/
|
|
82
82
|
private passContext;
|
|
83
83
|
/**
|
|
84
|
-
* Sends a security context message to
|
|
85
|
-
*
|
|
84
|
+
* Sends a security context message to every same-origin child on the direct link, dropping
|
|
85
|
+
* any child that is closed, freed or no longer permitted.
|
|
86
86
|
* @param message Security context message.
|
|
87
87
|
*/
|
|
88
88
|
private postToDirectChildren;
|
|
89
89
|
/**
|
|
90
|
-
* Keeps
|
|
91
|
-
*
|
|
92
|
-
* @param peer
|
|
93
|
-
* @param reply
|
|
90
|
+
* Keeps a direct child's reply callback for the next context id. Closed children are dropped
|
|
91
|
+
* along the way, so a removed frame doesn't keep its document in memory.
|
|
92
|
+
* @param peer The child's window.
|
|
93
|
+
* @param reply The child's reply callback.
|
|
94
94
|
*/
|
|
95
95
|
private keepDirectReply;
|
|
96
|
-
/** Current bus role.
|
|
96
|
+
/** Current bus role. Defaults to "sender". */
|
|
97
97
|
private role;
|
|
98
98
|
/** Upstream forwarding link, or null when acting as sender. */
|
|
99
99
|
private upstream;
|
|
@@ -105,11 +105,11 @@ export declare class Bus {
|
|
|
105
105
|
private isOpenFinProvider;
|
|
106
106
|
/** Timer that asks the upstream owner for the remote sampling rules. */
|
|
107
107
|
private rulesPoll;
|
|
108
|
-
/** True after destroy()
|
|
108
|
+
/** True after destroy(), so a handshake that finishes later doesn't start a timer. */
|
|
109
109
|
private destroyed;
|
|
110
|
-
/** Context id of the owner that answered the handshake. Null
|
|
110
|
+
/** Context id of the owner that answered the handshake. Null if there was no handshake. */
|
|
111
111
|
private ownerId;
|
|
112
|
-
/**
|
|
112
|
+
/** The owner's transport identity, taken from the handshake. */
|
|
113
113
|
private ownerPeer?;
|
|
114
114
|
/** Active handshake state awaiting welcome response. */
|
|
115
115
|
private awaitingWelcome;
|
|
@@ -146,7 +146,7 @@ export declare class Bus {
|
|
|
146
146
|
*/
|
|
147
147
|
attachWorker(worker: WorkerLike, options?: SourceOptions): () => void;
|
|
148
148
|
/**
|
|
149
|
-
* Sends journey state changes over
|
|
149
|
+
* Sends journey state changes over every link in the journey scope.
|
|
150
150
|
* @param journey Active journey or null if ended.
|
|
151
151
|
*/
|
|
152
152
|
broadcastJourney(journey: Journey | null): void;
|
|
@@ -156,7 +156,7 @@ export declare class Bus {
|
|
|
156
156
|
private allLinks;
|
|
157
157
|
/** Sends a message only over links of the given kind. */
|
|
158
158
|
private postOver;
|
|
159
|
-
/** Sends a journey message over
|
|
159
|
+
/** Sends a journey message over every link in the journey scope. */
|
|
160
160
|
private postJourney;
|
|
161
161
|
/** Routes incoming messages to registered handlers or upstream targets. */
|
|
162
162
|
private readonly receive;
|
|
@@ -169,42 +169,43 @@ export declare class Bus {
|
|
|
169
169
|
*/
|
|
170
170
|
private acceptsMessage;
|
|
171
171
|
/**
|
|
172
|
-
* Runs the source, budget, shape and permission checks.
|
|
173
|
-
*
|
|
172
|
+
* Runs the source, budget, shape and permission checks. A failed check returns false instead
|
|
173
|
+
* of throwing, so a flood of rejected messages builds no stack traces. Only the JSON encoding
|
|
174
|
+
* can throw, and acceptsMessage catches that.
|
|
174
175
|
* @param message Message from the source.
|
|
175
176
|
* @param source Link and identity of the source.
|
|
176
177
|
* @param child True if the source is a child of this context.
|
|
177
|
-
* @returns True if the message passes
|
|
178
|
+
* @returns True if the message passes every check.
|
|
178
179
|
*/
|
|
179
180
|
private passesChecks;
|
|
180
181
|
/**
|
|
181
|
-
*
|
|
182
|
+
* Hands an accepted message to its handler or to the upstream link.
|
|
182
183
|
* @param message Message that passed the source and shape checks.
|
|
183
184
|
* @param source Link and identity of the source.
|
|
184
185
|
*/
|
|
185
186
|
private routeMessage;
|
|
186
187
|
/**
|
|
187
|
-
* Answers
|
|
188
|
+
* Answers whoever sent a message. A link that can address a single source sends to it only.
|
|
188
189
|
* @param source Link and identity of the source.
|
|
189
190
|
* @param message Answer to send.
|
|
190
191
|
*/
|
|
191
192
|
private answer;
|
|
192
193
|
/**
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
194
|
+
* Checks whether records from a link can go upstream. Records sent back out on the link
|
|
195
|
+
* they arrived on would return to their sender. A direct link is the exception, because
|
|
196
|
+
* each one is a single call into one parent, so two direct links in a chain are
|
|
197
|
+
* different links.
|
|
197
198
|
* @param link Kind of the link the records arrived on.
|
|
198
199
|
* @returns True if the relay is safe.
|
|
199
200
|
*/
|
|
200
201
|
private canRelay;
|
|
201
|
-
/**
|
|
202
|
+
/** Checks whether this context can own the given link type. */
|
|
202
203
|
private canOwn;
|
|
203
|
-
/**
|
|
204
|
+
/** Works out whether this context is the OpenFin platform provider. */
|
|
204
205
|
private resolveOpenFinProvider;
|
|
205
206
|
/** Resolves the handshake orphan policy for the current platform context. */
|
|
206
207
|
private orphanPolicy;
|
|
207
|
-
/**
|
|
208
|
+
/** Checks whether a cross-origin boundary blocks access to the parent window. */
|
|
208
209
|
private isCrossOriginFrame;
|
|
209
210
|
/** Identifies the candidate upstream link based on platform hierarchy. */
|
|
210
211
|
private candidateUpstream;
|
|
@@ -215,66 +216,66 @@ export declare class Bus {
|
|
|
215
216
|
/** Returns the singleton OpenFin InterApplicationBus link. */
|
|
216
217
|
private ensureOpenFinLink;
|
|
217
218
|
/**
|
|
218
|
-
*
|
|
219
|
+
* Runs a hello/welcome handshake over the candidate link.
|
|
219
220
|
* @param candidate Upstream link candidate.
|
|
220
|
-
* @returns True if welcome
|
|
221
|
+
* @returns True if the welcome arrived before the timeout.
|
|
221
222
|
*/
|
|
222
223
|
private handshake;
|
|
223
224
|
/** Broadcasts tab claim and queries existing journey state. */
|
|
224
225
|
private announce;
|
|
225
226
|
/**
|
|
226
|
-
* Resolves the journey scope. "auto"
|
|
227
|
-
* @returns The scope in
|
|
227
|
+
* Resolves the journey scope. "auto" becomes "origin" in OpenFin and "tab" in a browser.
|
|
228
|
+
* @returns The scope in effect.
|
|
228
229
|
*/
|
|
229
230
|
private journeyScope;
|
|
230
231
|
/**
|
|
231
|
-
*
|
|
232
|
-
* Only "origin" uses the broadcast link
|
|
232
|
+
* Checks whether a link carries journey messages in the current scope.
|
|
233
|
+
* Only "origin" uses the broadcast link, which reaches every tab on the origin.
|
|
233
234
|
* @param link Link kind.
|
|
234
235
|
* @returns True if the link carries journey messages.
|
|
235
236
|
*/
|
|
236
237
|
private journeyLink;
|
|
237
238
|
/**
|
|
238
|
-
*
|
|
239
|
+
* Checks whether this context adopts a journey message.
|
|
239
240
|
* @param message Journey message.
|
|
240
241
|
* @param source Link and origin of the message.
|
|
241
|
-
* @returns True for a message on a journey link, to this context, from an accepted
|
|
242
|
-
* In "tab" scope, only
|
|
242
|
+
* @returns True for a message on a journey link, addressed to this context, from an accepted
|
|
243
|
+
* sender. In "tab" scope, the only accepted sender is a forwarder's owner.
|
|
243
244
|
*/
|
|
244
245
|
private acceptsJourney;
|
|
245
246
|
/**
|
|
246
|
-
*
|
|
247
|
+
* Checks whether a message comes from this forwarder's upstream owner.
|
|
247
248
|
* @param from Context id of the sender.
|
|
248
249
|
* @param link Link kind of the message.
|
|
249
250
|
* @returns True for the upstream link and, after a handshake, the owner that answered it.
|
|
250
251
|
*/
|
|
251
252
|
private fromOwner;
|
|
252
253
|
/**
|
|
253
|
-
* Parses a journey payload from another realm and
|
|
254
|
+
* Parses a journey payload from another realm and hands it to the runtime.
|
|
254
255
|
* @param payload Journey, or null when the journey ended.
|
|
255
256
|
*/
|
|
256
257
|
private applyJourney;
|
|
257
258
|
/**
|
|
258
|
-
* Builds the answer to a sampling question. Null rules
|
|
259
|
+
* Builds the answer to a sampling question. Null rules clear the forwarder's copy.
|
|
259
260
|
* @param to Context id of the forwarder that asked.
|
|
260
261
|
* @returns The answer.
|
|
261
262
|
*/
|
|
262
263
|
private rulesAnswer;
|
|
263
264
|
/**
|
|
264
|
-
*
|
|
265
|
+
* Checks whether this context accepts sampling rules from a source.
|
|
265
266
|
* @param to Context id that the answer names.
|
|
266
267
|
* @param source Link and origin of the answer.
|
|
267
268
|
* @returns True only for an answer from the upstream owner to this context.
|
|
268
269
|
*/
|
|
269
270
|
private acceptsRules;
|
|
270
271
|
/**
|
|
271
|
-
* Applies the rules
|
|
272
|
-
* @param raw
|
|
272
|
+
* Applies the rules from an answer, ignoring any that are invalid.
|
|
273
|
+
* @param raw The answer's rules, or null when the upstream has none.
|
|
273
274
|
*/
|
|
274
275
|
private applyRules;
|
|
275
276
|
/**
|
|
276
|
-
* Asks the upstream owner for the remote sampling rules now, then
|
|
277
|
-
* A direct link
|
|
277
|
+
* Asks the upstream owner for the remote sampling rules now, then on every poll interval.
|
|
278
|
+
* A direct link can't push the rules to a child, but a poll works on every link kind.
|
|
278
279
|
*/
|
|
279
280
|
private pollRules;
|
|
280
281
|
}
|
package/dist/bus/links.d.ts
CHANGED
|
@@ -64,13 +64,13 @@ export interface WorkerLike {
|
|
|
64
64
|
*/
|
|
65
65
|
export declare function createDirectLink(receive: Receive, diagnostics: Diagnostics): Link | null;
|
|
66
66
|
/**
|
|
67
|
-
* Creates a postMessage link to a parent window on a trusted origin. Records hold user data
|
|
68
|
-
*
|
|
67
|
+
* Creates a postMessage link to a parent window on a trusted origin. Records hold user data,
|
|
68
|
+
* so a page on another origin that frames this app must not get them.
|
|
69
69
|
* @param receive Callback for incoming parent messages.
|
|
70
|
-
* @param trustedOrigins
|
|
70
|
+
* @param trustedOrigins Parent origins that may receive the records, in addition to this origin.
|
|
71
71
|
* @param diagnostics Diagnostics reporter.
|
|
72
72
|
* @returns Link to the parent window, or null at the top level or with an untrusted parent.
|
|
73
|
-
*
|
|
73
|
+
* When it is null, this context sends its own records.
|
|
74
74
|
*/
|
|
75
75
|
export declare function createParentLink(receive: Receive, trustedOrigins: string[], diagnostics: Diagnostics): Link | null;
|
|
76
76
|
/**
|
package/dist/bus/validation.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BusMessage } from "../models/bus";
|
|
2
2
|
/**
|
|
3
|
-
* Checks the fields
|
|
3
|
+
* Checks the fields that each bus message type requires. unwrap() only checks the envelope.
|
|
4
4
|
* @param value Message to check.
|
|
5
5
|
* @returns True if the message has the required fields and values.
|
|
6
6
|
*/
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./constants-DakMxVB2.cjs"),t=require("./journey-DAGh5h9k.cjs"),n=require("./remote-rules-CJD3ToVk.cjs"),r=require("./log-record-D7bA1RPb.cjs"),i=require("./openfin-DtH2f7zX.cjs"),a=require("./fixed-window-CvESpFYV.cjs"),o=require("./unref-CU9Nyz_9.cjs");function s(t){if(typeof t!=`object`||!t)return!1;let n=t;if(typeof n.from!=`string`||!n.from||typeof n.t!=`string`)return!1;let i=e=>typeof n[e]==`string`;switch(n.t){case e.M.hello:case e.M.tab:return i(`tabId`);case e.M.welcome:return i(`to`)&&i(`tabId`)&&(n.routingContextId===void 0||i(`routingContextId`));case e.M.journeyRequest:case e.M.samplingRequest:return!0;case e.M.securityContext:return i(`id`)&&n.id!==``;case e.M.journey:return(n.to===void 0||i(`to`))&&`journey`in n;case e.M.sampling:return i(`to`)&&`rules`in n;case e.M.records:return Array.isArray(n.records)&&(n.routingContextId===void 0||i(`routingContextId`))&&n.records.every(t=>!r.n(t)||!r.t(t.severityText)?!1:!Array.isArray(t.attributes)&&!Array.isArray(t.resource)&&/^\d+$/.test(t.timeUnixNano)&&(t.observedTimeUnixNano===void 0||/^\d+$/.test(t.observedTimeUnixNano))&&typeof t.traceId==`string`&&/^(?:[a-f\d]{32})?$/.test(t.traceId)&&typeof t.spanId==`string`&&/^(?:[a-f\d]{16})?$/.test(t.spanId)&&Number.isInteger(t.traceFlags)&&t.traceFlags>=0&&t.traceFlags<=255&&t.severityNumber===e.Mn[t.severityText]);default:return!1}}function c(t){return{p:e.j,m:t}}function l(e){if(typeof e!=`object`||!e)return null;let t=e;if(t.p!==`ui-observability/2`||typeof t.m!=`object`||t.m===null)return null;let n=t.m;return typeof n.t==`string`?n:null}var u=Symbol.for(e.Cn),d=`null`;function f(e,t){return e===d?`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.`}function p(){let e=location.ancestorOrigins;if(e&&e.length>0)return e.item(0);let t=document.referrer;if(t===``)return null;try{return new URL(t).origin}catch{return null}}function m(e,t){if(typeof window>`u`||window.parent===window)return null;let n;try{n=window.parent[u]}catch{return null}if(typeof n?.busAccept!=`function`||n.busCanAccept&&!n.busCanAccept(window,location.origin))return null;let r=n,i=!0;return{kind:`direct`,post(n){i&&t.guard(`bus.send_failed`,`The direct call into the parent runtime failed.`,()=>{r.busAccept(n,e,window)})},close(){i=!1}}}function h(e,t,n){if(typeof window>`u`||window.parent===window)return null;let r=location.origin;if(r===d)return n.report(`bus.untrusted_origin`,`This frame is sandboxed without allow-same-origin. It has an opaque origin. No parent can trust it. This context sends its own records. Set bus.mode: "sender" in the frame. Add allow-same-origin to the sandbox attribute only for content that you trust.`,{origin:r,type:`parent`}),null;let i=new Set([r,...t]),a=p();if(a===null||!i.has(a))return n.report(`bus.untrusted_origin`,a===null?`The origin of the parent frame is unknown. This context sends its own records.`:`The parent frame is on ${a}. This origin is not in bus.trustedOrigins. This context sends its own records.`,{origin:a??``,type:`parent`}),null;let o=new Set,s=t=>{let r=l(t.data);r&&t.source===window.parent&&(i.has(t.origin)?e(r,{link:`parent`,origin:t.origin,peer:t.source}):o.has(t.origin)||(o.add(t.origin),n.report(`bus.untrusted_origin`,f(t.origin,`a message`),{origin:t.origin,type:r.t.slice(0,48)})))};return addEventListener(`message`,s),{kind:`parent`,post(e){n.guard(`bus.send_failed`,`The postMessage call to the parent failed.`,()=>{window.parent.postMessage(c(e),a)})},close(){removeEventListener(`message`,s)}}}function g(e,t,n,r,i){if(typeof window>`u`)return null;let a=new Set([location.origin,...t]);a.delete(d);let o=new Map,s=(e,t,a)=>{if(r&&!r(e,t)){o.delete(e);return}if(i&&!i(a,e))return;let s=e;s.closed?o.delete(e):n.guard(`bus.send_failed`,`The postMessage call to a child frame failed.`,()=>{s.postMessage(c(a),t)})},u=t=>{let i=l(t.data);if(!i||window.parent!==window&&t.source===window.parent)return;if(!r&&!a.has(t.origin)){n.report(`bus.untrusted_origin`,f(t.origin,`a message`),{origin:t.origin,type:i.t.slice(0,48)});return}if(r&&!r(t.source,t.origin))return;let{source:c,origin:u}=t;c&&o.set(c,u),e(i,{link:`children`,origin:u,peer:c??void 0,reply:c?e=>{s(c,u,e)}:void 0})};return addEventListener(`message`,u),{kind:`children`,post(e){for(let[t,n]of o)s(t,n,e)},close(){removeEventListener(`message`,u),o.clear()}}}function _(e,t,n){let r=globalThis.BroadcastChannel;if(r===void 0)return null;let i=n.guard(`bus.send_failed`,`The library could not open the BroadcastChannel.`,()=>new r(e));return i?(i.onmessage=e=>{let n=l(e.data);n&&t(n,{link:`broadcast`,origin:`same-origin`})},{kind:`broadcast`,post(e){n.guard(`bus.send_failed`,`The BroadcastChannel.postMessage call failed.`,()=>{i.postMessage(c(e))})},close(){n.guard(`bus.send_failed`,`The library could not close the BroadcastChannel.`,()=>{i.close()})}}):null}function v(e,t,n,r){let a=i.t()?.InterApplicationBus;if(!a)return null;if(!t)return r.report(`openfin.unavailable`,`OpenFin gives no application uuid. The InterApplicationBus link stays closed.`),null;let o=`${e}.${t}`;return r.guardAsync(`bus.send_failed`,`The InterApplicationBus.subscribe call failed.`,()=>a.subscribe({uuid:t},o,(e,t,r)=>{let i=l(e);i&&n(i,{link:`openfin`,origin:`openfin`,peer:t&&r?`${t}:${r}`:void 0})})),{kind:`openfin`,post(e){r.guardAsync(`bus.send_failed`,`The InterApplicationBus.publish call failed.`,()=>a.publish(o,c(e)))},close(){}}}function y(e,t){let n=globalThis,r=n.postMessage;return n.WorkerGlobalScope===void 0||!r?null:(n.addEventListener?.(`message`,t=>{let n=l(t.data);n&&e(n,{link:`owner`,origin:`same-origin`})}),{kind:`owner`,post(e){t.guard(`bus.send_failed`,`The postMessage call of the worker failed.`,()=>{r(c(e))})},close(){}})}function b(e,t,n){let r=n=>{let r=l(n.data);r&&t(r,{link:`worker`,origin:`same-origin`,peer:e})};return e.addEventListener(`message`,r),e.start?.(),{kind:`worker`,post(t){n.guard(`bus.send_failed`,`The postMessage call to a worker failed.`,()=>{e.postMessage(c(t))})},close(){e.removeEventListener(`message`,r)}}}var x={timeoutMs:e.k,maxAttempts:3},S=[`children`,`direct`,`worker`],C=class{config;diagnostics;platform;contextId;tabId;handlers;handshakeOptions;sources=new Map;rates=new WeakMap;channelRates=new Map;directReplies=new Map;mayPost(t,n){let r=this.sources.get(n)?.permissions;return r?t.t===e.M.journey?r.includes(`journey:read`):t.t===e.M.journeyRequest?r.includes(`journey:write`):t.t!==e.M.sampling||r.includes(`sampling:read`):this.config.bus.sourcePolicy===`trusted-origin`}registerFrame(e,t){let n=typeof HTMLIFrameElement>`u`?void 0:HTMLIFrameElement,r=n&&e instanceof n?e.contentWindow:e;if(!r||new URL(t.origin).origin!==t.origin||t.origin===`null`)throw Error(`A frame registration requires a window and an exact origin.`);let i={...t,permissions:[...t.permissions??[`records`]]};return this.sources.set(r,i),this.ensureChildrenLink(),()=>{this.sources.get(r)===i&&this.sources.delete(r)}}isRegistered(e,t){if(!e)return!1;let n=this.sources.get(e);return n?n.origin===t:this.config.bus.sourcePolicy!==`registered`&&t!==`null`&&(t===location.origin||this.config.bus.trustedOrigins.includes(t))}rotateContext(){this.passContext(this.role===`sender`)}passContext(t){let n={t:e.M.securityContext,from:this.contextId,id:this.config.securityContext.id};this.postOver(`children`,n),this.postOver(`worker`,n),this.postToDirectChildren(n),t&&this.postOver(`openfin`,n)}postToDirectChildren(e){for(let[t,n]of this.directReplies){let r=n.deref();!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.`,()=>{r(e,{link:`direct`,origin:`same-origin`,peer:t})})}}keepDirectReply(e,t){for(let e of this.directReplies.keys())e.closed&&this.directReplies.delete(e);this.directReplies.set(e,new WeakRef(t))}role=`sender`;upstream=null;links=[];openFinLink=null;isOpenFinProvider=!1;rulesPoll;destroyed=!1;ownerId=null;ownerPeer;awaitingWelcome=null;constructor(e,t,n,r,i,a,o=x){this.config=e,this.diagnostics=t,this.platform=n,this.contextId=r,this.tabId=i,this.handlers=a,this.handshakeOptions=o}getRole(){return this.role}async start(){let{bus:e}=this.config;if(e.mode===`off`)return this.role=`sender`,this.role;if(this.isOpenFinProvider=this.resolveOpenFinProvider(),e.mode===`sender`||e.mode===`forwarder`)return this.role=e.mode,this.openControlLinks(),this.role===`forwarder`&&(this.upstream=this.candidateUpstream(),this.upstream||this.diagnostics.report(`bus.no_owner`,`bus.mode is "forwarder". No owner exists. The library drops the records of this context.`)),this.announce(),this.role;this.openControlLinks();let t=m(this.receive,this.diagnostics);if(t)return this.role=`forwarder`,this.upstream=t,await this.handshake(t),this.diagnostics.report(`bus.role_resolved`,`This context attached directly to the runtime of its same-origin parent.`,{role:`forwarder`,via:`direct`}),this.announce(),this.role;let n=this.candidateUpstream();if(!n)return this.role=`sender`,this.diagnostics.report(`bus.role_resolved`,`No owner exists. This context sends its own records.`,{role:`sender`}),this.announce(),this.role;let r=this.orphanPolicy()===`retry`?this.handshakeOptions.maxAttempts:1,i=!1;for(let e=0;e<r&&!i;e++)i=await this.handshake(n);return this.role=i?`forwarder`:`sender`,this.upstream=i?n:null,i||(n!==this.openFinLink&&n.close(),this.diagnostics.report(`bus.handshake_timeout`,`No owner answered after ${String(r)} attempt(s) of ${String(this.handshakeOptions.timeoutMs)} ms. This context becomes the sender.`,{via:n.kind,crossOrigin:this.isCrossOriginFrame()})),this.diagnostics.report(`bus.role_resolved`,`The bus role is ${this.role}.`,{role:this.role,via:i?n.kind:`none`}),this.announce(),this.role}sendRecords(t){let{maxRecordsPerMessage:n,maxMessageBytes:r}=this.config.bus,i=new TextEncoder,a=e=>r?i.encode(JSON.stringify(e)).length:0,o=t=>({t:e.M.records,from:this.contextId,records:t,routingContextId:this.config.securityContext.id||void 0}),s=a(o([])),c=[],l=s;for(let e of t){let t=a(e);if(r&&s+t>r){this.diagnostics.count(`bus.rejected_message`);continue}let i=+(c.length>0);(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)}c.length>0&&this.upstream?.post(o(c))}acceptDirect(t,n,r){let i={link:`direct`,origin:`same-origin`,peer:r},a={...i,reply:e=>{n(e,i)}};this.acceptsMessage(t,a,!0)&&t.from!==this.contextId&&(r&&this.keepDirectReply(r,n),t.t===e.M.samplingRequest?n(this.rulesAnswer(t.from),i):(t.t===e.M.records&&!this.awaitingWelcome&&t.routingContextId!==this.config.securityContext.id&&n({t:e.M.securityContext,from:this.contextId,id:this.config.securityContext.id},i),this.routeMessage(t,a)))}attachWorker(e,t={}){let n={...t,permissions:[...t.permissions??[`records`]]};this.sources.set(e,n);let r=b(e,this.receive,this.diagnostics),i={...r,post:t=>{this.mayPost(t,e)&&r.post(t)}};return this.links.push(i),()=>{i.close();let t=this.links.indexOf(i);t>=0&&this.links.splice(t,1),this.sources.get(e)===n&&this.sources.delete(e)}}broadcastJourney(t){this.postJourney({t:e.M.journey,from:this.contextId,journey:t})}destroy(){this.sources.clear(),this.directReplies.clear(),this.destroyed=!0,clearInterval(this.rulesPoll),this.rulesPoll=void 0;for(let e of this.allLinks())e.close();this.links.length=0,this.upstream=null,this.ownerId=null,this.openFinLink=null}allLinks(){return!this.upstream||this.links.includes(this.upstream)?this.links:[...this.links,this.upstream]}postOver(e,t){for(let n of this.allLinks())n.kind===e&&n.post(t)}postJourney(e){for(let t of this.allLinks())this.journeyLink(t.kind)&&t.post(e)}receive=(e,t)=>{let n=t.link===`children`||t.link===`worker`;this.acceptsMessage(e,t,n)&&this.routeMessage(e,t)};acceptsMessage(e,t,n){if(this.destroyed)return!1;let r;try{r=this.passesChecks(e,t,n)}catch{r=!1}return r||this.diagnostics.count(`bus.rejected_message`),r}passesChecks(t,n,r){let{bus:i}=this.config,o=typeof n.peer==`object`?this.sources.get(n.peer):void 0;if(r&&i.sourcePolicy===`registered`&&!o)return!1;let c=typeof n.peer==`object`?n.peer:void 0,l=typeof n.peer==`string`?n.peer:n.link,u=Date.now(),d=(c?this.rates.get(c):this.channelRates.get(l))??{start:u,count:0};if(c)this.rates.set(c,d);else{for(let[e,t]of this.channelRates)a.n(t,1e3,u)&&this.channelRates.delete(e);if(i.maxTrackedSources&&this.channelRates.size>=i.maxTrackedSources&&!this.channelRates.has(l))return!1;this.channelRates.set(l,d)}if(!a.t(d,i.maxMessagesPerSecond||1/0,1e3))return!1;let f=JSON.stringify(t,(e,t)=>{if(i.validation===`strict`&&typeof t==`number`&&!Number.isFinite(t))throw Error(`Non-finite value`);return t});if(i.maxMessageBytes&&new TextEncoder().encode(f).length>i.maxMessageBytes||i.validation===`strict`&&!s(t)||t.t===e.M.records&&i.maxRecordsPerMessage&&t.records.length>i.maxRecordsPerMessage)return!1;if(o){let n=t.t===e.M.records?`records`:t.t===e.M.journey?`journey:write`:t.t===e.M.journeyRequest?`journey:read`:t.t===e.M.samplingRequest?`sampling:read`:void 0;if(n&&!o.permissions?.includes(n))return!1}return r&&(t.t===e.M.sampling||t.t===e.M.securityContext)?!1:i.sourcePolicy!==`registered`||n.link!==`broadcast`||t.t!==e.M.records}routeMessage(t,n){if(t.from!==this.contextId)switch(t.t){case e.M.hello:this.canOwn(n.link)&&this.answer(n,{t:e.M.welcome,from:this.contextId,to:t.from,tabId:this.tabId,routingContextId:this.awaitingWelcome?void 0:this.config.securityContext.id||void 0});break;case e.M.welcome:if(t.to!==this.contextId)break;if(this.awaitingWelcome?.link===n.link||this.upstream?.kind===n.link&&this.ownerId===null){this.ownerId=t.from,this.ownerPeer=n.peer;let e=this.config.securityContext.id;if(t.routingContextId&&this.handlers.onSecurityContext?.(t.routingContextId)===!1)break;this.config.securityContext.id!==e&&this.passContext(!1),this.awaitingWelcome?.settle(!0)}break;case e.M.records:if(this.config.securityContext.isolation&&this.config.securityContext.id&&t.routingContextId!==this.config.securityContext.id){this.diagnostics.count(`security.context_mismatch`);break}this.role===`sender`?this.handlers.onRecords(t.records):this.upstream&&this.canRelay(n.link)&&this.upstream.post(t);break;case e.M.securityContext:n.link===this.upstream?.kind&&this.ownerId===t.from&&this.ownerPeer===n.peer&&this.handlers.onSecurityContext?.(t.id)!==!1&&this.rotateContext();break;case e.M.journey:this.acceptsJourney(t,n)&&this.applyJourney(t.journey);break;case e.M.journeyRequest:{let r=this.handlers.onJourneyRequest();r&&this.journeyLink(n.link)&&this.answer(n,{t:e.M.journey,from:this.contextId,to:t.from,journey:r});break}case e.M.samplingRequest:(this.role===`forwarder`?n.link!==this.upstream?.kind:this.canOwn(n.link))&&this.answer(n,this.rulesAnswer(t.from));break;case e.M.sampling:this.acceptsRules(t.to,n)&&this.applyRules(t.rules);break;case e.M.tab:n.link===`broadcast`&&t.tabId===this.tabId&&this.contextId>t.from&&this.handlers.onTabConflict()}}answer(e,t){e.reply?e.reply(t):this.postOver(e.link,t)}canRelay(e){return e===`direct`||e!==this.upstream?.kind}canOwn(e){return this.role!==`sender`&&this.ownerId===null?!1:e===`openfin`?this.role===`sender`&&this.isOpenFinProvider:S.includes(e)}resolveOpenFinProvider(){let e=this.config.bus.openFinRole;if(e!==`auto`)return e===`provider`;if(this.platform.platform!==`openfin`&&this.platform.platform!==`openfin_web`)return!1;let t=i.t()?.me;return!t?.identity||t.isView?!1:!!(t.identity.name&&t.identity.name===t.identity.uuid)}orphanPolicy(){return this.isCrossOriginFrame()?`retry`:`promote`}isCrossOriginFrame(){if(typeof window>`u`||window.parent===window)return!1;try{return Reflect.get(window.parent,`location`),!1}catch{return!0}}candidateUpstream(){return this.platform.isWorker?y(this.receive,this.diagnostics):this.platform.isTopLevelDocument?this.platform.platform===`openfin`&&!this.isOpenFinProvider?this.ensureOpenFinLink():null:h(this.receive,this.config.bus.trustedOrigins,this.diagnostics)}openControlLinks(){let t=e=>{e&&this.links.push(e)};this.platform.isWorker||this.ensureChildrenLink(),this.platform.isTopLevelDocument&&t(_(e.O,this.receive,this.diagnostics)),(this.platform.platform===`openfin`||this.platform.platform===`openfin_web`)&&t(this.ensureOpenFinLink())}ensureChildrenLink(){if(this.links.some(e=>e.kind===`children`))return;let e=g(this.receive,this.config.bus.trustedOrigins,this.diagnostics,(e,t)=>{let n=this.isRegistered(e,t);if(!n){this.diagnostics.count(`bus.rejected_message`);let n=e!==null&&this.sources.has(e),r=t===location.origin||this.config.bus.trustedOrigins.includes(t);(n||!r)&&this.diagnostics.report(`bus.untrusted_origin`,`The bus rejected a message from an untrusted origin.`)}return n},(e,t)=>this.mayPost(e,t));e&&this.links.push(e)}ensureOpenFinLink(){return this.openFinLink??=v(e.O,this.platform.openfinUuid,this.receive,this.diagnostics),this.openFinLink}handshake(t){return new Promise(n=>{let r=!1,i=e=>{r||(r=!0,this.awaitingWelcome=null,clearTimeout(a),n(e))};this.awaitingWelcome={link:t.kind,settle:i};let a=setTimeout(()=>{i(!1)},this.handshakeOptions.timeoutMs);o.t(a),t.post({t:e.M.hello,from:this.contextId,tabId:this.tabId})})}announce(){this.postOver(`broadcast`,{t:e.M.tab,from:this.contextId,tabId:this.tabId}),this.upstream&&this.ownerId===null&&this.upstream.post({t:e.M.hello,from:this.contextId,tabId:this.tabId}),this.postJourney({t:e.M.journeyRequest,from:this.contextId}),this.pollRules(),this.passContext(!1)}journeyScope(){let{scope:e}=this.config.journey;if(e!==`auto`)return e;let{platform:t}=this.platform;return t===`openfin`||t===`openfin_web`?`origin`:`tab`}journeyLink(e){let t=this.journeyScope();return t===`context`?!1:t===`origin`||e!==`broadcast`}acceptsJourney(e,t){return!this.journeyLink(t.link)||e.to!==void 0&&e.to!==this.contextId?!1:this.journeyScope()===`origin`||this.fromOwner(e.from,t.link)&&(this.ownerPeer===void 0||this.ownerPeer===t.peer)}fromOwner(e,t){return this.role!==`forwarder`||t!==this.upstream?.kind?!1:this.ownerId===null||e===this.ownerId}applyJourney(e){if(e===null){this.handlers.onJourney(null);return}let n=t.r(e);n===null?this.diagnostics.report(`record.dropped_malformed`,`The bus dropped a journey message. Its payload is not a journey.`,{type:`journey`}):this.handlers.onJourney(n)}rulesAnswer(t){let n=this.handlers.remote.sampling?.wire()??null;return{t:e.M.sampling,from:this.contextId,to:t,rules:n}}acceptsRules(e,t){if(this.role!==`forwarder`||e!==this.contextId||t.link!==this.upstream?.kind)return!1;let{origin:n}=t;return t.link===`parent`&&n!==location.origin&&!this.config.bus.trustedOrigins.includes(n)?(this.diagnostics.report(`bus.untrusted_origin`,`The bus ignored sampling rules from ${n}. If you own this origin, add it to bus.trustedOrigins.`,{origin:n,type:`sampling`}),!1):this.ownerPeer===void 0||this.ownerPeer===t.peer}applyRules(e){if(e===null){n.t(this.handlers.remote,this.config,null);return}let t=n.n(e,this.diagnostics);t&&n.t(this.handlers.remote,this.config,t)}pollRules(){let{upstream:t}=this;if(this.destroyed||this.role!==`forwarder`||!t)return;let n=()=>{this.config.sampling.remote&&t.post({t:e.M.samplingRequest,from:this.contextId})};n(),this.rulesPoll=setInterval(n,e.an),o.t(this.rulesPoll)}};exports.Bus=C;
|
|
2
|
+
//# sourceMappingURL=bus-D_7pd7RN.cjs.map
|