/
interfaces.ts
75 lines (64 loc) · 2.26 KB
/
interfaces.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import {
ExecutionConfig,
Context,
OpConfig,
APIConfig,
WorkerContext
} from '../interfaces';
import FetcherCore from './core/fetcher-core';
import SchemaCore, { OpType } from './core/schema-core';
import SlicerCore from './core/slicer-core';
import APICore from './core/api-core';
import ProcessorCore from './core/processor-core';
import Slicer from './slicer';
import ParallelSlicer from './parallel-slicer';
import OperationAPI from './operation-api';
export type APICoreConstructor<U> = {
new (context: WorkerContext, apiConfig: APIConfig, executionConfig: ExecutionConfig): U;
};
export type OperationCoreConstructor<U> = {
new <T = OpConfig>(
context: WorkerContext,
opConfig: OpConfig & T,
executionConfig: ExecutionConfig
): U;
};
export type SlicerCoreConstructor<U> = {
new <T = OpConfig>(
context: WorkerContext,
opConfig: OpConfig & T,
executionConfig: ExecutionConfig
): U;
};
export type SchemaConstructor<T = any> = {
type(): string;
new (context: Context, opType?: OpType): SchemaCore<T>;
};
export type OperationAPIConstructor = APICoreConstructor<OperationAPI>;
export type ObserverConstructor = APICoreConstructor<APICore>;
export type APIConstructor = APICoreConstructor<APICore>;
export type SlicerConstructor = SlicerCoreConstructor<SlicerCore>;
export type SingleSlicerConstructor = SlicerCoreConstructor<Slicer>;
export type ParallelSlicerConstructor = SlicerCoreConstructor<ParallelSlicer>;
export type FetcherConstructor = OperationCoreConstructor<FetcherCore>;
export type ProcessorConstructor = OperationCoreConstructor<ProcessorCore>;
export type CoreOperation = FetcherCore | SlicerCore | ProcessorCore;
export interface OperationModule {
Schema: SchemaConstructor;
API?: OperationAPIConstructor;
}
export interface SchemaModule {
Schema: SchemaConstructor;
}
export type OperationAPIType = 'api' | 'observer';
export interface APIModule extends SchemaModule {
API: OperationAPIConstructor | ObserverConstructor;
type: OperationAPIType;
}
export interface ReaderModule extends OperationModule {
Slicer: SlicerConstructor;
Fetcher: FetcherConstructor;
}
export interface ProcessorModule extends OperationModule {
Processor: ProcessorConstructor;
}