diff --git a/docs/API.md b/docs/API.md index 0ec4570..3fc6b6e 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1,40 +1,9 @@ ## Functions - [ClientApiProvider](#clientapiprovider) -- [baseQueryOptions](#basequeryoptions) -- [getClientQueryKey](#getclientquerykey) -- [getDeviceInfoQueryKey](#getdeviceinfoquerykey) -- [getIsArchiveDeviceQueryKey](#getisarchivedevicequerykey) -- [deviceInfoQueryOptions](#deviceinfoqueryoptions) -- [isArchiveDeviceQueryOptions](#isarchivedevicequeryoptions) - [useClientApi](#useclientapi) - [useOwnDeviceInfo](#useowndeviceinfo) - [useIsArchiveDevice](#useisarchivedevice) -- [getDocumentsQueryKey](#getdocumentsquerykey) -- [getManyDocumentsQueryKey](#getmanydocumentsquerykey) -- [getDocumentByDocIdQueryKey](#getdocumentbydocidquerykey) -- [getDocumentByVersionIdQueryKey](#getdocumentbyversionidquerykey) -- [documentsQueryOptions](#documentsqueryoptions) -- [documentByDocumentIdQueryOptions](#documentbydocumentidqueryoptions) -- [documentByVersionIdQueryOptions](#documentbyversionidqueryoptions) -- [getProjectsQueryKey](#getprojectsquerykey) -- [getProjectByIdQueryKey](#getprojectbyidquerykey) -- [getProjectSettingsQueryKey](#getprojectsettingsquerykey) -- [getProjectRoleQueryKey](#getprojectrolequerykey) -- [getMembersQueryKey](#getmembersquerykey) -- [getMemberByIdQueryKey](#getmemberbyidquerykey) -- [getIconUrlQueryKey](#geticonurlquerykey) -- [getDocumentCreatedByQueryKey](#getdocumentcreatedbyquerykey) -- [getAttachmentUrlQueryKey](#getattachmenturlquerykey) -- [projectsQueryOptions](#projectsqueryoptions) -- [projectByIdQueryOptions](#projectbyidqueryoptions) -- [projectSettingsQueryOptions](#projectsettingsqueryoptions) -- [projectMembersQueryOptions](#projectmembersqueryoptions) -- [projectMemberByIdQueryOptions](#projectmemberbyidqueryoptions) -- [projectOwnRoleQueryOptions](#projectownrolequeryoptions) -- [iconUrlQueryOptions](#iconurlqueryoptions) -- [documentCreatedByQueryOptions](#documentcreatedbyqueryoptions) -- [attachmentUrlQueryOptions](#attachmenturlqueryoptions) - [useProjectSettings](#useprojectsettings) - [useSingleProject](#usesingleproject) - [useManyProjects](#usemanyprojects) @@ -46,13 +15,7 @@ - [useSingleDocByDocId](#usesingledocbydocid) - [useSingleDocByVersionId](#usesingledocbyversionid) - [useManyDocs](#usemanydocs) -- [getMapsQueryKey](#getmapsquerykey) -- [getStyleJsonUrlQueryKey](#getstylejsonurlquerykey) -- [mapStyleJsonUrlQueryOptions](#mapstylejsonurlqueryoptions) - [useMapStyleUrl](#usemapstyleurl) -- [getInvitesQueryKey](#getinvitesquerykey) -- [getPendingInvitesQueryKey](#getpendinginvitesquerykey) -- [pendingInvitesQueryOptions](#pendinginvitesqueryoptions) ### ClientApiProvider @@ -68,42 +31,6 @@ Parameters: * `opts.clientApi`: Client API instance -### baseQueryOptions - -| Function | Type | -| ---------- | ---------- | -| `baseQueryOptions` | `() => { networkMode: "always"; retry: number; }` | - -### getClientQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getClientQueryKey` | `() => readonly ["@comapeo/core-react", "client"]` | - -### getDeviceInfoQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getDeviceInfoQueryKey` | `() => readonly ["@comapeo/core-react", "client", "device_info"]` | - -### getIsArchiveDeviceQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getIsArchiveDeviceQueryKey` | `() => readonly ["@comapeo/core-react", "client", "is_archive_device"]` | - -### deviceInfoQueryOptions - -| Function | Type | -| ---------- | ---------- | -| `deviceInfoQueryOptions` | `({ clientApi, }: { clientApi: MapeoClientApi; }) => OmitKeyof, Error, { ...; } and Partial<...>, QueryKey>, "queryFn"> and { ...; } and { ...; }` | - -### isArchiveDeviceQueryOptions - -| Function | Type | -| ---------- | ---------- | -| `isArchiveDeviceQueryOptions` | `({ clientApi, }: { clientApi: MapeoClientApi; }) => OmitKeyof, "queryFn"> and { ...; } and { ...; }` | - ### useClientApi Access a client API instance. If a ClientApiContext provider is not @@ -167,156 +94,6 @@ function IsArchiveDeviceExample() { ``` -### getDocumentsQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getDocumentsQueryKey` | `({ projectId, docType, }: { projectId: string; docType: D; }) => readonly ["@comapeo/core-react", "projects", string, D]` | - -### getManyDocumentsQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getManyDocumentsQueryKey` | `({ projectId, docType, includeDeleted, lang, }: { projectId: string; docType: D; includeDeleted?: boolean or undefined; lang?: string or undefined; }) => readonly ["@comapeo/core-react", "projects", string, D, { ...; }]` | - -### getDocumentByDocIdQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getDocumentByDocIdQueryKey` | `({ projectId, docType, docId, lang, }: { projectId: string; docType: D; docId: string; lang?: string or undefined; }) => readonly ["@comapeo/core-react", "projects", string, D, string, { readonly lang: string or undefined; }]` | - -### getDocumentByVersionIdQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getDocumentByVersionIdQueryKey` | `({ projectId, docType, versionId, lang, }: { projectId: string; docType: D; versionId: string; lang?: string or undefined; }) => readonly ["@comapeo/core-react", "projects", string, D, string, { readonly lang: string or undefined; }]` | - -### documentsQueryOptions - -| Function | Type | -| ---------- | ---------- | -| `documentsQueryOptions` | `({ projectApi, projectId, docType, includeDeleted, lang, }: { projectApi: ClientApi; projectId: string; docType: D; includeDeleted?: boolean or undefined; lang?: string or undefined; }) => OmitKeyof<...> and ... 1 more ... and { ...; }` | - -### documentByDocumentIdQueryOptions - -| Function | Type | -| ---------- | ---------- | -| `documentByDocumentIdQueryOptions` | `({ projectApi, projectId, docType, docId, lang, }: { projectApi: ClientApi; projectId: string; docType: D; docId: string; lang?: string or undefined; }) => OmitKeyof({ projectApi, projectId, docType, versionId, lang, }: { projectApi: ClientApi; projectId: string; docType: D; versionId: string; lang?: string or undefined; }) => OmitKeyof readonly ["@comapeo/core-react", "projects"]` | - -### getProjectByIdQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getProjectByIdQueryKey` | `({ projectId }: { projectId: string; }) => readonly ["@comapeo/core-react", "projects", string]` | - -### getProjectSettingsQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getProjectSettingsQueryKey` | `({ projectId, }: { projectId: string; }) => readonly ["@comapeo/core-react", "projects", string, "project_settings"]` | - -### getProjectRoleQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getProjectRoleQueryKey` | `({ projectId }: { projectId: string; }) => readonly ["@comapeo/core-react", "projects", string, "role"]` | - -### getMembersQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getMembersQueryKey` | `({ projectId }: { projectId: string; }) => readonly ["@comapeo/core-react", "projects", string, "members"]` | - -### getMemberByIdQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getMemberByIdQueryKey` | `({ projectId, deviceId, }: { projectId: string; deviceId: string; }) => readonly ["@comapeo/core-react", "projects", string, "members", string]` | - -### getIconUrlQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getIconUrlQueryKey` | `({ projectId, iconId, ...mimeBasedOpts }: { projectId: string; iconId: string; } and (BitmapOpts or SvgOpts)) => readonly ["@comapeo/core-react", "projects", string, "icons", string, { mimeType: "image/png"; pixelDensity: 2 or ... 1 more ... or 1; size: ValidSizes; } or { ...; }]` | - -### getDocumentCreatedByQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getDocumentCreatedByQueryKey` | `({ projectId, originalVersionId, }: { projectId: string; originalVersionId: string; }) => readonly ["@comapeo/core-react", "projects", string, "document_created_by", string]` | - -### getAttachmentUrlQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getAttachmentUrlQueryKey` | `({ projectId, blobId, }: { projectId: string; blobId: BlobId; }) => readonly ["@comapeo/core-react", "projects", string, "attachments", BlobId]` | - -### projectsQueryOptions - -| Function | Type | -| ---------- | ---------- | -| `projectsQueryOptions` | `({ clientApi, }: { clientApi: MapeoClientApi; }) => OmitKeyof and ...` | - -### projectByIdQueryOptions - -| Function | Type | -| ---------- | ---------- | -| `projectByIdQueryOptions` | `({ clientApi, projectId, }: { clientApi: MapeoClientApi; projectId: string; }) => OmitKeyof, Error, ClientApi, QueryKey>, "queryFn"> and { ...; } and { ...; }` | - -### projectSettingsQueryOptions - -| Function | Type | -| ---------- | ---------- | -| `projectSettingsQueryOptions` | `({ projectApi, projectId, }: { projectApi: ClientApi; projectId: string; }) => OmitKeyof, "queryFn"> and { ...; } and { ...; }` | - -### projectMembersQueryOptions - -| Function | Type | -| ---------- | ---------- | -| `projectMembersQueryOptions` | `({ projectApi, projectId, }: { projectApi: ClientApi; projectId: string; }) => OmitKeyof, "queryFn"> and { ...; } and { ...; }` | - -### projectMemberByIdQueryOptions - -| Function | Type | -| ---------- | ---------- | -| `projectMemberByIdQueryOptions` | `({ projectApi, projectId, deviceId, }: { projectApi: ClientApi; projectId: string; deviceId: string; }) => OmitKeyof, "queryFn"> and { ...; } and { ...; }` | - -### projectOwnRoleQueryOptions - -| Function | Type | -| ---------- | ---------- | -| `projectOwnRoleQueryOptions` | `({ projectApi, projectId, }: { projectApi: ClientApi; projectId: string; }) => OmitKeyof, Error, Role<...>, QueryKey>, "queryFn"> and { ...; } and { ...; }` | - -### iconUrlQueryOptions - -| Function | Type | -| ---------- | ---------- | -| `iconUrlQueryOptions` | `({ projectApi, projectId, iconId, ...mimeBasedOpts }: { projectApi: ClientApi; projectId: string; iconId: string; } and (BitmapOpts or SvgOpts)) => OmitKeyof, "queryFn"> and { ...; } and { ...; }` | - -### documentCreatedByQueryOptions - -| Function | Type | -| ---------- | ---------- | -| `documentCreatedByQueryOptions` | `({ projectApi, projectId, originalVersionId, }: { projectApi: ClientApi; projectId: string; originalVersionId: string; }) => OmitKeyof, "queryFn"> and { ...; } and { ...; }` | - -### attachmentUrlQueryOptions - -| Function | Type | -| ---------- | ---------- | -| `attachmentUrlQueryOptions` | `({ projectApi, projectId, blobId, }: { projectApi: ClientApi; projectId: string; blobId: BlobId; }) => OmitKeyof, "queryFn"> and { ...; } and { ...; }` | - ### useProjectSettings Retrieve the project settings for a project. @@ -677,24 +454,6 @@ function useAllPresets(opts) { ``` -### getMapsQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getMapsQueryKey` | `() => readonly ["@comapeo/core-react", "maps"]` | - -### getStyleJsonUrlQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getStyleJsonUrlQueryKey` | `({ refreshToken, }: { refreshToken?: string or undefined; }) => readonly ["@comapeo/core-react", "maps", "stylejson_url", { readonly refreshToken: string or undefined; }]` | - -### mapStyleJsonUrlQueryOptions - -| Function | Type | -| ---------- | ---------- | -| `mapStyleJsonUrlQueryOptions` | `({ clientApi, refreshToken, }: { clientApi: MapeoClientApi; refreshToken?: string or undefined; }) => OmitKeyof, "queryFn"> and { ...; } and { ...; }` | - ### useMapStyleUrl Get a URL that points to a StyleJSON resource served by the embedded HTTP server. @@ -731,29 +490,10 @@ function ExampleWithRefreshToken() { ``` -### getInvitesQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getInvitesQueryKey` | `() => readonly ["@comapeo/core-react", "invites"]` | - -### getPendingInvitesQueryKey - -| Function | Type | -| ---------- | ---------- | -| `getPendingInvitesQueryKey` | `() => readonly ["@comapeo/core-react", "invites", { readonly status: "pending"; }]` | - -### pendingInvitesQueryOptions - -| Function | Type | -| ---------- | ---------- | -| `pendingInvitesQueryOptions` | `({ clientApi, }: { clientApi: MapeoClientApi; }) => OmitKeyof[], Error, MapBuffers[], QueryKey>, "queryFn"> and { ...; } and { ...; }` | - ## Constants - [ClientApiContext](#clientapicontext) -- [ROOT_QUERY_KEY](#root_query_key) ### ClientApiContext @@ -761,21 +501,4 @@ function ExampleWithRefreshToken() { | ---------- | ---------- | | `ClientApiContext` | `Context` | -### ROOT_QUERY_KEY - -| Constant | Type | -| ---------- | ---------- | -| `ROOT_QUERY_KEY` | `"@comapeo/core-react"` | - - - -## Types - -- [DocumentType](#documenttype) - -### DocumentType - -| Type | Type | -| ---------- | ---------- | -| `DocumentType` | `Extract< MapeoDoc['schemaName'], 'field' or 'observation' or 'preset' or 'track' or 'remoteDetectionAlert' >` | diff --git a/package.json b/package.json index 7976cf1..02e954f 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "types": "tsc", "test:unit": "vitest run", "test": "npm-run-all --parallel --continue-on-error --print-label --aggregate-output types test:*", - "docs:generate": "tsdoc --src=src/contexts/*,src/hooks/*,src/lib/react-query/* --dest=docs/API.md --noemoji --types" + "docs:generate": "tsdoc --src=src/contexts/*,src/hooks/* --dest=docs/API.md --noemoji --types" }, "peerDependencies": { "@comapeo/core": "*", diff --git a/src/index.ts b/src/index.ts index 64dbc04..a18fcad 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,16 +21,11 @@ export { useSingleProject, } from './hooks/projects.js' export { - deviceInfoQueryOptions, getClientQueryKey, getDeviceInfoQueryKey, getIsArchiveDeviceQueryKey, - isArchiveDeviceQueryOptions, } from './lib/react-query/client.js' export { - documentByDocumentIdQueryOptions, - documentByVersionIdQueryOptions, - documentsQueryOptions, getDocumentByDocIdQueryKey, getDocumentByVersionIdQueryKey, getDocumentsQueryKey, @@ -40,16 +35,12 @@ export { export { getInvitesQueryKey, getPendingInvitesQueryKey, - pendingInvitesQueryOptions, } from './lib/react-query/invites.js' export { getMapsQueryKey, getStyleJsonUrlQueryKey, - mapStyleJsonUrlQueryOptions, } from './lib/react-query/maps.js' export { - attachmentUrlQueryOptions, - documentCreatedByQueryOptions, getAttachmentUrlQueryKey, getDocumentCreatedByQueryKey, getIconUrlQueryKey, @@ -59,11 +50,5 @@ export { getProjectRoleQueryKey, getProjectSettingsQueryKey, getProjectsQueryKey, - iconUrlQueryOptions, - projectByIdQueryOptions, - projectMembersQueryOptions, - projectOwnRoleQueryOptions, - projectSettingsQueryOptions, - projectsQueryOptions, } from './lib/react-query/projects.js' -export { ROOT_QUERY_KEY, baseQueryOptions } from './lib/react-query/shared.js' +export { ROOT_QUERY_KEY } from './lib/react-query/shared.js'