@comapeo/core-react 1.1.0 → 2.0.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.
Files changed (46) hide show
  1. package/dist/commonjs/hooks/client.d.ts +21 -0
  2. package/dist/commonjs/hooks/client.js +20 -0
  3. package/dist/commonjs/hooks/documents.d.ts +59 -4
  4. package/dist/commonjs/hooks/documents.js +54 -0
  5. package/dist/commonjs/hooks/invites.d.ts +51 -0
  6. package/dist/commonjs/hooks/invites.js +50 -0
  7. package/dist/commonjs/hooks/projects.d.ts +83 -0
  8. package/dist/commonjs/hooks/projects.js +62 -0
  9. package/dist/commonjs/index.d.ts +10 -9
  10. package/dist/commonjs/index.js +21 -21
  11. package/dist/commonjs/lib/react-query/client.d.ts +40 -9
  12. package/dist/commonjs/lib/react-query/client.js +32 -0
  13. package/dist/commonjs/lib/react-query/documents.d.ts +733 -650
  14. package/dist/commonjs/lib/react-query/documents.js +57 -0
  15. package/dist/commonjs/lib/react-query/invites.d.ts +63 -4
  16. package/dist/commonjs/lib/react-query/invites.js +63 -0
  17. package/dist/commonjs/lib/react-query/maps.d.ts +12 -3
  18. package/dist/commonjs/lib/react-query/maps.js +5 -1
  19. package/dist/commonjs/lib/react-query/projects.d.ts +183 -47
  20. package/dist/commonjs/lib/react-query/projects.js +88 -0
  21. package/dist/commonjs/lib/react-query/shared.d.ts +5 -1
  22. package/dist/commonjs/lib/react-query/shared.js +8 -1
  23. package/dist/esm/hooks/client.d.ts +21 -0
  24. package/dist/esm/hooks/client.js +20 -2
  25. package/dist/esm/hooks/documents.d.ts +59 -4
  26. package/dist/esm/hooks/documents.js +53 -2
  27. package/dist/esm/hooks/invites.d.ts +51 -0
  28. package/dist/esm/hooks/invites.js +44 -0
  29. package/dist/esm/hooks/projects.d.ts +83 -0
  30. package/dist/esm/hooks/projects.js +58 -2
  31. package/dist/esm/index.d.ts +10 -9
  32. package/dist/esm/index.js +10 -9
  33. package/dist/esm/lib/react-query/client.d.ts +40 -9
  34. package/dist/esm/lib/react-query/client.js +32 -2
  35. package/dist/esm/lib/react-query/documents.d.ts +733 -650
  36. package/dist/esm/lib/react-query/documents.js +56 -2
  37. package/dist/esm/lib/react-query/invites.d.ts +63 -4
  38. package/dist/esm/lib/react-query/invites.js +61 -2
  39. package/dist/esm/lib/react-query/maps.d.ts +12 -3
  40. package/dist/esm/lib/react-query/maps.js +5 -1
  41. package/dist/esm/lib/react-query/projects.d.ts +183 -47
  42. package/dist/esm/lib/react-query/projects.js +84 -2
  43. package/dist/esm/lib/react-query/shared.d.ts +5 -1
  44. package/dist/esm/lib/react-query/shared.js +7 -1
  45. package/docs/API.md +157 -258
  46. package/package.json +27 -28
@@ -7,6 +7,9 @@ exports.getDocumentByVersionIdQueryKey = getDocumentByVersionIdQueryKey;
7
7
  exports.documentsQueryOptions = documentsQueryOptions;
8
8
  exports.documentByDocumentIdQueryOptions = documentByDocumentIdQueryOptions;
9
9
  exports.documentByVersionIdQueryOptions = documentByVersionIdQueryOptions;
10
+ exports.createDocumentMutationOptions = createDocumentMutationOptions;
11
+ exports.updateDocumentMutationOptions = updateDocumentMutationOptions;
12
+ exports.deleteDocumentMutationOptions = deleteDocumentMutationOptions;
10
13
  const react_query_1 = require("@tanstack/react-query");
11
14
  const shared_js_1 = require("./shared.js");
