@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
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 getDocumentsQueryKey({ projectId, docType, }) {
4
4
  return [ROOT_QUERY_KEY, 'projects', projectId, docType];
5
5
  }
@@ -0,0 +1,12 @@
1
+ import type { MapeoClientApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
2
+ export declare function getInvitesQueryKey(): readonly ["@comapeo/core-react", "invites"];
3
+ export declare function getPendingInvitesQueryKey(): readonly ["@comapeo/core-react", "invites", {
4
+ readonly status: "pending";
5
+ }];
6
+ export declare function pendingInvitesQueryOptions({ clientApi, }: {
7
+ clientApi: MapeoClientApi;
8
+ }): 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>[], import("@tanstack/react-query").QueryKey>, "queryFn"> & {
9
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/types.js").MapBuffers<import("@comapeo/core/dist/invite-api.js").InviteInternal>[], import("@tanstack/react-query").QueryKey, never> | undefined;
10
+ } & {
11
+ queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, import("@comapeo/core/dist/types.js").MapBuffers<import("@comapeo/core/dist/invite-api.js").InviteInternal>[]>;
12
+ };
@@ -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 getInvitesQueryKey() {
4
4
  return [ROOT_QUERY_KEY, 'invites'];
5
5
  }
@@ -0,0 +1,15 @@
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, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
12
+ queryFn?: import("@tanstack/react-query").QueryFunction<string, import("@tanstack/react-query").QueryKey, never> | undefined;
13
+ } & {
14
+ queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, string>;
15
+ };
@@ -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
  }
