diff --git a/packages/techdocs-common/src/stages/publish/googleStorage.ts b/packages/techdocs-common/src/stages/publish/googleStorage.ts index 5df4f2d886..3449a7e6e3 100644 --- a/packages/techdocs-common/src/stages/publish/googleStorage.ts +++ b/packages/techdocs-common/src/stages/publish/googleStorage.ts @@ -21,7 +21,7 @@ import { Logger } from 'winston'; import { Entity, EntityName } from '@backstage/catalog-model'; import { Config } from '@backstage/config'; import { getHeadersForFileExtension, supportedFileType } from './helpers'; -import { PublisherBase, PublisherBaseParams } from './types'; +import { PublisherBase, PublishRequest } from './types'; export class GoogleGCSPublish implements PublisherBase { static fromConfig(config: Config, logger: Logger): PublisherBase { @@ -82,7 +82,7 @@ export class GoogleGCSPublish implements PublisherBase { * Upload all the files from the generated `directory` to the GCS bucket. * Directory structure used in the bucket is - entityNamespace/entityKind/entityName/index.html */ - publish({ entity, directory }: PublisherBaseParams): Promise<{}> { + publish({ entity, directory }: PublishRequest): Promise<{}> { return new Promise((resolve, reject) => { // Path of all files to upload, relative to the root of the source directory // e.g. ['index.html', 'sub-page/index.html', 'assets/images/favicon.png'] diff --git a/packages/techdocs-common/src/stages/publish/local.ts b/packages/techdocs-common/src/stages/publish/local.ts index 0a75ab6914..7bb670f2d4 100644 --- a/packages/techdocs-common/src/stages/publish/local.ts +++ b/packages/techdocs-common/src/stages/publish/local.ts @@ -23,7 +23,7 @@ import { PluginEndpointDiscovery, } from '@backstage/backend-common'; import { Config } from '@backstage/config'; -import { PublisherBase, PublisherBaseParams } from './types'; +import { PublisherBase, PublishRequest } from './types'; /* `remoteUrl` is the URL which serves files from the local publisher's static directory. */ export type LocalPublishReturn = Promise<{ remoteUrl: string }>; @@ -52,7 +52,7 @@ export class LocalPublish implements PublisherBase { this.discovery = discovery; } - publish({ entity, directory }: PublisherBaseParams): LocalPublishReturn { + publish({ entity, directory }: PublishRequest): LocalPublishReturn { const entityNamespace = entity.metadata.namespace ?? 'default'; const publishDir = resolvePackagePath( diff --git a/packages/techdocs-common/src/stages/publish/types.ts b/packages/techdocs-common/src/stages/publish/types.ts index 6b5c9332a9..fae61241b2 100644 --- a/packages/techdocs-common/src/stages/publish/types.ts +++ b/packages/techdocs-common/src/stages/publish/types.ts @@ -21,13 +21,13 @@ import express from 'express'; */ export type PublisherType = 'local' | 'google_gcs'; -export type PublisherBaseParams = { +export type PublishRequest = { entity: Entity; /* The Path to the directory where the generated files are stored. */ directory: string; }; -export type PublisherBaseReturn = Promise<{}>; +export type PublishResponse = {}; /** * Base class for a TechDocs publisher (e.g. Local, Google GCS Bucket, AWS S3, etc.) @@ -38,10 +38,10 @@ export interface PublisherBase { /** * Store the generated static files onto a storage service (either local filesystem or external service). * - * @param options Object containing the entity from the service + * @param request Object containing the entity from the service * catalog, and the directory that contains the generated static files from TechDocs. */ - publish(options: PublisherBaseParams): PublisherBaseReturn; + publish(request: PublishRequest): Promise; /** * Retrieve TechDocs Metadata about a site e.g. name, contributors, last updated, etc.