tsdf 17.0.3 → 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/async-storage.js +1 -1
- package/dist/{asyncStorageAdapter-URS9eulL.js → asyncStorageAdapter-BuGjbXYA.js} +25 -165
- package/dist/{asyncStorageAdapter-DgsuE-T8.d.ts → asyncStorageAdapter-CMohMeKm.d.ts} +1 -1
- package/dist/{asyncStorageAdapters-Bxrrj_Mt.js → asyncStorageAdapters-ClUvxNQA.js} +2 -2
- package/dist/indexed-db-storage.d.ts +1 -1
- package/dist/indexed-db-storage.js +1 -1
- package/dist/{indexedDbPersistentStorage-BameJ4st.js → indexedDbPersistentStorage-BSlgLveB.js} +1 -11
- package/dist/main.d.ts +30 -34
- package/dist/main.js +257 -856
- package/dist/opfs-storage.d.ts +1 -1
- package/dist/opfs-storage.js +1 -1
- package/dist/{opfsPersistentStorage-BngS1m0X.d.ts → opfsPersistentStorage-Ci0JcCo5.d.ts} +1 -1
- package/dist/{opfsPersistentStorage-JsSCNBTr.js → opfsPersistentStorage-D_k77Srq.js} +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-BlyGC_PO.d.ts → types-D0ttVGmj.d.ts} +3 -3
- package/package.json +2 -2
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type TSDFDebugLogger } from '../../debug';
|
|
2
|
+
import type { ValidPayload } from '../../utils/storeShared';
|
|
3
|
+
import type { OfflineSessionUploadsConfig } from '../offlineUploadTypes';
|
|
4
|
+
import type { StorageAdapter } from '../types';
|
|
5
|
+
import type { GlobalOfflineEntity, InternalGlobalOfflineEntity, GlobalOfflineStatus, OfflineResolutionRecord, OfflineSession, OfflineSessionConfig } from './types';
|
|
6
|
+
type SessionCoordinatorOptions = {
|
|
7
|
+
sessionKey: string;
|
|
8
|
+
appVersion?: string;
|
|
9
|
+
adapter?: StorageAdapter;
|
|
10
|
+
onPersistentStorageError?: (error: unknown) => void;
|
|
11
|
+
debugLogger?: TSDFDebugLogger;
|
|
12
|
+
config?: OfflineSessionConfig;
|
|
13
|
+
uploads?: OfflineSessionUploadsConfig;
|
|
14
|
+
bootstrapStatusFromLocalStorage?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function createDefaultStatus(sessionKey: string): GlobalOfflineStatus;
|
|
17
|
+
/**
|
|
18
|
+
* Returns a session-scoped offline coordinator, creating it if needed.
|
|
19
|
+
* Existing coordinators are reconfigured when adapter/configuration changes.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getOrCreateSessionOfflineCoordinator(sessionKey: string, options?: Omit<SessionCoordinatorOptions, 'sessionKey'>): SessionOfflineCoordinator;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the latest offline status for a session. If the session has not been
|
|
24
|
+
* initialized yet, this returns a default "online" status with empty recovery data.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getGlobalOfflineStatus(sessionKey: string): GlobalOfflineStatus;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the latest list of offline entities for a session.
|
|
29
|
+
* Useful to render pending sync state badges or pending-item indicators.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getGlobalOfflineEntities(sessionKey: string): GlobalOfflineEntity[];
|
|
32
|
+
/**
|
|
33
|
+
* Returns the latest list of offline conflict/retry resolutions for a session.
|
|
34
|
+
* Useful to render conflict-resolution trays or retry-required queues.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getGlobalOfflineResolutions(sessionKey: string): OfflineResolutionRecord[];
|
|
37
|
+
/**
|
|
38
|
+
* Test-only primitive for resetting just the offline session coordinator
|
|
39
|
+
* registry.
|
|
40
|
+
*
|
|
41
|
+
* Prefer calling `resetSessionForTests()` from
|
|
42
|
+
* `tests/utils/resetSessionForTests.ts` so restart-style tests reset the full
|
|
43
|
+
* session/runtime boundary instead of invoking this low-level reset directly.
|
|
44
|
+
*/
|
|
45
|
+
export declare function __resetSessionOfflineCoordinatorRegistryForTests(): void;
|
|
46
|
+
export declare function getOfflineSessionUploadsConfig<TUploadRef extends ValidPayload>(session: OfflineSession<TUploadRef>): OfflineSessionUploadsConfig<TUploadRef> | undefined;
|
|
47
|
+
export declare function getOfflineSessionAppVersion(session: OfflineSession): string | undefined;
|
|
48
|
+
export declare function createOfflineSession<TUploadRef extends ValidPayload = ValidPayload>(args: {
|
|
49
|
+
config: OfflineSessionConfig<TUploadRef>;
|
|
50
|
+
getSessionKey?: () => string | false;
|
|
51
|
+
appVersion?: string;
|
|
52
|
+
debugLogger?: TSDFDebugLogger;
|
|
53
|
+
}): OfflineSession<TUploadRef>;
|
|
54
|
+
/**
|
|
55
|
+
* React hook that subscribes to the offline status stream for a session.
|
|
56
|
+
*/
|
|
57
|
+
export declare function useGlobalOfflineStatus(sessionKey: string): GlobalOfflineStatus;
|
|
58
|
+
/**
|
|
59
|
+
* React hook that subscribes to the offline entities stream for a session.
|
|
60
|
+
*/
|
|
61
|
+
export declare function useGlobalOfflineEntities(sessionKey: string): readonly GlobalOfflineEntity[];
|
|
62
|
+
/**
|
|
63
|
+
* React hook returning global offline conflict/retry resolutions for a session.
|
|
64
|
+
*/
|
|
65
|
+
export declare function useGlobalOfflineResolutions(sessionKey: string): readonly OfflineResolutionRecord[];
|
|
66
|
+
/**
|
|
67
|
+
* React hook returning offline entities for a specific store in a session.
|
|
68
|
+
*/
|
|
69
|
+
export declare function useOfflineStoreEntitiesWithPayload(args: {
|
|
70
|
+
sessionKey: string | false;
|
|
71
|
+
inactiveScope: string;
|
|
72
|
+
storeName?: string;
|
|
73
|
+
}): readonly InternalGlobalOfflineEntity[];
|
|
74
|
+
export declare function useOfflineStoreEntities(args: {
|
|
75
|
+
sessionKey: string | false;
|
|
76
|
+
inactiveScope: string;
|
|
77
|
+
storeName?: string;
|
|
78
|
+
}): readonly GlobalOfflineEntity[];
|
|
79
|
+
/**
|
|
80
|
+
* React hook returning offline status for a session or inactive scope.
|
|
81
|
+
*/
|
|
82
|
+
export declare function useOfflineStoreStatus(args: {
|
|
83
|
+
sessionKey: string | false;
|
|
84
|
+
inactiveScope: string;
|
|
85
|
+
}): GlobalOfflineStatus;
|
|
86
|
+
/**
|
|
87
|
+
* React hook returning offline conflict/retry resolutions for a specific store in a session.
|
|
88
|
+
*/
|
|
89
|
+
export declare function useOfflineStoreResolutions(args: {
|
|
90
|
+
sessionKey: string | false;
|
|
91
|
+
inactiveScope: string;
|
|
92
|
+
storeName?: string;
|
|
93
|
+
}): readonly OfflineResolutionRecord[];
|
|
94
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function setSessionProtectedKeysSnapshot(sessionKey: string, protectedKeys: Iterable<string>): void;
|
|
2
|
+
export declare function getSessionProtectedKeysSnapshot(sessionKey: string): Set<string> | null;
|
|
3
|
+
export declare function clearSessionProtectedKeysSnapshot(sessionKey: string): void;
|
|
4
|
+
/**
|
|
5
|
+
* Test-only primitive for resetting cached protected-key snapshots.
|
|
6
|
+
*
|
|
7
|
+
* Prefer calling `resetSessionForTests()` from
|
|
8
|
+
* `tests/utils/resetSessionForTests.ts` so restart-style tests reset the full
|
|
9
|
+
* session/runtime boundary instead of invoking this low-level reset directly.
|
|
10
|
+
*/
|
|
11
|
+
export declare function __resetSessionProtectedKeysSnapshotForTests(): void;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { __LEGIT_ANY__ } from '@ls-stack/utils/saferTyping';
|
|
2
|
+
import type { TSDFDebugLogger } from '../../debug';
|
|
3
|
+
import type { ValidPayload } from '../../utils/storeShared';
|
|
4
|
+
import type { OfflineMutationUploadsInput } from '../offlineUploadTypes';
|
|
5
|
+
import type { StorageAdapter } from '../types';
|
|
6
|
+
import type { PreparedOfflineMutation } from './mutationRuntime';
|
|
7
|
+
import { type AnyOfflineOperationDefinition, type GlobalOfflineEntity, type OfflineMutationInput, type OfflineOperationSchemaShape, type OfflineResolutionActionForOperation, type OfflineResolutionRecordForStore, type OfflineEntityRef, type OfflineSession, type OfflineStoreType, type ParsedOfflineResolutionConflictResultForOperation } from './types';
|
|
8
|
+
type OfflineStoreAdapter = {
|
|
9
|
+
getEntityRefs?: (args: {
|
|
10
|
+
operationName: string;
|
|
11
|
+
input: unknown;
|
|
12
|
+
}) => unknown[];
|
|
13
|
+
normalizeEntityRefs?: (entityRefs: unknown[]) => OfflineEntityRef[];
|
|
14
|
+
getProtectedCacheKeys: (entityRefs: OfflineEntityRef[]) => string[];
|
|
15
|
+
applyPendingEntity?: (args: {
|
|
16
|
+
operationName: string;
|
|
17
|
+
input: unknown;
|
|
18
|
+
tempId: ValidPayload;
|
|
19
|
+
pendingEntity: unknown;
|
|
20
|
+
}) => void;
|
|
21
|
+
rollbackPendingEntity?: (args: {
|
|
22
|
+
operationName: string;
|
|
23
|
+
input: unknown;
|
|
24
|
+
tempId: ValidPayload;
|
|
25
|
+
pendingEntity: unknown;
|
|
26
|
+
}) => void;
|
|
27
|
+
reconcileTempEntity?: (args: {
|
|
28
|
+
operationName: string;
|
|
29
|
+
input: unknown;
|
|
30
|
+
tempId: ValidPayload;
|
|
31
|
+
result: unknown;
|
|
32
|
+
reconciliation: {
|
|
33
|
+
finalPayload: ValidPayload;
|
|
34
|
+
finalData?: unknown;
|
|
35
|
+
};
|
|
36
|
+
}) => void;
|
|
37
|
+
captureQueuedMutationOverlays?: (args: {
|
|
38
|
+
sessionKey: string;
|
|
39
|
+
entityRefs: OfflineEntityRef[];
|
|
40
|
+
}) => void;
|
|
41
|
+
rebindQueuedMutationOverlays?: (args: {
|
|
42
|
+
sessionKey: string;
|
|
43
|
+
itemKeyRewrites: {
|
|
44
|
+
previousItemKey: string;
|
|
45
|
+
nextItemKey: string;
|
|
46
|
+
}[];
|
|
47
|
+
}) => void;
|
|
48
|
+
syncEntityOverlays?: (args: {
|
|
49
|
+
sessionKey: string;
|
|
50
|
+
entities: GlobalOfflineEntity[];
|
|
51
|
+
}) => void;
|
|
52
|
+
};
|
|
53
|
+
export declare class OfflineSessionUnavailableError extends Error {
|
|
54
|
+
readonly code = 460;
|
|
55
|
+
readonly id: "offline-session-unavailable";
|
|
56
|
+
constructor();
|
|
57
|
+
}
|
|
58
|
+
export type OfflineStoreController<TOperations extends Record<string, OfflineOperationSchemaShape>> = {
|
|
59
|
+
dispose: () => void;
|
|
60
|
+
hydrateIfNeeded: () => Promise<void>;
|
|
61
|
+
canQueueMutation: () => boolean;
|
|
62
|
+
prepareForMutation: <TName extends keyof TOperations & string>(args: {
|
|
63
|
+
offline: OfflineMutationInput<TOperations, TName>;
|
|
64
|
+
upload?: OfflineMutationUploadsInput;
|
|
65
|
+
}) => Promise<PreparedOfflineMutation>;
|
|
66
|
+
queueMutation: <TName extends keyof TOperations & string>(args: {
|
|
67
|
+
offline: OfflineMutationInput<TOperations, TName>;
|
|
68
|
+
upload?: OfflineMutationUploadsInput;
|
|
69
|
+
}) => Promise<void>;
|
|
70
|
+
getOfflineEntities: () => GlobalOfflineEntity[];
|
|
71
|
+
getOfflineResolutions: () => OfflineResolutionRecordForStore<TOperations>[];
|
|
72
|
+
parseOfflineResolutionConflict: <TName extends keyof TOperations & string>(resolution: OfflineResolutionRecordForStore<TOperations, TName>) => ParsedOfflineResolutionConflictResultForOperation<TOperations, TName>;
|
|
73
|
+
resolveOfflineResolution: <TName extends keyof TOperations & string>(resolutionId: string, operationName: TName, resolution: OfflineResolutionActionForOperation<TOperations, TName>) => Promise<void>;
|
|
74
|
+
prepareForFetch: () => Promise<void>;
|
|
75
|
+
getSessionStatus: () => {
|
|
76
|
+
isOfflineMode: boolean;
|
|
77
|
+
} | null;
|
|
78
|
+
shouldTreatFetchAsOffline: () => boolean;
|
|
79
|
+
handleFetchSuccess: () => Promise<void>;
|
|
80
|
+
evaluateOfflineFetchError: (error: unknown, operationName?: string) => Promise<void>;
|
|
81
|
+
ensureReplayScheduled: () => Promise<void>;
|
|
82
|
+
};
|
|
83
|
+
type OfflineStoreControllerBootstrap = Pick<OfflineStoreController<Record<string, OfflineOperationSchemaShape>>, 'hydrateIfNeeded' | 'ensureReplayScheduled'>;
|
|
84
|
+
export declare function initializeOfflineStoreController(controller: OfflineStoreControllerBootstrap | null | undefined): void;
|
|
85
|
+
export declare function createOfflineStoreController<TOperations extends Record<string, AnyOfflineOperationDefinition<__LEGIT_ANY__>>>(storeName: string, storeType: OfflineStoreType, getSessionKey: () => string | false, onPersistentStorageError: ((error: unknown) => void) | undefined, debugLogger: TSDFDebugLogger | undefined, adapter: StorageAdapter, storeAdapter: OfflineStoreAdapter, offlineSession: OfflineSession, operations: TOperations): OfflineStoreController<TOperations>;
|
|
86
|
+
export {};
|