@comapeo/core-react 6.4.0 → 7.1.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/documents.d.ts +111 -111
- package/dist/commonjs/hooks/projects.d.ts +93 -1
- package/dist/commonjs/hooks/projects.js +78 -0
- package/dist/commonjs/index.d.ts +1 -1
- package/dist/commonjs/index.js +5 -1
- package/dist/commonjs/lib/react-query/documents.d.ts +448 -448
- package/dist/commonjs/lib/react-query/projects.d.ts +36 -3
- package/dist/commonjs/lib/react-query/projects.js +32 -0
- package/dist/esm/hooks/documents.d.ts +111 -111
- package/dist/esm/hooks/projects.d.ts +93 -1
- package/dist/esm/hooks/projects.js +77 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/lib/react-query/documents.d.ts +448 -448
- package/dist/esm/lib/react-query/projects.d.ts +36 -3
- package/dist/esm/lib/react-query/projects.js +30 -0
- package/package.json +7 -7
|
@@ -31,7 +31,7 @@ export declare function useSingleDocByDocId<D extends WriteableDocumentType>({ p
|
|
|
31
31
|
}): {
|
|
32
32
|
data: Extract<({
|
|
33
33
|
schemaName: "track";
|
|
34
|
-
locations: import("@comapeo/schema/dist/schema/track.js").Position[];
|
|
34
|
+
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[]];
|
|
35
35
|
observationRefs: {
|
|
36
36
|
docId: string;
|
|
37
37
|
versionId: string;
|
|
@@ -51,28 +51,14 @@ export declare function useSingleDocByDocId<D extends WriteableDocumentType>({ p
|
|
|
51
51
|
links: string[];
|
|
52
52
|
deleted: boolean;
|
|
53
53
|
} & import("@comapeo/core/dist/datatype/index.js", { with: { "resolution-mode": "import" } }).DerivedDocFields) | ({
|
|
54
|
-
schemaName: "
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
schemaName: "remoteDetectionAlert";
|
|
55
|
+
detectionDateStart: string;
|
|
56
|
+
detectionDateEnd: string;
|
|
57
|
+
sourceId: string;
|
|
58
|
+
metadata: {
|
|
59
59
|
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
60
60
|
};
|
|
61
|
-
|
|
62
|
-
manualLocation?: boolean;
|
|
63
|
-
position?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
64
|
-
lastSavedPosition?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
65
|
-
positionProvider?: {
|
|
66
|
-
gpsAvailable?: boolean;
|
|
67
|
-
passiveAvailable?: boolean;
|
|
68
|
-
locationServicesEnabled: boolean;
|
|
69
|
-
networkAvailable?: boolean;
|
|
70
|
-
};
|
|
71
|
-
} | undefined;
|
|
72
|
-
presetRef?: {
|
|
73
|
-
docId: string;
|
|
74
|
-
versionId: string;
|
|
75
|
-
} | undefined;
|
|
61
|
+
geometry: import("@comapeo/schema/dist/schema/remoteDetectionAlert.js").Geometry;
|
|
76
62
|
docId: string;
|
|
77
63
|
versionId: string;
|
|
78
64
|
originalVersionId: string;
|
|
@@ -104,6 +90,36 @@ export declare function useSingleDocByDocId<D extends WriteableDocumentType>({ p
|
|
|
104
90
|
updatedAt: string;
|
|
105
91
|
links: string[];
|
|
106
92
|
deleted: boolean;
|
|
93
|
+
} & import("@comapeo/core/dist/datatype/index.js", { with: { "resolution-mode": "import" } }).DerivedDocFields) | ({
|
|
94
|
+
schemaName: "observation";
|
|
95
|
+
lat?: number | undefined;
|
|
96
|
+
lon?: number | undefined;
|
|
97
|
+
attachments: import("@comapeo/schema/dist/schema/observation.js").Attachment[];
|
|
98
|
+
tags: {
|
|
99
|
+
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
100
|
+
};
|
|
101
|
+
metadata?: {
|
|
102
|
+
manualLocation?: boolean;
|
|
103
|
+
position?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
104
|
+
lastSavedPosition?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
105
|
+
positionProvider?: {
|
|
106
|
+
gpsAvailable?: boolean;
|
|
107
|
+
passiveAvailable?: boolean;
|
|
108
|
+
locationServicesEnabled: boolean;
|
|
109
|
+
networkAvailable?: boolean;
|
|
110
|
+
};
|
|
111
|
+
} | undefined;
|
|
112
|
+
presetRef?: {
|
|
113
|
+
docId: string;
|
|
114
|
+
versionId: string;
|
|
115
|
+
} | undefined;
|
|
116
|
+
docId: string;
|
|
117
|
+
versionId: string;
|
|
118
|
+
originalVersionId: string;
|
|
119
|
+
createdAt: string;
|
|
120
|
+
updatedAt: string;
|
|
121
|
+
links: string[];
|
|
122
|
+
deleted: boolean;
|
|
107
123
|
} & import("@comapeo/core/dist/datatype/index.js", { with: { "resolution-mode": "import" } }).DerivedDocFields) | ({
|
|
108
124
|
schemaName: "field";
|
|
109
125
|
tagKey: string;
|
|
@@ -125,22 +141,6 @@ export declare function useSingleDocByDocId<D extends WriteableDocumentType>({ p
|
|
|
125
141
|
updatedAt: string;
|
|
126
142
|
links: string[];
|
|
127
143
|
deleted: boolean;
|
|
128
|
-
} & import("@comapeo/core/dist/datatype/index.js", { with: { "resolution-mode": "import" } }).DerivedDocFields) | ({
|
|
129
|
-
schemaName: "remoteDetectionAlert";
|
|
130
|
-
detectionDateStart: string;
|
|
131
|
-
detectionDateEnd: string;
|
|
132
|
-
sourceId: string;
|
|
133
|
-
metadata: {
|
|
134
|
-
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
135
|
-
};
|
|
136
|
-
geometry: import("@comapeo/schema/dist/schema/remoteDetectionAlert.js").Geometry;
|
|
137
|
-
docId: string;
|
|
138
|
-
versionId: string;
|
|
139
|
-
originalVersionId: string;
|
|
140
|
-
createdAt: string;
|
|
141
|
-
updatedAt: string;
|
|
142
|
-
links: string[];
|
|
143
|
-
deleted: boolean;
|
|
144
144
|
} & import("@comapeo/core/dist/datatype/index.js", { with: { "resolution-mode": "import" } }).DerivedDocFields), {
|
|
145
145
|
schemaName: D;
|
|
146
146
|
}>;
|
|
@@ -178,7 +178,7 @@ export declare function useSingleDocByVersionId<D extends WriteableDocumentType>
|
|
|
178
178
|
}): {
|
|
179
179
|
data: Extract<({
|
|
180
180
|
schemaName: "track";
|
|
181
|
-
locations: import("@comapeo/schema/dist/schema/track.js").Position[];
|
|
181
|
+
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[]];
|
|
182
182
|
observationRefs: {
|
|
183
183
|
docId: string;
|
|
184
184
|
versionId: string;
|
|
@@ -198,28 +198,14 @@ export declare function useSingleDocByVersionId<D extends WriteableDocumentType>
|
|
|
198
198
|
links: string[];
|
|
199
199
|
deleted: boolean;
|
|
200
200
|
} & import("@comapeo/core/dist/datatype/index.js", { with: { "resolution-mode": "import" } }).DerivedDocFields) | ({
|
|
201
|
-
schemaName: "
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
201
|
+
schemaName: "remoteDetectionAlert";
|
|
202
|
+
detectionDateStart: string;
|
|
203
|
+
detectionDateEnd: string;
|
|
204
|
+
sourceId: string;
|
|
205
|
+
metadata: {
|
|
206
206
|
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
207
207
|
};
|
|
208
|
-
|
|
209
|
-
manualLocation?: boolean;
|
|
210
|
-
position?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
211
|
-
lastSavedPosition?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
212
|
-
positionProvider?: {
|
|
213
|
-
gpsAvailable?: boolean;
|
|
214
|
-
passiveAvailable?: boolean;
|
|
215
|
-
locationServicesEnabled: boolean;
|
|
216
|
-
networkAvailable?: boolean;
|
|
217
|
-
};
|
|
218
|
-
} | undefined;
|
|
219
|
-
presetRef?: {
|
|
220
|
-
docId: string;
|
|
221
|
-
versionId: string;
|
|
222
|
-
} | undefined;
|
|
208
|
+
geometry: import("@comapeo/schema/dist/schema/remoteDetectionAlert.js").Geometry;
|
|
223
209
|
docId: string;
|
|
224
210
|
versionId: string;
|
|
225
211
|
originalVersionId: string;
|
|
@@ -251,6 +237,36 @@ export declare function useSingleDocByVersionId<D extends WriteableDocumentType>
|
|
|
251
237
|
updatedAt: string;
|
|
252
238
|
links: string[];
|
|
253
239
|
deleted: boolean;
|
|
240
|
+
} & import("@comapeo/core/dist/datatype/index.js", { with: { "resolution-mode": "import" } }).DerivedDocFields) | ({
|
|
241
|
+
schemaName: "observation";
|
|
242
|
+
lat?: number | undefined;
|
|
243
|
+
lon?: number | undefined;
|
|
244
|
+
attachments: import("@comapeo/schema/dist/schema/observation.js").Attachment[];
|
|
245
|
+
tags: {
|
|
246
|
+
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
247
|
+
};
|
|
248
|
+
metadata?: {
|
|
249
|
+
manualLocation?: boolean;
|
|
250
|
+
position?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
251
|
+
lastSavedPosition?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
252
|
+
positionProvider?: {
|
|
253
|
+
gpsAvailable?: boolean;
|
|
254
|
+
passiveAvailable?: boolean;
|
|
255
|
+
locationServicesEnabled: boolean;
|
|
256
|
+
networkAvailable?: boolean;
|
|
257
|
+
};
|
|
258
|
+
} | undefined;
|
|
259
|
+
presetRef?: {
|
|
260
|
+
docId: string;
|
|
261
|
+
versionId: string;
|
|
262
|
+
} | undefined;
|
|
263
|
+
docId: string;
|
|
264
|
+
versionId: string;
|
|
265
|
+
originalVersionId: string;
|
|
266
|
+
createdAt: string;
|
|
267
|
+
updatedAt: string;
|
|
268
|
+
links: string[];
|
|
269
|
+
deleted: boolean;
|
|
254
270
|
} & import("@comapeo/core/dist/datatype/index.js", { with: { "resolution-mode": "import" } }).DerivedDocFields) | ({
|
|
255
271
|
schemaName: "field";
|
|
256
272
|
tagKey: string;
|
|
@@ -272,22 +288,6 @@ export declare function useSingleDocByVersionId<D extends WriteableDocumentType>
|
|
|
272
288
|
updatedAt: string;
|
|
273
289
|
links: string[];
|
|
274
290
|
deleted: boolean;
|
|
275
|
-
} & import("@comapeo/core/dist/datatype/index.js", { with: { "resolution-mode": "import" } }).DerivedDocFields) | ({
|
|
276
|
-
schemaName: "remoteDetectionAlert";
|
|
277
|
-
detectionDateStart: string;
|
|
278
|
-
detectionDateEnd: string;
|
|
279
|
-
sourceId: string;
|
|
280
|
-
metadata: {
|
|
281
|
-
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
282
|
-
};
|
|
283
|
-
geometry: import("@comapeo/schema/dist/schema/remoteDetectionAlert.js").Geometry;
|
|
284
|
-
docId: string;
|
|
285
|
-
versionId: string;
|
|
286
|
-
originalVersionId: string;
|
|
287
|
-
createdAt: string;
|
|
288
|
-
updatedAt: string;
|
|
289
|
-
links: string[];
|
|
290
|
-
deleted: boolean;
|
|
291
291
|
} & import("@comapeo/core/dist/datatype/index.js", { with: { "resolution-mode": "import" } }).DerivedDocFields), {
|
|
292
292
|
schemaName: D;
|
|
293
293
|
}>;
|
|
@@ -336,7 +336,7 @@ export declare function useManyDocs<D extends WriteableDocumentType>({ projectId
|
|
|
336
336
|
}): {
|
|
337
337
|
data: Extract<({
|
|
338
338
|
schemaName: "track";
|
|
339
|
-
locations: import("@comapeo/schema/dist/schema/track.js").Position[];
|
|
339
|
+
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[]];
|
|
340
340
|
observationRefs: {
|
|
341
341
|
docId: string;
|
|
342
342
|
versionId: string;
|
|
@@ -356,28 +356,14 @@ export declare function useManyDocs<D extends WriteableDocumentType>({ projectId
|
|
|
356
356
|
links: string[];
|
|
357
357
|
deleted: boolean;
|
|
358
358
|
} & import("@comapeo/core/dist/datatype/index.js", { with: { "resolution-mode": "import" } }).DerivedDocFields)[] | ({
|
|
359
|
-
schemaName: "
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
359
|
+
schemaName: "remoteDetectionAlert";
|
|
360
|
+
detectionDateStart: string;
|
|
361
|
+
detectionDateEnd: string;
|
|
362
|
+
sourceId: string;
|
|
363
|
+
metadata: {
|
|
364
364
|
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
365
365
|
};
|
|
366
|
-
|
|
367
|
-
manualLocation?: boolean;
|
|
368
|
-
position?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
369
|
-
lastSavedPosition?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
370
|
-
positionProvider?: {
|
|
371
|
-
gpsAvailable?: boolean;
|
|
372
|
-
passiveAvailable?: boolean;
|
|
373
|
-
locationServicesEnabled: boolean;
|
|
374
|
-
networkAvailable?: boolean;
|
|
375
|
-
};
|
|
376
|
-
} | undefined;
|
|
377
|
-
presetRef?: {
|
|
378
|
-
docId: string;
|
|
379
|
-
versionId: string;
|
|
380
|
-
} | undefined;
|
|
366
|
+
geometry: import("@comapeo/schema/dist/schema/remoteDetectionAlert.js").Geometry;
|
|
381
367
|
docId: string;
|
|
382
368
|
versionId: string;
|
|
383
369
|
originalVersionId: string;
|
|
@@ -409,6 +395,36 @@ export declare function useManyDocs<D extends WriteableDocumentType>({ projectId
|
|
|
409
395
|
updatedAt: string;
|
|
410
396
|
links: string[];
|
|
411
397
|
deleted: boolean;
|
|
398
|
+
} & import("@comapeo/core/dist/datatype/index.js", { with: { "resolution-mode": "import" } }).DerivedDocFields)[] | ({
|
|
399
|
+
schemaName: "observation";
|
|
400
|
+
lat?: number | undefined;
|
|
401
|
+
lon?: number | undefined;
|
|
402
|
+
attachments: import("@comapeo/schema/dist/schema/observation.js").Attachment[];
|
|
403
|
+
tags: {
|
|
404
|
+
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
405
|
+
};
|
|
406
|
+
metadata?: {
|
|
407
|
+
manualLocation?: boolean;
|
|
408
|
+
position?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
409
|
+
lastSavedPosition?: import("@comapeo/schema/dist/schema/observation.js").Position;
|
|
410
|
+
positionProvider?: {
|
|
411
|
+
gpsAvailable?: boolean;
|
|
412
|
+
passiveAvailable?: boolean;
|
|
413
|
+
locationServicesEnabled: boolean;
|
|
414
|
+
networkAvailable?: boolean;
|
|
415
|
+
};
|
|
416
|
+
} | undefined;
|
|
417
|
+
presetRef?: {
|
|
418
|
+
docId: string;
|
|
419
|
+
versionId: string;
|
|
420
|
+
} | undefined;
|
|
421
|
+
docId: string;
|
|
422
|
+
versionId: string;
|
|
423
|
+
originalVersionId: string;
|
|
424
|
+
createdAt: string;
|
|
425
|
+
updatedAt: string;
|
|
426
|
+
links: string[];
|
|
427
|
+
deleted: boolean;
|
|
412
428
|
} & import("@comapeo/core/dist/datatype/index.js", { with: { "resolution-mode": "import" } }).DerivedDocFields)[] | ({
|
|
413
429
|
schemaName: "field";
|
|
414
430
|
tagKey: string;
|
|
@@ -430,22 +446,6 @@ export declare function useManyDocs<D extends WriteableDocumentType>({ projectId
|
|
|
430
446
|
updatedAt: string;
|
|
431
447
|
links: string[];
|
|
432
448
|
deleted: boolean;
|
|
433
|
-
} & import("@comapeo/core/dist/datatype/index.js", { with: { "resolution-mode": "import" } }).DerivedDocFields)[] | ({
|
|
434
|
-
schemaName: "remoteDetectionAlert";
|
|
435
|
-
detectionDateStart: string;
|
|
436
|
-
detectionDateEnd: string;
|
|
437
|
-
sourceId: string;
|
|
438
|
-
metadata: {
|
|
439
|
-
[k: string]: boolean | number | string | null | (boolean | number | string | null)[];
|
|
440
|
-
};
|
|
441
|
-
geometry: import("@comapeo/schema/dist/schema/remoteDetectionAlert.js").Geometry;
|
|
442
|
-
docId: string;
|
|
443
|
-
versionId: string;
|
|
444
|
-
originalVersionId: string;
|
|
445
|
-
createdAt: string;
|
|
446
|
-
updatedAt: string;
|
|
447
|
-
links: string[];
|
|
448
|
-
deleted: boolean;
|
|
449
449
|
} & import("@comapeo/core/dist/datatype/index.js", { with: { "resolution-mode": "import" } }).DerivedDocFields)[], Array<{
|
|
450
450
|
schemaName: D;
|
|
451
451
|
}>>;
|
|
@@ -250,7 +250,9 @@ export declare function useDocumentCreatedBy({ projectId, originalVersionId, }:
|
|
|
250
250
|
export declare function useOwnRoleInProject({ projectId }: {
|
|
251
251
|
projectId: string;
|
|
252
252
|
}): {
|
|
253
|
-
data: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role
|
|
253
|
+
data: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role & {
|
|
254
|
+
reason: string | undefined;
|
|
255
|
+
};
|
|
254
256
|
error: Error | null;
|
|
255
257
|
isRefetching: boolean;
|
|
256
258
|
};
|
|
@@ -360,9 +362,38 @@ export declare function useLeaveProject(): {
|
|
|
360
362
|
reset: () => void;
|
|
361
363
|
status: "pending" | "success" | "idle";
|
|
362
364
|
};
|
|
365
|
+
/**
|
|
366
|
+
* Update the categories of a project using an external file.
|
|
367
|
+
*
|
|
368
|
+
* @param opts.projectId Public ID of the project to apply changes to.
|
|
369
|
+
*/
|
|
370
|
+
export declare function useImportProjectCategories({ projectId, }: {
|
|
371
|
+
projectId: string;
|
|
372
|
+
}): {
|
|
373
|
+
error: Error;
|
|
374
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
375
|
+
filePath: string;
|
|
376
|
+
}, unknown>;
|
|
377
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
378
|
+
filePath: string;
|
|
379
|
+
}, unknown>;
|
|
380
|
+
reset: () => void;
|
|
381
|
+
status: "error";
|
|
382
|
+
} | {
|
|
383
|
+
error: null;
|
|
384
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
385
|
+
filePath: string;
|
|
386
|
+
}, unknown>;
|
|
387
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
388
|
+
filePath: string;
|
|
389
|
+
}, unknown>;
|
|
390
|
+
reset: () => void;
|
|
391
|
+
status: "pending" | "success" | "idle";
|
|
392
|
+
};
|
|
363
393
|
/**
|
|
364
394
|
* Update the configuration of a project using an external file.
|
|
365
395
|
*
|
|
396
|
+
* @deprecated Use `useImportProjectCategories` instead.
|
|
366
397
|
* @param opts.projectId Public ID of the project to apply changes to.
|
|
367
398
|
*/
|
|
368
399
|
export declare function useImportProjectConfig({ projectId }: {
|
|
@@ -449,6 +480,67 @@ export declare function useChangeMemberRole({ projectId }: {
|
|
|
449
480
|
reset: () => void;
|
|
450
481
|
status: "pending" | "success" | "idle";
|
|
451
482
|
};
|
|
483
|
+
/**
|
|
484
|
+
* Remove a member from a project, providing an optional reason for removal.
|
|
485
|
+
*
|
|
486
|
+
* Do NOT use this for removing your own device from a project. Use `useLeaveProject` instead.
|
|
487
|
+
*
|
|
488
|
+
* @param opts.projectId Project public ID
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* ```tsx
|
|
492
|
+
* function BasicExample() {
|
|
493
|
+
* const { mutate } = useRemoveMember({ projectId: '...' })
|
|
494
|
+
* mutate({
|
|
495
|
+
* deviceId: '...',
|
|
496
|
+
* // Optional
|
|
497
|
+
* reason: '...',
|
|
498
|
+
* })
|
|
499
|
+
* }
|
|
500
|
+
* ```
|
|
501
|
+
*/
|
|
502
|
+
export declare function useRemoveMember({ projectId }: {
|
|
503
|
+
projectId: string;
|
|
504
|
+
}): {
|
|
505
|
+
error: Error;
|
|
506
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
507
|
+
deviceId: string;
|
|
508
|
+
reason?: string;
|
|
509
|
+
}, unknown>;
|
|
510
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
511
|
+
deviceId: string;
|
|
512
|
+
reason?: string;
|
|
513
|
+
}, unknown>;
|
|
514
|
+
reset: () => void;
|
|
515
|
+
status: "error";
|
|
516
|
+
} | {
|
|
517
|
+
error: null;
|
|
518
|
+
mutate: import("@tanstack/react-query").UseMutateFunction<void, Error, {
|
|
519
|
+
deviceId: string;
|
|
520
|
+
reason?: string;
|
|
521
|
+
}, unknown>;
|
|
522
|
+
mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<void, Error, {
|
|
523
|
+
deviceId: string;
|
|
524
|
+
reason?: string;
|
|
525
|
+
}, unknown>;
|
|
526
|
+
reset: () => void;
|
|
527
|
+
status: "pending" | "success" | "idle";
|
|
528
|
+
};
|
|
529
|
+
/**
|
|
530
|
+
* Set up listener for changes to your own role in a project.
|
|
531
|
+
* It is necessary to use this if you want the project role-related read hooks to update
|
|
532
|
+
* based on role change events that are received in the background.
|
|
533
|
+
*
|
|
534
|
+
* @example
|
|
535
|
+
* ```tsx
|
|
536
|
+
* function SomeComponent({ projectId }: { projectId: string }) {
|
|
537
|
+
* useProjectOwnRoleChangeListener({ projectId })
|
|
538
|
+
* }
|
|
539
|
+
* ```
|
|
540
|
+
*/
|
|
541
|
+
export declare function useProjectOwnRoleChangeListener({ projectId, }: {
|
|
542
|
+
projectId: string;
|
|
543
|
+
}): void;
|
|
452
544
|
/**
|
|
453
545
|
* Create a blob for a project.
|
|
454
546
|
*
|
|
@@ -13,9 +13,12 @@ exports.useAddServerPeer = useAddServerPeer;
|
|
|
13
13
|
exports.useRemoveServerPeer = useRemoveServerPeer;
|
|
14
14
|
exports.useCreateProject = useCreateProject;
|
|
15
15
|
exports.useLeaveProject = useLeaveProject;
|
|
16
|
+
exports.useImportProjectCategories = useImportProjectCategories;
|
|
16
17
|
exports.useImportProjectConfig = useImportProjectConfig;
|
|
17
18
|
exports.useUpdateProjectSettings = useUpdateProjectSettings;
|
|
18
19
|
exports.useChangeMemberRole = useChangeMemberRole;
|
|
20
|
+
exports.useRemoveMember = useRemoveMember;
|
|
21
|
+
exports.useProjectOwnRoleChangeListener = useProjectOwnRoleChangeListener;
|
|
19
22
|
exports.useCreateBlob = useCreateBlob;
|
|
20
23
|
exports.useSyncState = useSyncState;
|
|
21
24
|
exports.useDataSyncProgress = useDataSyncProgress;
|
|
@@ -345,9 +348,27 @@ function useLeaveProject() {
|
|
|
345
348
|
? { error, mutate, mutateAsync, reset, status }
|
|
346
349
|
: { error: null, mutate, mutateAsync, reset, status };
|
|
347
350
|
}
|
|
351
|
+
/**
|
|
352
|
+
* Update the categories of a project using an external file.
|
|
353
|
+
*
|
|
354
|
+
* @param opts.projectId Public ID of the project to apply changes to.
|
|
355
|
+
*/
|
|
356
|
+
function useImportProjectCategories({ projectId, }) {
|
|
357
|
+
const queryClient = (0, react_query_1.useQueryClient)();
|
|
358
|
+
const { data: projectApi } = useSingleProject({ projectId });
|
|
359
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.importProjectCategoriesMutationOptions)({
|
|
360
|
+
queryClient,
|
|
361
|
+
projectApi,
|
|
362
|
+
projectId,
|
|
363
|
+
}));
|
|
364
|
+
return status === 'error'
|
|
365
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
366
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
367
|
+
}
|
|
348
368
|
/**
|
|
349
369
|
* Update the configuration of a project using an external file.
|
|
350
370
|
*
|
|
371
|
+
* @deprecated Use `useImportProjectCategories` instead.
|
|
351
372
|
* @param opts.projectId Public ID of the project to apply changes to.
|
|
352
373
|
*/
|
|
353
374
|
function useImportProjectConfig({ projectId }) {
|
|
@@ -393,6 +414,63 @@ function useChangeMemberRole({ projectId }) {
|
|
|
393
414
|
? { error, mutate, mutateAsync, reset, status }
|
|
394
415
|
: { error: null, mutate, mutateAsync, reset, status };
|
|
395
416
|
}
|
|
417
|
+
/**
|
|
418
|
+
* Remove a member from a project, providing an optional reason for removal.
|
|
419
|
+
*
|
|
420
|
+
* Do NOT use this for removing your own device from a project. Use `useLeaveProject` instead.
|
|
421
|
+
*
|
|
422
|
+
* @param opts.projectId Project public ID
|
|
423
|
+
*
|
|
424
|
+
* @example
|
|
425
|
+
* ```tsx
|
|
426
|
+
* function BasicExample() {
|
|
427
|
+
* const { mutate } = useRemoveMember({ projectId: '...' })
|
|
428
|
+
* mutate({
|
|
429
|
+
* deviceId: '...',
|
|
430
|
+
* // Optional
|
|
431
|
+
* reason: '...',
|
|
432
|
+
* })
|
|
433
|
+
* }
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
function useRemoveMember({ projectId }) {
|
|
437
|
+
const queryClient = (0, react_query_1.useQueryClient)();
|
|
438
|
+
const { data: projectApi } = useSingleProject({ projectId });
|
|
439
|
+
const { error, mutate, mutateAsync, reset, status } = (0, react_query_1.useMutation)((0, projects_js_1.removeProjectMemberMutationOptions)({ projectId, projectApi, queryClient }));
|
|
440
|
+
return status === 'error'
|
|
441
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
442
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Set up listener for changes to your own role in a project.
|
|
446
|
+
* It is necessary to use this if you want the project role-related read hooks to update
|
|
447
|
+
* based on role change events that are received in the background.
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* ```tsx
|
|
451
|
+
* function SomeComponent({ projectId }: { projectId: string }) {
|
|
452
|
+
* useProjectOwnRoleChangeListener({ projectId })
|
|
453
|
+
* }
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
function useProjectOwnRoleChangeListener({ projectId, }) {
|
|
457
|
+
const queryClient = (0, react_query_1.useQueryClient)();
|
|
458
|
+
const { data: projectApi } = useSingleProject({ projectId });
|
|
459
|
+
(0, react_1.useEffect)(() => {
|
|
460
|
+
function invalidateCache() {
|
|
461
|
+
queryClient.invalidateQueries({
|
|
462
|
+
queryKey: (0, projects_js_1.getMembersQueryKey)({ projectId }),
|
|
463
|
+
});
|
|
464
|
+
queryClient.invalidateQueries({
|
|
465
|
+
queryKey: (0, projects_js_1.getProjectRoleQueryKey)({ projectId }),
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
projectApi.addListener('own-role-change', invalidateCache);
|
|
469
|
+
return () => {
|
|
470
|
+
projectApi.removeListener('own-role-change', invalidateCache);
|
|
471
|
+
};
|
|
472
|
+
}, [projectApi, queryClient, projectId]);
|
|
473
|
+
}
|
|
396
474
|
/**
|
|
397
475
|
* Create a blob for a project.
|
|
398
476
|
*
|
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ export { useClientApi, useIsArchiveDevice, useOwnDeviceInfo, useSetIsArchiveDevi
|
|
|
3
3
|
export { useCreateDocument, useDeleteDocument, useManyDocs, usePresetsSelection, useSingleDocByDocId, useSingleDocByVersionId, useUpdateDocument, } from './hooks/documents.js';
|
|
4
4
|
export { useAcceptInvite, useManyInvites, useRejectInvite, useRequestCancelInvite, useSendInvite, useSetUpInvitesListeners, useSingleInvite, } from './hooks/invites.js';
|
|
5
5
|
export { useMapStyleUrl } from './hooks/maps.js';
|
|
6
|
-
export { useAddServerPeer, useAttachmentUrl, useConnectSyncServers, useCreateBlob, useCreateProject, useDataSyncProgress, useDisconnectSyncServers, useDocumentCreatedBy, useIconUrl, useImportProjectConfig, useLeaveProject, useManyMembers, useManyProjects, useOwnRoleInProject, useProjectSettings, useRemoveServerPeer, useSetAutostopDataSyncTimeout, useSingleMember, useSingleProject, useStartSync, useStopSync, useSyncState, useUpdateProjectSettings, useChangeMemberRole, useExportGeoJSON, useExportZipFile, } from './hooks/projects.js';
|
|
6
|
+
export { useAddServerPeer, useAttachmentUrl, useConnectSyncServers, useCreateBlob, useCreateProject, useDataSyncProgress, useDisconnectSyncServers, useDocumentCreatedBy, useIconUrl, useImportProjectCategories, useImportProjectConfig, useLeaveProject, useManyMembers, useManyProjects, useOwnRoleInProject, useProjectOwnRoleChangeListener, useProjectSettings, useRemoveServerPeer, useRemoveMember, useSetAutostopDataSyncTimeout, useSingleMember, useSingleProject, useStartSync, useStopSync, useSyncState, useUpdateProjectSettings, useChangeMemberRole, useExportGeoJSON, useExportZipFile, } 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/commonjs/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useExportGeoJSON = exports.useChangeMemberRole = exports.useUpdateProjectSettings = exports.useSyncState = exports.useStopSync = exports.useStartSync = exports.useSingleProject = exports.useSingleMember = exports.useSetAutostopDataSyncTimeout = exports.useRemoveMember = exports.useRemoveServerPeer = exports.useProjectSettings = exports.useProjectOwnRoleChangeListener = exports.useOwnRoleInProject = exports.useManyProjects = exports.useManyMembers = exports.useLeaveProject = exports.useImportProjectConfig = exports.useImportProjectCategories = exports.useIconUrl = exports.useDocumentCreatedBy = exports.useDisconnectSyncServers = exports.useDataSyncProgress = exports.useCreateProject = exports.useCreateBlob = exports.useConnectSyncServers = exports.useAttachmentUrl = exports.useAddServerPeer = exports.useMapStyleUrl = exports.useSingleInvite = exports.useSetUpInvitesListeners = exports.useSendInvite = exports.useRequestCancelInvite = exports.useRejectInvite = exports.useManyInvites = exports.useAcceptInvite = exports.useUpdateDocument = exports.useSingleDocByVersionId = exports.useSingleDocByDocId = exports.usePresetsSelection = exports.useManyDocs = exports.useDeleteDocument = exports.useCreateDocument = exports.useSetOwnDeviceInfo = exports.useSetIsArchiveDevice = exports.useOwnDeviceInfo = exports.useIsArchiveDevice = exports.useClientApi = exports.ClientApiProvider = exports.ClientApiContext = void 0;
|
|
4
|
+
exports.useExportZipFile = void 0;
|
|
4
5
|
var ClientApi_js_1 = require("./contexts/ClientApi.js");
|
|
5
6
|
Object.defineProperty(exports, "ClientApiContext", { enumerable: true, get: function () { return ClientApi_js_1.ClientApiContext; } });
|
|
6
7
|
Object.defineProperty(exports, "ClientApiProvider", { enumerable: true, get: function () { return ClientApi_js_1.ClientApiProvider; } });
|
|
@@ -38,13 +39,16 @@ Object.defineProperty(exports, "useDataSyncProgress", { enumerable: true, get: f
|
|
|
38
39
|
Object.defineProperty(exports, "useDisconnectSyncServers", { enumerable: true, get: function () { return projects_js_1.useDisconnectSyncServers; } });
|
|
39
40
|
Object.defineProperty(exports, "useDocumentCreatedBy", { enumerable: true, get: function () { return projects_js_1.useDocumentCreatedBy; } });
|
|
40
41
|
Object.defineProperty(exports, "useIconUrl", { enumerable: true, get: function () { return projects_js_1.useIconUrl; } });
|
|
42
|
+
Object.defineProperty(exports, "useImportProjectCategories", { enumerable: true, get: function () { return projects_js_1.useImportProjectCategories; } });
|
|
41
43
|
Object.defineProperty(exports, "useImportProjectConfig", { enumerable: true, get: function () { return projects_js_1.useImportProjectConfig; } });
|
|
42
44
|
Object.defineProperty(exports, "useLeaveProject", { enumerable: true, get: function () { return projects_js_1.useLeaveProject; } });
|
|
43
45
|
Object.defineProperty(exports, "useManyMembers", { enumerable: true, get: function () { return projects_js_1.useManyMembers; } });
|
|
44
46
|
Object.defineProperty(exports, "useManyProjects", { enumerable: true, get: function () { return projects_js_1.useManyProjects; } });
|
|
45
47
|
Object.defineProperty(exports, "useOwnRoleInProject", { enumerable: true, get: function () { return projects_js_1.useOwnRoleInProject; } });
|
|
48
|
+
Object.defineProperty(exports, "useProjectOwnRoleChangeListener", { enumerable: true, get: function () { return projects_js_1.useProjectOwnRoleChangeListener; } });
|
|
46
49
|
Object.defineProperty(exports, "useProjectSettings", { enumerable: true, get: function () { return projects_js_1.useProjectSettings; } });
|
|
47
50
|
Object.defineProperty(exports, "useRemoveServerPeer", { enumerable: true, get: function () { return projects_js_1.useRemoveServerPeer; } });
|
|
51
|
+
Object.defineProperty(exports, "useRemoveMember", { enumerable: true, get: function () { return projects_js_1.useRemoveMember; } });
|
|
48
52
|
Object.defineProperty(exports, "useSetAutostopDataSyncTimeout", { enumerable: true, get: function () { return projects_js_1.useSetAutostopDataSyncTimeout; } });
|
|
49
53
|
Object.defineProperty(exports, "useSingleMember", { enumerable: true, get: function () { return projects_js_1.useSingleMember; } });
|
|
50
54
|
Object.defineProperty(exports, "useSingleProject", { enumerable: true, get: function () { return projects_js_1.useSingleProject; } });
|