-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.js
86 lines (68 loc) · 2.03 KB
/
types.js
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
76
77
78
79
80
81
82
83
84
85
86
// @flow
/* eslint-disable no-use-before-define, import/exports-last */
type QueryChildrenType = {
+[key: string]: DenormalizedQueryType,
...,
};
type QueryInstructionType = string;
// eslint-disable-next-line flowtype/no-weak-types
export type InlineSubroutineType = (subject: any, bindle: BindleType) => any;
export type OperatorType = 'PIPELINE' | 'AGGREGATE_PIPELINE';
export type DenormalizedQueryType =
QueryInstructionType |
QueryChildrenType |
$ReadOnlyArray<DenormalizedQueryType> |
InlineSubroutineType;
export type InlineSubroutineInstructionType = {|
+inlineSubroutine: InlineSubroutineType,
+type: 'INLINE_SUBROUTINE',
|};
export type SubroutineInstructionType = {|
+subroutine: string,
+type: 'SUBROUTINE',
+values: $ReadOnlyArray<string>,
|};
export type OperatorInstructionType = {|
+operator: OperatorType,
+type: 'OPERATOR',
|};
export type MergeAdoptionInstructionType = {|
+margeChildren: QueryType,
+type: 'MERGE_ADOPTION',
|};
export type NamedAdoptionInstructionType = {|
+namedChildren: {
+[key: string]: QueryType,
...,
},
+type: 'NAMED_ADOPTION',
|};
export type InstructionType =
MergeAdoptionInstructionType |
NamedAdoptionInstructionType |
SubroutineInstructionType |
OperatorInstructionType |
InlineSubroutineInstructionType;
export type QueryType = $ReadOnlyArray<InstructionType>;
// eslint-disable-next-line flowtype/no-weak-types
type BindleType = Object;
// eslint-disable-next-line flowtype/no-weak-types
export type SubroutineType = (subject: any, values: $ReadOnlyArray<string>, bindle: BindleType) => any;
// eslint-disable-next-line flowtype/no-weak-types
export type ResultHandlerType = (output: any, input: any) => void;
export type UserConfigurationType = {|
+bindle?: BindleType,
+handleResult?: ResultHandlerType,
+subroutines: {
+[key: string]: SubroutineType,
...,
},
|};
export type ConfigurationType = {|
+bindle: BindleType,
+handleResult?: ResultHandlerType,
+subroutines: {
+[key: string]: SubroutineType,
...,
},
|};