@syncular/react 0.68.0 → 0.70.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/dist/client.d.ts +3 -1
- package/dist/runtime-version.d.ts +1 -1
- package/dist/runtime-version.js +1 -1
- package/dist/use-mutation.d.ts +3 -1
- package/dist/use-mutation.js +1 -1
- package/package.json +4 -4
- package/src/client.ts +4 -1
- package/src/runtime-version.ts +1 -1
- package/src/use-mutation.ts +8 -3
package/dist/client.d.ts
CHANGED
|
@@ -15,7 +15,9 @@ export interface SyncClientLike extends ClientSnapshotReader {
|
|
|
15
15
|
/** Key-bearing activation remains available on each concrete host type. */
|
|
16
16
|
activateSecurity(): void | Promise<void>;
|
|
17
17
|
query(sql: string, params?: readonly SqlValue[]): SqlRow[] | Promise<SqlRow[]>;
|
|
18
|
-
mutate(mutations: readonly MutationInput[]
|
|
18
|
+
mutate(mutations: readonly MutationInput[], options?: {
|
|
19
|
+
readonly clientCommitId?: string;
|
|
20
|
+
}): string | Promise<string>;
|
|
19
21
|
patch(table: string, rowId: string, partial: Readonly<Record<string, unknown>>, options?: {
|
|
20
22
|
readonly baseVersion?: number;
|
|
21
23
|
}): string | Promise<string>;
|
|
@@ -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.70.0";
|
package/dist/runtime-version.js
CHANGED
package/dist/use-mutation.d.ts
CHANGED
|
@@ -14,7 +14,9 @@ export interface UseMutationOptions {
|
|
|
14
14
|
readonly onError?: (error: Error) => void;
|
|
15
15
|
}
|
|
16
16
|
export interface UseMutationResult {
|
|
17
|
-
mutate: (mutations: readonly MutationInput[]
|
|
17
|
+
mutate: (mutations: readonly MutationInput[], options?: {
|
|
18
|
+
readonly clientCommitId?: string;
|
|
19
|
+
}) => Promise<string>;
|
|
18
20
|
readonly pendingCount: number;
|
|
19
21
|
/** True while at least one local enqueue is unresolved. */
|
|
20
22
|
readonly isPending: boolean;
|
package/dist/use-mutation.js
CHANGED
|
@@ -31,7 +31,7 @@ export function useMutation(tableOrOptions, maybeOptions) {
|
|
|
31
31
|
setPendingCount((count) => Math.max(0, count - 1));
|
|
32
32
|
}
|
|
33
33
|
}, []);
|
|
34
|
-
const mutate = useCallback((mutations) => run(() => client.mutate(mutations)), [client, run]);
|
|
34
|
+
const mutate = useCallback((mutations, options) => run(() => client.mutate(mutations, options)), [client, run]);
|
|
35
35
|
const base = {
|
|
36
36
|
mutate,
|
|
37
37
|
pendingCount,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncular/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.70.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.70.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.70.0",
|
|
66
|
+
"@syncular/server": "0.70.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
|
@@ -42,7 +42,10 @@ export interface SyncClientLike extends ClientSnapshotReader {
|
|
|
42
42
|
sql: string,
|
|
43
43
|
params?: readonly SqlValue[],
|
|
44
44
|
): SqlRow[] | Promise<SqlRow[]>;
|
|
45
|
-
mutate(
|
|
45
|
+
mutate(
|
|
46
|
+
mutations: readonly MutationInput[],
|
|
47
|
+
options?: { readonly clientCommitId?: string },
|
|
48
|
+
): string | Promise<string>;
|
|
46
49
|
patch(
|
|
47
50
|
table: string,
|
|
48
51
|
rowId: string,
|
package/src/runtime-version.ts
CHANGED
package/src/use-mutation.ts
CHANGED
|
@@ -19,7 +19,10 @@ export interface UseMutationOptions {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export interface UseMutationResult {
|
|
22
|
-
mutate: (
|
|
22
|
+
mutate: (
|
|
23
|
+
mutations: readonly MutationInput[],
|
|
24
|
+
options?: { readonly clientCommitId?: string },
|
|
25
|
+
) => Promise<string>;
|
|
23
26
|
readonly pendingCount: number;
|
|
24
27
|
/** True while at least one local enqueue is unresolved. */
|
|
25
28
|
readonly isPending: boolean;
|
|
@@ -88,8 +91,10 @@ export function useMutation<Row, Insert, Update, Id>(
|
|
|
88
91
|
[],
|
|
89
92
|
);
|
|
90
93
|
const mutate = useCallback(
|
|
91
|
-
(
|
|
92
|
-
|
|
94
|
+
(
|
|
95
|
+
mutations: readonly MutationInput[],
|
|
96
|
+
options?: { readonly clientCommitId?: string },
|
|
97
|
+
) => run(() => client.mutate(mutations, options)),
|
|
93
98
|
[client, run],
|
|
94
99
|
);
|
|
95
100
|
const base: UseMutationResult = {
|