@syncular/react 0.51.0 → 0.53.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
@@ -255,8 +255,8 @@ not need a custom retention effect.
255
255
  - `useConflicts()` observes conflicts and rejections only when that domain
256
256
  changes.
257
257
  - `useCommitOutcomes()` observes the durable newest-first final-outcome journal
258
- from exact `outcomesChanged` batches. Resolve entries through
259
- `useSyncClient().resolveCommitOutcome(...)`.
258
+ from exact `outcomesChanged` batches. Resolve entries through the client
259
+ returned by `useSyncClient()`.
260
260
  - `usePresence(scopeKey)` observes ephemeral realtime peers.
261
261
  - `useSyncClient()` and `useReactiveStore()` expose the normalized low-level
262
262
  surfaces for integrations. When the concrete client was passed through
@@ -351,6 +351,11 @@ come from that snapshot. Direct `conflicts`, `rejections`, and
351
351
  removed; custom adapters must implement the canonical snapshot methods.
352
352
  See the [client migration](https://syncular.dev/platform-web-reads-writes/#reading-local-state).
353
353
 
354
+ Read the client with `useSyncClient()` at the top of a component, then call
355
+ `client.proveCurrentBase(outcome)` from a recovery handler. Every client host
356
+ exposes the same retained-base proof. Custom `SyncClientLike` implementations
357
+ provide the method and its typed result.
358
+
354
359
  ## Live sync progress
355
360
 
356
361
  `useSyncProgress(client)` subscribes to a direct, worker, Tauri, or React Native
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** The provider uses the supplied client identity and canonical snapshot methods. */
2
- import type { ClientSnapshotReader, SyncProgress, SyncProgressListener, ClientChangeListener, ClientDiagnosticsListener, InvalidationListener, LeadershipState, LocalDataPurgeInput, LocalDataPurgeResult, LocalDataRebootstrapInput, LocalDataRebootstrapResult, MutationInput, PresencePeer, QueryReadSpec, QuerySnapshot, SecurityLifecycle, SqlRow, SqlValue, WindowBase, WindowState } from '@syncular/client';
2
+ import type { ClientSnapshotReader, SyncProgress, SyncProgressListener, ClientChangeListener, ClientDiagnosticsListener, CommitOutcome, CurrentBaseProof, InvalidationListener, LeadershipState, LocalDataPurgeInput, LocalDataPurgeResult, LocalDataRebootstrapInput, LocalDataRebootstrapResult, MutationInput, PresencePeer, QueryReadSpec, QuerySnapshot, SecurityLifecycle, SqlRow, SqlValue, WindowBase, WindowState } from '@syncular/client';
3
3
  export interface SyncClientLike extends ClientSnapshotReader {
4
4
  readonly currentSchemaVersion?: number;
5
5
  onProgress(listener: SyncProgressListener): () => void;
@@ -23,6 +23,7 @@ export interface SyncClientLike extends ClientSnapshotReader {
23
23
  rebootstrapLocalData(input: LocalDataRebootstrapInput): LocalDataRebootstrapResult | Promise<LocalDataRebootstrapResult>;
24
24
  querySnapshot<Row = SqlRow>(spec: QueryReadSpec): QuerySnapshot<Row> | Promise<QuerySnapshot<Row>>;
25
25
  pendingCommits: () => unknown[] | Promise<unknown[]>;
26
+ proveCurrentBase(outcome: Pick<CommitOutcome, 'clientCommitId' | 'sequence'>, maxRounds?: number): CurrentBaseProof | Promise<CurrentBaseProof>;
26
27
  presence(scopeKey: string): readonly PresencePeer[] | Promise<readonly PresencePeer[]>;
27
28
  setPresence(scopeKey: string, doc: Record<string, unknown> | null): void | Promise<void>;
28
29
  /** §4.8 windowed subscriptions: set the live units for a window base. */
@@ -3,4 +3,4 @@
3
3
  * Vite HMR uses it to replace a worker owner after a Syncular package upgrade
4
4
  * even when the application's generated schema version did not change.
5
5
  */
6
- export declare const SYNCULAR_REACT_RUNTIME_VERSION = "0.51.0";
6
+ export declare const SYNCULAR_REACT_RUNTIME_VERSION = "0.53.0";
@@ -3,4 +3,4 @@
3
3
  * Vite HMR uses it to replace a worker owner after a Syncular package upgrade
4
4
  * even when the application's generated schema version did not change.
5
5
  */
6
- export const SYNCULAR_REACT_RUNTIME_VERSION = '0.51.0';
6
+ export const SYNCULAR_REACT_RUNTIME_VERSION = '0.53.0';
@@ -3,4 +3,4 @@
3
3
  * Vite's dependency optimizer prevents a live worker from referring to a
4
4
  * retired hashed optimizer chunk after a package upgrade.
5
5
  */
6
- export declare const SYNCULAR_VITE_OPTIMIZE_DEPS_EXCLUDE: readonly ["@syncular/client", "@syncular/client/worker", "@syncular/core", "@syncular/crypto", "@syncular/react"];
6
+ export declare const SYNCULAR_VITE_OPTIMIZE_DEPS_EXCLUDE: readonly ['@syncular/client', '@syncular/client/worker', '@syncular/core', '@syncular/crypto', '@syncular/react'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncular/react",
3
- "version": "0.51.0",
3
+ "version": "0.53.0",
4
4
  "description": "React hooks for Syncular offline-first sync",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Benjamin Kniffler",
@@ -55,15 +55,15 @@
55
55
  "test": "bun test --preload ./test/setup.ts"
56
56
  },
57
57
  "dependencies": {
58
- "@syncular/client": "0.51.0"
58
+ "@syncular/client": "0.53.0"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "react": ">=18.0.0"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@happy-dom/global-registrator": "^20.0.0",
65
- "@syncular/core": "0.51.0",
66
- "@syncular/server": "0.51.0",
65
+ "@syncular/core": "0.53.0",
66
+ "@syncular/server": "0.53.0",
67
67
  "@testing-library/react": "^16.1.0",
68
68
  "@types/react": "^18.3.0",
69
69
  "@types/react-dom": "^18.3.0",
package/src/client.ts CHANGED
@@ -5,6 +5,8 @@ import type {
5
5
  SyncProgressListener,
6
6
  ClientChangeListener,
7
7
  ClientDiagnosticsListener,
8
+ CommitOutcome,
9
+ CurrentBaseProof,
8
10
  InvalidationListener,
9
11
  LeadershipState,
10
12
  LocalDataPurgeInput,
@@ -57,6 +59,10 @@ export interface SyncClientLike extends ClientSnapshotReader {
57
59
  spec: QueryReadSpec,
58
60
  ): QuerySnapshot<Row> | Promise<QuerySnapshot<Row>>;
59
61
  pendingCommits: () => unknown[] | Promise<unknown[]>;
62
+ proveCurrentBase(
63
+ outcome: Pick<CommitOutcome, 'clientCommitId' | 'sequence'>,
64
+ maxRounds?: number,
65
+ ): CurrentBaseProof | Promise<CurrentBaseProof>;
60
66
  presence(
61
67
  scopeKey: string,
62
68
  ): readonly PresencePeer[] | Promise<readonly PresencePeer[]>;
@@ -3,4 +3,4 @@
3
3
  * Vite HMR uses it to replace a worker owner after a Syncular package upgrade
4
4
  * even when the application's generated schema version did not change.
5
5
  */
6
- export const SYNCULAR_REACT_RUNTIME_VERSION = '0.51.0';
6
+ export const SYNCULAR_REACT_RUNTIME_VERSION = '0.53.0';