@syncular/react 0.79.3 → 0.81.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 +1 -0
- package/dist/client.d.ts +2 -0
- package/dist/runtime-version.d.ts +1 -1
- package/dist/runtime-version.js +1 -1
- package/dist/use-raw-sql.d.ts +2 -0
- package/dist/use-raw-sql.js +3 -0
- package/package.json +4 -4
- package/src/client.ts +2 -0
- package/src/runtime-version.ts +1 -1
- package/src/use-raw-sql.ts +5 -0
package/README.md
CHANGED
|
@@ -219,6 +219,7 @@ Options:
|
|
|
219
219
|
| `coverage` | Required window units read atomically with the rows. |
|
|
220
220
|
| `rowKey` | Stable identity fields used to retain unchanged row objects. |
|
|
221
221
|
| `claimCoverage` | Claim declared coverage while observed; default `true`. |
|
|
222
|
+
| `publishFirstAnswer` | Re-render for the revision of an empty answer with pending coverage; default `false`. |
|
|
222
223
|
| `enabled` | Disable observation and reads while `false`. |
|
|
223
224
|
| `id` | Stable cache identity for a raw query. |
|
|
224
225
|
| `tables`, `scopeKeys` | Compatibility shorthand; prefer `dependencies`. |
|
package/dist/client.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface SyncClientLike extends ClientSnapshotReader {
|
|
|
8
8
|
onDiagnostics(listener: ClientDiagnosticsListener): () => void;
|
|
9
9
|
onInvalidate(listener: InvalidationListener): () => void;
|
|
10
10
|
onPresence(listener: (scopeKey: string) => void): () => void;
|
|
11
|
+
/** §8.7: the server announced that the actor gained scopes. */
|
|
12
|
+
onScopesChanged(listener: () => void): () => void;
|
|
11
13
|
onLeadershipChange?(listener: (state: LeadershipState) => void): () => void;
|
|
12
14
|
leadershipSnapshot?(): LeadershipState | undefined;
|
|
13
15
|
securityLifecycle(): SecurityLifecycle | Promise<SecurityLifecycle>;
|
|
@@ -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.
|
|
6
|
+
export declare const SYNCULAR_REACT_RUNTIME_VERSION = "0.81.0";
|
package/dist/runtime-version.js
CHANGED
package/dist/use-raw-sql.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export interface UseRawSqlOptions<Row = SqlRow> {
|
|
|
11
11
|
readonly rowKey?: (row: Row) => readonly SqlValue[];
|
|
12
12
|
/** Generated coverage claims its windows by default. */
|
|
13
13
|
readonly claimCoverage?: boolean;
|
|
14
|
+
/** Re-render for the revision of an empty first answer; off by default. */
|
|
15
|
+
readonly publishFirstAnswer?: boolean;
|
|
14
16
|
readonly enabled?: boolean;
|
|
15
17
|
/**
|
|
16
18
|
* Stable, PHI-free query id. It names the query in
|
package/dist/use-raw-sql.js
CHANGED
|
@@ -25,12 +25,14 @@ export function useRawSql(sql, params, options) {
|
|
|
25
25
|
}
|
|
26
26
|
const coverage = options?.coverage ?? [];
|
|
27
27
|
const claimCoverage = options?.claimCoverage ?? true;
|
|
28
|
+
const publishFirstAnswer = options?.publishFirstAnswer === true;
|
|
28
29
|
const identity = canonicalValue({
|
|
29
30
|
sql,
|
|
30
31
|
params: params ?? [],
|
|
31
32
|
dependencies,
|
|
32
33
|
coverage,
|
|
33
34
|
claimCoverage,
|
|
35
|
+
publishFirstAnswer,
|
|
34
36
|
...(options?.id !== undefined ? { id: options.id } : {}),
|
|
35
37
|
});
|
|
36
38
|
// `identity` canonically contains every value-shaped input. Depending on
|
|
@@ -48,6 +50,7 @@ export function useRawSql(sql, params, options) {
|
|
|
48
50
|
...(options?.mapRow !== undefined ? { mapRow: options.mapRow } : {}),
|
|
49
51
|
...(options?.rowKey !== undefined ? { rowKey: options.rowKey } : {}),
|
|
50
52
|
claimCoverage,
|
|
53
|
+
publishFirstAnswer,
|
|
51
54
|
}), [store, identity, options?.mapRow, options?.rowKey]);
|
|
52
55
|
// oxlint-enable react-hooks/exhaustive-deps
|
|
53
56
|
const snapshot = useSyncExternalStore(enabled ? entry.subscribe : noSubscribe, enabled ? entry.getSnapshot : () => DISABLED, enabled ? entry.getSnapshot : () => DISABLED);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncular/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.81.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.
|
|
58
|
+
"@syncular/client": "0.81.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.
|
|
66
|
-
"@syncular/server": "0.
|
|
65
|
+
"@syncular/core": "0.81.0",
|
|
66
|
+
"@syncular/server": "0.81.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
|
@@ -32,6 +32,8 @@ export interface SyncClientLike extends ClientSnapshotReader {
|
|
|
32
32
|
onDiagnostics(listener: ClientDiagnosticsListener): () => void;
|
|
33
33
|
onInvalidate(listener: InvalidationListener): () => void;
|
|
34
34
|
onPresence(listener: (scopeKey: string) => void): () => void;
|
|
35
|
+
/** §8.7: the server announced that the actor gained scopes. */
|
|
36
|
+
onScopesChanged(listener: () => void): () => void;
|
|
35
37
|
onLeadershipChange?(listener: (state: LeadershipState) => void): () => void;
|
|
36
38
|
leadershipSnapshot?(): LeadershipState | undefined;
|
|
37
39
|
securityLifecycle(): SecurityLifecycle | Promise<SecurityLifecycle>;
|
package/src/runtime-version.ts
CHANGED
package/src/use-raw-sql.ts
CHANGED
|
@@ -24,6 +24,8 @@ export interface UseRawSqlOptions<Row = SqlRow> {
|
|
|
24
24
|
readonly rowKey?: (row: Row) => readonly SqlValue[];
|
|
25
25
|
/** Generated coverage claims its windows by default. */
|
|
26
26
|
readonly claimCoverage?: boolean;
|
|
27
|
+
/** Re-render for the revision of an empty first answer; off by default. */
|
|
28
|
+
readonly publishFirstAnswer?: boolean;
|
|
27
29
|
readonly enabled?: boolean;
|
|
28
30
|
/**
|
|
29
31
|
* Stable, PHI-free query id. It names the query in
|
|
@@ -79,12 +81,14 @@ export function useRawSql<Row = SqlRow>(
|
|
|
79
81
|
}
|
|
80
82
|
const coverage = options?.coverage ?? [];
|
|
81
83
|
const claimCoverage = options?.claimCoverage ?? true;
|
|
84
|
+
const publishFirstAnswer = options?.publishFirstAnswer === true;
|
|
82
85
|
const identity = canonicalValue({
|
|
83
86
|
sql,
|
|
84
87
|
params: params ?? [],
|
|
85
88
|
dependencies,
|
|
86
89
|
coverage,
|
|
87
90
|
claimCoverage,
|
|
91
|
+
publishFirstAnswer,
|
|
88
92
|
...(options?.id !== undefined ? { id: options.id } : {}),
|
|
89
93
|
});
|
|
90
94
|
// `identity` canonically contains every value-shaped input. Depending on
|
|
@@ -104,6 +108,7 @@ export function useRawSql<Row = SqlRow>(
|
|
|
104
108
|
...(options?.mapRow !== undefined ? { mapRow: options.mapRow } : {}),
|
|
105
109
|
...(options?.rowKey !== undefined ? { rowKey: options.rowKey } : {}),
|
|
106
110
|
claimCoverage,
|
|
111
|
+
publishFirstAnswer,
|
|
107
112
|
}),
|
|
108
113
|
[store, identity, options?.mapRow, options?.rowKey],
|
|
109
114
|
);
|