@comapeo/core-react 3.1.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 +33 -2
- package/dist/commonjs/hooks/client.js +8 -4
- package/dist/commonjs/hooks/documents.d.ts +66 -3
- package/dist/commonjs/hooks/documents.js +12 -6
- package/dist/commonjs/hooks/invites.d.ts +69 -4
- package/dist/commonjs/hooks/invites.js +16 -8
- package/dist/commonjs/hooks/projects.d.ts +150 -8
- package/dist/commonjs/hooks/projects.js +32 -16
- package/dist/esm/hooks/client.d.ts +33 -2
- package/dist/esm/hooks/client.js +8 -4
- package/dist/esm/hooks/documents.d.ts +66 -3
- package/dist/esm/hooks/documents.js +12 -6
- package/dist/esm/hooks/invites.d.ts +69 -4
- package/dist/esm/hooks/invites.js +16 -8
- package/dist/esm/hooks/projects.d.ts +150 -8
- package/dist/esm/hooks/projects.js +32 -16
- package/docs/API.md +17 -17
- package/package.json +2 -1
|
@@ -61,20 +61,51 @@ export declare function useIsArchiveDevice(): {
|
|
|
61
61
|
* Update the device info for the current device.
|
|
62
62
|
*/
|
|
63
63
|
export declare function useSetOwnDeviceInfo(): {
|
|
64
|
+
error: Error;
|
|
64
65
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
65
66
|
name: string;
|
|
66
67
|
deviceType: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).DeviceInfo["deviceType"];
|
|
67
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>;
|
|
68
73
|
reset: () => void;
|
|
69
|
-
status: "
|
|
74
|
+
status: "error";
|
|
75
|
+
} | {
|
|
76
|
+
error: null;
|
|
77
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
78
|
+
name: string;
|
|
79
|
+
deviceType: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).DeviceInfo["deviceType"];
|
|
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>;
|
|
85
|
+
reset: () => void;
|
|
86
|
+
status: "pending" | "success" | "idle";
|
|
70
87
|
};
|
|
71
88
|
/**
|
|
72
89
|
* Set or unset the current device as an archive device.
|
|
73
90
|
*/
|
|
74
91
|
export declare function useSetIsArchiveDevice(): {
|
|
92
|
+
error: Error;
|
|
75
93
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
76
94
|
isArchiveDevice: boolean;
|
|
77
95
|
}, unknown>;
|
|
96
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
97
|
+
isArchiveDevice: boolean;
|
|
98
|
+
}, unknown>;
|
|
99
|
+
reset: () => void;
|
|
100
|
+
status: "error";
|
|
101
|
+
} | {
|
|
102
|
+
error: null;
|
|
103
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
104
|
+
isArchiveDevice: boolean;
|
|
105
|
+
}, unknown>;
|
|
106
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
107
|
+
isArchiveDevice: boolean;
|
|
108
|
+
}, unknown>;
|
|
78
109
|
reset: () => void;
|
|
79
|
-
status: "pending" | "
|
|
110
|
+
status: "pending" | "success" | "idle";
|
|
80
111
|
};
|
|
@@ -77,8 +77,10 @@ function useIsArchiveDevice() {
|
|
|
77
77
|
function useSetOwnDeviceInfo() {
|
|
78
78
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
79
79
|
const clientApi = useClientApi();
|
|
80
|
-
const { mutate,
|
|
81
|
-
return
|
|
80
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, client_js_1.setOwnDeviceInfoMutationOptions)({ clientApi, queryClient }));
|
|
81
|
+
return status === 'error'
|
|
82
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
83
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
82
84
|
}
|
|
83
85
|
/**
|
|
84
86
|
* Set or unset the current device as an archive device.
|
|
@@ -86,6 +88,8 @@ function useSetOwnDeviceInfo() {
|
|
|
86
88
|
function useSetIsArchiveDevice() {
|
|
87
89
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
88
90
|
const clientApi = useClientApi();
|
|
89
|
-
const { mutate, status, reset } = (0, react_query_1.useMutation)((0, client_js_1.setIsArchiveDeviceMutationOptions)({ clientApi, queryClient }));
|
|
90
|
-
return
|
|
91
|
+
const { error, mutate, mutateAsync, status, reset } = (0, react_query_1.useMutation)((0, client_js_1.setIsArchiveDeviceMutationOptions)({ clientApi, queryClient }));
|
|
92
|
+
return status === 'error'
|
|
93
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
94
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
91
95
|
}
|
|
@@ -119,13 +119,33 @@ export declare function useCreateDocument<D extends WriteableDocumentType>({ doc
|
|
|
119
119
|
docType: D;
|
|
120
120
|
projectId: string;
|
|
121
121
|
}): {
|
|
122
|
+
error: Error;
|
|
122
123
|
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
123
124
|
forks: Array<string>;
|
|
124
125
|
}, Error, {
|
|
125
126
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
126
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>;
|
|
127
133
|
reset: () => void;
|
|
128
|
-
status: "
|
|
134
|
+
status: "error";
|
|
135
|
+
} | {
|
|
136
|
+
error: null;
|
|
137
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
138
|
+
forks: Array<string>;
|
|
139
|
+
}, Error, {
|
|
140
|
+
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
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>;
|
|
147
|
+
reset: () => void;
|
|
148
|
+
status: "pending" | "success" | "idle";
|
|
129
149
|
};
|
|
130
150
|
/**
|
|
131
151
|
* Update a document within a project.
|
|
@@ -137,14 +157,37 @@ export declare function useUpdateDocument<D extends WriteableDocumentType>({ doc
|
|
|
137
157
|
docType: D;
|
|
138
158
|
projectId: string;
|
|
139
159
|
}): {
|
|
160
|
+
error: Error;
|
|
140
161
|
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
141
162
|
forks: Array<string>;
|
|
142
163
|
}, Error, {
|
|
143
164
|
versionId: string;
|
|
144
165
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
145
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>;
|
|
146
173
|
reset: () => void;
|
|
147
|
-
status: "
|
|
174
|
+
status: "error";
|
|
175
|
+
} | {
|
|
176
|
+
error: null;
|
|
177
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
178
|
+
forks: Array<string>;
|
|
179
|
+
}, Error, {
|
|
180
|
+
versionId: string;
|
|
181
|
+
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
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>;
|
|
189
|
+
reset: () => void;
|
|
190
|
+
status: "pending" | "success" | "idle";
|
|
148
191
|
};
|
|
149
192
|
/**
|
|
150
193
|
* Delete a document within a project.
|
|
@@ -156,12 +199,32 @@ export declare function useDeleteDocument<D extends WriteableDocumentType>({ doc
|
|
|
156
199
|
docType: D;
|
|
157
200
|
projectId: string;
|
|
158
201
|
}): {
|
|
202
|
+
error: Error;
|
|
203
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
204
|
+
forks: Array<string>;
|
|
205
|
+
}, Error, {
|
|
206
|
+
docId: string;
|
|
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>;
|
|
213
|
+
reset: () => void;
|
|
214
|
+
status: "error";
|
|
215
|
+
} | {
|
|
216
|
+
error: null;
|
|
159
217
|
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
160
218
|
forks: Array<string>;
|
|
161
219
|
}, Error, {
|
|
162
220
|
docId: string;
|
|
163
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>;
|
|
164
227
|
reset: () => void;
|
|
165
|
-
status: "pending" | "
|
|
228
|
+
status: "pending" | "success" | "idle";
|
|
166
229
|
};
|
|
167
230
|
export {};
|
|
@@ -148,13 +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 { 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
|
-
return
|
|
157
|
+
return status === 'error'
|
|
158
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
159
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
158
160
|
}
|
|
159
161
|
/**
|
|
160
162
|
* Update a document within a project.
|
|
@@ -165,13 +167,15 @@ function useCreateDocument({ docType, projectId, }) {
|
|
|
165
167
|
function useUpdateDocument({ docType, projectId, }) {
|
|
166
168
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
167
169
|
const { data: projectApi } = (0, projects_js_1.useSingleProject)({ projectId });
|
|
168
|
-
const { 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)({
|
|
169
171
|
docType,
|
|
170
172
|
projectApi,
|
|
171
173
|
projectId,
|
|
172
174
|
queryClient,
|
|
173
175
|
}));
|
|
174
|
-
return
|
|
176
|
+
return status === 'error'
|
|
177
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
178
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
175
179
|
}
|
|
176
180
|
/**
|
|
177
181
|
* Delete a document within a project.
|
|
@@ -182,11 +186,13 @@ function useUpdateDocument({ docType, projectId, }) {
|
|
|
182
186
|
function useDeleteDocument({ docType, projectId, }) {
|
|
183
187
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
184
188
|
const { data: projectApi } = (0, projects_js_1.useSingleProject)({ projectId });
|
|
185
|
-
const { 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)({
|
|
186
190
|
docType,
|
|
187
191
|
projectApi,
|
|
188
192
|
projectId,
|
|
189
193
|
queryClient,
|
|
190
194
|
}));
|
|
191
|
-
return
|
|
195
|
+
return status === 'error'
|
|
196
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
197
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
192
198
|
}
|
|
@@ -2,21 +2,49 @@
|
|
|
2
2
|
* Accept an invite that has been received.
|
|
3
3
|
*/
|
|
4
4
|
export declare function useAcceptInvite(): {
|
|
5
|
+
error: Error;
|
|
5
6
|
mutate: import("@tanstack/react-query").UseMutateFunction<string, Error, {
|
|
6
7
|
inviteId: string;
|
|
7
8
|
}, unknown>;
|
|
9
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<string, Error, {
|
|
10
|
+
inviteId: string;
|
|
11
|
+
}, unknown>;
|
|
8
12
|
reset: () => void;
|
|
9
|
-
status: "
|
|
13
|
+
status: "error";
|
|
14
|
+
} | {
|
|
15
|
+
error: null;
|
|
16
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<string, Error, {
|
|
17
|
+
inviteId: string;
|
|
18
|
+
}, unknown>;
|
|
19
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<string, Error, {
|
|
20
|
+
inviteId: string;
|
|
21
|
+
}, unknown>;
|
|
22
|
+
reset: () => void;
|
|
23
|
+
status: "pending" | "success" | "idle";
|
|
10
24
|
};
|
|
11
25
|
/**
|
|
12
26
|
* Reject an invite that has been received.
|
|
13
27
|
*/
|
|
14
28
|
export declare function useRejectInvite(): {
|
|
29
|
+
error: Error;
|
|
15
30
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
16
31
|
inviteId: string;
|
|
17
32
|
}, unknown>;
|
|
33
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
34
|
+
inviteId: string;
|
|
35
|
+
}, unknown>;
|
|
18
36
|
reset: () => void;
|
|
19
|
-
status: "
|
|
37
|
+
status: "error";
|
|
38
|
+
} | {
|
|
39
|
+
error: null;
|
|
40
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
41
|
+
inviteId: string;
|
|
42
|
+
}, unknown>;
|
|
43
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
44
|
+
inviteId: string;
|
|
45
|
+
}, unknown>;
|
|
46
|
+
reset: () => void;
|
|
47
|
+
status: "pending" | "success" | "idle";
|
|
20
48
|
};
|
|
21
49
|
/**
|
|
22
50
|
* Send an invite for a project.
|
|
@@ -26,14 +54,37 @@ export declare function useRejectInvite(): {
|
|
|
26
54
|
export declare function useSendInvite({ projectId }: {
|
|
27
55
|
projectId: string;
|
|
28
56
|
}): {
|
|
57
|
+
error: Error;
|
|
29
58
|
mutate: import("@tanstack/react-query").UseMutateFunction<"ACCEPT" | "REJECT" | "ALREADY", Error, {
|
|
30
59
|
deviceId: string;
|
|
31
60
|
roleDescription?: string;
|
|
32
61
|
roleId: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).RoleIdForNewInvite;
|
|
33
62
|
roleName?: string;
|
|
34
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>;
|
|
35
70
|
reset: () => void;
|
|
36
|
-
status: "
|
|
71
|
+
status: "error";
|
|
72
|
+
} | {
|
|
73
|
+
error: null;
|
|
74
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<"ACCEPT" | "REJECT" | "ALREADY", Error, {
|
|
75
|
+
deviceId: string;
|
|
76
|
+
roleDescription?: string;
|
|
77
|
+
roleId: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).RoleIdForNewInvite;
|
|
78
|
+
roleName?: string;
|
|
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>;
|
|
86
|
+
reset: () => void;
|
|
87
|
+
status: "pending" | "success" | "idle";
|
|
37
88
|
};
|
|
38
89
|
/**
|
|
39
90
|
* Request a cancellation of an invite sent to another device.
|
|
@@ -43,9 +94,23 @@ export declare function useSendInvite({ projectId }: {
|
|
|
43
94
|
export declare function useRequestCancelInvite({ projectId }: {
|
|
44
95
|
projectId: string;
|
|
45
96
|
}): {
|
|
97
|
+
error: Error;
|
|
98
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
99
|
+
deviceId: string;
|
|
100
|
+
}, unknown>;
|
|
101
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
102
|
+
deviceId: string;
|
|
103
|
+
}, unknown>;
|
|
104
|
+
reset: () => void;
|
|
105
|
+
status: "error";
|
|
106
|
+
} | {
|
|
107
|
+
error: null;
|
|
46
108
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
47
109
|
deviceId: string;
|
|
48
110
|
}, unknown>;
|
|
111
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
112
|
+
deviceId: string;
|
|
113
|
+
}, unknown>;
|
|
49
114
|
reset: () => void;
|
|
50
|
-
status: "pending" | "
|
|
115
|
+
status: "pending" | "success" | "idle";
|
|
51
116
|
};
|
|
@@ -14,8 +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 { mutate,
|
|
18
|
-
return
|
|
17
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, invites_js_1.acceptInviteMutationOptions)({ clientApi, queryClient }));
|
|
18
|
+
return status === 'error'
|
|
19
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
20
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
23
|
* Reject an invite that has been received.
|
|
@@ -23,8 +25,10 @@ function useAcceptInvite() {
|
|
|
23
25
|
function useRejectInvite() {
|
|
24
26
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
25
27
|
const clientApi = (0, client_js_1.useClientApi)();
|
|
26
|
-
const { mutate,
|
|
27
|
-
return
|
|
28
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, invites_js_1.rejectInviteMutationOptions)({ clientApi, queryClient }));
|
|
29
|
+
return status === 'error'
|
|
30
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
31
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
28
32
|
}
|
|
29
33
|
/**
|
|
30
34
|
* Send an invite for a project.
|
|
@@ -34,8 +38,10 @@ function useRejectInvite() {
|
|
|
34
38
|
function useSendInvite({ projectId }) {
|
|
35
39
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
36
40
|
const { data: projectApi } = (0, projects_js_1.useSingleProject)({ projectId });
|
|
37
|
-
const { mutate,
|
|
38
|
-
return
|
|
41
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, invites_js_1.sendInviteMutationOptions)({ projectApi, projectId, queryClient }));
|
|
42
|
+
return status === 'error'
|
|
43
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
44
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
39
45
|
}
|
|
40
46
|
/**
|
|
41
47
|
* Request a cancellation of an invite sent to another device.
|
|
@@ -45,6 +51,8 @@ function useSendInvite({ projectId }) {
|
|
|
45
51
|
function useRequestCancelInvite({ projectId }) {
|
|
46
52
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
47
53
|
const { data: projectApi } = (0, projects_js_1.useSingleProject)({ projectId });
|
|
48
|
-
const { mutate,
|
|
49
|
-
return
|
|
54
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, invites_js_1.requestCancelInviteMutationOptions)({ projectApi, queryClient }));
|
|
55
|
+
return status === 'error'
|
|
56
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
57
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
50
58
|
}
|
|
@@ -275,33 +275,81 @@ export declare function useOwnRoleInProject({ projectId }: {
|
|
|
275
275
|
export declare function useAddServerPeer({ projectId }: {
|
|
276
276
|
projectId: string;
|
|
277
277
|
}): {
|
|
278
|
+
error: Error;
|
|
278
279
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
279
280
|
baseUrl: string;
|
|
280
281
|
dangerouslyAllowInsecureConnections?: boolean;
|
|
281
282
|
}, unknown>;
|
|
283
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
284
|
+
baseUrl: string;
|
|
285
|
+
dangerouslyAllowInsecureConnections?: boolean;
|
|
286
|
+
}, unknown>;
|
|
287
|
+
reset: () => void;
|
|
288
|
+
status: "error";
|
|
289
|
+
} | {
|
|
290
|
+
error: null;
|
|
291
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
292
|
+
baseUrl: string;
|
|
293
|
+
dangerouslyAllowInsecureConnections?: boolean;
|
|
294
|
+
}, unknown>;
|
|
295
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
296
|
+
baseUrl: string;
|
|
297
|
+
dangerouslyAllowInsecureConnections?: boolean;
|
|
298
|
+
}, unknown>;
|
|
282
299
|
reset: () => void;
|
|
283
|
-
status: "pending" | "
|
|
300
|
+
status: "pending" | "success" | "idle";
|
|
284
301
|
};
|
|
285
302
|
/**
|
|
286
303
|
* Create a new project.
|
|
287
304
|
*/
|
|
288
305
|
export declare function useCreateProject(): {
|
|
306
|
+
error: Error;
|
|
307
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<string, Error, {
|
|
308
|
+
name?: string;
|
|
309
|
+
configPath?: string;
|
|
310
|
+
} | undefined, unknown>;
|
|
311
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<string, Error, {
|
|
312
|
+
name?: string;
|
|
313
|
+
configPath?: string;
|
|
314
|
+
} | undefined, unknown>;
|
|
315
|
+
reset: () => void;
|
|
316
|
+
status: "error";
|
|
317
|
+
} | {
|
|
318
|
+
error: null;
|
|
289
319
|
mutate: import("@tanstack/react-query").UseMutateFunction<string, Error, {
|
|
290
320
|
name?: string;
|
|
291
321
|
configPath?: string;
|
|
292
322
|
} | undefined, unknown>;
|
|
323
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<string, Error, {
|
|
324
|
+
name?: string;
|
|
325
|
+
configPath?: string;
|
|
326
|
+
} | undefined, unknown>;
|
|
293
327
|
reset: () => void;
|
|
294
|
-
status: "pending" | "
|
|
328
|
+
status: "pending" | "success" | "idle";
|
|
295
329
|
};
|
|
296
330
|
/**
|
|
297
331
|
* Leave an existing project.
|
|
298
332
|
*/
|
|
299
333
|
export declare function useLeaveProject(): {
|
|
334
|
+
error: Error;
|
|
300
335
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
301
336
|
projectId: string;
|
|
302
337
|
}, unknown>;
|
|
338
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
339
|
+
projectId: string;
|
|
340
|
+
}, unknown>;
|
|
303
341
|
reset: () => void;
|
|
304
|
-
status: "
|
|
342
|
+
status: "error";
|
|
343
|
+
} | {
|
|
344
|
+
error: null;
|
|
345
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
346
|
+
projectId: string;
|
|
347
|
+
}, unknown>;
|
|
348
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
349
|
+
projectId: string;
|
|
350
|
+
}, unknown>;
|
|
351
|
+
reset: () => void;
|
|
352
|
+
status: "pending" | "success" | "idle";
|
|
305
353
|
};
|
|
306
354
|
/**
|
|
307
355
|
* Update the configuration of a project using an external file.
|
|
@@ -311,11 +359,25 @@ export declare function useLeaveProject(): {
|
|
|
311
359
|
export declare function useImportProjectConfig({ projectId }: {
|
|
312
360
|
projectId: string;
|
|
313
361
|
}): {
|
|
362
|
+
error: Error;
|
|
314
363
|
mutate: import("@tanstack/react-query").UseMutateFunction<Error[], Error, {
|
|
315
364
|
configPath: string;
|
|
316
365
|
}, unknown>;
|
|
366
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Error[], Error, {
|
|
367
|
+
configPath: string;
|
|
368
|
+
}, unknown>;
|
|
317
369
|
reset: () => void;
|
|
318
|
-
status: "
|
|
370
|
+
status: "error";
|
|
371
|
+
} | {
|
|
372
|
+
error: null;
|
|
373
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<Error[], Error, {
|
|
374
|
+
configPath: string;
|
|
375
|
+
}, unknown>;
|
|
376
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<Error[], Error, {
|
|
377
|
+
configPath: string;
|
|
378
|
+
}, unknown>;
|
|
379
|
+
reset: () => void;
|
|
380
|
+
status: "pending" | "success" | "idle";
|
|
319
381
|
};
|
|
320
382
|
/**
|
|
321
383
|
* Update the settings of a project.
|
|
@@ -325,13 +387,33 @@ export declare function useImportProjectConfig({ projectId }: {
|
|
|
325
387
|
export declare function useUpdateProjectSettings({ projectId }: {
|
|
326
388
|
projectId: string;
|
|
327
389
|
}): {
|
|
390
|
+
error: Error;
|
|
391
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).EditableProjectSettings, Error, {
|
|
392
|
+
name?: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).ProjectSettings["name"];
|
|
393
|
+
configMetadata?: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).ProjectSettings["configMetadata"];
|
|
394
|
+
defaultPresets?: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).ProjectSettings["defaultPresets"];
|
|
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>;
|
|
401
|
+
reset: () => void;
|
|
402
|
+
status: "error";
|
|
403
|
+
} | {
|
|
404
|
+
error: null;
|
|
328
405
|
mutate: import("@tanstack/react-query").UseMutateFunction<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).EditableProjectSettings, Error, {
|
|
329
406
|
name?: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).ProjectSettings["name"];
|
|
330
407
|
configMetadata?: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).ProjectSettings["configMetadata"];
|
|
331
408
|
defaultPresets?: import("@comapeo/schema", { with: { "resolution-mode": "import" } }).ProjectSettings["defaultPresets"];
|
|
332
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>;
|
|
333
415
|
reset: () => void;
|
|
334
|
-
status: "pending" | "
|
|
416
|
+
status: "pending" | "success" | "idle";
|
|
335
417
|
};
|
|
336
418
|
/**
|
|
337
419
|
* Create a blob for a project.
|
|
@@ -341,6 +423,7 @@ export declare function useUpdateProjectSettings({ projectId }: {
|
|
|
341
423
|
export declare function useCreateBlob({ projectId }: {
|
|
342
424
|
projectId: string;
|
|
343
425
|
}): {
|
|
426
|
+
error: Error;
|
|
344
427
|
mutate: import("@tanstack/react-query").UseMutateFunction<{
|
|
345
428
|
driveId: string;
|
|
346
429
|
name: string;
|
|
@@ -352,8 +435,45 @@ export declare function useCreateBlob({ projectId }: {
|
|
|
352
435
|
thumbnail?: string;
|
|
353
436
|
metadata: import("@comapeo/core/dist/blob-api.js", { with: { "resolution-mode": "import" } }).Metadata;
|
|
354
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>;
|
|
355
449
|
reset: () => void;
|
|
356
|
-
status: "
|
|
450
|
+
status: "error";
|
|
451
|
+
} | {
|
|
452
|
+
error: null;
|
|
453
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<{
|
|
454
|
+
driveId: string;
|
|
455
|
+
name: string;
|
|
456
|
+
type: "photo" | "video" | "audio";
|
|
457
|
+
hash: string;
|
|
458
|
+
}, Error, {
|
|
459
|
+
original: string;
|
|
460
|
+
preview?: string;
|
|
461
|
+
thumbnail?: string;
|
|
462
|
+
metadata: import("@comapeo/core/dist/blob-api.js", { with: { "resolution-mode": "import" } }).Metadata;
|
|
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>;
|
|
475
|
+
reset: () => void;
|
|
476
|
+
status: "pending" | "success" | "idle";
|
|
357
477
|
};
|
|
358
478
|
/**
|
|
359
479
|
* Hook to subscribe to the current sync state.
|
|
@@ -391,16 +511,38 @@ export declare function useDataSyncProgress({ projectId, }: {
|
|
|
391
511
|
export declare function useStartSync({ projectId }: {
|
|
392
512
|
projectId: string;
|
|
393
513
|
}): {
|
|
514
|
+
error: Error;
|
|
394
515
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
395
516
|
autostopDataSyncAfter: number | null;
|
|
396
517
|
} | undefined, unknown>;
|
|
518
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
519
|
+
autostopDataSyncAfter: number | null;
|
|
520
|
+
} | undefined, unknown>;
|
|
397
521
|
reset: () => void;
|
|
398
|
-
status: "
|
|
522
|
+
status: "error";
|
|
523
|
+
} | {
|
|
524
|
+
error: null;
|
|
525
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
526
|
+
autostopDataSyncAfter: number | null;
|
|
527
|
+
} | undefined, unknown>;
|
|
528
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
529
|
+
autostopDataSyncAfter: number | null;
|
|
530
|
+
} | undefined, unknown>;
|
|
531
|
+
reset: () => void;
|
|
532
|
+
status: "pending" | "success" | "idle";
|
|
399
533
|
};
|
|
400
534
|
export declare function useStopSync({ projectId }: {
|
|
401
535
|
projectId: string;
|
|
402
536
|
}): {
|
|
537
|
+
error: Error;
|
|
538
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, void, unknown>;
|
|
539
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, void, unknown>;
|
|
540
|
+
reset: () => void;
|
|
541
|
+
status: "error";
|
|
542
|
+
} | {
|
|
543
|
+
error: null;
|
|
403
544
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, void, unknown>;
|
|
545
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, void, unknown>;
|
|
404
546
|
reset: () => void;
|
|
405
|
-
status: "pending" | "
|
|
547
|
+
status: "pending" | "success" | "idle";
|
|
406
548
|
};
|