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:
@@ -35,7 +35,7 @@ import {
|
||||
techdocsApiRef,
|
||||
TechDocsStorageApi,
|
||||
techdocsStorageApiRef,
|
||||
} from '@backstage/plugin-techdocs';
|
||||
} from '@backstage/plugin-techdocs-react';
|
||||
|
||||
// TODO: Export type from plugin-techdocs and import this here
|
||||
// import { ParsedEntityId } from '@backstage/plugin-techdocs'
|
||||
|
||||
@@ -22,6 +22,9 @@ export function createTechDocsAddonExtension<TComponentProps>(
|
||||
// @alpha (undocumented)
|
||||
export const defaultTechDocsReaderPageValue: TechDocsReaderPageValue;
|
||||
|
||||
// @public
|
||||
export type SyncResult = 'cached' | 'updated';
|
||||
|
||||
// @alpha
|
||||
export const TECHDOCS_ADDONS_WRAPPER_KEY = 'techdocs.addons.wrapper.v1';
|
||||
|
||||
@@ -103,6 +106,32 @@ export type TechDocsReaderPageValue = {
|
||||
onReady?: () => void;
|
||||
};
|
||||
|
||||
// @public
|
||||
export interface TechDocsStorageApi {
|
||||
// (undocumented)
|
||||
getApiOrigin(): Promise<string>;
|
||||
// (undocumented)
|
||||
getBaseUrl(
|
||||
oldBaseUrl: string,
|
||||
entityId: CompoundEntityRef,
|
||||
path: string,
|
||||
): Promise<string>;
|
||||
// (undocumented)
|
||||
getBuilder(): Promise<string>;
|
||||
// (undocumented)
|
||||
getEntityDocs(entityId: CompoundEntityRef, path: string): Promise<string>;
|
||||
// (undocumented)
|
||||
getStorageUrl(): Promise<string>;
|
||||
// (undocumented)
|
||||
syncEntityDocs(
|
||||
entityId: CompoundEntityRef,
|
||||
logHandler?: (line: string) => void,
|
||||
): Promise<SyncResult>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export const techdocsStorageApiRef: ApiRef<TechDocsStorageApi>;
|
||||
|
||||
// @alpha
|
||||
export const useShadowRoot: () => ShadowRoot | undefined;
|
||||
|
||||
|
||||
@@ -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',
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -191,7 +191,7 @@ export type ReaderState = {
|
||||
// @public
|
||||
export const Router: () => JSX.Element;
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export type SyncResult = 'cached' | 'updated';
|
||||
|
||||
// @public
|
||||
@@ -394,7 +394,7 @@ export type TechDocsSearchResultListItemProps = {
|
||||
title?: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export interface TechDocsStorageApi {
|
||||
// (undocumented)
|
||||
getApiOrigin(): Promise<string>;
|
||||
@@ -417,7 +417,7 @@ export interface TechDocsStorageApi {
|
||||
): Promise<SyncResult>;
|
||||
}
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export const techdocsStorageApiRef: ApiRef<TechDocsStorageApi>;
|
||||
|
||||
// @public
|
||||
|
||||
@@ -14,7 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { techdocsApiRef, techdocsStorageApiRef } from './api';
|
||||
import {
|
||||
techdocsApiRef,
|
||||
techdocsStorageApiRef,
|
||||
} from '@backstage/plugin-techdocs-react';
|
||||
import { TechDocsClient, TechDocsStorageClient } from './client';
|
||||
import {
|
||||
rootDocsRouteRef,
|
||||
|
||||
@@ -26,7 +26,7 @@ import { useApi, configApiRef } from '@backstage/core-plugin-api';
|
||||
import { SidebarPinStateContext } from '@backstage/core-components';
|
||||
import { scmIntegrationsApiRef } from '@backstage/integration-react';
|
||||
|
||||
import { techdocsStorageApiRef } from '../../../api';
|
||||
import { techdocsStorageApiRef } from '@backstage/plugin-techdocs-react';
|
||||
|
||||
import { useTechDocsReader } from './context';
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import { useApi } from '@backstage/core-plugin-api';
|
||||
import { useMemo, useReducer, useRef } from 'react';
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
import useAsyncRetry from 'react-use/lib/useAsyncRetry';
|
||||
import { techdocsStorageApiRef } from '../../api';
|
||||
import { techdocsStorageApiRef } from '@backstage/plugin-techdocs-react';
|
||||
|
||||
/**
|
||||
* @public
|
||||
|
||||
Reference in New Issue
Block a user