@comapeo/core-react 3.2.0 → 3.3.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/commonjs/hooks/client.d.ts +14 -0
- package/dist/commonjs/hooks/client.js +6 -6
- package/dist/commonjs/hooks/documents.d.ts +32 -0
- package/dist/commonjs/hooks/documents.js +9 -9
- package/dist/commonjs/hooks/invites.d.ts +30 -0
- package/dist/commonjs/hooks/invites.js +12 -12
- package/dist/commonjs/hooks/projects.d.ts +68 -0
- package/dist/commonjs/hooks/projects.js +24 -24
- package/dist/esm/hooks/client.d.ts +14 -0
- package/dist/esm/hooks/client.js +6 -6
- package/dist/esm/hooks/documents.d.ts +32 -0
- package/dist/esm/hooks/documents.js +9 -9
- package/dist/esm/hooks/invites.d.ts +30 -0
- package/dist/esm/hooks/invites.js +12 -12
- package/dist/esm/hooks/projects.d.ts +68 -0
- package/dist/esm/hooks/projects.js +24 -24
- package/package.json +2 -1
|
@@ -66,6 +66,10 @@ export declare function useSetOwnDeviceInfo(): {
|
|
|
66
66
|
name: string;
|
|
67
67
|
deviceType: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).DeviceInfo["deviceType"];
|
|
68
68
|
}, unknown>;
|
|
69
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
70
|
+
name: string;
|
|
71
|
+
deviceType: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).DeviceInfo["deviceType"];
|
|
72
|
+
}, unknown>;
|
|
69
73
|
reset: () => void;
|
|
70
74
|
status: "error";
|
|
71
75
|
} | {
|
|
@@ -74,6 +78,10 @@ export declare function useSetOwnDeviceInfo(): {
|
|
|
74
78
|
name: string;
|
|
75
79
|
deviceType: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).DeviceInfo["deviceType"];
|
|
76
80
|
}, unknown>;
|
|
81
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
82
|
+
name: string;
|
|
83
|
+
deviceType: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).DeviceInfo["deviceType"];
|
|
84
|
+
}, unknown>;
|
|
77
85
|
reset: () => void;
|
|
78
86
|
status: "pending" | "success" | "idle";
|
|
79
87
|
};
|
|
@@ -85,6 +93,9 @@ export declare function useSetIsArchiveDevice(): {
|
|
|
85
93
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
86
94
|
isArchiveDevice: boolean;
|
|
87
95
|
}, unknown>;
|
|
96
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
97
|
+
isArchiveDevice: boolean;
|
|
98
|
+
}, unknown>;
|
|
88
99
|
reset: () => void;
|
|
89
100
|
status: "error";
|
|
90
101
|
} | {
|
|
@@ -92,6 +103,9 @@ export declare function useSetIsArchiveDevice(): {
|
|
|
92
103
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
93
104
|
isArchiveDevice: boolean;
|
|
94
105
|
}, unknown>;
|
|
106
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
107
|
+
isArchiveDevice: boolean;
|
|
108
|
+
}, unknown>;
|
|
95
109
|
reset: () => void;
|
|
96
110
|
status: "pending" | "success" | "idle";
|
|
97
111
|
};
|
|
@@ -77,10 +77,10 @@ function useIsArchiveDevice() {
|
|
|
77
77
|
function useSetOwnDeviceInfo() {
|
|
78
78
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
79
79
|
const clientApi = useClientApi();
|
|
80
|
-
const { error, mutate, reset, status } = (0, react_query_1.useMutation)((0, client_js_1.setOwnDeviceInfoMutationOptions)({ clientApi, queryClient }));
|
|
80
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, client_js_1.setOwnDeviceInfoMutationOptions)({ clientApi, queryClient }));
|
|
81
81
|
return status === 'error'
|
|
82
|
-
? { error, mutate, reset, status }
|
|
83
|
-
: { error: null, mutate, reset, status };
|
|
82
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
83
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
86
|
* Set or unset the current device as an archive device.
|
|
@@ -88,8 +88,8 @@ function useSetOwnDeviceInfo() {
|
|
|
88
88
|
function useSetIsArchiveDevice() {
|
|
89
89
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
90
90
|
const clientApi = useClientApi();
|
|
91
|
-
const { error, mutate, status, reset } = (0, react_query_1.useMutation)((0, client_js_1.setIsArchiveDeviceMutationOptions)({ clientApi, queryClient }));
|
|
91
|
+
const { error, mutate, mutateAsync, status, reset } = (0, react_query_1.useMutation)((0, client_js_1.setIsArchiveDeviceMutationOptions)({ clientApi, queryClient }));
|
|
92
92
|
return status === 'error'
|
|
93
|
-
? { error, mutate, reset, status }
|
|
94
|
-
: { error: null, mutate, reset, status };
|
|
93
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
94
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
95
95
|
}
|
|
@@ -125,6 +125,11 @@ export declare function useCreateDocument<D extends WriteableDocumentType>({ doc
|
|
|
125
125
|
}, Error, {
|
|
126
126
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
127
127
|
}, unknown>;
|
|
128
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
129
|
+
forks: Array<string>;
|
|
130
|
+
}, Error, {
|
|
131
|
+
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
132
|
+
}, unknown>;
|
|
128
133
|
reset: () => void;
|
|
129
134
|
status: "error";
|
|
130
135
|
} | {
|
|
@@ -134,6 +139,11 @@ export declare function useCreateDocument<D extends WriteableDocumentType>({ doc
|
|
|
134
139
|
}, Error, {
|
|
135
140
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
136
141
|
}, unknown>;
|
|
142
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
143
|
+
forks: Array<string>;
|
|
144
|
+
}, Error, {
|
|
145
|
+
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
146
|
+
}, unknown>;
|
|
137
147
|
reset: () => void;
|
|
138
148
|
status: "pending" | "success" | "idle";
|
|
139
149
|
};
|
|
@@ -154,6 +164,12 @@ export declare function useUpdateDocument<D extends WriteableDocumentType>({ doc
|
|
|
154
164
|
versionId: string;
|
|
155
165
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
156
166
|
}, unknown>;
|
|
167
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
168
|
+
forks: Array<string>;
|
|
169
|
+
}, Error, {
|
|
170
|
+
versionId: string;
|
|
171
|
+
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
172
|
+
}, unknown>;
|
|
157
173
|
reset: () => void;
|
|
158
174
|
status: "error";
|
|
159
175
|
} | {
|
|
@@ -164,6 +180,12 @@ export declare function useUpdateDocument<D extends WriteableDocumentType>({ doc
|
|
|
164
180
|
versionId: string;
|
|
165
181
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
166
182
|
}, unknown>;
|
|
183
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
184
|
+
forks: Array<string>;
|
|
185
|
+
}, Error, {
|
|
186
|
+
versionId: string;
|
|
187
|
+
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
188
|
+
}, unknown>;
|
|
167
189
|
reset: () => void;
|
|
168
190
|
status: "pending" | "success" | "idle";
|
|
169
191
|
};
|
|
@@ -183,6 +205,11 @@ export declare function useDeleteDocument<D extends WriteableDocumentType>({ doc
|
|
|
183
205
|
}, Error, {
|
|
184
206
|
docId: string;
|
|
185
207
|
}, unknown>;
|
|
208
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
209
|
+
forks: Array<string>;
|
|
210
|
+
}, Error, {
|
|
211
|
+
docId: string;
|
|
212
|
+
}, unknown>;
|
|
186
213
|
reset: () => void;
|
|
187
214
|
status: "error";
|
|
188
215
|
} | {
|
|
@@ -192,6 +219,11 @@ export declare function useDeleteDocument<D extends WriteableDocumentType>({ doc
|
|
|
192
219
|
}, Error, {
|
|
193
220
|
docId: string;
|
|
194
221
|
}, unknown>;
|
|
222
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
223
|
+
forks: Array<string>;
|
|
224
|
+
}, Error, {
|
|
225
|
+
docId: string;
|
|
226
|
+
}, unknown>;
|
|
195
227
|
reset: () => void;
|
|
196
228
|
status: "pending" | "success" | "idle";
|
|
197
229
|
};
|
|
@@ -148,15 +148,15 @@ function useManyDocs({ projectId, docType, includeDeleted, lang, }) {
|
|
|
148
148
|
function useCreateDocument({ docType, projectId, }) {
|
|
149
149
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
150
150
|
const { data: projectApi } = (0, projects_js_1.useSingleProject)({ projectId });
|
|
151
|
-
const { error, mutate, reset, status } = (0, react_query_1.useMutation)((0, documents_js_1.createDocumentMutationOptions)({
|
|
151
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, documents_js_1.createDocumentMutationOptions)({
|
|
152
152
|
docType,
|
|
153
153
|
projectApi,
|
|
154
154
|
projectId,
|
|
155
155
|
queryClient,
|
|
156
156
|
}));
|
|
157
157
|
return status === 'error'
|
|
158
|
-
? { error, mutate, reset, status }
|
|
159
|
-
: { error: null, mutate, reset, status };
|
|
158
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
159
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
162
|
* Update a document within a project.
|
|
@@ -167,15 +167,15 @@ function useCreateDocument({ docType, projectId, }) {
|
|
|
167
167
|
function useUpdateDocument({ docType, projectId, }) {
|
|
168
168
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
169
169
|
const { data: projectApi } = (0, projects_js_1.useSingleProject)({ projectId });
|
|
170
|
-
const { error, mutate, reset, status } = (0, react_query_1.useMutation)((0, documents_js_1.updateDocumentMutationOptions)({
|
|
170
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, documents_js_1.updateDocumentMutationOptions)({
|
|
171
171
|
docType,
|
|
172
172
|
projectApi,
|
|
173
173
|
projectId,
|
|
174
174
|
queryClient,
|
|
175
175
|
}));
|
|
176
176
|
return status === 'error'
|
|
177
|
-
? { error, mutate, reset, status }
|
|
178
|
-
: { error: null, mutate, reset, status };
|
|
177
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
178
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* Delete a document within a project.
|
|
@@ -186,13 +186,13 @@ function useUpdateDocument({ docType, projectId, }) {
|
|
|
186
186
|
function useDeleteDocument({ docType, projectId, }) {
|
|
187
187
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
188
188
|
const { data: projectApi } = (0, projects_js_1.useSingleProject)({ projectId });
|
|
189
|
-
const { error, mutate, reset, status } = (0, react_query_1.useMutation)((0, documents_js_1.deleteDocumentMutationOptions)({
|
|
189
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, documents_js_1.deleteDocumentMutationOptions)({
|
|
190
190
|
docType,
|
|
191
191
|
projectApi,
|
|
192
192
|
projectId,
|
|
193
193
|
queryClient,
|
|
194
194
|
}));
|
|
195
195
|
return status === 'error'
|
|
196
|
-
? { error, mutate, reset, status }
|
|
197
|
-
: { error: null, mutate, reset, status };
|
|
196
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
197
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
198
198
|
}
|
|
@@ -6,6 +6,9 @@ export declare function useAcceptInvite(): {
|
|
|
6
6
|
mutate: import("@tanstack/react-query").UseMutateFunction<string, Error, {
|
|
7
7
|
inviteId: string;
|
|
8
8
|
}, unknown>;
|
|
9
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<string, Error, {
|
|
10
|
+
inviteId: string;
|
|
11
|
+
}, unknown>;
|
|
9
12
|
reset: () => void;
|
|
10
13
|
status: "error";
|
|
11
14
|
} | {
|
|
@@ -13,6 +16,9 @@ export declare function useAcceptInvite(): {
|
|
|
13
16
|
mutate: import("@tanstack/react-query").UseMutateFunction<string, Error, {
|
|
14
17
|
inviteId: string;
|
|
15
18
|
}, unknown>;
|
|
19
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<string, Error, {
|
|
20
|
+
inviteId: string;
|
|
21
|
+
}, unknown>;
|
|
16
22
|
reset: () => void;
|
|
17
23
|
status: "pending" | "success" | "idle";
|
|
18
24
|
};
|
|
@@ -24,6 +30,9 @@ export declare function useRejectInvite(): {
|
|
|
24
30
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
25
31
|
inviteId: string;
|
|
26
32
|
}, unknown>;
|
|
33
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
34
|
+
inviteId: string;
|
|
35
|
+
}, unknown>;
|
|
27
36
|
reset: () => void;
|
|
28
37
|
status: "error";
|
|
29
38
|
} | {
|
|
@@ -31,6 +40,9 @@ export declare function useRejectInvite(): {
|
|
|
31
40
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
32
41
|
inviteId: string;
|
|
33
42
|
}, unknown>;
|
|
43
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
44
|
+
inviteId: string;
|
|
45
|
+
}, unknown>;
|
|
34
46
|
reset: () => void;
|
|
35
47
|
status: "pending" | "success" | "idle";
|
|
36
48
|
};
|
|
@@ -49,6 +61,12 @@ export declare function useSendInvite({ projectId }: {
|
|
|
49
61
|
roleId: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).RoleIdForNewInvite;
|
|
50
62
|
roleName?: string;
|
|
51
63
|
}, unknown>;
|
|
64
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<"ACCEPT" | "REJECT" | "ALREADY", Error, {
|
|
65
|
+
deviceId: string;
|
|
66
|
+
roleDescription?: string;
|
|
67
|
+
roleId: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).RoleIdForNewInvite;
|
|
68
|
+
roleName?: string;
|
|
69
|
+
}, unknown>;
|
|
52
70
|
reset: () => void;
|
|
53
71
|
status: "error";
|
|
54
72
|
} | {
|
|
@@ -59,6 +77,12 @@ export declare function useSendInvite({ projectId }: {
|
|
|
59
77
|
roleId: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).RoleIdForNewInvite;
|
|
60
78
|
roleName?: string;
|
|
61
79
|
}, unknown>;
|
|
80
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<"ACCEPT" | "REJECT" | "ALREADY", Error, {
|
|
81
|
+
deviceId: string;
|
|
82
|
+
roleDescription?: string;
|
|
83
|
+
roleId: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).RoleIdForNewInvite;
|
|
84
|
+
roleName?: string;
|
|
85
|
+
}, unknown>;
|
|
62
86
|
reset: () => void;
|
|
63
87
|
status: "pending" | "success" | "idle";
|
|
64
88
|
};
|
|
@@ -74,6 +98,9 @@ export declare function useRequestCancelInvite({ projectId }: {
|
|
|
74
98
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
75
99
|
deviceId: string;
|
|
76
100
|
}, unknown>;
|
|
101
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
102
|
+
deviceId: string;
|
|
103
|
+
}, unknown>;
|
|
77
104
|
reset: () => void;
|
|
78
105
|
status: "error";
|
|
79
106
|
} | {
|
|
@@ -81,6 +108,9 @@ export declare function useRequestCancelInvite({ projectId }: {
|
|
|
81
108
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
82
109
|
deviceId: string;
|
|
83
110
|
}, unknown>;
|
|
111
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
112
|
+
deviceId: string;
|
|
113
|
+
}, unknown>;
|
|
84
114
|
reset: () => void;
|
|
85
115
|
status: "pending" | "success" | "idle";
|
|
86
116
|
};
|
|
@@ -14,10 +14,10 @@ const projects_js_1 = require("./projects.js");
|
|
|
14
14
|
function useAcceptInvite() {
|
|
15
15
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
16
16
|
const clientApi = (0, client_js_1.useClientApi)();
|
|
17
|
-
const { error, mutate, reset, status } = (0, react_query_1.useMutation)((0, invites_js_1.acceptInviteMutationOptions)({ clientApi, queryClient }));
|
|
17
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, invites_js_1.acceptInviteMutationOptions)({ clientApi, queryClient }));
|
|
18
18
|
return status === 'error'
|
|
19
|
-
? { error, mutate, reset, status }
|
|
20
|
-
: { error: null, mutate, reset, status };
|
|
19
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
20
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Reject an invite that has been received.
|
|
@@ -25,10 +25,10 @@ function useAcceptInvite() {
|
|
|
25
25
|
function useRejectInvite() {
|
|
26
26
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
27
27
|
const clientApi = (0, client_js_1.useClientApi)();
|
|
28
|
-
const { error, mutate, reset, status } = (0, react_query_1.useMutation)((0, invites_js_1.rejectInviteMutationOptions)({ clientApi, queryClient }));
|
|
28
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, invites_js_1.rejectInviteMutationOptions)({ clientApi, queryClient }));
|
|
29
29
|
return status === 'error'
|
|
30
|
-
? { error, mutate, reset, status }
|
|
31
|
-
: { error: null, mutate, reset, status };
|
|
30
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
31
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Send an invite for a project.
|
|
@@ -38,10 +38,10 @@ function useRejectInvite() {
|
|
|
38
38
|
function useSendInvite({ projectId }) {
|
|
39
39
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
40
40
|
const { data: projectApi } = (0, projects_js_1.useSingleProject)({ projectId });
|
|
41
|
-
const { error, mutate, reset, status } = (0, react_query_1.useMutation)((0, invites_js_1.sendInviteMutationOptions)({ projectApi, projectId, queryClient }));
|
|
41
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, invites_js_1.sendInviteMutationOptions)({ projectApi, projectId, queryClient }));
|
|
42
42
|
return status === 'error'
|
|
43
|
-
? { error, mutate, reset, status }
|
|
44
|
-
: { error: null, mutate, reset, status };
|
|
43
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
44
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Request a cancellation of an invite sent to another device.
|
|
@@ -51,8 +51,8 @@ function useSendInvite({ projectId }) {
|
|
|
51
51
|
function useRequestCancelInvite({ projectId }) {
|
|
52
52
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
53
53
|
const { data: projectApi } = (0, projects_js_1.useSingleProject)({ projectId });
|
|
54
|
-
const { error, mutate, reset, status } = (0, react_query_1.useMutation)((0, invites_js_1.requestCancelInviteMutationOptions)({ projectApi, queryClient }));
|
|
54
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, invites_js_1.requestCancelInviteMutationOptions)({ projectApi, queryClient }));
|
|
55
55
|
return status === 'error'
|
|
56
|
-
? { error, mutate, reset, status }
|
|
57
|
-
: { error: null, mutate, reset, status };
|
|
56
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
57
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
58
58
|
}
|
|
@@ -280,6 +280,10 @@ export declare function useAddServerPeer({ projectId }: {
|
|
|
280
280
|
baseUrl: string;
|
|
281
281
|
dangerouslyAllowInsecureConnections?: boolean;
|
|
282
282
|
}, unknown>;
|
|
283
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
284
|
+
baseUrl: string;
|
|
285
|
+
dangerouslyAllowInsecureConnections?: boolean;
|
|
286
|
+
}, unknown>;
|
|
283
287
|
reset: () => void;
|
|
284
288
|
status: "error";
|
|
285
289
|
} | {
|
|
@@ -288,6 +292,10 @@ export declare function useAddServerPeer({ projectId }: {
|
|
|
288
292
|
baseUrl: string;
|
|
289
293
|
dangerouslyAllowInsecureConnections?: boolean;
|
|
290
294
|
}, unknown>;
|
|
295
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
296
|
+
baseUrl: string;
|
|
297
|
+
dangerouslyAllowInsecureConnections?: boolean;
|
|
298
|
+
}, unknown>;
|
|
291
299
|
reset: () => void;
|
|
292
300
|
status: "pending" | "success" | "idle";
|
|
293
301
|
};
|
|
@@ -300,6 +308,10 @@ export declare function useCreateProject(): {
|
|
|
300
308
|
name?: string;
|
|
301
309
|
configPath?: string;
|
|
302
310
|
} | undefined, unknown>;
|
|
311
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<string, Error, {
|
|
312
|
+
name?: string;
|
|
313
|
+
configPath?: string;
|
|
314
|
+
} | undefined, unknown>;
|
|
303
315
|
reset: () => void;
|
|
304
316
|
status: "error";
|
|
305
317
|
} | {
|
|
@@ -308,6 +320,10 @@ export declare function useCreateProject(): {
|
|
|
308
320
|
name?: string;
|
|
309
321
|
configPath?: string;
|
|
310
322
|
} | undefined, unknown>;
|
|
323
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<string, Error, {
|
|
324
|
+
name?: string;
|
|
325
|
+
configPath?: string;
|
|
326
|
+
} | undefined, unknown>;
|
|
311
327
|
reset: () => void;
|
|
312
328
|
status: "pending" | "success" | "idle";
|
|
313
329
|
};
|
|
@@ -319,6 +335,9 @@ export declare function useLeaveProject(): {
|
|
|
319
335
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
320
336
|
projectId: string;
|
|
321
337
|
}, unknown>;
|
|
338
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
339
|
+
projectId: string;
|
|
340
|
+
}, unknown>;
|
|
322
341
|
reset: () => void;
|
|
323
342
|
status: "error";
|
|
324
343
|
} | {
|
|
@@ -326,6 +345,9 @@ export declare function useLeaveProject(): {
|
|
|
326
345
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
327
346
|
projectId: string;
|
|
328
347
|
}, unknown>;
|
|
348
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
349
|
+
projectId: string;
|
|
350
|
+
}, unknown>;
|
|
329
351
|
reset: () => void;
|
|
330
352
|
status: "pending" | "success" | "idle";
|
|
331
353
|
};
|
|
@@ -341,6 +363,9 @@ export declare function useImportProjectConfig({ projectId }: {
|
|
|
341
363
|
mutate: import("@tanstack/react-query").UseMutateFunction<Error[], Error, {
|
|
342
364
|
configPath: string;
|
|
343
365
|
}, unknown>;
|
|
366
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Error[], Error, {
|
|
367
|
+
configPath: string;
|
|
368
|
+
}, unknown>;
|
|
344
369
|
reset: () => void;
|
|
345
370
|
status: "error";
|
|
346
371
|
} | {
|
|
@@ -348,6 +373,9 @@ export declare function useImportProjectConfig({ projectId }: {
|
|
|
348
373
|
mutate: import("@tanstack/react-query").UseMutateFunction<Error[], Error, {
|
|
349
374
|
configPath: string;
|
|
350
375
|
}, unknown>;
|
|
376
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Error[], Error, {
|
|
377
|
+
configPath: string;
|
|
378
|
+
}, unknown>;
|
|
351
379
|
reset: () => void;
|
|
352
380
|
status: "pending" | "success" | "idle";
|
|
353
381
|
};
|
|
@@ -365,6 +393,11 @@ export declare function useUpdateProjectSettings({ projectId }: {
|
|
|
365
393
|
configMetadata?: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).ProjectSettings["configMetadata"];
|
|
366
394
|
defaultPresets?: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).ProjectSettings["defaultPresets"];
|
|
367
395
|
}, unknown>;
|
|
396
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).EditableProjectSettings, Error, {
|
|
397
|
+
name?: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).ProjectSettings["name"];
|
|
398
|
+
configMetadata?: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).ProjectSettings["configMetadata"];
|
|
399
|
+
defaultPresets?: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).ProjectSettings["defaultPresets"];
|
|
400
|
+
}, unknown>;
|
|
368
401
|
reset: () => void;
|
|
369
402
|
status: "error";
|
|
370
403
|
} | {
|
|
@@ -374,6 +407,11 @@ export declare function useUpdateProjectSettings({ projectId }: {
|
|
|
374
407
|
configMetadata?: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).ProjectSettings["configMetadata"];
|
|
375
408
|
defaultPresets?: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).ProjectSettings["defaultPresets"];
|
|
376
409
|
}, unknown>;
|
|
410
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).EditableProjectSettings, Error, {
|
|
411
|
+
name?: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).ProjectSettings["name"];
|
|
412
|
+
configMetadata?: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).ProjectSettings["configMetadata"];
|
|
413
|
+
defaultPresets?: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).ProjectSettings["defaultPresets"];
|
|
414
|
+
}, unknown>;
|
|
377
415
|
reset: () => void;
|
|
378
416
|
status: "pending" | "success" | "idle";
|
|
379
417
|
};
|
|
@@ -397,6 +435,17 @@ export declare function useCreateBlob({ projectId }: {
|
|
|
397
435
|
thumbnail?: string;
|
|
398
436
|
metadata: import("@comapeo/core/dist/blob-api.js", { with: { "resolution-mode": "import" } }).Metadata;
|
|
399
437
|
}, unknown>;
|
|
438
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
439
|
+
driveId: string;
|
|
440
|
+
name: string;
|
|
441
|
+
type: "photo" | "video" | "audio";
|
|
442
|
+
hash: string;
|
|
443
|
+
}, Error, {
|
|
444
|
+
original: string;
|
|
445
|
+
preview?: string;
|
|
446
|
+
thumbnail?: string;
|
|
447
|
+
metadata: import("@comapeo/core/dist/blob-api.js", { with: { "resolution-mode": "import" } }).Metadata;
|
|
448
|
+
}, unknown>;
|
|
400
449
|
reset: () => void;
|
|
401
450
|
status: "error";
|
|
402
451
|
} | {
|
|
@@ -412,6 +461,17 @@ export declare function useCreateBlob({ projectId }: {
|
|
|
412
461
|
thumbnail?: string;
|
|
413
462
|
metadata: import("@comapeo/core/dist/blob-api.js", { with: { "resolution-mode": "import" } }).Metadata;
|
|
414
463
|
}, unknown>;
|
|
464
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
465
|
+
driveId: string;
|
|
466
|
+
name: string;
|
|
467
|
+
type: "photo" | "video" | "audio";
|
|
468
|
+
hash: string;
|
|
469
|
+
}, Error, {
|
|
470
|
+
original: string;
|
|
471
|
+
preview?: string;
|
|
472
|
+
thumbnail?: string;
|
|
473
|
+
metadata: import("@comapeo/core/dist/blob-api.js", { with: { "resolution-mode": "import" } }).Metadata;
|
|
474
|
+
}, unknown>;
|
|
415
475
|
reset: () => void;
|
|
416
476
|
status: "pending" | "success" | "idle";
|
|
417
477
|
};
|
|
@@ -455,6 +515,9 @@ export declare function useStartSync({ projectId }: {
|
|
|
455
515
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
456
516
|
autostopDataSyncAfter: number | null;
|
|
457
517
|
} | undefined, unknown>;
|
|
518
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
519
|
+
autostopDataSyncAfter: number | null;
|
|
520
|
+
} | undefined, unknown>;
|
|
458
521
|
reset: () => void;
|
|
459
522
|
status: "error";
|
|
460
523
|
} | {
|
|
@@ -462,6 +525,9 @@ export declare function useStartSync({ projectId }: {
|
|
|
462
525
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
463
526
|
autostopDataSyncAfter: number | null;
|
|
464
527
|
} | undefined, unknown>;
|
|
528
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
529
|
+
autostopDataSyncAfter: number | null;
|
|
530
|
+
} | undefined, unknown>;
|
|
465
531
|
reset: () => void;
|
|
466
532
|
status: "pending" | "success" | "idle";
|
|
467
533
|
};
|
|
@@ -470,11 +536,13 @@ export declare function useStopSync({ projectId }: {
|
|
|
470
536
|
}): {
|
|
471
537
|
error: Error;
|
|
472
538
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, void, unknown>;
|
|
539
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, void, unknown>;
|
|
473
540
|
reset: () => void;
|
|
474
541
|
status: "error";
|
|
475
542
|
} | {
|
|
476
543
|
error: null;
|
|
477
544
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, void, unknown>;
|
|
545
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, void, unknown>;
|
|
478
546
|
reset: () => void;
|
|
479
547
|
status: "pending" | "success" | "idle";
|
|
480
548
|
};
|
|
@@ -292,10 +292,10 @@ function useOwnRoleInProject({ projectId }) {
|
|
|
292
292
|
function useAddServerPeer({ projectId }) {
|
|
293
293
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
294
294
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
295
|
-
const { error, mutate, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.addServerPeerMutationOptions)({ projectApi, projectId, queryClient }));
|
|
295
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.addServerPeerMutationOptions)({ projectApi, projectId, queryClient }));
|
|
296
296
|
return status === 'error'
|
|
297
|
-
? { error, mutate, reset, status }
|
|
298
|
-
: { error: null, mutate, reset, status };
|
|
297
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
298
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
299
299
|
}
|
|
300
300
|
/**
|
|
301
301
|
* Create a new project.
|
|
@@ -303,10 +303,10 @@ function useAddServerPeer({ projectId }) {
|
|
|
303
303
|
function useCreateProject() {
|
|
304
304
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
305
305
|
const clientApi = (0, client_js_1.useClientApi)();
|
|
306
|
-
const { error, mutate, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.createProjectMutationOptions)({ clientApi, queryClient }));
|
|
306
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.createProjectMutationOptions)({ clientApi, queryClient }));
|
|
307
307
|
return status === 'error'
|
|
308
|
-
? { error, mutate, reset, status }
|
|
309
|
-
: { error: null, mutate, reset, status };
|
|
308
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
309
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
310
310
|
}
|
|
311
311
|
/**
|
|
312
312
|
* Leave an existing project.
|
|
@@ -314,10 +314,10 @@ function useCreateProject() {
|
|
|
314
314
|
function useLeaveProject() {
|
|
315
315
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
316
316
|
const clientApi = (0, client_js_1.useClientApi)();
|
|
317
|
-
const { error, mutate, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.leaveProjectMutationOptions)({ clientApi, queryClient }));
|
|
317
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.leaveProjectMutationOptions)({ clientApi, queryClient }));
|
|
318
318
|
return status === 'error'
|
|
319
|
-
? { error, mutate, reset, status }
|
|
320
|
-
: { error: null, mutate, reset, status };
|
|
319
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
320
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
323
323
|
* Update the configuration of a project using an external file.
|
|
@@ -327,10 +327,10 @@ function useLeaveProject() {
|
|
|
327
327
|
function useImportProjectConfig({ projectId }) {
|
|
328
328
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
329
329
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
330
|
-
const { error, mutate, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.importProjectConfigMutationOptions)({ queryClient, projectApi, projectId }));
|
|
330
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.importProjectConfigMutationOptions)({ queryClient, projectApi, projectId }));
|
|
331
331
|
return status === 'error'
|
|
332
|
-
? { error, mutate, reset, status }
|
|
333
|
-
: { error: null, mutate, reset, status };
|
|
332
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
333
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
334
334
|
}
|
|
335
335
|
/**
|
|
336
336
|
* Update the settings of a project.
|
|
@@ -340,10 +340,10 @@ function useImportProjectConfig({ projectId }) {
|
|
|
340
340
|
function useUpdateProjectSettings({ projectId }) {
|
|
341
341
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
342
342
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
343
|
-
const { error, mutate, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.updateProjectSettingsMutationOptions)({ projectApi, queryClient }));
|
|
343
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.updateProjectSettingsMutationOptions)({ projectApi, queryClient }));
|
|
344
344
|
return status === 'error'
|
|
345
|
-
? { error, mutate, reset, status }
|
|
346
|
-
: { error: null, mutate, reset, status };
|
|
345
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
346
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
347
347
|
}
|
|
348
348
|
/**
|
|
349
349
|
* Create a blob for a project.
|
|
@@ -352,10 +352,10 @@ function useUpdateProjectSettings({ projectId }) {
|
|
|
352
352
|
*/
|
|
353
353
|
function useCreateBlob({ projectId }) {
|
|
354
354
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
355
|
-
const { error, mutate, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.createBlobMutationOptions)({ projectApi }));
|
|
355
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.createBlobMutationOptions)({ projectApi }));
|
|
356
356
|
return status === 'error'
|
|
357
|
-
? { error, mutate, reset, status }
|
|
358
|
-
: { error: null, mutate, reset, status };
|
|
357
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
358
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
359
359
|
}
|
|
360
360
|
const PROJECT_SYNC_STORE_MAP = new WeakMap();
|
|
361
361
|
function useSyncStore({ projectId }) {
|
|
@@ -405,15 +405,15 @@ function useDataSyncProgress({ projectId, }) {
|
|
|
405
405
|
}
|
|
406
406
|
function useStartSync({ projectId }) {
|
|
407
407
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
408
|
-
const { mutate, reset, status
|
|
408
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.startSyncMutationOptions)({ projectApi }));
|
|
409
409
|
return status === 'error'
|
|
410
|
-
? { error, mutate, reset, status }
|
|
411
|
-
: { error: null, mutate, reset, status };
|
|
410
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
411
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
412
412
|
}
|
|
413
413
|
function useStopSync({ projectId }) {
|
|
414
414
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
415
|
-
const { error, mutate, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.stopSyncMutationOptions)({ projectApi }));
|
|
415
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.stopSyncMutationOptions)({ projectApi }));
|
|
416
416
|
return status === 'error'
|
|
417
|
-
? { error, mutate, reset, status }
|
|
418
|
-
: { error: null, mutate, reset, status };
|
|
417
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
418
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
419
419
|
}
|
|
@@ -66,6 +66,10 @@ export declare function useSetOwnDeviceInfo(): {
|
|
|
66
66
|
name: string;
|
|
67
67
|
deviceType: import("@comapeo/schema").DeviceInfo["deviceType"];
|
|
68
68
|
}, unknown>;
|
|
69
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
70
|
+
name: string;
|
|
71
|
+
deviceType: import("@comapeo/schema").DeviceInfo["deviceType"];
|
|
72
|
+
}, unknown>;
|
|
69
73
|
reset: () => void;
|
|
70
74
|
status: "error";
|
|
71
75
|
} | {
|
|
@@ -74,6 +78,10 @@ export declare function useSetOwnDeviceInfo(): {
|
|
|
74
78
|
name: string;
|
|
75
79
|
deviceType: import("@comapeo/schema").DeviceInfo["deviceType"];
|
|
76
80
|
}, unknown>;
|
|
81
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
82
|
+
name: string;
|
|
83
|
+
deviceType: import("@comapeo/schema").DeviceInfo["deviceType"];
|
|
84
|
+
}, unknown>;
|
|
77
85
|
reset: () => void;
|
|
78
86
|
status: "pending" | "success" | "idle";
|
|
79
87
|
};
|
|
@@ -85,6 +93,9 @@ export declare function useSetIsArchiveDevice(): {
|
|
|
85
93
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
86
94
|
isArchiveDevice: boolean;
|
|
87
95
|
}, unknown>;
|
|
96
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
97
|
+
isArchiveDevice: boolean;
|
|
98
|
+
}, unknown>;
|
|
88
99
|
reset: () => void;
|
|
89
100
|
status: "error";
|
|
90
101
|
} | {
|
|
@@ -92,6 +103,9 @@ export declare function useSetIsArchiveDevice(): {
|
|
|
92
103
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
93
104
|
isArchiveDevice: boolean;
|
|
94
105
|
}, unknown>;
|
|
106
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
107
|
+
isArchiveDevice: boolean;
|
|
108
|
+
}, unknown>;
|
|
95
109
|
reset: () => void;
|
|
96
110
|
status: "pending" | "success" | "idle";
|
|
97
111
|
};
|
package/dist/esm/hooks/client.js
CHANGED
|
@@ -70,10 +70,10 @@ export function useIsArchiveDevice() {
|
|
|
70
70
|
export function useSetOwnDeviceInfo() {
|
|
71
71
|
const queryClient = useQueryClient();
|
|
72
72
|
const clientApi = useClientApi();
|
|
73
|
-
const { error, mutate, reset, status } = useMutation(setOwnDeviceInfoMutationOptions({ clientApi, queryClient }));
|
|
73
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(setOwnDeviceInfoMutationOptions({ clientApi, queryClient }));
|
|
74
74
|
return status === 'error'
|
|
75
|
-
? { error, mutate, reset, status }
|
|
76
|
-
: { error: null, mutate, reset, status };
|
|
75
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
76
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Set or unset the current device as an archive device.
|
|
@@ -81,8 +81,8 @@ export function useSetOwnDeviceInfo() {
|
|
|
81
81
|
export function useSetIsArchiveDevice() {
|
|
82
82
|
const queryClient = useQueryClient();
|
|
83
83
|
const clientApi = useClientApi();
|
|
84
|
-
const { error, mutate, status, reset } = useMutation(setIsArchiveDeviceMutationOptions({ clientApi, queryClient }));
|
|
84
|
+
const { error, mutate, mutateAsync, status, reset } = useMutation(setIsArchiveDeviceMutationOptions({ clientApi, queryClient }));
|
|
85
85
|
return status === 'error'
|
|
86
|
-
? { error, mutate, reset, status }
|
|
87
|
-
: { error: null, mutate, reset, status };
|
|
86
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
87
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
88
88
|
}
|
|
@@ -125,6 +125,11 @@ export declare function useCreateDocument<D extends WriteableDocumentType>({ doc
|
|
|
125
125
|
}, Error, {
|
|
126
126
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
127
127
|
}, unknown>;
|
|
128
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
129
|
+
forks: Array<string>;
|
|
130
|
+
}, Error, {
|
|
131
|
+
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
132
|
+
}, unknown>;
|
|
128
133
|
reset: () => void;
|
|
129
134
|
status: "error";
|
|
130
135
|
} | {
|
|
@@ -134,6 +139,11 @@ export declare function useCreateDocument<D extends WriteableDocumentType>({ doc
|
|
|
134
139
|
}, Error, {
|
|
135
140
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
136
141
|
}, unknown>;
|
|
142
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
143
|
+
forks: Array<string>;
|
|
144
|
+
}, Error, {
|
|
145
|
+
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
146
|
+
}, unknown>;
|
|
137
147
|
reset: () => void;
|
|
138
148
|
status: "pending" | "success" | "idle";
|
|
139
149
|
};
|
|
@@ -154,6 +164,12 @@ export declare function useUpdateDocument<D extends WriteableDocumentType>({ doc
|
|
|
154
164
|
versionId: string;
|
|
155
165
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
156
166
|
}, unknown>;
|
|
167
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
168
|
+
forks: Array<string>;
|
|
169
|
+
}, Error, {
|
|
170
|
+
versionId: string;
|
|
171
|
+
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
172
|
+
}, unknown>;
|
|
157
173
|
reset: () => void;
|
|
158
174
|
status: "error";
|
|
159
175
|
} | {
|
|
@@ -164,6 +180,12 @@ export declare function useUpdateDocument<D extends WriteableDocumentType>({ doc
|
|
|
164
180
|
versionId: string;
|
|
165
181
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
166
182
|
}, unknown>;
|
|
183
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
184
|
+
forks: Array<string>;
|
|
185
|
+
}, Error, {
|
|
186
|
+
versionId: string;
|
|
187
|
+
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
188
|
+
}, unknown>;
|
|
167
189
|
reset: () => void;
|
|
168
190
|
status: "pending" | "success" | "idle";
|
|
169
191
|
};
|
|
@@ -183,6 +205,11 @@ export declare function useDeleteDocument<D extends WriteableDocumentType>({ doc
|
|
|
183
205
|
}, Error, {
|
|
184
206
|
docId: string;
|
|
185
207
|
}, unknown>;
|
|
208
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
209
|
+
forks: Array<string>;
|
|
210
|
+
}, Error, {
|
|
211
|
+
docId: string;
|
|
212
|
+
}, unknown>;
|
|
186
213
|
reset: () => void;
|
|
187
214
|
status: "error";
|
|
188
215
|
} | {
|
|
@@ -192,6 +219,11 @@ export declare function useDeleteDocument<D extends WriteableDocumentType>({ doc
|
|
|
192
219
|
}, Error, {
|
|
193
220
|
docId: string;
|
|
194
221
|
}, unknown>;
|
|
222
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
223
|
+
forks: Array<string>;
|
|
224
|
+
}, Error, {
|
|
225
|
+
docId: string;
|
|
226
|
+
}, unknown>;
|
|
195
227
|
reset: () => void;
|
|
196
228
|
status: "pending" | "success" | "idle";
|
|
197
229
|
};
|
|
@@ -140,15 +140,15 @@ export function useManyDocs({ projectId, docType, includeDeleted, lang, }) {
|
|
|
140
140
|
export function useCreateDocument({ docType, projectId, }) {
|
|
141
141
|
const queryClient = useQueryClient();
|
|
142
142
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
143
|
-
const { error, mutate, reset, status } = useMutation(createDocumentMutationOptions({
|
|
143
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(createDocumentMutationOptions({
|
|
144
144
|
docType,
|
|
145
145
|
projectApi,
|
|
146
146
|
projectId,
|
|
147
147
|
queryClient,
|
|
148
148
|
}));
|
|
149
149
|
return status === 'error'
|
|
150
|
-
? { error, mutate, reset, status }
|
|
151
|
-
: { error: null, mutate, reset, status };
|
|
150
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
151
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
154
|
* Update a document within a project.
|
|
@@ -159,15 +159,15 @@ export function useCreateDocument({ docType, projectId, }) {
|
|
|
159
159
|
export function useUpdateDocument({ docType, projectId, }) {
|
|
160
160
|
const queryClient = useQueryClient();
|
|
161
161
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
162
|
-
const { error, mutate, reset, status } = useMutation(updateDocumentMutationOptions({
|
|
162
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(updateDocumentMutationOptions({
|
|
163
163
|
docType,
|
|
164
164
|
projectApi,
|
|
165
165
|
projectId,
|
|
166
166
|
queryClient,
|
|
167
167
|
}));
|
|
168
168
|
return status === 'error'
|
|
169
|
-
? { error, mutate, reset, status }
|
|
170
|
-
: { error: null, mutate, reset, status };
|
|
169
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
170
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
173
|
* Delete a document within a project.
|
|
@@ -178,13 +178,13 @@ export function useUpdateDocument({ docType, projectId, }) {
|
|
|
178
178
|
export function useDeleteDocument({ docType, projectId, }) {
|
|
179
179
|
const queryClient = useQueryClient();
|
|
180
180
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
181
|
-
const { error, mutate, reset, status } = useMutation(deleteDocumentMutationOptions({
|
|
181
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(deleteDocumentMutationOptions({
|
|
182
182
|
docType,
|
|
183
183
|
projectApi,
|
|
184
184
|
projectId,
|
|
185
185
|
queryClient,
|
|
186
186
|
}));
|
|
187
187
|
return status === 'error'
|
|
188
|
-
? { error, mutate, reset, status }
|
|
189
|
-
: { error: null, mutate, reset, status };
|
|
188
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
189
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
190
190
|
}
|
|
@@ -6,6 +6,9 @@ export declare function useAcceptInvite(): {
|
|
|
6
6
|
mutate: import("@tanstack/react-query").UseMutateFunction<string, Error, {
|
|
7
7
|
inviteId: string;
|
|
8
8
|
}, unknown>;
|
|
9
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<string, Error, {
|
|
10
|
+
inviteId: string;
|
|
11
|
+
}, unknown>;
|
|
9
12
|
reset: () => void;
|
|
10
13
|
status: "error";
|
|
11
14
|
} | {
|
|
@@ -13,6 +16,9 @@ export declare function useAcceptInvite(): {
|
|
|
13
16
|
mutate: import("@tanstack/react-query").UseMutateFunction<string, Error, {
|
|
14
17
|
inviteId: string;
|
|
15
18
|
}, unknown>;
|
|
19
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<string, Error, {
|
|
20
|
+
inviteId: string;
|
|
21
|
+
}, unknown>;
|
|
16
22
|
reset: () => void;
|
|
17
23
|
status: "pending" | "success" | "idle";
|
|
18
24
|
};
|
|
@@ -24,6 +30,9 @@ export declare function useRejectInvite(): {
|
|
|
24
30
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
25
31
|
inviteId: string;
|
|
26
32
|
}, unknown>;
|
|
33
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
34
|
+
inviteId: string;
|
|
35
|
+
}, unknown>;
|
|
27
36
|
reset: () => void;
|
|
28
37
|
status: "error";
|
|
29
38
|
} | {
|
|
@@ -31,6 +40,9 @@ export declare function useRejectInvite(): {
|
|
|
31
40
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
32
41
|
inviteId: string;
|
|
33
42
|
}, unknown>;
|
|
43
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
44
|
+
inviteId: string;
|
|
45
|
+
}, unknown>;
|
|
34
46
|
reset: () => void;
|
|
35
47
|
status: "pending" | "success" | "idle";
|
|
36
48
|
};
|
|
@@ -49,6 +61,12 @@ export declare function useSendInvite({ projectId }: {
|
|
|
49
61
|
roleId: import("@comapeo/core/dist/roles.js").RoleIdForNewInvite;
|
|
50
62
|
roleName?: string;
|
|
51
63
|
}, unknown>;
|
|
64
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<"ACCEPT" | "REJECT" | "ALREADY", Error, {
|
|
65
|
+
deviceId: string;
|
|
66
|
+
roleDescription?: string;
|
|
67
|
+
roleId: import("@comapeo/core/dist/roles.js").RoleIdForNewInvite;
|
|
68
|
+
roleName?: string;
|
|
69
|
+
}, unknown>;
|
|
52
70
|
reset: () => void;
|
|
53
71
|
status: "error";
|
|
54
72
|
} | {
|
|
@@ -59,6 +77,12 @@ export declare function useSendInvite({ projectId }: {
|
|
|
59
77
|
roleId: import("@comapeo/core/dist/roles.js").RoleIdForNewInvite;
|
|
60
78
|
roleName?: string;
|
|
61
79
|
}, unknown>;
|
|
80
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<"ACCEPT" | "REJECT" | "ALREADY", Error, {
|
|
81
|
+
deviceId: string;
|
|
82
|
+
roleDescription?: string;
|
|
83
|
+
roleId: import("@comapeo/core/dist/roles.js").RoleIdForNewInvite;
|
|
84
|
+
roleName?: string;
|
|
85
|
+
}, unknown>;
|
|
62
86
|
reset: () => void;
|
|
63
87
|
status: "pending" | "success" | "idle";
|
|
64
88
|
};
|
|
@@ -74,6 +98,9 @@ export declare function useRequestCancelInvite({ projectId }: {
|
|
|
74
98
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
75
99
|
deviceId: string;
|
|
76
100
|
}, unknown>;
|
|
101
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
102
|
+
deviceId: string;
|
|
103
|
+
}, unknown>;
|
|
77
104
|
reset: () => void;
|
|
78
105
|
status: "error";
|
|
79
106
|
} | {
|
|
@@ -81,6 +108,9 @@ export declare function useRequestCancelInvite({ projectId }: {
|
|
|
81
108
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
82
109
|
deviceId: string;
|
|
83
110
|
}, unknown>;
|
|
111
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
112
|
+
deviceId: string;
|
|
113
|
+
}, unknown>;
|
|
84
114
|
reset: () => void;
|
|
85
115
|
status: "pending" | "success" | "idle";
|
|
86
116
|
};
|
|
@@ -8,10 +8,10 @@ import { useSingleProject } from './projects.js';
|
|
|
8
8
|
export function useAcceptInvite() {
|
|
9
9
|
const queryClient = useQueryClient();
|
|
10
10
|
const clientApi = useClientApi();
|
|
11
|
-
const { error, mutate, reset, status } = useMutation(acceptInviteMutationOptions({ clientApi, queryClient }));
|
|
11
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(acceptInviteMutationOptions({ clientApi, queryClient }));
|
|
12
12
|
return status === 'error'
|
|
13
|
-
? { error, mutate, reset, status }
|
|
14
|
-
: { error: null, mutate, reset, status };
|
|
13
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
14
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Reject an invite that has been received.
|
|
@@ -19,10 +19,10 @@ export function useAcceptInvite() {
|
|
|
19
19
|
export function useRejectInvite() {
|
|
20
20
|
const queryClient = useQueryClient();
|
|
21
21
|
const clientApi = useClientApi();
|
|
22
|
-
const { error, mutate, reset, status } = useMutation(rejectInviteMutationOptions({ clientApi, queryClient }));
|
|
22
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(rejectInviteMutationOptions({ clientApi, queryClient }));
|
|
23
23
|
return status === 'error'
|
|
24
|
-
? { error, mutate, reset, status }
|
|
25
|
-
: { error: null, mutate, reset, status };
|
|
24
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
25
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Send an invite for a project.
|
|
@@ -32,10 +32,10 @@ export function useRejectInvite() {
|
|
|
32
32
|
export function useSendInvite({ projectId }) {
|
|
33
33
|
const queryClient = useQueryClient();
|
|
34
34
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
35
|
-
const { error, mutate, reset, status } = useMutation(sendInviteMutationOptions({ projectApi, projectId, queryClient }));
|
|
35
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(sendInviteMutationOptions({ projectApi, projectId, queryClient }));
|
|
36
36
|
return status === 'error'
|
|
37
|
-
? { error, mutate, reset, status }
|
|
38
|
-
: { error: null, mutate, reset, status };
|
|
37
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
38
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Request a cancellation of an invite sent to another device.
|
|
@@ -45,8 +45,8 @@ export function useSendInvite({ projectId }) {
|
|
|
45
45
|
export function useRequestCancelInvite({ projectId }) {
|
|
46
46
|
const queryClient = useQueryClient();
|
|
47
47
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
48
|
-
const { error, mutate, reset, status } = useMutation(requestCancelInviteMutationOptions({ projectApi, queryClient }));
|
|
48
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(requestCancelInviteMutationOptions({ projectApi, queryClient }));
|
|
49
49
|
return status === 'error'
|
|
50
|
-
? { error, mutate, reset, status }
|
|
51
|
-
: { error: null, mutate, reset, status };
|
|
50
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
51
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
52
52
|
}
|
|
@@ -280,6 +280,10 @@ export declare function useAddServerPeer({ projectId }: {
|
|
|
280
280
|
baseUrl: string;
|
|
281
281
|
dangerouslyAllowInsecureConnections?: boolean;
|
|
282
282
|
}, unknown>;
|
|
283
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
284
|
+
baseUrl: string;
|
|
285
|
+
dangerouslyAllowInsecureConnections?: boolean;
|
|
286
|
+
}, unknown>;
|
|
283
287
|
reset: () => void;
|
|
284
288
|
status: "error";
|
|
285
289
|
} | {
|
|
@@ -288,6 +292,10 @@ export declare function useAddServerPeer({ projectId }: {
|
|
|
288
292
|
baseUrl: string;
|
|
289
293
|
dangerouslyAllowInsecureConnections?: boolean;
|
|
290
294
|
}, unknown>;
|
|
295
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
296
|
+
baseUrl: string;
|
|
297
|
+
dangerouslyAllowInsecureConnections?: boolean;
|
|
298
|
+
}, unknown>;
|
|
291
299
|
reset: () => void;
|
|
292
300
|
status: "pending" | "success" | "idle";
|
|
293
301
|
};
|
|
@@ -300,6 +308,10 @@ export declare function useCreateProject(): {
|
|
|
300
308
|
name?: string;
|
|
301
309
|
configPath?: string;
|
|
302
310
|
} | undefined, unknown>;
|
|
311
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<string, Error, {
|
|
312
|
+
name?: string;
|
|
313
|
+
configPath?: string;
|
|
314
|
+
} | undefined, unknown>;
|
|
303
315
|
reset: () => void;
|
|
304
316
|
status: "error";
|
|
305
317
|
} | {
|
|
@@ -308,6 +320,10 @@ export declare function useCreateProject(): {
|
|
|
308
320
|
name?: string;
|
|
309
321
|
configPath?: string;
|
|
310
322
|
} | undefined, unknown>;
|
|
323
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<string, Error, {
|
|
324
|
+
name?: string;
|
|
325
|
+
configPath?: string;
|
|
326
|
+
} | undefined, unknown>;
|
|
311
327
|
reset: () => void;
|
|
312
328
|
status: "pending" | "success" | "idle";
|
|
313
329
|
};
|
|
@@ -319,6 +335,9 @@ export declare function useLeaveProject(): {
|
|
|
319
335
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
320
336
|
projectId: string;
|
|
321
337
|
}, unknown>;
|
|
338
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
339
|
+
projectId: string;
|
|
340
|
+
}, unknown>;
|
|
322
341
|
reset: () => void;
|
|
323
342
|
status: "error";
|
|
324
343
|
} | {
|
|
@@ -326,6 +345,9 @@ export declare function useLeaveProject(): {
|
|
|
326
345
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
327
346
|
projectId: string;
|
|
328
347
|
}, unknown>;
|
|
348
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
349
|
+
projectId: string;
|
|
350
|
+
}, unknown>;
|
|
329
351
|
reset: () => void;
|
|
330
352
|
status: "pending" | "success" | "idle";
|
|
331
353
|
};
|
|
@@ -341,6 +363,9 @@ export declare function useImportProjectConfig({ projectId }: {
|
|
|
341
363
|
mutate: import("@tanstack/react-query").UseMutateFunction<Error[], Error, {
|
|
342
364
|
configPath: string;
|
|
343
365
|
}, unknown>;
|
|
366
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Error[], Error, {
|
|
367
|
+
configPath: string;
|
|
368
|
+
}, unknown>;
|
|
344
369
|
reset: () => void;
|
|
345
370
|
status: "error";
|
|
346
371
|
} | {
|
|
@@ -348,6 +373,9 @@ export declare function useImportProjectConfig({ projectId }: {
|
|
|
348
373
|
mutate: import("@tanstack/react-query").UseMutateFunction<Error[], Error, {
|
|
349
374
|
configPath: string;
|
|
350
375
|
}, unknown>;
|
|
376
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Error[], Error, {
|
|
377
|
+
configPath: string;
|
|
378
|
+
}, unknown>;
|
|
351
379
|
reset: () => void;
|
|
352
380
|
status: "pending" | "success" | "idle";
|
|
353
381
|
};
|
|
@@ -365,6 +393,11 @@ export declare function useUpdateProjectSettings({ projectId }: {
|
|
|
365
393
|
configMetadata?: import("@comapeo/schema").ProjectSettings["configMetadata"];
|
|
366
394
|
defaultPresets?: import("@comapeo/schema").ProjectSettings["defaultPresets"];
|
|
367
395
|
}, unknown>;
|
|
396
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("@comapeo/core/dist/mapeo-project.js").EditableProjectSettings, Error, {
|
|
397
|
+
name?: import("@comapeo/schema").ProjectSettings["name"];
|
|
398
|
+
configMetadata?: import("@comapeo/schema").ProjectSettings["configMetadata"];
|
|
399
|
+
defaultPresets?: import("@comapeo/schema").ProjectSettings["defaultPresets"];
|
|
400
|
+
}, unknown>;
|
|
368
401
|
reset: () => void;
|
|
369
402
|
status: "error";
|
|
370
403
|
} | {
|
|
@@ -374,6 +407,11 @@ export declare function useUpdateProjectSettings({ projectId }: {
|
|
|
374
407
|
configMetadata?: import("@comapeo/schema").ProjectSettings["configMetadata"];
|
|
375
408
|
defaultPresets?: import("@comapeo/schema").ProjectSettings["defaultPresets"];
|
|
376
409
|
}, unknown>;
|
|
410
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("@comapeo/core/dist/mapeo-project.js").EditableProjectSettings, Error, {
|
|
411
|
+
name?: import("@comapeo/schema").ProjectSettings["name"];
|
|
412
|
+
configMetadata?: import("@comapeo/schema").ProjectSettings["configMetadata"];
|
|
413
|
+
defaultPresets?: import("@comapeo/schema").ProjectSettings["defaultPresets"];
|
|
414
|
+
}, unknown>;
|
|
377
415
|
reset: () => void;
|
|
378
416
|
status: "pending" | "success" | "idle";
|
|
379
417
|
};
|
|
@@ -397,6 +435,17 @@ export declare function useCreateBlob({ projectId }: {
|
|
|
397
435
|
thumbnail?: string;
|
|
398
436
|
metadata: import("@comapeo/core/dist/blob-api.js").Metadata;
|
|
399
437
|
}, unknown>;
|
|
438
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
439
|
+
driveId: string;
|
|
440
|
+
name: string;
|
|
441
|
+
type: "photo" | "video" | "audio";
|
|
442
|
+
hash: string;
|
|
443
|
+
}, Error, {
|
|
444
|
+
original: string;
|
|
445
|
+
preview?: string;
|
|
446
|
+
thumbnail?: string;
|
|
447
|
+
metadata: import("@comapeo/core/dist/blob-api.js").Metadata;
|
|
448
|
+
}, unknown>;
|
|
400
449
|
reset: () => void;
|
|
401
450
|
status: "error";
|
|
402
451
|
} | {
|
|
@@ -412,6 +461,17 @@ export declare function useCreateBlob({ projectId }: {
|
|
|
412
461
|
thumbnail?: string;
|
|
413
462
|
metadata: import("@comapeo/core/dist/blob-api.js").Metadata;
|
|
414
463
|
}, unknown>;
|
|
464
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
|
|
465
|
+
driveId: string;
|
|
466
|
+
name: string;
|
|
467
|
+
type: "photo" | "video" | "audio";
|
|
468
|
+
hash: string;
|
|
469
|
+
}, Error, {
|
|
470
|
+
original: string;
|
|
471
|
+
preview?: string;
|
|
472
|
+
thumbnail?: string;
|
|
473
|
+
metadata: import("@comapeo/core/dist/blob-api.js").Metadata;
|
|
474
|
+
}, unknown>;
|
|
415
475
|
reset: () => void;
|
|
416
476
|
status: "pending" | "success" | "idle";
|
|
417
477
|
};
|
|
@@ -455,6 +515,9 @@ export declare function useStartSync({ projectId }: {
|
|
|
455
515
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
456
516
|
autostopDataSyncAfter: number | null;
|
|
457
517
|
} | undefined, unknown>;
|
|
518
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
519
|
+
autostopDataSyncAfter: number | null;
|
|
520
|
+
} | undefined, unknown>;
|
|
458
521
|
reset: () => void;
|
|
459
522
|
status: "error";
|
|
460
523
|
} | {
|
|
@@ -462,6 +525,9 @@ export declare function useStartSync({ projectId }: {
|
|
|
462
525
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
463
526
|
autostopDataSyncAfter: number | null;
|
|
464
527
|
} | undefined, unknown>;
|
|
528
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
529
|
+
autostopDataSyncAfter: number | null;
|
|
530
|
+
} | undefined, unknown>;
|
|
465
531
|
reset: () => void;
|
|
466
532
|
status: "pending" | "success" | "idle";
|
|
467
533
|
};
|
|
@@ -470,11 +536,13 @@ export declare function useStopSync({ projectId }: {
|
|
|
470
536
|
}): {
|
|
471
537
|
error: Error;
|
|
472
538
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, void, unknown>;
|
|
539
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, void, unknown>;
|
|
473
540
|
reset: () => void;
|
|
474
541
|
status: "error";
|
|
475
542
|
} | {
|
|
476
543
|
error: null;
|
|
477
544
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, void, unknown>;
|
|
545
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, void, unknown>;
|
|
478
546
|
reset: () => void;
|
|
479
547
|
status: "pending" | "success" | "idle";
|
|
480
548
|
};
|
|
@@ -271,10 +271,10 @@ export function useOwnRoleInProject({ projectId }) {
|
|
|
271
271
|
export function useAddServerPeer({ projectId }) {
|
|
272
272
|
const queryClient = useQueryClient();
|
|
273
273
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
274
|
-
const { error, mutate, reset, status } = useMutation(addServerPeerMutationOptions({ projectApi, projectId, queryClient }));
|
|
274
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(addServerPeerMutationOptions({ projectApi, projectId, queryClient }));
|
|
275
275
|
return status === 'error'
|
|
276
|
-
? { error, mutate, reset, status }
|
|
277
|
-
: { error: null, mutate, reset, status };
|
|
276
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
277
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
278
278
|
}
|
|
279
279
|
/**
|
|
280
280
|
* Create a new project.
|
|
@@ -282,10 +282,10 @@ export function useAddServerPeer({ projectId }) {
|
|
|
282
282
|
export function useCreateProject() {
|
|
283
283
|
const queryClient = useQueryClient();
|
|
284
284
|
const clientApi = useClientApi();
|
|
285
|
-
const { error, mutate, reset, status } = useMutation(createProjectMutationOptions({ clientApi, queryClient }));
|
|
285
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(createProjectMutationOptions({ clientApi, queryClient }));
|
|
286
286
|
return status === 'error'
|
|
287
|
-
? { error, mutate, reset, status }
|
|
288
|
-
: { error: null, mutate, reset, status };
|
|
287
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
288
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
289
289
|
}
|
|
290
290
|
/**
|
|
291
291
|
* Leave an existing project.
|
|
@@ -293,10 +293,10 @@ export function useCreateProject() {
|
|
|
293
293
|
export function useLeaveProject() {
|
|
294
294
|
const queryClient = useQueryClient();
|
|
295
295
|
const clientApi = useClientApi();
|
|
296
|
-
const { error, mutate, reset, status } = useMutation(leaveProjectMutationOptions({ clientApi, queryClient }));
|
|
296
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(leaveProjectMutationOptions({ clientApi, queryClient }));
|
|
297
297
|
return status === 'error'
|
|
298
|
-
? { error, mutate, reset, status }
|
|
299
|
-
: { error: null, mutate, reset, status };
|
|
298
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
299
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
300
300
|
}
|
|
301
301
|
/**
|
|
302
302
|
* Update the configuration of a project using an external file.
|
|
@@ -306,10 +306,10 @@ export function useLeaveProject() {
|
|
|
306
306
|
export function useImportProjectConfig({ projectId }) {
|
|
307
307
|
const queryClient = useQueryClient();
|
|
308
308
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
309
|
-
const { error, mutate, reset, status } = useMutation(importProjectConfigMutationOptions({ queryClient, projectApi, projectId }));
|
|
309
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(importProjectConfigMutationOptions({ queryClient, projectApi, projectId }));
|
|
310
310
|
return status === 'error'
|
|
311
|
-
? { error, mutate, reset, status }
|
|
312
|
-
: { error: null, mutate, reset, status };
|
|
311
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
312
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
313
313
|
}
|
|
314
314
|
/**
|
|
315
315
|
* Update the settings of a project.
|
|
@@ -319,10 +319,10 @@ export function useImportProjectConfig({ projectId }) {
|
|
|
319
319
|
export function useUpdateProjectSettings({ projectId }) {
|
|
320
320
|
const queryClient = useQueryClient();
|
|
321
321
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
322
|
-
const { error, mutate, reset, status } = useMutation(updateProjectSettingsMutationOptions({ projectApi, queryClient }));
|
|
322
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(updateProjectSettingsMutationOptions({ projectApi, queryClient }));
|
|
323
323
|
return status === 'error'
|
|
324
|
-
? { error, mutate, reset, status }
|
|
325
|
-
: { error: null, mutate, reset, status };
|
|
324
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
325
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
326
326
|
}
|
|
327
327
|
/**
|
|
328
328
|
* Create a blob for a project.
|
|
@@ -331,10 +331,10 @@ export function useUpdateProjectSettings({ projectId }) {
|
|
|
331
331
|
*/
|
|
332
332
|
export function useCreateBlob({ projectId }) {
|
|
333
333
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
334
|
-
const { error, mutate, reset, status } = useMutation(createBlobMutationOptions({ projectApi }));
|
|
334
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(createBlobMutationOptions({ projectApi }));
|
|
335
335
|
return status === 'error'
|
|
336
|
-
? { error, mutate, reset, status }
|
|
337
|
-
: { error: null, mutate, reset, status };
|
|
336
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
337
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
338
338
|
}
|
|
339
339
|
const PROJECT_SYNC_STORE_MAP = new WeakMap();
|
|
340
340
|
function useSyncStore({ projectId }) {
|
|
@@ -384,15 +384,15 @@ export function useDataSyncProgress({ projectId, }) {
|
|
|
384
384
|
}
|
|
385
385
|
export function useStartSync({ projectId }) {
|
|
386
386
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
387
|
-
const { mutate, reset, status
|
|
387
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(startSyncMutationOptions({ projectApi }));
|
|
388
388
|
return status === 'error'
|
|
389
|
-
? { error, mutate, reset, status }
|
|
390
|
-
: { error: null, mutate, reset, status };
|
|
389
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
390
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
391
391
|
}
|
|
392
392
|
export function useStopSync({ projectId }) {
|
|
393
393
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
394
|
-
const { error, mutate, reset, status } = useMutation(stopSyncMutationOptions({ projectApi }));
|
|
394
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(stopSyncMutationOptions({ projectApi }));
|
|
395
395
|
return status === 'error'
|
|
396
|
-
? { error, mutate, reset, status }
|
|
397
|
-
: { error: null, mutate, reset, status };
|
|
396
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
397
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
398
398
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comapeo/core-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "React wrapper for working with @comapeo/core",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -79,6 +79,7 @@
|
|
|
79
79
|
"@types/react": "19.0.12",
|
|
80
80
|
"@types/react-dom": "19.0.4",
|
|
81
81
|
"eslint": "9.23.0",
|
|
82
|
+
"eslint-plugin-react-hooks": "5.2.0",
|
|
82
83
|
"fastify": "4.29.0",
|
|
83
84
|
"globals": "16.0.0",
|
|
84
85
|
"husky": "9.1.7",
|