Tweak Collator/Decorator to be classes instead of methods

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Anders Näsman
2021-03-17 10:53:52 +01:00
committed by Eric Peterson
parent 124b93bff4
commit 51fc8de48c
6 changed files with 78 additions and 53 deletions
+10 -8
View File
@@ -62,15 +62,17 @@ export interface IndexableDocument {
}
/**
* Signature for the callback function that implementors must register to have
* their documents indexed.
* Interface that must be implemented in order to expose new documents to
* search.
*/
export type IndexableDocumentCollator = () => Promise<IndexableDocument[]>;
export interface DocumentCollator {
execute(): Promise<IndexableDocument[]>;
}
/**
* Signature for the callback function that implementors must register to
* decorate existing documents with additional metadata.
* Interface that must be implemented in order to decorate existing documents with
* additional metadata.
*/
export type IndexableDocumentDecorator = (
documents: IndexableDocument[],
) => Promise<IndexableDocument[]>;
export interface DocumentDecorator {
execute(documents: IndexableDocument[]): Promise<IndexableDocument[]>;
}