-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathtypes.ts
32 lines (28 loc) · 904 Bytes
/
types.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
28
29
30
31
32
import { Filter } from '@directus/shared/types';
export type ExtensionConfig = {
server: IndexerConfig;
batchLimit?: number;
collections: Record<string, CollectionConfig>;
};
export type CollectionConfig = {
collection?: string;
collectionName?: string;
collectionField?: string;
indexName?: string;
fields?: string[];
filter?: Filter;
transform?: (input: object, utils: Record<string, Function>, collectionName: string) => object;
};
export type IndexerConfig = {
type: string;
appId?: string;
key?: string;
host?: string;
headers?: Record<string, string>;
};
export type IndexerInterface = (config: IndexerConfig) => {
createIndex: (collection: string) => Promise<void>;
deleteItems: (collection: string) => Promise<void>;
deleteItem: (collection: string, id: string) => Promise<void>;
updateItem: (collection: string, id: string, data: object, pk?: string) => Promise<void>;
};