diff --git a/packages/techdocs-common/src/stages/publish/types.ts b/packages/techdocs-common/src/stages/publish/types.ts index f68cb9cc8f..ab497067b3 100644 --- a/packages/techdocs-common/src/stages/publish/types.ts +++ b/packages/techdocs-common/src/stages/publish/types.ts @@ -32,13 +32,19 @@ export type PublishRequest = { directory: string; }; -/* `remoteUrl` is the URL which serves files from the local publisher's static directory. */ +/** + * Response containing metadata about where files were published and what may + * have been published or updated. + */ export type PublishResponse = { + /** + * The URL which serves files from the local publisher's static directory. + */ remoteUrl?: string; /** * The list of objects (specifically their paths) that were published. - * Objects should not have a preceding slash, and should match how one would - * load the object over the `/static/docs/` TechDocs Backend Plugin endpoint. + * Objects do not have a preceding slash, and match how one would load the + * object over the `/static/docs/*` TechDocs Backend Plugin endpoint. */ objects?: string[]; } | void; diff --git a/plugins/techdocs-backend/src/DocsBuilder/builder.ts b/plugins/techdocs-backend/src/DocsBuilder/builder.ts index 4843acf2c2..1d725bd69e 100644 --- a/plugins/techdocs-backend/src/DocsBuilder/builder.ts +++ b/plugins/techdocs-backend/src/DocsBuilder/builder.ts @@ -221,7 +221,7 @@ export class DocsBuilder { }); // Invalidate the cache for any published objects. - if (this.cache && published?.objects?.length) { + if (this.cache && published && published?.objects?.length) { await this.cache.invalidateMultiple(published.objects); } diff --git a/plugins/techdocs-backend/src/cache/cacheMiddleware.ts b/plugins/techdocs-backend/src/cache/cacheMiddleware.ts index 2abbb24cf3..2650b39296 100644 --- a/plugins/techdocs-backend/src/cache/cacheMiddleware.ts +++ b/plugins/techdocs-backend/src/cache/cacheMiddleware.ts @@ -100,7 +100,7 @@ export const createCacheMiddleware = ({ // Monkey-patch the response's socket to keep track of chunks as they are // written over the wire. socket.write = ( - data, + data: string | Uint8Array, encoding?: BufferEncoding | ErrorCallback, callback?: ErrorCallback, ) => {