12
15
  function getDocumentsQueryKey({ projectId, docType, }) {
@@ -90,3 +93,57 @@ function documentByVersionIdQueryOptions({ projectApi, projectId, docType, versi
90
93
  },
91
94
  });
92
95
  }
96
+ function createDocumentMutationOptions({ docType, projectApi, projectId, queryClient, }) {
97
+ return {
98
+ ...(0, shared_js_1.baseMutationOptions)(),
99
+ mutationFn: async ({ value, }) => {
100
+ // @ts-expect-error TS not handling this well
101
+ return projectApi[docType].create({
102
+ ...value,
103
+ schemaName: docType,
104
+ });
105
+ },
106
+ onSuccess: () => {
107
+ queryClient.invalidateQueries({
108
+ queryKey: getDocumentsQueryKey({
109
+ projectId,
110
+ docType,
111
+ }),
112
+ });
113
+ },
114
+ };
115
+ }
116
+ function updateDocumentMutationOptions({ docType, projectApi, projectId, queryClient, }) {
117
+ return {
118
+ ...(0, shared_js_1.baseMutationOptions)(),
119
+ mutationFn: async ({ versionId, value, }) => {
120
+ // @ts-expect-error TS not handling this well
121
+ return projectApi[docType].update(versionId, value);
122
+ },
123
+ onSuccess: () => {
124
+ queryClient.invalidateQueries({
125
+ queryKey: getDocumentsQueryKey({
126
+ projectId,
127
+ docType,
128
+ }),
129
+ });
130
+ },
131
+ };
132
+ }
133
+ function deleteDocumentMutationOptions({ docType, projectApi, projectId, queryClient, }) {
134
+ return {
135
+ ...(0, shared_js_1.baseMutationOptions)(),
136
+ mutationFn: async ({ docId, }) => {
137
+ // @ts-expect-error TS not handling this well
138
+ return projectApi[docType].delete(docId);
139
+ },
140
+ onSuccess: () => {
141
+ queryClient.invalidateQueries({
142
+ queryKey: getDocumentsQueryKey({
143
+ projectId,
144
+ docType,
145
+ }),
146
+ });
147
+ },
148
+ };
149
+ }
@@ -1,12 +1,71 @@
1
- import type { MapeoClientApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
1
+ import type { RoleIdForNewInvite } from '@comapeo/core/dist/roles.js' with { 'resolution-mode': 'import' };
2
+ import type { MapeoClientApi, MapeoProjectApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
3
+ import { type QueryClient } from '@tanstack/react-query';
2
4
  export declare function getInvitesQueryKey(): readonly ["@comapeo/core-react", "invites"];
3
5
  export declare function getPendingInvitesQueryKey(): readonly ["@comapeo/core-react", "invites", {
4
6
  readonly status: "pending";
5
7
  }];
6
8
  export declare function pendingInvitesQueryOptions({ clientApi, }: {
7
9
  clientApi: MapeoClientApi;
8
- }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/types.js", { with: { "resolution-mode": "import" } }).MapBuffers<import("@comapeo/core/dist/invite-api.js", { with: { "resolution-mode": "import" } }).InviteInternal>[], Error, import("@comapeo/core/dist/types.js", { with: { "resolution-mode": "import" } }).MapBuffers<import("@comapeo/core/dist/invite-api.js", { with: { "resolution-mode": "import" } }).InviteInternal>[], import("@tanstack/react-query").QueryKey>, "queryFn"> & {
9
- queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/types.js", { with: { "resolution-mode": "import" } }).MapBuffers<import("@comapeo/core/dist/invite-api.js", { with: { "resolution-mode": "import" } }).InviteInternal>[], import("@tanstack/react-query").QueryKey, never> | undefined;
10
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/types.js", { with: { "resolution-mode": "import" } }).MapBuffers<import("@comapeo/core/dist/invite-api.js", { with: { "resolution-mode": "import" } }).InviteInternal>[], Error, import("@comapeo/core/dist/types.js", { with: { "resolution-mode": "import" } }).MapBuffers<import("@comapeo/core/dist/invite-api.js", { with: { "resolution-mode": "import" } }).InviteInternal>[], readonly ["@comapeo/core-react", "invites", {
11
+ readonly status: "pending";
12
+ }]>, "queryFn"> & {
13
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/types.js", { with: { "resolution-mode": "import" } }).MapBuffers<import("@comapeo/core/dist/invite-api.js", { with: { "resolution-mode": "import" } }).InviteInternal>[], readonly ["@comapeo/core-react", "invites", {
14
+ readonly status: "pending";
15
+ }], never> | undefined;
10
16
  } & {
11
- queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, import("@comapeo/core/dist/types.js", { with: { "resolution-mode": "import" } }).MapBuffers<import("@comapeo/core/dist/invite-api.js", { with: { "resolution-mode": "import" } }).InviteInternal>[]>;
17
+ queryKey: readonly ["@comapeo/core-react", "invites", {
18
+ readonly status: "pending";
19
+ }] & {
20
+ [dataTagSymbol]: import("@comapeo/core/dist/types.js", { with: { "resolution-mode": "import" } }).MapBuffers<import("@comapeo/core/dist/invite-api.js", { with: { "resolution-mode": "import" } }).InviteInternal>[];
21
+ [dataTagErrorSymbol]: Error;
22
+ };
23
+ };
24
+ export declare function acceptInviteMutationOptions({ clientApi, queryClient, }: {
25
+ clientApi: MapeoClientApi;
26
+ queryClient: QueryClient;
27
+ }): {
28
+ mutationFn: ({ inviteId }: {
29
+ inviteId: string;
30
+ }) => Promise<string>;
31
+ onSuccess: () => void;
32
+ networkMode: "always";
33
+ retry: false;
34
+ };
35
+ export declare function rejectInviteMutationOptions({ clientApi, queryClient, }: {
36
+ clientApi: MapeoClientApi;
37
+ queryClient: QueryClient;
38
+ }): {
39
+ mutationFn: ({ inviteId }: {
40
+ inviteId: string;
41
+ }) => Promise<void>;
42
+ onSuccess: () => void;
43
+ networkMode: "always";
44
+ retry: false;
45
+ };
46
+ export declare function sendInviteMutationOptions({ projectApi, projectId, queryClient, }: {
47
+ projectApi: MapeoProjectApi;
48
+ projectId: string;
49
+ queryClient: QueryClient;
50
+ }): {
51
+ mutationFn: ({ deviceId, ...role }: {
52
+ deviceId: string;
53
+ roleDescription?: string;
54
+ roleId: RoleIdForNewInvite;
55
+ roleName?: string;
56
+ }) => Promise<"ACCEPT" | "REJECT" | "ALREADY">;
57
+ onSuccess: () => void;
58
+ networkMode: "always";
59
+ retry: false;
60
+ };
61
+ export declare function requestCancelInviteMutationOptions({ projectApi, queryClient, }: {
62
+ projectApi: MapeoProjectApi;
63
+ queryClient: QueryClient;
64
+ }): {
65
+ mutationFn: ({ deviceId }: {
66
+ deviceId: string;
67
+ }) => Promise<void>;
68
+ onSuccess: () => void;
69
+ networkMode: "always";
70
+ retry: false;
12
71
  };
