@syncular/tauri 0.5.0 → 0.5.1
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/README.md +5 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +9 -4
- package/package.json +3 -3
- package/src/index.ts +15 -7
package/README.md
CHANGED
|
@@ -8,6 +8,11 @@ Install the bridge together with its required Tauri JavaScript API peer:
|
|
|
8
8
|
bun add @syncular/tauri @tauri-apps/api
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
Reactive snapshots use the plugin's independent read-only SQLite path, so
|
|
12
|
+
local Tauri views remain responsive while the native client is syncing over
|
|
13
|
+
HTTP/WebSocket. Mutations, sync, and all durable writes remain serialized on
|
|
14
|
+
the single mutable core owner.
|
|
15
|
+
|
|
11
16
|
Part of [Syncular](https://syncular.dev) — an offline-first sync framework.
|
|
12
17
|
See the [Syncular repository](https://github.com/syncular/syncular) for docs.
|
|
13
18
|
|
package/dist/index.d.ts
CHANGED
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* Every method forwards to the plugin's `syncular_command` command (the whole
|
|
14
14
|
* command surface in one JSON envelope — `{method, params}`), mirroring the FFI
|
|
15
15
|
* and the conformance shim. `query` uses the dedicated `syncular_query` fast
|
|
16
|
-
* path
|
|
17
|
-
*
|
|
16
|
+
* path; atomic reactive reads use `syncular_query_snapshot`, backed by an
|
|
17
|
+
* independent read-only SQLite connection so network sync cannot stall local
|
|
18
|
+
* UI reads. Client-observable
|
|
18
19
|
* events (`change` / `presence`) arrive on
|
|
19
20
|
* the `syncular://event` Tauri event and fan out to the registered listeners.
|
|
20
21
|
*
|
package/dist/index.js
CHANGED
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* Every method forwards to the plugin's `syncular_command` command (the whole
|
|
14
14
|
* command surface in one JSON envelope — `{method, params}`), mirroring the FFI
|
|
15
15
|
* and the conformance shim. `query` uses the dedicated `syncular_query` fast
|
|
16
|
-
* path
|
|
17
|
-
*
|
|
16
|
+
* path; atomic reactive reads use `syncular_query_snapshot`, backed by an
|
|
17
|
+
* independent read-only SQLite connection so network sync cannot stall local
|
|
18
|
+
* UI reads. Client-observable
|
|
18
19
|
* events (`change` / `presence`) arrive on
|
|
19
20
|
* the `syncular://event` Tauri event and fan out to the registered listeners.
|
|
20
21
|
*
|
|
@@ -220,11 +221,15 @@ export class TauriSyncClient {
|
|
|
220
221
|
return rows.map((r) => decodeRow(r));
|
|
221
222
|
}
|
|
222
223
|
async querySnapshot(spec) {
|
|
223
|
-
const
|
|
224
|
+
const reply = await this.#tauri.invoke(`${PLUGIN}syncular_query_snapshot`, {
|
|
224
225
|
sql: spec.sql,
|
|
225
226
|
params: (spec.params ?? []).map(encodeParam),
|
|
226
227
|
coverage: spec.coverage ?? [],
|
|
227
|
-
})
|
|
228
|
+
});
|
|
229
|
+
if (reply.error !== undefined) {
|
|
230
|
+
throw new TauriSyncError(reply.error.code, reply.error.message);
|
|
231
|
+
}
|
|
232
|
+
const result = reply.result;
|
|
228
233
|
return {
|
|
229
234
|
revision: BigInt(result.revision),
|
|
230
235
|
rows: result.rows.map(decodeRow),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncular/tauri",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Tauri integration for the Syncular client",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Benjamin Kniffler",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"test": "bun test"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@syncular/client": "0.5.
|
|
51
|
+
"@syncular/client": "0.5.1"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@tauri-apps/api": ">=2.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@syncular/react": "0.5.
|
|
57
|
+
"@syncular/react": "0.5.1"
|
|
58
58
|
}
|
|
59
59
|
}
|
package/src/index.ts
CHANGED
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* Every method forwards to the plugin's `syncular_command` command (the whole
|
|
14
14
|
* command surface in one JSON envelope — `{method, params}`), mirroring the FFI
|
|
15
15
|
* and the conformance shim. `query` uses the dedicated `syncular_query` fast
|
|
16
|
-
* path
|
|
17
|
-
*
|
|
16
|
+
* path; atomic reactive reads use `syncular_query_snapshot`, backed by an
|
|
17
|
+
* independent read-only SQLite connection so network sync cannot stall local
|
|
18
|
+
* UI reads. Client-observable
|
|
18
19
|
* events (`change` / `presence`) arrive on
|
|
19
20
|
* the `syncular://event` Tauri event and fan out to the registered listeners.
|
|
20
21
|
*
|
|
@@ -320,11 +321,18 @@ export class TauriSyncClient {
|
|
|
320
321
|
async querySnapshot<Row = SqlRow>(
|
|
321
322
|
spec: QueryReadSpec,
|
|
322
323
|
): Promise<QuerySnapshot<Row>> {
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
324
|
+
const reply = await this.#tauri.invoke<CommandReply>(
|
|
325
|
+
`${PLUGIN}syncular_query_snapshot`,
|
|
326
|
+
{
|
|
327
|
+
sql: spec.sql,
|
|
328
|
+
params: (spec.params ?? []).map(encodeParam),
|
|
329
|
+
coverage: spec.coverage ?? [],
|
|
330
|
+
},
|
|
331
|
+
);
|
|
332
|
+
if (reply.error !== undefined) {
|
|
333
|
+
throw new TauriSyncError(reply.error.code, reply.error.message);
|
|
334
|
+
}
|
|
335
|
+
const result = reply.result as {
|
|
328
336
|
revision: string;
|
|
329
337
|
rows: Record<string, unknown>[];
|
|
330
338
|
coverage: QuerySnapshot['coverage'];
|