@syncular/tauri 0.7.0 → 0.8.0

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 CHANGED
@@ -13,6 +13,11 @@ local Tauri views remain responsive while the native client is syncing over
13
13
  HTTP/WebSocket. Mutations, sync, and all durable writes remain serialized on
14
14
  the single mutable core owner.
15
15
 
16
+ The bridge includes the native core's durable commit-outcome journal:
17
+ `commitOutcome`, `commitOutcomes`, and `resolveCommitOutcome`. Final results
18
+ and explicit conflict resolutions survive process restarts; active failures
19
+ are never silently removed by retention.
20
+
16
21
  Part of [Syncular](https://syncular.dev) — an offline-first sync framework.
17
22
  See the [Syncular repository](https://github.com/syncular/syncular) for docs.
18
23
 
package/dist/index.d.ts CHANGED
@@ -26,7 +26,7 @@
26
26
  * `invoke`/`listen` either from its ESM entry points, from the ambient
27
27
  * `window.__TAURI__`, or via injected doubles (tests).
28
28
  */
29
- import type { ClientChangeListener, ConflictRecord, InvalidationListener, LeaseState, MutationInput, PresencePeer, QueryReadSpec, QuerySnapshot, RejectionRecord, SchemaFloor, SqlRow, SqlValue, SyncStatusSnapshot, WindowBase, WindowState } from '@syncular/client';
29
+ import type { ClientChangeListener, CommitOutcome, CommitOutcomeQuery, ConflictRecord, InvalidationListener, LeaseState, MutationInput, PresencePeer, QueryReadSpec, QuerySnapshot, RejectionRecord, ResolveCommitOutcomeInput, SchemaFloor, SqlRow, SqlValue, SyncStatusSnapshot, WindowBase, WindowState } from '@syncular/client';
30
30
  /** One event pushed on `syncular://event` (the derived client-observable set). */
31
31
  interface SyncularEvent {
32
32
  readonly type: string;
@@ -117,6 +117,9 @@ export declare class TauriSyncClient {
117
117
  syncUntilIdle(maxRounds?: number): Promise<unknown>;
118
118
  conflicts(): Promise<readonly ConflictRecord[]>;
119
119
  rejections(): Promise<readonly RejectionRecord[]>;
120
+ commitOutcome(clientCommitId: string): Promise<CommitOutcome | undefined>;
121
+ commitOutcomes(query?: CommitOutcomeQuery): Promise<readonly CommitOutcome[]>;
122
+ resolveCommitOutcome(input: ResolveCommitOutcomeInput): Promise<CommitOutcome>;
120
123
  schemaFloor(): Promise<SchemaFloor | undefined>;
121
124
  leaseState(): Promise<LeaseState | undefined>;
122
125
  upgrading(): Promise<boolean>;
package/dist/index.js CHANGED
@@ -359,6 +359,22 @@ export class TauriSyncClient {
359
359
  const result = (await this.#command('rejections', {}));
360
360
  return result.rejections;
361
361
  }
362
+ async commitOutcome(clientCommitId) {
363
+ const result = (await this.#command('commitOutcome', {
364
+ clientCommitId,
365
+ }));
366
+ return result.outcome;
367
+ }
368
+ async commitOutcomes(query = {}) {
369
+ const result = (await this.#command('commitOutcomes', { query }));
370
+ return result.outcomes;
371
+ }
372
+ async resolveCommitOutcome(input) {
373
+ const result = (await this.#command('resolveCommitOutcome', {
374
+ input,
375
+ }));
376
+ return result.outcome;
377
+ }
362
378
  async schemaFloor() {
363
379
  const result = (await this.#command('schemaFloor', {}));
364
380
  return result.floor ?? undefined;
@@ -469,6 +485,7 @@ function decodeChangeBatch(value) {
469
485
  : {}),
470
486
  conflictsChanged: raw.conflictsChanged === true,
471
487
  rejectionsChanged: raw.rejectionsChanged === true,
488
+ outcomesChanged: raw.outcomesChanged === true,
472
489
  };
473
490
  }
474
491
  function invalidationFromChange(batch) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncular/tauri",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
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.7.0"
51
+ "@syncular/client": "0.8.0"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@tauri-apps/api": ">=2.0.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@syncular/react": "0.7.0"
57
+ "@syncular/react": "0.8.0"
58
58
  }
59
59
  }
package/src/index.ts CHANGED
@@ -33,6 +33,8 @@
33
33
  import type {
34
34
  ClientChangeBatch,
35
35
  ClientChangeListener,
36
+ CommitOutcome,
37
+ CommitOutcomeQuery,
36
38
  ConflictRecord,
37
39
  InvalidationEvent,
38
40
  InvalidationListener,
@@ -42,6 +44,7 @@ import type {
42
44
  QueryReadSpec,
43
45
  QuerySnapshot,
44
46
  RejectionRecord,
47
+ ResolveCommitOutcomeInput,
45
48
  SchemaFloor,
46
49
  SqlRow,
47
50
  SqlValue,
@@ -528,6 +531,33 @@ export class TauriSyncClient {
528
531
  return result.rejections;
529
532
  }
530
533
 
534
+ async commitOutcome(
535
+ clientCommitId: string,
536
+ ): Promise<CommitOutcome | undefined> {
537
+ const result = (await this.#command('commitOutcome', {
538
+ clientCommitId,
539
+ })) as { outcome?: CommitOutcome };
540
+ return result.outcome;
541
+ }
542
+
543
+ async commitOutcomes(
544
+ query: CommitOutcomeQuery = {},
545
+ ): Promise<readonly CommitOutcome[]> {
546
+ const result = (await this.#command('commitOutcomes', { query })) as {
547
+ outcomes: CommitOutcome[];
548
+ };
549
+ return result.outcomes;
550
+ }
551
+
552
+ async resolveCommitOutcome(
553
+ input: ResolveCommitOutcomeInput,
554
+ ): Promise<CommitOutcome> {
555
+ const result = (await this.#command('resolveCommitOutcome', {
556
+ input,
557
+ })) as { outcome: CommitOutcome };
558
+ return result.outcome;
559
+ }
560
+
531
561
  async schemaFloor(): Promise<SchemaFloor | undefined> {
532
562
  const result = (await this.#command('schemaFloor', {})) as {
533
563
  floor?: SchemaFloor;
@@ -659,6 +689,7 @@ function decodeChangeBatch(value: unknown): ClientChangeBatch | undefined {
659
689
  : {}),
660
690
  conflictsChanged: raw.conflictsChanged === true,
661
691
  rejectionsChanged: raw.rejectionsChanged === true,
692
+ outcomesChanged: raw.outcomesChanged === true,
662
693
  };
663
694
  }
664
695