@syncular/react 0.15.37 → 0.15.38
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 -1
- package/dist/client.js +16 -1
- package/dist/runtime-version.d.ts +1 -1
- package/dist/runtime-version.js +1 -1
- package/package.json +4 -4
- package/src/client.ts +4 -1
- package/src/runtime-version.ts +1 -1
package/README.md
CHANGED
|
@@ -252,7 +252,11 @@ not need a custom retention effect.
|
|
|
252
252
|
`useSyncClient().resolveCommitOutcome(...)`.
|
|
253
253
|
- `usePresence(scopeKey)` observes ephemeral realtime peers.
|
|
254
254
|
- `useSyncClient()` and `useReactiveStore()` expose the normalized low-level
|
|
255
|
-
surfaces for integrations.
|
|
255
|
+
surfaces for integrations. When the concrete client was passed through
|
|
256
|
+
`installRealtimeSupervisor()` before mounting `SyncProvider`, its normalized
|
|
257
|
+
`useSyncClient()` facade preserves supervisor observation: pass it directly
|
|
258
|
+
to `realtimeSupervisorSnapshot()` and `subscribeRealtimeSupervisor()`.
|
|
259
|
+
Transport ownership and disposal remain on the concrete client/resource.
|
|
256
260
|
|
|
257
261
|
The hooks are SSR-safe: no local query runs during server rendering.
|
|
258
262
|
|
package/dist/client.js
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE client interface the React bindings target. Both the direct
|
|
3
|
+
* `SyncClient` (constructed on the current thread) and the worker-mode
|
|
4
|
+
* `SyncClientHandle` (a promise proxy over the OPFS worker) satisfy it —
|
|
5
|
+
* their public surfaces diverge (getters vs methods, sync vs promise), so
|
|
6
|
+
* this module normalizes both into a single async-friendly facade the hooks
|
|
7
|
+
* consume. That is the "one interface across direct and worker-handle modes"
|
|
8
|
+
* the invalidation seam (TODO 3.1) was standardized to enable.
|
|
9
|
+
*
|
|
10
|
+
* The normalizer resolves each accessor at call time (function → call it,
|
|
11
|
+
* value → read it) and wraps every result in `Promise.resolve`, so a hook
|
|
12
|
+
* never has to care which core it holds.
|
|
13
|
+
*/
|
|
14
|
+
import { linkRealtimeSupervisorObservation } from '@syncular/client';
|
|
1
15
|
/**
|
|
2
16
|
* Read a member by key that is EITHER a value getter (SyncClient) or a
|
|
3
17
|
* method returning a value/promise (SyncClientHandle). Read from the client
|
|
@@ -11,7 +25,7 @@ function resolveMember(client, key) {
|
|
|
11
25
|
return Promise.resolve(value);
|
|
12
26
|
}
|
|
13
27
|
export function normalizeClient(client) {
|
|
14
|
-
|
|
28
|
+
const normalized = {
|
|
15
29
|
...(client.currentSchemaVersion !== undefined
|
|
16
30
|
? { currentSchemaVersion: client.currentSchemaVersion }
|
|
17
31
|
: {}),
|
|
@@ -47,4 +61,5 @@ export function normalizeClient(client) {
|
|
|
47
61
|
setWindow: (base, units) => Promise.resolve(client.setWindow(base, units)),
|
|
48
62
|
windowState: (base) => Promise.resolve(client.windowState(base)),
|
|
49
63
|
};
|
|
64
|
+
return linkRealtimeSupervisorObservation(normalized, client);
|
|
50
65
|
}
|
|
@@ -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.15.
|
|
6
|
+
export declare const SYNCULAR_REACT_RUNTIME_VERSION = "0.15.38";
|
package/dist/runtime-version.js
CHANGED
|
@@ -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.15.
|
|
6
|
+
export const SYNCULAR_REACT_RUNTIME_VERSION = '0.15.38';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncular/react",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.38",
|
|
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.15.
|
|
58
|
+
"@syncular/client": "0.15.38"
|
|
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.15.
|
|
66
|
-
"@syncular/server": "0.15.
|
|
65
|
+
"@syncular/core": "0.15.38",
|
|
66
|
+
"@syncular/server": "0.15.38",
|
|
67
67
|
"@testing-library/react": "^16.1.0",
|
|
68
68
|
"@types/react": "^18.3.0",
|
|
69
69
|
"react": "^18.3.1",
|
package/src/client.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* value → read it) and wraps every result in `Promise.resolve`, so a hook
|
|
12
12
|
* never has to care which core it holds.
|
|
13
13
|
*/
|
|
14
|
+
|
|
14
15
|
import type {
|
|
15
16
|
ClientChangeListener,
|
|
16
17
|
ClientDiagnosticsListener,
|
|
@@ -40,6 +41,7 @@ import type {
|
|
|
40
41
|
WindowBase,
|
|
41
42
|
WindowState,
|
|
42
43
|
} from '@syncular/client';
|
|
44
|
+
import { linkRealtimeSupervisorObservation } from '@syncular/client';
|
|
43
45
|
|
|
44
46
|
/**
|
|
45
47
|
* The structural union of `SyncClient` and `SyncClientHandle`. Members that
|
|
@@ -193,7 +195,7 @@ export interface NormalizedClient {
|
|
|
193
195
|
}
|
|
194
196
|
|
|
195
197
|
export function normalizeClient(client: SyncClientLike): NormalizedClient {
|
|
196
|
-
|
|
198
|
+
const normalized: NormalizedClient = {
|
|
197
199
|
...(client.currentSchemaVersion !== undefined
|
|
198
200
|
? { currentSchemaVersion: client.currentSchemaVersion }
|
|
199
201
|
: {}),
|
|
@@ -237,4 +239,5 @@ export function normalizeClient(client: SyncClientLike): NormalizedClient {
|
|
|
237
239
|
setWindow: (base, units) => Promise.resolve(client.setWindow(base, units)),
|
|
238
240
|
windowState: (base) => Promise.resolve(client.windowState(base)),
|
|
239
241
|
};
|
|
242
|
+
return linkRealtimeSupervisorObservation(normalized, client);
|
|
240
243
|
}
|
package/src/runtime-version.ts
CHANGED
|
@@ -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.15.
|
|
6
|
+
export const SYNCULAR_REACT_RUNTIME_VERSION = '0.15.38';
|