@utk09/ui-observability 0.12.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +280 -10
- package/README.md +70 -839
- package/dist/{batch-BjQUwjA6.js → batch-D3NHhF9L.js} +4 -4
- package/dist/{batch-BjQUwjA6.js.map → batch-D3NHhF9L.js.map} +1 -1
- package/dist/{batch-D5LlU4Q9.cjs → batch-DnYRJqhU.cjs} +2 -2
- package/dist/{batch-D5LlU4Q9.cjs.map → batch-DnYRJqhU.cjs.map} +1 -1
- package/dist/bus/bus.d.cts +355 -0
- package/dist/bus/bus.d.ts +86 -12
- package/dist/bus/links.d.cts +132 -0
- package/dist/bus/links.d.ts +18 -3
- package/dist/bus/validation.d.cts +16 -0
- package/dist/bus/validation.d.ts +10 -1
- package/dist/bus-B__467mL.cjs +2 -0
- package/dist/bus-B__467mL.cjs.map +1 -0
- package/dist/bus-dw7T92sO.js +788 -0
- package/dist/bus-dw7T92sO.js.map +1 -0
- package/dist/capture/console.d.cts +37 -0
- package/dist/capture/console.d.ts +1 -1
- package/dist/capture/errors.d.cts +32 -0
- package/dist/capture/errors.d.ts +1 -1
- package/dist/capture/interactions.d.cts +80 -0
- package/dist/capture/interactions.d.ts +36 -4
- package/dist/capture/lifecycle.d.cts +20 -0
- package/dist/capture/lifecycle.d.ts +1 -1
- package/dist/capture/long-frames.d.cts +31 -0
- package/dist/capture/long-frames.d.ts +1 -1
- package/dist/capture/network.d.cts +57 -0
- package/dist/capture/network.d.ts +1 -1
- package/dist/capture/observed-windows.d.cts +51 -0
- package/dist/capture/observed-windows.d.ts +51 -0
- package/dist/capture/profiler-frames.d.cts +44 -0
- package/dist/capture/profiler-frames.d.ts +1 -1
- package/dist/capture/replay-buffer.d.cts +45 -0
- package/dist/capture/replay-buffer.d.ts +9 -10
- package/dist/capture/replay-upload.d.cts +79 -0
- package/dist/capture/replay-upload.d.ts +7 -2
- package/dist/capture/replay.d.cts +114 -0
- package/dist/capture/replay.d.ts +1 -1
- package/dist/capture/reports.d.cts +17 -0
- package/dist/capture/reports.d.ts +1 -1
- package/dist/capture/resource-timing.d.cts +14 -0
- package/dist/capture/resource-timing.d.ts +1 -1
- package/dist/capture/server-timing.d.cts +19 -0
- package/dist/capture/storm.d.cts +13 -0
- package/dist/capture/storm.d.ts +5 -5
- package/dist/capture/types.d.cts +128 -0
- package/dist/capture/types.d.ts +10 -9
- package/dist/capture/unclean-exit.d.cts +31 -0
- package/dist/capture/unclean-exit.d.ts +1 -1
- package/dist/capture/user-timing.d.cts +22 -0
- package/dist/capture/user-timing.d.ts +2 -2
- package/dist/capture/web-socket.d.cts +40 -0
- package/dist/capture/web-socket.d.ts +3 -3
- package/dist/capture/web-vitals.d.cts +40 -0
- package/dist/capture/web-vitals.d.ts +1 -1
- package/dist/{compression-lD9abCcO.cjs → compression-C0hUHKR-.cjs} +2 -2
- package/dist/{compression-lD9abCcO.cjs.map → compression-C0hUHKR-.cjs.map} +1 -1
- package/dist/{compression-AJJCMBOa.js → compression-SHPAvS4U.js} +2 -2
- package/dist/{compression-AJJCMBOa.js.map → compression-SHPAvS4U.js.map} +1 -1
- package/dist/config-CSNcS7OZ.js +558 -0
- package/dist/config-CSNcS7OZ.js.map +1 -0
- package/dist/config-CybPP5VM.cjs +2 -0
- package/dist/config-CybPP5VM.cjs.map +1 -0
- package/dist/console-BsM-fSCQ.js +81 -0
- package/dist/console-BsM-fSCQ.js.map +1 -0
- package/dist/console-Dkxs6IVQ.cjs +2 -0
- package/dist/console-Dkxs6IVQ.cjs.map +1 -0
- package/dist/constants-BwJDXzj6.js +357 -0
- package/dist/constants-BwJDXzj6.js.map +1 -0
- package/dist/constants-CtF52hIV.cjs +2 -0
- package/dist/constants-CtF52hIV.cjs.map +1 -0
- package/dist/constants.d.cts +763 -0
- package/dist/constants.d.ts +100 -20
- package/dist/core/breadcrumbs.d.cts +54 -0
- package/dist/core/breadcrumbs.d.ts +5 -0
- package/dist/core/config.d.cts +45 -0
- package/dist/core/config.d.ts +30 -2
- package/dist/core/context.d.cts +24 -0
- package/dist/core/context.d.ts +3 -8
- package/dist/core/debug-buffer.d.cts +34 -0
- package/dist/core/debug-buffer.d.ts +3 -3
- package/dist/core/debug-bundle.d.cts +12 -0
- package/dist/core/debug-bundle.d.ts +3 -3
- package/dist/core/deferred.d.cts +7 -0
- package/dist/core/deferred.d.ts +2 -2
- package/dist/core/diagnostics.d.cts +86 -0
- package/dist/core/diagnostics.d.ts +1 -1
- package/dist/core/drops.d.cts +39 -0
- package/dist/core/drops.d.ts +16 -6
- 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 +7 -7
- package/dist/core/logger.d.cts +141 -0
- package/dist/core/logger.d.ts +23 -30
- package/dist/core/measure.d.cts +30 -0
- package/dist/core/measure.d.ts +14 -3
- package/dist/core/meter.d.cts +78 -0
- package/dist/core/meter.d.ts +14 -8
- package/dist/core/pipeline.d.cts +227 -0
- package/dist/core/pipeline.d.ts +73 -10
- package/dist/core/profile-buckets.d.cts +31 -0
- package/dist/core/profiler.d.cts +218 -0
- package/dist/core/profiler.d.ts +2 -2
- package/dist/core/record.d.cts +190 -0
- package/dist/core/record.d.ts +44 -12
- package/dist/core/remote-rules.d.cts +17 -0
- package/dist/core/remote-rules.d.ts +3 -3
- package/dist/core/remote-sampling.d.cts +74 -0
- package/dist/core/remote-sampling.d.ts +3 -3
- package/dist/core/rotation.d.cts +99 -0
- package/dist/core/rotation.d.ts +99 -0
- package/dist/core/runtime.d.cts +774 -0
- package/dist/core/runtime.d.ts +254 -70
- package/dist/core/sampling.d.cts +86 -0
- package/dist/core/sampling.d.ts +5 -5
- package/dist/core/sender.d.cts +161 -0
- package/dist/core/sender.d.ts +59 -15
- package/dist/core/spans.d.cts +39 -0
- package/dist/core/spans.d.ts +1 -1
- package/dist/debug-bundle-B2v6Cym-.cjs +2 -0
- package/dist/debug-bundle-B2v6Cym-.cjs.map +1 -0
- package/dist/debug-bundle-Cs_YWzTa.js +35 -0
- package/dist/debug-bundle-Cs_YWzTa.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 +5 -2
- package/dist/doctor.js +119 -87
- package/dist/doctor.js.map +1 -1
- package/dist/errors-DP2RUm4V.cjs +3 -0
- package/dist/errors-DP2RUm4V.cjs.map +1 -0
- package/dist/errors-Q3Ng1ciC.js +86 -0
- package/dist/errors-Q3Ng1ciC.js.map +1 -0
- package/dist/factory-DV17sm2p.js +404 -0
- package/dist/factory-DV17sm2p.js.map +1 -0
- package/dist/factory-K8O6gpux.cjs +2 -0
- package/dist/factory-K8O6gpux.cjs.map +1 -0
- 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-BrQp_5J5.js → identity-BgtHyY4u.js} +33 -26
- package/dist/identity-BgtHyY4u.js.map +1 -0
- package/dist/identity-CvuyqZk7.cjs +2 -0
- package/dist/identity-CvuyqZk7.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +301 -0
- package/dist/index.d.ts +90 -98
- package/dist/index.js +1253 -1555
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-D4KVcqdD.cjs +2 -0
- package/dist/indexeddb-storage-D4KVcqdD.cjs.map +1 -0
- package/dist/{indexeddb-storage-DLXQzAGh.js → indexeddb-storage-e-13ZLWm.js} +61 -57
- package/dist/indexeddb-storage-e-13ZLWm.js.map +1 -0
- package/dist/interactions-Byxf1C82.js +207 -0
- package/dist/interactions-Byxf1C82.js.map +1 -0
- package/dist/interactions-OK85T-Dk.cjs +2 -0
- package/dist/interactions-OK85T-Dk.cjs.map +1 -0
- package/dist/{journey-35yCMNFo.js → journey-C93FTYcs.js} +46 -49
- package/dist/journey-C93FTYcs.js.map +1 -0
- package/dist/journey-nMbob3OB.cjs +2 -0
- package/dist/journey-nMbob3OB.cjs.map +1 -0
- package/dist/{library-console-BFWEuQsl.cjs → library-console-DJUQzcgM.cjs} +2 -2
- package/dist/{library-console-BFWEuQsl.cjs.map → library-console-DJUQzcgM.cjs.map} +1 -1
- package/dist/{library-console-Dl_Ly6DQ.js → library-console-DklSmucS.js} +2 -2
- package/dist/{library-console-Dl_Ly6DQ.js.map → library-console-DklSmucS.js.map} +1 -1
- package/dist/{library-request-nI6pvI6I.js → library-request-UGEwOHpf.js} +2 -2
- package/dist/{library-request-nI6pvI6I.js.map → library-request-UGEwOHpf.js.map} +1 -1
- package/dist/{library-request-Da-CHKzT.cjs → library-request-kY9iTpIF.cjs} +2 -2
- package/dist/{library-request-Da-CHKzT.cjs.map → library-request-kY9iTpIF.cjs.map} +1 -1
- package/dist/{lifecycle-CZ6RRXc6.js → lifecycle-B2PlIuQu.js} +21 -29
- package/dist/lifecycle-B2PlIuQu.js.map +1 -0
- package/dist/lifecycle-DaMdH_X7.cjs +2 -0
- package/dist/lifecycle-DaMdH_X7.cjs.map +1 -0
- package/dist/log-record-Bmx6etMh.cjs +2 -0
- package/dist/log-record-Bmx6etMh.cjs.map +1 -0
- package/dist/{log-record-DIA6McNr.js → log-record-DSt2P-Sr.js} +8 -7
- package/dist/log-record-DSt2P-Sr.js.map +1 -0
- package/dist/{long-frames-430_85Da.js → long-frames-Bamjs1WV.js} +18 -22
- package/dist/long-frames-Bamjs1WV.js.map +1 -0
- package/dist/long-frames-lhtONgGt.cjs +2 -0
- package/dist/long-frames-lhtONgGt.cjs.map +1 -0
- package/dist/models/batch.d.cts +57 -0
- package/dist/models/batch.d.ts +2 -2
- package/dist/models/bus.d.cts +163 -0
- package/dist/models/bus.d.ts +28 -3
- package/dist/models/config.d.cts +1555 -0
- package/dist/models/config.d.ts +377 -261
- package/dist/models/drop.d.cts +54 -0
- package/dist/models/drop.d.ts +16 -3
- package/dist/models/health.d.cts +148 -0
- package/dist/models/health.d.ts +108 -12
- package/dist/models/log-record.d.cts +61 -0
- package/dist/models/metric.d.cts +139 -0
- package/dist/models/metric.d.ts +13 -2
- package/dist/models/plugin.d.cts +47 -0
- package/dist/models/plugin.d.ts +3 -3
- package/dist/models/replay.d.cts +60 -0
- package/dist/models/serializer.d.cts +25 -0
- package/dist/models/serializer.d.ts +4 -2
- package/dist/models/storage.d.cts +95 -0
- package/dist/models/storage.d.ts +7 -5
- package/dist/network-BCn8Gn47.cjs +2 -0
- package/dist/network-BCn8Gn47.cjs.map +1 -0
- package/dist/{network-C7SkLf4v.js → network-Cg1L2w2r.js} +57 -57
- package/dist/network-Cg1L2w2r.js.map +1 -0
- package/dist/observed-windows-B3gJkdql.cjs +2 -0
- package/dist/observed-windows-B3gJkdql.cjs.map +1 -0
- package/dist/observed-windows-BrwaJNlj.js +64 -0
- package/dist/observed-windows-BrwaJNlj.js.map +1 -0
- package/dist/{otlp-2MCrC3kd.cjs → otlp-CrAWkQdO.cjs} +2 -2
- package/dist/{otlp-2MCrC3kd.cjs.map → otlp-CrAWkQdO.cjs.map} +1 -1
- package/dist/{otlp-COq033e3.js → otlp-D6dRZyB8.js} +9 -9
- package/dist/{otlp-COq033e3.js.map → otlp-D6dRZyB8.js.map} +1 -1
- package/dist/{platform-CVewe4wQ.js → platform-8DLhjddo.js} +9 -9
- package/dist/{platform-CVewe4wQ.js.map → platform-8DLhjddo.js.map} +1 -1
- package/dist/{platform-12uR7kBQ.cjs → platform-BqRc-7RO.cjs} +2 -2
- package/dist/{platform-12uR7kBQ.cjs.map → platform-BqRc-7RO.cjs.map} +1 -1
- package/dist/{profiler-BVWIOgnq.js → profiler-BaXSqCfz.js} +78 -96
- package/dist/profiler-BaXSqCfz.js.map +1 -0
- package/dist/profiler-BvWW2kNM.cjs +2 -0
- package/dist/profiler-BvWW2kNM.cjs.map +1 -0
- package/dist/{profiler-frames-CLXlT_xL.js → profiler-frames-C4ySHN0X.js} +21 -29
- package/dist/profiler-frames-C4ySHN0X.js.map +1 -0
- package/dist/profiler-frames-DeaBiB-5.cjs +2 -0
- package/dist/profiler-frames-DeaBiB-5.cjs.map +1 -0
- package/dist/remote-rules-D7L6D_D2.cjs +2 -0
- package/dist/remote-rules-D7L6D_D2.cjs.map +1 -0
- package/dist/remote-rules-Dq9xe7Qn.js +95 -0
- package/dist/remote-rules-Dq9xe7Qn.js.map +1 -0
- package/dist/replay-B0M8kWz_.js +310 -0
- package/dist/replay-B0M8kWz_.js.map +1 -0
- package/dist/replay-QOFBpAXh.cjs +2 -0
- package/dist/replay-QOFBpAXh.cjs.map +1 -0
- package/dist/{reports-BuXekPOS.js → reports--8APRLa-.js} +25 -30
- package/dist/reports--8APRLa-.js.map +1 -0
- package/dist/reports-ojuMKGO7.cjs +2 -0
- package/dist/reports-ojuMKGO7.cjs.map +1 -0
- package/dist/{resource-timing-CXGHwFRD.js → resource-timing-BzR05rE-.js} +20 -23
- package/dist/resource-timing-BzR05rE-.js.map +1 -0
- package/dist/resource-timing-pAG3ZhB5.cjs +2 -0
- package/dist/resource-timing-pAG3ZhB5.cjs.map +1 -0
- package/dist/response-body-BWvwKQ2p.js +331 -0
- package/dist/response-body-BWvwKQ2p.js.map +1 -0
- package/dist/response-body-CKEJ5itk.cjs +3 -0
- package/dist/response-body-CKEJ5itk.cjs.map +1 -0
- package/dist/rotation-BylN1B9e.js +93 -0
- package/dist/rotation-BylN1B9e.js.map +1 -0
- package/dist/rotation-E2eKClIs.cjs +2 -0
- package/dist/rotation-E2eKClIs.cjs.map +1 -0
- package/dist/sampling-B46LW0cy.cjs +2 -0
- package/dist/sampling-B46LW0cy.cjs.map +1 -0
- package/dist/sampling-zXA6r-Nw.js +63 -0
- package/dist/sampling-zXA6r-Nw.js.map +1 -0
- package/dist/{sanitize-CNmsD9r3.js → sanitize-DjnR6RXR.js} +2 -2
- package/dist/sanitize-DjnR6RXR.js.map +1 -0
- package/dist/{sanitize-ChLn97Ch.cjs → sanitize-Qj6LuZqp.cjs} +2 -2
- package/dist/sanitize-Qj6LuZqp.cjs.map +1 -0
- package/dist/sender-Bdp-TAS4.js +979 -0
- package/dist/sender-Bdp-TAS4.js.map +1 -0
- package/dist/sender-DR7ZycZY.cjs +2 -0
- package/dist/sender-DR7ZycZY.cjs.map +1 -0
- package/dist/storage/context-storage.d.cts +90 -0
- package/dist/storage/context-storage.d.ts +5 -5
- package/dist/storage/emergency-queue.d.cts +27 -0
- package/dist/storage/emergency-queue.d.ts +4 -4
- package/dist/storage/eviction.d.cts +40 -0
- package/dist/storage/eviction.d.ts +1 -1
- package/dist/storage/factory.d.cts +21 -0
- package/dist/storage/factory.d.ts +3 -3
- package/dist/storage/gap.d.cts +20 -0
- package/dist/storage/gap.d.ts +3 -3
- package/dist/storage/idb-driver.d.cts +93 -0
- package/dist/storage/idb-driver.d.ts +1 -1
- package/dist/storage/indexeddb-storage.d.cts +97 -0
- package/dist/storage/indexeddb-storage.d.ts +12 -4
- package/dist/storage/keys.d.cts +17 -0
- package/dist/storage/keys.d.ts +2 -2
- package/dist/storage/local-storage.d.cts +139 -0
- package/dist/storage/local-storage.d.ts +11 -4
- package/dist/storage/memory-storage.d.cts +73 -0
- package/dist/storage/memory-storage.d.ts +4 -3
- package/dist/storage/persistence.d.cts +8 -0
- package/dist/storage/persistence.d.ts +2 -2
- package/dist/storage/stored-context.d.cts +34 -0
- package/dist/storage/stored-context.d.ts +34 -0
- package/dist/stored-context-BOu54M8Y.cjs +2 -0
- package/dist/stored-context-BOu54M8Y.cjs.map +1 -0
- package/dist/stored-context-CSttrAsw.js +51 -0
- package/dist/stored-context-CSttrAsw.js.map +1 -0
- package/dist/storm-BHgI12iS.cjs +2 -0
- package/dist/storm-BHgI12iS.cjs.map +1 -0
- package/dist/storm-DKlpv0FL.js +9 -0
- package/dist/storm-DKlpv0FL.js.map +1 -0
- package/dist/transport/compression.d.cts +7 -0
- 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/exit-flush.d.cts +135 -0
- package/dist/transport/exit-flush.d.ts +30 -13
- package/dist/transport/headers.d.cts +8 -0
- package/dist/transport/headers.d.ts +2 -2
- package/dist/transport/http-transport.d.cts +116 -0
- package/dist/transport/http-transport.d.ts +20 -8
- package/dist/transport/memory-transport.d.cts +30 -0
- package/dist/transport/memory-transport.d.ts +2 -2
- 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 +27 -9
- package/dist/transport/serializers/ecs.d.cts +3 -0
- package/dist/transport/serializers/ecs.d.ts +1 -1
- package/dist/transport/serializers/otlp-metrics.d.cts +3 -0
- package/dist/transport/serializers/otlp-metrics.d.ts +1 -1
- package/dist/transport/serializers/otlp-traces.d.cts +3 -0
- package/dist/transport/serializers/otlp-traces.d.ts +1 -1
- package/dist/transport/serializers/otlp.d.cts +47 -0
- package/dist/transport/serializers/otlp.d.ts +2 -2
- package/dist/transport/serializers/select.d.cts +38 -0
- package/dist/transport/serializers/select.d.ts +5 -5
- package/dist/transport/status-transport.d.cts +129 -0
- package/dist/transport/status-transport.d.ts +25 -8
- 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 +4 -2
- 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-BYPYYkQ5.cjs +2 -0
- package/dist/unclean-exit-BYPYYkQ5.cjs.map +1 -0
- package/dist/{unclean-exit-Cob_jyTv.js → unclean-exit-BcOB8A2e.js} +23 -30
- package/dist/unclean-exit-BcOB8A2e.js.map +1 -0
- package/dist/{user-timing-DgHubxCI.js → user-timing-4KIJ74Vi.js} +15 -17
- package/dist/user-timing-4KIJ74Vi.js.map +1 -0
- package/dist/user-timing-BsU2wQKE.cjs +2 -0
- package/dist/user-timing-BsU2wQKE.cjs.map +1 -0
- package/dist/utils/console.d.cts +36 -0
- package/dist/utils/console.d.ts +4 -4
- package/dist/utils/deadline.d.cts +14 -0
- package/dist/utils/error-like.d.cts +25 -0
- package/dist/utils/fixed-window.d.cts +25 -0
- package/dist/utils/global-scope.d.cts +20 -0
- package/dist/utils/guards.d.cts +14 -0
- package/dist/utils/guards.d.ts +8 -0
- package/dist/utils/identity.d.cts +114 -0
- package/dist/utils/identity.d.ts +8 -4
- package/dist/utils/library-console.d.cts +11 -0
- package/dist/utils/library-request.d.cts +24 -0
- package/dist/utils/lock.d.cts +24 -0
- package/dist/utils/lock.d.ts +1 -1
- package/dist/utils/openfin.d.cts +48 -0
- package/dist/utils/patch.d.cts +9 -0
- package/dist/utils/platform.d.cts +62 -0
- package/dist/utils/platform.d.ts +2 -2
- package/dist/utils/sanitize.d.cts +52 -0
- package/dist/utils/sanitize.d.ts +1 -1
- package/dist/utils/sequence.d.cts +10 -0
- package/dist/utils/tracing.d.cts +158 -0
- package/dist/utils/tracing.d.ts +11 -4
- package/dist/utils/unref.d.cts +9 -0
- package/dist/web-socket-Cs1ZbmmN.cjs +2 -0
- package/dist/{web-socket-DthJuSAg.js.map → web-socket-Cs1ZbmmN.cjs.map} +1 -1
- package/dist/{web-socket-DthJuSAg.js → web-socket-Zg0hj1LB.js} +23 -28
- package/dist/web-socket-Zg0hj1LB.js.map +1 -0
- package/dist/{web-vitals-CsGCWnUr.js → web-vitals-4pWACwaR.js} +15 -21
- 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-B0_8rWy5.js → worker-protocol-CYpAbrVl.js} +14 -11
- package/dist/worker-protocol-CYpAbrVl.js.map +1 -0
- package/dist/worker-protocol-DFYXIFus.cjs +2 -0
- package/dist/worker-protocol-DFYXIFus.cjs.map +1 -0
- package/dist/worker-server--yGTadTA.cjs +2 -0
- package/dist/worker-server--yGTadTA.cjs.map +1 -0
- package/dist/worker-server-BokySIII.js +94 -0
- package/dist/worker-server-BokySIII.js.map +1 -0
- package/dist/worker-transport-BdEvh_-a.cjs +2 -0
- package/dist/worker-transport-BdEvh_-a.cjs.map +1 -0
- package/dist/worker-transport-JK-Fby9J.js +194 -0
- package/dist/worker-transport-JK-Fby9J.js.map +1 -0
- package/llms.txt +400 -0
- package/package.json +65 -49
- package/dist/bus-D_7pd7RN.cjs +0 -2
- package/dist/bus-D_7pd7RN.cjs.map +0 -1
- package/dist/bus-ecxUNTja.js +0 -660
- package/dist/bus-ecxUNTja.js.map +0 -1
- package/dist/console-CLz_PvFn.cjs +0 -2
- package/dist/console-CLz_PvFn.cjs.map +0 -1
- package/dist/console-cwgHKXvM.js +0 -82
- package/dist/console-cwgHKXvM.js.map +0 -1
- package/dist/constants-Bwl_YtQi.js +0 -349
- package/dist/constants-Bwl_YtQi.js.map +0 -1
- package/dist/constants-DakMxVB2.cjs +0 -2
- package/dist/constants-DakMxVB2.cjs.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/debug-bundle-BOdYmCeV.js +0 -32
- package/dist/debug-bundle-BOdYmCeV.js.map +0 -1
- package/dist/debug-bundle-Ex4L_LSP.cjs +0 -2
- package/dist/debug-bundle-Ex4L_LSP.cjs.map +0 -1
- package/dist/emergency-queue-B9WZxanZ.js +0 -67
- package/dist/emergency-queue-B9WZxanZ.js.map +0 -1
- package/dist/emergency-queue-HBpL5r3V.cjs +0 -2
- package/dist/emergency-queue-HBpL5r3V.cjs.map +0 -1
- package/dist/errors-D6bwgJtO.js +0 -92
- package/dist/errors-D6bwgJtO.js.map +0 -1
- package/dist/errors-DCOCRdSi.cjs +0 -3
- package/dist/errors-DCOCRdSi.cjs.map +0 -1
- package/dist/factory-DLFDjdLv.cjs +0 -2
- package/dist/factory-DLFDjdLv.cjs.map +0 -1
- package/dist/factory-e9Qo3K0z.js +0 -276
- package/dist/factory-e9Qo3K0z.js.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-BlvlgjrU.cjs +0 -2
- package/dist/identity-BlvlgjrU.cjs.map +0 -1
- package/dist/identity-BrQp_5J5.js.map +0 -1
- package/dist/indexeddb-storage-CtLvZH1r.cjs +0 -2
- package/dist/indexeddb-storage-CtLvZH1r.cjs.map +0 -1
- package/dist/indexeddb-storage-DLXQzAGh.js.map +0 -1
- package/dist/interactions-B6z2I4tU.js +0 -119
- package/dist/interactions-B6z2I4tU.js.map +0 -1
- package/dist/interactions-P6pz08Jn.cjs +0 -2
- package/dist/interactions-P6pz08Jn.cjs.map +0 -1
- package/dist/journey-35yCMNFo.js.map +0 -1
- package/dist/journey-DAGh5h9k.cjs +0 -2
- package/dist/journey-DAGh5h9k.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/lifecycle-BGGOcN4N.cjs +0 -2
- package/dist/lifecycle-BGGOcN4N.cjs.map +0 -1
- package/dist/lifecycle-CZ6RRXc6.js.map +0 -1
- package/dist/log-record-D7bA1RPb.cjs +0 -2
- package/dist/log-record-D7bA1RPb.cjs.map +0 -1
- package/dist/log-record-DIA6McNr.js.map +0 -1
- package/dist/long-frames-430_85Da.js.map +0 -1
- package/dist/long-frames-Dd8tsi2U.cjs +0 -2
- package/dist/long-frames-Dd8tsi2U.cjs.map +0 -1
- package/dist/models/stats.d.ts +0 -11
- package/dist/network-C7SkLf4v.js.map +0 -1
- package/dist/network-pEX3PAJv.cjs +0 -2
- package/dist/network-pEX3PAJv.cjs.map +0 -1
- package/dist/profiler-BVWIOgnq.js.map +0 -1
- package/dist/profiler-eVCknCzS.cjs +0 -2
- package/dist/profiler-eVCknCzS.cjs.map +0 -1
- package/dist/profiler-frames-CLXlT_xL.js.map +0 -1
- package/dist/profiler-frames-Dg2OebB2.cjs +0 -2
- package/dist/profiler-frames-Dg2OebB2.cjs.map +0 -1
- package/dist/remote-rules-BJGDJGwA.js +0 -98
- package/dist/remote-rules-BJGDJGwA.js.map +0 -1
- package/dist/remote-rules-CJD3ToVk.cjs +0 -2
- package/dist/remote-rules-CJD3ToVk.cjs.map +0 -1
- package/dist/replay-0zAJv9T3.js +0 -338
- package/dist/replay-0zAJv9T3.js.map +0 -1
- package/dist/replay-DomJpXqW.cjs +0 -2
- package/dist/replay-DomJpXqW.cjs.map +0 -1
- package/dist/reports-BsbqmP8h.cjs +0 -2
- package/dist/reports-BsbqmP8h.cjs.map +0 -1
- package/dist/reports-BuXekPOS.js.map +0 -1
- package/dist/resource-timing-CXGHwFRD.js.map +0 -1
- package/dist/resource-timing-DkycFGDa.cjs +0 -2
- package/dist/resource-timing-DkycFGDa.cjs.map +0 -1
- package/dist/sampling-Dd0wllyq.cjs +0 -2
- package/dist/sampling-Dd0wllyq.cjs.map +0 -1
- package/dist/sampling-UUDbi3K0.js +0 -60
- package/dist/sampling-UUDbi3K0.js.map +0 -1
- package/dist/sanitize-CNmsD9r3.js.map +0 -1
- package/dist/sanitize-ChLn97Ch.cjs.map +0 -1
- package/dist/select-CTk-K5mG.cjs +0 -3
- package/dist/select-CTk-K5mG.cjs.map +0 -1
- package/dist/select-DPv_j6wq.js +0 -270
- package/dist/select-DPv_j6wq.js.map +0 -1
- package/dist/sender-15zEsZpr.js +0 -857
- package/dist/sender-15zEsZpr.js.map +0 -1
- package/dist/sender-Bfpv9tad.cjs +0 -2
- package/dist/sender-Bfpv9tad.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-BTSNTIWI.js +0 -9
- package/dist/storm-BTSNTIWI.js.map +0 -1
- package/dist/storm-D0_qZOEg.cjs +0 -2
- package/dist/storm-D0_qZOEg.cjs.map +0 -1
- package/dist/unclean-exit-ClGzrc2A.cjs +0 -2
- package/dist/unclean-exit-ClGzrc2A.cjs.map +0 -1
- package/dist/unclean-exit-Cob_jyTv.js.map +0 -1
- package/dist/user-timing-CdYqx3PF.cjs +0 -2
- package/dist/user-timing-CdYqx3PF.cjs.map +0 -1
- package/dist/user-timing-DgHubxCI.js.map +0 -1
- package/dist/utils/timer.d.ts +0 -19
- package/dist/web-socket-BTuvYoJI.cjs +0 -2
- package/dist/web-socket-BTuvYoJI.cjs.map +0 -1
- package/dist/web-vitals-Ch5BpDmo.cjs +0 -2
- package/dist/web-vitals-Ch5BpDmo.cjs.map +0 -1
- package/dist/web-vitals-CsGCWnUr.js.map +0 -1
- package/dist/worker-protocol-B0_8rWy5.js.map +0 -1
- package/dist/worker-protocol-BjzFORfq.cjs +0 -2
- package/dist/worker-protocol-BjzFORfq.cjs.map +0 -1
- package/dist/worker-server-4en-Lt-3.cjs +0 -2
- package/dist/worker-server-4en-Lt-3.cjs.map +0 -1
- package/dist/worker-server-Cne9MX9I.js +0 -83
- package/dist/worker-server-Cne9MX9I.js.map +0 -1
- package/dist/worker-transport-B-GF4Aqn.cjs +0 -2
- package/dist/worker-transport-B-GF4Aqn.cjs.map +0 -1
- package/dist/worker-transport-C3SjJAEC.js +0 -200
- package/dist/worker-transport-C3SjJAEC.js.map +0 -1
|
@@ -0,0 +1,788 @@
|
|
|
1
|
+
import { A as e, Fn as t, M as n, N as r, O as i, Wn as a, at as o, k as s, pn as c } from "./constants-BwJDXzj6.js";
|
|
2
|
+
import { r as l } from "./journey-C93FTYcs.js";
|
|
3
|
+
import { n as u, t as d } from "./remote-rules-Dq9xe7Qn.js";
|
|
4
|
+
import { n as f, t as p } from "./log-record-DSt2P-Sr.js";
|
|
5
|
+
import { n as m } from "./guards-BlYGRK4l.js";
|
|
6
|
+
import { i as h } from "./identity-BgtHyY4u.js";
|
|
7
|
+
import { t as g } from "./openfin-Bxelt0yg.js";
|
|
8
|
+
import { n as _, t as v } from "./fixed-window-Dq3MLUUv.js";
|
|
9
|
+
import { t as y } from "./unref-DgHPQeWv.js";
|
|
10
|
+
import { t as b } from "./defineProperty-s2S8BXUc.js";
|
|
11
|
+
// src/bus/validation.ts
|
|
12
|
+
var x = [
|
|
13
|
+
"complete",
|
|
14
|
+
"timeout",
|
|
15
|
+
"inactive"
|
|
16
|
+
];
|
|
17
|
+
function S(e) {
|
|
18
|
+
if (typeof e != "object" || !e) return !1;
|
|
19
|
+
let t = e;
|
|
20
|
+
if (typeof t.from != "string" || !t.from || typeof t.t != "string") return !1;
|
|
21
|
+
let n = (e) => typeof t[e] == "string";
|
|
22
|
+
switch (t.t) {
|
|
23
|
+
case r.hello: return n("tabId");
|
|
24
|
+
case r.tab: return n("tabId") && (t.since === void 0 || Number.isFinite(t.since));
|
|
25
|
+
case r.welcome: return n("to") && n("tabId") && (t.routingContextId === void 0 || n("routingContextId"));
|
|
26
|
+
case r.journeyRequest:
|
|
27
|
+
case r.samplingRequest: return !0;
|
|
28
|
+
case r.securityContext: return n("id") && t.id !== "";
|
|
29
|
+
case r.journey: return (t.to === void 0 || n("to")) && "journey" in t;
|
|
30
|
+
case r.sampling: return n("to") && "rules" in t;
|
|
31
|
+
case r.flushRequest: return n("id") && typeof t.timeoutMs == "number";
|
|
32
|
+
case r.flushResult: return n("id") && "result" in t;
|
|
33
|
+
case r.records: return Array.isArray(t.records) && (t.routingContextId === void 0 || n("routingContextId")) && t.records.every((e) => !f(e) || !p(e.severityText) ? !1 : !Array.isArray(e.attributes) && !Array.isArray(e.resource) && /^\d+$/.test(e.timeUnixNano) && (e.observedTimeUnixNano === void 0 || /^\d+$/.test(e.observedTimeUnixNano)) && typeof e.traceId == "string" && /^(?:[a-f\d]{32})?$/.test(e.traceId) && typeof e.spanId == "string" && /^(?:[a-f\d]{16})?$/.test(e.spanId) && Number.isInteger(e.traceFlags) && e.traceFlags >= 0 && e.traceFlags <= 255 && e.severityNumber === a[e.severityText]);
|
|
34
|
+
default: return !1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function C(e) {
|
|
38
|
+
if (!m(e)) return null;
|
|
39
|
+
let { status: t, accepted: n, stored: r, dropped: i, forwarded: a, pending: o } = e;
|
|
40
|
+
return ![
|
|
41
|
+
n,
|
|
42
|
+
r,
|
|
43
|
+
i,
|
|
44
|
+
a,
|
|
45
|
+
o
|
|
46
|
+
].every((e) => Number.isSafeInteger(e) && e >= 0) || !x.includes(t) || t === "complete" && o !== 0 ? null : {
|
|
47
|
+
status: t,
|
|
48
|
+
accepted: n,
|
|
49
|
+
stored: r,
|
|
50
|
+
dropped: i,
|
|
51
|
+
forwarded: a,
|
|
52
|
+
pending: o
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
// src/models/bus.ts
|
|
56
|
+
function w(e) {
|
|
57
|
+
return {
|
|
58
|
+
p: n,
|
|
59
|
+
m: e
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function T(e) {
|
|
63
|
+
if (typeof e != "object" || !e) return null;
|
|
64
|
+
let t = e;
|
|
65
|
+
if (t.p !== "ui-observability/2" || typeof t.m != "object" || t.m === null) return null;
|
|
66
|
+
let n = t.m;
|
|
67
|
+
return typeof n.t == "string" ? n : null;
|
|
68
|
+
}
|
|
69
|
+
// src/bus/links.ts
|
|
70
|
+
var E = Symbol.for(t), D = "null", O = "ui-observability/2";
|
|
71
|
+
function k(e, t) {
|
|
72
|
+
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.`;
|
|
73
|
+
}
|
|
74
|
+
function A(e) {
|
|
75
|
+
let t = location.ancestorOrigins;
|
|
76
|
+
return t && t.length > 0 ? t.item(0) : j() ?? M(e);
|
|
77
|
+
}
|
|
78
|
+
function j() {
|
|
79
|
+
let e = document.referrer;
|
|
80
|
+
if (e === "") return null;
|
|
81
|
+
try {
|
|
82
|
+
return new URL(e).origin;
|
|
83
|
+
} catch {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function M(e) {
|
|
88
|
+
let t;
|
|
89
|
+
try {
|
|
90
|
+
t = window.parent.origin;
|
|
91
|
+
} catch {
|
|
92
|
+
return e.count("platform.api_blocked"), null;
|
|
93
|
+
}
|
|
94
|
+
return typeof t != "string" || t === D ? null : t;
|
|
95
|
+
}
|
|
96
|
+
function N() {
|
|
97
|
+
if (location.origin !== D) return location.origin;
|
|
98
|
+
let e = globalThis.origin;
|
|
99
|
+
return typeof e == "string" ? e : D;
|
|
100
|
+
}
|
|
101
|
+
function P(e, t) {
|
|
102
|
+
if (typeof window > "u" || window.parent === window) return null;
|
|
103
|
+
let r;
|
|
104
|
+
try {
|
|
105
|
+
r = window.parent[E];
|
|
106
|
+
} catch {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
if (typeof r?.busAccept != "function") return null;
|
|
110
|
+
let i = r.protocol, a = r.busCanAccept, o = typeof a == "function", s = i === void 0 && o ? O : i;
|
|
111
|
+
if (s !== "ui-observability/2") {
|
|
112
|
+
let e = typeof s == "string" ? s.slice(0, 48) : "none";
|
|
113
|
+
return t.report("bus.protocol_mismatch", "The same-origin parent runtime uses another bus protocol. This context tries a message link instead of a direct call.", {
|
|
114
|
+
found: e,
|
|
115
|
+
own: n
|
|
116
|
+
}), null;
|
|
117
|
+
}
|
|
118
|
+
let c = N();
|
|
119
|
+
if (o && !a.call(r, window, c)) return null;
|
|
120
|
+
let l = r, u = !0;
|
|
121
|
+
return {
|
|
122
|
+
kind: "direct",
|
|
123
|
+
post(n) {
|
|
124
|
+
u && t.guard("bus.send_failed", "The direct call into the parent runtime failed.", () => {
|
|
125
|
+
l.busAccept(n, e, window);
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
close() {
|
|
129
|
+
u = !1;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function F(e, t, n) {
|
|
134
|
+
if (typeof window > "u" || window.parent === window) return null;
|
|
135
|
+
let r = N();
|
|
136
|
+
if (r === D) return n.report("bus.untrusted_origin", "This frame reports the origin \"null\". No parent can trust that origin. This context sends its own records. A frame that is sandboxed without allow-same-origin has this origin. Set bus.mode: \"sender\" in the frame. Add allow-same-origin to the sandbox attribute only for content that you trust.", {
|
|
137
|
+
origin: r,
|
|
138
|
+
type: "parent"
|
|
139
|
+
}), null;
|
|
140
|
+
let i = /* @__PURE__ */ new Set([r, ...t]), a = A(n);
|
|
141
|
+
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.`, {
|
|
142
|
+
origin: a ?? "",
|
|
143
|
+
type: "parent"
|
|
144
|
+
}), null;
|
|
145
|
+
let o = /* @__PURE__ */ new Set(), s = (t) => {
|
|
146
|
+
let r = T(t.data);
|
|
147
|
+
r && t.source === window.parent && (i.has(t.origin) ? e(r, {
|
|
148
|
+
link: "parent",
|
|
149
|
+
origin: t.origin,
|
|
150
|
+
peer: t.source
|
|
151
|
+
}) : o.has(t.origin) || (o.add(t.origin), n.report("bus.untrusted_origin", k(t.origin, "a message"), {
|
|
152
|
+
origin: t.origin,
|
|
153
|
+
type: r.t.slice(0, 48)
|
|
154
|
+
})));
|
|
155
|
+
};
|
|
156
|
+
return addEventListener("message", s), {
|
|
157
|
+
kind: "parent",
|
|
158
|
+
post(e) {
|
|
159
|
+
n.guard("bus.send_failed", "The postMessage call to the parent failed.", () => {
|
|
160
|
+
window.parent.postMessage(w(e), a);
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
close() {
|
|
164
|
+
removeEventListener("message", s);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function I(e, t, n, r, i) {
|
|
169
|
+
if (typeof window > "u") return null;
|
|
170
|
+
let a = /* @__PURE__ */ new Set([location.origin, ...t]);
|
|
171
|
+
a.delete(D);
|
|
172
|
+
let o = /* @__PURE__ */ new Map(), s = (e, t, a) => {
|
|
173
|
+
if (r && !r(e, t)) {
|
|
174
|
+
o.delete(e);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (i && !i(a, e)) return;
|
|
178
|
+
let s = e;
|
|
179
|
+
s.closed ? o.delete(e) : n.guard("bus.send_failed", "The postMessage call to a child frame failed.", () => {
|
|
180
|
+
s.postMessage(w(a), t);
|
|
181
|
+
});
|
|
182
|
+
}, c = (t) => {
|
|
183
|
+
let i = T(t.data);
|
|
184
|
+
if (!i || window.parent !== window && t.source === window.parent) return;
|
|
185
|
+
if (!r && !a.has(t.origin)) {
|
|
186
|
+
n.report("bus.untrusted_origin", k(t.origin, "a message"), {
|
|
187
|
+
origin: t.origin,
|
|
188
|
+
type: i.t.slice(0, 48)
|
|
189
|
+
});
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (r && !r(t.source, t.origin)) return;
|
|
193
|
+
let { source: c, origin: l } = t;
|
|
194
|
+
c && o.set(c, l), e(i, {
|
|
195
|
+
link: "children",
|
|
196
|
+
origin: l,
|
|
197
|
+
peer: c ?? void 0,
|
|
198
|
+
reply: c ? (e) => {
|
|
199
|
+
s(c, l, e);
|
|
200
|
+
} : void 0
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
return addEventListener("message", c), {
|
|
204
|
+
kind: "children",
|
|
205
|
+
post(e) {
|
|
206
|
+
for (let [t, n] of o) s(t, n, e);
|
|
207
|
+
},
|
|
208
|
+
close() {
|
|
209
|
+
removeEventListener("message", c), o.clear();
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function L(e, t, n) {
|
|
214
|
+
let r = globalThis.BroadcastChannel;
|
|
215
|
+
if (r === void 0) return null;
|
|
216
|
+
let i = n.guard("bus.send_failed", "The library could not open the BroadcastChannel.", () => new r(e));
|
|
217
|
+
return i ? (i.onmessage = (e) => {
|
|
218
|
+
let n = T(e.data);
|
|
219
|
+
n && t(n, {
|
|
220
|
+
link: "broadcast",
|
|
221
|
+
origin: "same-origin"
|
|
222
|
+
});
|
|
223
|
+
}, {
|
|
224
|
+
kind: "broadcast",
|
|
225
|
+
post(e) {
|
|
226
|
+
n.guard("bus.send_failed", "The BroadcastChannel.postMessage call failed.", () => {
|
|
227
|
+
i.postMessage(w(e));
|
|
228
|
+
});
|
|
229
|
+
},
|
|
230
|
+
close() {
|
|
231
|
+
n.guard("bus.send_failed", "The library could not close the BroadcastChannel.", () => {
|
|
232
|
+
i.close();
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}) : null;
|
|
236
|
+
}
|
|
237
|
+
function R(e, t, n, r) {
|
|
238
|
+
let i = g()?.InterApplicationBus;
|
|
239
|
+
if (!i) return null;
|
|
240
|
+
if (!t) return r.report("openfin.unavailable", "OpenFin gives no application uuid. The InterApplicationBus link stays closed."), null;
|
|
241
|
+
let a = `${e}.${t}`;
|
|
242
|
+
return r.guardAsync("bus.send_failed", "The InterApplicationBus.subscribe call failed.", () => i.subscribe({ uuid: t }, a, (e, t, r) => {
|
|
243
|
+
let i = T(e);
|
|
244
|
+
i && n(i, {
|
|
245
|
+
link: "openfin",
|
|
246
|
+
origin: "openfin",
|
|
247
|
+
peer: t && r ? `${t}:${r}` : void 0
|
|
248
|
+
});
|
|
249
|
+
})), {
|
|
250
|
+
kind: "openfin",
|
|
251
|
+
post(e) {
|
|
252
|
+
r.guardAsync("bus.send_failed", "The InterApplicationBus.publish call failed.", () => i.publish(a, w(e)));
|
|
253
|
+
},
|
|
254
|
+
close() {}
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function z(e, t) {
|
|
258
|
+
let n = globalThis, r = n.postMessage;
|
|
259
|
+
return n.WorkerGlobalScope === void 0 || !r ? null : (n.addEventListener?.("message", (t) => {
|
|
260
|
+
let n = T(t.data);
|
|
261
|
+
n && e(n, {
|
|
262
|
+
link: "owner",
|
|
263
|
+
origin: "same-origin"
|
|
264
|
+
});
|
|
265
|
+
}), {
|
|
266
|
+
kind: "owner",
|
|
267
|
+
post(e) {
|
|
268
|
+
t.guard("bus.send_failed", "The postMessage call of the worker failed.", () => {
|
|
269
|
+
r(w(e));
|
|
270
|
+
});
|
|
271
|
+
},
|
|
272
|
+
close() {}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
function B(e, t, n) {
|
|
276
|
+
let r = (n) => {
|
|
277
|
+
let r = T(n.data);
|
|
278
|
+
r && t(r, {
|
|
279
|
+
link: "worker",
|
|
280
|
+
origin: "same-origin",
|
|
281
|
+
peer: e
|
|
282
|
+
});
|
|
283
|
+
};
|
|
284
|
+
return e.addEventListener("message", r), e.start?.(), {
|
|
285
|
+
kind: "worker",
|
|
286
|
+
post(t) {
|
|
287
|
+
n.guard("bus.send_failed", "The postMessage call to a worker failed.", () => {
|
|
288
|
+
e.postMessage(w(t));
|
|
289
|
+
});
|
|
290
|
+
},
|
|
291
|
+
close() {
|
|
292
|
+
e.removeEventListener("message", r);
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
// src/bus/bus.ts
|
|
297
|
+
var V = {
|
|
298
|
+
timeoutMs: e,
|
|
299
|
+
maxAttempts: 3
|
|
300
|
+
}, H = [
|
|
301
|
+
"children",
|
|
302
|
+
"direct",
|
|
303
|
+
"worker"
|
|
304
|
+
], U = class {
|
|
305
|
+
mayPost(e, t) {
|
|
306
|
+
let n = this.sources.get(t)?.permissions;
|
|
307
|
+
return n ? e.t === r.journey ? n.includes("journey:read") : e.t === r.journeyRequest ? n.includes("journey:write") : e.t !== r.sampling || n.includes("sampling:read") : this.config.bus.sourcePolicy === "trusted-origin";
|
|
308
|
+
}
|
|
309
|
+
registerFrame(e, t) {
|
|
310
|
+
let n = typeof HTMLIFrameElement > "u" ? void 0 : HTMLIFrameElement, r = n && e instanceof n ? e.contentWindow : e;
|
|
311
|
+
if (!r || new URL(t.origin).origin !== t.origin || t.origin === "null") throw Error("A frame registration requires a window and an exact origin.");
|
|
312
|
+
let i = {
|
|
313
|
+
...t,
|
|
314
|
+
permissions: [...t.permissions ?? ["records"]]
|
|
315
|
+
};
|
|
316
|
+
return this.sources.set(r, i), this.ensureChildrenLink(), () => {
|
|
317
|
+
this.sources.get(r) === i && this.sources.delete(r);
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
isRegistered(e, t) {
|
|
321
|
+
if (!e) return !1;
|
|
322
|
+
let n = this.sources.get(e);
|
|
323
|
+
return n ? n.origin === t : this.config.bus.sourcePolicy !== "registered" && t !== "null" && (t === N() || this.config.bus.trustedOrigins.includes(t));
|
|
324
|
+
}
|
|
325
|
+
rotateContext() {
|
|
326
|
+
this.passContext(this.role === "sender");
|
|
327
|
+
}
|
|
328
|
+
setTabId(e) {
|
|
329
|
+
this.tabId = e;
|
|
330
|
+
}
|
|
331
|
+
passContext(e) {
|
|
332
|
+
let t = {
|
|
333
|
+
t: r.securityContext,
|
|
334
|
+
from: this.contextId,
|
|
335
|
+
id: this.config.securityContext.id
|
|
336
|
+
};
|
|
337
|
+
this.postOver("children", t), this.postOver("worker", t), this.postToDirectChildren(t), e && this.postOver("openfin", t);
|
|
338
|
+
}
|
|
339
|
+
postToDirectChildren(e) {
|
|
340
|
+
let t = N();
|
|
341
|
+
for (let [n, r] of this.directReplies) {
|
|
342
|
+
let i = r.deref();
|
|
343
|
+
!i || n.closed || !this.isRegistered(n, t) ? this.directReplies.delete(n) : this.diagnostics.guard("bus.send_failed", "The reply to a direct child failed.", () => {
|
|
344
|
+
i(e, {
|
|
345
|
+
link: "direct",
|
|
346
|
+
origin: "same-origin",
|
|
347
|
+
peer: n
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
keepDirectReply(e, t) {
|
|
353
|
+
for (let e of this.directReplies.keys()) e.closed && this.directReplies.delete(e);
|
|
354
|
+
this.directReplies.set(e, new WeakRef(t));
|
|
355
|
+
}
|
|
356
|
+
constructor(e, t, n, r, i, a, o = V) {
|
|
357
|
+
b(this, "config", void 0), b(this, "diagnostics", void 0), b(this, "platform", void 0), b(this, "contextId", void 0), b(this, "tabId", void 0), b(this, "handlers", void 0), b(this, "handshakeOptions", void 0), b(this, "sources", /* @__PURE__ */ new Map()), b(this, "rates", /* @__PURE__ */ new WeakMap()), b(this, "channelRates", /* @__PURE__ */ new Map()), b(this, "directReplies", /* @__PURE__ */ new Map()), b(this, "role", "sender"), b(this, "upstream", null), b(this, "links", []), b(this, "openFinLink", null), b(this, "isOpenFinProvider", !1), b(this, "rulesPoll", void 0), b(this, "destroyed", !1), b(this, "ownerId", null), b(this, "ownerPeer", void 0), b(this, "awaitingWelcome", null), b(this, "flushAnswers", /* @__PURE__ */ new Map()), b(this, "flushQueue", []), b(this, "flushing", !1), b(this, "flushedAt", 0), b(this, "since", void 0), b(this, "receive", (e, t) => {
|
|
358
|
+
let n = t.link === "children" || t.link === "worker";
|
|
359
|
+
this.acceptsMessage(e, t, n) && this.routeMessage(e, t);
|
|
360
|
+
}), this.config = e, this.diagnostics = t, this.platform = n, this.contextId = r, this.tabId = i, this.handlers = a, this.handshakeOptions = o;
|
|
361
|
+
let s = performance.timeOrigin;
|
|
362
|
+
this.since = Number.isFinite(s) ? s : void 0;
|
|
363
|
+
}
|
|
364
|
+
getRole() {
|
|
365
|
+
return this.role;
|
|
366
|
+
}
|
|
367
|
+
async start() {
|
|
368
|
+
let { bus: e } = this.config;
|
|
369
|
+
if (e.mode === "off") return this.role = "sender", this.role;
|
|
370
|
+
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;
|
|
371
|
+
this.openControlLinks();
|
|
372
|
+
let t = P(this.receive, this.diagnostics);
|
|
373
|
+
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.", {
|
|
374
|
+
role: "forwarder",
|
|
375
|
+
via: "direct"
|
|
376
|
+
}), this.announce(), this.role;
|
|
377
|
+
let n = this.candidateUpstream();
|
|
378
|
+
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;
|
|
379
|
+
let r = this.orphanPolicy() === "retry" ? this.handshakeOptions.maxAttempts : 1, i = !1;
|
|
380
|
+
for (let e = 0; e < r && !i; e++) i = await this.handshake(n);
|
|
381
|
+
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.`, {
|
|
382
|
+
via: n.kind,
|
|
383
|
+
crossOrigin: this.isCrossOriginFrame()
|
|
384
|
+
})), this.diagnostics.report("bus.role_resolved", `The bus role is ${this.role}.`, {
|
|
385
|
+
role: this.role,
|
|
386
|
+
via: i ? n.kind : "none"
|
|
387
|
+
}), this.announce(), this.role;
|
|
388
|
+
}
|
|
389
|
+
sendRecords(e) {
|
|
390
|
+
let { maxRecordsPerMessage: t, maxMessageBytes: n } = this.config.bus, i = new TextEncoder(), a = (e) => n === null ? 0 : i.encode(JSON.stringify(e)).length, o = (e) => ({
|
|
391
|
+
t: r.records,
|
|
392
|
+
from: this.contextId,
|
|
393
|
+
records: e,
|
|
394
|
+
routingContextId: this.config.securityContext.id || void 0
|
|
395
|
+
}), s = a(o([])), c = [], l = s, u = 0;
|
|
396
|
+
for (let r of e) {
|
|
397
|
+
let e = a(r);
|
|
398
|
+
if (n !== null && s + e > n) {
|
|
399
|
+
this.diagnostics.count("bus.rejected_message"), u++;
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
let i = +(c.length > 0);
|
|
403
|
+
(t !== null && c.length >= t || n !== null && l + i + e > n) && (this.upstream?.post(o(c)), c = [], l = s), l += +(c.length > 0) + e, c.push(r);
|
|
404
|
+
}
|
|
405
|
+
return c.length > 0 && this.upstream?.post(o(c)), this.upstream ? e.length - u : 0;
|
|
406
|
+
}
|
|
407
|
+
async requestFlush(e, t) {
|
|
408
|
+
let { upstream: n } = this;
|
|
409
|
+
if (!n) return null;
|
|
410
|
+
let i = h(this.diagnostics), a, o = new Promise((e) => {
|
|
411
|
+
a = e;
|
|
412
|
+
});
|
|
413
|
+
this.flushAnswers.set(i, a), n.post({
|
|
414
|
+
t: r.flushRequest,
|
|
415
|
+
from: this.contextId,
|
|
416
|
+
id: i,
|
|
417
|
+
timeoutMs: e
|
|
418
|
+
});
|
|
419
|
+
try {
|
|
420
|
+
return await Promise.race([o, t.then(() => null)]);
|
|
421
|
+
} finally {
|
|
422
|
+
this.flushAnswers.delete(i);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
acceptDirect(e, t, n) {
|
|
426
|
+
let i = {
|
|
427
|
+
link: "direct",
|
|
428
|
+
origin: "same-origin",
|
|
429
|
+
peer: n
|
|
430
|
+
}, a = {
|
|
431
|
+
...i,
|
|
432
|
+
reply: (e) => {
|
|
433
|
+
t(e, i);
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
this.acceptsMessage(e, a, !0) && e.from !== this.contextId && (n && this.keepDirectReply(n, t), e.t === r.samplingRequest ? t(this.rulesAnswer(e.from), i) : (e.t === r.records && !this.awaitingWelcome && e.routingContextId !== this.config.securityContext.id && t({
|
|
437
|
+
t: r.securityContext,
|
|
438
|
+
from: this.contextId,
|
|
439
|
+
id: this.config.securityContext.id
|
|
440
|
+
}, i), this.routeMessage(e, a)));
|
|
441
|
+
}
|
|
442
|
+
attachWorker(e, t = {}) {
|
|
443
|
+
let n = {
|
|
444
|
+
...t,
|
|
445
|
+
permissions: [...t.permissions ?? ["records"]]
|
|
446
|
+
};
|
|
447
|
+
this.sources.set(e, n);
|
|
448
|
+
let r = B(e, (e, t) => {
|
|
449
|
+
this.receive(e, {
|
|
450
|
+
...t,
|
|
451
|
+
reply: (e) => {
|
|
452
|
+
i.post(e);
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
}, this.diagnostics), i = {
|
|
456
|
+
...r,
|
|
457
|
+
post: (t) => {
|
|
458
|
+
this.mayPost(t, e) && r.post(t);
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
return this.links.push(i), () => {
|
|
462
|
+
i.close();
|
|
463
|
+
let t = this.links.indexOf(i);
|
|
464
|
+
t >= 0 && this.links.splice(t, 1), this.sources.get(e) === n && this.sources.delete(e);
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
broadcastJourney(e) {
|
|
468
|
+
this.postJourney({
|
|
469
|
+
t: r.journey,
|
|
470
|
+
from: this.contextId,
|
|
471
|
+
journey: e
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
destroy() {
|
|
475
|
+
this.sources.clear(), this.directReplies.clear(), this.flushQueue = [], this.destroyed = !0, clearInterval(this.rulesPoll), this.rulesPoll = void 0;
|
|
476
|
+
for (let e of this.allLinks()) e.close();
|
|
477
|
+
this.links.length = 0, this.upstream = null, this.ownerId = null, this.openFinLink = null;
|
|
478
|
+
}
|
|
479
|
+
allLinks() {
|
|
480
|
+
return !this.upstream || this.links.includes(this.upstream) ? this.links : [...this.links, this.upstream];
|
|
481
|
+
}
|
|
482
|
+
postOver(e, t) {
|
|
483
|
+
for (let n of this.allLinks()) n.kind === e && n.post(t);
|
|
484
|
+
}
|
|
485
|
+
postJourney(e) {
|
|
486
|
+
for (let t of this.allLinks()) this.journeyLink(t.kind) && t.post(e);
|
|
487
|
+
}
|
|
488
|
+
acceptsMessage(e, t, n) {
|
|
489
|
+
if (this.destroyed) return !1;
|
|
490
|
+
let r;
|
|
491
|
+
try {
|
|
492
|
+
r = this.passesChecks(e, t, n);
|
|
493
|
+
} catch {
|
|
494
|
+
r = !1;
|
|
495
|
+
}
|
|
496
|
+
return r === "journey_denied" ? (this.diagnostics.count("bus.journey_denied"), !1) : (r || this.diagnostics.count("bus.rejected_message"), r);
|
|
497
|
+
}
|
|
498
|
+
passesChecks(e, t, n) {
|
|
499
|
+
let { bus: i } = this.config, a = typeof t.peer == "object" ? this.sources.get(t.peer) : void 0;
|
|
500
|
+
if (n && i.sourcePolicy === "registered" && !a) return !1;
|
|
501
|
+
let o = typeof t.peer == "object" ? t.peer : void 0, s = typeof t.peer == "string" ? t.peer : t.link, c = Date.now(), l = (o ? this.rates.get(o) : this.channelRates.get(s)) ?? {
|
|
502
|
+
start: c,
|
|
503
|
+
count: 0
|
|
504
|
+
};
|
|
505
|
+
if (o) this.rates.set(o, l);
|
|
506
|
+
else {
|
|
507
|
+
for (let [e, t] of this.channelRates) _(t, 1e3, c) && this.channelRates.delete(e);
|
|
508
|
+
if (this.channelRates.size >= 256 && !this.channelRates.has(s)) return !1;
|
|
509
|
+
this.channelRates.set(s, l);
|
|
510
|
+
}
|
|
511
|
+
if (!v(l, i.maxMessagesPerSecond ?? Infinity, 1e3)) return !1;
|
|
512
|
+
let u = JSON.stringify(e, (e, t) => {
|
|
513
|
+
if (typeof t == "number" && !Number.isFinite(t)) throw Error("Non-finite value");
|
|
514
|
+
return t;
|
|
515
|
+
});
|
|
516
|
+
if (i.maxMessageBytes !== null && new TextEncoder().encode(u).length > i.maxMessageBytes || !S(e) || e.t === r.records && i.maxRecordsPerMessage !== null && e.records.length > i.maxRecordsPerMessage) return !1;
|
|
517
|
+
if (a) {
|
|
518
|
+
let t = e.t === r.records || e.t === r.flushRequest ? "records" : e.t === r.journey ? "journey:write" : e.t === r.journeyRequest ? "journey:read" : e.t === r.samplingRequest ? "sampling:read" : void 0;
|
|
519
|
+
if (t && !a.permissions?.includes(t)) return t === "journey:read" && "journey_denied";
|
|
520
|
+
}
|
|
521
|
+
return n && (e.t === r.sampling || e.t === r.securityContext || e.t === r.flushResult) || t.link === "broadcast" && e.t === r.flushRequest ? !1 : i.sourcePolicy !== "registered" || t.link !== "broadcast" || e.t !== r.records;
|
|
522
|
+
}
|
|
523
|
+
routeMessage(e, t) {
|
|
524
|
+
if (e.from !== this.contextId) switch (e.t) {
|
|
525
|
+
case r.hello:
|
|
526
|
+
this.canOwn(t.link) && this.answer(t, {
|
|
527
|
+
t: r.welcome,
|
|
528
|
+
from: this.contextId,
|
|
529
|
+
to: e.from,
|
|
530
|
+
tabId: this.tabId,
|
|
531
|
+
routingContextId: this.awaitingWelcome ? void 0 : this.config.securityContext.id || void 0
|
|
532
|
+
});
|
|
533
|
+
break;
|
|
534
|
+
case r.welcome:
|
|
535
|
+
if (e.to !== this.contextId) break;
|
|
536
|
+
if (this.awaitingWelcome?.link === t.link || this.upstream?.kind === t.link && this.ownerId === null) {
|
|
537
|
+
this.ownerId = e.from, this.ownerPeer = t.peer;
|
|
538
|
+
let n = this.config.securityContext.id;
|
|
539
|
+
if (e.routingContextId && this.handlers.onSecurityContext?.(e.routingContextId) === !1) break;
|
|
540
|
+
this.config.securityContext.id !== n && this.passContext(!1), this.awaitingWelcome?.settle(!0);
|
|
541
|
+
}
|
|
542
|
+
break;
|
|
543
|
+
case r.records:
|
|
544
|
+
if (this.config.securityContext.isolation && this.config.securityContext.id && e.routingContextId !== this.config.securityContext.id) {
|
|
545
|
+
this.diagnostics.count("security.context_mismatch");
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
this.role === "sender" || this.handlers.paused?.() && this.canRelay(t.link) ? this.handlers.onRecords(e.records) : this.upstream && this.canRelay(t.link) && this.upstream.post(e);
|
|
549
|
+
break;
|
|
550
|
+
case r.securityContext:
|
|
551
|
+
t.link === this.upstream?.kind && this.ownerId === e.from && this.ownerPeer === t.peer && this.handlers.onSecurityContext?.(e.id) !== !1 && this.rotateContext();
|
|
552
|
+
break;
|
|
553
|
+
case r.journey:
|
|
554
|
+
this.acceptsJourney(e, t) && this.applyJourney(e.journey);
|
|
555
|
+
break;
|
|
556
|
+
case r.journeyRequest: {
|
|
557
|
+
let n = this.handlers.onJourneyRequest();
|
|
558
|
+
n && this.journeyLink(t.link) && this.answer(t, {
|
|
559
|
+
t: r.journey,
|
|
560
|
+
from: this.contextId,
|
|
561
|
+
to: e.from,
|
|
562
|
+
journey: n
|
|
563
|
+
});
|
|
564
|
+
break;
|
|
565
|
+
}
|
|
566
|
+
case r.samplingRequest:
|
|
567
|
+
(this.role === "forwarder" ? t.link !== this.upstream?.kind : this.canOwn(t.link)) && this.answer(t, this.rulesAnswer(e.from));
|
|
568
|
+
break;
|
|
569
|
+
case r.sampling:
|
|
570
|
+
this.acceptsRules(e.to, t) && this.applyRules(e.rules);
|
|
571
|
+
break;
|
|
572
|
+
case r.flushRequest:
|
|
573
|
+
(this.role === "sender" || this.canRelay(t.link)) && this.queueFlush(e, t);
|
|
574
|
+
break;
|
|
575
|
+
case r.flushResult:
|
|
576
|
+
this.settleFlush(e, t);
|
|
577
|
+
break;
|
|
578
|
+
case r.tab: t.link === "broadcast" && e.tabId === this.tabId && this.settleTabClaim(e);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
settleTabClaim(e) {
|
|
582
|
+
let { since: t } = e;
|
|
583
|
+
t === void 0 || this.since === void 0 || t === this.since ? this.contextId > e.from && this.handlers.onTabConflict() : t < this.since ? this.handlers.onTabConflict() : this.postOver("broadcast", this.tabClaim());
|
|
584
|
+
}
|
|
585
|
+
queueFlush(e, t) {
|
|
586
|
+
let n = t.peer ?? t.link, i = this.flushQueue.filter((e) => e.source === n).length;
|
|
587
|
+
if (this.flushQueue.length >= 100 || i >= 4) {
|
|
588
|
+
this.diagnostics.count("bus.rejected_message");
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
let a = Math.min(Math.max(e.timeoutMs, 0), o);
|
|
592
|
+
this.flushQueue.push({
|
|
593
|
+
source: n,
|
|
594
|
+
ends: Date.now() + a,
|
|
595
|
+
answer: (n) => {
|
|
596
|
+
this.answer(t, {
|
|
597
|
+
t: r.flushResult,
|
|
598
|
+
from: this.contextId,
|
|
599
|
+
id: e.id,
|
|
600
|
+
result: n
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
}), this.flushing || this.runFlushes();
|
|
604
|
+
}
|
|
605
|
+
async runFlushes() {
|
|
606
|
+
this.flushing = !0;
|
|
607
|
+
try {
|
|
608
|
+
for (; this.flushQueue.length > 0;) {
|
|
609
|
+
let e = this.flushedAt + s - Date.now();
|
|
610
|
+
if (e > 0 && await new Promise((t) => {
|
|
611
|
+
y(setTimeout(t, e));
|
|
612
|
+
}), this.flushQueue.length === 0) return;
|
|
613
|
+
this.flushedAt = Date.now();
|
|
614
|
+
let t = this.flushQueue;
|
|
615
|
+
this.flushQueue = [];
|
|
616
|
+
let n = Math.max(...t.map((e) => e.ends)), r = await this.diagnostics.guardAsync("pipeline.crashed", "The flush that a child context asked for failed. The child gets no answer.", async () => this.handlers.onFlush?.(Math.max(0, n - Date.now())));
|
|
617
|
+
if (r && !this.destroyed) for (let e of t) this.diagnostics.guard("bus.send_failed", "The answer to a flush request failed.", () => {
|
|
618
|
+
e.answer(r);
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
} finally {
|
|
622
|
+
this.flushing = !1;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
settleFlush(e, t) {
|
|
626
|
+
let n = this.flushAnswers.get(e.id), r = this.ownerPeer === void 0 ? t.link !== "openfin" : this.ownerPeer === t.peer;
|
|
627
|
+
if (!n || !r || !this.fromOwner(e.from, t.link)) return;
|
|
628
|
+
let i;
|
|
629
|
+
try {
|
|
630
|
+
i = C(e.result);
|
|
631
|
+
} catch {
|
|
632
|
+
i = null;
|
|
633
|
+
}
|
|
634
|
+
i ? n(i) : this.diagnostics.count("bus.rejected_message");
|
|
635
|
+
}
|
|
636
|
+
answer(e, t) {
|
|
637
|
+
e.reply ? e.reply(t) : this.postOver(e.link, t);
|
|
638
|
+
}
|
|
639
|
+
canRelay(e) {
|
|
640
|
+
return e === "direct" || e !== this.upstream?.kind;
|
|
641
|
+
}
|
|
642
|
+
canOwn(e) {
|
|
643
|
+
return this.role !== "sender" && this.ownerId === null ? !1 : e === "openfin" ? this.role === "sender" && this.isOpenFinProvider : H.includes(e);
|
|
644
|
+
}
|
|
645
|
+
resolveOpenFinProvider() {
|
|
646
|
+
let e = this.config.bus.openFinRole;
|
|
647
|
+
if (e !== "auto") return e === "provider";
|
|
648
|
+
if (this.platform.platform !== "openfin" && this.platform.platform !== "openfin_web") return !1;
|
|
649
|
+
let t = g()?.me;
|
|
650
|
+
return !t?.identity || t.isView ? !1 : !!(t.identity.name && t.identity.name === t.identity.uuid);
|
|
651
|
+
}
|
|
652
|
+
orphanPolicy() {
|
|
653
|
+
return this.isCrossOriginFrame() ? "retry" : "promote";
|
|
654
|
+
}
|
|
655
|
+
isCrossOriginFrame() {
|
|
656
|
+
if (typeof window > "u" || window.parent === window) return !1;
|
|
657
|
+
try {
|
|
658
|
+
return Reflect.get(window.parent, "location"), !1;
|
|
659
|
+
} catch {
|
|
660
|
+
return !0;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
candidateUpstream() {
|
|
664
|
+
return this.platform.isWorker ? z(this.receive, this.diagnostics) : this.platform.isTopLevelDocument ? this.platform.platform === "openfin" && !this.isOpenFinProvider ? this.ensureOpenFinLink() : null : F(this.receive, this.config.bus.trustedOrigins, this.diagnostics);
|
|
665
|
+
}
|
|
666
|
+
openControlLinks() {
|
|
667
|
+
let e = (e) => {
|
|
668
|
+
e && this.links.push(e);
|
|
669
|
+
};
|
|
670
|
+
this.platform.isWorker || this.ensureChildrenLink(), this.platform.isTopLevelDocument && e(L(i, this.receive, this.diagnostics)), (this.platform.platform === "openfin" || this.platform.platform === "openfin_web") && e(this.ensureOpenFinLink());
|
|
671
|
+
}
|
|
672
|
+
ensureChildrenLink() {
|
|
673
|
+
if (this.links.some((e) => e.kind === "children")) return;
|
|
674
|
+
let e = I(this.receive, this.config.bus.trustedOrigins, this.diagnostics, (e, t) => {
|
|
675
|
+
let n = this.isRegistered(e, t);
|
|
676
|
+
if (!n) {
|
|
677
|
+
this.diagnostics.count("bus.rejected_message");
|
|
678
|
+
let n = e !== null && this.sources.has(e), r = t === N() || this.config.bus.trustedOrigins.includes(t);
|
|
679
|
+
(n || !r) && this.diagnostics.report("bus.untrusted_origin", "The bus rejected a message from an untrusted origin.");
|
|
680
|
+
}
|
|
681
|
+
return n;
|
|
682
|
+
}, (e, t) => this.mayPost(e, t));
|
|
683
|
+
e && this.links.push(e);
|
|
684
|
+
}
|
|
685
|
+
ensureOpenFinLink() {
|
|
686
|
+
return this.openFinLink ??= R(i, this.platform.openfinUuid, this.receive, this.diagnostics), this.openFinLink;
|
|
687
|
+
}
|
|
688
|
+
handshake(e) {
|
|
689
|
+
return new Promise((t) => {
|
|
690
|
+
let n = !1, i = (e) => {
|
|
691
|
+
n || (n = !0, this.awaitingWelcome = null, clearTimeout(a), t(e));
|
|
692
|
+
};
|
|
693
|
+
this.awaitingWelcome = {
|
|
694
|
+
link: e.kind,
|
|
695
|
+
settle: i
|
|
696
|
+
};
|
|
697
|
+
let a = setTimeout(() => {
|
|
698
|
+
i(!1);
|
|
699
|
+
}, this.handshakeOptions.timeoutMs);
|
|
700
|
+
y(a), e.post({
|
|
701
|
+
t: r.hello,
|
|
702
|
+
from: this.contextId,
|
|
703
|
+
tabId: this.tabId
|
|
704
|
+
});
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
tabClaim() {
|
|
708
|
+
return {
|
|
709
|
+
t: r.tab,
|
|
710
|
+
from: this.contextId,
|
|
711
|
+
tabId: this.tabId,
|
|
712
|
+
...this.since === void 0 ? {} : { since: this.since }
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
announce() {
|
|
716
|
+
this.postOver("broadcast", this.tabClaim()), this.upstream && this.ownerId === null && this.upstream.post({
|
|
717
|
+
t: r.hello,
|
|
718
|
+
from: this.contextId,
|
|
719
|
+
tabId: this.tabId
|
|
720
|
+
}), this.postJourney({
|
|
721
|
+
t: r.journeyRequest,
|
|
722
|
+
from: this.contextId
|
|
723
|
+
}), this.pollRules(), this.passContext(!1);
|
|
724
|
+
}
|
|
725
|
+
journeyScope() {
|
|
726
|
+
let { scope: e } = this.config.journey;
|
|
727
|
+
if (e !== "auto") return e;
|
|
728
|
+
let { platform: t } = this.platform;
|
|
729
|
+
return t === "openfin" || t === "openfin_web" ? "origin" : "tab";
|
|
730
|
+
}
|
|
731
|
+
journeyLink(e) {
|
|
732
|
+
let t = this.journeyScope();
|
|
733
|
+
return t === "context" ? !1 : t === "origin" || e !== "broadcast";
|
|
734
|
+
}
|
|
735
|
+
acceptsJourney(e, t) {
|
|
736
|
+
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);
|
|
737
|
+
}
|
|
738
|
+
fromOwner(e, t) {
|
|
739
|
+
return this.role !== "forwarder" || t !== this.upstream?.kind ? !1 : this.ownerId === null || e === this.ownerId;
|
|
740
|
+
}
|
|
741
|
+
applyJourney(e) {
|
|
742
|
+
if (e === null) {
|
|
743
|
+
this.handlers.onJourney(null);
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
let t = l(e);
|
|
747
|
+
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);
|
|
748
|
+
}
|
|
749
|
+
rulesAnswer(e) {
|
|
750
|
+
let t = this.handlers.remote.sampling?.wire() ?? null;
|
|
751
|
+
return {
|
|
752
|
+
t: r.sampling,
|
|
753
|
+
from: this.contextId,
|
|
754
|
+
to: e,
|
|
755
|
+
rules: t
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
acceptsRules(e, t) {
|
|
759
|
+
if (this.role !== "forwarder" || e !== this.contextId || t.link !== this.upstream?.kind) return !1;
|
|
760
|
+
let { origin: n } = t;
|
|
761
|
+
return t.link === "parent" && n !== N() && !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.`, {
|
|
762
|
+
origin: n,
|
|
763
|
+
type: "sampling"
|
|
764
|
+
}), !1) : this.ownerPeer === void 0 || this.ownerPeer === t.peer;
|
|
765
|
+
}
|
|
766
|
+
applyRules(e) {
|
|
767
|
+
if (e === null) {
|
|
768
|
+
d(this.handlers.remote, this.config, null);
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
let t = u(e, this.diagnostics);
|
|
772
|
+
t && d(this.handlers.remote, this.config, t);
|
|
773
|
+
}
|
|
774
|
+
pollRules() {
|
|
775
|
+
let { upstream: e } = this;
|
|
776
|
+
if (this.destroyed || this.role !== "forwarder" || !e) return;
|
|
777
|
+
let t = () => {
|
|
778
|
+
this.config.sampling.remote && e.post({
|
|
779
|
+
t: r.samplingRequest,
|
|
780
|
+
from: this.contextId
|
|
781
|
+
});
|
|
782
|
+
};
|
|
783
|
+
t(), this.rulesPoll = setInterval(t, c), y(this.rulesPoll);
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
export { U as Bus };
|
|
787
|
+
|
|
788
|
+
//# sourceMappingURL=bus-dw7T92sO.js.map
|