@comapeo/core-react 1.0.0 → 1.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.
Files changed (57) 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 +59 -0
  4. package/dist/commonjs/hooks/client.js +71 -0
  5. package/dist/{hooks → commonjs/hooks}/documents.d.ts +2 -2
  6. package/dist/commonjs/hooks/documents.js +138 -0
  7. package/dist/commonjs/hooks/maps.js +37 -0
  8. package/dist/commonjs/hooks/projects.d.ts +251 -0
  9. package/dist/commonjs/hooks/projects.js +258 -0
  10. package/dist/commonjs/index.d.ts +11 -0
  11. package/dist/commonjs/index.js +69 -0
  12. package/dist/commonjs/lib/react-query/client.d.ts +30 -0
  13. package/dist/commonjs/lib/react-query/client.js +36 -0
  14. package/dist/{lib → commonjs/lib}/react-query/documents.d.ts +101 -101
  15. package/dist/commonjs/lib/react-query/documents.js +92 -0
  16. package/dist/commonjs/lib/react-query/invites.d.ts +12 -0
  17. package/dist/commonjs/lib/react-query/invites.js +22 -0
  18. package/dist/commonjs/lib/react-query/maps.d.ts +15 -0
  19. package/dist/commonjs/lib/react-query/maps.js +23 -0
  20. package/dist/commonjs/lib/react-query/projects.d.ts +196 -0
  21. package/dist/commonjs/lib/react-query/projects.js +147 -0
  22. package/dist/commonjs/lib/react-query/shared.js +16 -0
  23. package/dist/commonjs/package.json +3 -0
  24. package/dist/{contexts → esm/contexts}/ClientApi.d.ts +3 -3
  25. package/dist/{hooks → esm/hooks}/client.d.ts +2 -2
  26. package/dist/{hooks → esm/hooks}/client.js +2 -2
  27. package/dist/esm/hooks/documents.d.ts +112 -0
  28. package/dist/{hooks → esm/hooks}/documents.js +2 -2
  29. package/dist/esm/hooks/maps.d.ts +33 -0
  30. package/dist/{hooks → esm/hooks}/maps.js +2 -2
  31. package/dist/{hooks → esm/hooks}/projects.d.ts +6 -6
  32. package/dist/{hooks → esm/hooks}/projects.js +2 -2
  33. package/dist/esm/index.d.ts +11 -0
  34. package/dist/esm/index.js +11 -0
  35. package/dist/esm/lib/react-query/client.d.ts +30 -0
  36. package/dist/{lib → esm/lib}/react-query/client.js +1 -1
  37. package/dist/esm/lib/react-query/documents.d.ts +1501 -0
  38. package/dist/{lib → esm/lib}/react-query/documents.js +1 -1
  39. package/dist/esm/lib/react-query/invites.d.ts +12 -0
  40. package/dist/{lib → esm/lib}/react-query/invites.js +1 -1
  41. package/dist/esm/lib/react-query/maps.d.ts +15 -0
  42. package/dist/{lib → esm/lib}/react-query/maps.js +1 -1
  43. package/dist/esm/lib/react-query/projects.d.ts +196 -0
  44. package/dist/{lib → esm/lib}/react-query/projects.js +1 -1
  45. package/dist/esm/lib/react-query/shared.d.ts +5 -0
  46. package/dist/esm/package.json +3 -0
  47. package/package.json +28 -11
  48. package/dist/index.d.ts +0 -11
  49. package/dist/index.js +0 -11
  50. package/dist/lib/react-query/client.d.ts +0 -30
  51. package/dist/lib/react-query/invites.d.ts +0 -12
  52. package/dist/lib/react-query/maps.d.ts +0 -15
  53. package/dist/lib/react-query/projects.d.ts +0 -196
  54. /package/dist/{hooks → commonjs/hooks}/maps.d.ts +0 -0
  55. /package/dist/{lib → commonjs/lib}/react-query/shared.d.ts +0 -0
  56. /package/dist/{contexts → esm/contexts}/ClientApi.js +0 -0
  57. /package/dist/{lib → esm/lib}/react-query/shared.js +0 -0
