@comapeo/core-react 0.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.
- package/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +21 -0
- package/dist/contexts/ClientApi.d.ts +14 -0
- package/dist/contexts/ClientApi.js +12 -0
- package/dist/hooks/client.d.ts +59 -0
- package/dist/hooks/client.js +66 -0
- package/dist/hooks/documents.d.ts +475 -0
- package/dist/hooks/documents.js +124 -0
- package/dist/hooks/maps.d.ts +34 -0
- package/dist/hooks/maps.js +35 -0
- package/dist/hooks/projects.d.ts +261 -0
- package/dist/hooks/projects.js +257 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +11 -0
- package/dist/lib/react-query/client.d.ts +30 -0
- package/dist/lib/react-query/client.js +29 -0
- package/dist/lib/react-query/documents.d.ts +1492 -0
- package/dist/lib/react-query/documents.js +62 -0
- package/dist/lib/react-query/invites.d.ts +12 -0
- package/dist/lib/react-query/invites.js +17 -0
- package/dist/lib/react-query/maps.d.ts +15 -0
- package/dist/lib/react-query/maps.js +18 -0
- package/dist/lib/react-query/projects.d.ts +188 -0
- package/dist/lib/react-query/projects.js +120 -0
- package/dist/lib/react-query/shared.d.ts +5 -0
- package/dist/lib/react-query/shared.js +12 -0
- package/docs/API.md +783 -0
- package/package.json +80 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
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';
|
|
@@ -0,0 +1,30 @@
|
|
|
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_remote_archive"];
|
|
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
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { queryOptions } from '@tanstack/react-query';
|
|
2
|
+
import { baseQueryOptions, ROOT_QUERY_KEY } from './shared';
|
|
3
|
+
export function getClientQueryKey() {
|
|
4
|
+
return [ROOT_QUERY_KEY, 'client'];
|
|
5
|
+
}
|
|
6
|
+
export function getDeviceInfoQueryKey() {
|
|
7
|
+
return [ROOT_QUERY_KEY, 'client', 'device_info'];
|
|
8
|
+
}
|
|
9
|
+
export function getIsArchiveDeviceQueryKey() {
|
|
10
|
+
return [ROOT_QUERY_KEY, 'client', 'is_remote_archive'];
|
|
11
|
+
}
|
|
12
|
+
export function deviceInfoQueryOptions({ clientApi, }) {
|
|
13
|
+
return queryOptions({
|
|
14
|
+
...baseQueryOptions(),
|
|
15
|
+
queryKey: getDeviceInfoQueryKey(),
|
|
16
|
+
queryFn: async () => {
|
|
17
|
+
return clientApi.getDeviceInfo();
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export function isArchiveDeviceQueryOptions({ clientApi, }) {
|
|
22
|
+
return queryOptions({
|
|
23
|
+
...baseQueryOptions(),
|
|
24
|
+
queryKey: getIsArchiveDeviceQueryKey(),
|
|
25
|
+
queryFn: async () => {
|
|
26
|
+
return clientApi.getIsArchiveDevice();
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|