@comapeo/core-react 9.0.2 → 10.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.
Files changed (73) hide show
  1. package/README.md +1 -1
  2. package/dist/commonjs/contexts/ClientApi.d.ts +1 -3
  3. package/dist/commonjs/contexts/ClientApi.js +2 -2
  4. package/dist/commonjs/hooks/client.d.ts +74 -33
  5. package/dist/commonjs/hooks/client.js +40 -11
  6. package/dist/commonjs/hooks/documents.d.ts +41 -429
  7. package/dist/commonjs/hooks/documents.js +101 -51
  8. package/dist/commonjs/hooks/invites.d.ts +153 -55
  9. package/dist/commonjs/hooks/invites.js +69 -20
  10. package/dist/commonjs/hooks/maps.d.ts +96 -225
  11. package/dist/commonjs/hooks/maps.js +104 -37
  12. package/dist/commonjs/hooks/projects.d.ts +666 -223
  13. package/dist/commonjs/hooks/projects.js +264 -131
  14. package/dist/commonjs/index.d.ts +2 -2
  15. package/dist/commonjs/lib/map-shares-stores.d.ts +1 -1
  16. package/dist/commonjs/lib/map-shares-stores.js +2 -2
  17. package/dist/commonjs/lib/presets.d.ts +1 -3
  18. package/dist/commonjs/lib/react-query.d.ts +103 -0
  19. package/dist/commonjs/lib/react-query.js +187 -0
  20. package/dist/commonjs/lib/sync.d.ts +2 -5
  21. package/dist/commonjs/lib/sync.js +0 -1
  22. package/dist/commonjs/lib/types.d.ts +4 -6
  23. package/dist/esm/contexts/ClientApi.d.ts +1 -3
  24. package/dist/esm/contexts/ClientApi.js +1 -1
  25. package/dist/esm/hooks/client.d.ts +74 -33
  26. package/dist/esm/hooks/client.js +40 -11
  27. package/dist/esm/hooks/documents.d.ts +41 -429
  28. package/dist/esm/hooks/documents.js +101 -51
  29. package/dist/esm/hooks/invites.d.ts +153 -55
  30. package/dist/esm/hooks/invites.js +69 -20
  31. package/dist/esm/hooks/maps.d.ts +96 -225
  32. package/dist/esm/hooks/maps.js +105 -38
  33. package/dist/esm/hooks/projects.d.ts +666 -223
  34. package/dist/esm/hooks/projects.js +262 -129
  35. package/dist/esm/index.d.ts +2 -2
  36. package/dist/esm/lib/map-shares-stores.d.ts +1 -1
  37. package/dist/esm/lib/map-shares-stores.js +1 -1
  38. package/dist/esm/lib/presets.d.ts +1 -3
  39. package/dist/esm/lib/react-query.d.ts +103 -0
  40. package/dist/esm/lib/react-query.js +162 -0
  41. package/dist/esm/lib/sync.d.ts +2 -5
  42. package/dist/esm/lib/sync.js +1 -1
  43. package/dist/esm/lib/types.d.ts +4 -6
  44. package/docs/API.md +137 -81
  45. package/package.json +39 -35
  46. package/dist/commonjs/lib/react-query/client.d.ts +0 -65
  47. package/dist/commonjs/lib/react-query/client.js +0 -68
  48. package/dist/commonjs/lib/react-query/documents.d.ts +0 -1484
  49. package/dist/commonjs/lib/react-query/documents.js +0 -149
  50. package/dist/commonjs/lib/react-query/invites.d.ts +0 -88
  51. package/dist/commonjs/lib/react-query/invites.js +0 -95
  52. package/dist/commonjs/lib/react-query/maps.d.ts +0 -104
  53. package/dist/commonjs/lib/react-query/maps.js +0 -129
  54. package/dist/commonjs/lib/react-query/mutation-result.d.ts +0 -8
  55. package/dist/commonjs/lib/react-query/mutation-result.js +0 -22
  56. package/dist/commonjs/lib/react-query/projects.d.ts +0 -316
  57. package/dist/commonjs/lib/react-query/projects.js +0 -359
  58. package/dist/commonjs/lib/react-query/shared.d.ts +0 -9
  59. package/dist/commonjs/lib/react-query/shared.js +0 -23
  60. package/dist/esm/lib/react-query/client.d.ts +0 -65
  61. package/dist/esm/lib/react-query/client.js +0 -59
  62. package/dist/esm/lib/react-query/documents.d.ts +0 -1484
  63. package/dist/esm/lib/react-query/documents.js +0 -137
  64. package/dist/esm/lib/react-query/invites.d.ts +0 -88
  65. package/dist/esm/lib/react-query/invites.js +0 -85
  66. package/dist/esm/lib/react-query/maps.d.ts +0 -104
  67. package/dist/esm/lib/react-query/maps.js +0 -119
  68. package/dist/esm/lib/react-query/mutation-result.d.ts +0 -8
  69. package/dist/esm/lib/react-query/mutation-result.js +0 -19
  70. package/dist/esm/lib/react-query/projects.d.ts +0 -316
  71. package/dist/esm/lib/react-query/projects.js +0 -324
  72. package/dist/esm/lib/react-query/shared.d.ts +0 -9
  73. package/dist/esm/lib/react-query/shared.js +0 -18
