- Core API Reference
- Collection
- createCollection
- liveQueryCollectionOptions
- createLiveQueryCollection
- createOptimisticAction
- createTransaction
- Electric DB Collection
- electricCollectionOptions
- Query DB Collection
- queryCollectionOptions
- RxDB DB Collection
- rxdbCollectionOptions
- PowerSync Collection
- powerSyncCollectionOptions
- createIndexedDB
- indexedDBCollectionOptions
- React Hooks
- useLiveQuery
SyncConfig
Defined in: packages/db/src/types.ts:431
Type Parameters#
T#
T extends object = Record<string, unknown>
TKey#
TKey extends string | number = string | number
Properties#
exportSyncMeta()?#
optional exportSyncMeta: () => unknown;Defined in: packages/db/src/types.ts:478
Export adapter-specific metadata that lets hydration/persistence resume sync. The payload shape is owned by the adapter.
Returns#
unknown
getSyncMetadata()?#
optional getSyncMetadata: () => Record<string, unknown>;Defined in: packages/db/src/types.ts:472
Get the sync metadata for insert operations
Returns#
Record<string, unknown>
Record containing relation information
importSyncMeta()?#
optional importSyncMeta: (meta) => void;Defined in: packages/db/src/types.ts:483
Import adapter-specific metadata produced by exportSyncMeta.
Parameters#
meta#
unknown
Returns#
void
mergeSyncMeta()?#
optional mergeSyncMeta: (current, incoming) => unknown;Defined in: packages/db/src/types.ts:488
Merge two adapter-specific metadata payloads during hydration.
Parameters#
current#
unknown
incoming#
unknown
Returns#
unknown
rowUpdateMode?#
optional rowUpdateMode: "full" | "partial";Defined in: packages/db/src/types.ts:497
The row update mode used to sync to the collection.
Default#
partial
Description#
- partial: Updates contain only the changes to the row.
- full: Updates contain the entire row.
sync()#
sync: (params) =>
| void
| CleanupFn
| SyncConfigRes;Defined in: packages/db/src/types.ts:435
Parameters#
params#
begin#
() => void
Begin a new sync transaction.
collection#
Collection<T, TKey, any, any, any>
commit#
(signal?) => SyncAppliedReceipt
Commit the active sync transaction in FIFO order. Core accepts it at once, and an accepted transaction always applies. Returns true when its writes are visible, or a receipt that resolves when they become visible. While an optimistic transaction is persisting, it becomes visible when that transaction settles, together with the drop of its optimistic state. A signal that is already aborted abandons the transaction before acceptance, and the receipt rejects with an error named AbortError. Aborting after acceptance has no effect.
markError#
(error?) => void
Signal that initial sync failed before producing a usable snapshot. When supplied, error is preserved as the rejection reason from preload().
markReady#
() => void
Signal that a usable initial or recovered snapshot is available.
metadata?#
SyncMetadataApi<TKey>
truncate#
(options?) => void
Replace the synced rows. By default the replacement also marks the Collection ready. Set markReady:false to publish without changing status, for example when confirming a committed write from a closed source. The last truncate in a transaction supplies its readiness intent.
write#
(message) => void
Returns#
| void | CleanupFn | SyncConfigRes