@@ -3,7 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getInvitesQueryKey = getInvitesQueryKey;
4
4
  exports.getPendingInvitesQueryKey = getPendingInvitesQueryKey;
5
5
  exports.pendingInvitesQueryOptions = pendingInvitesQueryOptions;
6
+ exports.acceptInviteMutationOptions = acceptInviteMutationOptions;
7
+ exports.rejectInviteMutationOptions = rejectInviteMutationOptions;
8
+ exports.sendInviteMutationOptions = sendInviteMutationOptions;
9
+ exports.requestCancelInviteMutationOptions = requestCancelInviteMutationOptions;
6
10
  const react_query_1 = require("@tanstack/react-query");
11
+ const projects_js_1 = require("./projects.js");
7
12
  const shared_js_1 = require("./shared.js");
8
13
  function getInvitesQueryKey() {
9
14
  return [shared_js_1.ROOT_QUERY_KEY, 'invites'];
@@ -20,3 +25,61 @@ function pendingInvitesQueryOptions({ clientApi, }) {
20
25
  },
21
26
  });
22
27
  }
28
+ function acceptInviteMutationOptions({ clientApi, queryClient, }) {
29
+ return {
30
+ ...(0, shared_js_1.baseMutationOptions)(),
31
+ mutationFn: async ({ inviteId }) => {
32
+ return clientApi.invite.accept({ inviteId });
33
+ },
34
+ onSuccess: () => {
35
+ queryClient.invalidateQueries({
36
+ queryKey: getInvitesQueryKey(),
37
+ });
38
+ queryClient.invalidateQueries({
39
+ queryKey: (0, projects_js_1.getProjectsQueryKey)(),
40
+ });
41
+ },
42
+ };
43
+ }
44
+ function rejectInviteMutationOptions({ clientApi, queryClient, }) {
45
+ return {
46
+ ...(0, shared_js_1.baseMutationOptions)(),
47
+ mutationFn: async ({ inviteId }) => {
48
+ return clientApi.invite.reject({ inviteId });
49
+ },
50
+ onSuccess: () => {
51
+ queryClient.invalidateQueries({
52
+ queryKey: getInvitesQueryKey(),
53
+ });
54
+ },
55
+ };
56
+ }
57
+ function sendInviteMutationOptions({ projectApi, projectId, queryClient, }) {
58
+ return {
59
+ ...(0, shared_js_1.baseMutationOptions)(),
60
+ mutationFn: async ({ deviceId, ...role }) => {
61
+ return projectApi.$member.invite(deviceId, role);
62
+ },
63
+ onSuccess: () => {
64
+ queryClient.invalidateQueries({
65
+ queryKey: getInvitesQueryKey(),
66
+ });
67
+ queryClient.invalidateQueries({
68
+ queryKey: (0, projects_js_1.getMembersQueryKey)({ projectId }),
69
+ });
70
+ },
71
+ };
72
+ }
73
+ function requestCancelInviteMutationOptions({ projectApi, queryClient, }) {
74
+ return {
75
+ ...(0, shared_js_1.baseMutationOptions)(),
76
+ mutationFn: async ({ deviceId }) => {
77
+ return projectApi.$member.requestCancelInvite(deviceId);
78
+ },
79
+ onSuccess: () => {
80
+ queryClient.invalidateQueries({
81
+ queryKey: getInvitesQueryKey(),
82
+ });
83
+ },
84
+ };
85
+ }
@@ -8,8 +8,17 @@ export declare function getStyleJsonUrlQueryKey({ refreshToken, }: {
8
8
  export declare function mapStyleJsonUrlQueryOptions({ clientApi, refreshToken, }: {
9
9
  clientApi: MapeoClientApi;
10
10
  refreshToken?: string;
11
- }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
12
- queryFn?: import("@tanstack/react-query").QueryFunction<string, import("@tanstack/react-query").QueryKey, never> | undefined;
11
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, readonly ["@comapeo/core-react", "maps", "stylejson_url", {
12
+ readonly refreshToken: string | undefined;
13
+ }]>, "queryFn"> & {
14
+ queryFn?: import("@tanstack/react-query").QueryFunction<string, readonly ["@comapeo/core-react", "maps", "stylejson_url", {
15
+ readonly refreshToken: string | undefined;
16
+ }], never> | undefined;
13
17
  } & {
14
- queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, string>;
18
+ queryKey: readonly ["@comapeo/core-react", "maps", "stylejson_url", {
19
+ readonly refreshToken: string | undefined;
20
+ }] & {
21
+ [dataTagSymbol]: string;
22
+ [dataTagErrorSymbol]: Error;
23
+ };
15
24
  };
@@ -17,7 +17,11 @@ function mapStyleJsonUrlQueryOptions({ clientApi, refreshToken, }) {
17
17
  queryKey: getStyleJsonUrlQueryKey({ refreshToken }),
18
18
  queryFn: async () => {
19
19
  const result = await clientApi.getMapStyleJsonUrl();
20
- return refreshToken ? result + `?refresh_token=${refreshToken}` : result;
20
+ if (!refreshToken)
21
+ return result;
22
+ const u = new URL(result);
23
+ u.searchParams.set('refresh_token', refreshToken);
24
+ return u.href;
21
25
  },
22
26
  });
23
27
  }
@@ -1,6 +1,10 @@
1
+ import type { Metadata } from '@comapeo/core/dist/blob-api.js' with { 'resolution-mode': 'import' };
1
2
  import type { BitmapOpts, SvgOpts } from '@comapeo/core/dist/icon-api.js' with { 'resolution-mode': 'import' };
3
+ import type { EditableProjectSettings } from '@comapeo/core/dist/mapeo-project.js' with { 'resolution-mode': 'import' };
2
4
  import type { BlobId } from '@comapeo/core/dist/types.js' with { 'resolution-mode': 'import' };
3
5
  import type { MapeoClientApi, MapeoProjectApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
6
+ import type { ProjectSettings } from '@comapeo/schema' with { 'resolution-mode': 'import' };
7
+ import { type QueryClient } from '@tanstack/react-query';
4
8
  export declare function getProjectsQueryKey(): readonly ["@comapeo/core-react", "projects"];
5
9
  export declare function getProjectByIdQueryKey({ projectId }: {
6
10
  projectId: string;
@@ -81,7 +85,7 @@ export declare function projectsQueryOptions({ clientApi, }: {
81
85
  projectId: string;
82
86
  createdAt?: string | undefined;
83
87
  updatedAt?: string | undefined;
84
- })[], import("@tanstack/react-query").QueryKey>, "queryFn"> & {
88
+ })[], readonly ["@comapeo/core-react", "projects"]>, "queryFn"> & {
85
89
  queryFn?: import("@tanstack/react-query").QueryFunction<(Pick<{
86
90
  schemaName: "projectSettings";
87
91
  name?: string | undefined;
@@ -102,95 +106,227 @@ export declare function projectsQueryOptions({ clientApi, }: {
102
106
  projectId: string;
103
107
  createdAt?: string | undefined;
104
108
  updatedAt?: string | undefined;
105
- })[], import("@tanstack/react-query").QueryKey, never> | undefined;
109
+ })[], readonly ["@comapeo/core-react", "projects"], never> | undefined;
106
110
  } & {
107
- queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, (Pick<{
108
- schemaName: "projectSettings";
109
- name?: string | undefined;
110
- defaultPresets?: {
111
- point: string[];
112
- area: string[];
113
- vertex: string[];
114
- line: string[];
115
- relation: string[];
116
- } | undefined;
117
- configMetadata?: {
118
- name: string;
119
- buildDate: string;
120
- importDate: string;
121
- fileVersion: string;
122
- } | undefined;
123
- }, "name"> & {
124
- projectId: string;
125
- createdAt?: string | undefined;
126
- updatedAt?: string | undefined;
127
- })[]>;
111
+ queryKey: readonly ["@comapeo/core-react", "projects"] & {
112
+ [dataTagSymbol]: (Pick<{
113
+ schemaName: "projectSettings";
114
+ name?: string | undefined;
115
+ defaultPresets?: {
116
+ point: string[];
117
+ area: string[];
118
+ vertex: string[];
119
+ line: string[];
120
+ relation: string[];
121
+ } | undefined;
122
+ configMetadata?: {
123
+ name: string;
124
+ buildDate: string;
125
+ importDate: string;
126
+ fileVersion: string;
127
+ } | undefined;
128
+ }, "name"> & {
129
+ projectId: string;
130
+ createdAt?: string | undefined;
131
+ updatedAt?: string | undefined;
132
+ })[];
133
+ [dataTagErrorSymbol]: Error;
134
+ };
128
135
  };
129
136
  export declare function projectByIdQueryOptions({ clientApi, projectId, }: {
130
137
  clientApi: MapeoClientApi;
131
138
  projectId: string;
132
- }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).MapeoProject>, Error, import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).MapeoProject>, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
133
- queryFn?: import("@tanstack/react-query").QueryFunction<import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).MapeoProject>, import("@tanstack/react-query").QueryKey, never> | undefined;
139
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).MapeoProject>, Error, import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).MapeoProject>, readonly ["@comapeo/core-react", "projects", string]>, "queryFn"> & {
140
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).MapeoProject>, readonly ["@comapeo/core-react", "projects", string], never> | undefined;
134
141
  } & {
135
- queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).MapeoProject>>;
142
+ queryKey: readonly ["@comapeo/core-react", "projects", string] & {
143
+ [dataTagSymbol]: import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).MapeoProject>;
144
+ [dataTagErrorSymbol]: Error;
145
+ };
136
146
  };
