@corbado/observe 1.4.0 → 1.5.1
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/dist/cdn/script.global.js +36 -5
- package/dist/index.d.mts +35 -18
- package/dist/index.d.ts +35 -18
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -560,20 +560,17 @@ interface SdkReliabilityConfig {
|
|
|
560
560
|
*/
|
|
561
561
|
flushOnFlowTypeFinished: FlowType[];
|
|
562
562
|
/**
|
|
563
|
-
*
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
* Read at collection time, so a config that arrives mid-load applies from the next device info
|
|
568
|
-
* refresh onward. The very first collection of a load booting on the built-in defaults (nothing
|
|
569
|
-
* cached) always runs on the default.
|
|
563
|
+
* @deprecated No effect since device info is collected with built-in deadlines (a fast snapshot
|
|
564
|
+
* within 300 ms, slower fields as a later update within 6000 ms). Still parsed so older server
|
|
565
|
+
* configs keep loading; the backend keeps serving it for older SDK versions.
|
|
570
566
|
*/
|
|
571
567
|
deviceInfoCollectorTimeoutMs: number;
|
|
572
568
|
/**
|
|
573
|
-
* When true (and `telemetry` is enabled),
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
*
|
|
569
|
+
* When true (and `telemetry` is enabled), device info collection emits `info` telemetry entries:
|
|
570
|
+
* the fast snapshot's total and per-field durations in milliseconds, the late fields' outcome, the
|
|
571
|
+
* `privateMode` source (cache age, detection duration or timeout) and how the update was delivered
|
|
572
|
+
* (or that it was left undelivered at pagehide / destroy). Defaults to false: this is a diagnostic
|
|
573
|
+
* stream to switch on while investigating slow collection, not something to run permanently.
|
|
577
574
|
*/
|
|
578
575
|
deviceInfoTiming: boolean;
|
|
579
576
|
/** Serialize explicitly supplied raw error diagnostics. Defaults to true; refreshes apply to subsequent errors. Already queued events are unchanged. */
|
|
@@ -1589,10 +1586,9 @@ interface TrackerOptions {
|
|
|
1589
1586
|
/** Minimum time between attaching cached device info to events. */
|
|
1590
1587
|
deviceInfoDebounceTime?: number;
|
|
1591
1588
|
/**
|
|
1592
|
-
* @deprecated
|
|
1593
|
-
*
|
|
1594
|
-
*
|
|
1595
|
-
* cached it wins. It will be removed in a future release.
|
|
1589
|
+
* @deprecated No effect: device info is collected with built-in deadlines (a fast snapshot within
|
|
1590
|
+
* 300 ms, slower fields as a later update within 6000 ms). Still accepted so existing integrations
|
|
1591
|
+
* keep compiling. It will be removed in a future release.
|
|
1596
1592
|
*/
|
|
1597
1593
|
deviceInfoCollectorTimeout?: number;
|
|
1598
1594
|
defaultTags?: Record<string, string>;
|
|
@@ -2094,6 +2090,17 @@ declare class CorbadoTracker {
|
|
|
2094
2090
|
logInfo(message: string): void;
|
|
2095
2091
|
/** Convenience wrapper for {@link CorbadoTracker.telemetry} at `error` level. */
|
|
2096
2092
|
logError(message: string): void;
|
|
2093
|
+
/**
|
|
2094
|
+
* Queue hook run right before an event batch is sent: a device info snapshot that no event carried
|
|
2095
|
+
* yet (typically the fast snapshot after a burst of events at page load, or the privateMode update)
|
|
2096
|
+
* rides the first event of this page in the batch that has none. Events of other pages (outbox
|
|
2097
|
+
* replays) are never touched, and nothing is sent just for device info. When the page goes away
|
|
2098
|
+
* with a snapshot nothing could carry, that is reported (timing diagnostics only).
|
|
2099
|
+
*
|
|
2100
|
+
* Error situations:
|
|
2101
|
+
* - Any error: log "Failed to attach device info to batch" and send the batch unchanged
|
|
2102
|
+
*/
|
|
2103
|
+
private attachUndeliveredDeviceInfo;
|
|
2097
2104
|
/**
|
|
2098
2105
|
* Escalate an internal SDK diagnostic to the telemetry stream (self-instrumentation). This is the
|
|
2099
2106
|
* sink behind {@link Logger.reportTelemetry}; chosen internal failure sites route here so faults
|
|
@@ -2382,6 +2389,14 @@ interface QueueOptions {
|
|
|
2382
2389
|
* none has ever been set. Read at send time so a change applies to the next batch without a flush.
|
|
2383
2390
|
*/
|
|
2384
2391
|
getDataPolicy?: () => number | undefined;
|
|
2392
|
+
/**
|
|
2393
|
+
* Called with the events of every event batch right before it is sent (async and unload flushes),
|
|
2394
|
+
* before the batch's telemetry is taken. The tracker uses it to attach a device info snapshot that
|
|
2395
|
+
* no event carried yet to an event of the current page. It may mutate the events; the in-memory
|
|
2396
|
+
* pending entries share them, so a retry on this page keeps the change. Never called for batches
|
|
2397
|
+
* without events.
|
|
2398
|
+
*/
|
|
2399
|
+
beforeEventBatchSend?: (events: Event[], reason: FlushReason) => void;
|
|
2385
2400
|
}
|
|
2386
2401
|
/**
|
|
2387
2402
|
* @remarks When `window` is defined, `visibilitychange` (when the document becomes hidden) and `pagehide`
|
|
@@ -2446,6 +2461,7 @@ declare class RequestQueue {
|
|
|
2446
2461
|
private readonly requestConfig;
|
|
2447
2462
|
private readonly onConfigReceived?;
|
|
2448
2463
|
private readonly getDataPolicy?;
|
|
2464
|
+
private readonly beforeEventBatchSend?;
|
|
2449
2465
|
/** Current delivery policy, including live updates. */
|
|
2450
2466
|
private config;
|
|
2451
2467
|
/**
|
|
@@ -2545,6 +2561,8 @@ declare class RequestQueue {
|
|
|
2545
2561
|
* The transport later merges in `sent`/`transport`.
|
|
2546
2562
|
*/
|
|
2547
2563
|
private attachBatchMeta;
|
|
2564
|
+
/** Run the beforeEventBatchSend hook; a throwing hook must never break a flush. */
|
|
2565
|
+
private prepareEvents;
|
|
2548
2566
|
/** The data policy code from the tracker, or undefined; a throwing getter must never break a flush. */
|
|
2549
2567
|
private readDataPolicy;
|
|
2550
2568
|
private getDuePending;
|
|
@@ -2621,9 +2639,8 @@ declare const CONFIG_REQUEST_HEADER = "X-Corbado-Observe-Config";
|
|
|
2621
2639
|
declare const DEFAULT_FLUSH_INTERVAL_MS = 500;
|
|
2622
2640
|
declare const DEFAULT_SEQ_LOCK_TIMEOUT_MS = 50;
|
|
2623
2641
|
/**
|
|
2624
|
-
*
|
|
2625
|
-
*
|
|
2626
|
-
* response can arrive — generous enough that a slow-but-working browser API still answers.
|
|
2642
|
+
* Default of the deprecated `deviceInfoCollectorTimeoutMs` config field. Only parsed for config
|
|
2643
|
+
* compatibility: device info collection uses its own built-in deadlines (see `device.ts`).
|
|
2627
2644
|
*/
|
|
2628
2645
|
declare const DEFAULT_DEVICE_INFO_COLLECTOR_TIMEOUT_MS = 1000;
|
|
2629
2646
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -560,20 +560,17 @@ interface SdkReliabilityConfig {
|
|
|
560
560
|
*/
|
|
561
561
|
flushOnFlowTypeFinished: FlowType[];
|
|
562
562
|
/**
|
|
563
|
-
*
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
*
|
|
567
|
-
* Read at collection time, so a config that arrives mid-load applies from the next device info
|
|
568
|
-
* refresh onward. The very first collection of a load booting on the built-in defaults (nothing
|
|
569
|
-
* cached) always runs on the default.
|
|
563
|
+
* @deprecated No effect since device info is collected with built-in deadlines (a fast snapshot
|
|
564
|
+
* within 300 ms, slower fields as a later update within 6000 ms). Still parsed so older server
|
|
565
|
+
* configs keep loading; the backend keeps serving it for older SDK versions.
|
|
570
566
|
*/
|
|
571
567
|
deviceInfoCollectorTimeoutMs: number;
|
|
572
568
|
/**
|
|
573
|
-
* When true (and `telemetry` is enabled),
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
*
|
|
569
|
+
* When true (and `telemetry` is enabled), device info collection emits `info` telemetry entries:
|
|
570
|
+
* the fast snapshot's total and per-field durations in milliseconds, the late fields' outcome, the
|
|
571
|
+
* `privateMode` source (cache age, detection duration or timeout) and how the update was delivered
|
|
572
|
+
* (or that it was left undelivered at pagehide / destroy). Defaults to false: this is a diagnostic
|
|
573
|
+
* stream to switch on while investigating slow collection, not something to run permanently.
|
|
577
574
|
*/
|
|
578
575
|
deviceInfoTiming: boolean;
|
|
579
576
|
/** Serialize explicitly supplied raw error diagnostics. Defaults to true; refreshes apply to subsequent errors. Already queued events are unchanged. */
|
|
@@ -1589,10 +1586,9 @@ interface TrackerOptions {
|
|
|
1589
1586
|
/** Minimum time between attaching cached device info to events. */
|
|
1590
1587
|
deviceInfoDebounceTime?: number;
|
|
1591
1588
|
/**
|
|
1592
|
-
* @deprecated
|
|
1593
|
-
*
|
|
1594
|
-
*
|
|
1595
|
-
* cached it wins. It will be removed in a future release.
|
|
1589
|
+
* @deprecated No effect: device info is collected with built-in deadlines (a fast snapshot within
|
|
1590
|
+
* 300 ms, slower fields as a later update within 6000 ms). Still accepted so existing integrations
|
|
1591
|
+
* keep compiling. It will be removed in a future release.
|
|
1596
1592
|
*/
|
|
1597
1593
|
deviceInfoCollectorTimeout?: number;
|
|
1598
1594
|
defaultTags?: Record<string, string>;
|
|
@@ -2094,6 +2090,17 @@ declare class CorbadoTracker {
|
|
|
2094
2090
|
logInfo(message: string): void;
|
|
2095
2091
|
/** Convenience wrapper for {@link CorbadoTracker.telemetry} at `error` level. */
|
|
2096
2092
|
logError(message: string): void;
|
|
2093
|
+
/**
|
|
2094
|
+
* Queue hook run right before an event batch is sent: a device info snapshot that no event carried
|
|
2095
|
+
* yet (typically the fast snapshot after a burst of events at page load, or the privateMode update)
|
|
2096
|
+
* rides the first event of this page in the batch that has none. Events of other pages (outbox
|
|
2097
|
+
* replays) are never touched, and nothing is sent just for device info. When the page goes away
|
|
2098
|
+
* with a snapshot nothing could carry, that is reported (timing diagnostics only).
|
|
2099
|
+
*
|
|
2100
|
+
* Error situations:
|
|
2101
|
+
* - Any error: log "Failed to attach device info to batch" and send the batch unchanged
|
|
2102
|
+
*/
|
|
2103
|
+
private attachUndeliveredDeviceInfo;
|
|
2097
2104
|
/**
|
|
2098
2105
|
* Escalate an internal SDK diagnostic to the telemetry stream (self-instrumentation). This is the
|
|
2099
2106
|
* sink behind {@link Logger.reportTelemetry}; chosen internal failure sites route here so faults
|
|
@@ -2382,6 +2389,14 @@ interface QueueOptions {
|
|
|
2382
2389
|
* none has ever been set. Read at send time so a change applies to the next batch without a flush.
|
|
2383
2390
|
*/
|
|
2384
2391
|
getDataPolicy?: () => number | undefined;
|
|
2392
|
+
/**
|
|
2393
|
+
* Called with the events of every event batch right before it is sent (async and unload flushes),
|
|
2394
|
+
* before the batch's telemetry is taken. The tracker uses it to attach a device info snapshot that
|
|
2395
|
+
* no event carried yet to an event of the current page. It may mutate the events; the in-memory
|
|
2396
|
+
* pending entries share them, so a retry on this page keeps the change. Never called for batches
|
|
2397
|
+
* without events.
|
|
2398
|
+
*/
|
|
2399
|
+
beforeEventBatchSend?: (events: Event[], reason: FlushReason) => void;
|
|
2385
2400
|
}
|
|
2386
2401
|
/**
|
|
2387
2402
|
* @remarks When `window` is defined, `visibilitychange` (when the document becomes hidden) and `pagehide`
|
|
@@ -2446,6 +2461,7 @@ declare class RequestQueue {
|
|
|
2446
2461
|
private readonly requestConfig;
|
|
2447
2462
|
private readonly onConfigReceived?;
|
|
2448
2463
|
private readonly getDataPolicy?;
|
|
2464
|
+
private readonly beforeEventBatchSend?;
|
|
2449
2465
|
/** Current delivery policy, including live updates. */
|
|
2450
2466
|
private config;
|
|
2451
2467
|
/**
|
|
@@ -2545,6 +2561,8 @@ declare class RequestQueue {
|
|
|
2545
2561
|
* The transport later merges in `sent`/`transport`.
|
|
2546
2562
|
*/
|
|
2547
2563
|
private attachBatchMeta;
|
|
2564
|
+
/** Run the beforeEventBatchSend hook; a throwing hook must never break a flush. */
|
|
2565
|
+
private prepareEvents;
|
|
2548
2566
|
/** The data policy code from the tracker, or undefined; a throwing getter must never break a flush. */
|
|
2549
2567
|
private readDataPolicy;
|
|
2550
2568
|
private getDuePending;
|
|
@@ -2621,9 +2639,8 @@ declare const CONFIG_REQUEST_HEADER = "X-Corbado-Observe-Config";
|
|
|
2621
2639
|
declare const DEFAULT_FLUSH_INTERVAL_MS = 500;
|
|
2622
2640
|
declare const DEFAULT_SEQ_LOCK_TIMEOUT_MS = 50;
|
|
2623
2641
|
/**
|
|
2624
|
-
*
|
|
2625
|
-
*
|
|
2626
|
-
* response can arrive — generous enough that a slow-but-working browser API still answers.
|
|
2642
|
+
* Default of the deprecated `deviceInfoCollectorTimeoutMs` config field. Only parsed for config
|
|
2643
|
+
* compatibility: device info collection uses its own built-in deadlines (see `device.ts`).
|
|
2627
2644
|
*/
|
|
2628
2645
|
declare const DEFAULT_DEVICE_INFO_COLLECTOR_TIMEOUT_MS = 1000;
|
|
2629
2646
|
/**
|