@utk09/ui-observability 0.9.2 → 0.9.4
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 +51 -0
- package/README.md +108 -33
- package/dist/batch-C4oF6XZT.cjs +2 -0
- package/dist/batch-C4oF6XZT.cjs.map +1 -0
- package/dist/{batch-4xKzzSCj.js → batch-D-4xl7op.js} +8 -5
- package/dist/batch-D-4xl7op.js.map +1 -0
- package/dist/bus/bus.d.ts +0 -4
- package/dist/{bus-DrixwdiX.js → bus-Cyvq-Ngx.js} +59 -62
- package/dist/bus-Cyvq-Ngx.js.map +1 -0
- package/dist/bus-rOhVuRee.cjs +2 -0
- package/dist/bus-rOhVuRee.cjs.map +1 -0
- package/dist/capture/network.d.ts +1 -0
- package/dist/capture/storm.d.ts +2 -7
- package/dist/capture/types.d.ts +3 -0
- package/dist/capture/web-socket.d.ts +40 -0
- package/dist/{console-B3vGRW5p.js → console-BT7mcgU6.js} +3 -3
- package/dist/{console-B3vGRW5p.js.map → console-BT7mcgU6.js.map} +1 -1
- package/dist/{console-ChfuJlf9.cjs → console-Boqa7new.cjs} +2 -2
- package/dist/{console-ChfuJlf9.cjs.map → console-Boqa7new.cjs.map} +1 -1
- package/dist/constants-BgRS6MB0.cjs +2 -0
- package/dist/constants-BgRS6MB0.cjs.map +1 -0
- package/dist/constants-L_d5YvvQ.js +160 -0
- package/dist/constants-L_d5YvvQ.js.map +1 -0
- package/dist/constants.d.ts +36 -5
- package/dist/core/breadcrumbs.d.ts +4 -4
- package/dist/core/context.d.ts +0 -8
- package/dist/core/diagnostics.d.ts +1 -3
- package/dist/core/journey.d.ts +7 -0
- package/dist/core/meter.d.ts +19 -1
- package/dist/core/pipeline.d.ts +12 -4
- package/dist/core/record.d.ts +40 -8
- package/dist/core/remote-sampling.d.ts +7 -3
- package/dist/core/runtime.d.ts +62 -3
- package/dist/core/sampling.d.ts +33 -4
- package/dist/core/sender.d.ts +8 -0
- package/dist/core/spans.d.ts +34 -0
- package/dist/{errors-BGs5NOrw.js → errors-BDI96zKc.js} +6 -6
- package/dist/errors-BDI96zKc.js.map +1 -0
- package/dist/errors-_xEsCVXn.cjs +3 -0
- package/dist/errors-_xEsCVXn.cjs.map +1 -0
- package/dist/fixed-window-BR0bu32Y.cjs +2 -0
- package/dist/fixed-window-BR0bu32Y.cjs.map +1 -0
- package/dist/fixed-window-Re7jIRJH.js +9 -0
- package/dist/fixed-window-Re7jIRJH.js.map +1 -0
- package/dist/identity-Bwku7zzN.cjs +2 -0
- package/dist/identity-Bwku7zzN.cjs.map +1 -0
- package/dist/{identity-rpEyjvVg.js → identity-Dtv917nz.js} +33 -23
- package/dist/identity-Dtv917nz.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +804 -537
- package/dist/index.js.map +1 -1
- package/dist/indexeddb-storage-Cvavrf-y.cjs +2 -0
- package/dist/indexeddb-storage-Cvavrf-y.cjs.map +1 -0
- package/dist/{indexeddb-storage-Q9fDYlyn.js → indexeddb-storage-HgkQUTyS.js} +57 -68
- package/dist/indexeddb-storage-HgkQUTyS.js.map +1 -0
- package/dist/{interactions-BAGRmtrv.cjs → interactions-Bhe1ft8P.cjs} +2 -2
- package/dist/interactions-Bhe1ft8P.cjs.map +1 -0
- package/dist/{interactions-B8zjCjga.js → interactions-Ck01cEij.js} +3 -3
- package/dist/interactions-Ck01cEij.js.map +1 -0
- package/dist/journey-Co9OlzrW.cjs +2 -0
- package/dist/journey-Co9OlzrW.cjs.map +1 -0
- package/dist/{journey-_dQQ1eMP.js → journey-DRK0A8u_.js} +37 -33
- package/dist/journey-DRK0A8u_.js.map +1 -0
- package/dist/{library-request-DX6ev9oG.js → library-request-ChCar5F8.js} +3 -3
- package/dist/{library-request-DX6ev9oG.js.map → library-request-ChCar5F8.js.map} +1 -1
- package/dist/{library-request-BIG3Xpx3.cjs → library-request-gMFOCNcn.cjs} +2 -2
- package/dist/{library-request-BIG3Xpx3.cjs.map → library-request-gMFOCNcn.cjs.map} +1 -1
- package/dist/log-record-cwFiLyPY.js +17 -0
- package/dist/log-record-cwFiLyPY.js.map +1 -0
- package/dist/log-record-jX9eWUP8.cjs +2 -0
- package/dist/log-record-jX9eWUP8.cjs.map +1 -0
- package/dist/{long-frames-Cq2LgNnp.cjs → long-frames-Bky6nZDF.cjs} +2 -2
- package/dist/long-frames-Bky6nZDF.cjs.map +1 -0
- package/dist/{long-frames-B0tKuChx.js → long-frames-DDumopji.js} +4 -4
- package/dist/long-frames-DDumopji.js.map +1 -0
- package/dist/models/batch.d.ts +6 -0
- package/dist/models/config.d.ts +56 -5
- package/dist/models/log-record.d.ts +1 -1
- package/dist/models/plugin.d.ts +47 -0
- package/dist/models/stats.d.ts +11 -0
- package/dist/{network-CMnEvGJB.js → network-BsBZ6_-Q.js} +43 -29
- package/dist/network-BsBZ6_-Q.js.map +1 -0
- package/dist/network-_4csBGBM.cjs +2 -0
- package/dist/network-_4csBGBM.cjs.map +1 -0
- package/dist/openfin-BwEN0uj4.js +8 -0
- package/dist/openfin-BwEN0uj4.js.map +1 -0
- package/dist/openfin-DtH2f7zX.cjs +2 -0
- package/dist/openfin-DtH2f7zX.cjs.map +1 -0
- package/dist/platform-4yYjMD-B.js +57 -0
- package/dist/platform-4yYjMD-B.js.map +1 -0
- package/dist/platform-o7r1ocOu.cjs +2 -0
- package/dist/platform-o7r1ocOu.cjs.map +1 -0
- package/dist/remote-rules-1KqfVBIu.js +91 -0
- package/dist/remote-rules-1KqfVBIu.js.map +1 -0
- package/dist/remote-rules-BHgEGlYi.cjs +2 -0
- package/dist/remote-rules-BHgEGlYi.cjs.map +1 -0
- package/dist/sampling-C4my-ma0.cjs +2 -0
- package/dist/sampling-C4my-ma0.cjs.map +1 -0
- package/dist/sampling-nYIWP_vP.js +86 -0
- package/dist/sampling-nYIWP_vP.js.map +1 -0
- package/dist/{sanitize-BNwgPj_B.js → sanitize-BiUKCUG6.js} +2 -2
- package/dist/{sanitize-BNwgPj_B.js.map → sanitize-BiUKCUG6.js.map} +1 -1
- package/dist/{sanitize-BqzPc4Jg.cjs → sanitize-BxuPSXOk.cjs} +2 -2
- package/dist/{sanitize-BqzPc4Jg.cjs.map → sanitize-BxuPSXOk.cjs.map} +1 -1
- package/dist/sender-6vrT9fFL.cjs +3 -0
- package/dist/sender-6vrT9fFL.cjs.map +1 -0
- package/dist/{sender--0_VzPbN.js → sender-DFQMF39P.js} +380 -278
- package/dist/sender-DFQMF39P.js.map +1 -0
- package/dist/storage/gap.d.ts +20 -0
- package/dist/storage/indexeddb-storage.d.ts +1 -7
- package/dist/storage/keys.d.ts +9 -0
- package/dist/storage/local-storage.d.ts +0 -6
- package/dist/storage/memory-storage.d.ts +1 -1
- package/dist/storm-6YYbXzT_.cjs +2 -0
- package/dist/storm-6YYbXzT_.cjs.map +1 -0
- package/dist/storm-CfO0Sam2.js +10 -0
- package/dist/storm-CfO0Sam2.js.map +1 -0
- package/dist/transport/exit-flush.d.ts +6 -0
- package/dist/transport/http-transport.d.ts +2 -1
- package/dist/transport/serializers/otlp-traces.d.ts +3 -0
- package/dist/transport/serializers/select.d.ts +8 -5
- package/dist/transport/status-transport.d.ts +7 -0
- package/dist/types-BR9t_w28.js +8 -0
- package/dist/types-BR9t_w28.js.map +1 -0
- package/dist/types-C7WNpnG1.cjs +2 -0
- package/dist/types-C7WNpnG1.cjs.map +1 -0
- package/dist/utils/fixed-window.d.ts +15 -0
- package/dist/utils/guards.d.ts +6 -0
- package/dist/utils/identity.d.ts +11 -0
- package/dist/utils/openfin.d.ts +48 -0
- package/dist/utils/platform.d.ts +13 -0
- package/dist/utils/tracing.d.ts +82 -4
- package/dist/web-socket-Ar4cZxmd.js +102 -0
- package/dist/web-socket-Ar4cZxmd.js.map +1 -0
- package/dist/web-socket-BwJdwSHl.cjs +2 -0
- package/dist/web-socket-BwJdwSHl.cjs.map +1 -0
- package/package.json +2 -3
- package/dist/batch-4xKzzSCj.js.map +0 -1
- package/dist/batch-cys7e53Q.cjs +0 -2
- package/dist/batch-cys7e53Q.cjs.map +0 -1
- package/dist/bus-B6vzPmQM.cjs +0 -2
- package/dist/bus-B6vzPmQM.cjs.map +0 -1
- package/dist/bus-DrixwdiX.js.map +0 -1
- package/dist/constants-Be83LICb.cjs +0 -2
- package/dist/constants-Be83LICb.cjs.map +0 -1
- package/dist/constants-CQ_D7jIW.js +0 -144
- package/dist/constants-CQ_D7jIW.js.map +0 -1
- package/dist/deadline-5_PecIl5.js +0 -26
- 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/errors-BGs5NOrw.js.map +0 -1
- package/dist/errors-BMJm7KZZ.cjs +0 -3
- package/dist/errors-BMJm7KZZ.cjs.map +0 -1
- package/dist/identity-DXyV86o-.cjs +0 -2
- package/dist/identity-DXyV86o-.cjs.map +0 -1
- package/dist/identity-rpEyjvVg.js.map +0 -1
- package/dist/indexeddb-storage-BXaPVPyG.cjs +0 -2
- package/dist/indexeddb-storage-BXaPVPyG.cjs.map +0 -1
- package/dist/indexeddb-storage-Q9fDYlyn.js.map +0 -1
- package/dist/interactions-B8zjCjga.js.map +0 -1
- package/dist/interactions-BAGRmtrv.cjs.map +0 -1
- package/dist/journey-BGSyy8Es.cjs +0 -2
- package/dist/journey-BGSyy8Es.cjs.map +0 -1
- package/dist/journey-_dQQ1eMP.js.map +0 -1
- package/dist/long-frames-B0tKuChx.js.map +0 -1
- package/dist/long-frames-Cq2LgNnp.cjs.map +0 -1
- package/dist/network-C6kJbW6K.cjs +0 -2
- package/dist/network-C6kJbW6K.cjs.map +0 -1
- package/dist/network-CMnEvGJB.js.map +0 -1
- package/dist/platform-DNOJjpOm.cjs +0 -2
- package/dist/platform-DNOJjpOm.cjs.map +0 -1
- package/dist/platform-j0uMPwHi.js +0 -48
- package/dist/platform-j0uMPwHi.js.map +0 -1
- package/dist/remote-rules-DgoBJxZL.cjs +0 -2
- package/dist/remote-rules-DgoBJxZL.cjs.map +0 -1
- package/dist/remote-rules-UggoZqfP.js +0 -86
- package/dist/remote-rules-UggoZqfP.js.map +0 -1
- package/dist/sampling-BLMD8EGM.js +0 -64
- package/dist/sampling-BLMD8EGM.js.map +0 -1
- package/dist/sampling-MthcVXXU.cjs +0 -2
- package/dist/sampling-MthcVXXU.cjs.map +0 -1
- package/dist/sender--0_VzPbN.js.map +0 -1
- package/dist/sender-SPGMqZjD.cjs +0 -3
- package/dist/sender-SPGMqZjD.cjs.map +0 -1
- package/dist/storm-CTy1dfvs.cjs +0 -2
- package/dist/storm-CTy1dfvs.cjs.map +0 -1
- package/dist/storm-knaj4GUH.js +0 -10
- package/dist/storm-knaj4GUH.js.map +0 -1
package/dist/core/runtime.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { BusMessage } from "../models/bus";
|
|
|
3
3
|
import type { ObservabilityConfig, ResolvedConfig } from "../models/config";
|
|
4
4
|
import type { InstrumentDef, MetricAttributes } from "../models/metric";
|
|
5
5
|
import { type LogRecord } from "../models/log-record";
|
|
6
|
+
import type { DeliveryStats } from "../models/stats";
|
|
6
7
|
import { ConsoleSink } from "../utils/console";
|
|
7
8
|
import { type Identity } from "../utils/identity";
|
|
8
9
|
import { type PlatformMetadata } from "../utils/platform";
|
|
@@ -15,7 +16,6 @@ import { JourneyEngine } from "./journey";
|
|
|
15
16
|
import { RecordBuilder } from "./record";
|
|
16
17
|
/** Manages subsystem lifecycles, bus coordination and record delivery. */
|
|
17
18
|
export declare class ObservabilityRuntime {
|
|
18
|
-
private readonly degraded;
|
|
19
19
|
/**
|
|
20
20
|
* Runtime of this copy of the library when another version owns the page runtime.
|
|
21
21
|
* It stays off the global key.
|
|
@@ -105,12 +105,31 @@ export declare class ObservabilityRuntime {
|
|
|
105
105
|
private readonly journeyOptions;
|
|
106
106
|
/** False in a runtime that an early log call started. The first configure() then sets limits. */
|
|
107
107
|
private tunablesLocked;
|
|
108
|
+
/**
|
|
109
|
+
* True for a console-only runtime. It sends nothing, joins no bus and installs no capture.
|
|
110
|
+
* Another version of the library on the page, or a server, makes it console-only.
|
|
111
|
+
*/
|
|
112
|
+
private readonly degraded;
|
|
113
|
+
/** True after the report of a destination on a server. The runtime reports it one time. */
|
|
114
|
+
private serverReported;
|
|
115
|
+
/**
|
|
116
|
+
* Ends the root span of a forwarder when its document unloads. The exit flush ends it only in
|
|
117
|
+
* the sender. Without this, the client spans of a frame or a view have no parent.
|
|
118
|
+
*/
|
|
119
|
+
private readonly onPageHide;
|
|
108
120
|
/**
|
|
109
121
|
* @param input Initial consumer configuration options.
|
|
110
|
-
* @param
|
|
111
|
-
* no capture.
|
|
122
|
+
* @param mismatch True for a console-only runtime next to another version.
|
|
112
123
|
*/
|
|
113
124
|
private constructor();
|
|
125
|
+
/**
|
|
126
|
+
* Adds a breadcrumb from app code. It copies the data now. A later change of the object of the
|
|
127
|
+
* app then does not change the trail.
|
|
128
|
+
* @param message Description of the event. A JavaScript caller can pass a value that is not a
|
|
129
|
+
* string. The library converts it.
|
|
130
|
+
* @param data Optional metadata.
|
|
131
|
+
*/
|
|
132
|
+
addBreadcrumb(message: unknown, data?: Record<string, unknown>): void;
|
|
114
133
|
/**
|
|
115
134
|
* Adds a value to a counter or a histogram. The meter sends one point at each interval.
|
|
116
135
|
* @param def Definition of the instrument.
|
|
@@ -118,6 +137,12 @@ export declare class ObservabilityRuntime {
|
|
|
118
137
|
* @param attributes Attribute set of the value.
|
|
119
138
|
*/
|
|
120
139
|
recordMetric(def: InstrumentDef, value: number, attributes?: MetricAttributes): void;
|
|
140
|
+
/**
|
|
141
|
+
* Builds and emits the record of one span. The console does not print it. minLevel does not
|
|
142
|
+
* drop it. The trace engine sampled the trace before the span existed.
|
|
143
|
+
* @param span The span data.
|
|
144
|
+
*/
|
|
145
|
+
private recordSpan;
|
|
121
146
|
/**
|
|
122
147
|
* Builds and emits the record of one aggregated point. The console does not print it.
|
|
123
148
|
* @param name Metric name.
|
|
@@ -173,6 +198,18 @@ export declare class ObservabilityRuntime {
|
|
|
173
198
|
* @param input Partial configuration to merge.
|
|
174
199
|
*/
|
|
175
200
|
private reconfigure;
|
|
201
|
+
/**
|
|
202
|
+
* Tests if the runtime runs on a server, for example Node during server-side rendering.
|
|
203
|
+
* @returns True on Node.
|
|
204
|
+
*/
|
|
205
|
+
private onServer;
|
|
206
|
+
/**
|
|
207
|
+
* Removes the delivery settings from the input of a console-only runtime. On a server, it
|
|
208
|
+
* reports a destination one time.
|
|
209
|
+
* @param input Consumer configuration options.
|
|
210
|
+
* @returns The options that the runtime accepts.
|
|
211
|
+
*/
|
|
212
|
+
private allowed;
|
|
176
213
|
/**
|
|
177
214
|
* Restores the startup tunables in the next config. A part of the runtime reads each tunable
|
|
178
215
|
* one time. A later change has no effect. The runtime then refuses it.
|
|
@@ -250,6 +287,17 @@ export declare class ObservabilityRuntime {
|
|
|
250
287
|
private installCaptures;
|
|
251
288
|
/** Uninstalls the active capture modules. */
|
|
252
289
|
private uninstallCaptures;
|
|
290
|
+
/**
|
|
291
|
+
* Imports the WebSocket capture plugin. A failed import reports and skips it.
|
|
292
|
+
* @returns Promise that resolves to the class, or undefined if the import failed.
|
|
293
|
+
*/
|
|
294
|
+
private loadWebSocket;
|
|
295
|
+
/**
|
|
296
|
+
* Wraps a plugin as a capture module. The plugin gets public tools only.
|
|
297
|
+
* @param plugin Plugin of the app, or a built-in plugin.
|
|
298
|
+
* @returns The capture module.
|
|
299
|
+
*/
|
|
300
|
+
private pluginCapture;
|
|
253
301
|
/**
|
|
254
302
|
* Imports one capture module. A failed import reports and skips that module only.
|
|
255
303
|
* @param name Capture module name.
|
|
@@ -317,6 +365,17 @@ export declare class ObservabilityRuntime {
|
|
|
317
365
|
private readonly reportGap;
|
|
318
366
|
/** Makes and stores a new tab ID after a tab ID collision. */
|
|
319
367
|
private regenerateTabId;
|
|
368
|
+
/**
|
|
369
|
+
* Starts a new session in this context. It sends the open metric points, starts a new trace,
|
|
370
|
+
* ends the active journey and clears the breadcrumbs. Other tabs read the new id at their next
|
|
371
|
+
* startup.
|
|
372
|
+
*/
|
|
373
|
+
newSession(): void;
|
|
374
|
+
/**
|
|
375
|
+
* Reads the delivery state of this context.
|
|
376
|
+
* @returns Promise that resolves to the counts and the time of the last accepted send.
|
|
377
|
+
*/
|
|
378
|
+
stats(): Promise<DeliveryStats>;
|
|
320
379
|
/**
|
|
321
380
|
* Counts the batches held in storage after a failed or deferred delivery.
|
|
322
381
|
* @returns Promise that resolves to the number of stored batches. A forwarder stores
|
package/dist/core/sampling.d.ts
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
import type { ResolvedConfig } from "../models/config";
|
|
2
|
-
import type { LogRecord } from "../models/log-record";
|
|
2
|
+
import type { LogLevel, LogRecord } from "../models/log-record";
|
|
3
3
|
import type { RemoteRules } from "./remote-sampling";
|
|
4
|
+
/** Value of the longest prefix that matches a namespace. */
|
|
5
|
+
interface PrefixMatch<T> {
|
|
6
|
+
/** Value of the prefix, for example a rate or a level. */
|
|
7
|
+
value: T;
|
|
8
|
+
/** Length of the prefix. */
|
|
9
|
+
length: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Finds the longest prefix in a map that matches a namespace.
|
|
13
|
+
* For example, trading.ticks overrides trading.
|
|
14
|
+
* @param namespace Target application namespace.
|
|
15
|
+
* @param values Value for each namespace prefix.
|
|
16
|
+
* @returns The match, or undefined if no prefix matches.
|
|
17
|
+
*/
|
|
18
|
+
export declare function longestPrefix<T>(namespace: string, values: Record<string, T>): PrefixMatch<T> | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Finds the minimum level of a namespace in the config. The longest matching prefix of
|
|
21
|
+
* `minLevels` wins. A namespace with no match uses `minLevel`.
|
|
22
|
+
* @param namespace Target application namespace.
|
|
23
|
+
* @param config Active configuration instance.
|
|
24
|
+
* @returns The minimum level of the namespace.
|
|
25
|
+
*/
|
|
26
|
+
export declare function levelFor(namespace: string, config: ResolvedConfig): LogLevel;
|
|
27
|
+
/**
|
|
28
|
+
* Decides if sampling keeps a key at a rate. One key always gives the same result.
|
|
29
|
+
* @param key Journey ID or trace ID.
|
|
30
|
+
* @param rate Sampling rate, 0..1.
|
|
31
|
+
* @returns True if sampling keeps the key.
|
|
32
|
+
*/
|
|
33
|
+
export declare function sampleKey(key: string, rate: number): boolean;
|
|
4
34
|
/** Fields that sampling reads. The caller knows all of them before it builds a record. */
|
|
5
35
|
export interface SampleInput {
|
|
6
36
|
/** Severity level of the entry. */
|
|
@@ -41,10 +71,8 @@ export declare function shouldSample(record: LogRecord, config: ResolvedConfig,
|
|
|
41
71
|
* An example is application code that calls logger.error in a render loop.
|
|
42
72
|
*/
|
|
43
73
|
export declare class ErrorCeiling {
|
|
44
|
-
/** Start of the current window, in epoch milliseconds. */
|
|
45
|
-
private windowStart;
|
|
46
74
|
/** ERROR and FATAL records admitted in the current window. */
|
|
47
|
-
private
|
|
75
|
+
private readonly window;
|
|
48
76
|
/**
|
|
49
77
|
* Checks a record against the limit. It counts only ERROR and FATAL records.
|
|
50
78
|
* @param record Record about to enter a stream.
|
|
@@ -52,3 +80,4 @@ export declare class ErrorCeiling {
|
|
|
52
80
|
*/
|
|
53
81
|
allow(record: LogRecord): boolean;
|
|
54
82
|
}
|
|
83
|
+
export {};
|
package/dist/core/sender.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ResolvedConfig } from "../models/config";
|
|
2
2
|
import type { LossReporter } from "../models/drop";
|
|
3
3
|
import type { LogRecord } from "../models/log-record";
|
|
4
|
+
import type { DeliveryStats } from "../models/stats";
|
|
4
5
|
import { type GapReporter } from "../models/storage";
|
|
5
6
|
import type { Diagnostics } from "./diagnostics";
|
|
6
7
|
import type { RemoteSlot } from "./remote-sampling";
|
|
@@ -26,12 +27,14 @@ export declare class Sender {
|
|
|
26
27
|
private readonly pipeline;
|
|
27
28
|
private readonly exitFlush;
|
|
28
29
|
private readonly diagnostics;
|
|
30
|
+
private readonly transport;
|
|
29
31
|
/**
|
|
30
32
|
* @param storage Storage adapter for undelivered batches.
|
|
31
33
|
* @param retry Retry engine for stored batches.
|
|
32
34
|
* @param pipeline Pipeline that batches records.
|
|
33
35
|
* @param exitFlush Handler that sends pending records on unload.
|
|
34
36
|
* @param diagnostics Diagnostics reporter.
|
|
37
|
+
* @param transport Transport of the pipeline and the retry engine.
|
|
35
38
|
*/
|
|
36
39
|
private constructor();
|
|
37
40
|
/**
|
|
@@ -56,6 +59,11 @@ export declare class Sender {
|
|
|
56
59
|
* @returns Promise that resolves to the batch count, or 0 if storage fails.
|
|
57
60
|
*/
|
|
58
61
|
queueDepth(): Promise<number>;
|
|
62
|
+
/**
|
|
63
|
+
* Reads the delivery state of the pipeline and the transport.
|
|
64
|
+
* @returns Records that wait, records in requests and the last accepted send.
|
|
65
|
+
*/
|
|
66
|
+
stats(): Omit<DeliveryStats, "stored">;
|
|
59
67
|
/**
|
|
60
68
|
* Sends pending records with a normal flush, then with the exit flush. Then it stops all
|
|
61
69
|
* timers and listeners. Then it closes storage. The normal flush keeps the headers, gzip
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { EndedTrace } from "../utils/tracing";
|
|
2
|
+
/** One span that the runtime records. */
|
|
3
|
+
export interface SpanData {
|
|
4
|
+
/** Span name. */
|
|
5
|
+
name: string;
|
|
6
|
+
/** "internal" for a root span, "client" for a request. */
|
|
7
|
+
kind: "internal" | "client";
|
|
8
|
+
/** Trace ID. */
|
|
9
|
+
traceId: string;
|
|
10
|
+
/** Span ID. */
|
|
11
|
+
spanId: string;
|
|
12
|
+
/** Span ID of the parent, or "" for a root span. */
|
|
13
|
+
parentSpanId: string;
|
|
14
|
+
/** Start time in epoch milliseconds. */
|
|
15
|
+
startMs: number;
|
|
16
|
+
/** End time in epoch milliseconds. */
|
|
17
|
+
endMs: number;
|
|
18
|
+
/** True for a failed operation. */
|
|
19
|
+
error: boolean;
|
|
20
|
+
/** Attributes of the span. */
|
|
21
|
+
attributes: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Builds the root span of an ambient trace that ended.
|
|
25
|
+
* @param ended The trace.
|
|
26
|
+
* @returns The span data.
|
|
27
|
+
*/
|
|
28
|
+
export declare function rootSpan(ended: EndedTrace): SpanData;
|
|
29
|
+
/**
|
|
30
|
+
* Builds the span fields of a span record. The record limits do not cut them.
|
|
31
|
+
* @param span The span data.
|
|
32
|
+
* @returns The fields.
|
|
33
|
+
*/
|
|
34
|
+
export declare function spanFields(span: SpanData): Record<string, unknown>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./constants-
|
|
1
|
+
import "./constants-L_d5YvvQ.js";
|
|
2
2
|
import { r as e } from "./error-like-Ywo5uRHo.js";
|
|
3
|
-
import {
|
|
4
|
-
import { t as n } from "./storm-
|
|
3
|
+
import { i as t } from "./platform-4yYjMD-B.js";
|
|
4
|
+
import { t as n } from "./storm-CfO0Sam2.js";
|
|
5
5
|
//#region src/capture/errors.ts
|
|
6
6
|
function r(t) {
|
|
7
7
|
if (e(t)) {
|
|
@@ -39,7 +39,7 @@ var i = class {
|
|
|
39
39
|
let n = e.target, r = n?.src ?? n?.href ?? "";
|
|
40
40
|
if (n !== null && n !== globalThis && r !== "") {
|
|
41
41
|
if (!this.ctx.config.capture.resourceErrors) return;
|
|
42
|
-
let e = this.ctx.config.capture.fullUrls
|
|
42
|
+
let e = t(r, this.ctx.config.capture.fullUrls);
|
|
43
43
|
this.ctx.breadcrumbs.push({
|
|
44
44
|
t: Date.now(),
|
|
45
45
|
category: "http",
|
|
@@ -54,7 +54,7 @@ var i = class {
|
|
|
54
54
|
if (!this.ctx.config.capture.errors) return;
|
|
55
55
|
let i = e, a = i.message === "" ? "unknown error" : i.message, o = i.error ?? Error(a);
|
|
56
56
|
this.report("window.onerror", o, {
|
|
57
|
-
"error.source": i.filename,
|
|
57
|
+
"error.source": t(i.filename, this.ctx.config.capture.fullUrls),
|
|
58
58
|
"error.line": i.lineno,
|
|
59
59
|
"error.column": i.colno
|
|
60
60
|
});
|
|
@@ -91,4 +91,4 @@ var i = class {
|
|
|
91
91
|
//#endregion
|
|
92
92
|
export { i as ErrorCapture };
|
|
93
93
|
|
|
94
|
-
//# sourceMappingURL=errors-
|
|
94
|
+
//# sourceMappingURL=errors-BDI96zKc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-BDI96zKc.js","names":["isErrorLike","recordedUrl","allowInWindow","signatureOf","value","frame","message","ErrorCapture","ctx","target","event","resourceUrl","url","errorEvent","fallback","error","now","previous","key","suppressed","oldest","reason","source","extra"],"sources":["../src/capture/errors.ts"],"sourcesContent":["// src/capture/errors.ts\n//\n// Captures uncaught errors, unhandled rejections and failed resource loads.\n\nimport {\n ERROR_DEDUPE_MS,\n ERROR_STORM_MAX_PER_WINDOW,\n MAX_TRACKED_ERROR_SIGNATURES,\n} from \"../constants\";\nimport { isErrorLike } from \"../utils/error-like\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Tracking metadata for a deduplicated error signature. */\ninterface SeenError {\n /** Time of the last report for the signature, in epoch milliseconds. */\n at: number;\n /** Occurrences recorded since the last report. */\n count: number;\n}\n\n/** Message and deduplication key of a thrown value. */\ninterface Signature {\n /** Message of the record. */\n message: string;\n /** Deduplication key. */\n key: string;\n}\n\n/**\n * Reads the message and the deduplication key of a thrown value.\n * Duck typing reads an error from another realm. That error fails `instanceof Error`.\n * @param value Thrown value or rejection reason.\n * @returns The signature.\n * @throws When a getter or the text form of the value throws. Call it inside a guard.\n */\nfunction signatureOf(value: unknown): Signature {\n if (isErrorLike(value)) {\n const frame = (value.stack ?? \"\").split(\"\\n\")[1] ?? \"\";\n return { message: value.message, key: `${value.name}|${value.message}|${frame}` };\n }\n\n const message = String(value);\n return { message, key: `${typeof value}|${message}|` };\n}\n\n/** Captures uncaught exceptions, unhandled promise rejections, and failed resource loads. */\nexport class ErrorCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"errors\";\n\n /** Prevents duplicate listener registration. */\n private installed = false;\n\n /** Recently reported error signatures in LRU order. */\n private readonly seen = new Map<string, SeenError>();\n\n /** Rate limit of this capture. Console noise has its own window and cannot use it. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param ctx Capture context containing configuration, diagnostics, logger, and breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Subscribes to global error and unhandledrejection events. */\n install(): void {\n if (this.installed || typeof addEventListener === \"undefined\") {\n return;\n }\n this.installed = true;\n\n // Uses capture phase to observe non-bubbling resource load errors.\n addEventListener(\"error\", this.onError, true);\n addEventListener(\"unhandledrejection\", this.onRejection);\n }\n\n /** Removes event listeners and clears tracked error signatures. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n removeEventListener(\"error\", this.onError, true);\n removeEventListener(\"unhandledrejection\", this.onRejection);\n this.seen.clear();\n }\n\n /** Routes resource load failures and uncaught script errors. */\n private readonly onError = (event: ErrorEvent | Event): void => {\n const target = event.target as (HTMLElement & { src?: string; href?: string }) | null;\n const resourceUrl = target?.src ?? target?.href ?? \"\";\n\n // Filters element-level resource load failures from script errors.\n if (\n target !== null &&\n target !== (globalThis as unknown as EventTarget) &&\n resourceUrl !== \"\"\n ) {\n if (!this.ctx.config.capture.resourceErrors) {\n return;\n }\n\n // A cache buster is noise. A signed URL is a credential.\n // The record keeps neither unless you set fullUrls.\n const url = recordedUrl(resourceUrl, this.ctx.config.capture.fullUrls);\n\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"http\",\n message: `resource failed: ${url}`,\n });\n this.ctx.logger.warn(\"resource failed to load\", {\n \"error.type\": \"resource\",\n \"resource.url\": url,\n \"resource.tag\": target.tagName.toLowerCase(),\n });\n return;\n }\n\n if (!this.ctx.config.capture.errors) {\n return;\n }\n\n const errorEvent = event as ErrorEvent;\n const fallback = errorEvent.message === \"\" ? \"unknown error\" : errorEvent.message;\n const thrown: unknown = errorEvent.error;\n const error = thrown ?? new Error(fallback);\n\n this.report(\"window.onerror\", error, {\n // A signed script URL is a credential.\n \"error.source\": recordedUrl(errorEvent.filename, this.ctx.config.capture.fullUrls),\n \"error.line\": errorEvent.lineno,\n \"error.column\": errorEvent.colno,\n });\n };\n\n /** Captures unhandled promise rejections. */\n private readonly onRejection = (event: PromiseRejectionEvent): void => {\n if (!this.ctx.config.capture.rejections) {\n return;\n }\n\n this.report(\"unhandledrejection\", event.reason, {\n \"error.type\": \"unhandledrejection\",\n });\n };\n\n /**\n * Rate limits, deduplicates, and logs captured errors.\n * @param source Originating capture event name.\n * @param error Caught error instance or thrown value.\n * @param extra Contextual error attributes.\n */\n private report(source: string, error: unknown, extra: Record<string, unknown>): void {\n if (!allowInWindow(this.window, ERROR_STORM_MAX_PER_WINDOW, this.ctx.diagnostics, \"errors\")) {\n return;\n }\n\n const now = Date.now();\n // A reason with no text form, for example a null-prototype object, gets an empty message.\n // The record then uses the source as its message.\n const { message, key } = this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not read the error reason. It records the error without its message.\",\n () => signatureOf(error),\n ) ?? { message: \"\", key: `${typeof error}||` };\n const previous = this.seen.get(key);\n\n if (previous && now - previous.at < ERROR_DEDUPE_MS) {\n previous.count++;\n previous.at = now;\n return;\n }\n\n // This is the number of occurrences that deduplication dropped since the last report.\n // Without this count, many errors look like few errors.\n const suppressed = previous ? previous.count - 1 : 0;\n\n // Delete, then set, to move the key to the end of the map. The map stays in\n // least-recently-reported order. The eviction below needs this order.\n this.seen.delete(key);\n this.seen.set(key, { at: now, count: 1 });\n\n // A page can throw with a new message at each render, for example from a template literal\n // in a loop. Without this cap, the map grows until the document closes.\n if (this.seen.size > MAX_TRACKED_ERROR_SIGNATURES) {\n const [oldest] = this.seen.keys();\n this.seen.delete(oldest);\n }\n\n // Give the original value to the logger. It converts the reason and keeps its data.\n // Without a reason, the record still needs error.message and error.stack_trace.\n const reason = error === undefined ? new Error(message) : error;\n this.ctx.logger.error(message === \"\" ? source : message, reason, {\n ...extra,\n \"error.captured_by\": source,\n \"error.suppressed_count\": suppressed,\n });\n }\n}\n"],"mappings":";;;;;AAqCA,SAASG,EAAY,GAA2B;CAC9C,IAAIH,EAAYI,CAAK,GAAG;EACtB,IAAMC,KAASD,EAAM,SAAS,GAAA,CAAI,MAAM,IAAI,CAAC,CAAC,MAAM;EACpD,OAAO;GAAE,SAASA,EAAM;GAAS,KAAK,GAAGA,EAAM,KAAK,GAAGA,EAAM,QAAQ,GAAGC;EAAQ;CAClF;CAEA,IAAMC,IAAU,OAAOF,CAAK;CAC5B,OAAO;EAAE;EAAS,KAAK,GAAG,OAAOA,EAAM,GAAGE,EAAQ;CAAG;AACvD;AAGA,IAAaC,IAAb,MAA6C;CAgBd;CAd7B,OAAgB;CAGhB,YAAoB;CAGpB,uBAAwB,IAAI,IAAuB;CAGnD,SAAuC;EAAE,OAAO;EAAG,OAAO;CAAE;CAK5D,YAAY,GAAsC;EAArB,KAAA,MAAAC;CAAsB;CAGnD,UAAgB;EACd,AAAI,KAAK,aAAa,OAAO,mBAAqB,QAGlD,KAAK,YAAY,IAGjB,iBAAiB,SAAS,KAAK,SAAS,EAAI,GAC5C,iBAAiB,sBAAsB,KAAK,WAAW;CACzD;CAGA,YAAkB;EAChB,AAAK,KAAK,cAGV,KAAK,YAAY,IAEjB,oBAAoB,SAAS,KAAK,SAAS,EAAI,GAC/C,oBAAoB,sBAAsB,KAAK,WAAW,GAC1D,KAAK,KAAK,MAAM;CAClB;CAGA,WAA4B,MAAoC;EAC9D,IAAMC,IAASC,EAAM,QACfC,IAAcF,GAAQ,OAAOA,GAAQ,QAAQ;EAGnD,IACEA,MAAW,QACXA,MAAY,cACZE,MAAgB,IAChB;GACA,IAAI,CAAC,KAAK,IAAI,OAAO,QAAQ,gB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AAOC,CAAG,GACpB,KAAK,KAAK,IAAIA,GAAK;GAAE,IAAIF;GAAK,OAAO;EAAE,CAAC,GAIpC,KAAK,KAAK,OAAA,KAAqC;GACjD,IAAM,CAACI,KAAU,KAAK,KAAK,KAAK;GAChC,KAAK,KAAK,OAAOA,CAAM;EACzB;EAIA,IAAMC,IAASN,MAAU,KAAA,IAAgB,MAAMT,CAAO,IAAIS;EAC1D,KAAK,IAAI,OAAO,MAAMT,MAAY,KAAKgB,IAAShB,GAASe,GAAQ;GAC/D,GAAGE;GACH,qBAAqBD;GACrB,0BAA0BH;EAC5B,CAAC;CACH;AACF"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
require("./constants-BgRS6MB0.cjs");const e=require("./error-like-gGRx2s36.cjs"),t=require("./platform-o7r1ocOu.cjs"),n=require("./storm-6YYbXzT_.cjs");function r(t){if(e.r(t)){let e=(t.stack??``).split(`
|
|
2
|
+
`)[1]??``;return{message:t.message,key:`${t.name}|${t.message}|${e}`}}let n=String(t);return{message:n,key:`${typeof t}|${n}|`}}var i=class{ctx;name=`errors`;installed=!1;seen=new Map;window={start:0,count:0};constructor(e){this.ctx=e}install(){this.installed||typeof addEventListener>`u`||(this.installed=!0,addEventListener(`error`,this.onError,!0),addEventListener(`unhandledrejection`,this.onRejection))}uninstall(){this.installed&&(this.installed=!1,removeEventListener(`error`,this.onError,!0),removeEventListener(`unhandledrejection`,this.onRejection),this.seen.clear())}onError=e=>{let n=e.target,r=n?.src??n?.href??``;if(n!==null&&n!==globalThis&&r!==``){if(!this.ctx.config.capture.resourceErrors)return;let e=t.i(r,this.ctx.config.capture.fullUrls);this.ctx.breadcrumbs.push({t:Date.now(),category:`http`,message:`resource failed: ${e}`}),this.ctx.logger.warn(`resource failed to load`,{"error.type":`resource`,"resource.url":e,"resource.tag":n.tagName.toLowerCase()});return}if(!this.ctx.config.capture.errors)return;let i=e,a=i.message===``?`unknown error`:i.message,o=i.error??Error(a);this.report(`window.onerror`,o,{"error.source":t.i(i.filename,this.ctx.config.capture.fullUrls),"error.line":i.lineno,"error.column":i.colno})};onRejection=e=>{this.ctx.config.capture.rejections&&this.report(`unhandledrejection`,e.reason,{"error.type":`unhandledrejection`})};report(e,t,i){if(!n.t(this.window,20,this.ctx.diagnostics,`errors`))return;let a=Date.now(),{message:o,key:s}=this.ctx.diagnostics.guard(`capture.record_failed`,`The library could not read the error reason. It records the error without its message.`,()=>r(t))??{message:``,key:`${typeof t}||`},c=this.seen.get(s);if(c&&a-c.at<5e3){c.count++,c.at=a;return}let l=c?c.count-1:0;if(this.seen.delete(s),this.seen.set(s,{at:a,count:1}),this.seen.size>200){let[e]=this.seen.keys();this.seen.delete(e)}let u=t===void 0?Error(o):t;this.ctx.logger.error(o===``?e:o,u,{...i,"error.captured_by":e,"error.suppressed_count":l})}};exports.ErrorCapture=i;
|
|
3
|
+
//# sourceMappingURL=errors-_xEsCVXn.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-_xEsCVXn.cjs","names":["isErrorLike","recordedUrl","allowInWindow","require_error_like","require_platform","require_storm","signatureOf","value","frame","message","ErrorCapture","ctx","target","event","resourceUrl","url","errorEvent","fallback","error","now","previous","key","suppressed","oldest","reason","source","extra"],"sources":["../src/capture/errors.ts"],"sourcesContent":["// src/capture/errors.ts\n//\n// Captures uncaught errors, unhandled rejections and failed resource loads.\n\nimport {\n ERROR_DEDUPE_MS,\n ERROR_STORM_MAX_PER_WINDOW,\n MAX_TRACKED_ERROR_SIGNATURES,\n} from \"../constants\";\nimport { isErrorLike } from \"../utils/error-like\";\nimport { recordedUrl } from \"../utils/platform\";\nimport { allowInWindow, type StormWindow } from \"./storm\";\nimport type { Capture, CaptureContext } from \"./types\";\n\n/** Tracking metadata for a deduplicated error signature. */\ninterface SeenError {\n /** Time of the last report for the signature, in epoch milliseconds. */\n at: number;\n /** Occurrences recorded since the last report. */\n count: number;\n}\n\n/** Message and deduplication key of a thrown value. */\ninterface Signature {\n /** Message of the record. */\n message: string;\n /** Deduplication key. */\n key: string;\n}\n\n/**\n * Reads the message and the deduplication key of a thrown value.\n * Duck typing reads an error from another realm. That error fails `instanceof Error`.\n * @param value Thrown value or rejection reason.\n * @returns The signature.\n * @throws When a getter or the text form of the value throws. Call it inside a guard.\n */\nfunction signatureOf(value: unknown): Signature {\n if (isErrorLike(value)) {\n const frame = (value.stack ?? \"\").split(\"\\n\")[1] ?? \"\";\n return { message: value.message, key: `${value.name}|${value.message}|${frame}` };\n }\n\n const message = String(value);\n return { message, key: `${typeof value}|${message}|` };\n}\n\n/** Captures uncaught exceptions, unhandled promise rejections, and failed resource loads. */\nexport class ErrorCapture implements Capture {\n /** Capture module identifier. */\n readonly name = \"errors\";\n\n /** Prevents duplicate listener registration. */\n private installed = false;\n\n /** Recently reported error signatures in LRU order. */\n private readonly seen = new Map<string, SeenError>();\n\n /** Rate limit of this capture. Console noise has its own window and cannot use it. */\n private readonly window: StormWindow = { start: 0, count: 0 };\n\n /**\n * @param ctx Capture context containing configuration, diagnostics, logger, and breadcrumbs.\n */\n constructor(private readonly ctx: CaptureContext) {}\n\n /** Subscribes to global error and unhandledrejection events. */\n install(): void {\n if (this.installed || typeof addEventListener === \"undefined\") {\n return;\n }\n this.installed = true;\n\n // Uses capture phase to observe non-bubbling resource load errors.\n addEventListener(\"error\", this.onError, true);\n addEventListener(\"unhandledrejection\", this.onRejection);\n }\n\n /** Removes event listeners and clears tracked error signatures. */\n uninstall(): void {\n if (!this.installed) {\n return;\n }\n this.installed = false;\n\n removeEventListener(\"error\", this.onError, true);\n removeEventListener(\"unhandledrejection\", this.onRejection);\n this.seen.clear();\n }\n\n /** Routes resource load failures and uncaught script errors. */\n private readonly onError = (event: ErrorEvent | Event): void => {\n const target = event.target as (HTMLElement & { src?: string; href?: string }) | null;\n const resourceUrl = target?.src ?? target?.href ?? \"\";\n\n // Filters element-level resource load failures from script errors.\n if (\n target !== null &&\n target !== (globalThis as unknown as EventTarget) &&\n resourceUrl !== \"\"\n ) {\n if (!this.ctx.config.capture.resourceErrors) {\n return;\n }\n\n // A cache buster is noise. A signed URL is a credential.\n // The record keeps neither unless you set fullUrls.\n const url = recordedUrl(resourceUrl, this.ctx.config.capture.fullUrls);\n\n this.ctx.breadcrumbs.push({\n t: Date.now(),\n category: \"http\",\n message: `resource failed: ${url}`,\n });\n this.ctx.logger.warn(\"resource failed to load\", {\n \"error.type\": \"resource\",\n \"resource.url\": url,\n \"resource.tag\": target.tagName.toLowerCase(),\n });\n return;\n }\n\n if (!this.ctx.config.capture.errors) {\n return;\n }\n\n const errorEvent = event as ErrorEvent;\n const fallback = errorEvent.message === \"\" ? \"unknown error\" : errorEvent.message;\n const thrown: unknown = errorEvent.error;\n const error = thrown ?? new Error(fallback);\n\n this.report(\"window.onerror\", error, {\n // A signed script URL is a credential.\n \"error.source\": recordedUrl(errorEvent.filename, this.ctx.config.capture.fullUrls),\n \"error.line\": errorEvent.lineno,\n \"error.column\": errorEvent.colno,\n });\n };\n\n /** Captures unhandled promise rejections. */\n private readonly onRejection = (event: PromiseRejectionEvent): void => {\n if (!this.ctx.config.capture.rejections) {\n return;\n }\n\n this.report(\"unhandledrejection\", event.reason, {\n \"error.type\": \"unhandledrejection\",\n });\n };\n\n /**\n * Rate limits, deduplicates, and logs captured errors.\n * @param source Originating capture event name.\n * @param error Caught error instance or thrown value.\n * @param extra Contextual error attributes.\n */\n private report(source: string, error: unknown, extra: Record<string, unknown>): void {\n if (!allowInWindow(this.window, ERROR_STORM_MAX_PER_WINDOW, this.ctx.diagnostics, \"errors\")) {\n return;\n }\n\n const now = Date.now();\n // A reason with no text form, for example a null-prototype object, gets an empty message.\n // The record then uses the source as its message.\n const { message, key } = this.ctx.diagnostics.guard(\n \"capture.record_failed\",\n \"The library could not read the error reason. It records the error without its message.\",\n () => signatureOf(error),\n ) ?? { message: \"\", key: `${typeof error}||` };\n const previous = this.seen.get(key);\n\n if (previous && now - previous.at < ERROR_DEDUPE_MS) {\n previous.count++;\n previous.at = now;\n return;\n }\n\n // This is the number of occurrences that deduplication dropped since the last report.\n // Without this count, many errors look like few errors.\n const suppressed = previous ? previous.count - 1 : 0;\n\n // Delete, then set, to move the key to the end of the map. The map stays in\n // least-recently-reported order. The eviction below needs this order.\n this.seen.delete(key);\n this.seen.set(key, { at: now, count: 1 });\n\n // A page can throw with a new message at each render, for example from a template literal\n // in a loop. Without this cap, the map grows until the document closes.\n if (this.seen.size > MAX_TRACKED_ERROR_SIGNATURES) {\n const [oldest] = this.seen.keys();\n this.seen.delete(oldest);\n }\n\n // Give the original value to the logger. It converts the reason and keeps its data.\n // Without a reason, the record still needs error.message and error.stack_trace.\n const reason = error === undefined ? new Error(message) : error;\n this.ctx.logger.error(message === \"\" ? source : message, reason, {\n ...extra,\n \"error.captured_by\": source,\n \"error.suppressed_count\": suppressed,\n });\n }\n}\n"],"mappings":"wJAqCA,SAASM,EAAY,EAA2B,CAC9C,GAAIN,EAAAA,EAAYO,CAAK,EAAG,CACtB,IAAMC,GAASD,EAAM,OAAS,GAAA,CAAI,MAAM;CAAI,CAAC,CAAC,IAAM,GACpD,MAAO,CAAE,QAASA,EAAM,QAAS,IAAK,GAAGA,EAAM,KAAK,GAAGA,EAAM,QAAQ,GAAGC,GAAQ,CAClF,CAEA,IAAMC,EAAU,OAAOF,CAAK,EAC5B,MAAO,CAAE,UAAS,IAAK,GAAG,OAAOA,EAAM,GAAGE,EAAQ,EAAG,CACvD,CAGA,IAAaC,EAAb,KAA6C,CAgBd,IAd7B,KAAgB,SAGhB,UAAoB,GAGpB,KAAwB,IAAI,IAG5B,OAAuC,CAAE,MAAO,EAAG,MAAO,CAAE,EAK5D,YAAY,EAAsC,CAArB,KAAA,IAAAC,CAAsB,CAGnD,SAAgB,CACV,KAAK,WAAa,OAAO,iBAAqB,MAGlD,KAAK,UAAY,GAGjB,iBAAiB,QAAS,KAAK,QAAS,EAAI,EAC5C,iBAAiB,qBAAsB,KAAK,WAAW,EACzD,CAGA,WAAkB,CACX,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OAAQ,KAAK,IAAI,YAAY,MAC5C,wBACA,6FACMb,EAAYY,CAAK,CACzB,GAAK,CAAE,QAAS,GAAI,IAAK,GAAG,OAAOA,EAAM,GAAI,EACvCE,EAAW,KAAK,KAAK,IAAIC,CAAG,EAElC,GAAID,GAAYD,EAAMC,EAAS,GAAA,IAAsB,CACnD,EAAS,QACT,EAAS,GAAKD,EACd,MACF,CAIA,IAAMG,EAAaF,EAAWA,EAAS,MAAQ,EAAI,EASnD,GALA,KAAK,KAAK,OAAOC,CAAG,EACpB,KAAK,KAAK,IAAIA,EAAK,CAAE,GAAIF,EAAK,MAAO,CAAE,CAAC,EAIpC,KAAK,KAAK,KAAA,IAAqC,CACjD,GAAM,CAACI,GAAU,KAAK,KAAK,KAAK,EAChC,KAAK,KAAK,OAAOA,CAAM,CACzB,CAIA,IAAMC,EAASN,IAAU,IAAA,GAAgB,MAAMT,CAAO,EAAIS,EAC1D,KAAK,IAAI,OAAO,MAAMT,IAAY,GAAKgB,EAAShB,EAASe,EAAQ,CAC/D,GAAGE,EACH,oBAAqBD,EACrB,yBAA0BH,CAC5B,CAAC,CACH,CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixed-window-BR0bu32Y.cjs","names":["countInWindow","now","window","windowMs","limit"],"sources":["../src/utils/fixed-window.ts"],"sourcesContent":["// src/utils/fixed-window.ts\n//\n// Counts events in a fixed time window. A quiet period adds no allowance. The capture modules and\n// the error ceiling use it to stop a storm of records.\n\n/** State of one fixed window. Counters that share a limit share one object. */\nexport interface StormWindow {\n /** Start of the current window, in epoch milliseconds. */\n start: number;\n /** Events counted in the current window. */\n count: number;\n}\n\n/**\n * Counts one event in a fixed window.\n * @param window Window state to change.\n * @param limit Maximum events in each window.\n * @param windowMs Length of the window, in milliseconds.\n * @returns False when the window has no allowance left. The caller must drop the event.\n */\nexport function countInWindow(window: StormWindow, limit: number, windowMs: number): boolean {\n const now = Date.now();\n\n // Guard against a clock that moves back. The window then never ends.\n if (now < window.start || now - window.start > windowMs) {\n window.start = now;\n window.count = 0;\n }\n\n window.count++;\n\n return window.count <= limit;\n}\n"],"mappings":"AAoBA,SAAgBA,EAAc,EAAqB,EAAe,EAA2B,CAC3F,IAAMC,EAAM,KAAK,IAAI,EAUrB,OAPIA,EAAMC,EAAO,OAASD,EAAMC,EAAO,MAAQC,KAC7C,EAAO,MAAQF,EACf,EAAO,MAAQ,GAGjB,EAAO,QAEAC,EAAO,OAASE,CACzB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/utils/fixed-window.ts
|
|
2
|
+
function e(e, t, n) {
|
|
3
|
+
let r = Date.now();
|
|
4
|
+
return (r < e.start || r - e.start > n) && (e.start = r, e.count = 0), e.count++, e.count <= t;
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { e as t };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=fixed-window-Re7jIRJH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixed-window-Re7jIRJH.js","names":["countInWindow","now","window","windowMs","limit"],"sources":["../src/utils/fixed-window.ts"],"sourcesContent":["// src/utils/fixed-window.ts\n//\n// Counts events in a fixed time window. A quiet period adds no allowance. The capture modules and\n// the error ceiling use it to stop a storm of records.\n\n/** State of one fixed window. Counters that share a limit share one object. */\nexport interface StormWindow {\n /** Start of the current window, in epoch milliseconds. */\n start: number;\n /** Events counted in the current window. */\n count: number;\n}\n\n/**\n * Counts one event in a fixed window.\n * @param window Window state to change.\n * @param limit Maximum events in each window.\n * @param windowMs Length of the window, in milliseconds.\n * @returns False when the window has no allowance left. The caller must drop the event.\n */\nexport function countInWindow(window: StormWindow, limit: number, windowMs: number): boolean {\n const now = Date.now();\n\n // Guard against a clock that moves back. The window then never ends.\n if (now < window.start || now - window.start > windowMs) {\n window.start = now;\n window.count = 0;\n }\n\n window.count++;\n\n return window.count <= limit;\n}\n"],"mappings":";AAoBA,SAAgBA,EAAc,GAAqB,GAAe,GAA2B;CAC3F,IAAMC,IAAM,KAAK,IAAI;CAUrB,QAPIA,IAAMC,EAAO,SAASD,IAAMC,EAAO,QAAQC,OAC7C,EAAO,QAAQF,GACf,EAAO,QAAQ,IAGjB,EAAO,SAEAC,EAAO,SAASE;AACzB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./constants-BgRS6MB0.cjs");var t={local:()=>localStorage,session:()=>sessionStorage};function n(){let e=e=>({getItem:t=>e.get(t)??null,setItem:(t,n)=>{e.set(t,n)},removeItem:t=>{e.delete(t)}}),t=e(new Map),n=e(new Map);return{local:()=>t,session:()=>n}}function r(e){let t=new Uint8Array(e);if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`)crypto.getRandomValues(t);else for(let n=0;n<e;n++)t[n]=Math.floor(Math.random()*256);return Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``)}function i(e){try{if(typeof crypto<`u`&&typeof crypto.randomUUID==`function`)return crypto.randomUUID()}catch{e.count(`platform.api_blocked`)}return r(16)}function a(e,t,n,r){return r.guard(`storage.unavailable`,`The library could not read ${t}Storage.`,()=>e[t]().getItem(n))??null}function o(e,t,n,r,i){i.guard(`storage.unavailable`,`The library could not write to ${t}Storage.`,()=>{e[t]().setItem(n,r)})}function s(t,n,r){let i=a(t,`local`,e.on,n);if(i)try{let e=JSON.parse(i);return e.id&&r-(e.lastSeenAt??0)<18e5?e.id:void 0}catch{n.report(`storage.degraded`,`The session record is not valid JSON. The library starts a new session.`);return}}function c(n,r=t){let c=i(n),l=Date.now(),u=i(n),d=s(r,n,l)??u,f=JSON.stringify({id:d,lastSeenAt:l});o(r,`local`,e.on,f,n);let p=a(r,`session`,`ui-observability.tab`,n)??``;return p||(p=i(n),o(r,`session`,e.vn,p,n)),{sessionId:d,tabId:p,contextId:c}}function l(t,n,r){o(r,`session`,e.vn,t,n)}var u=class{diagnostics;stores;lastTouchAt=0;constructor(e,n=t){this.diagnostics=e,this.stores=n}touch(e){let t=Date.now();if(t-this.lastTouchAt<6e4)return;let n=s(this.stores,this.diagnostics,t);n!==void 0&&n!==e?this.lastTouchAt=t:this.write(e,t)}restart(e){this.write(e,Date.now())}write(t,n){this.lastTouchAt=n;let r=JSON.stringify({id:t,lastSeenAt:n});o(this.stores,`local`,e.on,r,this.diagnostics)}};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
|
|
2
|
+
//# sourceMappingURL=identity-Bwku7zzN.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-Bwku7zzN.cjs","names":["SESSION_ID_KEY","TAB_ID_KEY","require_constants","BROWSER_STORES","memoryStores","wrap","map","key","value","localStore","sessionStore","randomHex","bytes","byteLength","i","b","newId","diagnostics","safeRead","store","stores","safeWrite","liveSession","raw","parsed","now","resolveIdentity","contextId","minted","sessionId","session","tabId","persistTabId","SessionTouch","stored"],"sources":["../src/utils/identity.ts"],"sourcesContent":["// src/utils/identity.ts\n//\n// Makes and keeps the session, tab, and context correlation identifiers. In a\n// sandboxed iframe and in private mode, Storage throws instead of returning null.\n// An unguarded read breaks the library at import.\n\nimport {\n BYTE_VALUE_COUNT,\n ID_BYTE_LENGTH,\n SESSION_ID_KEY,\n SESSION_IDLE_MS,\n SESSION_TOUCH_MS,\n TAB_ID_KEY,\n} from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\n\n/** Correlation identifiers attached to log records across session, tab, and realm scopes. */\nexport interface Identity {\n /** Origin-wide user session identifier surviving across tabs until idle expiration. */\n sessionId: string;\n /** Browser tab or desktop window identifier surviving document reloads. */\n tabId: string;\n /** Unique execution realm identifier regenerated on every document load. */\n contextId: string;\n}\n\n/** The three Storage methods that identity and journey code use. */\nexport interface KeyValueStore {\n /**\n * Reads one value.\n * @param key Storage key.\n * @returns Stored value, or null.\n */\n getItem(key: string): string | null;\n /**\n * Writes one value.\n * @param key Storage key.\n * @param value Value to write.\n */\n setItem(key: string, value: string): void;\n /**\n * Removes one value.\n * @param key Storage key.\n */\n removeItem(key: string): void;\n}\n\n/** Stores for identity and journey keys. A getter can throw in a sandboxed frame. */\nexport interface IdentityStores {\n /** Store that lasts across tabs and reloads. */\n local(): KeyValueStore;\n /** Store that lasts for one tab. */\n session(): KeyValueStore;\n}\n\n/** Stores that write to the browser. The `identity: \"storage\"` option uses them. */\nexport const BROWSER_STORES: IdentityStores = {\n local: () => localStorage,\n session: () => sessionStorage,\n};\n\n/**\n * Creates stores that keep values in memory only. The `identity: \"memory\"` option uses them.\n * @returns Stores that write nothing to the browser.\n */\nexport function memoryStores(): IdentityStores {\n const wrap = (map: Map<string, string>): KeyValueStore => ({\n getItem: (key) => map.get(key) ?? null,\n setItem: (key, value) => {\n map.set(key, value);\n },\n removeItem: (key) => {\n map.delete(key);\n },\n });\n\n const localStore = wrap(new Map());\n const sessionStore = wrap(new Map());\n\n return { local: () => localStore, session: () => sessionStore };\n}\n\n/**\n * Generates a random lowercase hexadecimal string of the specified byte length.\n * It uses crypto.getRandomValues when it is available. If not, it uses Math.random.\n * @param byteLength Number of random bytes to generate.\n * @returns Hexadecimal string of length byteLength * 2.\n */\nexport function randomHex(byteLength: number): string {\n const bytes = new Uint8Array(byteLength);\n if (typeof crypto !== \"undefined\" && typeof crypto.getRandomValues === \"function\") {\n crypto.getRandomValues(bytes);\n } else {\n for (let i = 0; i < byteLength; i++) {\n bytes[i] = Math.floor(Math.random() * BYTE_VALUE_COUNT);\n }\n }\n return Array.from(bytes, (b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\n/**\n * Generates a unique identifier string using crypto.randomUUID or randomHex fallback.\n * @param diagnostics Diagnostics reporter. It counts a blocked crypto.randomUUID call.\n * @returns UUID or random hex identifier.\n */\nexport function newId(diagnostics: Diagnostics): string {\n try {\n if (typeof crypto !== \"undefined\" && typeof crypto.randomUUID === \"function\") {\n return crypto.randomUUID();\n }\n } catch {\n // A sandbox can block crypto.randomUUID with a SecurityError. The method exists,\n // but the call throws. Count the fault. A report on each id is noise.\n diagnostics.count(\"platform.api_blocked\");\n }\n return randomHex(ID_BYTE_LENGTH);\n}\n\n/**\n * Reads a value from the local or session store. Reports a storage error to diagnostics.\n * @param stores Identity stores.\n * @param store Storage target (\"local\" or \"session\").\n * @param key Storage key.\n * @param diagnostics Diagnostics reporter.\n * @returns Stored string value or null if unreadable or absent.\n */\nfunction safeRead(\n stores: IdentityStores,\n store: \"local\" | \"session\",\n key: string,\n diagnostics: Diagnostics,\n): string | null {\n return (\n diagnostics.guard(\"storage.unavailable\", `The library could not read ${store}Storage.`, () =>\n stores[store]().getItem(key),\n ) ?? null\n );\n}\n\n/**\n * Writes a key-value pair to the local or session store. Reports a storage error to diagnostics.\n * @param stores Identity stores.\n * @param store Storage target (\"local\" or \"session\").\n * @param key Storage key.\n * @param value String value to store.\n * @param diagnostics Diagnostics reporter.\n */\nfunction safeWrite(\n stores: IdentityStores,\n store: \"local\" | \"session\",\n key: string,\n value: string,\n diagnostics: Diagnostics,\n): void {\n diagnostics.guard(\n \"storage.unavailable\",\n `The library could not write to ${store}Storage.`,\n () => {\n stores[store]().setItem(key, value);\n },\n );\n}\n\n/**\n * Reads the session id in the local store. It reports a record that is not valid JSON.\n * @param stores Identity stores.\n * @param diagnostics Diagnostics reporter.\n * @param now Epoch time in milliseconds.\n * @returns The stored id, or undefined when it is absent or expired.\n */\nfunction liveSession(\n stores: IdentityStores,\n diagnostics: Diagnostics,\n now: number,\n): string | undefined {\n const raw = safeRead(stores, \"local\", SESSION_ID_KEY, diagnostics);\n if (!raw) {\n return undefined;\n }\n\n try {\n const parsed = JSON.parse(raw) as { id?: string; lastSeenAt?: number };\n return parsed.id && now - (parsed.lastSeenAt ?? 0) < SESSION_IDLE_MS ? parsed.id : undefined;\n } catch {\n diagnostics.report(\n \"storage.degraded\",\n \"The session record is not valid JSON. The library starts a new session.\",\n );\n return undefined;\n }\n}\n\n/**\n * Resolves or initializes session, tab, and context identifiers for the active realm.\n * @param diagnostics Diagnostics reporter.\n * @param stores Identity stores.\n * @returns Populated Identity object.\n */\nexport function resolveIdentity(\n diagnostics: Diagnostics,\n stores: IdentityStores = BROWSER_STORES,\n): Identity {\n const contextId = newId(diagnostics);\n const now = Date.now();\n\n const minted = newId(diagnostics);\n const sessionId = liveSession(stores, diagnostics, now) ?? minted;\n const session = JSON.stringify({ id: sessionId, lastSeenAt: now });\n safeWrite(stores, \"local\", SESSION_ID_KEY, session, diagnostics);\n\n let tabId = safeRead(stores, \"session\", TAB_ID_KEY, diagnostics) ?? \"\";\n if (!tabId) {\n tabId = newId(diagnostics);\n safeWrite(stores, \"session\", TAB_ID_KEY, tabId, diagnostics);\n }\n\n return { sessionId, tabId, contextId };\n}\n\n/**\n * Writes a new tab id to the session store.\n * @param tabId New tab identifier.\n * @param diagnostics Diagnostics reporter.\n * @param stores Identity stores.\n */\nexport function persistTabId(\n tabId: string,\n diagnostics: Diagnostics,\n stores: IdentityStores,\n): void {\n safeWrite(stores, \"session\", TAB_ID_KEY, tabId, diagnostics);\n}\n\n/**\n * Writes the last-seen timestamp of the session. `SESSION_TOUCH_MS` sets the throttle.\n * The instance keeps the throttle state, not the module. Two runtimes in one document\n * must not block the session writes of each other.\n */\nexport class SessionTouch {\n /** Epoch milliseconds of the last write this instance made. */\n private lastTouchAt = 0;\n\n /**\n * @param diagnostics Diagnostics reporter.\n * @param stores Identity stores.\n */\n constructor(\n private diagnostics: Diagnostics,\n private readonly stores: IdentityStores = BROWSER_STORES,\n ) {}\n\n /**\n * Writes the session activity time to the local store. It writes one time in each throttle window.\n * @param sessionId Active session identifier.\n */\n touch(sessionId: string): void {\n const now = Date.now();\n\n if (now - this.lastTouchAt < SESSION_TOUCH_MS) {\n return;\n }\n\n // Another tab can hold a newer session, for example after newSession(). Do not write the old\n // id back. A reload would then resume the old session.\n const stored = liveSession(this.stores, this.diagnostics, now);\n if (stored !== undefined && stored !== sessionId) {\n this.lastTouchAt = now;\n return;\n }\n\n this.write(sessionId, now);\n }\n\n /**\n * Writes a new session id to the local store now. The throttle does not apply.\n * @param sessionId New session identifier.\n */\n restart(sessionId: string): void {\n this.write(sessionId, Date.now());\n }\n\n /**\n * Writes the session record and starts a new throttle window.\n * @param sessionId Session identifier.\n * @param now Epoch time in milliseconds.\n */\n private write(sessionId: string, now: number): void {\n this.lastTouchAt = now;\n const session = JSON.stringify({ id: sessionId, lastSeenAt: now });\n safeWrite(this.stores, \"local\", SESSION_ID_KEY, session, this.diagnostics);\n }\n}\n"],"mappings":"4CAwDA,IAAaG,EAAiC,CAC5C,UAAa,aACb,YAAe,cACjB,EAMA,SAAgBC,GAA+B,CAC7C,IAAMC,EAAQ,IAA6C,CACzD,QAAU,GAAQC,EAAI,IAAIC,CAAG,GAAK,KAClC,SAAU,EAAK,IAAU,CACvBD,EAAI,IAAIC,EAAKC,CAAK,CACpB,EACA,WAAa,GAAQ,CACnBF,EAAI,OAAOC,CAAG,CAChB,CACF,GAEME,EAAaJ,EAAK,IAAI,GAAK,EAC3BK,EAAeL,EAAK,IAAI,GAAK,EAEnC,MAAO,CAAE,UAAaI,EAAY,YAAeC,CAAa,CAChE,CAQA,SAAgBC,EAAU,EAA4B,CACpD,IAAMC,EAAQ,IAAI,WAAWC,CAAU,EACvC,GAAI,OAAO,OAAW,KAAe,OAAO,OAAO,iBAAoB,WACrE,OAAO,gBAAgBD,CAAK,OAE5B,IAAK,IAAIE,EAAI,EAAGA,EAAID,EAAY,IAC9B,EAAMC,GAAK,KAAK,MAAM,KAAK,OAAO,EAAA,GAAoB,EAG1D,OAAO,MAAM,KAAKF,EAAQ,GAAMG,EAAE,SAAS,E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K,GAMpE,OALKc,IACH,EAAQf,EAAMC,CAAW,EACzBI,EAAUD,EAAQ,UAAWnB,EAAAA,GAAY8B,EAAOd,CAAW,GAGtD,CAAE,YAAW,QAAO,WAAU,CACvC,CAQA,SAAgBe,EACd,EACA,EACA,EACM,CACNX,EAAUD,EAAQ,UAAWnB,EAAAA,GAAY8B,EAAOd,CAAW,CAC7D,CAOA,IAAagB,EAAb,KAA0B,CASd,YACS,OARnB,YAAsB,EAMtB,YACE,EACA,EAA0C9B,EAC1C,CAFQ,KAAA,YAAAc,EACS,KAAA,OAAAG,CAChB,CAMH,MAAM,EAAyB,CAC7B,IAAMK,EAAM,KAAK,IAAI,EAErB,GAAIA,EAAM,KAAK,YAAA,IACb,OAKF,IAAMS,EAASZ,EAAY,KAAK,OAAQ,KAAK,YAAaG,CAAG,EACzDS,IAAW,IAAA,IAAaA,IAAWL,EACrC,KAAK,YAAcJ,EAIrB,KAAK,MAAMI,EAAWJ,CAAG,CAC3B,CAMA,QAAQ,EAAyB,CAC/B,KAAK,MAAMI,EAAW,KAAK,IAAI,CAAC,CAClC,CAOA,MAAc,EAAmB,EAAmB,CAClD,KAAK,YAAcJ,EACnB,IAAMK,EAAU,KAAK,UAAU,CAAE,GAAID,EAAW,WAAYJ,CAAI,CAAC,EACjEJ,EAAU,KAAK,OAAQ,QAASrB,EAAAA,GAAgB8B,EAAS,KAAK,WAAW,CAC3E,CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { on as e, vn as t } from "./constants-L_d5YvvQ.js";
|
|
2
2
|
//#region src/utils/identity.ts
|
|
3
3
|
var n = {
|
|
4
4
|
local: () => localStorage,
|
|
@@ -41,39 +41,49 @@ function s(e, t, n, r, i) {
|
|
|
41
41
|
e[t]().setItem(n, r);
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
function c(
|
|
45
|
-
let
|
|
46
|
-
if (
|
|
47
|
-
let e = JSON.parse(
|
|
48
|
-
e.id &&
|
|
44
|
+
function c(t, n, r) {
|
|
45
|
+
let i = o(t, "local", e, n);
|
|
46
|
+
if (i) try {
|
|
47
|
+
let e = JSON.parse(i);
|
|
48
|
+
return e.id && r - (e.lastSeenAt ?? 0) < 18e5 ? e.id : void 0;
|
|
49
49
|
} catch {
|
|
50
|
-
|
|
50
|
+
n.report("storage.degraded", "The session record is not valid JSON. The library starts a new session.");
|
|
51
|
+
return;
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
}
|
|
54
|
+
function l(r, i = n) {
|
|
55
|
+
let l = a(r), u = Date.now(), d = a(r), f = c(i, r, u) ?? d, p = JSON.stringify({
|
|
56
|
+
id: f,
|
|
57
|
+
lastSeenAt: u
|
|
55
58
|
});
|
|
56
|
-
s(i, "local", e,
|
|
57
|
-
let
|
|
58
|
-
return
|
|
59
|
-
sessionId:
|
|
60
|
-
tabId:
|
|
61
|
-
contextId:
|
|
59
|
+
s(i, "local", e, p, r);
|
|
60
|
+
let m = o(i, "session", "ui-observability.tab", r) ?? "";
|
|
61
|
+
return m || (m = a(r), s(i, "session", t, m, r)), {
|
|
62
|
+
sessionId: f,
|
|
63
|
+
tabId: m,
|
|
64
|
+
contextId: l
|
|
62
65
|
};
|
|
63
66
|
}
|
|
64
|
-
function
|
|
67
|
+
function u(e, n, r) {
|
|
65
68
|
s(r, "session", t, e, n);
|
|
66
69
|
}
|
|
67
|
-
var
|
|
70
|
+
var d = class {
|
|
68
71
|
diagnostics;
|
|
69
72
|
stores;
|
|
70
73
|
lastTouchAt = 0;
|
|
71
74
|
constructor(e, t = n) {
|
|
72
75
|
this.diagnostics = e, this.stores = t;
|
|
73
76
|
}
|
|
74
|
-
touch(
|
|
75
|
-
let
|
|
76
|
-
if (
|
|
77
|
+
touch(e) {
|
|
78
|
+
let t = Date.now();
|
|
79
|
+
if (t - this.lastTouchAt < 6e4) return;
|
|
80
|
+
let n = c(this.stores, this.diagnostics, t);
|
|
81
|
+
n !== void 0 && n !== e ? this.lastTouchAt = t : this.write(e, t);
|
|
82
|
+
}
|
|
83
|
+
restart(e) {
|
|
84
|
+
this.write(e, Date.now());
|
|
85
|
+
}
|
|
86
|
+
write(t, n) {
|
|
77
87
|
this.lastTouchAt = n;
|
|
78
88
|
let r = JSON.stringify({
|
|
79
89
|
id: t,
|
|
@@ -83,6 +93,6 @@ var u = class {
|
|
|
83
93
|
}
|
|
84
94
|
};
|
|
85
95
|
//#endregion
|
|
86
|
-
export {
|
|
96
|
+
export { u as a, a as i, d as n, i as o, r, l as s, n as t };
|
|
87
97
|
|
|
88
|
-
//# sourceMappingURL=identity-
|
|
98
|
+
//# sourceMappingURL=identity-Dtv917nz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-Dtv917nz.js","names":["SESSION_ID_KEY","TAB_ID_KEY","BROWSER_STORES","memoryStores","wrap","map","key","value","localStore","sessionStore","randomHex","bytes","byteLength","i","b","newId","safeRead","diagnostics","store","stores","safeWrite","liveSession","raw","parsed","now","resolveIdentity","contextId","minted","sessionId","session","tabId","persistTabId","SessionTouch","stored"],"sources":["../src/utils/identity.ts"],"sourcesContent":["// src/utils/identity.ts\n//\n// Makes and keeps the session, tab, and context correlation identifiers. In a\n// sandboxed iframe and in private mode, Storage throws instead of returning null.\n// An unguarded read breaks the library at import.\n\nimport {\n BYTE_VALUE_COUNT,\n ID_BYTE_LENGTH,\n SESSION_ID_KEY,\n SESSION_IDLE_MS,\n SESSION_TOUCH_MS,\n TAB_ID_KEY,\n} from \"../constants\";\nimport type { Diagnostics } from \"../core/diagnostics\";\n\n/** Correlation identifiers attached to log records across session, tab, and realm scopes. */\nexport interface Identity {\n /** Origin-wide user session identifier surviving across tabs until idle expiration. */\n sessionId: string;\n /** Browser tab or desktop window identifier surviving document reloads. */\n tabId: string;\n /** Unique execution realm identifier regenerated on every document load. */\n contextId: string;\n}\n\n/** The three Storage methods that identity and journey code use. */\nexport interface KeyValueStore {\n /**\n * Reads one value.\n * @param key Storage key.\n * @returns Stored value, or null.\n */\n getItem(key: string): string | null;\n /**\n * Writes one value.\n * @param key Storage key.\n * @param value Value to write.\n */\n setItem(key: string, value: string): void;\n /**\n * Removes one value.\n * @param key Storage key.\n */\n removeItem(key: string): void;\n}\n\n/** Stores for identity and journey keys. A getter can throw in a sandboxed frame. */\nexport interface IdentityStores {\n /** Store that lasts across tabs and reloads. */\n local(): KeyValueStore;\n /** Store that lasts for one tab. */\n session(): KeyValueStore;\n}\n\n/** Stores that write to the browser. The `identity: \"storage\"` option uses them. */\nexport const BROWSER_STORES: IdentityStores = {\n local: () => localStorage,\n session: () => sessionStorage,\n};\n\n/**\n * Creates stores that keep values in memory only. The `identity: \"memory\"` option uses them.\n * @returns Stores that write nothing to the browser.\n */\nexport function memoryStores(): IdentityStores {\n const wrap = (map: Map<string, string>): KeyValueStore => ({\n getItem: (key) => map.get(key) ?? null,\n setItem: (key, value) => {\n map.set(key, value);\n },\n removeItem: (key) => {\n map.delete(key);\n },\n });\n\n const localStore = wrap(new Map());\n const sessionStore = wrap(new Map());\n\n return { local: () => localStore, session: () => sessionStore };\n}\n\n/**\n * Generates a random lowercase hexadecimal string of the specified byte length.\n * It uses crypto.getRandomValues when it is available. If not, it uses Math.random.\n * @param byteLength Number of random bytes to generate.\n * @returns Hexadecimal string of length byteLength * 2.\n */\nexport function randomHex(byteLength: number): string {\n const bytes = new Uint8Array(byteLength);\n if (typeof crypto !== \"undefined\" && typeof crypto.getRandomValues === \"function\") {\n crypto.getRandomValues(bytes);\n } else {\n for (let i = 0; i < byteLength; i++) {\n bytes[i] = Math.floor(Math.random() * BYTE_VALUE_COUNT);\n }\n }\n return Array.from(bytes, (b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\n/**\n * Generates a unique identifier string using crypto.randomUUID or randomHex fallback.\n * @param diagnostics Diagnostics reporter. It counts a blocked crypto.randomUUID call.\n * @returns UUID or random hex identifier.\n */\nexport function newId(diagnostics: Diagnostics): string {\n try {\n if (typeof crypto !== \"undefined\" && typeof crypto.randomUUID === \"function\") {\n return crypto.randomUUID();\n }\n } catch {\n // A sandbox can block crypto.randomUUID with a SecurityError. The method exists,\n // but the call throws. Count the fault. A report on each id is noise.\n diagnostics.count(\"platform.api_blocked\");\n }\n return randomHex(ID_BYTE_LENGTH);\n}\n\n/**\n * Reads a value from the local or session store. Reports a storage error to diagnostics.\n * @param stores Identity stores.\n * @param store Storage target (\"local\" or \"session\").\n * @param key Storage key.\n * @param diagnostics Diagnostics reporter.\n * @returns Stored string value or null if unreadable or absent.\n */\nfunction safeRead(\n stores: IdentityStores,\n store: \"local\" | \"session\",\n key: string,\n diagnostics: Diagnostics,\n): string | null {\n return (\n diagnostics.guard(\"storage.unavailable\", `The library could not read ${store}Storage.`, () =>\n stores[store]().getItem(key),\n ) ?? null\n );\n}\n\n/**\n * Writes a key-value pair to the local or session store. Reports a storage error to diagnostics.\n * @param stores Identity stores.\n * @param store Storage target (\"local\" or \"session\").\n * @param key Storage key.\n * @param value String value to store.\n * @param diagnostics Diagnostics reporter.\n */\nfunction safeWrite(\n stores: IdentityStores,\n store: \"local\" | \"session\",\n key: string,\n value: string,\n diagnostics: Diagnostics,\n): void {\n diagnostics.guard(\n \"storage.unavailable\",\n `The library could not write to ${store}Storage.`,\n () => {\n stores[store]().setItem(key, value);\n },\n );\n}\n\n/**\n * Reads the session id in the local store. It reports a record that is not valid JSON.\n * @param stores Identity stores.\n * @param diagnostics Diagnostics reporter.\n * @param now Epoch time in milliseconds.\n * @returns The stored id, or undefined when it is absent or expired.\n */\nfunction liveSession(\n stores: IdentityStores,\n diagnostics: Diagnostics,\n now: number,\n): string | undefined {\n const raw = safeRead(stores, \"local\", SESSION_ID_KEY, diagnostics);\n if (!raw) {\n return undefined;\n }\n\n try {\n const parsed = JSON.parse(raw) as { id?: string; lastSeenAt?: number };\n return parsed.id && now - (parsed.lastSeenAt ?? 0) < SESSION_IDLE_MS ? parsed.id : undefined;\n } catch {\n diagnostics.report(\n \"storage.degraded\",\n \"The session record is not valid JSON. The library starts a new session.\",\n );\n return undefined;\n }\n}\n\n/**\n * Resolves or initializes session, tab, and context identifiers for the active realm.\n * @param diagnostics Diagnostics reporter.\n * @param stores Identity stores.\n * @returns Populated Identity object.\n */\nexport function resolveIdentity(\n diagnostics: Diagnostics,\n stores: IdentityStores = BROWSER_STORES,\n): Identity {\n const contextId = newId(diagnostics);\n const now = Date.now();\n\n const minted = newId(diagnostics);\n const sessionId = liveSession(stores, diagnostics, now) ?? minted;\n const session = JSON.stringify({ id: sessionId, lastSeenAt: now });\n safeWrite(stores, \"local\", SESSION_ID_KEY, session, diagnostics);\n\n let tabId = safeRead(stores, \"session\", TAB_ID_KEY, diagnostics) ?? \"\";\n if (!tabId) {\n tabId = newId(diagnostics);\n safeWrite(stores, \"session\", TAB_ID_KEY, tabId, diagnostics);\n }\n\n return { sessionId, tabId, contextId };\n}\n\n/**\n * Writes a new tab id to the session store.\n * @param tabId New tab identifier.\n * @param diagnostics Diagnostics reporter.\n * @param stores Identity stores.\n */\nexport function persistTabId(\n tabId: string,\n diagnostics: Diagnostics,\n stores: IdentityStores,\n): void {\n safeWrite(stores, \"session\", TAB_ID_KEY, tabId, diagnostics);\n}\n\n/**\n * Writes the last-seen timestamp of the session. `SESSION_TOUCH_MS` sets the throttle.\n * The instance keeps the throttle state, not the module. Two runtimes in one document\n * must not block the session writes of each other.\n */\nexport class SessionTouch {\n /** Epoch milliseconds of the last write this instance made. */\n private lastTouchAt = 0;\n\n /**\n * @param diagnostics Diagnostics reporter.\n * @param stores Identity stores.\n */\n constructor(\n private diagnostics: Diagnostics,\n private readonly stores: IdentityStores = BROWSER_STORES,\n ) {}\n\n /**\n * Writes the session activity time to the local store. It writes one time in each throttle window.\n * @param sessionId Active session identifier.\n */\n touch(sessionId: string): void {\n const now = Date.now();\n\n if (now - this.lastTouchAt < SESSION_TOUCH_MS) {\n return;\n }\n\n // Another tab can hold a newer session, for example after newSession(). Do not write the old\n // id back. A reload would then resume the old session.\n const stored = liveSession(this.stores, this.diagnostics, now);\n if (stored !== undefined && stored !== sessionId) {\n this.lastTouchAt = now;\n return;\n }\n\n this.write(sessionId, now);\n }\n\n /**\n * Writes a new session id to the local store now. The throttle does not apply.\n * @param sessionId New session identifier.\n */\n restart(sessionId: string): void {\n this.write(sessionId, Date.now());\n }\n\n /**\n * Writes the session record and starts a new throttle window.\n * @param sessionId Session identifier.\n * @param now Epoch time in milliseconds.\n */\n private write(sessionId: string, now: number): void {\n this.lastTouchAt = now;\n const session = JSON.stringify({ id: sessionId, lastSeenAt: now });\n safeWrite(this.stores, \"local\", SESSION_ID_KEY, session, this.diagnostics);\n }\n}\n"],"mappings":";;AAwDA,IAAaE,IAAiC;CAC5C,aAAa;CACb,eAAe;AACjB;AAMA,SAAgBC,IAA+B;CAC7C,IAAMC,KAAQ,OAA6C;EACzD,UAAU,MAAQC,EAAI,IAAIC,CAAG,KAAK;EAClC,UAAU,GAAK,MAAU;GACvB,EAAI,IAAIA,GAAKC,CAAK;EACpB;EACA,aAAa,MAAQ;GACnB,EAAI,OAAOD,CAAG;EAChB;CACF,IAEME,IAAaJ,kBAAK,IAAI,IAAI,CAAC,GAC3BK,IAAeL,kBAAK,IAAI,IAAI,CAAC;CAEnC,OAAO;EAAE,aAAaI;EAAY,eAAeC;CAAa;AAChE;AAQA,SAAgBC,EAAU,GAA4B;CACpD,IAAMC,IAAQ,IAAI,WAAWC,CAAU;CACvC,IAAI,OAAO,SAAW,OAAe,OAAO,OAAO,mBAAoB,YACrE,OAAO,gBAAgBD,CAAK;MAE5B,KAAK,IAAIE,IAAI,GAAGA,IAAID,GAAY,KAC9B,EAAMC,KAAK,KAAK,MAAM,KAAK,OAAO,IAAA,GAAoB;CAG1D,OAAO,MAAM,KAAKF,IAAQ,MAAMG,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE;AAC1E;AAOA,SAAgBC,EAAM,GAA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