@@ -0,0 +1,196 @@
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
+ import type { MapeoClientApi, MapeoProjectApi } from '@comapeo/ipc' with { 'resolution-mode': 'import' };
4
+ export declare function getProjectsQueryKey(): readonly ["@comapeo/core-react", "projects"];
5
+ export declare function getProjectByIdQueryKey({ projectId }: {
6
+ projectId: string;
7
+ }): readonly ["@comapeo/core-react", "projects", string];
8
+ export declare function getProjectSettingsQueryKey({ projectId, }: {
9
+ projectId: string;
10
+ }): readonly ["@comapeo/core-react", "projects", string, "project_settings"];
11
+ export declare function getProjectRoleQueryKey({ projectId }: {
12
+ projectId: string;
13
+ }): readonly ["@comapeo/core-react", "projects", string, "role"];
14
+ export declare function getMembersQueryKey({ projectId }: {
15
+ projectId: string;
16
+ }): readonly ["@comapeo/core-react", "projects", string, "members"];
17
+ export declare function getMemberByIdQueryKey({ projectId, deviceId, }: {
18
+ projectId: string;
19
+ deviceId: string;
20
+ }): readonly ["@comapeo/core-react", "projects", string, "members", string];
21
+ export declare function getIconUrlQueryKey({ projectId, iconId, ...mimeBasedOpts }: {
22
+ projectId: string;
23
+ iconId: string;
24
+ } & (BitmapOpts | SvgOpts)): readonly ["@comapeo/core-react", "projects", string, "icons", string, {
25
+ mimeType: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant["mimeType"], "image/png">;
26
+ pixelDensity: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant, {
27
+ mimeType: "image/png";
28
+ }>["pixelDensity"];
29
+ size: import("@comapeo/core/dist/icon-api.js").ValidSizes;
30
+ } | {
31
+ mimeType: Extract<import("@comapeo/core/dist/icon-api.js").IconVariant["mimeType"], "image/svg+xml">;
32
+ size: import("@comapeo/core/dist/icon-api.js").ValidSizes;
33
+ }];
34
+ export declare function getDocumentCreatedByQueryKey({ projectId, originalVersionId, }: {
35
+ projectId: string;
36
+ originalVersionId: string;
37
+ }): readonly ["@comapeo/core-react", "projects", string, "document_created_by", string];
38
+ export declare function getAttachmentUrlQueryKey({ projectId, blobId, }: {
39
+ projectId: string;
40
+ blobId: BlobId;
41
+ }): readonly ["@comapeo/core-react", "projects", string, "attachments", BlobId];
42
+ export declare function projectsQueryOptions({ clientApi, }: {
43
+ clientApi: MapeoClientApi;
44
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<(Pick<{
45
+ schemaName: "projectSettings";
46
+ name?: string | undefined;
47
+ defaultPresets?: {
48
+ point: string[];
49
+ area: string[];
50
+ vertex: string[];
51
+ line: string[];
52
+ relation: string[];
53
+ } | undefined;
54
+ configMetadata?: {
55
+ name: string;
56
+ buildDate: string;
57
+ importDate: string;
58
+ fileVersion: string;
59
+ } | undefined;
60
+ }, "name"> & {
61
+ projectId: string;
62
+ createdAt?: string | undefined;
63
+ updatedAt?: string | undefined;
64
+ })[], Error, (Pick<{
65
+ schemaName: "projectSettings";
66
+ name?: string | undefined;
67
+ defaultPresets?: {
68
+ point: string[];
69
+ area: string[];
70
+ vertex: string[];
71
+ line: string[];
72
+ relation: string[];
73
+ } | undefined;
74
+ configMetadata?: {
75
+ name: string;
76
+ buildDate: string;
77
+ importDate: string;
78
+ fileVersion: string;
79
+ } | undefined;
80
+ }, "name"> & {
81
+ projectId: string;
82
+ createdAt?: string | undefined;
83
+ updatedAt?: string | undefined;
84
+ })[], import("@tanstack/react-query").QueryKey>, "queryFn"> & {
85
+ queryFn?: import("@tanstack/react-query").QueryFunction<(Pick<{
86
+ schemaName: "projectSettings";
87
+ name?: string | undefined;
88
+ defaultPresets?: {
89
+ point: string[];
90
+ area: string[];
91
+ vertex: string[];
92
+ line: string[];
93
+ relation: string[];
94
+ } | undefined;
95
+ configMetadata?: {
96
+ name: string;
97
+ buildDate: string;
98
+ importDate: string;
99
+ fileVersion: string;
100
+ } | undefined;
101
+ }, "name"> & {
102
+ projectId: string;
103
+ createdAt?: string | undefined;
104
+ updatedAt?: string | undefined;
105
+ })[], import("@tanstack/react-query").QueryKey, never> | undefined;
106
+ } & {
107
+ queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, (Pick<{
108
+ schemaName: "projectSettings";
109
+ name?: string | undefined;
110
+ defaultPresets?: {
111
+ point: string[];
112
+ area: string[];
113
+ vertex: string[];
114
+ line: string[];
115
+ relation: string[];
116
+ } | undefined;
117
+ configMetadata?: {
118
+ name: string;
119
+ buildDate: string;
120
+ importDate: string;
121
+ fileVersion: string;
122
+ } | undefined;
123
+ }, "name"> & {
124
+ projectId: string;
125
+ createdAt?: string | undefined;
126
+ updatedAt?: string | undefined;
127
+ })[]>;
128
+ };
129
+ export declare function projectByIdQueryOptions({ clientApi, projectId, }: {
130
+ clientApi: MapeoClientApi;
131
+ projectId: string;
132
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js").MapeoProject>, Error, import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js").MapeoProject>, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
133
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js").MapeoProject>, import("@tanstack/react-query").QueryKey, never> | undefined;
134
+ } & {
135
+ queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, import("rpc-reflector/lib/types.js").ClientApi<import("@comapeo/core/dist/mapeo-project.js").MapeoProject>>;
136
+ };
137
+ export declare function projectSettingsQueryOptions({ projectApi, projectId, }: {
138
+ projectApi: MapeoProjectApi;
139
+ projectId: string;
140
+ }): 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, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
141
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/mapeo-project.js").EditableProjectSettings, import("@tanstack/react-query").QueryKey, never> | undefined;
142
+ } & {
143
+ queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, import("@comapeo/core/dist/mapeo-project.js").EditableProjectSettings>;
144
+ };
145
+ export declare function projectMembersQueryOptions({ projectApi, projectId, }: {
146
+ projectApi: MapeoProjectApi;
147
+ projectId: string;
148
+ }): 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[], import("@tanstack/react-query").QueryKey>, "queryFn"> & {
149
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/member-api.js").MemberInfo[], import("@tanstack/react-query").QueryKey, never> | undefined;
150
+ } & {
151
+ queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, import("@comapeo/core/dist/member-api.js").MemberInfo[]>;
152
+ };
153
+ export declare function projectMemberByIdQueryOptions({ projectApi, projectId, deviceId, }: {
154
+ projectApi: MapeoProjectApi;
155
+ projectId: string;
156
+ deviceId: string;
157
+ }): 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, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
158
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/member-api.js").MemberInfo, import("@tanstack/react-query").QueryKey, never> | undefined;
159
+ } & {
160
+ queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, import("@comapeo/core/dist/member-api.js").MemberInfo>;
161
+ };
162
+ export declare function projectOwnRoleQueryOptions({ projectApi, projectId, }: {
163
+ projectApi: MapeoProjectApi;
164
+ projectId: string;
165
+ }): 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">, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
166
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("@comapeo/core/dist/roles.js").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">, import("@tanstack/react-query").QueryKey, never> | undefined;
167
+ } & {
168
+ queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, import("@comapeo/core/dist/roles.js").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">>;
169
+ };
170
+ export declare function iconUrlQueryOptions({ projectApi, projectId, iconId, ...mimeBasedOpts }: {
171
+ projectApi: MapeoProjectApi;
172
+ projectId: string;
173
+ iconId: Parameters<MapeoProjectApi['$icons']['getIconUrl']>[0];
174
+ } & (BitmapOpts | SvgOpts)): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
175
+ queryFn?: import("@tanstack/react-query").QueryFunction<string, import("@tanstack/react-query").QueryKey, never> | undefined;
176
+ } & {
177
+ queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, string>;
178
+ };
179
+ export declare function documentCreatedByQueryOptions({ projectApi, projectId, originalVersionId, }: {
180
+ projectApi: MapeoProjectApi;
181
+ projectId: string;
182
+ originalVersionId: string;
183
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
184
+ queryFn?: import("@tanstack/react-query").QueryFunction<string, import("@tanstack/react-query").QueryKey, never> | undefined;
185
+ } & {
186
+ queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, string>;
187
+ };
188
+ export declare function attachmentUrlQueryOptions({ projectApi, projectId, blobId, }: {
189
+ projectApi: MapeoProjectApi;
190
+ projectId: string;
191
+ blobId: BlobId;
192
+ }): import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, import("@tanstack/react-query").QueryKey>, "queryFn"> & {
193
+ queryFn?: import("@tanstack/react-query").QueryFunction<string, import("@tanstack/react-query").QueryKey, never> | undefined;
194
+ } & {
195
+ queryKey: import("@tanstack/react-query").DataTag<import("@tanstack/react-query").QueryKey, string>;
196
+ };
@@ -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 getProjectsQueryKey() {
4
4
  return [ROOT_QUERY_KEY, 'projects'];
5
5
  }
@@ -0,0 +1,5 @@
1
+ export declare const ROOT_QUERY_KEY = "@comapeo/core-react";
2
+ export declare function baseQueryOptions(): {
3
+ networkMode: "always";
4
+ retry: number;
5
+ };
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comapeo/core-react",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "React wrapper for working with @comapeo/core",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,32 +18,46 @@
18
18
  "Andrew Chou <achou@awana.digital>"
19
19
  ],
