Open History to see the last commit
1---
2id: SyncConfig
3title: SyncConfig
4---
5
6Defined in: [packages/db/src/types.ts:387](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L387)
7
8## Type Parameters
9
10### T
11
12`T` *extends* `object` = `Record`\<`string`, `unknown`\>
13
14### TKey
15
16`TKey` *extends* `string` \| `number` = `string` \| `number`
17
18## Properties
19
20### exportSyncMeta()?
21
22```ts
23optional exportSyncMeta: () => unknown;
24```
25
26Defined in: [packages/db/src/types.ts:431](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L431)
27
28Export adapter-specific metadata that lets hydration/persistence resume sync.
29The payload shape is owned by the adapter.
30
31#### Returns
32
33`unknown`
34
35***
36
37### getSyncMetadata()?
38
39```ts
40optional getSyncMetadata: () => Record<string, unknown>;
41```
42
43Defined in: [packages/db/src/types.ts:425](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L425)
44
45Get the sync metadata for insert operations
46
47#### Returns
48
49`Record`\<`string`, `unknown`\>
50
51Record containing relation information
52
53***
54
55### importSyncMeta()?
56
57```ts
58optional importSyncMeta: (meta) => void;
59```
60
61Defined in: [packages/db/src/types.ts:436](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L436)
62
63Import adapter-specific metadata produced by exportSyncMeta.
64
65#### Parameters
66
67##### meta
68
69`unknown`
70
71#### Returns
72
73`void`
74
75***
76
77### mergeSyncMeta()?
78
79```ts
80optional mergeSyncMeta: (current, incoming) => unknown;
81```
82
83Defined in: [packages/db/src/types.ts:441](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L441)
84
85Merge two adapter-specific metadata payloads during hydration.
86
87#### Parameters
88
89##### current
90
91`unknown`
92
93##### incoming
94
95`unknown`
96
97#### Returns
98
99`unknown`
100
101***
102
103### rowUpdateMode?
104
105```ts
106optional rowUpdateMode: "full" | "partial";
107```
108
109Defined in: [packages/db/src/types.ts:450](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L450)
110
111The row update mode used to sync to the collection.
112
113#### Default
114
115`partial`
116
117#### Description
118
119- `partial`: Updates contain only the changes to the row.
120- `full`: Updates contain the entire row.
121
122***
123
124### sync()
125
126```ts
127sync: (params) =>
128 | void
129 | CleanupFn
130 | SyncConfigRes;
131```
132
133Defined in: [packages/db/src/types.ts:391](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L391)
134
135#### Parameters
136
137##### params
138
139###### begin
140
141(`options?`) => `void`
142
143Begin a new sync transaction.
144
145###### collection
146
147[`Collection`](Collection.md)\<`T`, `TKey`, `any`, `any`, `any`\>
148
149###### commit
150
151(`signal?`) => [`SyncAppliedReceipt`](../type-aliases/SyncAppliedReceipt.md)
152
153Commit the active sync transaction in FIFO order.
154Returns `true` when the writes and events are already visible. Otherwise
155returns a receipt that resolves after they become visible. If collection
156cleanup or an optional request abort abandons the transaction first, the
157receipt rejects with an error named `AbortError`.
158Pass a signal only for request-scoped work that must not publish after
159cancellation. Aborting after application has no effect.
160
161###### markError
162
163(`error?`) => `void`
164
165Signal that initial sync failed before producing a usable snapshot.
166When supplied, `error` is preserved as the rejection reason from `preload()`.
167
168###### markReady
169
170() => `void`
171
172Signal that a usable initial or recovered snapshot is available.
173
174###### metadata?
175
176[`SyncMetadataApi`](SyncMetadataApi.md)\<`TKey`\>
177
178###### truncate
179
180() => `void`
181
182###### write
183
184(`message`) => `void`
185
186#### Returns
187
188 \| `void`
189 \| [`CleanupFn`](../type-aliases/CleanupFn.md)
190 \| [`SyncConfigRes`](../type-aliases/SyncConfigRes.md)