Improve types/documentation.

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2021-07-06 10:14:00 +02:00
committed by Eric Peterson
parent 5fe0c2ce78
commit 790f02c898
3 changed files with 11 additions and 5 deletions
@@ -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;
@@ -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);
}
+1 -1
View File
@@ -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,
) => {