20
20
  "type": "module",
21
- "main": "./dist/index.js",
22
- "types": "./dist/index.d.ts",
23
21
  "exports": {
24
22
  ".": {
25
- "types": "./dist/index.d.ts",
26
- "import": "./dist/index.js"
27
- }
23
+ "import": {
24
+ "types": "./dist/esm/index.d.ts",
25
+ "default": "./dist/esm/index.js"
26
+ },
27
+ "require": {
28
+ "types": "./dist/commonjs/index.d.ts",
29
+ "default": "./dist/commonjs/index.js"
30
+ }
31
+ },
32
+ "./package.json": "./package.json"
28
33
  },
34
+ "main": "./dist/commonjs/index.js",
35
+ "types": "./dist/commonjs/index.d.ts",
36
+ "module": "./dist/esm/index.js",
29
37
  "files": [
30
38
  "CHANGELOG.md",
31
39
  "dist/",
32
40
  "docs/API.md"
33
41
  ],
42
+ "tshy": {
43
+ "project": "./tsconfig.build.json",
44
+ "selfLink": false,
45
+ "exports": {
46
+ ".": "./src/index.ts",
47
+ "./package.json": "./package.json"
48
+ }
49
+ },
34
50
  "scripts": {
35
- "prepare": "husky",
51
+ "prepare:husky": "husky",
52
+ "prepare:tshy": "tshy",
53
+ "prepare": "npm-run-all --parallel prepare:*",
36
54
  "lint:eslint": "eslint --cache .",
37
55
  "lint:format": "prettier --cache --check .",
38
56
  "lint": "npm-run-all --parallel --continue-on-error --print-label --aggregate-output lint:*",
39
57
  "types": "tsc",
40
58
  "test:unit": "vitest run",
41
59
  "test": "npm-run-all --parallel --continue-on-error --print-label --aggregate-output types test:*",
42
- "docs:generate": "tsdoc --src=src/contexts/*,src/hooks/*,src/lib/react-query/* --dest=docs/API.md --noemoji --types",
43
- "build:clean": "rimraf ./dist",
44
- "build:npm": "tsc -p tsconfig.npm.json",
45
- "build": "npm-run-all build:clean build:npm",
46
- "prepack": "npm run build"
60
+ "docs:generate": "tsdoc --src=src/contexts/*,src/hooks/*,src/lib/react-query/* --dest=docs/API.md --noemoji --types"
47
61
  },
