@@ -183,11 +183,15 @@ export class Preparers implements PreparerBuilder {
|
||||
}
|
||||
|
||||
// @public
|
||||
export class Publisher {
|
||||
export class Publisher implements PublisherBuilder {
|
||||
static fromConfig(
|
||||
config: Config,
|
||||
options: PublisherFactory,
|
||||
): Promise<PublisherBase>;
|
||||
// (undocumented)
|
||||
get(config: Config): PublisherBase;
|
||||
// (undocumented)
|
||||
register(type: PublisherType | 'techdocs', publisher: PublisherBase): void;
|
||||
}
|
||||
|
||||
// @public
|
||||
@@ -202,10 +206,17 @@ export interface PublisherBase {
|
||||
publish(request: PublishRequest): Promise<PublishResponse>;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type PublisherBuilder = {
|
||||
register(type: PublisherType, publisher: PublisherBase): void;
|
||||
get(config: Config): PublisherBase;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type PublisherFactory = {
|
||||
logger: Logger;
|
||||
discovery: PluginEndpointDiscovery;
|
||||
customPublisher?: PublisherBase | undefined;
|
||||
};
|
||||
|
||||
// @public
|
||||
@@ -303,6 +314,15 @@ export interface TechdocsPreparerExtensionPoint {
|
||||
// @public
|
||||
export const techdocsPreparerExtensionPoint: ExtensionPoint<TechdocsPreparerExtensionPoint>;
|
||||
|
||||
// @public
|
||||
export interface TechdocsPublisherExtensionPoint {
|
||||
// (undocumented)
|
||||
registerPublisher(type: PublisherType, publisher: PublisherBase): void;
|
||||
}
|
||||
|
||||
// @public
|
||||
export const techdocsPublisherExtensionPoint: ExtensionPoint<TechdocsPublisherExtensionPoint>;
|
||||
|
||||
// @public
|
||||
export const transformDirLocation: (
|
||||
entity: Entity,
|
||||
|
||||
@@ -23,4 +23,5 @@ export type {
|
||||
MigrateRequest,
|
||||
ReadinessResponse,
|
||||
TechDocsMetadata,
|
||||
PublisherBuilder,
|
||||
} from './types';
|
||||
|
||||
@@ -32,13 +32,11 @@ import {
|
||||
* Uses `techdocs.publisher.type`.
|
||||
* @public
|
||||
*/
|
||||
|
||||
type CustomPublisherType = PublisherType | 'techdocs';
|
||||
|
||||
export class Publisher implements PublisherBuilder {
|
||||
private publishers: Map<CustomPublisherType, PublisherBase> = new Map();
|
||||
private publishers: Map<PublisherType | 'techdocs', PublisherBase> =
|
||||
new Map();
|
||||
|
||||
register(type: CustomPublisherType, publisher: PublisherBase): void {
|
||||
register(type: PublisherType | 'techdocs', publisher: PublisherBase): void {
|
||||
this.publishers.set(type, publisher);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user