@comapeo/core-react 1.0.1 → 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 (64) hide show
  1. package/dist/commonjs/contexts/ClientApi.d.ts +14 -0
  2. package/dist/commonjs/contexts/ClientApi.js +16 -0
  3. package/dist/commonjs/hooks/client.d.ts +80 -0
  4. package/dist/commonjs/hooks/client.js +91 -0
  5. package/dist/{hooks → commonjs/hooks}/documents.d.ts +60 -5
  6. package/dist/commonjs/hooks/documents.js +192 -0
  7. package/dist/commonjs/hooks/invites.d.ts +51 -0
  8. package/dist/commonjs/hooks/invites.js +50 -0
  9. package/dist/commonjs/hooks/maps.js +37 -0
  10. package/dist/commonjs/hooks/projects.d.ts +334 -0
  11. package/dist/commonjs/hooks/projects.js +320 -0
  12. package/dist/commonjs/index.d.ts +12 -0
  13. package/dist/commonjs/index.js +69 -0
  14. package/dist/commonjs/lib/react-query/client.d.ts +61 -0
  15. package/dist/commonjs/lib/react-query/client.js +68 -0
  16. package/dist/{lib → commonjs/lib}/react-query/documents.d.ts +789 -706
  17. package/dist/commonjs/lib/react-query/documents.js +149 -0
  18. package/dist/commonjs/lib/react-query/invites.d.ts +71 -0
  19. package/dist/commonjs/lib/react-query/invites.js +85 -0
  20. package/dist/commonjs/lib/react-query/maps.d.ts +24 -0
  21. package/dist/commonjs/lib/react-query/maps.js +27 -0
  22. package/dist/commonjs/lib/react-query/projects.d.ts +332 -0
  23. package/dist/commonjs/lib/react-query/projects.js +235 -0
  24. package/dist/{lib → commonjs/lib}/react-query/shared.d.ts +5 -1
  25. package/dist/commonjs/lib/react-query/shared.js +23 -0
  26. package/dist/commonjs/package.json +3 -0
  27. package/dist/{contexts → esm/contexts}/ClientApi.d.ts +3 -3
  28. package/dist/{hooks → esm/hooks}/client.d.ts +23 -2
  29. package/dist/{hooks → esm/hooks}/client.js +21 -3
  30. package/dist/esm/hooks/documents.d.ts +167 -0
  31. package/dist/{hooks → esm/hooks}/documents.js +54 -3
  32. package/dist/esm/hooks/invites.d.ts +51 -0
  33. package/dist/esm/hooks/invites.js +44 -0
  34. package/dist/esm/hooks/maps.d.ts +33 -0
  35. package/dist/{hooks → esm/hooks}/maps.js +2 -2
  36. package/dist/{hooks → esm/hooks}/projects.d.ts +89 -6
  37. package/dist/{hooks → esm/hooks}/projects.js +59 -3
  38. package/dist/esm/index.d.ts +12 -0
  39. package/dist/esm/index.js +12 -0
  40. package/dist/esm/lib/react-query/client.d.ts +61 -0
  41. package/dist/esm/lib/react-query/client.js +59 -0
  42. package/dist/esm/lib/react-query/documents.d.ts +1584 -0
  43. package/dist/{lib → esm/lib}/react-query/documents.js +56 -2
  44. package/dist/esm/lib/react-query/invites.d.ts +71 -0
  45. package/dist/esm/lib/react-query/invites.js +76 -0
  46. package/dist/esm/lib/react-query/maps.d.ts +24 -0
  47. package/dist/{lib → esm/lib}/react-query/maps.js +6 -2
  48. package/dist/esm/lib/react-query/projects.d.ts +332 -0
  49. package/dist/{lib → esm/lib}/react-query/projects.js +84 -2
  50. package/dist/esm/lib/react-query/shared.d.ts +9 -0
  51. package/dist/{lib → esm/lib}/react-query/shared.js +7 -1
  52. package/dist/esm/package.json +3 -0
  53. package/docs/API.md +157 -258
  54. package/package.json +51 -37
  55. package/dist/index.d.ts +0 -11
  56. package/dist/index.js +0 -11
  57. package/dist/lib/react-query/client.d.ts +0 -30
  58. package/dist/lib/react-query/client.js +0 -29
  59. package/dist/lib/react-query/invites.d.ts +0 -12
  60. package/dist/lib/react-query/invites.js +0 -17
  61. package/dist/lib/react-query/maps.d.ts +0 -15
  62. package/dist/lib/react-query/projects.d.ts +0 -196
  63. /package/dist/{hooks → commonjs/hooks}/maps.d.ts +0 -0
  64. /package/dist/{contexts → esm/contexts}/ClientApi.js +0 -0