@@ -1,7 +1,7 @@
1
- import type { Preset } from '@comapeo/schema' with {
2
- 'resolution-mode': 'import'
3
- };
4
- import type { WriteableDocumentType } from '../lib/types.js';
1
+ import type { MapeoProjectApi } from '@comapeo/ipc';
2
+ import { type UseMutationResult, type UseSuspenseQueryResult } from '@tanstack/react-query';
3
+ import { type FilteredMutationResult } from '../lib/react-query.js';
4
+ import type { WriteableDocumentType, WriteableValue } from '../lib/types.js';
5
5
  /**
6
6
  * Retrieve a single document from the database based on the document's document ID.
7
7
  *
@@ -30,125 +30,7 @@ export declare function useSingleDocByDocId<D extends WriteableDocumentType>({ p
30
30
  docType: D;
31
31
  docId: string;
32
32
  lang?: string;
33
- }): {
34
- data: Extract<({
35
- schemaName: "track";
36
- locations: [import("@comapeo/schema/dist/schema/track.js").Position, import("@comapeo/schema/dist/schema/track.js").Position, ...import("@comapeo/schema/dist/schema/track.js").Position[]];
37
- observationRefs: {
38
- docId: string;
39
- versionId: string;
40
- }[];
41
- tags: {
42
- [k: string]: boolean | number | string | null | (boolean | number | string | null)[];
43
- };
44
- presetRef?: {
45
- docId: string;
46
- versionId: string;
47
- } | undefined;
48
- docId: string;
49
- versionId: string;
50
- originalVersionId: string;
51
- createdAt: string;
52
- updatedAt: string;
53
- links: string[];
54
- deleted: boolean;
55
- } & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields) | ({
56
- schemaName: "remoteDetectionAlert";
57
- detectionDateStart: string;
58
- detectionDateEnd: string;
59
- sourceId: string;
60
- metadata: {
61
- [k: string]: boolean | number | string | null | (boolean | number | string | null)[];
62
- };
63
- geometry: import("@comapeo/schema/dist/schema/remoteDetectionAlert.js").Geometry;
64
- docId: string;
65
- versionId: string;
66
- originalVersionId: string;
67
- createdAt: string;
68
- updatedAt: string;
69
- links: string[];
70
- deleted: boolean;
71
- } & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields) | ({
72
- schemaName: "preset";
73
- name: string;
74
- geometry: ("point" | "vertex" | "line" | "area" | "relation")[];
75
- tags: import("@comapeo/schema/dist/schema/preset.js").Tags;
76
- addTags: import("@comapeo/schema/dist/schema/preset.js").Tags1;
77
- removeTags: import("@comapeo/schema/dist/schema/preset.js").Tags2;
78
- fieldRefs: {
79
- docId: string;
80
- versionId: string;
81
- }[];
82
- iconRef?: {
83
- docId: string;
84
- versionId: string;
85
- } | undefined;
86
- terms: string[];
87
- color?: string | undefined;
88
- docId: string;
89
- versionId: string;
90
- originalVersionId: string;
91
- createdAt: string;
92
- updatedAt: string;
93
- links: string[];
94
- deleted: boolean;
95
- } & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields) | ({
96
- schemaName: "observation";
97
- lat?: number | undefined;
98
- lon?: number | undefined;
99
- attachments: import("@comapeo/schema/dist/schema/observation.js").Attachment[];
100
- tags: {
101
- [k: string]: boolean | number | string | null | (boolean | number | string | null)[];
102
- };
103
- metadata?: {
104
- manualLocation?: boolean;
105
- position?: import("@comapeo/schema/dist/schema/observation.js").Position;
106
- lastSavedPosition?: import("@comapeo/schema/dist/schema/observation.js").Position;
107
- positionProvider?: {
108
- gpsAvailable?: boolean;
109
- passiveAvailable?: boolean;
110
- locationServicesEnabled: boolean;
111
- networkAvailable?: boolean;
112
- };
113
- } | undefined;
114
- presetRef?: {
115
- docId: string;
116
- versionId: string;
117
- } | undefined;
118
- docId: string;
119
- versionId: string;
120
- originalVersionId: string;
121
- createdAt: string;
122
- updatedAt: string;
123
- links: string[];
124
- deleted: boolean;
125
- } & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields) | ({
126
- schemaName: "field";
127
- tagKey: string;
128
- type: "type_unspecified" | "text" | "number" | "selectOne" | "selectMultiple" | "UNRECOGNIZED";
129
- label: string;
130
- appearance?: ("appearance_unspecified" | "singleline" | "multiline" | "UNRECOGNIZED") | undefined;
131
- snakeCase?: boolean | undefined;
132
- options?: {
133
- label: string;
134
- value: string | boolean | number | null;
135
- }[] | undefined;
136
- universal?: boolean | undefined;
137
- placeholder?: string | undefined;
138
- helperText?: string | undefined;
139
- docId: string;
140
- versionId: string;
141
- originalVersionId: string;
142
- createdAt: string;
143
- updatedAt: string;
144
- links: string[];
145
- deleted: boolean;
146
- } & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields), {
147
- schemaName: D;
148
- }>;
149
- error: Error | null;
150
- isRefetching: boolean;
151
- };
33
+ }): Pick<UseSuspenseQueryResult<Awaited<ReturnType<MapeoProjectApi[D]['getByDocId']>>>, 'data' | 'error' | 'isRefetching'>;
152
34
  /**
153
35
  * Retrieve a single document from the database based on the document's version ID.
154
36
  *
@@ -177,125 +59,7 @@ export declare function useSingleDocByVersionId<D extends WriteableDocumentType>
177
59
  docType: D;
178
60
  versionId: string;
179
61
  lang?: string;
180
- }): {
181
- data: Extract<({
182
- schemaName: "track";
183
- locations: [import("@comapeo/schema/dist/schema/track.js").Position, import("@comapeo/schema/dist/schema/track.js").Position, ...import("@comapeo/schema/dist/schema/track.js").Position[]];
184
- observationRefs: {
185
- docId: string;
186
- versionId: string;
187
- }[];
188
- tags: {
189
- [k: string]: boolean | number | string | null | (boolean | number | string | null)[];
190
- };
191
- presetRef?: {
192
- docId: string;
193
- versionId: string;
194
- } | undefined;
195
- docId: string;
196
- versionId: string;
197
- originalVersionId: string;
198
- createdAt: string;
199
- updatedAt: string;
200
- links: string[];
201
- deleted: boolean;
202
- } & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields) | ({
203
- schemaName: "remoteDetectionAlert";
204
- detectionDateStart: string;
205
- detectionDateEnd: string;
206
- sourceId: string;
207
- metadata: {
208
- [k: string]: boolean | number | string | null | (boolean | number | string | null)[];
209
- };
210
- geometry: import("@comapeo/schema/dist/schema/remoteDetectionAlert.js").Geometry;
211
- docId: string;
212
- versionId: string;
213
- originalVersionId: string;
214
- createdAt: string;
215
- updatedAt: string;
216
- links: string[];
217
- deleted: boolean;
218
- } & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields) | ({
219
- schemaName: "preset";
220
- name: string;
221
- geometry: ("point" | "vertex" | "line" | "area" | "relation")[];
222
- tags: import("@comapeo/schema/dist/schema/preset.js").Tags;
223
- addTags: import("@comapeo/schema/dist/schema/preset.js").Tags1;
224
- removeTags: import("@comapeo/schema/dist/schema/preset.js").Tags2;
225
- fieldRefs: {
226
- docId: string;
227
- versionId: string;
228
- }[];
229
- iconRef?: {
230
- docId: string;
231
- versionId: string;
232
- } | undefined;
233
- terms: string[];
234
- color?: string | undefined;
235
- docId: string;
236
- versionId: string;
237
- originalVersionId: string;
238
- createdAt: string;
239
- updatedAt: string;
240
- links: string[];
241
- deleted: boolean;
242
- } & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields) | ({
243
- schemaName: "observation";
244
- lat?: number | undefined;
245
- lon?: number | undefined;
246
- attachments: import("@comapeo/schema/dist/schema/observation.js").Attachment[];
247
- tags: {
248
- [k: string]: boolean | number | string | null | (boolean | number | string | null)[];
249
- };
250
- metadata?: {
251
- manualLocation?: boolean;
252
- position?: import("@comapeo/schema/dist/schema/observation.js").Position;
253
- lastSavedPosition?: import("@comapeo/schema/dist/schema/observation.js").Position;
254
- positionProvider?: {
255
- gpsAvailable?: boolean;
256
- passiveAvailable?: boolean;
257
- locationServicesEnabled: boolean;
258
- networkAvailable?: boolean;
259
- };
260
- } | undefined;
261
- presetRef?: {
262
- docId: string;
263
- versionId: string;
264
- } | undefined;
265
- docId: string;
266
- versionId: string;
267
- originalVersionId: string;
268
- createdAt: string;
269
- updatedAt: string;
270
- links: string[];
271
- deleted: boolean;
272
- } & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields) | ({
273
- schemaName: "field";
274
- tagKey: string;
275
- type: "type_unspecified" | "text" | "number" | "selectOne" | "selectMultiple" | "UNRECOGNIZED";
276
- label: string;
277
- appearance?: ("appearance_unspecified" | "singleline" | "multiline" | "UNRECOGNIZED") | undefined;
278
- snakeCase?: boolean | undefined;
279
- options?: {
280
- label: string;
281
- value: string | boolean | number | null;
282
- }[] | undefined;
283
- universal?: boolean | undefined;
284
- placeholder?: string | undefined;
285
- helperText?: string | undefined;
286
- docId: string;
287
- versionId: string;
288
- originalVersionId: string;
289
- createdAt: string;
290
- updatedAt: string;
291
- links: string[];
292
- deleted: boolean;
293
- } & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields), {
294
- schemaName: D;
295
- }>;
296
- error: Error | null;
297
- isRefetching: boolean;
298
- };
62
+ }): Pick<UseSuspenseQueryResult<Awaited<ReturnType<MapeoProjectApi[D]['getByVersionId']>>>, 'data' | 'error' | 'isRefetching'>;
299
63
  /**
300
64
  * Retrieve all documents of a specific `docType`.
301
65
  *
@@ -335,125 +99,7 @@ export declare function useManyDocs<D extends WriteableDocumentType>({ projectId
335
99
  docType: D;
336
100
  includeDeleted?: boolean;
337
101
  lang?: string;
338
- }): {
339
- data: Extract<({
340
- schemaName: "track";
341
- locations: [import("@comapeo/schema/dist/schema/track.js").Position, import("@comapeo/schema/dist/schema/track.js").Position, ...import("@comapeo/schema/dist/schema/track.js").Position[]];
342
- observationRefs: {
343
- docId: string;
344
- versionId: string;
345
- }[];
346
- tags: {
347
- [k: string]: boolean | number | string | null | (boolean | number | string | null)[];
348
- };
349
- presetRef?: {
350
- docId: string;
351
- versionId: string;
352
- } | undefined;
353
- docId: string;
354
- versionId: string;
355
- originalVersionId: string;
356
- createdAt: string;
357
- updatedAt: string;
358
- links: string[];
359
- deleted: boolean;
360
- } & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields)[] | ({
361
- schemaName: "remoteDetectionAlert";
362
- detectionDateStart: string;
363
- detectionDateEnd: string;
364
- sourceId: string;
365
- metadata: {
366
- [k: string]: boolean | number | string | null | (boolean | number | string | null)[];
367
- };
368
- geometry: import("@comapeo/schema/dist/schema/remoteDetectionAlert.js").Geometry;
369
- docId: string;
370
- versionId: string;
371
- originalVersionId: string;
372
- createdAt: string;
373
- updatedAt: string;
374
- links: string[];
375
- deleted: boolean;
376
- } & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields)[] | ({
377
- schemaName: "preset";
378
- name: string;
379
- geometry: ("point" | "vertex" | "line" | "area" | "relation")[];
380
- tags: import("@comapeo/schema/dist/schema/preset.js").Tags;
381
- addTags: import("@comapeo/schema/dist/schema/preset.js").Tags1;
382
- removeTags: import("@comapeo/schema/dist/schema/preset.js").Tags2;
383
- fieldRefs: {
384
- docId: string;
385
- versionId: string;
386
- }[];
387
- iconRef?: {
388
- docId: string;
389
- versionId: string;
390
- } | undefined;
391
- terms: string[];
392
- color?: string | undefined;
393
- docId: string;
394
- versionId: string;
395
- originalVersionId: string;
396
- createdAt: string;
397
- updatedAt: string;
398
- links: string[];
399
- deleted: boolean;
400
- } & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields)[] | ({
401
- schemaName: "observation";
402
- lat?: number | undefined;
403
- lon?: number | undefined;
404
- attachments: import("@comapeo/schema/dist/schema/observation.js").Attachment[];
405
- tags: {
406
- [k: string]: boolean | number | string | null | (boolean | number | string | null)[];
407
- };
408
- metadata?: {
409
- manualLocation?: boolean;
410
- position?: import("@comapeo/schema/dist/schema/observation.js").Position;
411
- lastSavedPosition?: import("@comapeo/schema/dist/schema/observation.js").Position;
412
- positionProvider?: {
413
- gpsAvailable?: boolean;
414
- passiveAvailable?: boolean;
415
- locationServicesEnabled: boolean;
416
- networkAvailable?: boolean;
417
- };
418
- } | undefined;
419
- presetRef?: {
420
- docId: string;
421
- versionId: string;
422
- } | undefined;
423
- docId: string;
424
- versionId: string;
425
- originalVersionId: string;
426
- createdAt: string;
427
- updatedAt: string;
428
- links: string[];
429
- deleted: boolean;
430
- } & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields)[] | ({
431
- schemaName: "field";
432
- tagKey: string;
433
- type: "type_unspecified" | "text" | "number" | "selectOne" | "selectMultiple" | "UNRECOGNIZED";
434
- label: string;
435
- appearance?: ("appearance_unspecified" | "singleline" | "multiline" | "UNRECOGNIZED") | undefined;
436
- snakeCase?: boolean | undefined;
437
- options?: {
438
- label: string;
439
- value: string | boolean | number | null;
440
- }[] | undefined;
441
- universal?: boolean | undefined;
442
- placeholder?: string | undefined;
443
- helperText?: string | undefined;
444
- docId: string;
445
- versionId: string;
446
- originalVersionId: string;
447
- createdAt: string;
448
- updatedAt: string;
449
- links: string[];
450
- deleted: boolean;
451
- } & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields)[], Array<{
452
- schemaName: D;
453
- }>>;
454
- error: Error | null;
455
- isRefetching: boolean;
456
- };
102
+ }): Pick<UseSuspenseQueryResult<Awaited<ReturnType<MapeoProjectApi[D]['getMany']>>>, 'data' | 'error' | 'isRefetching'>;
457
103
  /**
458
104
  * Create a document for a project.
459
105
  *
@@ -463,27 +109,9 @@ export declare function useManyDocs<D extends WriteableDocumentType>({ projectId
463
109
  export declare function useCreateDocument<D extends WriteableDocumentType>({ docType, projectId, }: {
464
110
  docType: D;
465
111
  projectId: string;
466
- }): {
467
- error: Error;
468
- mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
469
- value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
470
- }, unknown>;
471
- mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
472
- value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
473
- }, unknown>;
474
- reset: () => void;
475
- status: "error";
476
- } | {
477
- error: null;
478
- mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
479
- value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
480
- }, unknown>;
481
- mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
482
- value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
483
- }, unknown>;
484
- reset: () => void;
485
- status: "pending" | "success" | "idle";
486
- };
112
+ }): FilteredMutationResult<UseMutationResult<Awaited<ReturnType<MapeoProjectApi[D]['create']>>, Error, {
113
+ value: Omit<WriteableValue<D>, 'schemaName'>;
114
+ }>>;
487
115
  /**
488
116
  * Update a document within a project.
489
117
  *
@@ -493,31 +121,9 @@ export declare function useCreateDocument<D extends WriteableDocumentType>({ doc
493
121
  export declare function useUpdateDocument<D extends WriteableDocumentType>({ docType, projectId, }: {
494
122
  docType: D;
495
123
  projectId: string;
496
- }): {
497
- error: Error;
498
- mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
499
- versionId: string;
500
- value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
501
- }, unknown>;
502
- mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
503
- versionId: string;
504
- value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
505
- }, unknown>;
506
- reset: () => void;
507
- status: "error";
508
- } | {
509
- error: null;
510
- mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
511
- versionId: string;
512
- value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
513
- }, unknown>;
514
- mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
515
- versionId: string;
516
- value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
517
- }, unknown>;
518
- reset: () => void;
519
- status: "pending" | "success" | "idle";
520
- };
124
+ }): FilteredMutationResult<UseMutationResult<Awaited<ReturnType<MapeoProjectApi[D]['update']>>, Error, {
125
+ value: Omit<WriteableValue<D>, 'schemaName'>;
126
+ }>>;
521
127
  /**
522
128
  * Delete a document within a project.
523
129
  *
@@ -527,27 +133,9 @@ export declare function useUpdateDocument<D extends WriteableDocumentType>({ doc
527
133
  export declare function useDeleteDocument<D extends WriteableDocumentType>({ docType, projectId, }: {
528
134
  docType: D;
529
135
  projectId: string;
530
- }): {
531
- error: Error;
532
- mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
533
- docId: string;
534
- }, unknown>;
535
- mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
536
- docId: string;
537
- }, unknown>;
538
- reset: () => void;
539
- status: "error";
540
- } | {
541
- error: null;
542
- mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
543
- docId: string;
544
- }, unknown>;
545
- mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
546
- docId: string;
547
- }, unknown>;
548
- reset: () => void;
549
- status: "pending" | "success" | "idle";
550
- };
136
+ }): FilteredMutationResult<UseMutationResult<Awaited<ReturnType<MapeoProjectApi[D]['delete']>>, Error, {
137
+ docId: string;
138
+ }>>;
551
139
  /**
552
140
  * Retrieve presets for category selection, ordered by project settings.
553
141
  *
@@ -581,4 +169,28 @@ export declare function usePresetsSelection({ projectId, dataType, lang, }: {
581
169
  projectId: string;
582
170
  dataType: 'observation' | 'track';
583
171
  lang?: string;
584
- }): Array<Preset>;
172
+ }): {
173
+ schemaName: "preset";
174
+ name: string;
175
+ geometry: ("point" | "vertex" | "line" | "area" | "relation")[];
176
+ tags: import("@comapeo/schema/dist/schema/preset.js").Tags;
177
+ addTags: import("@comapeo/schema/dist/schema/preset.js").Tags1;
178
+ removeTags: import("@comapeo/schema/dist/schema/preset.js").Tags2;
179
+ fieldRefs: {
180
+ docId: string;
181
+ versionId: string;
182
+ }[];
183
+ iconRef?: {
184
+ docId: string;
185
+ versionId: string;
186
+ } | undefined;
187
+ terms: string[];
188
+ color?: string | undefined;
189
+ docId: string;
190
+ versionId: string;
191
+ originalVersionId: string;
192
+ createdAt: string;
193
+ updatedAt: string;
194
+ links: string[];
195
+ deleted: boolean;
196
+ }[];