tsdf 17.0.0-alpha.14 → 17.0.0-alpha.15

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.
@@ -1,2 +1,2 @@
1
- import { t as createAsyncStorageAdapter } from "./asyncStorageAdapter-C1ouzZYD.js";
1
+ import { t as createAsyncStorageAdapter } from "./asyncStorageAdapter-DgbL6kBV.js";
2
2
  export { createAsyncStorageAdapter };
@@ -1,2 +1,2 @@
1
- import { i as createAsyncStorageAdapter } from "./asyncStorageAdapter-B1kF0Ojl.js";
1
+ import { i as createAsyncStorageAdapter } from "./asyncStorageAdapter-B-pdNeAs.js";
2
2
  export { createAsyncStorageAdapter };
@@ -433,7 +433,7 @@ function getTSDFDebugTimingMs() {
433
433
  //#endregion
434
434
  //#region src/persistentStorage/quotaDebug.ts
435
435
  function logPersistentStorageQuotaCleanup(args) {
436
- emitTSDFDebugLog(args.prodLogger, {
436
+ emitTSDFDebugLog(args.logger, {
437
437
  area: "persistent-storage",
438
438
  details: {
439
439
  adapter: args.adapter,
@@ -888,7 +888,7 @@ var ManagedAsyncStorageAdapter = class {
888
888
  kind = "async";
889
889
  #driver;
890
890
  #debugLogger;
891
- #prodLogger;
891
+ #logger;
892
892
  #cachedNamespaceIndexReads = createCache({ maxCacheSize: ASYNC_STORAGE_NAMESPACE_INDEX_CACHE_MAX_SIZE });
893
893
  #cachedPayloadReads = createCache({ maxCacheSize: ASYNC_STORAGE_PAYLOAD_CACHE_MAX_SIZE });
894
894
  #namespaceReadCacheGenerations = /* @__PURE__ */ new Map();
@@ -908,12 +908,12 @@ var ManagedAsyncStorageAdapter = class {
908
908
  this.#debugLogger = debugLogger;
909
909
  this.#driver.debugLogger = debugLogger;
910
910
  }
911
- get prodLogger() {
912
- return this.#prodLogger;
911
+ get logger() {
912
+ return this.#logger;
913
913
  }
914
- set prodLogger(prodLogger) {
915
- this.#prodLogger = prodLogger;
916
- this.#driver.prodLogger = prodLogger;
914
+ set logger(logger) {
915
+ this.#logger = logger;
916
+ this.#driver.logger = logger;
917
917
  }
918
918
  async #runWithSessionWriterLock(sessionKey, callback) {
919
919
  return runWithNavigatorLock(`${ASYNC_STORAGE_WRITER_LOCK_NAME_PREFIX}${sessionKey}`, ASYNC_STORAGE_WRITER_LOCK_WARNING, callback);
@@ -1831,13 +1831,13 @@ var ManagedAsyncStorageAdapter = class {
1831
1831
  if (effectiveStaticPolicy?.maxBytes !== void 0) {
1832
1832
  const pinnedKeys = new Set(effectiveStaticPolicy.pinnedKeys ?? []);
1833
1833
  const { keptKeys, unprotectedBytes } = keepEntriesWithinByteBudget(candidateEntries, (entry) => entry.itemKey, (entry) => entry.lastAccessAt, (entry) => entry.sizeBytes, (entry) => pinnedKeys.has(entry.itemKey), (entry) => entry.protected, effectiveStaticPolicy.maxBytes);
1834
- const prodLogger = args.driver.prodLogger;
1834
+ const logger = args.driver.logger;
1835
1835
  const evictedEntries = candidateEntries.length - keptKeys.size;
1836
- if (prodLogger && evictedEntries > 0) {
1836
+ if (logger && evictedEntries > 0) {
1837
1837
  const scopeKind = args.scope.kind;
1838
1838
  logPersistentStorageQuotaCleanup({
1839
1839
  adapter: "async",
1840
- prodLogger,
1840
+ logger,
1841
1841
  evictedEntries,
1842
1842
  keptEntries: keptKeys.size,
1843
1843
  maxBytes: effectiveStaticPolicy.maxBytes,
@@ -1,4 +1,4 @@
1
- import { r as AsyncStorageDriver, t as AsyncStorageAdapter } from "./types-hwf0jXKv.js";
1
+ import { r as AsyncStorageDriver, t as AsyncStorageAdapter } from "./types-CtltNSyd.js";
2
2
 
3
3
  //#region src/persistentStorage/asyncStorageAdapter.d.ts
4
4
  declare function createAsyncStorageAdapter(driver: AsyncStorageDriver): AsyncStorageAdapter;
@@ -1,3 +1,3 @@
1
- import { t as opfsPersistentStorage } from "./opfsPersistentStorage-DcODOOJk.js";
2
- import { n as indexedDbPersistentStorage } from "./indexedDbPersistentStorage-BMgsTNPP.js";
1
+ import { t as opfsPersistentStorage } from "./opfsPersistentStorage-DobQJr0X.js";
2
+ import { n as indexedDbPersistentStorage } from "./indexedDbPersistentStorage-D35uqEXv.js";
3
3
  export { indexedDbPersistentStorage, opfsPersistentStorage };
@@ -1,4 +1,4 @@
1
- import { t as AsyncStorageAdapter } from "./types-hwf0jXKv.js";
1
+ import { t as AsyncStorageAdapter } from "./types-CtltNSyd.js";
2
2
  //#region src/persistentStorage/indexedDbAsyncStorageAdapter.d.ts
3
3
  /** Options for creating the IndexedDB persistent storage adapter. */
4
4
  type IndexedDbPersistentStorageOptions$1 = {
@@ -1,2 +1,2 @@
1
- import { n as indexedDbPersistentStorage, t as createIndexedDbPersistentStorage } from "./indexedDbPersistentStorage-BMgsTNPP.js";
1
+ import { n as indexedDbPersistentStorage, t as createIndexedDbPersistentStorage } from "./indexedDbPersistentStorage-D35uqEXv.js";
2
2
  export { createIndexedDbPersistentStorage, indexedDbPersistentStorage };
@@ -1,4 +1,4 @@
1
- import { B as getNamespaceId, G as parsePersistedAsyncNamespaceKind, H as getPersistedNamespaceId, K as serializeProtectedRef, R as compareMetadata, S as serializeJsonForStorage, U as normalizeStaticPolicy, V as getPayloadRecordKey, W as parseAsyncStorageRecordKey, a as estimateManagedAsyncStorageEntrySizeBytes, h as getTSDFDebugTimingMs, i as createAsyncStorageAdapter, m as emitTSDFDebugLog, z as encodePersistedAsyncNamespaceKind } from "./asyncStorageAdapter-B1kF0Ojl.js";
1
+ import { B as getNamespaceId, G as parsePersistedAsyncNamespaceKind, H as getPersistedNamespaceId, K as serializeProtectedRef, R as compareMetadata, S as serializeJsonForStorage, U as normalizeStaticPolicy, V as getPayloadRecordKey, W as parseAsyncStorageRecordKey, a as estimateManagedAsyncStorageEntrySizeBytes, h as getTSDFDebugTimingMs, i as createAsyncStorageAdapter, m as emitTSDFDebugLog, z as encodePersistedAsyncNamespaceKind } from "./asyncStorageAdapter-B-pdNeAs.js";
2
2
  import { __LEGIT_CAST__ } from "@ls-stack/utils/saferTyping";
3
3
  import { isObject } from "@ls-stack/utils/typeGuards";
4
4
  //#region src/persistentStorage/indexedDbAsyncStorageAdapter.ts
package/dist/main.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as OfflineResolutionRecord, A as DefineListQueryOfflineOperations, At as PayloadDebounce, B as OfflineEntityMutationKind, Bt as mutationSkipped, C as PersistentStorageSchema, Ct as OfflineUploadAdapter, D as CollectionOfflineOperationDefinition, Dt as OfflineUploadTransportContext, E as CollectionOfflineEntityRef, Et as OfflineUploadState, F as ListQueryOfflineEntityRef, Ft as TSDFStatus, G as OfflineMutationQueueingPolicy, Gt as ScheduleFetchResults, H as OfflineMutationInput, Ht as RequestSchedulerEventData, I as ListQueryOfflineOperationDefinition, It as UnwrapTSDFResult, J as OfflineReplayRetryConfig, Jt as TSDFDebugLogLevel, K as OfflineOperationKind, Kt as TSDFDebugLogArea, L as OfflineAccumulationConfig, Lt as ValidPayload, M as DocumentOfflineOperationDefinition, Mt as StoreFetchError, N as GlobalOfflineEntity, Nt as StoreMutationError, O as DefineCollectionOfflineOperations, Ot as MaybeTSDFResult, P as GlobalOfflineStatus, Pt as StoreMutationErrorOptions, Q as OfflineResolutionConflictParseErrorCode, R as OfflineAccumulationMergeContext, Rt as ValidStoreState, S as PersistentStoragePreloadResult, St as OfflineUpload, T as AnyOfflineOperationDefinition, Tt as OfflineUploadSource, U as OfflineMutationQueueingCause, Ut as RequestSchedulerEvents, V as OfflineMutationDescriptor, Vt as FetchType, W as OfflineMutationQueueingConfig, Wt as ScheduleFetchOptions, X as OfflineResolutionActionForOperation, Xt as TSDFFocusDebugOperation, Y as OfflineResolutionAction, Yt as TSDFDebugLogger, Z as OfflineResolutionConflictParseError, Zt as TSDFLoggerOptions, _ as ListQueryOfflineOperationsConfig, _t as defaultOfflineRuntimeConfig, a as AsyncStorageMetadataOrder, at as OfflineSession, b as PersistentStorageDataSchema, bt as OfflineSessionUploadsConfig, c as AsyncStorageNamespaceCommitUpsert, ct as OfflineSyncState, d as AsyncStorageNamespaceKind, dt as OfflineTempEntityConfig, et as OfflineResolutionRecordForOperation, f as AsyncStorageNamespaceScope, ft as OfflineTempEntityPendingEntry, g as DocumentPersistentStorageConfig, gt as ParsedOfflineResolutionConflictResultForStore, h as ConvertedPersistentStorageDataSchema, ht as ParsedOfflineResolutionConflictResultForOperation, i as AsyncStorageDriverSetEntry, it as OfflineRuntimeConfigUpdate, j as DefineOfflineOperation, jt as StoreError, k as DefineDocumentOfflineOperations, kt as MutationSkipped, l as AsyncStorageNamespaceGetResult, lt as OfflineTempEntitiesConfig, m as CollectionPersistentStorageConfig, mt as OperationResult, n as AsyncStorageDiscoveredScope, nt as OfflineRetryExhaustedResolutionAction, o as AsyncStorageNamespaceCommitArgs, ot as OfflineSessionConfig, p as AsyncStorageReadOptions, pt as OperationConflict, q as OfflineQueueEntry, qt as TSDFDebugLogEntry, r as AsyncStorageDriver, rt as OfflineRuntimeConfig, s as AsyncStorageNamespaceCommitTouch, st as OfflineSupersedeConfig, t as AsyncStorageAdapter, tt as OfflineResolutionRecordForStore, u as AsyncStorageNamespaceHandle, ut as OfflineTempEntitiesReconciliation, v as ListQueryPersistentStorageConfig, vt as OfflineMutationUploadsInput, w as StorageAdapter, wt as OfflineUploadProgress, x as PersistentStorageErrorHandler, xt as OfflineStoredUploadRecord, y as PersistentStorageBaseConfig, yt as OfflineOperationUploadsContext, z as OfflineConflictResolutionAction, zt as fetchTypePriority } from "./types-hwf0jXKv.js";
1
+ import { $ as OfflineResolutionRecord, A as DefineListQueryOfflineOperations, At as PayloadDebounce, B as OfflineEntityMutationKind, Bt as mutationSkipped, C as PersistentStorageSchema, Ct as OfflineUploadAdapter, D as CollectionOfflineOperationDefinition, Dt as OfflineUploadTransportContext, E as CollectionOfflineEntityRef, Et as OfflineUploadState, F as ListQueryOfflineEntityRef, Ft as TSDFStatus, G as OfflineMutationQueueingPolicy, Gt as ScheduleFetchResults, H as OfflineMutationInput, Ht as RequestSchedulerEventData, I as ListQueryOfflineOperationDefinition, It as UnwrapTSDFResult, J as OfflineReplayRetryConfig, Jt as TSDFDebugLogLevel, K as OfflineOperationKind, Kt as TSDFDebugLogArea, L as OfflineAccumulationConfig, Lt as ValidPayload, M as DocumentOfflineOperationDefinition, Mt as StoreFetchError, N as GlobalOfflineEntity, Nt as StoreMutationError, O as DefineCollectionOfflineOperations, Ot as MaybeTSDFResult, P as GlobalOfflineStatus, Pt as StoreMutationErrorOptions, Q as OfflineResolutionConflictParseErrorCode, R as OfflineAccumulationMergeContext, Rt as ValidStoreState, S as PersistentStoragePreloadResult, St as OfflineUpload, T as AnyOfflineOperationDefinition, Tt as OfflineUploadSource, U as OfflineMutationQueueingCause, Ut as RequestSchedulerEvents, V as OfflineMutationDescriptor, Vt as FetchType, W as OfflineMutationQueueingConfig, Wt as ScheduleFetchOptions, X as OfflineResolutionActionForOperation, Xt as TSDFFocusDebugOperation, Y as OfflineResolutionAction, Yt as TSDFDebugLogger, Z as OfflineResolutionConflictParseError, Zt as TSDFLoggerOptions, _ as ListQueryOfflineOperationsConfig, _t as defaultOfflineRuntimeConfig, a as AsyncStorageMetadataOrder, at as OfflineSession, b as PersistentStorageDataSchema, bt as OfflineSessionUploadsConfig, c as AsyncStorageNamespaceCommitUpsert, ct as OfflineSyncState, d as AsyncStorageNamespaceKind, dt as OfflineTempEntityConfig, et as OfflineResolutionRecordForOperation, f as AsyncStorageNamespaceScope, ft as OfflineTempEntityPendingEntry, g as DocumentPersistentStorageConfig, gt as ParsedOfflineResolutionConflictResultForStore, h as ConvertedPersistentStorageDataSchema, ht as ParsedOfflineResolutionConflictResultForOperation, i as AsyncStorageDriverSetEntry, it as OfflineRuntimeConfigUpdate, j as DefineOfflineOperation, jt as StoreError, k as DefineDocumentOfflineOperations, kt as MutationSkipped, l as AsyncStorageNamespaceGetResult, lt as OfflineTempEntitiesConfig, m as CollectionPersistentStorageConfig, mt as OperationResult, n as AsyncStorageDiscoveredScope, nt as OfflineRetryExhaustedResolutionAction, o as AsyncStorageNamespaceCommitArgs, ot as OfflineSessionConfig, p as AsyncStorageReadOptions, pt as OperationConflict, q as OfflineQueueEntry, qt as TSDFDebugLogEntry, r as AsyncStorageDriver, rt as OfflineRuntimeConfig, s as AsyncStorageNamespaceCommitTouch, st as OfflineSupersedeConfig, t as AsyncStorageAdapter, tt as OfflineResolutionRecordForStore, u as AsyncStorageNamespaceHandle, ut as OfflineTempEntitiesReconciliation, v as ListQueryPersistentStorageConfig, vt as OfflineMutationUploadsInput, w as StorageAdapter, wt as OfflineUploadProgress, x as PersistentStorageErrorHandler, xt as OfflineStoredUploadRecord, y as PersistentStorageBaseConfig, yt as OfflineOperationUploadsContext, z as OfflineConflictResolutionAction, zt as fetchTypePriority } from "./types-CtltNSyd.js";
2
2
  import { __LEGIT_ANY__ } from "@ls-stack/utils/saferTyping";
3
3
  import { Emitter } from "evtmitter";
4
4
  import { Context } from "react";
@@ -75,7 +75,7 @@ type StoreManagerOfflineApi<TUploadRef extends ValidPayload = ValidPayload> = {
75
75
  type StoreManager<TUploadRef extends ValidPayload = ValidPayload> = {
76
76
  /** Returns the active shared session / tenant key. */getSessionKey: () => string | false; /** Shared debug logger for browser-tab sync, focus lifecycle, and persistent storage internals. */
77
77
  debugLogger?: TSDFDebugLogger; /** Shared logger for low-volume production signals. */
78
- prodLogger?: TSDFDebugLogger; /** Normalizes raw exceptions into the shared StoreError shape. */
78
+ logger?: TSDFDebugLogger; /** Normalizes raw exceptions into the shared StoreError shape. */
79
79
  errorNormalizer: (exception: Error) => StoreError; /** Global fallback for persistent storage failures in attached stores. */
80
80
  onPersistentStorageError: PersistentStorageErrorHandler | undefined; /** Global fallback for mutation failures in attached stores. */
81
81
  onMutationError: StoreManagerMutationErrorHandler | undefined; /** Shared defaults used by attached stores unless a store-level override exists. */
@@ -101,8 +101,8 @@ type CreateStoreManagerOptions<TUploadRef extends ValidPayload = ValidPayload> =
101
101
  onPersistentStorageError?: PersistentStorageErrorHandler; /** Global fallback for mutation failures when a store does not provide its own handler. */
102
102
  onMutationError?: StoreManagerMutationErrorHandler; /** Default focus revalidation policy for attached stores. Store-level values override it. */
103
103
  revalidateOnWindowFocus?: boolean | (() => boolean); /** Enables verbose development-only logs. Pass `true` to use console logging, or pass a logger function. */
104
- debugLogger?: TSDFLoggerOptions; /** Enables low-volume production-safe logs. Pass `true` to use console logging, or pass a logger function. */
105
- prodLogger?: TSDFLoggerOptions; /** Optional shared offline session config for every attached store. */
104
+ debugLogger?: TSDFLoggerOptions; /** Enables low-volume production-safe logs. Defaults to console logging; pass `false` to disable. */
105
+ logger?: TSDFLoggerOptions; /** Optional shared offline session config for every attached store. */
106
106
  offlineSession?: OfflineSessionConfig<TUploadRef>;
107
107
  };
108
108
  declare function createStoreManager<TUploadRef extends ValidPayload = ValidPayload>(options: CreateStoreManagerOptions<TUploadRef>): StoreManager<TUploadRef>;
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
- import { A as offlineResolutionRecordSchema, C as OfflineResolutionConflictParseError, D as isModeEffectivelyActive, E as getIsOfflineModeFromStatus, F as warnIfNavigatorLockUnavailable, G as parsePersistedAsyncNamespaceKind, I as createCompactLocalStorageEntry, K as serializeProtectedRef, L as parseCompactLocalStorageEntry, M as getSessionProtectedKeysSnapshot, N as setSessionProtectedKeysSnapshot, O as isOfflineModeStatusValue, P as getNavigatorLockManager, S as serializeJsonForStorage, T as defaultOfflineRuntimeConfig, V as getPayloadRecordKey, _ as getDefaultMaxBytesForScope, a as estimateManagedAsyncStorageEntrySizeBytes, b as getSerializedStringSize, c as readAsyncStorageNamespaceIndexStateUsingDriver, d as unregisterAsyncStartupStoreCleanup, f as parseAsyncStorageNamespaceKind, g as resolveTSDFLogger, h as getTSDFDebugTimingMs, j as clearSessionProtectedKeysSnapshot, k as offlineItemEntityRefSchema, l as registerAsyncStartupStoreCleanup, m as emitTSDFDebugLog, o as getProtectedKeysFromMetadata, p as logPersistentStorageQuotaCleanup, q as scheduleIdleCleanup, r as buildPersistedStaticPolicy, s as mergeManagedAsyncStorageCustomMetadata, u as serializeProtectedRef$1, v as createShouldIgnoreItemPredicate, w as compactOfflineStatusSnapshotSchema, x as keepEntriesWithinByteBudget, y as createTimedKeySet } from "./asyncStorageAdapter-B1kF0Ojl.js";
2
- import { a as encodePathSegment, i as getNavigatorStorageDirectory, n as getDirectoryHandleIfExists, r as getFileHandleIfExists } from "./opfsPersistentStorage-DcODOOJk.js";
1
+ import { A as offlineResolutionRecordSchema, C as OfflineResolutionConflictParseError, D as isModeEffectivelyActive, E as getIsOfflineModeFromStatus, F as warnIfNavigatorLockUnavailable, G as parsePersistedAsyncNamespaceKind, I as createCompactLocalStorageEntry, K as serializeProtectedRef, L as parseCompactLocalStorageEntry, M as getSessionProtectedKeysSnapshot, N as setSessionProtectedKeysSnapshot, O as isOfflineModeStatusValue, P as getNavigatorLockManager, S as serializeJsonForStorage, T as defaultOfflineRuntimeConfig, V as getPayloadRecordKey, _ as getDefaultMaxBytesForScope, a as estimateManagedAsyncStorageEntrySizeBytes, b as getSerializedStringSize, c as readAsyncStorageNamespaceIndexStateUsingDriver, d as unregisterAsyncStartupStoreCleanup, f as parseAsyncStorageNamespaceKind, g as resolveTSDFLogger, h as getTSDFDebugTimingMs, j as clearSessionProtectedKeysSnapshot, k as offlineItemEntityRefSchema, l as registerAsyncStartupStoreCleanup, m as emitTSDFDebugLog, o as getProtectedKeysFromMetadata, p as logPersistentStorageQuotaCleanup, q as scheduleIdleCleanup, r as buildPersistedStaticPolicy, s as mergeManagedAsyncStorageCustomMetadata, u as serializeProtectedRef$1, v as createShouldIgnoreItemPredicate, w as compactOfflineStatusSnapshotSchema, x as keepEntriesWithinByteBudget, y as createTimedKeySet } from "./asyncStorageAdapter-B-pdNeAs.js";
2
+ import { a as encodePathSegment, i as getNavigatorStorageDirectory, n as getDirectoryHandleIfExists, r as getFileHandleIfExists } from "./opfsPersistentStorage-DobQJr0X.js";
3
3
  import { isWindowFocused, onWindowFocus } from "@ls-stack/browser-utils/window";
4
4
  import { filterAndMap, findAndMap, sortBy } from "@ls-stack/utils/arrayUtils";
5
5
  import { getCompositeKey } from "@ls-stack/utils/getCompositeKey";
@@ -1387,7 +1387,7 @@ function createPersistentStorageHandle(config, { asyncValueCodec, getManifestMet
1387
1387
  const sessionKey = config.getSessionKey();
1388
1388
  if (sessionKey === false) return null;
1389
1389
  asyncAdapter.debugLogger = config.debugLogger;
1390
- asyncAdapter.prodLogger = config.prodLogger;
1390
+ asyncAdapter.logger = config.logger;
1391
1391
  return asyncAdapter.openNamespace({
1392
1392
  sessionKey,
1393
1393
  storeName: asyncNamespace?.storeName ?? config.storeName,
@@ -1593,7 +1593,7 @@ function createPersistentStorageNamespaceHandle(config, { asyncValueCodec, getMa
1593
1593
  const sessionKey = config.getSessionKey();
1594
1594
  if (sessionKey === false) return null;
1595
1595
  asyncAdapter.debugLogger = config.debugLogger;
1596
- asyncAdapter.prodLogger = config.prodLogger;
1596
+ asyncAdapter.logger = config.logger;
1597
1597
  return asyncAdapter.openNamespace({
1598
1598
  sessionKey,
1599
1599
  storeName: config.storeName,
@@ -2174,7 +2174,7 @@ async function clearSessionStorage(sessionKey, adapter) {
2174
2174
  }
2175
2175
  /** Clears all persistent storage entries for a given session key across built-in adapters. */
2176
2176
  async function clearAllSessionStorage(sessionKey) {
2177
- const { indexedDbPersistentStorage, opfsPersistentStorage } = await import("./asyncStorageAdapters-CxkAFJbY.js");
2177
+ const { indexedDbPersistentStorage, opfsPersistentStorage } = await import("./asyncStorageAdapters-0ObaLfne.js");
2178
2178
  await Promise.all([
2179
2179
  clearSessionStorage(sessionKey, "local-sync"),
2180
2180
  clearSessionStorage(sessionKey, opfsPersistentStorage),
@@ -2303,13 +2303,13 @@ function setupCollectionPersistence(config, options = {}) {
2303
2303
  });
2304
2304
  const quotaCleanupAdapter = localStorageAdapter === null ? "async" : "local-sync";
2305
2305
  function logByteBudgetCleanup(phase, totalEntries, keptKeys, unprotectedBytes) {
2306
- const prodLogger = config.prodLogger;
2307
- if (!prodLogger) return;
2306
+ const logger = config.logger;
2307
+ if (!logger) return;
2308
2308
  const evictedEntries = totalEntries - keptKeys.size;
2309
2309
  if (evictedEntries === 0) return;
2310
2310
  logPersistentStorageQuotaCleanup({
2311
2311
  adapter: quotaCleanupAdapter,
2312
- prodLogger,
2312
+ logger,
2313
2313
  evictedEntries,
2314
2314
  keptEntries: keptKeys.size,
2315
2315
  maxBytes,
@@ -7549,7 +7549,7 @@ function createDisabledStoreManagerOfflineApi(getSessionKey) {
7549
7549
  }
7550
7550
  function createStoreManager(options) {
7551
7551
  const debugLogger = import.meta.env.DEV ? resolveTSDFLogger(options.debugLogger) : void 0;
7552
- const prodLogger = resolveTSDFLogger(options.prodLogger);
7552
+ const logger = resolveTSDFLogger(options.logger ?? true);
7553
7553
  let resolvedOfflineSession;
7554
7554
  if (options.offlineSession) {
7555
7555
  const createOfflineSessionOptions = {
@@ -7615,7 +7615,7 @@ function createStoreManager(options) {
7615
7615
  ...offlineApi
7616
7616
  };
7617
7617
  storeManager.debugLogger = debugLogger;
7618
- storeManager.prodLogger = prodLogger;
7618
+ storeManager.logger = logger;
7619
7619
  storeManagerRegistry.set(storeManager, registry);
7620
7620
  storeManagerOfflineSessionRegistry.set(storeManager, resolvedOfflineSession);
7621
7621
  return storeManager;
@@ -7708,15 +7708,15 @@ async function performMutationWithLifecycle(startMutation, mutation, onError, op
7708
7708
  //#endregion
7709
7709
  //#region src/utils/storeFocusLifecycle.ts
7710
7710
  /** @internal */
7711
- function createStoreFocusLifecycle(revalidateOnWindowFocus, usesRealTimeUpdates, transportReconnectCooldownMs, getWindowIsFocused, onWindowFocus, onWindowFocusRevalidate, onTransportReconnectRevalidate, debug) {
7711
+ function createStoreFocusLifecycle(revalidateOnWindowFocus, usesRealTimeUpdates, transportReconnectCooldownMs, getWindowCanRunRevalidation, onWindowFocus, onWindowCanRunRevalidation, onWindowFocusRevalidate, onTransportReconnectRevalidate, debug) {
7712
7712
  let cleanupFocusListener = null;
7713
- let cleanupReconnectFocusListener = null;
7713
+ let cleanupReconnectRevalidationListener = null;
7714
7714
  let reconnectCooldownTimeoutId = null;
7715
- let hasPendingReconnectRevalidateOnFocus = false;
7715
+ let hasPendingReconnectRevalidate = false;
7716
7716
  let lastTransportReconnectRevalidateAt = Number.NEGATIVE_INFINITY;
7717
- function clearReconnectFocusListener() {
7718
- cleanupReconnectFocusListener?.();
7719
- cleanupReconnectFocusListener = null;
7717
+ function clearReconnectRevalidationListener() {
7718
+ cleanupReconnectRevalidationListener?.();
7719
+ cleanupReconnectRevalidationListener = null;
7720
7720
  }
7721
7721
  function clearReconnectCooldownTimeout() {
7722
7722
  if (reconnectCooldownTimeoutId !== null) {
@@ -7745,25 +7745,26 @@ function createStoreFocusLifecycle(revalidateOnWindowFocus, usesRealTimeUpdates,
7745
7745
  lastTransportReconnectRevalidateAt = Date.now();
7746
7746
  onTransportReconnectRevalidate();
7747
7747
  }
7748
- function ensureReconnectFocusListener() {
7749
- if (cleanupReconnectFocusListener) return;
7750
- cleanupReconnectFocusListener = onWindowFocus(() => {
7751
- clearReconnectFocusListener();
7752
- if (!hasPendingReconnectRevalidateOnFocus) return;
7753
- hasPendingReconnectRevalidateOnFocus = false;
7748
+ function ensureReconnectRevalidationListener() {
7749
+ if (cleanupReconnectRevalidationListener) return;
7750
+ cleanupReconnectRevalidationListener = onWindowCanRunRevalidation(() => {
7751
+ if (!getWindowCanRunRevalidation()) return;
7752
+ clearReconnectRevalidationListener();
7753
+ if (!hasPendingReconnectRevalidate) return;
7754
+ hasPendingReconnectRevalidate = false;
7754
7755
  runTransportReconnectRevalidate();
7755
7756
  });
7756
7757
  }
7757
7758
  function flushTransportReconnectRevalidate() {
7758
7759
  clearReconnectCooldownTimeout();
7759
- if (getWindowIsFocused()) {
7760
- hasPendingReconnectRevalidateOnFocus = false;
7761
- clearReconnectFocusListener();
7760
+ if (getWindowCanRunRevalidation()) {
7761
+ hasPendingReconnectRevalidate = false;
7762
+ clearReconnectRevalidationListener();
7762
7763
  runTransportReconnectRevalidate();
7763
7764
  return;
7764
7765
  }
7765
- hasPendingReconnectRevalidateOnFocus = true;
7766
- ensureReconnectFocusListener();
7766
+ hasPendingReconnectRevalidate = true;
7767
+ ensureReconnectRevalidationListener();
7767
7768
  }
7768
7769
  function scheduleTrailingTransportReconnectRevalidate() {
7769
7770
  clearReconnectCooldownTimeout();
@@ -7775,9 +7776,9 @@ function createStoreFocusLifecycle(revalidateOnWindowFocus, usesRealTimeUpdates,
7775
7776
  function reset() {
7776
7777
  cleanupFocusListener?.();
7777
7778
  cleanupFocusListener = null;
7778
- clearReconnectFocusListener();
7779
+ clearReconnectRevalidationListener();
7779
7780
  clearReconnectCooldownTimeout();
7780
- hasPendingReconnectRevalidateOnFocus = false;
7781
+ hasPendingReconnectRevalidate = false;
7781
7782
  lastTransportReconnectRevalidateAt = Number.NEGATIVE_INFINITY;
7782
7783
  if (!revalidateOnWindowFocus) return;
7783
7784
  if (usesRealTimeUpdates) {
@@ -7806,9 +7807,9 @@ function createStoreFocusLifecycle(revalidateOnWindowFocus, usesRealTimeUpdates,
7806
7807
  function dispose() {
7807
7808
  cleanupFocusListener?.();
7808
7809
  cleanupFocusListener = null;
7809
- clearReconnectFocusListener();
7810
+ clearReconnectRevalidationListener();
7810
7811
  clearReconnectCooldownTimeout();
7811
- hasPendingReconnectRevalidateOnFocus = false;
7812
+ hasPendingReconnectRevalidate = false;
7812
7813
  lastTransportReconnectRevalidateAt = Number.NEGATIVE_INFINITY;
7813
7814
  }
7814
7815
  function onTransportReconnect() {
@@ -7817,7 +7818,7 @@ function createStoreFocusLifecycle(revalidateOnWindowFocus, usesRealTimeUpdates,
7817
7818
  flushTransportReconnectRevalidate();
7818
7819
  return;
7819
7820
  }
7820
- if (hasPendingReconnectRevalidateOnFocus) return;
7821
+ if (hasPendingReconnectRevalidate) return;
7821
7822
  if (Date.now() - lastTransportReconnectRevalidateAt >= transportReconnectCooldownMs) {
7822
7823
  flushTransportReconnectRevalidate();
7823
7824
  return;
@@ -7832,6 +7833,25 @@ function createStoreFocusLifecycle(revalidateOnWindowFocus, usesRealTimeUpdates,
7832
7833
  };
7833
7834
  }
7834
7835
  //#endregion
7836
+ //#region src/utils/windowRevalidation.ts
7837
+ /** @internal */
7838
+ function isWindowVisible() {
7839
+ return document.visibilityState === "visible";
7840
+ }
7841
+ /** @internal */
7842
+ function onWindowVisible(handler) {
7843
+ window.addEventListener("focus", handler);
7844
+ window.addEventListener("pageshow", handler);
7845
+ window.addEventListener("visibilitychange", handler);
7846
+ document.addEventListener("visibilitychange", handler);
7847
+ return () => {
7848
+ window.removeEventListener("focus", handler);
7849
+ window.removeEventListener("pageshow", handler);
7850
+ window.removeEventListener("visibilitychange", handler);
7851
+ document.removeEventListener("visibilitychange", handler);
7852
+ };
7853
+ }
7854
+ //#endregion
7835
7855
  //#region src/collectionStore/collectionCacheLimits.ts
7836
7856
  /** @internal */
7837
7857
  function createCollectionCacheLimits(store, maxItems, itemCacheRuntime, isProtectedFromEviction, cleanupItemResources, onStateCleanup) {
@@ -8529,7 +8549,7 @@ function createCollectionStore(storeOptions) {
8529
8549
  session: resolvedOfflineSessionForPersistentStorage
8530
8550
  } : void 0,
8531
8551
  debugLogger: storeManager.debugLogger,
8532
- prodLogger: storeManager.prodLogger,
8552
+ logger: storeManager.logger,
8533
8553
  getSessionKey: getSessionKeyForRuntime,
8534
8554
  storeName: id
8535
8555
  }) : null;
@@ -8646,6 +8666,7 @@ function createCollectionStore(storeOptions) {
8646
8666
  return false;
8647
8667
  }
8648
8668
  const getWindowIsFocused = testOptions?.getWindowIsFocused ?? isWindowFocused;
8669
+ const getWindowCanRunRevalidation = testOptions?.getWindowCanRunRevalidation ?? isWindowVisible;
8649
8670
  function runWithoutBroadcast(callback) {
8650
8671
  remoteApplyDepth++;
8651
8672
  try {
@@ -9206,7 +9227,7 @@ function createCollectionStore(storeOptions) {
9206
9227
  if (!offline && result.ok && result.value.kind === "online") return Result.ok(result.value.data);
9207
9228
  return result;
9208
9229
  }
9209
- const focusLifecycle = createStoreFocusLifecycle(resolvedRevalidateOnWindowFocus, usesRealTimeUpdates, transportReconnectCooldownMs, getWindowIsFocused, testOptions?.onWindowFocus ?? onWindowFocus, () => {
9230
+ const focusLifecycle = createStoreFocusLifecycle(resolvedRevalidateOnWindowFocus, usesRealTimeUpdates, transportReconnectCooldownMs, getWindowCanRunRevalidation, testOptions?.onWindowFocus ?? onWindowFocus, testOptions?.onWindowCanRunRevalidation ?? onWindowVisible, () => {
9210
9231
  invalidateItem(() => true, "lowPriority");
9211
9232
  }, () => {
9212
9233
  invalidateItem(() => true, "realtimeUpdate");
@@ -9229,12 +9250,12 @@ function createCollectionStore(storeOptions) {
9229
9250
  * items need to be revalidated.
9230
9251
  *
9231
9252
  * - No-op when `usesRealTimeUpdates` is `false`.
9232
- * - If the window is focused, the first reconnect invalidates all items
9253
+ * - If the window is visible, the first reconnect invalidates all items
9233
9254
  * immediately with `realtimeUpdate` priority.
9234
9255
  * - Additional reconnects within `transportReconnectCooldownMs` are
9235
9256
  * coalesced into one trailing invalidation.
9236
- * - If the window is **not** focused, reconnect invalidation waits until the
9237
- * next window focus event.
9257
+ * - If the window is hidden, reconnect invalidation waits until the next
9258
+ * window visibility/resume event.
9238
9259
  */
9239
9260
  function onTransportReconnect() {
9240
9261
  if (isDisposed) return;
@@ -9617,7 +9638,7 @@ function createDocumentStore(storeOptions) {
9617
9638
  session: resolvedOfflineSessionForPersistentStorage
9618
9639
  } : void 0,
9619
9640
  debugLogger: storeManager.debugLogger,
9620
- prodLogger: storeManager.prodLogger,
9641
+ logger: storeManager.logger,
9621
9642
  getSessionKey: getSessionKeyForRuntime,
9622
9643
  storeName: id
9623
9644
  }) : null;
@@ -9677,6 +9698,7 @@ function createDocumentStore(storeOptions) {
9677
9698
  const events = evtmitter();
9678
9699
  const storeEvents = evtmitter();
9679
9700
  const getWindowIsFocused = testOptions?.getWindowIsFocused ?? isWindowFocused;
9701
+ const getWindowCanRunRevalidation = testOptions?.getWindowCanRunRevalidation ?? isWindowVisible;
9680
9702
  function runWithoutBroadcast(callback) {
9681
9703
  remoteApplyDepth++;
9682
9704
  try {
@@ -9837,7 +9859,7 @@ function createDocumentStore(storeOptions) {
9837
9859
  usesRealTimeUpdates
9838
9860
  });
9839
9861
  if (initialStatus !== "idle" || initialData !== null || initialError !== null) scheduler.setLastFetchStartTimeForRequest(DOC_REQUEST_ID, testOptions?.initialLastFetchStartTime ?? 0);
9840
- const focusLifecycle = createStoreFocusLifecycle(resolvedRevalidateOnWindowFocus, usesRealTimeUpdates, transportReconnectCooldownMs, getWindowIsFocused, testOptions?.onWindowFocus ?? onWindowFocus, () => {
9862
+ const focusLifecycle = createStoreFocusLifecycle(resolvedRevalidateOnWindowFocus, usesRealTimeUpdates, transportReconnectCooldownMs, getWindowCanRunRevalidation, testOptions?.onWindowFocus ?? onWindowFocus, testOptions?.onWindowCanRunRevalidation ?? onWindowVisible, () => {
9841
9863
  invalidateData("lowPriority");
9842
9864
  }, () => {
9843
9865
  invalidateData("realtimeUpdate");
@@ -9915,12 +9937,12 @@ function createDocumentStore(storeOptions) {
9915
9937
  * needs to be revalidated.
9916
9938
  *
9917
9939
  * - No-op when `usesRealTimeUpdates` is `false`.
9918
- * - If the window is focused, the first reconnect invalidates immediately
9919
- * with `realtimeUpdate` priority.
9940
+ * - If the window is visible, the first reconnect invalidates immediately with
9941
+ * `realtimeUpdate` priority.
9920
9942
  * - Additional reconnects within `transportReconnectCooldownMs` are coalesced
9921
9943
  * into one trailing invalidation.
9922
- * - If the window is **not** focused, reconnect invalidation waits until the
9923
- * next window focus event.
9944
+ * - If the window is hidden, reconnect invalidation waits until the next
9945
+ * window visibility/resume event.
9924
9946
  */
9925
9947
  function onTransportReconnect() {
9926
9948
  if (isDisposed) return;
@@ -10301,13 +10323,13 @@ function setupListQueryPersistence(config, options = {}) {
10301
10323
  });
10302
10324
  const quotaCleanupAdapter = localStorageAdapter === null ? "async" : "local-sync";
10303
10325
  function logQueryByteBudgetCleanup(phase, totalEntries, keptKeys, unprotectedBytes) {
10304
- const prodLogger = config.prodLogger;
10305
- if (!prodLogger) return;
10326
+ const logger = config.logger;
10327
+ if (!logger) return;
10306
10328
  const evictedEntries = totalEntries - keptKeys.size;
10307
10329
  if (evictedEntries === 0) return;
10308
10330
  logPersistentStorageQuotaCleanup({
10309
10331
  adapter: quotaCleanupAdapter,
10310
- prodLogger,
10332
+ logger,
10311
10333
  evictedEntries,
10312
10334
  keptEntries: keptKeys.size,
10313
10335
  maxBytes: maxQueryBytes,
@@ -10320,13 +10342,13 @@ function setupListQueryPersistence(config, options = {}) {
10320
10342
  });
10321
10343
  }
10322
10344
  function logItemByteBudgetCleanup(phase, totalEntries, keptKeys, unprotectedBytes) {
10323
- const prodLogger = config.prodLogger;
10324
- if (!prodLogger) return;
10345
+ const logger = config.logger;
10346
+ if (!logger) return;
10325
10347
  const evictedEntries = totalEntries - keptKeys.size;
10326
10348
  if (evictedEntries === 0) return;
10327
10349
  logPersistentStorageQuotaCleanup({
10328
10350
  adapter: quotaCleanupAdapter,
10329
- prodLogger,
10351
+ logger,
10330
10352
  evictedEntries,
10331
10353
  keptEntries: keptKeys.size,
10332
10354
  maxBytes: maxItemBytes,
@@ -14710,7 +14732,7 @@ function createListQueryStore(storeOptions) {
14710
14732
  session: resolvedOfflineSessionForPersistentStorage
14711
14733
  } : void 0,
14712
14734
  debugLogger: storeManager.debugLogger,
14713
- prodLogger: storeManager.prodLogger,
14735
+ logger: storeManager.logger,
14714
14736
  getSessionKey: getSessionKeyForRuntime,
14715
14737
  storeName: id
14716
14738
  }) : null;
@@ -14794,6 +14816,7 @@ function createListQueryStore(storeOptions) {
14794
14816
  return false;
14795
14817
  }
14796
14818
  const getWindowIsFocused = testOptions?.getWindowIsFocused ?? isWindowFocused;
14819
+ const getWindowCanRunRevalidation = testOptions?.getWindowCanRunRevalidation ?? isWindowVisible;
14797
14820
  function runWithoutBroadcast(callback) {
14798
14821
  remoteApplyDepth++;
14799
14822
  try {
@@ -15348,7 +15371,7 @@ function createListQueryStore(storeOptions) {
15348
15371
  function useFindItem$1(findItemFn, options = {}) {
15349
15372
  return useFindItem(findItemFn, options, store, registerActiveStandaloneItems, touchItems);
15350
15373
  }
15351
- const focusLifecycle = createStoreFocusLifecycle(resolvedRevalidateOnWindowFocus, usesRealTimeUpdates, transportReconnectCooldownMs, getWindowIsFocused, testOptions?.onWindowFocus ?? onWindowFocus, () => {
15374
+ const focusLifecycle = createStoreFocusLifecycle(resolvedRevalidateOnWindowFocus, usesRealTimeUpdates, transportReconnectCooldownMs, getWindowCanRunRevalidation, testOptions?.onWindowFocus ?? onWindowFocus, testOptions?.onWindowCanRunRevalidation ?? onWindowVisible, () => {
15352
15375
  invalidateQueryAndItems({
15353
15376
  all: true,
15354
15377
  type: "lowPriority"
@@ -15383,12 +15406,12 @@ function createListQueryStore(storeOptions) {
15383
15406
  * queries and items need to be revalidated.
15384
15407
  *
15385
15408
  * - No-op when `usesRealTimeUpdates` is `false`.
15386
- * - If the window is focused, the first reconnect invalidates all queries
15409
+ * - If the window is visible, the first reconnect invalidates all queries
15387
15410
  * and items immediately with `realtimeUpdate` priority.
15388
15411
  * - Additional reconnects within `transportReconnectCooldownMs` are
15389
15412
  * coalesced into one trailing invalidation.
15390
- * - If the window is **not** focused, reconnect invalidation waits until the
15391
- * next window focus event.
15413
+ * - If the window is hidden, reconnect invalidation waits until the next
15414
+ * window visibility/resume event.
15392
15415
  */
15393
15416
  function onTransportReconnect() {
15394
15417
  if (isDisposed) return;
@@ -1,2 +1,2 @@
1
- import { t as opfsPersistentStorage } from "./opfsPersistentStorage-B0QmznAg.js";
1
+ import { t as opfsPersistentStorage } from "./opfsPersistentStorage-Brc4BAn4.js";
2
2
  export { opfsPersistentStorage };
@@ -1,2 +1,2 @@
1
- import { t as opfsPersistentStorage } from "./opfsPersistentStorage-DcODOOJk.js";
1
+ import { t as opfsPersistentStorage } from "./opfsPersistentStorage-DobQJr0X.js";
2
2
  export { opfsPersistentStorage };
@@ -1,4 +1,4 @@
1
- import { t as AsyncStorageAdapter } from "./types-hwf0jXKv.js";
1
+ import { t as AsyncStorageAdapter } from "./types-CtltNSyd.js";
2
2
 
3
3
  //#region src/persistentStorage/opfsPersistentStorage.d.ts
4
4
  declare const opfsPersistentStorage: AsyncStorageAdapter;
@@ -1,4 +1,4 @@
1
- import { B as getNamespaceId, G as parsePersistedAsyncNamespaceKind, V as getPayloadRecordKey, W as parseAsyncStorageRecordKey, h as getTSDFDebugTimingMs, i as createAsyncStorageAdapter, m as emitTSDFDebugLog, z as encodePersistedAsyncNamespaceKind } from "./asyncStorageAdapter-B1kF0Ojl.js";
1
+ import { B as getNamespaceId, G as parsePersistedAsyncNamespaceKind, V as getPayloadRecordKey, W as parseAsyncStorageRecordKey, h as getTSDFDebugTimingMs, i as createAsyncStorageAdapter, m as emitTSDFDebugLog, z as encodePersistedAsyncNamespaceKind } from "./asyncStorageAdapter-B-pdNeAs.js";
2
2
  import { getCompositeKey } from "@ls-stack/utils/getCompositeKey";
3
3
  import { __LEGIT_CAST__ } from "@ls-stack/utils/saferTyping";
4
4
  import { isObject } from "@ls-stack/utils/typeGuards";
@@ -1315,7 +1315,7 @@ type AsyncStorageDiscoveredScope = {
1315
1315
  /** Low-level async backend contract implemented by custom storage drivers. */
1316
1316
  type AsyncStorageDriver = {
1317
1317
  /** Mutable debug logger used by concrete adapters to emit operation timings. */debugLogger?: TSDFDebugLogger; /** Mutable logger used for low-volume production signals. */
1318
- prodLogger?: TSDFDebugLogger; /** Read a single raw record from a logical namespace. */
1318
+ logger?: TSDFDebugLogger; /** Read a single raw record from a logical namespace. */
1319
1319
  get(scope: AsyncStorageNamespaceScope, key: string): Promise<unknown>; /** Write a single raw record to a logical namespace. */
1320
1320
  set(scope: AsyncStorageNamespaceScope, key: string, value: unknown): Promise<void>; /** Remove a single raw record from a logical namespace. */
1321
1321
  remove(scope: AsyncStorageNamespaceScope, key: string): Promise<void>; /** List raw record keys within a logical namespace. */
@@ -1349,7 +1349,7 @@ type AsyncStorageNamespaceHandle<TValue, TCustomMetadata extends Record<string,
1349
1349
  type AsyncStorageAdapter = {
1350
1350
  /** Adapter mode marker used by persistence internals to pick async behavior. */kind: 'async'; /** Mutable debug logger used by concrete adapters to emit operation timings. */
1351
1351
  debugLogger?: TSDFDebugLogger; /** Mutable logger used for low-volume production signals. */
1352
- prodLogger?: TSDFDebugLogger; /** Open a logical namespace with managed batching and touch guarantees. */
1352
+ logger?: TSDFDebugLogger; /** Open a logical namespace with managed batching and touch guarantees. */
1353
1353
  openNamespace<TValue, TCustomMetadata extends Record<string, unknown> = Record<string, unknown>>(scope: AsyncStorageNamespaceScope): AsyncStorageNamespaceHandle<TValue, TCustomMetadata>; /** Reconstruct offline-protected entry refs for a session from persisted metadata. */
1354
1354
  readProtectedStorageKeys(sessionKey: string): Promise<Set<string>>; /** Eagerly sync offline protection changes into persisted metadata for already-cached entries. */
1355
1355
  syncSessionProtectedKeys(sessionKey: string, protectedKeys: Iterable<string>, previousProtectedKeys?: Iterable<string>): Promise<void>; /** Remove all namespaces for a session key. */
@@ -132,4 +132,4 @@ TSDF automatically invalidates data in these scenarios:
132
132
  - **Mutation error**: After a failed mutation, affected data is invalidated to revert optimistic updates
133
133
  - **Mutation success with `revalidateOnSuccess`**: Affected data is invalidated to fetch the server's actual state
134
134
  - **Window focus**: When `revalidateOnWindowFocus` is enabled, all data is invalidated with `lowPriority`
135
- - **Transport reconnect**: When `onTransportReconnect()` is called, all data is invalidated with `realtimeUpdate` priority. See [Real-Time Updates](./real-time-updates.md)
135
+ - **Transport reconnect**: When `onTransportReconnect()` is called, all data is invalidated with `realtimeUpdate` priority as soon as the document is visible. See [Real-Time Updates](./real-time-updates.md)
@@ -64,7 +64,7 @@ Store-specific options:
64
64
 
65
65
  > `persistentStorage` automatically reuses the store's existing `id` for its storage namespace and the store manager's `getSessionKey` for session scoping. When `getSessionKey` returns `false`, no persistence operations run.
66
66
 
67
- Enable `createStoreManager({ debugLogger: true, ... })` to inspect load, save/write, commit, clear, metadata, and offline protection persistence operations in development. Enable `createStoreManager({ prodLogger: true, ... })` to receive production-safe quota cleanup logs; they include the affected quota, configured byte budget, total unprotected bytes, and kept/evicted entry counts. Async adapters also emit timed `adapter-operation` entries with `durationMs` for concrete OPFS, IndexedDB, or custom driver work in development.
67
+ Enable `createStoreManager({ debugLogger: true, ... })` to inspect load, save/write, commit, clear, metadata, and offline protection persistence operations in development. Production-safe quota cleanup logs are emitted through the manager `logger` by default; they include the affected quota, configured byte budget, total unprotected bytes, and kept/evicted entry counts. Pass `logger: false` to disable them. Async adapters also emit timed `adapter-operation` entries with `durationMs` for concrete OPFS, IndexedDB, or custom driver work in development.
68
68
 
69
69
  ## Converted Data Schemas
70
70
 
@@ -104,9 +104,9 @@ Store-level `store.onTransportReconnect()` remains available for stores backed b
104
104
 
105
105
  Behavior:
106
106
 
107
- - If the window is **focused**: all data is invalidated immediately with `realtimeUpdate` priority
108
- - If the window is **not focused**: invalidation is deferred until the window regains focus
109
- - Multiple reconnect calls while unfocused are coalesced (only one invalidation fires on focus)
107
+ - If the document is **visible**: all data is invalidated immediately with `realtimeUpdate` priority, even when the browser does not report strict focus
108
+ - If the document is **hidden**: invalidation is deferred until the app becomes visible or resumes
109
+ - Multiple reconnect calls while hidden are coalesced (only one invalidation fires on resume)
110
110
  - This is a no-op when `usesRealTimeUpdates` is `false`
111
111
 
112
112
  ## Pattern: WebSocket Integration
@@ -30,27 +30,26 @@ const storeManager = createStoreManager({
30
30
  console.error('TSDF persistence failed', error);
31
31
  },
32
32
  debugLogger: true,
33
- prodLogger: true,
34
33
  });
35
34
  ```
36
35
 
37
36
  Options:
38
37
 
39
- | Option | Required | Description |
40
- | ----------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
41
- | `getSessionKey` | Yes | Returns the active tenant/account key. Return `false` while no session is ready. |
42
- | `errorNormalizer` | Yes | Converts thrown `Error` values into TSDF's shared `StoreError` shape. |
43
- | `lowPriorityThrottleMs` | No | Default minimum interval between low-priority fetches for attached stores. Defaults to 40 minutes (`2_400_000ms`). |
44
- | `baseCoalescingWindowMs` | No | Default window to group fetch requests for attached stores. Defaults to `16ms`. |
45
- | `backgroundCoalescingDelayMs` | No | Extra browser-tab coalescing delay applied only while a tab is in the background. Defaults to `3000ms`. |
46
- | `dynamicRealtimeThrottleMs` | No | Default adaptive throttle for real-time updates in attached stores. Defaults to `100ms` focused and `1000ms` in the background. Store options override it. |
47
- | `blockWindowClose` | No | Shared window-close blocker for mutations in attached stores. Defaults to `null`. |
48
- | `revalidateOnWindowFocus` | No | Default focus revalidation policy for attached stores. Store options override it. |
49
- | `onMutationError` | No | Global fallback for mutation failures when a store does not provide its own handler. |
50
- | `onPersistentStorageError` | No | Global fallback for persistent storage failures when a store does not provide its own handler. |
51
- | `debugLogger` | No | Enables verbose development-only browser-tab sync, focus revalidation, and persistent-storage debug logs. Pass `true` or a logger function. |
52
- | `prodLogger` | No | Enables low-volume production-safe logs such as persistent-storage quota cleanup. Pass `true` or a logger function. |
53
- | `offlineSession` | No | Shared offline config used by stores with `persistentStorage.offline`. |
38
+ | Option | Required | Description |
39
+ | ----------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
40
+ | `getSessionKey` | Yes | Returns the active tenant/account key. Return `false` while no session is ready. |
41
+ | `errorNormalizer` | Yes | Converts thrown `Error` values into TSDF's shared `StoreError` shape. |
42
+ | `lowPriorityThrottleMs` | No | Default minimum interval between low-priority fetches for attached stores. Defaults to 40 minutes (`2_400_000ms`). |
43
+ | `baseCoalescingWindowMs` | No | Default window to group fetch requests for attached stores. Defaults to `16ms`. |
44
+ | `backgroundCoalescingDelayMs` | No | Extra browser-tab coalescing delay applied only while a tab is in the background. Defaults to `3000ms`. |
45
+ | `dynamicRealtimeThrottleMs` | No | Default adaptive throttle for real-time updates in attached stores. Defaults to `100ms` focused and `1000ms` in the background. Store options override it. |
46
+ | `blockWindowClose` | No | Shared window-close blocker for mutations in attached stores. Defaults to `null`. |
47
+ | `revalidateOnWindowFocus` | No | Default focus revalidation policy for attached stores. Store options override it. |
48
+ | `onMutationError` | No | Global fallback for mutation failures when a store does not provide its own handler. |
49
+ | `onPersistentStorageError` | No | Global fallback for persistent storage failures when a store does not provide its own handler. |
50
+ | `debugLogger` | No | Enables verbose development-only browser-tab sync, focus revalidation, and persistent-storage debug logs. Pass `true` or a logger function. |
51
+ | `logger` | No | Enables low-volume production-safe logs such as persistent-storage quota cleanup. Defaults to console logging; pass `false` to disable or a function to customize. |
52
+ | `offlineSession` | No | Shared offline config used by stores with `persistentStorage.offline`. |
54
53
 
55
54
  The session key is used by browser-tab sync, persistent storage, and offline state. Stores with the same `id` but different session keys are isolated.
56
55
 
@@ -62,7 +61,7 @@ Store-level options can explicitly disable inherited defaults when the option su
62
61
 
63
62
  Pass `debugLogger: true` to log browser-tab sync operations, focus revalidation decisions, and persistent-storage operations through `console.log`, `console.warn`, and `console.error` in development. Browser-tab sync logs include lifecycle, leader changes, publish/receive events, and skipped messages. Focus revalidation logs report when `revalidateOnWindowFocus` triggers, is dynamically disabled, or is skipped because real-time updates own freshness. Store data sync uses store-specific channels, while tab-presence status uses one shared `presence` channel per manager/session. Presence prioritizes the focused tab; background tabs announce open/focus/blur changes and keep their last known fallback rank during quiet periods. Async persistent storage adapters emit timed `adapter-operation` entries with `durationMs` so slow OPFS, IndexedDB, or custom driver paths can be inspected.
64
63
 
65
- Pass `prodLogger: true` to log low-volume production-safe signals. Today this includes persistent-storage `quota-cleanup` entries.
64
+ Low-volume production-safe signals are logged by default through `console.log`, `console.warn`, and `console.error`. Today this includes persistent-storage `quota-cleanup` entries. Pass `logger: false` to disable them, or pass a function to route them to your own tooling.
66
65
 
67
66
  ```ts
68
67
  const storeManager = createStoreManager({
@@ -71,7 +70,7 @@ const storeManager = createStoreManager({
71
70
  debugLogger: ({ level, message, details }) => {
72
71
  observability[level](message, details);
73
72
  },
74
- prodLogger: ({ level, message, details }) => {
73
+ logger: ({ level, message, details }) => {
75
74
  observability[level](message, details);
76
75
  },
77
76
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdf",
3
- "version": "17.0.0-alpha.14",
3
+ "version": "17.0.0-alpha.15",
4
4
  "description": "A data fetching solution based on t-state",
5
5
  "license": "PolyForm-Noncommercial-1.0.0",
6
6
  "author": "Lucas Santos",