tsdf 17.0.4 → 17.0.6
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-CMohMeKm.d.ts → asyncStorageAdapter-DgsuE-T8.d.ts} +1 -1
- package/dist/{asyncStorageAdapter-BuGjbXYA.js → asyncStorageAdapter-URS9eulL.js} +165 -25
- package/dist/{asyncStorageAdapters-ClUvxNQA.js → asyncStorageAdapters-Bxrrj_Mt.js} +2 -2
- package/dist/indexed-db-storage.d.ts +1 -1
- package/dist/indexed-db-storage.js +1 -1
- package/dist/{indexedDbPersistentStorage-BSlgLveB.js → indexedDbPersistentStorage-BameJ4st.js} +11 -1
- package/dist/main.d.ts +34 -30
- package/dist/main.js +856 -257
- package/dist/opfs-storage.d.ts +1 -1
- package/dist/opfs-storage.js +1 -1
- package/dist/{opfsPersistentStorage-Ci0JcCo5.d.ts → opfsPersistentStorage-BngS1m0X.d.ts} +1 -1
- package/dist/{opfsPersistentStorage-D_k77Srq.js → opfsPersistentStorage-JsSCNBTr.js} +1 -1
- package/dist/{types-D0ttVGmj.d.ts → types-BlyGC_PO.d.ts} +3 -3
- package/package.json +5 -5
- package/dist/src/async-storage.d.ts +0 -1
- package/dist/src/cacheLimits/lruCacheRuntime.d.ts +0 -9
- package/dist/src/cacheLimits/scheduleIdleThrottled.d.ts +0 -1
- package/dist/src/cacheLimits/useRegisterActiveKeys.d.ts +0 -1
- package/dist/src/collectionStore/collectionCacheLimits.d.ts +0 -1
- package/dist/src/collectionStore/collectionStore.d.ts +0 -385
- package/dist/src/collectionStore/executeBatchFetch.d.ts +0 -6
- package/dist/src/collectionStore/useItem.d.ts +0 -15
- package/dist/src/collectionStore/useMultipleItems.d.ts +0 -35
- package/dist/src/debug.d.ts +0 -30
- package/dist/src/documentStore.d.ts +0 -290
- package/dist/src/hooks/useListItem.d.ts +0 -22
- package/dist/src/hooks/useListItemIsDeleted.d.ts +0 -13
- package/dist/src/hooks/useListItemIsLoading.d.ts +0 -16
- package/dist/src/indexed-db-storage.d.ts +0 -1
- package/dist/src/internal/offlineTestInstrumentation.d.ts +0 -12
- package/dist/src/internal/testTimelineTypes.d.ts +0 -1
- package/dist/src/invalidationUtils.d.ts +0 -8
- package/dist/src/isOffScreenContext.d.ts +0 -16
- package/dist/src/listQueryStore/createFetchApi.d.ts +0 -1
- package/dist/src/listQueryStore/createMutationApi.d.ts +0 -1
- package/dist/src/listQueryStore/executeItemBatchFetch.d.ts +0 -20
- package/dist/src/listQueryStore/executeQueryFetch.d.ts +0 -7
- package/dist/src/listQueryStore/itemFieldUtils.d.ts +0 -77
- package/dist/src/listQueryStore/listQueryCacheLimits.d.ts +0 -1
- package/dist/src/listQueryStore/listQueryStore.d.ts +0 -538
- package/dist/src/listQueryStore/types.d.ts +0 -347
- package/dist/src/listQueryStore/useFindItem.d.ts +0 -7
- package/dist/src/listQueryStore/useItem.d.ts +0 -29
- package/dist/src/listQueryStore/useListQuery.d.ts +0 -29
- package/dist/src/listQueryStore/useMultipleItems.d.ts +0 -44
- package/dist/src/listQueryStore/useMultipleListQueries.d.ts +0 -46
- package/dist/src/listQueryStore/usePendingOfflineItems.d.ts +0 -19
- package/dist/src/main.d.ts +0 -23
- package/dist/src/opfs-storage.d.ts +0 -1
- package/dist/src/persistentStorage/asyncStorageAdapter.d.ts +0 -95
- package/dist/src/persistentStorage/asyncStorageAdapters.d.ts +0 -2
- package/dist/src/persistentStorage/asyncStorageShared.d.ts +0 -23
- package/dist/src/persistentStorage/collectionStorePersistence.d.ts +0 -26
- package/dist/src/persistentStorage/compactListQueryLocalStorageEntry.d.ts +0 -11
- package/dist/src/persistentStorage/compactLocalStorageEntry.d.ts +0 -8
- package/dist/src/persistentStorage/documentEntryKey.d.ts +0 -1
- package/dist/src/persistentStorage/documentStorePersistence.d.ts +0 -17
- package/dist/src/persistentStorage/indexedDbAsyncStorageAdapter.d.ts +0 -165
- package/dist/src/persistentStorage/indexedDbPersistentStorage.d.ts +0 -6
- package/dist/src/persistentStorage/listQueryStorePersistence.d.ts +0 -37
- package/dist/src/persistentStorage/localStorageMetadata.d.ts +0 -126
- package/dist/src/persistentStorage/navigatorLocks.d.ts +0 -3
- package/dist/src/persistentStorage/offline/entityMetadata.d.ts +0 -12
- package/dist/src/persistentStorage/offline/fetchRuntime.d.ts +0 -35
- package/dist/src/persistentStorage/offline/mutationRuntime.d.ts +0 -31
- package/dist/src/persistentStorage/offline/offlineResolution.typeGuards.d.ts +0 -1
- package/dist/src/persistentStorage/offline/overlayStoreLifecycle.d.ts +0 -13
- package/dist/src/persistentStorage/offline/sessionCoordinator.d.ts +0 -94
- package/dist/src/persistentStorage/offline/sessionProtectionRegistry.d.ts +0 -11
- package/dist/src/persistentStorage/offline/storeController.d.ts +0 -86
- package/dist/src/persistentStorage/offline/types.d.ts +0 -1255
- package/dist/src/persistentStorage/offlineUploadRegistry.d.ts +0 -11
- package/dist/src/persistentStorage/offlineUploadTypes.d.ts +0 -97
- package/dist/src/persistentStorage/offlineUploadsShared.d.ts +0 -4
- package/dist/src/persistentStorage/opfsAsyncStorageAdapter.d.ts +0 -24
- package/dist/src/persistentStorage/opfsFileNaming.d.ts +0 -23
- package/dist/src/persistentStorage/opfsHelpers.d.ts +0 -3
- package/dist/src/persistentStorage/opfsOfflineUploadAdapter.d.ts +0 -2
- package/dist/src/persistentStorage/opfsPersistentStorage.d.ts +0 -2
- package/dist/src/persistentStorage/parsePersistedData.d.ts +0 -45
- package/dist/src/persistentStorage/persistenceUtils.d.ts +0 -52
- package/dist/src/persistentStorage/persistentStorageDefaults.d.ts +0 -4
- package/dist/src/persistentStorage/persistentStorageManager.d.ts +0 -197
- package/dist/src/persistentStorage/quotaDebug.d.ts +0 -16
- package/dist/src/persistentStorage/scheduleIdleCleanup.d.ts +0 -28
- package/dist/src/persistentStorage/storageAdapter.d.ts +0 -41
- package/dist/src/persistentStorage/storageEntryPrefixes.d.ts +0 -16
- package/dist/src/persistentStorage/types.d.ts +0 -412
- package/dist/src/persistentStorage/validateWithSchema.d.ts +0 -12
- package/dist/src/requestScheduler.d.ts +0 -81
- package/dist/src/storeManager.d.ts +0 -160
- package/dist/src/utils/automaticFetchPolicy.d.ts +0 -29
- package/dist/src/utils/browserTabsPriority.d.ts +0 -43
- package/dist/src/utils/browserTabsSync.d.ts +0 -33
- package/dist/src/utils/optimisticMutationTracker.d.ts +0 -20
- package/dist/src/utils/optimisticRollback.d.ts +0 -11
- package/dist/src/utils/payloadDebounce.d.ts +0 -5
- package/dist/src/utils/performMutation.d.ts +0 -19
- package/dist/src/utils/reusePrevIfEqual.d.ts +0 -1
- package/dist/src/utils/storeFocusLifecycle.d.ts +0 -1
- package/dist/src/utils/storeShared.d.ts +0 -126
- package/dist/src/utils/useEnsureIsLoaded.d.ts +0 -6
- package/dist/src/utils/useRequireFreshData.d.ts +0 -6
- package/dist/tests/basic-functionality/collection-store.test.d.ts +0 -1
- package/dist/tests/basic-functionality/document-store.test.d.ts +0 -1
- package/dist/tests/basic-functionality/list-query-state-manipulation.test.d.ts +0 -1
- package/dist/tests/basic-functionality/list-query-store.test.d.ts +0 -1
- package/dist/tests/browser-tabs/browser-tabs-background-rtu-batch.test.d.ts +0 -1
- package/dist/tests/browser-tabs/browser-tabs-background-rtu.test.d.ts +0 -1
- package/dist/tests/browser-tabs/browser-tabs-background-scheduling.test.d.ts +0 -1
- package/dist/tests/browser-tabs/browser-tabs-list-query-pagination.test.d.ts +0 -1
- package/dist/tests/browser-tabs/browser-tabs-non-cancelable-fetches.test.d.ts +0 -1
- package/dist/tests/browser-tabs/browser-tabs-optimistic-sync.test.d.ts +0 -1
- package/dist/tests/browser-tabs/browser-tabs-partial-resources.test.d.ts +0 -1
- package/dist/tests/browser-tabs/browser-tabs-priority.test.d.ts +0 -1
- package/dist/tests/browser-tabs/browser-tabs-snapshot-consistency.test.d.ts +0 -1
- package/dist/tests/browser-tabs/browser-tabs-state-methods.test.d.ts +0 -1
- package/dist/tests/browser-tabs/browser-tabs-sync-coordinator.test.d.ts +0 -1
- package/dist/tests/browser-tabs/browser-tabs-test-helpers.d.ts +0 -69
- package/dist/tests/browser-tabs/focus-coordinator.test.d.ts +0 -1
- package/dist/tests/hooks/collection-hooks-2.test.d.ts +0 -1
- package/dist/tests/hooks/collection-hooks.test.d.ts +0 -1
- package/dist/tests/hooks/collection-useListItem.test.d.ts +0 -1
- package/dist/tests/hooks/debounce-payload-hooks.test.d.ts +0 -1
- package/dist/tests/hooks/disable-refetches.test.d.ts +0 -1
- package/dist/tests/hooks/document-hooks-2.test.d.ts +0 -1
- package/dist/tests/hooks/document-hooks.test.d.ts +0 -1
- package/dist/tests/hooks/document-useListItem.test.d.ts +0 -1
- package/dist/tests/hooks/fetch-error-recovery.test.d.ts +0 -1
- package/dist/tests/hooks/hook-memoization.test.d.ts +0 -1
- package/dist/tests/hooks/list-query-hooks-2.test.d.ts +0 -1
- package/dist/tests/hooks/list-query-hooks-3.test.d.ts +0 -1
- package/dist/tests/hooks/list-query-hooks-mutations.test.d.ts +0 -1
- package/dist/tests/hooks/list-query-hooks.test.d.ts +0 -1
- package/dist/tests/hooks/list-query-pending-offline-items.test.d.ts +0 -1
- package/dist/tests/hooks/off-screen-context.test.d.ts +0 -1
- package/dist/tests/list-query-features/list-query-derived-queries.test.d.ts +0 -1
- package/dist/tests/list-query-features/list-query-offset-pagination.test.d.ts +0 -1
- package/dist/tests/list-query-features/list-query-optimistic-filters.test.d.ts +0 -1
- package/dist/tests/list-query-features/list-query-partial-resources-2.test.d.ts +0 -1
- package/dist/tests/list-query-features/list-query-partial-resources-3.test.d.ts +0 -1
- package/dist/tests/list-query-features/list-query-partial-resources-regressions.test.d.ts +0 -1
- package/dist/tests/list-query-features/list-query-partial-resources-show-partial-status.test.d.ts +0 -1
- package/dist/tests/list-query-features/list-query-partial-resources.test.d.ts +0 -1
- package/dist/tests/list-query-features/list-query-size-coalescing-partial-resources.test.d.ts +0 -1
- package/dist/tests/mocks/browserTabsTestUtils.d.ts +0 -17
- package/dist/tests/mocks/collectionStoreTestEnv.d.ts +0 -265
- package/dist/tests/mocks/documentStoreTestEnv.d.ts +0 -140
- package/dist/tests/mocks/duplicateStoreGuard.test.d.ts +0 -1
- package/dist/tests/mocks/listQueryStoreTestEnv.d.ts +0 -295
- package/dist/tests/mocks/mockBrowserOpfs.d.ts +0 -70
- package/dist/tests/mocks/mockBrowserOpfs.test.d.ts +0 -1
- package/dist/tests/mocks/mockLocalStorageStore.d.ts +0 -61
- package/dist/tests/mocks/seedScenarioPersistentStorage.d.ts +0 -51
- package/dist/tests/mocks/serverMock.d.ts +0 -56
- package/dist/tests/mocks/serverTableMock.d.ts +0 -174
- package/dist/tests/mocks/testEnvUtils.d.ts +0 -120
- package/dist/tests/mocks/testScenarioPersistentStorage.test.d.ts +0 -1
- package/dist/tests/offline/offline-fetching-scenarios.test.d.ts +0 -1
- package/dist/tests/offline/offline-mixed-adapter-storage.test.d.ts +0 -1
- package/dist/tests/offline/offline-mutation-fallback.test.d.ts +0 -1
- package/dist/tests/offline/offline-network-recovery.test.d.ts +0 -1
- package/dist/tests/offline/offline-outage.test.d.ts +0 -1
- package/dist/tests/offline/offline-overlays.test.d.ts +0 -1
- package/dist/tests/offline/offline-query-replay.test.d.ts +0 -1
- package/dist/tests/offline/offline-reads.test.d.ts +0 -1
- package/dist/tests/offline/offline-replay-conflicts.test.d.ts +0 -1
- package/dist/tests/offline/offline-replay-queueing.test.d.ts +0 -1
- package/dist/tests/offline/offline-resolution-dependencies.test.d.ts +0 -1
- package/dist/tests/offline/offline-runtime-controls.test.d.ts +0 -1
- package/dist/tests/offline/offline-session-and-global-state.test.d.ts +0 -1
- package/dist/tests/offline/offline-storage.test.d.ts +0 -1
- package/dist/tests/offline/offline-uploads.test.d.ts +0 -1
- package/dist/tests/offline/offlineReplayTestShared.d.ts +0 -292
- package/dist/tests/offline/offlineTestShared.d.ts +0 -156
- package/dist/tests/perform-mutation/mutation-error-rollback.test.d.ts +0 -1
- package/dist/tests/perform-mutation/perform-mutation-block-window-close.test.d.ts +0 -1
- package/dist/tests/perform-mutation/perform-mutation-debounce.test.d.ts +0 -1
- package/dist/tests/perform-mutation/store-events.test.d.ts +0 -1
- package/dist/tests/persistent-storage/async-storage-efficiency/collection.test.d.ts +0 -1
- package/dist/tests/persistent-storage/async-storage-efficiency/document.test.d.ts +0 -1
- package/dist/tests/persistent-storage/async-storage-efficiency/list-query.test.d.ts +0 -1
- package/dist/tests/persistent-storage/async-storage-efficiency/maintenance.test.d.ts +0 -1
- package/dist/tests/persistent-storage/async-storage-efficiency/shared.d.ts +0 -804
- package/dist/tests/persistent-storage/async-storage-shared.test.d.ts +0 -1
- package/dist/tests/persistent-storage/collection-store-persistence.converted.opfs.test.d.ts +0 -1
- package/dist/tests/persistent-storage/collection-store-persistence.converted.test.d.ts +0 -1
- package/dist/tests/persistent-storage/collection-store-persistence.opfs.test.d.ts +0 -1
- package/dist/tests/persistent-storage/collection-store-persistence.test.d.ts +0 -1
- package/dist/tests/persistent-storage/document-store-persistence.converted.opfs.test.d.ts +0 -1
- package/dist/tests/persistent-storage/document-store-persistence.converted.test.d.ts +0 -1
- package/dist/tests/persistent-storage/document-store-persistence.opfs.test.d.ts +0 -1
- package/dist/tests/persistent-storage/document-store-persistence.test.d.ts +0 -1
- package/dist/tests/persistent-storage/expiration-scan.test.d.ts +0 -1
- package/dist/tests/persistent-storage/indexeddb-async-storage-efficiency/collection.test.d.ts +0 -1
- package/dist/tests/persistent-storage/indexeddb-async-storage-efficiency/document.test.d.ts +0 -1
- package/dist/tests/persistent-storage/indexeddb-async-storage-efficiency/list-query.test.d.ts +0 -1
- package/dist/tests/persistent-storage/indexeddb-async-storage-efficiency/maintenance.test.d.ts +0 -1
- package/dist/tests/persistent-storage/indexeddb-async-storage-efficiency/shared.d.ts +0 -780
- package/dist/tests/persistent-storage/indexeddb-storage-adapter.test.d.ts +0 -1
- package/dist/tests/persistent-storage/list-query-store-persistence.converted.opfs.test.d.ts +0 -1
- package/dist/tests/persistent-storage/list-query-store-persistence.converted.test.d.ts +0 -1
- package/dist/tests/persistent-storage/list-query-store-persistence.opfs.test.d.ts +0 -1
- package/dist/tests/persistent-storage/list-query-store-persistence.test.d.ts +0 -1
- package/dist/tests/persistent-storage/persistence-with-tabs-sync.test.d.ts +0 -1
- package/dist/tests/persistent-storage/persistentStorageByteBudgetTestUtils.d.ts +0 -18
- package/dist/tests/persistent-storage/quota-exceeded-recovery-no-locks.test.d.ts +0 -1
- package/dist/tests/persistent-storage/quota-exceeded-recovery.test.d.ts +0 -1
- package/dist/tests/persistent-storage/quotaRecoveryTestUtils.d.ts +0 -228
- package/dist/tests/persistent-storage/storage-adapter.test.d.ts +0 -1
- package/dist/tests/persistent-storage/sync-storage-efficiency/collection.test.d.ts +0 -1
- package/dist/tests/persistent-storage/sync-storage-efficiency/document.test.d.ts +0 -1
- package/dist/tests/persistent-storage/sync-storage-efficiency/list-query.test.d.ts +0 -1
- package/dist/tests/persistent-storage/sync-storage-efficiency/maintenance.test.d.ts +0 -1
- package/dist/tests/persistent-storage/sync-storage-efficiency/shared.d.ts +0 -784
- package/dist/tests/playwright/browser-tabs.spec.d.ts +0 -1
- package/dist/tests/playwright/persistent-storage.spec.d.ts +0 -1
- package/dist/tests/request-schedulling/batch-medium-priority.test.d.ts +0 -1
- package/dist/tests/request-schedulling/batch-realtime-updates.test.d.ts +0 -1
- package/dist/tests/request-schedulling/collection-batch-coalescing.test.d.ts +0 -1
- package/dist/tests/request-schedulling/collection-batch-key-grouping.test.d.ts +0 -1
- package/dist/tests/request-schedulling/collection-fetch-orchestration.test.d.ts +0 -1
- package/dist/tests/request-schedulling/document-await-fetch.test.d.ts +0 -1
- package/dist/tests/request-schedulling/document-base-coalescing.test.d.ts +0 -1
- package/dist/tests/request-schedulling/document-fetch-orchestration.test.d.ts +0 -1
- package/dist/tests/request-schedulling/document-medium-priority-fetch.test.d.ts +0 -1
- package/dist/tests/request-schedulling/document-realtime-updates.test.d.ts +0 -1
- package/dist/tests/request-schedulling/list-query-item-batch-coalescing.test.d.ts +0 -1
- package/dist/tests/request-schedulling/list-query-item-batch-key-grouping.test.d.ts +0 -1
- package/dist/tests/request-schedulling/list-query-size-coalescing.test.d.ts +0 -1
- package/dist/tests/request-schedulling/medium-vs-realtime.test.d.ts +0 -1
- package/dist/tests/request-schedulling/request-scheduler-cross-tab-sync.test.d.ts +0 -1
- package/dist/tests/request-schedulling/window-focus.test.d.ts +0 -1
- package/dist/tests/store-manager.test.d.ts +0 -1
- package/dist/tests/user-facing-api/collection-offline-usage.test.d.ts +0 -1
- package/dist/tests/user-facing-api/document-offline-usage.test.d.ts +0 -1
- package/dist/tests/user-facing-api/list-query-offline-usage.test.d.ts +0 -1
- package/dist/tests/user-facing-api/result-returning-callbacks.test.d.ts +0 -1
- package/dist/tests/utils/genericTestUtils.d.ts +0 -6
- package/dist/tests/utils/indexedDbPersistentStorageOptimizationTestUtils.d.ts +0 -79
- package/dist/tests/utils/indexedDbPersistentStorageTestStore.d.ts +0 -181
- package/dist/tests/utils/listQueryHooksTestUtils.d.ts +0 -8
- package/dist/tests/utils/networkMock.d.ts +0 -11
- package/dist/tests/utils/opfsPersistentStorageTestStore.d.ts +0 -220
- package/dist/tests/utils/persistentStorageOptimizationTestUtils.d.ts +0 -54
- package/dist/tests/utils/persistentStorageOptimizationTestUtils.test.d.ts +0 -1
- package/dist/tests/utils/persistentStorageTestStore.d.ts +0 -66
- package/dist/tests/utils/resetSessionForTests.d.ts +0 -3
- package/dist/tests/utils/withSuppressedActError.d.ts +0 -4
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { type Result as ResultType } from 't-result';
|
|
2
|
-
import { type TSDFDebugLogger, type TSDFLoggerOptions } from './debug';
|
|
3
|
-
import type { GlobalOfflineEntity, GlobalOfflineStatus, OfflineResolutionRecord, OfflineRuntimeConfig, OfflineRuntimeConfigUpdate, OfflineSession, OfflineSessionConfig } from './persistentStorage/offline/types';
|
|
4
|
-
import type { OfflineUpload } from './persistentStorage/offlineUploadTypes';
|
|
5
|
-
import type { PersistentStorageErrorHandler } from './persistentStorage/types';
|
|
6
|
-
import type { BrowserTabsPriorityTimings } from './utils/browserTabsPriority';
|
|
7
|
-
import { type BrowserTabsTransportFactory } from './utils/browserTabsSync';
|
|
8
|
-
import type { BlockWindowCloseHandler } from './utils/performMutation';
|
|
9
|
-
import type { StoreError, StoreMutationErrorOptions, ValidPayload } from './utils/storeShared';
|
|
10
|
-
/** Minimum interval between realtime-update fetches, recomputed per fetch.
|
|
11
|
-
* When the window regains focus, a refetch still waiting on the unfocused
|
|
12
|
-
* interval is re-evaluated with the focused one, firing immediately if it has
|
|
13
|
-
* already elapsed. */
|
|
14
|
-
export type DynamicRealtimeThrottleMs = (params: {
|
|
15
|
-
readonly lastFetchDuration: number;
|
|
16
|
-
readonly windowIsNotFocused: boolean;
|
|
17
|
-
}) => number;
|
|
18
|
-
export type StoreManagerStoreDefaults = {
|
|
19
|
-
/** Default minimum interval between low-priority fetches for attached stores. */
|
|
20
|
-
readonly lowPriorityThrottleMs: number;
|
|
21
|
-
/** Default coalescing window used by attached stores when they do not override it. */
|
|
22
|
-
readonly baseCoalescingWindowMs: number;
|
|
23
|
-
/** Extra browser-tab coalescing delay applied only while a tab is in the background. */
|
|
24
|
-
readonly backgroundCoalescingDelayMs: number;
|
|
25
|
-
/** Default adaptive throttle for real-time updates in attached stores. */
|
|
26
|
-
readonly dynamicRealtimeThrottleMs: DynamicRealtimeThrottleMs;
|
|
27
|
-
/** Shared window-close blocker used by mutations in attached stores. */
|
|
28
|
-
readonly blockWindowClose: BlockWindowCloseHandler | null;
|
|
29
|
-
/** Default focus revalidation policy for attached stores. */
|
|
30
|
-
readonly revalidateOnWindowFocus: boolean | (() => boolean) | undefined;
|
|
31
|
-
};
|
|
32
|
-
export type StoreManagerMutationErrorHandler = (error: unknown, options: StoreMutationErrorOptions) => void;
|
|
33
|
-
type StoreManagerOfflineApi<TUploadRef extends ValidPayload = ValidPayload> = {
|
|
34
|
-
/** Returns the shared offline config, when configured. */
|
|
35
|
-
getOfflineConfig: () => OfflineSessionConfig<TUploadRef> | undefined;
|
|
36
|
-
/** Latest effective runtime config for this manager's offline session. */
|
|
37
|
-
getOfflineRuntimeConfig: () => OfflineRuntimeConfig;
|
|
38
|
-
/** Updates runtime controls for this manager's offline session. */
|
|
39
|
-
setOfflineRuntimeConfig: (update: OfflineRuntimeConfigUpdate) => ResultType<void, Error>;
|
|
40
|
-
/** Resets runtime controls back to the static session config. */
|
|
41
|
-
resetOfflineRuntimeConfig: () => void;
|
|
42
|
-
/** Returns the latest aggregated offline status for this manager. */
|
|
43
|
-
getOfflineStatus: () => GlobalOfflineStatus;
|
|
44
|
-
/** Returns the latest aggregated offline entities for this manager. */
|
|
45
|
-
getOfflineEntities: () => readonly GlobalOfflineEntity[];
|
|
46
|
-
/** Returns the latest aggregated offline resolutions for this manager. */
|
|
47
|
-
getOfflineResolutions: () => readonly OfflineResolutionRecord[];
|
|
48
|
-
/** Returns the latest session-scoped offline uploads for this manager. */
|
|
49
|
-
getOfflineUploads: () => readonly OfflineUpload<TUploadRef>[];
|
|
50
|
-
/** Resolves a staged upload id to its latest final ref, uploading first if needed. */
|
|
51
|
-
resolveOfflineUpload: (id: string) => Promise<ResultType<TUploadRef, Error>>;
|
|
52
|
-
/** Resolves multiple staged upload ids to their latest final refs. */
|
|
53
|
-
resolveOfflineUploads: (ids: readonly string[]) => Promise<ResultType<Record<string, TUploadRef>, Error>>;
|
|
54
|
-
/** Saves a session-scoped upload locally for later dependency resolution. */
|
|
55
|
-
saveOfflineUpload: (args: {
|
|
56
|
-
id: string;
|
|
57
|
-
file: Blob | File;
|
|
58
|
-
}) => Promise<ResultType<void, Error>>;
|
|
59
|
-
/** Replaces a previously stored session-scoped upload. */
|
|
60
|
-
replaceOfflineUpload: (args: {
|
|
61
|
-
id: string;
|
|
62
|
-
file: Blob | File;
|
|
63
|
-
}) => Promise<ResultType<void, Error>>;
|
|
64
|
-
/** Loads a previously stored session-scoped upload. */
|
|
65
|
-
loadOfflineUpload: (id: string) => Promise<ResultType<File | null, Error>>;
|
|
66
|
-
/** Deletes a stored upload when it is no longer referenced. */
|
|
67
|
-
deleteOfflineUpload: (id: string) => Promise<ResultType<void, Error>>;
|
|
68
|
-
/** React hook subscribing to the manager's aggregated offline status. */
|
|
69
|
-
useOfflineStatus: () => GlobalOfflineStatus;
|
|
70
|
-
/** React hook subscribing to the manager's aggregated offline entities. */
|
|
71
|
-
useOfflineEntities: () => readonly GlobalOfflineEntity[];
|
|
72
|
-
/** React hook subscribing to the manager's aggregated offline resolutions. */
|
|
73
|
-
useOfflineResolutions: () => readonly OfflineResolutionRecord[];
|
|
74
|
-
/** React hook subscribing to the manager's aggregated offline uploads. */
|
|
75
|
-
useOfflineUploads: () => readonly OfflineUpload<TUploadRef>[];
|
|
76
|
-
};
|
|
77
|
-
/** Shared coordinator passed to every TSDF store instance in an app/session. */
|
|
78
|
-
export type StoreManager<TUploadRef extends ValidPayload = ValidPayload> = {
|
|
79
|
-
/** Returns the active shared session / tenant key. */
|
|
80
|
-
getSessionKey: () => string | false;
|
|
81
|
-
/** Shared debug logger for browser-tab sync, focus lifecycle, and persistent storage internals. */
|
|
82
|
-
debugLogger?: TSDFDebugLogger;
|
|
83
|
-
/** Shared logger for low-volume production signals. */
|
|
84
|
-
logger?: TSDFDebugLogger;
|
|
85
|
-
/** Normalizes raw exceptions into the shared StoreError shape. */
|
|
86
|
-
errorNormalizer: (exception: Error) => StoreError;
|
|
87
|
-
/** Global fallback for persistent storage failures in attached stores. */
|
|
88
|
-
onPersistentStorageError: PersistentStorageErrorHandler | undefined;
|
|
89
|
-
/** Global fallback for mutation failures in attached stores. */
|
|
90
|
-
onMutationError: StoreManagerMutationErrorHandler | undefined;
|
|
91
|
-
/** Shared defaults used by attached stores unless a store-level override exists. */
|
|
92
|
-
storeDefaults: StoreManagerStoreDefaults;
|
|
93
|
-
/** Returns the unique ids of all currently registered store instances. */
|
|
94
|
-
getAllStoreIds: () => string[];
|
|
95
|
-
/** Resets all registered stores except the ignored logical ids. */
|
|
96
|
-
resetAll: (ignoreStores: string[]) => void;
|
|
97
|
-
/** Signals a shared real-time transport reconnect to all registered stores. */
|
|
98
|
-
onTransportReconnect: () => void;
|
|
99
|
-
} & StoreManagerOfflineApi<TUploadRef>;
|
|
100
|
-
type RegisteredStore = {
|
|
101
|
-
id: string;
|
|
102
|
-
reset: () => void;
|
|
103
|
-
onTransportReconnect: () => void;
|
|
104
|
-
};
|
|
105
|
-
/** Options used to create a shared TSDF store manager. */
|
|
106
|
-
export type CreateStoreManagerOptions<TUploadRef extends ValidPayload = ValidPayload> = {
|
|
107
|
-
/**
|
|
108
|
-
* Returns the current authenticated session / tenant key shared by all
|
|
109
|
-
* stores attached to this manager. Return `false` to disable session-scoped
|
|
110
|
-
* behavior while no account is loaded.
|
|
111
|
-
*/
|
|
112
|
-
getSessionKey: () => string | false;
|
|
113
|
-
/**
|
|
114
|
-
* Returns the stable app build version used to isolate browser-tab sync
|
|
115
|
-
* across deployments. The callback is evaluated once when the manager is
|
|
116
|
-
* created.
|
|
117
|
-
*/
|
|
118
|
-
getAppVersion?: () => string;
|
|
119
|
-
/** Normalizes raw exceptions into the shared StoreError shape. */
|
|
120
|
-
errorNormalizer: (exception: Error) => StoreError;
|
|
121
|
-
/** Default minimum interval between low-priority fetches for attached stores. Defaults to 40 minutes. */
|
|
122
|
-
lowPriorityThrottleMs?: number;
|
|
123
|
-
/** Default coalescing window for attached stores. Defaults to 16ms. */
|
|
124
|
-
baseCoalescingWindowMs?: number;
|
|
125
|
-
/** Extra browser-tab coalescing delay applied only while a tab is in the background. Defaults to 3000ms. */
|
|
126
|
-
backgroundCoalescingDelayMs?: number;
|
|
127
|
-
/** Default adaptive throttle for real-time updates in attached stores. Store-level values override it. */
|
|
128
|
-
dynamicRealtimeThrottleMs?: DynamicRealtimeThrottleMs;
|
|
129
|
-
/** Shared window-close blocker used by mutations in attached stores. Pass `null` to disable. */
|
|
130
|
-
blockWindowClose?: BlockWindowCloseHandler | null;
|
|
131
|
-
/** Global fallback for persistent storage failures when a store does not provide its own handler. */
|
|
132
|
-
onPersistentStorageError?: PersistentStorageErrorHandler;
|
|
133
|
-
/** Global fallback for mutation failures when a store does not provide its own handler. */
|
|
134
|
-
onMutationError?: StoreManagerMutationErrorHandler;
|
|
135
|
-
/** Default focus revalidation policy for attached stores. Store-level values override it. */
|
|
136
|
-
revalidateOnWindowFocus?: boolean | (() => boolean);
|
|
137
|
-
/** Enables verbose development-only logs. Pass `true` to use console logging, or pass a logger function. */
|
|
138
|
-
debugLogger?: TSDFLoggerOptions;
|
|
139
|
-
/** Enables low-volume production-safe logs. Defaults to console logging; pass `false` to disable. */
|
|
140
|
-
logger?: TSDFLoggerOptions;
|
|
141
|
-
/** Optional shared offline session config for every attached store. */
|
|
142
|
-
offlineSession?: OfflineSessionConfig<TUploadRef>;
|
|
143
|
-
};
|
|
144
|
-
export declare function createStoreManager<TUploadRef extends ValidPayload = ValidPayload>(options: CreateStoreManagerOptions<TUploadRef>): StoreManager<TUploadRef>;
|
|
145
|
-
export declare function registerStoreWithManager(storeManager: StoreManager, store: RegisteredStore): () => void;
|
|
146
|
-
export declare function getStoreManagerAppVersion(storeManager: StoreManager): string | undefined;
|
|
147
|
-
export declare function getOrCreateStoreManagerBrowserTabsPresence(storeManager: StoreManager, options: {
|
|
148
|
-
getWindowIsFocused: () => boolean;
|
|
149
|
-
onWindowFocusChange?: (handler: () => void) => () => void;
|
|
150
|
-
transportFactory?: BrowserTabsTransportFactory;
|
|
151
|
-
priorityTimings?: BrowserTabsPriorityTimings;
|
|
152
|
-
}): {
|
|
153
|
-
priority: {
|
|
154
|
-
getCoalescingWindowMs: (baseMs: number) => number;
|
|
155
|
-
};
|
|
156
|
-
tabId: string;
|
|
157
|
-
};
|
|
158
|
-
export declare function resolveStoreManagerOfflineSession<TUploadRef extends ValidPayload = ValidPayload>(storeManager: StoreManager<TUploadRef>, storeName: string, usesOfflineStorage: boolean): OfflineSession<TUploadRef> | null;
|
|
159
|
-
export declare function validateStoreManagerSessionConsistency(storeName: string, offlineSession: OfflineSession, getSessionKey: () => string | false): string | false;
|
|
160
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { TSDFStatus } from './storeShared';
|
|
2
|
-
export declare const AUTOMATIC_RETRY_LOCKOUT_MS = 10000;
|
|
3
|
-
/**
|
|
4
|
-
* Per-hook state used by `tryClaimAutomaticFetchSlot`.
|
|
5
|
-
* Maps a resource signature to the last automatic attempt and whether a fast
|
|
6
|
-
* error has locked that resource out.
|
|
7
|
-
*/
|
|
8
|
-
export type AutomaticFetchRetryState = Map<string, {
|
|
9
|
-
attemptedAt: number;
|
|
10
|
-
locked: boolean;
|
|
11
|
-
}>;
|
|
12
|
-
type AutomaticFetchStatus = TSDFStatus | 'idle' | 'loadingMore' | undefined;
|
|
13
|
-
export declare function observeAutomaticFetchStatus(state: AutomaticFetchRetryState, signature: string, currentStatus: AutomaticFetchStatus): void;
|
|
14
|
-
/**
|
|
15
|
-
* Decides whether an automatic, render-driven fetch should proceed.
|
|
16
|
-
*
|
|
17
|
-
* Returns `true` and records the attempt when allowed. Returns `false`
|
|
18
|
-
* when the resource is locked after a fast error.
|
|
19
|
-
*
|
|
20
|
-
* Manual fetches (`scheduleFetch`, `invalidateData`, transport reconnect,
|
|
21
|
-
* etc.) bypass this gate by calling the underlying scheduler directly.
|
|
22
|
-
*
|
|
23
|
-
* Lock state is maintained by `observeAutomaticFetchStatus`, which the
|
|
24
|
-
* consuming hook runs in a status-tracking effect before this is called.
|
|
25
|
-
*/
|
|
26
|
-
export declare function tryClaimAutomaticFetchSlot(state: AutomaticFetchRetryState, signature: string, currentStatus: AutomaticFetchStatus): boolean;
|
|
27
|
-
export declare function createFieldsResourceSignature(fields: '*' | readonly string[] | undefined): string;
|
|
28
|
-
export declare function shouldScheduleAutomaticFetch(wasLoaded: boolean | undefined, shouldFetch: boolean, disableRefetches: boolean, disableRefetchOnMount: boolean, skipFreshFetch?: boolean): boolean;
|
|
29
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export type BrowserTabsPriorityTimings = {
|
|
2
|
-
backgroundCoalescingDelayMs?: number;
|
|
3
|
-
fetchLeaseMs?: number | ((lastFetchDuration: number) => number);
|
|
4
|
-
};
|
|
5
|
-
export type BrowserTabsTabStatusMessage = {
|
|
6
|
-
kind: 'tab-status';
|
|
7
|
-
isFocused: boolean;
|
|
8
|
-
lastFocusedAt: number;
|
|
9
|
-
lastPresenceAt: number;
|
|
10
|
-
};
|
|
11
|
-
export type BrowserTabsLeaderPresence = {
|
|
12
|
-
tabId: string;
|
|
13
|
-
isFocused: boolean;
|
|
14
|
-
lastFocusedAt: number;
|
|
15
|
-
lastPresenceAt: number;
|
|
16
|
-
};
|
|
17
|
-
export type BrowserTabsLeaderChangeDetails = {
|
|
18
|
-
isLocalLeader: boolean;
|
|
19
|
-
leaderTabId: string;
|
|
20
|
-
liveTabs: readonly BrowserTabsLeaderPresence[];
|
|
21
|
-
localRank: number;
|
|
22
|
-
localTabId: string;
|
|
23
|
-
reason: 'local-focus' | 'local-status' | 'priority-read' | 'remote-status';
|
|
24
|
-
};
|
|
25
|
-
type BrowserTabsRemoteLeaseState = {
|
|
26
|
-
ownerTabId: string;
|
|
27
|
-
startedAt: number;
|
|
28
|
-
expiresAt: number;
|
|
29
|
-
};
|
|
30
|
-
export type BrowserTabsPriority = {
|
|
31
|
-
publishLocalStatus: () => void;
|
|
32
|
-
noteLocalFocusState: () => void;
|
|
33
|
-
getPriorityRank: () => number;
|
|
34
|
-
getCoalescingWindowMs: (baseCoalescingWindowMs: number) => number;
|
|
35
|
-
onTabStatusMessage: (remoteTabId: string, message: BrowserTabsTabStatusMessage) => void;
|
|
36
|
-
noteRemoteFetchStart: (targetKey: string, remoteTabId: string, startedAt: number, lastFetchDuration: number) => BrowserTabsRemoteLeaseState;
|
|
37
|
-
noteRemoteFetchSuccess: (targetKey: string, remoteTabId: string, startedAt: number, duration: number) => void;
|
|
38
|
-
getRemoteLeaseState: (targetKey: string) => BrowserTabsRemoteLeaseState | null;
|
|
39
|
-
clearRemoteLease: (targetKey: string) => void;
|
|
40
|
-
reset: () => void;
|
|
41
|
-
close: () => void;
|
|
42
|
-
};
|
|
43
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { type BrowserTabsPriority } from './browserTabsPriority';
|
|
2
|
-
export type BrowserTabsStoreType = 'presence' | 'document' | 'collection' | 'listQuery' | 'offline';
|
|
3
|
-
export type BrowserTabsMessageMeta = {
|
|
4
|
-
protocolVersion: 1;
|
|
5
|
-
messageId: string;
|
|
6
|
-
storeType: BrowserTabsStoreType;
|
|
7
|
-
sessionKey: string;
|
|
8
|
-
tabId: string;
|
|
9
|
-
seq: number;
|
|
10
|
-
sentAt: number;
|
|
11
|
-
};
|
|
12
|
-
export type BrowserTabsTransport = {
|
|
13
|
-
postMessage: (message: unknown) => void;
|
|
14
|
-
close: () => void;
|
|
15
|
-
};
|
|
16
|
-
export type BrowserTabsTransportFactory = (options: {
|
|
17
|
-
channelName: string;
|
|
18
|
-
onMessage: (message: unknown) => void;
|
|
19
|
-
}) => BrowserTabsTransport | null;
|
|
20
|
-
export type BrowserTabsPresencePriority = {
|
|
21
|
-
priority: BrowserTabsPriority;
|
|
22
|
-
tabId: string;
|
|
23
|
-
close: () => void;
|
|
24
|
-
};
|
|
25
|
-
export type SnapshotConsistency = 'optimistic' | 'confirmed';
|
|
26
|
-
export type BrowserTabsSyncVersion = {
|
|
27
|
-
consistency: SnapshotConsistency;
|
|
28
|
-
sentAt: number;
|
|
29
|
-
tabId: string;
|
|
30
|
-
seq: number;
|
|
31
|
-
};
|
|
32
|
-
export declare function toBrowserTabsSyncVersion(meta: Pick<BrowserTabsMessageMeta, 'tabId' | 'seq' | 'sentAt'>, consistency: SnapshotConsistency): BrowserTabsSyncVersion;
|
|
33
|
-
export declare function isBrowserTabsSyncVersionNewer(candidate: BrowserTabsSyncVersion, current: BrowserTabsSyncVersion | undefined): boolean;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tracks the optimistic mutations of each entity, so a failed one can tell
|
|
3
|
-
* whether a newer one may have been saved without changing the local state
|
|
4
|
-
* (e.g. saving the same value), which reverting the failed one would
|
|
5
|
-
* contradict. Mutations that fail or are skipped don't count.
|
|
6
|
-
*/
|
|
7
|
-
export declare function createOptimisticMutationTracker(): {
|
|
8
|
-
start(key: string, mutationId: number): void;
|
|
9
|
-
/**
|
|
10
|
-
* Whether an optimistic mutation other than `selfId`, started after
|
|
11
|
-
* `sinceId`, succeeded or is still in flight. `sinceId` is older than
|
|
12
|
-
* `selfId` when the failing mutation reverts the updates of the debounced
|
|
13
|
-
* calls it superseded.
|
|
14
|
-
*/
|
|
15
|
-
hasNewer(key: string, sinceId: number, selfId: number): boolean;
|
|
16
|
-
/** Whether an optimistic mutation other than `selfId` is in flight */
|
|
17
|
-
hasOtherInFlight(key: string, selfId: number): boolean;
|
|
18
|
-
/** `succeeded` is whether the server accepted the mutation */
|
|
19
|
-
end(key: string, mutationId: number, succeeded: boolean): void;
|
|
20
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reverts the change an optimistic update made to an entity (`before` ->
|
|
3
|
-
* `after`) on top of its `current` value, one level deep and by reference:
|
|
4
|
-
* fields still equal to `after` are restored and fields the update didn't
|
|
5
|
-
* touch keep their current value. A field changed again since the update is
|
|
6
|
-
* kept and reported as `changed`, so the caller can revalidate the entity.
|
|
7
|
-
*/
|
|
8
|
-
export declare function revertOptimisticChange<T extends Record<string, unknown> | null | undefined>(current: T, before: T, after: T): {
|
|
9
|
-
value: T;
|
|
10
|
-
changed: boolean;
|
|
11
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { DebounceOptions } from '@ls-stack/utils/debounce';
|
|
2
|
-
import type { PayloadDebounce } from './storeShared';
|
|
3
|
-
export declare function shouldDebouncePayload(debouncePayload: PayloadDebounce | undefined): boolean;
|
|
4
|
-
export declare function getPayloadDebounceOptions(debouncePayload: PayloadDebounce | undefined): DebounceOptions | undefined;
|
|
5
|
-
export declare function assertNoRequireFreshDataWithDebouncePayload(hookName: string, requireFreshData: boolean | undefined, debouncePayload: PayloadDebounce | undefined): void;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type Result as TResult } from 't-result';
|
|
2
|
-
import { type MutationSkipped } from './storeShared';
|
|
3
|
-
/** Starts a temporary window-close block while a mutation is in progress. */
|
|
4
|
-
export type BlockWindowCloseHandler = () => {
|
|
5
|
-
/** Releases the window-close block. */
|
|
6
|
-
unblock: () => void;
|
|
7
|
-
};
|
|
8
|
-
/** Debounce settings for mutation calls sharing a logical context and payload. */
|
|
9
|
-
export type MutationDebounce = {
|
|
10
|
-
/** Logical namespace for the debounced mutation group. */
|
|
11
|
-
context: string;
|
|
12
|
-
/** Payload compared with the context to decide which calls supersede each other. */
|
|
13
|
-
payload: unknown;
|
|
14
|
-
/** Debounce window in milliseconds. */
|
|
15
|
-
ms: number;
|
|
16
|
-
};
|
|
17
|
-
type ResultError = Error | Record<string, unknown> | unknown[] | readonly unknown[];
|
|
18
|
-
export declare function performMutationWithLifecycle<T, TError extends ResultError, TRollback>(startMutation: () => () => unknown, mutation: () => Promise<T>, onError: (exception: unknown, rollbacks: TRollback[]) => TError, optimisticUpdate: ((addRollback: (rollback: TRollback) => void) => void | boolean) | undefined, onSuccess: ((result: Awaited<T>, rollbacks: TRollback[]) => void) | undefined, debounce: MutationDebounce | undefined, blockWindowClose: BlockWindowCloseHandler | null | undefined, pendingDebounceRollbacks: Map<string, TRollback[]>): Promise<TResult<Awaited<T>, TError | MutationSkipped>>;
|
|
19
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function reusePrevIfEqual<T>(prev: T | undefined, current: T): T;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { type Result as ResultType, type ResultValidErrors } from 't-result';
|
|
2
|
-
import type { FetchType } from '../requestScheduler';
|
|
3
|
-
/** Shared fetch lifecycle status used by TSDF stores and hooks. */
|
|
4
|
-
export type TSDFStatus = 'loading' | 'error' | 'refetching' | 'success';
|
|
5
|
-
/** Payload shapes supported by store keying and fetch APIs. */
|
|
6
|
-
export type ValidPayload = number | string | Record<string, unknown>;
|
|
7
|
-
/** State shapes supported by TSDF caches. */
|
|
8
|
-
export type ValidStoreState = Record<string, unknown> | unknown[];
|
|
9
|
-
export type UnwrapTSDFResult<T> = T extends {
|
|
10
|
-
ok: true;
|
|
11
|
-
value: infer Value;
|
|
12
|
-
} ? Value : T extends {
|
|
13
|
-
ok: false;
|
|
14
|
-
error: ResultValidErrors;
|
|
15
|
-
} ? never : T;
|
|
16
|
-
export declare function unwrapTSDFResult<T>(value: T): UnwrapTSDFResult<T>;
|
|
17
|
-
export type MaybeTSDFResult<T> = T | ResultType<T, ResultValidErrors>;
|
|
18
|
-
export declare function unwrapMaybeTSDFResult<T>(value: MaybeTSDFResult<T>): T;
|
|
19
|
-
/**
|
|
20
|
-
* Returns `true` when `prefix` is a strict prefix of `full` (`prefix` is shorter
|
|
21
|
-
* and every entry matches `full` at the same index). Used by list-query offline
|
|
22
|
-
* paths to detect that a cached query has additional items beyond the in-memory
|
|
23
|
-
* query state.
|
|
24
|
-
*/
|
|
25
|
-
export declare function isStrictItemKeyPrefix(prefix: readonly string[], full: readonly string[]): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Debounce settings for payload-driven automatic fetches in store hooks.
|
|
28
|
-
*
|
|
29
|
-
* The hook still reads data from state using the latest payload immediately.
|
|
30
|
-
* Only the automatic fetch side is delayed. Single hooks do not support
|
|
31
|
-
* combining this with `requireFreshData`.
|
|
32
|
-
*/
|
|
33
|
-
export type PayloadDebounce = {
|
|
34
|
-
/** Debounce window in milliseconds before the latest payload is fetched. */
|
|
35
|
-
ms: number;
|
|
36
|
-
/**
|
|
37
|
-
* Maximum time a burst may stay deferred before the latest payload is
|
|
38
|
-
* fetched, even if changes keep happening within the debounce window.
|
|
39
|
-
*/
|
|
40
|
-
maxWait?: number;
|
|
41
|
-
/**
|
|
42
|
-
* When true, the first payload in a burst may fetch immediately, and later
|
|
43
|
-
* changes within the same burst stay debounced until the wait window ends.
|
|
44
|
-
*/
|
|
45
|
-
leading?: boolean;
|
|
46
|
-
};
|
|
47
|
-
export declare const DEFAULT_BATCH_KEY = "__default__";
|
|
48
|
-
/** Normalized error shape used by fetch and mutation APIs. */
|
|
49
|
-
export type StoreError = {
|
|
50
|
-
/** Numeric application or transport error code. */
|
|
51
|
-
code: number;
|
|
52
|
-
/** Stable machine-readable error id. */
|
|
53
|
-
id: string;
|
|
54
|
-
/** Human-readable error message. */
|
|
55
|
-
message: string;
|
|
56
|
-
/** Optional request path associated with the failure. */
|
|
57
|
-
path?: string;
|
|
58
|
-
/** Optional HTTP method associated with the failure. */
|
|
59
|
-
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
60
|
-
};
|
|
61
|
-
export declare const invalidPayloadError: StoreError;
|
|
62
|
-
export declare const fetchTypePriority: Record<FetchType, number>;
|
|
63
|
-
/** Returns the higher-priority fetch type, treating a missing `a` as lower. */
|
|
64
|
-
export declare function higherFetchType(a: FetchType | null | undefined, b: FetchType): FetchType;
|
|
65
|
-
/** Result error returned when a debounced or canceled mutation never runs. */
|
|
66
|
-
export type MutationSkipped = {
|
|
67
|
-
/** Stable discriminator for skipped mutations. */
|
|
68
|
-
kind: 'skipped';
|
|
69
|
-
};
|
|
70
|
-
export declare const mutationSkipped: MutationSkipped;
|
|
71
|
-
/** Options passed to mutation error handlers. */
|
|
72
|
-
export type StoreMutationErrorOptions = {
|
|
73
|
-
/**
|
|
74
|
-
* True when the mutation caller asked the shared error handler to stay quiet.
|
|
75
|
-
*
|
|
76
|
-
* Handlers are still called so apps can keep centralized logging, metrics, or
|
|
77
|
-
* custom recovery behavior while suppressing user-facing noise such as toast
|
|
78
|
-
* notifications.
|
|
79
|
-
*/
|
|
80
|
-
silentErrors?: boolean;
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* Resolves a store-level option that may inherit from a manager-level fallback.
|
|
84
|
-
* `undefined` means "use the manager value" and `null` means "explicit opt-out,
|
|
85
|
-
* ignore the manager value".
|
|
86
|
-
*/
|
|
87
|
-
export declare function resolveManagerFallback<T>(storeLevel: T | null | undefined, managerLevel: NoInfer<T> | undefined): T | undefined;
|
|
88
|
-
export declare function normalizeStoreError(exception: unknown, errorNormalizer: (exception: Error) => StoreError): StoreError;
|
|
89
|
-
/** Error wrapper returned by mutation APIs after normalization. */
|
|
90
|
-
export declare class StoreMutationError extends Error {
|
|
91
|
-
/** Stable discriminator matching result-style mutation errors. */
|
|
92
|
-
readonly kind = "error";
|
|
93
|
-
/** Numeric application or transport error code. */
|
|
94
|
-
code: number;
|
|
95
|
-
/** Stable machine-readable error id. */
|
|
96
|
-
id: string;
|
|
97
|
-
/** Optional request path associated with the failure. */
|
|
98
|
-
path?: string;
|
|
99
|
-
/** Optional HTTP method associated with the failure. */
|
|
100
|
-
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
101
|
-
constructor(error: StoreError, options?: ErrorOptions);
|
|
102
|
-
}
|
|
103
|
-
export declare function toStoreMutationError(exception: unknown, errorNormalizer: (exception: Error) => StoreError): StoreMutationError;
|
|
104
|
-
/** Error wrapper returned by fetch APIs after normalization. */
|
|
105
|
-
export declare class StoreFetchError extends Error {
|
|
106
|
-
/** Numeric application or transport error code. */
|
|
107
|
-
code: number;
|
|
108
|
-
/** Stable machine-readable error id. */
|
|
109
|
-
id: string;
|
|
110
|
-
/** Fetch failure category. */
|
|
111
|
-
type: 'fetch' | 'aborted' | 'timeout';
|
|
112
|
-
/** Optional request path associated with the failure. */
|
|
113
|
-
path?: string;
|
|
114
|
-
/** Optional HTTP method associated with the failure. */
|
|
115
|
-
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
116
|
-
constructor(error: StoreError, type: 'fetch' | 'aborted' | 'timeout');
|
|
117
|
-
}
|
|
118
|
-
export declare class TimeoutStoreError extends StoreFetchError {
|
|
119
|
-
constructor();
|
|
120
|
-
}
|
|
121
|
-
export declare class AbortedStoreError extends StoreFetchError {
|
|
122
|
-
constructor();
|
|
123
|
-
}
|
|
124
|
-
export declare class NotFoundStoreError extends StoreFetchError {
|
|
125
|
-
constructor();
|
|
126
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
type EnsureIsLoadedResultModifier = <T extends {
|
|
2
|
-
isLoading: boolean;
|
|
3
|
-
status: string;
|
|
4
|
-
}>(result: T) => T;
|
|
5
|
-
export declare function useEnsureIsLoaded(ensureIsLoaded: boolean | undefined, enabled: boolean, forceFetch: () => void): readonly [EnsureIsLoadedResultModifier, () => void];
|
|
6
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
type RequireFreshDataResultModifier = <T extends {
|
|
2
|
-
isLoading: boolean;
|
|
3
|
-
status: string;
|
|
4
|
-
}>(result: T) => T;
|
|
5
|
-
export declare function useRequireFreshData(requireFreshData: boolean | undefined, enabled: boolean, forceFetch: () => void): readonly [RequireFreshDataResultModifier, () => void];
|
|
6
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { PartialResourcesConfig } from '../../src/listQueryStore/types';
|
|
2
|
-
import type { Row } from '../mocks/listQueryStoreTestEnv';
|
|
3
|
-
export declare function setupBrowserTabsTestLifecycle(): void;
|
|
4
|
-
export declare function wait(ms: number): Promise<void>;
|
|
5
|
-
type FocusControllerBinding = {
|
|
6
|
-
getWindowIsFocused: () => boolean;
|
|
7
|
-
/** Per-tab focus subscription. Calls the handler when this tab receives focus. */
|
|
8
|
-
onWindowFocus: (handler: () => void) => () => void;
|
|
9
|
-
/** Per-tab blur subscription. Calls the handler when this tab loses focus. */
|
|
10
|
-
onWindowBlur: (handler: () => void) => () => void;
|
|
11
|
-
};
|
|
12
|
-
interface FocusChangeCoordinator<T extends string> {
|
|
13
|
-
/** Returns a `getWindowIsFocused` getter for the given tab, for use in store env creation. */
|
|
14
|
-
getWindowIsFocused(tab: T): () => boolean;
|
|
15
|
-
/** Returns a binding for use as `bindFocusController` in test env options. Provides per-tab `getWindowIsFocused`, `onWindowFocus`, and `onWindowBlur`. */
|
|
16
|
-
bind(tab: T): FocusControllerBinding;
|
|
17
|
-
/** Focus a tab. If another tab was focused, it gets blurred first (like a real browser tab switch). */
|
|
18
|
-
focusTab(tab: T): Promise<void>;
|
|
19
|
-
/** Blur all tabs (simulates window going to background). No-op if nothing is focused. */
|
|
20
|
-
blur(): Promise<void>;
|
|
21
|
-
}
|
|
22
|
-
export declare function createFocusChangeCoordinator<T extends string>(tabs: readonly T[], initialFocused: T | null): FocusChangeCoordinator<T>;
|
|
23
|
-
export declare function countFetchHistoryEntries<TEntry extends {
|
|
24
|
-
type: string;
|
|
25
|
-
}>(history: TEntry[], type: TEntry['type']): number;
|
|
26
|
-
export declare const partialResourcesConfig: PartialResourcesConfig<Row>;
|
|
27
|
-
export declare function getPublisherTabIds(messages: Array<{
|
|
28
|
-
message: unknown;
|
|
29
|
-
}>): Set<string>;
|
|
30
|
-
export declare function getMessageKinds(messages: Array<{
|
|
31
|
-
message: unknown;
|
|
32
|
-
}>): string[];
|
|
33
|
-
export declare function getNonStatusMessages(messages: Array<{
|
|
34
|
-
message: unknown;
|
|
35
|
-
}>): {
|
|
36
|
-
message: unknown;
|
|
37
|
-
}[];
|
|
38
|
-
export declare function createCollectionItems(): {
|
|
39
|
-
item1: {
|
|
40
|
-
name: string;
|
|
41
|
-
};
|
|
42
|
-
item2: {
|
|
43
|
-
name: string;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
export declare function createUsersTable(): {
|
|
47
|
-
users: {
|
|
48
|
-
id: number;
|
|
49
|
-
name: string;
|
|
50
|
-
}[];
|
|
51
|
-
};
|
|
52
|
-
export declare function createThreeUsersTable(): {
|
|
53
|
-
users: {
|
|
54
|
-
id: number;
|
|
55
|
-
name: string;
|
|
56
|
-
}[];
|
|
57
|
-
};
|
|
58
|
-
export declare function createOptimisticSortConfig(): {
|
|
59
|
-
queries: {
|
|
60
|
-
tableId: string;
|
|
61
|
-
};
|
|
62
|
-
sort: {
|
|
63
|
-
sortBy: (item: {
|
|
64
|
-
name: string;
|
|
65
|
-
}) => string;
|
|
66
|
-
order: "asc";
|
|
67
|
-
};
|
|
68
|
-
}[];
|
|
69
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/react/dont-cleanup-after-each';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/react/dont-cleanup-after-each';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/react/dont-cleanup-after-each';
|