@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
|
@@ -79,11 +79,19 @@ export declare function projectMemberByIdQueryOptions({ projectApi, projectId, d
|
|
|
79
79
|
export declare function projectOwnRoleQueryOptions({ projectApi, projectId, }: {
|
|
80
80
|
projectApi: MapeoProjectApi;
|
|
81
81
|
projectId: string;
|
|
82
|
-
}): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role
|
|
83
|
-
|
|
82
|
+
}): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role & {
|
|
83
|
+
reason: string | undefined;
|
|
84
|
+
}, Error, import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role & {
|
|
85
|
+
reason: string | undefined;
|
|
86
|
+
}, readonly ["@comapeo/core-react", "projects", string, "role"]>, "queryFn"> & {
|
|
87
|
+
queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role & {
|
|
88
|
+
reason: string | undefined;
|
|
89
|
+
}, readonly ["@comapeo/core-react", "projects", string, "role"], never> | undefined;
|
|
84
90
|
} & {
|
|
85
91
|
queryKey: readonly ["@comapeo/core-react", "projects", string, "role"] & {
|
|
86
|
-
[dataTagSymbol]: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role
|
|
92
|
+
[dataTagSymbol]: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role & {
|
|
93
|
+
reason: string | undefined;
|
|
94
|
+
};
|
|
87
95
|
[dataTagErrorSymbol]: Error;
|
|
88
96
|
};
|
|
89
97
|
};
|
|
@@ -158,6 +166,18 @@ export declare function leaveProjectMutationOptions({ clientApi, queryClient, }:
|
|
|
158
166
|
networkMode: "always";
|
|
159
167
|
retry: false;
|
|
160
168
|
};
|
|
169
|
+
export declare function importProjectCategoriesMutationOptions({ projectApi, projectId, queryClient, }: {
|
|
170
|
+
projectApi: MapeoProjectApi;
|
|
171
|
+
projectId: string;
|
|
172
|
+
queryClient: QueryClient;
|
|
173
|
+
}): {
|
|
174
|
+
mutationFn: ({ filePath }: {
|
|
175
|
+
filePath: string;
|
|
176
|
+
}) => Promise<void>;
|
|
177
|
+
onSuccess: () => void;
|
|
178
|
+
networkMode: "always";
|
|
179
|
+
retry: false;
|
|
180
|
+
};
|
|
161
181
|
export declare function importProjectConfigMutationOptions({ projectApi, projectId, queryClient, }: {
|
|
162
182
|
projectApi: MapeoProjectApi;
|
|
163
183
|
projectId: string;
|
|
@@ -192,6 +212,19 @@ export declare function changeMemberRoleMutationOptions({ projectApi, projectId,
|
|
|
192
212
|
networkMode: "always";
|
|
193
213
|
retry: false;
|
|
194
214
|
};
|
|
215
|
+
export declare function removeProjectMemberMutationOptions({ projectApi, projectId, queryClient, }: {
|
|
216
|
+
projectApi: MapeoProjectApi;
|
|
217
|
+
projectId: string;
|
|
218
|
+
queryClient: QueryClient;
|
|
219
|
+
}): {
|
|
220
|
+
mutationFn: ({ deviceId, reason }: {
|
|
221
|
+
deviceId: string;
|
|
222
|
+
reason?: string;
|
|
223
|
+
}) => Promise<void>;
|
|
224
|
+
onSuccess: () => void;
|
|
225
|
+
networkMode: "always";
|
|
226
|
+
retry: false;
|
|
227
|
+
};
|
|
195
228
|
export declare function createBlobMutationOptions({ projectApi, }: {
|
|
196
229
|
projectApi: MapeoProjectApi;
|
|
197
230
|
}): {
|
|
@@ -20,9 +20,11 @@ exports.addServerPeerMutationOptions = addServerPeerMutationOptions;
|
|
|
20
20
|
exports.removeServerPeerMutationOptions = removeServerPeerMutationOptions;
|
|
21
21
|
exports.createProjectMutationOptions = createProjectMutationOptions;
|
|
22
22
|
exports.leaveProjectMutationOptions = leaveProjectMutationOptions;
|
|
23
|
+
exports.importProjectCategoriesMutationOptions = importProjectCategoriesMutationOptions;
|
|
23
24
|
exports.importProjectConfigMutationOptions = importProjectConfigMutationOptions;
|
|
24
25
|
exports.updateProjectSettingsMutationOptions = updateProjectSettingsMutationOptions;
|
|
25
26
|
exports.changeMemberRoleMutationOptions = changeMemberRoleMutationOptions;
|
|
27
|
+
exports.removeProjectMemberMutationOptions = removeProjectMemberMutationOptions;
|
|
26
28
|
exports.createBlobMutationOptions = createBlobMutationOptions;
|
|
27
29
|
exports.startSyncMutationOptions = startSyncMutationOptions;
|
|
28
30
|
exports.stopSyncMutationOptions = stopSyncMutationOptions;
|
|
@@ -222,6 +224,19 @@ function leaveProjectMutationOptions({ clientApi, queryClient, }) {
|
|
|
222
224
|
},
|
|
223
225
|
};
|
|
224
226
|
}
|
|
227
|
+
function importProjectCategoriesMutationOptions({ projectApi, projectId, queryClient, }) {
|
|
228
|
+
return {
|
|
229
|
+
...(0, shared_js_1.baseMutationOptions)(),
|
|
230
|
+
mutationFn: ({ filePath }) => {
|
|
231
|
+
return projectApi.$importCategories({ filePath });
|
|
232
|
+
},
|
|
233
|
+
onSuccess: () => {
|
|
234
|
+
queryClient.invalidateQueries({
|
|
235
|
+
queryKey: getProjectByIdQueryKey({ projectId }),
|
|
236
|
+
});
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
}
|
|
225
240
|
function importProjectConfigMutationOptions({ projectApi, projectId, queryClient, }) {
|
|
226
241
|
return {
|
|
227
242
|
...(0, shared_js_1.baseMutationOptions)(),
|
|
@@ -264,6 +279,23 @@ function changeMemberRoleMutationOptions({ projectApi, projectId, queryClient, }
|
|
|
264
279
|
},
|
|
265
280
|
};
|
|
266
281
|
}
|
|
282
|
+
function removeProjectMemberMutationOptions({ projectApi, projectId, queryClient, }) {
|
|
283
|
+
return {
|
|
284
|
+
...(0, shared_js_1.baseMutationOptions)(),
|
|
285
|
+
mutationFn: async ({ deviceId, reason }) => {
|
|
286
|
+
// Have to avoid passing `undefined` explicitly
|
|
287
|
+
// See https://github.com/digidem/rpc-reflector/issues/21
|
|
288
|
+
return reason
|
|
289
|
+
? projectApi.$member.remove(deviceId, { reason })
|
|
290
|
+
: projectApi.$member.remove(deviceId);
|
|
291
|
+
},
|
|
292
|
+
onSuccess: () => {
|
|
293
|
+
queryClient.invalidateQueries({
|
|
294
|
+
queryKey: getMembersQueryKey({ projectId }),
|
|
295
|
+
});
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
}
|
|
267
299
|
function createBlobMutationOptions({ projectApi, }) {
|
|
268
300
|
return {
|
|
269
301
|
...(0, shared_js_1.baseMutationOptions)(),
|
|
@@ -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").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").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").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").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").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").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").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").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").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").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").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").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").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").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").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").Role
|
|
253
|
+
data: import("@comapeo/core/dist/roles.js").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
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMutation, useQueryClient, useSuspenseQuery, } from '@tanstack/react-query';
|
|
2
|
-
import { useSyncExternalStore } from 'react';
|
|
3
|
-
import { addServerPeerMutationOptions, changeMemberRoleMutationOptions, connectSyncServersMutationOptions, createBlobMutationOptions, createProjectMutationOptions, disconnectSyncServersMutationOptions, documentCreatedByQueryOptions, exportGeoJSONMutationOptions, exportZipFileMutationOptions, importProjectConfigMutationOptions, leaveProjectMutationOptions, mediaServerOriginQueryOptions, projectByIdQueryOptions, projectMemberByIdQueryOptions, projectMembersQueryOptions, projectOwnRoleQueryOptions, projectSettingsQueryOptions, projectsQueryOptions, removeServerPeerMutationOptions, setAutostopDataSyncTimeoutMutationOptions, startSyncMutationOptions, stopSyncMutationOptions, updateProjectSettingsMutationOptions, } from '../lib/react-query/projects.js';
|
|
2
|
+
import { useEffect, useSyncExternalStore } from 'react';
|
|
3
|
+
import { addServerPeerMutationOptions, changeMemberRoleMutationOptions, connectSyncServersMutationOptions, createBlobMutationOptions, createProjectMutationOptions, disconnectSyncServersMutationOptions, documentCreatedByQueryOptions, exportGeoJSONMutationOptions, exportZipFileMutationOptions, getMembersQueryKey, getProjectRoleQueryKey, importProjectCategoriesMutationOptions, importProjectConfigMutationOptions, leaveProjectMutationOptions, mediaServerOriginQueryOptions, projectByIdQueryOptions, projectMemberByIdQueryOptions, projectMembersQueryOptions, projectOwnRoleQueryOptions, projectSettingsQueryOptions, projectsQueryOptions, removeProjectMemberMutationOptions, removeServerPeerMutationOptions, setAutostopDataSyncTimeoutMutationOptions, startSyncMutationOptions, stopSyncMutationOptions, updateProjectSettingsMutationOptions, } from '../lib/react-query/projects.js';
|
|
4
4
|
import { SyncStore } from '../lib/sync.js';
|
|
5
5
|
import { getBlobUrl, getIconUrl } from '../lib/urls.js';
|
|
6
6
|
import { useClientApi } from './client.js';
|
|
@@ -317,9 +317,27 @@ export function useLeaveProject() {
|
|
|
317
317
|
? { error, mutate, mutateAsync, reset, status }
|
|
318
318
|
: { error: null, mutate, mutateAsync, reset, status };
|
|
319
319
|
}
|
|
320
|
+
/**
|
|
321
|
+
* Update the categories of a project using an external file.
|
|
322
|
+
*
|
|
323
|
+
* @param opts.projectId Public ID of the project to apply changes to.
|
|
324
|
+
*/
|
|
325
|
+
export function useImportProjectCategories({ projectId, }) {
|
|
326
|
+
const queryClient = useQueryClient();
|
|
327
|
+
const { data: projectApi } = useSingleProject({ projectId });
|
|
328
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(importProjectCategoriesMutationOptions({
|
|
329
|
+
queryClient,
|
|
330
|
+
projectApi,
|
|
331
|
+
projectId,
|
|
332
|
+
}));
|
|
333
|
+
return status === 'error'
|
|
334
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
335
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
336
|
+
}
|
|
320
337
|
/**
|
|
321
338
|
* Update the configuration of a project using an external file.
|
|
322
339
|
*
|
|
340
|
+
* @deprecated Use `useImportProjectCategories` instead.
|
|
323
341
|
* @param opts.projectId Public ID of the project to apply changes to.
|
|
324
342
|
*/
|
|
325
343
|
export function useImportProjectConfig({ projectId }) {
|
|
@@ -365,6 +383,63 @@ export function useChangeMemberRole({ projectId }) {
|
|
|
365
383
|
? { error, mutate, mutateAsync, reset, status }
|
|
366
384
|
: { error: null, mutate, mutateAsync, reset, status };
|
|
367
385
|
}
|
|
386
|
+
/**
|
|
387
|
+
* Remove a member from a project, providing an optional reason for removal.
|
|
388
|
+
*
|
|
389
|
+
* Do NOT use this for removing your own device from a project. Use `useLeaveProject` instead.
|
|
390
|
+
*
|
|
391
|
+
* @param opts.projectId Project public ID
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* ```tsx
|
|
395
|
+
* function BasicExample() {
|
|
396
|
+
* const { mutate } = useRemoveMember({ projectId: '...' })
|
|
397
|
+
* mutate({
|
|
398
|
+
* deviceId: '...',
|
|
399
|
+
* // Optional
|
|
400
|
+
* reason: '...',
|
|
401
|
+
* })
|
|
402
|
+
* }
|
|
403
|
+
* ```
|
|
404
|
+
*/
|
|
405
|
+
export function useRemoveMember({ projectId }) {
|
|
406
|
+
const queryClient = useQueryClient();
|
|
407
|
+
const { data: projectApi } = useSingleProject({ projectId });
|
|
408
|
+
const { error, mutate, mutateAsync, reset, status } = useMutation(removeProjectMemberMutationOptions({ projectId, projectApi, queryClient }));
|
|
409
|
+
return status === 'error'
|
|
410
|
+
? { error, mutate, mutateAsync, reset, status }
|
|
411
|
+
: { error: null, mutate, mutateAsync, reset, status };
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Set up listener for changes to your own role in a project.
|
|
415
|
+
* It is necessary to use this if you want the project role-related read hooks to update
|
|
416
|
+
* based on role change events that are received in the background.
|
|
417
|
+
*
|
|
418
|
+
* @example
|
|
419
|
+
* ```tsx
|
|
420
|
+
* function SomeComponent({ projectId }: { projectId: string }) {
|
|
421
|
+
* useProjectOwnRoleChangeListener({ projectId })
|
|
422
|
+
* }
|
|
423
|
+
* ```
|
|
424
|
+
*/
|
|
425
|
+
export function useProjectOwnRoleChangeListener({ projectId, }) {
|
|
426
|
+
const queryClient = useQueryClient();
|
|
427
|
+
const { data: projectApi } = useSingleProject({ projectId });
|
|
428
|
+
useEffect(() => {
|
|
429
|
+
function invalidateCache() {
|
|
430
|
+
queryClient.invalidateQueries({
|
|
431
|
+
queryKey: getMembersQueryKey({ projectId }),
|
|
432
|
+
});
|
|
433
|
+
queryClient.invalidateQueries({
|
|
434
|
+
queryKey: getProjectRoleQueryKey({ projectId }),
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
projectApi.addListener('own-role-change', invalidateCache);
|
|
438
|
+
return () => {
|
|
439
|
+
projectApi.removeListener('own-role-change', invalidateCache);
|
|
440
|
+
};
|
|
441
|
+
}, [projectApi, queryClient, projectId]);
|
|
442
|
+
}
|
|
368
443
|
/**
|
|
369
444
|
* Create a blob for a project.
|
|
370
445
|
*
|
package/dist/esm/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/esm/index.js
CHANGED
|
@@ -3,4 +3,4 @@ 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';
|