@@ -0,0 +1,258 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useProjectSettings = useProjectSettings;
4
+ exports.useSingleProject = useSingleProject;
5
+ exports.useManyProjects = useManyProjects;
6
+ exports.useSingleMember = useSingleMember;
7
+ exports.useManyMembers = useManyMembers;
8
+ exports.useIconUrl = useIconUrl;
9
+ exports.useAttachmentUrl = useAttachmentUrl;
10
+ exports.useDocumentCreatedBy = useDocumentCreatedBy;
11
+ const react_query_1 = require("@tanstack/react-query");
12
+ const projects_js_1 = require("../lib/react-query/projects.js");
13
+ const client_js_1 = require("./client.js");
14
+ /**
15
+ * Retrieve the project settings for a project.
16
+ *
17
+ * @param opts.projectId Project public ID
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * function BasicExample() {
22
+ * const { data } = useProjectSettings({ projectId: '...' })
23
+ *
24
+ * console.log(data.name)
25
+ * }
26
+ * ```
27
+ */
28
+ function useProjectSettings({ projectId }) {
29
+ const clientApi = (0, client_js_1.useClientApi)();
30
+ const { data: projectApi } = (0, react_query_1.useSuspenseQuery)((0, projects_js_1.projectByIdQueryOptions)({
31
+ projectId,
32
+ clientApi,
33
+ }));
34
+ const { data, error, isRefetching } = (0, react_query_1.useSuspenseQuery)((0, projects_js_1.projectSettingsQueryOptions)({
35
+ projectApi,
36
+ projectId,
37
+ }));
38
+ return { data, error, isRefetching };
39
+ }
40
+ /**
41
+ * Retrieve a project API instance for a project.
42
+ *
43
+ * This is mostly used internally by the other hooks and should only be used if certain project APIs are not exposed via the hooks.
44
+ *
45
+ * @param opts.projectId Project public ID
46
+ *
47
+ * @example
48
+ * ```tsx
49
+ * function BasicExample() {
50
+ * const { data } = useSingleProject({ projectId: '...' })
51
+ * }
52
+ * ```
53
+ */
54
+ function useSingleProject({ projectId }) {
55
+ const clientApi = (0, client_js_1.useClientApi)();
56
+ const { data, error, isRefetching } = (0, react_query_1.useSuspenseQuery)({
57
+ ...(0, projects_js_1.projectByIdQueryOptions)({
58
+ clientApi,
59
+ projectId,
60
+ }),
61
+ // Keep project instances around indefinitely - shouldn't be a memory
62
+ // problem because these are only lightweight proxy objects, and project
63
+ // references are kept indefinitely on the backend anyway once they are
64
+ // accessed
65
+ staleTime: Infinity,
66
+ gcTime: Infinity,
67
+ });
68
+ return { data, error, isRefetching };
69
+ }
70
+ /**
71
+ * Retrieve project information for each project that exists.
72
+ *
73
+ * @example
74
+ * ```tsx
75
+ * function BasicExample() {
76
+ * const { data } = useManyProjects()
77
+ *
78
+ * console.log(data.map(project => project.name))
79
+ * }
80
+ * ```
81
+ */
82
+ function useManyProjects() {
83
+ const clientApi = (0, client_js_1.useClientApi)();
84
+ const { data, error, isRefetching } = (0, react_query_1.useSuspenseQuery)((0, projects_js_1.projectsQueryOptions)({
85
+ clientApi,
86
+ }));
87
+ return { data, error, isRefetching };
88
+ }
89
+ /**
90
+ * Retrieve a single member of a project.
91
+ *
92
+ * @param opts.projectId Project public ID
93
+ * @param opts.projectId Device ID of interest
94
+ *
95
+ * @example
96
+ * ```tsx
97
+ * function BasicExample() {
98
+ * const { data } = useSingleMember({ projectId: '...', deviceId: '...' })
99
+ *
100
+ * console.log(data.role)
101
+ * }
102
+ * ```
103
+ */
104
+ function useSingleMember({ projectId, deviceId, }) {
105
+ const { data: projectApi } = useSingleProject({ projectId });
106
+ const { data, error, isRefetching } = (0, react_query_1.useSuspenseQuery)((0, projects_js_1.projectMemberByIdQueryOptions)({
107
+ projectApi,
108
+ projectId,
109
+ deviceId,
110
+ }));
111
+ return { data, error, isRefetching };
112
+ }
113
+ /**
114
+ * Retrieve all members of a project.
115
+ *
116
+ * @param opts.projectId Project public ID
117
+ *
118
+ * @example
119
+ * ```tsx
120
+ * function BasicExample() {
121
+ * const { data } = useManyMembers({ projectId: '...' })
122
+ *
123
+ * console.log(data.role)
124
+ * }
125
+ * ```
126
+ */
127
+ function useManyMembers({ projectId }) {
128
+ const { data: projectApi } = useSingleProject({ projectId });
129
+ const { data, error, isRefetching } = (0, react_query_1.useSuspenseQuery)((0, projects_js_1.projectMembersQueryOptions)({ projectApi, projectId }));
130
+ return { data, error, isRefetching };
131
+ }
132
+ /**
133
+ * Retrieve a URL that points to icon resources served by the embedded HTTP server.
134
+ *
135
+ * _TODO: Explain bitmap opts vs svg opts_
136
+ *
137
+ * @param opts.projectId Project public ID
138
+ * @param opts.iconId Icon ID of interest
139
+ * @param opts.mimeType MIME type of desired resource
140
+ * @param opts.pixelDensity Pixel density resource (only applicable when `mimeType` is `'image/png'`)
141
+ * @param opts.size Size of desired resource
142
+ *
143
+ * @example
144
+ * ```tsx
145
+ * function PngExample() {
146
+ * const { data } = useIconUrl({
147
+ * projectId: '...',
148
+ * iconId: '...',
149
+ * mimeType: 'image/png',
150
+ * pixelDensity: 1,
151
+ * size: 'medium'
152
+ * })
153
+ * }
154
+ * ```
155
+ *
156
+ * ```tsx
157
+ * function SvgExample() {
158
+ * const { data } = useIconUrl({
159
+ * projectId: '...',
160
+ * iconId: '...',
161
+ * mimeType: 'image/svg',
162
+ * size: 'medium'
163
+ * })
164
+ * }
165
+ * ```
166
+ */
167
+ function useIconUrl({ projectId, iconId, ...mimeBasedOpts }) {
168
+ const { data: projectApi } = useSingleProject({ projectId });
169
+ const { data, error, isRefetching } = (0, react_query_1.useSuspenseQuery)((0, projects_js_1.iconUrlQueryOptions)({
170
+ ...mimeBasedOpts,
171
+ projectApi,
172
+ projectId,
173
+ iconId,
174
+ }));
175
+ return { data, error, isRefetching };
176
+ }
177
+ /**
178
+ * Retrieve a URL that points to a desired blob resource.
179
+ *
180
+ * _TODO: Explain BlobId in more depth_
181
+ *
182
+ * @param opts.projectId Project public Id
183
+ * @param opts.blobId Blob ID of the desired resource
184
+ *
185
+ * @example
186
+ * ```tsx
187
+ * function PhotoExample() {
188
+ * const { data } = useAttachmentUrl({
189
+ * projectId: '...',
190
+ * blobId: {
191
+ * type: 'photo',
192
+ * variant: 'thumbnail',
193
+ * name: '...',
194
+ * driveId: '...',
195
+ * }
196
+ * })
197
+ * }
198
+ * ```
199
+ *
200
+ * ```tsx
201
+ * function AudioExample() {
202
+ * const { data } = useAttachmentUrl({
203
+ * projectId: '...',
204
+ * blobId: {
205
+ * type: 'audio',
206
+ * variant: 'original',
207
+ * name: '...',
208
+ * driveId: '...',
209
+ * }
210
+ * })
211
+ * }
212
+ * ```
213
+ *
214
+ * ```tsx
215
+ * function VideoExample() {
216
+ * const { data } = useAttachmentUrl({
217
+ * projectId: '...',
218
+ * blobId: {
219
+ * type: 'video',
220
+ * variant: 'original',
221
+ * name: '...',
222
+ * driveId: '...',
223
+ * }
224
+ * })
225
+ * }
226
+ * ```
227
+ */
228
+ function useAttachmentUrl({ projectId, blobId, }) {
229
+ const { data: projectApi } = useSingleProject({ projectId });
230
+ const { data, error, isRefetching } = (0, react_query_1.useSuspenseQuery)((0, projects_js_1.attachmentUrlQueryOptions)({
231
+ projectApi,
232
+ projectId,
233
+ blobId,
234
+ }));
235
+ return { data, error, isRefetching };
236
+ }
237
+ // TODO: Eventually remove in favor of this information being provided by the backend when retrieving documents
238
+ /**
239
+ * Retrieve the device ID that created a document.
240
+ *
241
+ * @param opts.projectId Project public ID
242
+ * @param opts.originalVersionId Version ID of document
243
+ *
244
+ * @example
245
+ * ```tsx
246
+ * function BasicExample() {
247
+ * const { data } = useDocumentCreatedBy({
248
+ * projectId: '...',
249
+ * originalVersionId: '...',
250
+ * })
251
+ * }
252
+ * ```
253
+ */
254
+ function useDocumentCreatedBy({ projectId, originalVersionId, }) {
255
+ const { data: projectApi } = useSingleProject({ projectId });
256
+ const { data, error, isRefetching } = (0, react_query_1.useSuspenseQuery)((0, projects_js_1.documentCreatedByQueryOptions)({ projectApi, projectId, originalVersionId }));
257
+ return { data, error, isRefetching };
258
+ }
@@ -0,0 +1,11 @@
1
+ export { ClientApiContext, ClientApiProvider } from './contexts/ClientApi.js';
2
+ export { useClientApi, useIsArchiveDevice, useOwnDeviceInfo, } from './hooks/client.js';
3
+ export { useManyDocs, useSingleDocByDocId, useSingleDocByVersionId, } from './hooks/documents.js';
4
+ export { useMapStyleUrl } from './hooks/maps.js';
5
+ export { useAttachmentUrl, useDocumentCreatedBy, useIconUrl, useManyMembers, useManyProjects, useProjectSettings, useSingleMember, useSingleProject, } from './hooks/projects.js';
6
+ export { deviceInfoQueryOptions, getClientQueryKey, getDeviceInfoQueryKey, getIsArchiveDeviceQueryKey, isArchiveDeviceQueryOptions, } from './lib/react-query/client.js';
7
+ export { documentByDocumentIdQueryOptions, documentByVersionIdQueryOptions, documentsQueryOptions, getDocumentByDocIdQueryKey, getDocumentByVersionIdQueryKey, getDocumentsQueryKey, getManyDocumentsQueryKey, type DocumentType, } from './lib/react-query/documents.js';
8
+ export { getInvitesQueryKey, getPendingInvitesQueryKey, pendingInvitesQueryOptions, } from './lib/react-query/invites.js';
9
+ export { getMapsQueryKey, getStyleJsonUrlQueryKey, mapStyleJsonUrlQueryOptions, } from './lib/react-query/maps.js';
10
+ export { attachmentUrlQueryOptions, documentCreatedByQueryOptions, getAttachmentUrlQueryKey, getDocumentCreatedByQueryKey, getIconUrlQueryKey, getMemberByIdQueryKey, getMembersQueryKey, getProjectByIdQueryKey, getProjectRoleQueryKey, getProjectSettingsQueryKey, getProjectsQueryKey, iconUrlQueryOptions, projectByIdQueryOptions, projectMembersQueryOptions, projectOwnRoleQueryOptions, projectSettingsQueryOptions, projectsQueryOptions, } from './lib/react-query/projects.js';
11
+ export { ROOT_QUERY_KEY, baseQueryOptions } from './lib/react-query/shared.js';
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.projectOwnRoleQueryOptions = exports.projectMembersQueryOptions = exports.projectByIdQueryOptions = exports.iconUrlQueryOptions = exports.getProjectsQueryKey = exports.getProjectSettingsQueryKey = exports.getProjectRoleQueryKey = exports.getProjectByIdQueryKey = exports.getMembersQueryKey = exports.getMemberByIdQueryKey = exports.getIconUrlQueryKey = exports.getDocumentCreatedByQueryKey = exports.getAttachmentUrlQueryKey = exports.documentCreatedByQueryOptions = exports.attachmentUrlQueryOptions = exports.mapStyleJsonUrlQueryOptions = exports.getStyleJsonUrlQueryKey = exports.getMapsQueryKey = exports.pendingInvitesQueryOptions = exports.getPendingInvitesQueryKey = exports.getInvitesQueryKey = exports.getManyDocumentsQueryKey = exports.getDocumentsQueryKey = exports.getDocumentByVersionIdQueryKey = exports.getDocumentByDocIdQueryKey = exports.documentsQueryOptions = exports.documentByVersionIdQueryOptions = exports.documentByDocumentIdQueryOptions = exports.isArchiveDeviceQueryOptions = exports.getIsArchiveDeviceQueryKey = exports.getDeviceInfoQueryKey = exports.getClientQueryKey = exports.deviceInfoQueryOptions = exports.useSingleProject = exports.useSingleMember = exports.useProjectSettings = exports.useManyProjects = exports.useManyMembers = exports.useIconUrl = exports.useDocumentCreatedBy = exports.useAttachmentUrl = exports.useMapStyleUrl = exports.useSingleDocByVersionId = exports.useSingleDocByDocId = exports.useManyDocs = exports.useOwnDeviceInfo = exports.useIsArchiveDevice = exports.useClientApi = exports.ClientApiProvider = exports.ClientApiContext = void 0;
4
+ exports.baseQueryOptions = exports.ROOT_QUERY_KEY = exports.projectsQueryOptions = exports.projectSettingsQueryOptions = void 0;
5
+ var ClientApi_js_1 = require("./contexts/ClientApi.js");
6
+ Object.defineProperty(exports, "ClientApiContext", { enumerable: true, get: function () { return ClientApi_js_1.ClientApiContext; } });
7
+ Object.defineProperty(exports, "ClientApiProvider", { enumerable: true, get: function () { return ClientApi_js_1.ClientApiProvider; } });
8
+ var client_js_1 = require("./hooks/client.js");
9
+ Object.defineProperty(exports, "useClientApi", { enumerable: true, get: function () { return client_js_1.useClientApi; } });
10
+ Object.defineProperty(exports, "useIsArchiveDevice", { enumerable: true, get: function () { return client_js_1.useIsArchiveDevice; } });
11
+ Object.defineProperty(exports, "useOwnDeviceInfo", { enumerable: true, get: function () { return client_js_1.useOwnDeviceInfo; } });
12
+ var documents_js_1 = require("./hooks/documents.js");
13
+ Object.defineProperty(exports, "useManyDocs", { enumerable: true, get: function () { return documents_js_1.useManyDocs; } });
14
+ Object.defineProperty(exports, "useSingleDocByDocId", { enumerable: true, get: function () { return documents_js_1.useSingleDocByDocId; } });
15
+ Object.defineProperty(exports, "useSingleDocByVersionId", { enumerable: true, get: function () { return documents_js_1.useSingleDocByVersionId; } });
16
+ var maps_js_1 = require("./hooks/maps.js");
17
+ Object.defineProperty(exports, "useMapStyleUrl", { enumerable: true, get: function () { return maps_js_1.useMapStyleUrl; } });
18
+ var projects_js_1 = require("./hooks/projects.js");
19
+ Object.defineProperty(exports, "useAttachmentUrl", { enumerable: true, get: function () { return projects_js_1.useAttachmentUrl; } });
20
+ Object.defineProperty(exports, "useDocumentCreatedBy", { enumerable: true, get: function () { return projects_js_1.useDocumentCreatedBy; } });
21
+ Object.defineProperty(exports, "useIconUrl", { enumerable: true, get: function () { return projects_js_1.useIconUrl; } });
22
+ Object.defineProperty(exports, "useManyMembers", { enumerable: true, get: function () { return projects_js_1.useManyMembers; } });
23
+ Object.defineProperty(exports, "useManyProjects", { enumerable: true, get: function () { return projects_js_1.useManyProjects; } });
24
+ Object.defineProperty(exports, "useProjectSettings", { enumerable: true, get: function () { return projects_js_1.useProjectSettings; } });
25
+ Object.defineProperty(exports, "useSingleMember", { enumerable: true, get: function () { return projects_js_1.useSingleMember; } });
26
+ Object.defineProperty(exports, "useSingleProject", { enumerable: true, get: function () { return projects_js_1.useSingleProject; } });
27
+ var client_js_2 = require("./lib/react-query/client.js");
28
+ Object.defineProperty(exports, "deviceInfoQueryOptions", { enumerable: true, get: function () { return client_js_2.deviceInfoQueryOptions; } });
29
+ Object.defineProperty(exports, "getClientQueryKey", { enumerable: true, get: function () { return client_js_2.getClientQueryKey; } });
30
+ Object.defineProperty(exports, "getDeviceInfoQueryKey", { enumerable: true, get: function () { return client_js_2.getDeviceInfoQueryKey; } });
31
+ Object.defineProperty(exports, "getIsArchiveDeviceQueryKey", { enumerable: true, get: function () { return client_js_2.getIsArchiveDeviceQueryKey; } });
32
+ Object.defineProperty(exports, "isArchiveDeviceQueryOptions", { enumerable: true, get: function () { return client_js_2.isArchiveDeviceQueryOptions; } });
33
+ var documents_js_2 = require("./lib/react-query/documents.js");
34
+ Object.defineProperty(exports, "documentByDocumentIdQueryOptions", { enumerable: true, get: function () { return documents_js_2.documentByDocumentIdQueryOptions; } });
35
+ Object.defineProperty(exports, "documentByVersionIdQueryOptions", { enumerable: true, get: function () { return documents_js_2.documentByVersionIdQueryOptions; } });
36
+ Object.defineProperty(exports, "documentsQueryOptions", { enumerable: true, get: function () { return documents_js_2.documentsQueryOptions; } });
37
+ Object.defineProperty(exports, "getDocumentByDocIdQueryKey", { enumerable: true, get: function () { return documents_js_2.getDocumentByDocIdQueryKey; } });
38
+ Object.defineProperty(exports, "getDocumentByVersionIdQueryKey", { enumerable: true, get: function () { return documents_js_2.getDocumentByVersionIdQueryKey; } });
39
+ Object.defineProperty(exports, "getDocumentsQueryKey", { enumerable: true, get: function () { return documents_js_2.getDocumentsQueryKey; } });
40
+ Object.defineProperty(exports, "getManyDocumentsQueryKey", { enumerable: true, get: function () { return documents_js_2.getManyDocumentsQueryKey; } });
41
+ var invites_js_1 = require("./lib/react-query/invites.js");
42
+ Object.defineProperty(exports, "getInvitesQueryKey", { enumerable: true, get: function () { return invites_js_1.getInvitesQueryKey; } });
43
+ Object.defineProperty(exports, "getPendingInvitesQueryKey", { enumerable: true, get: function () { return invites_js_1.getPendingInvitesQueryKey; } });
44
+ Object.defineProperty(exports, "pendingInvitesQueryOptions", { enumerable: true, get: function () { return invites_js_1.pendingInvitesQueryOptions; } });
45
+ var maps_js_2 = require("./lib/react-query/maps.js");
46
+ Object.defineProperty(exports, "getMapsQueryKey", { enumerable: true, get: function () { return maps_js_2.getMapsQueryKey; } });
47
+ Object.defineProperty(exports, "getStyleJsonUrlQueryKey", { enumerable: true, get: function () { return maps_js_2.getStyleJsonUrlQueryKey; } });
48
+ Object.defineProperty(exports, "mapStyleJsonUrlQueryOptions", { enumerable: true, get: function () { return maps_js_2.mapStyleJsonUrlQueryOptions; } });
49
+ var projects_js_2 = require("./lib/react-query/projects.js");
50
+ Object.defineProperty(exports, "attachmentUrlQueryOptions", { enumerable: true, get: function () { return projects_js_2.attachmentUrlQueryOptions; } });
51
+ Object.defineProperty(exports, "documentCreatedByQueryOptions", { enumerable: true, get: function () { return projects_js_2.documentCreatedByQueryOptions; } });
52
+ Object.defineProperty(exports, "getAttachmentUrlQueryKey", { enumerable: true, get: function () { return projects_js_2.getAttachmentUrlQueryKey; } });
53
+ Object.defineProperty(exports, "getDocumentCreatedByQueryKey", { enumerable: true, get: function () { return projects_js_2.getDocumentCreatedByQueryKey; } });
54
+ Object.defineProperty(exports, "getIconUrlQueryKey", { enumerable: true, get: function () { return projects_js_2.getIconUrlQueryKey; } });
55
+ Object.defineProperty(exports, "getMemberByIdQueryKey", { enumerable: true, get: function () { return projects_js_2.getMemberByIdQueryKey; } });
56
+ Object.defineProperty(exports, "getMembersQueryKey", { enumerable: true, get: function () { return projects_js_2.getMembersQueryKey; } });
57
+ Object.defineProperty(exports, "getProjectByIdQueryKey", { enumerable: true, get: function () { return projects_js_2.getProjectByIdQueryKey; } });
58
+ Object.defineProperty(exports, "getProjectRoleQueryKey", { enumerable: true, get: function () { return projects_js_2.getProjectRoleQueryKey; } });
59
+ Object.defineProperty(exports, "getProjectSettingsQueryKey", { enumerable: true, get: function () { return projects_js_2.getProjectSettingsQueryKey; } });
60
+ Object.defineProperty(exports, "getProjectsQueryKey", { enumerable: true, get: function () { return projects_js_2.getProjectsQueryKey; } });
61
+ Object.defineProperty(exports, "iconUrlQueryOptions", { enumerable: true, get: function () { return projects_js_2.iconUrlQueryOptions; } });
62
+ Object.defineProperty(exports, "projectByIdQueryOptions", { enumerable: true, get: function () { return projects_js_2.projectByIdQueryOptions; } });
63
+ Object.defineProperty(exports, "projectMembersQueryOptions", { enumerable: true, get: function () { return projects_js_2.projectMembersQueryOptions; } });
64
+ Object.defineProperty(exports, "projectOwnRoleQueryOptions", { enumerable: true, get: function () { return projects_js_2.projectOwnRoleQueryOptions; } });
65
+ Object.defineProperty(exports, "projectSettingsQueryOptions", { enumerable: true, get: function () { return projects_js_2.projectSettingsQueryOptions; } });
66
+ Object.defineProperty(exports, "projectsQueryOptions", { enumerable: true, get: function () { return projects_js_2.projectsQueryOptions; } });
67
+ var shared_js_1 = require("./lib/react-query/shared.js");
68
+ Object.defineProperty(exports, "ROOT_QUERY_KEY", { enumerable: true, get: function () { return shared_js_1.ROOT_QUERY_KEY; } });
69
+ Object.defineProperty(exports, "baseQueryOptions", { enumerable: true, get: function () { return shared_js_1.baseQueryOptions; } });
@@ -0,0 +1,30 @@
1
+ import type { MapeoClientApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
2
+ export declare function getClientQueryKey(): readonly ["@comapeo/core-react", "client"];
3
+ export declare function getDeviceInfoQueryKey(): readonly ["@comapeo/core-react", "client", "device_info"];
4
+ export declare function getIsArchiveDeviceQueryKey(): readonly ["@comapeo/core-react", "client", "is_archive_device"];
5
+ export declare function deviceInfoQueryOptions({ clientApi, }: {
6
+ clientApi: MapeoClientApi;
7
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<{
8
+ deviceId: string;
9
+ deviceType: "device_type_unspecified" | "mobile" | "tablet" | "desktop" | "selfHostedServer" | "UNRECOGNIZED";
10
+ } & Partial<import("@comapeo/core/dist/schema/client.js", { with: { "resolution-mode": "import" } }).DeviceInfoParam>, Error, {
11
+ deviceId: string;
12
+ deviceType: "device_type_unspecified" | "mobile" | "tablet" | "desktop" | "selfHostedServer" | "UNRECOGNIZED";
13
+ } & Partial<import("@comapeo/core/dist/schema/client.js", { with: { "resolution-mode": "import" } }).DeviceInfoParam>, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
14
+ queryFn?: import("@tanstack/react-query").QueryFunction<{
15
+ deviceId: string;
16
+ deviceType: "device_type_unspecified" | "mobile" | "tablet" | "desktop" | "selfHostedServer" | "UNRECOGNIZED";
17
+ } & Partial<import("@comapeo/core/dist/schema/client.js", { with: { "resolution-mode": "import" } }).DeviceInfoParam>, import("@tanstack/react-query").QueryKey, never> | undefined;
18
+ } & {
19
+ queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, {
20
+ deviceId: string;
21
+ deviceType: "device_type_unspecified" | "mobile" | "tablet" | "desktop" | "selfHostedServer" | "UNRECOGNIZED";
22
+ } & Partial<import("@comapeo/core/dist/schema/client.js", { with: { "resolution-mode": "import" } }).DeviceInfoParam>>;
23
+ };
24
+ export declare function isArchiveDeviceQueryOptions({ clientApi, }: {
25
+ clientApi: MapeoClientApi;
26
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<boolean, Error, boolean, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
27
+ queryFn?: import("@tanstack/react-query").QueryFunction<boolean, import("@tanstack/react-query").QueryKey, never> | undefined;
28
+ } & {
29
+ queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, boolean>;
30
+ };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getClientQueryKey = getClientQueryKey;
4
+ exports.getDeviceInfoQueryKey = getDeviceInfoQueryKey;
5
+ exports.getIsArchiveDeviceQueryKey = getIsArchiveDeviceQueryKey;
6
+ exports.deviceInfoQueryOptions = deviceInfoQueryOptions;
7
+ exports.isArchiveDeviceQueryOptions = isArchiveDeviceQueryOptions;
8
+ const react_query_1 = require("@tanstack/react-query");
9
+ const shared_js_1 = require("./shared.js");
10
+ function getClientQueryKey() {
11
+ return [shared_js_1.ROOT_QUERY_KEY, 'client'];
12
+ }
13
+ function getDeviceInfoQueryKey() {
14
+ return [shared_js_1.ROOT_QUERY_KEY, 'client', 'device_info'];
15
+ }
16
+ function getIsArchiveDeviceQueryKey() {
17
+ return [shared_js_1.ROOT_QUERY_KEY, 'client', 'is_archive_device'];
18
+ }
19
+ function deviceInfoQueryOptions({ clientApi, }) {
20
+ return (0, react_query_1.queryOptions)({
21
+ ...(0, shared_js_1.baseQueryOptions)(),
22
+ queryKey: getDeviceInfoQueryKey(),
23
+ queryFn: async () => {
24
+ return clientApi.getDeviceInfo();
25
+ },
26
+ });
27
+ }
28
+ function isArchiveDeviceQueryOptions({ clientApi, }) {
29
+ return (0, react_query_1.queryOptions)({
30
+ ...(0, shared_js_1.baseQueryOptions)(),
31
+ queryKey: getIsArchiveDeviceQueryKey(),
32
+ queryFn: async () => {
33
+ return clientApi.getIsArchiveDevice();
34
+ },
35
+ });
36
+ }