@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.
@@ -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<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">, Error, import("@comapeo/core/dist/roles.js").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">, readonly ["@comapeo/core-react", "projects", string, "role"]>, "queryFn"> & {
83
- queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/roles.js").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">, readonly ["@comapeo/core-react", "projects", string, "role"], never> | undefined;
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<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">;
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": "6.4.0",
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": "^4.4.0",
61
- "@comapeo/ipc": "^5.0.0",
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": "4.4.0",
68
- "@comapeo/ipc": "5.0.0",
69
- "@comapeo/schema": "2.1.1",
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": "5.0.0",
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",