@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
|
@@ -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").EditableProjectSettings, Error, {
|
|
392
|
+
name?: import("@comapeo/schema").ProjectSettings["name"];
|
|
393
|
+
configMetadata?: import("@comapeo/schema").ProjectSettings["configMetadata"];
|
|
394
|
+
defaultPresets?: import("@comapeo/schema").ProjectSettings["defaultPresets"];
|
|
395
|
+
}, unknown>;
|
|
396
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("@comapeo/core/dist/mapeo-project.js").EditableProjectSettings, Error, {
|
|
397
|
+
name?: import("@comapeo/schema").ProjectSettings["name"];
|
|
398
|
+
configMetadata?: import("@comapeo/schema").ProjectSettings["configMetadata"];
|
|
399
|
+
defaultPresets?: import("@comapeo/schema").ProjectSettings["defaultPresets"];
|
|
400
|
+
}, unknown>;
|
|
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").EditableProjectSettings, Error, {
|
|
329
406
|
name?: import("@comapeo/schema").ProjectSettings["name"];
|
|
330
407
|
configMetadata?: import("@comapeo/schema").ProjectSettings["configMetadata"];
|
|
331
408
|
defaultPresets?: import("@comapeo/schema").ProjectSettings["defaultPresets"];
|
|
332
409
|
}, unknown>;
|
|
410
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("@comapeo/core/dist/mapeo-project.js").EditableProjectSettings, Error, {
|
|
411
|
+
name?: import("@comapeo/schema").ProjectSettings["name"];
|
|
412
|
+
configMetadata?: import("@comapeo/schema").ProjectSettings["configMetadata"];
|
|
413
|
+
defaultPresets?: import("@comapeo/schema").ProjectSettings["defaultPresets"];
|
|
414
|
+
}, unknown>;
|
|
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").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").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").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").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
|
};
|
|
@@ -271,8 +271,10 @@ export function useOwnRoleInProject({ projectId }) {
|
|
|
271
271
|
export function useAddServerPeer({ projectId }) {
|
|
272
272
|
const queryClient = useQueryClient();
|
|
273
273
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
274
|
-
const { mutate, reset, status } = useMutation(addServerPeerMutationOptions({ projectApi, projectId, queryClient }));
|
|
275
|
-
return
|
|
274
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(addServerPeerMutationOptions({ projectApi, projectId, queryClient }));
|
|
275
|
+
return status === 'error'
|
|
276
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
277
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
276
278
|
}
|
|
277
279
|
/**
|
|
278
280
|
* Create a new project.
|
|
@@ -280,8 +282,10 @@ export function useAddServerPeer({ projectId }) {
|
|
|
280
282
|
export function useCreateProject() {
|
|
281
283
|
const queryClient = useQueryClient();
|
|
282
284
|
const clientApi = useClientApi();
|
|
283
|
-
const { mutate,
|
|
284
|
-
return
|
|
285
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(createProjectMutationOptions({ clientApi, queryClient }));
|
|
286
|
+
return status === 'error'
|
|
287
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
288
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
285
289
|
}
|
|
286
290
|
/**
|
|
287
291
|
* Leave an existing project.
|
|
@@ -289,8 +293,10 @@ export function useCreateProject() {
|
|
|
289
293
|
export function useLeaveProject() {
|
|
290
294
|
const queryClient = useQueryClient();
|
|
291
295
|
const clientApi = useClientApi();
|
|
292
|
-
const { mutate,
|
|
293
|
-
return
|
|
296
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(leaveProjectMutationOptions({ clientApi, queryClient }));
|
|
297
|
+
return status === 'error'
|
|
298
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
299
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
294
300
|
}
|
|
295
301
|
/**
|
|
296
302
|
* Update the configuration of a project using an external file.
|
|
@@ -300,8 +306,10 @@ export function useLeaveProject() {
|
|
|
300
306
|
export function useImportProjectConfig({ projectId }) {
|
|
301
307
|
const queryClient = useQueryClient();
|
|
302
308
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
303
|
-
const { mutate,
|
|
304
|
-
return
|
|
309
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(importProjectConfigMutationOptions({ queryClient, projectApi, projectId }));
|
|
310
|
+
return status === 'error'
|
|
311
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
312
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
305
313
|
}
|
|
306
314
|
/**
|
|
307
315
|
* Update the settings of a project.
|
|
@@ -311,8 +319,10 @@ export function useImportProjectConfig({ projectId }) {
|
|
|
311
319
|
export function useUpdateProjectSettings({ projectId }) {
|
|
312
320
|
const queryClient = useQueryClient();
|
|
313
321
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
314
|
-
const { mutate, reset, status } = useMutation(updateProjectSettingsMutationOptions({ projectApi, queryClient }));
|
|
315
|
-
return
|
|
322
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(updateProjectSettingsMutationOptions({ projectApi, queryClient }));
|
|
323
|
+
return status === 'error'
|
|
324
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
325
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
316
326
|
}
|
|
317
327
|
/**
|
|
318
328
|
* Create a blob for a project.
|
|
@@ -321,8 +331,10 @@ export function useUpdateProjectSettings({ projectId }) {
|
|
|
321
331
|
*/
|
|
322
332
|
export function useCreateBlob({ projectId }) {
|
|
323
333
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
324
|
-
const { mutate, reset, status } = useMutation(createBlobMutationOptions({ projectApi }));
|
|
325
|
-
return
|
|
334
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(createBlobMutationOptions({ projectApi }));
|
|
335
|
+
return status === 'error'
|
|
336
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
337
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
326
338
|
}
|
|
327
339
|
const PROJECT_SYNC_STORE_MAP = new WeakMap();
|
|
328
340
|
function useSyncStore({ projectId }) {
|
|
@@ -372,11 +384,15 @@ export function useDataSyncProgress({ projectId, }) {
|
|
|
372
384
|
}
|
|
373
385
|
export function useStartSync({ projectId }) {
|
|
374
386
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
375
|
-
const { mutate, reset, status } = useMutation(startSyncMutationOptions({ projectApi }));
|
|
376
|
-
return
|
|
387
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(startSyncMutationOptions({ projectApi }));
|
|
388
|
+
return status === 'error'
|
|
389
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
390
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
377
391
|
}
|
|
378
392
|
export function useStopSync({ projectId }) {
|
|
379
393
|
const { data: projectApi } = useSingleProject({ projectId });
|
|
380
|
-
const { mutate, reset, status } = useMutation(stopSyncMutationOptions({ projectApi }));
|
|
381
|
-
return
|
|
394
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(stopSyncMutationOptions({ projectApi }));
|
|
395
|
+
return status === 'error'
|
|
396
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
397
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
382
398
|
}
|
package/docs/API.md
CHANGED
|
@@ -120,7 +120,7 @@ Update the device info for the current device.
|
|
|
120
120
|
|
|
121
121
|
| Function | Type |
|
|
122
122
|
| ---------- | ---------- |
|
|
123
|
-
| `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 { ...; }` |
|
|
124
124
|
|
|
125
125
|
### useSetIsArchiveDevice
|
|
126
126
|
|
|
@@ -128,7 +128,7 @@ Set or unset the current device as an archive device.
|
|
|
128
128
|
|
|
129
129
|
| Function | Type |
|
|
130
130
|
| ---------- | ---------- |
|
|
131
|
-
| `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"; }` |
|
|
132
132
|
|
|
133
133
|
### useProjectSettings
|
|
134
134
|
|
|
@@ -407,7 +407,7 @@ function BasicExample() {
|
|
|
407
407
|
|
|
408
408
|
| Function | Type |
|
|
409
409
|
| ---------- | ---------- |
|
|
410
|
-
| `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 { ...; }` |
|
|
411
411
|
|
|
412
412
|
### useCreateProject
|
|
413
413
|
|
|
@@ -415,7 +415,7 @@ Create a new project.
|
|
|
415
415
|
|
|
416
416
|
| Function | Type |
|
|
417
417
|
| ---------- | ---------- |
|
|
418
|
-
| `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 { ...; }` |
|
|
419
419
|
|
|
420
420
|
### useLeaveProject
|
|
421
421
|
|
|
@@ -423,7 +423,7 @@ Leave an existing project.
|
|
|
423
423
|
|
|
424
424
|
| Function | Type |
|
|
425
425
|
| ---------- | ---------- |
|
|
426
|
-
| `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"; }` |
|
|
427
427
|
|
|
428
428
|
### useImportProjectConfig
|
|
429
429
|
|
|
@@ -431,7 +431,7 @@ Update the configuration of a project using an external file.
|
|
|
431
431
|
|
|
432
432
|
| Function | Type |
|
|
433
433
|
| ---------- | ---------- |
|
|
434
|
-
| `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 { ...; }` |
|
|
435
435
|
|
|
436
436
|
Parameters:
|
|
437
437
|
|
|
@@ -444,7 +444,7 @@ Update the settings of a project.
|
|
|
444
444
|
|
|
445
445
|
| Function | Type |
|
|
446
446
|
| ---------- | ---------- |
|
|
447
|
-
| `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 { ...; }` |
|
|
448
448
|
|
|
449
449
|
Parameters:
|
|
450
450
|
|
|
@@ -457,7 +457,7 @@ Create a blob for a project.
|
|
|
457
457
|
|
|
458
458
|
| Function | Type |
|
|
459
459
|
| ---------- | ---------- |
|
|
460
|
-
| `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...` |
|
|
461
461
|
|
|
462
462
|
Parameters:
|
|
463
463
|
|
|
@@ -508,13 +508,13 @@ Provides the progress of data sync for sync-enabled connected peers
|
|
|
508
508
|
|
|
509
509
|
| Function | Type |
|
|
510
510
|
| ---------- | ---------- |
|
|
511
|
-
| `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 { ...; }` |
|
|
512
512
|
|
|
513
513
|
### useStopSync
|
|
514
514
|
|
|
515
515
|
| Function | Type |
|
|
516
516
|
| ---------- | ---------- |
|
|
517
|
-
| `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"; }` |
|
|
518
518
|
|
|
519
519
|
### useSingleDocByDocId
|
|
520
520
|
|
|
@@ -634,7 +634,7 @@ Create a document for a project.
|
|
|
634
634
|
|
|
635
635
|
| Function | Type |
|
|
636
636
|
| ---------- | ---------- |
|
|
637
|
-
| `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 { ...; }` |
|
|
638
638
|
|
|
639
639
|
Parameters:
|
|
640
640
|
|
|
@@ -648,7 +648,7 @@ Update a document within a project.
|
|
|
648
648
|
|
|
649
649
|
| Function | Type |
|
|
650
650
|
| ---------- | ---------- |
|
|
651
|
-
| `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 { ...; }` |
|
|
652
652
|
|
|
653
653
|
Parameters:
|
|
654
654
|
|
|
@@ -662,7 +662,7 @@ Delete a document within a project.
|
|
|
662
662
|
|
|
663
663
|
| Function | Type |
|
|
664
664
|
| ---------- | ---------- |
|
|
665
|
-
| `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 { ...; }` |
|
|
666
666
|
|
|
667
667
|
Parameters:
|
|
668
668
|
|
|
@@ -676,7 +676,7 @@ Accept an invite that has been received.
|
|
|
676
676
|
|
|
677
677
|
| Function | Type |
|
|
678
678
|
| ---------- | ---------- |
|
|
679
|
-
| `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"; }` |
|
|
680
680
|
|
|
681
681
|
### useRejectInvite
|
|
682
682
|
|
|
@@ -684,7 +684,7 @@ Reject an invite that has been received.
|
|
|
684
684
|
|
|
685
685
|
| Function | Type |
|
|
686
686
|
| ---------- | ---------- |
|
|
687
|
-
| `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"; }` |
|
|
688
688
|
|
|
689
689
|
### useSendInvite
|
|
690
690
|
|
|
@@ -692,7 +692,7 @@ Send an invite for a project.
|
|
|
692
692
|
|
|
693
693
|
| Function | Type |
|
|
694
694
|
| ---------- | ---------- |
|
|
695
|
-
| `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...` |
|
|
696
696
|
|
|
697
697
|
Parameters:
|
|
698
698
|
|
|
@@ -705,7 +705,7 @@ Request a cancellation of an invite sent to another device.
|
|
|
705
705
|
|
|
706
706
|
| Function | Type |
|
|
707
707
|
| ---------- | ---------- |
|
|
708
|
-
| `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 { ...; }` |
|
|
709
709
|
|
|
710
710
|
Parameters:
|
|
711
711
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comapeo/core-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "React wrapper for working with @comapeo/core",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -79,6 +79,7 @@
|
|
|
79
79
|
"@types/react": "19.0.12",
|
|
80
80
|
"@types/react-dom": "19.0.4",
|
|
81
81
|
"eslint": "9.23.0",
|
|
82
|
+
"eslint-plugin-react-hooks": "5.2.0",
|
|
82
83
|
"fastify": "4.29.0",
|
|
83
84
|
"globals": "16.0.0",
|
|
84
85
|
"husky": "9.1.7",
|