move TechDocsStorage api from @backstage/plugin-techdocs to @backstage/plugin-techdocs-react

Signed-off-by: Anders Näsman <andersn@spotify.com>
This commit is contained in:
Anders Näsman
2022-04-25 15:51:17 +02:00
parent 54f06e9c00
commit a68de3c984
8 changed files with 78 additions and 9 deletions
+37
View File
@@ -39,3 +39,40 @@ export interface TechDocsApi {
export const techdocsApiRef = createApiRef<TechDocsApi>({
id: 'plugin.techdocs.service',
});
/**
* The outcome of a docs sync operation.
*
* @public
*/
export type SyncResult = 'cached' | 'updated';
/**
* API which talks to TechDocs storage to fetch files to render.
*
* @public
*/
export interface TechDocsStorageApi {
getApiOrigin(): Promise<string>;
getStorageUrl(): Promise<string>;
getBuilder(): Promise<string>;
getEntityDocs(entityId: CompoundEntityRef, path: string): Promise<string>;
syncEntityDocs(
entityId: CompoundEntityRef,
logHandler?: (line: string) => void,
): Promise<SyncResult>;
getBaseUrl(
oldBaseUrl: string,
entityId: CompoundEntityRef,
path: string,
): Promise<string>;
}
/**
* Utility API reference for the {@link TechDocsStorageApi}.
*
* @public
*/
export const techdocsStorageApiRef = createApiRef<TechDocsStorageApi>({
id: 'plugin.techdocs.storageservice',
});
+2 -2
View File
@@ -26,8 +26,8 @@ export {
TechDocsAddons,
TECHDOCS_ADDONS_WRAPPER_KEY,
} from './addons';
export { techdocsApiRef } from './api';
export type { TechDocsApi } from './api';
export { techdocsApiRef, techdocsStorageApiRef } from './api';
export type { SyncResult, TechDocsApi, TechDocsStorageApi } from './api';
export {
defaultTechDocsReaderPageValue,
TechDocsReaderPageProvider,