@comapeo/core-react 5.0.0 → 6.0.0-prerelease.2

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.
@@ -1,8 +1,6 @@
1
1
  import type { MapeoClientApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
2
- import { type JSX, type ReactNode } from 'react';
3
- export declare const ClientApiContext: import("react").Context<import("rpc-reflector/lib/types").ClientApi<Omit<import("@comapeo/core", { with: { "resolution-mode": "import" } }).MapeoManager, "getProject"> & {
4
- getProject: (projectPublicId: string) => Promise<import("@comapeo/ipc/dist/client.js", { with: { "resolution-mode": "import" } }).MapeoProjectApi>;
5
- }> | null>;
2
+ import { type Context, type JSX, type ReactNode } from 'react';
3
+ export declare const ClientApiContext: Context<MapeoClientApi | null>;
6
4
  /**
7
5
  * Create a context provider that holds a CoMapeo API client instance.
8
6
  *
@@ -1,3 +1,4 @@
1
+ import type { MapeoClientApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
1
2
  /**
2
3
  * Access a client API instance. If a ClientApiContext provider is not
3
4
  * set up, it will throw an error.
@@ -23,9 +24,7 @@
23
24
  * ```
24
25
  *
25
26
  */
26
- export declare function useClientApi(): import("rpc-reflector/lib/types.js").ClientApi<Omit<import("@comapeo/core", { with: { "resolution-mode": "import" } }).MapeoManager, "getProject"> & {
27
- getProject: (projectPublicId: string) => Promise<import("@comapeo/ipc/dist/client.js", { with: { "resolution-mode": "import" } }).MapeoProjectApi>;
28
- }>;
27
+ export declare function useClientApi(): MapeoClientApi;
29
28
  /**
30
29
  * Retrieve info about the current device.
31
30
  *
@@ -108,13 +108,13 @@ export declare function useSendInvite({ projectId }: {
108
108
  mutate: import("@tanstack/react-query").UseMutateFunction<"ACCEPT" | "REJECT" | "ALREADY", Error, {
109
109
  deviceId: string;
110
110
  roleDescription?: string;
111
- roleId: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).RoleIdForNewInvite;
111
+ roleId: import("@comapeo/core", { with: { "resolution-mode": "import" } }).MemberApi.RoleIdForNewInvite;
112
112
  roleName?: string;
113
113
  }, unknown>;
114
114
  mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<"ACCEPT" | "REJECT" | "ALREADY", Error, {
115
115
  deviceId: string;
116
116
  roleDescription?: string;
117
- roleId: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).RoleIdForNewInvite;
117
+ roleId: import("@comapeo/core", { with: { "resolution-mode": "import" } }).MemberApi.RoleIdForNewInvite;
118
118
  roleName?: string;
119
119
  }, unknown>;
120
120
  reset: () => void;
@@ -124,13 +124,13 @@ export declare function useSendInvite({ projectId }: {
124
124
  mutate: import("@tanstack/react-query").UseMutateFunction<"ACCEPT" | "REJECT" | "ALREADY", Error, {
125
125
  deviceId: string;
126
126
  roleDescription?: string;
127
- roleId: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).RoleIdForNewInvite;
127
+ roleId: import("@comapeo/core", { with: { "resolution-mode": "import" } }).MemberApi.RoleIdForNewInvite;
128
128
  roleName?: string;
129
129
  }, unknown>;
130
130
  mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<"ACCEPT" | "REJECT" | "ALREADY", Error, {
131
131
  deviceId: string;
132
132
  roleDescription?: string;
133
- roleId: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).RoleIdForNewInvite;
133
+ roleId: import("@comapeo/core", { with: { "resolution-mode": "import" } }).MemberApi.RoleIdForNewInvite;
134
134
  roleName?: string;
135
135
  }, unknown>;
136
136
  reset: () => void;
@@ -1,5 +1,5 @@
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' };
1
+ import type { BlobApi, IconApi } from '@comapeo/core' with { 'resolution-mode': 'import' };
2
+ import type { MapeoProjectApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
3
3
  import { type SyncState } from '../lib/sync.js';
4
4
  /**
5
5
  * Retrieve the project settings for a project.
@@ -39,7 +39,7 @@ export declare function useProjectSettings({ projectId }: {
39
39
  export declare function useSingleProject({ projectId }: {
40
40
  projectId: string;
41
41
  }): {
42
- data: import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).MapeoProject>;
42
+ data: MapeoProjectApi;
43
43
  error: Error | null;
44
44
  isRefetching: boolean;
45
45
  };
@@ -142,7 +142,7 @@ export declare function useManyMembers({ projectId }: {
142
142
  export declare function useIconUrl({ projectId, iconId, ...mimeBasedOpts }: {
143
143
  projectId: string;
144
144
  iconId: string;
145
- } & (BitmapOpts | SvgOpts)): {
145
+ } & (IconApi.BitmapOpts | IconApi.SvgOpts)): {
146
146
  data: string;
147
147
  error: Error | null;
148
148
  isRefetching: boolean;
@@ -200,7 +200,7 @@ export declare function useIconUrl({ projectId, iconId, ...mimeBasedOpts }: {
200
200
  */
201
201
  export declare function useAttachmentUrl({ projectId, blobId, }: {
202
202
  projectId: string;
203
- blobId: BlobId;
203
+ blobId: BlobApi.BlobId;
204
204
  }): {
205
205
  data: string;
206
206
  error: Error | null;
@@ -248,7 +248,7 @@ export declare function useDocumentCreatedBy({ projectId, originalVersionId, }:
248
248
  export declare function useOwnRoleInProject({ projectId }: {
249
249
  projectId: string;
250
250
  }): {
251
- data: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "a24eaca65ab5d5d0" | "08e4251e36f6e7ed">;
251
+ data: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">;
252
252
  error: Error | null;
253
253
  isRefetching: boolean;
254
254
  };
@@ -448,7 +448,7 @@ export declare function useCreateBlob({ projectId }: {
448
448
  original: string;
449
449
  preview?: string;
450
450
  thumbnail?: string;
451
- metadata: import("@comapeo/core/dist/blob-api.js", { with: { "resolution-mode": "import" } }).Metadata;
451
+ metadata: BlobApi.Metadata;
452
452
  }, unknown>;
453
453
  mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
454
454
  driveId: string;
@@ -459,7 +459,7 @@ export declare function useCreateBlob({ projectId }: {
459
459
  original: string;
460
460
  preview?: string;
461
461
  thumbnail?: string;
462
- metadata: import("@comapeo/core/dist/blob-api.js", { with: { "resolution-mode": "import" } }).Metadata;
462
+ metadata: BlobApi.Metadata;
463
463
  }, unknown>;
464
464
  reset: () => void;
465
465
  status: "error";
@@ -474,7 +474,7 @@ export declare function useCreateBlob({ projectId }: {
474
474
  original: string;
475
475
  preview?: string;
476
476
  thumbnail?: string;
477
- metadata: import("@comapeo/core/dist/blob-api.js", { with: { "resolution-mode": "import" } }).Metadata;
477
+ metadata: BlobApi.Metadata;
478
478
  }, unknown>;
479
479
  mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
480
480
  driveId: string;
@@ -485,7 +485,7 @@ export declare function useCreateBlob({ projectId }: {
485
485
  original: string;
486
486
  preview?: string;
487
487
  thumbnail?: string;
488
- metadata: import("@comapeo/core/dist/blob-api.js", { with: { "resolution-mode": "import" } }).Metadata;
488
+ metadata: BlobApi.Metadata;
489
489
  }, unknown>;
490
490
  reset: () => void;
491
491
  status: "pending" | "success" | "idle";
@@ -1,4 +1,4 @@
1
- import type { RoleIdForNewInvite } from '@comapeo/core/dist/roles.js' with { 'resolution-mode': 'import' };
1
+ import type { MemberApi } from '@comapeo/core' with { 'resolution-mode': 'import' };
2
2
  import type { MapeoClientApi, MapeoProjectApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
3
3
  import { type QueryClient } from '@tanstack/react-query';
4
4
  export declare function getInvitesQueryKey(): readonly ["@comapeo/core-react", "invites"];
@@ -64,7 +64,7 @@ export declare function sendInviteMutationOptions({ projectApi, projectId, query
64
64
  mutationFn: ({ deviceId, ...role }: {
65
65
  deviceId: string;
66
66
  roleDescription?: string;
67
- roleId: RoleIdForNewInvite;
67
+ roleId: MemberApi.RoleIdForNewInvite;
68
68
  roleName?: string;
69
69
  }) => Promise<"ACCEPT" | "REJECT" | "ALREADY">;
70
70
  onSuccess: () => void;
@@ -1,10 +1,7 @@
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' };
1
+ import type { BlobApi, IconApi } from '@comapeo/core' with { 'resolution-mode': 'import' };
5
2
  import type { MapeoClientApi, MapeoProjectApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
6
3
  import type { ProjectSettings } from '@comapeo/schema' with { 'resolution-mode': 'import' };
7
- import { type QueryClient } from '@tanstack/react-query';
4
+ import { type QueryClient, type UseSuspenseQueryOptions } from '@tanstack/react-query';
8
5
  export declare function getProjectsQueryKey(): readonly ["@comapeo/core-react", "projects"];
9
6
  export declare function getProjectByIdQueryKey({ projectId }: {
10
7
  projectId: string;
@@ -25,7 +22,7 @@ export declare function getMemberByIdQueryKey({ projectId, deviceId, }: {
25
22
  export declare function getIconUrlQueryKey({ projectId, iconId, ...mimeBasedOpts }: {
26
23
  projectId: string;
27
24
  iconId: string;
28
- } & (BitmapOpts | SvgOpts)): readonly ["@comapeo/core-react", "projects", string, "icons", string, {
25
+ } & (IconApi.BitmapOpts | IconApi.SvgOpts)): readonly ["@comapeo/core-react", "projects", string, "icons", string, {
29
26
  mimeType: Extract<import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).IconVariant["mimeType"], "image/png">;
30
27
  pixelDensity: Extract<import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).IconVariant, {
31
28
  mimeType: "image/png";
@@ -41,8 +38,8 @@ export declare function getDocumentCreatedByQueryKey({ projectId, originalVersio
41
38
  }): readonly ["@comapeo/core-react", "projects", string, "document_created_by", string];
42
39
  export declare function getAttachmentUrlQueryKey({ projectId, blobId, }: {
43
40
  projectId: string;
44
- blobId: BlobId;
45
- }): readonly ["@comapeo/core-react", "projects", string, "attachments", BlobId];
41
+ blobId: BlobApi.BlobId;
42
+ }): readonly ["@comapeo/core-react", "projects", string, "attachments", import("@comapeo/core/dist/types.js", { with: { "resolution-mode": "import" } }).BlobId];
46
43
  export declare function projectsQueryOptions({ clientApi, }: {
47
44
  clientApi: MapeoClientApi;
48
45
  }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/mapeo-manager.js", { with: { "resolution-mode": "import" } }).ListedProject[], Error, import("@comapeo/core/dist/mapeo-manager.js", { with: { "resolution-mode": "import" } }).ListedProject[], readonly ["@comapeo/core-react", "projects"]>, "queryFn"> & {
@@ -56,22 +53,15 @@ export declare function projectsQueryOptions({ clientApi, }: {
56
53
  export declare function projectByIdQueryOptions({ clientApi, projectId, }: {
57
54
  clientApi: MapeoClientApi;
58
55
  projectId: string;
59
- }): 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"> & {
60
- 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;
61
- } & {
62
- queryKey: readonly ["@comapeo/core-react", "projects", string] & {
63
- [dataTagSymbol]: import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).MapeoProject>;
64
- [dataTagErrorSymbol]: Error;
65
- };
66
- };
56
+ }): UseSuspenseQueryOptions<MapeoProjectApi, Error, MapeoProjectApi, ReturnType<typeof getProjectByIdQueryKey>>;
67
57
  export declare function projectSettingsQueryOptions({ projectApi, projectId, }: {
68
58
  projectApi: MapeoProjectApi;
69
59
  projectId: string;
70
- }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<EditableProjectSettings, Error, EditableProjectSettings, readonly ["@comapeo/core-react", "projects", string, "project_settings"]>, "queryFn"> & {
71
- queryFn?: import("@tanstack/react-query").QueryFunction<EditableProjectSettings, readonly ["@comapeo/core-react", "projects", string, "project_settings"], never> | undefined;
60
+ }): 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, readonly ["@comapeo/core-react", "projects", string, "project_settings"]>, "queryFn"> & {
61
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).EditableProjectSettings, readonly ["@comapeo/core-react", "projects", string, "project_settings"], never> | undefined;
72
62
  } & {
73
63
  queryKey: readonly ["@comapeo/core-react", "projects", string, "project_settings"] & {
74
- [dataTagSymbol]: EditableProjectSettings;
64
+ [dataTagSymbol]: import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).EditableProjectSettings;
75
65
  [dataTagErrorSymbol]: Error;
76
66
  };
77
67
  };
@@ -101,11 +91,11 @@ export declare function projectMemberByIdQueryOptions({ projectApi, projectId, d
101
91
  export declare function projectOwnRoleQueryOptions({ projectApi, projectId, }: {
102
92
  projectApi: MapeoProjectApi;
103
93
  projectId: string;
104
- }): 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" | "a24eaca65ab5d5d0" | "08e4251e36f6e7ed">, Error, import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "a24eaca65ab5d5d0" | "08e4251e36f6e7ed">, readonly ["@comapeo/core-react", "projects", string, "role"]>, "queryFn"> & {
105
- queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "a24eaca65ab5d5d0" | "08e4251e36f6e7ed">, readonly ["@comapeo/core-react", "projects", string, "role"], never> | undefined;
94
+ }): 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"> & {
95
+ 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;
106
96
  } & {
107
97
  queryKey: readonly ["@comapeo/core-react", "projects", string, "role"] & {
108
- [dataTagSymbol]: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "a24eaca65ab5d5d0" | "08e4251e36f6e7ed">;
98
+ [dataTagSymbol]: import("@comapeo/core/dist/roles.js", { with: { "resolution-mode": "import" } }).Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">;
109
99
  [dataTagErrorSymbol]: Error;
110
100
  };
111
101
  };
@@ -113,7 +103,7 @@ export declare function iconUrlQueryOptions({ projectApi, projectId, iconId, ...
113
103
  projectApi: MapeoProjectApi;
114
104
  projectId: string;
115
105
  iconId: Parameters<MapeoProjectApi['$icons']['getIconUrl']>[0];
116
- } & (BitmapOpts | SvgOpts)): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, readonly ["@comapeo/core-react", "projects", string, "icons", string, {
106
+ } & (IconApi.BitmapOpts | IconApi.SvgOpts)): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, readonly ["@comapeo/core-react", "projects", string, "icons", string, {
117
107
  mimeType: Extract<import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).IconVariant["mimeType"], "image/png">;
118
108
  pixelDensity: Extract<import("@comapeo/core/dist/icon-api.js", { with: { "resolution-mode": "import" } }).IconVariant, {
119
109
  mimeType: "image/png";
@@ -163,11 +153,11 @@ export declare function documentCreatedByQueryOptions({ projectApi, projectId, o
163
153
  export declare function attachmentUrlQueryOptions({ projectApi, projectId, blobId, }: {
164
154
  projectApi: MapeoProjectApi;
165
155
  projectId: string;
166
- blobId: BlobId;
167
- }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, readonly ["@comapeo/core-react", "projects", string, "attachments", BlobId]>, "queryFn"> & {
168
- queryFn?: import("@tanstack/react-query").QueryFunction<string, readonly ["@comapeo/core-react", "projects", string, "attachments", BlobId], never> | undefined;
156
+ blobId: BlobApi.BlobId;
157
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, readonly ["@comapeo/core-react", "projects", string, "attachments", import("@comapeo/core/dist/types.js", { with: { "resolution-mode": "import" } }).BlobId]>, "queryFn"> & {
158
+ queryFn?: import("@tanstack/react-query").QueryFunction<string, readonly ["@comapeo/core-react", "projects", string, "attachments", import("@comapeo/core/dist/types.js", { with: { "resolution-mode": "import" } }).BlobId], never> | undefined;
169
159
  } & {
170
- queryKey: readonly ["@comapeo/core-react", "projects", string, "attachments", BlobId] & {
160
+ queryKey: readonly ["@comapeo/core-react", "projects", string, "attachments", import("@comapeo/core/dist/types.js", { with: { "resolution-mode": "import" } }).BlobId] & {
171
161
  [dataTagSymbol]: string;
172
162
  [dataTagErrorSymbol]: Error;
173
163
  };
@@ -243,7 +233,7 @@ export declare function updateProjectSettingsMutationOptions({ projectApi, query
243
233
  defaultPresets?: ProjectSettings["defaultPresets"];
244
234
  projectColor?: ProjectSettings["projectColor"];
245
235
  projectDescription?: ProjectSettings["projectDescription"];
246
- }) => Promise<EditableProjectSettings>;
236
+ }) => Promise<import("@comapeo/core/dist/mapeo-project.js", { with: { "resolution-mode": "import" } }).EditableProjectSettings>;
247
237
  onSuccess: () => void;
248
238
  networkMode: "always";
249
239
  retry: false;
@@ -255,7 +245,7 @@ export declare function createBlobMutationOptions({ projectApi, }: {
255
245
  original: string;
256
246
  preview?: string;
257
247
  thumbnail?: string;
258
- metadata: Metadata;
248
+ metadata: BlobApi.Metadata;
259
249
  }) => Promise<{
260
250
  driveId: string;
261
251
  name: string;
@@ -1,8 +1,6 @@
1
1
  import type { MapeoClientApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
2
- import { type JSX, type ReactNode } from 'react';
3
- export declare const ClientApiContext: import("react").Context<import("rpc-reflector/lib/types.js").ClientApi<Omit<import("@comapeo/core").MapeoManager, "getProject"> & {
4
- getProject: (projectPublicId: string) => Promise<import("@comapeo/ipc/dist/client.js").MapeoProjectApi>;
5
- }> | null>;
2
+ import { type Context, type JSX, type ReactNode } from 'react';
3
+ export declare const ClientApiContext: Context<MapeoClientApi | null>;
6
4
  /**
7
5
  * Create a context provider that holds a CoMapeo API client instance.
8
6
  *
@@ -1,4 +1,4 @@
1
- import { createContext, createElement } from 'react';
1
+ import { createContext, createElement, } from 'react';
2
2
  export const ClientApiContext = createContext(null);
3
3
  /**
4
4
  * Create a context provider that holds a CoMapeo API client instance.
@@ -1,3 +1,4 @@
1
+ import type { MapeoClientApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
1
2
  /**
2
3
  * Access a client API instance. If a ClientApiContext provider is not
3
4
  * set up, it will throw an error.
@@ -23,9 +24,7 @@
23
24
  * ```
24
25
  *
25
26
  */
26
- export declare function useClientApi(): import("rpc-reflector/lib/types.js").ClientApi<Omit<import("@comapeo/core").MapeoManager, "getProject"> & {
27
- getProject: (projectPublicId: string) => Promise<import("@comapeo/ipc/dist/client.js").MapeoProjectApi>;
28
- }>;
27
+ export declare function useClientApi(): MapeoClientApi;
29
28
  /**
30
29
  * Retrieve info about the current device.
31
30
  *
@@ -108,13 +108,13 @@ export declare function useSendInvite({ projectId }: {
108
108
  mutate: import("@tanstack/react-query").UseMutateFunction<"ACCEPT" | "REJECT" | "ALREADY", Error, {
109
109
  deviceId: string;
110
110
  roleDescription?: string;
111
- roleId: import("@comapeo/core/dist/roles.js").RoleIdForNewInvite;
111
+ roleId: import("@comapeo/core").MemberApi.RoleIdForNewInvite;
112
112
  roleName?: string;
113
113
  }, unknown>;
114
114
  mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<"ACCEPT" | "REJECT" | "ALREADY", Error, {
115
115
  deviceId: string;
116
116
  roleDescription?: string;
117
- roleId: import("@comapeo/core/dist/roles.js").RoleIdForNewInvite;
117
+ roleId: import("@comapeo/core").MemberApi.RoleIdForNewInvite;
118
118
  roleName?: string;
119
119
  }, unknown>;
120
120
  reset: () => void;
@@ -124,13 +124,13 @@ export declare function useSendInvite({ projectId }: {
124
124
  mutate: import("@tanstack/react-query").UseMutateFunction<"ACCEPT" | "REJECT" | "ALREADY", Error, {
125
125
  deviceId: string;
126
126
  roleDescription?: string;
127
- roleId: import("@comapeo/core/dist/roles.js").RoleIdForNewInvite;
127
+ roleId: import("@comapeo/core").MemberApi.RoleIdForNewInvite;
128
128
  roleName?: string;
129
129
  }, unknown>;
130
130
  mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<"ACCEPT" | "REJECT" | "ALREADY", Error, {
131
131
  deviceId: string;
132
132
  roleDescription?: string;
133
- roleId: import("@comapeo/core/dist/roles.js").RoleIdForNewInvite;
133
+ roleId: import("@comapeo/core").MemberApi.RoleIdForNewInvite;
134
134
  roleName?: string;
135
135
  }, unknown>;
136
136
  reset: () => void;
@@ -1,5 +1,5 @@
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' };
1
+ import type { BlobApi, IconApi } from '@comapeo/core' with { 'resolution-mode': 'import' };
2
+ import type { MapeoProjectApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
3
3
  import { type SyncState } from '../lib/sync.js';
4
4
  /**
5
5
  * Retrieve the project settings for a project.
@@ -39,7 +39,7 @@ export declare function useProjectSettings({ projectId }: {
39
39
  export declare function useSingleProject({ projectId }: {
40
40
  projectId: string;
41
41
  }): {
42
- data: import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js").MapeoProject>;
42
+ data: MapeoProjectApi;
43
43
  error: Error | null;
44
44
  isRefetching: boolean;
45
45
  };
@@ -142,7 +142,7 @@ export declare function useManyMembers({ projectId }: {
142
142
  export declare function useIconUrl({ projectId, iconId, ...mimeBasedOpts }: {
143
143
  projectId: string;
144
144
  iconId: string;
145
- } & (BitmapOpts | SvgOpts)): {
145
+ } & (IconApi.BitmapOpts | IconApi.SvgOpts)): {
146
146
  data: string;
147
147
  error: Error | null;
148
148
  isRefetching: boolean;
@@ -200,7 +200,7 @@ export declare function useIconUrl({ projectId, iconId, ...mimeBasedOpts }: {
200
200
  */
201
201
  export declare function useAttachmentUrl({ projectId, blobId, }: {
202
202
  projectId: string;
203
- blobId: BlobId;
203
+ blobId: BlobApi.BlobId;
204
204
  }): {
205
205
  data: string;
206
206
  error: Error | null;
@@ -248,7 +248,7 @@ export declare function useDocumentCreatedBy({ projectId, originalVersionId, }:
248
248
  export declare function useOwnRoleInProject({ projectId }: {
249
249
  projectId: string;
250
250
  }): {
251
- data: import("@comapeo/core/dist/roles.js").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "a24eaca65ab5d5d0" | "08e4251e36f6e7ed">;
251
+ data: import("@comapeo/core/dist/roles.js").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">;
252
252
  error: Error | null;
253
253
  isRefetching: boolean;
254
254
  };
@@ -448,7 +448,7 @@ export declare function useCreateBlob({ projectId }: {
448
448
  original: string;
449
449
  preview?: string;
450
450
  thumbnail?: string;
451
- metadata: import("@comapeo/core/dist/blob-api.js").Metadata;
451
+ metadata: BlobApi.Metadata;
452
452
  }, unknown>;
453
453
  mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
454
454
  driveId: string;
@@ -459,7 +459,7 @@ export declare function useCreateBlob({ projectId }: {
459
459
  original: string;
460
460
  preview?: string;
461
461
  thumbnail?: string;
462
- metadata: import("@comapeo/core/dist/blob-api.js").Metadata;
462
+ metadata: BlobApi.Metadata;
463
463
  }, unknown>;
464
464
  reset: () => void;
465
465
  status: "error";
@@ -474,7 +474,7 @@ export declare function useCreateBlob({ projectId }: {
474
474
  original: string;
475
475
  preview?: string;
476
476
  thumbnail?: string;
477
- metadata: import("@comapeo/core/dist/blob-api.js").Metadata;
477
+ metadata: BlobApi.Metadata;
478
478
  }, unknown>;
479
479
  mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<{
480
480
  driveId: string;
@@ -485,7 +485,7 @@ export declare function useCreateBlob({ projectId }: {
485
485
  original: string;
486
486
  preview?: string;
487
487
  thumbnail?: string;
488
- metadata: import("@comapeo/core/dist/blob-api.js").Metadata;
488
+ metadata: BlobApi.Metadata;
489
489
  }, unknown>;
490
490
  reset: () => void;
491
491
  status: "pending" | "success" | "idle";
@@ -1,4 +1,4 @@
1
- import type { RoleIdForNewInvite } from '@comapeo/core/dist/roles.js' with { 'resolution-mode': 'import' };
1
+ import type { MemberApi } from '@comapeo/core' with { 'resolution-mode': 'import' };
2
2
  import type { MapeoClientApi, MapeoProjectApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
3
3
  import { type QueryClient } from '@tanstack/react-query';
4
4
  export declare function getInvitesQueryKey(): readonly ["@comapeo/core-react", "invites"];
@@ -64,7 +64,7 @@ export declare function sendInviteMutationOptions({ projectApi, projectId, query
64
64
  mutationFn: ({ deviceId, ...role }: {
65
65
  deviceId: string;
66
66
  roleDescription?: string;
67
- roleId: RoleIdForNewInvite;
67
+ roleId: MemberApi.RoleIdForNewInvite;
68
68
  roleName?: string;
69
69
  }) => Promise<"ACCEPT" | "REJECT" | "ALREADY">;
70
70
  onSuccess: () => void;
@@ -1,10 +1,7 @@
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' };
1
+ import type { BlobApi, IconApi } from '@comapeo/core' with { 'resolution-mode': 'import' };
5
2
  import type { MapeoClientApi, MapeoProjectApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
6
3
  import type { ProjectSettings } from '@comapeo/schema' with { 'resolution-mode': 'import' };
7
- import { type QueryClient } from '@tanstack/react-query';
4
+ import { type QueryClient, type UseSuspenseQueryOptions } from '@tanstack/react-query';
8
5
  export declare function getProjectsQueryKey(): readonly ["@comapeo/core-react", "projects"];
9
6
  export declare function getProjectByIdQueryKey({ projectId }: {
10
7
  projectId: string;
@@ -25,7 +22,7 @@ export declare function getMemberByIdQueryKey({ projectId, deviceId, }: {
25
22
  export declare function getIconUrlQueryKey({ projectId, iconId, ...mimeBasedOpts }: {
26
23
  projectId: string;
27
24
  iconId: string;
28
- } & (BitmapOpts | SvgOpts)): readonly ["@comapeo/core-react", "projects", string, "icons", string, {
25
+ } & (IconApi.BitmapOpts | IconApi.SvgOpts)): readonly ["@comapeo/core-react", "projects", string, "icons", string, {
29
26
  mimeType: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant["mimeType"], "image/png">;
30
27
  pixelDensity: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant, {
31
28
  mimeType: "image/png";
@@ -41,8 +38,8 @@ export declare function getDocumentCreatedByQueryKey({ projectId, originalVersio
41
38
  }): readonly ["@comapeo/core-react", "projects", string, "document_created_by", string];
42
39
  export declare function getAttachmentUrlQueryKey({ projectId, blobId, }: {
43
40
  projectId: string;
44
- blobId: BlobId;
45
- }): readonly ["@comapeo/core-react", "projects", string, "attachments", BlobId];
41
+ blobId: BlobApi.BlobId;
42
+ }): readonly ["@comapeo/core-react", "projects", string, "attachments", import("@comapeo/core/dist/types.js").BlobId];
46
43
  export declare function projectsQueryOptions({ clientApi, }: {
47
44
  clientApi: MapeoClientApi;
48
45
  }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/mapeo-manager.js").ListedProject[], Error, import("@comapeo/core/dist/mapeo-manager.js").ListedProject[], readonly ["@comapeo/core-react", "projects"]>, "queryFn"> & {
@@ -56,22 +53,15 @@ export declare function projectsQueryOptions({ clientApi, }: {
56
53
  export declare function projectByIdQueryOptions({ clientApi, projectId, }: {
57
54
  clientApi: MapeoClientApi;
58
55
  projectId: string;
59
- }): 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"> & {
60
- 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;
61
- } & {
62
- queryKey: readonly ["@comapeo/core-react", "projects", string] & {
63
- [dataTagSymbol]: import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js").MapeoProject>;
64
- [dataTagErrorSymbol]: Error;
65
- };
66
- };
56
+ }): UseSuspenseQueryOptions<MapeoProjectApi, Error, MapeoProjectApi, ReturnType<typeof getProjectByIdQueryKey>>;
67
57
  export declare function projectSettingsQueryOptions({ projectApi, projectId, }: {
68
58
  projectApi: MapeoProjectApi;
69
59
  projectId: string;
70
- }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<EditableProjectSettings, Error, EditableProjectSettings, readonly ["@comapeo/core-react", "projects", string, "project_settings"]>, "queryFn"> & {
71
- queryFn?: import("@tanstack/react-query").QueryFunction<EditableProjectSettings, readonly ["@comapeo/core-react", "projects", string, "project_settings"], never> | undefined;
60
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/mapeo-project.js").EditableProjectSettings, Error, import("@comapeo/core/dist/mapeo-project.js").EditableProjectSettings, readonly ["@comapeo/core-react", "projects", string, "project_settings"]>, "queryFn"> & {
61
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/mapeo-project.js").EditableProjectSettings, readonly ["@comapeo/core-react", "projects", string, "project_settings"], never> | undefined;
72
62
  } & {
73
63
  queryKey: readonly ["@comapeo/core-react", "projects", string, "project_settings"] & {
74
- [dataTagSymbol]: EditableProjectSettings;
64
+ [dataTagSymbol]: import("@comapeo/core/dist/mapeo-project.js").EditableProjectSettings;
75
65
  [dataTagErrorSymbol]: Error;
76
66
  };
77
67
  };
@@ -101,11 +91,11 @@ export declare function projectMemberByIdQueryOptions({ projectApi, projectId, d
101
91
  export declare function projectOwnRoleQueryOptions({ projectApi, projectId, }: {
102
92
  projectApi: MapeoProjectApi;
103
93
  projectId: string;
104
- }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/roles.js").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "a24eaca65ab5d5d0" | "08e4251e36f6e7ed">, Error, import("@comapeo/core/dist/roles.js").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "a24eaca65ab5d5d0" | "08e4251e36f6e7ed">, readonly ["@comapeo/core-react", "projects", string, "role"]>, "queryFn"> & {
105
- queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/roles.js").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "a24eaca65ab5d5d0" | "08e4251e36f6e7ed">, readonly ["@comapeo/core-react", "projects", string, "role"], never> | undefined;
94
+ }): 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"> & {
95
+ 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;
106
96
  } & {
107
97
  queryKey: readonly ["@comapeo/core-react", "projects", string, "role"] & {
108
- [dataTagSymbol]: import("@comapeo/core/dist/roles.js").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "a24eaca65ab5d5d0" | "08e4251e36f6e7ed">;
98
+ [dataTagSymbol]: import("@comapeo/core/dist/roles.js").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">;
109
99
  [dataTagErrorSymbol]: Error;
110
100
  };
111
101
  };
@@ -113,7 +103,7 @@ export declare function iconUrlQueryOptions({ projectApi, projectId, iconId, ...
113
103
  projectApi: MapeoProjectApi;
114
104
  projectId: string;
115
105
  iconId: Parameters<MapeoProjectApi['$icons']['getIconUrl']>[0];
116
- } & (BitmapOpts | SvgOpts)): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, readonly ["@comapeo/core-react", "projects", string, "icons", string, {
106
+ } & (IconApi.BitmapOpts | IconApi.SvgOpts)): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, readonly ["@comapeo/core-react", "projects", string, "icons", string, {
117
107
  mimeType: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant["mimeType"], "image/png">;
118
108
  pixelDensity: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant, {
119
109
  mimeType: "image/png";
@@ -163,11 +153,11 @@ export declare function documentCreatedByQueryOptions({ projectApi, projectId, o
163
153
  export declare function attachmentUrlQueryOptions({ projectApi, projectId, blobId, }: {
164
154
  projectApi: MapeoProjectApi;
165
155
  projectId: string;
166
- blobId: BlobId;
167
- }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, readonly ["@comapeo/core-react", "projects", string, "attachments", BlobId]>, "queryFn"> & {
168
- queryFn?: import("@tanstack/react-query").QueryFunction<string, readonly ["@comapeo/core-react", "projects", string, "attachments", BlobId], never> | undefined;
156
+ blobId: BlobApi.BlobId;
157
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, readonly ["@comapeo/core-react", "projects", string, "attachments", import("@comapeo/core/dist/types.js").BlobId]>, "queryFn"> & {
158
+ queryFn?: import("@tanstack/react-query").QueryFunction<string, readonly ["@comapeo/core-react", "projects", string, "attachments", import("@comapeo/core/dist/types.js").BlobId], never> | undefined;
169
159
  } & {
170
- queryKey: readonly ["@comapeo/core-react", "projects", string, "attachments", BlobId] & {
160
+ queryKey: readonly ["@comapeo/core-react", "projects", string, "attachments", import("@comapeo/core/dist/types.js").BlobId] & {
171
161
  [dataTagSymbol]: string;
172
162
  [dataTagErrorSymbol]: Error;
173
163
  };
@@ -243,7 +233,7 @@ export declare function updateProjectSettingsMutationOptions({ projectApi, query
243
233
  defaultPresets?: ProjectSettings["defaultPresets"];
244
234
  projectColor?: ProjectSettings["projectColor"];
245
235
  projectDescription?: ProjectSettings["projectDescription"];
246
- }) => Promise<EditableProjectSettings>;
236
+ }) => Promise<import("@comapeo/core/dist/mapeo-project.js").EditableProjectSettings>;
247
237
  onSuccess: () => void;
248
238
  networkMode: "always";
249
239
  retry: false;
@@ -255,7 +245,7 @@ export declare function createBlobMutationOptions({ projectApi, }: {
255
245
  original: string;
256
246
  preview?: string;
257
247
  thumbnail?: string;
258
- metadata: Metadata;
248
+ metadata: BlobApi.Metadata;
259
249
  }) => Promise<{
260
250
  driveId: string;
261
251
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comapeo/core-react",
3
- "version": "5.0.0",
3
+ "version": "6.0.0-prerelease.2",
4
4
  "description": "React wrapper for working with @comapeo/core",
5
5
  "repository": {
6
6
  "type": "git",
@@ -57,15 +57,15 @@
57
57
  "types": "tsc"
58
58
  },
59
59
  "peerDependencies": {
60
- "@comapeo/core": "^4.0.0",
61
- "@comapeo/ipc": "^4.0.0",
60
+ "@comapeo/core": "4.1.3-prerelease.0",
61
+ "@comapeo/ipc": "5.0.0-prerelease.3",
62
62
  "@comapeo/schema": "*",
63
63
  "@tanstack/react-query": "^5",
64
64
  "react": "^18 || ^19"
65
65
  },
66
66
  "devDependencies": {
67
- "@comapeo/core": "4.0.0",
68
- "@comapeo/ipc": "4.0.0",
67
+ "@comapeo/core": "4.1.3-prerelease.0",
68
+ "@comapeo/ipc": "5.0.0-prerelease.3",
69
69
  "@comapeo/schema": "2.0.0",
70
70
  "@eslint/compat": "1.3.0",
71
71
  "@eslint/js": "9.29.0",