@utk09/ui-observability 0.10.0 → 0.12.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 +77 -1
- package/README.md +323 -113
- package/bin/uiobs.mjs +1 -1
- package/dist/{batch-BMdT9mKm.js → batch-BjQUwjA6.js} +5 -6
- package/dist/batch-BjQUwjA6.js.map +1 -0
- package/dist/{batch-BHXypM1j.cjs → batch-D5LlU4Q9.cjs} +2 -2
- package/dist/batch-D5LlU4Q9.cjs.map +1 -0
- package/dist/bus/bus.d.ts +48 -47
- package/dist/bus/links.d.ts +4 -4
- package/dist/bus/validation.d.ts +1 -1
- package/dist/bus-D_7pd7RN.cjs +2 -0
- package/dist/bus-D_7pd7RN.cjs.map +1 -0
- package/dist/{bus-DKfBaica.js → bus-ecxUNTja.js} +105 -109
- package/dist/bus-ecxUNTja.js.map +1 -0
- package/dist/capture/console.d.ts +10 -10
- package/dist/capture/errors.d.ts +6 -6
- package/dist/capture/interactions.d.ts +14 -14
- package/dist/capture/lifecycle.d.ts +3 -3
- package/dist/capture/long-frames.d.ts +6 -6
- package/dist/capture/network.d.ts +17 -17
- package/dist/capture/profiler-frames.d.ts +44 -0
- package/dist/capture/replay-buffer.d.ts +46 -0
- package/dist/capture/replay-upload.d.ts +74 -0
- package/dist/capture/replay.d.ts +114 -0
- package/dist/capture/reports.d.ts +2 -2
- package/dist/capture/resource-timing.d.ts +1 -1
- package/dist/capture/server-timing.d.ts +3 -3
- package/dist/capture/storm.d.ts +3 -3
- package/dist/capture/types.d.ts +45 -33
- package/dist/capture/unclean-exit.d.ts +8 -8
- package/dist/capture/user-timing.d.ts +3 -3
- package/dist/capture/web-socket.d.ts +11 -11
- package/dist/capture/web-vitals.d.ts +20 -7
- package/dist/compression-AJJCMBOa.js +11 -0
- package/dist/compression-AJJCMBOa.js.map +1 -0
- package/dist/compression-lD9abCcO.cjs +2 -0
- package/dist/compression-lD9abCcO.cjs.map +1 -0
- package/dist/console-CLz_PvFn.cjs +2 -0
- package/dist/console-CLz_PvFn.cjs.map +1 -0
- package/dist/{console-BX_0UCV7.js → console-cwgHKXvM.js} +14 -15
- package/dist/console-cwgHKXvM.js.map +1 -0
- package/dist/constants-Bwl_YtQi.js +349 -0
- package/dist/constants-Bwl_YtQi.js.map +1 -0
- package/dist/constants-DakMxVB2.cjs +2 -0
- package/dist/constants-DakMxVB2.cjs.map +1 -0
- package/dist/constants.d.ts +150 -103
- package/dist/context-storage-BjzeBSxH.cjs.map +1 -1
- package/dist/{context-storage-DxZf4Gfh.js → context-storage-BzkoHzkQ.js} +2 -3
- package/dist/context-storage-BzkoHzkQ.js.map +1 -0
- package/dist/core/breadcrumbs.d.ts +16 -15
- package/dist/core/config.d.ts +3 -3
- package/dist/core/context.d.ts +7 -7
- package/dist/core/debug-buffer.d.ts +10 -10
- package/dist/core/debug-bundle.d.ts +3 -3
- package/dist/core/deferred.d.ts +2 -2
- package/dist/core/diagnostics.d.ts +24 -21
- package/dist/core/drops.d.ts +7 -7
- package/dist/core/hold-buffer.d.ts +1 -1
- package/dist/core/journey.d.ts +22 -23
- package/dist/core/logger.d.ts +22 -21
- package/dist/core/measure.d.ts +7 -7
- package/dist/core/meter.d.ts +25 -21
- package/dist/core/pipeline.d.ts +42 -41
- package/dist/core/profile-buckets.d.ts +31 -0
- package/dist/core/profiler.d.ts +218 -0
- package/dist/core/record.d.ts +23 -23
- package/dist/core/remote-rules.d.ts +4 -4
- package/dist/core/remote-sampling.d.ts +21 -20
- package/dist/core/runtime.d.ts +206 -137
- package/dist/core/sampling.d.ts +18 -18
- package/dist/core/sender.d.ts +22 -20
- package/dist/core/spans.d.ts +5 -5
- package/dist/{deadline-5_PecIl5.js → deadline-C4ccAuk5.js} +4 -9
- 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-CZZ6SQQh.js → debug-bundle-BOdYmCeV.js} +12 -6
- package/dist/debug-bundle-BOdYmCeV.js.map +1 -0
- package/dist/debug-bundle-Ex4L_LSP.cjs +2 -0
- package/dist/debug-bundle-Ex4L_LSP.cjs.map +1 -0
- package/dist/doctor.cjs +1 -1
- package/dist/doctor.cjs.map +1 -1
- package/dist/doctor.d.ts +16 -6
- package/dist/doctor.js +148 -54
- package/dist/doctor.js.map +1 -1
- package/dist/{emergency-queue-Cs8-i2xw.js → emergency-queue-B9WZxanZ.js} +15 -17
- package/dist/emergency-queue-B9WZxanZ.js.map +1 -0
- package/dist/{emergency-queue-CQ-9acZf.cjs → emergency-queue-HBpL5r3V.cjs} +2 -2
- package/dist/emergency-queue-HBpL5r3V.cjs.map +1 -0
- package/dist/{error-like-Ywo5uRHo.js → error-like-B11pB4aL.js} +2 -3
- package/dist/error-like-B11pB4aL.js.map +1 -0
- package/dist/error-like-gGRx2s36.cjs.map +1 -1
- package/dist/{errors-oyxrpHjY.js → errors-D6bwgJtO.js} +5 -6
- package/dist/errors-D6bwgJtO.js.map +1 -0
- package/dist/{errors-CigX45pL.cjs → errors-DCOCRdSi.cjs} +2 -2
- package/dist/errors-DCOCRdSi.cjs.map +1 -0
- package/dist/{factory-BkjNzPYL.cjs → factory-DLFDjdLv.cjs} +2 -2
- package/dist/factory-DLFDjdLv.cjs.map +1 -0
- package/dist/{factory-Bgsky_e0.js → factory-e9Qo3K0z.js} +18 -22
- package/dist/factory-e9Qo3K0z.js.map +1 -0
- package/dist/fixed-window-CvESpFYV.cjs.map +1 -1
- package/dist/{fixed-window-CtaFHanJ.js → fixed-window-Dq3MLUUv.js} +2 -3
- package/dist/fixed-window-Dq3MLUUv.js.map +1 -0
- package/dist/global-scope-BN-Io_yv.cjs.map +1 -1
- package/dist/{global-scope-dp2jADRl.js → global-scope-D9I8s-oN.js} +2 -3
- package/dist/global-scope-D9I8s-oN.js.map +1 -0
- package/dist/{guards-CpvOpJL6.js → guards-Cidk71ME.js} +2 -3
- package/dist/guards-Cidk71ME.js.map +1 -0
- package/dist/guards-nJ70syPt.cjs.map +1 -1
- package/dist/{identity-BMlKGHUM.cjs → identity-BlvlgjrU.cjs} +2 -2
- package/dist/identity-BlvlgjrU.cjs.map +1 -0
- package/dist/{identity-DOaHdfhT.js → identity-BrQp_5J5.js} +20 -21
- package/dist/identity-BrQp_5J5.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +112 -79
- package/dist/index.js +797 -659
- package/dist/index.js.map +1 -1
- package/dist/{indexeddb-storage-CaXGJqDD.cjs → indexeddb-storage-CtLvZH1r.cjs} +2 -2
- package/dist/indexeddb-storage-CtLvZH1r.cjs.map +1 -0
- package/dist/{indexeddb-storage-D-lUW_5P.js → indexeddb-storage-DLXQzAGh.js} +5 -6
- package/dist/indexeddb-storage-DLXQzAGh.js.map +1 -0
- package/dist/{interactions-CqDNrtIR.js → interactions-B6z2I4tU.js} +10 -11
- package/dist/interactions-B6z2I4tU.js.map +1 -0
- package/dist/{interactions-8DgxtmgO.cjs → interactions-P6pz08Jn.cjs} +2 -2
- package/dist/interactions-P6pz08Jn.cjs.map +1 -0
- package/dist/{journey-DgIjhrIc.js → journey-35yCMNFo.js} +21 -21
- package/dist/journey-35yCMNFo.js.map +1 -0
- package/dist/journey-DAGh5h9k.cjs +2 -0
- package/dist/journey-DAGh5h9k.cjs.map +1 -0
- package/dist/keys-BHhw_0Wh.cjs.map +1 -1
- package/dist/{keys-D5r_GH9q.js → keys-BU9j5YqW.js} +2 -3
- package/dist/keys-BU9j5YqW.js.map +1 -0
- package/dist/{library-console-g_VU-wzP.cjs → library-console-BFWEuQsl.cjs} +2 -2
- package/dist/library-console-BFWEuQsl.cjs.map +1 -0
- package/dist/library-console-Dl_Ly6DQ.js +13 -0
- package/dist/library-console-Dl_Ly6DQ.js.map +1 -0
- package/dist/{library-request-FQaiWjCP.cjs → library-request-Da-CHKzT.cjs} +2 -2
- package/dist/library-request-Da-CHKzT.cjs.map +1 -0
- package/dist/{library-request-CyC-9IOk.js → library-request-nI6pvI6I.js} +4 -5
- package/dist/library-request-nI6pvI6I.js.map +1 -0
- package/dist/{lifecycle-C2z_d8OX.cjs → lifecycle-BGGOcN4N.cjs} +2 -2
- package/dist/lifecycle-BGGOcN4N.cjs.map +1 -0
- package/dist/{lifecycle-BLC4VU7c.js → lifecycle-CZ6RRXc6.js} +3 -4
- package/dist/lifecycle-CZ6RRXc6.js.map +1 -0
- package/dist/{log-record-DKvo-B-d.cjs → log-record-D7bA1RPb.cjs} +2 -2
- package/dist/log-record-D7bA1RPb.cjs.map +1 -0
- package/dist/{log-record-CndanC-p.js → log-record-DIA6McNr.js} +3 -4
- package/dist/log-record-DIA6McNr.js.map +1 -0
- package/dist/{long-frames-BQef9rXR.js → long-frames-430_85Da.js} +9 -8
- package/dist/long-frames-430_85Da.js.map +1 -0
- package/dist/long-frames-Dd8tsi2U.cjs +2 -0
- package/dist/long-frames-Dd8tsi2U.cjs.map +1 -0
- package/dist/models/batch.d.ts +14 -15
- package/dist/models/bus.d.ts +24 -24
- package/dist/models/config.d.ts +402 -216
- package/dist/models/drop.d.ts +13 -11
- package/dist/models/health.d.ts +13 -13
- package/dist/models/log-record.d.ts +13 -14
- package/dist/models/metric.d.ts +82 -17
- package/dist/models/plugin.d.ts +13 -13
- package/dist/models/replay.d.ts +60 -0
- package/dist/models/serializer.d.ts +2 -3
- package/dist/models/stats.d.ts +2 -2
- package/dist/models/storage.d.ts +12 -11
- package/dist/{network-CvkvYzRU.js → network-C7SkLf4v.js} +30 -32
- package/dist/network-C7SkLf4v.js.map +1 -0
- package/dist/{network-CqnQOqon.cjs → network-pEX3PAJv.cjs} +2 -2
- package/dist/network-pEX3PAJv.cjs.map +1 -0
- package/dist/openfin-Bxelt0yg.js +7 -0
- package/dist/openfin-Bxelt0yg.js.map +1 -0
- package/dist/openfin-DtH2f7zX.cjs.map +1 -1
- package/dist/otlp-2MCrC3kd.cjs +2 -0
- package/dist/otlp-2MCrC3kd.cjs.map +1 -0
- package/dist/{otlp-CYIL7MOE.js → otlp-COq033e3.js} +26 -35
- package/dist/otlp-COq033e3.js.map +1 -0
- package/dist/patch-BX8KrPCT.cjs.map +1 -1
- package/dist/{patch-CCWfuEY7.js → patch-UdPz1ea8.js} +2 -3
- package/dist/patch-UdPz1ea8.js.map +1 -0
- package/dist/{platform-KMWkoI-v.cjs → platform-12uR7kBQ.cjs} +2 -2
- package/dist/platform-12uR7kBQ.cjs.map +1 -0
- package/dist/{platform-wcAkkv9F.js → platform-CVewe4wQ.js} +9 -10
- package/dist/platform-CVewe4wQ.js.map +1 -0
- package/dist/profiler-BVWIOgnq.js +310 -0
- package/dist/profiler-BVWIOgnq.js.map +1 -0
- package/dist/profiler-eVCknCzS.cjs +2 -0
- package/dist/profiler-eVCknCzS.cjs.map +1 -0
- package/dist/profiler-frames-CLXlT_xL.js +86 -0
- package/dist/profiler-frames-CLXlT_xL.js.map +1 -0
- package/dist/profiler-frames-Dg2OebB2.cjs +2 -0
- package/dist/profiler-frames-Dg2OebB2.cjs.map +1 -0
- package/dist/{remote-rules-CH_7PphT.js → remote-rules-BJGDJGwA.js} +29 -30
- package/dist/remote-rules-BJGDJGwA.js.map +1 -0
- package/dist/{remote-rules-BL8km4xk.cjs → remote-rules-CJD3ToVk.cjs} +2 -2
- package/dist/remote-rules-CJD3ToVk.cjs.map +1 -0
- package/dist/replay-0zAJv9T3.js +338 -0
- package/dist/replay-0zAJv9T3.js.map +1 -0
- package/dist/replay-DomJpXqW.cjs +2 -0
- package/dist/replay-DomJpXqW.cjs.map +1 -0
- package/dist/{reports-Bh_-KpZ2.cjs → reports-BsbqmP8h.cjs} +2 -2
- package/dist/reports-BsbqmP8h.cjs.map +1 -0
- package/dist/{reports-BOKyY3_A.js → reports-BuXekPOS.js} +4 -5
- package/dist/reports-BuXekPOS.js.map +1 -0
- package/dist/{resource-timing-BROnEJ0E.js → resource-timing-CXGHwFRD.js} +6 -7
- package/dist/resource-timing-CXGHwFRD.js.map +1 -0
- package/dist/{resource-timing-CbgwNpog.cjs → resource-timing-DkycFGDa.cjs} +2 -2
- package/dist/resource-timing-DkycFGDa.cjs.map +1 -0
- package/dist/{sampling-ECGVYiDD.cjs → sampling-Dd0wllyq.cjs} +2 -2
- package/dist/sampling-Dd0wllyq.cjs.map +1 -0
- package/dist/{sampling-BLO_pcV4.js → sampling-UUDbi3K0.js} +11 -12
- package/dist/sampling-UUDbi3K0.js.map +1 -0
- package/dist/{sanitize-DS0G4_ea.js → sanitize-CNmsD9r3.js} +4 -5
- package/dist/sanitize-CNmsD9r3.js.map +1 -0
- package/dist/{sanitize-Bsn8HQWC.cjs → sanitize-ChLn97Ch.cjs} +2 -2
- package/dist/sanitize-ChLn97Ch.cjs.map +1 -0
- package/dist/{select-DWO0-w8_.cjs → select-CTk-K5mG.cjs} +3 -3
- package/dist/select-CTk-K5mG.cjs.map +1 -0
- package/dist/{select-wqt9Wxio.js → select-DPv_j6wq.js} +64 -67
- package/dist/select-DPv_j6wq.js.map +1 -0
- package/dist/{sender-BkAVt-Rq.js → sender-15zEsZpr.js} +98 -101
- package/dist/sender-15zEsZpr.js.map +1 -0
- package/dist/sender-Bfpv9tad.cjs +2 -0
- package/dist/sender-Bfpv9tad.cjs.map +1 -0
- package/dist/storage/context-storage.d.ts +34 -33
- package/dist/storage/emergency-queue.d.ts +9 -9
- package/dist/storage/eviction.d.ts +12 -12
- package/dist/storage/factory.d.ts +8 -7
- package/dist/storage/gap.d.ts +6 -6
- package/dist/storage/idb-driver.d.ts +31 -32
- package/dist/storage/indexeddb-storage.d.ts +26 -27
- package/dist/storage/keys.d.ts +7 -7
- package/dist/storage/local-storage.d.ts +38 -38
- package/dist/storage/memory-storage.d.ts +21 -22
- package/dist/storage/persistence.d.ts +1 -1
- package/dist/storage-BA9RqRO-.cjs.map +1 -1
- package/dist/{storage-w7Tslvlq.js → storage-DZwed89z.js} +2 -3
- package/dist/storage-DZwed89z.js.map +1 -0
- package/dist/{storm-DD4cUkoL.js → storm-BTSNTIWI.js} +4 -5
- package/dist/storm-BTSNTIWI.js.map +1 -0
- package/dist/{storm-DCEsqViG.cjs → storm-D0_qZOEg.cjs} +2 -2
- package/dist/storm-D0_qZOEg.cjs.map +1 -0
- package/dist/transport/compression.d.ts +2 -2
- package/dist/transport/errors.d.ts +7 -7
- package/dist/transport/exit-flush.d.ts +39 -39
- package/dist/transport/headers.d.ts +2 -2
- package/dist/transport/http-transport.d.ts +28 -27
- package/dist/transport/memory-transport.d.ts +6 -6
- package/dist/transport/retry-engine.d.ts +35 -34
- package/dist/transport/serializers/ecs.d.ts +1 -1
- package/dist/transport/serializers/otlp-metrics.d.ts +1 -1
- package/dist/transport/serializers/otlp-traces.d.ts +1 -1
- package/dist/transport/serializers/otlp.d.ts +16 -16
- package/dist/transport/serializers/select.d.ts +7 -7
- package/dist/transport/status-transport.d.ts +20 -20
- package/dist/transport/worker-protocol.d.ts +3 -3
- package/dist/{types-BR9t_w28.js → types-BAerHgCq.js} +2 -3
- package/dist/types-BAerHgCq.js.map +1 -0
- package/dist/types-C7WNpnG1.cjs.map +1 -1
- package/dist/{unclean-exit-CwdpbUDg.cjs → unclean-exit-ClGzrc2A.cjs} +2 -2
- package/dist/unclean-exit-ClGzrc2A.cjs.map +1 -0
- package/dist/{unclean-exit-BYZ5yaSI.js → unclean-exit-Cob_jyTv.js} +3 -4
- package/dist/unclean-exit-Cob_jyTv.js.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-CdYqx3PF.cjs +2 -0
- package/dist/user-timing-CdYqx3PF.cjs.map +1 -0
- package/dist/{user-timing-Di2ra5DB.js → user-timing-DgHubxCI.js} +7 -6
- package/dist/user-timing-DgHubxCI.js.map +1 -0
- package/dist/utils/console.d.ts +2 -2
- package/dist/utils/deadline.d.ts +4 -4
- package/dist/utils/error-like.d.ts +7 -7
- package/dist/utils/fixed-window.d.ts +9 -8
- package/dist/utils/global-scope.d.ts +8 -8
- package/dist/utils/guards.d.ts +2 -2
- package/dist/utils/identity.d.ts +17 -17
- package/dist/utils/library-console.d.ts +4 -4
- package/dist/utils/library-request.d.ts +10 -10
- package/dist/utils/lock.d.ts +10 -9
- package/dist/utils/openfin.d.ts +5 -5
- package/dist/utils/patch.d.ts +6 -6
- package/dist/utils/platform.d.ts +13 -11
- package/dist/utils/sanitize.d.ts +4 -4
- package/dist/utils/timer.d.ts +1 -1
- package/dist/utils/tracing.d.ts +38 -38
- package/dist/utils/unref.d.ts +3 -3
- package/dist/{web-socket-DwBNhgre.cjs → web-socket-BTuvYoJI.cjs} +2 -2
- package/dist/web-socket-BTuvYoJI.cjs.map +1 -0
- package/dist/{web-socket-B-5qqPy7.js → web-socket-DthJuSAg.js} +14 -15
- package/dist/web-socket-DthJuSAg.js.map +1 -0
- package/dist/web-vitals-Ch5BpDmo.cjs +2 -0
- package/dist/web-vitals-Ch5BpDmo.cjs.map +1 -0
- package/dist/web-vitals-CsGCWnUr.js +77 -0
- package/dist/web-vitals-CsGCWnUr.js.map +1 -0
- package/dist/{worker-protocol-0HMf4-kY.js → worker-protocol-B0_8rWy5.js} +6 -7
- package/dist/worker-protocol-B0_8rWy5.js.map +1 -0
- package/dist/{worker-protocol-DXekoADQ.cjs → worker-protocol-BjzFORfq.cjs} +2 -2
- package/dist/worker-protocol-BjzFORfq.cjs.map +1 -0
- package/dist/worker-server-4en-Lt-3.cjs +2 -0
- package/dist/worker-server-4en-Lt-3.cjs.map +1 -0
- package/dist/{worker-server-CKcmX5m5.js → worker-server-Cne9MX9I.js} +25 -26
- package/dist/{worker-server-CKcmX5m5.js.map → worker-server-Cne9MX9I.js.map} +1 -1
- package/dist/worker-transport-B-GF4Aqn.cjs +2 -0
- package/dist/worker-transport-B-GF4Aqn.cjs.map +1 -0
- package/dist/{worker-transport-2220ghFZ.js → worker-transport-C3SjJAEC.js} +64 -65
- package/dist/worker-transport-C3SjJAEC.js.map +1 -0
- package/package.json +33 -41
- package/dist/batch-BHXypM1j.cjs.map +0 -1
- package/dist/batch-BMdT9mKm.js.map +0 -1
- package/dist/bus-DKfBaica.js.map +0 -1
- package/dist/bus-Dea9rVhy.cjs +0 -2
- package/dist/bus-Dea9rVhy.cjs.map +0 -1
- package/dist/console-BX_0UCV7.js.map +0 -1
- package/dist/console-DZEcs7FL.cjs +0 -2
- package/dist/console-DZEcs7FL.cjs.map +0 -1
- package/dist/constants-CL0ZdI2f.cjs +0 -2
- package/dist/constants-CL0ZdI2f.cjs.map +0 -1
- package/dist/constants-CU60FG4w.js +0 -305
- package/dist/constants-CU60FG4w.js.map +0 -1
- package/dist/context-storage-DxZf4Gfh.js.map +0 -1
- package/dist/deadline-5_PecIl5.js.map +0 -1
- package/dist/deadline-XSnm95pg.cjs +0 -2
- package/dist/deadline-XSnm95pg.cjs.map +0 -1
- package/dist/debug-bundle-CZZ6SQQh.js.map +0 -1
- package/dist/debug-bundle-yRkrU1ny.cjs +0 -2
- package/dist/debug-bundle-yRkrU1ny.cjs.map +0 -1
- package/dist/emergency-queue-CQ-9acZf.cjs.map +0 -1
- package/dist/emergency-queue-Cs8-i2xw.js.map +0 -1
- package/dist/error-like-Ywo5uRHo.js.map +0 -1
- package/dist/errors-CigX45pL.cjs.map +0 -1
- package/dist/errors-oyxrpHjY.js.map +0 -1
- package/dist/factory-Bgsky_e0.js.map +0 -1
- package/dist/factory-BkjNzPYL.cjs.map +0 -1
- package/dist/fixed-window-CtaFHanJ.js.map +0 -1
- package/dist/global-scope-dp2jADRl.js.map +0 -1
- package/dist/guards-CpvOpJL6.js.map +0 -1
- package/dist/identity-BMlKGHUM.cjs.map +0 -1
- package/dist/identity-DOaHdfhT.js.map +0 -1
- package/dist/indexeddb-storage-CaXGJqDD.cjs.map +0 -1
- package/dist/indexeddb-storage-D-lUW_5P.js.map +0 -1
- package/dist/interactions-8DgxtmgO.cjs.map +0 -1
- package/dist/interactions-CqDNrtIR.js.map +0 -1
- package/dist/journey-5tcxEbnG.cjs +0 -2
- package/dist/journey-5tcxEbnG.cjs.map +0 -1
- package/dist/journey-DgIjhrIc.js.map +0 -1
- package/dist/keys-D5r_GH9q.js.map +0 -1
- package/dist/library-console-CabK2j2-.js +0 -14
- package/dist/library-console-CabK2j2-.js.map +0 -1
- package/dist/library-console-g_VU-wzP.cjs.map +0 -1
- package/dist/library-request-CyC-9IOk.js.map +0 -1
- package/dist/library-request-FQaiWjCP.cjs.map +0 -1
- package/dist/lifecycle-BLC4VU7c.js.map +0 -1
- package/dist/lifecycle-C2z_d8OX.cjs.map +0 -1
- package/dist/log-record-CndanC-p.js.map +0 -1
- package/dist/log-record-DKvo-B-d.cjs.map +0 -1
- package/dist/long-frames-BQef9rXR.js.map +0 -1
- package/dist/long-frames-CV5ZG2cx.cjs +0 -2
- package/dist/long-frames-CV5ZG2cx.cjs.map +0 -1
- package/dist/network-CqnQOqon.cjs.map +0 -1
- package/dist/network-CvkvYzRU.js.map +0 -1
- package/dist/openfin-BwEN0uj4.js +0 -8
- package/dist/openfin-BwEN0uj4.js.map +0 -1
- package/dist/otlp-CYIL7MOE.js.map +0 -1
- package/dist/otlp-RVbkNQRh.cjs +0 -2
- package/dist/otlp-RVbkNQRh.cjs.map +0 -1
- package/dist/patch-CCWfuEY7.js.map +0 -1
- package/dist/platform-KMWkoI-v.cjs.map +0 -1
- package/dist/platform-wcAkkv9F.js.map +0 -1
- package/dist/remote-rules-BL8km4xk.cjs.map +0 -1
- package/dist/remote-rules-CH_7PphT.js.map +0 -1
- package/dist/reports-BOKyY3_A.js.map +0 -1
- package/dist/reports-Bh_-KpZ2.cjs.map +0 -1
- package/dist/resource-timing-BROnEJ0E.js.map +0 -1
- package/dist/resource-timing-CbgwNpog.cjs.map +0 -1
- package/dist/sampling-BLO_pcV4.js.map +0 -1
- package/dist/sampling-ECGVYiDD.cjs.map +0 -1
- package/dist/sanitize-Bsn8HQWC.cjs.map +0 -1
- package/dist/sanitize-DS0G4_ea.js.map +0 -1
- package/dist/select-DWO0-w8_.cjs.map +0 -1
- package/dist/select-wqt9Wxio.js.map +0 -1
- package/dist/sender-BkAVt-Rq.js.map +0 -1
- package/dist/sender-D82PxlCY.cjs +0 -2
- package/dist/sender-D82PxlCY.cjs.map +0 -1
- package/dist/storage-w7Tslvlq.js.map +0 -1
- package/dist/storm-DCEsqViG.cjs.map +0 -1
- package/dist/storm-DD4cUkoL.js.map +0 -1
- package/dist/types-BR9t_w28.js.map +0 -1
- package/dist/unclean-exit-BYZ5yaSI.js.map +0 -1
- package/dist/unclean-exit-CwdpbUDg.cjs.map +0 -1
- package/dist/user-timing-C1kB3JEg.cjs +0 -2
- package/dist/user-timing-C1kB3JEg.cjs.map +0 -1
- package/dist/user-timing-Di2ra5DB.js.map +0 -1
- package/dist/web-socket-B-5qqPy7.js.map +0 -1
- package/dist/web-socket-DwBNhgre.cjs.map +0 -1
- package/dist/web-vitals-Bflr5jSA.js +0 -53
- package/dist/web-vitals-Bflr5jSA.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-0HMf4-kY.js.map +0 -1
- package/dist/worker-protocol-DXekoADQ.cjs.map +0 -1
- package/dist/worker-server-BQK5z2yl.cjs +0 -2
- package/dist/worker-server-BQK5z2yl.cjs.map +0 -1
- package/dist/worker-transport-2220ghFZ.js.map +0 -1
- package/dist/worker-transport-Dj2yCQN5.cjs +0 -2
- package/dist/worker-transport-Dj2yCQN5.cjs.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as r,
|
|
3
|
-
import { r as
|
|
4
|
-
import { n as
|
|
5
|
-
import { a as
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { Qn as e, ot as t, st as n } from "./constants-Bwl_YtQi.js";
|
|
2
|
+
import { n as r, t as i } from "./deadline-C4ccAuk5.js";
|
|
3
|
+
import { r as a } from "./platform-CVewe4wQ.js";
|
|
4
|
+
import { n as o, s, t as c } from "./select-DPv_j6wq.js";
|
|
5
|
+
import { a as l, i as u, n as d, r as f, t as p } from "./sender-15zEsZpr.js";
|
|
6
|
+
import { t as m } from "./unref-DgHPQeWv.js";
|
|
7
|
+
import { i as h, n as g, r as _ } from "./worker-protocol-B0_8rWy5.js";
|
|
8
|
+
// src/transport/worker-client.ts
|
|
8
9
|
var v = class extends Error {
|
|
9
10
|
kind;
|
|
10
11
|
constructor(e) {
|
|
@@ -12,7 +13,7 @@ var v = class extends Error {
|
|
|
12
13
|
}
|
|
13
14
|
};
|
|
14
15
|
function y(t, n) {
|
|
15
|
-
let r,
|
|
16
|
+
let r, i = !1, a = 0, o = (e) => i || e.aborted, s = () => {
|
|
16
17
|
let e = r;
|
|
17
18
|
if (r = void 0, e) {
|
|
18
19
|
n.guard("transport.http_error", "The transport worker could not be closed.", () => {
|
|
@@ -25,16 +26,16 @@ function y(t, n) {
|
|
|
25
26
|
for (let t of e.pending.values()) t.reject(new v("channel"));
|
|
26
27
|
e.pending.clear();
|
|
27
28
|
}
|
|
28
|
-
},
|
|
29
|
+
}, c = (t, r, i) => {
|
|
29
30
|
try {
|
|
30
31
|
t.port.postMessage(h(e.send, {
|
|
31
32
|
id: r,
|
|
32
33
|
job: i
|
|
33
34
|
}));
|
|
34
35
|
} catch (e) {
|
|
35
|
-
n.report("transport.http_error", "The transport worker could not clone its batch.", void 0, e),
|
|
36
|
+
n.report("transport.http_error", "The transport worker could not clone its batch.", void 0, e), s();
|
|
36
37
|
}
|
|
37
|
-
},
|
|
38
|
+
}, l = () => {
|
|
38
39
|
if (r) return r;
|
|
39
40
|
let i;
|
|
40
41
|
try {
|
|
@@ -49,64 +50,63 @@ function y(t, n) {
|
|
|
49
50
|
r = a;
|
|
50
51
|
let o = (t) => {
|
|
51
52
|
let n = t.data;
|
|
52
|
-
if (!g(n))
|
|
53
|
+
if (!g(n)) s();
|
|
53
54
|
else if (n.t === e.ready) {
|
|
54
55
|
if (n.ok !== !0) {
|
|
55
|
-
|
|
56
|
+
s();
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
58
59
|
if (!a.ready) {
|
|
59
60
|
a.ready = !0;
|
|
60
|
-
for (let [e, t] of a.pending)
|
|
61
|
+
for (let [e, t] of a.pending) c(a, e, t.job);
|
|
61
62
|
}
|
|
62
|
-
} else n.t !== e.result || typeof n.id != "number" || !_(n.result) ?
|
|
63
|
-
},
|
|
64
|
-
|
|
63
|
+
} else n.t !== e.result || typeof n.id != "number" || !_(n.result) ? s() : a.pending.get(n.id)?.resolve(n.result);
|
|
64
|
+
}, l = () => {
|
|
65
|
+
s();
|
|
65
66
|
};
|
|
66
|
-
return a.port.addEventListener("message", o), a.port.addEventListener("messageerror",
|
|
67
|
-
a.port.removeEventListener("message", o), a.port.removeEventListener("messageerror",
|
|
67
|
+
return a.port.addEventListener("message", o), a.port.addEventListener("messageerror", l), i.addEventListener("error", l), i.addEventListener("messageerror", l), a.detach = () => {
|
|
68
|
+
a.port.removeEventListener("message", o), a.port.removeEventListener("messageerror", l), a.worker.removeEventListener("error", l), a.worker.removeEventListener("messageerror", l);
|
|
68
69
|
}, a.port.start(), i.postMessage(h(e.connect), [n.port2]), a;
|
|
69
70
|
} catch (e) {
|
|
70
|
-
throw n.report("transport.http_error", "The transport worker could not start.", void 0, e),
|
|
71
|
+
throw n.report("transport.http_error", "The transport worker could not start.", void 0, e), s(), n.guard("transport.http_error", "The transport worker could not stop.", () => i?.terminate()), new v("channel");
|
|
71
72
|
}
|
|
72
73
|
};
|
|
73
74
|
return {
|
|
74
|
-
send: async (t, r,
|
|
75
|
-
if (
|
|
76
|
-
let
|
|
77
|
-
if (
|
|
78
|
-
let
|
|
75
|
+
send: async (t, r, i) => {
|
|
76
|
+
if (o(r)) throw new v("cancelled");
|
|
77
|
+
let u = l();
|
|
78
|
+
if (o(r)) throw s(), new v("cancelled");
|
|
79
|
+
let d = ++a, f;
|
|
79
80
|
try {
|
|
80
|
-
return await new Promise((
|
|
81
|
-
let
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}),
|
|
85
|
-
},
|
|
86
|
-
|
|
81
|
+
return await new Promise((a, o) => {
|
|
82
|
+
let l = (t) => {
|
|
83
|
+
u.pending.delete(d), n.guard("transport.http_error", "The transport worker request could not be cancelled.", () => {
|
|
84
|
+
u.port.postMessage(h(e.cancel, { id: d }));
|
|
85
|
+
}), o(new v(t));
|
|
86
|
+
}, p = () => {
|
|
87
|
+
l("cancelled");
|
|
87
88
|
}, g = setTimeout(() => {
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
clearTimeout(g), r.removeEventListener("abort",
|
|
92
|
-
},
|
|
89
|
+
u.ready ? l("timeout") : s();
|
|
90
|
+
}, i);
|
|
91
|
+
m(g), f = () => {
|
|
92
|
+
clearTimeout(g), r.removeEventListener("abort", p), u.pending.delete(d);
|
|
93
|
+
}, u.pending.set(d, {
|
|
93
94
|
job: t,
|
|
94
|
-
resolve:
|
|
95
|
-
reject:
|
|
96
|
-
}), r.addEventListener("abort",
|
|
95
|
+
resolve: a,
|
|
96
|
+
reject: o
|
|
97
|
+
}), r.addEventListener("abort", p, { once: !0 }), u.ready && c(u, d, t);
|
|
97
98
|
});
|
|
98
99
|
} finally {
|
|
99
|
-
|
|
100
|
+
f();
|
|
100
101
|
}
|
|
101
102
|
},
|
|
102
103
|
close: () => {
|
|
103
|
-
|
|
104
|
+
i = !0, s();
|
|
104
105
|
}
|
|
105
106
|
};
|
|
106
107
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
var b = class extends u {
|
|
108
|
+
// src/transport/worker-transport.ts
|
|
109
|
+
var b = class extends l {
|
|
110
110
|
http;
|
|
111
111
|
loss;
|
|
112
112
|
client;
|
|
@@ -117,27 +117,27 @@ var b = class extends u {
|
|
|
117
117
|
}
|
|
118
118
|
async send(e, t) {
|
|
119
119
|
this.assertContext(e);
|
|
120
|
-
let n =
|
|
120
|
+
let n = c(e, this.config), r = o(n, this.config);
|
|
121
121
|
if (!r) {
|
|
122
122
|
this.diagnostics.count("record.dropped_no_destination");
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
125
|
if (e.records.length === 0) return;
|
|
126
|
-
let
|
|
127
|
-
if (!
|
|
126
|
+
let l = this.workerClient(), u = typeof document < "u" && document.visibilityState === "hidden";
|
|
127
|
+
if (!l || typeof this.config.serializer != "string" || u) {
|
|
128
128
|
await this.http.send(e, t);
|
|
129
129
|
return;
|
|
130
130
|
}
|
|
131
131
|
let d;
|
|
132
132
|
try {
|
|
133
|
-
if (d = await this.attempt(
|
|
133
|
+
if (d = await this.attempt(l, e, n, r, this.config.serializer), this.assertContext(e), "status" in d && (d.status === 401 || d.status === 403) && typeof this.config.headers == "function" && (f(this.http), d = await this.attempt(l, e, n, r, this.config.serializer), this.assertContext(e)), "failure" in d && d.failure === "protocol") throw new v("channel");
|
|
134
134
|
} catch (n) {
|
|
135
|
-
if (this.diagnostics.report("transport.http_error", "The transport worker request failed.", void 0, n), this.assertContext(e), n instanceof
|
|
135
|
+
if (this.diagnostics.report("transport.http_error", "The transport worker request failed.", void 0, n), this.assertContext(e), n instanceof i || n instanceof v && n.kind === "timeout") throw this.diagnostics.report("transport.timeout", "The transport worker request exceeded its time limit."), new s("timeout", "The transport worker request exceeded its time limit.");
|
|
136
136
|
if (n instanceof v && n.kind === "channel") {
|
|
137
|
-
this.client ===
|
|
137
|
+
this.client === l && (this.disabled = !0, l.close()), await this.http.send(e, t);
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
|
-
throw new
|
|
140
|
+
throw new s("transient", "The transport worker request failed.");
|
|
141
141
|
}
|
|
142
142
|
if ("failure" in d) {
|
|
143
143
|
if (d.failure === "serialize") {
|
|
@@ -145,13 +145,13 @@ var b = class extends u {
|
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
147
|
let t = d.failure === "timeout";
|
|
148
|
-
throw this.diagnostics.report(t ? "transport.timeout" : "transport.http_error", "The transport worker did not send its batch."), new
|
|
148
|
+
throw this.diagnostics.report(t ? "transport.timeout" : "transport.http_error", "The transport worker did not send its batch."), new s(t ? "timeout" : a() ? "transient" : "offline", "The transport worker did not send its batch.");
|
|
149
149
|
}
|
|
150
150
|
if (d.compressionFailed && this.diagnostics.report("transport.http_error", "The transport worker sent its batch without gzip after a compression failure."), d.status >= 200 && d.status < 300) this.accept(n, d.sampling, d.date);
|
|
151
151
|
else throw this.reject(d.status, e.id, n, {
|
|
152
152
|
retryAfterMs: d.retryAfterMs,
|
|
153
153
|
maxBytes: d.maxBytes,
|
|
154
|
-
advice:
|
|
154
|
+
advice: p
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
throttledForMs(e) {
|
|
@@ -168,14 +168,14 @@ var b = class extends u {
|
|
|
168
168
|
let e = this.config.transportWorker;
|
|
169
169
|
if (e !== this.source && (this.client?.close(), this.client = void 0, this.source = e, this.disabled = !1), e && !this.disabled) return this.client ??= y(e, this.diagnostics), this.client;
|
|
170
170
|
}
|
|
171
|
-
async attempt(e,
|
|
172
|
-
let l = this.config.delivery.requestTimeoutMs,
|
|
173
|
-
this.assertContext(
|
|
174
|
-
let p =
|
|
175
|
-
if (p <= 0) throw new
|
|
171
|
+
async attempt(e, a, o, s, c) {
|
|
172
|
+
let l = this.config.delivery.requestTimeoutMs, d = Date.now() + l, f = await r(this.untilCancelled(u(this.http, this.config, this.diagnostics)), l);
|
|
173
|
+
this.assertContext(a);
|
|
174
|
+
let p = d - Date.now();
|
|
175
|
+
if (p <= 0) throw new i(l);
|
|
176
176
|
let m = new Headers(f);
|
|
177
|
-
return m.set(n,
|
|
178
|
-
batch:
|
|
177
|
+
return m.set(n, a.id), m.set(t, String(a.attempts)), e.send({
|
|
178
|
+
batch: a,
|
|
179
179
|
kind: o,
|
|
180
180
|
endpoint: s,
|
|
181
181
|
serializer: c,
|
|
@@ -184,18 +184,17 @@ var b = class extends u {
|
|
|
184
184
|
credentials: this.config.credentials,
|
|
185
185
|
priority: this.config.delivery.priority,
|
|
186
186
|
timeoutMs: p,
|
|
187
|
-
deadlineMs:
|
|
187
|
+
deadlineMs: d
|
|
188
188
|
}, this.cancellation.signal, p);
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
191
|
function x(e, t, n, r, i) {
|
|
192
|
-
let a = new
|
|
192
|
+
let a = new d(e, t, n, r, i);
|
|
193
193
|
return {
|
|
194
194
|
transport: new b(e, t, a, n, r, i),
|
|
195
195
|
exitHeaders: () => a.lastHeaders()
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
|
-
//#endregion
|
|
199
198
|
export { x as createWorkerTransport };
|
|
200
199
|
|
|
201
|
-
//# sourceMappingURL=worker-transport-
|
|
200
|
+
//# sourceMappingURL=worker-transport-C3SjJAEC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-transport-C3SjJAEC.js","names":["TRANSPORT_WORKER_TYPE","HEADER_ATTEMPT","HEADER_BATCH_ID","withDeadline","DeadlineError","isOnline","endpointFor","batchKind","StatusTransport","resolveHeaders","HttpTransport","resetHeaders","CREDENTIAL_ADVICE","unrefTimer","workerMessage","isWorkerMessage","isWorkerResult","WorkerFault","kind","createWorkerClient","session","closed","sequence","inactive","signal","fail","old","diagnostics","pending","post","error","connect","worker","factory","channel","current","onMessage","message","event","id","onError","finish","cancel","reject","abort","timer","timeoutMs","job","WorkerTransport","config","onSampling","loss","onClock","http","batch","endpoint","client","hidden","onKeepalive","result","TransportError","timeout","last","deadline","values","remaining","headers","createWorkerTransport","onLoss"],"sources":["../src/transport/worker-client.ts","../src/transport/worker-transport.ts"],"sourcesContent":["import { TRANSPORT_WORKER_TYPE } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { unrefTimer } from \"../utils/unref\";\nimport {\n isWorkerMessage,\n isWorkerResult,\n workerMessage,\n type WorkerJob,\n type WorkerResult,\n} from \"./worker-protocol\";\n\n/** A channel failure permits HTTP fallback. A timeout keeps the retry policy. */\nexport class WorkerFault extends Error {\n constructor(readonly kind: \"channel\" | \"timeout\" | \"cancelled\") {\n super(\"The transport worker did not complete the request.\");\n }\n}\n\n/** One pending request on the private channel. */\ninterface Pending {\n job: WorkerJob;\n resolve: (result: WorkerResult) => void;\n reject: (error: WorkerFault) => void;\n}\n\n/** One connection to one worker. */\ninterface Session {\n worker: Worker;\n port: MessagePort;\n ready: boolean;\n pending: Map<number, Pending>;\n detach: () => void;\n}\n\n/** Private channel operations of the HTTP worker adapter. */\nexport interface WorkerClient {\n send(job: WorkerJob, signal: AbortSignal, timeoutMs: number): Promise<WorkerResult>;\n close(): void;\n}\n\n/** Opens a private message port. The worker factory stays on the main thread. */\nexport function createWorkerClient(factory: () => Worker, diagnostics: Diagnostics): WorkerClient {\n let session: Session | undefined;\n let closed = false;\n let sequence = 0;\n\n const inactive = (signal: AbortSignal): boolean => closed || signal.aborted;\n\n const fail = (): void => {\n const old = session;\n session = undefined;\n if (!old) {\n return;\n }\n diagnostics.guard(\"transport.http_error\", \"The transport worker could not be closed.\", () => {\n old.detach();\n });\n diagnostics.guard(\"transport.http_error\", \"The transport port could not be closed.\", () => {\n old.port.close();\n });\n diagnostics.guard(\n \"transport.http_error\",\n \"The transport worker could not be terminated.\",\n () => {\n old.worker.terminate();\n },\n );\n for (const pending of old.pending.values()) {\n pending.reject(new WorkerFault(\"channel\"));\n }\n old.pending.clear();\n };\n\n const post = (current: Session, id: number, job: WorkerJob): void => {\n try {\n current.port.postMessage(workerMessage(TRANSPORT_WORKER_TYPE.send, { id, job }));\n } catch (error) {\n diagnostics.report(\n \"transport.http_error\",\n \"The transport worker could not clone its batch.\",\n undefined,\n error,\n );\n fail();\n }\n };\n\n const connect = (): Session => {\n if (session) {\n return session;\n }\n let worker: Worker | undefined;\n try {\n worker = factory();\n const channel = new MessageChannel();\n const current: Session = {\n worker,\n port: channel.port1,\n ready: false,\n pending: new Map(),\n detach: () => undefined,\n };\n session = current;\n const onMessage = (event: MessageEvent<unknown>): void => {\n const message = event.data;\n if (!isWorkerMessage(message)) {\n fail();\n return;\n }\n if (message.t === TRANSPORT_WORKER_TYPE.ready) {\n if (message.ok !== true) {\n fail();\n return;\n }\n if (!current.ready) {\n current.ready = true;\n for (const [id, pending] of current.pending) {\n post(current, id, pending.job);\n }\n }\n return;\n }\n if (\n message.t !== TRANSPORT_WORKER_TYPE.result ||\n typeof message.id !== \"number\" ||\n !isWorkerResult(message.result)\n ) {\n fail();\n return;\n }\n\n current.pending.get(message.id)?.resolve(message.result);\n };\n const onError = (): void => {\n fail();\n };\n current.port.addEventListener(\"message\", onMessage);\n current.port.addEventListener(\"messageerror\", onError);\n worker.addEventListener(\"error\", onError);\n worker.addEventListener(\"messageerror\", onError);\n current.detach = () => {\n current.port.removeEventListener(\"message\", onMessage);\n current.port.removeEventListener(\"messageerror\", onError);\n current.worker.removeEventListener(\"error\", onError);\n current.worker.removeEventListener(\"messageerror\", onError);\n };\n current.port.start();\n worker.postMessage(workerMessage(TRANSPORT_WORKER_TYPE.connect), [channel.port2]);\n return current;\n } catch (error) {\n diagnostics.report(\n \"transport.http_error\",\n \"The transport worker could not start.\",\n undefined,\n error,\n );\n fail();\n diagnostics.guard(\"transport.http_error\", \"The transport worker could not stop.\", () =>\n worker?.terminate(),\n );\n throw new WorkerFault(\"channel\");\n }\n };\n\n return {\n send: async (job, signal, timeoutMs) => {\n if (inactive(signal)) {\n throw new WorkerFault(\"cancelled\");\n }\n const current = connect();\n if (inactive(signal)) {\n fail();\n throw new WorkerFault(\"cancelled\");\n }\n const id = ++sequence;\n let finish!: () => void;\n try {\n return await new Promise<WorkerResult>((resolve, reject) => {\n const cancel = (kind: \"timeout\" | \"cancelled\"): void => {\n current.pending.delete(id);\n diagnostics.guard(\n \"transport.http_error\",\n \"The transport worker request could not be cancelled.\",\n () => {\n current.port.postMessage(workerMessage(TRANSPORT_WORKER_TYPE.cancel, { id }));\n },\n );\n reject(new WorkerFault(kind));\n };\n const abort = (): void => {\n cancel(\"cancelled\");\n };\n const timer = setTimeout(() => {\n // A worker that hasn't answered ready hasn't started, so HTTP can't duplicate its\n // unsent job.\n if (current.ready) {\n cancel(\"timeout\");\n } else {\n fail();\n }\n }, timeoutMs);\n unrefTimer(timer);\n finish = () => {\n clearTimeout(timer);\n signal.removeEventListener(\"abort\", abort);\n current.pending.delete(id);\n };\n current.pending.set(id, { job, resolve, reject });\n signal.addEventListener(\"abort\", abort, { once: true });\n if (current.ready) {\n post(current, id, job);\n }\n });\n } finally {\n finish();\n }\n },\n close: () => {\n closed = true;\n fail();\n },\n };\n}\n","import {\n HEADER_ATTEMPT,\n HEADER_BATCH_ID,\n HTTP_FORBIDDEN,\n HTTP_SUCCESS_END,\n HTTP_SUCCESS_MIN,\n HTTP_UNAUTHORIZED,\n} from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport type { LogBatch } from \"../models/batch\";\nimport type { BatchKind, ResolvedConfig } from \"../models/config\";\nimport type { LossReporter } from \"../models/drop\";\nimport { DeadlineError, withDeadline } from \"../utils/deadline\";\nimport { isOnline } from \"../utils/platform\";\nimport { TransportError } from \"./errors\";\nimport { resetHeaders, resolveHeaders } from \"./headers\";\nimport { CREDENTIAL_ADVICE, HttpTransport } from \"./http-transport\";\nimport { batchKind, endpointFor } from \"./serializers/select\";\nimport { StatusTransport } from \"./status-transport\";\nimport { createWorkerClient, WorkerFault, type WorkerClient } from \"./worker-client\";\nimport type { WorkerResult } from \"./worker-protocol\";\n\n/** Main-thread policy around the private worker channel. */\nclass WorkerTransport extends StatusTransport {\n private client: WorkerClient | undefined;\n\n private source: ResolvedConfig[\"transportWorker\"];\n\n private disabled = false;\n\n constructor(\n config: ResolvedConfig,\n diagnostics: Diagnostics,\n private readonly http: HttpTransport,\n onSampling: (raw: unknown) => void,\n private readonly loss: LossReporter,\n onClock: (offsetMs: number) => void,\n ) {\n super(config, diagnostics, onSampling, loss, onClock);\n }\n\n /** Encodes and sends in the worker. Hidden pages keep the main HTTP keepalive path. */\n async send(batch: LogBatch, onKeepalive?: () => void): Promise<void> {\n this.assertContext(batch);\n const kind = batchKind(batch, this.config);\n const endpoint = endpointFor(kind, this.config);\n if (!endpoint) {\n this.diagnostics.count(\"record.dropped_no_destination\");\n return;\n }\n if (batch.records.length === 0) {\n return;\n }\n\n const client = this.workerClient();\n const hidden = typeof document !== \"undefined\" && document.visibilityState === \"hidden\";\n if (!client || typeof this.config.serializer !== \"string\" || hidden) {\n await this.http.send(batch, onKeepalive);\n return;\n }\n\n let result: WorkerResult;\n try {\n result = await this.attempt(client, batch, kind, endpoint, this.config.serializer);\n this.assertContext(batch);\n if (\n \"status\" in result &&\n (result.status === HTTP_UNAUTHORIZED || result.status === HTTP_FORBIDDEN) &&\n typeof this.config.headers === \"function\"\n ) {\n resetHeaders(this.http);\n result = await this.attempt(client, batch, kind, endpoint, this.config.serializer);\n this.assertContext(batch);\n }\n if (\"failure\" in result && result.failure === \"protocol\") {\n throw new WorkerFault(\"channel\");\n }\n } catch (error) {\n this.diagnostics.report(\n \"transport.http_error\",\n \"The transport worker request failed.\",\n undefined,\n error,\n );\n this.assertContext(batch);\n if (\n error instanceof DeadlineError ||\n (error instanceof WorkerFault && error.kind === \"timeout\")\n ) {\n this.diagnostics.report(\n \"transport.timeout\",\n \"The transport worker request exceeded its time limit.\",\n );\n throw new TransportError(\n \"timeout\",\n \"The transport worker request exceeded its time limit.\",\n );\n }\n if (error instanceof WorkerFault && error.kind === \"channel\") {\n if (this.client === client) {\n this.disabled = true;\n client.close();\n }\n await this.http.send(batch, onKeepalive);\n return;\n }\n throw new TransportError(\"transient\", \"The transport worker request failed.\");\n }\n\n if (\"failure\" in result) {\n if (result.failure === \"serialize\") {\n this.diagnostics.report(\n \"transport.serialize_failed\",\n \"The transport worker could not serialize its batch.\",\n { batchId: batch.id },\n );\n this.loss(\"unserializable\", batch.records, [batch.id]);\n return;\n }\n const timeout = result.failure === \"timeout\";\n this.diagnostics.report(\n timeout ? \"transport.timeout\" : \"transport.http_error\",\n \"The transport worker did not send its batch.\",\n );\n // An offline failure must not use up a stored attempt. The HTTP path applies the same rule.\n throw new TransportError(\n timeout ? \"timeout\" : isOnline() ? \"transient\" : \"offline\",\n \"The transport worker did not send its batch.\",\n );\n }\n if (result.compressionFailed) {\n this.diagnostics.report(\n \"transport.http_error\",\n \"The transport worker sent its batch without gzip after a compression failure.\",\n );\n }\n if (result.status >= HTTP_SUCCESS_MIN && result.status < HTTP_SUCCESS_END) {\n this.accept(kind, result.sampling, result.date);\n return;\n }\n throw this.reject(result.status, batch.id, kind, {\n retryAfterMs: result.retryAfterMs,\n maxBytes: result.maxBytes,\n advice: CREDENTIAL_ADVICE,\n });\n }\n\n /** Keeps throttle state from both the worker and the hidden-page HTTP path. */\n override throttledForMs(batch: LogBatch): number {\n return Math.max(super.throttledForMs(batch), this.http.throttledForMs(batch));\n }\n\n /** Returns the last accepted send from either path. */\n override lastSendAt(): number | null {\n const last = Math.max(super.lastSendAt() ?? -Infinity, this.http.lastSendAt() ?? -Infinity);\n return Number.isFinite(last) ? last : null;\n }\n\n /** Stops both paths before a delivery identity change or shutdown. */\n override stop(): void {\n super.stop();\n this.client?.close();\n this.http.stop();\n }\n\n private workerClient(): WorkerClient | undefined {\n const factory = this.config.transportWorker;\n if (factory !== this.source) {\n this.client?.close();\n this.client = undefined;\n this.source = factory;\n this.disabled = false;\n }\n if (!factory || this.disabled) {\n return undefined;\n }\n this.client ??= createWorkerClient(factory, this.diagnostics);\n return this.client;\n }\n\n /** One deadline covers the main headers function and the worker operation. */\n private async attempt(\n client: WorkerClient,\n batch: LogBatch,\n kind: BatchKind,\n endpoint: string,\n serializer: \"otlp\" | \"ecs\",\n ): Promise<WorkerResult> {\n const timeoutMs = this.config.delivery.requestTimeoutMs;\n const deadline = Date.now() + timeoutMs;\n const values = await withDeadline(\n this.untilCancelled(resolveHeaders(this.http, this.config, this.diagnostics)),\n timeoutMs,\n );\n this.assertContext(batch);\n const remaining = deadline - Date.now();\n if (remaining <= 0) {\n throw new DeadlineError(timeoutMs);\n }\n const headers = new Headers(values);\n headers.set(HEADER_BATCH_ID, batch.id);\n headers.set(HEADER_ATTEMPT, String(batch.attempts));\n return client.send(\n {\n batch,\n kind,\n endpoint,\n serializer,\n headers: Object.fromEntries(headers),\n compression: this.config.compression,\n credentials: this.config.credentials,\n priority: this.config.delivery.priority,\n timeoutMs: remaining,\n deadlineMs: deadline,\n },\n this.cancellation.signal,\n remaining,\n );\n }\n}\n\n/** Creates the worker adapter without adding a package entry point or a runtime dependency. */\nexport function createWorkerTransport(\n config: ResolvedConfig,\n diagnostics: Diagnostics,\n onSampling: (raw: unknown) => void,\n onLoss: LossReporter,\n onClock: (offsetMs: number) => void,\n): { transport: StatusTransport; exitHeaders: () => Record<string, string> | undefined } {\n const http = new HttpTransport(config, diagnostics, onSampling, onLoss, onClock);\n return {\n transport: new WorkerTransport(config, diagnostics, http, onSampling, onLoss, onClock),\n exitHeaders: () => http.lastHeaders(),\n };\n}\n"],"mappings":";;;;;;;;AAYA,IAAaiB,IAAb,cAAiC,MAAM;CAChB;CAArB,YAAY,GAAoD;EAA3C,AACnB,MAAM,oDAAoD,GADvC,KAAA,OAAAC;CAErB;AACF;AAyBA,SAAgBC,EAAmB,GAAuB,GAAwC;CAChG,IAAIC,GACAC,IAAS,IACTC,IAAW,GAETC,KAAY,MAAiCF,KAAUG,EAAO,SAE9DC,UAAmB;EACvB,IAAMC,IAAMN;EAEZ,IADA,IAAU,KAAA,GACLM,GAGL;GAMA,AANAC,EAAY,MAAM,wBAAwB,mDAAmD;IAC3F,EAAI,OAAO;GACb,CAAC,GACDA,EAAY,MAAM,wBAAwB,iDAAiD;IACzF,EAAI,KAAK,MAAM;GACjB,CAAC,GACDA,EAAY,MACV,wBACA,uDACM;IACJ,EAAI,OAAO,UAAU;GACvB,CACF;GACA,KAAK,IAAMC,KAAWF,EAAI,QA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CAAO;GACnC,aAAa,KAAK,OAAO;GACzB,aAAa,KAAK,OAAO;GACzB,UAAU,KAAK,OAAO,SAAS;GAC/B,WAAWD;GACX,YAAYF;EACd,GACA,KAAK,aAAa,QAClBE,CACF;CACF;AACF;AAGA,SAAgBE,EACd,GACA,GACA,GACA,GACA,GACuF;CACvF,IAAMd,IAAO,IAAI3C,EAAcuC,GAAQtB,GAAauB,GAAYkB,GAAQhB,CAAO;CAC/E,OAAO;EACL,WAAW,IAAIJ,EAAgBC,GAAQtB,GAAa0B,GAAMH,GAAYkB,GAAQhB,CAAO;EACrF,mBAAmBC,EAAK,YAAY;CACtC;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utk09/ui-observability",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "UI observability and logging for browser, OpenFin and webview applications",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"type": "module",
|
|
30
30
|
"sideEffects": false,
|
|
31
31
|
"engines": {
|
|
32
|
-
"node": ">=
|
|
32
|
+
"node": ">=22.22.3"
|
|
33
33
|
},
|
|
34
34
|
"bin": {
|
|
35
35
|
"uiobs": "bin/uiobs.mjs"
|
|
@@ -50,23 +50,15 @@
|
|
|
50
50
|
},
|
|
51
51
|
"./package.json": "./package.json"
|
|
52
52
|
},
|
|
53
|
-
"workspaces": [
|
|
54
|
-
"playground/react",
|
|
55
|
-
"playground/angular",
|
|
56
|
-
"playground/microfrontend/host",
|
|
57
|
-
"playground/microfrontend/remote-blotter",
|
|
58
|
-
"playground/microfrontend/remote-ticket",
|
|
59
|
-
"playground/console-only"
|
|
60
|
-
],
|
|
61
53
|
"scripts": {
|
|
62
|
-
"dev": "concurrently -k \"
|
|
63
|
-
"dev:vanilla": "
|
|
54
|
+
"dev": "concurrently -k \"pnpm run dev:vanilla\" \"pnpm run dev:ingest\" \"pnpm run dev:cross-origin\"",
|
|
55
|
+
"dev:vanilla": "pnpm --filter @example/vanilla run dev",
|
|
64
56
|
"dev:ingest": "node tools/mock-ingest-server.mjs",
|
|
65
57
|
"dev:cross-origin": "vite --config vite.cross-origin.config.ts",
|
|
66
|
-
"example:react": "
|
|
67
|
-
"example:angular": "
|
|
68
|
-
"example:microfrontend": "concurrently -k \"
|
|
69
|
-
"example:console-only": "
|
|
58
|
+
"example:react": "pnpm --filter @example/react run dev",
|
|
59
|
+
"example:angular": "pnpm --filter @example/angular run dev",
|
|
60
|
+
"example:microfrontend": "concurrently -k \"pnpm --filter @example/mf-blotter run dev\" \"pnpm --filter @example/mf-ticket run dev\" \"pnpm --filter @example/mf-host run dev\"",
|
|
61
|
+
"example:console-only": "pnpm --filter @example/console-only run dev",
|
|
70
62
|
"build": "rimraf dist && tsc --project tsconfig.build.json && vite build",
|
|
71
63
|
"build:watch": "vite build --watch",
|
|
72
64
|
"lint": "eslint .",
|
|
@@ -80,44 +72,44 @@
|
|
|
80
72
|
"check:peers": "node tools/check-peer-imports.mjs",
|
|
81
73
|
"check:size": "node tools/check-size.mjs",
|
|
82
74
|
"check:dev": "node tools/check-dev-server.mjs",
|
|
83
|
-
"
|
|
84
|
-
"
|
|
75
|
+
"prepare": "pnpm run build",
|
|
76
|
+
"fix": "pnpm run lint:fix && pnpm run format",
|
|
77
|
+
"verify": "pnpm run format:check && pnpm run typecheck && pnpm run build && pnpm run lint && pnpm run check:peers && pnpm run check:size && pnpm run check:dev && pnpm run test:coverage",
|
|
78
|
+
"prepublishOnly": "pnpm run verify"
|
|
85
79
|
},
|
|
86
80
|
"peerDependencies": {
|
|
87
81
|
"@opentelemetry/api": "^1",
|
|
82
|
+
"@rrweb/record": "^2",
|
|
88
83
|
"web-vitals": "^4 || ^5 || ^6"
|
|
89
84
|
},
|
|
90
85
|
"peerDependenciesMeta": {
|
|
91
86
|
"@opentelemetry/api": {
|
|
92
87
|
"optional": true
|
|
93
88
|
},
|
|
89
|
+
"@rrweb/record": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
94
92
|
"web-vitals": {
|
|
95
93
|
"optional": true
|
|
96
94
|
}
|
|
97
95
|
},
|
|
98
96
|
"devDependencies": {
|
|
99
|
-
"@eslint/js": "
|
|
100
|
-
"@opentelemetry/api": "
|
|
101
|
-
"@types/node": "
|
|
102
|
-
"@vitest/coverage-istanbul": "
|
|
103
|
-
"concurrently": "
|
|
104
|
-
"eslint": "
|
|
105
|
-
"eslint-config-prettier": "
|
|
106
|
-
"fake-indexeddb": "
|
|
107
|
-
"happy-dom": "
|
|
108
|
-
"prettier": "
|
|
109
|
-
"rimraf": "
|
|
110
|
-
"typescript": "
|
|
111
|
-
"typescript-eslint": "
|
|
112
|
-
"vite": "
|
|
113
|
-
"vitest": "
|
|
114
|
-
"web-vitals": "
|
|
97
|
+
"@eslint/js": "catalog:library",
|
|
98
|
+
"@opentelemetry/api": "catalog:library",
|
|
99
|
+
"@types/node": "catalog:library",
|
|
100
|
+
"@vitest/coverage-istanbul": "catalog:library",
|
|
101
|
+
"concurrently": "catalog:library",
|
|
102
|
+
"eslint": "catalog:library",
|
|
103
|
+
"eslint-config-prettier": "catalog:library",
|
|
104
|
+
"fake-indexeddb": "catalog:library",
|
|
105
|
+
"happy-dom": "catalog:library",
|
|
106
|
+
"prettier": "catalog:library",
|
|
107
|
+
"rimraf": "catalog:library",
|
|
108
|
+
"typescript": "catalog:library",
|
|
109
|
+
"typescript-eslint": "catalog:library",
|
|
110
|
+
"vite": "catalog:library",
|
|
111
|
+
"vitest": "catalog:library",
|
|
112
|
+
"web-vitals": "catalog:library"
|
|
115
113
|
},
|
|
116
|
-
"
|
|
117
|
-
"@parcel/watcher@2.6.0": true,
|
|
118
|
-
"esbuild@0.28.1": true,
|
|
119
|
-
"lmdb@3.5.1": true,
|
|
120
|
-
"msgpackr-extract@3.0.4": true,
|
|
121
|
-
"fsevents@2.3.3": true
|
|
122
|
-
}
|
|
114
|
+
"packageManager": "pnpm@12.21.0"
|
|
123
115
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batch-BHXypM1j.cjs","names":["newId","ATTR_LOG_TYPE","LOG_TYPE_ACTION","require_constants","require_identity","isLogBatch","value","id","createdAt","attempts","records","splitBatch","batch","middle","halve","diagnostics","attributeOf","record","attributes","key","isActionRecord","countRecords","batches","total"],"sources":["../src/models/batch.ts"],"sourcesContent":["// src/models/batch.ts\n//\n// A batch of log records for delivery to the ingest endpoint.\n\nimport { ATTR_LOG_TYPE, LOG_TYPE_ACTION } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { newId } from \"../utils/identity\";\nimport type { LogRecord } from \"./log-record\";\n\n/**\n * A batch of records with a stable id used for server-side deduplication across retries.\n * @see {@link splitBatch}\n */\nexport interface LogBatch {\n /** Application namespace that owns this stored batch. */\n readonly persistenceNamespace?: string;\n /** Delivery context id. It does not change. With isolation, a batch without this id stays stored. */\n readonly routingContextId?: string;\n /** Deduplication key. It stays the same across retries and reloads. */\n id: string;\n /** Records to deliver, in log order. */\n records: LogRecord[];\n /** Batch creation time, in epoch milliseconds. */\n createdAt: number;\n /** Delivery attempts so far. */\n attempts: number;\n}\n\n/**\n * Tells if a value from storage has all fields of a batch. `keyOf` cannot match\n * an entry without `id` after delivery. The library then retries that entry with no\n * end, and the entry blocks each batch behind it. An entry without `attempts` counts\n * as NaN. That count never reaches `maxAttempts`. Thus the library never drops the\n * entry as a dead letter.\n * @param value Parsed storage entry.\n * @returns True when each required field is present and has the correct type.\n */\nexport function isLogBatch(value: unknown): value is LogBatch {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const id: unknown = Reflect.get(value, \"id\");\n const createdAt: unknown = Reflect.get(value, \"createdAt\");\n const attempts: unknown = Reflect.get(value, \"attempts\");\n const records: unknown = Reflect.get(value, \"records\");\n\n return (\n typeof id === \"string\" &&\n typeof createdAt === \"number\" &&\n typeof attempts === \"number\" &&\n Array.isArray(records)\n );\n}\n\n/**\n * Splits a batch that the server rejected as too large into two halves.\n * Each half gets a new id. Each half keeps the age and attempts of the original batch.\n * @param batch The rejected batch.\n * @param diagnostics Diagnostics reporter for the new batch ids.\n * @returns Two batches, or `null` if a single record is already over the limit.\n */\nexport function splitBatch(batch: LogBatch, diagnostics: Diagnostics): [LogBatch, LogBatch] | null {\n if (batch.records.length < 2) {\n return null;\n }\n\n const middle = Math.floor(batch.records.length / 2);\n const halve = (records: LogRecord[]): LogBatch => ({\n id: newId(diagnostics),\n records,\n createdAt: batch.createdAt,\n attempts: batch.attempts,\n routingContextId: batch.routingContextId,\n persistenceNamespace: batch.persistenceNamespace,\n });\n\n return [halve(batch.records.slice(0, middle)), halve(batch.records.slice(middle))];\n}\n\n/**\n * Reads one attribute of a record. A record from storage can be corrupt. It can be null or have\n * no attributes.\n * @param record Record to read.\n * @param key Attribute key.\n * @returns The attribute value, or undefined for a corrupt record.\n */\nexport function attributeOf(record: LogRecord, key: string): unknown {\n const value: unknown = record;\n if (typeof value !== \"object\" || value === null) {\n return undefined;\n }\n\n const attributes: unknown = Reflect.get(value, \"attributes\");\n if (typeof attributes !== \"object\" || attributes === null) {\n return undefined;\n }\n\n return Reflect.get(attributes, key);\n}\n\n/**\n * Tests if a record is an action. A corrupt record from storage is not an action.\n * @param record Record to test.\n * @returns True for an action record.\n */\nexport function isActionRecord(record: LogRecord): boolean {\n return attributeOf(record, ATTR_LOG_TYPE) === LOG_TYPE_ACTION;\n}\n\n/**\n * Returns the total record count of the batches.\n * @param batches Batches to measure.\n * @returns Total record count.\n */\nexport function countRecords(batches: readonly LogBatch[]): number {\n return batches.reduce((total, batch) => total + batch.records.length, 0);\n}\n"],"mappings":"iFAqCA,SAAgBK,EAAW,EAAmC,CAC5D,GAAI,OAAOC,GAAU,WAAYA,EAC/B,MAAO,GAGT,IAAMC,EAAc,QAAQ,IAAID,EAAO,IAAI,EACrCE,EAAqB,QAAQ,IAAIF,EAAO,WAAW,EACnDG,EAAoB,QAAQ,IAAIH,EAAO,UAAU,EACjDI,EAAmB,QAAQ,IAAIJ,EAAO,SAAS,EAErD,OACE,OAAOC,GAAO,UACd,OAAOC,GAAc,UACrB,OAAOC,GAAa,UACpB,MAAM,QAAQC,CAAO,CAEzB,CASA,SAAgBC,EAAW,EAAiB,EAAuD,CACjG,GAAIC,EAAM,QAAQ,OAAS,EACzB,OAAO,KAGT,IAAMC,EAAS,KAAK,MAAMD,EAAM,QAAQ,OAAS,CAAC,EAC5CE,EAAS,IAAoC,CACjD,GAAId,EAAAA,EAAMe,CAAW,EACrB,UACA,UAAWH,EAAM,UACjB,SAAUA,EAAM,SAChB,iBAAkBA,EAAM,iBACxB,qBAAsBA,EAAM,oBAC9B,GAEA,MAAO,CAACE,EAAMF,EAAM,QAAQ,MAAM,EAAGC,CAAM,CAAC,EAAGC,EAAMF,EAAM,QAAQ,MAAMC,CAAM,CAAC,CAAC,CACnF,CASA,SAAgBG,EAAY,EAAmB,EAAsB,CACnE,IAAMV,EAAiBW,EACvB,GAAI,OAAOX,GAAU,WAAYA,EAC/B,OAGF,IAAMY,EAAsB,QAAQ,IAAIZ,EAAO,YAAY,EAC3D,GAAI,OAAOY,GAAe,UAAYA,EAItC,OAAO,QAAQ,IAAIA,EAAYC,CAAG,CACpC,CAOA,SAAgBC,EAAe,EAA4B,CACzD,OAAOJ,EAAYC,EAAQhB,EAAAA,CAAa,IAAMC,EAAAA,EAChD,CAOA,SAAgBmB,EAAa,EAAsC,CACjE,OAAOC,EAAQ,QAAQ,EAAO,IAAUC,EAAQX,EAAM,QAAQ,OAAQ,CAAC,CACzE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batch-BMdT9mKm.js","names":["LOG_TYPE_ACTION","ATTR_LOG_TYPE","newId","isLogBatch","value","id","createdAt","attempts","records","splitBatch","batch","middle","halve","diagnostics","attributeOf","record","attributes","key","isActionRecord","countRecords","batches","total"],"sources":["../src/models/batch.ts"],"sourcesContent":["// src/models/batch.ts\n//\n// A batch of log records for delivery to the ingest endpoint.\n\nimport { ATTR_LOG_TYPE, LOG_TYPE_ACTION } from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\nimport { newId } from \"../utils/identity\";\nimport type { LogRecord } from \"./log-record\";\n\n/**\n * A batch of records with a stable id used for server-side deduplication across retries.\n * @see {@link splitBatch}\n */\nexport interface LogBatch {\n /** Application namespace that owns this stored batch. */\n readonly persistenceNamespace?: string;\n /** Delivery context id. It does not change. With isolation, a batch without this id stays stored. */\n readonly routingContextId?: string;\n /** Deduplication key. It stays the same across retries and reloads. */\n id: string;\n /** Records to deliver, in log order. */\n records: LogRecord[];\n /** Batch creation time, in epoch milliseconds. */\n createdAt: number;\n /** Delivery attempts so far. */\n attempts: number;\n}\n\n/**\n * Tells if a value from storage has all fields of a batch. `keyOf` cannot match\n * an entry without `id` after delivery. The library then retries that entry with no\n * end, and the entry blocks each batch behind it. An entry without `attempts` counts\n * as NaN. That count never reaches `maxAttempts`. Thus the library never drops the\n * entry as a dead letter.\n * @param value Parsed storage entry.\n * @returns True when each required field is present and has the correct type.\n */\nexport function isLogBatch(value: unknown): value is LogBatch {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const id: unknown = Reflect.get(value, \"id\");\n const createdAt: unknown = Reflect.get(value, \"createdAt\");\n const attempts: unknown = Reflect.get(value, \"attempts\");\n const records: unknown = Reflect.get(value, \"records\");\n\n return (\n typeof id === \"string\" &&\n typeof createdAt === \"number\" &&\n typeof attempts === \"number\" &&\n Array.isArray(records)\n );\n}\n\n/**\n * Splits a batch that the server rejected as too large into two halves.\n * Each half gets a new id. Each half keeps the age and attempts of the original batch.\n * @param batch The rejected batch.\n * @param diagnostics Diagnostics reporter for the new batch ids.\n * @returns Two batches, or `null` if a single record is already over the limit.\n */\nexport function splitBatch(batch: LogBatch, diagnostics: Diagnostics): [LogBatch, LogBatch] | null {\n if (batch.records.length < 2) {\n return null;\n }\n\n const middle = Math.floor(batch.records.length / 2);\n const halve = (records: LogRecord[]): LogBatch => ({\n id: newId(diagnostics),\n records,\n createdAt: batch.createdAt,\n attempts: batch.attempts,\n routingContextId: batch.routingContextId,\n persistenceNamespace: batch.persistenceNamespace,\n });\n\n return [halve(batch.records.slice(0, middle)), halve(batch.records.slice(middle))];\n}\n\n/**\n * Reads one attribute of a record. A record from storage can be corrupt. It can be null or have\n * no attributes.\n * @param record Record to read.\n * @param key Attribute key.\n * @returns The attribute value, or undefined for a corrupt record.\n */\nexport function attributeOf(record: LogRecord, key: string): unknown {\n const value: unknown = record;\n if (typeof value !== \"object\" || value === null) {\n return undefined;\n }\n\n const attributes: unknown = Reflect.get(value, \"attributes\");\n if (typeof attributes !== \"object\" || attributes === null) {\n return undefined;\n }\n\n return Reflect.get(attributes, key);\n}\n\n/**\n * Tests if a record is an action. A corrupt record from storage is not an action.\n * @param record Record to test.\n * @returns True for an action record.\n */\nexport function isActionRecord(record: LogRecord): boolean {\n return attributeOf(record, ATTR_LOG_TYPE) === LOG_TYPE_ACTION;\n}\n\n/**\n * Returns the total record count of the batches.\n * @param batches Batches to measure.\n * @returns Total record count.\n */\nexport function countRecords(batches: readonly LogBatch[]): number {\n return batches.reduce((total, batch) => total + batch.records.length, 0);\n}\n"],"mappings":";;;AAqCA,SAAgBG,EAAW,GAAmC;CAC5D,IAAI,OAAOC,KAAU,aAAYA,GAC/B,OAAO;CAGT,IAAMC,IAAc,QAAQ,IAAID,GAAO,IAAI,GACrCE,IAAqB,QAAQ,IAAIF,GAAO,WAAW,GACnDG,IAAoB,QAAQ,IAAIH,GAAO,UAAU,GACjDI,IAAmB,QAAQ,IAAIJ,GAAO,SAAS;CAErD,OACE,OAAOC,KAAO,YACd,OAAOC,KAAc,YACrB,OAAOC,KAAa,YACpB,MAAM,QAAQC,CAAO;AAEzB;AASA,SAAgBC,EAAW,GAAiB,GAAuD;CACjG,IAAIC,EAAM,QAAQ,SAAS,GACzB,OAAO;CAGT,IAAMC,IAAS,KAAK,MAAMD,EAAM,QAAQ,SAAS,CAAC,GAC5CE,KAAS,OAAoC;EACjD,IAAIV,EAAMW,CAAW;EACrB;EACA,WAAWH,EAAM;EACjB,UAAUA,EAAM;EAChB,kBAAkBA,EAAM;EACxB,sBAAsBA,EAAM;CAC9B;CAEA,OAAO,CAACE,EAAMF,EAAM,QAAQ,MAAM,GAAGC,CAAM,CAAC,GAAGC,EAAMF,EAAM,QAAQ,MAAMC,CAAM,CAAC,CAAC;AACnF;AASA,SAAgBG,EAAY,GAAmB,GAAsB;CACnE,IAAMV,IAAiBW;CACvB,IAAI,OAAOX,KAAU,aAAYA,GAC/B;CAGF,IAAMY,IAAsB,QAAQ,IAAIZ,GAAO,YAAY;CAC3D,IAAI,OAAOY,KAAe,YAAYA,GAItC,OAAO,QAAQ,IAAIA,GAAYC,CAAG;AACpC;AAOA,SAAgBC,EAAe,GAA4B;CACzD,OAAOJ,EAAYC,GAAQd,CAAa,MAAMD;AAChD;AAOA,SAAgBmB,EAAa,GAAsC;CACjE,OAAOC,EAAQ,QAAQ,GAAO,MAAUC,IAAQX,EAAM,QAAQ,QAAQ,CAAC;AACzE"}
|