@corbado/observe 0.5.1 → 0.5.2

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/index.d.mts CHANGED
@@ -615,8 +615,12 @@ declare class CorbadoTracker {
615
615
  private sessionStorage;
616
616
  /** Dedicated localStorage engine for reliability state (config cache, outbox, continuity session, seq). */
617
617
  private persistentStorage;
618
- /** Boot snapshot of the reliability config; immutable for the lifetime of this page load. */
619
- private readonly config;
618
+ /**
619
+ * Reliability config for this load. A boot with a cached server config is a snapshot (immutable
620
+ * mid-load); a boot on the built-in defaults upgrades once to the first server-returned config
621
+ * (see {@link handleConfig}).
622
+ */
623
+ private config;
620
624
  private deviceInfoCollector;
621
625
  private deviceInfoDebounceTime;
622
626
  private deviceInfoTransmittedLastTime;
@@ -625,9 +629,11 @@ declare class CorbadoTracker {
625
629
  private experiments;
626
630
  constructor(options: TrackerOptions);
627
631
  /**
628
- * Cache fresh server config as last-known. Boot-snapshot model: the config is NOT applied to this
629
- * load `this.config` stays the construction-time snapshot it takes effect on the next page
630
- * load via {@link loadCachedConfig}.
632
+ * Cache fresh server config as last-known so the next page load boots with it. When this load
633
+ * booted on the built-in defaults (no cached config), the config is additionally applied live:
634
+ * every field is read at use time, and a mid-load `sessionContinuity` flip is safe because
635
+ * `nextSeq` adopts the in-memory session id into the empty continuity store instead of minting
636
+ * (no session split). A load that booted on a cached config keeps its snapshot untouched.
631
637
  */
632
638
  private handleConfig;
633
639
  /**
@@ -1011,9 +1017,10 @@ interface QueueOptions {
1011
1017
  flushInterval?: number;
1012
1018
  debug?: boolean;
1013
1019
  /**
1014
- * Reliability config snapshot for this page load; defaults to all-features-OFF. Boot-snapshot
1015
- * model: the queue never changes its behavior mid-load. A fresh config returned by the server is
1016
- * only handed to {@link QueueOptions.onConfigReceived} for caching and applies on the next load.
1020
+ * Reliability config for this page load; defaults to all-features-OFF. Boot-snapshot model: with
1021
+ * a cached config the queue never changes its behavior mid-load a fresh config returned by the
1022
+ * server is only handed to {@link QueueOptions.onConfigReceived} for caching and applies on the
1023
+ * next load. Only a defaults boot (no cached config) applies the first server config live.
1017
1024
  */
1018
1025
  config?: SdkReliabilityConfig;
1019
1026
  /** Called when the server returns a fresh config, so the client can cache it for the next load. */
@@ -1062,9 +1069,14 @@ declare class RequestQueue {
1062
1069
  private readonly debug;
1063
1070
  private readonly requestConfig;
1064
1071
  private readonly onConfigReceived?;
1065
- private readonly config;
1072
+ /**
1073
+ * Reliability config for this load. A boot with a cached server config is a snapshot that never
1074
+ * changes mid-load; a boot on the built-in defaults upgrades once to the first server-returned
1075
+ * config (see {@link handleConfigResponse}).
1076
+ */
1077
+ private config;
1066
1078
  /** Event names that trigger an immediate flush at enqueue time (config.flushOnEventNames). */
1067
- private readonly priorityNames;
1079
+ private priorityNames;
1068
1080
  private store?;
1069
1081
  /**
1070
1082
  * Once the server has answered the config request with a 2xx (200 = fresh config cached for the
@@ -1106,11 +1118,20 @@ declare class RequestQueue {
1106
1118
  private takeLows;
1107
1119
  private shouldRequestConfig;
1108
1120
  /**
1109
- * Handle the server's answer to the config request. Boot-snapshot model: a fresh config is ONLY
1110
- * handed to `onConfigReceived` for caching — it is never applied to this load. The behavior the
1111
- * queue was constructed with stays in effect until the page unloads.
1121
+ * Handle the server's answer to the config request. With a cached boot config the boot-snapshot
1122
+ * model applies: a fresh config is ONLY handed to `onConfigReceived` for caching and takes effect
1123
+ * on the next load. A load that booted on the built-in defaults (nothing cached) has no prior
1124
+ * behavior to stay coherent with — there the first server config is additionally applied live,
1125
+ * so cold-storage visits (first visit, cleared storage) don't run their whole load without the
1126
+ * reliability features.
1112
1127
  */
1113
1128
  private handleConfigResponse;
1129
+ /**
1130
+ * Switch this load from the built-in defaults to the first server config (defaults boot only).
1131
+ * Most fields are read at use time, so replacing the reference is enough; only the derived state
1132
+ * (priority-name set, durable outbox store) needs rebuilding.
1133
+ */
1134
+ private applyConfigLive;
1114
1135
  /** Returns true when the batch was acknowledged with a 2xx (safe to keep draining). */
1115
1136
  private handleSendResult;
1116
1137
  private isRetryable;
@@ -1188,9 +1209,10 @@ declare const CONFIG_BOUNDS: {
1188
1209
  declare const DEFAULT_SESSION_INACTIVITY_MS: number;
1189
1210
  /**
1190
1211
  * Default config: every delivery-reliability feature is OFF. The SDK behaves like a plain async
1191
- * fetch-keepalive flusher until the server returns config (which is then cached as last-known and
1192
- * applied on the NEXT page load boot-snapshot model). The empty version means "nothing cached";
1193
- * the config request header sends "1" in that case.
1212
+ * fetch-keepalive flusher until the server returns config, which is cached as last-known for the
1213
+ * next load AND applied live to the current load (a defaults boot has no prior config to stay
1214
+ * coherent with; loads booting on a cached config keep their snapshot boot-snapshot model). The
1215
+ * empty version means "nothing cached"; the config request header sends "1" in that case.
1194
1216
  */
1195
1217
  declare const DEFAULT_RELIABILITY_CONFIG: SdkReliabilityConfig;
1196
1218
  /**
package/dist/index.d.ts CHANGED
@@ -615,8 +615,12 @@ declare class CorbadoTracker {
615
615
  private sessionStorage;
616
616
  /** Dedicated localStorage engine for reliability state (config cache, outbox, continuity session, seq). */
617
617
  private persistentStorage;
618
- /** Boot snapshot of the reliability config; immutable for the lifetime of this page load. */
619
- private readonly config;
618
+ /**
619
+ * Reliability config for this load. A boot with a cached server config is a snapshot (immutable
620
+ * mid-load); a boot on the built-in defaults upgrades once to the first server-returned config
621
+ * (see {@link handleConfig}).
622
+ */
623
+ private config;
620
624
  private deviceInfoCollector;
621
625
  private deviceInfoDebounceTime;
622
626
  private deviceInfoTransmittedLastTime;
@@ -625,9 +629,11 @@ declare class CorbadoTracker {
625
629
  private experiments;
626
630
  constructor(options: TrackerOptions);
627
631
  /**
628
- * Cache fresh server config as last-known. Boot-snapshot model: the config is NOT applied to this
629
- * load `this.config` stays the construction-time snapshot it takes effect on the next page
630
- * load via {@link loadCachedConfig}.
632
+ * Cache fresh server config as last-known so the next page load boots with it. When this load
633
+ * booted on the built-in defaults (no cached config), the config is additionally applied live:
634
+ * every field is read at use time, and a mid-load `sessionContinuity` flip is safe because
635
+ * `nextSeq` adopts the in-memory session id into the empty continuity store instead of minting
636
+ * (no session split). A load that booted on a cached config keeps its snapshot untouched.
631
637
  */
632
638
  private handleConfig;
633
639
  /**
@@ -1011,9 +1017,10 @@ interface QueueOptions {
1011
1017
  flushInterval?: number;
1012
1018
  debug?: boolean;
1013
1019
  /**
1014
- * Reliability config snapshot for this page load; defaults to all-features-OFF. Boot-snapshot
1015
- * model: the queue never changes its behavior mid-load. A fresh config returned by the server is
1016
- * only handed to {@link QueueOptions.onConfigReceived} for caching and applies on the next load.
1020
+ * Reliability config for this page load; defaults to all-features-OFF. Boot-snapshot model: with
1021
+ * a cached config the queue never changes its behavior mid-load a fresh config returned by the
1022
+ * server is only handed to {@link QueueOptions.onConfigReceived} for caching and applies on the
1023
+ * next load. Only a defaults boot (no cached config) applies the first server config live.
1017
1024
  */
1018
1025
  config?: SdkReliabilityConfig;
1019
1026
  /** Called when the server returns a fresh config, so the client can cache it for the next load. */
@@ -1062,9 +1069,14 @@ declare class RequestQueue {
1062
1069
  private readonly debug;
1063
1070
  private readonly requestConfig;
1064
1071
  private readonly onConfigReceived?;
1065
- private readonly config;
1072
+ /**
1073
+ * Reliability config for this load. A boot with a cached server config is a snapshot that never
1074
+ * changes mid-load; a boot on the built-in defaults upgrades once to the first server-returned
1075
+ * config (see {@link handleConfigResponse}).
1076
+ */
1077
+ private config;
1066
1078
  /** Event names that trigger an immediate flush at enqueue time (config.flushOnEventNames). */
1067
- private readonly priorityNames;
1079
+ private priorityNames;
1068
1080
  private store?;
1069
1081
  /**
1070
1082
  * Once the server has answered the config request with a 2xx (200 = fresh config cached for the
@@ -1106,11 +1118,20 @@ declare class RequestQueue {
1106
1118
  private takeLows;
1107
1119
  private shouldRequestConfig;
1108
1120
  /**
1109
- * Handle the server's answer to the config request. Boot-snapshot model: a fresh config is ONLY
1110
- * handed to `onConfigReceived` for caching — it is never applied to this load. The behavior the
1111
- * queue was constructed with stays in effect until the page unloads.
1121
+ * Handle the server's answer to the config request. With a cached boot config the boot-snapshot
1122
+ * model applies: a fresh config is ONLY handed to `onConfigReceived` for caching and takes effect
1123
+ * on the next load. A load that booted on the built-in defaults (nothing cached) has no prior
1124
+ * behavior to stay coherent with — there the first server config is additionally applied live,
1125
+ * so cold-storage visits (first visit, cleared storage) don't run their whole load without the
1126
+ * reliability features.
1112
1127
  */
1113
1128
  private handleConfigResponse;
1129
+ /**
1130
+ * Switch this load from the built-in defaults to the first server config (defaults boot only).
1131
+ * Most fields are read at use time, so replacing the reference is enough; only the derived state
1132
+ * (priority-name set, durable outbox store) needs rebuilding.
1133
+ */
1134
+ private applyConfigLive;
1114
1135
  /** Returns true when the batch was acknowledged with a 2xx (safe to keep draining). */
1115
1136
  private handleSendResult;
1116
1137
  private isRetryable;
@@ -1188,9 +1209,10 @@ declare const CONFIG_BOUNDS: {
1188
1209
  declare const DEFAULT_SESSION_INACTIVITY_MS: number;
1189
1210
  /**
1190
1211
  * Default config: every delivery-reliability feature is OFF. The SDK behaves like a plain async
1191
- * fetch-keepalive flusher until the server returns config (which is then cached as last-known and
1192
- * applied on the NEXT page load boot-snapshot model). The empty version means "nothing cached";
1193
- * the config request header sends "1" in that case.
1212
+ * fetch-keepalive flusher until the server returns config, which is cached as last-known for the
1213
+ * next load AND applied live to the current load (a defaults boot has no prior config to stay
1214
+ * coherent with; loads booting on a cached config keep their snapshot boot-snapshot model). The
1215
+ * empty version means "nothing cached"; the config request header sends "1" in that case.
1194
1216
  */
1195
1217
  declare const DEFAULT_RELIABILITY_CONFIG: SdkReliabilityConfig;
1196
1218
  /**