@utk09/ui-observability 0.11.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +481 -0
- package/README.md +73 -669
- package/bin/uiobs.mjs +1 -1
- package/dist/{batch-CL9uWYY3.js → batch-CXmPmTse.js} +3 -3
- package/dist/batch-CXmPmTse.js.map +1 -0
- package/dist/{batch-C8OcWR2L.cjs → batch-mmPigCpi.cjs} +2 -2
- package/dist/batch-mmPigCpi.cjs.map +1 -0
- package/dist/bus/bus.d.cts +331 -0
- package/dist/bus/bus.d.ts +108 -57
- package/dist/bus/links.d.cts +132 -0
- package/dist/bus/links.d.ts +22 -7
- package/dist/bus/validation.d.cts +16 -0
- package/dist/bus/validation.d.ts +11 -2
- package/dist/bus-C39wspFV.js +775 -0
- package/dist/bus-C39wspFV.js.map +1 -0
- package/dist/bus-_EaOVPGq.cjs +2 -0
- package/dist/bus-_EaOVPGq.cjs.map +1 -0
- package/dist/capture/console.d.cts +37 -0
- package/dist/capture/console.d.ts +11 -11
- package/dist/capture/errors.d.cts +32 -0
- package/dist/capture/errors.d.ts +7 -7
- package/dist/capture/interactions.d.cts +48 -0
- package/dist/capture/interactions.d.ts +15 -15
- package/dist/capture/lifecycle.d.cts +20 -0
- package/dist/capture/lifecycle.d.ts +4 -4
- package/dist/capture/long-frames.d.cts +31 -0
- package/dist/capture/long-frames.d.ts +7 -7
- package/dist/capture/network.d.cts +57 -0
- package/dist/capture/network.d.ts +18 -18
- package/dist/capture/profiler-frames.d.cts +44 -0
- package/dist/capture/profiler-frames.d.ts +44 -0
- package/dist/capture/replay-buffer.d.cts +45 -0
- package/dist/capture/replay-buffer.d.ts +45 -0
- package/dist/capture/replay-upload.d.cts +79 -0
- package/dist/capture/replay-upload.d.ts +79 -0
- package/dist/capture/replay.d.cts +114 -0
- package/dist/capture/replay.d.ts +114 -0
- package/dist/capture/reports.d.cts +17 -0
- package/dist/capture/reports.d.ts +3 -3
- package/dist/capture/resource-timing.d.cts +14 -0
- package/dist/capture/resource-timing.d.ts +2 -2
- package/dist/capture/server-timing.d.cts +19 -0
- package/dist/capture/server-timing.d.ts +3 -3
- package/dist/capture/storm.d.cts +13 -0
- package/dist/capture/storm.d.ts +7 -7
- package/dist/capture/types.d.cts +128 -0
- package/dist/capture/types.d.ts +54 -41
- package/dist/capture/unclean-exit.d.cts +31 -0
- package/dist/capture/unclean-exit.d.ts +9 -9
- package/dist/capture/user-timing.d.cts +22 -0
- package/dist/capture/user-timing.d.ts +4 -4
- package/dist/capture/web-socket.d.cts +40 -0
- package/dist/capture/web-socket.d.ts +14 -14
- package/dist/capture/web-vitals.d.cts +40 -0
- package/dist/capture/web-vitals.d.ts +21 -8
- package/dist/compression-CvED_Jel.cjs +2 -0
- package/dist/compression-CvED_Jel.cjs.map +1 -0
- package/dist/compression-tVtXwVjX.js +11 -0
- package/dist/compression-tVtXwVjX.js.map +1 -0
- package/dist/config-DUs7uHHt.cjs +2 -0
- package/dist/config-DUs7uHHt.cjs.map +1 -0
- package/dist/config-SgQcCP1_.js +560 -0
- package/dist/config-SgQcCP1_.js.map +1 -0
- package/dist/console-BGgGnjSi.js +81 -0
- package/dist/console-BGgGnjSi.js.map +1 -0
- package/dist/console-CSZ5_Vx5.cjs +2 -0
- package/dist/console-CSZ5_Vx5.cjs.map +1 -0
- package/dist/constants-CUyd9cTZ.js +357 -0
- package/dist/constants-CUyd9cTZ.js.map +1 -0
- package/dist/constants-CqdJhTxH.cjs +2 -0
- package/dist/constants-CqdJhTxH.cjs.map +1 -0
- package/dist/constants.d.cts +751 -0
- package/dist/constants.d.ts +231 -116
- package/dist/core/breadcrumbs.d.cts +54 -0
- package/dist/core/breadcrumbs.d.ts +21 -15
- package/dist/core/config.d.cts +45 -0
- package/dist/core/config.d.ts +33 -5
- package/dist/core/context.d.cts +24 -0
- package/dist/core/context.d.ts +8 -13
- package/dist/core/debug-buffer.d.cts +34 -0
- package/dist/core/debug-buffer.d.ts +13 -13
- package/dist/core/debug-bundle.d.cts +12 -0
- package/dist/core/debug-bundle.d.ts +6 -6
- package/dist/core/deferred.d.cts +7 -0
- package/dist/core/deferred.d.ts +4 -4
- package/dist/core/diagnostics.d.cts +86 -0
- package/dist/core/diagnostics.d.ts +25 -22
- package/dist/core/drops.d.cts +39 -0
- package/dist/core/drops.d.ts +22 -12
- package/dist/core/hold-buffer.d.cts +36 -0
- package/dist/core/hold-buffer.d.ts +16 -7
- package/dist/core/journey.d.cts +148 -0
- package/dist/core/journey.d.ts +28 -29
- package/dist/core/logger.d.cts +141 -0
- package/dist/core/logger.d.ts +45 -51
- package/dist/core/measure.d.cts +30 -0
- package/dist/core/measure.d.ts +21 -10
- package/dist/core/meter.d.cts +78 -0
- package/dist/core/meter.d.ts +38 -28
- package/dist/core/pipeline.d.cts +227 -0
- package/dist/core/pipeline.d.ts +114 -50
- package/dist/core/profile-buckets.d.cts +31 -0
- package/dist/core/profile-buckets.d.ts +31 -0
- package/dist/core/profiler.d.cts +218 -0
- package/dist/core/profiler.d.ts +218 -0
- package/dist/core/record.d.cts +190 -0
- package/dist/core/record.d.ts +67 -35
- package/dist/core/remote-rules.d.cts +17 -0
- package/dist/core/remote-rules.d.ts +7 -7
- package/dist/core/remote-sampling.d.cts +74 -0
- package/dist/core/remote-sampling.d.ts +24 -23
- package/dist/core/rotation.d.cts +75 -0
- package/dist/core/rotation.d.ts +75 -0
- package/dist/core/runtime.d.cts +765 -0
- package/dist/core/runtime.d.ts +430 -186
- package/dist/core/sampling.d.cts +86 -0
- package/dist/core/sampling.d.ts +22 -22
- package/dist/core/sender.d.cts +161 -0
- package/dist/core/sender.d.ts +80 -34
- package/dist/core/spans.d.cts +39 -0
- package/dist/core/spans.d.ts +6 -6
- package/dist/{deadline-BOjOxNHj.js → deadline-C4ccAuk5.js} +3 -6
- package/dist/deadline-C4ccAuk5.js.map +1 -0
- package/dist/deadline-CUGbto-y.cjs +2 -0
- package/dist/deadline-CUGbto-y.cjs.map +1 -0
- package/dist/debug-bundle-BXIlwDKM.cjs +2 -0
- package/dist/debug-bundle-BXIlwDKM.cjs.map +1 -0
- package/dist/debug-bundle-CRpYV_ui.js +35 -0
- package/dist/debug-bundle-CRpYV_ui.js.map +1 -0
- package/dist/defineProperty-X1c4tIPD.cjs +1 -0
- package/dist/defineProperty-s2S8BXUc.js +35 -0
- package/dist/doctor.cjs +1 -1
- package/dist/doctor.cjs.map +1 -1
- package/dist/doctor.d.cts +36 -0
- package/dist/doctor.d.ts +19 -6
- package/dist/doctor.js +180 -53
- package/dist/doctor.js.map +1 -1
- package/dist/error-like-B11pB4aL.js.map +1 -1
- package/dist/error-like-gGRx2s36.cjs.map +1 -1
- package/dist/errors-BE_EZV7Q.js +86 -0
- package/dist/errors-BE_EZV7Q.js.map +1 -0
- package/dist/errors-CNPbesMs.cjs +3 -0
- package/dist/errors-CNPbesMs.cjs.map +1 -0
- package/dist/factory-CTi0Is3F.js +404 -0
- package/dist/factory-CTi0Is3F.js.map +1 -0
- package/dist/factory-hRrH32v5.cjs +2 -0
- package/dist/factory-hRrH32v5.cjs.map +1 -0
- package/dist/fixed-window-CvESpFYV.cjs.map +1 -1
- package/dist/fixed-window-Dq3MLUUv.js.map +1 -1
- package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
- package/dist/global-scope-D9I8s-oN.js.map +1 -1
- package/dist/guards-BlYGRK4l.js +10 -0
- package/dist/guards-BlYGRK4l.js.map +1 -0
- package/dist/guards-EjG3ahFp.cjs +2 -0
- package/dist/guards-EjG3ahFp.cjs.map +1 -0
- package/dist/{identity-DT5VmvXy.js → identity-DdhKgrpk.js} +11 -15
- package/dist/identity-DdhKgrpk.js.map +1 -0
- package/dist/identity-DlWRIuwy.cjs +2 -0
- package/dist/identity-DlWRIuwy.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +300 -0
- package/dist/index.d.ts +165 -141
- package/dist/index.js +1283 -1468
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-CL9uqBCy.cjs +2 -0
- package/dist/indexeddb-storage-CL9uqBCy.cjs.map +1 -0
- package/dist/{indexeddb-storage-BJVtiQKm.js → indexeddb-storage-GHdl0t8A.js} +51 -47
- package/dist/indexeddb-storage-GHdl0t8A.js.map +1 -0
- package/dist/interactions-CUkzK8sR.cjs +2 -0
- package/dist/interactions-CUkzK8sR.cjs.map +1 -0
- package/dist/{interactions-DTgKy_6K.js → interactions-DiFvCosX.js} +41 -49
- package/dist/interactions-DiFvCosX.js.map +1 -0
- package/dist/journey-B4Adltjm.cjs +2 -0
- package/dist/journey-B4Adltjm.cjs.map +1 -0
- package/dist/{journey-CuJrHzEg.js → journey-D2_sia57.js} +51 -53
- package/dist/journey-D2_sia57.js.map +1 -0
- package/dist/{library-console-C1m6g1BR.js → library-console-Btrzt814.js} +2 -2
- package/dist/library-console-Btrzt814.js.map +1 -0
- package/dist/{library-console-D2GY9Or6.cjs → library-console-CPW6bvZH.cjs} +2 -2
- package/dist/library-console-CPW6bvZH.cjs.map +1 -0
- package/dist/{library-request-BQBT9N9Q.js → library-request-BJ9PLRaD.js} +2 -2
- package/dist/library-request-BJ9PLRaD.js.map +1 -0
- package/dist/{library-request-1BX_UlaX.cjs → library-request-D7OvTxZV.cjs} +2 -2
- package/dist/library-request-D7OvTxZV.cjs.map +1 -0
- package/dist/{lifecycle-BaKx_-32.js → lifecycle-22CUCrc9.js} +21 -29
- package/dist/lifecycle-22CUCrc9.js.map +1 -0
- package/dist/lifecycle-IaAm1mOC.cjs +2 -0
- package/dist/lifecycle-IaAm1mOC.cjs.map +1 -0
- package/dist/{log-record-CAoGBBf3.js → log-record-BNiLfqtL.js} +8 -7
- package/dist/log-record-BNiLfqtL.js.map +1 -0
- package/dist/log-record-CkivuiEl.cjs +2 -0
- package/dist/log-record-CkivuiEl.cjs.map +1 -0
- package/dist/long-frames-BUUbXd-B.cjs +2 -0
- package/dist/long-frames-BUUbXd-B.cjs.map +1 -0
- package/dist/long-frames-DNFaRnC3.js +62 -0
- package/dist/long-frames-DNFaRnC3.js.map +1 -0
- package/dist/models/batch.d.cts +57 -0
- package/dist/models/batch.d.ts +16 -17
- package/dist/models/bus.d.cts +158 -0
- package/dist/models/bus.d.ts +46 -26
- package/dist/models/config.d.cts +1540 -0
- package/dist/models/config.d.ts +692 -405
- package/dist/models/drop.d.cts +54 -0
- package/dist/models/drop.d.ts +29 -14
- package/dist/models/health.d.cts +148 -0
- package/dist/models/health.d.ts +119 -23
- package/dist/models/log-record.d.cts +61 -0
- package/dist/models/log-record.d.ts +13 -14
- package/dist/models/metric.d.cts +139 -0
- package/dist/models/metric.d.ts +94 -18
- package/dist/models/plugin.d.cts +47 -0
- package/dist/models/plugin.d.ts +16 -16
- package/dist/models/replay.d.cts +60 -0
- package/dist/models/replay.d.ts +60 -0
- package/dist/models/serializer.d.cts +23 -0
- package/dist/models/serializer.d.ts +3 -4
- package/dist/models/storage.d.cts +95 -0
- package/dist/models/storage.d.ts +17 -14
- package/dist/network-CGMLQ-mA.cjs +2 -0
- package/dist/network-CGMLQ-mA.cjs.map +1 -0
- package/dist/{network-DBNwApoF.js → network-on2zZT6H.js} +57 -57
- package/dist/network-on2zZT6H.js.map +1 -0
- package/dist/openfin-Bxelt0yg.js.map +1 -1
- package/dist/openfin-DtH2f7zX.cjs.map +1 -1
- package/dist/otlp-BENHf3g9.cjs +2 -0
- package/dist/otlp-BENHf3g9.cjs.map +1 -0
- package/dist/{otlp-BTJdIa6F.js → otlp-DimfrRor.js} +22 -29
- package/dist/otlp-DimfrRor.js.map +1 -0
- package/dist/patch-BX8KrPCT.cjs.map +1 -1
- package/dist/patch-UdPz1ea8.js.map +1 -1
- package/dist/{platform-DkcuXwe-.js → platform-BaaFIPCU.js} +8 -8
- package/dist/platform-BaaFIPCU.js.map +1 -0
- package/dist/{platform-C2Ez5kDc.cjs → platform-CfA3-7sJ.cjs} +2 -2
- package/dist/platform-CfA3-7sJ.cjs.map +1 -0
- package/dist/profiler-BAZoh7A4.js +292 -0
- package/dist/profiler-BAZoh7A4.js.map +1 -0
- package/dist/profiler-D4tJpDRc.cjs +2 -0
- package/dist/profiler-D4tJpDRc.cjs.map +1 -0
- package/dist/profiler-frames-C4xr7KfH.cjs +2 -0
- package/dist/profiler-frames-C4xr7KfH.cjs.map +1 -0
- package/dist/profiler-frames-cJMx9wNM.js +78 -0
- package/dist/profiler-frames-cJMx9wNM.js.map +1 -0
- package/dist/remote-rules-Dz9MRAsB.js +95 -0
- package/dist/remote-rules-Dz9MRAsB.js.map +1 -0
- package/dist/remote-rules-_tY0zj5o.cjs +2 -0
- package/dist/remote-rules-_tY0zj5o.cjs.map +1 -0
- package/dist/replay-B3gFXIZd.cjs +2 -0
- package/dist/replay-B3gFXIZd.cjs.map +1 -0
- package/dist/replay-Ds-ANH34.js +310 -0
- package/dist/replay-Ds-ANH34.js.map +1 -0
- package/dist/reports-BDSe4dFH.cjs +2 -0
- package/dist/reports-BDSe4dFH.cjs.map +1 -0
- package/dist/{reports-TA-zInnq.js → reports-C-thq-bk.js} +25 -30
- package/dist/reports-C-thq-bk.js.map +1 -0
- package/dist/resource-timing-C576gFIQ.cjs +2 -0
- package/dist/resource-timing-C576gFIQ.cjs.map +1 -0
- package/dist/{resource-timing-BLv3EA2A.js → resource-timing-eUl2dNgC.js} +20 -23
- package/dist/resource-timing-eUl2dNgC.js.map +1 -0
- package/dist/response-body-YdNl-HkR.cjs +3 -0
- package/dist/response-body-YdNl-HkR.cjs.map +1 -0
- package/dist/response-body-eoSQpLiH.js +331 -0
- package/dist/response-body-eoSQpLiH.js.map +1 -0
- package/dist/rotation-Cwct4ckk.js +94 -0
- package/dist/rotation-Cwct4ckk.js.map +1 -0
- package/dist/rotation-D4qUAHAu.cjs +2 -0
- package/dist/rotation-D4qUAHAu.cjs.map +1 -0
- package/dist/sampling-BlrI8jor.js +63 -0
- package/dist/sampling-BlrI8jor.js.map +1 -0
- package/dist/sampling-mXt4dstx.cjs +2 -0
- package/dist/sampling-mXt4dstx.cjs.map +1 -0
- package/dist/{sanitize-6ymPlVvP.js → sanitize-Ba0KqU06.js} +2 -2
- package/dist/sanitize-Ba0KqU06.js.map +1 -0
- package/dist/{sanitize-BAWzkZt0.cjs → sanitize-DQyiI_KY.cjs} +2 -2
- package/dist/sanitize-DQyiI_KY.cjs.map +1 -0
- package/dist/sender-BdRuNVhF.cjs +2 -0
- package/dist/sender-BdRuNVhF.cjs.map +1 -0
- package/dist/sender-Dv8rAmpV.js +979 -0
- package/dist/sender-Dv8rAmpV.js.map +1 -0
- package/dist/storage/context-storage.d.cts +90 -0
- package/dist/storage/context-storage.d.ts +38 -37
- package/dist/storage/emergency-queue.d.cts +27 -0
- package/dist/storage/emergency-queue.d.ts +13 -13
- package/dist/storage/eviction.d.cts +40 -0
- package/dist/storage/eviction.d.ts +13 -13
- package/dist/storage/factory.d.cts +21 -0
- package/dist/storage/factory.d.ts +11 -10
- package/dist/storage/gap.d.cts +20 -0
- package/dist/storage/gap.d.ts +9 -9
- package/dist/storage/idb-driver.d.cts +93 -0
- package/dist/storage/idb-driver.d.ts +32 -33
- package/dist/storage/indexeddb-storage.d.cts +97 -0
- package/dist/storage/indexeddb-storage.d.ts +38 -31
- package/dist/storage/keys.d.cts +17 -0
- package/dist/storage/keys.d.ts +9 -9
- package/dist/storage/local-storage.d.cts +139 -0
- package/dist/storage/local-storage.d.ts +49 -42
- package/dist/storage/memory-storage.d.cts +73 -0
- package/dist/storage/memory-storage.d.ts +25 -25
- package/dist/storage/persistence.d.cts +8 -0
- package/dist/storage/persistence.d.ts +3 -3
- package/dist/storage/stored-context.d.cts +34 -0
- package/dist/storage/stored-context.d.ts +34 -0
- package/dist/stored-context-B2EzVuYm.js +51 -0
- package/dist/stored-context-B2EzVuYm.js.map +1 -0
- package/dist/stored-context-CXt7eHZL.cjs +2 -0
- package/dist/stored-context-CXt7eHZL.cjs.map +1 -0
- package/dist/storm-C-zYSdDX.cjs +2 -0
- package/dist/storm-C-zYSdDX.cjs.map +1 -0
- package/dist/storm-DjKetLKZ.js +9 -0
- package/dist/storm-DjKetLKZ.js.map +1 -0
- package/dist/transport/compression.d.cts +7 -0
- package/dist/transport/compression.d.ts +2 -2
- package/dist/transport/custom-transport.d.cts +22 -0
- package/dist/transport/custom-transport.d.ts +6 -5
- package/dist/transport/errors.d.cts +31 -0
- package/dist/transport/errors.d.ts +7 -7
- package/dist/transport/exit-flush.d.cts +135 -0
- package/dist/transport/exit-flush.d.ts +62 -45
- package/dist/transport/headers.d.cts +8 -0
- package/dist/transport/headers.d.ts +4 -4
- package/dist/transport/http-transport.d.cts +116 -0
- package/dist/transport/http-transport.d.ts +48 -35
- package/dist/transport/memory-transport.d.cts +30 -0
- package/dist/transport/memory-transport.d.ts +8 -8
- package/dist/transport/response-body.d.cts +49 -0
- package/dist/transport/response-body.d.ts +49 -0
- package/dist/transport/retry-engine.d.cts +129 -0
- package/dist/transport/retry-engine.d.ts +62 -43
- package/dist/transport/serializers/ecs.d.cts +3 -0
- package/dist/transport/serializers/ecs.d.ts +2 -2
- package/dist/transport/serializers/otlp-metrics.d.cts +3 -0
- package/dist/transport/serializers/otlp-metrics.d.ts +2 -2
- package/dist/transport/serializers/otlp-traces.d.cts +3 -0
- package/dist/transport/serializers/otlp-traces.d.ts +2 -2
- package/dist/transport/serializers/otlp.d.cts +47 -0
- package/dist/transport/serializers/otlp.d.ts +18 -18
- package/dist/transport/serializers/select.d.cts +38 -0
- package/dist/transport/serializers/select.d.ts +11 -11
- package/dist/transport/status-transport.d.cts +129 -0
- package/dist/transport/status-transport.d.ts +45 -28
- package/dist/transport/worker-client.d.cts +23 -0
- package/dist/transport/worker-client.d.ts +12 -3
- package/dist/transport/worker-entry.d.cts +5 -0
- package/dist/transport/worker-entry.d.ts +1 -1
- package/dist/transport/worker-protocol.d.cts +38 -0
- package/dist/transport/worker-protocol.d.ts +7 -5
- package/dist/transport/worker-server.d.cts +3 -0
- package/dist/transport/worker-server.d.ts +1 -1
- package/dist/transport/worker-transport.d.cts +10 -0
- package/dist/transport/worker-transport.d.ts +5 -4
- package/dist/types-BAerHgCq.js.map +1 -1
- package/dist/types-C7WNpnG1.cjs.map +1 -1
- package/dist/{unclean-exit-CwcUhFOn.js → unclean-exit-DQD1cT7c.js} +23 -30
- package/dist/unclean-exit-DQD1cT7c.js.map +1 -0
- package/dist/unclean-exit-py99ApzT.cjs +2 -0
- package/dist/unclean-exit-py99ApzT.cjs.map +1 -0
- package/dist/unref-CU9Nyz_9.cjs +2 -0
- package/dist/unref-CU9Nyz_9.cjs.map +1 -0
- package/dist/unref-DgHPQeWv.js +7 -0
- package/dist/unref-DgHPQeWv.js.map +1 -0
- package/dist/{user-timing-_jZIhDKI.js → user-timing-BePqb1uN.js} +18 -18
- package/dist/user-timing-BePqb1uN.js.map +1 -0
- package/dist/user-timing-D6XTmpuM.cjs +2 -0
- package/dist/user-timing-D6XTmpuM.cjs.map +1 -0
- package/dist/utils/console.d.cts +36 -0
- package/dist/utils/console.d.ts +6 -6
- package/dist/utils/deadline.d.cts +14 -0
- package/dist/utils/deadline.d.ts +4 -4
- package/dist/utils/error-like.d.cts +25 -0
- package/dist/utils/error-like.d.ts +7 -7
- package/dist/utils/fixed-window.d.cts +25 -0
- package/dist/utils/fixed-window.d.ts +9 -8
- package/dist/utils/global-scope.d.cts +20 -0
- package/dist/utils/global-scope.d.ts +8 -8
- package/dist/utils/guards.d.cts +14 -0
- package/dist/utils/guards.d.ts +10 -2
- package/dist/utils/identity.d.cts +109 -0
- package/dist/utils/identity.d.ts +20 -21
- package/dist/utils/library-console.d.cts +11 -0
- package/dist/utils/library-console.d.ts +4 -4
- package/dist/utils/library-request.d.cts +24 -0
- package/dist/utils/library-request.d.ts +10 -10
- package/dist/utils/lock.d.cts +24 -0
- package/dist/utils/lock.d.ts +11 -10
- package/dist/utils/openfin.d.cts +48 -0
- package/dist/utils/openfin.d.ts +5 -5
- package/dist/utils/patch.d.cts +9 -0
- package/dist/utils/patch.d.ts +6 -6
- package/dist/utils/platform.d.cts +62 -0
- package/dist/utils/platform.d.ts +15 -13
- package/dist/utils/sanitize.d.cts +52 -0
- package/dist/utils/sanitize.d.ts +5 -5
- package/dist/utils/sequence.d.cts +10 -0
- package/dist/utils/tracing.d.cts +158 -0
- package/dist/utils/tracing.d.ts +49 -42
- package/dist/utils/unref.d.cts +9 -0
- package/dist/utils/unref.d.ts +3 -3
- package/dist/web-socket-CoIUBM3C.cjs +2 -0
- package/dist/web-socket-CoIUBM3C.cjs.map +1 -0
- package/dist/{web-socket-CV7yIMnm.js → web-socket-DSHgDiZ6.js} +23 -28
- package/dist/web-socket-DSHgDiZ6.js.map +1 -0
- package/dist/web-vitals-4pWACwaR.js +71 -0
- package/dist/web-vitals-4pWACwaR.js.map +1 -0
- package/dist/web-vitals-__X7t4pj.cjs +2 -0
- package/dist/web-vitals-__X7t4pj.cjs.map +1 -0
- package/dist/worker-protocol-QbvqNazn.cjs +2 -0
- package/dist/worker-protocol-QbvqNazn.cjs.map +1 -0
- package/dist/{worker-protocol-CrsdSDLn.js → worker-protocol-x074Rpet.js} +14 -11
- package/dist/worker-protocol-x074Rpet.js.map +1 -0
- package/dist/worker-server-CFe4nvos.cjs +2 -0
- package/dist/worker-server-CFe4nvos.cjs.map +1 -0
- package/dist/worker-server-iUVSjH8L.js +94 -0
- package/dist/worker-server-iUVSjH8L.js.map +1 -0
- package/dist/worker-transport-CRAX-09c.cjs +2 -0
- package/dist/worker-transport-CRAX-09c.cjs.map +1 -0
- package/dist/worker-transport-Dy1KMA7t.js +190 -0
- package/dist/worker-transport-Dy1KMA7t.js.map +1 -0
- package/llms.txt +397 -0
- package/package.json +55 -41
- package/dist/batch-C8OcWR2L.cjs.map +0 -1
- package/dist/batch-CL9uWYY3.js.map +0 -1
- package/dist/bus-BZ0GldpT.js +0 -660
- package/dist/bus-BZ0GldpT.js.map +0 -1
- package/dist/bus-VWlmM5xs.cjs +0 -2
- package/dist/bus-VWlmM5xs.cjs.map +0 -1
- package/dist/console-BPZCuSLc.cjs +0 -2
- package/dist/console-BPZCuSLc.cjs.map +0 -1
- package/dist/console-BeCF7n59.js +0 -82
- package/dist/console-BeCF7n59.js.map +0 -1
- package/dist/constants-DqKJH_MP.cjs +0 -2
- package/dist/constants-DqKJH_MP.cjs.map +0 -1
- package/dist/constants-zyrqveN4.js +0 -304
- package/dist/constants-zyrqveN4.js.map +0 -1
- package/dist/context-storage-BjzeBSxH.cjs +0 -2
- package/dist/context-storage-BjzeBSxH.cjs.map +0 -1
- package/dist/context-storage-BzkoHzkQ.js +0 -51
- package/dist/context-storage-BzkoHzkQ.js.map +0 -1
- package/dist/deadline-BOjOxNHj.js.map +0 -1
- package/dist/deadline-XSnm95pg.cjs +0 -2
- package/dist/deadline-XSnm95pg.cjs.map +0 -1
- package/dist/debug-bundle-BzJNpbF0.cjs +0 -2
- package/dist/debug-bundle-BzJNpbF0.cjs.map +0 -1
- package/dist/debug-bundle-C7UkHZ-q.js +0 -25
- package/dist/debug-bundle-C7UkHZ-q.js.map +0 -1
- package/dist/emergency-queue-CNTRui5t.cjs +0 -2
- package/dist/emergency-queue-CNTRui5t.cjs.map +0 -1
- package/dist/emergency-queue-Zy6lNafo.js +0 -67
- package/dist/emergency-queue-Zy6lNafo.js.map +0 -1
- package/dist/errors-Dh7kef0i.js +0 -92
- package/dist/errors-Dh7kef0i.js.map +0 -1
- package/dist/errors-tfEr48bS.cjs +0 -3
- package/dist/errors-tfEr48bS.cjs.map +0 -1
- package/dist/factory-BonqI3NL.js +0 -276
- package/dist/factory-BonqI3NL.js.map +0 -1
- package/dist/factory-CJXVYp0R.cjs +0 -2
- package/dist/factory-CJXVYp0R.cjs.map +0 -1
- package/dist/guards-Cidk71ME.js +0 -7
- package/dist/guards-Cidk71ME.js.map +0 -1
- package/dist/guards-nJ70syPt.cjs +0 -2
- package/dist/guards-nJ70syPt.cjs.map +0 -1
- package/dist/identity-Cxgj6pZX.cjs +0 -2
- package/dist/identity-Cxgj6pZX.cjs.map +0 -1
- package/dist/identity-DT5VmvXy.js.map +0 -1
- package/dist/indexeddb-storage-BJVtiQKm.js.map +0 -1
- package/dist/indexeddb-storage-CIoW21Xd.cjs +0 -2
- package/dist/indexeddb-storage-CIoW21Xd.cjs.map +0 -1
- package/dist/interactions-DTgKy_6K.js.map +0 -1
- package/dist/interactions-fEN6FbVo.cjs +0 -2
- package/dist/interactions-fEN6FbVo.cjs.map +0 -1
- package/dist/journey-CuJrHzEg.js.map +0 -1
- package/dist/journey-pffMVMfa.cjs +0 -2
- package/dist/journey-pffMVMfa.cjs.map +0 -1
- package/dist/keys-BHhw_0Wh.cjs +0 -2
- package/dist/keys-BHhw_0Wh.cjs.map +0 -1
- package/dist/keys-BU9j5YqW.js +0 -16
- package/dist/keys-BU9j5YqW.js.map +0 -1
- package/dist/library-console-C1m6g1BR.js.map +0 -1
- package/dist/library-console-D2GY9Or6.cjs.map +0 -1
- package/dist/library-request-1BX_UlaX.cjs.map +0 -1
- package/dist/library-request-BQBT9N9Q.js.map +0 -1
- package/dist/lifecycle-2EtUaRpo.cjs +0 -2
- package/dist/lifecycle-2EtUaRpo.cjs.map +0 -1
- package/dist/lifecycle-BaKx_-32.js.map +0 -1
- package/dist/log-record-CAoGBBf3.js.map +0 -1
- package/dist/log-record-i9zOTkpQ.cjs +0 -2
- package/dist/log-record-i9zOTkpQ.cjs.map +0 -1
- package/dist/long-frames-BVg4i5SC.cjs +0 -2
- package/dist/long-frames-BVg4i5SC.cjs.map +0 -1
- package/dist/long-frames-Czk7IupC.js +0 -64
- package/dist/long-frames-Czk7IupC.js.map +0 -1
- package/dist/models/stats.d.ts +0 -11
- package/dist/network-DBNwApoF.js.map +0 -1
- package/dist/network-xbbuvG_6.cjs +0 -2
- package/dist/network-xbbuvG_6.cjs.map +0 -1
- package/dist/otlp-BDvFrLnc.cjs +0 -2
- package/dist/otlp-BDvFrLnc.cjs.map +0 -1
- package/dist/otlp-BTJdIa6F.js.map +0 -1
- package/dist/platform-C2Ez5kDc.cjs.map +0 -1
- package/dist/platform-DkcuXwe-.js.map +0 -1
- package/dist/remote-rules-Cfb4K-Nl.js +0 -98
- package/dist/remote-rules-Cfb4K-Nl.js.map +0 -1
- package/dist/remote-rules-vzvk7aKf.cjs +0 -2
- package/dist/remote-rules-vzvk7aKf.cjs.map +0 -1
- package/dist/reports-Dk2YhKIh.cjs +0 -2
- package/dist/reports-Dk2YhKIh.cjs.map +0 -1
- package/dist/reports-TA-zInnq.js.map +0 -1
- package/dist/resource-timing-BLv3EA2A.js.map +0 -1
- package/dist/resource-timing-Cysw1S1f.cjs +0 -2
- package/dist/resource-timing-Cysw1S1f.cjs.map +0 -1
- package/dist/sampling-C4VV-1MS.js +0 -60
- package/dist/sampling-C4VV-1MS.js.map +0 -1
- package/dist/sampling-Ckh2yW9k.cjs +0 -2
- package/dist/sampling-Ckh2yW9k.cjs.map +0 -1
- package/dist/sanitize-6ymPlVvP.js.map +0 -1
- package/dist/sanitize-BAWzkZt0.cjs.map +0 -1
- package/dist/select-ZF4by-lF.cjs +0 -3
- package/dist/select-ZF4by-lF.cjs.map +0 -1
- package/dist/select-xtQaenIi.js +0 -270
- package/dist/select-xtQaenIi.js.map +0 -1
- package/dist/sender-CiMHC9YG.js +0 -856
- package/dist/sender-CiMHC9YG.js.map +0 -1
- package/dist/sender-D5wBoXA8.cjs +0 -2
- package/dist/sender-D5wBoXA8.cjs.map +0 -1
- package/dist/storage-BA9RqRO-.cjs +0 -2
- package/dist/storage-BA9RqRO-.cjs.map +0 -1
- package/dist/storage-DZwed89z.js +0 -16
- package/dist/storage-DZwed89z.js.map +0 -1
- package/dist/storm-CYi9Swpx.cjs +0 -2
- package/dist/storm-CYi9Swpx.cjs.map +0 -1
- package/dist/storm-VR024_QN.js +0 -9
- package/dist/storm-VR024_QN.js.map +0 -1
- package/dist/unclean-exit-CwcUhFOn.js.map +0 -1
- package/dist/unclean-exit-DFUN57wY.cjs +0 -2
- package/dist/unclean-exit-DFUN57wY.cjs.map +0 -1
- package/dist/user-timing-C9kfRq3J.cjs +0 -2
- package/dist/user-timing-C9kfRq3J.cjs.map +0 -1
- package/dist/user-timing-_jZIhDKI.js.map +0 -1
- package/dist/utils/timer.d.ts +0 -19
- package/dist/web-socket-BWUoqBh8.cjs +0 -2
- package/dist/web-socket-BWUoqBh8.cjs.map +0 -1
- package/dist/web-socket-CV7yIMnm.js.map +0 -1
- package/dist/web-vitals-Bq4WFHQo.js +0 -52
- package/dist/web-vitals-Bq4WFHQo.js.map +0 -1
- package/dist/web-vitals-DFuoTQbZ.cjs +0 -2
- package/dist/web-vitals-DFuoTQbZ.cjs.map +0 -1
- package/dist/worker-protocol-Bai7GAIA.cjs +0 -2
- package/dist/worker-protocol-Bai7GAIA.cjs.map +0 -1
- package/dist/worker-protocol-CrsdSDLn.js.map +0 -1
- package/dist/worker-server-BrIYkfoa.cjs +0 -2
- package/dist/worker-server-BrIYkfoa.cjs.map +0 -1
- package/dist/worker-server-Dp5HYm4b.js +0 -83
- package/dist/worker-server-Dp5HYm4b.js.map +0 -1
- package/dist/worker-transport-Bwej4N2e.cjs +0 -2
- package/dist/worker-transport-Bwej4N2e.cjs.map +0 -1
- package/dist/worker-transport-D6jtgpqN.js +0 -199
- package/dist/worker-transport-D6jtgpqN.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unclean-exit-py99ApzT.cjs","names":["ALIVE_KEY","ALIVE_UPDATE_MS","require_constants","require_defineProperty","readMarker","value","text","sessionId","at","visibility","UncleanExitCapture","marker","event","ctx"],"sources":["../src/capture/unclean-exit.ts"],"sourcesContent":["// src/capture/unclean-exit.ts\n//\n// Detects a page in this tab that ended without a clean close, for example after a crash. The\n// top document keeps a marker in sessionStorage and a clean close removes it, so if the tab's\n// next page finds a marker, it reports it.\n\nimport { ALIVE_KEY, ALIVE_UPDATE_MS } from \"../constants\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Marker left by a page that is alive. */\ninterface AliveMarker {\n /** The page's session id. */\n sessionId: string;\n /** When the marker was last updated, in epoch milliseconds. */\n at: number;\n /** The page's visibility at the last update. */\n visibility: string;\n}\n\n/** A document with the flag the browser sets on a page it discarded to free memory. */\ninterface DiscardDocument {\n wasDiscarded?: boolean;\n}\n\n/**\n * Reads a marker from its sessionStorage text.\n * @param text Stored text, or null when there is no marker.\n * @returns The marker, or null if there is none or it has the wrong shape.\n * @throws SyntaxError for text that isn't JSON. The caller reports it.\n */\nfunction readMarker(text: string | null): AliveMarker | null {\n const value: unknown = text === null ? null : JSON.parse(text);\n if (typeof value !== \"object\" || value === null) {\n return null;\n }\n\n const { sessionId, at, visibility } = value as Partial<Record<keyof AliveMarker, unknown>>;\n const valid =\n typeof sessionId === \"string\" && Number.isFinite(at) && typeof visibility === \"string\";\n\n return valid ? { sessionId, at: at as number, visibility } : null;\n}\n\n/** Reports the previous page's unclean exit, and maintains this page's marker. */\nexport class UncleanExitCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"uncleanExit\";\n\n /** Prevents duplicate listener registration. */\n private installed = false;\n\n /** Timer that updates the marker. */\n private timer: ReturnType<typeof setInterval> | undefined;\n\n /** True after pagehide. Needed because the browser fires visibilitychange after pagehide. */\n private closing = false;\n\n /**\n * @param ctx Capture context with the config, diagnostics, logger and session id.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Reports the previous page's marker once, then starts maintaining this page's own. */\n install(): void {\n // Only the top document keeps the marker, because a same-origin frame shares its\n // sessionStorage.\n if (this.installed || typeof document === \"undefined\" || window.parent !== window) {\n return;\n }\n\n // The marker holds the session id, and memory identity writes nothing to the device.\n if (this.ctx.config.identity === \"memory\") {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n 'capture.uncleanExit needs sessionStorage. identity: \"memory\" turns it off.',\n );\n return;\n }\n this.installed = true;\n\n if (!this.ctx.once.uncleanExit) {\n this.ctx.once.uncleanExit = true;\n // A popup copies its live opener's sessionStorage, so that marker isn't a crash.\n if (!window.opener) {\n this.reportPrevious();\n }\n }\n\n this.mark();\n addEventListener(\"pagehide\", this.onPageHide);\n addEventListener(\"pageshow\", this.onPageShow);\n document.addEventListener(\"visibilitychange\", this.mark);\n this.timer = setInterval(this.mark, ALIVE_UPDATE_MS);\n }\n\n /** Removes the listeners, the timer and the marker, since the capture stopped without a crash. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n removeEventListener(\"pagehide\", this.onPageHide);\n removeEventListener(\"pageshow\", this.onPageShow);\n document.removeEventListener(\"visibilitychange\", this.mark);\n clearInterval(this.timer);\n this.clear();\n }\n\n /** Logs WARN `ui.unclean_exit` if this tab's previous page left its marker behind. */\n private reportPrevious(): void {\n const marker = this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not read the alive marker in sessionStorage.\",\n () => readMarker(sessionStorage.getItem(ALIVE_KEY)),\n );\n if (!marker) {\n return;\n }\n\n this.ctx.logger.warn(\"ui.unclean_exit\", {\n \"exit.session_id\": marker.sessionId,\n \"exit.last_seen_ms\": marker.at,\n \"exit.visibility\": marker.visibility,\n \"exit.discarded\": (document as DiscardDocument).wasDiscarded === true,\n });\n }\n\n /** Writes this page's marker with the current time and visibility. */\n private readonly mark = (): void => {\n if (this.closing) {\n return;\n }\n\n const marker: AliveMarker = {\n sessionId: this.ctx.sessionId(),\n at: Date.now(),\n visibility: document.visibilityState,\n };\n\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not write the alive marker to sessionStorage.\",\n () => {\n sessionStorage.setItem(ALIVE_KEY, JSON.stringify(marker));\n },\n );\n };\n\n /** Removes this page's marker. */\n private clear(): void {\n this.ctx.diagnostics.guard(\n \"storage.unavailable\",\n \"The library could not remove the alive marker from sessionStorage.\",\n () => {\n sessionStorage.removeItem(ALIVE_KEY);\n },\n );\n }\n\n /** A clean close removes the marker. The page may still live on in the back-forward cache. */\n private readonly onPageHide = (): void => {\n this.closing = true;\n this.clear();\n };\n\n /** A page that comes back from the back-forward cache is alive again. */\n private readonly onPageShow = (event: Event): void => {\n if ((event as PageTransitionEvent).persisted) {\n this.closing = false;\n this.mark();\n }\n };\n}\n"],"mappings":"A,uFA8BA,SAASI,EAAW,EAAyC,CAC3D,IAAMC,EAAiBC,IAAS,KAAO,KAAO,KAAK,MAAMA,CAAI,EAC7D,GAAI,OAAOD,GAAU,WAAYA,EAC/B,OAAO,KAGT,GAAM,CAAE,YAAW,KAAI,cAAeA,EAItC,OAFE,OAAOE,GAAc,UAAY,OAAO,SAASC,CAAE,GAAK,OAAOC,GAAe,SAEjE,CAAE,YAAe,KAAc,YAAW,EAAI,IAC/D,CAGA,IAAaC,EAAb,KAAmD,CAgBjD,YAAY,EAAsC,CAArBP,EAAA,EAAA,KAAA,MAAA,IAAA,EAAA,EAd7BA,EAAA,EAAA,KAAA,OAAgB,aAAA,EAGhBA,EAAA,EAAA,KAAA,YAAoB,EAAA,EAGpBA,EAAA,EAAA,KAAA,QAAA,IAAA,EAAA,EAGAA,EAAA,EAAA,KAAA,UAAkB,EAAA,EA0ElBA,EAAA,EAAA,KAAA,WAAoC,CAClC,GAAI,KAAK,QACP,OAGF,IAAMQ,EAAsB,CAC1B,UAAW,KAAK,IAAI,UAAU,EAC9B,GAAI,KAAK,IAAI,EACb,WAAY,SAAS,eACvB,EAEA,KAAK,IAAI,YAAY,MACnB,sBACA,sEACM,CACJ,eAAe,QAAQX,EAAAA,EAAW,KAAK,UAAUW,CAAM,CAAC,CAC1D,CACF,CACF,CAAA,EAcAR,EAAA,EAAA,KAAA,iBAA0C,CACxC,KAAK,QAAU,GACf,KAAK,MAAM,CACb,CAAA,EAGAA,EAAA,EAAA,KAAA,aAA+B,GAAuB,CAC/CS,EAA8B,YACjC,KAAK,QAAU,GACf,KAAK,KAAK,EAEd,CAAA,EAhH6B,KAAA,IAAAC,CAAsB,CAGnD,SAAgB,CAGV,KAAK,WAAa,OAAO,SAAa,KAAe,OAAO,SAAW,SAKvE,KAAK,IAAI,OAAO,WAAa,SAC/B,KAAK,IAAI,YAAY,OACnB,yBACA,4EACF,GAGF,KAAK,UAAY,GAEZ,KAAK,IAAI,KAAK,cACjB,KAAK,IAAI,KAAK,YAAc,GAEvB,OAAO,QACV,KAAK,eAAe,GAIxB,KAAK,KAAK,EACV,iBAAiB,WAAY,KAAK,UAAU,EAC5C,iBAAiB,WAAY,KAAK,UAAU,EAC5C,SAAS,iBAAiB,mBAAoB,KAAK,IAAI,EACvD,KAAK,MAAQ,YAAY,KAAK,KAAMZ,EAAAA,CAAe,GACrD,CAGA,WAAkB,CACX,KAAK,YAGV,KAAK,UAAY,GAEjB,oBAAoB,WAAY,KAAK,UAAU,EAC/C,oBAAoB,WAAY,KAAK,UAAU,EAC/C,SAAS,oBAAoB,mBAAoB,KAAK,IAAI,EAC1D,cAAc,KAAK,KAAK,EACxB,KAAK,MAAM,EACb,CAGA,gBAA+B,CAC7B,IAAMU,EAAS,KAAK,IAAI,YAAY,MAClC,sBACA,qEACMP,EAAW,eAAe,QAAQJ,EAAAA,CAAS,CAAC,CACpD,EACKW,GAIL,KAAK,IAAI,OAAO,KAAK,kBAAmB,CACtC,kBAAmBA,EAAO,UAC1B,oBAAqBA,EAAO,GAC5B,kBAAmBA,EAAO,WAC1B,iBAAmB,SAA6B,eAAiB,EACnE,CAAC,CACH,CAwBA,OAAsB,CACpB,KAAK,IAAI,YAAY,MACnB,sBACA,yEACM,CACJ,eAAe,WAAWX,EAAAA,CAAS,CACrC,CACF,CACF,CAeF,E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unref-CU9Nyz_9.cjs","names":["unrefTimer","timer"],"sources":["../src/utils/unref.ts"],"sourcesContent":["// src/utils/unref.ts\n//\n// Unreferences timer handles in Node and browser environments. A pending timer\n// keeps a Node process alive under SSR and in tests.\n\n/** A timer handle. A number in a browser, a Timeout object in Node. */\nexport type TimerHandle = number | { unref?: () => void };\n\n/**\n * Unreferences a timer handle, so a pending timer doesn't keep a Node.js process alive.\n * @param timer The timer handle returned by setTimeout.\n */\nexport function unrefTimer(timer: TimerHandle): void {\n if (typeof timer !== \"number\") {\n timer.unref?.();\n }\n}\n"],"mappings":"AAYA,SAAgBA,EAAW,EAA0B,CAC/C,OAAOC,GAAU,UACnBA,EAAM,QAAQ,CAElB,C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unref-DgHPQeWv.js","names":["unrefTimer","timer"],"sources":["../src/utils/unref.ts"],"sourcesContent":["// src/utils/unref.ts\n//\n// Unreferences timer handles in Node and browser environments. A pending timer\n// keeps a Node process alive under SSR and in tests.\n\n/** A timer handle. A number in a browser, a Timeout object in Node. */\nexport type TimerHandle = number | { unref?: () => void };\n\n/**\n * Unreferences a timer handle, so a pending timer doesn't keep a Node.js process alive.\n * @param timer The timer handle returned by setTimeout.\n */\nexport function unrefTimer(timer: TimerHandle): void {\n if (typeof timer !== \"number\") {\n timer.unref?.();\n }\n}\n"],"mappings":";AAYA,SAAgBA,EAAW,GAA0B;CACnD,AAAI,OAAOC,KAAU,YACnBA,EAAM,QAAQ;AAElB"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { i as e } from "./platform-
|
|
1
|
+
import { i as e } from "./platform-BaaFIPCU.js";
|
|
2
2
|
import { t } from "./types-BAerHgCq.js";
|
|
3
|
+
import { t as n } from "./defineProperty-s2S8BXUc.js";
|
|
3
4
|
// src/capture/user-timing.ts
|
|
4
|
-
var
|
|
5
|
+
var r = {
|
|
5
6
|
name: "ui.user_timing.duration",
|
|
6
7
|
kind: "histogram",
|
|
7
8
|
unit: "ms",
|
|
@@ -19,12 +20,9 @@ var n = {
|
|
|
19
20
|
5e3,
|
|
20
21
|
1e4
|
|
21
22
|
]
|
|
22
|
-
},
|
|
23
|
-
ctx;
|
|
24
|
-
name = "userTiming";
|
|
25
|
-
observer;
|
|
23
|
+
}, i = class {
|
|
26
24
|
constructor(e) {
|
|
27
|
-
this.ctx = e;
|
|
25
|
+
n(this, "ctx", void 0), n(this, "name", "userTiming"), n(this, "observer", void 0), this.ctx = e;
|
|
28
26
|
}
|
|
29
27
|
install() {
|
|
30
28
|
if (this.observer) return;
|
|
@@ -32,7 +30,9 @@ var n = {
|
|
|
32
30
|
e.userTiming = !0;
|
|
33
31
|
let n = typeof PerformanceObserver > "u" ? void 0 : PerformanceObserver.supportedEntryTypes;
|
|
34
32
|
n?.includes("measure") ? (this.observer = new PerformanceObserver((e) => {
|
|
35
|
-
this.
|
|
33
|
+
this.ctx.diagnostics.guard("capture.record_failed", "The library could not record a user timing entry.", () => {
|
|
34
|
+
this.record(e.getEntries());
|
|
35
|
+
});
|
|
36
36
|
}), this.observer.observe({
|
|
37
37
|
type: "measure",
|
|
38
38
|
buffered: t
|
|
@@ -44,20 +44,20 @@ var n = {
|
|
|
44
44
|
uninstall() {
|
|
45
45
|
this.observer?.disconnect(), this.observer = void 0;
|
|
46
46
|
}
|
|
47
|
-
record(
|
|
47
|
+
record(n) {
|
|
48
48
|
if (this.ctx.isActive?.() === !1) return;
|
|
49
|
-
let { fullUrls: i,
|
|
50
|
-
for (let
|
|
51
|
-
if (
|
|
52
|
-
let
|
|
53
|
-
|
|
54
|
-
t: Math.round(performance.timeOrigin +
|
|
49
|
+
let { fullUrls: i, userTiming: a } = this.ctx.config.capture, o = typeof a == "object" ? a.include : void 0;
|
|
50
|
+
for (let a of n) {
|
|
51
|
+
if (o !== void 0 && o.length > 0 && !t(a.name, o)) continue;
|
|
52
|
+
let n = e(a.name, i);
|
|
53
|
+
a.entryType === "measure" ? this.ctx.recordMetric(r, a.duration, { "user_timing.name": n }) : this.ctx.breadcrumbs.push({
|
|
54
|
+
t: Math.round(performance.timeOrigin + a.startTime),
|
|
55
55
|
category: "event",
|
|
56
|
-
message:
|
|
56
|
+
message: n.slice(0, this.ctx.config.limits.maxBodyChars)
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
|
-
export {
|
|
61
|
+
export { i as UserTimingCapture };
|
|
62
62
|
|
|
63
|
-
//# sourceMappingURL=user-timing-
|
|
63
|
+
//# sourceMappingURL=user-timing-BePqb1uN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-timing-BePqb1uN.js","names":["recordedUrl","_defineProperty","USER_TIMING_DURATION","UserTimingCapture","ctx","first","once","supported","list","include","userTiming","entry","entries","matchesAny","name","fullUrls"],"sources":["../src/capture/user-timing.ts"],"sourcesContent":["// src/capture/user-timing.ts\n//\n// Records the app's marks and measures from the User Timing API. A measure goes into a\n// histogram, and a mark adds a breadcrumb.\n\nimport type { InstrumentDef } from \"../models/metric\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { type Capture, type CaptureContext, matchesAny } from \"./types\";\n\n/** Histogram of the app's measures, in milliseconds. */\nconst USER_TIMING_DURATION: InstrumentDef = {\n name: \"ui.user_timing.duration\",\n kind: \"histogram\",\n unit: \"ms\",\n boundaries: [1, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000],\n};\n\n/** Observes the app's marks and measures. */\nexport class UserTimingCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"userTiming\";\n\n /** Observer for the mark and measure entries. */\n private observer: PerformanceObserver | undefined;\n\n /**\n * @param ctx Capture context with the config, the meter and the breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Observes marks and measures. Only the first install in a document reads buffered entries. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n const { once } = this.ctx;\n const first = !once.userTiming;\n once.userTiming = true;\n\n // Older browsers have no supportedEntryTypes, and the capture stays off there.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n if (!supported?.includes(\"measure\")) {\n if (first) {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report User Timing entries. The user timing capture is off.\",\n );\n }\n return;\n }\n\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 user timing entry.\",\n () => {\n this.record(list.getEntries());\n },\n );\n });\n // Buffered entries include the marks and measures made before this chunk loaded.\n this.observer.observe({ type: \"measure\", buffered: first });\n if (supported.includes(\"mark\")) {\n this.observer.observe({ type: \"mark\", buffered: first });\n }\n }\n\n /** Disconnects the observer. */\n uninstall(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n /**\n * Records the entries whose name `userTiming.include` selects.\n * @param entries Mark and measure entries.\n */\n private record(entries: PerformanceEntryList): void {\n if (this.ctx.isActive?.() === false) {\n return;\n }\n\n const { fullUrls, userTiming } = this.ctx.config.capture;\n const include = typeof userTiming === \"object\" ? userTiming.include : undefined;\n for (const entry of entries) {\n if (include !== undefined && include.length > 0 && !matchesAny(entry.name, include)) {\n continue;\n }\n\n // A third-party script can write any name, so a name can hold a URL with a token.\n const name = recordedUrl(entry.name, fullUrls);\n if (entry.entryType === \"measure\") {\n this.ctx.recordMetric(USER_TIMING_DURATION, entry.duration, { \"user_timing.name\": name });\n } else {\n this.ctx.breadcrumbs.push({\n // A buffered entry reaches the observer late, and the trail needs the mark's own time.\n t: Math.round(performance.timeOrigin + entry.startTime),\n category: \"event\",\n message: name.slice(0, this.ctx.config.limits.maxBodyChars),\n });\n }\n }\n }\n}\n"],"mappings":";;;;AAUA,IAAME,IAAsC;CAC1C,MAAM;CACN,MAAM;CACN,MAAM;CACN,YAAY;EAAC;EAAG;EAAG;EAAI;EAAI;EAAI;EAAK;EAAK;EAAK;EAAM;EAAM;EAAM;CAAK;AACvE,GAGaC,IAAb,MAAkD;CAUhD,YAAY,GAAsC;EAArB,AAAAF,EAAA,MAAA,OAAA,KAAA,CAAA,GAR7BA,EAAA,MAAA,QAAgB,YAAA,GAGhBA,EAAA,MAAA,YAAA,KAAA,CAAA,GAK6B,KAAA,MAAAG;CAAsB;CAGnD,UAAgB;EACd,IAAI,KAAK,UACP;EAGF,IAAM,EAAE,YAAS,KAAK,KAChBC,IAAQ,CAACC,EAAK;EACpB,EAAK,aAAa;EAGlB,IAAMC,IACJ,OAAO,sBAAwB,MAC3B,KAAA,IACA,oBAAoB;EAC1B,AAAKA,GAAW,SAAS,SAAS,KAUlC,KAAK,WAAW,IAAI,qBAAqB,MAAS;GAEhD,KAAK,IAAI,YAAY,MACnB,yBACA,2DACM;IACJ,KAAK,OAAOC,EAAK,WAAW,CAAC;GAC/B,CACF;EACF,CAAC,GAED,KAAK,SAAS,QAAQ;GAAE,MAAM;GAAW,UAAUH;EAAM,CAAC,GACtDE,EAAU,SAAS,MAAM,KAC3B,KAAK,SAAS,QAAQ;GAAE,MAAM;GAAQ,UAAUF;EAAM,CAAC,KAtBnDA,KACF,KAAK,IAAI,YAAY,OACnB,0BACA,kFACF;CAoBN;CAGA,YAAkB;EAEhB,AADA,KAAK,UAAU,WAAW,GAC1B,KAAK,WAAW,KAAA;CAClB;CAMA,OAAe,GAAqC;EAClD,IAAI,KAAK,IAAI,WAAW,MAAM,IAC5B;EAGF,IAAM,EAAE,aAAU,kBAAe,KAAK,IAAI,OAAO,SAC3CI,IAAU,OAAOC,KAAe,WAAWA,EAAW,UAAU,KAAA;EACtE,KAAK,IAAMC,KAASC,GAAS;GAC3B,IAAIH,MAAY,KAAA,KAAaA,EAAQ,SAAS,KAAK,CAACI,EAAWF,EAAM,MAAMF,CAAO,GAChF;GAIF,IAAMK,IAAOd,EAAYW,EAAM,MAAMI,CAAQ;GAC7C,AAAIJ,EAAM,cAAc,YACtB,KAAK,IAAI,aAAaT,GAAsBS,EAAM,UAAU,EAAE,oBAAoBG,EAAK,CAAC,IAExF,KAAK,IAAI,YAAY,KAAK;IAExB,GAAG,KAAK,MAAM,YAAY,aAAaH,EAAM,SAAS;IACtD,UAAU;IACV,SAASG,EAAK,MAAM,GAAG,KAAK,IAAI,OAAO,OAAO,YAAY;GAC5D,CAAC;EAEL;CACF;AACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./platform-CfA3-7sJ.cjs"),t=require("./types-C7WNpnG1.cjs"),n=require("./defineProperty-X1c4tIPD.cjs");var r={name:`ui.user_timing.duration`,kind:`histogram`,unit:`ms`,boundaries:[1,5,10,25,50,100,250,500,1e3,2500,5e3,1e4]},i=class{constructor(e){n.t(this,`ctx`,void 0),n.t(this,`name`,`userTiming`),n.t(this,`observer`,void 0),this.ctx=e}install(){if(this.observer)return;let{once:e}=this.ctx,t=!e.userTiming;e.userTiming=!0;let n=typeof PerformanceObserver>`u`?void 0:PerformanceObserver.supportedEntryTypes;n?.includes(`measure`)?(this.observer=new PerformanceObserver(e=>{this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not record a user timing entry.`,()=>{this.record(e.getEntries())})}),this.observer.observe({type:`measure`,buffered:t}),n.includes(`mark`)&&this.observer.observe({type:`mark`,buffered:t})):t&&this.ctx.diagnostics.report(`capture.install_failed`,`The browser does not report User Timing entries. The user timing capture is off.`)}uninstall(){this.observer?.disconnect(),this.observer=void 0}record(n){if(this.ctx.isActive?.()===!1)return;let{fullUrls:i,userTiming:a}=this.ctx.config.capture,o=typeof a==`object`?a.include:void 0;for(let a of n){if(o!==void 0&&o.length>0&&!t.t(a.name,o))continue;let n=e.i(a.name,i);a.entryType===`measure`?this.ctx.recordMetric(r,a.duration,{"user_timing.name":n}):this.ctx.breadcrumbs.push({t:Math.round(performance.timeOrigin+a.startTime),category:`event`,message:n.slice(0,this.ctx.config.limits.maxBodyChars)})}}};exports.UserTimingCapture=i;
|
|
2
|
+
//# sourceMappingURL=user-timing-D6XTmpuM.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-timing-D6XTmpuM.cjs","names":["matchesAny","recordedUrl","require_platform","require_types","require_defineProperty","USER_TIMING_DURATION","UserTimingCapture","ctx","first","once","supported","list","include","userTiming","entry","entries","name","fullUrls"],"sources":["../src/capture/user-timing.ts"],"sourcesContent":["// src/capture/user-timing.ts\n//\n// Records the app's marks and measures from the User Timing API. A measure goes into a\n// histogram, and a mark adds a breadcrumb.\n\nimport type { InstrumentDef } from \"../models/metric\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { type Capture, type CaptureContext, matchesAny } from \"./types\";\n\n/** Histogram of the app's measures, in milliseconds. */\nconst USER_TIMING_DURATION: InstrumentDef = {\n name: \"ui.user_timing.duration\",\n kind: \"histogram\",\n unit: \"ms\",\n boundaries: [1, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000],\n};\n\n/** Observes the app's marks and measures. */\nexport class UserTimingCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"userTiming\";\n\n /** Observer for the mark and measure entries. */\n private observer: PerformanceObserver | undefined;\n\n /**\n * @param ctx Capture context with the config, the meter and the breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Observes marks and measures. Only the first install in a document reads buffered entries. */\n install(): void {\n if (this.observer) {\n return;\n }\n\n const { once } = this.ctx;\n const first = !once.userTiming;\n once.userTiming = true;\n\n // Older browsers have no supportedEntryTypes, and the capture stays off there.\n const supported: readonly string[] | undefined =\n typeof PerformanceObserver === \"undefined\"\n ? undefined\n : PerformanceObserver.supportedEntryTypes;\n if (!supported?.includes(\"measure\")) {\n if (first) {\n this.ctx.diagnostics.report(\n \"capture.install_failed\",\n \"The browser does not report User Timing entries. The user timing capture is off.\",\n );\n }\n return;\n }\n\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 user timing entry.\",\n () => {\n this.record(list.getEntries());\n },\n );\n });\n // Buffered entries include the marks and measures made before this chunk loaded.\n this.observer.observe({ type: \"measure\", buffered: first });\n if (supported.includes(\"mark\")) {\n this.observer.observe({ type: \"mark\", buffered: first });\n }\n }\n\n /** Disconnects the observer. */\n uninstall(): void {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n /**\n * Records the entries whose name `userTiming.include` selects.\n * @param entries Mark and measure entries.\n */\n private record(entries: PerformanceEntryList): void {\n if (this.ctx.isActive?.() === false) {\n return;\n }\n\n const { fullUrls, userTiming } = this.ctx.config.capture;\n const include = typeof userTiming === \"object\" ? userTiming.include : undefined;\n for (const entry of entries) {\n if (include !== undefined && include.length > 0 && !matchesAny(entry.name, include)) {\n continue;\n }\n\n // A third-party script can write any name, so a name can hold a URL with a token.\n const name = recordedUrl(entry.name, fullUrls);\n if (entry.entryType === \"measure\") {\n this.ctx.recordMetric(USER_TIMING_DURATION, entry.duration, { \"user_timing.name\": name });\n } else {\n this.ctx.breadcrumbs.push({\n // A buffered entry reaches the observer late, and the trail needs the mark's own time.\n t: Math.round(performance.timeOrigin + entry.startTime),\n category: \"event\",\n message: name.slice(0, this.ctx.config.limits.maxBodyChars),\n });\n }\n }\n }\n}\n"],"mappings":"A,wHAUA,IAAMK,EAAsC,CAC1C,KAAM,0BACN,KAAM,YACN,KAAM,KACN,WAAY,CAAC,EAAG,EAAG,GAAI,GAAI,GAAI,IAAK,IAAK,IAAK,IAAM,KAAM,IAAM,GAAK,CACvE,EAGaC,EAAb,KAAkD,CAUhD,YAAY,EAAsC,CAArBF,EAAA,EAAA,KAAA,MAAA,IAAA,EAAA,EAR7BA,EAAA,EAAA,KAAA,OAAgB,YAAA,EAGhBA,EAAA,EAAA,KAAA,WAAA,IAAA,EAAA,EAK6B,KAAA,IAAAG,CAAsB,CAGnD,SAAgB,CACd,GAAI,KAAK,SACP,OAGF,GAAM,CAAE,QAAS,KAAK,IAChBC,EAAQ,CAACC,EAAK,WACpB,EAAK,WAAa,GAGlB,IAAMC,EACJ,OAAO,oBAAwB,IAC3B,IAAA,GACA,oBAAoB,oBACrBA,GAAW,SAAS,SAAS,GAUlC,KAAK,SAAW,IAAI,oBAAqB,GAAS,CAEhD,KAAK,IAAI,YAAY,MACnB,wBACA,wDACM,CACJ,KAAK,OAAOC,EAAK,WAAW,CAAC,CAC/B,CACF,CACF,CAAC,EAED,KAAK,SAAS,QAAQ,CAAE,KAAM,UAAW,SAAUH,CAAM,CAAC,EACtDE,EAAU,SAAS,MAAM,GAC3B,KAAK,SAAS,QAAQ,CAAE,KAAM,OAAQ,SAAUF,CAAM,CAAC,GAtBnDA,GACF,KAAK,IAAI,YAAY,OACnB,yBACA,kFACF,CAoBN,CAGA,WAAkB,CAChB,KAAK,UAAU,WAAW,EAC1B,KAAK,SAAW,IAAA,EAClB,CAMA,OAAe,EAAqC,CAClD,GAAI,KAAK,IAAI,WAAW,IAAM,GAC5B,OAGF,GAAM,CAAE,WAAU,cAAe,KAAK,IAAI,OAAO,QAC3CI,EAAU,OAAOC,GAAe,SAAWA,EAAW,QAAU,IAAA,GACtE,IAAK,IAAMC,KAASC,EAAS,CAC3B,GAAIH,IAAY,IAAA,IAAaA,EAAQ,OAAS,GAAK,CAACZ,EAAAA,EAAWc,EAAM,KAAMF,CAAO,EAChF,SAIF,IAAMI,EAAOf,EAAAA,EAAYa,EAAM,KAAMG,CAAQ,EACzCH,EAAM,YAAc,UACtB,KAAK,IAAI,aAAaT,EAAsBS,EAAM,SAAU,CAAE,mBAAoBE,CAAK,CAAC,EAExF,KAAK,IAAI,YAAY,KAAK,CAExB,EAAG,KAAK,MAAM,YAAY,WAAaF,EAAM,SAAS,EACtD,SAAU,QACV,QAASE,EAAK,MAAM,EAAG,KAAK,IAAI,OAAO,OAAO,YAAY,CAC5D,CAAC,CAEL,CACF,CACF,E"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Diagnostics } from "../core/diagnostics.cjs";
|
|
2
|
+
import type { ResolvedConsole } from "../models/config.cjs";
|
|
3
|
+
import type { LogLevel } from "../models/log-record.cjs";
|
|
4
|
+
import { type SanitizeLimits } from "./sanitize.cjs";
|
|
5
|
+
/** Mirrors log records directly to browser or Node console methods based on severity. */
|
|
6
|
+
export declare class ConsoleSink {
|
|
7
|
+
private settings;
|
|
8
|
+
private diagnostics;
|
|
9
|
+
private readonly limits;
|
|
10
|
+
/**
|
|
11
|
+
* @param settings Console level and styles. A null level prints nothing.
|
|
12
|
+
* @param diagnostics Diagnostics reporter.
|
|
13
|
+
* @param limits Size limits for the printed payload. Same as the record limits.
|
|
14
|
+
*/
|
|
15
|
+
constructor(settings: ResolvedConsole, diagnostics: Diagnostics, limits?: SanitizeLimits);
|
|
16
|
+
/**
|
|
17
|
+
* Replaces the console level and styles.
|
|
18
|
+
* @param settings Console level and styles. A null level prints nothing.
|
|
19
|
+
*/
|
|
20
|
+
update(settings: ResolvedConsole): void;
|
|
21
|
+
/**
|
|
22
|
+
* Checks whether a level clears the console threshold.
|
|
23
|
+
* @param level Severity level of the record.
|
|
24
|
+
* @returns True if the sink prints this level.
|
|
25
|
+
*/
|
|
26
|
+
accepts(level: LogLevel): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Prints a styled log line if the level clears the console threshold.
|
|
29
|
+
* @param namespace Logger namespace, shown in the prefix.
|
|
30
|
+
* @param level Severity level of the record.
|
|
31
|
+
* @param message Primary log message.
|
|
32
|
+
* @param payload Caller payload. The sink prints a sanitized copy.
|
|
33
|
+
* @param error Error to print before the payload.
|
|
34
|
+
*/
|
|
35
|
+
write(namespace: string, level: LogLevel, message: string, payload?: Record<string, unknown>, error?: Error): void;
|
|
36
|
+
}
|
package/dist/utils/console.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Diagnostics } from "../core/diagnostics";
|
|
2
|
-
import type { ResolvedConsole } from "../models/config";
|
|
3
|
-
import type { LogLevel } from "../models/log-record";
|
|
4
|
-
import { type SanitizeLimits } from "./sanitize";
|
|
1
|
+
import type { Diagnostics } from "../core/diagnostics.js";
|
|
2
|
+
import type { ResolvedConsole } from "../models/config.js";
|
|
3
|
+
import type { LogLevel } from "../models/log-record.js";
|
|
4
|
+
import { type SanitizeLimits } from "./sanitize.js";
|
|
5
5
|
/** Mirrors log records directly to browser or Node console methods based on severity. */
|
|
6
6
|
export declare class ConsoleSink {
|
|
7
7
|
private settings;
|
|
@@ -10,7 +10,7 @@ export declare class ConsoleSink {
|
|
|
10
10
|
/**
|
|
11
11
|
* @param settings Console level and styles. A null level prints nothing.
|
|
12
12
|
* @param diagnostics Diagnostics reporter.
|
|
13
|
-
* @param limits Size limits
|
|
13
|
+
* @param limits Size limits for the printed payload. Same as the record limits.
|
|
14
14
|
*/
|
|
15
15
|
constructor(settings: ResolvedConsole, diagnostics: Diagnostics, limits?: SanitizeLimits);
|
|
16
16
|
/**
|
|
@@ -19,7 +19,7 @@ export declare class ConsoleSink {
|
|
|
19
19
|
*/
|
|
20
20
|
update(settings: ResolvedConsole): void;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Checks whether a level clears the console threshold.
|
|
23
23
|
* @param level Severity level of the record.
|
|
24
24
|
* @returns True if the sink prints this level.
|
|
25
25
|
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** The error for a promise that didn't settle before its deadline. */
|
|
2
|
+
export declare class DeadlineError extends Error {
|
|
3
|
+
/**
|
|
4
|
+
* @param ms Deadline in milliseconds.
|
|
5
|
+
*/
|
|
6
|
+
constructor(ms: number);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Rejects when a promise doesn't settle within a deadline.
|
|
10
|
+
* @param work The promise to bound.
|
|
11
|
+
* @param ms Deadline in milliseconds.
|
|
12
|
+
* @returns The promise's value, or a rejection after the deadline.
|
|
13
|
+
*/
|
|
14
|
+
export declare function withDeadline<T>(work: Promise<T>, ms: number): Promise<T>;
|
package/dist/utils/deadline.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** The error for a promise that didn't settle before its deadline. */
|
|
2
2
|
export declare class DeadlineError extends Error {
|
|
3
3
|
/**
|
|
4
4
|
* @param ms Deadline in milliseconds.
|
|
@@ -6,9 +6,9 @@ export declare class DeadlineError extends Error {
|
|
|
6
6
|
constructor(ms: number);
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Rejects when a promise
|
|
10
|
-
* @param work
|
|
9
|
+
* Rejects when a promise doesn't settle within a deadline.
|
|
10
|
+
* @param work The promise to bound.
|
|
11
11
|
* @param ms Deadline in milliseconds.
|
|
12
|
-
* @returns The value
|
|
12
|
+
* @returns The promise's value, or a rejection after the deadline.
|
|
13
13
|
*/
|
|
14
14
|
export declare function withDeadline<T>(work: Promise<T>, ms: number): Promise<T>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** The standard error fields. Any other own field is written as error data. */
|
|
2
|
+
export declare const ERROR_OWN_KEYS: ReadonlySet<string>;
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether a value is a field that error data keeps. An object field, such as an
|
|
5
|
+
* AxiosError's config, holds credentials and request bodies.
|
|
6
|
+
* @param value Field value.
|
|
7
|
+
* @returns True for a string, a number or a boolean.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isDataField(value: unknown): boolean;
|
|
10
|
+
/** The error fields that the library reads. */
|
|
11
|
+
export interface ErrorLike {
|
|
12
|
+
/** Error class name, for example "TypeError". */
|
|
13
|
+
name: string;
|
|
14
|
+
/** Error message. */
|
|
15
|
+
message: string;
|
|
16
|
+
/** Stack trace text. */
|
|
17
|
+
stack?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Checks whether a value has the shape of an error. A getter on a hostile value can throw, so
|
|
21
|
+
* call this inside a diagnostics guard.
|
|
22
|
+
* @param value The value to check.
|
|
23
|
+
* @returns True for an object with a string name, a string message and a string or no stack.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isErrorLike(value: unknown): value is ErrorLike;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** The standard error fields. Any other own field is written as error data. */
|
|
2
2
|
export declare const ERROR_OWN_KEYS: ReadonlySet<string>;
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* config
|
|
4
|
+
* Checks whether a value is a field that error data keeps. An object field, such as an
|
|
5
|
+
* AxiosError's config, holds credentials and request bodies.
|
|
6
6
|
* @param value Field value.
|
|
7
7
|
* @returns True for a string, a number or a boolean.
|
|
8
8
|
*/
|
|
9
9
|
export declare function isDataField(value: unknown): boolean;
|
|
10
|
-
/** The fields
|
|
10
|
+
/** The error fields that the library reads. */
|
|
11
11
|
export interface ErrorLike {
|
|
12
12
|
/** Error class name, for example "TypeError". */
|
|
13
13
|
name: string;
|
|
@@ -17,9 +17,9 @@ export interface ErrorLike {
|
|
|
17
17
|
stack?: string;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @param value
|
|
20
|
+
* Checks whether a value has the shape of an error. A getter on a hostile value can throw, so
|
|
21
|
+
* call this inside a diagnostics guard.
|
|
22
|
+
* @param value The value to check.
|
|
23
23
|
* @returns True for an object with a string name, a string message and a string or no stack.
|
|
24
24
|
*/
|
|
25
25
|
export declare function isErrorLike(value: unknown): value is ErrorLike;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** State of one fixed window. Counters that share a limit share one object. */
|
|
2
|
+
export interface StormWindow {
|
|
3
|
+
/** Start of the current window, in epoch milliseconds. */
|
|
4
|
+
start: number;
|
|
5
|
+
/** Events counted in the current window. */
|
|
6
|
+
count: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Counts one event in a fixed window.
|
|
10
|
+
* @param window The window state to update.
|
|
11
|
+
* @param limit Maximum events per window.
|
|
12
|
+
* @param windowMs Window length in milliseconds.
|
|
13
|
+
* @returns False when the window has no allowance left. The caller must drop the event.
|
|
14
|
+
*/
|
|
15
|
+
export declare function countInWindow(window: StormWindow, limit: number, windowMs: number): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Checks whether a fixed window has ended. The bus uses the same rule to expire its source
|
|
18
|
+
* entries.
|
|
19
|
+
* @param window Window state.
|
|
20
|
+
* @param windowMs Window length in milliseconds.
|
|
21
|
+
* @param now Current epoch time in milliseconds.
|
|
22
|
+
* @returns True once the window length has passed, or when the clock moved back. Without the
|
|
23
|
+
* second check, a clock that moves back would keep the window open.
|
|
24
|
+
*/
|
|
25
|
+
export declare function windowEnded(window: StormWindow, windowMs: number, now: number): boolean;
|
|
@@ -7,18 +7,19 @@ export interface StormWindow {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Counts one event in a fixed window.
|
|
10
|
-
* @param window
|
|
11
|
-
* @param limit Maximum events
|
|
12
|
-
* @param windowMs
|
|
10
|
+
* @param window The window state to update.
|
|
11
|
+
* @param limit Maximum events per window.
|
|
12
|
+
* @param windowMs Window length in milliseconds.
|
|
13
13
|
* @returns False when the window has no allowance left. The caller must drop the event.
|
|
14
14
|
*/
|
|
15
15
|
export declare function countInWindow(window: StormWindow, limit: number, windowMs: number): boolean;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Checks whether a fixed window has ended. The bus uses the same rule to expire its source
|
|
18
|
+
* entries.
|
|
18
19
|
* @param window Window state.
|
|
19
|
-
* @param windowMs
|
|
20
|
-
* @param now Current epoch time
|
|
21
|
-
* @returns True
|
|
22
|
-
* check, a clock that moves back
|
|
20
|
+
* @param windowMs Window length in milliseconds.
|
|
21
|
+
* @param now Current epoch time in milliseconds.
|
|
22
|
+
* @returns True once the window length has passed, or when the clock moved back. Without the
|
|
23
|
+
* second check, a clock that moves back would keep the window open.
|
|
23
24
|
*/
|
|
24
25
|
export declare function windowEnded(window: StormWindow, windowMs: number, now: number): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** A scope that a function runs inside. */
|
|
2
|
+
export interface GlobalScope {
|
|
3
|
+
/**
|
|
4
|
+
* Runs a function inside the scope. Only the synchronous part of the function is covered.
|
|
5
|
+
* @param fn The function to run.
|
|
6
|
+
* @returns The function's return value.
|
|
7
|
+
*/
|
|
8
|
+
run<T>(fn: () => T): T;
|
|
9
|
+
/**
|
|
10
|
+
* Checks whether a scope is open.
|
|
11
|
+
* @returns True while a function is running inside the scope.
|
|
12
|
+
*/
|
|
13
|
+
open(): boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates a scope whose count lives on a global symbol.
|
|
17
|
+
* @param key The global symbol's key.
|
|
18
|
+
* @returns The scope.
|
|
19
|
+
*/
|
|
20
|
+
export declare function globalScope(key: string): GlobalScope;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** A scope that a function runs inside. */
|
|
2
2
|
export interface GlobalScope {
|
|
3
3
|
/**
|
|
4
|
-
* Runs a function inside the scope.
|
|
5
|
-
* @param fn
|
|
6
|
-
* @returns The return value
|
|
4
|
+
* Runs a function inside the scope. Only the synchronous part of the function is covered.
|
|
5
|
+
* @param fn The function to run.
|
|
6
|
+
* @returns The function's return value.
|
|
7
7
|
*/
|
|
8
8
|
run<T>(fn: () => T): T;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @returns True while a function
|
|
10
|
+
* Checks whether a scope is open.
|
|
11
|
+
* @returns True while a function is running inside the scope.
|
|
12
12
|
*/
|
|
13
13
|
open(): boolean;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
* @param key
|
|
16
|
+
* Creates a scope whose count lives on a global symbol.
|
|
17
|
+
* @param key The global symbol's key.
|
|
18
18
|
* @returns The scope.
|
|
19
19
|
*/
|
|
20
20
|
export declare function globalScope(key: string): GlobalScope;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a value is a non-null object that isn't an array.
|
|
3
|
+
* @param value The value to check.
|
|
4
|
+
* @returns True for an object with string keys.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* Checks whether a key is the object's own property, so an inherited "toString" fails. It
|
|
9
|
+
* replaces Object.hasOwn, which is missing before Chrome 93, Firefox 92 and Safari 15.4.
|
|
10
|
+
* @param object The object to check.
|
|
11
|
+
* @param key The property key.
|
|
12
|
+
* @returns True if the object has its own property with this key.
|
|
13
|
+
*/
|
|
14
|
+
export declare function hasOwn(object: object, key: PropertyKey): boolean;
|
package/dist/utils/guards.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @param value
|
|
2
|
+
* Checks whether a value is a non-null object that isn't an array.
|
|
3
|
+
* @param value The value to check.
|
|
4
4
|
* @returns True for an object with string keys.
|
|
5
5
|
*/
|
|
6
6
|
export declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* Checks whether a key is the object's own property, so an inherited "toString" fails. It
|
|
9
|
+
* replaces Object.hasOwn, which is missing before Chrome 93, Firefox 92 and Safari 15.4.
|
|
10
|
+
* @param object The object to check.
|
|
11
|
+
* @param key The property key.
|
|
12
|
+
* @returns True if the object has its own property with this key.
|
|
13
|
+
*/
|
|
14
|
+
export declare function hasOwn(object: object, key: PropertyKey): boolean;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { Diagnostics } from "../core/diagnostics.cjs";
|
|
2
|
+
/** Correlation identifiers attached to log records across session, tab, and realm scopes. */
|
|
3
|
+
export interface Identity {
|
|
4
|
+
/** Origin-wide user session identifier surviving across tabs until idle expiration. */
|
|
5
|
+
sessionId: string;
|
|
6
|
+
/** Browser tab or desktop window identifier surviving document reloads. */
|
|
7
|
+
tabId: string;
|
|
8
|
+
/** Unique execution realm identifier regenerated on every document load. */
|
|
9
|
+
contextId: string;
|
|
10
|
+
}
|
|
11
|
+
/** The three Storage methods that identity and journey code use. */
|
|
12
|
+
export interface KeyValueStore {
|
|
13
|
+
/**
|
|
14
|
+
* Reads one value.
|
|
15
|
+
* @param key Storage key.
|
|
16
|
+
* @returns Stored value, or null.
|
|
17
|
+
*/
|
|
18
|
+
getItem(key: string): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Writes one value.
|
|
21
|
+
* @param key Storage key.
|
|
22
|
+
* @param value Value to write.
|
|
23
|
+
*/
|
|
24
|
+
setItem(key: string, value: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Removes one value.
|
|
27
|
+
* @param key Storage key.
|
|
28
|
+
*/
|
|
29
|
+
removeItem(key: string): void;
|
|
30
|
+
}
|
|
31
|
+
/** Stores for identity and journey keys. A getter can throw in a sandboxed frame. */
|
|
32
|
+
export interface IdentityStores {
|
|
33
|
+
/** Store that lasts across tabs and reloads. */
|
|
34
|
+
local(): KeyValueStore;
|
|
35
|
+
/** Store that lasts for one tab. */
|
|
36
|
+
session(): KeyValueStore;
|
|
37
|
+
}
|
|
38
|
+
/** Stores that write to the browser. Used by the `identity: "storage"` option. */
|
|
39
|
+
export declare const BROWSER_STORES: IdentityStores;
|
|
40
|
+
/**
|
|
41
|
+
* Creates stores that keep values in memory only. Used by the `identity: "memory"` option.
|
|
42
|
+
* @returns Stores that write nothing to the browser.
|
|
43
|
+
*/
|
|
44
|
+
export declare function memoryStores(): IdentityStores;
|
|
45
|
+
/**
|
|
46
|
+
* Generates a random lowercase hexadecimal string of the given byte length. Uses
|
|
47
|
+
* crypto.getRandomValues when it is available, and Math.random otherwise.
|
|
48
|
+
* @param byteLength Number of random bytes to generate.
|
|
49
|
+
* @returns Hexadecimal string of length byteLength * 2.
|
|
50
|
+
*/
|
|
51
|
+
export declare function randomHex(byteLength: number): string;
|
|
52
|
+
/**
|
|
53
|
+
* Generates a unique identifier with crypto.randomUUID, falling back to randomHex.
|
|
54
|
+
* @param diagnostics Diagnostics reporter. Counts a blocked crypto.randomUUID call.
|
|
55
|
+
* @returns A UUID or a random hex identifier.
|
|
56
|
+
*/
|
|
57
|
+
export declare function newId(diagnostics: Diagnostics): string;
|
|
58
|
+
/**
|
|
59
|
+
* Resolves or initializes the session, tab, and context identifiers for the active realm.
|
|
60
|
+
* @param diagnostics Diagnostics reporter.
|
|
61
|
+
* @param stores Identity stores.
|
|
62
|
+
* @returns The populated Identity object.
|
|
63
|
+
*/
|
|
64
|
+
export declare function resolveIdentity(diagnostics: Diagnostics, stores?: IdentityStores, idleMs?: number | null): Identity;
|
|
65
|
+
/**
|
|
66
|
+
* Writes a new tab id to the session store.
|
|
67
|
+
* @param tabId New tab identifier.
|
|
68
|
+
* @param diagnostics Diagnostics reporter.
|
|
69
|
+
* @param stores Identity stores.
|
|
70
|
+
*/
|
|
71
|
+
export declare function persistTabId(tabId: string, diagnostics: Diagnostics, stores: IdentityStores): void;
|
|
72
|
+
/**
|
|
73
|
+
* Writes the session's last-seen timestamp, throttled by `SESSION_TOUCH_MS`. The throttle
|
|
74
|
+
* state lives on the instance, not the module, so two runtimes in one document don't block
|
|
75
|
+
* each other's session writes.
|
|
76
|
+
*/
|
|
77
|
+
export declare class SessionTouch {
|
|
78
|
+
private diagnostics;
|
|
79
|
+
private readonly stores;
|
|
80
|
+
private readonly idleMs;
|
|
81
|
+
/** Epoch milliseconds of the last write this instance made. */
|
|
82
|
+
private lastTouchAt;
|
|
83
|
+
/**
|
|
84
|
+
* @param diagnostics Diagnostics reporter.
|
|
85
|
+
* @param stores Identity stores.
|
|
86
|
+
*/
|
|
87
|
+
constructor(diagnostics: Diagnostics, stores?: IdentityStores, idleMs?: number | null);
|
|
88
|
+
/**
|
|
89
|
+
* Writes the session activity time to the local store, at most once per throttle window.
|
|
90
|
+
* @param sessionId The active session identifier.
|
|
91
|
+
*/
|
|
92
|
+
touch(sessionId: string): void;
|
|
93
|
+
/**
|
|
94
|
+
* Reads the live session id from the local store.
|
|
95
|
+
* @returns The stored session id, or undefined if no session is live.
|
|
96
|
+
*/
|
|
97
|
+
stored(): string | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Writes a new session id to the local store right away, bypassing the throttle.
|
|
100
|
+
* @param sessionId The new session identifier.
|
|
101
|
+
*/
|
|
102
|
+
restart(sessionId: string): void;
|
|
103
|
+
/**
|
|
104
|
+
* Writes the session record and starts a new throttle window.
|
|
105
|
+
* @param sessionId Session identifier.
|
|
106
|
+
* @param now Epoch time in milliseconds.
|
|
107
|
+
*/
|
|
108
|
+
private write;
|
|
109
|
+
}
|