tsdf 17.0.2 → 17.0.4
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.d.ts +1 -1
- package/dist/{asyncStorageAdapter-DuAUANgu.d.ts → asyncStorageAdapter-CMohMeKm.d.ts} +1 -1
- package/dist/indexed-db-storage.d.ts +1 -1
- package/dist/main.d.ts +28 -32
- package/dist/main.js +46 -46
- package/dist/opfs-storage.d.ts +1 -1
- package/dist/{opfsPersistentStorage-BB0qqnRz.d.ts → opfsPersistentStorage-Ci0JcCo5.d.ts} +1 -1
- package/dist/src/async-storage.d.ts +1 -0
- package/dist/src/cacheLimits/lruCacheRuntime.d.ts +9 -0
- package/dist/src/cacheLimits/scheduleIdleThrottled.d.ts +1 -0
- package/dist/src/cacheLimits/useRegisterActiveKeys.d.ts +1 -0
- package/dist/src/collectionStore/collectionCacheLimits.d.ts +1 -0
- package/dist/src/collectionStore/collectionStore.d.ts +385 -0
- package/dist/src/collectionStore/executeBatchFetch.d.ts +6 -0
- package/dist/src/collectionStore/useItem.d.ts +15 -0
- package/dist/src/collectionStore/useMultipleItems.d.ts +35 -0
- package/dist/src/debug.d.ts +30 -0
- package/dist/src/documentStore.d.ts +290 -0
- package/dist/src/hooks/useListItem.d.ts +22 -0
- package/dist/src/hooks/useListItemIsDeleted.d.ts +13 -0
- package/dist/src/hooks/useListItemIsLoading.d.ts +16 -0
- package/dist/src/indexed-db-storage.d.ts +1 -0
- package/dist/src/internal/offlineTestInstrumentation.d.ts +12 -0
- package/dist/src/internal/testTimelineTypes.d.ts +1 -0
- package/dist/src/invalidationUtils.d.ts +8 -0
- package/dist/src/isOffScreenContext.d.ts +16 -0
- package/dist/src/listQueryStore/createFetchApi.d.ts +1 -0
- package/dist/src/listQueryStore/createMutationApi.d.ts +1 -0
- package/dist/src/listQueryStore/executeItemBatchFetch.d.ts +20 -0
- package/dist/src/listQueryStore/executeQueryFetch.d.ts +7 -0
- package/dist/src/listQueryStore/itemFieldUtils.d.ts +77 -0
- package/dist/src/listQueryStore/listQueryCacheLimits.d.ts +1 -0
- package/dist/src/listQueryStore/listQueryStore.d.ts +538 -0
- package/dist/src/listQueryStore/types.d.ts +347 -0
- package/dist/src/listQueryStore/useFindItem.d.ts +7 -0
- package/dist/src/listQueryStore/useItem.d.ts +29 -0
- package/dist/src/listQueryStore/useListQuery.d.ts +29 -0
- package/dist/src/listQueryStore/useMultipleItems.d.ts +44 -0
- package/dist/src/listQueryStore/useMultipleListQueries.d.ts +46 -0
- package/dist/src/listQueryStore/usePendingOfflineItems.d.ts +19 -0
- package/dist/src/main.d.ts +23 -0
- package/dist/src/opfs-storage.d.ts +1 -0
- package/dist/src/persistentStorage/asyncStorageAdapter.d.ts +95 -0
- package/dist/src/persistentStorage/asyncStorageAdapters.d.ts +2 -0
- package/dist/src/persistentStorage/asyncStorageShared.d.ts +23 -0
- package/dist/src/persistentStorage/collectionStorePersistence.d.ts +26 -0
- package/dist/src/persistentStorage/compactListQueryLocalStorageEntry.d.ts +11 -0
- package/dist/src/persistentStorage/compactLocalStorageEntry.d.ts +8 -0
- package/dist/src/persistentStorage/documentEntryKey.d.ts +1 -0
- package/dist/src/persistentStorage/documentStorePersistence.d.ts +17 -0
- package/dist/src/persistentStorage/indexedDbAsyncStorageAdapter.d.ts +165 -0
- package/dist/src/persistentStorage/indexedDbPersistentStorage.d.ts +6 -0
- package/dist/src/persistentStorage/listQueryStorePersistence.d.ts +37 -0
- package/dist/src/persistentStorage/localStorageMetadata.d.ts +126 -0
- package/dist/src/persistentStorage/navigatorLocks.d.ts +3 -0
- package/dist/src/persistentStorage/offline/entityMetadata.d.ts +12 -0
- package/dist/src/persistentStorage/offline/fetchRuntime.d.ts +35 -0
- package/dist/src/persistentStorage/offline/mutationRuntime.d.ts +31 -0
- package/dist/src/persistentStorage/offline/offlineResolution.typeGuards.d.ts +1 -0
- package/dist/src/persistentStorage/offline/overlayStoreLifecycle.d.ts +13 -0
- package/dist/src/persistentStorage/offline/sessionCoordinator.d.ts +94 -0
- package/dist/src/persistentStorage/offline/sessionProtectionRegistry.d.ts +11 -0
- package/dist/src/persistentStorage/offline/storeController.d.ts +86 -0
- package/dist/src/persistentStorage/offline/types.d.ts +1255 -0
- package/dist/src/persistentStorage/offlineUploadRegistry.d.ts +11 -0
- package/dist/src/persistentStorage/offlineUploadTypes.d.ts +97 -0
- package/dist/src/persistentStorage/offlineUploadsShared.d.ts +4 -0
- package/dist/src/persistentStorage/opfsAsyncStorageAdapter.d.ts +24 -0
- package/dist/src/persistentStorage/opfsFileNaming.d.ts +23 -0
- package/dist/src/persistentStorage/opfsHelpers.d.ts +3 -0
- package/dist/src/persistentStorage/opfsOfflineUploadAdapter.d.ts +2 -0
- package/dist/src/persistentStorage/opfsPersistentStorage.d.ts +2 -0
- package/dist/src/persistentStorage/parsePersistedData.d.ts +45 -0
- package/dist/src/persistentStorage/persistenceUtils.d.ts +52 -0
- package/dist/src/persistentStorage/persistentStorageDefaults.d.ts +4 -0
- package/dist/src/persistentStorage/persistentStorageManager.d.ts +197 -0
- package/dist/src/persistentStorage/quotaDebug.d.ts +16 -0
- package/dist/src/persistentStorage/scheduleIdleCleanup.d.ts +28 -0
- package/dist/src/persistentStorage/storageAdapter.d.ts +41 -0
- package/dist/src/persistentStorage/storageEntryPrefixes.d.ts +16 -0
- package/dist/src/persistentStorage/types.d.ts +412 -0
- package/dist/src/persistentStorage/validateWithSchema.d.ts +12 -0
- package/dist/src/requestScheduler.d.ts +81 -0
- package/dist/src/storeManager.d.ts +160 -0
- package/dist/src/utils/automaticFetchPolicy.d.ts +29 -0
- package/dist/src/utils/browserTabsPriority.d.ts +43 -0
- package/dist/src/utils/browserTabsSync.d.ts +33 -0
- package/dist/src/utils/optimisticMutationTracker.d.ts +20 -0
- package/dist/src/utils/optimisticRollback.d.ts +11 -0
- package/dist/src/utils/payloadDebounce.d.ts +5 -0
- package/dist/src/utils/performMutation.d.ts +19 -0
- package/dist/src/utils/reusePrevIfEqual.d.ts +1 -0
- package/dist/src/utils/storeFocusLifecycle.d.ts +1 -0
- package/dist/src/utils/storeShared.d.ts +126 -0
- package/dist/src/utils/useEnsureIsLoaded.d.ts +6 -0
- package/dist/src/utils/useRequireFreshData.d.ts +6 -0
- package/dist/tests/basic-functionality/collection-store.test.d.ts +1 -0
- package/dist/tests/basic-functionality/document-store.test.d.ts +1 -0
- package/dist/tests/basic-functionality/list-query-state-manipulation.test.d.ts +1 -0
- package/dist/tests/basic-functionality/list-query-store.test.d.ts +1 -0
- package/dist/tests/browser-tabs/browser-tabs-background-rtu-batch.test.d.ts +1 -0
- package/dist/tests/browser-tabs/browser-tabs-background-rtu.test.d.ts +1 -0
- package/dist/tests/browser-tabs/browser-tabs-background-scheduling.test.d.ts +1 -0
- package/dist/tests/browser-tabs/browser-tabs-list-query-pagination.test.d.ts +1 -0
- package/dist/tests/browser-tabs/browser-tabs-non-cancelable-fetches.test.d.ts +1 -0
- package/dist/tests/browser-tabs/browser-tabs-optimistic-sync.test.d.ts +1 -0
- package/dist/tests/browser-tabs/browser-tabs-partial-resources.test.d.ts +1 -0
- package/dist/tests/browser-tabs/browser-tabs-priority.test.d.ts +1 -0
- package/dist/tests/browser-tabs/browser-tabs-snapshot-consistency.test.d.ts +1 -0
- package/dist/tests/browser-tabs/browser-tabs-state-methods.test.d.ts +1 -0
- package/dist/tests/browser-tabs/browser-tabs-sync-coordinator.test.d.ts +1 -0
- package/dist/tests/browser-tabs/browser-tabs-test-helpers.d.ts +69 -0
- package/dist/tests/browser-tabs/focus-coordinator.test.d.ts +1 -0
- package/dist/tests/hooks/collection-hooks-2.test.d.ts +1 -0
- package/dist/tests/hooks/collection-hooks.test.d.ts +1 -0
- package/dist/tests/hooks/collection-useListItem.test.d.ts +1 -0
- package/dist/tests/hooks/debounce-payload-hooks.test.d.ts +1 -0
- package/dist/tests/hooks/disable-refetches.test.d.ts +1 -0
- package/dist/tests/hooks/document-hooks-2.test.d.ts +1 -0
- package/dist/tests/hooks/document-hooks.test.d.ts +1 -0
- package/dist/tests/hooks/document-useListItem.test.d.ts +1 -0
- package/dist/tests/hooks/fetch-error-recovery.test.d.ts +1 -0
- package/dist/tests/hooks/hook-memoization.test.d.ts +1 -0
- package/dist/tests/hooks/list-query-hooks-2.test.d.ts +1 -0
- package/dist/tests/hooks/list-query-hooks-3.test.d.ts +1 -0
- package/dist/tests/hooks/list-query-hooks-mutations.test.d.ts +1 -0
- package/dist/tests/hooks/list-query-hooks.test.d.ts +1 -0
- package/dist/tests/hooks/list-query-pending-offline-items.test.d.ts +1 -0
- package/dist/tests/hooks/off-screen-context.test.d.ts +1 -0
- package/dist/tests/list-query-features/list-query-derived-queries.test.d.ts +1 -0
- package/dist/tests/list-query-features/list-query-offset-pagination.test.d.ts +1 -0
- package/dist/tests/list-query-features/list-query-optimistic-filters.test.d.ts +1 -0
- package/dist/tests/list-query-features/list-query-partial-resources-2.test.d.ts +1 -0
- package/dist/tests/list-query-features/list-query-partial-resources-3.test.d.ts +1 -0
- package/dist/tests/list-query-features/list-query-partial-resources-regressions.test.d.ts +1 -0
- package/dist/tests/list-query-features/list-query-partial-resources-show-partial-status.test.d.ts +1 -0
- package/dist/tests/list-query-features/list-query-partial-resources.test.d.ts +1 -0
- package/dist/tests/list-query-features/list-query-size-coalescing-partial-resources.test.d.ts +1 -0
- package/dist/tests/mocks/browserTabsTestUtils.d.ts +17 -0
- package/dist/tests/mocks/collectionStoreTestEnv.d.ts +265 -0
- package/dist/tests/mocks/documentStoreTestEnv.d.ts +140 -0
- package/dist/tests/mocks/duplicateStoreGuard.test.d.ts +1 -0
- package/dist/tests/mocks/listQueryStoreTestEnv.d.ts +295 -0
- package/dist/tests/mocks/mockBrowserOpfs.d.ts +70 -0
- package/dist/tests/mocks/mockBrowserOpfs.test.d.ts +1 -0
- package/dist/tests/mocks/mockLocalStorageStore.d.ts +61 -0
- package/dist/tests/mocks/seedScenarioPersistentStorage.d.ts +51 -0
- package/dist/tests/mocks/serverMock.d.ts +56 -0
- package/dist/tests/mocks/serverTableMock.d.ts +174 -0
- package/dist/tests/mocks/testEnvUtils.d.ts +120 -0
- package/dist/tests/mocks/testScenarioPersistentStorage.test.d.ts +1 -0
- package/dist/tests/offline/offline-fetching-scenarios.test.d.ts +1 -0
- package/dist/tests/offline/offline-mixed-adapter-storage.test.d.ts +1 -0
- package/dist/tests/offline/offline-mutation-fallback.test.d.ts +1 -0
- package/dist/tests/offline/offline-network-recovery.test.d.ts +1 -0
- package/dist/tests/offline/offline-outage.test.d.ts +1 -0
- package/dist/tests/offline/offline-overlays.test.d.ts +1 -0
- package/dist/tests/offline/offline-query-replay.test.d.ts +1 -0
- package/dist/tests/offline/offline-reads.test.d.ts +1 -0
- package/dist/tests/offline/offline-replay-conflicts.test.d.ts +1 -0
- package/dist/tests/offline/offline-replay-queueing.test.d.ts +1 -0
- package/dist/tests/offline/offline-resolution-dependencies.test.d.ts +1 -0
- package/dist/tests/offline/offline-runtime-controls.test.d.ts +1 -0
- package/dist/tests/offline/offline-session-and-global-state.test.d.ts +1 -0
- package/dist/tests/offline/offline-storage.test.d.ts +1 -0
- package/dist/tests/offline/offline-uploads.test.d.ts +1 -0
- package/dist/tests/offline/offlineReplayTestShared.d.ts +292 -0
- package/dist/tests/offline/offlineTestShared.d.ts +156 -0
- package/dist/tests/perform-mutation/mutation-error-rollback.test.d.ts +1 -0
- package/dist/tests/perform-mutation/perform-mutation-block-window-close.test.d.ts +1 -0
- package/dist/tests/perform-mutation/perform-mutation-debounce.test.d.ts +1 -0
- package/dist/tests/perform-mutation/store-events.test.d.ts +1 -0
- package/dist/tests/persistent-storage/async-storage-efficiency/collection.test.d.ts +1 -0
- package/dist/tests/persistent-storage/async-storage-efficiency/document.test.d.ts +1 -0
- package/dist/tests/persistent-storage/async-storage-efficiency/list-query.test.d.ts +1 -0
- package/dist/tests/persistent-storage/async-storage-efficiency/maintenance.test.d.ts +1 -0
- package/dist/tests/persistent-storage/async-storage-efficiency/shared.d.ts +804 -0
- package/dist/tests/persistent-storage/async-storage-shared.test.d.ts +1 -0
- package/dist/tests/persistent-storage/collection-store-persistence.converted.opfs.test.d.ts +1 -0
- package/dist/tests/persistent-storage/collection-store-persistence.converted.test.d.ts +1 -0
- package/dist/tests/persistent-storage/collection-store-persistence.opfs.test.d.ts +1 -0
- package/dist/tests/persistent-storage/collection-store-persistence.test.d.ts +1 -0
- package/dist/tests/persistent-storage/document-store-persistence.converted.opfs.test.d.ts +1 -0
- package/dist/tests/persistent-storage/document-store-persistence.converted.test.d.ts +1 -0
- package/dist/tests/persistent-storage/document-store-persistence.opfs.test.d.ts +1 -0
- package/dist/tests/persistent-storage/document-store-persistence.test.d.ts +1 -0
- package/dist/tests/persistent-storage/expiration-scan.test.d.ts +1 -0
- package/dist/tests/persistent-storage/indexeddb-async-storage-efficiency/collection.test.d.ts +1 -0
- package/dist/tests/persistent-storage/indexeddb-async-storage-efficiency/document.test.d.ts +1 -0
- package/dist/tests/persistent-storage/indexeddb-async-storage-efficiency/list-query.test.d.ts +1 -0
- package/dist/tests/persistent-storage/indexeddb-async-storage-efficiency/maintenance.test.d.ts +1 -0
- package/dist/tests/persistent-storage/indexeddb-async-storage-efficiency/shared.d.ts +780 -0
- package/dist/tests/persistent-storage/indexeddb-storage-adapter.test.d.ts +1 -0
- package/dist/tests/persistent-storage/list-query-store-persistence.converted.opfs.test.d.ts +1 -0
- package/dist/tests/persistent-storage/list-query-store-persistence.converted.test.d.ts +1 -0
- package/dist/tests/persistent-storage/list-query-store-persistence.opfs.test.d.ts +1 -0
- package/dist/tests/persistent-storage/list-query-store-persistence.test.d.ts +1 -0
- package/dist/tests/persistent-storage/persistence-with-tabs-sync.test.d.ts +1 -0
- package/dist/tests/persistent-storage/persistentStorageByteBudgetTestUtils.d.ts +18 -0
- package/dist/tests/persistent-storage/quota-exceeded-recovery-no-locks.test.d.ts +1 -0
- package/dist/tests/persistent-storage/quota-exceeded-recovery.test.d.ts +1 -0
- package/dist/tests/persistent-storage/quotaRecoveryTestUtils.d.ts +228 -0
- package/dist/tests/persistent-storage/storage-adapter.test.d.ts +1 -0
- package/dist/tests/persistent-storage/sync-storage-efficiency/collection.test.d.ts +1 -0
- package/dist/tests/persistent-storage/sync-storage-efficiency/document.test.d.ts +1 -0
- package/dist/tests/persistent-storage/sync-storage-efficiency/list-query.test.d.ts +1 -0
- package/dist/tests/persistent-storage/sync-storage-efficiency/maintenance.test.d.ts +1 -0
- package/dist/tests/persistent-storage/sync-storage-efficiency/shared.d.ts +784 -0
- package/dist/tests/playwright/browser-tabs.spec.d.ts +1 -0
- package/dist/tests/playwright/persistent-storage.spec.d.ts +1 -0
- package/dist/tests/request-schedulling/batch-medium-priority.test.d.ts +1 -0
- package/dist/tests/request-schedulling/batch-realtime-updates.test.d.ts +1 -0
- package/dist/tests/request-schedulling/collection-batch-coalescing.test.d.ts +1 -0
- package/dist/tests/request-schedulling/collection-batch-key-grouping.test.d.ts +1 -0
- package/dist/tests/request-schedulling/collection-fetch-orchestration.test.d.ts +1 -0
- package/dist/tests/request-schedulling/document-await-fetch.test.d.ts +1 -0
- package/dist/tests/request-schedulling/document-base-coalescing.test.d.ts +1 -0
- package/dist/tests/request-schedulling/document-fetch-orchestration.test.d.ts +1 -0
- package/dist/tests/request-schedulling/document-medium-priority-fetch.test.d.ts +1 -0
- package/dist/tests/request-schedulling/document-realtime-updates.test.d.ts +1 -0
- package/dist/tests/request-schedulling/list-query-item-batch-coalescing.test.d.ts +1 -0
- package/dist/tests/request-schedulling/list-query-item-batch-key-grouping.test.d.ts +1 -0
- package/dist/tests/request-schedulling/list-query-size-coalescing.test.d.ts +1 -0
- package/dist/tests/request-schedulling/medium-vs-realtime.test.d.ts +1 -0
- package/dist/tests/request-schedulling/request-scheduler-cross-tab-sync.test.d.ts +1 -0
- package/dist/tests/request-schedulling/window-focus.test.d.ts +1 -0
- package/dist/tests/store-manager.test.d.ts +1 -0
- package/dist/tests/user-facing-api/collection-offline-usage.test.d.ts +1 -0
- package/dist/tests/user-facing-api/document-offline-usage.test.d.ts +1 -0
- package/dist/tests/user-facing-api/list-query-offline-usage.test.d.ts +1 -0
- package/dist/tests/user-facing-api/result-returning-callbacks.test.d.ts +1 -0
- package/dist/tests/utils/genericTestUtils.d.ts +6 -0
- package/dist/tests/utils/indexedDbPersistentStorageOptimizationTestUtils.d.ts +79 -0
- package/dist/tests/utils/indexedDbPersistentStorageTestStore.d.ts +181 -0
- package/dist/tests/utils/listQueryHooksTestUtils.d.ts +8 -0
- package/dist/tests/utils/networkMock.d.ts +11 -0
- package/dist/tests/utils/opfsPersistentStorageTestStore.d.ts +220 -0
- package/dist/tests/utils/persistentStorageOptimizationTestUtils.d.ts +54 -0
- package/dist/tests/utils/persistentStorageOptimizationTestUtils.test.d.ts +1 -0
- package/dist/tests/utils/persistentStorageTestStore.d.ts +66 -0
- package/dist/tests/utils/resetSessionForTests.d.ts +3 -0
- package/dist/tests/utils/withSuppressedActError.d.ts +4 -0
- package/dist/{types-aWgyZHLj.d.ts → types-D0ttVGmj.d.ts} +1 -1
- package/docs/browser-tabs-sync.md +2 -0
- package/docs/mutations.md +7 -3
- package/docs/persistent-storage.md +2 -0
- package/package.json +6 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function range(start: number, end: number): number[];
|
|
2
|
+
export declare function pick<T extends Record<string, unknown>, K extends keyof T>(obj: T | null | undefined, keys: K[]): Record<string, unknown>;
|
|
3
|
+
export declare function flushAllTimers(): Promise<void>;
|
|
4
|
+
export declare function advanceTime(ms: number): Promise<void>;
|
|
5
|
+
export declare function resolveAfterAllTimers<T>(promise: Promise<T>): Promise<T>;
|
|
6
|
+
export declare function waitForScheduledCleanup(delayMs?: number): Promise<void>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { AsyncStorageNamespaceScope } from '../../src/persistentStorage/types';
|
|
2
|
+
import { type IndexedDbPersistentStorageTestStore } from './indexedDbPersistentStorageTestStore';
|
|
3
|
+
type IndexedDbStructureSnapshot = {
|
|
4
|
+
stores: Array<{
|
|
5
|
+
autoIncrement: boolean;
|
|
6
|
+
indexes: Array<{
|
|
7
|
+
keyPath: string | string[] | null;
|
|
8
|
+
multiEntry: boolean;
|
|
9
|
+
name: string;
|
|
10
|
+
unique: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
keyPath: string | string[] | null;
|
|
13
|
+
name: string;
|
|
14
|
+
rowCount: number;
|
|
15
|
+
rows: Array<{
|
|
16
|
+
key: unknown;
|
|
17
|
+
value: unknown;
|
|
18
|
+
}>;
|
|
19
|
+
}>;
|
|
20
|
+
version: number;
|
|
21
|
+
};
|
|
22
|
+
export declare function getIndexedDbStructureSnapshot(mockAdapter: IndexedDbPersistentStorageTestStore): Promise<IndexedDbStructureSnapshot>;
|
|
23
|
+
type IndexedDbRowReference = {
|
|
24
|
+
key: unknown;
|
|
25
|
+
storeName: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function getParsedIndexedDbRecordData<T = unknown>(mockAdapterOrReference: IndexedDbPersistentStorageTestStore | IndexedDbRowReference, maybeReference?: IndexedDbRowReference): Promise<T | null>;
|
|
28
|
+
export declare function getIndexedDbNamespaceSnapshot(mockAdapter: IndexedDbPersistentStorageTestStore, scope: AsyncStorageNamespaceScope): Promise<{
|
|
29
|
+
entries: Record<string, Record<string, unknown>>;
|
|
30
|
+
staticPolicy?: Record<string, unknown>;
|
|
31
|
+
} | null>;
|
|
32
|
+
export declare function getIndexedDbPayloadSnapshot<T = unknown>(mockAdapter: IndexedDbPersistentStorageTestStore, args: {
|
|
33
|
+
key: string;
|
|
34
|
+
scope: AsyncStorageNamespaceScope;
|
|
35
|
+
}): Promise<T | null>;
|
|
36
|
+
type IndexedDbPersistentStorageOperationCaptureResult = {
|
|
37
|
+
operations: string[];
|
|
38
|
+
timelineString: string;
|
|
39
|
+
};
|
|
40
|
+
export declare function startIndexedDbPersistentStorageOperationCapture(mockAdapter: IndexedDbPersistentStorageTestStore): {
|
|
41
|
+
finish: () => IndexedDbPersistentStorageOperationCaptureResult;
|
|
42
|
+
};
|
|
43
|
+
export declare function getParsedLocalStorageValue<T = unknown>(key: string): T | null;
|
|
44
|
+
export declare function startPersistentStorageOperationCapture(): {
|
|
45
|
+
finish: () => {
|
|
46
|
+
timelineString: string;
|
|
47
|
+
operations: readonly ({
|
|
48
|
+
time: number;
|
|
49
|
+
type: "getItem";
|
|
50
|
+
exists: boolean;
|
|
51
|
+
key: string | null;
|
|
52
|
+
rawValue: string | null;
|
|
53
|
+
valueByteSize: number | null;
|
|
54
|
+
} | {
|
|
55
|
+
time: number;
|
|
56
|
+
type: "setItem";
|
|
57
|
+
existsBefore: boolean;
|
|
58
|
+
valueChanged: boolean;
|
|
59
|
+
key: string;
|
|
60
|
+
rawValueAfter: string;
|
|
61
|
+
valueByteSizeBefore: number | null;
|
|
62
|
+
valueByteSizeAfter: number;
|
|
63
|
+
} | {
|
|
64
|
+
time: number;
|
|
65
|
+
type: "removeItem";
|
|
66
|
+
existsBefore: boolean;
|
|
67
|
+
key: string;
|
|
68
|
+
} | {
|
|
69
|
+
time: number;
|
|
70
|
+
type: "key";
|
|
71
|
+
index: number;
|
|
72
|
+
key: string | null;
|
|
73
|
+
} | {
|
|
74
|
+
time: number;
|
|
75
|
+
type: "clear";
|
|
76
|
+
})[];
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import type { ItemLoadedFields } from '../../src/listQueryStore/types';
|
|
2
|
+
import { createIndexedDbPersistentStorageForTests, type IndexedDbPersistentStorageOperation, type IndexedDbPersistentStorageOptions } from '../../src/persistentStorage/indexedDbAsyncStorageAdapter';
|
|
3
|
+
import type { AsyncStorageNamespaceScope, AsyncStorageNamespaceStaticPolicy } from '../../src/persistentStorage/types';
|
|
4
|
+
type StorageSeedOptions = {
|
|
5
|
+
timestamp?: number;
|
|
6
|
+
version?: number;
|
|
7
|
+
};
|
|
8
|
+
type ListQuerySeedItemOptions = StorageSeedOptions & {
|
|
9
|
+
loadedFields?: ItemLoadedFields;
|
|
10
|
+
};
|
|
11
|
+
type ListQueryItemRef = string | {
|
|
12
|
+
tableId: string;
|
|
13
|
+
id: number | string;
|
|
14
|
+
};
|
|
15
|
+
type IndexedDbPersistentStorageTestStoreOptions = {
|
|
16
|
+
databaseName?: string;
|
|
17
|
+
initialState?: {
|
|
18
|
+
storeName: string;
|
|
19
|
+
sessionKey: string;
|
|
20
|
+
document?: {
|
|
21
|
+
data: unknown;
|
|
22
|
+
timestamp?: number;
|
|
23
|
+
version?: number;
|
|
24
|
+
};
|
|
25
|
+
collection?: Array<{
|
|
26
|
+
payload: string;
|
|
27
|
+
data: unknown;
|
|
28
|
+
timestamp?: number;
|
|
29
|
+
version?: number;
|
|
30
|
+
}>;
|
|
31
|
+
listQuery?: {
|
|
32
|
+
items?: Array<{
|
|
33
|
+
tableId: string;
|
|
34
|
+
id: number | string;
|
|
35
|
+
data: unknown;
|
|
36
|
+
timestamp?: number;
|
|
37
|
+
version?: number;
|
|
38
|
+
}>;
|
|
39
|
+
queries?: Array<{
|
|
40
|
+
params: unknown;
|
|
41
|
+
items: Array<{
|
|
42
|
+
tableId: string;
|
|
43
|
+
id: number | string;
|
|
44
|
+
}>;
|
|
45
|
+
hasMore?: boolean;
|
|
46
|
+
timestamp?: number;
|
|
47
|
+
version?: number;
|
|
48
|
+
}>;
|
|
49
|
+
};
|
|
50
|
+
rawEntries?: Record<string, unknown>;
|
|
51
|
+
};
|
|
52
|
+
persistentStorageOptions?: IndexedDbPersistentStorageOptions;
|
|
53
|
+
};
|
|
54
|
+
type IndexedDbStructureInspection = {
|
|
55
|
+
stores: Array<{
|
|
56
|
+
autoIncrement: boolean;
|
|
57
|
+
indexes: Array<{
|
|
58
|
+
keyPath: string | string[] | null;
|
|
59
|
+
multiEntry: boolean;
|
|
60
|
+
name: string;
|
|
61
|
+
unique: boolean;
|
|
62
|
+
}>;
|
|
63
|
+
keyPath: string | string[] | null;
|
|
64
|
+
name: string;
|
|
65
|
+
rows: Array<{
|
|
66
|
+
key: unknown;
|
|
67
|
+
value: unknown;
|
|
68
|
+
}>;
|
|
69
|
+
}>;
|
|
70
|
+
version: number;
|
|
71
|
+
};
|
|
72
|
+
type IndexedDbPersistentStorageTestStoreScope = {
|
|
73
|
+
document: {
|
|
74
|
+
namespace: AsyncStorageNamespaceScope;
|
|
75
|
+
storageKey: () => string;
|
|
76
|
+
seed: <T>(data: T, options?: StorageSeedOptions) => string;
|
|
77
|
+
setPayload: (value: unknown) => void;
|
|
78
|
+
setMetadata: (value: unknown) => void;
|
|
79
|
+
removePayload: () => void;
|
|
80
|
+
removeMetadata: () => void;
|
|
81
|
+
};
|
|
82
|
+
collection: {
|
|
83
|
+
namespace: AsyncStorageNamespaceScope;
|
|
84
|
+
itemKey: (payload: string) => string;
|
|
85
|
+
itemStorageKey: (payload: string) => string;
|
|
86
|
+
listStoredPayloads: () => Promise<string[]>;
|
|
87
|
+
setStaticPolicy: (policy: Record<string, unknown>) => void;
|
|
88
|
+
seedItem: <T>(payload: string, data: T, options?: StorageSeedOptions) => string;
|
|
89
|
+
};
|
|
90
|
+
listQuery: {
|
|
91
|
+
itemNamespace: AsyncStorageNamespaceScope;
|
|
92
|
+
queryNamespace: AsyncStorageNamespaceScope;
|
|
93
|
+
itemKey: (tableId: string, id: number | string) => string;
|
|
94
|
+
itemStorageKey: (tableId: string, id: number | string) => string;
|
|
95
|
+
queryKey: (params: unknown) => string;
|
|
96
|
+
queryStorageKey: (params: unknown) => string;
|
|
97
|
+
listStoredItemKeys: () => Promise<string[]>;
|
|
98
|
+
listStoredQueryKeys: () => Promise<string[]>;
|
|
99
|
+
setItemStaticPolicy: (policy: Record<string, unknown>) => void;
|
|
100
|
+
setQueryStaticPolicy: (policy: Record<string, unknown>) => void;
|
|
101
|
+
seedItem: <T>(tableId: string, id: number | string, data: T, options?: ListQuerySeedItemOptions) => {
|
|
102
|
+
itemKey: string;
|
|
103
|
+
payload: string;
|
|
104
|
+
storageKey: string;
|
|
105
|
+
};
|
|
106
|
+
seedQuery: (params: unknown, items: ListQueryItemRef[], options?: StorageSeedOptions & {
|
|
107
|
+
hasMore?: boolean;
|
|
108
|
+
}) => string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
export declare function serializeTestStaticPolicy(policy: AsyncStorageNamespaceStaticPolicy | Record<string, unknown> | null | undefined): Record<string, unknown> | null;
|
|
112
|
+
export type ManagedMetadataRecord = {
|
|
113
|
+
customMetadata: Record<string, unknown>;
|
|
114
|
+
key: string;
|
|
115
|
+
lastAccessAt: number;
|
|
116
|
+
sizeBytes?: number;
|
|
117
|
+
version: number;
|
|
118
|
+
writtenAt: number;
|
|
119
|
+
};
|
|
120
|
+
export declare function serializeManagedMetadataRecord(metadata: ManagedMetadataRecord): Record<string, unknown>;
|
|
121
|
+
export type IndexedDbPersistentStorageTestStore = {
|
|
122
|
+
adapter: ReturnType<typeof createIndexedDbPersistentStorageForTests>['adapter'];
|
|
123
|
+
clearReadRequests: () => void;
|
|
124
|
+
clearInstrumentation: () => void;
|
|
125
|
+
databaseName: string;
|
|
126
|
+
flushIndexedDbCommits: () => Promise<void>;
|
|
127
|
+
flushPendingWrites: () => Promise<void>;
|
|
128
|
+
flushWrites: () => Promise<void>;
|
|
129
|
+
scopeReadRequests: (args?: {
|
|
130
|
+
storeName: string;
|
|
131
|
+
sessionKey: string;
|
|
132
|
+
}) => string[];
|
|
133
|
+
getRaw: (key: string) => Promise<string | null>;
|
|
134
|
+
has: (key: string) => Promise<boolean>;
|
|
135
|
+
listKeysRequests: AsyncStorageNamespaceScope[];
|
|
136
|
+
operations: IndexedDbPersistentStorageOperation[];
|
|
137
|
+
payloadGetManyRequests: string[][];
|
|
138
|
+
payloadGetRequests: string[];
|
|
139
|
+
storage: {
|
|
140
|
+
getRaw: (key: string) => Promise<string | null>;
|
|
141
|
+
has: (key: string) => Promise<boolean>;
|
|
142
|
+
writeRaw: (key: string, raw: string) => void;
|
|
143
|
+
writeValue: <T>(key: string, value: T) => void;
|
|
144
|
+
writePayload: (key: string, value: unknown) => void;
|
|
145
|
+
writeMetadata: (key: string, value: unknown) => void;
|
|
146
|
+
removePayload: (key: string) => void;
|
|
147
|
+
removeMetadata: (key: string) => void;
|
|
148
|
+
};
|
|
149
|
+
indexedDb: {
|
|
150
|
+
getRow: (storeName: string, key: unknown) => Promise<unknown>;
|
|
151
|
+
listRows: (storeName: string) => Promise<Array<{
|
|
152
|
+
key: unknown;
|
|
153
|
+
value: unknown;
|
|
154
|
+
}>>;
|
|
155
|
+
putRow: (storeName: string, value: unknown) => Promise<unknown>;
|
|
156
|
+
updateRow: (storeName: string, key: unknown, update: (current: unknown) => unknown) => Promise<unknown>;
|
|
157
|
+
deleteRow: (storeName: string, key: unknown) => Promise<unknown>;
|
|
158
|
+
inspectStructure: () => Promise<IndexedDbStructureInspection>;
|
|
159
|
+
mutateRawRow: (storeName: string, key: unknown, update: (current: unknown) => unknown) => Promise<void>;
|
|
160
|
+
queueMutateRawRow: (storeName: string, key: unknown, update: (current: unknown) => unknown) => void;
|
|
161
|
+
failCleanupRemoveKnownRecords: (scope: AsyncStorageNamespaceScope, times?: number) => void;
|
|
162
|
+
};
|
|
163
|
+
rawNamespace: {
|
|
164
|
+
get: (scope: AsyncStorageNamespaceScope, key: string) => Promise<unknown>;
|
|
165
|
+
listKeys: (scope: AsyncStorageNamespaceScope) => Promise<string[]>;
|
|
166
|
+
remove: (scope: AsyncStorageNamespaceScope, key: string) => void;
|
|
167
|
+
set: (scope: AsyncStorageNamespaceScope, key: string, value: unknown) => void;
|
|
168
|
+
};
|
|
169
|
+
readMetadata: (key: string) => Promise<ManagedMetadataRecord | null>;
|
|
170
|
+
removeMetadata: (key: string) => void;
|
|
171
|
+
removePayload: (key: string) => void;
|
|
172
|
+
scope: (storeName: string, sessionKey: string) => IndexedDbPersistentStorageTestStoreScope;
|
|
173
|
+
setMetadata: (key: string, value: unknown) => void;
|
|
174
|
+
setPayload: (key: string, value: unknown) => void;
|
|
175
|
+
setRaw: (key: string, raw: string) => void;
|
|
176
|
+
setValue: <T>(key: string, value: T) => void;
|
|
177
|
+
};
|
|
178
|
+
export declare function getCurrentIndexedDbPersistentStorageTestStore(): IndexedDbPersistentStorageTestStore;
|
|
179
|
+
export declare function resetCurrentIndexedDbPersistentStorageTestStore(): Promise<void>;
|
|
180
|
+
export declare function createIndexedDbPersistentStorageTestStore(options?: IndexedDbPersistentStorageTestStoreOptions): IndexedDbPersistentStorageTestStore;
|
|
181
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { OfflineNetworkModeConfig } from '../../src/persistentStorage/offline/types';
|
|
2
|
+
export declare function createOfflineNetworkMock(initialOnline?: boolean): {
|
|
3
|
+
config: OfflineNetworkModeConfig;
|
|
4
|
+
install(): void;
|
|
5
|
+
isOnline(): boolean;
|
|
6
|
+
isOffline(): boolean;
|
|
7
|
+
setOnline(): void;
|
|
8
|
+
setOffline(): void;
|
|
9
|
+
goOnline(): void;
|
|
10
|
+
goOffline(): void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import type { ItemLoadedFields } from '../../src/listQueryStore/types';
|
|
2
|
+
import type { AsyncStorageNamespaceScope } from '../../src/persistentStorage/types';
|
|
3
|
+
import { type MockBrowserOpfsEnvironment } from '../mocks/mockBrowserOpfs';
|
|
4
|
+
type StorageSeedOptions = {
|
|
5
|
+
timestamp?: number;
|
|
6
|
+
version?: number;
|
|
7
|
+
};
|
|
8
|
+
type ListQuerySeedItemOptions = StorageSeedOptions & {
|
|
9
|
+
loadedFields?: ItemLoadedFields;
|
|
10
|
+
};
|
|
11
|
+
type ListQueryItemRef = string | {
|
|
12
|
+
tableId: string;
|
|
13
|
+
id: number | string;
|
|
14
|
+
};
|
|
15
|
+
type ManagedMetadataRecord = {
|
|
16
|
+
customMetadata: Record<string, unknown>;
|
|
17
|
+
key: string;
|
|
18
|
+
lastAccessAt: number;
|
|
19
|
+
sizeBytes?: number;
|
|
20
|
+
version: number;
|
|
21
|
+
writtenAt: number;
|
|
22
|
+
};
|
|
23
|
+
type RecordKind = 'payload' | 'internal';
|
|
24
|
+
type InstrumentedRecord = {
|
|
25
|
+
key: string;
|
|
26
|
+
logicalKey: string | null;
|
|
27
|
+
recordKind: RecordKind;
|
|
28
|
+
};
|
|
29
|
+
type MockOpfsBaseOperation = {
|
|
30
|
+
path: string;
|
|
31
|
+
startedTime: number;
|
|
32
|
+
time: number;
|
|
33
|
+
};
|
|
34
|
+
type UntrackedMockOpfsFileOperation = MockOpfsBaseOperation & {
|
|
35
|
+
fileName: string;
|
|
36
|
+
scope: null;
|
|
37
|
+
} & ({
|
|
38
|
+
created: boolean;
|
|
39
|
+
exists: boolean;
|
|
40
|
+
type: 'ensureFile' | 'openFile';
|
|
41
|
+
} | {
|
|
42
|
+
readRaw: string;
|
|
43
|
+
type: 'readFile';
|
|
44
|
+
valueByteSize: number;
|
|
45
|
+
} | {
|
|
46
|
+
writeRaw: string;
|
|
47
|
+
type: 'writeFile';
|
|
48
|
+
valueChanged: boolean;
|
|
49
|
+
valueByteSizeAfter: number;
|
|
50
|
+
valueByteSizeBefore: number;
|
|
51
|
+
} | {
|
|
52
|
+
errorName: string;
|
|
53
|
+
phase: 'close' | 'createWritable';
|
|
54
|
+
type: 'writeFileFailed';
|
|
55
|
+
} | {
|
|
56
|
+
exists: boolean;
|
|
57
|
+
type: 'deleteFile';
|
|
58
|
+
});
|
|
59
|
+
export type MockOpfsOperation = (MockOpfsBaseOperation & {
|
|
60
|
+
created: boolean;
|
|
61
|
+
exists: boolean;
|
|
62
|
+
scope: AsyncStorageNamespaceScope | null;
|
|
63
|
+
type: 'ensureDir' | 'openDir';
|
|
64
|
+
}) | (MockOpfsBaseOperation & {
|
|
65
|
+
created: boolean;
|
|
66
|
+
exists: boolean;
|
|
67
|
+
record: InstrumentedRecord;
|
|
68
|
+
scope: AsyncStorageNamespaceScope;
|
|
69
|
+
type: 'ensureFile' | 'openFile';
|
|
70
|
+
}) | (MockOpfsBaseOperation & {
|
|
71
|
+
record: InstrumentedRecord;
|
|
72
|
+
scope: AsyncStorageNamespaceScope;
|
|
73
|
+
} & ({
|
|
74
|
+
readRaw: string;
|
|
75
|
+
type: 'readFile';
|
|
76
|
+
valueByteSize: number;
|
|
77
|
+
} | {
|
|
78
|
+
writeRaw: string;
|
|
79
|
+
type: 'writeFile';
|
|
80
|
+
valueChanged: boolean;
|
|
81
|
+
valueByteSizeAfter: number;
|
|
82
|
+
valueByteSizeBefore: number;
|
|
83
|
+
} | {
|
|
84
|
+
errorName: string;
|
|
85
|
+
phase: 'close' | 'createWritable';
|
|
86
|
+
type: 'writeFileFailed';
|
|
87
|
+
})) | (MockOpfsBaseOperation & {
|
|
88
|
+
exists: boolean;
|
|
89
|
+
record: InstrumentedRecord;
|
|
90
|
+
scope: AsyncStorageNamespaceScope;
|
|
91
|
+
type: 'deleteFile';
|
|
92
|
+
}) | UntrackedMockOpfsFileOperation | (MockOpfsBaseOperation & {
|
|
93
|
+
entries: string[];
|
|
94
|
+
method: 'entries' | 'keys' | 'values';
|
|
95
|
+
scope: AsyncStorageNamespaceScope | null;
|
|
96
|
+
type: 'listDir';
|
|
97
|
+
}) | (MockOpfsBaseOperation & {
|
|
98
|
+
deleted: boolean;
|
|
99
|
+
exists: boolean;
|
|
100
|
+
recursive: boolean;
|
|
101
|
+
scope: AsyncStorageNamespaceScope | null;
|
|
102
|
+
type: 'deleteDir';
|
|
103
|
+
});
|
|
104
|
+
export type OpfsPersistentStorageTestStore = ReturnType<typeof createOpfsPersistentStorageTestStore>;
|
|
105
|
+
type OpfsPersistentStorageTestStoreScope = {
|
|
106
|
+
document: {
|
|
107
|
+
namespace: AsyncStorageNamespaceScope;
|
|
108
|
+
storageKey: () => string;
|
|
109
|
+
seed: <T>(data: T, options?: StorageSeedOptions) => string;
|
|
110
|
+
setPayload: (value: unknown) => void;
|
|
111
|
+
setMetadata: (value: unknown) => void;
|
|
112
|
+
removePayload: () => void;
|
|
113
|
+
removeMetadata: () => void;
|
|
114
|
+
};
|
|
115
|
+
collection: {
|
|
116
|
+
namespace: AsyncStorageNamespaceScope;
|
|
117
|
+
itemKey: (payload: string) => string;
|
|
118
|
+
itemStorageKey: (payload: string) => string;
|
|
119
|
+
listStoredPayloads: () => string[];
|
|
120
|
+
setStaticPolicy: (policy: Record<string, unknown>) => void;
|
|
121
|
+
seedItem: <T>(payload: string, data: T, options?: StorageSeedOptions) => string;
|
|
122
|
+
};
|
|
123
|
+
listQuery: {
|
|
124
|
+
itemNamespace: AsyncStorageNamespaceScope;
|
|
125
|
+
queryNamespace: AsyncStorageNamespaceScope;
|
|
126
|
+
itemKey: (tableId: string, id: number | string) => string;
|
|
127
|
+
itemStorageKey: (tableId: string, id: number | string) => string;
|
|
128
|
+
queryKey: (params: unknown) => string;
|
|
129
|
+
queryStorageKey: (params: unknown) => string;
|
|
130
|
+
listStoredItemKeys: () => string[];
|
|
131
|
+
listStoredQueryKeys: () => string[];
|
|
132
|
+
setItemStaticPolicy: (policy: Record<string, unknown>) => void;
|
|
133
|
+
setQueryStaticPolicy: (policy: Record<string, unknown>) => void;
|
|
134
|
+
seedItem: <T>(tableId: string, id: number | string, data: T, options?: ListQuerySeedItemOptions) => {
|
|
135
|
+
itemKey: string;
|
|
136
|
+
payload: string;
|
|
137
|
+
storageKey: string;
|
|
138
|
+
};
|
|
139
|
+
seedQuery: (params: unknown, items: ListQueryItemRef[], options?: StorageSeedOptions & {
|
|
140
|
+
hasMore?: boolean;
|
|
141
|
+
}) => string;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
export type OpfsPersistentStorageTestStoreOptions = {
|
|
145
|
+
initialState?: {
|
|
146
|
+
storeName: string;
|
|
147
|
+
sessionKey: string;
|
|
148
|
+
document?: {
|
|
149
|
+
data: unknown;
|
|
150
|
+
timestamp?: number;
|
|
151
|
+
version?: number;
|
|
152
|
+
};
|
|
153
|
+
collection?: Array<{
|
|
154
|
+
payload: string;
|
|
155
|
+
data: unknown;
|
|
156
|
+
timestamp?: number;
|
|
157
|
+
version?: number;
|
|
158
|
+
}>;
|
|
159
|
+
listQuery?: {
|
|
160
|
+
items?: Array<{
|
|
161
|
+
tableId: string;
|
|
162
|
+
id: number | string;
|
|
163
|
+
data: unknown;
|
|
164
|
+
timestamp?: number;
|
|
165
|
+
version?: number;
|
|
166
|
+
}>;
|
|
167
|
+
queries?: Array<{
|
|
168
|
+
params: unknown;
|
|
169
|
+
items: Array<{
|
|
170
|
+
tableId: string;
|
|
171
|
+
id: number | string;
|
|
172
|
+
}>;
|
|
173
|
+
hasMore?: boolean;
|
|
174
|
+
timestamp?: number;
|
|
175
|
+
version?: number;
|
|
176
|
+
}>;
|
|
177
|
+
};
|
|
178
|
+
rawEntries?: Record<string, unknown>;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
export declare function createOpfsPersistentStorageTestStore(options?: OpfsPersistentStorageTestStoreOptions): {
|
|
182
|
+
mockBrowserOpfs: MockBrowserOpfsEnvironment;
|
|
183
|
+
storage: {
|
|
184
|
+
getRaw: (key: string) => string | null;
|
|
185
|
+
has: (key: string) => boolean;
|
|
186
|
+
writeRaw: (key: string, raw: string) => void;
|
|
187
|
+
writeValue: <T>(key: string, value: T) => void;
|
|
188
|
+
writePayload: (key: string, value: unknown) => void;
|
|
189
|
+
writeMetadata: (key: string, value: unknown) => void;
|
|
190
|
+
removePayload: (key: string) => void;
|
|
191
|
+
removeMetadata: (key: string) => void;
|
|
192
|
+
};
|
|
193
|
+
payloadGetRequests: string[];
|
|
194
|
+
payloadGetManyRequests: string[][];
|
|
195
|
+
listKeysRequests: AsyncStorageNamespaceScope[];
|
|
196
|
+
operations: MockOpfsOperation[];
|
|
197
|
+
scopeReadRequests: (args?: {
|
|
198
|
+
storeName: string;
|
|
199
|
+
sessionKey: string;
|
|
200
|
+
}) => string[];
|
|
201
|
+
clearReadRequests: () => void;
|
|
202
|
+
clearInstrumentation: () => void;
|
|
203
|
+
getRaw: (key: string) => string | null;
|
|
204
|
+
has: (key: string) => boolean;
|
|
205
|
+
scope: (storeName: string, sessionKey: string) => OpfsPersistentStorageTestStoreScope;
|
|
206
|
+
setRaw: (key: string, raw: string) => void;
|
|
207
|
+
setValue: <T>(key: string, value: T) => void;
|
|
208
|
+
setPayload: (key: string, value: unknown) => void;
|
|
209
|
+
setMetadata: (key: string, value: unknown) => void;
|
|
210
|
+
readMetadata: (key: string) => ManagedMetadataRecord | null;
|
|
211
|
+
removePayload: (key: string) => void;
|
|
212
|
+
removeMetadata: (key: string) => void;
|
|
213
|
+
rawNamespace: {
|
|
214
|
+
get: (scope: AsyncStorageNamespaceScope, key: string) => unknown;
|
|
215
|
+
listKeys: (scope: AsyncStorageNamespaceScope) => string[];
|
|
216
|
+
remove: (scope: AsyncStorageNamespaceScope, key: string) => void;
|
|
217
|
+
set: (scope: AsyncStorageNamespaceScope, key: string, value: unknown) => void;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { AsyncStorageNamespaceScope } from '../../src/persistentStorage/types';
|
|
2
|
+
import type { MockBrowserOpfsEnvironment } from '../mocks/mockBrowserOpfs';
|
|
3
|
+
import { createOpfsPersistentStorageTestStore } from './opfsPersistentStorageTestStore';
|
|
4
|
+
type PersistentStorageOperation = {
|
|
5
|
+
time: number;
|
|
6
|
+
type: 'getItem';
|
|
7
|
+
exists: boolean;
|
|
8
|
+
key: string | null;
|
|
9
|
+
rawValue: string | null;
|
|
10
|
+
valueByteSize: number | null;
|
|
11
|
+
} | {
|
|
12
|
+
time: number;
|
|
13
|
+
type: 'setItem';
|
|
14
|
+
existsBefore: boolean;
|
|
15
|
+
valueChanged: boolean;
|
|
16
|
+
key: string;
|
|
17
|
+
rawValueAfter: string;
|
|
18
|
+
valueByteSizeBefore: number | null;
|
|
19
|
+
valueByteSizeAfter: number;
|
|
20
|
+
} | {
|
|
21
|
+
time: number;
|
|
22
|
+
type: 'removeItem';
|
|
23
|
+
existsBefore: boolean;
|
|
24
|
+
key: string;
|
|
25
|
+
} | {
|
|
26
|
+
time: number;
|
|
27
|
+
type: 'key';
|
|
28
|
+
index: number;
|
|
29
|
+
key: string | null;
|
|
30
|
+
} | {
|
|
31
|
+
time: number;
|
|
32
|
+
type: 'clear';
|
|
33
|
+
};
|
|
34
|
+
export declare function getPersistentStorageOperationTimelineString(operations: readonly PersistentStorageOperation[]): string;
|
|
35
|
+
type PersistentStorageOperationCapture = {
|
|
36
|
+
finish: () => {
|
|
37
|
+
timelineString: string;
|
|
38
|
+
operations: readonly PersistentStorageOperation[];
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export declare function startPersistentStorageOperationCapture(): PersistentStorageOperationCapture;
|
|
42
|
+
export declare function getParsedLocalStorageValue<T = unknown>(key: string): T | null;
|
|
43
|
+
export declare function getParsedOpfsFileData<T = unknown>(filePath: string): T | null;
|
|
44
|
+
export declare function getParsedOpfsNamespaceValue<T = unknown>(mockAdapter: ReturnType<typeof createOpfsPersistentStorageTestStore>, scope: AsyncStorageNamespaceScope, key: string): T | null;
|
|
45
|
+
export declare function getLocalStorageTree(): string;
|
|
46
|
+
export declare function getOpfsDirTree(source: ReturnType<typeof createOpfsPersistentStorageTestStore> | MockBrowserOpfsEnvironment): string;
|
|
47
|
+
type OpfsPersistentStorageOperationCaptureResult = {
|
|
48
|
+
operations: string[];
|
|
49
|
+
timelineString: string;
|
|
50
|
+
};
|
|
51
|
+
export declare function startOpfsPersistentStorageOperationCapture(mockAdapter: ReturnType<typeof createOpfsPersistentStorageTestStore>): {
|
|
52
|
+
finish: () => OpfsPersistentStorageOperationCaptureResult;
|
|
53
|
+
};
|
|
54
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|