137
147
  export declare function projectSettingsQueryOptions({ projectApi, projectId, }: {
138
148
  projectApi: MapeoProjectApi;
139
149
  projectId: string;
140
- }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).EditableProjectSettings, Error, import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).EditableProjectSettings, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
141
- queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).EditableProjectSettings, import("@tanstack/react-query").QueryKey, never> | undefined;
150
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<EditableProjectSettings, Error, EditableProjectSettings, readonly ["@comapeo/core-react", "projects", string, "project_settings"]>, "queryFn"> & {
151
+ queryFn?: import("@tanstack/react-query").QueryFunction<EditableProjectSettings, readonly ["@comapeo/core-react", "projects", string, "project_settings"], never> | undefined;
142
152
  } & {
143
- queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).EditableProjectSettings>;
153
+ queryKey: readonly ["@comapeo/core-react", "projects", string, "project_settings"] & {
154
+ [dataTagSymbol]: EditableProjectSettings;
155
+ [dataTagErrorSymbol]: Error;
156
+ };
144
157
  };
145
158
  export declare function projectMembersQueryOptions({ projectApi, projectId, }: {
146
159
  projectApi: MapeoProjectApi;
147
160
  projectId: string;
148
- }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/member-api.js", { with: { "resolution-mode": "import" } }).MemberInfo[], Error, import("@comapeo/core/dist/member-api.js", { with: { "resolution-mode": "import" } }).MemberInfo[], import("@tanstack/react-query").QueryKey>, "queryFn"> & {
149
- queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/member-api.js", { with: { "resolution-mode": "import" } }).MemberInfo[], import("@tanstack/react-query").QueryKey, never> | undefined;
161
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/member-api.js", { with: { "resolution-mode": "import" } }).MemberInfo[], Error, import("@comapeo/core/dist/member-api.js", { with: { "resolution-mode": "import" } }).MemberInfo[], readonly ["@comapeo/core-react", "projects", string, "members"]>, "queryFn"> & {
162
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/member-api.js", { with: { "resolution-mode": "import" } }).MemberInfo[], readonly ["@comapeo/core-react", "projects", string, "members"], never> | undefined;
150
163
  } & {
151
- queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, import("@comapeo/core/dist/member-api.js", { with: { "resolution-mode": "import" } }).MemberInfo[]>;
164
+ queryKey: readonly ["@comapeo/core-react", "projects", string, "members"] & {
165
+ [dataTagSymbol]: import("@comapeo/core/dist/member-api.js", { with: { "resolution-mode": "import" } }).MemberInfo[];
166
+ [dataTagErrorSymbol]: Error;
167
+ };
152
168
  };
