-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
base.ts
27 lines (25 loc) · 1.05 KB
/
base.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { Callbacks } from "../../callbacks/manager.js";
import { DocumentInterface } from "../../documents/document.js";
/**
* Base Document Compression class. All compressors should extend this class.
*/
export abstract class BaseDocumentCompressor {
/**
* Abstract method that must be implemented by any class that extends
* `BaseDocumentCompressor`. This method takes an array of `Document`
* objects and a query string as parameters and returns a Promise that
* resolves with an array of compressed `Document` objects.
* @param documents An array of `Document` objects to be compressed.
* @param query A query string.
* @returns A Promise that resolves with an array of compressed `Document` objects.
*/
abstract compressDocuments(
documents: DocumentInterface[],
query: string,
callbacks?: Callbacks
): Promise<DocumentInterface[]>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isBaseDocumentCompressor(x: any): x is BaseDocumentCompressor {
return x?.compressDocuments !== undefined;
}
}