@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").Role
|
|
83
|
-
|
|
82
|
+
}): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/roles.js").Role & {
|
|
83
|
+
reason: string | undefined;
|
|
84
|
+
}, Error, import("@comapeo/core/dist/roles.js").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").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").Role
|
|
92
|
+
[dataTagSymbol]: import("@comapeo/core/dist/roles.js").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
|
}): {
|
|
@@ -189,6 +189,19 @@ export function leaveProjectMutationOptions({ clientApi, queryClient, }) {
|
|
|
189
189
|
},
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
|
+
export function importProjectCategoriesMutationOptions({ projectApi, projectId, queryClient, }) {
|
|
193
|
+
return {
|
|
194
|
+
...baseMutationOptions(),
|
|
195
|
+
mutationFn: ({ filePath }) => {
|
|
196
|
+
return projectApi.$importCategories({ filePath });
|
|
197
|
+
},
|
|
198
|
+
onSuccess: () => {
|
|
199
|
+
queryClient.invalidateQueries({
|
|
200
|
+
queryKey: getProjectByIdQueryKey({ projectId }),
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
}
|
|
192
205
|
export function importProjectConfigMutationOptions({ projectApi, projectId, queryClient, }) {
|
|
193
206
|
return {
|
|
194
207
|
...baseMutationOptions(),
|
|
@@ -231,6 +244,23 @@ export function changeMemberRoleMutationOptions({ projectApi, projectId, queryCl
|
|
|
231
244
|
},
|
|
232
245
|
};
|
|
233
246
|
}
|
|
247
|
+
export function removeProjectMemberMutationOptions({ projectApi, projectId, queryClient, }) {
|
|
248
|
+
return {
|
|
249
|
+
...baseMutationOptions(),
|
|
250
|
+
mutationFn: async ({ deviceId, reason }) => {
|
|
251
|
+
// Have to avoid passing `undefined` explicitly
|
|
252
|
+
// See https://github.com/digidem/rpc-reflector/issues/21
|
|
253
|
+
return reason
|
|
254
|
+
? projectApi.$member.remove(deviceId, { reason })
|
|
255
|
+
: projectApi.$member.remove(deviceId);
|
|
256
|
+
},
|
|
257
|
+
onSuccess: () => {
|
|
258
|
+
queryClient.invalidateQueries({
|
|
259
|
+
queryKey: getMembersQueryKey({ projectId }),
|
|
260
|
+
});
|
|
261
|
+
},
|
|
262
|
+
};
|
|
263
|
+
}
|
|
234
264
|
export function createBlobMutationOptions({ projectApi, }) {
|
|
235
265
|
return {
|
|
236
266
|
...baseMutationOptions(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comapeo/core-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "React wrapper for working with @comapeo/core",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -57,21 +57,21 @@
|
|
|
57
57
|
"types": "tsc"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@comapeo/core": "^
|
|
61
|
-
"@comapeo/ipc": "^
|
|
60
|
+
"@comapeo/core": "^5.1.1",
|
|
61
|
+
"@comapeo/ipc": "^6.0.0",
|
|
62
62
|
"@comapeo/schema": "*",
|
|
63
63
|
"@tanstack/react-query": "^5",
|
|
64
64
|
"react": "^18 || ^19"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@comapeo/core": "
|
|
68
|
-
"@comapeo/ipc": "
|
|
69
|
-
"@comapeo/schema": "2.
|
|
67
|
+
"@comapeo/core": "5.1.1",
|
|
68
|
+
"@comapeo/ipc": "6.0.0",
|
|
69
|
+
"@comapeo/schema": "2.2.0",
|
|
70
70
|
"@eslint/compat": "1.3.2",
|
|
71
71
|
"@eslint/js": "9.35.0",
|
|
72
72
|
"@ianvs/prettier-plugin-sort-imports": "4.7.0",
|
|
73
73
|
"@mapeo/crypto": "1.0.0-alpha.10",
|
|
74
|
-
"@mapeo/default-config": "
|
|
74
|
+
"@mapeo/default-config": "6.0.0",
|
|
75
75
|
"@mapeo/mock-data": "5.0.0",
|
|
76
76
|
"@tanstack/eslint-plugin-query": "5.89.0",
|
|
77
77
|
"@tanstack/react-query": "5.89.0",
|