tsdf 17.0.0-alpha.16 → 17.0.0-alpha.17
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/async-storage.js +1 -1
- package/dist/{asyncStorageAdapter-B-pdNeAs.js → asyncStorageAdapter-CGfnsd9m.js} +25 -2
- package/dist/{asyncStorageAdapters-0ObaLfne.js → asyncStorageAdapters-xME9-DVC.js} +2 -2
- package/dist/indexed-db-storage.js +1 -1
- package/dist/{indexedDbPersistentStorage-D35uqEXv.js → indexedDbPersistentStorage-BlhAkfaB.js} +1 -1
- package/dist/main.js +6 -4
- package/dist/opfs-storage.js +1 -1
- package/dist/{opfsPersistentStorage-DobQJr0X.js → opfsPersistentStorage-DqJXzF7M.js} +1 -1
- package/package.json +1 -1
package/dist/async-storage.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as createAsyncStorageAdapter } from "./asyncStorageAdapter-
|
|
1
|
+
import { i as createAsyncStorageAdapter } from "./asyncStorageAdapter-CGfnsd9m.js";
|
|
2
2
|
export { createAsyncStorageAdapter };
|
|
@@ -20,6 +20,25 @@ function scheduleIdleCleanup(callback) {
|
|
|
20
20
|
return () => clearTimeout(timeoutId);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
const INITIAL_MAINTENANCE_CLEANUP_DELAY_MS = 1e4;
|
|
24
|
+
/**
|
|
25
|
+
* Gives startup maintenance a short grace period before using the regular
|
|
26
|
+
* idle cleanup scheduling.
|
|
27
|
+
*/
|
|
28
|
+
function scheduleInitialMaintenanceCleanup(callback) {
|
|
29
|
+
if (typeof requestIdleCallback !== "function") {
|
|
30
|
+
const timeoutId = setTimeout(callback, INITIAL_MAINTENANCE_CLEANUP_DELAY_MS + 2e3);
|
|
31
|
+
return () => clearTimeout(timeoutId);
|
|
32
|
+
}
|
|
33
|
+
let cancelIdleCleanup = null;
|
|
34
|
+
const timeoutId = setTimeout(() => {
|
|
35
|
+
cancelIdleCleanup = scheduleIdleCleanup(callback);
|
|
36
|
+
}, INITIAL_MAINTENANCE_CLEANUP_DELAY_MS);
|
|
37
|
+
return () => {
|
|
38
|
+
clearTimeout(timeoutId);
|
|
39
|
+
cancelIdleCleanup?.();
|
|
40
|
+
};
|
|
41
|
+
}
|
|
23
42
|
//#endregion
|
|
24
43
|
//#region src/persistentStorage/asyncStorageShared.ts
|
|
25
44
|
const PAYLOAD_RECORD_PREFIX = "__tsdf_payload__:";
|
|
@@ -896,6 +915,7 @@ var ManagedAsyncStorageAdapter = class {
|
|
|
896
915
|
#pendingNamespaceCommits = /* @__PURE__ */ new Map();
|
|
897
916
|
#readCacheGeneration = 0;
|
|
898
917
|
#recentTouchedBuckets = /* @__PURE__ */ new Map();
|
|
918
|
+
#cancelStartupCleanup = null;
|
|
899
919
|
#startupCleanupScheduled = false;
|
|
900
920
|
constructor(driver) {
|
|
901
921
|
this.#driver = driver;
|
|
@@ -1019,6 +1039,8 @@ var ManagedAsyncStorageAdapter = class {
|
|
|
1019
1039
|
this.#observedScopes.clear();
|
|
1020
1040
|
this.#pendingNamespaceCommits.clear();
|
|
1021
1041
|
this.#recentTouchedBuckets.clear();
|
|
1042
|
+
this.#cancelStartupCleanup?.();
|
|
1043
|
+
this.#cancelStartupCleanup = null;
|
|
1022
1044
|
this.#startupCleanupScheduled = false;
|
|
1023
1045
|
this.#driver.__resetForTests?.();
|
|
1024
1046
|
}
|
|
@@ -1537,7 +1559,8 @@ var ManagedAsyncStorageAdapter = class {
|
|
|
1537
1559
|
#scheduleStartupCleanupIfNeeded() {
|
|
1538
1560
|
if (this.#startupCleanupScheduled) return;
|
|
1539
1561
|
this.#startupCleanupScheduled = true;
|
|
1540
|
-
|
|
1562
|
+
this.#cancelStartupCleanup = scheduleInitialMaintenanceCleanup(() => {
|
|
1563
|
+
this.#cancelStartupCleanup = null;
|
|
1541
1564
|
this.#runStartupCleanupIfDue().catch(() => {});
|
|
1542
1565
|
});
|
|
1543
1566
|
}
|
|
@@ -1919,4 +1942,4 @@ function serializeProtectedRef(ref) {
|
|
|
1919
1942
|
return serializeProtectedRef$1(ref);
|
|
1920
1943
|
}
|
|
1921
1944
|
//#endregion
|
|
1922
|
-
export { offlineResolutionRecordSchema as A, getNamespaceId as B, OfflineResolutionConflictParseError as C, isModeEffectivelyActive as D, getIsOfflineModeFromStatus as E, warnIfNavigatorLockUnavailable as F, parsePersistedAsyncNamespaceKind as G, getPersistedNamespaceId as H, createCompactLocalStorageEntry as I, serializeProtectedRef$1 as K, parseCompactLocalStorageEntry as L, getSessionProtectedKeysSnapshot as M, setSessionProtectedKeysSnapshot as N, isOfflineModeStatusValue as O, getNavigatorLockManager as P, compareMetadata as R, serializeJsonForStorage as S, defaultOfflineRuntimeConfig as T, normalizeStaticPolicy as U, getPayloadRecordKey as V, parseAsyncStorageRecordKey as W, getDefaultMaxBytesForScope as _, estimateManagedAsyncStorageEntrySizeBytes as a, getSerializedStringSize as b, readAsyncStorageNamespaceIndexStateUsingDriver as c, unregisterAsyncStartupStoreCleanup as d, parseAsyncStorageNamespaceKind as f, resolveTSDFLogger as g, getTSDFDebugTimingMs as h, createAsyncStorageAdapter as i, clearSessionProtectedKeysSnapshot as j, offlineItemEntityRefSchema as k, registerAsyncStartupStoreCleanup as l, emitTSDFDebugLog as m, ASYNC_STORAGE_MAX_AGE_MS as n, getProtectedKeysFromMetadata as o, logPersistentStorageQuotaCleanup as p,
|
|
1945
|
+
export { offlineResolutionRecordSchema as A, getNamespaceId as B, OfflineResolutionConflictParseError as C, isModeEffectivelyActive as D, getIsOfflineModeFromStatus as E, warnIfNavigatorLockUnavailable as F, parsePersistedAsyncNamespaceKind as G, getPersistedNamespaceId as H, createCompactLocalStorageEntry as I, scheduleIdleCleanup as J, serializeProtectedRef$1 as K, parseCompactLocalStorageEntry as L, getSessionProtectedKeysSnapshot as M, setSessionProtectedKeysSnapshot as N, isOfflineModeStatusValue as O, getNavigatorLockManager as P, compareMetadata as R, serializeJsonForStorage as S, defaultOfflineRuntimeConfig as T, normalizeStaticPolicy as U, getPayloadRecordKey as V, parseAsyncStorageRecordKey as W, getDefaultMaxBytesForScope as _, estimateManagedAsyncStorageEntrySizeBytes as a, getSerializedStringSize as b, readAsyncStorageNamespaceIndexStateUsingDriver as c, unregisterAsyncStartupStoreCleanup as d, parseAsyncStorageNamespaceKind as f, resolveTSDFLogger as g, getTSDFDebugTimingMs as h, createAsyncStorageAdapter as i, clearSessionProtectedKeysSnapshot as j, offlineItemEntityRefSchema as k, registerAsyncStartupStoreCleanup as l, emitTSDFDebugLog as m, ASYNC_STORAGE_MAX_AGE_MS as n, getProtectedKeysFromMetadata as o, logPersistentStorageQuotaCleanup as p, INITIAL_MAINTENANCE_CLEANUP_DELAY_MS as q, buildPersistedStaticPolicy as r, mergeManagedAsyncStorageCustomMetadata as s, ASYNC_MAINTENANCE_LOCAL_STORAGE_KEY as t, serializeProtectedRef as u, createShouldIgnoreItemPredicate as v, compactOfflineStatusSnapshotSchema as w, keepEntriesWithinByteBudget as x, createTimedKeySet as y, encodePersistedAsyncNamespaceKind as z };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as opfsPersistentStorage } from "./opfsPersistentStorage-
|
|
2
|
-
import { n as indexedDbPersistentStorage } from "./indexedDbPersistentStorage-
|
|
1
|
+
import { t as opfsPersistentStorage } from "./opfsPersistentStorage-DqJXzF7M.js";
|
|
2
|
+
import { n as indexedDbPersistentStorage } from "./indexedDbPersistentStorage-BlhAkfaB.js";
|
|
3
3
|
export { indexedDbPersistentStorage, opfsPersistentStorage };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as indexedDbPersistentStorage, t as createIndexedDbPersistentStorage } from "./indexedDbPersistentStorage-
|
|
1
|
+
import { n as indexedDbPersistentStorage, t as createIndexedDbPersistentStorage } from "./indexedDbPersistentStorage-BlhAkfaB.js";
|
|
2
2
|
export { createIndexedDbPersistentStorage, indexedDbPersistentStorage };
|
package/dist/{indexedDbPersistentStorage-D35uqEXv.js → indexedDbPersistentStorage-BlhAkfaB.js}
RENAMED
|
@@ -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-
|
|
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-CGfnsd9m.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.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
|
|
2
|
-
import { a as encodePathSegment, i as getNavigatorStorageDirectory, n as getDirectoryHandleIfExists, r as getFileHandleIfExists } from "./opfsPersistentStorage-
|
|
1
|
+
import { A as offlineResolutionRecordSchema, C as OfflineResolutionConflictParseError, D as isModeEffectivelyActive, E as getIsOfflineModeFromStatus, F as warnIfNavigatorLockUnavailable, G as parsePersistedAsyncNamespaceKind, I as createCompactLocalStorageEntry, J as scheduleIdleCleanup, 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 INITIAL_MAINTENANCE_CLEANUP_DELAY_MS, r as buildPersistedStaticPolicy, s as mergeManagedAsyncStorageCustomMetadata, u as serializeProtectedRef$1, v as createShouldIgnoreItemPredicate, w as compactOfflineStatusSnapshotSchema, x as keepEntriesWithinByteBudget, y as createTimedKeySet } from "./asyncStorageAdapter-CGfnsd9m.js";
|
|
2
|
+
import { a as encodePathSegment, i as getNavigatorStorageDirectory, n as getDirectoryHandleIfExists, r as getFileHandleIfExists } from "./opfsPersistentStorage-DqJXzF7M.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";
|
|
@@ -1257,7 +1257,9 @@ function scheduleAdapterExpirationScan(adapter) {
|
|
|
1257
1257
|
if (adapter === "local-sync") {
|
|
1258
1258
|
if (localStorageExpirationScanScheduled) return;
|
|
1259
1259
|
localStorageExpirationScanScheduled = true;
|
|
1260
|
-
|
|
1260
|
+
setTimeout(() => {
|
|
1261
|
+
scheduleLocalStorageMaintenance();
|
|
1262
|
+
}, INITIAL_MAINTENANCE_CLEANUP_DELAY_MS);
|
|
1261
1263
|
return;
|
|
1262
1264
|
}
|
|
1263
1265
|
if (scannedAsyncAdapters.has(adapter)) return;
|
|
@@ -2174,7 +2176,7 @@ async function clearSessionStorage(sessionKey, adapter) {
|
|
|
2174
2176
|
}
|
|
2175
2177
|
/** Clears all persistent storage entries for a given session key across built-in adapters. */
|
|
2176
2178
|
async function clearAllSessionStorage(sessionKey) {
|
|
2177
|
-
const { indexedDbPersistentStorage, opfsPersistentStorage } = await import("./asyncStorageAdapters-
|
|
2179
|
+
const { indexedDbPersistentStorage, opfsPersistentStorage } = await import("./asyncStorageAdapters-xME9-DVC.js");
|
|
2178
2180
|
await Promise.all([
|
|
2179
2181
|
clearSessionStorage(sessionKey, "local-sync"),
|
|
2180
2182
|
clearSessionStorage(sessionKey, opfsPersistentStorage),
|
package/dist/opfs-storage.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as opfsPersistentStorage } from "./opfsPersistentStorage-
|
|
1
|
+
import { t as opfsPersistentStorage } from "./opfsPersistentStorage-DqJXzF7M.js";
|
|
2
2
|
export { opfsPersistentStorage };
|
|
@@ -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-
|
|
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-CGfnsd9m.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";
|