153
169
  export declare function projectMemberByIdQueryOptions({ projectApi, projectId, deviceId, }: {
154
170
  projectApi: MapeoProjectApi;
155
171
  projectId: string;
156
172
  deviceId: string;
157
- }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/member-api.js", { with: { "resolution-mode": "import" } }).MemberInfo, Error, import("@comapeo/core/dist/member-api.js", { with: { "resolution-mode": "import" } }).MemberInfo, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
158
- queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/member-api.js", { with: { "resolution-mode": "import" } }).MemberInfo, import("@tanstack/react-query").QueryKey, never> | undefined;
173
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/member-api.js", { with: { "resolution-mode": "import" } }).MemberInfo, Error, import("@comapeo/core/dist/member-api.js", { with: { "resolution-mode": "import" } }).MemberInfo, readonly ["@comapeo/core-react", "projects", string, "members", string]>, "queryFn"> & {
174
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/member-api.js", { with: { "resolution-mode": "import" } }).MemberInfo, readonly ["@comapeo/core-react", "projects", string, "members", string], never> | undefined;
159
175
  } & {
160
- queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, import("@comapeo/core/dist/member-api.js", { with: { "resolution-mode": "import" } }).MemberInfo>;
176
+ queryKey: readonly ["@comapeo/core-react", "projects", string, "members", string] & {
177
+ [dataTagSymbol]: import("@comapeo/core/dist/member-api.js", { with: { "resolution-mode": "import" } }).MemberInfo;
178
+ [dataTagErrorSymbol]: Error;
179
+ };
161
180
  };
