@utk09/ui-observability 0.11.0 → 1.0.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 +481 -0
- package/README.md +73 -669
- package/bin/uiobs.mjs +1 -1
- package/dist/{batch-CL9uWYY3.js → batch-CXmPmTse.js} +3 -3
- package/dist/batch-CXmPmTse.js.map +1 -0
- package/dist/{batch-C8OcWR2L.cjs → batch-mmPigCpi.cjs} +2 -2
- package/dist/batch-mmPigCpi.cjs.map +1 -0
- package/dist/bus/bus.d.cts +331 -0
- package/dist/bus/bus.d.ts +108 -57
- package/dist/bus/links.d.cts +132 -0
- package/dist/bus/links.d.ts +22 -7
- package/dist/bus/validation.d.cts +16 -0
- package/dist/bus/validation.d.ts +11 -2
- package/dist/bus-C39wspFV.js +775 -0
- package/dist/bus-C39wspFV.js.map +1 -0
- package/dist/bus-_EaOVPGq.cjs +2 -0
- package/dist/bus-_EaOVPGq.cjs.map +1 -0
- package/dist/capture/console.d.cts +37 -0
- package/dist/capture/console.d.ts +11 -11
- package/dist/capture/errors.d.cts +32 -0
- package/dist/capture/errors.d.ts +7 -7
- package/dist/capture/interactions.d.cts +48 -0
- package/dist/capture/interactions.d.ts +15 -15
- package/dist/capture/lifecycle.d.cts +20 -0
- package/dist/capture/lifecycle.d.ts +4 -4
- package/dist/capture/long-frames.d.cts +31 -0
- package/dist/capture/long-frames.d.ts +7 -7
- package/dist/capture/network.d.cts +57 -0
- package/dist/capture/network.d.ts +18 -18
- package/dist/capture/profiler-frames.d.cts +44 -0
- package/dist/capture/profiler-frames.d.ts +44 -0
- package/dist/capture/replay-buffer.d.cts +45 -0
- package/dist/capture/replay-buffer.d.ts +45 -0
- package/dist/capture/replay-upload.d.cts +79 -0
- package/dist/capture/replay-upload.d.ts +79 -0
- package/dist/capture/replay.d.cts +114 -0
- package/dist/capture/replay.d.ts +114 -0
- package/dist/capture/reports.d.cts +17 -0
- package/dist/capture/reports.d.ts +3 -3
- package/dist/capture/resource-timing.d.cts +14 -0
- package/dist/capture/resource-timing.d.ts +2 -2
- package/dist/capture/server-timing.d.cts +19 -0
- package/dist/capture/server-timing.d.ts +3 -3
- package/dist/capture/storm.d.cts +13 -0
- package/dist/capture/storm.d.ts +7 -7
- package/dist/capture/types.d.cts +128 -0
- package/dist/capture/types.d.ts +54 -41
- package/dist/capture/unclean-exit.d.cts +31 -0
- package/dist/capture/unclean-exit.d.ts +9 -9
- package/dist/capture/user-timing.d.cts +22 -0
- package/dist/capture/user-timing.d.ts +4 -4
- package/dist/capture/web-socket.d.cts +40 -0
- package/dist/capture/web-socket.d.ts +14 -14
- package/dist/capture/web-vitals.d.cts +40 -0
- package/dist/capture/web-vitals.d.ts +21 -8
- package/dist/compression-CvED_Jel.cjs +2 -0
- package/dist/compression-CvED_Jel.cjs.map +1 -0
- package/dist/compression-tVtXwVjX.js +11 -0
- package/dist/compression-tVtXwVjX.js.map +1 -0
- package/dist/config-DUs7uHHt.cjs +2 -0
- package/dist/config-DUs7uHHt.cjs.map +1 -0
- package/dist/config-SgQcCP1_.js +560 -0
- package/dist/config-SgQcCP1_.js.map +1 -0
- package/dist/console-BGgGnjSi.js +81 -0
- package/dist/console-BGgGnjSi.js.map +1 -0
- package/dist/console-CSZ5_Vx5.cjs +2 -0
- package/dist/console-CSZ5_Vx5.cjs.map +1 -0
- package/dist/constants-CUyd9cTZ.js +357 -0
- package/dist/constants-CUyd9cTZ.js.map +1 -0
- package/dist/constants-CqdJhTxH.cjs +2 -0
- package/dist/constants-CqdJhTxH.cjs.map +1 -0
- package/dist/constants.d.cts +751 -0
- package/dist/constants.d.ts +231 -116
- package/dist/core/breadcrumbs.d.cts +54 -0
- package/dist/core/breadcrumbs.d.ts +21 -15
- package/dist/core/config.d.cts +45 -0
- package/dist/core/config.d.ts +33 -5
- package/dist/core/context.d.cts +24 -0
- package/dist/core/context.d.ts +8 -13
- package/dist/core/debug-buffer.d.cts +34 -0
- package/dist/core/debug-buffer.d.ts +13 -13
- package/dist/core/debug-bundle.d.cts +12 -0
- package/dist/core/debug-bundle.d.ts +6 -6
- package/dist/core/deferred.d.cts +7 -0
- package/dist/core/deferred.d.ts +4 -4
- package/dist/core/diagnostics.d.cts +86 -0
- package/dist/core/diagnostics.d.ts +25 -22
- package/dist/core/drops.d.cts +39 -0
- package/dist/core/drops.d.ts +22 -12
- package/dist/core/hold-buffer.d.cts +36 -0
- package/dist/core/hold-buffer.d.ts +16 -7
- package/dist/core/journey.d.cts +148 -0
- package/dist/core/journey.d.ts +28 -29
- package/dist/core/logger.d.cts +141 -0
- package/dist/core/logger.d.ts +45 -51
- package/dist/core/measure.d.cts +30 -0
- package/dist/core/measure.d.ts +21 -10
- package/dist/core/meter.d.cts +78 -0
- package/dist/core/meter.d.ts +38 -28
- package/dist/core/pipeline.d.cts +227 -0
- package/dist/core/pipeline.d.ts +114 -50
- package/dist/core/profile-buckets.d.cts +31 -0
- package/dist/core/profile-buckets.d.ts +31 -0
- package/dist/core/profiler.d.cts +218 -0
- package/dist/core/profiler.d.ts +218 -0
- package/dist/core/record.d.cts +190 -0
- package/dist/core/record.d.ts +67 -35
- package/dist/core/remote-rules.d.cts +17 -0
- package/dist/core/remote-rules.d.ts +7 -7
- package/dist/core/remote-sampling.d.cts +74 -0
- package/dist/core/remote-sampling.d.ts +24 -23
- package/dist/core/rotation.d.cts +75 -0
- package/dist/core/rotation.d.ts +75 -0
- package/dist/core/runtime.d.cts +765 -0
- package/dist/core/runtime.d.ts +430 -186
- package/dist/core/sampling.d.cts +86 -0
- package/dist/core/sampling.d.ts +22 -22
- package/dist/core/sender.d.cts +161 -0
- package/dist/core/sender.d.ts +80 -34
- package/dist/core/spans.d.cts +39 -0
- package/dist/core/spans.d.ts +6 -6
- package/dist/{deadline-BOjOxNHj.js → deadline-C4ccAuk5.js} +3 -6
- 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-BXIlwDKM.cjs +2 -0
- package/dist/debug-bundle-BXIlwDKM.cjs.map +1 -0
- package/dist/debug-bundle-CRpYV_ui.js +35 -0
- package/dist/debug-bundle-CRpYV_ui.js.map +1 -0
- package/dist/defineProperty-X1c4tIPD.cjs +1 -0
- package/dist/defineProperty-s2S8BXUc.js +35 -0
- package/dist/doctor.cjs +1 -1
- package/dist/doctor.cjs.map +1 -1
- package/dist/doctor.d.cts +36 -0
- package/dist/doctor.d.ts +19 -6
- package/dist/doctor.js +180 -53
- package/dist/doctor.js.map +1 -1
- package/dist/error-like-B11pB4aL.js.map +1 -1
- package/dist/error-like-gGRx2s36.cjs.map +1 -1
- package/dist/errors-BE_EZV7Q.js +86 -0
- package/dist/errors-BE_EZV7Q.js.map +1 -0
- package/dist/errors-CNPbesMs.cjs +3 -0
- package/dist/errors-CNPbesMs.cjs.map +1 -0
- package/dist/factory-CTi0Is3F.js +404 -0
- package/dist/factory-CTi0Is3F.js.map +1 -0
- package/dist/factory-hRrH32v5.cjs +2 -0
- package/dist/factory-hRrH32v5.cjs.map +1 -0
- package/dist/fixed-window-CvESpFYV.cjs.map +1 -1
- package/dist/fixed-window-Dq3MLUUv.js.map +1 -1
- package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
- package/dist/global-scope-D9I8s-oN.js.map +1 -1
- package/dist/guards-BlYGRK4l.js +10 -0
- package/dist/guards-BlYGRK4l.js.map +1 -0
- package/dist/guards-EjG3ahFp.cjs +2 -0
- package/dist/guards-EjG3ahFp.cjs.map +1 -0
- package/dist/{identity-DT5VmvXy.js → identity-DdhKgrpk.js} +11 -15
- package/dist/identity-DdhKgrpk.js.map +1 -0
- package/dist/identity-DlWRIuwy.cjs +2 -0
- package/dist/identity-DlWRIuwy.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +300 -0
- package/dist/index.d.ts +165 -141
- package/dist/index.js +1283 -1468
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-CL9uqBCy.cjs +2 -0
- package/dist/indexeddb-storage-CL9uqBCy.cjs.map +1 -0
- package/dist/{indexeddb-storage-BJVtiQKm.js → indexeddb-storage-GHdl0t8A.js} +51 -47
- package/dist/indexeddb-storage-GHdl0t8A.js.map +1 -0
- package/dist/interactions-CUkzK8sR.cjs +2 -0
- package/dist/interactions-CUkzK8sR.cjs.map +1 -0
- package/dist/{interactions-DTgKy_6K.js → interactions-DiFvCosX.js} +41 -49
- package/dist/interactions-DiFvCosX.js.map +1 -0
- package/dist/journey-B4Adltjm.cjs +2 -0
- package/dist/journey-B4Adltjm.cjs.map +1 -0
- package/dist/{journey-CuJrHzEg.js → journey-D2_sia57.js} +51 -53
- package/dist/journey-D2_sia57.js.map +1 -0
- package/dist/{library-console-C1m6g1BR.js → library-console-Btrzt814.js} +2 -2
- package/dist/library-console-Btrzt814.js.map +1 -0
- package/dist/{library-console-D2GY9Or6.cjs → library-console-CPW6bvZH.cjs} +2 -2
- package/dist/library-console-CPW6bvZH.cjs.map +1 -0
- package/dist/{library-request-BQBT9N9Q.js → library-request-BJ9PLRaD.js} +2 -2
- package/dist/library-request-BJ9PLRaD.js.map +1 -0
- package/dist/{library-request-1BX_UlaX.cjs → library-request-D7OvTxZV.cjs} +2 -2
- package/dist/library-request-D7OvTxZV.cjs.map +1 -0
- package/dist/{lifecycle-BaKx_-32.js → lifecycle-22CUCrc9.js} +21 -29
- package/dist/lifecycle-22CUCrc9.js.map +1 -0
- package/dist/lifecycle-IaAm1mOC.cjs +2 -0
- package/dist/lifecycle-IaAm1mOC.cjs.map +1 -0
- package/dist/{log-record-CAoGBBf3.js → log-record-BNiLfqtL.js} +8 -7
- package/dist/log-record-BNiLfqtL.js.map +1 -0
- package/dist/log-record-CkivuiEl.cjs +2 -0
- package/dist/log-record-CkivuiEl.cjs.map +1 -0
- package/dist/long-frames-BUUbXd-B.cjs +2 -0
- package/dist/long-frames-BUUbXd-B.cjs.map +1 -0
- package/dist/long-frames-DNFaRnC3.js +62 -0
- package/dist/long-frames-DNFaRnC3.js.map +1 -0
- package/dist/models/batch.d.cts +57 -0
- package/dist/models/batch.d.ts +16 -17
- package/dist/models/bus.d.cts +158 -0
- package/dist/models/bus.d.ts +46 -26
- package/dist/models/config.d.cts +1540 -0
- package/dist/models/config.d.ts +692 -405
- package/dist/models/drop.d.cts +54 -0
- package/dist/models/drop.d.ts +29 -14
- package/dist/models/health.d.cts +148 -0
- package/dist/models/health.d.ts +119 -23
- package/dist/models/log-record.d.cts +61 -0
- package/dist/models/log-record.d.ts +13 -14
- package/dist/models/metric.d.cts +139 -0
- package/dist/models/metric.d.ts +94 -18
- package/dist/models/plugin.d.cts +47 -0
- package/dist/models/plugin.d.ts +16 -16
- package/dist/models/replay.d.cts +60 -0
- package/dist/models/replay.d.ts +60 -0
- package/dist/models/serializer.d.cts +23 -0
- package/dist/models/serializer.d.ts +3 -4
- package/dist/models/storage.d.cts +95 -0
- package/dist/models/storage.d.ts +17 -14
- package/dist/network-CGMLQ-mA.cjs +2 -0
- package/dist/network-CGMLQ-mA.cjs.map +1 -0
- package/dist/{network-DBNwApoF.js → network-on2zZT6H.js} +57 -57
- package/dist/network-on2zZT6H.js.map +1 -0
- package/dist/openfin-Bxelt0yg.js.map +1 -1
- package/dist/openfin-DtH2f7zX.cjs.map +1 -1
- package/dist/otlp-BENHf3g9.cjs +2 -0
- package/dist/otlp-BENHf3g9.cjs.map +1 -0
- package/dist/{otlp-BTJdIa6F.js → otlp-DimfrRor.js} +22 -29
- package/dist/otlp-DimfrRor.js.map +1 -0
- package/dist/patch-BX8KrPCT.cjs.map +1 -1
- package/dist/patch-UdPz1ea8.js.map +1 -1
- package/dist/{platform-DkcuXwe-.js → platform-BaaFIPCU.js} +8 -8
- package/dist/platform-BaaFIPCU.js.map +1 -0
- package/dist/{platform-C2Ez5kDc.cjs → platform-CfA3-7sJ.cjs} +2 -2
- package/dist/platform-CfA3-7sJ.cjs.map +1 -0
- package/dist/profiler-BAZoh7A4.js +292 -0
- package/dist/profiler-BAZoh7A4.js.map +1 -0
- package/dist/profiler-D4tJpDRc.cjs +2 -0
- package/dist/profiler-D4tJpDRc.cjs.map +1 -0
- package/dist/profiler-frames-C4xr7KfH.cjs +2 -0
- package/dist/profiler-frames-C4xr7KfH.cjs.map +1 -0
- package/dist/profiler-frames-cJMx9wNM.js +78 -0
- package/dist/profiler-frames-cJMx9wNM.js.map +1 -0
- package/dist/remote-rules-Dz9MRAsB.js +95 -0
- package/dist/remote-rules-Dz9MRAsB.js.map +1 -0
- package/dist/remote-rules-_tY0zj5o.cjs +2 -0
- package/dist/remote-rules-_tY0zj5o.cjs.map +1 -0
- package/dist/replay-B3gFXIZd.cjs +2 -0
- package/dist/replay-B3gFXIZd.cjs.map +1 -0
- package/dist/replay-Ds-ANH34.js +310 -0
- package/dist/replay-Ds-ANH34.js.map +1 -0
- package/dist/reports-BDSe4dFH.cjs +2 -0
- package/dist/reports-BDSe4dFH.cjs.map +1 -0
- package/dist/{reports-TA-zInnq.js → reports-C-thq-bk.js} +25 -30
- package/dist/reports-C-thq-bk.js.map +1 -0
- package/dist/resource-timing-C576gFIQ.cjs +2 -0
- package/dist/resource-timing-C576gFIQ.cjs.map +1 -0
- package/dist/{resource-timing-BLv3EA2A.js → resource-timing-eUl2dNgC.js} +20 -23
- package/dist/resource-timing-eUl2dNgC.js.map +1 -0
- package/dist/response-body-YdNl-HkR.cjs +3 -0
- package/dist/response-body-YdNl-HkR.cjs.map +1 -0
- package/dist/response-body-eoSQpLiH.js +331 -0
- package/dist/response-body-eoSQpLiH.js.map +1 -0
- package/dist/rotation-Cwct4ckk.js +94 -0
- package/dist/rotation-Cwct4ckk.js.map +1 -0
- package/dist/rotation-D4qUAHAu.cjs +2 -0
- package/dist/rotation-D4qUAHAu.cjs.map +1 -0
- package/dist/sampling-BlrI8jor.js +63 -0
- package/dist/sampling-BlrI8jor.js.map +1 -0
- package/dist/sampling-mXt4dstx.cjs +2 -0
- package/dist/sampling-mXt4dstx.cjs.map +1 -0
- package/dist/{sanitize-6ymPlVvP.js → sanitize-Ba0KqU06.js} +2 -2
- package/dist/sanitize-Ba0KqU06.js.map +1 -0
- package/dist/{sanitize-BAWzkZt0.cjs → sanitize-DQyiI_KY.cjs} +2 -2
- package/dist/sanitize-DQyiI_KY.cjs.map +1 -0
- package/dist/sender-BdRuNVhF.cjs +2 -0
- package/dist/sender-BdRuNVhF.cjs.map +1 -0
- package/dist/sender-Dv8rAmpV.js +979 -0
- package/dist/sender-Dv8rAmpV.js.map +1 -0
- package/dist/storage/context-storage.d.cts +90 -0
- package/dist/storage/context-storage.d.ts +38 -37
- package/dist/storage/emergency-queue.d.cts +27 -0
- package/dist/storage/emergency-queue.d.ts +13 -13
- package/dist/storage/eviction.d.cts +40 -0
- package/dist/storage/eviction.d.ts +13 -13
- package/dist/storage/factory.d.cts +21 -0
- package/dist/storage/factory.d.ts +11 -10
- package/dist/storage/gap.d.cts +20 -0
- package/dist/storage/gap.d.ts +9 -9
- package/dist/storage/idb-driver.d.cts +93 -0
- package/dist/storage/idb-driver.d.ts +32 -33
- package/dist/storage/indexeddb-storage.d.cts +97 -0
- package/dist/storage/indexeddb-storage.d.ts +38 -31
- package/dist/storage/keys.d.cts +17 -0
- package/dist/storage/keys.d.ts +9 -9
- package/dist/storage/local-storage.d.cts +139 -0
- package/dist/storage/local-storage.d.ts +49 -42
- package/dist/storage/memory-storage.d.cts +73 -0
- package/dist/storage/memory-storage.d.ts +25 -25
- package/dist/storage/persistence.d.cts +8 -0
- package/dist/storage/persistence.d.ts +3 -3
- package/dist/storage/stored-context.d.cts +34 -0
- package/dist/storage/stored-context.d.ts +34 -0
- package/dist/stored-context-B2EzVuYm.js +51 -0
- package/dist/stored-context-B2EzVuYm.js.map +1 -0
- package/dist/stored-context-CXt7eHZL.cjs +2 -0
- package/dist/stored-context-CXt7eHZL.cjs.map +1 -0
- package/dist/storm-C-zYSdDX.cjs +2 -0
- package/dist/storm-C-zYSdDX.cjs.map +1 -0
- package/dist/storm-DjKetLKZ.js +9 -0
- package/dist/storm-DjKetLKZ.js.map +1 -0
- package/dist/transport/compression.d.cts +7 -0
- package/dist/transport/compression.d.ts +2 -2
- package/dist/transport/custom-transport.d.cts +22 -0
- package/dist/transport/custom-transport.d.ts +6 -5
- package/dist/transport/errors.d.cts +31 -0
- package/dist/transport/errors.d.ts +7 -7
- package/dist/transport/exit-flush.d.cts +135 -0
- package/dist/transport/exit-flush.d.ts +62 -45
- package/dist/transport/headers.d.cts +8 -0
- package/dist/transport/headers.d.ts +4 -4
- package/dist/transport/http-transport.d.cts +116 -0
- package/dist/transport/http-transport.d.ts +48 -35
- package/dist/transport/memory-transport.d.cts +30 -0
- package/dist/transport/memory-transport.d.ts +8 -8
- package/dist/transport/response-body.d.cts +49 -0
- package/dist/transport/response-body.d.ts +49 -0
- package/dist/transport/retry-engine.d.cts +129 -0
- package/dist/transport/retry-engine.d.ts +62 -43
- package/dist/transport/serializers/ecs.d.cts +3 -0
- package/dist/transport/serializers/ecs.d.ts +2 -2
- package/dist/transport/serializers/otlp-metrics.d.cts +3 -0
- package/dist/transport/serializers/otlp-metrics.d.ts +2 -2
- package/dist/transport/serializers/otlp-traces.d.cts +3 -0
- package/dist/transport/serializers/otlp-traces.d.ts +2 -2
- package/dist/transport/serializers/otlp.d.cts +47 -0
- package/dist/transport/serializers/otlp.d.ts +18 -18
- package/dist/transport/serializers/select.d.cts +38 -0
- package/dist/transport/serializers/select.d.ts +11 -11
- package/dist/transport/status-transport.d.cts +129 -0
- package/dist/transport/status-transport.d.ts +45 -28
- package/dist/transport/worker-client.d.cts +23 -0
- package/dist/transport/worker-client.d.ts +12 -3
- package/dist/transport/worker-entry.d.cts +5 -0
- package/dist/transport/worker-entry.d.ts +1 -1
- package/dist/transport/worker-protocol.d.cts +38 -0
- package/dist/transport/worker-protocol.d.ts +7 -5
- package/dist/transport/worker-server.d.cts +3 -0
- package/dist/transport/worker-server.d.ts +1 -1
- package/dist/transport/worker-transport.d.cts +10 -0
- package/dist/transport/worker-transport.d.ts +5 -4
- package/dist/types-BAerHgCq.js.map +1 -1
- package/dist/types-C7WNpnG1.cjs.map +1 -1
- package/dist/{unclean-exit-CwcUhFOn.js → unclean-exit-DQD1cT7c.js} +23 -30
- package/dist/unclean-exit-DQD1cT7c.js.map +1 -0
- package/dist/unclean-exit-py99ApzT.cjs +2 -0
- package/dist/unclean-exit-py99ApzT.cjs.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-_jZIhDKI.js → user-timing-BePqb1uN.js} +18 -18
- package/dist/user-timing-BePqb1uN.js.map +1 -0
- package/dist/user-timing-D6XTmpuM.cjs +2 -0
- package/dist/user-timing-D6XTmpuM.cjs.map +1 -0
- package/dist/utils/console.d.cts +36 -0
- package/dist/utils/console.d.ts +6 -6
- package/dist/utils/deadline.d.cts +14 -0
- package/dist/utils/deadline.d.ts +4 -4
- package/dist/utils/error-like.d.cts +25 -0
- package/dist/utils/error-like.d.ts +7 -7
- package/dist/utils/fixed-window.d.cts +25 -0
- package/dist/utils/fixed-window.d.ts +9 -8
- package/dist/utils/global-scope.d.cts +20 -0
- package/dist/utils/global-scope.d.ts +8 -8
- package/dist/utils/guards.d.cts +14 -0
- package/dist/utils/guards.d.ts +10 -2
- package/dist/utils/identity.d.cts +109 -0
- package/dist/utils/identity.d.ts +20 -21
- package/dist/utils/library-console.d.cts +11 -0
- package/dist/utils/library-console.d.ts +4 -4
- package/dist/utils/library-request.d.cts +24 -0
- package/dist/utils/library-request.d.ts +10 -10
- package/dist/utils/lock.d.cts +24 -0
- package/dist/utils/lock.d.ts +11 -10
- package/dist/utils/openfin.d.cts +48 -0
- package/dist/utils/openfin.d.ts +5 -5
- package/dist/utils/patch.d.cts +9 -0
- package/dist/utils/patch.d.ts +6 -6
- package/dist/utils/platform.d.cts +62 -0
- package/dist/utils/platform.d.ts +15 -13
- package/dist/utils/sanitize.d.cts +52 -0
- package/dist/utils/sanitize.d.ts +5 -5
- package/dist/utils/sequence.d.cts +10 -0
- package/dist/utils/tracing.d.cts +158 -0
- package/dist/utils/tracing.d.ts +49 -42
- package/dist/utils/unref.d.cts +9 -0
- package/dist/utils/unref.d.ts +3 -3
- package/dist/web-socket-CoIUBM3C.cjs +2 -0
- package/dist/web-socket-CoIUBM3C.cjs.map +1 -0
- package/dist/{web-socket-CV7yIMnm.js → web-socket-DSHgDiZ6.js} +23 -28
- package/dist/web-socket-DSHgDiZ6.js.map +1 -0
- package/dist/web-vitals-4pWACwaR.js +71 -0
- package/dist/web-vitals-4pWACwaR.js.map +1 -0
- package/dist/web-vitals-__X7t4pj.cjs +2 -0
- package/dist/web-vitals-__X7t4pj.cjs.map +1 -0
- package/dist/worker-protocol-QbvqNazn.cjs +2 -0
- package/dist/worker-protocol-QbvqNazn.cjs.map +1 -0
- package/dist/{worker-protocol-CrsdSDLn.js → worker-protocol-x074Rpet.js} +14 -11
- package/dist/worker-protocol-x074Rpet.js.map +1 -0
- package/dist/worker-server-CFe4nvos.cjs +2 -0
- package/dist/worker-server-CFe4nvos.cjs.map +1 -0
- package/dist/worker-server-iUVSjH8L.js +94 -0
- package/dist/worker-server-iUVSjH8L.js.map +1 -0
- package/dist/worker-transport-CRAX-09c.cjs +2 -0
- package/dist/worker-transport-CRAX-09c.cjs.map +1 -0
- package/dist/worker-transport-Dy1KMA7t.js +190 -0
- package/dist/worker-transport-Dy1KMA7t.js.map +1 -0
- package/llms.txt +397 -0
- package/package.json +55 -41
- package/dist/batch-C8OcWR2L.cjs.map +0 -1
- package/dist/batch-CL9uWYY3.js.map +0 -1
- package/dist/bus-BZ0GldpT.js +0 -660
- package/dist/bus-BZ0GldpT.js.map +0 -1
- package/dist/bus-VWlmM5xs.cjs +0 -2
- package/dist/bus-VWlmM5xs.cjs.map +0 -1
- package/dist/console-BPZCuSLc.cjs +0 -2
- package/dist/console-BPZCuSLc.cjs.map +0 -1
- package/dist/console-BeCF7n59.js +0 -82
- package/dist/console-BeCF7n59.js.map +0 -1
- package/dist/constants-DqKJH_MP.cjs +0 -2
- package/dist/constants-DqKJH_MP.cjs.map +0 -1
- package/dist/constants-zyrqveN4.js +0 -304
- package/dist/constants-zyrqveN4.js.map +0 -1
- package/dist/context-storage-BjzeBSxH.cjs +0 -2
- package/dist/context-storage-BjzeBSxH.cjs.map +0 -1
- package/dist/context-storage-BzkoHzkQ.js +0 -51
- package/dist/context-storage-BzkoHzkQ.js.map +0 -1
- package/dist/deadline-BOjOxNHj.js.map +0 -1
- package/dist/deadline-XSnm95pg.cjs +0 -2
- package/dist/deadline-XSnm95pg.cjs.map +0 -1
- package/dist/debug-bundle-BzJNpbF0.cjs +0 -2
- package/dist/debug-bundle-BzJNpbF0.cjs.map +0 -1
- package/dist/debug-bundle-C7UkHZ-q.js +0 -25
- package/dist/debug-bundle-C7UkHZ-q.js.map +0 -1
- package/dist/emergency-queue-CNTRui5t.cjs +0 -2
- package/dist/emergency-queue-CNTRui5t.cjs.map +0 -1
- package/dist/emergency-queue-Zy6lNafo.js +0 -67
- package/dist/emergency-queue-Zy6lNafo.js.map +0 -1
- package/dist/errors-Dh7kef0i.js +0 -92
- package/dist/errors-Dh7kef0i.js.map +0 -1
- package/dist/errors-tfEr48bS.cjs +0 -3
- package/dist/errors-tfEr48bS.cjs.map +0 -1
- package/dist/factory-BonqI3NL.js +0 -276
- package/dist/factory-BonqI3NL.js.map +0 -1
- package/dist/factory-CJXVYp0R.cjs +0 -2
- package/dist/factory-CJXVYp0R.cjs.map +0 -1
- package/dist/guards-Cidk71ME.js +0 -7
- package/dist/guards-Cidk71ME.js.map +0 -1
- package/dist/guards-nJ70syPt.cjs +0 -2
- package/dist/guards-nJ70syPt.cjs.map +0 -1
- package/dist/identity-Cxgj6pZX.cjs +0 -2
- package/dist/identity-Cxgj6pZX.cjs.map +0 -1
- package/dist/identity-DT5VmvXy.js.map +0 -1
- package/dist/indexeddb-storage-BJVtiQKm.js.map +0 -1
- package/dist/indexeddb-storage-CIoW21Xd.cjs +0 -2
- package/dist/indexeddb-storage-CIoW21Xd.cjs.map +0 -1
- package/dist/interactions-DTgKy_6K.js.map +0 -1
- package/dist/interactions-fEN6FbVo.cjs +0 -2
- package/dist/interactions-fEN6FbVo.cjs.map +0 -1
- package/dist/journey-CuJrHzEg.js.map +0 -1
- package/dist/journey-pffMVMfa.cjs +0 -2
- package/dist/journey-pffMVMfa.cjs.map +0 -1
- package/dist/keys-BHhw_0Wh.cjs +0 -2
- package/dist/keys-BHhw_0Wh.cjs.map +0 -1
- package/dist/keys-BU9j5YqW.js +0 -16
- package/dist/keys-BU9j5YqW.js.map +0 -1
- package/dist/library-console-C1m6g1BR.js.map +0 -1
- package/dist/library-console-D2GY9Or6.cjs.map +0 -1
- package/dist/library-request-1BX_UlaX.cjs.map +0 -1
- package/dist/library-request-BQBT9N9Q.js.map +0 -1
- package/dist/lifecycle-2EtUaRpo.cjs +0 -2
- package/dist/lifecycle-2EtUaRpo.cjs.map +0 -1
- package/dist/lifecycle-BaKx_-32.js.map +0 -1
- package/dist/log-record-CAoGBBf3.js.map +0 -1
- package/dist/log-record-i9zOTkpQ.cjs +0 -2
- package/dist/log-record-i9zOTkpQ.cjs.map +0 -1
- package/dist/long-frames-BVg4i5SC.cjs +0 -2
- package/dist/long-frames-BVg4i5SC.cjs.map +0 -1
- package/dist/long-frames-Czk7IupC.js +0 -64
- package/dist/long-frames-Czk7IupC.js.map +0 -1
- package/dist/models/stats.d.ts +0 -11
- package/dist/network-DBNwApoF.js.map +0 -1
- package/dist/network-xbbuvG_6.cjs +0 -2
- package/dist/network-xbbuvG_6.cjs.map +0 -1
- package/dist/otlp-BDvFrLnc.cjs +0 -2
- package/dist/otlp-BDvFrLnc.cjs.map +0 -1
- package/dist/otlp-BTJdIa6F.js.map +0 -1
- package/dist/platform-C2Ez5kDc.cjs.map +0 -1
- package/dist/platform-DkcuXwe-.js.map +0 -1
- package/dist/remote-rules-Cfb4K-Nl.js +0 -98
- package/dist/remote-rules-Cfb4K-Nl.js.map +0 -1
- package/dist/remote-rules-vzvk7aKf.cjs +0 -2
- package/dist/remote-rules-vzvk7aKf.cjs.map +0 -1
- package/dist/reports-Dk2YhKIh.cjs +0 -2
- package/dist/reports-Dk2YhKIh.cjs.map +0 -1
- package/dist/reports-TA-zInnq.js.map +0 -1
- package/dist/resource-timing-BLv3EA2A.js.map +0 -1
- package/dist/resource-timing-Cysw1S1f.cjs +0 -2
- package/dist/resource-timing-Cysw1S1f.cjs.map +0 -1
- package/dist/sampling-C4VV-1MS.js +0 -60
- package/dist/sampling-C4VV-1MS.js.map +0 -1
- package/dist/sampling-Ckh2yW9k.cjs +0 -2
- package/dist/sampling-Ckh2yW9k.cjs.map +0 -1
- package/dist/sanitize-6ymPlVvP.js.map +0 -1
- package/dist/sanitize-BAWzkZt0.cjs.map +0 -1
- package/dist/select-ZF4by-lF.cjs +0 -3
- package/dist/select-ZF4by-lF.cjs.map +0 -1
- package/dist/select-xtQaenIi.js +0 -270
- package/dist/select-xtQaenIi.js.map +0 -1
- package/dist/sender-CiMHC9YG.js +0 -856
- package/dist/sender-CiMHC9YG.js.map +0 -1
- package/dist/sender-D5wBoXA8.cjs +0 -2
- package/dist/sender-D5wBoXA8.cjs.map +0 -1
- package/dist/storage-BA9RqRO-.cjs +0 -2
- package/dist/storage-BA9RqRO-.cjs.map +0 -1
- package/dist/storage-DZwed89z.js +0 -16
- package/dist/storage-DZwed89z.js.map +0 -1
- package/dist/storm-CYi9Swpx.cjs +0 -2
- package/dist/storm-CYi9Swpx.cjs.map +0 -1
- package/dist/storm-VR024_QN.js +0 -9
- package/dist/storm-VR024_QN.js.map +0 -1
- package/dist/unclean-exit-CwcUhFOn.js.map +0 -1
- package/dist/unclean-exit-DFUN57wY.cjs +0 -2
- package/dist/unclean-exit-DFUN57wY.cjs.map +0 -1
- package/dist/user-timing-C9kfRq3J.cjs +0 -2
- package/dist/user-timing-C9kfRq3J.cjs.map +0 -1
- package/dist/user-timing-_jZIhDKI.js.map +0 -1
- package/dist/utils/timer.d.ts +0 -19
- package/dist/web-socket-BWUoqBh8.cjs +0 -2
- package/dist/web-socket-BWUoqBh8.cjs.map +0 -1
- package/dist/web-socket-CV7yIMnm.js.map +0 -1
- package/dist/web-vitals-Bq4WFHQo.js +0 -52
- package/dist/web-vitals-Bq4WFHQo.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-Bai7GAIA.cjs +0 -2
- package/dist/worker-protocol-Bai7GAIA.cjs.map +0 -1
- package/dist/worker-protocol-CrsdSDLn.js.map +0 -1
- package/dist/worker-server-BrIYkfoa.cjs +0 -2
- package/dist/worker-server-BrIYkfoa.cjs.map +0 -1
- package/dist/worker-server-Dp5HYm4b.js +0 -83
- package/dist/worker-server-Dp5HYm4b.js.map +0 -1
- package/dist/worker-transport-Bwej4N2e.cjs +0 -2
- package/dist/worker-transport-Bwej4N2e.cjs.map +0 -1
- package/dist/worker-transport-D6jtgpqN.js +0 -199
- package/dist/worker-transport-D6jtgpqN.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
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-BZ0GldpT.js
DELETED
|
@@ -1,660 +0,0 @@
|
|
|
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
|
-
if (typeof n.from != "string" || !n.from || typeof n.t != "string") return !1;
|
|
13
|
-
let i = (e) => typeof n[e] == "string";
|
|
14
|
-
switch (n.t) {
|
|
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
|
-
default: return !1;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
// src/models/bus.ts
|
|
28
|
-
function _(e) {
|
|
29
|
-
return {
|
|
30
|
-
p: a,
|
|
31
|
-
m: e
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function v(e) {
|
|
35
|
-
if (typeof e != "object" || !e) return null;
|
|
36
|
-
let t = e;
|
|
37
|
-
if (t.p !== "ui-observability/2" || typeof t.m != "object" || t.m === null) return null;
|
|
38
|
-
let n = t.m;
|
|
39
|
-
return typeof n.t == "string" ? n : null;
|
|
40
|
-
}
|
|
41
|
-
// src/bus/links.ts
|
|
42
|
-
var y = Symbol.for(i), b = "null";
|
|
43
|
-
function x(e, t) {
|
|
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.`;
|
|
45
|
-
}
|
|
46
|
-
function S() {
|
|
47
|
-
let e = location.ancestorOrigins;
|
|
48
|
-
if (e && e.length > 0) return e.item(0);
|
|
49
|
-
let t = document.referrer;
|
|
50
|
-
if (t === "") return null;
|
|
51
|
-
try {
|
|
52
|
-
return new URL(t).origin;
|
|
53
|
-
} catch {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function C(e, t) {
|
|
58
|
-
if (typeof window > "u" || window.parent === window) return null;
|
|
59
|
-
let n;
|
|
60
|
-
try {
|
|
61
|
-
n = window.parent[y];
|
|
62
|
-
} catch {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
if (typeof n?.busAccept != "function" || n.busCanAccept && !n.busCanAccept(window, location.origin)) return null;
|
|
66
|
-
let r = n, i = !0;
|
|
67
|
-
return {
|
|
68
|
-
kind: "direct",
|
|
69
|
-
post(n) {
|
|
70
|
-
i && t.guard("bus.send_failed", "The direct call into the parent runtime failed.", () => {
|
|
71
|
-
r.busAccept(n, e, window);
|
|
72
|
-
});
|
|
73
|
-
},
|
|
74
|
-
close() {
|
|
75
|
-
i = !1;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
function w(e, t, n) {
|
|
80
|
-
if (typeof window > "u" || window.parent === window) return null;
|
|
81
|
-
let r = location.origin;
|
|
82
|
-
if (r === b) 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.", {
|
|
83
|
-
origin: r,
|
|
84
|
-
type: "parent"
|
|
85
|
-
}), null;
|
|
86
|
-
let i = /* @__PURE__ */ new Set([r, ...t]), a = S();
|
|
87
|
-
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.`, {
|
|
88
|
-
origin: a ?? "",
|
|
89
|
-
type: "parent"
|
|
90
|
-
}), null;
|
|
91
|
-
let o = /* @__PURE__ */ new Set(), s = (t) => {
|
|
92
|
-
let r = v(t.data);
|
|
93
|
-
r && t.source === window.parent && (i.has(t.origin) ? e(r, {
|
|
94
|
-
link: "parent",
|
|
95
|
-
origin: t.origin,
|
|
96
|
-
peer: t.source
|
|
97
|
-
}) : o.has(t.origin) || (o.add(t.origin), n.report("bus.untrusted_origin", x(t.origin, "a message"), {
|
|
98
|
-
origin: t.origin,
|
|
99
|
-
type: r.t.slice(0, 48)
|
|
100
|
-
})));
|
|
101
|
-
};
|
|
102
|
-
return addEventListener("message", s), {
|
|
103
|
-
kind: "parent",
|
|
104
|
-
post(e) {
|
|
105
|
-
n.guard("bus.send_failed", "The postMessage call to the parent failed.", () => {
|
|
106
|
-
window.parent.postMessage(_(e), a);
|
|
107
|
-
});
|
|
108
|
-
},
|
|
109
|
-
close() {
|
|
110
|
-
removeEventListener("message", s);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
function T(e, t, n, r, i) {
|
|
115
|
-
if (typeof window > "u") return null;
|
|
116
|
-
let a = /* @__PURE__ */ new Set([location.origin, ...t]);
|
|
117
|
-
a.delete(b);
|
|
118
|
-
let o = /* @__PURE__ */ new Map(), s = (e, t, a) => {
|
|
119
|
-
if (r && !r(e, t)) {
|
|
120
|
-
o.delete(e);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (i && !i(a, e)) return;
|
|
124
|
-
let s = e;
|
|
125
|
-
s.closed ? o.delete(e) : n.guard("bus.send_failed", "The postMessage call to a child frame failed.", () => {
|
|
126
|
-
s.postMessage(_(a), t);
|
|
127
|
-
});
|
|
128
|
-
}, c = (t) => {
|
|
129
|
-
let i = v(t.data);
|
|
130
|
-
if (!i || window.parent !== window && t.source === window.parent) return;
|
|
131
|
-
if (!r && !a.has(t.origin)) {
|
|
132
|
-
n.report("bus.untrusted_origin", x(t.origin, "a message"), {
|
|
133
|
-
origin: t.origin,
|
|
134
|
-
type: i.t.slice(0, 48)
|
|
135
|
-
});
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (r && !r(t.source, t.origin)) return;
|
|
139
|
-
let { source: c, origin: l } = t;
|
|
140
|
-
c && o.set(c, l), e(i, {
|
|
141
|
-
link: "children",
|
|
142
|
-
origin: l,
|
|
143
|
-
peer: c ?? void 0,
|
|
144
|
-
reply: c ? (e) => {
|
|
145
|
-
s(c, l, e);
|
|
146
|
-
} : void 0
|
|
147
|
-
});
|
|
148
|
-
};
|
|
149
|
-
return addEventListener("message", c), {
|
|
150
|
-
kind: "children",
|
|
151
|
-
post(e) {
|
|
152
|
-
for (let [t, n] of o) s(t, n, e);
|
|
153
|
-
},
|
|
154
|
-
close() {
|
|
155
|
-
removeEventListener("message", c), o.clear();
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
function E(e, t, n) {
|
|
160
|
-
let r = globalThis.BroadcastChannel;
|
|
161
|
-
if (r === void 0) return null;
|
|
162
|
-
let i = n.guard("bus.send_failed", "The library could not open the BroadcastChannel.", () => new r(e));
|
|
163
|
-
return i ? (i.onmessage = (e) => {
|
|
164
|
-
let n = v(e.data);
|
|
165
|
-
n && t(n, {
|
|
166
|
-
link: "broadcast",
|
|
167
|
-
origin: "same-origin"
|
|
168
|
-
});
|
|
169
|
-
}, {
|
|
170
|
-
kind: "broadcast",
|
|
171
|
-
post(e) {
|
|
172
|
-
n.guard("bus.send_failed", "The BroadcastChannel.postMessage call failed.", () => {
|
|
173
|
-
i.postMessage(_(e));
|
|
174
|
-
});
|
|
175
|
-
},
|
|
176
|
-
close() {
|
|
177
|
-
n.guard("bus.send_failed", "The library could not close the BroadcastChannel.", () => {
|
|
178
|
-
i.close();
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
}) : null;
|
|
182
|
-
}
|
|
183
|
-
function D(e, t, n, r) {
|
|
184
|
-
let i = f()?.InterApplicationBus;
|
|
185
|
-
if (!i) return null;
|
|
186
|
-
if (!t) return r.report("openfin.unavailable", "OpenFin gives no application uuid. The InterApplicationBus link stays closed."), null;
|
|
187
|
-
let a = `${e}.${t}`;
|
|
188
|
-
return r.guardAsync("bus.send_failed", "The InterApplicationBus.subscribe call failed.", () => i.subscribe({ uuid: t }, a, (e, t, r) => {
|
|
189
|
-
let i = v(e);
|
|
190
|
-
i && n(i, {
|
|
191
|
-
link: "openfin",
|
|
192
|
-
origin: "openfin",
|
|
193
|
-
peer: t && r ? `${t}:${r}` : void 0
|
|
194
|
-
});
|
|
195
|
-
})), {
|
|
196
|
-
kind: "openfin",
|
|
197
|
-
post(e) {
|
|
198
|
-
r.guardAsync("bus.send_failed", "The InterApplicationBus.publish call failed.", () => i.publish(a, _(e)));
|
|
199
|
-
},
|
|
200
|
-
close() {}
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
function O(e, t) {
|
|
204
|
-
let n = globalThis, r = n.postMessage;
|
|
205
|
-
return n.WorkerGlobalScope === void 0 || !r ? null : (n.addEventListener?.("message", (t) => {
|
|
206
|
-
let n = v(t.data);
|
|
207
|
-
n && e(n, {
|
|
208
|
-
link: "owner",
|
|
209
|
-
origin: "same-origin"
|
|
210
|
-
});
|
|
211
|
-
}), {
|
|
212
|
-
kind: "owner",
|
|
213
|
-
post(e) {
|
|
214
|
-
t.guard("bus.send_failed", "The postMessage call of the worker failed.", () => {
|
|
215
|
-
r(_(e));
|
|
216
|
-
});
|
|
217
|
-
},
|
|
218
|
-
close() {}
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
function k(e, t, n) {
|
|
222
|
-
let r = (n) => {
|
|
223
|
-
let r = v(n.data);
|
|
224
|
-
r && t(r, {
|
|
225
|
-
link: "worker",
|
|
226
|
-
origin: "same-origin",
|
|
227
|
-
peer: e
|
|
228
|
-
});
|
|
229
|
-
};
|
|
230
|
-
return e.addEventListener("message", r), e.start?.(), {
|
|
231
|
-
kind: "worker",
|
|
232
|
-
post(t) {
|
|
233
|
-
n.guard("bus.send_failed", "The postMessage call to a worker failed.", () => {
|
|
234
|
-
e.postMessage(_(t));
|
|
235
|
-
});
|
|
236
|
-
},
|
|
237
|
-
close() {
|
|
238
|
-
e.removeEventListener("message", r);
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
// src/bus/bus.ts
|
|
243
|
-
var A = {
|
|
244
|
-
timeoutMs: o,
|
|
245
|
-
maxAttempts: 3
|
|
246
|
-
}, j = [
|
|
247
|
-
"children",
|
|
248
|
-
"direct",
|
|
249
|
-
"worker"
|
|
250
|
-
], M = class {
|
|
251
|
-
config;
|
|
252
|
-
diagnostics;
|
|
253
|
-
platform;
|
|
254
|
-
contextId;
|
|
255
|
-
tabId;
|
|
256
|
-
handlers;
|
|
257
|
-
handshakeOptions;
|
|
258
|
-
sources = /* @__PURE__ */ new Map();
|
|
259
|
-
rates = /* @__PURE__ */ new WeakMap();
|
|
260
|
-
channelRates = /* @__PURE__ */ new Map();
|
|
261
|
-
directReplies = /* @__PURE__ */ new Map();
|
|
262
|
-
mayPost(t, n) {
|
|
263
|
-
let r = this.sources.get(n)?.permissions;
|
|
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";
|
|
265
|
-
}
|
|
266
|
-
registerFrame(e, t) {
|
|
267
|
-
let n = typeof HTMLIFrameElement > "u" ? void 0 : HTMLIFrameElement, r = n && e instanceof n ? e.contentWindow : e;
|
|
268
|
-
if (!r || new URL(t.origin).origin !== t.origin || t.origin === "null") throw Error("A frame registration requires a window and an exact origin.");
|
|
269
|
-
let i = {
|
|
270
|
-
...t,
|
|
271
|
-
permissions: [...t.permissions ?? ["records"]]
|
|
272
|
-
};
|
|
273
|
-
return this.sources.set(r, i), this.ensureChildrenLink(), () => {
|
|
274
|
-
this.sources.get(r) === i && this.sources.delete(r);
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
isRegistered(e, t) {
|
|
278
|
-
if (!e) return !1;
|
|
279
|
-
let n = this.sources.get(e);
|
|
280
|
-
return n ? n.origin === t : this.config.bus.sourcePolicy !== "registered" && t !== "null" && (t === location.origin || this.config.bus.trustedOrigins.includes(t));
|
|
281
|
-
}
|
|
282
|
-
rotateContext() {
|
|
283
|
-
this.passContext(this.role === "sender");
|
|
284
|
-
}
|
|
285
|
-
passContext(t) {
|
|
286
|
-
let n = {
|
|
287
|
-
t: e.securityContext,
|
|
288
|
-
from: this.contextId,
|
|
289
|
-
id: this.config.securityContext.id
|
|
290
|
-
};
|
|
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));
|
|
308
|
-
}
|
|
309
|
-
role = "sender";
|
|
310
|
-
upstream = null;
|
|
311
|
-
links = [];
|
|
312
|
-
openFinLink = null;
|
|
313
|
-
isOpenFinProvider = !1;
|
|
314
|
-
rulesPoll;
|
|
315
|
-
destroyed = !1;
|
|
316
|
-
ownerId = null;
|
|
317
|
-
ownerPeer;
|
|
318
|
-
awaitingWelcome = null;
|
|
319
|
-
constructor(e, t, n, r, i, a, o = A) {
|
|
320
|
-
this.config = e, this.diagnostics = t, this.platform = n, this.contextId = r, this.tabId = i, this.handlers = a, this.handshakeOptions = o;
|
|
321
|
-
}
|
|
322
|
-
getRole() {
|
|
323
|
-
return this.role;
|
|
324
|
-
}
|
|
325
|
-
async start() {
|
|
326
|
-
let { bus: e } = this.config;
|
|
327
|
-
if (e.mode === "off") return this.role = "sender", this.role;
|
|
328
|
-
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;
|
|
329
|
-
this.openControlLinks();
|
|
330
|
-
let t = C(this.receive, this.diagnostics);
|
|
331
|
-
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.", {
|
|
332
|
-
role: "forwarder",
|
|
333
|
-
via: "direct"
|
|
334
|
-
}), this.announce(), this.role;
|
|
335
|
-
let n = this.candidateUpstream();
|
|
336
|
-
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;
|
|
337
|
-
let r = this.orphanPolicy() === "retry" ? this.handshakeOptions.maxAttempts : 1, i = !1;
|
|
338
|
-
for (let e = 0; e < r && !i; e++) i = await this.handshake(n);
|
|
339
|
-
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.`, {
|
|
340
|
-
via: n.kind,
|
|
341
|
-
crossOrigin: this.isCrossOriginFrame()
|
|
342
|
-
})), this.diagnostics.report("bus.role_resolved", `The bus role is ${this.role}.`, {
|
|
343
|
-
role: this.role,
|
|
344
|
-
via: i ? n.kind : "none"
|
|
345
|
-
}), this.announce(), this.role;
|
|
346
|
-
}
|
|
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,
|
|
350
|
-
from: this.contextId,
|
|
351
|
-
records: t,
|
|
352
|
-
routingContextId: this.config.securityContext.id || void 0
|
|
353
|
-
}), s = a(o([])), c = [], l = s;
|
|
354
|
-
for (let e of t) {
|
|
355
|
-
let t = a(e);
|
|
356
|
-
if (r && s + t > r) {
|
|
357
|
-
this.diagnostics.count("bus.rejected_message");
|
|
358
|
-
continue;
|
|
359
|
-
}
|
|
360
|
-
let i = +(c.length > 0);
|
|
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);
|
|
362
|
-
}
|
|
363
|
-
c.length > 0 && this.upstream?.post(o(c));
|
|
364
|
-
}
|
|
365
|
-
acceptDirect(t, n, r) {
|
|
366
|
-
let i = {
|
|
367
|
-
link: "direct",
|
|
368
|
-
origin: "same-origin",
|
|
369
|
-
peer: r
|
|
370
|
-
}, a = {
|
|
371
|
-
...i,
|
|
372
|
-
reply: (e) => {
|
|
373
|
-
n(e, i);
|
|
374
|
-
}
|
|
375
|
-
};
|
|
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,
|
|
378
|
-
from: this.contextId,
|
|
379
|
-
id: this.config.securityContext.id
|
|
380
|
-
}, i), this.routeMessage(t, a)));
|
|
381
|
-
}
|
|
382
|
-
attachWorker(e, t = {}) {
|
|
383
|
-
let n = {
|
|
384
|
-
...t,
|
|
385
|
-
permissions: [...t.permissions ?? ["records"]]
|
|
386
|
-
};
|
|
387
|
-
this.sources.set(e, n);
|
|
388
|
-
let r = k(e, this.receive, this.diagnostics), i = {
|
|
389
|
-
...r,
|
|
390
|
-
post: (t) => {
|
|
391
|
-
this.mayPost(t, e) && r.post(t);
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
return this.links.push(i), () => {
|
|
395
|
-
i.close();
|
|
396
|
-
let t = this.links.indexOf(i);
|
|
397
|
-
t >= 0 && this.links.splice(t, 1), this.sources.get(e) === n && this.sources.delete(e);
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
broadcastJourney(t) {
|
|
401
|
-
this.postJourney({
|
|
402
|
-
t: e.journey,
|
|
403
|
-
from: this.contextId,
|
|
404
|
-
journey: t
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
destroy() {
|
|
408
|
-
this.sources.clear(), this.directReplies.clear(), this.destroyed = !0, clearInterval(this.rulesPoll), this.rulesPoll = void 0;
|
|
409
|
-
for (let e of this.allLinks()) e.close();
|
|
410
|
-
this.links.length = 0, this.upstream = null, this.ownerId = null, this.openFinLink = null;
|
|
411
|
-
}
|
|
412
|
-
allLinks() {
|
|
413
|
-
return !this.upstream || this.links.includes(this.upstream) ? this.links : [...this.links, this.upstream];
|
|
414
|
-
}
|
|
415
|
-
postOver(e, t) {
|
|
416
|
-
for (let n of this.allLinks()) n.kind === e && n.post(t);
|
|
417
|
-
}
|
|
418
|
-
postJourney(e) {
|
|
419
|
-
for (let t of this.allLinks()) this.journeyLink(t.kind) && t.post(e);
|
|
420
|
-
}
|
|
421
|
-
receive = (e, t) => {
|
|
422
|
-
let n = t.link === "children" || t.link === "worker";
|
|
423
|
-
this.acceptsMessage(e, t, n) && this.routeMessage(e, t);
|
|
424
|
-
};
|
|
425
|
-
acceptsMessage(e, t, n) {
|
|
426
|
-
if (this.destroyed) return !1;
|
|
427
|
-
let r;
|
|
428
|
-
try {
|
|
429
|
-
r = this.passesChecks(e, t, n);
|
|
430
|
-
} catch {
|
|
431
|
-
r = !1;
|
|
432
|
-
}
|
|
433
|
-
return r || this.diagnostics.count("bus.rejected_message"), r;
|
|
434
|
-
}
|
|
435
|
-
passesChecks(t, n, r) {
|
|
436
|
-
let { bus: i } = this.config, a = typeof n.peer == "object" ? this.sources.get(n.peer) : void 0;
|
|
437
|
-
if (r && i.sourcePolicy === "registered" && !a) return !1;
|
|
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)) ?? {
|
|
439
|
-
start: c,
|
|
440
|
-
count: 0
|
|
441
|
-
};
|
|
442
|
-
if (o) this.rates.set(o, l);
|
|
443
|
-
else {
|
|
444
|
-
for (let [e, t] of this.channelRates) p(t, 1e3, c) && this.channelRates.delete(e);
|
|
445
|
-
if (i.maxTrackedSources && this.channelRates.size >= i.maxTrackedSources && !this.channelRates.has(s)) return !1;
|
|
446
|
-
this.channelRates.set(s, l);
|
|
447
|
-
}
|
|
448
|
-
if (!m(l, i.maxMessagesPerSecond || Infinity, 1e3)) return !1;
|
|
449
|
-
let u = JSON.stringify(t, (e, t) => {
|
|
450
|
-
if (i.validation === "strict" && typeof t == "number" && !Number.isFinite(t)) throw Error("Non-finite value");
|
|
451
|
-
return t;
|
|
452
|
-
});
|
|
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;
|
|
454
|
-
if (a) {
|
|
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;
|
|
456
|
-
if (n && !a.permissions?.includes(n)) return !1;
|
|
457
|
-
}
|
|
458
|
-
return r && (t.t === e.sampling || t.t === e.securityContext) ? !1 : i.sourcePolicy !== "registered" || n.link !== "broadcast" || t.t !== e.records;
|
|
459
|
-
}
|
|
460
|
-
routeMessage(t, n) {
|
|
461
|
-
if (t.from !== this.contextId) switch (t.t) {
|
|
462
|
-
case e.hello:
|
|
463
|
-
this.canOwn(n.link) && this.answer(n, {
|
|
464
|
-
t: e.welcome,
|
|
465
|
-
from: this.contextId,
|
|
466
|
-
to: t.from,
|
|
467
|
-
tabId: this.tabId,
|
|
468
|
-
routingContextId: this.awaitingWelcome ? void 0 : this.config.securityContext.id || void 0
|
|
469
|
-
});
|
|
470
|
-
break;
|
|
471
|
-
case e.welcome:
|
|
472
|
-
if (t.to !== this.contextId) break;
|
|
473
|
-
if (this.awaitingWelcome?.link === n.link || this.upstream?.kind === n.link && this.ownerId === null) {
|
|
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);
|
|
478
|
-
}
|
|
479
|
-
break;
|
|
480
|
-
case e.records:
|
|
481
|
-
if (this.config.securityContext.isolation && this.config.securityContext.id && t.routingContextId !== this.config.securityContext.id) {
|
|
482
|
-
this.diagnostics.count("security.context_mismatch");
|
|
483
|
-
break;
|
|
484
|
-
}
|
|
485
|
-
this.role === "sender" ? this.handlers.onRecords(t.records) : this.upstream && this.canRelay(n.link) && this.upstream.post(t);
|
|
486
|
-
break;
|
|
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();
|
|
489
|
-
break;
|
|
490
|
-
case e.journey:
|
|
491
|
-
this.acceptsJourney(t, n) && this.applyJourney(t.journey);
|
|
492
|
-
break;
|
|
493
|
-
case e.journeyRequest: {
|
|
494
|
-
let r = this.handlers.onJourneyRequest();
|
|
495
|
-
r && this.journeyLink(n.link) && this.answer(n, {
|
|
496
|
-
t: e.journey,
|
|
497
|
-
from: this.contextId,
|
|
498
|
-
to: t.from,
|
|
499
|
-
journey: r
|
|
500
|
-
});
|
|
501
|
-
break;
|
|
502
|
-
}
|
|
503
|
-
case e.samplingRequest:
|
|
504
|
-
(this.role === "forwarder" ? n.link !== this.upstream?.kind : this.canOwn(n.link)) && this.answer(n, this.rulesAnswer(t.from));
|
|
505
|
-
break;
|
|
506
|
-
case e.sampling:
|
|
507
|
-
this.acceptsRules(t.to, n) && this.applyRules(t.rules);
|
|
508
|
-
break;
|
|
509
|
-
case e.tab: n.link === "broadcast" && t.tabId === this.tabId && this.contextId > t.from && this.handlers.onTabConflict();
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
answer(e, t) {
|
|
513
|
-
e.reply ? e.reply(t) : this.postOver(e.link, t);
|
|
514
|
-
}
|
|
515
|
-
canRelay(e) {
|
|
516
|
-
return e === "direct" || e !== this.upstream?.kind;
|
|
517
|
-
}
|
|
518
|
-
canOwn(e) {
|
|
519
|
-
return this.role !== "sender" && this.ownerId === null ? !1 : e === "openfin" ? this.role === "sender" && this.isOpenFinProvider : j.includes(e);
|
|
520
|
-
}
|
|
521
|
-
resolveOpenFinProvider() {
|
|
522
|
-
let e = this.config.bus.openFinRole;
|
|
523
|
-
if (e !== "auto") return e === "provider";
|
|
524
|
-
if (this.platform.platform !== "openfin" && this.platform.platform !== "openfin_web") return !1;
|
|
525
|
-
let t = f()?.me;
|
|
526
|
-
return !t?.identity || t.isView ? !1 : !!(t.identity.name && t.identity.name === t.identity.uuid);
|
|
527
|
-
}
|
|
528
|
-
orphanPolicy() {
|
|
529
|
-
return this.isCrossOriginFrame() ? "retry" : "promote";
|
|
530
|
-
}
|
|
531
|
-
isCrossOriginFrame() {
|
|
532
|
-
if (typeof window > "u" || window.parent === window) return !1;
|
|
533
|
-
try {
|
|
534
|
-
return Reflect.get(window.parent, "location"), !1;
|
|
535
|
-
} catch {
|
|
536
|
-
return !0;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
candidateUpstream() {
|
|
540
|
-
return this.platform.isWorker ? O(this.receive, this.diagnostics) : this.platform.isTopLevelDocument ? this.platform.platform === "openfin" && !this.isOpenFinProvider ? this.ensureOpenFinLink() : null : w(this.receive, this.config.bus.trustedOrigins, this.diagnostics);
|
|
541
|
-
}
|
|
542
|
-
openControlLinks() {
|
|
543
|
-
let e = (e) => {
|
|
544
|
-
e && this.links.push(e);
|
|
545
|
-
};
|
|
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());
|
|
547
|
-
}
|
|
548
|
-
ensureChildrenLink() {
|
|
549
|
-
if (this.links.some((e) => e.kind === "children")) return;
|
|
550
|
-
let e = T(this.receive, this.config.bus.trustedOrigins, this.diagnostics, (e, t) => {
|
|
551
|
-
let n = this.isRegistered(e, t);
|
|
552
|
-
if (!n) {
|
|
553
|
-
this.diagnostics.count("bus.rejected_message");
|
|
554
|
-
let n = e !== null && this.sources.has(e), r = t === location.origin || this.config.bus.trustedOrigins.includes(t);
|
|
555
|
-
(n || !r) && this.diagnostics.report("bus.untrusted_origin", "The bus rejected a message from an untrusted origin.");
|
|
556
|
-
}
|
|
557
|
-
return n;
|
|
558
|
-
}, (e, t) => this.mayPost(e, t));
|
|
559
|
-
e && this.links.push(e);
|
|
560
|
-
}
|
|
561
|
-
ensureOpenFinLink() {
|
|
562
|
-
return this.openFinLink ??= D(t, this.platform.openfinUuid, this.receive, this.diagnostics), this.openFinLink;
|
|
563
|
-
}
|
|
564
|
-
handshake(t) {
|
|
565
|
-
return new Promise((n) => {
|
|
566
|
-
let r = !1, i = (e) => {
|
|
567
|
-
r || (r = !0, this.awaitingWelcome = null, clearTimeout(a), n(e));
|
|
568
|
-
};
|
|
569
|
-
this.awaitingWelcome = {
|
|
570
|
-
link: t.kind,
|
|
571
|
-
settle: i
|
|
572
|
-
};
|
|
573
|
-
let a = setTimeout(() => {
|
|
574
|
-
i(!1);
|
|
575
|
-
}, this.handshakeOptions.timeoutMs);
|
|
576
|
-
h(a), t.post({
|
|
577
|
-
t: e.hello,
|
|
578
|
-
from: this.contextId,
|
|
579
|
-
tabId: this.tabId
|
|
580
|
-
});
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
announce() {
|
|
584
|
-
this.postOver("broadcast", {
|
|
585
|
-
t: e.tab,
|
|
586
|
-
from: this.contextId,
|
|
587
|
-
tabId: this.tabId
|
|
588
|
-
}), this.upstream && this.ownerId === null && this.upstream.post({
|
|
589
|
-
t: e.hello,
|
|
590
|
-
from: this.contextId,
|
|
591
|
-
tabId: this.tabId
|
|
592
|
-
}), this.postJourney({
|
|
593
|
-
t: e.journeyRequest,
|
|
594
|
-
from: this.contextId
|
|
595
|
-
}), this.pollRules(), this.passContext(!1);
|
|
596
|
-
}
|
|
597
|
-
journeyScope() {
|
|
598
|
-
let { scope: e } = this.config.journey;
|
|
599
|
-
if (e !== "auto") return e;
|
|
600
|
-
let { platform: t } = this.platform;
|
|
601
|
-
return t === "openfin" || t === "openfin_web" ? "origin" : "tab";
|
|
602
|
-
}
|
|
603
|
-
journeyLink(e) {
|
|
604
|
-
let t = this.journeyScope();
|
|
605
|
-
return t === "context" ? !1 : t === "origin" || e !== "broadcast";
|
|
606
|
-
}
|
|
607
|
-
acceptsJourney(e, t) {
|
|
608
|
-
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);
|
|
609
|
-
}
|
|
610
|
-
fromOwner(e, t) {
|
|
611
|
-
return this.role !== "forwarder" || t !== this.upstream?.kind ? !1 : this.ownerId === null || e === this.ownerId;
|
|
612
|
-
}
|
|
613
|
-
applyJourney(e) {
|
|
614
|
-
if (e === null) {
|
|
615
|
-
this.handlers.onJourney(null);
|
|
616
|
-
return;
|
|
617
|
-
}
|
|
618
|
-
let t = s(e);
|
|
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);
|
|
620
|
-
}
|
|
621
|
-
rulesAnswer(t) {
|
|
622
|
-
let n = this.handlers.remote.sampling?.wire() ?? null;
|
|
623
|
-
return {
|
|
624
|
-
t: e.sampling,
|
|
625
|
-
from: this.contextId,
|
|
626
|
-
to: t,
|
|
627
|
-
rules: n
|
|
628
|
-
};
|
|
629
|
-
}
|
|
630
|
-
acceptsRules(e, t) {
|
|
631
|
-
if (this.role !== "forwarder" || e !== this.contextId || t.link !== this.upstream?.kind) return !1;
|
|
632
|
-
let { origin: n } = t;
|
|
633
|
-
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.`, {
|
|
634
|
-
origin: n,
|
|
635
|
-
type: "sampling"
|
|
636
|
-
}), !1) : this.ownerPeer === void 0 || this.ownerPeer === t.peer;
|
|
637
|
-
}
|
|
638
|
-
applyRules(e) {
|
|
639
|
-
if (e === null) {
|
|
640
|
-
l(this.handlers.remote, this.config, null);
|
|
641
|
-
return;
|
|
642
|
-
}
|
|
643
|
-
let t = c(e, this.diagnostics);
|
|
644
|
-
t && l(this.handlers.remote, this.config, t);
|
|
645
|
-
}
|
|
646
|
-
pollRules() {
|
|
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,
|
|
652
|
-
from: this.contextId
|
|
653
|
-
});
|
|
654
|
-
};
|
|
655
|
-
r(), this.rulesPoll = setInterval(r, n), h(this.rulesPoll);
|
|
656
|
-
}
|
|
657
|
-
};
|
|
658
|
-
export { M as Bus };
|
|
659
|
-
|
|
660
|
-
//# sourceMappingURL=bus-BZ0GldpT.js.map
|