@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
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import { t as e } from "./storm-
|
|
1
|
+
import { t as e } from "./storm-DKlpv0FL.js";
|
|
2
|
+
import { t } from "./defineProperty-s2S8BXUc.js";
|
|
2
3
|
// src/capture/lifecycle.ts
|
|
3
|
-
var
|
|
4
|
-
ctx;
|
|
5
|
-
name = "lifecycle";
|
|
6
|
-
installed = !1;
|
|
7
|
-
phase = {
|
|
8
|
-
state: "",
|
|
9
|
-
enteredAt: 0
|
|
10
|
-
};
|
|
11
|
-
window = {
|
|
12
|
-
start: 0,
|
|
13
|
-
count: 0
|
|
14
|
-
};
|
|
4
|
+
var n = class {
|
|
15
5
|
constructor(e) {
|
|
16
|
-
this
|
|
6
|
+
t(this, "ctx", void 0), t(this, "name", "lifecycle"), t(this, "installed", !1), t(this, "phase", {
|
|
7
|
+
state: "",
|
|
8
|
+
enteredAt: 0
|
|
9
|
+
}), t(this, "window", {
|
|
10
|
+
start: 0,
|
|
11
|
+
count: 0
|
|
12
|
+
}), t(this, "onVisibility", () => {
|
|
13
|
+
this.transition(document.visibilityState === "hidden" ? "hidden" : "visible");
|
|
14
|
+
}), t(this, "onFreeze", () => {
|
|
15
|
+
this.transition("frozen");
|
|
16
|
+
}), t(this, "onResume", () => {
|
|
17
|
+
this.transition("resumed");
|
|
18
|
+
}), t(this, "onPageShow", (e) => {
|
|
19
|
+
e.persisted && this.transition("restored");
|
|
20
|
+
}), this.ctx = e;
|
|
17
21
|
}
|
|
18
22
|
install() {
|
|
19
23
|
this.installed || (this.installed = !0, this.ctx.once.lifecycle ??= {
|
|
@@ -24,23 +28,11 @@ var t = class {
|
|
|
24
28
|
uninstall() {
|
|
25
29
|
this.installed = !1, document.removeEventListener("visibilitychange", this.onVisibility), document.removeEventListener("freeze", this.onFreeze), document.removeEventListener("resume", this.onResume), removeEventListener("pageshow", this.onPageShow);
|
|
26
30
|
}
|
|
27
|
-
onVisibility = () => {
|
|
28
|
-
this.transition(document.visibilityState === "hidden" ? "hidden" : "visible");
|
|
29
|
-
};
|
|
30
|
-
onFreeze = () => {
|
|
31
|
-
this.transition("frozen");
|
|
32
|
-
};
|
|
33
|
-
onResume = () => {
|
|
34
|
-
this.transition("resumed");
|
|
35
|
-
};
|
|
36
|
-
onPageShow = (e) => {
|
|
37
|
-
e.persisted && this.transition("restored");
|
|
38
|
-
};
|
|
39
31
|
transition(t) {
|
|
40
32
|
if (!this.installed || t === this.phase.state) return;
|
|
41
33
|
let n = performance.now(), r = this.phase.state, i = Math.max(0, n - this.phase.enteredAt);
|
|
42
34
|
this.phase.state = t, this.phase.enteredAt = n;
|
|
43
|
-
let {
|
|
35
|
+
let { captureLimits: a } = this.ctx.config;
|
|
44
36
|
this.ctx.isActive?.() !== !1 && e(this.window, a.lifecyclePerWindow, this.ctx.diagnostics, "lifecycle events", a.windowMs) && this.ctx.diagnostics.guard("capture.record_failed", "The library could not record a lifecycle event.", () => {
|
|
45
37
|
this.ctx.logger.logEvent("ui.lifecycle", {
|
|
46
38
|
"lifecycle.state": t,
|
|
@@ -50,6 +42,6 @@ var t = class {
|
|
|
50
42
|
});
|
|
51
43
|
}
|
|
52
44
|
};
|
|
53
|
-
export {
|
|
45
|
+
export { n as LifecycleCapture };
|
|
54
46
|
|
|
55
|
-
//# sourceMappingURL=lifecycle-
|
|
47
|
+
//# sourceMappingURL=lifecycle-B2PlIuQu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle-B2PlIuQu.js","names":["allowInWindow","LifecycleCapture","_defineProperty","event","ctx","state","now","previous","duration","captureLimits"],"sources":["../src/capture/lifecycle.ts"],"sourcesContent":["import { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext, CaptureOnce } from \"./types\";\n\n/** Records page state changes, each with how long the previous state lasted. */\nexport class LifecycleCapture implements Capture {\n readonly name = \"lifecycle\";\n\n private installed = false;\n\n private phase: NonNullable<CaptureOnce[\"lifecycle\"]> = { state: \"\", enteredAt: 0 };\n\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Installs the document and back-forward cache listeners. */\n install(): void {\n if (this.installed) {\n return;\n }\n this.installed = true;\n this.ctx.once.lifecycle ??= { state: \"\", enteredAt: performance.now() };\n this.phase = this.ctx.once.lifecycle;\n document.addEventListener(\"visibilitychange\", this.onVisibility);\n document.addEventListener(\"freeze\", this.onFreeze);\n document.addEventListener(\"resume\", this.onResume);\n addEventListener(\"pageshow\", this.onPageShow);\n this.onVisibility();\n }\n\n /** Removes all listeners. */\n uninstall(): void {\n this.installed = false;\n document.removeEventListener(\"visibilitychange\", this.onVisibility);\n document.removeEventListener(\"freeze\", this.onFreeze);\n document.removeEventListener(\"resume\", this.onResume);\n removeEventListener(\"pageshow\", this.onPageShow);\n }\n\n private readonly onVisibility = (): void => {\n this.transition(document.visibilityState === \"hidden\" ? \"hidden\" : \"visible\");\n };\n\n private readonly onFreeze = (): void => {\n this.transition(\"frozen\");\n };\n\n private readonly onResume = (): void => {\n this.transition(\"resumed\");\n };\n\n private readonly onPageShow = (event: PageTransitionEvent): void => {\n if (event.persisted) {\n this.transition(\"restored\");\n }\n };\n\n /** Updates the state even when the rate limit drops its event. */\n private transition(state: string): void {\n if (!this.installed || state === this.phase.state) {\n return;\n }\n\n const now = performance.now();\n const previous = this.phase.state;\n const duration = Math.max(0, now - this.phase.enteredAt);\n this.phase.state = state;\n this.phase.enteredAt = now;\n\n const { captureLimits } = this.ctx.config;\n if (\n this.ctx.isActive?.() === false ||\n !allowInWindow(\n this.window,\n captureLimits.lifecyclePerWindow,\n this.ctx.diagnostics,\n \"lifecycle events\",\n captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not record a lifecycle event.\",\n () => {\n this.ctx.logger.logEvent(\"ui.lifecycle\", {\n \"lifecycle.state\": state,\n \"lifecycle.previous_state\": previous,\n \"lifecycle.duration_ms\": duration,\n });\n },\n );\n }\n}\n"],"mappings":";;;AAIA,IAAaC,IAAb,MAAiD;CAS/C,YAAY,GAAsC;EAArB,AAAAC,EAAA,MAAA,OAAA,KAAA,CAAA,GAR7BA,EAAA,MAAA,QAAgB,WAAA,GAEhBA,EAAA,MAAA,aAAoB,EAAA,GAEpBA,EAAA,MAAA,SAAuD;GAAE,OAAO;GAAI,WAAW;EAAE,CAAA,GAEjFA,EAAA,MAAA,UAAuC;GAAE,OAAO;GAAG,OAAO;EAAE,CAAA,GA4B5DA,EAAA,MAAA,sBAA4C;GAC1C,KAAK,WAAW,SAAS,oBAAoB,WAAW,WAAW,SAAS;EAC9E,CAAA,GAEAA,EAAA,MAAA,kBAAwC;GACtC,KAAK,WAAW,QAAQ;EAC1B,CAAA,GAEAA,EAAA,MAAA,kBAAwC;GACtC,KAAK,WAAW,SAAS;EAC3B,CAAA,GAEAA,EAAA,MAAA,eAA+B,MAAqC;GAClE,AAAIC,EAAM,aACR,KAAK,WAAW,UAAU;EAE9B,CAAA,GA1C6B,KAAA,MAAAC;CAAsB;CAGnD,UAAgB;EACd,AAAI,KAAK,cAGT,KAAK,YAAY,IACjB,KAAK,IAAI,KAAK,cAAc;GAAE,OAAO;GAAI,WAAW,YAAY,IAAI;EAAE,GACtE,KAAK,QAAQ,KAAK,IAAI,KAAK,WAC3B,SAAS,iBAAiB,oBAAoB,KAAK,YAAY,GAC/D,SAAS,iBAAiB,UAAU,KAAK,QAAQ,GACjD,SAAS,iBAAiB,UAAU,KAAK,QAAQ,GACjD,iBAAiB,YAAY,KAAK,UAAU,GAC5C,KAAK,aAAa;CACpB;CAGA,YAAkB;EAKhB,AAJA,KAAK,YAAY,IACjB,SAAS,oBAAoB,oBAAoB,KAAK,YAAY,GAClE,SAAS,oBAAoB,UAAU,KAAK,QAAQ,GACpD,SAAS,oBAAoB,UAAU,KAAK,QAAQ,GACpD,oBAAoB,YAAY,KAAK,UAAU;CACjD;CAqBA,WAAmB,GAAqB;EACtC,IAAI,CAAC,KAAK,aAAaC,MAAU,KAAK,MAAM,OAC1C;EAGF,IAAMC,IAAM,YAAY,IAAI,GACtBC,IAAW,KAAK,MAAM,OACtBC,IAAW,KAAK,IAAI,GAAGF,IAAM,KAAK,MAAM,SAAS;EAEvD,AADA,KAAK,MAAM,QAAQD,GACnB,KAAK,MAAM,YAAYC;EAEvB,IAAM,EAAE,qBAAkB,KAAK,IAAI;EACnC,AACE,KAAK,IAAI,WAAW,MAAM,MACzBN,EACC,KAAK,QACLS,EAAc,oBACd,KAAK,IAAI,aACT,oBACAA,EAAc,QAChB,KAKF,KAAK,IAAI,YAAY,MACnB,yBACA,yDACM;GACJ,KAAK,IAAI,OAAO,SAAS,gBAAgB;IACvC,mBAAmBJ;IACnB,4BAA4BE;IAC5B,yBAAyBC;GAC3B,CAAC;EACH,CACF;CACF;AACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./storm-BHgI12iS.cjs"),t=require("./defineProperty-X1c4tIPD.cjs");var n=class{constructor(e){t.t(this,`ctx`,void 0),t.t(this,`name`,`lifecycle`),t.t(this,`installed`,!1),t.t(this,`phase`,{state:``,enteredAt:0}),t.t(this,`window`,{start:0,count:0}),t.t(this,`onVisibility`,()=>{this.transition(document.visibilityState===`hidden`?`hidden`:`visible`)}),t.t(this,`onFreeze`,()=>{this.transition(`frozen`)}),t.t(this,`onResume`,()=>{this.transition(`resumed`)}),t.t(this,`onPageShow`,e=>{e.persisted&&this.transition(`restored`)}),this.ctx=e}install(){this.installed||(this.installed=!0,this.ctx.once.lifecycle??={state:``,enteredAt:performance.now()},this.phase=this.ctx.once.lifecycle,document.addEventListener(`visibilitychange`,this.onVisibility),document.addEventListener(`freeze`,this.onFreeze),document.addEventListener(`resume`,this.onResume),addEventListener(`pageshow`,this.onPageShow),this.onVisibility())}uninstall(){this.installed=!1,document.removeEventListener(`visibilitychange`,this.onVisibility),document.removeEventListener(`freeze`,this.onFreeze),document.removeEventListener(`resume`,this.onResume),removeEventListener(`pageshow`,this.onPageShow)}transition(t){if(!this.installed||t===this.phase.state)return;let n=performance.now(),r=this.phase.state,i=Math.max(0,n-this.phase.enteredAt);this.phase.state=t,this.phase.enteredAt=n;let{captureLimits:a}=this.ctx.config;this.ctx.isActive?.()!==!1&&e.t(this.window,a.lifecyclePerWindow,this.ctx.diagnostics,`lifecycle events`,a.windowMs)&&this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record a lifecycle event.`,()=>{this.ctx.logger.logEvent(`ui.lifecycle`,{"lifecycle.state":t,"lifecycle.previous_state":r,"lifecycle.duration_ms":i})})}};exports.LifecycleCapture=n;
|
|
2
|
+
//# sourceMappingURL=lifecycle-DaMdH_X7.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle-DaMdH_X7.cjs","names":["allowInWindow","require_storm","require_defineProperty","LifecycleCapture","event","ctx","state","now","previous","duration","captureLimits"],"sources":["../src/capture/lifecycle.ts"],"sourcesContent":["import { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext, CaptureOnce } from \"./types\";\n\n/** Records page state changes, each with how long the previous state lasted. */\nexport class LifecycleCapture implements Capture {\n readonly name = \"lifecycle\";\n\n private installed = false;\n\n private phase: NonNullable<CaptureOnce[\"lifecycle\"]> = { state: \"\", enteredAt: 0 };\n\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Installs the document and back-forward cache listeners. */\n install(): void {\n if (this.installed) {\n return;\n }\n this.installed = true;\n this.ctx.once.lifecycle ??= { state: \"\", enteredAt: performance.now() };\n this.phase = this.ctx.once.lifecycle;\n document.addEventListener(\"visibilitychange\", this.onVisibility);\n document.addEventListener(\"freeze\", this.onFreeze);\n document.addEventListener(\"resume\", this.onResume);\n addEventListener(\"pageshow\", this.onPageShow);\n this.onVisibility();\n }\n\n /** Removes all listeners. */\n uninstall(): void {\n this.installed = false;\n document.removeEventListener(\"visibilitychange\", this.onVisibility);\n document.removeEventListener(\"freeze\", this.onFreeze);\n document.removeEventListener(\"resume\", this.onResume);\n removeEventListener(\"pageshow\", this.onPageShow);\n }\n\n private readonly onVisibility = (): void => {\n this.transition(document.visibilityState === \"hidden\" ? \"hidden\" : \"visible\");\n };\n\n private readonly onFreeze = (): void => {\n this.transition(\"frozen\");\n };\n\n private readonly onResume = (): void => {\n this.transition(\"resumed\");\n };\n\n private readonly onPageShow = (event: PageTransitionEvent): void => {\n if (event.persisted) {\n this.transition(\"restored\");\n }\n };\n\n /** Updates the state even when the rate limit drops its event. */\n private transition(state: string): void {\n if (!this.installed || state === this.phase.state) {\n return;\n }\n\n const now = performance.now();\n const previous = this.phase.state;\n const duration = Math.max(0, now - this.phase.enteredAt);\n this.phase.state = state;\n this.phase.enteredAt = now;\n\n const { captureLimits } = this.ctx.config;\n if (\n this.ctx.isActive?.() === false ||\n !allowInWindow(\n this.window,\n captureLimits.lifecyclePerWindow,\n this.ctx.diagnostics,\n \"lifecycle events\",\n captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not record a lifecycle event.\",\n () => {\n this.ctx.logger.logEvent(\"ui.lifecycle\", {\n \"lifecycle.state\": state,\n \"lifecycle.previous_state\": previous,\n \"lifecycle.duration_ms\": duration,\n });\n },\n );\n }\n}\n"],"mappings":"A,mFAIA,IAAaG,EAAb,KAAiD,CAS/C,YAAY,EAAsC,CAArBD,EAAA,EAAA,KAAA,MAAA,IAAA,EAAA,EAR7BA,EAAA,EAAA,KAAA,OAAgB,WAAA,EAEhBA,EAAA,EAAA,KAAA,YAAoB,EAAA,EAEpBA,EAAA,EAAA,KAAA,QAAuD,CAAE,MAAO,GAAI,UAAW,CAAE,CAAA,EAEjFA,EAAA,EAAA,KAAA,SAAuC,CAAE,MAAO,EAAG,MAAO,CAAE,CAAA,EA4B5DA,EAAA,EAAA,KAAA,mBAA4C,CAC1C,KAAK,WAAW,SAAS,kBAAoB,SAAW,SAAW,SAAS,CAC9E,CAAA,EAEAA,EAAA,EAAA,KAAA,eAAwC,CACtC,KAAK,WAAW,QAAQ,CAC1B,CAAA,EAEAA,EAAA,EAAA,KAAA,eAAwC,CACtC,KAAK,WAAW,SAAS,CAC3B,CAAA,EAEAA,EAAA,EAAA,KAAA,aAA+B,GAAqC,CAC9DE,EAAM,WACR,KAAK,WAAW,UAAU,CAE9B,CAAA,EA1C6B,KAAA,IAAAC,CAAsB,CAGnD,SAAgB,CACV,KAAK,YAGT,KAAK,UAAY,GACjB,KAAK,IAAI,KAAK,YAAc,CAAE,MAAO,GAAI,UAAW,YAAY,IAAI,CAAE,EACtE,KAAK,MAAQ,KAAK,IAAI,KAAK,UAC3B,SAAS,iBAAiB,mBAAoB,KAAK,YAAY,EAC/D,SAAS,iBAAiB,SAAU,KAAK,QAAQ,EACjD,SAAS,iBAAiB,SAAU,KAAK,QAAQ,EACjD,iBAAiB,WAAY,KAAK,UAAU,EAC5C,KAAK,aAAa,EACpB,CAGA,WAAkB,CAChB,KAAK,UAAY,GACjB,SAAS,oBAAoB,mBAAoB,KAAK,YAAY,EAClE,SAAS,oBAAoB,SAAU,KAAK,QAAQ,EACpD,SAAS,oBAAoB,SAAU,KAAK,QAAQ,EACpD,oBAAoB,WAAY,KAAK,UAAU,CACjD,CAqBA,WAAmB,EAAqB,CACtC,GAAI,CAAC,KAAK,WAAaC,IAAU,KAAK,MAAM,MAC1C,OAGF,IAAMC,EAAM,YAAY,IAAI,EACtBC,EAAW,KAAK,MAAM,MACtBC,EAAW,KAAK,IAAI,EAAGF,EAAM,KAAK,MAAM,SAAS,EACvD,KAAK,MAAM,MAAQD,EACnB,KAAK,MAAM,UAAYC,EAEvB,GAAM,CAAE,iBAAkB,KAAK,IAAI,OAEjC,KAAK,IAAI,WAAW,IAAM,IACzBP,EAAAA,EACC,KAAK,OACLU,EAAc,mBACd,KAAK,IAAI,YACT,mBACAA,EAAc,QAChB,GAKF,KAAK,IAAI,YAAY,MACnB,wBACA,sDACM,CACJ,KAAK,IAAI,OAAO,SAAS,eAAgB,CACvC,kBAAmBJ,EACnB,2BAA4BE,EAC5B,wBAAyBC,CAC3B,CAAC,CACH,CACF,CACF,CACF,E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./constants-CtF52hIV.cjs"),t=require("./guards-EjG3ahFp.cjs");function n(){return`${String(Date.now())}000000`}function r(n){return typeof n==`string`&&t.t(e.At,n)}function i(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.body==`string`&&typeof t.severityText==`string`&&typeof t.timeUnixNano==`string`&&typeof t.attributes==`object`&&t.attributes!==null&&typeof t.resource==`object`&&t.resource!==null}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return r}});
|
|
2
|
+
//# sourceMappingURL=log-record-Bmx6etMh.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-record-Bmx6etMh.cjs","names":["hasOwn","LEVEL_ORDER","require_constants","require_guards","nowUnixNano","isLogLevel","value","isLogRecord","record"],"sources":["../src/models/log-record.ts"],"sourcesContent":["// src/models/log-record.ts\n//\n// Shape of one log record, plus helpers for building and validating it.\n//\n// The severity tables live in `src/constants.ts`.\n\nimport { LEVEL_ORDER } from \"../constants\";\nimport { hasOwn } from \"../utils/guards\";\n\n/** OpenTelemetry severity levels, in ascending order. */\nexport type LogLevel = \"TRACE\" | \"DEBUG\" | \"INFO\" | \"WARN\" | \"ERROR\" | \"FATAL\";\n\n/**\n * What a record is about. `action` is something a person did, `event` is something the\n * application did, and `metric` is a measurement. `log` is an application log call,\n * `system` is this library's own output and `span` is one span of a trace.\n */\nexport type LogType = \"action\" | \"event\" | \"metric\" | \"log\" | \"system\" | \"span\";\n\n/** Metric value type: level, running total, or distribution. */\nexport type MetricType = \"gauge\" | \"counter\" | \"histogram\";\n\n/** Internal record shape. A serializer converts it to the payload format. */\nexport interface LogRecord {\n /**\n * Event time, nanoseconds since epoch, as a decimal string.\n * @see {@link nowUnixNano}\n */\n timeUnixNano: string;\n /**\n * When this library received the event, if that differs from `timeUnixNano`. A forwarded\n * record, for example, can have a different time.\n */\n observedTimeUnixNano?: string;\n /** Distributed trace id. */\n traceId: string;\n /** Span id within the trace. */\n spanId: string;\n /** OpenTelemetry trace flags. The library uses only the sampled bit. */\n traceFlags: number;\n /** OpenTelemetry severity number for `severityText`. */\n severityNumber: number;\n /** Log level. */\n severityText: LogLevel;\n /** Log message. */\n body: string;\n /** Structured attributes, sanitized and size-capped. */\n attributes: Record<string, unknown>;\n /** Resource attributes, shared by every record from one context. */\n resource: Record<string, unknown>;\n}\n\n/**\n * Returns the current time as a Unix nanosecond timestamp. Appends zeros instead of\n * multiplying, because `Date.now() * 1e6` exceeds `Number.MAX_SAFE_INTEGER` and corrupts\n * digits without an error. The trailing zeros mean unknown precision, not measured digits.\n * @returns Epoch timestamp in nanoseconds, as a decimal string.\n */\nexport function nowUnixNano(): string {\n return `${String(Date.now())}000000`;\n}\n\n/**\n * Checks whether a value is a known log level. The own-key check rejects \"toString\".\n * @param value The value to check.\n * @returns True if `value` is a key of the severity table.\n */\nexport function isLogLevel(value: unknown): value is LogLevel {\n return typeof value === \"string\" && hasOwn(LEVEL_ORDER, value);\n}\n\n/**\n * Checks whether a value has the shape `LogRecord` requires. Use it to validate records from\n * another realm, because a malformed record throws during serialization. Any string is\n * accepted as `severityText`, not only a known level, so an unknown level from a newer\n * version still passes.\n * @param value The value to check.\n * @returns True if `value` has the shape `LogRecord` requires.\n */\nexport function isLogRecord(value: unknown): value is LogRecord {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n // Cast to `Record<string, unknown>`, not `Partial<LogRecord>`. With the partial type the\n // compiler treats these fields as never null, so the checks below would look unnecessary.\n const record = value as Record<string, unknown>;\n return (\n typeof record.body === \"string\" &&\n typeof record.severityText === \"string\" &&\n typeof record.timeUnixNano === \"string\" &&\n typeof record.attributes === \"object\" &&\n record.attributes !== null &&\n typeof record.resource === \"object\" &&\n record.resource !== null\n );\n}\n"],"mappings":"A,+EA0DA,SAAgBI,GAAsB,CACpC,MAAO,GAAG,OAAO,KAAK,IAAI,CAAC,EAAE,OAC/B,CAOA,SAAgBC,EAAW,EAAmC,CAC5D,OAAO,OAAOC,GAAU,UAAYN,EAAAA,EAAOC,EAAAA,GAAaK,CAAK,CAC/D,CAUA,SAAgBC,EAAY,EAAoC,CAC9D,GAAI,OAAOD,GAAU,WAAYA,EAC/B,MAAO,GAIT,IAAME,EAASF,EACf,OACE,OAAOE,EAAO,MAAS,UACvB,OAAOA,EAAO,cAAiB,UAC/B,OAAOA,EAAO,cAAiB,UAC/B,OAAOA,EAAO,YAAe,UAC7BA,EAAO,aAAe,MACtB,OAAOA,EAAO,UAAa,UAC3BA,EAAO,WAAa,IAExB,C"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { At as e } from "./constants-BwJDXzj6.js";
|
|
2
|
+
import { t } from "./guards-BlYGRK4l.js";
|
|
2
3
|
// src/models/log-record.ts
|
|
3
|
-
function
|
|
4
|
+
function n() {
|
|
4
5
|
return `${String(Date.now())}000000`;
|
|
5
6
|
}
|
|
6
|
-
function n
|
|
7
|
-
return typeof
|
|
7
|
+
function r(n) {
|
|
8
|
+
return typeof n == "string" && t(e, n);
|
|
8
9
|
}
|
|
9
|
-
function
|
|
10
|
+
function i(e) {
|
|
10
11
|
if (typeof e != "object" || !e) return !1;
|
|
11
12
|
let t = e;
|
|
12
13
|
return typeof t.body == "string" && typeof t.severityText == "string" && typeof t.timeUnixNano == "string" && typeof t.attributes == "object" && t.attributes !== null && typeof t.resource == "object" && t.resource !== null;
|
|
13
14
|
}
|
|
14
|
-
export {
|
|
15
|
+
export { i as n, n as r, r as t };
|
|
15
16
|
|
|
16
|
-
//# sourceMappingURL=log-record-
|
|
17
|
+
//# sourceMappingURL=log-record-DSt2P-Sr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-record-DSt2P-Sr.js","names":["LEVEL_ORDER","nowUnixNano","isLogLevel","value","hasOwn","isLogRecord","record"],"sources":["../src/models/log-record.ts"],"sourcesContent":["// src/models/log-record.ts\n//\n// Shape of one log record, plus helpers for building and validating it.\n//\n// The severity tables live in `src/constants.ts`.\n\nimport { LEVEL_ORDER } from \"../constants\";\nimport { hasOwn } from \"../utils/guards\";\n\n/** OpenTelemetry severity levels, in ascending order. */\nexport type LogLevel = \"TRACE\" | \"DEBUG\" | \"INFO\" | \"WARN\" | \"ERROR\" | \"FATAL\";\n\n/**\n * What a record is about. `action` is something a person did, `event` is something the\n * application did, and `metric` is a measurement. `log` is an application log call,\n * `system` is this library's own output and `span` is one span of a trace.\n */\nexport type LogType = \"action\" | \"event\" | \"metric\" | \"log\" | \"system\" | \"span\";\n\n/** Metric value type: level, running total, or distribution. */\nexport type MetricType = \"gauge\" | \"counter\" | \"histogram\";\n\n/** Internal record shape. A serializer converts it to the payload format. */\nexport interface LogRecord {\n /**\n * Event time, nanoseconds since epoch, as a decimal string.\n * @see {@link nowUnixNano}\n */\n timeUnixNano: string;\n /**\n * When this library received the event, if that differs from `timeUnixNano`. A forwarded\n * record, for example, can have a different time.\n */\n observedTimeUnixNano?: string;\n /** Distributed trace id. */\n traceId: string;\n /** Span id within the trace. */\n spanId: string;\n /** OpenTelemetry trace flags. The library uses only the sampled bit. */\n traceFlags: number;\n /** OpenTelemetry severity number for `severityText`. */\n severityNumber: number;\n /** Log level. */\n severityText: LogLevel;\n /** Log message. */\n body: string;\n /** Structured attributes, sanitized and size-capped. */\n attributes: Record<string, unknown>;\n /** Resource attributes, shared by every record from one context. */\n resource: Record<string, unknown>;\n}\n\n/**\n * Returns the current time as a Unix nanosecond timestamp. Appends zeros instead of\n * multiplying, because `Date.now() * 1e6` exceeds `Number.MAX_SAFE_INTEGER` and corrupts\n * digits without an error. The trailing zeros mean unknown precision, not measured digits.\n * @returns Epoch timestamp in nanoseconds, as a decimal string.\n */\nexport function nowUnixNano(): string {\n return `${String(Date.now())}000000`;\n}\n\n/**\n * Checks whether a value is a known log level. The own-key check rejects \"toString\".\n * @param value The value to check.\n * @returns True if `value` is a key of the severity table.\n */\nexport function isLogLevel(value: unknown): value is LogLevel {\n return typeof value === \"string\" && hasOwn(LEVEL_ORDER, value);\n}\n\n/**\n * Checks whether a value has the shape `LogRecord` requires. Use it to validate records from\n * another realm, because a malformed record throws during serialization. Any string is\n * accepted as `severityText`, not only a known level, so an unknown level from a newer\n * version still passes.\n * @param value The value to check.\n * @returns True if `value` has the shape `LogRecord` requires.\n */\nexport function isLogRecord(value: unknown): value is LogRecord {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n // Cast to `Record<string, unknown>`, not `Partial<LogRecord>`. With the partial type the\n // compiler treats these fields as never null, so the checks below would look unnecessary.\n const record = value as Record<string, unknown>;\n return (\n typeof record.body === \"string\" &&\n typeof record.severityText === \"string\" &&\n typeof record.timeUnixNano === \"string\" &&\n typeof record.attributes === \"object\" &&\n record.attributes !== null &&\n typeof record.resource === \"object\" &&\n record.resource !== null\n );\n}\n"],"mappings":";;;AA0DA,SAAgBC,IAAsB;CACpC,OAAO,GAAG,OAAO,KAAK,IAAI,CAAC,EAAE;AAC/B;AAOA,SAAgBC,EAAW,GAAmC;CAC5D,OAAO,OAAOC,KAAU,YAAYC,EAAOJ,GAAaG,CAAK;AAC/D;AAUA,SAAgBE,EAAY,GAAoC;CAC9D,IAAI,OAAOF,KAAU,aAAYA,GAC/B,OAAO;CAIT,IAAMG,IAASH;CACf,OACE,OAAOG,EAAO,QAAS,YACvB,OAAOA,EAAO,gBAAiB,YAC/B,OAAOA,EAAO,gBAAiB,YAC/B,OAAOA,EAAO,cAAe,YAC7BA,EAAO,eAAe,QACtB,OAAOA,EAAO,YAAa,YAC3BA,EAAO,aAAa;AAExB"}
|
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
import { i as e } from "./platform-
|
|
2
|
-
import { t } from "./storm-
|
|
1
|
+
import { i as e } from "./platform-8DLhjddo.js";
|
|
2
|
+
import { t } from "./storm-DKlpv0FL.js";
|
|
3
|
+
import { t as n } from "./defineProperty-s2S8BXUc.js";
|
|
3
4
|
// src/capture/long-frames.ts
|
|
4
|
-
var
|
|
5
|
-
function
|
|
5
|
+
var r = ["long-animation-frame", "longtask"];
|
|
6
|
+
function i(e) {
|
|
6
7
|
let t;
|
|
7
8
|
for (let n of e ?? []) (!t || n.duration > t.duration) && (t = n);
|
|
8
9
|
return t;
|
|
9
10
|
}
|
|
10
|
-
var
|
|
11
|
-
ctx;
|
|
12
|
-
name = "long-frames";
|
|
13
|
-
observer;
|
|
14
|
-
window = {
|
|
15
|
-
start: 0,
|
|
16
|
-
count: 0
|
|
17
|
-
};
|
|
18
|
-
threshold = 100;
|
|
11
|
+
var a = class {
|
|
19
12
|
constructor(e) {
|
|
20
|
-
this
|
|
13
|
+
n(this, "ctx", void 0), n(this, "name", "long-frames"), n(this, "observer", void 0), n(this, "window", {
|
|
14
|
+
start: 0,
|
|
15
|
+
count: 0
|
|
16
|
+
}), n(this, "threshold", 100), this.ctx = e;
|
|
21
17
|
}
|
|
22
18
|
install() {
|
|
23
19
|
if (this.observer) return;
|
|
24
20
|
let { once: e } = this.ctx, t = !e.longFrames;
|
|
25
21
|
e.longFrames = !0;
|
|
26
|
-
let
|
|
22
|
+
let n = typeof PerformanceObserver > "u" ? void 0 : PerformanceObserver.supportedEntryTypes, i = r.find((e) => n?.includes(e));
|
|
27
23
|
if (i === void 0) {
|
|
28
24
|
if (!t) return;
|
|
29
25
|
this.ctx.diagnostics.report("capture.install_failed", "The browser does not report long frames. The long frame capture is off.");
|
|
@@ -40,16 +36,16 @@ var i = class {
|
|
|
40
36
|
this.observer?.disconnect(), this.observer = void 0;
|
|
41
37
|
}
|
|
42
38
|
readThreshold() {
|
|
43
|
-
let e = this.ctx.config.capture.
|
|
44
|
-
return typeof
|
|
39
|
+
let { longFrames: e } = this.ctx.config.capture, t = typeof e == "object" ? e.thresholdMs : 100;
|
|
40
|
+
return typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : (this.ctx.diagnostics.report("config.invalid", "capture.longFrames.thresholdMs must be a number of 0 or more. The library uses 100."), 100);
|
|
45
41
|
}
|
|
46
42
|
record(n) {
|
|
47
43
|
if (n.duration < this.threshold) return;
|
|
48
|
-
let { diagnostics:
|
|
49
|
-
if (!t(this.window, this.ctx.config.
|
|
44
|
+
let { diagnostics: r } = this.ctx;
|
|
45
|
+
if (!t(this.window, this.ctx.config.captureLimits.longFramesPerWindow, r, "long frames", this.ctx.config.captureLimits.windowMs)) return;
|
|
50
46
|
let a = Math.round(n.duration), o = { "frame.type": n.entryType };
|
|
51
47
|
n.blockingDuration !== void 0 && (o["frame.blocking_ms"] = Math.round(n.blockingDuration));
|
|
52
|
-
let s =
|
|
48
|
+
let s = i(n.scripts), c = (t) => e(t, this.ctx.config.capture.fullUrls, this.ctx.config.capture.urlTransform, r);
|
|
53
49
|
if (s?.invoker) {
|
|
54
50
|
let { invoker: e } = s;
|
|
55
51
|
o["frame.script.invoker"] = e.includes("://") ? c(e) : e;
|
|
@@ -61,6 +57,6 @@ var i = class {
|
|
|
61
57
|
}), this.ctx.logger.logMetric("ui.long_frame.duration", a, "ms", "histogram", o);
|
|
62
58
|
}
|
|
63
59
|
};
|
|
64
|
-
export {
|
|
60
|
+
export { a as LongFrameCapture };
|
|
65
61
|
|
|
66
|
-
//# sourceMappingURL=long-frames-
|
|
62
|
+
//# sourceMappingURL=long-frames-Bamjs1WV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"long-frames-Bamjs1WV.js","names":["recordedUrl","_defineProperty","FRAME_TYPES","longestScript","longest","script","scripts","LongFrameCapture","ctx","first","once","supported","type","name","entry","list","value","longFrames","allowInWindow","diagnostics","duration","attrs","url","invoker"],"sources":["../src/capture/long-frames.ts"],"sourcesContent":["// src/capture/long-frames.ts\n//\n// Reports long animation frames. A long frame can freeze the page with no user input involved,\n// for example a grid that re-renders 5,000 rows, and INP never shows that.\n\nimport { LONG_FRAME_THRESHOLD_MS } from \"../constants\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** The entry types this capture can observe, best first. */\nconst FRAME_TYPES = [\"long-animation-frame\", \"longtask\"];\n\n/** One script in a long animation frame. Some versions of the DOM types don't declare it. */\ninterface FrameScript {\n /** How long the script ran, in milliseconds. */\n duration: number;\n /** What called the script, for example an event listener or a timer. */\n invoker?: string;\n /** URL of the script's source. */\n sourceURL?: string;\n}\n\n/** A long animation frame or a long task. A long task has no blocking time and no scripts. */\ninterface FrameEntry extends PerformanceEntry {\n /** How long the frame blocked input, in milliseconds. */\n blockingDuration?: number;\n /** Scripts that ran in the frame. */\n scripts?: FrameScript[];\n}\n\n/**\n * Finds the script that ran longest in a frame.\n * @param scripts The frame's scripts.\n * @returns The longest script, or undefined if the frame has none.\n */\nfunction longestScript(scripts: FrameScript[] | undefined): FrameScript | undefined {\n let longest: FrameScript | undefined;\n\n for (const script of scripts ?? []) {\n if (!longest || script.duration > longest.duration) {\n longest = script;\n }\n }\n\n return longest;\n}\n\n/** Records every long animation frame as a histogram metric and a breadcrumb. */\nexport class LongFrameCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"long-frames\";\n\n /** Active observer. Undefined while the capture isn't installed. */\n private observer: PerformanceObserver | undefined;\n\n /** This capture's own rate limit, so a frozen tab can't flood the pipeline. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /** Minimum frame duration to record, in milliseconds. */\n private threshold = LONG_FRAME_THRESHOLD_MS;\n\n /**\n * @param ctx Capture context: configuration, diagnostics, logger and breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Observes the best entry type the browser supports. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n // Only the first install in a document reads buffered frames or reports missing support,\n // so a reinstall after configure() doesn't repeat either.\n const { once } = this.ctx;\n const first = !once.longFrames;\n once.longFrames = true;\n\n // Older browsers have no supportedEntryTypes, and the capture stays off there.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n const type = FRAME_TYPES.find((name) => supported?.includes(name));\n\n if (type === undefined) {\n if (!first) {\n return;\n }\n\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report long frames. The long frame capture is off.\",\n );\n return;\n }\n\n this.threshold = this.readThreshold();\n this.observer = new PerformanceObserver((list) => {\n // The browser calls this directly, so anything we throw is an uncaught error on the page.\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not record a long frame.\",\n () => {\n for (const entry of list.getEntries()) {\n this.record(entry);\n }\n },\n );\n });\n\n // Buffered frames include the first render, which happens before this chunk loads.\n this.observer.observe({ type, buffered: first });\n }\n\n /** Disconnects the observer. */\n uninstall(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n /**\n * Reads the threshold from the configuration and reports a value it can't use.\n * @returns Minimum frame duration to record, in milliseconds.\n */\n private readThreshold(): number {\n const { longFrames } = this.ctx.config.capture;\n const value: unknown =\n typeof longFrames === \"object\" ? longFrames.thresholdMs : LONG_FRAME_THRESHOLD_MS;\n\n if (typeof value === \"number\" && Number.isFinite(value) && value >= 0) {\n return value;\n }\n\n this.ctx.diagnostics.report(\n \"config.invalid\",\n `capture.longFrames.thresholdMs must be a number of 0 or more. The library uses ${String(LONG_FRAME_THRESHOLD_MS)}.`,\n );\n return LONG_FRAME_THRESHOLD_MS;\n }\n\n /**\n * Records one frame at or above the threshold.\n * @param entry Long animation frame or long task entry.\n */\n private record(entry: FrameEntry): void {\n if (entry.duration < this.threshold) {\n return;\n }\n\n const { diagnostics } = this.ctx;\n\n if (\n !allowInWindow(\n this.window,\n this.ctx.config.captureLimits.longFramesPerWindow,\n diagnostics,\n \"long frames\",\n this.ctx.config.captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n const duration = Math.round(entry.duration);\n const attrs: Record<string, unknown> = { \"frame.type\": entry.entryType };\n\n if (entry.blockingDuration !== undefined) {\n attrs[\"frame.blocking_ms\"] = Math.round(entry.blockingDuration);\n }\n\n const script = longestScript(entry.scripts);\n\n // A signed URL is a credential. Only keep the query when fullUrls is on.\n const url = (value: string): string =>\n recordedUrl(\n value,\n this.ctx.config.capture.fullUrls,\n this.ctx.config.capture.urlTransform,\n diagnostics,\n );\n\n if (script?.invoker) {\n // A script entry's invoker is the script URL. Other invokers, for example\n // \"IMG#hero.onload\", contain a \"#\" that isn't a fragment.\n const { invoker } = script;\n attrs[\"frame.script.invoker\"] = invoker.includes(\"://\") ? url(invoker) : invoker;\n }\n\n if (script?.sourceURL) {\n attrs[\"frame.script.source\"] = url(script.sourceURL);\n }\n\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"frame\",\n message: `long frame ${String(duration)} ms`,\n });\n this.ctx.logger.logMetric(\"ui.long_frame.duration\", duration, \"ms\", \"histogram\", attrs);\n }\n}\n"],"mappings":";;;;AAWA,IAAME,IAAc,CAAC,wBAAwB,UAAU;AAyBvD,SAASC,EAAc,GAA6D;CAClF,IAAIC;CAEJ,KAAK,IAAMC,KAAUC,KAAW,CAAC,GAC/B,CAAI,CAACF,KAAWC,EAAO,WAAWD,EAAQ,cACxC,IAAUC;CAId,OAAOD;AACT;AAGA,IAAaG,IAAb,MAAiD;CAgB/C,YAAY,GAAsC;EAArB,AAAAN,EAAA,MAAA,OAAA,KAAA,CAAA,GAd7BA,EAAA,MAAA,QAAgB,aAAA,GAGhBA,EAAA,MAAA,YAAA,KAAA,CAAA,GAGAA,EAAA,MAAA,UAAuC;GAAE,OAAO;GAAG,OAAO;EAAE,CAAA,GAG5DA,EAAA,MAAA,aAAA,GAAA,GAK6B,KAAA,MAAAO;CAAsB;CAGnD,UAAgB;EACd,IAAI,KAAK,UACP;EAKF,IAAM,EAAE,YAAS,KAAK,KAChBC,IAAQ,CAACC,EAAK;EACpB,EAAK,aAAa;EAGlB,IAAMC,IACJ,OAAO,sBAAwB,MAC3B,KAAA,IACA,oBAAoB,qBACpBC,IAAOV,EAAY,MAAM,MAASS,GAAW,SAASE,CAAI,CAAC;EAEjE,IAAID,MAAS,KAAA,GAAW;GACtB,IAAI,CAACH,GACH;GAGF,KAAK,IAAI,YAAY,OACnB,0BACA,yEACF;EAEF,OAiBA,AAfA,KAAK,YAAY,KAAK,cAAc,GACpC,KAAK,WAAW,IAAI,qBAAqB,MAAS;GAEhD,KAAK,IAAI,YAAY,MACnB,yBACA,oDACM;IACJ,KAAK,IAAMK,KAASC,EAAK,WAAW,GAClC,KAAK,OAAOD,CAAK;GAErB,CACF;EACF,CAAC,GAGD,KAAK,SAAS,QAAQ;GAAE;GAAM,UAAUL;EAAM,CAAC;CACjD;CAGA,YAAkB;EAEhB,AADA,KAAK,UAAU,WAAW,GAC1B,KAAK,WAAW,KAAA;CAClB;CAMA,gBAAgC;EAC9B,IAAM,EAAE,kBAAe,KAAK,IAAI,OAAO,SACjCO,IACJ,OAAOC,KAAe,WAAWA,EAAW,cAAA;EAU9C,OARI,OAAOD,KAAU,YAAY,OAAO,SAASA,CAAK,KAAKA,KAAS,IAC3DA,KAGT,KAAK,IAAI,YAAY,OACnB,kBACA,qFACF,GACA;CACF;CAMA,OAAe,GAAyB;EACtC,IAAIF,EAAM,WAAW,KAAK,WACxB;EAGF,IAAM,EAAE,mBAAgB,KAAK;EAE7B,IACE,CAACI,EACC,KAAK,QACL,KAAK,IAAI,OAAO,cAAc,qBAC9BC,GACA,eACA,KAAK,IAAI,OAAO,cAAc,QAChC,GAEA;EAGF,IAAMC,IAAW,KAAK,MAAMN,EAAM,QAAQ,GACpCO,IAAiC,EAAE,cAAcP,EAAM,UAAU;EAEvE,AAAIA,EAAM,qBAAqB,KAAA,MAC7B,EAAM,uBAAuB,KAAK,MAAMA,EAAM,gBAAgB;EAGhE,IAAMT,IAASF,EAAcW,EAAM,OAAO,GAGpCQ,KAAO,MACXtB,EACEgB,GACA,KAAK,IAAI,OAAO,QAAQ,UACxB,KAAK,IAAI,OAAO,QAAQ,cACxBG,CACF;EAEF,IAAId,GAAQ,SAAS;GAGnB,IAAM,EAAE,eAAYA;GACpB,EAAM,0BAA0BkB,EAAQ,SAAS,KAAK,IAAID,EAAIC,CAAO,IAAIA;EAC3E;EAWA,AATIlB,GAAQ,cACV,EAAM,yBAAyBiB,EAAIjB,EAAO,SAAS,IAGrD,KAAK,IAAI,YAAY,KAAK;GACxB,GAAG,KAAK,IAAI;GACZ,UAAU;GACV,SAAS,cAAc,OAAOe,CAAQ,EAAE;EAC1C,CAAC,GACD,KAAK,IAAI,OAAO,UAAU,0BAA0BA,GAAU,MAAM,aAAaC,CAAK;CACxF;AACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./platform-BqRc-7RO.cjs"),t=require("./storm-BHgI12iS.cjs"),n=require("./defineProperty-X1c4tIPD.cjs");var r=[`long-animation-frame`,`longtask`];function i(e){let t;for(let n of e??[])(!t||n.duration>t.duration)&&(t=n);return t}var a=class{constructor(e){n.t(this,`ctx`,void 0),n.t(this,`name`,`long-frames`),n.t(this,`observer`,void 0),n.t(this,`window`,{start:0,count:0}),n.t(this,`threshold`,100),this.ctx=e}install(){if(this.observer)return;let{once:e}=this.ctx,t=!e.longFrames;e.longFrames=!0;let n=typeof PerformanceObserver>`u`?void 0:PerformanceObserver.supportedEntryTypes,i=r.find(e=>n?.includes(e));if(i===void 0){if(!t)return;this.ctx.diagnostics.report(`capture.install_failed`,`The browser does not report long frames. The long frame capture is off.`)}else this.threshold=this.readThreshold(),this.observer=new PerformanceObserver(e=>{this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record a long frame.`,()=>{for(let t of e.getEntries())this.record(t)})}),this.observer.observe({type:i,buffered:t})}uninstall(){this.observer?.disconnect(),this.observer=void 0}readThreshold(){let{longFrames:e}=this.ctx.config.capture,t=typeof e==`object`?e.thresholdMs:100;return typeof t==`number`&&Number.isFinite(t)&&t>=0?t:(this.ctx.diagnostics.report(`config.invalid`,`capture.longFrames.thresholdMs must be a number of 0 or more. The library uses 100.`),100)}record(n){if(n.duration<this.threshold)return;let{diagnostics:r}=this.ctx;if(!t.t(this.window,this.ctx.config.captureLimits.longFramesPerWindow,r,`long frames`,this.ctx.config.captureLimits.windowMs))return;let a=Math.round(n.duration),o={"frame.type":n.entryType};n.blockingDuration!==void 0&&(o[`frame.blocking_ms`]=Math.round(n.blockingDuration));let s=i(n.scripts),c=t=>e.i(t,this.ctx.config.capture.fullUrls,this.ctx.config.capture.urlTransform,r);if(s?.invoker){let{invoker:e}=s;o[`frame.script.invoker`]=e.includes(`://`)?c(e):e}s?.sourceURL&&(o[`frame.script.source`]=c(s.sourceURL)),this.ctx.breadcrumbs.push({t:Date.now(),category:`frame`,message:`long frame ${String(a)} ms`}),this.ctx.logger.logMetric(`ui.long_frame.duration`,a,`ms`,`histogram`,o)}};exports.LongFrameCapture=a;
|
|
2
|
+
//# sourceMappingURL=long-frames-lhtONgGt.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"long-frames-lhtONgGt.cjs","names":["allowInWindow","recordedUrl","require_platform","require_storm","require_defineProperty","FRAME_TYPES","longestScript","longest","script","scripts","LongFrameCapture","ctx","first","once","supported","type","name","entry","list","value","longFrames","diagnostics","duration","attrs","url","invoker"],"sources":["../src/capture/long-frames.ts"],"sourcesContent":["// src/capture/long-frames.ts\n//\n// Reports long animation frames. A long frame can freeze the page with no user input involved,\n// for example a grid that re-renders 5,000 rows, and INP never shows that.\n\nimport { LONG_FRAME_THRESHOLD_MS } from \"../constants\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** The entry types this capture can observe, best first. */\nconst FRAME_TYPES = [\"long-animation-frame\", \"longtask\"];\n\n/** One script in a long animation frame. Some versions of the DOM types don't declare it. */\ninterface FrameScript {\n /** How long the script ran, in milliseconds. */\n duration: number;\n /** What called the script, for example an event listener or a timer. */\n invoker?: string;\n /** URL of the script's source. */\n sourceURL?: string;\n}\n\n/** A long animation frame or a long task. A long task has no blocking time and no scripts. */\ninterface FrameEntry extends PerformanceEntry {\n /** How long the frame blocked input, in milliseconds. */\n blockingDuration?: number;\n /** Scripts that ran in the frame. */\n scripts?: FrameScript[];\n}\n\n/**\n * Finds the script that ran longest in a frame.\n * @param scripts The frame's scripts.\n * @returns The longest script, or undefined if the frame has none.\n */\nfunction longestScript(scripts: FrameScript[] | undefined): FrameScript | undefined {\n let longest: FrameScript | undefined;\n\n for (const script of scripts ?? []) {\n if (!longest || script.duration > longest.duration) {\n longest = script;\n }\n }\n\n return longest;\n}\n\n/** Records every long animation frame as a histogram metric and a breadcrumb. */\nexport class LongFrameCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"long-frames\";\n\n /** Active observer. Undefined while the capture isn't installed. */\n private observer: PerformanceObserver | undefined;\n\n /** This capture's own rate limit, so a frozen tab can't flood the pipeline. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /** Minimum frame duration to record, in milliseconds. */\n private threshold = LONG_FRAME_THRESHOLD_MS;\n\n /**\n * @param ctx Capture context: configuration, diagnostics, logger and breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Observes the best entry type the browser supports. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n // Only the first install in a document reads buffered frames or reports missing support,\n // so a reinstall after configure() doesn't repeat either.\n const { once } = this.ctx;\n const first = !once.longFrames;\n once.longFrames = true;\n\n // Older browsers have no supportedEntryTypes, and the capture stays off there.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n const type = FRAME_TYPES.find((name) => supported?.includes(name));\n\n if (type === undefined) {\n if (!first) {\n return;\n }\n\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report long frames. The long frame capture is off.\",\n );\n return;\n }\n\n this.threshold = this.readThreshold();\n this.observer = new PerformanceObserver((list) => {\n // The browser calls this directly, so anything we throw is an uncaught error on the page.\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not record a long frame.\",\n () => {\n for (const entry of list.getEntries()) {\n this.record(entry);\n }\n },\n );\n });\n\n // Buffered frames include the first render, which happens before this chunk loads.\n this.observer.observe({ type, buffered: first });\n }\n\n /** Disconnects the observer. */\n uninstall(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n /**\n * Reads the threshold from the configuration and reports a value it can't use.\n * @returns Minimum frame duration to record, in milliseconds.\n */\n private readThreshold(): number {\n const { longFrames } = this.ctx.config.capture;\n const value: unknown =\n typeof longFrames === \"object\" ? longFrames.thresholdMs : LONG_FRAME_THRESHOLD_MS;\n\n if (typeof value === \"number\" && Number.isFinite(value) && value >= 0) {\n return value;\n }\n\n this.ctx.diagnostics.report(\n \"config.invalid\",\n `capture.longFrames.thresholdMs must be a number of 0 or more. The library uses ${String(LONG_FRAME_THRESHOLD_MS)}.`,\n );\n return LONG_FRAME_THRESHOLD_MS;\n }\n\n /**\n * Records one frame at or above the threshold.\n * @param entry Long animation frame or long task entry.\n */\n private record(entry: FrameEntry): void {\n if (entry.duration < this.threshold) {\n return;\n }\n\n const { diagnostics } = this.ctx;\n\n if (\n !allowInWindow(\n this.window,\n this.ctx.config.captureLimits.longFramesPerWindow,\n diagnostics,\n \"long frames\",\n this.ctx.config.captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n const duration = Math.round(entry.duration);\n const attrs: Record<string, unknown> = { \"frame.type\": entry.entryType };\n\n if (entry.blockingDuration !== undefined) {\n attrs[\"frame.blocking_ms\"] = Math.round(entry.blockingDuration);\n }\n\n const script = longestScript(entry.scripts);\n\n // A signed URL is a credential. Only keep the query when fullUrls is on.\n const url = (value: string): string =>\n recordedUrl(\n value,\n this.ctx.config.capture.fullUrls,\n this.ctx.config.capture.urlTransform,\n diagnostics,\n );\n\n if (script?.invoker) {\n // A script entry's invoker is the script URL. Other invokers, for example\n // \"IMG#hero.onload\", contain a \"#\" that isn't a fragment.\n const { invoker } = script;\n attrs[\"frame.script.invoker\"] = invoker.includes(\"://\") ? url(invoker) : invoker;\n }\n\n if (script?.sourceURL) {\n attrs[\"frame.script.source\"] = url(script.sourceURL);\n }\n\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"frame\",\n message: `long frame ${String(duration)} ms`,\n });\n this.ctx.logger.logMetric(\"ui.long_frame.duration\", duration, \"ms\", \"histogram\", attrs);\n }\n}\n"],"mappings":"A,wHAWA,IAAMK,EAAc,CAAC,uBAAwB,UAAU,EAyBvD,SAASC,EAAc,EAA6D,CAClF,IAAIC,EAEJ,IAAK,IAAMC,KAAUC,GAAW,CAAC,GAC3B,CAACF,GAAWC,EAAO,SAAWD,EAAQ,YACxC,EAAUC,GAId,OAAOD,CACT,CAGA,IAAaG,EAAb,KAAiD,CAgB/C,YAAY,EAAsC,CAArBN,EAAA,EAAA,KAAA,MAAA,IAAA,EAAA,EAd7BA,EAAA,EAAA,KAAA,OAAgB,aAAA,EAGhBA,EAAA,EAAA,KAAA,WAAA,IAAA,EAAA,EAGAA,EAAA,EAAA,KAAA,SAAuC,CAAE,MAAO,EAAG,MAAO,CAAE,CAAA,EAG5DA,EAAA,EAAA,KAAA,YAAA,GAAA,EAK6B,KAAA,IAAAO,CAAsB,CAGnD,SAAgB,CACd,GAAI,KAAK,SACP,OAKF,GAAM,CAAE,QAAS,KAAK,IAChBC,EAAQ,CAACC,EAAK,WACpB,EAAK,WAAa,GAGlB,IAAMC,EACJ,OAAO,oBAAwB,IAC3B,IAAA,GACA,oBAAoB,oBACpBC,EAAOV,EAAY,KAAM,GAASS,GAAW,SAASE,CAAI,CAAC,EAEjE,GAAID,IAAS,IAAA,GAAW,CACtB,GAAI,CAACH,EACH,OAGF,KAAK,IAAI,YAAY,OACnB,yBACA,yEACF,CAEF,KAEA,MAAK,UAAY,KAAK,cAAc,EACpC,KAAK,SAAW,IAAI,oBAAqB,GAAS,CAEhD,KAAK,IAAI,YAAY,MACnB,wBACA,iDACM,CACJ,IAAK,IAAMK,KAASC,EAAK,WAAW,EAClC,KAAK,OAAOD,CAAK,CAErB,CACF,CACF,CAAC,EAGD,KAAK,SAAS,QAAQ,CAAE,OAAM,SAAUL,CAAM,CAAC,CACjD,CAGA,WAAkB,CAChB,KAAK,UAAU,WAAW,EAC1B,KAAK,SAAW,IAAA,EAClB,CAMA,eAAgC,CAC9B,GAAM,CAAE,cAAe,KAAK,IAAI,OAAO,QACjCO,EACJ,OAAOC,GAAe,SAAWA,EAAW,YAAA,IAU9C,OARI,OAAOD,GAAU,UAAY,OAAO,SAASA,CAAK,GAAKA,GAAS,EAC3DA,GAGT,KAAK,IAAI,YAAY,OACnB,iBACA,qFACF,EACA,IACF,CAMA,OAAe,EAAyB,CACtC,GAAIF,EAAM,SAAW,KAAK,UACxB,OAGF,GAAM,CAAE,eAAgB,KAAK,IAE7B,GACE,CAACjB,EAAAA,EACC,KAAK,OACL,KAAK,IAAI,OAAO,cAAc,oBAC9BqB,EACA,cACA,KAAK,IAAI,OAAO,cAAc,QAChC,EAEA,OAGF,IAAMC,EAAW,KAAK,MAAML,EAAM,QAAQ,EACpCM,EAAiC,CAAE,aAAcN,EAAM,SAAU,EAEnEA,EAAM,mBAAqB,IAAA,KAC7B,EAAM,qBAAuB,KAAK,MAAMA,EAAM,gBAAgB,GAGhE,IAAMT,EAASF,EAAcW,EAAM,OAAO,EAGpCO,EAAO,GACXvB,EAAAA,EACEkB,EACA,KAAK,IAAI,OAAO,QAAQ,SACxB,KAAK,IAAI,OAAO,QAAQ,aACxBE,CACF,EAEF,GAAIb,GAAQ,QAAS,CAGnB,GAAM,CAAE,WAAYA,EACpB,EAAM,wBAA0BiB,EAAQ,SAAS,KAAK,EAAID,EAAIC,CAAO,EAAIA,CAC3E,CAEIjB,GAAQ,YACV,EAAM,uBAAyBgB,EAAIhB,EAAO,SAAS,GAGrD,KAAK,IAAI,YAAY,KAAK,CACxB,EAAG,KAAK,IAAI,EACZ,SAAU,QACV,QAAS,cAAc,OAAOc,CAAQ,EAAE,IAC1C,CAAC,EACD,KAAK,IAAI,OAAO,UAAU,yBAA0BA,EAAU,KAAM,YAAaC,CAAK,CACxF,CACF,E"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Diagnostics } from "../core/diagnostics.cjs";
|
|
2
|
+
import type { LogRecord } from "./log-record.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* A batch of records with a stable id used for server-side deduplication across retries.
|
|
5
|
+
* @see {@link splitBatch}
|
|
6
|
+
*/
|
|
7
|
+
export interface LogBatch {
|
|
8
|
+
/** Application namespace that owns this stored batch. */
|
|
9
|
+
readonly persistenceNamespace?: string;
|
|
10
|
+
/** Delivery context id. Never changes. With isolation, a batch without one stays stored. */
|
|
11
|
+
readonly routingContextId?: string;
|
|
12
|
+
/** Deduplication key. Stays the same across retries and reloads. */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Records to deliver, in log order. */
|
|
15
|
+
records: LogRecord[];
|
|
16
|
+
/** Batch creation time, in epoch milliseconds. */
|
|
17
|
+
createdAt: number;
|
|
18
|
+
/** Delivery attempts so far. */
|
|
19
|
+
attempts: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Checks whether a value from storage has every field of a batch. `keyOf` can't match an entry
|
|
23
|
+
* without `id` after delivery, so that entry would be retried forever and block every batch
|
|
24
|
+
* behind it. An entry without `attempts` counts as NaN, which never reaches `maxAttempts`, so
|
|
25
|
+
* it would never be dropped as a dead letter.
|
|
26
|
+
* @param value Parsed storage entry.
|
|
27
|
+
* @returns True when every required field is present and has the correct type.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isLogBatch(value: unknown): value is LogBatch;
|
|
30
|
+
/**
|
|
31
|
+
* Splits a batch that the server rejected as too large into two halves. Each half gets a new
|
|
32
|
+
* id but keeps the original batch's age and attempts.
|
|
33
|
+
* @param batch The rejected batch.
|
|
34
|
+
* @param diagnostics Diagnostics reporter for the new batch ids.
|
|
35
|
+
* @returns Two batches, or `null` if a single record is already over the limit.
|
|
36
|
+
*/
|
|
37
|
+
export declare function splitBatch(batch: LogBatch, diagnostics: Diagnostics): [LogBatch, LogBatch] | null;
|
|
38
|
+
/**
|
|
39
|
+
* Reads one attribute of a record. A record from storage can be corrupt, either null or
|
|
40
|
+
* missing its attributes.
|
|
41
|
+
* @param record Record to read.
|
|
42
|
+
* @param key Attribute key.
|
|
43
|
+
* @returns The attribute value, or undefined for a corrupt record.
|
|
44
|
+
*/
|
|
45
|
+
export declare function attributeOf(record: LogRecord, key: string): unknown;
|
|
46
|
+
/**
|
|
47
|
+
* Checks whether a record is an action. A corrupt record from storage is not an action.
|
|
48
|
+
* @param record Record to check.
|
|
49
|
+
* @returns True for an action record.
|
|
50
|
+
*/
|
|
51
|
+
export declare function isActionRecord(record: LogRecord): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Counts the records across all batches.
|
|
54
|
+
* @param batches Batches to measure.
|
|
55
|
+
* @returns Total record count.
|
|
56
|
+
*/
|
|
57
|
+
export declare function countRecords(batches: readonly LogBatch[]): number;
|
package/dist/models/batch.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Diagnostics } from "../core/diagnostics";
|
|
2
|
-
import type { LogRecord } from "./log-record";
|
|
1
|
+
import type { Diagnostics } from "../core/diagnostics.js";
|
|
2
|
+
import type { LogRecord } from "./log-record.js";
|
|
3
3
|
/**
|
|
4
4
|
* A batch of records with a stable id used for server-side deduplication across retries.
|
|
5
5
|
* @see {@link splitBatch}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { BUS_PROTOCOL, type BUS_TYPE } from "../constants.cjs";
|
|
2
|
+
import type { LogRecord } from "./log-record.cjs";
|
|
3
|
+
/** What one child window or worker may do. The handshake needs no permission of its own. */
|
|
4
|
+
export type BusPermission = "records" | "journey:read" | "journey:write" | "sampling:read";
|
|
5
|
+
export interface SourceOptions {
|
|
6
|
+
/** This source's permissions. Without the list, the source can only send records. */
|
|
7
|
+
permissions?: BusPermission[];
|
|
8
|
+
}
|
|
9
|
+
/** Origin and permissions for one child frame registration. */
|
|
10
|
+
export interface FrameOptions extends SourceOptions {
|
|
11
|
+
/** Expected window origin, including its scheme and port. Must match exactly. */
|
|
12
|
+
origin: string;
|
|
13
|
+
}
|
|
14
|
+
/** Delivery role: whether this context sends its own records or forwards them upstream. */
|
|
15
|
+
export type BusRole = "sender" | "forwarder";
|
|
16
|
+
/**
|
|
17
|
+
* Kind of transport channel, which the bus uses to route incoming and outgoing messages.
|
|
18
|
+
* Without it, `receive` can't tell the channels apart and a same-origin iframe looks like a
|
|
19
|
+
* duplicated tab.
|
|
20
|
+
*/
|
|
21
|
+
export type LinkKind =
|
|
22
|
+
/** Synchronous call into a same-origin parent runtime. */
|
|
23
|
+
"direct"
|
|
24
|
+
/** postMessage to a parent window. */
|
|
25
|
+
| "parent"
|
|
26
|
+
/** postMessage to child frames. */
|
|
27
|
+
| "children"
|
|
28
|
+
/** BroadcastChannel across same-origin tabs and windows. */
|
|
29
|
+
| "broadcast"
|
|
30
|
+
/** OpenFin InterApplicationBus across desktop views and applications. */
|
|
31
|
+
| "openfin"
|
|
32
|
+
/** Dedicated worker communication to its owning document. */
|
|
33
|
+
| "owner"
|
|
34
|
+
/** Document-side communication to a dedicated worker. */
|
|
35
|
+
| "worker";
|
|
36
|
+
/** Origin and transport metadata for an incoming bus message. */
|
|
37
|
+
export interface MessageSource {
|
|
38
|
+
/** Source identity as the transport reports it. The source can't supply it in message.from. */
|
|
39
|
+
peer?: object | string;
|
|
40
|
+
/** Inbound transport channel kind. */
|
|
41
|
+
link: LinkKind;
|
|
42
|
+
/** `event.origin` for `parent` and `children`. Other links use `"same-origin"` or `"openfin"`. */
|
|
43
|
+
origin: string;
|
|
44
|
+
/** Replies to this source only. A link that can't address a single source omits it. */
|
|
45
|
+
reply?: (message: BusMessage) => void;
|
|
46
|
+
}
|
|
47
|
+
/** Discriminated union of control and telemetry payload messages. */
|
|
48
|
+
export type BusMessage =
|
|
49
|
+
/** Handshake discovery announcement from a starting forwarder. */
|
|
50
|
+
{
|
|
51
|
+
t: typeof BUS_TYPE.hello;
|
|
52
|
+
from: string;
|
|
53
|
+
tabId: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Handshake response from an upstream owner, addressed through the `to` field. A welcome on
|
|
57
|
+
* InterApplicationBus reaches every subscriber, so without an address every waiting view
|
|
58
|
+
* would accept the welcome as its own.
|
|
59
|
+
*/
|
|
60
|
+
| {
|
|
61
|
+
t: typeof BUS_TYPE.welcome;
|
|
62
|
+
from: string;
|
|
63
|
+
to: string;
|
|
64
|
+
tabId: string;
|
|
65
|
+
routingContextId?: string;
|
|
66
|
+
}
|
|
67
|
+
/** Telemetry log records forwarded to an upstream sender. */
|
|
68
|
+
| {
|
|
69
|
+
t: typeof BUS_TYPE.records;
|
|
70
|
+
from: string;
|
|
71
|
+
records: LogRecord[];
|
|
72
|
+
routingContextId?: string;
|
|
73
|
+
}
|
|
74
|
+
/** Delivery context update. Only the owner from the handshake may send it to its children. */
|
|
75
|
+
| {
|
|
76
|
+
t: typeof BUS_TYPE.securityContext;
|
|
77
|
+
from: string;
|
|
78
|
+
id: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Journey update, or the answer to a journey question. An answer carries the asking
|
|
82
|
+
* context's address in `to`. The payload comes from another realm, so the receiver parses it.
|
|
83
|
+
*/
|
|
84
|
+
| {
|
|
85
|
+
t: typeof BUS_TYPE.journey;
|
|
86
|
+
from: string;
|
|
87
|
+
to?: string;
|
|
88
|
+
journey: unknown;
|
|
89
|
+
}
|
|
90
|
+
/** Query requesting active journey state from connected peers. */
|
|
91
|
+
| {
|
|
92
|
+
t: typeof BUS_TYPE.journeyRequest;
|
|
93
|
+
from: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Tab identifier claim broadcast to detect collisions across windows. `since` is the
|
|
97
|
+
* document's `performance.timeOrigin`, so the older document keeps the id. An older library
|
|
98
|
+
* sends none.
|
|
99
|
+
*/
|
|
100
|
+
| {
|
|
101
|
+
t: typeof BUS_TYPE.tab;
|
|
102
|
+
from: string;
|
|
103
|
+
tabId: string;
|
|
104
|
+
since?: number;
|
|
105
|
+
}
|
|
106
|
+
/** A forwarder's request for the current remote sampling rules. */
|
|
107
|
+
| {
|
|
108
|
+
t: typeof BUS_TYPE.samplingRequest;
|
|
109
|
+
from: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Remote sampling rules in the header's shape, with the remaining TTL. `to` holds the address
|
|
113
|
+
* of the forwarder that asked. The receiver validates `rules` again. Null rules end the
|
|
114
|
+
* forwarder's copy.
|
|
115
|
+
*/
|
|
116
|
+
| {
|
|
117
|
+
t: typeof BUS_TYPE.sampling;
|
|
118
|
+
from: string;
|
|
119
|
+
to: string;
|
|
120
|
+
rules: unknown;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A forwarder's request to flush. `id` names the request, and `timeoutMs` is the time the
|
|
124
|
+
* forwarder has left. The receiver clamps it to its own range.
|
|
125
|
+
*/
|
|
126
|
+
| {
|
|
127
|
+
t: typeof BUS_TYPE.flushRequest;
|
|
128
|
+
from: string;
|
|
129
|
+
id: string;
|
|
130
|
+
timeoutMs: number;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The answer to a flush request, with the request's id. The result comes from another realm,
|
|
134
|
+
* so the receiver checks each field before it uses one.
|
|
135
|
+
*/
|
|
136
|
+
| {
|
|
137
|
+
t: typeof BUS_TYPE.flushResult;
|
|
138
|
+
from: string;
|
|
139
|
+
id: string;
|
|
140
|
+
result: unknown;
|
|
141
|
+
};
|
|
142
|
+
/** Transport envelope wrapping bus messages with a protocol version tag. */
|
|
143
|
+
export interface BusEnvelope {
|
|
144
|
+
/** Protocol version identifier. */
|
|
145
|
+
p: typeof BUS_PROTOCOL;
|
|
146
|
+
/** Encapsulated bus payload. */
|
|
147
|
+
m: BusMessage;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Wraps a bus message in a versioned protocol envelope.
|
|
151
|
+
* @param message Message to encapsulate.
|
|
152
|
+
* @returns Envelope ready for transport.
|
|
153
|
+
*/
|
|
154
|
+
export declare function envelope(message: BusMessage): BusEnvelope;
|
|
155
|
+
/**
|
|
156
|
+
* Validates the protocol tag and unpacks a raw payload into a bus message. A document gets
|
|
157
|
+
* `message` events from all embedded content on the page, including analytics tags, video
|
|
158
|
+
* players and extensions. Without the tag check, the bus would parse a video player's message
|
|
159
|
+
* as a log record.
|
|
160
|
+
* @param data Raw payload received over a transport link.
|
|
161
|
+
* @returns The validated message, or null if the payload is invalid or unrecognized.
|
|
162
|
+
*/
|
|
163
|
+
export declare function unwrap(data: unknown): BusMessage | null;
|
package/dist/models/bus.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BUS_PROTOCOL, type BUS_TYPE } from "../constants";
|
|
2
|
-
import type { LogRecord } from "./log-record";
|
|
1
|
+
import { BUS_PROTOCOL, type BUS_TYPE } from "../constants.js";
|
|
2
|
+
import type { LogRecord } from "./log-record.js";
|
|
3
3
|
/** What one child window or worker may do. The handshake needs no permission of its own. */
|
|
4
4
|
export type BusPermission = "records" | "journey:read" | "journey:write" | "sampling:read";
|
|
5
5
|
export interface SourceOptions {
|
|
@@ -92,11 +92,16 @@ export type BusMessage =
|
|
|
92
92
|
t: typeof BUS_TYPE.journeyRequest;
|
|
93
93
|
from: string;
|
|
94
94
|
}
|
|
95
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* Tab identifier claim broadcast to detect collisions across windows. `since` is the
|
|
97
|
+
* document's `performance.timeOrigin`, so the older document keeps the id. An older library
|
|
98
|
+
* sends none.
|
|
99
|
+
*/
|
|
96
100
|
| {
|
|
97
101
|
t: typeof BUS_TYPE.tab;
|
|
98
102
|
from: string;
|
|
99
103
|
tabId: string;
|
|
104
|
+
since?: number;
|
|
100
105
|
}
|
|
101
106
|
/** A forwarder's request for the current remote sampling rules. */
|
|
102
107
|
| {
|
|
@@ -113,6 +118,26 @@ export type BusMessage =
|
|
|
113
118
|
from: string;
|
|
114
119
|
to: string;
|
|
115
120
|
rules: unknown;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A forwarder's request to flush. `id` names the request, and `timeoutMs` is the time the
|
|
124
|
+
* forwarder has left. The receiver clamps it to its own range.
|
|
125
|
+
*/
|
|
126
|
+
| {
|
|
127
|
+
t: typeof BUS_TYPE.flushRequest;
|
|
128
|
+
from: string;
|
|
129
|
+
id: string;
|
|
130
|
+
timeoutMs: number;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The answer to a flush request, with the request's id. The result comes from another realm,
|
|
134
|
+
* so the receiver checks each field before it uses one.
|
|
135
|
+
*/
|
|
136
|
+
| {
|
|
137
|
+
t: typeof BUS_TYPE.flushResult;
|
|
138
|
+
from: string;
|
|
139
|
+
id: string;
|
|
140
|
+
result: unknown;
|
|
116
141
|
};
|
|
117
142
|
/** Transport envelope wrapping bus messages with a protocol version tag. */
|
|
118
143
|
export interface BusEnvelope {
|