162
181
  export declare function projectOwnRoleQueryOptions({ projectApi, projectId, }: {
163
182
  projectApi: MapeoProjectApi;
164
183
  projectId: string;
165
- }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">, Error, import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
166
- queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">, import("@tanstack/react-query").QueryKey, never> | undefined;
184
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">, Error, import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">, readonly ["@comapeo/core-react", "projects", string, "role"]>, "queryFn"> & {
185
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">, readonly ["@comapeo/core-react", "projects", string, "role"], never> | undefined;
167
186
  } & {
168
- queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">>;
187
+ queryKey: readonly ["@comapeo/core-react", "projects", string, "role"] & {
188
+ [dataTagSymbol]: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">;
189
+ [dataTagErrorSymbol]: Error;
190
+ };
169
191
  };
170
192
  export declare function iconUrlQueryOptions({ projectApi, projectId, iconId, ...mimeBasedOpts }: {
171
193
  projectApi: MapeoProjectApi;
172
194
  projectId: string;
173
195
  iconId: Parameters<MapeoProjectApi['$icons']['getIconUrl']>[0];
174
- } & (BitmapOpts | SvgOpts)): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
175
- queryFn?: import("@tanstack/react-query").QueryFunction<string, import("@tanstack/react-query").QueryKey, never> | undefined;
196
+ } & (BitmapOpts | SvgOpts)): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, readonly ["@comapeo/core-react", "projects", string, "icons", string, {
197
+ mimeType: Extract<import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).IconVariant["mimeType"], "image/png">;
198
+ pixelDensity: Extract<import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).IconVariant, {
199
+ mimeType: "image/png";
200
+ }>["pixelDensity"];
201
+ size: import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).ValidSizes;
202
+ } | {
203
+ mimeType: Extract<import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).IconVariant["mimeType"], "image/svg+xml">;
204
+ size: import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).ValidSizes;
205
+ }]>, "queryFn"> & {
206
+ queryFn?: import("@tanstack/react-query").QueryFunction<string, readonly ["@comapeo/core-react", "projects", string, "icons", string, {
207
+ mimeType: Extract<import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).IconVariant["mimeType"], "image/png">;
208
+ pixelDensity: Extract<import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).IconVariant, {
209
+ mimeType: "image/png";
210
+ }>["pixelDensity"];
211
+ size: import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).ValidSizes;
212
+ } | {
213
+ mimeType: Extract<import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).IconVariant["mimeType"], "image/svg+xml">;
214
+ size: import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).ValidSizes;
215
+ }], never> | undefined;
176
216
  } & {
177
- queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, string>;
217
+ queryKey: readonly ["@comapeo/core-react", "projects", string, "icons", string, {
218
+ mimeType: Extract<import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).IconVariant["mimeType"], "image/png">;
219
+ pixelDensity: Extract<import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).IconVariant, {
220
+ mimeType: "image/png";
221
+ }>["pixelDensity"];
222
+ size: import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).ValidSizes;
223
+ } | {
224
+ mimeType: Extract<import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).IconVariant["mimeType"], "image/svg+xml">;
225
+ size: import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).ValidSizes;
226
+ }] & {
227
+ [dataTagSymbol]: string;
228
+ [dataTagErrorSymbol]: Error;
229
+ };
178
230
  };
