-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathglobals.d.ts
More file actions
241 lines (202 loc) · 5.31 KB
/
globals.d.ts
File metadata and controls
241 lines (202 loc) · 5.31 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
type Definition = import('sequential-workflow-model').Definition;
type Step = import('sequential-workflow-model').Step;
type BranchedStep = import('sequential-workflow-model').BranchedStep;
type SequentialStep = import('sequential-workflow-model').SequentialStep;
type DefinitionWalker = import('sequential-workflow-model').DefinitionWalker;
type WorkflowMachineSnapshot =
import('sequential-workflow-machine').WorkflowMachineSnapshot;
type BranchNameResult = import('sequential-workflow-machine').BranchNameResult;
type RootEditorProvider =
import('sequential-workflow-designer').RootEditorProvider;
type StepEditorProvider =
import('sequential-workflow-designer').StepEditorProvider;
type SourceUnit = import('solc-typed-ast').SourceUnit;
type ASTNode = import('solc-typed-ast').ASTNode;
type SourceUnit = import('solc-typed-ast').SourceUnit;
type ASTNodeWithChildren = import('solc-typed-ast').ASTNodeWithChildren;
type TypeName = import('solc-typed-ast').TypeName;
type ContractDefinition = import('solc-typed-ast').ContractDefinition;
type FunctionDefinition = import('solc-typed-ast').FunctionDefinition;
type LiteralKind = import('solc-typed-ast').LiteralKind;
type ASTNodeFactory = import('solc-typed-ast').ASTNodeFactory;
type Identifier = import('solc-typed-ast').Identifier;
type MemberAccess = import('solc-typed-ast').MemberAccess;
type IndexAccess = import('solc-typed-ast').IndexAccess;
type Literal = import('solc-typed-ast').Literal;
type Block = import('solc-typed-ast').Block;
///// Common
type TClass<T = any> = new (...args: any[]) => T;
///// Root
interface MyDefinition extends Definition {
properties: {
name: 'string';
};
}
type ValueTypeName =
| 'boolean'
| 'string'
| 'address'
| 'uint256'
| 'mapping(address => uint256)';
interface NestedVariableValue {
propertyType: 'nested';
path: string[];
}
interface VariableValue {
propertyType: 'variable';
name: string;
}
interface MappingAccessValue extends VariableValue {
propertyType: 'mapping';
key: DynamicValue;
}
interface LiteralValue {
propertyType: 'literal';
type: ValueTypeName;
value: string;
}
interface StringValue {
propertyType: 'string';
value: string;
options?: string[] | Record<string, string>;
}
interface TypeValue {
propertyType: 'type';
value: ValueTypeName;
}
type DynamicValue =
| VariableValue
| NestedVariableValue
| MappingAccessValue
| LiteralValue;
///// Services
interface IVariableService {
define(name: string, type: ValueTypeName): void;
typeOf(name: string): ValueTypeName;
get(name: String): any;
resolve(input: DynamicValue): any;
set(input: string | VariableValue | MappingAccessValue, value: any): void;
isSet(name: string): boolean;
delete(name: string): void;
format(pattern: String): string;
}
///// State
type VariableState = Record<string, any>;
interface GlobalState {
startTime: Date;
// state: VariableState;
$variables: IVariableService;
$logger: LoggerService;
}
interface LoopActivityState {
indexVariableName: string;
}
///// Steps
interface LogStep extends Step {
type: 'log';
componentType: 'task';
properties: {
message: string;
};
}
interface CalculateStep extends Step {
type: 'calculate';
componentType: 'task';
properties: {
left: DynamicValue;
operator: StringValue;
right: DynamicValue;
result: VariableValue | MappingAccessValue;
};
}
// interface MappingGetValueStep extends Step {
// type: 'mappingGetValue';
// componentType: 'task';
// properties: {
// mapping: string;
// key: string;
// result: string;
// };
// }
// interface MappingSetValueStep extends Step {
// type: 'mappingSetValue';
// componentType: 'task';
// properties: {
// mapping: string;
// key: string;
// value: string;
// };
// }
interface IfStep extends BranchedStep {
type: 'if';
componentType: 'switch';
properties: {
left: DynamicValue;
operator: StringValue;
right: DynamicValue;
};
}
interface LoopStep extends SequentialStep {
type: 'loop';
componentType: 'container';
properties: {
from: DynamicValue;
to: DynamicValue;
increment: DynamicValue;
operator: string;
indexVariable: string;
variables: string;
};
}
interface ConvertValueStep extends Step {
type: 'convertValue';
componentType: 'task';
properties: {
source: DynamicValue;
target: string;
};
}
interface FunctionsStep extends BranchedStep {
type: 'functions';
componentType: 'switch';
properties: {};
}
interface VariableStep extends Step {
type: 'variable';
componentType: 'task';
properties: {
name: string;
type: TypeValue;
// defaultValue: string;
};
}
interface ArgumentStep extends Step {
type: 'argument';
componentType: 'task';
properties: {
name: string;
type: TypeValue;
// defaultValue: string;
};
}
interface ReturnStep extends Step {
type: 'return';
componentType: 'task';
properties: {
result: DynamicValue;
type: TypeValue;
};
}
///// Compilers
interface AbstractCompiler {
units(definition: MyDefinition): [SourceUnit];
compile(definition: MyDefinition): Promise<string>;
}
interface RootResolver {
resolve(definition: MyDefinition): SourceUnit;
}
interface StepResolver {
resolve(step: Step, index: number, parent: ASTNodeWithChildren);
}
///// Miscellaneous
type RawInputData = Record<string, string>;