@comapeo/core-react 1.1.0 → 2.0.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 +21 -0
- package/dist/commonjs/hooks/client.js +20 -0
- package/dist/commonjs/hooks/documents.d.ts +59 -4
- package/dist/commonjs/hooks/documents.js +54 -0
- package/dist/commonjs/hooks/invites.d.ts +51 -0
- package/dist/commonjs/hooks/invites.js +50 -0
- package/dist/commonjs/hooks/projects.d.ts +83 -0
- package/dist/commonjs/hooks/projects.js +62 -0
- package/dist/commonjs/index.d.ts +10 -9
- package/dist/commonjs/index.js +21 -21
- package/dist/commonjs/lib/react-query/client.d.ts +40 -9
- package/dist/commonjs/lib/react-query/client.js +32 -0
- package/dist/commonjs/lib/react-query/documents.d.ts +733 -650
- package/dist/commonjs/lib/react-query/documents.js +57 -0
- package/dist/commonjs/lib/react-query/invites.d.ts +63 -4
- package/dist/commonjs/lib/react-query/invites.js +63 -0
- package/dist/commonjs/lib/react-query/maps.d.ts +12 -3
- package/dist/commonjs/lib/react-query/maps.js +5 -1
- package/dist/commonjs/lib/react-query/projects.d.ts +183 -47
- package/dist/commonjs/lib/react-query/projects.js +88 -0
- package/dist/commonjs/lib/react-query/shared.d.ts +5 -1
- package/dist/commonjs/lib/react-query/shared.js +8 -1
- package/dist/esm/hooks/client.d.ts +21 -0
- package/dist/esm/hooks/client.js +20 -2
- package/dist/esm/hooks/documents.d.ts +59 -4
- package/dist/esm/hooks/documents.js +53 -2
- package/dist/esm/hooks/invites.d.ts +51 -0
- package/dist/esm/hooks/invites.js +44 -0
- package/dist/esm/hooks/projects.d.ts +83 -0
- package/dist/esm/hooks/projects.js +58 -2
- package/dist/esm/index.d.ts +10 -9
- package/dist/esm/index.js +10 -9
- package/dist/esm/lib/react-query/client.d.ts +40 -9
- package/dist/esm/lib/react-query/client.js +32 -2
- package/dist/esm/lib/react-query/documents.d.ts +733 -650
- package/dist/esm/lib/react-query/documents.js +56 -2
- package/dist/esm/lib/react-query/invites.d.ts +63 -4
- package/dist/esm/lib/react-query/invites.js +61 -2
- package/dist/esm/lib/react-query/maps.d.ts +12 -3
- package/dist/esm/lib/react-query/maps.js +5 -1
- package/dist/esm/lib/react-query/projects.d.ts +183 -47
- package/dist/esm/lib/react-query/projects.js +84 -2
- package/dist/esm/lib/react-query/shared.d.ts +5 -1
- package/dist/esm/lib/react-query/shared.js +7 -1
- package/docs/API.md +157 -258
- package/package.json +27 -28
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export declare const ROOT_QUERY_KEY = "@comapeo/core-react";
|
|
2
2
|
export declare function baseQueryOptions(): {
|
|
3
3
|
networkMode: "always";
|
|
4
|
-
retry:
|
|
4
|
+
retry: false;
|
|
5
|
+
};
|
|
6
|
+
export declare function baseMutationOptions(): {
|
|
7
|
+
networkMode: "always";
|
|
8
|
+
retry: false;
|
|
5
9
|
};
|
|
@@ -7,6 +7,12 @@ export const ROOT_QUERY_KEY = '@comapeo/core-react';
|
|
|
7
7
|
export function baseQueryOptions() {
|
|
8
8
|
return {
|
|
9
9
|
networkMode: 'always',
|
|
10
|
-
retry:
|
|
10
|
+
retry: false,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function baseMutationOptions() {
|
|
14
|
+
return {
|
|
15
|
+
networkMode: 'always',
|
|
16
|
+
retry: false,
|
|
11
17
|
};
|
|
12
18
|
}
|
package/docs/API.md
CHANGED
|
@@ -1,40 +1,11 @@
|
|
|
1
1
|
## Functions
|
|
2
2
|
|
|
3
3
|
- [ClientApiProvider](#clientapiprovider)
|
|
4
|
-
- [baseQueryOptions](#basequeryoptions)
|
|
5
|
-
- [getClientQueryKey](#getclientquerykey)
|
|
6
|
-
- [getDeviceInfoQueryKey](#getdeviceinfoquerykey)
|
|
7
|
-
- [getIsArchiveDeviceQueryKey](#getisarchivedevicequerykey)
|
|
8
|
-
- [deviceInfoQueryOptions](#deviceinfoqueryoptions)
|
|
9
|
-
- [isArchiveDeviceQueryOptions](#isarchivedevicequeryoptions)
|
|
10
4
|
- [useClientApi](#useclientapi)
|
|
11
5
|
- [useOwnDeviceInfo](#useowndeviceinfo)
|
|
12
6
|
- [useIsArchiveDevice](#useisarchivedevice)
|
|
13
|
-
- [
|
|
14
|
-
- [
|
|
15
|
-
- [getDocumentByDocIdQueryKey](#getdocumentbydocidquerykey)
|
|
16
|
-
- [getDocumentByVersionIdQueryKey](#getdocumentbyversionidquerykey)
|
|
17
|
-
- [documentsQueryOptions](#documentsqueryoptions)
|
|
18
|
-
- [documentByDocumentIdQueryOptions](#documentbydocumentidqueryoptions)
|
|
19
|
-
- [documentByVersionIdQueryOptions](#documentbyversionidqueryoptions)
|
|
20
|
-
- [getProjectsQueryKey](#getprojectsquerykey)
|
|
21
|
-
- [getProjectByIdQueryKey](#getprojectbyidquerykey)
|
|
22
|
-
- [getProjectSettingsQueryKey](#getprojectsettingsquerykey)
|
|
23
|
-
- [getProjectRoleQueryKey](#getprojectrolequerykey)
|
|
24
|
-
- [getMembersQueryKey](#getmembersquerykey)
|
|
25
|
-
- [getMemberByIdQueryKey](#getmemberbyidquerykey)
|
|
26
|
-
- [getIconUrlQueryKey](#geticonurlquerykey)
|
|
27
|
-
- [getDocumentCreatedByQueryKey](#getdocumentcreatedbyquerykey)
|
|
28
|
-
- [getAttachmentUrlQueryKey](#getattachmenturlquerykey)
|
|
29
|
-
- [projectsQueryOptions](#projectsqueryoptions)
|
|
30
|
-
- [projectByIdQueryOptions](#projectbyidqueryoptions)
|
|
31
|
-
- [projectSettingsQueryOptions](#projectsettingsqueryoptions)
|
|
32
|
-
- [projectMembersQueryOptions](#projectmembersqueryoptions)
|
|
33
|
-
- [projectMemberByIdQueryOptions](#projectmemberbyidqueryoptions)
|
|
34
|
-
- [projectOwnRoleQueryOptions](#projectownrolequeryoptions)
|
|
35
|
-
- [iconUrlQueryOptions](#iconurlqueryoptions)
|
|
36
|
-
- [documentCreatedByQueryOptions](#documentcreatedbyqueryoptions)
|
|
37
|
-
- [attachmentUrlQueryOptions](#attachmenturlqueryoptions)
|
|
7
|
+
- [useSetOwnDeviceInfo](#usesetowndeviceinfo)
|
|
8
|
+
- [useSetIsArchiveDevice](#usesetisarchivedevice)
|
|
38
9
|
- [useProjectSettings](#useprojectsettings)
|
|
39
10
|
- [useSingleProject](#usesingleproject)
|
|
40
11
|
- [useManyProjects](#usemanyprojects)
|
|
@@ -43,16 +14,23 @@
|
|
|
43
14
|
- [useIconUrl](#useiconurl)
|
|
44
15
|
- [useAttachmentUrl](#useattachmenturl)
|
|
45
16
|
- [useDocumentCreatedBy](#usedocumentcreatedby)
|
|
17
|
+
- [useAddServerPeer](#useaddserverpeer)
|
|
18
|
+
- [useCreateProject](#usecreateproject)
|
|
19
|
+
- [useLeaveProject](#useleaveproject)
|
|
20
|
+
- [useImportProjectConfig](#useimportprojectconfig)
|
|
21
|
+
- [useUpdateProjectSettings](#useupdateprojectsettings)
|
|
22
|
+
- [useCreateBlob](#usecreateblob)
|
|
46
23
|
- [useSingleDocByDocId](#usesingledocbydocid)
|
|
47
24
|
- [useSingleDocByVersionId](#usesingledocbyversionid)
|
|
48
25
|
- [useManyDocs](#usemanydocs)
|
|
49
|
-
- [
|
|
50
|
-
- [
|
|
51
|
-
- [
|
|
26
|
+
- [useCreateDocument](#usecreatedocument)
|
|
27
|
+
- [useUpdateDocument](#useupdatedocument)
|
|
28
|
+
- [useDeleteDocument](#usedeletedocument)
|
|
29
|
+
- [useAcceptInvite](#useacceptinvite)
|
|
30
|
+
- [useRejectInvite](#userejectinvite)
|
|
31
|
+
- [useSendInvite](#usesendinvite)
|
|
32
|
+
- [useRequestCancelInvite](#userequestcancelinvite)
|
|
52
33
|
- [useMapStyleUrl](#usemapstyleurl)
|
|
53
|
-
- [getInvitesQueryKey](#getinvitesquerykey)
|
|
54
|
-
- [getPendingInvitesQueryKey](#getpendinginvitesquerykey)
|
|
55
|
-
- [pendingInvitesQueryOptions](#pendinginvitesqueryoptions)
|
|
56
34
|
|
|
57
35
|
### ClientApiProvider
|
|
58
36
|
|
|
@@ -68,42 +46,6 @@ Parameters:
|
|
|
68
46
|
* `opts.clientApi`: Client API instance
|
|
69
47
|
|
|
70
48
|
|
|
71
|
-
### baseQueryOptions
|
|
72
|
-
|
|
73
|
-
| Function | Type |
|
|
74
|
-
| ---------- | ---------- |
|
|
75
|
-
| `baseQueryOptions` | `() => { networkMode: "always"; retry: number; }` |
|
|
76
|
-
|
|
77
|
-
### getClientQueryKey
|
|
78
|
-
|
|
79
|
-
| Function | Type |
|
|
80
|
-
| ---------- | ---------- |
|
|
81
|
-
| `getClientQueryKey` | `() => readonly ["@comapeo/core-react", "client"]` |
|
|
82
|
-
|
|
83
|
-
### getDeviceInfoQueryKey
|
|
84
|
-
|
|
85
|
-
| Function | Type |
|
|
86
|
-
| ---------- | ---------- |
|
|
87
|
-
| `getDeviceInfoQueryKey` | `() => readonly ["@comapeo/core-react", "client", "device_info"]` |
|
|
88
|
-
|
|
89
|
-
### getIsArchiveDeviceQueryKey
|
|
90
|
-
|
|
91
|
-
| Function | Type |
|
|
92
|
-
| ---------- | ---------- |
|
|
93
|
-
| `getIsArchiveDeviceQueryKey` | `() => readonly ["@comapeo/core-react", "client", "is_archive_device"]` |
|
|
94
|
-
|
|
95
|
-
### deviceInfoQueryOptions
|
|
96
|
-
|
|
97
|
-
| Function | Type |
|
|
98
|
-
| ---------- | ---------- |
|
|
99
|
-
| `deviceInfoQueryOptions` | `({ clientApi, }: { clientApi: MapeoClientApi; }) => OmitKeyof<UseQueryOptions<{ deviceId: string; deviceType: "device_type_unspecified" or "mobile" or "tablet" or "desktop" or "selfHostedServer" or "UNRECOGNIZED"; } and Partial<...>, Error, { ...; } and Partial<...>, QueryKey>, "queryFn"> and { ...; } and { ...; }` |
|
|
100
|
-
|
|
101
|
-
### isArchiveDeviceQueryOptions
|
|
102
|
-
|
|
103
|
-
| Function | Type |
|
|
104
|
-
| ---------- | ---------- |
|
|
105
|
-
| `isArchiveDeviceQueryOptions` | `({ clientApi, }: { clientApi: MapeoClientApi; }) => OmitKeyof<UseQueryOptions<boolean, Error, boolean, QueryKey>, "queryFn"> and { ...; } and { ...; }` |
|
|
106
|
-
|
|
107
49
|
### useClientApi
|
|
108
50
|
|
|
109
51
|
Access a client API instance. If a ClientApiContext provider is not
|
|
@@ -167,155 +109,21 @@ function IsArchiveDeviceExample() {
|
|
|
167
109
|
```
|
|
168
110
|
|
|
169
111
|
|
|
170
|
-
###
|
|
171
|
-
|
|
172
|
-
| Function | Type |
|
|
173
|
-
| ---------- | ---------- |
|
|
174
|
-
| `getDocumentsQueryKey` | `<D extends DocumentType>({ projectId, docType, }: { projectId: string; docType: D; }) => readonly ["@comapeo/core-react", "projects", string, D]` |
|
|
175
|
-
|
|
176
|
-
### getManyDocumentsQueryKey
|
|
177
|
-
|
|
178
|
-
| Function | Type |
|
|
179
|
-
| ---------- | ---------- |
|
|
180
|
-
| `getManyDocumentsQueryKey` | `<D extends DocumentType>({ projectId, docType, includeDeleted, lang, }: { projectId: string; docType: D; includeDeleted?: boolean or undefined; lang?: string or undefined; }) => readonly ["@comapeo/core-react", "projects", string, D, { ...; }]` |
|
|
181
|
-
|
|
182
|
-
### getDocumentByDocIdQueryKey
|
|
183
|
-
|
|
184
|
-
| Function | Type |
|
|
185
|
-
| ---------- | ---------- |
|
|
186
|
-
| `getDocumentByDocIdQueryKey` | `<D extends DocumentType>({ projectId, docType, docId, lang, }: { projectId: string; docType: D; docId: string; lang?: string or undefined; }) => readonly ["@comapeo/core-react", "projects", string, D, string, { readonly lang: string or undefined; }]` |
|
|
187
|
-
|
|
188
|
-
### getDocumentByVersionIdQueryKey
|
|
189
|
-
|
|
190
|
-
| Function | Type |
|
|
191
|
-
| ---------- | ---------- |
|
|
192
|
-
| `getDocumentByVersionIdQueryKey` | `<D extends DocumentType>({ projectId, docType, versionId, lang, }: { projectId: string; docType: D; versionId: string; lang?: string or undefined; }) => readonly ["@comapeo/core-react", "projects", string, D, string, { readonly lang: string or undefined; }]` |
|
|
193
|
-
|
|
194
|
-
### documentsQueryOptions
|
|
195
|
-
|
|
196
|
-
| Function | Type |
|
|
197
|
-
| ---------- | ---------- |
|
|
198
|
-
| `documentsQueryOptions` | `<D extends DocumentType>({ projectApi, projectId, docType, includeDeleted, lang, }: { projectApi: ClientApi<MapeoProject>; projectId: string; docType: D; includeDeleted?: boolean or undefined; lang?: string or undefined; }) => OmitKeyof<...> and ... 1 more ... and { ...; }` |
|
|
199
|
-
|
|
200
|
-
### documentByDocumentIdQueryOptions
|
|
201
|
-
|
|
202
|
-
| Function | Type |
|
|
203
|
-
| ---------- | ---------- |
|
|
204
|
-
| `documentByDocumentIdQueryOptions` | `<D extends DocumentType>({ projectApi, projectId, docType, docId, lang, }: { projectApi: ClientApi<MapeoProject>; projectId: string; docType: D; docId: string; lang?: string or undefined; }) => OmitKeyof<UseQueryOptions<({ schemaName: "track"; ... 9 more ...; deleted: boolean; } and { ...; }) or ({ ...; } and { ...; }) or ...` |
|
|
205
|
-
|
|
206
|
-
### documentByVersionIdQueryOptions
|
|
207
|
-
|
|
208
|
-
| Function | Type |
|
|
209
|
-
| ---------- | ---------- |
|
|
210
|
-
| `documentByVersionIdQueryOptions` | `<D extends DocumentType>({ projectApi, projectId, docType, versionId, lang, }: { projectApi: ClientApi<MapeoProject>; projectId: string; docType: D; versionId: string; lang?: string or undefined; }) => OmitKeyof<UseQueryOptions<{ schemaName: "track"; ... 9 more ...; deleted: boolean; } or { ...; } or { ...; } or { ...; ...` |
|
|
211
|
-
|
|
212
|
-
### getProjectsQueryKey
|
|
213
|
-
|
|
214
|
-
| Function | Type |
|
|
215
|
-
| ---------- | ---------- |
|
|
216
|
-
| `getProjectsQueryKey` | `() => readonly ["@comapeo/core-react", "projects"]` |
|
|
217
|
-
|
|
218
|
-
### getProjectByIdQueryKey
|
|
219
|
-
|
|
220
|
-
| Function | Type |
|
|
221
|
-
| ---------- | ---------- |
|
|
222
|
-
| `getProjectByIdQueryKey` | `({ projectId }: { projectId: string; }) => readonly ["@comapeo/core-react", "projects", string]` |
|
|
223
|
-
|
|
224
|
-
### getProjectSettingsQueryKey
|
|
225
|
-
|
|
226
|
-
| Function | Type |
|
|
227
|
-
| ---------- | ---------- |
|
|
228
|
-
| `getProjectSettingsQueryKey` | `({ projectId, }: { projectId: string; }) => readonly ["@comapeo/core-react", "projects", string, "project_settings"]` |
|
|
229
|
-
|
|
230
|
-
### getProjectRoleQueryKey
|
|
231
|
-
|
|
232
|
-
| Function | Type |
|
|
233
|
-
| ---------- | ---------- |
|
|
234
|
-
| `getProjectRoleQueryKey` | `({ projectId }: { projectId: string; }) => readonly ["@comapeo/core-react", "projects", string, "role"]` |
|
|
235
|
-
|
|
236
|
-
### getMembersQueryKey
|
|
237
|
-
|
|
238
|
-
| Function | Type |
|
|
239
|
-
| ---------- | ---------- |
|
|
240
|
-
| `getMembersQueryKey` | `({ projectId }: { projectId: string; }) => readonly ["@comapeo/core-react", "projects", string, "members"]` |
|
|
241
|
-
|
|
242
|
-
### getMemberByIdQueryKey
|
|
243
|
-
|
|
244
|
-
| Function | Type |
|
|
245
|
-
| ---------- | ---------- |
|
|
246
|
-
| `getMemberByIdQueryKey` | `({ projectId, deviceId, }: { projectId: string; deviceId: string; }) => readonly ["@comapeo/core-react", "projects", string, "members", string]` |
|
|
247
|
-
|
|
248
|
-
### getIconUrlQueryKey
|
|
249
|
-
|
|
250
|
-
| Function | Type |
|
|
251
|
-
| ---------- | ---------- |
|
|
252
|
-
| `getIconUrlQueryKey` | `({ projectId, iconId, ...mimeBasedOpts }: { projectId: string; iconId: string; } and (BitmapOpts or SvgOpts)) => readonly ["@comapeo/core-react", "projects", string, "icons", string, { mimeType: "image/png"; pixelDensity: 2 or ... 1 more ... or 1; size: ValidSizes; } or { ...; }]` |
|
|
253
|
-
|
|
254
|
-
### getDocumentCreatedByQueryKey
|
|
255
|
-
|
|
256
|
-
| Function | Type |
|
|
257
|
-
| ---------- | ---------- |
|
|
258
|
-
| `getDocumentCreatedByQueryKey` | `({ projectId, originalVersionId, }: { projectId: string; originalVersionId: string; }) => readonly ["@comapeo/core-react", "projects", string, "document_created_by", string]` |
|
|
259
|
-
|
|
260
|
-
### getAttachmentUrlQueryKey
|
|
261
|
-
|
|
262
|
-
| Function | Type |
|
|
263
|
-
| ---------- | ---------- |
|
|
264
|
-
| `getAttachmentUrlQueryKey` | `({ projectId, blobId, }: { projectId: string; blobId: BlobId; }) => readonly ["@comapeo/core-react", "projects", string, "attachments", BlobId]` |
|
|
265
|
-
|
|
266
|
-
### projectsQueryOptions
|
|
267
|
-
|
|
268
|
-
| Function | Type |
|
|
269
|
-
| ---------- | ---------- |
|
|
270
|
-
| `projectsQueryOptions` | `({ clientApi, }: { clientApi: MapeoClientApi; }) => OmitKeyof<UseQueryOptions<(Pick<{ schemaName: "projectSettings"; name?: string or undefined; defaultPresets?: { point: string[]; area: string[]; vertex: string[]; line: string[]; relation: string[]; } or undefined; configMetadata?: { ...; } or undefined; }, "name"> and ...` |
|
|
271
|
-
|
|
272
|
-
### projectByIdQueryOptions
|
|
273
|
-
|
|
274
|
-
| Function | Type |
|
|
275
|
-
| ---------- | ---------- |
|
|
276
|
-
| `projectByIdQueryOptions` | `({ clientApi, projectId, }: { clientApi: MapeoClientApi; projectId: string; }) => OmitKeyof<UseQueryOptions<ClientApi<MapeoProject>, Error, ClientApi<MapeoProject>, QueryKey>, "queryFn"> and { ...; } and { ...; }` |
|
|
277
|
-
|
|
278
|
-
### projectSettingsQueryOptions
|
|
279
|
-
|
|
280
|
-
| Function | Type |
|
|
281
|
-
| ---------- | ---------- |
|
|
282
|
-
| `projectSettingsQueryOptions` | `({ projectApi, projectId, }: { projectApi: ClientApi<MapeoProject>; projectId: string; }) => OmitKeyof<UseQueryOptions<EditableProjectSettings, Error, EditableProjectSettings, QueryKey>, "queryFn"> and { ...; } and { ...; }` |
|
|
283
|
-
|
|
284
|
-
### projectMembersQueryOptions
|
|
285
|
-
|
|
286
|
-
| Function | Type |
|
|
287
|
-
| ---------- | ---------- |
|
|
288
|
-
| `projectMembersQueryOptions` | `({ projectApi, projectId, }: { projectApi: ClientApi<MapeoProject>; projectId: string; }) => OmitKeyof<UseQueryOptions<MemberInfo[], Error, MemberInfo[], QueryKey>, "queryFn"> and { ...; } and { ...; }` |
|
|
289
|
-
|
|
290
|
-
### projectMemberByIdQueryOptions
|
|
291
|
-
|
|
292
|
-
| Function | Type |
|
|
293
|
-
| ---------- | ---------- |
|
|
294
|
-
| `projectMemberByIdQueryOptions` | `({ projectApi, projectId, deviceId, }: { projectApi: ClientApi<MapeoProject>; projectId: string; deviceId: string; }) => OmitKeyof<UseQueryOptions<MemberInfo, Error, MemberInfo, QueryKey>, "queryFn"> and { ...; } and { ...; }` |
|
|
295
|
-
|
|
296
|
-
### projectOwnRoleQueryOptions
|
|
297
|
-
|
|
298
|
-
| Function | Type |
|
|
299
|
-
| ---------- | ---------- |
|
|
300
|
-
| `projectOwnRoleQueryOptions` | `({ projectApi, projectId, }: { projectApi: ClientApi<MapeoProject>; projectId: string; }) => OmitKeyof<UseQueryOptions<Role<"a12a6702b93bd7ff" or "f7c150f5a3a9a855" or "012fd2d431c0bf60" or "9e6d29263cba36c9" or "8ced989b1904606b" or "08e4251e36f6e7ed">, Error, Role<...>, QueryKey>, "queryFn"> and { ...; } and { ...; }` |
|
|
112
|
+
### useSetOwnDeviceInfo
|
|
301
113
|
|
|
302
|
-
|
|
114
|
+
Update the device info for the current device.
|
|
303
115
|
|
|
304
116
|
| Function | Type |
|
|
305
117
|
| ---------- | ---------- |
|
|
306
|
-
| `
|
|
307
|
-
|
|
308
|
-
### documentCreatedByQueryOptions
|
|
118
|
+
| `useSetOwnDeviceInfo` | `() => { mutate: UseMutateFunction<void, Error, { name: string; deviceType: "device_type_unspecified" or "mobile" or "tablet" or "desktop" or "selfHostedServer" or "UNRECOGNIZED"; }, unknown>; reset: () => void; status: "pending" or ... 2 more ... or "idle"; }` |
|
|
309
119
|
|
|
310
|
-
|
|
311
|
-
| ---------- | ---------- |
|
|
312
|
-
| `documentCreatedByQueryOptions` | `({ projectApi, projectId, originalVersionId, }: { projectApi: ClientApi<MapeoProject>; projectId: string; originalVersionId: string; }) => OmitKeyof<UseQueryOptions<string, Error, string, QueryKey>, "queryFn"> and { ...; } and { ...; }` |
|
|
120
|
+
### useSetIsArchiveDevice
|
|
313
121
|
|
|
314
|
-
|
|
122
|
+
Set or unset the current device as an archive device.
|
|
315
123
|
|
|
316
124
|
| Function | Type |
|
|
317
125
|
| ---------- | ---------- |
|
|
318
|
-
| `
|
|
126
|
+
| `useSetIsArchiveDevice` | `() => { mutate: UseMutateFunction<void, Error, { isArchiveDevice: boolean; }, unknown>; reset: () => void; status: "pending" or "error" or "success" or "idle"; }` |
|
|
319
127
|
|
|
320
128
|
### useProjectSettings
|
|
321
129
|
|
|
@@ -565,6 +373,67 @@ function BasicExample() {
|
|
|
565
373
|
```
|
|
566
374
|
|
|
567
375
|
|
|
376
|
+
### useAddServerPeer
|
|
377
|
+
|
|
378
|
+
| Function | Type |
|
|
379
|
+
| ---------- | ---------- |
|
|
380
|
+
| `useAddServerPeer` | `({ projectId }: { projectId: string; }) => { mutate: UseMutateFunction<void, Error, { baseUrl: string; dangerouslyAllowInsecureConnections?: boolean or undefined; }, unknown>; reset: () => void; status: "pending" or ... 2 more ... or "idle"; }` |
|
|
381
|
+
|
|
382
|
+
### useCreateProject
|
|
383
|
+
|
|
384
|
+
Create a new project.
|
|
385
|
+
|
|
386
|
+
| Function | Type |
|
|
387
|
+
| ---------- | ---------- |
|
|
388
|
+
| `useCreateProject` | `() => { mutate: UseMutateFunction<string, Error, { name?: string or undefined; configPath?: string or undefined; } or undefined, unknown>; reset: () => void; status: "pending" or ... 2 more ... or "idle"; }` |
|
|
389
|
+
|
|
390
|
+
### useLeaveProject
|
|
391
|
+
|
|
392
|
+
Leave an existing project.
|
|
393
|
+
|
|
394
|
+
| Function | Type |
|
|
395
|
+
| ---------- | ---------- |
|
|
396
|
+
| `useLeaveProject` | `() => { mutate: UseMutateFunction<void, Error, { projectId: string; }, unknown>; reset: () => void; status: "pending" or "error" or "success" or "idle"; }` |
|
|
397
|
+
|
|
398
|
+
### useImportProjectConfig
|
|
399
|
+
|
|
400
|
+
Update the configuration of a project using an external file.
|
|
401
|
+
|
|
402
|
+
| Function | Type |
|
|
403
|
+
| ---------- | ---------- |
|
|
404
|
+
| `useImportProjectConfig` | `({ projectId }: { projectId: string; }) => { mutate: UseMutateFunction<Error[], Error, { configPath: string; }, unknown>; reset: () => void; status: "pending" or "error" or "success" or "idle"; }` |
|
|
405
|
+
|
|
406
|
+
Parameters:
|
|
407
|
+
|
|
408
|
+
* `opts.projectId`: Public ID of the project to apply changes to.
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
### useUpdateProjectSettings
|
|
412
|
+
|
|
413
|
+
Update the settings of a project.
|
|
414
|
+
|
|
415
|
+
| Function | Type |
|
|
416
|
+
| ---------- | ---------- |
|
|
417
|
+
| `useUpdateProjectSettings` | `({ projectId }: { projectId: string; }) => { mutate: UseMutateFunction<EditableProjectSettings, Error, { name?: string or undefined; configMetadata?: { name: string; buildDate: string; importDate: string; fileVersion: string; } or undefined; defaultPresets?: { ...; } or undefined; }, unknown>; reset: () => void; status...` |
|
|
418
|
+
|
|
419
|
+
Parameters:
|
|
420
|
+
|
|
421
|
+
* `opts.projectId`: Public ID of the project to apply changes to.
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
### useCreateBlob
|
|
425
|
+
|
|
426
|
+
Create a blob for a project.
|
|
427
|
+
|
|
428
|
+
| Function | Type |
|
|
429
|
+
| ---------- | ---------- |
|
|
430
|
+
| `useCreateBlob` | `({ projectId }: { projectId: string; }) => { mutate: UseMutateFunction<{ driveId: string; name: string; type: "audio" or "video" or "photo"; hash: string; }, Error, { original: string; preview?: string or undefined; thumbnail?: string or undefined; metadata: Metadata; }, unknown>; reset: () => void; status: "pending" or ...` |
|
|
431
|
+
|
|
432
|
+
Parameters:
|
|
433
|
+
|
|
434
|
+
* `opts.projectId`: Public project ID of project to apply to changes to.
|
|
435
|
+
|
|
436
|
+
|
|
568
437
|
### useSingleDocByDocId
|
|
569
438
|
|
|
570
439
|
Retrieve a single document from the database based on the document's document ID.
|
|
@@ -573,7 +442,7 @@ Triggers the closest error boundary if the document cannot be found
|
|
|
573
442
|
|
|
574
443
|
| Function | Type |
|
|
575
444
|
| ---------- | ---------- |
|
|
576
|
-
| `useSingleDocByDocId` | `<D extends
|
|
445
|
+
| `useSingleDocByDocId` | `<D extends WriteableDocumentType>({ projectId, docType, docId, lang, }: { projectId: string; docType: D; docId: string; lang?: string or undefined; }) => ReadHookResult<Extract<{ schemaName: "deviceInfo"; name: string; deviceType: "device_type_unspecified" or ... 4 more ... or "UNRECOGNIZED"; ... 7 more ...; deleted: b...` |
|
|
577
446
|
|
|
578
447
|
Parameters:
|
|
579
448
|
|
|
@@ -606,7 +475,7 @@ Triggers the closest error boundary if the document cannot be found.
|
|
|
606
475
|
|
|
607
476
|
| Function | Type |
|
|
608
477
|
| ---------- | ---------- |
|
|
609
|
-
| `useSingleDocByVersionId` | `<D extends
|
|
478
|
+
| `useSingleDocByVersionId` | `<D extends WriteableDocumentType>({ projectId, docType, versionId, lang, }: { projectId: string; docType: D; versionId: string; lang?: string or undefined; }) => ReadHookResult<Extract<{ schemaName: "deviceInfo"; name: string; deviceType: "device_type_unspecified" or ... 4 more ... or "UNRECOGNIZED"; ... 7 more ...; de...` |
|
|
610
479
|
|
|
611
480
|
Parameters:
|
|
612
481
|
|
|
@@ -639,7 +508,7 @@ Retrieve all documents of a specific `docType`.
|
|
|
639
508
|
|
|
640
509
|
| Function | Type |
|
|
641
510
|
| ---------- | ---------- |
|
|
642
|
-
| `useManyDocs` | `<D extends
|
|
511
|
+
| `useManyDocs` | `<D extends WriteableDocumentType>({ projectId, docType, includeDeleted, lang, }: { projectId: string; docType: D; includeDeleted?: boolean or undefined; lang?: string or undefined; }) => ReadHookResult<Extract<{ schemaName: "deviceInfo"; name: string; deviceType: "device_type_unspecified" or ... 4 more ... or "UNRECOGNI...` |
|
|
643
512
|
|
|
644
513
|
Parameters:
|
|
645
514
|
|
|
@@ -677,23 +546,89 @@ function useAllPresets(opts) {
|
|
|
677
546
|
```
|
|
678
547
|
|
|
679
548
|
|
|
680
|
-
###
|
|
549
|
+
### useCreateDocument
|
|
550
|
+
|
|
551
|
+
Create a document for a project.
|
|
552
|
+
|
|
553
|
+
| Function | Type |
|
|
554
|
+
| ---------- | ---------- |
|
|
555
|
+
| `useCreateDocument` | `<D extends WriteableDocumentType>({ docType, projectId, }: { docType: D; projectId: string; }) => { mutate: UseMutateFunction<WriteableDocument<D> and { forks: string[]; }, Error, { value: Omit<WriteableValue<D>, "schemaName">; }, unknown>; reset: () => void; status: "pending" or ... 2 more ... or "idle"; }` |
|
|
556
|
+
|
|
557
|
+
Parameters:
|
|
558
|
+
|
|
559
|
+
* `opts.docType`: Document type to create.
|
|
560
|
+
* `opts.projectId`: Public ID of project to create document for.
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
### useUpdateDocument
|
|
564
|
+
|
|
565
|
+
Update a document within a project.
|
|
681
566
|
|
|
682
567
|
| Function | Type |
|
|
683
568
|
| ---------- | ---------- |
|
|
684
|
-
| `
|
|
569
|
+
| `useUpdateDocument` | `<D extends WriteableDocumentType>({ docType, projectId, }: { docType: D; projectId: string; }) => { mutate: UseMutateFunction<WriteableDocument<D> and { forks: string[]; }, Error, { versionId: string; value: Omit<...>; }, unknown>; reset: () => void; status: "pending" or ... 2 more ... or "idle"; }` |
|
|
685
570
|
|
|
686
|
-
|
|
571
|
+
Parameters:
|
|
572
|
+
|
|
573
|
+
* `opts.docType`: Document type to update.
|
|
574
|
+
* `opts.projectId`: Public ID of project document belongs to.
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
### useDeleteDocument
|
|
578
|
+
|
|
579
|
+
Delete a document within a project.
|
|
580
|
+
|
|
581
|
+
| Function | Type |
|
|
582
|
+
| ---------- | ---------- |
|
|
583
|
+
| `useDeleteDocument` | `<D extends WriteableDocumentType>({ docType, projectId, }: { docType: D; projectId: string; }) => { mutate: UseMutateFunction<WriteableDocument<D> and { forks: string[]; }, Error, { docId: string; }, unknown>; reset: () => void; status: "pending" or ... 2 more ... or "idle"; }` |
|
|
584
|
+
|
|
585
|
+
Parameters:
|
|
586
|
+
|
|
587
|
+
* `opts.docType`: Document type to delete.
|
|
588
|
+
* `opts.projectId`: Public ID of project document belongs to.
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
### useAcceptInvite
|
|
592
|
+
|
|
593
|
+
Accept an invite that has been received.
|
|
687
594
|
|
|
688
595
|
| Function | Type |
|
|
689
596
|
| ---------- | ---------- |
|
|
690
|
-
| `
|
|
597
|
+
| `useAcceptInvite` | `() => { mutate: UseMutateFunction<string, Error, { inviteId: string; }, unknown>; reset: () => void; status: "pending" or "error" or "success" or "idle"; }` |
|
|
691
598
|
|
|
692
|
-
###
|
|
599
|
+
### useRejectInvite
|
|
600
|
+
|
|
601
|
+
Reject an invite that has been received.
|
|
693
602
|
|
|
694
603
|
| Function | Type |
|
|
695
604
|
| ---------- | ---------- |
|
|
696
|
-
| `
|
|
605
|
+
| `useRejectInvite` | `() => { mutate: UseMutateFunction<void, Error, { inviteId: string; }, unknown>; reset: () => void; status: "pending" or "error" or "success" or "idle"; }` |
|
|
606
|
+
|
|
607
|
+
### useSendInvite
|
|
608
|
+
|
|
609
|
+
Send an invite for a project.
|
|
610
|
+
|
|
611
|
+
| Function | Type |
|
|
612
|
+
| ---------- | ---------- |
|
|
613
|
+
| `useSendInvite` | `({ projectId }: { projectId: string; }) => { mutate: UseMutateFunction<"ACCEPT" or "REJECT" or "ALREADY", Error, { deviceId: string; roleDescription?: string or undefined; roleId: "f7c150f5a3a9a855" or "012fd2d431c0bf60" or "9e6d29263cba36c9"; roleName?: string or undefined; }, unknown>; reset: () => void; status: "pendin...` |
|
|
614
|
+
|
|
615
|
+
Parameters:
|
|
616
|
+
|
|
617
|
+
* `opts.projectId`: Public ID of project to send the invite on behalf of.
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
### useRequestCancelInvite
|
|
621
|
+
|
|
622
|
+
Request a cancellation of an invite sent to another device.
|
|
623
|
+
|
|
624
|
+
| Function | Type |
|
|
625
|
+
| ---------- | ---------- |
|
|
626
|
+
| `useRequestCancelInvite` | `({ projectId }: { projectId: string; }) => { mutate: UseMutateFunction<void, Error, { deviceId: string; }, unknown>; reset: () => void; status: "pending" or "error" or "success" or "idle"; }` |
|
|
627
|
+
|
|
628
|
+
Parameters:
|
|
629
|
+
|
|
630
|
+
* `opts.projectId`: Public ID of project to request the invite cancellation for.
|
|
631
|
+
|
|
697
632
|
|
|
698
633
|
### useMapStyleUrl
|
|
699
634
|
|
|
@@ -731,29 +666,10 @@ function ExampleWithRefreshToken() {
|
|
|
731
666
|
```
|
|
732
667
|
|
|
733
668
|
|
|
734
|
-
### getInvitesQueryKey
|
|
735
|
-
|
|
736
|
-
| Function | Type |
|
|
737
|
-
| ---------- | ---------- |
|
|
738
|
-
| `getInvitesQueryKey` | `() => readonly ["@comapeo/core-react", "invites"]` |
|
|
739
|
-
|
|
740
|
-
### getPendingInvitesQueryKey
|
|
741
|
-
|
|
742
|
-
| Function | Type |
|
|
743
|
-
| ---------- | ---------- |
|
|
744
|
-
| `getPendingInvitesQueryKey` | `() => readonly ["@comapeo/core-react", "invites", { readonly status: "pending"; }]` |
|
|
745
|
-
|
|
746
|
-
### pendingInvitesQueryOptions
|
|
747
|
-
|
|
748
|
-
| Function | Type |
|
|
749
|
-
| ---------- | ---------- |
|
|
750
|
-
| `pendingInvitesQueryOptions` | `({ clientApi, }: { clientApi: MapeoClientApi; }) => OmitKeyof<UseQueryOptions<MapBuffers<InviteInternal>[], Error, MapBuffers<InviteInternal>[], QueryKey>, "queryFn"> and { ...; } and { ...; }` |
|
|
751
|
-
|
|
752
669
|
|
|
753
670
|
## Constants
|
|
754
671
|
|
|
755
672
|
- [ClientApiContext](#clientapicontext)
|
|
756
|
-
- [ROOT_QUERY_KEY](#root_query_key)
|
|
757
673
|
|
|
758
674
|
### ClientApiContext
|
|
759
675
|
|
|
@@ -761,21 +677,4 @@ function ExampleWithRefreshToken() {
|
|
|
761
677
|
| ---------- | ---------- |
|
|
762
678
|
| `ClientApiContext` | `Context<MapeoClientApi or null>` |
|
|
763
679
|
|
|
764
|
-
### ROOT_QUERY_KEY
|
|
765
|
-
|
|
766
|
-
| Constant | Type |
|
|
767
|
-
| ---------- | ---------- |
|
|
768
|
-
| `ROOT_QUERY_KEY` | `"@comapeo/core-react"` |
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
## Types
|
|
773
|
-
|
|
774
|
-
- [DocumentType](#documenttype)
|
|
775
|
-
|
|
776
|
-
### DocumentType
|
|
777
|
-
|
|
778
|
-
| Type | Type |
|
|
779
|
-
| ---------- | ---------- |
|
|
780
|
-
| `DocumentType` | `Extract< MapeoDoc['schemaName'], 'field' or 'observation' or 'preset' or 'track' or 'remoteDetectionAlert' >` |
|
|
781
680
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comapeo/core-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "React wrapper for working with @comapeo/core",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"types": "tsc",
|
|
58
58
|
"test:unit": "vitest run",
|
|
59
59
|
"test": "npm-run-all --parallel --continue-on-error --print-label --aggregate-output types test:*",
|
|
60
|
-
"docs:generate": "tsdoc --src=src/contexts/*,src/hooks
|
|
60
|
+
"docs:generate": "tsdoc --src=src/contexts/*,src/hooks/* --dest=docs/API.md --noemoji --types"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@comapeo/core": "*",
|
|
@@ -67,31 +67,30 @@
|
|
|
67
67
|
"react": "^18 || ^19"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@eslint/compat": "
|
|
71
|
-
"@eslint/js": "
|
|
72
|
-
"@ianvs/prettier-plugin-sort-imports": "
|
|
73
|
-
"@mapeo/crypto": "
|
|
74
|
-
"@tanstack/eslint-plugin-query": "
|
|
75
|
-
"@testing-library/dom": "
|
|
76
|
-
"@testing-library/react": "
|
|
77
|
-
"@types/lint-staged": "
|
|
78
|
-
"@types/node": "
|
|
79
|
-
"@types/react": "
|
|
80
|
-
"@types/react-dom": "
|
|
81
|
-
"commit-and-tag-version": "
|
|
82
|
-
"eslint": "
|
|
83
|
-
"fastify": "
|
|
84
|
-
"globals": "
|
|
85
|
-
"husky": "
|
|
86
|
-
"lint-staged": "
|
|
87
|
-
"npm-run-all2": "
|
|
88
|
-
"prettier": "
|
|
89
|
-
"random-access-memory": "
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"typescript": "
|
|
94
|
-
"
|
|
95
|
-
"vitest": "^2.1.8"
|
|
70
|
+
"@eslint/compat": "1.2.5",
|
|
71
|
+
"@eslint/js": "9.18.0",
|
|
72
|
+
"@ianvs/prettier-plugin-sort-imports": "4.4.1",
|
|
73
|
+
"@mapeo/crypto": "1.0.0-alpha.10",
|
|
74
|
+
"@tanstack/eslint-plugin-query": "5.62.16",
|
|
75
|
+
"@testing-library/dom": "10.4.0",
|
|
76
|
+
"@testing-library/react": "16.1.0",
|
|
77
|
+
"@types/lint-staged": "13.3.0",
|
|
78
|
+
"@types/node": "22.10.5",
|
|
79
|
+
"@types/react": "19.0.6",
|
|
80
|
+
"@types/react-dom": "19.0.3",
|
|
81
|
+
"commit-and-tag-version": "12.5.0",
|
|
82
|
+
"eslint": "9.18.0",
|
|
83
|
+
"fastify": "4.29.0",
|
|
84
|
+
"globals": "15.14.0",
|
|
85
|
+
"husky": "9.1.7",
|
|
86
|
+
"lint-staged": "15.3.0",
|
|
87
|
+
"npm-run-all2": "7.0.2",
|
|
88
|
+
"prettier": "3.4.2",
|
|
89
|
+
"random-access-memory": "6.2.1",
|
|
90
|
+
"tsdoc-markdown": "1.1.0",
|
|
91
|
+
"tshy": "3.0.2",
|
|
92
|
+
"typescript": "5.7.3",
|
|
93
|
+
"typescript-eslint": "8.19.1",
|
|
94
|
+
"vitest": "2.1.8"
|
|
96
95
|
}
|
|
97
96
|
}
|