@allternit/workflow-engine 0.1.0 → 0.1.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/src/types.ts.bak DELETED
@@ -1,449 +0,0 @@
1
- /**
2
- * A2R Workflow Engine Types
3
- *
4
- * Core type definitions for workflow orchestration.
5
- */
6
-
7
- /**
8
- * Workflow Definition
9
- */
10
- export interface Workflow {
11
- /** Workflow ID */
12
- id: string;
13
- /** Workflow name */
14
- name: string;
15
- /** Workflow version */
16
- version: string;
17
- /** Workflow description */
18
- description?: string;
19
- /** Input parameters schema */
20
- inputs?: ParameterSchema[];
21
- /** Output parameters schema */
22
- outputs?: ParameterSchema[];
23
- /** Workflow variables */
24
- variables?: Variable[];
25
- /** Workflow nodes */
26
- nodes: WorkflowNode[];
27
- /** Connections between nodes */
28
- connections: Connection[];
29
- /** Workflow triggers */
30
- triggers?: Trigger[];
31
- /** Error handling strategy */
32
- errorHandling?: ErrorHandlingConfig;
33
- /** Workflow metadata */
34
- metadata?: WorkflowMetadata;
35
- }
36
-
37
- /**
38
- * Workflow Node
39
- */
40
- export interface WorkflowNode {
41
- /** Unique node ID */
42
- id: string;
43
- /** Node type */
44
- type: string;
45
- /** Node name */
46
- name: string;
47
- /** Node configuration */
48
- config?: Record<string, unknown>;
49
- /** Input mappings */
50
- inputs?: InputMapping[];
51
- /** Output mappings */
52
- outputs?: OutputMapping[];
53
- /** Node position in visual editor */
54
- position?: Position;
55
- /** Node metadata */
56
- metadata?: NodeMetadata;
57
- }
58
-
59
- /**
60
- * Connection between nodes
61
- */
62
- export interface Connection {
63
- /** Connection ID */
64
- id: string;
65
- /** Source node ID */
66
- source: string;
67
- /** Source output port */
68
- sourcePort?: string;
69
- /** Target node ID */
70
- target: string;
71
- /** Target input port */
72
- targetPort?: string;
73
- /** Condition for this connection */
74
- condition?: string;
75
- }
76
-
77
- /**
78
- * Parameter Schema
79
- */
80
- export interface ParameterSchema {
81
- /** Parameter name */
82
- name: string;
83
- /** Parameter type */
84
- type: 'string' | 'number' | 'boolean' | 'array' | 'object' | 'any';
85
- /** Parameter description */
86
- description?: string;
87
- /** Is required */
88
- required?: boolean;
89
- /** Default value */
90
- default?: unknown;
91
- /** Validation rules */
92
- validation?: ValidationRule[];
93
- }
94
-
95
- /**
96
- * Validation Rule
97
- */
98
- export interface ValidationRule {
99
- /** Rule type */
100
- type: 'required' | 'min' | 'max' | 'pattern' | 'enum' | 'custom';
101
- /** Rule value */
102
- value?: unknown;
103
- /** Error message */
104
- message?: string;
105
- }
106
-
107
- /**
108
- * Workflow Variable
109
- */
110
- export interface Variable {
111
- /** Variable name */
112
- name: string;
113
- /** Variable type */
114
- type: string;
115
- /** Initial value */
116
- default?: unknown;
117
- /** Is secret */
118
- secret?: boolean;
119
- /** Scope */
120
- scope?: 'workflow' | 'node' | 'global';
121
- }
122
-
123
- /**
124
- * Input Mapping
125
- */
126
- export interface InputMapping {
127
- /** Target input name */
128
- target: string;
129
- /** Source expression */
130
- source: string;
131
- /** Transform expression */
132
- transform?: string;
133
- /** Default value if source is empty */
134
- default?: unknown;
135
- }
136
-
137
- /**
138
- * Output Mapping
139
- */
140
- export interface OutputMapping {
141
- /** Source output name */
142
- source: string;
143
- /** Target variable or expression */
144
- target: string;
145
- /** Transform expression */
146
- transform?: string;
147
- }
148
-
149
- /**
150
- * Workflow Trigger
151
- */
152
- export interface Trigger {
153
- /** Trigger ID */
154
- id: string;
155
- /** Trigger type */
156
- type: 'schedule' | 'webhook' | 'event' | 'manual' | 'api';
157
- /** Trigger configuration */
158
- config?: Record<string, unknown>;
159
- /** Is enabled */
160
- enabled?: boolean;
161
- }
162
-
163
- /**
164
- * Error Handling Configuration
165
- */
166
- export interface ErrorHandlingConfig {
167
- /** Default retry count */
168
- retryCount?: number;
169
- /** Default retry delay (ms) */
170
- retryDelay?: number;
171
- /** Error handler node ID */
172
- errorHandler?: string;
173
- /** Continue on error */
174
- continueOnError?: boolean;
175
- /** Max concurrent errors before failing workflow */
176
- maxErrors?: number;
177
- }
178
-
179
- /**
180
- * Workflow Metadata
181
- */
182
- export interface WorkflowMetadata {
183
- /** Created timestamp */
184
- createdAt?: string;
185
- /** Updated timestamp */
186
- updatedAt?: string;
187
- /** Author */
188
- author?: string;
189
- /** Tags */
190
- tags?: string[];
191
- /** Category */
192
- category?: string;
193
- }
194
-
195
- /**
196
- * Node Metadata
197
- */
198
- export interface NodeMetadata {
199
- /** Node color */
200
- color?: string;
201
- /** Node icon */
202
- icon?: string;
203
- /** Documentation URL */
204
- docs?: string;
205
- }
206
-
207
- /**
208
- * Position in visual editor
209
- */
210
- export interface Position {
211
- x: number;
212
- y: number;
213
- }
214
-
215
- /**
216
- * Workflow Execution
217
- */
218
- export interface WorkflowExecution {
219
- /** Execution ID */
220
- id: string;
221
- /** Workflow ID */
222
- workflowId: string;
223
- /** Execution status */
224
- status: ExecutionStatus;
225
- /** Input data */
226
- inputs?: Record<string, unknown>;
227
- /** Output data */
228
- outputs?: Record<string, unknown>;
229
- /** Execution context */
230
- context?: ExecutionContext;
231
- /** Node executions */
232
- nodeExecutions?: NodeExecution[];
233
- /** Started timestamp */
234
- startedAt?: string;
235
- /** Completed timestamp */
236
- completedAt?: string;
237
- /** Error information */
238
- error?: ExecutionError;
239
- }
240
-
241
- /**
242
- * Execution Status
243
- */
244
- export type ExecutionStatus =
245
- | 'pending'
246
- | 'running'
247
- | 'paused'
248
- | 'completed'
249
- | 'failed'
250
- | 'cancelled'
251
- | 'timeout';
252
-
253
- /**
254
- * Execution Context
255
- */
256
- export interface ExecutionContext {
257
- /** Workflow variables */
258
- variables: Record<string, unknown>;
259
- /** Execution state */
260
- state: ExecutionState;
261
- /** Parent execution ID (for sub-workflows) */
262
- parentExecutionId?: string;
263
- /** Trigger information */
264
- trigger?: TriggerInfo;
265
- /** User/agent context */
266
- userContext?: UserContext;
267
- }
268
-
269
- /**
270
- * Execution State
271
- */
272
- export interface ExecutionState {
273
- /** Currently executing nodes */
274
- activeNodes: string[];
275
- /** Completed nodes */
276
- completedNodes: string[];
277
- /** Failed nodes */
278
- failedNodes: string[];
279
- /** Node results */
280
- nodeResults: Record<string, unknown>;
281
- /** Execution path taken */
282
- executionPath: string[];
283
- }
284
-
285
- /**
286
- * Node Execution
287
- */
288
- export interface NodeExecution {
289
- /** Node ID */
290
- nodeId: string;
291
- /** Execution status */
292
- status: ExecutionStatus;
293
- /** Input data */
294
- inputs?: Record<string, unknown>;
295
- /** Output data */
296
- outputs?: Record<string, unknown>;
297
- /** Started timestamp */
298
- startedAt?: string;
299
- /** Completed timestamp */
300
- completedAt?: string;
301
- /** Retry count */
302
- retryCount?: number;
303
- /** Error information */
304
- error?: ExecutionError;
305
- }
306
-
307
- /**
308
- * Execution Error
309
- */
310
- export interface ExecutionError {
311
- /** Error code */
312
- code: string;
313
- /** Error message */
314
- message: string;
315
- /** Error details */
316
- details?: unknown;
317
- /** Stack trace */
318
- stack?: string;
319
- /** Node ID where error occurred */
320
- nodeId?: string;
321
- }
322
-
323
- /**
324
- * Trigger Information
325
- */
326
- export interface TriggerInfo {
327
- /** Trigger type */
328
- type: string;
329
- /** Trigger ID */
330
- triggerId: string;
331
- /** Trigger data */
332
- data?: unknown;
333
- /** Timestamp */
334
- timestamp: string;
335
- }
336
-
337
- /**
338
- * User Context
339
- */
340
- export interface UserContext {
341
- /** User ID */
342
- userId?: string;
343
- /** Organization ID */
344
- orgId?: string;
345
- /** Roles */
346
- roles?: string[];
347
- /** Permissions */
348
- permissions?: string[];
349
- }
350
-
351
- /**
352
- * Node Type Definition
353
- */
354
- export interface NodeType {
355
- /** Node type ID */
356
- type: string;
357
- /** Node category */
358
- category: NodeCategory;
359
- /** Display name */
360
- displayName: string;
361
- /** Description */
362
- description?: string;
363
- /** Input ports */
364
- inputs?: PortDefinition[];
365
- /** Output ports */
366
- outputs?: PortDefinition[];
367
- /** Configuration schema */
368
- configSchema?: ParameterSchema[];
369
- /** Default configuration */
370
- defaultConfig?: Record<string, unknown>;
371
- /** Node executor */
372
- executor?: NodeExecutor;
373
- /** Icon */
374
- icon?: string;
375
- /** Color */
376
- color?: string;
377
- }
378
-
379
- /**
380
- * Node Category
381
- */
382
- export type NodeCategory =
383
- | 'input'
384
- | 'output'
385
- | 'transform'
386
- | 'condition'
387
- | 'loop'
388
- | 'delay'
389
- | 'http'
390
- | 'database'
391
- | 'ai'
392
- | 'custom';
393
-
394
- /**
395
- * Port Definition
396
- */
397
- export interface PortDefinition {
398
- /** Port name */
399
- name: string;
400
- /** Port type */
401
- type: string;
402
- /** Is required */
403
- required?: boolean;
404
- /** Description */
405
- description?: string;
406
- }
407
-
408
- /**
409
- * Node Executor Function
410
- */
411
- export type NodeExecutor = (
412
- node: WorkflowNode,
413
- context: ExecutionContext,
414
- inputs: Record<string, unknown>
415
- ) => Promise<Record<string, unknown>>;
416
-
417
- /**
418
- * Workflow Engine Configuration
419
- */
420
- export interface WorkflowEngineConfig {
421
- /** Max concurrent executions */
422
- maxConcurrentExecutions?: number;
423
- /** Default execution timeout (ms) */
424
- defaultTimeout?: number;
425
- /** Enable execution history */
426
- enableHistory?: boolean;
427
- /** History retention (days) */
428
- historyRetentionDays?: number;
429
- /** Custom node types */
430
- nodeTypes?: NodeType[];
431
- /** Hooks */
432
- hooks?: WorkflowHooks;
433
- }
434
-
435
- /**
436
- * Workflow Hooks
437
- */
438
- export interface WorkflowHooks {
439
- /** Before workflow execution */
440
- beforeExecute?: (execution: WorkflowExecution) => Promise<void>;
441
- /** After workflow execution */
442
- afterExecute?: (execution: WorkflowExecution) => Promise<void>;
443
- /** Before node execution */
444
- beforeNodeExecute?: (node: WorkflowNode, context: ExecutionContext) => Promise<void>;
445
- /** After node execution */
446
- afterNodeExecute?: (node: WorkflowNode, context: ExecutionContext, result: unknown) => Promise<void>;
447
- /** On error */
448
- onError?: (error: ExecutionError, context: ExecutionContext) => Promise<void>;
449
- }