@comapeo/core-react 6.2.2 → 6.3.1
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/documents.d.ts +369 -52
- package/dist/commonjs/hooks/documents.js +3 -8
- package/dist/commonjs/hooks/projects.d.ts +2 -0
- package/dist/commonjs/hooks/projects.js +2 -0
- package/dist/commonjs/lib/react-query/documents.d.ts +73 -158
- package/dist/commonjs/lib/react-query/documents.js +3 -3
- package/dist/esm/hooks/documents.d.ts +369 -52
- package/dist/esm/hooks/documents.js +3 -8
- package/dist/esm/hooks/projects.d.ts +2 -0
- package/dist/esm/hooks/projects.js +2 -0
- package/dist/esm/lib/react-query/documents.d.ts +73 -158
- package/dist/esm/lib/react-query/documents.js +3 -3
- package/package.json +3 -3
|
@@ -96,7 +96,7 @@ function documentByVersionIdQueryOptions({ projectApi, projectId, docType, versi
|
|
|
96
96
|
function createDocumentMutationOptions({ docType, projectApi, projectId, queryClient, }) {
|
|
97
97
|
return {
|
|
98
98
|
...(0, shared_js_1.baseMutationOptions)(),
|
|
99
|
-
mutationFn: async ({ value
|
|
99
|
+
mutationFn: async ({ value }) => {
|
|
100
100
|
// @ts-expect-error TS not handling this well
|
|
101
101
|
return projectApi[docType].create({
|
|
102
102
|
...value,
|
|
@@ -116,7 +116,7 @@ function createDocumentMutationOptions({ docType, projectApi, projectId, queryCl
|
|
|
116
116
|
function updateDocumentMutationOptions({ docType, projectApi, projectId, queryClient, }) {
|
|
117
117
|
return {
|
|
118
118
|
...(0, shared_js_1.baseMutationOptions)(),
|
|
119
|
-
mutationFn: async ({ versionId, value
|
|
119
|
+
mutationFn: async ({ versionId, value }) => {
|
|
120
120
|
// @ts-expect-error TS not handling this well
|
|
121
121
|
return projectApi[docType].update(versionId, value);
|
|
122
122
|
},
|
|
@@ -133,7 +133,7 @@ function updateDocumentMutationOptions({ docType, projectApi, projectId, queryCl
|
|
|
133
133
|
function deleteDocumentMutationOptions({ docType, projectApi, projectId, queryClient, }) {
|
|
134
134
|
return {
|
|
135
135
|
...(0, shared_js_1.baseMutationOptions)(),
|
|
136
|
-
mutationFn: async ({ docId
|
|
136
|
+
mutationFn: async ({ docId }) => {
|
|
137
137
|
// @ts-expect-error TS not handling this well
|
|
138
138
|
return projectApi[docType].delete(docId);
|
|
139
139
|
},
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import type { MapeoDoc } from '@comapeo/schema' with { 'resolution-mode': 'import' };
|
|
2
1
|
import type { WriteableDocumentType } from '../lib/types.js';
|
|
3
|
-
type ReadHookResult<D> = {
|
|
4
|
-
data: D;
|
|
5
|
-
error: Error | null;
|
|
6
|
-
isRefetching: boolean;
|
|
7
|
-
};
|
|
8
2
|
/**
|
|
9
3
|
* Retrieve a single document from the database based on the document's document ID.
|
|
10
4
|
*
|
|
@@ -33,9 +27,125 @@ export declare function useSingleDocByDocId<D extends WriteableDocumentType>({ p
|
|
|
33
27
|
docType: D;
|
|
34
28
|
docId: string;
|
|
35
29
|
lang?: string;
|
|
36
|
-
}):
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
}): {
|
|
31
|
+
data: Extract<({
|
|
32
|
+
schemaName: "track";
|
|
33
|
+
locations: import("@comapeo/schema/dist/schema/track.js").Position[];
|
|
34
|
+
observationRefs: {
|
|
35
|
+
docId: string;
|
|
36
|
+
versionId: string;
|
|
37
|
+
}[];
|
|
38
|
+
tags: {
|
|
39
|
+
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
40
|
+
};
|
|
41
|
+
presetRef?: {
|
|
42
|
+
docId: string;
|
|
43
|
+
versionId: string;
|
|
44
|
+
} | undefined;
|
|
45
|
+
docId: string;
|
|
46
|
+
versionId: string;
|
|
47
|
+
originalVersionId: string;
|
|
48
|
+
createdAt: string;
|
|
49
|
+
updatedAt: string;
|
|
50
|
+
links: string[];
|
|
51
|
+
deleted: boolean;
|
|
52
|
+
} & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields) | ({
|
|
53
|
+
schemaName: "observation";
|
|
54
|
+
lat?: number | undefined;
|
|
55
|
+
lon?: number | undefined;
|
|
56
|
+
attachments: import("@comapeo/schema/dist/schema/observation.js").Attachment[];
|
|
57
|
+
tags: {
|
|
58
|
+
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
59
|
+
};
|
|
60
|
+
metadata?: {
|
|
61
|
+
manualLocation?: boolean;
|
|
62
|
+
position?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
63
|
+
lastSavedPosition?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
64
|
+
positionProvider?: {
|
|
65
|
+
gpsAvailable?: boolean;
|
|
66
|
+
passiveAvailable?: boolean;
|
|
67
|
+
locationServicesEnabled: boolean;
|
|
68
|
+
networkAvailable?: boolean;
|
|
69
|
+
};
|
|
70
|
+
} | undefined;
|
|
71
|
+
presetRef?: {
|
|
72
|
+
docId: string;
|
|
73
|
+
versionId: string;
|
|
74
|
+
} | undefined;
|
|
75
|
+
docId: string;
|
|
76
|
+
versionId: string;
|
|
77
|
+
originalVersionId: string;
|
|
78
|
+
createdAt: string;
|
|
79
|
+
updatedAt: string;
|
|
80
|
+
links: string[];
|
|
81
|
+
deleted: boolean;
|
|
82
|
+
} & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields) | ({
|
|
83
|
+
schemaName: "preset";
|
|
84
|
+
name: string;
|
|
85
|
+
geometry: ("point" | "vertex" | "line" | "area" | "relation")[];
|
|
86
|
+
tags: import("@comapeo/schema/dist/schema/preset.js").Tags;
|
|
87
|
+
addTags: import("@comapeo/schema/dist/schema/preset.js").Tags1;
|
|
88
|
+
removeTags: import("@comapeo/schema/dist/schema/preset.js").Tags2;
|
|
89
|
+
fieldRefs: {
|
|
90
|
+
docId: string;
|
|
91
|
+
versionId: string;
|
|
92
|
+
}[];
|
|
93
|
+
iconRef?: {
|
|
94
|
+
docId: string;
|
|
95
|
+
versionId: string;
|
|
96
|
+
} | undefined;
|
|
97
|
+
terms: string[];
|
|
98
|
+
color?: string | undefined;
|
|
99
|
+
docId: string;
|
|
100
|
+
versionId: string;
|
|
101
|
+
originalVersionId: string;
|
|
102
|
+
createdAt: string;
|
|
103
|
+
updatedAt: string;
|
|
104
|
+
links: string[];
|
|
105
|
+
deleted: boolean;
|
|
106
|
+
} & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields) | ({
|
|
107
|
+
schemaName: "field";
|
|
108
|
+
tagKey: string;
|
|
109
|
+
type: "type_unspecified" | "text" | "number" | "selectOne" | "selectMultiple" | "UNRECOGNIZED";
|
|
110
|
+
label: string;
|
|
111
|
+
appearance?: ("appearance_unspecified" | "singleline" | "multiline" | "UNRECOGNIZED") | undefined;
|
|
112
|
+
snakeCase?: boolean | undefined;
|
|
113
|
+
options?: {
|
|
114
|
+
label: string;
|
|
115
|
+
value: string | boolean | number | null;
|
|
116
|
+
}[] | undefined;
|
|
117
|
+
universal?: boolean | undefined;
|
|
118
|
+
placeholder?: string | undefined;
|
|
119
|
+
helperText?: string | undefined;
|
|
120
|
+
docId: string;
|
|
121
|
+
versionId: string;
|
|
122
|
+
originalVersionId: string;
|
|
123
|
+
createdAt: string;
|
|
124
|
+
updatedAt: string;
|
|
125
|
+
links: string[];
|
|
126
|
+
deleted: boolean;
|
|
127
|
+
} & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields) | ({
|
|
128
|
+
schemaName: "remoteDetectionAlert";
|
|
129
|
+
detectionDateStart: string;
|
|
130
|
+
detectionDateEnd: string;
|
|
131
|
+
sourceId: string;
|
|
132
|
+
metadata: {
|
|
133
|
+
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
134
|
+
};
|
|
135
|
+
geometry: import("@comapeo/schema/dist/schema/remoteDetectionAlert.js").Geometry;
|
|
136
|
+
docId: string;
|
|
137
|
+
versionId: string;
|
|
138
|
+
originalVersionId: string;
|
|
139
|
+
createdAt: string;
|
|
140
|
+
updatedAt: string;
|
|
141
|
+
links: string[];
|
|
142
|
+
deleted: boolean;
|
|
143
|
+
} & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields), {
|
|
144
|
+
schemaName: D;
|
|
145
|
+
}>;
|
|
146
|
+
error: Error | null;
|
|
147
|
+
isRefetching: boolean;
|
|
148
|
+
};
|
|
39
149
|
/**
|
|
40
150
|
* Retrieve a single document from the database based on the document's version ID.
|
|
41
151
|
*
|
|
@@ -64,9 +174,125 @@ export declare function useSingleDocByVersionId<D extends WriteableDocumentType>
|
|
|
64
174
|
docType: D;
|
|
65
175
|
versionId: string;
|
|
66
176
|
lang?: string;
|
|
67
|
-
}):
|
|
68
|
-
|
|
69
|
-
|
|
177
|
+
}): {
|
|
178
|
+
data: Extract<({
|
|
179
|
+
schemaName: "track";
|
|
180
|
+
locations: import("@comapeo/schema/dist/schema/track.js").Position[];
|
|
181
|
+
observationRefs: {
|
|
182
|
+
docId: string;
|
|
183
|
+
versionId: string;
|
|
184
|
+
}[];
|
|
185
|
+
tags: {
|
|
186
|
+
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
187
|
+
};
|
|
188
|
+
presetRef?: {
|
|
189
|
+
docId: string;
|
|
190
|
+
versionId: string;
|
|
191
|
+
} | undefined;
|
|
192
|
+
docId: string;
|
|
193
|
+
versionId: string;
|
|
194
|
+
originalVersionId: string;
|
|
195
|
+
createdAt: string;
|
|
196
|
+
updatedAt: string;
|
|
197
|
+
links: string[];
|
|
198
|
+
deleted: boolean;
|
|
199
|
+
} & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields) | ({
|
|
200
|
+
schemaName: "observation";
|
|
201
|
+
lat?: number | undefined;
|
|
202
|
+
lon?: number | undefined;
|
|
203
|
+
attachments: import("@comapeo/schema/dist/schema/observation.js").Attachment[];
|
|
204
|
+
tags: {
|
|
205
|
+
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
206
|
+
};
|
|
207
|
+
metadata?: {
|
|
208
|
+
manualLocation?: boolean;
|
|
209
|
+
position?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
210
|
+
lastSavedPosition?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
211
|
+
positionProvider?: {
|
|
212
|
+
gpsAvailable?: boolean;
|
|
213
|
+
passiveAvailable?: boolean;
|
|
214
|
+
locationServicesEnabled: boolean;
|
|
215
|
+
networkAvailable?: boolean;
|
|
216
|
+
};
|
|
217
|
+
} | undefined;
|
|
218
|
+
presetRef?: {
|
|
219
|
+
docId: string;
|
|
220
|
+
versionId: string;
|
|
221
|
+
} | undefined;
|
|
222
|
+
docId: string;
|
|
223
|
+
versionId: string;
|
|
224
|
+
originalVersionId: string;
|
|
225
|
+
createdAt: string;
|
|
226
|
+
updatedAt: string;
|
|
227
|
+
links: string[];
|
|
228
|
+
deleted: boolean;
|
|
229
|
+
} & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields) | ({
|
|
230
|
+
schemaName: "preset";
|
|
231
|
+
name: string;
|
|
232
|
+
geometry: ("point" | "vertex" | "line" | "area" | "relation")[];
|
|
233
|
+
tags: import("@comapeo/schema/dist/schema/preset.js").Tags;
|
|
234
|
+
addTags: import("@comapeo/schema/dist/schema/preset.js").Tags1;
|
|
235
|
+
removeTags: import("@comapeo/schema/dist/schema/preset.js").Tags2;
|
|
236
|
+
fieldRefs: {
|
|
237
|
+
docId: string;
|
|
238
|
+
versionId: string;
|
|
239
|
+
}[];
|
|
240
|
+
iconRef?: {
|
|
241
|
+
docId: string;
|
|
242
|
+
versionId: string;
|
|
243
|
+
} | undefined;
|
|
244
|
+
terms: string[];
|
|
245
|
+
color?: string | undefined;
|
|
246
|
+
docId: string;
|
|
247
|
+
versionId: string;
|
|
248
|
+
originalVersionId: string;
|
|
249
|
+
createdAt: string;
|
|
250
|
+
updatedAt: string;
|
|
251
|
+
links: string[];
|
|
252
|
+
deleted: boolean;
|
|
253
|
+
} & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields) | ({
|
|
254
|
+
schemaName: "field";
|
|
255
|
+
tagKey: string;
|
|
256
|
+
type: "type_unspecified" | "text" | "number" | "selectOne" | "selectMultiple" | "UNRECOGNIZED";
|
|
257
|
+
label: string;
|
|
258
|
+
appearance?: ("appearance_unspecified" | "singleline" | "multiline" | "UNRECOGNIZED") | undefined;
|
|
259
|
+
snakeCase?: boolean | undefined;
|
|
260
|
+
options?: {
|
|
261
|
+
label: string;
|
|
262
|
+
value: string | boolean | number | null;
|
|
263
|
+
}[] | undefined;
|
|
264
|
+
universal?: boolean | undefined;
|
|
265
|
+
placeholder?: string | undefined;
|
|
266
|
+
helperText?: string | undefined;
|
|
267
|
+
docId: string;
|
|
268
|
+
versionId: string;
|
|
269
|
+
originalVersionId: string;
|
|
270
|
+
createdAt: string;
|
|
271
|
+
updatedAt: string;
|
|
272
|
+
links: string[];
|
|
273
|
+
deleted: boolean;
|
|
274
|
+
} & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields) | ({
|
|
275
|
+
schemaName: "remoteDetectionAlert";
|
|
276
|
+
detectionDateStart: string;
|
|
277
|
+
detectionDateEnd: string;
|
|
278
|
+
sourceId: string;
|
|
279
|
+
metadata: {
|
|
280
|
+
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
281
|
+
};
|
|
282
|
+
geometry: import("@comapeo/schema/dist/schema/remoteDetectionAlert.js").Geometry;
|
|
283
|
+
docId: string;
|
|
284
|
+
versionId: string;
|
|
285
|
+
originalVersionId: string;
|
|
286
|
+
createdAt: string;
|
|
287
|
+
updatedAt: string;
|
|
288
|
+
links: string[];
|
|
289
|
+
deleted: boolean;
|
|
290
|
+
} & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields), {
|
|
291
|
+
schemaName: D;
|
|
292
|
+
}>;
|
|
293
|
+
error: Error | null;
|
|
294
|
+
isRefetching: boolean;
|
|
295
|
+
};
|
|
70
296
|
/**
|
|
71
297
|
* Retrieve all documents of a specific `docType`.
|
|
72
298
|
*
|
|
@@ -106,9 +332,125 @@ export declare function useManyDocs<D extends WriteableDocumentType>({ projectId
|
|
|
106
332
|
docType: D;
|
|
107
333
|
includeDeleted?: boolean;
|
|
108
334
|
lang?: string;
|
|
109
|
-
}):
|
|
110
|
-
|
|
111
|
-
|
|
335
|
+
}): {
|
|
336
|
+
data: Extract<({
|
|
337
|
+
schemaName: "track";
|
|
338
|
+
locations: import("@comapeo/schema/dist/schema/track.js").Position[];
|
|
339
|
+
observationRefs: {
|
|
340
|
+
docId: string;
|
|
341
|
+
versionId: string;
|
|
342
|
+
}[];
|
|
343
|
+
tags: {
|
|
344
|
+
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
345
|
+
};
|
|
346
|
+
presetRef?: {
|
|
347
|
+
docId: string;
|
|
348
|
+
versionId: string;
|
|
349
|
+
} | undefined;
|
|
350
|
+
docId: string;
|
|
351
|
+
versionId: string;
|
|
352
|
+
originalVersionId: string;
|
|
353
|
+
createdAt: string;
|
|
354
|
+
updatedAt: string;
|
|
355
|
+
links: string[];
|
|
356
|
+
deleted: boolean;
|
|
357
|
+
} & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields)[] | ({
|
|
358
|
+
schemaName: "observation";
|
|
359
|
+
lat?: number | undefined;
|
|
360
|
+
lon?: number | undefined;
|
|
361
|
+
attachments: import("@comapeo/schema/dist/schema/observation.js").Attachment[];
|
|
362
|
+
tags: {
|
|
363
|
+
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
364
|
+
};
|
|
365
|
+
metadata?: {
|
|
366
|
+
manualLocation?: boolean;
|
|
367
|
+
position?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
368
|
+
lastSavedPosition?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
369
|
+
positionProvider?: {
|
|
370
|
+
gpsAvailable?: boolean;
|
|
371
|
+
passiveAvailable?: boolean;
|
|
372
|
+
locationServicesEnabled: boolean;
|
|
373
|
+
networkAvailable?: boolean;
|
|
374
|
+
};
|
|
375
|
+
} | undefined;
|
|
376
|
+
presetRef?: {
|
|
377
|
+
docId: string;
|
|
378
|
+
versionId: string;
|
|
379
|
+
} | undefined;
|
|
380
|
+
docId: string;
|
|
381
|
+
versionId: string;
|
|
382
|
+
originalVersionId: string;
|
|
383
|
+
createdAt: string;
|
|
384
|
+
updatedAt: string;
|
|
385
|
+
links: string[];
|
|
386
|
+
deleted: boolean;
|
|
387
|
+
} & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields)[] | ({
|
|
388
|
+
schemaName: "preset";
|
|
389
|
+
name: string;
|
|
390
|
+
geometry: ("point" | "vertex" | "line" | "area" | "relation")[];
|
|
391
|
+
tags: import("@comapeo/schema/dist/schema/preset.js").Tags;
|
|
392
|
+
addTags: import("@comapeo/schema/dist/schema/preset.js").Tags1;
|
|
393
|
+
removeTags: import("@comapeo/schema/dist/schema/preset.js").Tags2;
|
|
394
|
+
fieldRefs: {
|
|
395
|
+
docId: string;
|
|
396
|
+
versionId: string;
|
|
397
|
+
}[];
|
|
398
|
+
iconRef?: {
|
|
399
|
+
docId: string;
|
|
400
|
+
versionId: string;
|
|
401
|
+
} | undefined;
|
|
402
|
+
terms: string[];
|
|
403
|
+
color?: string | undefined;
|
|
404
|
+
docId: string;
|
|
405
|
+
versionId: string;
|
|
406
|
+
originalVersionId: string;
|
|
407
|
+
createdAt: string;
|
|
408
|
+
updatedAt: string;
|
|
409
|
+
links: string[];
|
|
410
|
+
deleted: boolean;
|
|
411
|
+
} & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields)[] | ({
|
|
412
|
+
schemaName: "field";
|
|
413
|
+
tagKey: string;
|
|
414
|
+
type: "type_unspecified" | "text" | "number" | "selectOne" | "selectMultiple" | "UNRECOGNIZED";
|
|
415
|
+
label: string;
|
|
416
|
+
appearance?: ("appearance_unspecified" | "singleline" | "multiline" | "UNRECOGNIZED") | undefined;
|
|
417
|
+
snakeCase?: boolean | undefined;
|
|
418
|
+
options?: {
|
|
419
|
+
label: string;
|
|
420
|
+
value: string | boolean | number | null;
|
|
421
|
+
}[] | undefined;
|
|
422
|
+
universal?: boolean | undefined;
|
|
423
|
+
placeholder?: string | undefined;
|
|
424
|
+
helperText?: string | undefined;
|
|
425
|
+
docId: string;
|
|
426
|
+
versionId: string;
|
|
427
|
+
originalVersionId: string;
|
|
428
|
+
createdAt: string;
|
|
429
|
+
updatedAt: string;
|
|
430
|
+
links: string[];
|
|
431
|
+
deleted: boolean;
|
|
432
|
+
} & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields)[] | ({
|
|
433
|
+
schemaName: "remoteDetectionAlert";
|
|
434
|
+
detectionDateStart: string;
|
|
435
|
+
detectionDateEnd: string;
|
|
436
|
+
sourceId: string;
|
|
437
|
+
metadata: {
|
|
438
|
+
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
439
|
+
};
|
|
440
|
+
geometry: import("@comapeo/schema/dist/schema/remoteDetectionAlert.js").Geometry;
|
|
441
|
+
docId: string;
|
|
442
|
+
versionId: string;
|
|
443
|
+
originalVersionId: string;
|
|
444
|
+
createdAt: string;
|
|
445
|
+
updatedAt: string;
|
|
446
|
+
links: string[];
|
|
447
|
+
deleted: boolean;
|
|
448
|
+
} & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields)[], Array<{
|
|
449
|
+
schemaName: D;
|
|
450
|
+
}>>;
|
|
451
|
+
error: Error | null;
|
|
452
|
+
isRefetching: boolean;
|
|
453
|
+
};
|
|
112
454
|
/**
|
|
113
455
|
* Create a document for a project.
|
|
114
456
|
*
|
|
@@ -120,28 +462,20 @@ export declare function useCreateDocument<D extends WriteableDocumentType>({ doc
|
|
|
120
462
|
projectId: string;
|
|
121
463
|
}): {
|
|
122
464
|
error: Error;
|
|
123
|
-
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
124
|
-
forks: Array<string>;
|
|
125
|
-
}, Error, {
|
|
465
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
|
|
126
466
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
127
467
|
}, unknown>;
|
|
128
|
-
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
129
|
-
forks: Array<string>;
|
|
130
|
-
}, Error, {
|
|
468
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
|
|
131
469
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
132
470
|
}, unknown>;
|
|
133
471
|
reset: () => void;
|
|
134
472
|
status: "error";
|
|
135
473
|
} | {
|
|
136
474
|
error: null;
|
|
137
|
-
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
138
|
-
forks: Array<string>;
|
|
139
|
-
}, Error, {
|
|
475
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
|
|
140
476
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
141
477
|
}, unknown>;
|
|
142
|
-
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
143
|
-
forks: Array<string>;
|
|
144
|
-
}, Error, {
|
|
478
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
|
|
145
479
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
146
480
|
}, unknown>;
|
|
147
481
|
reset: () => void;
|
|
@@ -158,15 +492,11 @@ export declare function useUpdateDocument<D extends WriteableDocumentType>({ doc
|
|
|
158
492
|
projectId: string;
|
|
159
493
|
}): {
|
|
160
494
|
error: Error;
|
|
161
|
-
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
162
|
-
forks: Array<string>;
|
|
163
|
-
}, Error, {
|
|
495
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
|
|
164
496
|
versionId: string;
|
|
165
497
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
166
498
|
}, unknown>;
|
|
167
|
-
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
168
|
-
forks: Array<string>;
|
|
169
|
-
}, Error, {
|
|
499
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
|
|
170
500
|
versionId: string;
|
|
171
501
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
172
502
|
}, unknown>;
|
|
@@ -174,15 +504,11 @@ export declare function useUpdateDocument<D extends WriteableDocumentType>({ doc
|
|
|
174
504
|
status: "error";
|
|
175
505
|
} | {
|
|
176
506
|
error: null;
|
|
177
|
-
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
178
|
-
forks: Array<string>;
|
|
179
|
-
}, Error, {
|
|
507
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
|
|
180
508
|
versionId: string;
|
|
181
509
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
182
510
|
}, unknown>;
|
|
183
|
-
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
184
|
-
forks: Array<string>;
|
|
185
|
-
}, Error, {
|
|
511
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
|
|
186
512
|
versionId: string;
|
|
187
513
|
value: Omit<import("../lib/types.js").WriteableValue<D>, "schemaName">;
|
|
188
514
|
}, unknown>;
|
|
@@ -200,31 +526,22 @@ export declare function useDeleteDocument<D extends WriteableDocumentType>({ doc
|
|
|
200
526
|
projectId: string;
|
|
201
527
|
}): {
|
|
202
528
|
error: Error;
|
|
203
|
-
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
204
|
-
forks: Array<string>;
|
|
205
|
-
}, Error, {
|
|
529
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
|
|
206
530
|
docId: string;
|
|
207
531
|
}, unknown>;
|
|
208
|
-
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
209
|
-
forks: Array<string>;
|
|
210
|
-
}, Error, {
|
|
532
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
|
|
211
533
|
docId: string;
|
|
212
534
|
}, unknown>;
|
|
213
535
|
reset: () => void;
|
|
214
536
|
status: "error";
|
|
215
537
|
} | {
|
|
216
538
|
error: null;
|
|
217
|
-
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
218
|
-
forks: Array<string>;
|
|
219
|
-
}, Error, {
|
|
539
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
|
|
220
540
|
docId: string;
|
|
221
541
|
}, unknown>;
|
|
222
|
-
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & {
|
|
223
|
-
forks: Array<string>;
|
|
224
|
-
}, Error, {
|
|
542
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("../lib/types.js").WriteableDocument<D> & import("@comapeo/core/dist/datatype/index.js").DerivedDocFields, Error, {
|
|
225
543
|
docId: string;
|
|
226
544
|
}, unknown>;
|
|
227
545
|
reset: () => void;
|
|
228
546
|
status: "pending" | "success" | "idle";
|
|
229
547
|
};
|
|
230
|
-
export {};
|
|
@@ -34,10 +34,7 @@ export function useSingleDocByDocId({ projectId, docType, docId, lang, }) {
|
|
|
34
34
|
lang,
|
|
35
35
|
}));
|
|
36
36
|
return {
|
|
37
|
-
|
|
38
|
-
// be narrowed properly within the function body. See for example
|
|
39
|
-
// https://github.com/microsoft/TypeScript/issues/33014#event-15134418011
|
|
40
|
-
data,
|
|
37
|
+
data: data,
|
|
41
38
|
error,
|
|
42
39
|
isRefetching,
|
|
43
40
|
};
|
|
@@ -75,8 +72,7 @@ export function useSingleDocByVersionId({ projectId, docType, versionId, lang, }
|
|
|
75
72
|
lang,
|
|
76
73
|
}));
|
|
77
74
|
return {
|
|
78
|
-
|
|
79
|
-
data,
|
|
75
|
+
data: data,
|
|
80
76
|
error,
|
|
81
77
|
isRefetching,
|
|
82
78
|
};
|
|
@@ -125,8 +121,7 @@ export function useManyDocs({ projectId, docType, includeDeleted, lang, }) {
|
|
|
125
121
|
lang,
|
|
126
122
|
}));
|
|
127
123
|
return {
|
|
128
|
-
|
|
129
|
-
data,
|
|
124
|
+
data: data,
|
|
130
125
|
error,
|
|
131
126
|
isRefetching,
|
|
132
127
|
};
|
|
@@ -221,6 +221,8 @@ export declare function useAttachmentUrl({ projectId, blobId, }: {
|
|
|
221
221
|
* })
|
|
222
222
|
* }
|
|
223
223
|
* ```
|
|
224
|
+
*
|
|
225
|
+
* @deprecated Use `createdBy` field from document read hooks.
|
|
224
226
|
*/
|
|
225
227
|
export declare function useDocumentCreatedBy({ projectId, originalVersionId, }: {
|
|
226
228
|
projectId: string;
|
|
@@ -251,6 +251,8 @@ function useMediaServerOrigin({ projectApi }) {
|
|
|
251
251
|
* })
|
|
252
252
|
* }
|
|
253
253
|
* ```
|
|
254
|
+
*
|
|
255
|
+
* @deprecated Use `createdBy` field from document read hooks.
|
|
254
256
|
*/
|
|
255
257
|
export function useDocumentCreatedBy({ projectId, originalVersionId, }) {
|
|
256
258
|
const { data: projectApi } = useSingleProject({ projectId });
|