48
62
  "peerDependencies": {
49
63
  "@comapeo/core": "*",
@@ -75,6 +89,7 @@
75
89
  "random-access-memory": "^6.2.1",
76
90
  "rimraf": "^6.0.1",
77
91
  "tsdoc-markdown": "^1.1.0",
92
+ "tshy": "^3.0.2",
78
93
  "typescript": "^5.7.2",
79
94
  "typescript-eslint": "^8.18.1",
80
95
  "vitest": "^2.1.8"
package/dist/index.d.ts DELETED
@@ -1,11 +0,0 @@
1
- export * from './contexts/ClientApi';
2
- export * from './hooks/client';
3
- export * from './hooks/documents';
4
- export * from './hooks/maps';
5
- export * from './hooks/projects';
6
- export * from './lib/react-query/client';
7
- export * from './lib/react-query/documents';
8
- export * from './lib/react-query/invites';
9
- export * from './lib/react-query/maps';
10
- export * from './lib/react-query/projects';
11
- export * from './lib/react-query/shared';
package/dist/index.js DELETED
@@ -1,11 +0,0 @@
1
- export * from './contexts/ClientApi';
2
- export * from './hooks/client';
3
- export * from './hooks/documents';
4
- export * from './hooks/maps';
5
- export * from './hooks/projects';
6
- export * from './lib/react-query/client';
7
- export * from './lib/react-query/documents';
8
- export * from './lib/react-query/invites';
9
- export * from './lib/react-query/maps';
10
- export * from './lib/react-query/projects';
11
- export * from './lib/react-query/shared';
@@ -1,30 +0,0 @@
1
- import type { MapeoClientApi } from '@comapeo/ipc';
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/query-core").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").DeviceInfoParam>, Error, {
11
- deviceId: string;
12
- deviceType: "device_type_unspecified" | "mobile" | "tablet" | "desktop" | "selfHostedServer" | "UNRECOGNIZED";
13
- } & Partial<import("@comapeo/core/dist/schema/client").DeviceInfoParam>, import("@tanstack/query-core").QueryKey>, "queryFn"> & {
14
- queryFn?: import("@tanstack/query-core").QueryFunction<{
15
- deviceId: string;
16
- deviceType: "device_type_unspecified" | "mobile" | "tablet" | "desktop" | "selfHostedServer" | "UNRECOGNIZED";
17
- } & Partial<import("@comapeo/core/dist/schema/client").DeviceInfoParam>, import("@tanstack/query-core").QueryKey, never> | undefined;
18
- } & {
19
- queryKey: import("@tanstack/query-core").DataTag<import("@tanstack/query-core").QueryKey, {
20
- deviceId: string;
21
- deviceType: "device_type_unspecified" | "mobile" | "tablet" | "desktop" | "selfHostedServer" | "UNRECOGNIZED";
22
- } & Partial<import("@comapeo/core/dist/schema/client").DeviceInfoParam>>;
23
- };
24
- export declare function isArchiveDeviceQueryOptions({ clientApi, }: {
25
- clientApi: MapeoClientApi;
26
- }): import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<boolean, Error, boolean, import("@tanstack/query-core").QueryKey>, "queryFn"> & {
27
- queryFn?: import("@tanstack/query-core").QueryFunction<boolean, import("@tanstack/query-core").QueryKey, never> | undefined;
28
- } & {
29
- queryKey: import("@tanstack/query-core").DataTag<import("@tanstack/query-core").QueryKey, boolean>;
30
- };
@@ -1,12 +0,0 @@
1
- import type { MapeoClientApi } from '@comapeo/ipc';
2
- export declare function getInvitesQueryKey(): readonly ["@comapeo/core-react", "invites"];
3
- export declare function getPendingInvitesQueryKey(): readonly ["@comapeo/core-react", "invites", {
4
- readonly status: "pending";
5
- }];
6
- export declare function pendingInvitesQueryOptions({ clientApi, }: {
7
- clientApi: MapeoClientApi;
8
- }): import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/types").MapBuffers<import("@comapeo/core/dist/invite-api").InviteInternal>[], Error, import("@comapeo/core/dist/types").MapBuffers<import("@comapeo/core/dist/invite-api").InviteInternal>[], import("@tanstack/query-core").QueryKey>, "queryFn"> & {
9
- queryFn?: import("@tanstack/query-core").QueryFunction<import("@comapeo/core/dist/types").MapBuffers<import("@comapeo/core/dist/invite-api").InviteInternal>[], import("@tanstack/query-core").QueryKey, never> | undefined;
10
- } & {
11
- queryKey: import("@tanstack/query-core").DataTag<import("@tanstack/query-core").QueryKey, import("@comapeo/core/dist/types").MapBuffers<import("@comapeo/core/dist/invite-api").InviteInternal>[]>;
12
- };
@@ -1,15 +0,0 @@
1
- import type { MapeoClientApi } from '@comapeo/ipc';
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/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, import("@tanstack/query-core").QueryKey>, "queryFn"> & {
12
- queryFn?: import("@tanstack/query-core").QueryFunction<string, import("@tanstack/query-core").QueryKey, never> | undefined;
13
- } & {
14
- queryKey: import("@tanstack/query-core").DataTag<import("@tanstack/query-core").QueryKey, string>;
15
- };
@@ -1,196 +0,0 @@
1
- import type { BitmapOpts, SvgOpts } from '@comapeo/core/dist/icon-api';
2
- import type { BlobId } from '@comapeo/core/dist/types.js';
3
- import type { MapeoClientApi, MapeoProjectApi } from '@comapeo/ipc';
4
- export declare function getProjectsQueryKey(): readonly ["@comapeo/core-react", "projects"];
5
- export declare function getProjectByIdQueryKey({ projectId }: {
6
- projectId: string;
7
- }): readonly ["@comapeo/core-react", "projects", string];
8
- export declare function getProjectSettingsQueryKey({ projectId, }: {
9
- projectId: string;
10
- }): readonly ["@comapeo/core-react", "projects", string, "project_settings"];
11
- export declare function getProjectRoleQueryKey({ projectId }: {
12
- projectId: string;
13
- }): readonly ["@comapeo/core-react", "projects", string, "role"];
14
- export declare function getMembersQueryKey({ projectId }: {
15
- projectId: string;
16
- }): readonly ["@comapeo/core-react", "projects", string, "members"];
17
- export declare function getMemberByIdQueryKey({ projectId, deviceId, }: {
18
- projectId: string;
19
- deviceId: string;
20
- }): readonly ["@comapeo/core-react", "projects", string, "members", string];
21
- export declare function getIconUrlQueryKey({ projectId, iconId, ...mimeBasedOpts }: {
22
- projectId: string;
23
- iconId: string;
24
- } & (BitmapOpts | SvgOpts)): readonly ["@comapeo/core-react", "projects", string, "icons", string, {
25
- mimeType: Extract<import("@comapeo/core/dist/icon-api").IconVariant["mimeType"], "image/png">;
26
- pixelDensity: Extract<import("@comapeo/core/dist/icon-api").IconVariant, {
27
- mimeType: "image/png";
28
- }>["pixelDensity"];
29
- size: import("@comapeo/core/dist/icon-api").ValidSizes;
30
- } | {
31
- mimeType: Extract<import("@comapeo/core/dist/icon-api").IconVariant["mimeType"], "image/svg+xml">;
32
- size: import("@comapeo/core/dist/icon-api").ValidSizes;
33
- }];
34
- export declare function getDocumentCreatedByQueryKey({ projectId, originalVersionId, }: {
35
- projectId: string;
36
- originalVersionId: string;
37
- }): readonly ["@comapeo/core-react", "projects", string, "document_created_by", string];
38
- export declare function getAttachmentUrlQueryKey({ projectId, blobId, }: {
39
- projectId: string;
40
- blobId: BlobId;
41
- }): readonly ["@comapeo/core-react", "projects", string, "attachments", BlobId];
42
- export declare function projectsQueryOptions({ clientApi, }: {
43
- clientApi: MapeoClientApi;
44
- }): import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<(Pick<{
45
- schemaName: "projectSettings";
46
- name?: string | undefined;
47
- defaultPresets?: {
48
- point: string[];
49
- area: string[];
50
- vertex: string[];
51
- line: string[];
52
- relation: string[];
53
- } | undefined;
54
- configMetadata?: {
55
- name: string;
56
- buildDate: string;
57
- importDate: string;
58
- fileVersion: string;
59
- } | undefined;
60
- }, "name"> & {
61
- projectId: string;
62
- createdAt?: string | undefined;
63
- updatedAt?: string | undefined;
64
- })[], Error, (Pick<{
65
- schemaName: "projectSettings";
66
- name?: string | undefined;
67
- defaultPresets?: {
68
- point: string[];
69
- area: string[];
70
- vertex: string[];
71
- line: string[];
72
- relation: string[];
73
- } | undefined;
74
- configMetadata?: {
75
- name: string;
76
- buildDate: string;
77
- importDate: string;
78
- fileVersion: string;
79
- } | undefined;
80
- }, "name"> & {
81
- projectId: string;
82
- createdAt?: string | undefined;
83
- updatedAt?: string | undefined;
84
- })[], import("@tanstack/query-core").QueryKey>, "queryFn"> & {
85
- queryFn?: import("@tanstack/query-core").QueryFunction<(Pick<{
86
- schemaName: "projectSettings";
87
- name?: string | undefined;
88
- defaultPresets?: {
89
- point: string[];
90
- area: string[];
91
- vertex: string[];
92
- line: string[];
93
- relation: string[];
94
- } | undefined;
95
- configMetadata?: {
96
- name: string;
97
- buildDate: string;
98
- importDate: string;
99
- fileVersion: string;
100
- } | undefined;
101
- }, "name"> & {
102
- projectId: string;
103
- createdAt?: string | undefined;
104
- updatedAt?: string | undefined;
105
- })[], import("@tanstack/query-core").QueryKey, never> | undefined;
106
- } & {
107
- queryKey: import("@tanstack/query-core").DataTag<import("@tanstack/query-core").QueryKey, (Pick<{
108
- schemaName: "projectSettings";
109
- name?: string | undefined;
110
- defaultPresets?: {
111
- point: string[];
112
- area: string[];
113
- vertex: string[];
114
- line: string[];
115
- relation: string[];
116
- } | undefined;
117
- configMetadata?: {
118
- name: string;
119
- buildDate: string;
120
- importDate: string;
121
- fileVersion: string;
122
- } | undefined;
123
- }, "name"> & {
124
- projectId: string;
125
- createdAt?: string | undefined;
126
- updatedAt?: string | undefined;
127
- })[]>;
128
- };
129
- export declare function projectByIdQueryOptions({ clientApi, projectId, }: {
130
- clientApi: MapeoClientApi;
131
- projectId: string;
132
- }): import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("rpc-reflector/lib/types").ClientApi<import("@comapeo/core/dist/mapeo-project").MapeoProject>, Error, import("rpc-reflector/lib/types").ClientApi<import("@comapeo/core/dist/mapeo-project").MapeoProject>, import("@tanstack/query-core").QueryKey>, "queryFn"> & {
133
- queryFn?: import("@tanstack/query-core").QueryFunction<import("rpc-reflector/lib/types").ClientApi<import("@comapeo/core/dist/mapeo-project").MapeoProject>, import("@tanstack/query-core").QueryKey, never> | undefined;
134
- } & {
135
- queryKey: import("@tanstack/query-core").DataTag<import("@tanstack/query-core").QueryKey, import("rpc-reflector/lib/types").ClientApi<import("@comapeo/core/dist/mapeo-project").MapeoProject>>;
136
- };
137
- export declare function projectSettingsQueryOptions({ projectApi, projectId, }: {
138
- projectApi: MapeoProjectApi;
139
- projectId: string;
140
- }): import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/mapeo-project").EditableProjectSettings, Error, import("@comapeo/core/dist/mapeo-project").EditableProjectSettings, import("@tanstack/query-core").QueryKey>, "queryFn"> & {
141
- queryFn?: import("@tanstack/query-core").QueryFunction<import("@comapeo/core/dist/mapeo-project").EditableProjectSettings, import("@tanstack/query-core").QueryKey, never> | undefined;
142
- } & {
143
- queryKey: import("@tanstack/query-core").DataTag<import("@tanstack/query-core").QueryKey, import("@comapeo/core/dist/mapeo-project").EditableProjectSettings>;
144
- };
145
- export declare function projectMembersQueryOptions({ projectApi, projectId, }: {
146
- projectApi: MapeoProjectApi;
147
- projectId: string;
148
- }): import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/member-api").MemberInfo[], Error, import("@comapeo/core/dist/member-api").MemberInfo[], import("@tanstack/query-core").QueryKey>, "queryFn"> & {
149
- queryFn?: import("@tanstack/query-core").QueryFunction<import("@comapeo/core/dist/member-api").MemberInfo[], import("@tanstack/query-core").QueryKey, never> | undefined;
150
- } & {
151
- queryKey: import("@tanstack/query-core").DataTag<import("@tanstack/query-core").QueryKey, import("@comapeo/core/dist/member-api").MemberInfo[]>;
152
- };
153
- export declare function projectMemberByIdQueryOptions({ projectApi, projectId, deviceId, }: {
154
- projectApi: MapeoProjectApi;
155
- projectId: string;
156
- deviceId: string;
157
- }): import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/member-api").MemberInfo, Error, import("@comapeo/core/dist/member-api").MemberInfo, import("@tanstack/query-core").QueryKey>, "queryFn"> & {
158
- queryFn?: import("@tanstack/query-core").QueryFunction<import("@comapeo/core/dist/member-api").MemberInfo, import("@tanstack/query-core").QueryKey, never> | undefined;
159
- } & {
160
- queryKey: import("@tanstack/query-core").DataTag<import("@tanstack/query-core").QueryKey, import("@comapeo/core/dist/member-api").MemberInfo>;
161
- };
162
- export declare function projectOwnRoleQueryOptions({ projectApi, projectId, }: {
163
- projectApi: MapeoProjectApi;
164
- projectId: string;
165
- }): import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@comapeo/core/dist/roles").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">, Error, import("@comapeo/core/dist/roles").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">, import("@tanstack/query-core").QueryKey>, "queryFn"> & {
166
- queryFn?: import("@tanstack/query-core").QueryFunction<import("@comapeo/core/dist/roles").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">, import("@tanstack/query-core").QueryKey, never> | undefined;
167
- } & {
168
- queryKey: import("@tanstack/query-core").DataTag<import("@tanstack/query-core").QueryKey, import("@comapeo/core/dist/roles").Role<"a12a6702b93bd7ff" | "f7c150f5a3a9a855" | "012fd2d431c0bf60" | "9e6d29263cba36c9" | "8ced989b1904606b" | "08e4251e36f6e7ed">>;
169
- };
170
- export declare function iconUrlQueryOptions({ projectApi, projectId, iconId, ...mimeBasedOpts }: {
171
- projectApi: MapeoProjectApi;
172
- projectId: string;
173
- iconId: Parameters<MapeoProjectApi['$icons']['getIconUrl']>[0];
174
- } & (BitmapOpts | SvgOpts)): import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, import("@tanstack/query-core").QueryKey>, "queryFn"> & {
175
- queryFn?: import("@tanstack/query-core").QueryFunction<string, import("@tanstack/query-core").QueryKey, never> | undefined;
176
- } & {
177
- queryKey: import("@tanstack/query-core").DataTag<import("@tanstack/query-core").QueryKey, string>;
178
- };
179
- export declare function documentCreatedByQueryOptions({ projectApi, projectId, originalVersionId, }: {
180
- projectApi: MapeoProjectApi;
181
- projectId: string;
182
- originalVersionId: string;
183
- }): import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, import("@tanstack/query-core").QueryKey>, "queryFn"> & {
184
- queryFn?: import("@tanstack/query-core").QueryFunction<string, import("@tanstack/query-core").QueryKey, never> | undefined;
185
- } & {
186
- queryKey: import("@tanstack/query-core").DataTag<import("@tanstack/query-core").QueryKey, string>;
187
- };
188
- export declare function attachmentUrlQueryOptions({ projectApi, projectId, blobId, }: {
189
- projectApi: MapeoProjectApi;
190
- projectId: string;
191
- blobId: BlobId;
192
- }): import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<string, Error, string, import("@tanstack/query-core").QueryKey>, "queryFn"> & {
193
- queryFn?: import("@tanstack/query-core").QueryFunction<string, import("@tanstack/query-core").QueryKey, never> | undefined;
194
- } & {
195
- queryKey: import("@tanstack/query-core").DataTag<import("@tanstack/query-core").QueryKey, string>;
196
- };
File without changes