@comapeo/core-react 3.0.0 → 3.2.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 +19 -2
- package/dist/commonjs/hooks/client.js +8 -4
- package/dist/commonjs/hooks/documents.d.ts +34 -3
- package/dist/commonjs/hooks/documents.js +12 -6
- package/dist/commonjs/hooks/invites.d.ts +39 -4
- package/dist/commonjs/hooks/invites.js +16 -8
- package/dist/commonjs/hooks/projects.d.ts +104 -8
- package/dist/commonjs/hooks/projects.js +53 -16
- package/dist/commonjs/index.d.ts +1 -1
- package/dist/commonjs/index.js +2 -1
- package/dist/esm/hooks/client.d.ts +19 -2
- package/dist/esm/hooks/client.js +8 -4
- package/dist/esm/hooks/documents.d.ts +34 -3
- package/dist/esm/hooks/documents.js +12 -6
- package/dist/esm/hooks/invites.d.ts +39 -4
- package/dist/esm/hooks/invites.js +16 -8
- package/dist/esm/hooks/projects.d.ts +104 -8
- package/dist/esm/hooks/projects.js +53 -17
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/docs/API.md +43 -17
- package/package.json +1 -1
package/dist/commonjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useUpdateProjectSettings = exports.useSyncState = exports.useStopSync = exports.useStartSync = exports.useSingleProject = exports.useSingleMember = exports.useProjectSettings = exports.useManyProjects = exports.useManyMembers = exports.useLeaveProject = exports.useImportProjectConfig = exports.useIconUrl = exports.useDocumentCreatedBy = exports.useDataSyncProgress = exports.useCreateProject = exports.useCreateBlob = exports.useAttachmentUrl = exports.useAddServerPeer = exports.useMapStyleUrl = exports.useSendInvite = exports.useRequestCancelInvite = exports.useRejectInvite = exports.useAcceptInvite = exports.useUpdateDocument = exports.useSingleDocByVersionId = exports.useSingleDocByDocId = exports.useManyDocs = exports.useDeleteDocument = exports.useCreateDocument = exports.useSetOwnDeviceInfo = exports.useSetIsArchiveDevice = exports.useOwnDeviceInfo = exports.useIsArchiveDevice = exports.useClientApi = exports.ClientApiProvider = exports.ClientApiContext = void 0;
|
|
3
|
+
exports.useUpdateProjectSettings = exports.useSyncState = exports.useStopSync = exports.useStartSync = exports.useSingleProject = exports.useSingleMember = exports.useProjectSettings = exports.useOwnRoleInProject = exports.useManyProjects = exports.useManyMembers = exports.useLeaveProject = exports.useImportProjectConfig = exports.useIconUrl = exports.useDocumentCreatedBy = exports.useDataSyncProgress = exports.useCreateProject = exports.useCreateBlob = exports.useAttachmentUrl = exports.useAddServerPeer = exports.useMapStyleUrl = exports.useSendInvite = exports.useRequestCancelInvite = exports.useRejectInvite = exports.useAcceptInvite = exports.useUpdateDocument = exports.useSingleDocByVersionId = exports.useSingleDocByDocId = exports.useManyDocs = exports.useDeleteDocument = exports.useCreateDocument = exports.useSetOwnDeviceInfo = exports.useSetIsArchiveDevice = exports.useOwnDeviceInfo = exports.useIsArchiveDevice = exports.useClientApi = exports.ClientApiProvider = exports.ClientApiContext = void 0;
|
|
4
4
|
var ClientApi_js_1 = require("./contexts/ClientApi.js");
|
|
5
5
|
Object.defineProperty(exports, "ClientApiContext", { enumerable: true, get: function () { return ClientApi_js_1.ClientApiContext; } });
|
|
6
6
|
Object.defineProperty(exports, "ClientApiProvider", { enumerable: true, get: function () { return ClientApi_js_1.ClientApiProvider; } });
|
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "useImportProjectConfig", { enumerable: true, get
|
|
|
36
36
|
Object.defineProperty(exports, "useLeaveProject", { enumerable: true, get: function () { return projects_js_1.useLeaveProject; } });
|
|
37
37
|
Object.defineProperty(exports, "useManyMembers", { enumerable: true, get: function () { return projects_js_1.useManyMembers; } });
|
|
38
38
|
Object.defineProperty(exports, "useManyProjects", { enumerable: true, get: function () { return projects_js_1.useManyProjects; } });
|
|
39
|
+
Object.defineProperty(exports, "useOwnRoleInProject", { enumerable: true, get: function () { return projects_js_1.useOwnRoleInProject; } });
|
|
39
40
|
Object.defineProperty(exports, "useProjectSettings", { enumerable: true, get: function () { return projects_js_1.useProjectSettings; } });
|
|
40
41
|
Object.defineProperty(exports, "useSingleMember", { enumerable: true, get: function () { return projects_js_1.useSingleMember; } });
|
|
41
42
|
Object.defineProperty(exports, "useSingleProject", { enumerable: true, get: function () { return projects_js_1.useSingleProject; } });
|
|
@@ -61,20 +61,37 @@ 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").DeviceInfo["deviceType"];
|
|
67
68
|
}, unknown>;
|
|
68
69
|
reset: () => void;
|
|
69
|
-
status: "
|
|
70
|
+
status: "error";
|
|
71
|
+
} | {
|
|
72
|
+
error: null;
|
|
73
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
74
|
+
name: string;
|
|
75
|
+
deviceType: import("@comapeo/schema").DeviceInfo["deviceType"];
|
|
76
|
+
}, unknown>;
|
|
77
|
+
reset: () => void;
|
|
78
|
+
status: "pending" | "success" | "idle";
|
|
70
79
|
};
|
|
71
80
|
/**
|
|
72
81
|
* Set or unset the current device as an archive device.
|
|
73
82
|
*/
|
|
74
83
|
export declare function useSetIsArchiveDevice(): {
|
|
84
|
+
error: Error;
|
|
85
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
86
|
+
isArchiveDevice: boolean;
|
|
87
|
+
}, unknown>;
|
|
88
|
+
reset: () => void;
|
|
89
|
+
status: "error";
|
|
90
|
+
} | {
|
|
91
|
+
error: null;
|
|
75
92
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
76
93
|
isArchiveDevice: boolean;
|
|
77
94
|
}, unknown>;
|
|
78
95
|
reset: () => void;
|
|
79
|
-
status: "pending" | "
|
|
96
|
+
status: "pending" | "success" | "idle";
|
|
80
97
|
};
|
package/dist/esm/hooks/client.js
CHANGED
|
@@ -70,8 +70,10 @@ export function useIsArchiveDevice() {
|
|
|
70
70
|
export function useSetOwnDeviceInfo() {
|
|
71
71
|
const queryClient = useQueryClient();
|
|
72
72
|
const clientApi = useClientApi();
|
|
73
|
-
const {
|
|
74
|
-
return
|
|
73
|
+
const { error, mutate, reset, status } = useMutation(setOwnDeviceInfoMutationOptions({ clientApi, queryClient }));
|
|
74
|
+
return status === 'error'
|
|
75
|
+
? { error, mutate, reset, status }
|
|
76
|
+
: { error: null, mutate, reset, status };
|
|
75
77
|
}
|
|
76
78
|
/**
|
|
77
79
|
* Set or unset the current device as an archive device.
|
|
@@ -79,6 +81,8 @@ export function useSetOwnDeviceInfo() {
|
|
|
79
81
|
export function useSetIsArchiveDevice() {
|
|
80
82
|
const queryClient = useQueryClient();
|
|
81
83
|
const clientApi = useClientApi();
|
|
82
|
-
const { mutate, status, reset } = useMutation(setIsArchiveDeviceMutationOptions({ clientApi, queryClient }));
|
|
83
|
-
return
|
|
84
|
+
const { error, mutate, status, reset } = useMutation(setIsArchiveDeviceMutationOptions({ clientApi, queryClient }));
|
|
85
|
+
return status === 'error'
|
|
86
|
+
? { error, mutate, reset, status }
|
|
87
|
+
: { error: null, mutate, reset, status };
|
|
84
88
|
}
|
|
@@ -119,13 +119,23 @@ 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>;
|
|
127
128
|
reset: () => void;
|
|
128
|
-
status: "
|
|
129
|
+
status: "error";
|
|
130
|
+
} | {
|
|
131
|
+
error: null;
|
|
132
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
133
|
+
forks: Array<string>;
|
|
134
|
+
}, Error, {
|
|
135
|
+
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
136
|
+
}, unknown>;
|
|
137
|
+
reset: () => void;
|
|
138
|
+
status: "pending" | "success" | "idle";
|
|
129
139
|
};
|
|
130
140
|
/**
|
|
131
141
|
* Update a document within a project.
|
|
@@ -137,6 +147,7 @@ export declare function useUpdateDocument<D extends WriteableDocumentType>({ doc
|
|
|
137
147
|
docType: D;
|
|
138
148
|
projectId: string;
|
|
139
149
|
}): {
|
|
150
|
+
error: Error;
|
|
140
151
|
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
141
152
|
forks: Array<string>;
|
|
142
153
|
}, Error, {
|
|
@@ -144,7 +155,17 @@ export declare function useUpdateDocument<D extends WriteableDocumentType>({ doc
|
|
|
144
155
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
145
156
|
}, unknown>;
|
|
146
157
|
reset: () => void;
|
|
147
|
-
status: "
|
|
158
|
+
status: "error";
|
|
159
|
+
} | {
|
|
160
|
+
error: null;
|
|
161
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
162
|
+
forks: Array<string>;
|
|
163
|
+
}, Error, {
|
|
164
|
+
versionId: string;
|
|
165
|
+
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
166
|
+
}, unknown>;
|
|
167
|
+
reset: () => void;
|
|
168
|
+
status: "pending" | "success" | "idle";
|
|
148
169
|
};
|
|
149
170
|
/**
|
|
150
171
|
* Delete a document within a project.
|
|
@@ -156,12 +177,22 @@ export declare function useDeleteDocument<D extends WriteableDocumentType>({ doc
|
|
|
156
177
|
docType: D;
|
|
157
178
|
projectId: string;
|
|
158
179
|
}): {
|
|
180
|
+
error: Error;
|
|
181
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
182
|
+
forks: Array<string>;
|
|
183
|
+
}, Error, {
|
|
184
|
+
docId: string;
|
|
185
|
+
}, unknown>;
|
|
186
|
+
reset: () => void;
|
|
187
|
+
status: "error";
|
|
188
|
+
} | {
|
|
189
|
+
error: null;
|
|
159
190
|
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
160
191
|
forks: Array<string>;
|
|
161
192
|
}, Error, {
|
|
162
193
|
docId: string;
|
|
163
194
|
}, unknown>;
|
|
164
195
|
reset: () => void;
|
|
165
|
-
status: "pending" | "
|
|
196
|
+
status: "pending" | "success" | "idle";
|
|
166
197
|
};
|
|
167
198
|
export {};
|
|
@@ -140,13 +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 { mutate, reset, status } = useMutation(createDocumentMutationOptions({
|
|
143
|
+
const { error, mutate, reset, status } = useMutation(createDocumentMutationOptions({
|
|
144
144
|
docType,
|
|
145
145
|
projectApi,
|
|
146
146
|
projectId,
|
|
147
147
|
queryClient,
|
|
148
148
|
}));
|
|
149
|
-
return
|
|
149
|
+
return status === 'error'
|
|
150
|
+
? { error, mutate, reset, status }
|
|
151
|
+
: { error: null, mutate, reset, status };
|
|
150
152
|
}
|
|
151
153
|
/**
|
|
152
154
|
* Update a document within a project.
|
|
@@ -157,13 +159,15 @@ export function useCreateDocument({ docType, projectId, }) {
|
|
|
157
159
|
export function useUpdateDocument({ docType, projectId, }) {
|
|
158
160
|
const queryClient = useQueryClient();
|
|
159
161
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
160
|
-
const { mutate, reset, status } = useMutation(updateDocumentMutationOptions({
|
|
162
|
+
const { error, mutate, reset, status } = useMutation(updateDocumentMutationOptions({
|
|
161
163
|
docType,
|
|
162
164
|
projectApi,
|
|
163
165
|
projectId,
|
|
164
166
|
queryClient,
|
|
165
167
|
}));
|
|
166
|
-
return
|
|
168
|
+
return status === 'error'
|
|
169
|
+
? { error, mutate, reset, status }
|
|
170
|
+
: { error: null, mutate, reset, status };
|
|
167
171
|
}
|
|
168
172
|
/**
|
|
169
173
|
* Delete a document within a project.
|
|
@@ -174,11 +178,13 @@ export function useUpdateDocument({ docType, projectId, }) {
|
|
|
174
178
|
export function useDeleteDocument({ docType, projectId, }) {
|
|
175
179
|
const queryClient = useQueryClient();
|
|
176
180
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
177
|
-
const { mutate, reset, status } = useMutation(deleteDocumentMutationOptions({
|
|
181
|
+
const { error, mutate, reset, status } = useMutation(deleteDocumentMutationOptions({
|
|
178
182
|
docType,
|
|
179
183
|
projectApi,
|
|
180
184
|
projectId,
|
|
181
185
|
queryClient,
|
|
182
186
|
}));
|
|
183
|
-
return
|
|
187
|
+
return status === 'error'
|
|
188
|
+
? { error, mutate, reset, status }
|
|
189
|
+
: { error: null, mutate, reset, status };
|
|
184
190
|
}
|
|
@@ -2,21 +2,37 @@
|
|
|
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>;
|
|
8
9
|
reset: () => void;
|
|
9
|
-
status: "
|
|
10
|
+
status: "error";
|
|
11
|
+
} | {
|
|
12
|
+
error: null;
|
|
13
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<string, Error, {
|
|
14
|
+
inviteId: string;
|
|
15
|
+
}, unknown>;
|
|
16
|
+
reset: () => void;
|
|
17
|
+
status: "pending" | "success" | "idle";
|
|
10
18
|
};
|
|
11
19
|
/**
|
|
12
20
|
* Reject an invite that has been received.
|
|
13
21
|
*/
|
|
14
22
|
export declare function useRejectInvite(): {
|
|
23
|
+
error: Error;
|
|
24
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
25
|
+
inviteId: string;
|
|
26
|
+
}, unknown>;
|
|
27
|
+
reset: () => void;
|
|
28
|
+
status: "error";
|
|
29
|
+
} | {
|
|
30
|
+
error: null;
|
|
15
31
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
16
32
|
inviteId: string;
|
|
17
33
|
}, unknown>;
|
|
18
34
|
reset: () => void;
|
|
19
|
-
status: "pending" | "
|
|
35
|
+
status: "pending" | "success" | "idle";
|
|
20
36
|
};
|
|
21
37
|
/**
|
|
22
38
|
* Send an invite for a project.
|
|
@@ -26,6 +42,7 @@ export declare function useRejectInvite(): {
|
|
|
26
42
|
export declare function useSendInvite({ projectId }: {
|
|
27
43
|
projectId: string;
|
|
28
44
|
}): {
|
|
45
|
+
error: Error;
|
|
29
46
|
mutate: import("@tanstack/react-query").UseMutateFunction<"ACCEPT" | "REJECT" | "ALREADY", Error, {
|
|
30
47
|
deviceId: string;
|
|
31
48
|
roleDescription?: string;
|
|
@@ -33,7 +50,17 @@ export declare function useSendInvite({ projectId }: {
|
|
|
33
50
|
roleName?: string;
|
|
34
51
|
}, unknown>;
|
|
35
52
|
reset: () => void;
|
|
36
|
-
status: "
|
|
53
|
+
status: "error";
|
|
54
|
+
} | {
|
|
55
|
+
error: null;
|
|
56
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<"ACCEPT" | "REJECT" | "ALREADY", Error, {
|
|
57
|
+
deviceId: string;
|
|
58
|
+
roleDescription?: string;
|
|
59
|
+
roleId: import("@comapeo/core/dist/roles.js").RoleIdForNewInvite;
|
|
60
|
+
roleName?: string;
|
|
61
|
+
}, unknown>;
|
|
62
|
+
reset: () => void;
|
|
63
|
+
status: "pending" | "success" | "idle";
|
|
37
64
|
};
|
|
38
65
|
/**
|
|
39
66
|
* Request a cancellation of an invite sent to another device.
|
|
@@ -43,9 +70,17 @@ export declare function useSendInvite({ projectId }: {
|
|
|
43
70
|
export declare function useRequestCancelInvite({ projectId }: {
|
|
44
71
|
projectId: string;
|
|
45
72
|
}): {
|
|
73
|
+
error: Error;
|
|
74
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
75
|
+
deviceId: string;
|
|
76
|
+
}, unknown>;
|
|
77
|
+
reset: () => void;
|
|
78
|
+
status: "error";
|
|
79
|
+
} | {
|
|
80
|
+
error: null;
|
|
46
81
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
47
82
|
deviceId: string;
|
|
48
83
|
}, unknown>;
|
|
49
84
|
reset: () => void;
|
|
50
|
-
status: "pending" | "
|
|
85
|
+
status: "pending" | "success" | "idle";
|
|
51
86
|
};
|
|
@@ -8,8 +8,10 @@ import { useSingleProject } from './projects.js';
|
|
|
8
8
|
export function useAcceptInvite() {
|
|
9
9
|
const queryClient = useQueryClient();
|
|
10
10
|
const clientApi = useClientApi();
|
|
11
|
-
const {
|
|
12
|
-
return
|
|
11
|
+
const { error, mutate, reset, status } = useMutation(acceptInviteMutationOptions({ clientApi, queryClient }));
|
|
12
|
+
return status === 'error'
|
|
13
|
+
? { error, mutate, reset, status }
|
|
14
|
+
: { error: null, mutate, reset, status };
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* Reject an invite that has been received.
|
|
@@ -17,8 +19,10 @@ export function useAcceptInvite() {
|
|
|
17
19
|
export function useRejectInvite() {
|
|
18
20
|
const queryClient = useQueryClient();
|
|
19
21
|
const clientApi = useClientApi();
|
|
20
|
-
const {
|
|
21
|
-
return
|
|
22
|
+
const { error, mutate, reset, status } = useMutation(rejectInviteMutationOptions({ clientApi, queryClient }));
|
|
23
|
+
return status === 'error'
|
|
24
|
+
? { error, mutate, reset, status }
|
|
25
|
+
: { error: null, mutate, reset, status };
|
|
22
26
|
}
|
|
23
27
|
/**
|
|
24
28
|
* Send an invite for a project.
|
|
@@ -28,8 +32,10 @@ export function useRejectInvite() {
|
|
|
28
32
|
export function useSendInvite({ projectId }) {
|
|
29
33
|
const queryClient = useQueryClient();
|
|
30
34
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
31
|
-
const {
|
|
32
|
-
return
|
|
35
|
+
const { error, mutate, reset, status } = useMutation(sendInviteMutationOptions({ projectApi, projectId, queryClient }));
|
|
36
|
+
return status === 'error'
|
|
37
|
+
? { error, mutate, reset, status }
|
|
38
|
+
: { error: null, mutate, reset, status };
|
|
33
39
|
}
|
|
34
40
|
/**
|
|
35
41
|
* Request a cancellation of an invite sent to another device.
|
|
@@ -39,6 +45,8 @@ export function useSendInvite({ projectId }) {
|
|
|
39
45
|
export function useRequestCancelInvite({ projectId }) {
|
|
40
46
|
const queryClient = useQueryClient();
|
|
41
47
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
42
|
-
const {
|
|
43
|
-
return
|
|
48
|
+
const { error, mutate, reset, status } = useMutation(requestCancelInviteMutationOptions({ projectApi, queryClient }));
|
|
49
|
+
return status === 'error'
|
|
50
|
+
? { error, mutate, reset, status }
|
|
51
|
+
: { error: null, mutate, reset, status };
|
|
44
52
|
}
|
|
@@ -250,36 +250,84 @@ export declare function useDocumentCreatedBy({ projectId, originalVersionId, }:
|
|
|
250
250
|
error: Error | null;
|
|
251
251
|
isRefetching: boolean;
|
|
252
252
|
};
|
|
253
|
+
/**
|
|
254
|
+
* Get the role for the current device in a specified project.
|
|
255
|
+
* This is a more convenient alternative to using the `useOwnDeviceInfo` and `useManyMembers` hooks.
|
|
256
|
+
*
|
|
257
|
+
* @param opts.projectId Project public ID
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```tsx
|
|
261
|
+
* function BasicExample() {
|
|
262
|
+
* const { data } = useOwnRoleInProject({
|
|
263
|
+
* projectId: '...',
|
|
264
|
+
* })
|
|
265
|
+
* }
|
|
266
|
+
* ```
|
|
267
|
+
*/
|
|
268
|
+
export declare function useOwnRoleInProject({ projectId }: {
|
|
269
|
+
projectId: string;
|
|
270
|
+
}): {
|
|
271
|
+
data: import("@comapeo/core/dist/roles.js").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">;
|
|
272
|
+
error: Error | null;
|
|
273
|
+
isRefetching: boolean;
|
|
274
|
+
};
|
|
253
275
|
export declare function useAddServerPeer({ projectId }: {
|
|
254
276
|
projectId: string;
|
|
255
277
|
}): {
|
|
278
|
+
error: Error;
|
|
279
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
280
|
+
baseUrl: string;
|
|
281
|
+
dangerouslyAllowInsecureConnections?: boolean;
|
|
282
|
+
}, unknown>;
|
|
283
|
+
reset: () => void;
|
|
284
|
+
status: "error";
|
|
285
|
+
} | {
|
|
286
|
+
error: null;
|
|
256
287
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
257
288
|
baseUrl: string;
|
|
258
289
|
dangerouslyAllowInsecureConnections?: boolean;
|
|
259
290
|
}, unknown>;
|
|
260
291
|
reset: () => void;
|
|
261
|
-
status: "pending" | "
|
|
292
|
+
status: "pending" | "success" | "idle";
|
|
262
293
|
};
|
|
263
294
|
/**
|
|
264
295
|
* Create a new project.
|
|
265
296
|
*/
|
|
266
297
|
export declare function useCreateProject(): {
|
|
298
|
+
error: Error;
|
|
267
299
|
mutate: import("@tanstack/react-query").UseMutateFunction<string, Error, {
|
|
268
300
|
name?: string;
|
|
269
301
|
configPath?: string;
|
|
270
302
|
} | undefined, unknown>;
|
|
271
303
|
reset: () => void;
|
|
272
|
-
status: "
|
|
304
|
+
status: "error";
|
|
305
|
+
} | {
|
|
306
|
+
error: null;
|
|
307
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<string, Error, {
|
|
308
|
+
name?: string;
|
|
309
|
+
configPath?: string;
|
|
310
|
+
} | undefined, unknown>;
|
|
311
|
+
reset: () => void;
|
|
312
|
+
status: "pending" | "success" | "idle";
|
|
273
313
|
};
|
|
274
314
|
/**
|
|
275
315
|
* Leave an existing project.
|
|
276
316
|
*/
|
|
277
317
|
export declare function useLeaveProject(): {
|
|
318
|
+
error: Error;
|
|
278
319
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
279
320
|
projectId: string;
|
|
280
321
|
}, unknown>;
|
|
281
322
|
reset: () => void;
|
|
282
|
-
status: "
|
|
323
|
+
status: "error";
|
|
324
|
+
} | {
|
|
325
|
+
error: null;
|
|
326
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
327
|
+
projectId: string;
|
|
328
|
+
}, unknown>;
|
|
329
|
+
reset: () => void;
|
|
330
|
+
status: "pending" | "success" | "idle";
|
|
283
331
|
};
|
|
284
332
|
/**
|
|
285
333
|
* Update the configuration of a project using an external file.
|
|
@@ -289,11 +337,19 @@ export declare function useLeaveProject(): {
|
|
|
289
337
|
export declare function useImportProjectConfig({ projectId }: {
|
|
290
338
|
projectId: string;
|
|
291
339
|
}): {
|
|
340
|
+
error: Error;
|
|
341
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<Error[], Error, {
|
|
342
|
+
configPath: string;
|
|
343
|
+
}, unknown>;
|
|
344
|
+
reset: () => void;
|
|
345
|
+
status: "error";
|
|
346
|
+
} | {
|
|
347
|
+
error: null;
|
|
292
348
|
mutate: import("@tanstack/react-query").UseMutateFunction<Error[], Error, {
|
|
293
349
|
configPath: string;
|
|
294
350
|
}, unknown>;
|
|
295
351
|
reset: () => void;
|
|
296
|
-
status: "pending" | "
|
|
352
|
+
status: "pending" | "success" | "idle";
|
|
297
353
|
};
|
|
298
354
|
/**
|
|
299
355
|
* Update the settings of a project.
|
|
@@ -303,13 +359,23 @@ export declare function useImportProjectConfig({ projectId }: {
|
|
|
303
359
|
export declare function useUpdateProjectSettings({ projectId }: {
|
|
304
360
|
projectId: string;
|
|
305
361
|
}): {
|
|
362
|
+
error: Error;
|
|
306
363
|
mutate: import("@tanstack/react-query").UseMutateFunction<import("@comapeo/core/dist/mapeo-project.js").EditableProjectSettings, Error, {
|
|
307
364
|
name?: import("@comapeo/schema").ProjectSettings["name"];
|
|
308
365
|
configMetadata?: import("@comapeo/schema").ProjectSettings["configMetadata"];
|
|
309
366
|
defaultPresets?: import("@comapeo/schema").ProjectSettings["defaultPresets"];
|
|
310
367
|
}, unknown>;
|
|
311
368
|
reset: () => void;
|
|
312
|
-
status: "
|
|
369
|
+
status: "error";
|
|
370
|
+
} | {
|
|
371
|
+
error: null;
|
|
372
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<import("@comapeo/core/dist/mapeo-project.js").EditableProjectSettings, Error, {
|
|
373
|
+
name?: import("@comapeo/schema").ProjectSettings["name"];
|
|
374
|
+
configMetadata?: import("@comapeo/schema").ProjectSettings["configMetadata"];
|
|
375
|
+
defaultPresets?: import("@comapeo/schema").ProjectSettings["defaultPresets"];
|
|
376
|
+
}, unknown>;
|
|
377
|
+
reset: () => void;
|
|
378
|
+
status: "pending" | "success" | "idle";
|
|
313
379
|
};
|
|
314
380
|
/**
|
|
315
381
|
* Create a blob for a project.
|
|
@@ -319,6 +385,7 @@ export declare function useUpdateProjectSettings({ projectId }: {
|
|
|
319
385
|
export declare function useCreateBlob({ projectId }: {
|
|
320
386
|
projectId: string;
|
|
321
387
|
}): {
|
|
388
|
+
error: Error;
|
|
322
389
|
mutate: import("@tanstack/react-query").UseMutateFunction<{
|
|
323
390
|
driveId: string;
|
|
324
391
|
name: string;
|
|
@@ -331,7 +398,22 @@ export declare function useCreateBlob({ projectId }: {
|
|
|
331
398
|
metadata: import("@comapeo/core/dist/blob-api.js").Metadata;
|
|
332
399
|
}, unknown>;
|
|
333
400
|
reset: () => void;
|
|
334
|
-
status: "
|
|
401
|
+
status: "error";
|
|
402
|
+
} | {
|
|
403
|
+
error: null;
|
|
404
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<{
|
|
405
|
+
driveId: string;
|
|
406
|
+
name: string;
|
|
407
|
+
type: "photo" | "video" | "audio";
|
|
408
|
+
hash: string;
|
|
409
|
+
}, Error, {
|
|
410
|
+
original: string;
|
|
411
|
+
preview?: string;
|
|
412
|
+
thumbnail?: string;
|
|
413
|
+
metadata: import("@comapeo/core/dist/blob-api.js").Metadata;
|
|
414
|
+
}, unknown>;
|
|
415
|
+
reset: () => void;
|
|
416
|
+
status: "pending" | "success" | "idle";
|
|
335
417
|
};
|
|
336
418
|
/**
|
|
337
419
|
* Hook to subscribe to the current sync state.
|
|
@@ -369,16 +451,30 @@ export declare function useDataSyncProgress({ projectId, }: {
|
|
|
369
451
|
export declare function useStartSync({ projectId }: {
|
|
370
452
|
projectId: string;
|
|
371
453
|
}): {
|
|
454
|
+
error: Error;
|
|
372
455
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
373
456
|
autostopDataSyncAfter: number | null;
|
|
374
457
|
} | undefined, unknown>;
|
|
375
458
|
reset: () => void;
|
|
376
|
-
status: "
|
|
459
|
+
status: "error";
|
|
460
|
+
} | {
|
|
461
|
+
error: null;
|
|
462
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
463
|
+
autostopDataSyncAfter: number | null;
|
|
464
|
+
} | undefined, unknown>;
|
|
465
|
+
reset: () => void;
|
|
466
|
+
status: "pending" | "success" | "idle";
|
|
377
467
|
};
|
|
378
468
|
export declare function useStopSync({ projectId }: {
|
|
379
469
|
projectId: string;
|
|
380
470
|
}): {
|
|
471
|
+
error: Error;
|
|
472
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, void, unknown>;
|
|
473
|
+
reset: () => void;
|
|
474
|
+
status: "error";
|
|
475
|
+
} | {
|
|
476
|
+
error: null;
|
|
381
477
|
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, void, unknown>;
|
|
382
478
|
reset: () => void;
|
|
383
|
-
status: "pending" | "
|
|
479
|
+
status: "pending" | "success" | "idle";
|
|
384
480
|
};
|