tsdf 17.0.0-alpha.14 → 17.0.0-alpha.16

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;
@@ -8529,7 +8529,7 @@ function createCollectionStore(storeOptions) {
8529
8529
  session: resolvedOfflineSessionForPersistentStorage
8530
8530
  } : void 0,
8531
8531
  debugLogger: storeManager.debugLogger,
8532
- prodLogger: storeManager.prodLogger,
8532
+ logger: storeManager.logger,
8533
8533
  getSessionKey: getSessionKeyForRuntime,
8534
8534
  storeName: id
8535
8535
  }) : null;
@@ -9617,7 +9617,7 @@ function createDocumentStore(storeOptions) {
9617
9617
  session: resolvedOfflineSessionForPersistentStorage
9618
9618
  } : void 0,
9619
9619
  debugLogger: storeManager.debugLogger,
9620
- prodLogger: storeManager.prodLogger,
9620
+ logger: storeManager.logger,
9621
9621
  getSessionKey: getSessionKeyForRuntime,
9622
9622
  storeName: id
9623
9623
  }) : null;
@@ -10301,13 +10301,13 @@ function setupListQueryPersistence(config, options = {}) {
10301
10301
  });
10302
10302
  const quotaCleanupAdapter = localStorageAdapter === null ? "async" : "local-sync";
10303
10303
  function logQueryByteBudgetCleanup(phase, totalEntries, keptKeys, unprotectedBytes) {
10304
- const prodLogger = config.prodLogger;
10305
- if (!prodLogger) return;
10304
+ const logger = config.logger;
10305
+ if (!logger) return;
10306
10306
  const evictedEntries = totalEntries - keptKeys.size;
10307
10307
  if (evictedEntries === 0) return;
10308
10308
  logPersistentStorageQuotaCleanup({
10309
10309
  adapter: quotaCleanupAdapter,
10310
- prodLogger,
10310
+ logger,
10311
10311
  evictedEntries,
10312
10312
  keptEntries: keptKeys.size,
10313
10313
  maxBytes: maxQueryBytes,
@@ -10320,13 +10320,13 @@ function setupListQueryPersistence(config, options = {}) {
10320
10320
  });
10321
10321
  }
10322
10322
  function logItemByteBudgetCleanup(phase, totalEntries, keptKeys, unprotectedBytes) {
10323
- const prodLogger = config.prodLogger;
10324
- if (!prodLogger) return;
10323
+ const logger = config.logger;
10324
+ if (!logger) return;
10325
10325
  const evictedEntries = totalEntries - keptKeys.size;
10326
10326
  if (evictedEntries === 0) return;
10327
10327
  logPersistentStorageQuotaCleanup({
10328
10328
  adapter: quotaCleanupAdapter,
10329
- prodLogger,
10329
+ logger,
10330
10330
  evictedEntries,
10331
10331
  keptEntries: keptKeys.size,
10332
10332
  maxBytes: maxItemBytes,
@@ -14710,7 +14710,7 @@ function createListQueryStore(storeOptions) {
14710
14710
  session: resolvedOfflineSessionForPersistentStorage
14711
14711
  } : void 0,
14712
14712
  debugLogger: storeManager.debugLogger,
14713
- prodLogger: storeManager.prodLogger,
14713
+ logger: storeManager.logger,
14714
14714
  getSessionKey: getSessionKeyForRuntime,
14715
14715
  storeName: id
14716
14716
  }) : null;
@@ -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. */
@@ -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
 
@@ -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.16",
4
4
  "description": "A data fetching solution based on t-state",
5
5
  "license": "PolyForm-Noncommercial-1.0.0",
6
6
  "author": "Lucas Santos",