@useparagon/core 0.0.1-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +63 -0
- package/src/event/event.interface.ts +18 -0
- package/src/event/index.ts +1 -0
- package/src/execution/context.constants.ts +9 -0
- package/src/execution/context.interface.ts +39 -0
- package/src/execution/context.ts +72 -0
- package/src/execution/context.utils.ts +53 -0
- package/src/execution/index.ts +2 -0
- package/src/index.ts +6 -0
- package/src/integration/custom-integration.interface.ts +20 -0
- package/src/integration/index.ts +2 -0
- package/src/integration/integration-config.interface.ts +19 -0
- package/src/integration/integration.interface.ts +16 -0
- package/src/operator/index.ts +2 -0
- package/src/operator/operator.interface.ts +6 -0
- package/src/operator/operators/BooleanTrue.ts +20 -0
- package/src/operator/operators/StringContains.ts +27 -0
- package/src/resolvers/index.ts +2 -0
- package/src/resolvers/resolver.utils.ts +157 -0
- package/src/resolvers/resolvers.interface.ts +369 -0
- package/src/secret/index.ts +1 -0
- package/src/secret/secret.interface.ts +4 -0
- package/src/stateMachine/index.ts +2 -0
- package/src/stateMachine/stateMachine.constants.ts +12 -0
- package/src/stateMachine/stateMachine.interface.ts +145 -0
- package/src/stateMachine/stateMachine.utils.ts +733 -0
- package/src/steps/index.ts +3 -0
- package/src/steps/library/action/action.interface.ts +69 -0
- package/src/steps/library/action/action.step.ts +70 -0
- package/src/steps/library/action/index.ts +2 -0
- package/src/steps/library/conditional/conditional.interface.ts +82 -0
- package/src/steps/library/conditional/conditional.step.ts +96 -0
- package/src/steps/library/conditional/conditional.utils.ts +110 -0
- package/src/steps/library/conditional/index.ts +2 -0
- package/src/steps/library/delay/delay.interface.ts +71 -0
- package/src/steps/library/delay/delay.step.ts +51 -0
- package/src/steps/library/delay/index.ts +2 -0
- package/src/steps/library/fanout/fanout.interface.ts +46 -0
- package/src/steps/library/fanout/fanout.step.ts +68 -0
- package/src/steps/library/fanout/index.ts +2 -0
- package/src/steps/library/function/function.interface.ts +69 -0
- package/src/steps/library/function/function.step.ts +55 -0
- package/src/steps/library/function/index.ts +2 -0
- package/src/steps/library/index.ts +7 -0
- package/src/steps/library/integrationRequest/index.ts +2 -0
- package/src/steps/library/integrationRequest/integrationRequest.interface.ts +79 -0
- package/src/steps/library/integrationRequest/integrationRequest.step.ts +100 -0
- package/src/steps/library/request/index.ts +2 -0
- package/src/steps/library/request/request.interface.ts +159 -0
- package/src/steps/library/request/request.step.ts +117 -0
- package/src/steps/library/response/index.ts +2 -0
- package/src/steps/library/response/response.interface.ts +50 -0
- package/src/steps/library/response/response.step.ts +68 -0
- package/src/steps/step.constants.ts +4 -0
- package/src/steps/step.interface-base.ts +81 -0
- package/src/steps/step.interface.ts +31 -0
- package/src/steps/step.ts +136 -0
- package/src/steps/step.utils.ts +103 -0
- package/src/triggers/cron/cron.interface.ts +94 -0
- package/src/triggers/cron/cron.step.ts +52 -0
- package/src/triggers/cron/cron.utils.ts +117 -0
- package/src/triggers/cron/index.ts +3 -0
- package/src/triggers/endpoint/endpoint.interface.ts +66 -0
- package/src/triggers/endpoint/endpoint.step.ts +61 -0
- package/src/triggers/endpoint/index.ts +2 -0
- package/src/triggers/event/event.interface.ts +43 -0
- package/src/triggers/event/event.step.ts +41 -0
- package/src/triggers/event/index.ts +2 -0
- package/src/triggers/index.ts +4 -0
- package/src/triggers/integrationEnabled/index.ts +2 -0
- package/src/triggers/integrationEnabled/integrationEnabled.interface.ts +29 -0
- package/src/triggers/integrationEnabled/integrationEnabled.step.ts +33 -0
- package/src/triggers/trigger.interface.ts +28 -0
- package/src/triggers/trigger.ts +25 -0
- package/src/user/index.ts +2 -0
- package/src/user/user.interface.ts +4 -0
- package/src/user/user.ts +6 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/utils.ts +10 -0
- package/src/workflow/index.ts +2 -0
- package/src/workflow/workflow.interface.ts +50 -0
- package/src/workflow/workflow.ts +132 -0
- package/tsconfig.json +9 -0
- package/tsconfig.release.json +8 -0
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* supported data types
|
|
3
|
+
*/
|
|
4
|
+
export enum DataType {
|
|
5
|
+
STRING = 'STRING',
|
|
6
|
+
NUMBER = 'NUMBER',
|
|
7
|
+
DATE = 'DATE',
|
|
8
|
+
BOOLEAN = 'BOOLEAN',
|
|
9
|
+
EMAIL = 'EMAIL',
|
|
10
|
+
OBJECT = 'OBJECT',
|
|
11
|
+
ARRAY = 'ARRAY',
|
|
12
|
+
ANY = 'ANY',
|
|
13
|
+
FILE = 'FILE',
|
|
14
|
+
NON_DECIMAL = 'NON_DECIMAL',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* data type for files
|
|
19
|
+
*/
|
|
20
|
+
type FileDataType = Buffer;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* portable data type for files with associated metadata
|
|
24
|
+
*/
|
|
25
|
+
export type FileValue = {
|
|
26
|
+
data: FileDataType;
|
|
27
|
+
dataType: DataType.FILE;
|
|
28
|
+
encoding?: string;
|
|
29
|
+
id?: string;
|
|
30
|
+
mimeType?: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
size?: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* supported data type mappings
|
|
37
|
+
*/
|
|
38
|
+
export type DataTypeValues = {
|
|
39
|
+
[DataType.STRING]: string;
|
|
40
|
+
[DataType.NUMBER]: number;
|
|
41
|
+
[DataType.DATE]: Date;
|
|
42
|
+
[DataType.BOOLEAN]: boolean;
|
|
43
|
+
[DataType.EMAIL]: string;
|
|
44
|
+
[DataType.OBJECT]: object;
|
|
45
|
+
[DataType.ARRAY]: any[];
|
|
46
|
+
[DataType.ANY]: any;
|
|
47
|
+
[DataType.FILE]: FileValue;
|
|
48
|
+
[DataType.NON_DECIMAL]: number;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* a static value
|
|
53
|
+
*/
|
|
54
|
+
export type ValueSource<T extends DataType = DataType> = {
|
|
55
|
+
dataType?: T;
|
|
56
|
+
type: 'VALUE';
|
|
57
|
+
value: DataTypeValues[T];
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* different strategies for fanning in variables within an execution
|
|
62
|
+
*/
|
|
63
|
+
export enum FanInStrategy {
|
|
64
|
+
SINGLE = 'SINGLE',
|
|
65
|
+
SINGLE_BY_FANOUT = 'SINGLE_BY_FANOUT',
|
|
66
|
+
MULTI = 'MULTI',
|
|
67
|
+
MULTI_BY_FANOUT = 'MULTI_BY_FANOUT',
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* a dynamic value determined at runtime
|
|
72
|
+
*/
|
|
73
|
+
export type VariableSource<T extends DataType = DataType> = {
|
|
74
|
+
dataType?: T;
|
|
75
|
+
type: 'VARIABLE';
|
|
76
|
+
stepId: string;
|
|
77
|
+
path: string[];
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* a reference to an environment secret
|
|
82
|
+
*/
|
|
83
|
+
export type SecretSource = {
|
|
84
|
+
type: 'ENVIRONMENT_SECRET';
|
|
85
|
+
environmentSecretId: string;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* a reference to a value generated during an execution
|
|
90
|
+
*
|
|
91
|
+
* @deprecated
|
|
92
|
+
* @todo remove deprecated execution source
|
|
93
|
+
*/
|
|
94
|
+
export type DeprecatedExecutionSource = {
|
|
95
|
+
type: 'CACHED_EXECUTION';
|
|
96
|
+
cachedEntryId: string;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* a value composed of 0 or more static or dynamic values used to build a string
|
|
101
|
+
*/
|
|
102
|
+
export type TokenizedValue<T extends DataType = DataType> =
|
|
103
|
+
| ValueSource<T>
|
|
104
|
+
| VariableSource<T>
|
|
105
|
+
| SecretSource;
|
|
106
|
+
// | ConnectCredentialSource
|
|
107
|
+
// | PersonaMetadataSource;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* a reference to 0 or more static or dynamic values
|
|
111
|
+
*/
|
|
112
|
+
export type TokenizedSource<T extends DataType = DataType> = {
|
|
113
|
+
dataType?: T;
|
|
114
|
+
type: 'TOKENIZED';
|
|
115
|
+
parts: TokenizedValue[];
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* a reference to a condition
|
|
120
|
+
*/
|
|
121
|
+
export type ConditionSource = {
|
|
122
|
+
type: 'CONDITION';
|
|
123
|
+
condition: ConditionWrapper;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* a reference to a user's credential
|
|
128
|
+
*
|
|
129
|
+
* @todo uncomment
|
|
130
|
+
*/
|
|
131
|
+
// export type UserSuppliedCredentialSource = {
|
|
132
|
+
// type: 'USER_SUPPLIED_CREDENTIAL';
|
|
133
|
+
// tokenType: TokenType;
|
|
134
|
+
// providerType: ProviderType;
|
|
135
|
+
// credential: TokenizedSource<DataType.STRING>;
|
|
136
|
+
// };
|
|
137
|
+
|
|
138
|
+
export type Source<T extends DataType = DataType> =
|
|
139
|
+
| ValueSource<T>
|
|
140
|
+
| VariableSource<T>
|
|
141
|
+
| TokenizedSource<T>
|
|
142
|
+
| ConditionSource
|
|
143
|
+
| SecretSource
|
|
144
|
+
| DeprecatedExecutionSource;
|
|
145
|
+
// | ExecutionSource
|
|
146
|
+
// | FanoutExecutionSource
|
|
147
|
+
// | UserSuppliedCredentialSource
|
|
148
|
+
// | ConnectCredentialSource
|
|
149
|
+
// | PersonaMetadataSource;
|
|
150
|
+
|
|
151
|
+
export type KeyedSource<T extends DataType = DataType> = {
|
|
152
|
+
key: string;
|
|
153
|
+
source: Source<T>;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export enum Operator {
|
|
157
|
+
'None' = '$none',
|
|
158
|
+
'StringContains' = '$stringContains',
|
|
159
|
+
'StringDoesNotContain' = '$stringDoesNotContain',
|
|
160
|
+
'StringExactlyMatches' = '$stringExactlyMatches',
|
|
161
|
+
'StringDoesNotExactlyMatch' = '$stringDoesNotExactlyMatch',
|
|
162
|
+
'StringIsIn' = '$stringIsIn',
|
|
163
|
+
'StringIsNotIn' = '$stringIsNotIn',
|
|
164
|
+
'StringStartsWith' = '$stringStartsWith',
|
|
165
|
+
'StringDoesNotStartWith' = '$stringDoesNotStartWith',
|
|
166
|
+
'StringEndsWith' = '$stringEndsWith',
|
|
167
|
+
'StringDoesNotEndWith' = '$stringDoesNotEndWith',
|
|
168
|
+
'NumberGreaterThan' = '$numberGreaterThan',
|
|
169
|
+
'NumberLessThan' = '$numberLessThan',
|
|
170
|
+
'NumberEquals' = '$numberEquals',
|
|
171
|
+
'NumberDoesNotEqual' = '$numberDoesNotEqual',
|
|
172
|
+
'NumberLessThanOrEqualTo' = '$numberLessThanOrEqualTo',
|
|
173
|
+
'NumberGreaterThanOrEqualTo' = '$numberGreaterThanOrEqualTo',
|
|
174
|
+
'DateTimeAfter' = '$dateTimeAfter',
|
|
175
|
+
'DateTimeBefore' = '$dateTimeBefore',
|
|
176
|
+
'DateTimeEquals' = '$dateTimeEquals',
|
|
177
|
+
'BooleanTrue' = '$booleanTrue',
|
|
178
|
+
'BooleanFalse' = '$booleanFalse',
|
|
179
|
+
/** (PARA-5551) previously operators for Does Exist / Does Not Exist do a strict check for equality to null, resulting in a bug where value is undefined
|
|
180
|
+
* to handle this situation, we are adding 2 new operators IsNotNull and IsNull and changing functionality of
|
|
181
|
+
* Exist and DoesNotExist operators to handle undefined values
|
|
182
|
+
*/
|
|
183
|
+
'IsNotNull' = '$exists',
|
|
184
|
+
'IsNull' = '$doesNotExist',
|
|
185
|
+
'Exists' = '$isNotUndefinedOrNull',
|
|
186
|
+
'DoesNotExist' = '$isUndefinedOrNull',
|
|
187
|
+
'ArrayIsIn' = '$arrayIsIn',
|
|
188
|
+
'ArrayIsNotIn' = '$arrayIsNotIn',
|
|
189
|
+
'ArrayIsEmpty' = '$arrayIsEmpty',
|
|
190
|
+
'ArrayIsNotEmpty' = '$arrayIsNotEmpty',
|
|
191
|
+
'StringGreaterThan' = '$stringGreaterThan',
|
|
192
|
+
'StringLessThan' = '$stringLessThan',
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* used to determine boolean logic
|
|
197
|
+
*/
|
|
198
|
+
export type Condition =
|
|
199
|
+
| {
|
|
200
|
+
operator: Operator.None;
|
|
201
|
+
variable: Source<DataType.ANY>;
|
|
202
|
+
}
|
|
203
|
+
| {
|
|
204
|
+
operator: Operator.StringContains;
|
|
205
|
+
variable: Source<DataType.STRING>;
|
|
206
|
+
argument: Source<DataType.STRING>;
|
|
207
|
+
}
|
|
208
|
+
| {
|
|
209
|
+
operator: Operator.StringDoesNotContain;
|
|
210
|
+
variable: Source<DataType.STRING>;
|
|
211
|
+
argument: Source<DataType.STRING>;
|
|
212
|
+
}
|
|
213
|
+
| {
|
|
214
|
+
operator: Operator.StringExactlyMatches;
|
|
215
|
+
variable: Source<DataType.STRING>;
|
|
216
|
+
argument: Source<DataType.STRING>;
|
|
217
|
+
}
|
|
218
|
+
| {
|
|
219
|
+
operator: Operator.StringDoesNotExactlyMatch;
|
|
220
|
+
variable: Source<DataType.STRING>;
|
|
221
|
+
argument: Source<DataType.STRING>;
|
|
222
|
+
}
|
|
223
|
+
| {
|
|
224
|
+
operator: Operator.StringIsIn;
|
|
225
|
+
variable: Source<DataType.STRING>;
|
|
226
|
+
argument: Source<DataType.STRING>;
|
|
227
|
+
}
|
|
228
|
+
| {
|
|
229
|
+
operator: Operator.StringIsNotIn;
|
|
230
|
+
variable: Source<DataType.STRING>;
|
|
231
|
+
argument: Source<DataType.STRING>;
|
|
232
|
+
}
|
|
233
|
+
| {
|
|
234
|
+
operator: Operator.StringStartsWith;
|
|
235
|
+
variable: Source<DataType.STRING>;
|
|
236
|
+
argument: Source<DataType.STRING>;
|
|
237
|
+
}
|
|
238
|
+
| {
|
|
239
|
+
operator: Operator.StringDoesNotStartWith;
|
|
240
|
+
variable: Source<DataType.STRING>;
|
|
241
|
+
argument: Source<DataType.STRING>;
|
|
242
|
+
}
|
|
243
|
+
| {
|
|
244
|
+
operator: Operator.StringEndsWith;
|
|
245
|
+
variable: Source<DataType.STRING>;
|
|
246
|
+
argument: Source<DataType.STRING>;
|
|
247
|
+
}
|
|
248
|
+
| {
|
|
249
|
+
operator: Operator.StringDoesNotEndWith;
|
|
250
|
+
variable: Source<DataType.STRING>;
|
|
251
|
+
argument: Source<DataType.STRING>;
|
|
252
|
+
}
|
|
253
|
+
| {
|
|
254
|
+
operator: Operator.NumberGreaterThan;
|
|
255
|
+
variable: Source<DataType.NUMBER>;
|
|
256
|
+
argument: Source<DataType.NUMBER>;
|
|
257
|
+
}
|
|
258
|
+
| {
|
|
259
|
+
operator: Operator.NumberLessThan;
|
|
260
|
+
variable: Source<DataType.NUMBER>;
|
|
261
|
+
argument: Source<DataType.NUMBER>;
|
|
262
|
+
}
|
|
263
|
+
| {
|
|
264
|
+
operator: Operator.NumberGreaterThanOrEqualTo;
|
|
265
|
+
variable: Source<DataType.NUMBER>;
|
|
266
|
+
argument: Source<DataType.NUMBER>;
|
|
267
|
+
}
|
|
268
|
+
| {
|
|
269
|
+
operator: Operator.NumberLessThanOrEqualTo;
|
|
270
|
+
variable: Source<DataType.NUMBER>;
|
|
271
|
+
argument: Source<DataType.NUMBER>;
|
|
272
|
+
}
|
|
273
|
+
| {
|
|
274
|
+
operator: Operator.NumberEquals;
|
|
275
|
+
variable: Source<DataType.NUMBER>;
|
|
276
|
+
argument: Source<DataType.NUMBER>;
|
|
277
|
+
}
|
|
278
|
+
| {
|
|
279
|
+
operator: Operator.NumberDoesNotEqual;
|
|
280
|
+
variable: Source<DataType.NUMBER>;
|
|
281
|
+
argument: Source<DataType.NUMBER>;
|
|
282
|
+
}
|
|
283
|
+
| {
|
|
284
|
+
operator: Operator.DateTimeAfter;
|
|
285
|
+
variable: Source<DataType.DATE>;
|
|
286
|
+
argument: Source<DataType.DATE>;
|
|
287
|
+
}
|
|
288
|
+
| {
|
|
289
|
+
operator: Operator.DateTimeBefore;
|
|
290
|
+
variable: Source<DataType.DATE>;
|
|
291
|
+
argument: Source<DataType.DATE>;
|
|
292
|
+
}
|
|
293
|
+
| {
|
|
294
|
+
operator: Operator.DateTimeEquals;
|
|
295
|
+
variable: Source<DataType.DATE>;
|
|
296
|
+
argument: Source<DataType.DATE>;
|
|
297
|
+
}
|
|
298
|
+
| {
|
|
299
|
+
operator: Operator.BooleanTrue;
|
|
300
|
+
variable: Source<DataType.BOOLEAN>;
|
|
301
|
+
}
|
|
302
|
+
| {
|
|
303
|
+
operator: Operator.BooleanFalse;
|
|
304
|
+
variable: Source<DataType.BOOLEAN>;
|
|
305
|
+
}
|
|
306
|
+
| { operator: Operator.IsNull; variable: Source }
|
|
307
|
+
| {
|
|
308
|
+
operator: Operator.IsNotNull;
|
|
309
|
+
variable: Source;
|
|
310
|
+
}
|
|
311
|
+
| { operator: Operator.Exists; variable: Source }
|
|
312
|
+
| {
|
|
313
|
+
operator: Operator.DoesNotExist;
|
|
314
|
+
variable: Source;
|
|
315
|
+
}
|
|
316
|
+
| {
|
|
317
|
+
operator: Operator.ArrayIsEmpty;
|
|
318
|
+
variable: Source<DataType.ARRAY>;
|
|
319
|
+
}
|
|
320
|
+
| {
|
|
321
|
+
operator: Operator.ArrayIsNotEmpty;
|
|
322
|
+
variable: Source<DataType.ARRAY>;
|
|
323
|
+
}
|
|
324
|
+
| {
|
|
325
|
+
operator: Operator.StringGreaterThan;
|
|
326
|
+
variable: Source<DataType.STRING>;
|
|
327
|
+
argument: Source<DataType.STRING>;
|
|
328
|
+
}
|
|
329
|
+
| {
|
|
330
|
+
operator: Operator.StringLessThan;
|
|
331
|
+
variable: Source<DataType.STRING>;
|
|
332
|
+
argument: Source<DataType.STRING>;
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* a condition composed of multiple conditions where all have to evaluate true
|
|
337
|
+
*/
|
|
338
|
+
export type AndConditions = {
|
|
339
|
+
type: 'JOIN';
|
|
340
|
+
join: 'AND';
|
|
341
|
+
conditions: ConditionWrapper[];
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* a condition composed of multiple conditions where only one has to evaluate true
|
|
346
|
+
*/
|
|
347
|
+
export type OrConditions = {
|
|
348
|
+
type: 'JOIN';
|
|
349
|
+
join: 'OR';
|
|
350
|
+
conditions: ConditionWrapper[];
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* a condition composed of multiple compound conditions
|
|
355
|
+
*/
|
|
356
|
+
export type JoinedConditions = AndConditions | OrConditions;
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* an operator for a condition
|
|
360
|
+
*/
|
|
361
|
+
export type OperatorCondition = {
|
|
362
|
+
type: 'OPERATOR';
|
|
363
|
+
condition: Condition;
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* a higher order type representing combinations of complex types
|
|
368
|
+
*/
|
|
369
|
+
export type ConditionWrapper = JoinedConditions | OperatorCondition;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './secret.interface';
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { StepMap } from '../steps/step.interface';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* used to describe a group of steps
|
|
5
|
+
*/
|
|
6
|
+
export enum SequenceType {
|
|
7
|
+
TRIGGER = 'TRIGGER',
|
|
8
|
+
MAIN = 'MAIN',
|
|
9
|
+
BRANCH = 'BRANCH',
|
|
10
|
+
FANOUT = 'FANOUT',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* represents a transition between sequences
|
|
15
|
+
*/
|
|
16
|
+
export type SequenceEdge = {
|
|
17
|
+
/**
|
|
18
|
+
* describes the transition between sequences
|
|
19
|
+
*/
|
|
20
|
+
type: SequenceEdgeType;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* the id of the sequence being transitioned from
|
|
24
|
+
*/
|
|
25
|
+
from: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* the id of the sequence being transitioned to
|
|
29
|
+
*/
|
|
30
|
+
to: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* used to describe the type of a sequence edge
|
|
35
|
+
*/
|
|
36
|
+
export enum SequenceEdgeType {
|
|
37
|
+
NEXT = 'NEXT',
|
|
38
|
+
BRANCH = 'BRANCH',
|
|
39
|
+
FANOUT = 'FANOUT',
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* represents a transition between steps
|
|
44
|
+
*/
|
|
45
|
+
export type StepEdge = {
|
|
46
|
+
/**
|
|
47
|
+
* human-readable label; used within UIs
|
|
48
|
+
*/
|
|
49
|
+
label?: string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* the step id being transitioned from
|
|
53
|
+
*/
|
|
54
|
+
from: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* the step id being transitioned to
|
|
58
|
+
*/
|
|
59
|
+
to: string | null | undefined;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* a sub group of steps to be executed
|
|
64
|
+
*/
|
|
65
|
+
export type Sequence = {
|
|
66
|
+
/**
|
|
67
|
+
* id of the sequence
|
|
68
|
+
*/
|
|
69
|
+
id: string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* starting step id of the sequence
|
|
73
|
+
*/
|
|
74
|
+
start?: string; // step ids
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* the ids of the steps within the sequence
|
|
78
|
+
*/
|
|
79
|
+
stepIds: string[];
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* the step edges to / from the sequence
|
|
83
|
+
*/
|
|
84
|
+
stepEdges: StepEdge[];
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* the sequence edges bordering the sequence
|
|
88
|
+
*/
|
|
89
|
+
sequenceEdges: SequenceEdge[];
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* the type of sequence
|
|
93
|
+
*/
|
|
94
|
+
type: SequenceType;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* width of a branch of steps within a condition; used for rendering UIs
|
|
98
|
+
*/
|
|
99
|
+
conditionalBranchWidth?: number;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* key / value map of sequences where the keys are the sequence ids
|
|
104
|
+
*/
|
|
105
|
+
export type SequenceMap = Record<string, Sequence>;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* a JSON representation of a workflow
|
|
109
|
+
*/
|
|
110
|
+
export type StateMachine = {
|
|
111
|
+
/**
|
|
112
|
+
* a key / value map of all the steps in the state machine
|
|
113
|
+
*/
|
|
114
|
+
stepMap: StepMap;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* a key / value map of all the sequences in the state machine
|
|
118
|
+
*/
|
|
119
|
+
sequenceMap: SequenceMap;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* the id of the starting sequence
|
|
123
|
+
*/
|
|
124
|
+
start: string;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* the active step that's executing
|
|
128
|
+
* should be set to the trigger id for full workflow executions
|
|
129
|
+
* @since PARA-1484: epic/fan-in
|
|
130
|
+
*/
|
|
131
|
+
activeStepId?: string;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* if provided, a workflow should stop executing after reaching this step
|
|
135
|
+
* used for single step tests where `activeStepId` & `finalStepId` should be the same value
|
|
136
|
+
* @since PARA-1484: epic/fan-in
|
|
137
|
+
*/
|
|
138
|
+
finalStepId?: string;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* steps that aren't used in the state machine
|
|
142
|
+
* @todo rename to `unusedStepIds` to be explicit about objs vs strings
|
|
143
|
+
*/
|
|
144
|
+
unusedSteps: string[];
|
|
145
|
+
};
|