179
231
  export declare function documentCreatedByQueryOptions({ projectApi, projectId, originalVersionId, }: {
180
232
  projectApi: MapeoProjectApi;
181
233
  projectId: string;
182
234
  originalVersionId: string;
183
- }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
184
- queryFn?: import("@tanstack/react-query").QueryFunction<string, import("@tanstack/react-query").QueryKey, never> | undefined;
235
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, readonly ["@comapeo/core-react", "projects", string, "document_created_by", string]>, "queryFn"> & {
236
+ queryFn?: import("@tanstack/react-query").QueryFunction<string, readonly ["@comapeo/core-react", "projects", string, "document_created_by", string], never> | undefined;
185
237
  } & {
186
- queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, string>;
238
+ queryKey: readonly ["@comapeo/core-react", "projects", string, "document_created_by", string] & {
239
+ [dataTagSymbol]: string;
240
+ [dataTagErrorSymbol]: Error;
241
+ };
187
242
  };
188
243
  export declare function attachmentUrlQueryOptions({ projectApi, projectId, blobId, }: {
189
244
  projectApi: MapeoProjectApi;
190
245
  projectId: string;
191
246
  blobId: BlobId;
192
- }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
193
- queryFn?: import("@tanstack/react-query").QueryFunction<string, import("@tanstack/react-query").QueryKey, never> | undefined;
247
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, readonly ["@comapeo/core-react", "projects", string, "attachments", BlobId]>, "queryFn"> & {
248
+ queryFn?: import("@tanstack/react-query").QueryFunction<string, readonly ["@comapeo/core-react", "projects", string, "attachments", BlobId], never> | undefined;
194
249
  } & {
195
- queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, string>;
250
+ queryKey: readonly ["@comapeo/core-react", "projects", string, "attachments", BlobId] & {
251
+ [dataTagSymbol]: string;
252
+ [dataTagErrorSymbol]: Error;
253
+ };
254
+ };
255
+ export declare function addServerPeerMutationOptions({ projectApi, projectId, queryClient, }: {
256
+ projectApi: MapeoProjectApi;
257
+ projectId: string;
258
+ queryClient: QueryClient;
259
+ }): {
260
+ mutationFn: ({ baseUrl, dangerouslyAllowInsecureConnections }: {
261
+ baseUrl: string;
262
+ dangerouslyAllowInsecureConnections?: boolean;
263
+ }) => Promise<void>;
264
+ onSuccess: () => void;
265
+ networkMode: "always";
266
+ retry: false;
267
+ };
268
+ export declare function createProjectMutationOptions({ clientApi, queryClient, }: {
269
+ clientApi: MapeoClientApi;
270
+ queryClient: QueryClient;
271
+ }): {
272
+ mutationFn: (opts: {
273
+ name?: string;
274
+ configPath?: string;
275
+ } | undefined) => Promise<string>;
276
+ onSuccess: () => void;
277
+ networkMode: "always";
278
+ retry: false;
279
+ };
280
+ export declare function leaveProjectMutationOptions({ clientApi, queryClient, }: {
281
+ clientApi: MapeoClientApi;
282
+ queryClient: QueryClient;
283
+ }): {
284
+ mutationFn: ({ projectId }: {
285
+ projectId: string;
286
+ }) => Promise<void>;
287
+ onSuccess: () => void;
288
+ networkMode: "always";
289
+ retry: false;
290
+ };
291
+ export declare function importProjectConfigMutationOptions({ projectApi, projectId, queryClient, }: {
292
+ projectApi: MapeoProjectApi;
293
+ projectId: string;
294
+ queryClient: QueryClient;
295
+ }): {
296
+ mutationFn: ({ configPath }: {
297
+ configPath: string;
298
+ }) => Promise<Error[]>;
299
+ onSuccess: () => void;
300
+ networkMode: "always";
301
+ retry: false;
302
+ };
303
+ export declare function updateProjectSettingsMutationOptions({ projectApi, queryClient, }: {
304
+ projectApi: MapeoProjectApi;
305
+ queryClient: QueryClient;
306
+ }): {
307
+ mutationFn: (value: {
308
+ name?: ProjectSettings["name"];
309
+ configMetadata?: ProjectSettings["configMetadata"];
310
+ defaultPresets?: ProjectSettings["defaultPresets"];
311
+ }) => Promise<EditableProjectSettings>;
312
+ onSuccess: () => void;
313
+ networkMode: "always";
314
+ retry: false;
315
+ };
316
+ export declare function createBlobMutationOptions({ projectApi, }: {
317
+ projectApi: MapeoProjectApi;
318
+ }): {
319
+ mutationFn: ({ original, preview, thumbnail, metadata }: {
320
+ original: string;
321
+ preview?: string;
322
+ thumbnail?: string;
323
+ metadata: Metadata;
324
+ }) => Promise<{
325
+ driveId: string;
326
+ name: string;
327
+ type: "photo" | "video" | "audio";
328
+ hash: string;
329
+ }>;
330
+ networkMode: "always";
331
+ retry: false;
196
332
  };