@@ -1,5 +1,5 @@
1
- import { queryOptions } from '@tanstack/react-query';
2
- import { baseQueryOptions, ROOT_QUERY_KEY } from './shared';
1
+ import { queryOptions, } from '@tanstack/react-query';
2
+ import { baseMutationOptions, baseQueryOptions, ROOT_QUERY_KEY, } from './shared.js';
3
3
  export function getDocumentsQueryKey({ projectId, docType, }) {
4
4
  return [ROOT_QUERY_KEY, 'projects', projectId, docType];
5
5
  }
@@ -81,3 +81,57 @@ export function documentByVersionIdQueryOptions({ projectApi, projectId, docType
81
81
  },
82
82
  });
83
83
  }
84
+ export function createDocumentMutationOptions({ docType, projectApi, projectId, queryClient, }) {
85
+ return {
86
+ ...baseMutationOptions(),
87
+ mutationFn: async ({ value, }) => {
88
+ // @ts-expect-error TS not handling this well
89
+ return projectApi[docType].create({
90
+ ...value,
91
+ schemaName: docType,
92
+ });
93
+ },
94
+ onSuccess: () => {
95
+ queryClient.invalidateQueries({
96
+ queryKey: getDocumentsQueryKey({
97
+ projectId,
98
+ docType,
99
+ }),
100
+ });
101
+ },
102
+ };
103
+ }
104
+ export function updateDocumentMutationOptions({ docType, projectApi, projectId, queryClient, }) {
105
+ return {
106
+ ...baseMutationOptions(),
107
+ mutationFn: async ({ versionId, value, }) => {
108
+ // @ts-expect-error TS not handling this well
109
+ return projectApi[docType].update(versionId, value);
110
+ },
111
+ onSuccess: () => {
112
+ queryClient.invalidateQueries({
113
+ queryKey: getDocumentsQueryKey({
114
+ projectId,
115
+ docType,
116
+ }),
117
+ });
118
+ },
119
+ };
120
+ }
121
+ export function deleteDocumentMutationOptions({ docType, projectApi, projectId, queryClient, }) {
122
+ return {
123
+ ...baseMutationOptions(),
124
+ mutationFn: async ({ docId, }) => {
125
+ // @ts-expect-error TS not handling this well
126
+ return projectApi[docType].delete(docId);
127
+ },
128
+ onSuccess: () => {
129
+ queryClient.invalidateQueries({
130
+ queryKey: getDocumentsQueryKey({
131
+ projectId,
132
+ docType,
133
+ }),
134
+ });
135
+ },
136
+ };
137
+ }
@@ -0,0 +1,71 @@
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';
4
+ export declare function getInvitesQueryKey(): readonly ["@comapeo/core-react", "invites"];
5
+ export declare function getPendingInvitesQueryKey(): readonly ["@comapeo/core-react", "invites", {
6
+ readonly status: "pending";
7
+ }];
8
+ export declare function pendingInvitesQueryOptions({ clientApi, }: {
9
+ clientApi: MapeoClientApi;
10
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/types.js").MapBuffers<import("@comapeo/core/dist/invite-api.js").InviteInternal>[], Error, import("@comapeo/core/dist/types.js").MapBuffers<import("@comapeo/core/dist/invite-api.js").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").MapBuffers<import("@comapeo/core/dist/invite-api.js").InviteInternal>[], readonly ["@comapeo/core-react", "invites", {
14
+ readonly status: "pending";
15
+ }], never> | undefined;
16
+ } & {
17
+ queryKey: readonly ["@comapeo/core-react", "invites", {
18
+ readonly status: "pending";
19
+ }] & {
20
+ [dataTagSymbol]: import("@comapeo/core/dist/types.js").MapBuffers<import("@comapeo/core/dist/invite-api.js").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;
71
+ };
@@ -0,0 +1,76 @@
1
+ import { queryOptions, } from '@tanstack/react-query';
2
+ import { getMembersQueryKey, getProjectsQueryKey } from './projects.js';
3
+ import { baseMutationOptions, baseQueryOptions, ROOT_QUERY_KEY, } from './shared.js';
4
+ export function getInvitesQueryKey() {
5
+ return [ROOT_QUERY_KEY, 'invites'];
6
+ }
7
+ export function getPendingInvitesQueryKey() {
8
+ return [ROOT_QUERY_KEY, 'invites', { status: 'pending' }];
9
+ }
10
+ export function pendingInvitesQueryOptions({ clientApi, }) {
11
+ return queryOptions({
12
+ ...baseQueryOptions(),
13
+ queryKey: getPendingInvitesQueryKey(),
14
+ queryFn: async () => {
15
+ return clientApi.invite.getPending();
16
+ },
17
+ });
18
+ }
19
+ export function acceptInviteMutationOptions({ clientApi, queryClient, }) {
20
+ return {
21
+ ...baseMutationOptions(),
22
+ mutationFn: async ({ inviteId }) => {
23
+ return clientApi.invite.accept({ inviteId });
24
+ },
25
+ onSuccess: () => {
26
+ queryClient.invalidateQueries({
27
+ queryKey: getInvitesQueryKey(),
28
+ });
29
+ queryClient.invalidateQueries({
30
+ queryKey: getProjectsQueryKey(),
31
+ });
32
+ },
33
+ };
34
+ }
35
+ export function rejectInviteMutationOptions({ clientApi, queryClient, }) {
36
+ return {
37
+ ...baseMutationOptions(),
38
+ mutationFn: async ({ inviteId }) => {
39
+ return clientApi.invite.reject({ inviteId });
40
+ },
41
+ onSuccess: () => {
42
+ queryClient.invalidateQueries({
43
+ queryKey: getInvitesQueryKey(),
44
+ });
45
+ },
46
+ };
47
+ }
48
+ export function sendInviteMutationOptions({ projectApi, projectId, queryClient, }) {
49
+ return {
50
+ ...baseMutationOptions(),
51
+ mutationFn: async ({ deviceId, ...role }) => {
52
+ return projectApi.$member.invite(deviceId, role);
53
+ },
54
+ onSuccess: () => {
55
+ queryClient.invalidateQueries({
56
+ queryKey: getInvitesQueryKey(),
57
+ });
58
+ queryClient.invalidateQueries({
59
+ queryKey: getMembersQueryKey({ projectId }),
60
+ });
61
+ },
62
+ };
63
+ }
64
+ export function requestCancelInviteMutationOptions({ projectApi, queryClient, }) {
65
+ return {
66
+ ...baseMutationOptions(),
67
+ mutationFn: async ({ deviceId }) => {
68
+ return projectApi.$member.requestCancelInvite(deviceId);
69
+ },
70
+ onSuccess: () => {
71
+ queryClient.invalidateQueries({
72
+ queryKey: getInvitesQueryKey(),
73
+ });
74
+ },
75
+ };
76
+ }
@@ -0,0 +1,24 @@
1
+ import type { MapeoClientApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
2
+ export declare function getMapsQueryKey(): readonly ["@comapeo/core-react", "maps"];
3
+ export declare function getStyleJsonUrlQueryKey({ refreshToken, }: {
4
+ refreshToken?: string;
5
+ }): readonly ["@comapeo/core-react", "maps", "stylejson_url", {
6
+ readonly refreshToken: string | undefined;
7
+ }];
8
+ export declare function mapStyleJsonUrlQueryOptions({ clientApi, refreshToken, }: {
9
+ clientApi: MapeoClientApi;
10
+ refreshToken?: string;
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;
17
+ } & {
18
+ queryKey: readonly ["@comapeo/core-react", "maps", "stylejson_url", {
19
+ readonly refreshToken: string | undefined;
20
+ }] & {
21
+ [dataTagSymbol]: string;
22
+ [dataTagErrorSymbol]: Error;
23
+ };
24
+ };
@@ -1,5 +1,5 @@
1
1
  import { queryOptions } from '@tanstack/react-query';
2
- import { baseQueryOptions, ROOT_QUERY_KEY } from './shared';
2
+ import { baseQueryOptions, ROOT_QUERY_KEY } from './shared.js';
3
3
  export function getMapsQueryKey() {
4
4
  return [ROOT_QUERY_KEY, 'maps'];
5
5
  }
@@ -12,7 +12,11 @@ export function mapStyleJsonUrlQueryOptions({ clientApi, refreshToken, }) {
12
12
  queryKey: getStyleJsonUrlQueryKey({ refreshToken }),
13
13
  queryFn: async () => {
14
14
  const result = await clientApi.getMapStyleJsonUrl();
15
- return refreshToken ? result + `?refresh_token=${refreshToken}` : result;
15
+ if (!refreshToken)
16
+ return result;
17
+ const u = new URL(result);
18
+ u.searchParams.set('refresh_token', refreshToken);
19
+ return u.href;
16
20
  },
17
21
  });
18
22
  }
@@ -0,0 +1,332 @@
1
+ import type { Metadata } from '@comapeo/core/dist/blob-api.js' with { 'resolution-mode': 'import' };
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' };
4
+ import type { BlobId } from '@comapeo/core/dist/types.js' with { 'resolution-mode': 'import' };
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';
8
+ export declare function getProjectsQueryKey(): readonly ["@comapeo/core-react", "projects"];
9
+ export declare function getProjectByIdQueryKey({ projectId }: {
10
+ projectId: string;
11
+ }): readonly ["@comapeo/core-react", "projects", string];
12
+ export declare function getProjectSettingsQueryKey({ projectId, }: {
13
+ projectId: string;
14
+ }): readonly ["@comapeo/core-react", "projects", string, "project_settings"];
15
+ export declare function getProjectRoleQueryKey({ projectId }: {
16
+ projectId: string;
17
+ }): readonly ["@comapeo/core-react", "projects", string, "role"];
18
+ export declare function getMembersQueryKey({ projectId }: {
19
+ projectId: string;
20
+ }): readonly ["@comapeo/core-react", "projects", string, "members"];
21
+ export declare function getMemberByIdQueryKey({ projectId, deviceId, }: {
22
+ projectId: string;
23
+ deviceId: string;
24
+ }): readonly ["@comapeo/core-react", "projects", string, "members", string];
25
+ export declare function getIconUrlQueryKey({ projectId, iconId, ...mimeBasedOpts }: {
26
+ projectId: string;
27
+ iconId: string;
28
+ } & (BitmapOpts | SvgOpts)): readonly ["@comapeo/core-react", "projects", string, "icons", string, {
29
+ mimeType: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant["mimeType"], "image/png">;
30
+ pixelDensity: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant, {
31
+ mimeType: "image/png";
32
+ }>["pixelDensity"];
33
+ size: import("@comapeo/core/dist/icon-api.js").ValidSizes;
34
+ } | {
35
+ mimeType: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant["mimeType"], "image/svg+xml">;
36
+ size: import("@comapeo/core/dist/icon-api.js").ValidSizes;
37
+ }];
38
+ export declare function getDocumentCreatedByQueryKey({ projectId, originalVersionId, }: {
39
+ projectId: string;
40
+ originalVersionId: string;
41
+ }): readonly ["@comapeo/core-react", "projects", string, "document_created_by", string];
42
+ export declare function getAttachmentUrlQueryKey({ projectId, blobId, }: {
43
+ projectId: string;
44
+ blobId: BlobId;
45
+ }): readonly ["@comapeo/core-react", "projects", string, "attachments", BlobId];
46
+ export declare function projectsQueryOptions({ clientApi, }: {
47
+ clientApi: MapeoClientApi;
48
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<(Pick<{
49
+ schemaName: "projectSettings";
50
+ name?: string | undefined;
51
+ defaultPresets?: {
52
+ point: string[];
53
+ area: string[];
54
+ vertex: string[];
55
+ line: string[];
56
+ relation: string[];
57
+ } | undefined;
58
+ configMetadata?: {
59
+ name: string;
60
+ buildDate: string;
61
+ importDate: string;
62
+ fileVersion: string;
63
+ } | undefined;
64
+ }, "name"> & {
65
+ projectId: string;
66
+ createdAt?: string | undefined;
67
+ updatedAt?: string | undefined;
68
+ })[], Error, (Pick<{
69
+ schemaName: "projectSettings";
70
+ name?: string | undefined;
71
+ defaultPresets?: {
72
+ point: string[];
73
+ area: string[];
74
+ vertex: string[];
75
+ line: string[];
76
+ relation: string[];
77
+ } | undefined;
78
+ configMetadata?: {
79
+ name: string;
80
+ buildDate: string;
81
+ importDate: string;
82
+ fileVersion: string;
83
+ } | undefined;
84
+ }, "name"> & {
85
+ projectId: string;
86
+ createdAt?: string | undefined;
87
+ updatedAt?: string | undefined;
88
+ })[], readonly ["@comapeo/core-react", "projects"]>, "queryFn"> & {
89
+ queryFn?: import("@tanstack/react-query").QueryFunction<(Pick<{
90
+ schemaName: "projectSettings";
91
+ name?: string | undefined;
92
+ defaultPresets?: {
93
+ point: string[];
94
+ area: string[];
95
+ vertex: string[];
96
+ line: string[];
97
+ relation: string[];
98
+ } | undefined;
99
+ configMetadata?: {
100
+ name: string;
101
+ buildDate: string;
102
+ importDate: string;
103
+ fileVersion: string;
104
+ } | undefined;
105
+ }, "name"> & {
106
+ projectId: string;
107
+ createdAt?: string | undefined;
108
+ updatedAt?: string | undefined;
109
+ })[], readonly ["@comapeo/core-react", "projects"], never> | undefined;
110
+ } & {
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
+ };
135
+ };
136
+ export declare function projectByIdQueryOptions({ clientApi, projectId, }: {
137
+ clientApi: MapeoClientApi;
138
+ projectId: string;
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").MapeoProject>, Error, import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js").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").MapeoProject>, readonly ["@comapeo/core-react", "projects", string], never> | undefined;
141
+ } & {
142
+ queryKey: readonly ["@comapeo/core-react", "projects", string] & {
143
+ [dataTagSymbol]: import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js").MapeoProject>;
144
+ [dataTagErrorSymbol]: Error;
145
+ };
146
+ };
147
+ export declare function projectSettingsQueryOptions({ projectApi, projectId, }: {
148
+ projectApi: MapeoProjectApi;
149
+ projectId: string;
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;
152
+ } & {
153
+ queryKey: readonly ["@comapeo/core-react", "projects", string, "project_settings"] & {
154
+ [dataTagSymbol]: EditableProjectSettings;
155
+ [dataTagErrorSymbol]: Error;
156
+ };
157
+ };
158
+ export declare function projectMembersQueryOptions({ projectApi, projectId, }: {
159
+ projectApi: MapeoProjectApi;
160
+ projectId: string;
161
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/member-api.js").MemberInfo[], Error, import("@comapeo/core/dist/member-api.js").MemberInfo[], readonly ["@comapeo/core-react", "projects", string, "members"]>, "queryFn"> & {
162
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/member-api.js").MemberInfo[], readonly ["@comapeo/core-react", "projects", string, "members"], never> | undefined;
163
+ } & {
164
+ queryKey: readonly ["@comapeo/core-react", "projects", string, "members"] & {
165
+ [dataTagSymbol]: import("@comapeo/core/dist/member-api.js").MemberInfo[];
166
+ [dataTagErrorSymbol]: Error;
167
+ };
168
+ };
169
+ export declare function projectMemberByIdQueryOptions({ projectApi, projectId, deviceId, }: {
170
+ projectApi: MapeoProjectApi;
171
+ projectId: string;
172
+ deviceId: string;
173
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/member-api.js").MemberInfo, Error, import("@comapeo/core/dist/member-api.js").MemberInfo, readonly ["@comapeo/core-react", "projects", string, "members", string]>, "queryFn"> & {
174
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/member-api.js").MemberInfo, readonly ["@comapeo/core-react", "projects", string, "members", string], never> | undefined;
175
+ } & {
176
+ queryKey: readonly ["@comapeo/core-react", "projects", string, "members", string] & {
177
+ [dataTagSymbol]: import("@comapeo/core/dist/member-api.js").MemberInfo;
178
+ [dataTagErrorSymbol]: Error;
179
+ };
180
+ };
181
+ export declare function projectOwnRoleQueryOptions({ projectApi, projectId, }: {
182
+ projectApi: MapeoProjectApi;
183
+ projectId: string;
184
+ }): 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"> & {
185
+ 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;
186
+ } & {
187
+ queryKey: readonly ["@comapeo/core-react", "projects", string, "role"] & {
188
+ [dataTagSymbol]: import("@comapeo/core/dist/roles.js").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">;
189
+ [dataTagErrorSymbol]: Error;
190
+ };
191
+ };
192
+ export declare function iconUrlQueryOptions({ projectApi, projectId, iconId, ...mimeBasedOpts }: {
193
+ projectApi: MapeoProjectApi;
194
+ projectId: string;
195
+ iconId: Parameters<MapeoProjectApi['$icons']['getIconUrl']>[0];
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").IconVariant["mimeType"], "image/png">;
198
+ pixelDensity: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant, {
199
+ mimeType: "image/png";
200
+ }>["pixelDensity"];
201
+ size: import("@comapeo/core/dist/icon-api.js").ValidSizes;
202
+ } | {
203
+ mimeType: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant["mimeType"], "image/svg+xml">;
204
+ size: import("@comapeo/core/dist/icon-api.js").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").IconVariant["mimeType"], "image/png">;
208
+ pixelDensity: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant, {
209
+ mimeType: "image/png";
210
+ }>["pixelDensity"];
211
+ size: import("@comapeo/core/dist/icon-api.js").ValidSizes;
212
+ } | {
213
+ mimeType: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant["mimeType"], "image/svg+xml">;
214
+ size: import("@comapeo/core/dist/icon-api.js").ValidSizes;
215
+ }], never> | undefined;
216
+ } & {
217
+ queryKey: readonly ["@comapeo/core-react", "projects", string, "icons", string, {
218
+ mimeType: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant["mimeType"], "image/png">;
219
+ pixelDensity: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant, {
220
+ mimeType: "image/png";
221
+ }>["pixelDensity"];
222
+ size: import("@comapeo/core/dist/icon-api.js").ValidSizes;
223
+ } | {
224
+ mimeType: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant["mimeType"], "image/svg+xml">;
225
+ size: import("@comapeo/core/dist/icon-api.js").ValidSizes;
226
+ }] & {
227
+ [dataTagSymbol]: string;
228
+ [dataTagErrorSymbol]: Error;
229
+ };
230
+ };
231
+ export declare function documentCreatedByQueryOptions({ projectApi, projectId, originalVersionId, }: {
232
+ projectApi: MapeoProjectApi;
233
+ projectId: string;
234
+ originalVersionId: string;
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;
237
+ } & {
238
+ queryKey: readonly ["@comapeo/core-react", "projects", string, "document_created_by", string] & {
239
+ [dataTagSymbol]: string;
240
+ [dataTagErrorSymbol]: Error;
241
+ };
242
+ };
243
+ export declare function attachmentUrlQueryOptions({ projectApi, projectId, blobId, }: {
244
+ projectApi: MapeoProjectApi;
245
+ projectId: string;
246
+ blobId: BlobId;
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;
249
+ } & {
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;
332
+ };