@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMutation, useQueryClient, useSuspenseQuery, } from '@tanstack/react-query';
|
|
2
2
|
import { useSyncExternalStore } from 'react';
|
|
3
|
-
import { addServerPeerMutationOptions, attachmentUrlQueryOptions, createBlobMutationOptions, createProjectMutationOptions, documentCreatedByQueryOptions, iconUrlQueryOptions, importProjectConfigMutationOptions, leaveProjectMutationOptions, projectByIdQueryOptions, projectMemberByIdQueryOptions, projectMembersQueryOptions, projectSettingsQueryOptions, projectsQueryOptions, startSyncMutationOptions, stopSyncMutationOptions, updateProjectSettingsMutationOptions, } from '../lib/react-query/projects.js';
|
|
3
|
+
import { addServerPeerMutationOptions, attachmentUrlQueryOptions, createBlobMutationOptions, createProjectMutationOptions, documentCreatedByQueryOptions, iconUrlQueryOptions, importProjectConfigMutationOptions, leaveProjectMutationOptions, projectByIdQueryOptions, projectMemberByIdQueryOptions, projectMembersQueryOptions, projectOwnRoleQueryOptions, projectSettingsQueryOptions, projectsQueryOptions, startSyncMutationOptions, stopSyncMutationOptions, updateProjectSettingsMutationOptions, } from '../lib/react-query/projects.js';
|
|
4
4
|
import { SyncStore } from '../lib/sync.js';
|
|
5
5
|
import { useClientApi } from './client.js';
|
|
6
6
|
/**
|
|
@@ -248,11 +248,33 @@ export function useDocumentCreatedBy({ projectId, originalVersionId, }) {
|
|
|
248
248
|
const { data, error, isRefetching } = useSuspenseQuery(documentCreatedByQueryOptions({ projectApi, projectId, originalVersionId }));
|
|
249
249
|
return { data, error, isRefetching };
|
|
250
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Get the role for the current device in a specified project.
|
|
253
|
+
* This is a more convenient alternative to using the `useOwnDeviceInfo` and `useManyMembers` hooks.
|
|
254
|
+
*
|
|
255
|
+
* @param opts.projectId Project public ID
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```tsx
|
|
259
|
+
* function BasicExample() {
|
|
260
|
+
* const { data } = useOwnRoleInProject({
|
|
261
|
+
* projectId: '...',
|
|
262
|
+
* })
|
|
263
|
+
* }
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
export function useOwnRoleInProject({ projectId }) {
|
|
267
|
+
const { data: projectApi } = useSingleProject({ projectId });
|
|
268
|
+
const { data, error, isRefetching } = useSuspenseQuery(projectOwnRoleQueryOptions({ projectApi, projectId }));
|
|
269
|
+
return { data, error, isRefetching };
|
|
270
|
+
}
|
|
251
271
|
export function useAddServerPeer({ projectId }) {
|
|
252
272
|
const queryClient = useQueryClient();
|
|
253
273
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
254
|
-
const { mutate, reset, status } = useMutation(addServerPeerMutationOptions({ projectApi, projectId, queryClient }));
|
|
255
|
-
return
|
|
274
|
+
const { error, mutate, reset, status } = useMutation(addServerPeerMutationOptions({ projectApi, projectId, queryClient }));
|
|
275
|
+
return status === 'error'
|
|
276
|
+
? { error, mutate, reset, status }
|
|
277
|
+
: { error: null, mutate, reset, status };
|
|
256
278
|
}
|
|
257
279
|
/**
|
|
258
280
|
* Create a new project.
|
|
@@ -260,8 +282,10 @@ export function useAddServerPeer({ projectId }) {
|
|
|
260
282
|
export function useCreateProject() {
|
|
261
283
|
const queryClient = useQueryClient();
|
|
262
284
|
const clientApi = useClientApi();
|
|
263
|
-
const {
|
|
264
|
-
return
|
|
285
|
+
const { error, mutate, reset, status } = useMutation(createProjectMutationOptions({ clientApi, queryClient }));
|
|
286
|
+
return status === 'error'
|
|
287
|
+
? { error, mutate, reset, status }
|
|
288
|
+
: { error: null, mutate, reset, status };
|
|
265
289
|
}
|
|
266
290
|
/**
|
|
267
291
|
* Leave an existing project.
|
|
@@ -269,8 +293,10 @@ export function useCreateProject() {
|
|
|
269
293
|
export function useLeaveProject() {
|
|
270
294
|
const queryClient = useQueryClient();
|
|
271
295
|
const clientApi = useClientApi();
|
|
272
|
-
const {
|
|
273
|
-
return
|
|
296
|
+
const { error, mutate, reset, status } = useMutation(leaveProjectMutationOptions({ clientApi, queryClient }));
|
|
297
|
+
return status === 'error'
|
|
298
|
+
? { error, mutate, reset, status }
|
|
299
|
+
: { error: null, mutate, reset, status };
|
|
274
300
|
}
|
|
275
301
|
/**
|
|
276
302
|
* Update the configuration of a project using an external file.
|
|
@@ -280,8 +306,10 @@ export function useLeaveProject() {
|
|
|
280
306
|
export function useImportProjectConfig({ projectId }) {
|
|
281
307
|
const queryClient = useQueryClient();
|
|
282
308
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
283
|
-
const {
|
|
284
|
-
return
|
|
309
|
+
const { error, mutate, reset, status } = useMutation(importProjectConfigMutationOptions({ queryClient, projectApi, projectId }));
|
|
310
|
+
return status === 'error'
|
|
311
|
+
? { error, mutate, reset, status }
|
|
312
|
+
: { error: null, mutate, reset, status };
|
|
285
313
|
}
|
|
286
314
|
/**
|
|
287
315
|
* Update the settings of a project.
|
|
@@ -291,8 +319,10 @@ export function useImportProjectConfig({ projectId }) {
|
|
|
291
319
|
export function useUpdateProjectSettings({ projectId }) {
|
|
292
320
|
const queryClient = useQueryClient();
|
|
293
321
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
294
|
-
const { mutate, reset, status } = useMutation(updateProjectSettingsMutationOptions({ projectApi, queryClient }));
|
|
295
|
-
return
|
|
322
|
+
const { error, mutate, reset, status } = useMutation(updateProjectSettingsMutationOptions({ projectApi, queryClient }));
|
|
323
|
+
return status === 'error'
|
|
324
|
+
? { error, mutate, reset, status }
|
|
325
|
+
: { error: null, mutate, reset, status };
|
|
296
326
|
}
|
|
297
327
|
/**
|
|
298
328
|
* Create a blob for a project.
|
|
@@ -301,8 +331,10 @@ export function useUpdateProjectSettings({ projectId }) {
|
|
|
301
331
|
*/
|
|
302
332
|
export function useCreateBlob({ projectId }) {
|
|
303
333
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
304
|
-
const { mutate, reset, status } = useMutation(createBlobMutationOptions({ projectApi }));
|
|
305
|
-
return
|
|
334
|
+
const { error, mutate, reset, status } = useMutation(createBlobMutationOptions({ projectApi }));
|
|
335
|
+
return status === 'error'
|
|
336
|
+
? { error, mutate, reset, status }
|
|
337
|
+
: { error: null, mutate, reset, status };
|
|
306
338
|
}
|
|
307
339
|
const PROJECT_SYNC_STORE_MAP = new WeakMap();
|
|
308
340
|
function useSyncStore({ projectId }) {
|
|
@@ -352,11 +384,15 @@ export function useDataSyncProgress({ projectId, }) {
|
|
|
352
384
|
}
|
|
353
385
|
export function useStartSync({ projectId }) {
|
|
354
386
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
355
|
-
const { mutate, reset, status } = useMutation(startSyncMutationOptions({ projectApi }));
|
|
356
|
-
return
|
|
387
|
+
const { mutate, reset, status, error } = useMutation(startSyncMutationOptions({ projectApi }));
|
|
388
|
+
return status === 'error'
|
|
389
|
+
? { error, mutate, reset, status }
|
|
390
|
+
: { error: null, mutate, reset, status };
|
|
357
391
|
}
|
|
358
392
|
export function useStopSync({ projectId }) {
|
|
359
393
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
360
|
-
const { mutate, reset, status } = useMutation(stopSyncMutationOptions({ projectApi }));
|
|
361
|
-
return
|
|
394
|
+
const { error, mutate, reset, status } = useMutation(stopSyncMutationOptions({ projectApi }));
|
|
395
|
+
return status === 'error'
|
|
396
|
+
? { error, mutate, reset, status }
|
|
397
|
+
: { error: null, mutate, reset, status };
|
|
362
398
|
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ export { useClientApi, useIsArchiveDevice, useOwnDeviceInfo, useSetIsArchiveDevi
|
|
|
3
3
|
export { useCreateDocument, useDeleteDocument, useManyDocs, useSingleDocByDocId, useSingleDocByVersionId, useUpdateDocument, } from './hooks/documents.js';
|
|
4
4
|
export { useAcceptInvite, useRejectInvite, useRequestCancelInvite, useSendInvite, } from './hooks/invites.js';
|
|
5
5
|
export { useMapStyleUrl } from './hooks/maps.js';
|
|
6
|
-
export { useAddServerPeer, useAttachmentUrl, useCreateBlob, useCreateProject, useDataSyncProgress, useDocumentCreatedBy, useIconUrl, useImportProjectConfig, useLeaveProject, useManyMembers, useManyProjects, useProjectSettings, useSingleMember, useSingleProject, useStartSync, useStopSync, useSyncState, useUpdateProjectSettings, } from './hooks/projects.js';
|
|
6
|
+
export { useAddServerPeer, useAttachmentUrl, useCreateBlob, useCreateProject, useDataSyncProgress, useDocumentCreatedBy, useIconUrl, useImportProjectConfig, useLeaveProject, useManyMembers, useManyProjects, useOwnRoleInProject, useProjectSettings, useSingleMember, useSingleProject, useStartSync, useStopSync, useSyncState, useUpdateProjectSettings, } from './hooks/projects.js';
|
|
7
7
|
export { type SyncState } from './lib/sync.js';
|
|
8
8
|
export { type WriteableDocument, type WriteableDocumentType, type WriteableValue, } from './lib/types.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -3,4 +3,4 @@ export { useClientApi, useIsArchiveDevice, useOwnDeviceInfo, useSetIsArchiveDevi
|
|
|
3
3
|
export { useCreateDocument, useDeleteDocument, useManyDocs, useSingleDocByDocId, useSingleDocByVersionId, useUpdateDocument, } from './hooks/documents.js';
|
|
4
4
|
export { useAcceptInvite, useRejectInvite, useRequestCancelInvite, useSendInvite, } from './hooks/invites.js';
|
|
5
5
|
export { useMapStyleUrl } from './hooks/maps.js';
|
|
6
|
-
export { useAddServerPeer, useAttachmentUrl, useCreateBlob, useCreateProject, useDataSyncProgress, useDocumentCreatedBy, useIconUrl, useImportProjectConfig, useLeaveProject, useManyMembers, useManyProjects, useProjectSettings, useSingleMember, useSingleProject, useStartSync, useStopSync, useSyncState, useUpdateProjectSettings, } from './hooks/projects.js';
|
|
6
|
+
export { useAddServerPeer, useAttachmentUrl, useCreateBlob, useCreateProject, useDataSyncProgress, useDocumentCreatedBy, useIconUrl, useImportProjectConfig, useLeaveProject, useManyMembers, useManyProjects, useOwnRoleInProject, useProjectSettings, useSingleMember, useSingleProject, useStartSync, useStopSync, useSyncState, useUpdateProjectSettings, } from './hooks/projects.js';
|
package/docs/API.md
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
- [useIconUrl](#useiconurl)
|
|
15
15
|
- [useAttachmentUrl](#useattachmenturl)
|
|
16
16
|
- [useDocumentCreatedBy](#usedocumentcreatedby)
|
|
17
|
+
- [useOwnRoleInProject](#useownroleinproject)
|
|
17
18
|
- [useAddServerPeer](#useaddserverpeer)
|
|
18
19
|
- [useCreateProject](#usecreateproject)
|
|
19
20
|
- [useLeaveProject](#useleaveproject)
|
|
@@ -119,7 +120,7 @@ Update the device info for the current device.
|
|
|
119
120
|
|
|
120
121
|
| Function | Type |
|
|
121
122
|
| ---------- | ---------- |
|
|
122
|
-
| `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: "
|
|
123
|
+
| `useSetOwnDeviceInfo` | `() => { error: Error; mutate: UseMutateFunction<void, Error, { name: string; deviceType: "device_type_unspecified" or "mobile" or "tablet" or "desktop" or "selfHostedServer" or "UNRECOGNIZED"; }, unknown>; reset: () => void; status: "error"; } or { ...; }` |
|
|
123
124
|
|
|
124
125
|
### useSetIsArchiveDevice
|
|
125
126
|
|
|
@@ -127,7 +128,7 @@ Set or unset the current device as an archive device.
|
|
|
127
128
|
|
|
128
129
|
| Function | Type |
|
|
129
130
|
| ---------- | ---------- |
|
|
130
|
-
| `useSetIsArchiveDevice` | `() => { mutate: UseMutateFunction<void, Error, { isArchiveDevice: boolean; }, unknown>; reset: () => void; status: "
|
|
131
|
+
| `useSetIsArchiveDevice` | `() => { error: Error; mutate: UseMutateFunction<void, Error, { isArchiveDevice: boolean; }, unknown>; reset: () => void; status: "error"; } or { error: null; mutate: UseMutateFunction<...>; reset: () => void; status: "pending" or ... 1 more ... or "idle"; }` |
|
|
131
132
|
|
|
132
133
|
### useProjectSettings
|
|
133
134
|
|
|
@@ -377,11 +378,36 @@ function BasicExample() {
|
|
|
377
378
|
```
|
|
378
379
|
|
|
379
380
|
|
|
381
|
+
### useOwnRoleInProject
|
|
382
|
+
|
|
383
|
+
Get the role for the current device in a specified project.
|
|
384
|
+
This is a more convenient alternative to using the `useOwnDeviceInfo` and `useManyMembers` hooks.
|
|
385
|
+
|
|
386
|
+
| Function | Type |
|
|
387
|
+
| ---------- | ---------- |
|
|
388
|
+
| `useOwnRoleInProject` | `({ projectId }: { projectId: string; }) => { data: Role<"a12a6702b93bd7ff" or "f7c150f5a3a9a855" or "012fd2d431c0bf60" or "9e6d29263cba36c9" or "8ced989b1904606b" or "08e4251e36f6e7ed">; error: Error or null; isRefetching: boolean; }` |
|
|
389
|
+
|
|
390
|
+
Parameters:
|
|
391
|
+
|
|
392
|
+
* `opts.projectId`: Project public ID
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
Examples:
|
|
396
|
+
|
|
397
|
+
```tsx
|
|
398
|
+
function BasicExample() {
|
|
399
|
+
const { data } = useOwnRoleInProject({
|
|
400
|
+
projectId: '...',
|
|
401
|
+
})
|
|
402
|
+
}
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
|
|
380
406
|
### useAddServerPeer
|
|
381
407
|
|
|
382
408
|
| Function | Type |
|
|
383
409
|
| ---------- | ---------- |
|
|
384
|
-
| `useAddServerPeer` | `({ projectId }: { projectId: string; }) => { mutate: UseMutateFunction<void, Error, { baseUrl: string; dangerouslyAllowInsecureConnections?: boolean or undefined; }, unknown>; reset: () => void; status: "
|
|
410
|
+
| `useAddServerPeer` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<void, Error, { baseUrl: string; dangerouslyAllowInsecureConnections?: boolean or undefined; }, unknown>; reset: () => void; status: "error"; } or { ...; }` |
|
|
385
411
|
|
|
386
412
|
### useCreateProject
|
|
387
413
|
|
|
@@ -389,7 +415,7 @@ Create a new project.
|
|
|
389
415
|
|
|
390
416
|
| Function | Type |
|
|
391
417
|
| ---------- | ---------- |
|
|
392
|
-
| `useCreateProject` | `() => { mutate: UseMutateFunction<string, Error, { name?: string or undefined; configPath?: string or undefined; } or undefined, unknown>; reset: () => void; status: "
|
|
418
|
+
| `useCreateProject` | `() => { error: Error; mutate: UseMutateFunction<string, Error, { name?: string or undefined; configPath?: string or undefined; } or undefined, unknown>; reset: () => void; status: "error"; } or { ...; }` |
|
|
393
419
|
|
|
394
420
|
### useLeaveProject
|
|
395
421
|
|
|
@@ -397,7 +423,7 @@ Leave an existing project.
|
|
|
397
423
|
|
|
398
424
|
| Function | Type |
|
|
399
425
|
| ---------- | ---------- |
|
|
400
|
-
| `useLeaveProject` | `() => { mutate: UseMutateFunction<void, Error, { projectId: string; }, unknown>; reset: () => void; status: "
|
|
426
|
+
| `useLeaveProject` | `() => { error: Error; mutate: UseMutateFunction<void, Error, { projectId: string; }, unknown>; reset: () => void; status: "error"; } or { error: null; mutate: UseMutateFunction<void, Error, { ...; }, unknown>; reset: () => void; status: "pending" or ... 1 more ... or "idle"; }` |
|
|
401
427
|
|
|
402
428
|
### useImportProjectConfig
|
|
403
429
|
|
|
@@ -405,7 +431,7 @@ Update the configuration of a project using an external file.
|
|
|
405
431
|
|
|
406
432
|
| Function | Type |
|
|
407
433
|
| ---------- | ---------- |
|
|
408
|
-
| `useImportProjectConfig` | `({ projectId }: { projectId: string; }) => { mutate: UseMutateFunction<Error[], Error, { configPath: string; }, unknown>; reset: () => void; status: "
|
|
434
|
+
| `useImportProjectConfig` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<Error[], Error, { configPath: string; }, unknown>; reset: () => void; status: "error"; } or { ...; }` |
|
|
409
435
|
|
|
410
436
|
Parameters:
|
|
411
437
|
|
|
@@ -418,7 +444,7 @@ Update the settings of a project.
|
|
|
418
444
|
|
|
419
445
|
| Function | Type |
|
|
420
446
|
| ---------- | ---------- |
|
|
421
|
-
| `useUpdateProjectSettings` | `({ projectId }: { projectId: string; }) => { mutate: UseMutateFunction<EditableProjectSettings, Error, { name?: string or undefined; configMetadata?: {
|
|
447
|
+
| `useUpdateProjectSettings` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<EditableProjectSettings, Error, { name?: string or undefined; configMetadata?: { ...; } or undefined; defaultPresets?: { ...; } or undefined; }, unknown>; reset: () => void; status: "error"; } or { ...; }` |
|
|
422
448
|
|
|
423
449
|
Parameters:
|
|
424
450
|
|
|
@@ -431,7 +457,7 @@ Create a blob for a project.
|
|
|
431
457
|
|
|
432
458
|
| Function | Type |
|
|
433
459
|
| ---------- | ---------- |
|
|
434
|
-
| `useCreateBlob` | `({ projectId }: { projectId: string; }) => { mutate: UseMutateFunction<{ driveId: string; name: string; type: "photo" or "audio" or "video"; hash: string; }, Error, { original: string; preview?: string or undefined; thumbnail?: string or undefined; metadata: Metadata; }, unknown>; reset: () => void; status
|
|
460
|
+
| `useCreateBlob` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<{ driveId: string; name: string; type: "photo" or "audio" or "video"; hash: string; }, Error, { original: string; preview?: string or undefined; thumbnail?: string or undefined; metadata: Metadata; }, unknown>; reset: () => void; status...` |
|
|
435
461
|
|
|
436
462
|
Parameters:
|
|
437
463
|
|
|
@@ -482,13 +508,13 @@ Provides the progress of data sync for sync-enabled connected peers
|
|
|
482
508
|
|
|
483
509
|
| Function | Type |
|
|
484
510
|
| ---------- | ---------- |
|
|
485
|
-
| `useStartSync` | `({ projectId }: { projectId: string; }) => { mutate: UseMutateFunction<void, Error, { autostopDataSyncAfter: number or null; } or undefined, unknown>; reset: () => void; status: "
|
|
511
|
+
| `useStartSync` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<void, Error, { autostopDataSyncAfter: number or null; } or undefined, unknown>; reset: () => void; status: "error"; } or { ...; }` |
|
|
486
512
|
|
|
487
513
|
### useStopSync
|
|
488
514
|
|
|
489
515
|
| Function | Type |
|
|
490
516
|
| ---------- | ---------- |
|
|
491
|
-
| `useStopSync` | `({ projectId }: { projectId: string; }) => { mutate: UseMutateFunction<void, Error, void, unknown>; reset: () => void; status: "
|
|
517
|
+
| `useStopSync` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<void, Error, void, unknown>; reset: () => void; status: "error"; } or { error: null; mutate: UseMutateFunction<...>; reset: () => void; status: "pending" or ... 1 more ... or "idle"; }` |
|
|
492
518
|
|
|
493
519
|
### useSingleDocByDocId
|
|
494
520
|
|
|
@@ -608,7 +634,7 @@ Create a document for a project.
|
|
|
608
634
|
|
|
609
635
|
| Function | Type |
|
|
610
636
|
| ---------- | ---------- |
|
|
611
|
-
| `useCreateDocument` | `<D extends WriteableDocumentType>({ docType, projectId, }: { docType: D; projectId: string; }) => { mutate: UseMutateFunction<WriteableDocument<D> and { forks: string[]; }, Error, {
|
|
637
|
+
| `useCreateDocument` | `<D extends WriteableDocumentType>({ docType, projectId, }: { docType: D; projectId: string; }) => { error: Error; mutate: UseMutateFunction<WriteableDocument<D> and { forks: string[]; }, Error, { ...; }, unknown>; reset: () => void; status: "error"; } or { ...; }` |
|
|
612
638
|
|
|
613
639
|
Parameters:
|
|
614
640
|
|
|
@@ -622,7 +648,7 @@ Update a document within a project.
|
|
|
622
648
|
|
|
623
649
|
| Function | Type |
|
|
624
650
|
| ---------- | ---------- |
|
|
625
|
-
| `useUpdateDocument` | `<D extends WriteableDocumentType>({ docType, projectId, }: { docType: D; projectId: string; }) => { mutate: UseMutateFunction<WriteableDocument<D> and { forks: string[]; }, Error, {
|
|
651
|
+
| `useUpdateDocument` | `<D extends WriteableDocumentType>({ docType, projectId, }: { docType: D; projectId: string; }) => { error: Error; mutate: UseMutateFunction<WriteableDocument<D> and { forks: string[]; }, Error, { ...; }, unknown>; reset: () => void; status: "error"; } or { ...; }` |
|
|
626
652
|
|
|
627
653
|
Parameters:
|
|
628
654
|
|
|
@@ -636,7 +662,7 @@ Delete a document within a project.
|
|
|
636
662
|
|
|
637
663
|
| Function | Type |
|
|
638
664
|
| ---------- | ---------- |
|
|
639
|
-
| `useDeleteDocument` | `<D extends WriteableDocumentType>({ docType, projectId, }: { docType: D; projectId: string; }) => { mutate: UseMutateFunction<WriteableDocument<D> and { forks: string[]; }, Error, {
|
|
665
|
+
| `useDeleteDocument` | `<D extends WriteableDocumentType>({ docType, projectId, }: { docType: D; projectId: string; }) => { error: Error; mutate: UseMutateFunction<WriteableDocument<D> and { forks: string[]; }, Error, { ...; }, unknown>; reset: () => void; status: "error"; } or { ...; }` |
|
|
640
666
|
|
|
641
667
|
Parameters:
|
|
642
668
|
|
|
@@ -650,7 +676,7 @@ Accept an invite that has been received.
|
|
|
650
676
|
|
|
651
677
|
| Function | Type |
|
|
652
678
|
| ---------- | ---------- |
|
|
653
|
-
| `useAcceptInvite` | `() => { mutate: UseMutateFunction<string, Error, { inviteId: string; }, unknown>; reset: () => void; status: "
|
|
679
|
+
| `useAcceptInvite` | `() => { error: Error; mutate: UseMutateFunction<string, Error, { inviteId: string; }, unknown>; reset: () => void; status: "error"; } or { error: null; mutate: UseMutateFunction<string, Error, { ...; }, unknown>; reset: () => void; status: "pending" or ... 1 more ... or "idle"; }` |
|
|
654
680
|
|
|
655
681
|
### useRejectInvite
|
|
656
682
|
|
|
@@ -658,7 +684,7 @@ Reject an invite that has been received.
|
|
|
658
684
|
|
|
659
685
|
| Function | Type |
|
|
660
686
|
| ---------- | ---------- |
|
|
661
|
-
| `useRejectInvite` | `() => { mutate: UseMutateFunction<void, Error, { inviteId: string; }, unknown>; reset: () => void; status: "
|
|
687
|
+
| `useRejectInvite` | `() => { error: Error; mutate: UseMutateFunction<void, Error, { inviteId: string; }, unknown>; reset: () => void; status: "error"; } or { error: null; mutate: UseMutateFunction<void, Error, { ...; }, unknown>; reset: () => void; status: "pending" or ... 1 more ... or "idle"; }` |
|
|
662
688
|
|
|
663
689
|
### useSendInvite
|
|
664
690
|
|
|
@@ -666,7 +692,7 @@ Send an invite for a project.
|
|
|
666
692
|
|
|
667
693
|
| Function | Type |
|
|
668
694
|
| ---------- | ---------- |
|
|
669
|
-
| `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;
|
|
695
|
+
| `useSendInvite` | `({ projectId }: { projectId: string; }) => { error: Error; 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; s...` |
|
|
670
696
|
|
|
671
697
|
Parameters:
|
|
672
698
|
|
|
@@ -679,7 +705,7 @@ Request a cancellation of an invite sent to another device.
|
|
|
679
705
|
|
|
680
706
|
| Function | Type |
|
|
681
707
|
| ---------- | ---------- |
|
|
682
|
-
| `useRequestCancelInvite` | `({ projectId }: { projectId: string; }) => { mutate: UseMutateFunction<void, Error, { deviceId: string; }, unknown>; reset: () => void; status: "
|
|
708
|
+
| `useRequestCancelInvite` | `({ projectId }: { projectId: string; }) => { error: Error; mutate: UseMutateFunction<void, Error, { deviceId: string; }, unknown>; reset: () => void; status: "error"; } or { ...; }` |
|
|
683
709
|
|
|
684
710
|
Parameters:
|
|
685
711
|
|