@comapeo/core-react 1.0.1 → 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 +27 -12
  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
@@ -1,5 +1,5 @@
1
- import type { BitmapOpts, SvgOpts } from '@comapeo/core/dist/icon-api';
2
- import type { BlobId } from '@comapeo/core/dist/types';
1
+ import type { BitmapOpts, SvgOpts } from '@comapeo/core/dist/icon-api.js' with { 'resolution-mode': 'import' };
2
+ import type { BlobId } from '@comapeo/core/dist/types.js' with { 'resolution-mode': 'import' };
3
3
  /**
4
4
  * Retrieve the project settings for a project.
5
5
  *
@@ -17,7 +17,7 @@ import type { BlobId } from '@comapeo/core/dist/types';
17
17
  export declare function useProjectSettings({ projectId }: {
18
18
  projectId: string;
19
19
  }): {
20
- data: import("@comapeo/core/dist/mapeo-project").EditableProjectSettings;
20
+ data: import("@comapeo/core/dist/mapeo-project.js").EditableProjectSettings;
21
21
  error: Error | null;
22
22
  isRefetching: boolean;
23
23
  };
@@ -38,7 +38,7 @@ export declare function useProjectSettings({ projectId }: {
38
38
  export declare function useSingleProject({ projectId }: {
39
39
  projectId: string;
40
40
  }): {
41
- data: import("rpc-reflector/lib/types").ClientApi<import("@comapeo/core/dist/mapeo-project").MapeoProject>;
41
+ data: import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js").MapeoProject>;
42
42
  error: Error | null;
43
43
  isRefetching: boolean;
44
44
  };
@@ -98,7 +98,7 @@ export declare function useSingleMember({ projectId, deviceId, }: {
98
98
  projectId: string;
99
99
  deviceId: string;
100
100
  }): {
101
- data: import("@comapeo/core/dist/member-api").MemberInfo;
101
+ data: import("@comapeo/core/dist/member-api.js").MemberInfo;
102
102
  error: Error | null;
103
103
  isRefetching: boolean;
104
104
  };
@@ -119,7 +119,7 @@ export declare function useSingleMember({ projectId, deviceId, }: {
119
119
  export declare function useManyMembers({ projectId }: {
120
120
  projectId: string;
121
121
  }): {
122
- data: import("@comapeo/core/dist/member-api").MemberInfo[];
122
+ data: import("@comapeo/core/dist/member-api.js").MemberInfo[];
123
123
  error: Error | null;
124
124
  isRefetching: boolean;
125
125
  };
@@ -1,6 +1,6 @@
1
1
  import { useSuspenseQuery } from '@tanstack/react-query';
2
- import { attachmentUrlQueryOptions, documentCreatedByQueryOptions, iconUrlQueryOptions, projectByIdQueryOptions, projectMemberByIdQueryOptions, projectMembersQueryOptions, projectSettingsQueryOptions, projectsQueryOptions, } from '../lib/react-query/projects';
3
- import { useClientApi } from './client';
2
+ import { attachmentUrlQueryOptions, documentCreatedByQueryOptions, iconUrlQueryOptions, projectByIdQueryOptions, projectMemberByIdQueryOptions, projectMembersQueryOptions, projectSettingsQueryOptions, projectsQueryOptions, } from '../lib/react-query/projects.js';
3
+ import { useClientApi } from './client.js';
4
4
  /**
5
5
  * Retrieve the project settings for a project.
6
6
  *
@@ -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,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, } 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,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").DeviceInfoParam>, Error, {
11
+ deviceId: string;
12
+ deviceType: "device_type_unspecified" | "mobile" | "tablet" | "desktop" | "selfHostedServer" | "UNRECOGNIZED";
13
+ } & Partial<import("@comapeo/core/dist/schema/client.js").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").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").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
+ };
@@ -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 getClientQueryKey() {
4
4
  return [ROOT_QUERY_KEY, 'client'];
5
5
  }