@utk09/ui-observability 0.12.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +420 -0
- package/README.md +72 -839
- package/dist/{batch-BjQUwjA6.js → batch-CXmPmTse.js} +4 -4
- package/dist/{batch-BjQUwjA6.js.map → batch-CXmPmTse.js.map} +1 -1
- package/dist/{batch-D5LlU4Q9.cjs → batch-mmPigCpi.cjs} +2 -2
- package/dist/{batch-D5LlU4Q9.cjs.map → batch-mmPigCpi.cjs.map} +1 -1
- package/dist/bus/bus.d.cts +331 -0
- package/dist/bus/bus.d.ts +60 -10
- 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-ecxUNTja.js → bus-C39wspFV.js} +308 -193
- package/dist/bus-C39wspFV.js.map +1 -0
- package/dist/bus-_EaOVPGq.cjs +2 -0
- package/dist/bus-_EaOVPGq.cjs.map +1 -0
- package/dist/capture/console.d.cts +37 -0
- package/dist/capture/console.d.ts +1 -1
- package/dist/capture/errors.d.cts +32 -0
- package/dist/capture/errors.d.ts +1 -1
- package/dist/capture/interactions.d.cts +48 -0
- package/dist/capture/interactions.d.ts +1 -1
- 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/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-CvED_Jel.cjs} +2 -2
- package/dist/{compression-lD9abCcO.cjs.map → compression-CvED_Jel.cjs.map} +1 -1
- package/dist/{compression-AJJCMBOa.js → compression-tVtXwVjX.js} +2 -2
- package/dist/{compression-AJJCMBOa.js.map → compression-tVtXwVjX.js.map} +1 -1
- package/dist/config-DUs7uHHt.cjs +2 -0
- package/dist/config-DUs7uHHt.cjs.map +1 -0
- package/dist/config-SgQcCP1_.js +560 -0
- package/dist/config-SgQcCP1_.js.map +1 -0
- package/dist/console-BGgGnjSi.js +81 -0
- package/dist/console-BGgGnjSi.js.map +1 -0
- package/dist/console-CSZ5_Vx5.cjs +2 -0
- package/dist/console-CSZ5_Vx5.cjs.map +1 -0
- package/dist/constants-CUyd9cTZ.js +357 -0
- package/dist/constants-CUyd9cTZ.js.map +1 -0
- package/dist/constants-CqdJhTxH.cjs +2 -0
- package/dist/constants-CqdJhTxH.cjs.map +1 -0
- package/dist/constants.d.cts +751 -0
- package/dist/constants.d.ts +88 -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 +75 -0
- package/dist/core/rotation.d.ts +75 -0
- package/dist/core/runtime.d.cts +765 -0
- package/dist/core/runtime.d.ts +245 -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-BXIlwDKM.cjs +2 -0
- package/dist/debug-bundle-BXIlwDKM.cjs.map +1 -0
- package/dist/debug-bundle-CRpYV_ui.js +35 -0
- package/dist/debug-bundle-CRpYV_ui.js.map +1 -0
- package/dist/defineProperty-X1c4tIPD.cjs +1 -0
- package/dist/defineProperty-s2S8BXUc.js +35 -0
- package/dist/doctor.cjs +1 -1
- package/dist/doctor.cjs.map +1 -1
- package/dist/doctor.d.cts +36 -0
- package/dist/doctor.d.ts +5 -2
- package/dist/doctor.js +121 -89
- package/dist/doctor.js.map +1 -1
- package/dist/errors-BE_EZV7Q.js +86 -0
- package/dist/errors-BE_EZV7Q.js.map +1 -0
- package/dist/errors-CNPbesMs.cjs +3 -0
- package/dist/errors-CNPbesMs.cjs.map +1 -0
- package/dist/factory-CTi0Is3F.js +404 -0
- package/dist/factory-CTi0Is3F.js.map +1 -0
- package/dist/factory-hRrH32v5.cjs +2 -0
- package/dist/factory-hRrH32v5.cjs.map +1 -0
- package/dist/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-DdhKgrpk.js} +20 -24
- package/dist/identity-DdhKgrpk.js.map +1 -0
- package/dist/identity-DlWRIuwy.cjs +2 -0
- package/dist/identity-DlWRIuwy.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +300 -0
- package/dist/index.d.ts +89 -98
- package/dist/index.js +1173 -1506
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-CL9uqBCy.cjs +2 -0
- package/dist/indexeddb-storage-CL9uqBCy.cjs.map +1 -0
- package/dist/{indexeddb-storage-DLXQzAGh.js → indexeddb-storage-GHdl0t8A.js} +51 -47
- package/dist/indexeddb-storage-GHdl0t8A.js.map +1 -0
- package/dist/interactions-CUkzK8sR.cjs +2 -0
- package/dist/interactions-CUkzK8sR.cjs.map +1 -0
- package/dist/{interactions-B6z2I4tU.js → interactions-DiFvCosX.js} +41 -49
- package/dist/interactions-DiFvCosX.js.map +1 -0
- package/dist/journey-B4Adltjm.cjs +2 -0
- package/dist/journey-B4Adltjm.cjs.map +1 -0
- package/dist/{journey-35yCMNFo.js → journey-D2_sia57.js} +45 -48
- package/dist/journey-D2_sia57.js.map +1 -0
- package/dist/{library-console-Dl_Ly6DQ.js → library-console-Btrzt814.js} +2 -2
- package/dist/{library-console-Dl_Ly6DQ.js.map → library-console-Btrzt814.js.map} +1 -1
- package/dist/{library-console-BFWEuQsl.cjs → library-console-CPW6bvZH.cjs} +2 -2
- package/dist/{library-console-BFWEuQsl.cjs.map → library-console-CPW6bvZH.cjs.map} +1 -1
- package/dist/{library-request-nI6pvI6I.js → library-request-BJ9PLRaD.js} +2 -2
- package/dist/{library-request-nI6pvI6I.js.map → library-request-BJ9PLRaD.js.map} +1 -1
- package/dist/{library-request-Da-CHKzT.cjs → library-request-D7OvTxZV.cjs} +2 -2
- package/dist/{library-request-Da-CHKzT.cjs.map → library-request-D7OvTxZV.cjs.map} +1 -1
- package/dist/{lifecycle-CZ6RRXc6.js → lifecycle-22CUCrc9.js} +21 -29
- package/dist/lifecycle-22CUCrc9.js.map +1 -0
- package/dist/lifecycle-IaAm1mOC.cjs +2 -0
- package/dist/lifecycle-IaAm1mOC.cjs.map +1 -0
- package/dist/{log-record-DIA6McNr.js → log-record-BNiLfqtL.js} +8 -7
- package/dist/log-record-BNiLfqtL.js.map +1 -0
- package/dist/log-record-CkivuiEl.cjs +2 -0
- package/dist/log-record-CkivuiEl.cjs.map +1 -0
- package/dist/long-frames-BUUbXd-B.cjs +2 -0
- package/dist/long-frames-BUUbXd-B.cjs.map +1 -0
- package/dist/{long-frames-430_85Da.js → long-frames-DNFaRnC3.js} +18 -22
- package/dist/long-frames-DNFaRnC3.js.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 +158 -0
- package/dist/models/bus.d.ts +22 -2
- package/dist/models/config.d.cts +1540 -0
- package/dist/models/config.d.ts +360 -259
- 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 +23 -0
- package/dist/models/serializer.d.ts +1 -1
- package/dist/models/storage.d.cts +95 -0
- package/dist/models/storage.d.ts +7 -5
- package/dist/network-CGMLQ-mA.cjs +2 -0
- package/dist/network-CGMLQ-mA.cjs.map +1 -0
- package/dist/{network-C7SkLf4v.js → network-on2zZT6H.js} +51 -51
- package/dist/network-on2zZT6H.js.map +1 -0
- package/dist/{otlp-2MCrC3kd.cjs → otlp-BENHf3g9.cjs} +2 -2
- package/dist/{otlp-2MCrC3kd.cjs.map → otlp-BENHf3g9.cjs.map} +1 -1
- package/dist/{otlp-COq033e3.js → otlp-DimfrRor.js} +12 -12
- package/dist/{otlp-COq033e3.js.map → otlp-DimfrRor.js.map} +1 -1
- package/dist/{platform-CVewe4wQ.js → platform-BaaFIPCU.js} +10 -10
- package/dist/{platform-CVewe4wQ.js.map → platform-BaaFIPCU.js.map} +1 -1
- package/dist/{platform-12uR7kBQ.cjs → platform-CfA3-7sJ.cjs} +2 -2
- package/dist/{platform-12uR7kBQ.cjs.map → platform-CfA3-7sJ.cjs.map} +1 -1
- package/dist/{profiler-BVWIOgnq.js → profiler-BAZoh7A4.js} +89 -107
- package/dist/profiler-BAZoh7A4.js.map +1 -0
- package/dist/profiler-D4tJpDRc.cjs +2 -0
- package/dist/profiler-D4tJpDRc.cjs.map +1 -0
- package/dist/profiler-frames-C4xr7KfH.cjs +2 -0
- package/dist/profiler-frames-C4xr7KfH.cjs.map +1 -0
- package/dist/{profiler-frames-CLXlT_xL.js → profiler-frames-cJMx9wNM.js} +29 -37
- package/dist/profiler-frames-cJMx9wNM.js.map +1 -0
- package/dist/remote-rules-Dz9MRAsB.js +95 -0
- package/dist/remote-rules-Dz9MRAsB.js.map +1 -0
- package/dist/remote-rules-_tY0zj5o.cjs +2 -0
- package/dist/remote-rules-_tY0zj5o.cjs.map +1 -0
- package/dist/replay-B3gFXIZd.cjs +2 -0
- package/dist/replay-B3gFXIZd.cjs.map +1 -0
- package/dist/replay-Ds-ANH34.js +310 -0
- package/dist/replay-Ds-ANH34.js.map +1 -0
- package/dist/reports-BDSe4dFH.cjs +2 -0
- package/dist/reports-BDSe4dFH.cjs.map +1 -0
- package/dist/{reports-BuXekPOS.js → reports-C-thq-bk.js} +25 -30
- package/dist/reports-C-thq-bk.js.map +1 -0
- package/dist/resource-timing-C576gFIQ.cjs +2 -0
- package/dist/resource-timing-C576gFIQ.cjs.map +1 -0
- package/dist/{resource-timing-CXGHwFRD.js → resource-timing-eUl2dNgC.js} +20 -23
- package/dist/resource-timing-eUl2dNgC.js.map +1 -0
- package/dist/response-body-YdNl-HkR.cjs +3 -0
- package/dist/response-body-YdNl-HkR.cjs.map +1 -0
- package/dist/response-body-eoSQpLiH.js +331 -0
- package/dist/response-body-eoSQpLiH.js.map +1 -0
- package/dist/rotation-Cwct4ckk.js +94 -0
- package/dist/rotation-Cwct4ckk.js.map +1 -0
- package/dist/rotation-D4qUAHAu.cjs +2 -0
- package/dist/rotation-D4qUAHAu.cjs.map +1 -0
- package/dist/sampling-BlrI8jor.js +63 -0
- package/dist/sampling-BlrI8jor.js.map +1 -0
- package/dist/sampling-mXt4dstx.cjs +2 -0
- package/dist/sampling-mXt4dstx.cjs.map +1 -0
- package/dist/{sanitize-CNmsD9r3.js → sanitize-Ba0KqU06.js} +2 -2
- package/dist/sanitize-Ba0KqU06.js.map +1 -0
- package/dist/{sanitize-ChLn97Ch.cjs → sanitize-DQyiI_KY.cjs} +2 -2
- package/dist/sanitize-DQyiI_KY.cjs.map +1 -0
- package/dist/sender-BdRuNVhF.cjs +2 -0
- package/dist/sender-BdRuNVhF.cjs.map +1 -0
- package/dist/sender-Dv8rAmpV.js +979 -0
- package/dist/sender-Dv8rAmpV.js.map +1 -0
- package/dist/storage/context-storage.d.cts +90 -0
- package/dist/storage/context-storage.d.ts +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-B2EzVuYm.js +51 -0
- package/dist/stored-context-B2EzVuYm.js.map +1 -0
- package/dist/stored-context-CXt7eHZL.cjs +2 -0
- package/dist/stored-context-CXt7eHZL.cjs.map +1 -0
- package/dist/storm-C-zYSdDX.cjs +2 -0
- package/dist/storm-C-zYSdDX.cjs.map +1 -0
- package/dist/storm-DjKetLKZ.js +9 -0
- package/dist/storm-DjKetLKZ.js.map +1 -0
- package/dist/transport/compression.d.cts +7 -0
- package/dist/transport/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-Cob_jyTv.js → unclean-exit-DQD1cT7c.js} +23 -30
- package/dist/unclean-exit-DQD1cT7c.js.map +1 -0
- package/dist/unclean-exit-py99ApzT.cjs +2 -0
- package/dist/unclean-exit-py99ApzT.cjs.map +1 -0
- package/dist/{user-timing-DgHubxCI.js → user-timing-BePqb1uN.js} +15 -17
- package/dist/user-timing-BePqb1uN.js.map +1 -0
- package/dist/user-timing-D6XTmpuM.cjs +2 -0
- package/dist/user-timing-D6XTmpuM.cjs.map +1 -0
- package/dist/utils/console.d.cts +36 -0
- package/dist/utils/console.d.ts +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 +109 -0
- package/dist/utils/identity.d.ts +3 -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-CoIUBM3C.cjs +2 -0
- package/dist/{web-socket-DthJuSAg.js.map → web-socket-CoIUBM3C.cjs.map} +1 -1
- package/dist/{web-socket-DthJuSAg.js → web-socket-DSHgDiZ6.js} +23 -28
- package/dist/web-socket-DSHgDiZ6.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-QbvqNazn.cjs +2 -0
- package/dist/worker-protocol-QbvqNazn.cjs.map +1 -0
- package/dist/{worker-protocol-B0_8rWy5.js → worker-protocol-x074Rpet.js} +14 -11
- package/dist/worker-protocol-x074Rpet.js.map +1 -0
- package/dist/worker-server-CFe4nvos.cjs +2 -0
- package/dist/worker-server-CFe4nvos.cjs.map +1 -0
- package/dist/worker-server-iUVSjH8L.js +94 -0
- package/dist/worker-server-iUVSjH8L.js.map +1 -0
- package/dist/worker-transport-CRAX-09c.cjs +2 -0
- package/dist/worker-transport-CRAX-09c.cjs.map +1 -0
- package/dist/worker-transport-Dy1KMA7t.js +190 -0
- package/dist/worker-transport-Dy1KMA7t.js.map +1 -0
- package/llms.txt +397 -0
- package/package.json +54 -46
- package/dist/bus-D_7pd7RN.cjs +0 -2
- package/dist/bus-D_7pd7RN.cjs.map +0 -1
- 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.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 @@
|
|
|
1
|
+
{"version":3,"file":"profiler-frames-C4xr7KfH.cjs","names":["profilerCore","allowInWindow","PROFILE_FRAME_METRIC_NAME","PROFILE_KEYS","PROFILE_FRAME_PROBE","require_constants","require_profiler","require_storm","require_defineProperty","FRAME_TYPE","FramePhasesCapture","ctx","entry","list","once","start","end","names","captureLimits","phaseStart","value","renderStart","layoutStart","forced","script","phases","name","phase","ms","FramePacingCapture","scope","request","probe","frame","time","error"],"sources":["../src/capture/profiler-frames.ts"],"sourcesContent":["// src/capture/profiler-frames.ts\n//\n// Ties the profiler to the browser's rendering work. The frame phases capture attributes the\n// phases of each long animation frame to the probes that ran in it. Frame pacing measures the\n// time between consecutive frames.\n\nimport {\n PROFILE_FRAME_METRIC_NAME,\n PROFILE_FRAME_PROBE,\n PROFILE_KEYS,\n PROFILER_LINK_MIN_MS,\n} from \"../constants\";\nimport { profilerCore } from \"../core/profiler\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Long animation frames, not long tasks: long tasks don't have phases. */\nconst FRAME_TYPE = \"long-animation-frame\";\n\n/** One script in a long animation frame. */\ninterface FrameScript {\n /** Style and layout time the script forced, in ms. */\n forcedStyleAndLayoutDuration?: number;\n}\n\n/** A long animation frame. Some versions of the DOM typings don't declare these fields. */\ninterface PhaseEntry extends PerformanceEntry {\n /** When the render callbacks started. 0 if the frame didn't render. */\n renderStart?: number;\n /** When style and layout started. 0 if the frame didn't render. */\n styleAndLayoutStart?: number;\n /** The scripts that ran in the frame. */\n scripts?: FrameScript[];\n}\n\n/** The page globals frame pacing needs. A worker or Node.js may have none of them. */\ninterface FrameScope {\n /** Calls a function before the next paint, passing the frame's start time. */\n requestAnimationFrame?: (callback: (time: number) => void) => number;\n cancelAnimationFrame?: (handle: number) => void;\n document?: Pick<Document, \"addEventListener\" | \"removeEventListener\">;\n}\n\n/** Attributes the phases of each long animation frame to every probe with a span in it. */\nexport class FramePhasesCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"frame-phases\";\n\n /** The active observer. Undefined while the capture isn't installed. */\n private observer: PerformanceObserver | undefined;\n\n /** Rate limit for this capture, so a frozen tab can't flood the pipeline. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param ctx Capture context: configuration, diagnostics and logger.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Starts observing long animation frames and turns on the recent-span ring. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n // Older browsers have no supportedEntryTypes. The capture just stays off there.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n\n if (!supported?.includes(FRAME_TYPE)) {\n // Report on the first install in a document only, not on every reinstall after configure().\n const { once } = this.ctx;\n\n if (!once.framePhases) {\n once.framePhases = true;\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report long animation frames. profiler.framePhases is off.\",\n );\n }\n\n return;\n }\n\n profilerCore().link(PROFILER_LINK_MIN_MS);\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 animation frame of the profiler.\",\n () => {\n for (const entry of list.getEntries()) {\n this.record(entry);\n }\n },\n );\n });\n\n // Not buffered: a buffered frame is older than anything in the ring and would link to nothing.\n this.observer.observe({ type: FRAME_TYPE });\n }\n\n /** Disconnects the observer and turns the recent-span ring off. */\n uninstall(): void {\n if (!this.observer) {\n return;\n }\n\n this.observer.disconnect();\n this.observer = undefined;\n profilerCore().link(Infinity);\n }\n\n /**\n * Records one frame's phases for every probe that had a span in the frame.\n * @param entry Long animation frame entry.\n */\n private record(entry: PhaseEntry): void {\n const start = entry.startTime;\n const end = start + entry.duration;\n const names = profilerCore().linked(start, end);\n\n if (names.length === 0) {\n return;\n }\n\n const { captureLimits } = this.ctx.config;\n\n if (\n !allowInWindow(\n this.window,\n captureLimits.longFramesPerWindow,\n this.ctx.diagnostics,\n \"profiler frames\",\n captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n // A frame that didn't render has 0 in both fields. The whole frame then counts as script.\n const phaseStart = (value = 0): number => (value > 0 ? value : end);\n const renderStart = phaseStart(entry.renderStart);\n const layoutStart = phaseStart(entry.styleAndLayoutStart);\n let forced = 0;\n\n for (const script of entry.scripts ?? []) {\n forced += script.forcedStyleAndLayoutDuration ?? 0;\n }\n\n const phases: [string, number][] = [\n [\"script\", renderStart - start],\n [\"render\", layoutStart - renderStart],\n [\"style_layout\", end - layoutStart],\n [\"forced_layout\", forced],\n ];\n\n for (const name of names) {\n for (const [phase, ms] of phases) {\n this.ctx.logger.logMetric(PROFILE_FRAME_METRIC_NAME, ms, \"ms\", \"histogram\", {\n [PROFILE_KEYS.probe]: name,\n [PROFILE_KEYS.framePhase]: phase,\n });\n }\n }\n }\n}\n\n/** Measures the time between consecutive frames with the frame pacing probe. */\nexport class FramePacingCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"frame-pacing\";\n\n /** Handle of the pending frame callback. Undefined while the capture isn't installed. */\n private handle: number | undefined;\n\n /** Start time of the last frame. -1 before the first frame and after the page was hidden. */\n private last = -1;\n\n /**\n * @param ctx Capture context: configuration, diagnostics and logger.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** A hidden page gets no frame callbacks, so the first frame back isn't an interval. */\n private readonly onVisibility = (): void => {\n this.last = -1;\n };\n\n /** Starts the frame callback loop. */\n install(): void {\n const scope = globalThis as FrameScope;\n const { requestAnimationFrame: request } = scope;\n\n if (this.handle !== undefined) {\n return;\n }\n\n if (typeof request !== \"function\") {\n const { once } = this.ctx;\n\n if (!once.framePacing) {\n once.framePacing = true;\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"This context has no frame callback. The frame pacing of the profiler is off.\",\n );\n }\n\n return;\n }\n\n const probe = profilerCore().probe(PROFILE_FRAME_PROBE, undefined, this.ctx.diagnostics);\n const frame = (time: number): void => {\n // The browser calls this directly, so anything we throw is an uncaught error on the page.\n // It also runs every frame, which is why the try block allocates nothing.\n try {\n if (this.last >= 0) {\n probe.record(time - this.last);\n }\n } catch (error) {\n this.ctx.diagnostics.report(\n \"capture.record_failed\",\n \"The library could not record a frame interval of the profiler.\",\n undefined,\n error,\n );\n }\n\n this.last = time;\n this.handle = request(frame);\n };\n\n scope.document?.addEventListener(\"visibilitychange\", this.onVisibility);\n this.handle = request(frame);\n }\n\n /** Stops the frame callback loop. */\n uninstall(): void {\n const scope = globalThis as FrameScope;\n\n if (this.handle === undefined) {\n return;\n }\n\n scope.cancelAnimationFrame?.(this.handle);\n scope.document?.removeEventListener(\"visibilitychange\", this.onVisibility);\n this.handle = undefined;\n this.last = -1;\n }\n}\n"],"mappings":"A,8JAiBA,IAAMS,EAAa,uBA2BNC,EAAb,KAAmD,CAajD,YAAY,EAAsC,CAArBF,EAAA,EAAA,KAAA,MAAA,IAAA,EAAA,EAX7BA,EAAA,EAAA,KAAA,OAAgB,cAAA,EAGhBA,EAAA,EAAA,KAAA,WAAA,IAAA,EAAA,EAGAA,EAAA,EAAA,KAAA,SAAuC,CAAE,MAAO,EAAG,MAAO,CAAE,CAAA,EAK/B,KAAA,IAAAG,CAAsB,CAGnD,SAAgB,CACd,GAAI,MAAK,SAUT,KAJE,OAAO,oBAAwB,IAC3B,IAAA,GACA,oBAAoB,oBAAA,EAEV,SAASF,CAAU,EAenCH,EAAA,EAAa,CAAC,CAAC,KAAA,CAAyB,EACxC,KAAK,SAAW,IAAI,oBAAqB,GAAS,CAEhD,KAAK,IAAI,YAAY,MACnB,wBACA,2EACM,CACJ,IAAK,IAAMM,KAASC,EAAK,WAAW,EAClC,KAAK,OAAOD,CAAK,CAErB,CACF,CACF,CAAC,EAGD,KAAK,SAAS,QAAQ,CAAE,KAAMH,CAAW,CAAC,MA9BJ,CAEpC,GAAM,CAAE,QAAS,KAAK,IAEjBK,EAAK,cACR,EAAK,YAAc,GACnB,KAAK,IAAI,YAAY,OACnB,yBACA,iFACF,EAIJ,EAkBF,CAGA,WAAkB,CACX,KA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,CAC1C,KAAK,KAAO,EACd,CAAA,EAL6B,KAAA,IAAAG,CAAsB,CAQnD,SAAgB,CACd,IAAMmB,EAAQ,WACR,CAAE,sBAAuBC,GAAYD,EAE3C,GAAI,KAAK,SAAW,IAAA,GAClB,OAGF,GAAI,OAAOC,GAAY,WAAY,CACjC,GAAM,CAAE,QAAS,KAAK,IAEjBjB,EAAK,cACR,EAAK,YAAc,GACnB,KAAK,IAAI,YAAY,OACnB,yBACA,8EACF,GAGF,MACF,CAEA,IAAMkB,EAAQhC,EAAAA,EAAa,CAAC,CAAC,MAAMI,EAAAA,GAAqB,IAAA,GAAW,KAAK,IAAI,WAAW,EACjF6B,EAAS,GAAuB,CAGpC,GAAI,CACE,KAAK,MAAQ,GACfD,EAAM,OAAOE,EAAO,KAAK,IAAI,CAEjC,OAASC,EAAO,CACd,KAAK,IAAI,YAAY,OACnB,wBACA,iEACA,IAAA,GACAA,CACF,CACF,CAEA,KAAK,KAAOD,EACZ,KAAK,OAASH,EAAQE,CAAK,CAC7B,EAEAH,EAAM,UAAU,iBAAiB,mBAAoB,KAAK,YAAY,EACtE,KAAK,OAASC,EAAQE,CAAK,CAC7B,CAGA,WAAkB,CAChB,IAAMH,EAAQ,WAEV,KAAK,SAAW,IAAA,KAIpBA,EAAM,uBAAuB,KAAK,MAAM,EACxCA,EAAM,UAAU,oBAAoB,mBAAoB,KAAK,YAAY,EACzE,KAAK,OAAS,IAAA,GACd,KAAK,KAAO,GACd,CACF,E"}
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as r } from "./profiler-
|
|
3
|
-
import { t as i } from "./storm-
|
|
1
|
+
import { $t as e, Qt as t, Zt as n } from "./constants-CUyd9cTZ.js";
|
|
2
|
+
import { t as r } from "./profiler-BAZoh7A4.js";
|
|
3
|
+
import { t as i } from "./storm-DjKetLKZ.js";
|
|
4
|
+
import { t as a } from "./defineProperty-s2S8BXUc.js";
|
|
4
5
|
// src/capture/profiler-frames.ts
|
|
5
|
-
var
|
|
6
|
-
ctx;
|
|
7
|
-
name = "frame-phases";
|
|
8
|
-
observer;
|
|
9
|
-
window = {
|
|
10
|
-
start: 0,
|
|
11
|
-
count: 0
|
|
12
|
-
};
|
|
6
|
+
var o = "long-animation-frame", s = class {
|
|
13
7
|
constructor(e) {
|
|
14
|
-
this
|
|
8
|
+
a(this, "ctx", void 0), a(this, "name", "frame-phases"), a(this, "observer", void 0), a(this, "window", {
|
|
9
|
+
start: 0,
|
|
10
|
+
count: 0
|
|
11
|
+
}), this.ctx = e;
|
|
15
12
|
}
|
|
16
13
|
install() {
|
|
17
14
|
if (!this.observer) {
|
|
18
|
-
if ((typeof PerformanceObserver > "u" ? void 0 : PerformanceObserver.supportedEntryTypes)?.includes(
|
|
15
|
+
if ((typeof PerformanceObserver > "u" ? void 0 : PerformanceObserver.supportedEntryTypes)?.includes(o)) r().link(1), this.observer = new PerformanceObserver((e) => {
|
|
19
16
|
this.ctx.diagnostics.guard("capture.record_failed", "The library could not record a long animation frame of the profiler.", () => {
|
|
20
17
|
for (let t of e.getEntries()) this.record(t);
|
|
21
18
|
});
|
|
22
|
-
}), this.observer.observe({ type:
|
|
19
|
+
}), this.observer.observe({ type: o });
|
|
23
20
|
else {
|
|
24
21
|
let { once: e } = this.ctx;
|
|
25
22
|
e.framePhases || (e.framePhases = !0, this.ctx.diagnostics.report("capture.install_failed", "The browser does not report long animation frames. profiler.framePhases is off."));
|
|
@@ -29,58 +26,53 @@ var a = "long-animation-frame", o = class {
|
|
|
29
26
|
uninstall() {
|
|
30
27
|
this.observer && (this.observer.disconnect(), this.observer = void 0, r().link(Infinity));
|
|
31
28
|
}
|
|
32
|
-
record(
|
|
33
|
-
let a =
|
|
29
|
+
record(t) {
|
|
30
|
+
let a = t.startTime, o = a + t.duration, s = r().linked(a, o);
|
|
34
31
|
if (s.length === 0) return;
|
|
35
|
-
let {
|
|
32
|
+
let { captureLimits: c } = this.ctx.config;
|
|
36
33
|
if (!i(this.window, c.longFramesPerWindow, this.ctx.diagnostics, "profiler frames", c.windowMs)) return;
|
|
37
|
-
let l = (e = 0) => e > 0 ? e : o, u = l(
|
|
38
|
-
for (let e of
|
|
34
|
+
let l = (e = 0) => e > 0 ? e : o, u = l(t.renderStart), d = l(t.styleAndLayoutStart), f = 0;
|
|
35
|
+
for (let e of t.scripts ?? []) f += e.forcedStyleAndLayoutDuration ?? 0;
|
|
39
36
|
let p = [
|
|
40
37
|
["script", u - a],
|
|
41
38
|
["render", d - u],
|
|
42
39
|
["style_layout", o - d],
|
|
43
40
|
["forced_layout", f]
|
|
44
41
|
];
|
|
45
|
-
for (let
|
|
46
|
-
[e.probe]:
|
|
42
|
+
for (let t of s) for (let [r, i] of p) this.ctx.logger.logMetric(n, i, "ms", "histogram", {
|
|
43
|
+
[e.probe]: t,
|
|
47
44
|
[e.framePhase]: r
|
|
48
45
|
});
|
|
49
46
|
}
|
|
50
|
-
},
|
|
51
|
-
ctx;
|
|
52
|
-
name = "frame-pacing";
|
|
53
|
-
handle;
|
|
54
|
-
last = -1;
|
|
47
|
+
}, c = class {
|
|
55
48
|
constructor(e) {
|
|
56
|
-
this
|
|
49
|
+
a(this, "ctx", void 0), a(this, "name", "frame-pacing"), a(this, "handle", void 0), a(this, "last", -1), a(this, "onVisibility", () => {
|
|
50
|
+
this.last = -1;
|
|
51
|
+
}), this.ctx = e;
|
|
57
52
|
}
|
|
58
|
-
onVisibility = () => {
|
|
59
|
-
this.last = -1;
|
|
60
|
-
};
|
|
61
53
|
install() {
|
|
62
|
-
let e = globalThis, { requestAnimationFrame:
|
|
54
|
+
let e = globalThis, { requestAnimationFrame: n } = e;
|
|
63
55
|
if (this.handle !== void 0) return;
|
|
64
|
-
if (typeof
|
|
56
|
+
if (typeof n != "function") {
|
|
65
57
|
let { once: e } = this.ctx;
|
|
66
58
|
e.framePacing || (e.framePacing = !0, this.ctx.diagnostics.report("capture.install_failed", "This context has no frame callback. The frame pacing of the profiler is off."));
|
|
67
59
|
return;
|
|
68
60
|
}
|
|
69
|
-
let i = r().probe(
|
|
61
|
+
let i = r().probe(t, void 0, this.ctx.diagnostics), a = (e) => {
|
|
70
62
|
try {
|
|
71
63
|
this.last >= 0 && i.record(e - this.last);
|
|
72
64
|
} catch (e) {
|
|
73
65
|
this.ctx.diagnostics.report("capture.record_failed", "The library could not record a frame interval of the profiler.", void 0, e);
|
|
74
66
|
}
|
|
75
|
-
this.last = e, this.handle =
|
|
67
|
+
this.last = e, this.handle = n(a);
|
|
76
68
|
};
|
|
77
|
-
e.document?.addEventListener("visibilitychange", this.onVisibility), this.handle =
|
|
69
|
+
e.document?.addEventListener("visibilitychange", this.onVisibility), this.handle = n(a);
|
|
78
70
|
}
|
|
79
71
|
uninstall() {
|
|
80
72
|
let e = globalThis;
|
|
81
73
|
this.handle !== void 0 && (e.cancelAnimationFrame?.(this.handle), e.document?.removeEventListener("visibilitychange", this.onVisibility), this.handle = void 0, this.last = -1);
|
|
82
74
|
}
|
|
83
75
|
};
|
|
84
|
-
export {
|
|
76
|
+
export { c as FramePacingCapture, s as FramePhasesCapture };
|
|
85
77
|
|
|
86
|
-
//# sourceMappingURL=profiler-frames-
|
|
78
|
+
//# sourceMappingURL=profiler-frames-cJMx9wNM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiler-frames-cJMx9wNM.js","names":["PROFILE_KEYS","PROFILE_FRAME_PROBE","PROFILE_FRAME_METRIC_NAME","profilerCore","allowInWindow","_defineProperty","FRAME_TYPE","FramePhasesCapture","ctx","entry","list","once","start","end","names","captureLimits","phaseStart","value","renderStart","layoutStart","forced","script","phases","name","phase","ms","FramePacingCapture","scope","request","probe","frame","time","error"],"sources":["../src/capture/profiler-frames.ts"],"sourcesContent":["// src/capture/profiler-frames.ts\n//\n// Ties the profiler to the browser's rendering work. The frame phases capture attributes the\n// phases of each long animation frame to the probes that ran in it. Frame pacing measures the\n// time between consecutive frames.\n\nimport {\n PROFILE_FRAME_METRIC_NAME,\n PROFILE_FRAME_PROBE,\n PROFILE_KEYS,\n PROFILER_LINK_MIN_MS,\n} from \"../constants\";\nimport { profilerCore } from \"../core/profiler\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Long animation frames, not long tasks: long tasks don't have phases. */\nconst FRAME_TYPE = \"long-animation-frame\";\n\n/** One script in a long animation frame. */\ninterface FrameScript {\n /** Style and layout time the script forced, in ms. */\n forcedStyleAndLayoutDuration?: number;\n}\n\n/** A long animation frame. Some versions of the DOM typings don't declare these fields. */\ninterface PhaseEntry extends PerformanceEntry {\n /** When the render callbacks started. 0 if the frame didn't render. */\n renderStart?: number;\n /** When style and layout started. 0 if the frame didn't render. */\n styleAndLayoutStart?: number;\n /** The scripts that ran in the frame. */\n scripts?: FrameScript[];\n}\n\n/** The page globals frame pacing needs. A worker or Node.js may have none of them. */\ninterface FrameScope {\n /** Calls a function before the next paint, passing the frame's start time. */\n requestAnimationFrame?: (callback: (time: number) => void) => number;\n cancelAnimationFrame?: (handle: number) => void;\n document?: Pick<Document, \"addEventListener\" | \"removeEventListener\">;\n}\n\n/** Attributes the phases of each long animation frame to every probe with a span in it. */\nexport class FramePhasesCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"frame-phases\";\n\n /** The active observer. Undefined while the capture isn't installed. */\n private observer: PerformanceObserver | undefined;\n\n /** Rate limit for this capture, so a frozen tab can't flood the pipeline. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param ctx Capture context: configuration, diagnostics and logger.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Starts observing long animation frames and turns on the recent-span ring. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n // Older browsers have no supportedEntryTypes. The capture just stays off there.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n\n if (!supported?.includes(FRAME_TYPE)) {\n // Report on the first install in a document only, not on every reinstall after configure().\n const { once } = this.ctx;\n\n if (!once.framePhases) {\n once.framePhases = true;\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report long animation frames. profiler.framePhases is off.\",\n );\n }\n\n return;\n }\n\n profilerCore().link(PROFILER_LINK_MIN_MS);\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 animation frame of the profiler.\",\n () => {\n for (const entry of list.getEntries()) {\n this.record(entry);\n }\n },\n );\n });\n\n // Not buffered: a buffered frame is older than anything in the ring and would link to nothing.\n this.observer.observe({ type: FRAME_TYPE });\n }\n\n /** Disconnects the observer and turns the recent-span ring off. */\n uninstall(): void {\n if (!this.observer) {\n return;\n }\n\n this.observer.disconnect();\n this.observer = undefined;\n profilerCore().link(Infinity);\n }\n\n /**\n * Records one frame's phases for every probe that had a span in the frame.\n * @param entry Long animation frame entry.\n */\n private record(entry: PhaseEntry): void {\n const start = entry.startTime;\n const end = start + entry.duration;\n const names = profilerCore().linked(start, end);\n\n if (names.length === 0) {\n return;\n }\n\n const { captureLimits } = this.ctx.config;\n\n if (\n !allowInWindow(\n this.window,\n captureLimits.longFramesPerWindow,\n this.ctx.diagnostics,\n \"profiler frames\",\n captureLimits.windowMs,\n )\n ) {\n return;\n }\n\n // A frame that didn't render has 0 in both fields. The whole frame then counts as script.\n const phaseStart = (value = 0): number => (value > 0 ? value : end);\n const renderStart = phaseStart(entry.renderStart);\n const layoutStart = phaseStart(entry.styleAndLayoutStart);\n let forced = 0;\n\n for (const script of entry.scripts ?? []) {\n forced += script.forcedStyleAndLayoutDuration ?? 0;\n }\n\n const phases: [string, number][] = [\n [\"script\", renderStart - start],\n [\"render\", layoutStart - renderStart],\n [\"style_layout\", end - layoutStart],\n [\"forced_layout\", forced],\n ];\n\n for (const name of names) {\n for (const [phase, ms] of phases) {\n this.ctx.logger.logMetric(PROFILE_FRAME_METRIC_NAME, ms, \"ms\", \"histogram\", {\n [PROFILE_KEYS.probe]: name,\n [PROFILE_KEYS.framePhase]: phase,\n });\n }\n }\n }\n}\n\n/** Measures the time between consecutive frames with the frame pacing probe. */\nexport class FramePacingCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"frame-pacing\";\n\n /** Handle of the pending frame callback. Undefined while the capture isn't installed. */\n private handle: number | undefined;\n\n /** Start time of the last frame. -1 before the first frame and after the page was hidden. */\n private last = -1;\n\n /**\n * @param ctx Capture context: configuration, diagnostics and logger.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** A hidden page gets no frame callbacks, so the first frame back isn't an interval. */\n private readonly onVisibility = (): void => {\n this.last = -1;\n };\n\n /** Starts the frame callback loop. */\n install(): void {\n const scope = globalThis as FrameScope;\n const { requestAnimationFrame: request } = scope;\n\n if (this.handle !== undefined) {\n return;\n }\n\n if (typeof request !== \"function\") {\n const { once } = this.ctx;\n\n if (!once.framePacing) {\n once.framePacing = true;\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"This context has no frame callback. The frame pacing of the profiler is off.\",\n );\n }\n\n return;\n }\n\n const probe = profilerCore().probe(PROFILE_FRAME_PROBE, undefined, this.ctx.diagnostics);\n const frame = (time: number): void => {\n // The browser calls this directly, so anything we throw is an uncaught error on the page.\n // It also runs every frame, which is why the try block allocates nothing.\n try {\n if (this.last >= 0) {\n probe.record(time - this.last);\n }\n } catch (error) {\n this.ctx.diagnostics.report(\n \"capture.record_failed\",\n \"The library could not record a frame interval of the profiler.\",\n undefined,\n error,\n );\n }\n\n this.last = time;\n this.handle = request(frame);\n };\n\n scope.document?.addEventListener(\"visibilitychange\", this.onVisibility);\n this.handle = request(frame);\n }\n\n /** Stops the frame callback loop. */\n uninstall(): void {\n const scope = globalThis as FrameScope;\n\n if (this.handle === undefined) {\n return;\n }\n\n scope.cancelAnimationFrame?.(this.handle);\n scope.document?.removeEventListener(\"visibilitychange\", this.onVisibility);\n this.handle = undefined;\n this.last = -1;\n }\n}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AO,KAAK,IAAI;GAEjC,SAASC,GAAO;IACd,KAAK,IAAI,YAAY,OACnB,yBACA,kEACA,KAAA,GACAA,CACF;GACF;GAGA,AADA,KAAK,OAAOD,GACZ,KAAK,SAASH,EAAQE,CAAK;EAC7B;EAGA,AADAH,EAAM,UAAU,iBAAiB,oBAAoB,KAAK,YAAY,GACtE,KAAK,SAASC,EAAQE,CAAK;CAC7B;CAGA,YAAkB;EAChB,IAAMH,IAAQ;EAEd,AAAI,KAAK,WAAW,KAAA,MAIpBA,EAAM,uBAAuB,KAAK,MAAM,GACxCA,EAAM,UAAU,oBAAoB,oBAAoB,KAAK,YAAY,GACzE,KAAK,SAAS,KAAA,GACd,KAAK,OAAO;CACd;AACF"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { cn as e, kt as t, ln as n, sn as r } from "./constants-CUyd9cTZ.js";
|
|
2
|
+
import { n as i, t as a } from "./guards-BlYGRK4l.js";
|
|
3
|
+
import { n as o, r as s } from "./sampling-BlrI8jor.js";
|
|
4
|
+
import { t as c } from "./defineProperty-s2S8BXUc.js";
|
|
5
|
+
// src/core/remote-sampling.ts
|
|
6
|
+
var l = class {
|
|
7
|
+
constructor(e) {
|
|
8
|
+
c(this, "config", void 0), c(this, "rules", null), c(this, "receivedAt", 0), c(this, "until", 0), this.config = e;
|
|
9
|
+
}
|
|
10
|
+
apply(e) {
|
|
11
|
+
if (!e) {
|
|
12
|
+
this.rules = null;
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
let t = Date.now();
|
|
16
|
+
this.rules = e.rules, this.receivedAt = t, this.until = t + e.ttlMs;
|
|
17
|
+
}
|
|
18
|
+
current() {
|
|
19
|
+
if (!this.rules) return null;
|
|
20
|
+
let e = Date.now();
|
|
21
|
+
return !this.config.sampling.remote || e < this.receivedAt || e >= this.until ? (this.rules = null, null) : this.rules;
|
|
22
|
+
}
|
|
23
|
+
minLevelFor(e) {
|
|
24
|
+
let n = o(e, this.config), r = this.current(), i = s(e, r?.minLevels ?? {})?.value ?? r?.minLevel;
|
|
25
|
+
return i !== void 0 && t[i] < t[n] ? i : n;
|
|
26
|
+
}
|
|
27
|
+
wire() {
|
|
28
|
+
let e = this.current();
|
|
29
|
+
return e ? {
|
|
30
|
+
...e,
|
|
31
|
+
v: 1,
|
|
32
|
+
ttlMs: this.until - Date.now()
|
|
33
|
+
} : null;
|
|
34
|
+
}
|
|
35
|
+
}, u = class extends Error {};
|
|
36
|
+
function d(e) {
|
|
37
|
+
return typeof e == "number" && e >= 0 && e <= 1;
|
|
38
|
+
}
|
|
39
|
+
function f(t) {
|
|
40
|
+
if (t.length > 4096) throw new u(`The header is longer than ${String(e)} characters.`);
|
|
41
|
+
try {
|
|
42
|
+
return JSON.parse(t);
|
|
43
|
+
} catch {
|
|
44
|
+
throw new u("The header is not valid JSON.");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function p(e) {
|
|
48
|
+
if (e === void 0) return {};
|
|
49
|
+
let t = "rates must be an object with at most 100 rates from 0 to 1.";
|
|
50
|
+
if (!i(e)) throw new u(t);
|
|
51
|
+
let n = Object.entries(e);
|
|
52
|
+
if (n.length > 100 || !n.every(([, e]) => d(e))) throw new u(t);
|
|
53
|
+
return Object.fromEntries(n);
|
|
54
|
+
}
|
|
55
|
+
function m(e) {
|
|
56
|
+
let n = "minLevels must be an object with at most 100 level names.";
|
|
57
|
+
if (!i(e)) throw new u(n);
|
|
58
|
+
let r = Object.entries(e), o = r.every(([, e]) => typeof e == "string" && a(t, e));
|
|
59
|
+
if (r.length > 100 || !o) throw new u(n);
|
|
60
|
+
return Object.fromEntries(r);
|
|
61
|
+
}
|
|
62
|
+
function h(e) {
|
|
63
|
+
if (!i(e)) throw new u("The rules must be an object.");
|
|
64
|
+
if (e.v !== 1) throw new u("The version must be 1.");
|
|
65
|
+
let { ttlMs: o, defaultRate: s, minLevel: c } = e;
|
|
66
|
+
if (typeof o != "number" || !(o > 0 && o <= 36e5)) throw new u(`ttlMs must be a number more than 0 and at most ${String(n)}.`);
|
|
67
|
+
if (s !== void 0 && !d(s)) throw new u("defaultRate must be a number from 0 to 1.");
|
|
68
|
+
if (c !== void 0 && !(typeof c == "string" && a(t, c))) throw new u("minLevel must be a level name, for example DEBUG.");
|
|
69
|
+
let l = { rates: p(e.rates) };
|
|
70
|
+
if (s !== void 0 && (l.defaultRate = s), c !== void 0 && (l.minLevel = c), e.minLevels !== void 0 && (l.minLevels = m(e.minLevels)), e.capture !== void 0) {
|
|
71
|
+
let t = e.capture;
|
|
72
|
+
if (!i(t)) throw new u("capture must be an object of capture switches.");
|
|
73
|
+
let n = Object.entries(t);
|
|
74
|
+
if (!n.every(([e, t]) => r.some((t) => t === e) && typeof t == "boolean")) throw new u("capture must contain boolean capture switches without privacy controls.");
|
|
75
|
+
l.capture = Object.fromEntries(n);
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
rules: l,
|
|
79
|
+
ttlMs: o
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function g(e, t) {
|
|
83
|
+
try {
|
|
84
|
+
return h(typeof e == "string" ? f(e) : e);
|
|
85
|
+
} catch (e) {
|
|
86
|
+
let n = e instanceof u ? ` ${e.message}` : "";
|
|
87
|
+
return t.report("config.invalid", `The library ignores the sampling rules from the server.${n}`, void 0, e), null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function _(e, t, n) {
|
|
91
|
+
n && (e.sampling ??= new l(t)), e.sampling?.apply(n), e.changed?.();
|
|
92
|
+
}
|
|
93
|
+
export { g as n, _ as t };
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=remote-rules-Dz9MRAsB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-rules-Dz9MRAsB.js","names":["REMOTE_SAMPLING_MAX_CHARS","LEVEL_ORDER","REMOTE_SAMPLING_MAX_TTL_MS","REMOTE_CAPTURE_FLAGS","isObject","hasOwn","levelFor","longestPrefix","_defineProperty","RemoteSampling","config","update","now","local","namespace","rules","remote","RuleError","isRate","value","parseText","text","readRates","rule","entries","rate","readMinLevels","valid","level","readRules","ttlMs","defaultRate","minLevel","capture","key","flag","name","parseRemoteRules","raw","error","reason","diagnostics","applyRemote","slot"],"sources":["../src/core/remote-sampling.ts","../src/core/remote-rules.ts"],"sourcesContent":["// src/core/remote-sampling.ts\n//\n// Holds the sampling rules from the ingest server for their TTL. The rules are an overlay\n// and are never written into the config, which keeps a later configure() and the TTL simple.\n// Only the lazy chunks import this class. The main bundle imports just the types.\n\nimport { LEVEL_ORDER, REMOTE_SAMPLING_VERSION } from \"../constants\";\nimport type { RemoteCaptureFlag, ResolvedConfig } from \"../models/config\";\nimport type { LogLevel } from \"../models/log-record\";\nimport { levelFor, longestPrefix } from \"./sampling\";\n\n/** Sampling rules from the ingest server, after validation. */\nexport interface RemoteRules {\n /** Rate used when no namespace rate matches. Without it, the config rate applies. */\n defaultRate?: number;\n /** Rate per namespace prefix. These apply on top of the config rates. */\n rates: Record<string, number>;\n /** Temporary capture switches. Every context applies its own allowlist. */\n capture?: Partial<Record<RemoteCaptureFlag, boolean>>;\n /** Lowest level the library sends. Can only lower `minLevel`. */\n minLevel?: LogLevel;\n /** Lowest level per namespace prefix. Can only lower the config's level. */\n minLevels?: Record<string, LogLevel>;\n}\n\n/** Rules and their TTL, after validation. */\nexport interface RemoteUpdate {\n /** Validated rules. */\n rules: RemoteRules;\n /** How long the rules stay in effect, in milliseconds. */\n ttlMs: number;\n}\n\n/** Rules in the header's shape. A context sends them to a forwarder over the bus. */\nexport interface RemoteWire extends RemoteRules {\n /** Rules version. */\n v: typeof REMOTE_SAMPLING_VERSION;\n /** How long the rules stay in effect, in milliseconds. */\n ttlMs: number;\n}\n\n/** The runtime's overlay slot. The sender or the bus fills it when the first rules arrive. */\nexport interface RemoteSlot {\n /** Overlay, or null before the first rules. */\n sampling: RemoteSampling | null;\n /** Refreshes captures after a trusted rule update. */\n changed?: () => void;\n}\n\n/** The remote sampling rules in effect for this context. */\nexport class RemoteSampling {\n /** Current rules, or null. */\n private rules: RemoteRules | null = null;\n\n /** When the rules arrived, in epoch milliseconds. */\n private receivedAt = 0;\n\n /** When the rules end, in epoch milliseconds. */\n private until = 0;\n\n /**\n * @param config Active configuration instance. A reconfigure changes it in place.\n */\n constructor(private readonly config: ResolvedConfig) {}\n\n /**\n * Puts new rules into effect, replacing the current ones.\n * @param update Validated rules and their TTL, or null when the upstream has no rules.\n */\n apply(update: RemoteUpdate | null): void {\n if (!update) {\n this.rules = null;\n return;\n }\n\n const now = Date.now();\n\n this.rules = update.rules;\n this.receivedAt = now;\n this.until = now + update.ttlMs;\n }\n\n /**\n * Returns the current rules.\n * @returns The rules, or null after the TTL or when `sampling.remote` is off.\n */\n current(): RemoteRules | null {\n if (!this.rules) {\n return null;\n }\n\n const now = Date.now();\n\n // Drop the rules when remote sampling is off, so turning it on again can't bring them back.\n // Also guard against a clock that moves back, which would keep the rules past their TTL.\n if (!this.config.sampling.remote || now < this.receivedAt || now >= this.until) {\n this.rules = null;\n return null;\n }\n\n return this.rules;\n }\n\n /**\n * Returns the lowest level the library sends for a namespace. A remote prefix level wins\n * over the remote `minLevel`, and a remote level applies only when it is lower than the\n * config level.\n * @param namespace Target application namespace.\n * @returns The lower of the remote level and the namespace's config level.\n */\n minLevelFor(namespace: string): LogLevel {\n const local = levelFor(namespace, this.config);\n const rules = this.current();\n const remote = longestPrefix(namespace, rules?.minLevels ?? {})?.value ?? rules?.minLevel;\n\n return remote !== undefined && LEVEL_ORDER[remote] < LEVEL_ORDER[local] ? remote : local;\n }\n\n /**\n * Returns the current rules in the header's shape, with the remaining TTL.\n * @returns The rules, or null if none are in effect.\n */\n wire(): RemoteWire | null {\n const rules = this.current();\n\n if (!rules) {\n return null;\n }\n\n return { ...rules, v: REMOTE_SAMPLING_VERSION, ttlMs: this.until - Date.now() };\n }\n}\n","// src/core/remote-rules.ts\n//\n// Validates the sampling rules from the ingest server and puts them into effect.\n// Imported by the sender and the bus. The main bundle doesn't include it.\n\nimport {\n LEVEL_ORDER,\n REMOTE_CAPTURE_FLAGS,\n REMOTE_SAMPLING_MAX_CHARS,\n REMOTE_SAMPLING_MAX_RATES,\n REMOTE_SAMPLING_MAX_TTL_MS,\n REMOTE_SAMPLING_VERSION,\n SAMPLING_RATE_MAX,\n SAMPLING_RATE_MIN,\n} from \"../constants\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { LogLevel } from \"../models/log-record\";\nimport { hasOwn, isObject } from \"../utils/guards\";\nimport type { Diagnostics } from \"./diagnostics\";\nimport {\n type RemoteRules,\n RemoteSampling,\n type RemoteSlot,\n type RemoteUpdate,\n} from \"./remote-sampling\";\n\n/** One validation step failed. The message states the rule. */\nclass RuleError extends Error {}\n\n/**\n * Checks whether a value is a rate.\n * @param value Value to check.\n * @returns True for a number from 0 to 1. NaN fails.\n */\nfunction isRate(value: unknown): value is number {\n return typeof value === \"number\" && value >= SAMPLING_RATE_MIN && value <= SAMPLING_RATE_MAX;\n}\n\n/**\n * Parses the header text as JSON.\n * @param text Header text.\n * @returns The parsed value.\n * @throws RuleError when the text is too long or isn't JSON.\n */\nfunction parseText(text: string): unknown {\n if (text.length > REMOTE_SAMPLING_MAX_CHARS) {\n throw new RuleError(\n `The header is longer than ${String(REMOTE_SAMPLING_MAX_CHARS)} characters.`,\n );\n }\n\n try {\n return JSON.parse(text);\n } catch {\n // The caller reports the RuleError.\n throw new RuleError(\"The header is not valid JSON.\");\n }\n}\n\n/**\n * Reads the namespace rates.\n * @param value Value of `rates`.\n * @returns The rates.\n * @throws RuleError when a rate is invalid.\n */\nfunction readRates(value: unknown): Record<string, number> {\n if (value === undefined) {\n return {};\n }\n\n const rule = `rates must be an object with at most ${String(REMOTE_SAMPLING_MAX_RATES)} rates from 0 to 1.`;\n\n if (!isObject(value)) {\n throw new RuleError(rule);\n }\n\n const entries = Object.entries(value);\n\n if (entries.length > REMOTE_SAMPLING_MAX_RATES || !entries.every(([, rate]) => isRate(rate))) {\n throw new RuleError(rule);\n }\n\n // fromEntries creates own properties, so a \"__proto__\" key can't change the prototype.\n return Object.fromEntries(entries) as Record<string, number>;\n}\n\n/**\n * Reads the level for every namespace prefix.\n * @param value Value of `minLevels`.\n * @returns The levels.\n * @throws RuleError when a level is invalid.\n */\nfunction readMinLevels(value: unknown): Record<string, LogLevel> {\n const rule = `minLevels must be an object with at most ${String(REMOTE_SAMPLING_MAX_RATES)} level names.`;\n\n if (!isObject(value)) {\n throw new RuleError(rule);\n }\n\n const entries = Object.entries(value);\n const valid = entries.every(\n ([, level]) => typeof level === \"string\" && hasOwn(LEVEL_ORDER, level),\n );\n\n if (entries.length > REMOTE_SAMPLING_MAX_RATES || !valid) {\n throw new RuleError(rule);\n }\n\n // fromEntries creates own properties, so a \"__proto__\" key can't change the prototype.\n return Object.fromEntries(entries) as Record<string, LogLevel>;\n}\n\n/**\n * Validates the rules. Sampling applies `remoteMaxRate` when it reads them.\n * @param value Parsed header value.\n * @returns The rules and their TTL.\n * @throws RuleError when a field is invalid.\n */\nfunction readRules(value: unknown): RemoteUpdate {\n if (!isObject(value)) {\n throw new RuleError(\"The rules must be an object.\");\n }\n\n if (value.v !== REMOTE_SAMPLING_VERSION) {\n throw new RuleError(`The version must be ${String(REMOTE_SAMPLING_VERSION)}.`);\n }\n\n const { ttlMs, defaultRate, minLevel } = value;\n\n if (typeof ttlMs !== \"number\" || !(ttlMs > 0 && ttlMs <= REMOTE_SAMPLING_MAX_TTL_MS)) {\n throw new RuleError(\n `ttlMs must be a number more than 0 and at most ${String(REMOTE_SAMPLING_MAX_TTL_MS)}.`,\n );\n }\n\n if (defaultRate !== undefined && !isRate(defaultRate)) {\n throw new RuleError(\"defaultRate must be a number from 0 to 1.\");\n }\n\n if (minLevel !== undefined && !(typeof minLevel === \"string\" && hasOwn(LEVEL_ORDER, minLevel))) {\n throw new RuleError(\"minLevel must be a level name, for example DEBUG.\");\n }\n\n const rules: RemoteRules = { rates: readRates(value.rates) };\n\n if (defaultRate !== undefined) {\n rules.defaultRate = defaultRate;\n }\n\n if (minLevel !== undefined) {\n rules.minLevel = minLevel as LogLevel;\n }\n\n if (value.minLevels !== undefined) {\n rules.minLevels = readMinLevels(value.minLevels);\n }\n\n if (value.capture !== undefined) {\n const capture = value.capture;\n if (!isObject(capture)) {\n throw new RuleError(\"capture must be an object of capture switches.\");\n }\n\n const entries = Object.entries(capture);\n if (\n !entries.every(\n ([key, flag]) =>\n REMOTE_CAPTURE_FLAGS.some((name) => name === key) && typeof flag === \"boolean\",\n )\n ) {\n throw new RuleError(\n \"capture must contain boolean capture switches without privacy controls.\",\n );\n }\n\n rules.capture = Object.fromEntries(entries);\n }\n\n return { rules, ttlMs };\n}\n\n/**\n * Validates sampling rules from the server. One invalid rule rejects all of them.\n * @param raw Header text, or a parsed object from a custom transport or the bus.\n * @param diagnostics Diagnostics reporter.\n * @returns The rules and their TTL, or null if they are invalid.\n */\nexport function parseRemoteRules(raw: unknown, diagnostics: Diagnostics): RemoteUpdate | null {\n try {\n return readRules(typeof raw === \"string\" ? parseText(raw) : raw);\n } catch (error) {\n const reason = error instanceof RuleError ? ` ${error.message}` : \"\";\n\n diagnostics.report(\n \"config.invalid\",\n `The library ignores the sampling rules from the server.${reason}`,\n undefined,\n error,\n );\n return null;\n }\n}\n\n/**\n * Puts rules into effect in the runtime's slot. Creates the overlay for the first rules.\n * @param slot The runtime's slot.\n * @param config Active configuration instance.\n * @param update Validated rules, or null when the upstream has no rules.\n */\nexport function applyRemote(\n slot: RemoteSlot,\n config: ResolvedConfig,\n update: RemoteUpdate | null,\n): void {\n if (update) {\n slot.sampling ??= new RemoteSampling(config);\n }\n\n slot.sampling?.apply(update);\n slot.changed?.();\n}\n"],"mappings":";;;;;AAkDA,IAAaS,IAAb,MAA4B;CAa1B,YAAY,GAAyC;EAAxB,AAAAD,EAAA,MAAA,UAAA,KAAA,CAAA,GAX7BA,EAAA,MAAA,SAAoC,IAAA,GAGpCA,EAAA,MAAA,cAAqB,C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CAc3D,IAZIY,MAAgB,KAAA,MAClB,EAAM,cAAcA,IAGlBC,MAAa,KAAA,MACf,EAAM,WAAWA,IAGfb,EAAM,cAAc,KAAA,MACtB,EAAM,YAAYO,EAAcP,EAAM,SAAS,IAG7CA,EAAM,YAAY,KAAA,GAAW;EAC/B,IAAMc,IAAUd,EAAM;EACtB,IAAI,CAACf,EAAS6B,CAAO,GACnB,MAAM,IAAIhB,EAAU,gDAAgD;EAGtE,IAAMO,IAAU,OAAO,QAAQS,CAAO;EACtC,IACE,CAACT,EAAQ,OACN,CAACU,GAAKC,OACLhC,EAAqB,MAAM,MAASiC,MAASF,CAAG,KAAK,OAAOC,KAAS,SACzE,GAEA,MAAM,IAAIlB,EACR,yEACF;EAGF,EAAM,UAAU,OAAO,YAAYO,CAAO;CAC5C;CAEA,OAAO;EAAE;EAAO;CAAM;AACxB;AAQA,SAAgBa,EAAiB,GAAc,GAA+C;CAC5F,IAAI;EACF,OAAOR,EAAU,OAAOS,KAAQ,WAAWlB,EAAUkB,CAAG,IAAIA,CAAG;CACjE,SAASC,GAAO;EACd,IAAMC,IAASD,aAAiBtB,IAAY,IAAIsB,EAAM,YAAY;EAQlE,OANAE,EAAY,OACV,kBACA,0DAA0DD,KAC1D,KAAA,GACAD,CACF,GACO;CACT;AACF;AAQA,SAAgBG,EACd,GACA,GACA,GACM;CAMN,AALI/B,MACF,EAAK,aAAa,IAAIF,EAAeC,CAAM,IAG7CiC,EAAK,UAAU,MAAMhC,CAAM,GAC3BgC,EAAK,UAAU;AACjB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./constants-CqdJhTxH.cjs"),t=require("./guards-EjG3ahFp.cjs"),n=require("./sampling-mXt4dstx.cjs"),r=require("./defineProperty-X1c4tIPD.cjs");var i=class{constructor(e){r.t(this,`config`,void 0),r.t(this,`rules`,null),r.t(this,`receivedAt`,0),r.t(this,`until`,0),this.config=e}apply(e){if(!e){this.rules=null;return}let t=Date.now();this.rules=e.rules,this.receivedAt=t,this.until=t+e.ttlMs}current(){if(!this.rules)return null;let e=Date.now();return!this.config.sampling.remote||e<this.receivedAt||e>=this.until?(this.rules=null,null):this.rules}minLevelFor(t){let r=n.n(t,this.config),i=this.current(),a=n.r(t,i?.minLevels??{})?.value??i?.minLevel;return a!==void 0&&e.kt[a]<e.kt[r]?a:r}wire(){let e=this.current();return e?{...e,v:1,ttlMs:this.until-Date.now()}:null}},a=class extends Error{};function o(e){return typeof e==`number`&&e>=0&&e<=1}function s(t){if(t.length>4096)throw new a(`The header is longer than ${String(e.cn)} characters.`);try{return JSON.parse(t)}catch{throw new a(`The header is not valid JSON.`)}}function c(e){if(e===void 0)return{};let n=`rates must be an object with at most 100 rates from 0 to 1.`;if(!t.n(e))throw new a(n);let r=Object.entries(e);if(r.length>100||!r.every(([,e])=>o(e)))throw new a(n);return Object.fromEntries(r)}function l(n){let r=`minLevels must be an object with at most 100 level names.`;if(!t.n(n))throw new a(r);let i=Object.entries(n),o=i.every(([,n])=>typeof n==`string`&&t.t(e.kt,n));if(i.length>100||!o)throw new a(r);return Object.fromEntries(i)}function u(n){if(!t.n(n))throw new a(`The rules must be an object.`);if(n.v!==1)throw new a(`The version must be 1.`);let{ttlMs:r,defaultRate:i,minLevel:s}=n;if(typeof r!=`number`||!(r>0&&r<=36e5))throw new a(`ttlMs must be a number more than 0 and at most ${String(e.ln)}.`);if(i!==void 0&&!o(i))throw new a(`defaultRate must be a number from 0 to 1.`);if(s!==void 0&&!(typeof s==`string`&&t.t(e.kt,s)))throw new a(`minLevel must be a level name, for example DEBUG.`);let u={rates:c(n.rates)};if(i!==void 0&&(u.defaultRate=i),s!==void 0&&(u.minLevel=s),n.minLevels!==void 0&&(u.minLevels=l(n.minLevels)),n.capture!==void 0){let r=n.capture;if(!t.n(r))throw new a(`capture must be an object of capture switches.`);let i=Object.entries(r);if(!i.every(([t,n])=>e.sn.some(e=>e===t)&&typeof n==`boolean`))throw new a(`capture must contain boolean capture switches without privacy controls.`);u.capture=Object.fromEntries(i)}return{rules:u,ttlMs:r}}function d(e,t){try{return u(typeof e==`string`?s(e):e)}catch(e){let n=e instanceof a?` ${e.message}`:``;return t.report(`config.invalid`,`The library ignores the sampling rules from the server.${n}`,void 0,e),null}}function f(e,t,n){n&&(e.sampling??=new i(t)),e.sampling?.apply(n),e.changed?.()}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return f}});
|
|
2
|
+
//# sourceMappingURL=remote-rules-_tY0zj5o.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-rules-_tY0zj5o.cjs","names":["levelFor","longestPrefix","LEVEL_ORDER","REMOTE_SAMPLING_MAX_CHARS","isObject","hasOwn","LEVEL_ORDER","REMOTE_SAMPLING_MAX_TTL_MS","REMOTE_CAPTURE_FLAGS","require_constants","require_guards","require_sampling","require_defineProperty","RemoteSampling","config","update","now","local","namespace","rules","remote","RuleError","isRate","value","parseText","text","readRates","rule","entries","rate","readMinLevels","valid","level","readRules","ttlMs","defaultRate","minLevel","capture","key","flag","name","parseRemoteRules","raw","error","reason","diagnostics","applyRemote","slot"],"sources":["../src/core/remote-sampling.ts","../src/core/remote-rules.ts"],"sourcesContent":["// src/core/remote-sampling.ts\n//\n// Holds the sampling rules from the ingest server for their TTL. The rules are an overlay\n// and are never written into the config, which keeps a later configure() and the TTL simple.\n// Only the lazy chunks import this class. The main bundle imports just the types.\n\nimport { LEVEL_ORDER, REMOTE_SAMPLING_VERSION } from \"../constants\";\nimport type { RemoteCaptureFlag, ResolvedConfig } from \"../models/config\";\nimport type { LogLevel } from \"../models/log-record\";\nimport { levelFor, longestPrefix } from \"./sampling\";\n\n/** Sampling rules from the ingest server, after validation. */\nexport interface RemoteRules {\n /** Rate used when no namespace rate matches. Without it, the config rate applies. */\n defaultRate?: number;\n /** Rate per namespace prefix. These apply on top of the config rates. */\n rates: Record<string, number>;\n /** Temporary capture switches. Every context applies its own allowlist. */\n capture?: Partial<Record<RemoteCaptureFlag, boolean>>;\n /** Lowest level the library sends. Can only lower `minLevel`. */\n minLevel?: LogLevel;\n /** Lowest level per namespace prefix. Can only lower the config's level. */\n minLevels?: Record<string, LogLevel>;\n}\n\n/** Rules and their TTL, after validation. */\nexport interface RemoteUpdate {\n /** Validated rules. */\n rules: RemoteRules;\n /** How long the rules stay in effect, in milliseconds. */\n ttlMs: number;\n}\n\n/** Rules in the header's shape. A context sends them to a forwarder over the bus. */\nexport interface RemoteWire extends RemoteRules {\n /** Rules version. */\n v: typeof REMOTE_SAMPLING_VERSION;\n /** How long the rules stay in effect, in milliseconds. */\n ttlMs: number;\n}\n\n/** The runtime's overlay slot. The sender or the bus fills it when the first rules arrive. */\nexport interface RemoteSlot {\n /** Overlay, or null before the first rules. */\n sampling: RemoteSampling | null;\n /** Refreshes captures after a trusted rule update. */\n changed?: () => void;\n}\n\n/** The remote sampling rules in effect for this context. */\nexport class RemoteSampling {\n /** Current rules, or null. */\n private rules: RemoteRules | null = null;\n\n /** When the rules arrived, in epoch milliseconds. */\n private receivedAt = 0;\n\n /** When the rules end, in epoch milliseconds. */\n private until = 0;\n\n /**\n * @param config Active configuration instance. A reconfigure changes it in place.\n */\n constructor(private readonly config: ResolvedConfig) {}\n\n /**\n * Puts new rules into effect, replacing the current ones.\n * @param update Validated rules and their TTL, or null when the upstream has no rules.\n */\n apply(update: RemoteUpdate | null): void {\n if (!update) {\n this.rules = null;\n return;\n }\n\n const now = Date.now();\n\n this.rules = update.rules;\n this.receivedAt = now;\n this.until = now + update.ttlMs;\n }\n\n /**\n * Returns the current rules.\n * @returns The rules, or null after the TTL or when `sampling.remote` is off.\n */\n current(): RemoteRules | null {\n if (!this.rules) {\n return null;\n }\n\n const now = Date.now();\n\n // Drop the rules when remote sampling is off, so turning it on again can't bring them back.\n // Also guard against a clock that moves back, which would keep the rules past their TTL.\n if (!this.config.sampling.remote || now < this.receivedAt || now >= this.until) {\n this.rules = null;\n return null;\n }\n\n return this.rules;\n }\n\n /**\n * Returns the lowest level the library sends for a namespace. A remote prefix level wins\n * over the remote `minLevel`, and a remote level applies only when it is lower than the\n * config level.\n * @param namespace Target application namespace.\n * @returns The lower of the remote level and the namespace's config level.\n */\n minLevelFor(namespace: string): LogLevel {\n const local = levelFor(namespace, this.config);\n const rules = this.current();\n const remote = longestPrefix(namespace, rules?.minLevels ?? {})?.value ?? rules?.minLevel;\n\n return remote !== undefined && LEVEL_ORDER[remote] < LEVEL_ORDER[local] ? remote : local;\n }\n\n /**\n * Returns the current rules in the header's shape, with the remaining TTL.\n * @returns The rules, or null if none are in effect.\n */\n wire(): RemoteWire | null {\n const rules = this.current();\n\n if (!rules) {\n return null;\n }\n\n return { ...rules, v: REMOTE_SAMPLING_VERSION, ttlMs: this.until - Date.now() };\n }\n}\n","// src/core/remote-rules.ts\n//\n// Validates the sampling rules from the ingest server and puts them into effect.\n// Imported by the sender and the bus. The main bundle doesn't include it.\n\nimport {\n LEVEL_ORDER,\n REMOTE_CAPTURE_FLAGS,\n REMOTE_SAMPLING_MAX_CHARS,\n REMOTE_SAMPLING_MAX_RATES,\n REMOTE_SAMPLING_MAX_TTL_MS,\n REMOTE_SAMPLING_VERSION,\n SAMPLING_RATE_MAX,\n SAMPLING_RATE_MIN,\n} from \"../constants\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { LogLevel } from \"../models/log-record\";\nimport { hasOwn, isObject } from \"../utils/guards\";\nimport type { Diagnostics } from \"./diagnostics\";\nimport {\n type RemoteRules,\n RemoteSampling,\n type RemoteSlot,\n type RemoteUpdate,\n} from \"./remote-sampling\";\n\n/** One validation step failed. The message states the rule. */\nclass RuleError extends Error {}\n\n/**\n * Checks whether a value is a rate.\n * @param value Value to check.\n * @returns True for a number from 0 to 1. NaN fails.\n */\nfunction isRate(value: unknown): value is number {\n return typeof value === \"number\" && value >= SAMPLING_RATE_MIN && value <= SAMPLING_RATE_MAX;\n}\n\n/**\n * Parses the header text as JSON.\n * @param text Header text.\n * @returns The parsed value.\n * @throws RuleError when the text is too long or isn't JSON.\n */\nfunction parseText(text: string): unknown {\n if (text.length > REMOTE_SAMPLING_MAX_CHARS) {\n throw new RuleError(\n `The header is longer than ${String(REMOTE_SAMPLING_MAX_CHARS)} characters.`,\n );\n }\n\n try {\n return JSON.parse(text);\n } catch {\n // The caller reports the RuleError.\n throw new RuleError(\"The header is not valid JSON.\");\n }\n}\n\n/**\n * Reads the namespace rates.\n * @param value Value of `rates`.\n * @returns The rates.\n * @throws RuleError when a rate is invalid.\n */\nfunction readRates(value: unknown): Record<string, number> {\n if (value === undefined) {\n return {};\n }\n\n const rule = `rates must be an object with at most ${String(REMOTE_SAMPLING_MAX_RATES)} rates from 0 to 1.`;\n\n if (!isObject(value)) {\n throw new RuleError(rule);\n }\n\n const entries = Object.entries(value);\n\n if (entries.length > REMOTE_SAMPLING_MAX_RATES || !entries.every(([, rate]) => isRate(rate))) {\n throw new RuleError(rule);\n }\n\n // fromEntries creates own properties, so a \"__proto__\" key can't change the prototype.\n return Object.fromEntries(entries) as Record<string, number>;\n}\n\n/**\n * Reads the level for every namespace prefix.\n * @param value Value of `minLevels`.\n * @returns The levels.\n * @throws RuleError when a level is invalid.\n */\nfunction readMinLevels(value: unknown): Record<string, LogLevel> {\n const rule = `minLevels must be an object with at most ${String(REMOTE_SAMPLING_MAX_RATES)} level names.`;\n\n if (!isObject(value)) {\n throw new RuleError(rule);\n }\n\n const entries = Object.entries(value);\n const valid = entries.every(\n ([, level]) => typeof level === \"string\" && hasOwn(LEVEL_ORDER, level),\n );\n\n if (entries.length > REMOTE_SAMPLING_MAX_RATES || !valid) {\n throw new RuleError(rule);\n }\n\n // fromEntries creates own properties, so a \"__proto__\" key can't change the prototype.\n return Object.fromEntries(entries) as Record<string, LogLevel>;\n}\n\n/**\n * Validates the rules. Sampling applies `remoteMaxRate` when it reads them.\n * @param value Parsed header value.\n * @returns The rules and their TTL.\n * @throws RuleError when a field is invalid.\n */\nfunction readRules(value: unknown): RemoteUpdate {\n if (!isObject(value)) {\n throw new RuleError(\"The rules must be an object.\");\n }\n\n if (value.v !== REMOTE_SAMPLING_VERSION) {\n throw new RuleError(`The version must be ${String(REMOTE_SAMPLING_VERSION)}.`);\n }\n\n const { ttlMs, defaultRate, minLevel } = value;\n\n if (typeof ttlMs !== \"number\" || !(ttlMs > 0 && ttlMs <= REMOTE_SAMPLING_MAX_TTL_MS)) {\n throw new RuleError(\n `ttlMs must be a number more than 0 and at most ${String(REMOTE_SAMPLING_MAX_TTL_MS)}.`,\n );\n }\n\n if (defaultRate !== undefined && !isRate(defaultRate)) {\n throw new RuleError(\"defaultRate must be a number from 0 to 1.\");\n }\n\n if (minLevel !== undefined && !(typeof minLevel === \"string\" && hasOwn(LEVEL_ORDER, minLevel))) {\n throw new RuleError(\"minLevel must be a level name, for example DEBUG.\");\n }\n\n const rules: RemoteRules = { rates: readRates(value.rates) };\n\n if (defaultRate !== undefined) {\n rules.defaultRate = defaultRate;\n }\n\n if (minLevel !== undefined) {\n rules.minLevel = minLevel as LogLevel;\n }\n\n if (value.minLevels !== undefined) {\n rules.minLevels = readMinLevels(value.minLevels);\n }\n\n if (value.capture !== undefined) {\n const capture = value.capture;\n if (!isObject(capture)) {\n throw new RuleError(\"capture must be an object of capture switches.\");\n }\n\n const entries = Object.entries(capture);\n if (\n !entries.every(\n ([key, flag]) =>\n REMOTE_CAPTURE_FLAGS.some((name) => name === key) && typeof flag === \"boolean\",\n )\n ) {\n throw new RuleError(\n \"capture must contain boolean capture switches without privacy controls.\",\n );\n }\n\n rules.capture = Object.fromEntries(entries);\n }\n\n return { rules, ttlMs };\n}\n\n/**\n * Validates sampling rules from the server. One invalid rule rejects all of them.\n * @param raw Header text, or a parsed object from a custom transport or the bus.\n * @param diagnostics Diagnostics reporter.\n * @returns The rules and their TTL, or null if they are invalid.\n */\nexport function parseRemoteRules(raw: unknown, diagnostics: Diagnostics): RemoteUpdate | null {\n try {\n return readRules(typeof raw === \"string\" ? parseText(raw) : raw);\n } catch (error) {\n const reason = error instanceof RuleError ? ` ${error.message}` : \"\";\n\n diagnostics.report(\n \"config.invalid\",\n `The library ignores the sampling rules from the server.${reason}`,\n undefined,\n error,\n );\n return null;\n }\n}\n\n/**\n * Puts rules into effect in the runtime's slot. Creates the overlay for the first rules.\n * @param slot The runtime's slot.\n * @param config Active configuration instance.\n * @param update Validated rules, or null when the upstream has no rules.\n */\nexport function applyRemote(\n slot: RemoteSlot,\n config: ResolvedConfig,\n update: RemoteUpdate | null,\n): void {\n if (update) {\n slot.sampling ??= new RemoteSampling(config);\n }\n\n slot.sampling?.apply(update);\n slot.changed?.();\n}\n"],"mappings":"A,+JAkDA,IAAaa,EAAb,KAA4B,CAa1B,YAAY,EAAyC,CAAxBD,EAAA,EAAA,KAAA,SAAA,IAAA,EAAA,EAX7BA,EAAA,EAAA,KAAA,QAAoC,IAAA,EAGpCA,EAAA,EAAA,KAAA,aAAqB,CAAA,EAGrBA,EAAA,EAAA,KAAA,QAAgB,CAAA,EAKa,KAAA,OAAAE,CAAyB,CAMtD,MAAM,EAAmC,CACvC,GAAI,CAACC,EAAQ,CACX,KAAK,MAAQ,KACb,MACF,CAEA,IAAMC,EAAM,KAAK,IAAI,EAErB,KAAK,MAAQD,EAAO,MACpB,KAAK,WAAaC,EAClB,KAAK,MAAQA,EAAMD,EAAO,KAC5B,CAMA,SAA8B,CAC5B,GAAI,CAAC,KAAK,MACR,OAAO,KAGT,IAAMC,EAAM,KAAK,IAAI,EASrB,MALI,CAAC,KAAK,OAAO,SAAS,QAAUA,EAAM,KAAK,YAAcA,GAAO,KAAK,OACvE,KAAK,MAAQ,KACN,MAGF,KAAK,KACd,CASA,YAAY,EAA6B,CACvC,IAAMC,EAAQjB,EAAAA,EAASkB,EAAW,KAAK,MAAM,EACvCC,EAAQ,KAAK,QAAQ,EACrBC,EAASnB,EAAAA,EAAciB,EAAWC,GAAO,WAAa,CAAC,CAAC,CAAC,EAAE,OAASA,GAAO,SAEj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CACxB,CAQA,SAAgBa,EAAiB,EAAc,EAA+C,CAC5F,GAAI,CACF,OAAOR,EAAU,OAAOS,GAAQ,SAAWlB,EAAUkB,CAAG,EAAIA,CAAG,CACjE,OAASC,EAAO,CACd,IAAMC,EAASD,aAAiBtB,EAAY,IAAIsB,EAAM,UAAY,GAQlE,OANAE,EAAY,OACV,iBACA,0DAA0DD,IAC1D,IAAA,GACAD,CACF,EACO,IACT,CACF,CAQA,SAAgBG,EACd,EACA,EACA,EACM,CACF/B,IACF,EAAK,WAAa,IAAIF,EAAeC,CAAM,GAG7CiC,EAAK,UAAU,MAAMhC,CAAM,EAC3BgC,EAAK,UAAU,CACjB,C"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./constants-CqdJhTxH.cjs"),t=require("./identity-DlWRIuwy.cjs"),n=require("./library-request-D7OvTxZV.cjs"),r=require("./unref-CU9Nyz_9.cjs"),i=require("./defineProperty-X1c4tIPD.cjs"),a=require("./compression-CvED_Jel.cjs"),o=require("./deadline-CUGbto-y.cjs"),s=require("./storm-C-zYSdDX.cjs"),c=require("./types-C7WNpnG1.cjs");var l=4,u=3,d=class{constructor(e){i.t(this,`maxBytes`,void 0),i.t(this,`parts`,[]),i.t(this,`sizes`,[]),i.t(this,`total`,0),i.t(this,`starved`,!1),i.t(this,`lost`,0),this.maxBytes=e}add(e,t,n){let r=n&&t===l;if(this.starved&&!r)return this.lost++,!1;(r||this.parts.length===0)&&(this.starved=!1,this.parts.push([]),this.sizes.push(0),this.parts.length>u&&this.dropOldest());let i=this.parts.length-1;this.parts[i].push(e),this.sizes[i]+=e.length,this.total+=e.length;let a=this.maxBytes();for(;this.total>a&&this.parts.length>0;)this.starved=this.parts.length===1,this.lost+=this.dropOldest();return this.starved}take(){let e={texts:this.parts.flat(),lost:this.lost};return this.parts=[],this.sizes=[],this.total=0,this.lost=0,e}clear(){this.parts=[],this.sizes=[],this.total=0,this.starved=!1,this.lost=0}dropOldest(){let[e]=this.parts.splice(0,1),[t]=this.sizes.splice(0,1);return this.total-=t,e.length}},f=[401,403],p=`Error`,m=429,h=500,g=class{constructor(e,t){i.t(this,`config`,void 0),i.t(this,`diagnostics`,void 0),i.t(this,`open`,[]),i.t(this,`openBytes`,0),i.t(this,`flushTimer`,void 0),i.t(this,`queue`,[]),i.t(this,`queueBytes`,0),i.t(this,`busy`,!1),i.t(this,`retryTimer`,void 0),i.t(this,`ids`,void 0),i.t(this,`sequence`,0),i.t(this,`generation`,0),i.t(this,`inFlight`,void 0),this.config=e,this.diagnostics=t}begin(e){e.replayId!==this.ids?.replayId&&(this.sequence=0),this.ids=e}push(e){let{maxSegmentEvents:t,maxSegmentBytes:n,flushIntervalMs:i}=this.config().replay;for(let r of e)this.open.length>0&&this.openBytes+r.length>n&&this.flush(),this.open.push(r),this.openBytes+=r.length,(this.open.length>=t||this.openBytes>=n)&&this.flush();this.open.length>0&&this.flushTimer===void 0&&(this.flushTimer=setTimeout(()=>{this.flushTimer=void 0,this.flush()},i),r.t(this.flushTimer))}flush(){clearTimeout(this.flushTimer),this.flushTimer=void 0;let{ids:e}=this;if(this.open.length===0||!e)return;let t=`[${this.open.join(`,`)}]`,n={"replay.id":e.replayId,"session.id":e.sessionId,"tab.id":e.tabId,"service.name":this.config().serviceName,sequence:this.sequence++,events:this.open.length,bytes:t.length,payload:t};this.open=[],this.openBytes=0,this.queue.push(n),this.queueBytes+=n.bytes;let r=0;for(;this.queueBytes>this.config().replay.maxQueueBytes&&this.queue.length>1;){let[e]=this.queue.splice(0,1);this.queueBytes-=e.bytes,r++}r>0&&this.diagnostics.report(`transport.dropped_permanent`,`The replay queue is above replay.maxQueueBytes. The library dropped ${String(r)} segments.`),this.drain()}discardOpen(){clearTimeout(this.flushTimer),this.flushTimer=void 0,this.open=[],this.openBytes=0}stop(){this.generation++,this.inFlight?.abort(),this.inFlight=void 0,clearTimeout(this.retryTimer),this.retryTimer=void 0,this.discardOpen(),this.queue=[],this.queueBytes=0,this.busy=!1}drain(){if(this.busy||this.queue.length===0)return;let[e]=this.queue.splice(0,1);this.queueBytes-=e.bytes,this.busy=!0,this.deliver(e,1,this.generation)}async deliver(e,t,n){let i=await this.send(e,t,n);if(n!==this.generation)return;let{replay:a,delivery:o}=this.config();if(i===`retry`&&t<a.maxAttempts){let i=Math.min(o.retryBaseDelayMs*2**(t-1),o.retryMaxDelayMs);this.retryTimer=setTimeout(()=>{this.retryTimer=void 0,this.deliver(e,t+1,n)},i),r.t(this.retryTimer)}else i!==`sent`&&this.diagnostics.report(`transport.dropped_permanent`,`The library dropped the replay segment ${String(e.sequence)} after ${String(t)} attempts.`,{"replay.id":e[`replay.id`],sequence:e.sequence}),this.busy=!1,this.drain()}async send(t,i,s){let c=this.config(),{onSegment:l,endpoint:u,headers:d}=c.replay,g=c.delivery.requestTimeoutMs;if(l)try{return await o.n(Promise.resolve(l(t)),g),`sent`}catch(e){return this.diagnostics.report(`capture.record_failed`,`The replay.onSegment function threw an error, or it did not end in ${String(g)} ms.`,void 0,e),`drop`}if(u===null)return`drop`;let _=new AbortController,v=setTimeout(()=>{_.abort()},g);r.t(v);try{let r=typeof d==`function`?await o.n(Promise.resolve(d()),g):d,l=new Headers(r??{});l.set(e.ft,e.z),l.set(e.ut,`${t[`replay.id`]}-${String(t.sequence)}`),l.set(e.lt,String(i-1));let{payload:p,events:v,...y}=t,b=`${JSON.stringify(y).slice(0,-1)},"events":${p}}`,x=b;if(c.compression===`gzip`&&b.length>=1024){let t=await a.t(b);t&&(x=t,l.set(e.dt,e.tt))}if(s!==this.generation)return`drop`;this.inFlight=_;let S=await n.r(()=>fetch(u,{method:`POST`,headers:l,body:x,credentials:c.credentials,cache:`no-store`,signal:_.signal}));return S.ok?`sent`:(this.diagnostics.report(`transport.http_error`,`The replay endpoint returned ${String(S.status)}.`),f.includes(S.status)||S.status===m||S.status>=h?`retry`:`drop`)}catch(e){return this.diagnostics.report(`transport.http_error`,`The replay request failed with ${e instanceof Error?e.name:p}.`),`retry`}finally{clearTimeout(v),this.inFlight=void 0}}},_=`session.id`,v=`tab.id`,y=`*`,b=[`sampling`,`slimDOMOptions`,`ignoreClass`,`ignoreSelector`,`ignoreCSSAttributes`,`userTriggeredOnInput`,`recordAfter`,`inlineStylesheet`,`dataURLOptions`],x={input:!0,textarea:!0,select:!0},S=`********`,C=4,w=3,T=0,E=3,D=class{constructor(e){i.t(this,`ctx`,void 0),i.t(this,`name`,`replay`),i.t(this,`buffer`,void 0),i.t(this,`uploader`,void 0),i.t(this,`window`,{start:0,count:0}),i.t(this,`record`,void 0),i.t(this,`stopRecorder`,void 0),i.t(this,`replayId`,``),i.t(this,`installed`,!1),i.t(this,`starting`,!1),i.t(this,`generation`,0),i.t(this,`live`,!1),i.t(this,`starvedReported`,!1),i.t(this,`liveTimer`,void 0),i.t(this,`maskText`,(e,t)=>{let{maskText:n,maskSelectors:r}=this.ctx.config.replay,i=r.length>0&&t?.closest(r.join(`,`));return n&&!i&&t?.closest(`[data-observability-unmask]`)?e:e.replace(/\S/g,y)}),i.t(this,`maskInput`,e=>e===``?``:S),i.t(this,`transformRequest`,e=>{try{let{capture:t}=this.ctx.config,r=e.name;return n.t()||c.t(r,t.ignoreUrls)?void 0:t.fullUrls?e:{...e,name:r.split(/[?#]/)[0]}}catch(e){this.onFault(e);return}}),i.t(this,`emit`,(e,t)=>{try{this.scrub(e);let n=JSON.stringify(e);if(this.live){this.uploader.push([n]);return}this.buffer.add(n,e.type,t===!0)&&!this.starvedReported&&(this.starvedReported=!0,this.ctx.diagnostics.report(`capture.rate_limited`,`One part of the replay is above replay.maxBufferBytes. The buffer is empty until the next full snapshot. The replay of an error in that time starts at the error, with no events from before it. Raise the limit, or block a large element with replay.blockSelectors.`))}catch(e){this.onFault(e)}}),i.t(this,`onFault`,e=>{this.ctx.diagnostics.report(`capture.record_failed`,`The replay recorder had an error.`,void 0,e)}),i.t(this,`onError`,e=>{let{diagnostics:t,config:n}=this.ctx;t.guard(`capture.record_failed`,`The replay upload did not start.`,()=>{if(!this.record)return;let{afterErrorMs:i,uploadsPerWindow:a}=n.replay;if(this.live||!s.t(this.window,a,t,`replay uploads`,n.replay.uploadWindowMs))return;let{texts:o,lost:c}=this.buffer.take();c>0&&t.report(`capture.rate_limited`,`The replay buffer was above replay.maxBufferBytes. The library dropped ${String(c)} events.`);let{takeFullSnapshot:l}=this.record;if(o.length!==0||l){if(this.uploader.begin({replayId:this.replayId,sessionId:String(e.resource[_]),tabId:String(e.resource[v])}),this.live=!0,o.length===0){if(!t.guard(`capture.record_failed`,`The replay recorder did not take a full snapshot. The library sends no replay for this error.`,()=>(this.record?.takeFullSnapshot?.(!0),!0))){this.live=!1,this.uploader.discardOpen(),this.window.count=Math.max(0,this.window.count-1);return}}else this.uploader.push(o);this.liveTimer=setTimeout(this.endLive,i),r.t(this.liveTimer)}})}),i.t(this,`endLive`,()=>{this.liveTimer=void 0,this.live=!1,this.uploader.flush(),this.ctx.diagnostics.guard(`capture.record_failed`,`The replay recorder did not take a full snapshot.`,()=>{this.record?.takeFullSnapshot?.(!0)})}),this.ctx=e,this.buffer=new d(()=>this.ctx.config.replay.maxBufferBytes),this.uploader=new g(()=>this.ctx.config,this.ctx.diagnostics)}install(){this.installed||(this.installed=!0,this.ctx.onError?.(this.onError),(this.ctx.replayConsent?.()??!this.ctx.config.replay.requireConsent)&&this.start())}uninstall(){this.installed=!1,this.ctx.onError?.(void 0),this.stop()}async start(){let{diagnostics:n}=this.ctx,{loader:r,endpoint:i,onSegment:a,plugins:o}=this.ctx.config.replay;if(!this.installed||this.record||this.starting)return;if(typeof document>`u`){this.reportOnce(`This context has no document. The session replay is off.`);return}if(!r||i===null&&!a){n.report(`config.invalid`,`The session replay needs replay.loader, and replay.endpoint or replay.onSegment. The session replay is off.`);return}let s=this.selectors();if(!s)return;let{generation:c}=this;this.starting=!0;let l=await n.guardAsync(`capture.install_failed`,`The library could not load the replay recorder.`,r),u={transformRequest:this.transformRequest},d=await Promise.all(o.map(e=>n.guardAsync(`capture.install_failed`,`The library could not load a replay plugin.`,()=>Promise.resolve(e(u)))));if(c!==this.generation||(this.starting=!1,!l))return;let{record:f}=l;if(typeof f!=`function`){n.report(`capture.install_failed`,`The replay loader gave no record function. The session replay is off.`);return}let p=this.ctx.config.replay;n.guard(`capture.install_failed`,`The replay recorder did not start.`,()=>{let r={},i=[];for(let[e,t]of Object.entries(p.recordOptions))b.includes(e)?r[e]=t:i.push(e);i.length>0&&n.report(`config.invalid`,`The library ignores these keys of replay.recordOptions: ${i.join(`, `)}. It sets the mask, block, canvas, plugin and event options itself.`),this.starvedReported=!1;let a=f({...r,emit:this.emit,checkoutEveryNms:p.bufferMs/2,maskAllInputs:!1,maskInputOptions:p.maskInputs?x:{password:!0},maskInputFn:this.maskInput,maskTextSelector:s.mask,maskTextFn:this.maskText,blockSelector:s.block,recordCanvas:p.recordCanvas,errorHandler:this.onFault,plugins:d.filter(e=>e!==void 0)});typeof a==`function`?(this.stopRecorder=a,this.record=f,this.replayId=t.i(this.ctx.diagnostics),this.ctx.setContext?.(e.dn,this.replayId)):n.report(`capture.install_failed`,`The replay recorder did not start.`)})}reset(){let e=this.record!==void 0||this.starting;this.stop(),e&&this.start()}stop(){let{stopRecorder:t}=this;this.generation++,this.starting=!1,this.record=void 0,this.stopRecorder=void 0,this.live=!1,clearTimeout(this.liveTimer),this.liveTimer=void 0,this.buffer.clear(),this.uploader.stop(),t&&(this.ctx.setContext?.(e.dn,void 0),this.ctx.diagnostics.guard(`capture.install_failed`,`The replay recorder did not stop.`,t))}selectors(){let{maskText:t,maskSelectors:n,blockSelectors:r}=this.ctx.config.replay;for(let e of[...n,...r])try{document.createDocumentFragment().querySelector(e)}catch(t){this.ctx.diagnostics.report(`config.invalid`,`The replay selector ${e} is not a valid CSS selector. The session replay is off.`,void 0,t);return}return{mask:t?`*`:(e=>e.length>0?e.join(`,`):void 0)(n),block:[e.vt,...r].join(`,`)}}scrub(e){let{data:t}=e;if(t){if(e.type===C)typeof t.href==`string`&&!this.ctx.config.capture.fullUrls&&(t.href=t.href.split(/[?#]/)[0]);else if(e.type===w&&t.source===T){for(let e of t.texts??[])e.value=this.shadowText(e.value,e.id);for(let e of t.adds??[])e.node?.type===E&&(e.node={...e.node,textContent:this.shadowText(e.node.textContent,e.node.id)})}}}shadowText(e,t){let n=this.record?.mirror?.getNode(t);if(typeof e!=`string`||!n||n.parentElement)return e;let{maskText:r,maskSelectors:i}=this.ctx.config.replay,a=n.parentNode?.host??null;return r?this.maskText(e,a):i.length>0&&a?.closest(i.join(`,`))?e.replace(/\S/g,y):e}reportOnce(e){let{once:t}=this.ctx;t.replay||(t.replay=!0,this.ctx.diagnostics.report(`capture.install_failed`,e))}};exports.ReplayCapture=D;
|
|
2
|
+
//# sourceMappingURL=replay-B3gFXIZd.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay-B3gFXIZd.cjs","names":["META_EVENT","withDeadline","HEADER_CONTENT_TYPE","CONTENT_TYPE_JSON","HEADER_BATCH_ID","HEADER_ATTEMPT","gzip","HEADER_CONTENT_ENCODING","ENCODING_GZIP","runAsLibraryRequest","isLibraryRequest","matchesAny","allowInWindow","newId","REPLAY_ID_KEY","IGNORE_SELECTOR","require_constants","require_identity","require_library_request","require_unref","require_defineProperty","require_compression","require_deadline","require_storm","require_types","META_EVENT$1","KEPT_PARTS","ReplayBuffer","maxBytes","opens","isCheckout","type","last","text","limit","taken","part","size","CREDENTIAL_STATUSES","UNKNOWN_ERROR","STATUS_TOO_MANY","STATUS_SERVER_FAULT","ReplayUploader","config","diagnostics","ids","texts","maxSegmentBytes","maxSegmentEvents","flushIntervalMs","payload","segment","dropped","oldest","result","attempt","generation","replay","wait","delivery","source","timeoutMs","onSegment","error","endpoint","controller","timer","given","headers","_count","head","body","zipped","response","SESSION_ID","TAB_ID","MASK_CHARACTER","RECORD_OPTION_KEYS","MASK_EACH_INPUT","MASKED_INPUT","META_EVENT","INCREMENTAL_EVENT","MUTATION_SOURCE","TEXT_NODE","ReplayCapture","forced","maskSelectors","element","maskText","url","request","capture","event","uploadsPerWindow","lost","takeFullSnapshot","record","afterErrorMs","ctx","loader","selectors","loaded","tools","made","plugins","make","extra","ignored","key","value","stopRecorder","plugin","running","selector","blockSelectors","list","data","change","add","node","id","host","once","message"],"sources":["../src/capture/replay-buffer.ts","../src/capture/replay-upload.ts","../src/capture/replay.ts"],"sourcesContent":["// src/capture/replay-buffer.ts\n//\n// Keeps the recent session replay events in memory as JSON text. Events are grouped into\n// parts, and every part starts with a full snapshot, so a player can start from any of them.\n\n/** Event type of the meta event. The recorder sends it right before a full snapshot. */\nconst META_EVENT = 4;\n\n/** How many parts we keep. With a snapshot every half window, 3 parts cover a full window. */\nconst KEPT_PARTS = 3;\n\n/** Size-limited ring of recent replay events. */\nexport class ReplayBuffer {\n /** Events per part, as JSON text. The last part is the open one. */\n private parts: string[][] = [];\n\n /** Size of each part: the sum of its text lengths. */\n private sizes: number[] = [];\n\n /** Size of all parts together. */\n private total = 0;\n\n /**\n * True after the buffer had to drop its only part. Everything up to the next full snapshot\n * has no snapshot in front of it, which makes it useless to a player.\n */\n private starved = false;\n\n /** Events dropped by the size limit since the last take. */\n private lost = 0;\n\n /**\n * @param maxBytes Returns the size limit for all parts together.\n */\n constructor(private readonly maxBytes: () => number) {}\n\n /**\n * Adds one event.\n * @param text The event as JSON text.\n * @param type The recorder's event type.\n * @param isCheckout True for the events of a new full snapshot.\n * @returns True if this event made the buffer drop its only part.\n */\n add(text: string, type: number, isCheckout: boolean): boolean {\n // The meta event and the snapshot both carry the flag, but only the meta event opens a part.\n const opens = isCheckout && type === META_EVENT;\n\n if (this.starved && !opens) {\n this.lost++;\n return false;\n }\n\n if (opens || this.parts.length === 0) {\n this.starved = false;\n this.parts.push([]);\n this.sizes.push(0);\n\n if (this.parts.length > KEPT_PARTS) {\n this.dropOldest();\n }\n }\n\n const last = this.parts.length - 1;\n this.parts[last].push(text);\n this.sizes[last] += text.length;\n this.total += text.length;\n\n const limit = this.maxBytes();\n while (this.total > limit && this.parts.length > 0) {\n // Nothing with a snapshot comes after the last part, so once it goes the events that\n // follow can't be played.\n this.starved = this.parts.length === 1;\n this.lost += this.dropOldest();\n }\n\n return this.starved;\n }\n\n /**\n * Returns every event in order with the dropped count, and empties the buffer. A starved\n * buffer stays starved, because the events after a take still have no snapshot in front.\n * @returns The events as JSON text, and how many events the size limit dropped.\n */\n take(): { texts: string[]; lost: number } {\n const taken = { texts: this.parts.flat(), lost: this.lost };\n this.parts = [];\n this.sizes = [];\n this.total = 0;\n this.lost = 0;\n return taken;\n }\n\n /** Empties the buffer and its dropped count, so the next upload doesn't report old drops. */\n clear(): void {\n this.parts = [];\n this.sizes = [];\n this.total = 0;\n this.starved = false;\n this.lost = 0;\n }\n\n /**\n * Removes the oldest part.\n * @returns The number of events in that part.\n */\n private dropOldest(): number {\n const [part] = this.parts.splice(0, 1);\n const [size] = this.sizes.splice(0, 1);\n this.total -= size;\n return part.length;\n }\n}\n","// src/capture/replay-upload.ts\n//\n// Cuts session replay events into segments and sends them. A segment closes on an event count,\n// on a size, or after a wait. Only one segment is in flight at a time, which keeps them in\n// order. Segments live in memory only, and the exit flush doesn't send them.\n\nimport {\n COMPRESSION_THRESHOLD_BYTES,\n CONTENT_TYPE_JSON,\n ENCODING_GZIP,\n HEADER_ATTEMPT,\n HEADER_BATCH_ID,\n HEADER_CONTENT_ENCODING,\n HEADER_CONTENT_TYPE,\n} from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { ResolvedConfig } from \"../models/config\";\nimport type { ReplaySegment } from \"../models/replay\";\nimport { gzip } from \"../transport/compression\";\nimport { withDeadline } from \"../utils/deadline\";\nimport { runAsLibraryRequest } from \"../utils/library-request\";\nimport { unrefTimer } from \"../utils/unref\";\n\n/** The ids stamped on every segment of a recording. */\nexport interface ReplayIds {\n /** Recording id. */\n replayId: string;\n /** Session id from the record that triggered the upload. */\n sessionId: string;\n /** Tab id from the record that triggered the upload. */\n tabId: string;\n}\n\n/** Outcome of one send. `retry` means a later attempt might work. */\ntype SendResult = \"sent\" | \"retry\" | \"drop\";\n\n/** Statuses that mean our credentials were rejected. The next attempt re-reads the headers. */\nconst CREDENTIAL_STATUSES = [401, 403];\n\n/** Name used for a thrown value that isn't an Error. Reports only ever show the error name. */\nconst UNKNOWN_ERROR = \"Error\";\n\n/** The server is asking us to slow down. */\nconst STATUS_TOO_MANY = 429;\n\n/** Server faults start here. */\nconst STATUS_SERVER_FAULT = 500;\n\n/** Cuts replay events into segments and sends them in order. */\nexport class ReplayUploader {\n /** Events in the open segment, as JSON text. */\n private open: string[] = [];\n\n /** Size of the open segment. */\n private openBytes = 0;\n\n /** Closes a segment that didn't fill up in time. */\n private flushTimer: ReturnType<typeof setTimeout> | undefined;\n\n /** Closed segments waiting to be sent. The one in flight isn't in here. */\n private queue: ReplaySegment[] = [];\n\n /** Total size of the queued segments. */\n private queueBytes = 0;\n\n /** True while a segment is in flight or waiting for its next attempt. */\n private busy = false;\n\n /** Timer for the in-flight segment's next attempt. */\n private retryTimer: ReturnType<typeof setTimeout> | undefined;\n\n /** Ids for the segments we cut next. */\n private ids: ReplayIds | undefined;\n\n /** Sequence number for the recording's next segment. */\n private sequence = 0;\n\n /** Bumped on every stop, so a send that finishes after a stop changes nothing. */\n private generation = 0;\n\n /** Aborts the request in flight. Once stopped, the uploader must not send anything else. */\n private inFlight: AbortController | undefined;\n\n /**\n * @param config Returns the current configuration.\n * @param diagnostics Diagnostics reporter.\n */\n constructor(\n private readonly config: () => ResolvedConfig,\n private readonly diagnostics: Diagnostics,\n ) {}\n\n /**\n * Sets the ids for the segments that follow. A new recording restarts the sequence at 0.\n * @param ids Ids of the recording and of the record that triggered the upload.\n */\n begin(ids: ReplayIds): void {\n if (ids.replayId !== this.ids?.replayId) {\n this.sequence = 0;\n }\n\n this.ids = ids;\n }\n\n /**\n * Adds events. A full segment closes right away, a partial one closes after the wait.\n * @param texts The events as JSON text, in order.\n */\n push(texts: readonly string[]): void {\n const { maxSegmentEvents, maxSegmentBytes, flushIntervalMs } = this.config().replay;\n\n for (const text of texts) {\n // If this event doesn't fit, close the segment first. A huge event ends up in its own.\n if (this.open.length > 0 && this.openBytes + text.length > maxSegmentBytes) {\n this.flush();\n }\n\n this.open.push(text);\n this.openBytes += text.length;\n\n if (this.open.length >= maxSegmentEvents || this.openBytes >= maxSegmentBytes) {\n this.flush();\n }\n }\n\n if (this.open.length > 0 && this.flushTimer === undefined) {\n this.flushTimer = setTimeout(() => {\n this.flushTimer = undefined;\n this.flush();\n }, flushIntervalMs);\n unrefTimer(this.flushTimer);\n }\n }\n\n /** Closes the open segment and gets it sent. */\n flush(): void {\n clearTimeout(this.flushTimer);\n this.flushTimer = undefined;\n\n const { ids } = this;\n if (this.open.length === 0 || !ids) {\n return;\n }\n\n const payload = `[${this.open.join(\",\")}]`;\n const segment: ReplaySegment = {\n \"replay.id\": ids.replayId,\n \"session.id\": ids.sessionId,\n \"tab.id\": ids.tabId,\n \"service.name\": this.config().serviceName,\n sequence: this.sequence++,\n events: this.open.length,\n bytes: payload.length,\n payload,\n };\n this.open = [];\n this.openBytes = 0;\n this.queue.push(segment);\n this.queueBytes += segment.bytes;\n\n let dropped = 0;\n while (this.queueBytes > this.config().replay.maxQueueBytes && this.queue.length > 1) {\n const [oldest] = this.queue.splice(0, 1);\n this.queueBytes -= oldest.bytes;\n dropped++;\n }\n\n if (dropped > 0) {\n this.diagnostics.report(\n \"transport.dropped_permanent\",\n `The replay queue is above replay.maxQueueBytes. The library dropped ${String(dropped)} segments.`,\n );\n }\n\n this.drain();\n }\n\n /**\n * Drops the events of the open segment and keeps the closed ones. A snapshot that fails\n * halfway leaves its first events here, and a lone meta event is useless to a player.\n */\n discardOpen(): void {\n clearTimeout(this.flushTimer);\n this.flushTimer = undefined;\n this.open = [];\n this.openBytes = 0;\n }\n\n /** Drops everything that is waiting. A send still in flight no longer changes any state. */\n stop(): void {\n this.generation++;\n this.inFlight?.abort();\n this.inFlight = undefined;\n clearTimeout(this.retryTimer);\n this.retryTimer = undefined;\n this.discardOpen();\n this.queue = [];\n this.queueBytes = 0;\n this.busy = false;\n }\n\n /** Sends the next segment, unless one is already in flight. */\n private drain(): void {\n if (this.busy || this.queue.length === 0) {\n return;\n }\n\n const [segment] = this.queue.splice(0, 1);\n this.queueBytes -= segment.bytes;\n this.busy = true;\n void this.deliver(segment, 1, this.generation);\n }\n\n /**\n * Sends one segment, backing off before each retry.\n * @param segment The segment to send.\n * @param attempt Attempt number, starting at 1.\n * @param generation The uploader's generation when the send started.\n */\n private async deliver(\n segment: ReplaySegment,\n attempt: number,\n generation: number,\n ): Promise<void> {\n const result = await this.send(segment, attempt, generation);\n\n if (generation !== this.generation) {\n return;\n }\n\n const { replay, delivery } = this.config();\n if (result === \"retry\" && attempt < replay.maxAttempts) {\n const wait = Math.min(\n delivery.retryBaseDelayMs * 2 ** (attempt - 1),\n delivery.retryMaxDelayMs,\n );\n this.retryTimer = setTimeout(() => {\n this.retryTimer = undefined;\n void this.deliver(segment, attempt + 1, generation);\n }, wait);\n unrefTimer(this.retryTimer);\n return;\n }\n\n if (result !== \"sent\") {\n this.diagnostics.report(\n \"transport.dropped_permanent\",\n `The library dropped the replay segment ${String(segment.sequence)} after ${String(attempt)} attempts.`,\n { \"replay.id\": segment[\"replay.id\"], sequence: segment.sequence },\n );\n }\n\n this.busy = false;\n this.drain();\n }\n\n /**\n * Hands a segment to the app's onSegment function, or posts it to the endpoint. Never throws.\n * @param segment The segment to send.\n * @param attempt Attempt number, starting at 1.\n * @param generation The uploader's generation when the send started.\n * @returns How the send went.\n */\n private async send(\n segment: ReplaySegment,\n attempt: number,\n generation: number,\n ): Promise<SendResult> {\n const config = this.config();\n const { onSegment, endpoint, headers: source } = config.replay;\n const timeoutMs = config.delivery.requestTimeoutMs;\n\n if (onSegment) {\n try {\n // Don't let a callback that never settles block the uploader forever.\n await withDeadline(Promise.resolve(onSegment(segment)), timeoutMs);\n return \"sent\";\n } catch (error) {\n this.diagnostics.report(\n \"capture.record_failed\",\n `The replay.onSegment function threw an error, or it did not end in ${String(timeoutMs)} ms.`,\n undefined,\n error,\n );\n return \"drop\";\n }\n }\n\n // The capture starts only with an endpoint or onSegment, but a later configure() can remove\n // both while a segment waits.\n if (endpoint === null) {\n return \"drop\";\n }\n\n const controller = new AbortController();\n const timer = setTimeout(() => {\n controller.abort();\n }, timeoutMs);\n unrefTimer(timer);\n\n try {\n // The replay endpoint only gets replay.headers. The log endpoint's headers may carry a\n // token meant for a different host.\n const given =\n typeof source === \"function\"\n ? await withDeadline(Promise.resolve(source()), timeoutMs)\n : source;\n const headers = new Headers(given ?? {});\n headers.set(HEADER_CONTENT_TYPE, CONTENT_TYPE_JSON);\n headers.set(HEADER_BATCH_ID, `${segment[\"replay.id\"]}-${String(segment.sequence)}`);\n headers.set(HEADER_ATTEMPT, String(attempt - 1));\n\n // In the body \"events\" is the event list itself. Its length is the count.\n const { payload, events: _count, ...head } = segment;\n const text = `${JSON.stringify(head).slice(0, -1)},\"events\":${payload}}`;\n let body: string | Uint8Array<ArrayBuffer> = text;\n\n if (config.compression === ENCODING_GZIP && text.length >= COMPRESSION_THRESHOLD_BYTES) {\n const zipped = await gzip(text);\n\n if (zipped) {\n body = zipped;\n headers.set(HEADER_CONTENT_ENCODING, ENCODING_GZIP);\n }\n }\n\n // If we were stopped during the awaits above, send nothing.\n if (generation !== this.generation) {\n return \"drop\";\n }\n\n this.inFlight = controller;\n\n // Network capture skips requests started in this scope. The replay endpoint is also in\n // capture.ignoreUrls, in case some wrapper starts the request later.\n const response = await runAsLibraryRequest(() =>\n fetch(endpoint, {\n method: \"POST\",\n headers,\n body,\n credentials: config.credentials,\n cache: \"no-store\",\n signal: controller.signal,\n }),\n );\n\n if (response.ok) {\n return \"sent\";\n }\n\n this.diagnostics.report(\n \"transport.http_error\",\n `The replay endpoint returned ${String(response.status)}.`,\n );\n\n return CREDENTIAL_STATUSES.includes(response.status) ||\n response.status === STATUS_TOO_MANY ||\n response.status >= STATUS_SERVER_FAULT\n ? \"retry\"\n : \"drop\";\n } catch (error) {\n // A request error's message can contain the URL, and a URL can contain a credential.\n this.diagnostics.report(\n \"transport.http_error\",\n `The replay request failed with ${error instanceof Error ? error.name : UNKNOWN_ERROR}.`,\n );\n return \"retry\";\n } finally {\n clearTimeout(timer);\n this.inFlight = undefined;\n }\n }\n}\n","// src/capture/replay.ts\n//\n// Session replay. The app's recorder package records the DOM, and this capture keeps the recent\n// events in memory. When an ERROR or FATAL record comes through, it uploads the buffer plus a\n// few seconds of what happens next. All text and input values are masked by default.\n\nimport { IGNORE_SELECTOR, REPLAY_ID_KEY, REPLAY_UNMASK_ATTRIBUTE } from \"../constants\";\nimport type { LogRecord } from \"../models/log-record\";\nimport type { ReplayEvent, ReplayPluginTools, ReplayRecord } from \"../models/replay\";\nimport { newId } from \"../utils/identity\";\nimport { isLibraryRequest } from \"../utils/library-request\";\nimport { unrefTimer } from \"../utils/unref\";\nimport { ReplayBuffer } from \"./replay-buffer\";\nimport { ReplayUploader } from \"./replay-upload\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport { type Capture, type CaptureContext, matchesAny } from \"./types\";\n\n/** Resource attribute for the session id. */\nconst SESSION_ID = \"session.id\";\n\n/** Resource attribute for the tab id. */\nconst TAB_ID = \"tab.id\";\n\n/** Every non-space character of masked text becomes this. */\nconst MASK_CHARACTER = \"*\";\n\n/**\n * The replay.recordOptions keys we pass through to the recorder. Everything else the recorder\n * accepts is a mask, block, canvas, plugin or event option, and those are ours to set.\n */\nconst RECORD_OPTION_KEYS = [\n \"sampling\",\n \"slimDOMOptions\",\n \"ignoreClass\",\n \"ignoreSelector\",\n \"ignoreCSSAttributes\",\n \"userTriggeredOnInput\",\n \"recordAfter\",\n \"inlineStylesheet\",\n \"dataURLOptions\",\n];\n\n/**\n * Per-element input mask for the recorder. We don't use its \"mask all inputs\" switch because\n * that list leaves out hidden and file inputs.\n */\nconst MASK_EACH_INPUT = { input: true, textarea: true, select: true };\n\n/** What every masked input value turns into. Fixed length, so it doesn't give away a PIN's. */\nconst MASKED_INPUT = \"********\";\n\n/** Event type of the meta event, which carries the page URL. */\nconst META_EVENT = 4;\n\n/** Event type of an incremental snapshot. */\nconst INCREMENTAL_EVENT = 3;\n\n/** Incremental snapshot source for DOM mutations. */\nconst MUTATION_SOURCE = 0;\n\n/** Node type of a text node in the recorder's serialized nodes. */\nconst TEXT_NODE = 3;\n\n/** The bits of a recorder event we rewrite before keeping it. */\ninterface ScrubData {\n /** Page URL, on a meta event. */\n href?: unknown;\n /** Source of an incremental snapshot. */\n source?: unknown;\n /** Text changes in a mutation. */\n texts?: { id: number; value: unknown }[];\n /** Nodes added by a mutation. */\n adds?: { node?: { id: number; type: number; textContent?: unknown } }[];\n}\n\n/** Records the DOM and uploads the recent events after an error. */\nexport class ReplayCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"replay\";\n\n /** Recent events. An upload empties it. */\n private readonly buffer: ReplayBuffer;\n\n /** Cuts the events into segments and sends them. */\n private readonly uploader: ReplayUploader;\n\n /** Upload rate limit, so an error storm doesn't upload the page over and over. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /** The recorder's record function. Undefined while the recorder isn't running. */\n private record: ReplayRecord | undefined;\n\n /** Stops the recorder. */\n private stopRecorder: (() => void) | undefined;\n\n /** Id of the current recording. */\n private replayId = \"\";\n\n /** True between install() and uninstall(). */\n private installed = false;\n\n /** True while start() is loading the recorder. */\n private starting = false;\n\n /** Bumped on every stop, so a start that finishes after a stop records nothing. */\n private generation = 0;\n\n /** True right after an error, while new events go straight to the uploader. */\n private live = false;\n\n /** True once we've reported a full snapshot that doesn't fit in the buffer. */\n private starvedReported = false;\n\n /** Ends the live period after an error. */\n private liveTimer: ReturnType<typeof setTimeout> | undefined;\n\n /**\n * @param ctx Capture context: configuration, diagnostics and the runtime hooks.\n */\n constructor(private readonly ctx: CaptureContext) {\n this.buffer = new ReplayBuffer(() => this.ctx.config.replay.maxBufferBytes);\n this.uploader = new ReplayUploader(() => this.ctx.config, this.ctx.diagnostics);\n }\n\n /** Starts listening for error records, and starts the recorder unless consent is still needed. */\n install(): void {\n if (this.installed) {\n return;\n }\n\n this.installed = true;\n this.ctx.onError?.(this.onError);\n\n // If the app called stopReplay(), that still holds after the captures are reinstalled.\n if (this.ctx.replayConsent?.() ?? !this.ctx.config.replay.requireConsent) {\n void this.start();\n }\n }\n\n /** Stops the recorder and drops whatever hasn't been sent. */\n uninstall(): void {\n this.installed = false;\n this.ctx.onError?.(undefined);\n this.stop();\n }\n\n /**\n * Loads the recorder and starts it. Never rejects.\n * @returns A promise that resolves once the recorder is running, or can't run.\n */\n async start(): Promise<void> {\n const { diagnostics } = this.ctx;\n const { loader, endpoint, onSegment, plugins } = this.ctx.config.replay;\n\n if (!this.installed || this.record || this.starting) {\n return;\n }\n\n if (typeof document === \"undefined\") {\n this.reportOnce(\"This context has no document. The session replay is off.\");\n return;\n }\n\n if (!loader || (endpoint === null && !onSegment)) {\n diagnostics.report(\n \"config.invalid\",\n \"The session replay needs replay.loader, and replay.endpoint or replay.onSegment. The session replay is off.\",\n );\n return;\n }\n\n const selectors = this.selectors();\n if (!selectors) {\n return;\n }\n\n const { generation } = this;\n this.starting = true;\n const loaded = await diagnostics.guardAsync(\n \"capture.install_failed\",\n \"The library could not load the replay recorder.\",\n loader,\n );\n const tools: ReplayPluginTools = { transformRequest: this.transformRequest };\n const made = await Promise.all(\n plugins.map((make) =>\n diagnostics.guardAsync(\n \"capture.install_failed\",\n \"The library could not load a replay plugin.\",\n () => Promise.resolve(make(tools)),\n ),\n ),\n );\n\n // A stop or an uninstall while we were loading cancels this start.\n if (generation !== this.generation) {\n return;\n }\n\n this.starting = false;\n\n // The loader failed, and the guard has already reported it.\n if (!loaded) {\n return;\n }\n\n const { record } = loaded;\n if (typeof record !== \"function\") {\n diagnostics.report(\n \"capture.install_failed\",\n \"The replay loader gave no record function. The session replay is off.\",\n );\n return;\n }\n\n const config = this.ctx.config.replay;\n diagnostics.guard(\"capture.install_failed\", \"The replay recorder did not start.\", () => {\n const extra: Record<string, unknown> = {};\n const ignored: string[] = [];\n\n for (const [key, value] of Object.entries(config.recordOptions)) {\n if (RECORD_OPTION_KEYS.includes(key)) {\n extra[key] = value;\n } else {\n ignored.push(key);\n }\n }\n\n if (ignored.length > 0) {\n diagnostics.report(\n \"config.invalid\",\n `The library ignores these keys of replay.recordOptions: ${ignored.join(\", \")}. It sets the mask, block, canvas, plugin and event options itself.`,\n );\n }\n\n // The real recorder takes its first snapshot inside record(), so a starve report can come\n // before record() returns.\n this.starvedReported = false;\n\n const stopRecorder = record({\n ...extra,\n emit: this.emit,\n // Take a full snapshot every half window, so the buffer always begins with one.\n checkoutEveryNms: config.bufferMs / 2,\n // The per-element list covers every input type. Passwords are masked no matter what.\n maskAllInputs: false,\n maskInputOptions: config.maskInputs ? MASK_EACH_INPUT : { password: true },\n maskInputFn: this.maskInput,\n maskTextSelector: selectors.mask,\n maskTextFn: this.maskText,\n blockSelector: selectors.block,\n recordCanvas: config.recordCanvas,\n errorHandler: this.onFault,\n plugins: made.filter((plugin) => plugin !== undefined),\n });\n\n // The recorder swallows errors from its own startup and just returns no stop function.\n if (typeof stopRecorder !== \"function\") {\n diagnostics.report(\"capture.install_failed\", \"The replay recorder did not start.\");\n return;\n }\n\n this.stopRecorder = stopRecorder;\n this.record = record;\n this.replayId = newId(this.ctx.diagnostics);\n this.ctx.setContext?.(REPLAY_ID_KEY, this.replayId);\n });\n }\n\n /**\n * Drops the buffer and, if the recorder was running, starts a fresh recording. The runtime\n * calls this on a new session, so the next user never gets the previous user's page.\n */\n reset(): void {\n const running = this.record !== undefined || this.starting;\n\n this.stop();\n if (running) {\n void this.start();\n }\n }\n\n /** Stops the recorder and drops whatever hasn't been sent. */\n stop(): void {\n const { stopRecorder } = this;\n\n this.generation++;\n this.starting = false;\n this.record = undefined;\n this.stopRecorder = undefined;\n this.live = false;\n clearTimeout(this.liveTimer);\n this.liveTimer = undefined;\n this.buffer.clear();\n this.uploader.stop();\n\n if (stopRecorder) {\n this.ctx.setContext?.(REPLAY_ID_KEY, undefined);\n this.ctx.diagnostics.guard(\n \"capture.install_failed\",\n \"The replay recorder did not stop.\",\n stopRecorder,\n );\n }\n }\n\n /**\n * Reads the mask and block selectors. An invalid selector aborts the start: a replay with a\n * missing mask would show text the app meant to hide.\n * @returns The selectors for the recorder, or undefined if one of them is invalid.\n */\n private selectors(): { mask: string | undefined; block: string } | undefined {\n const { maskText, maskSelectors, blockSelectors } = this.ctx.config.replay;\n\n for (const selector of [...maskSelectors, ...blockSelectors]) {\n try {\n document.createDocumentFragment().querySelector(selector);\n } catch (error) {\n this.ctx.diagnostics.report(\n \"config.invalid\",\n `The replay selector ${selector} is not a valid CSS selector. The session replay is off.`,\n undefined,\n error,\n );\n return undefined;\n }\n }\n\n const join = (list: string[]): string | undefined =>\n list.length > 0 ? list.join(\",\") : undefined;\n\n // Click capture skips the ignored regions, so a replay must not show them either. The app\n // can't turn this off.\n return {\n mask: maskText ? \"*\" : join(maskSelectors),\n block: [IGNORE_SELECTOR, ...blockSelectors].join(\",\"),\n };\n }\n\n /**\n * Masks one piece of page text. The recorder calls this for every text the mask selector\n * matches.\n * @param text The node's text.\n * @param element The element that holds the text, or null.\n * @returns The text to record.\n */\n private readonly maskText = (text: string, element: Element | null): string => {\n const { maskText, maskSelectors } = this.ctx.config.replay;\n const forced = maskSelectors.length > 0 && element?.closest(maskSelectors.join(\",\"));\n\n // With maskText off, the recorder only calls us for text under a mask selector.\n if (maskText && !forced && element?.closest(`[${REPLAY_UNMASK_ATTRIBUTE}]`)) {\n return text;\n }\n\n return text.replace(/\\S/g, MASK_CHARACTER);\n };\n\n /**\n * Masks an input value. The result always has the same length.\n * @param text The input's value.\n * @returns The text to record.\n */\n private readonly maskInput = (text: string): string => (text === \"\" ? \"\" : MASKED_INPUT);\n\n /**\n * Strips what the recorder's own masking misses: the query string of the page URL, and text\n * sitting directly in a shadow root that changed after the snapshot.\n * @param event Recorder event.\n */\n private scrub(event: ReplayEvent): void {\n const { data } = event as { data?: ScrubData };\n\n if (!data) {\n return;\n }\n\n if (event.type === META_EVENT) {\n // A signed URL is a credential. Only keep the query when fullUrls is on.\n if (typeof data.href === \"string\" && !this.ctx.config.capture.fullUrls) {\n data.href = data.href.split(/[?#]/)[0];\n }\n return;\n }\n\n if (event.type !== INCREMENTAL_EVENT || data.source !== MUTATION_SOURCE) {\n return;\n }\n\n for (const change of data.texts ?? []) {\n change.value = this.shadowText(change.value, change.id);\n }\n\n for (const add of data.adds ?? []) {\n if (add.node?.type === TEXT_NODE) {\n // The recorder holds on to this node object, so change a copy.\n add.node = {\n ...add.node,\n textContent: this.shadowText(add.node.textContent, add.node.id),\n };\n }\n }\n }\n\n /**\n * Masks text that sits directly in a shadow root. The recorder masks it in a full snapshot\n * but not in later mutations.\n * @param text Text from the mutation.\n * @param id The recorder's id for the text node.\n * @returns The text to record.\n */\n private shadowText(text: unknown, id: number): unknown {\n const node = this.record?.mirror?.getNode(id) as Node | null | undefined;\n\n // Text with an element parent has already been through the recorder's mask function.\n if (typeof text !== \"string\" || !node || node.parentElement) {\n return text;\n }\n\n const { maskText, maskSelectors } = this.ctx.config.replay;\n const host = (node.parentNode as ShadowRoot | null)?.host ?? null;\n\n if (maskText) {\n return this.maskText(text, host);\n }\n\n return maskSelectors.length > 0 && host?.closest(maskSelectors.join(\",\"))\n ? text.replace(/\\S/g, MASK_CHARACTER)\n : text;\n }\n\n /**\n * Vets a request from the recorder's network plugin.\n * @param request The plugin's request.\n * @returns The request to record, or undefined to skip it.\n */\n private readonly transformRequest: ReplayPluginTools[\"transformRequest\"] = (request) => {\n // The plugin calls this from inside its fetch wrapper, so a throw here could reach the\n // app's request.\n try {\n const { capture } = this.ctx.config;\n const url = request.name;\n\n // The plugin calls us after the request, outside the library-request scope, so also check\n // the ignore list. It has every library endpoint, including the replay one. Otherwise a\n // recorded upload becomes a new event, which becomes a new upload.\n if (isLibraryRequest() || matchesAny(url, capture.ignoreUrls)) {\n return undefined;\n }\n\n // A signed URL is a credential. Only keep the query when fullUrls is on.\n return capture.fullUrls ? request : { ...request, name: url.split(/[?#]/)[0] };\n } catch (error) {\n this.onFault(error);\n return undefined;\n }\n };\n\n /**\n * Receives one event from the recorder, which calls this from its observers.\n * @param event Recorder event.\n * @param isCheckout True for the events of a new full snapshot.\n */\n private readonly emit = (event: ReplayEvent, isCheckout?: boolean): void => {\n try {\n this.scrub(event);\n\n // Stringify once: we need the text for the upload and for the size limit anyway.\n const text = JSON.stringify(event);\n\n if (this.live) {\n this.uploader.push([text]);\n return;\n }\n\n if (this.buffer.add(text, event.type, isCheckout === true) && !this.starvedReported) {\n this.starvedReported = true;\n this.ctx.diagnostics.report(\n \"capture.rate_limited\",\n \"One part of the replay is above replay.maxBufferBytes. The buffer is empty until the next full snapshot. The replay of an error in that time starts at the error, with no events from before it. Raise the limit, or block a large element with replay.blockSelectors.\",\n );\n }\n } catch (error) {\n this.onFault(error);\n }\n };\n\n /**\n * Reports an error from the recorder, or from serializing an event.\n * @param error What the recorder caught.\n */\n private readonly onFault = (error: unknown): void => {\n this.ctx.diagnostics.report(\n \"capture.record_failed\",\n \"The replay recorder had an error.\",\n undefined,\n error,\n );\n };\n\n /**\n * Starts an upload when an ERROR or FATAL record comes through.\n * @param record The record the runtime emitted.\n */\n private readonly onError = (record: LogRecord): void => {\n const { diagnostics, config } = this.ctx;\n\n diagnostics.guard(\"capture.record_failed\", \"The replay upload did not start.\", () => {\n if (!this.record) {\n return;\n }\n\n const { afterErrorMs, uploadsPerWindow } = config.replay;\n\n // An error during the live period rides along in the same upload and doesn't extend it.\n // That way a stream of errors can't hold the upload open, and the upload limit still bites.\n if (\n this.live ||\n !allowInWindow(\n this.window,\n uploadsPerWindow,\n diagnostics,\n \"replay uploads\",\n config.replay.uploadWindowMs,\n )\n ) {\n return;\n }\n\n const { texts, lost } = this.buffer.take();\n if (lost > 0) {\n diagnostics.report(\n \"capture.rate_limited\",\n `The replay buffer was above replay.maxBufferBytes. The library dropped ${String(lost)} events.`,\n );\n }\n\n const { takeFullSnapshot } = this.record;\n\n // An empty buffer has no full snapshot, and a player can't do anything without one.\n if (texts.length === 0 && !takeFullSnapshot) {\n return;\n }\n\n this.uploader.begin({\n replayId: this.replayId,\n sessionId: String(record.resource[SESSION_ID]),\n tabId: String(record.resource[TAB_ID]),\n });\n this.live = true;\n\n if (texts.length === 0) {\n // We're live, so this snapshot goes straight to the uploader. The real recorder throws\n // here before its start, and without the reset the live period would never end.\n const taken = diagnostics.guard(\n \"capture.record_failed\",\n \"The replay recorder did not take a full snapshot. The library sends no replay for this error.\",\n () => {\n this.record?.takeFullSnapshot?.(true);\n return true;\n },\n );\n\n // Nothing went out, so drop what a half-done snapshot left and give the slot back.\n // The uploader's open segment was empty, because live was off until begin().\n if (!taken) {\n this.live = false;\n this.uploader.discardOpen();\n this.window.count = Math.max(0, this.window.count - 1);\n return;\n }\n } else {\n this.uploader.push(texts);\n }\n\n this.liveTimer = setTimeout(this.endLive, afterErrorMs);\n unrefTimer(this.liveTimer);\n });\n };\n\n /** Ends the live period. The buffer starts over with a full snapshot. */\n private readonly endLive = (): void => {\n this.liveTimer = undefined;\n this.live = false;\n this.uploader.flush();\n this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The replay recorder did not take a full snapshot.\",\n () => {\n this.record?.takeFullSnapshot?.(true);\n },\n );\n };\n\n /**\n * Reports why the replay is off, once per document.\n * @param message Report text.\n */\n private reportOnce(message: string): void {\n const { once } = this.ctx;\n\n if (!once.replay) {\n once.replay = true;\n this.ctx.diagnostics.report(\"capture.install_failed\", message);\n }\n }\n}\n"],"mappings":"A,2VAMA,IAAMA,EAAa,EAGb0B,EAAa,EAGNC,EAAb,KAA0B,CAsBxB,YAAY,EAAyC,CAAxBP,EAAA,EAAA,KAAA,WAAA,IAAA,EAAA,EApB7BA,EAAA,EAAA,KAAA,QAA4B,CAAC,CAAA,EAG7BA,EAAA,EAAA,KAAA,QAA0B,CA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