@yiyi_zhang/reactflow-ui 0.1.0 → 0.2.0

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.
@@ -0,0 +1,124 @@
1
+ {
2
+ "workflowId": "wf_retry_demo_001",
3
+ "status": "COMPLETED",
4
+ "startTime": 1704546000000,
5
+ "endTime": 1704546180000,
6
+ "input": { "orderId": "ord_9876", "maxRetries": 3 },
7
+ "output": { "orderStatus": "PROCESSED", "transactionId": "txn_abc123" },
8
+ "workflowDefinition": {
9
+ "name": "payment_processing_workflow",
10
+ "description": "重试机制演示:支付任务重试 2 次后成功,通知任务首次成功",
11
+ "version": 1,
12
+ "tasks": [
13
+ {
14
+ "name": "validate_order",
15
+ "taskReferenceName": "validate_order_ref",
16
+ "type": "SIMPLE",
17
+ "inputParameters": { "orderId": "${workflow.input.orderId}" }
18
+ },
19
+ {
20
+ "name": "process_payment",
21
+ "taskReferenceName": "process_payment_ref",
22
+ "type": "HTTP",
23
+ "retryCount": 3,
24
+ "retryDelaySeconds": 10,
25
+ "inputParameters": {
26
+ "uri": "https://payment-api.example.com/charge",
27
+ "method": "POST",
28
+ "body": { "orderId": "${workflow.input.orderId}" }
29
+ }
30
+ },
31
+ {
32
+ "name": "update_inventory",
33
+ "taskReferenceName": "update_inventory_ref",
34
+ "type": "SIMPLE",
35
+ "retryCount": 2,
36
+ "inputParameters": { "orderId": "${workflow.input.orderId}" }
37
+ },
38
+ {
39
+ "name": "send_confirmation",
40
+ "taskReferenceName": "send_confirm_ref",
41
+ "type": "HTTP",
42
+ "inputParameters": {
43
+ "uri": "https://notify-api.example.com/email",
44
+ "method": "POST"
45
+ }
46
+ }
47
+ ],
48
+ "schemaVersion": 2
49
+ },
50
+ "tasks": [
51
+ {
52
+ "taskId": "task_validate_001",
53
+ "referenceTaskName": "validate_order_ref",
54
+ "status": "COMPLETED",
55
+ "taskType": "SIMPLE",
56
+ "startTime": 1704546000000,
57
+ "endTime": 1704546005000,
58
+ "inputData": { "orderId": "ord_9876" },
59
+ "outputData": { "valid": true, "amount": 99.99 }
60
+ },
61
+ {
62
+ "taskId": "task_payment_retry0",
63
+ "referenceTaskName": "process_payment_ref",
64
+ "status": "FAILED_WITH_TERMINAL_ERROR",
65
+ "taskType": "HTTP",
66
+ "retryCount": 0,
67
+ "startTime": 1704546006000,
68
+ "endTime": 1704546016000,
69
+ "inputData": { "orderId": "ord_9876", "amount": 99.99 },
70
+ "reasonForIncompletion": "Connection timeout: payment gateway unreachable"
71
+ },
72
+ {
73
+ "taskId": "task_payment_retry1",
74
+ "referenceTaskName": "process_payment_ref",
75
+ "status": "FAILED_WITH_TERMINAL_ERROR",
76
+ "taskType": "HTTP",
77
+ "retryCount": 1,
78
+ "startTime": 1704546026000,
79
+ "endTime": 1704546036000,
80
+ "inputData": { "orderId": "ord_9876", "amount": 99.99 },
81
+ "reasonForIncompletion": "HTTP 503: Service Temporarily Unavailable"
82
+ },
83
+ {
84
+ "taskId": "task_payment_retry2",
85
+ "referenceTaskName": "process_payment_ref",
86
+ "status": "COMPLETED",
87
+ "taskType": "HTTP",
88
+ "retryCount": 2,
89
+ "startTime": 1704546046000,
90
+ "endTime": 1704546056000,
91
+ "inputData": { "orderId": "ord_9876", "amount": 99.99 },
92
+ "outputData": { "transactionId": "txn_abc123", "status": "APPROVED" }
93
+ },
94
+ {
95
+ "taskId": "task_inventory_retry0",
96
+ "referenceTaskName": "update_inventory_ref",
97
+ "status": "FAILED",
98
+ "taskType": "SIMPLE",
99
+ "retryCount": 0,
100
+ "startTime": 1704546057000,
101
+ "endTime": 1704546067000,
102
+ "reasonForIncompletion": "Database deadlock detected"
103
+ },
104
+ {
105
+ "taskId": "task_inventory_retry1",
106
+ "referenceTaskName": "update_inventory_ref",
107
+ "status": "COMPLETED",
108
+ "taskType": "SIMPLE",
109
+ "retryCount": 1,
110
+ "startTime": 1704546077000,
111
+ "endTime": 1704546085000,
112
+ "outputData": { "updated": true, "newStock": 42 }
113
+ },
114
+ {
115
+ "taskId": "task_confirm_001",
116
+ "referenceTaskName": "send_confirm_ref",
117
+ "status": "COMPLETED",
118
+ "taskType": "HTTP",
119
+ "startTime": 1704546086000,
120
+ "endTime": 1704546090000,
121
+ "outputData": { "emailSent": true, "messageId": "msg_confirm_456" }
122
+ }
123
+ ]
124
+ }
@@ -0,0 +1,136 @@
1
+ {
2
+ "workflowId": "wf_switch_demo_001",
3
+ "status": "COMPLETED",
4
+ "startTime": 1704546000000,
5
+ "endTime": 1704546090000,
6
+ "input": { "userType": "premium", "requestId": "req_555" },
7
+ "output": { "processed": true, "tier": "premium" },
8
+ "workflowDefinition": {
9
+ "name": "user_tier_workflow",
10
+ "description": "SWITCH 分支演示:根据用户类型走不同处理路径(premium 分支执行)",
11
+ "version": 1,
12
+ "tasks": [
13
+ {
14
+ "name": "lookup_user",
15
+ "taskReferenceName": "lookup_user_ref",
16
+ "type": "HTTP",
17
+ "inputParameters": {
18
+ "uri": "https://api.example.com/users/${workflow.input.requestId}",
19
+ "method": "GET"
20
+ }
21
+ },
22
+ {
23
+ "name": "route_by_tier",
24
+ "taskReferenceName": "route_ref",
25
+ "type": "SWITCH",
26
+ "inputParameters": {
27
+ "switchCaseValue": "${workflow.input.userType}"
28
+ },
29
+ "evaluatorType": "value-param",
30
+ "expression": "switchCaseValue",
31
+ "decisionCases": {
32
+ "premium": [
33
+ {
34
+ "name": "premium_processing",
35
+ "taskReferenceName": "premium_proc_ref",
36
+ "type": "SIMPLE",
37
+ "inputParameters": { "priority": "high", "sla": "1h" }
38
+ },
39
+ {
40
+ "name": "premium_notify",
41
+ "taskReferenceName": "premium_notify_ref",
42
+ "type": "EVENT",
43
+ "inputParameters": { "sink": "sqs:premium-events" }
44
+ }
45
+ ],
46
+ "standard": [
47
+ {
48
+ "name": "standard_processing",
49
+ "taskReferenceName": "standard_proc_ref",
50
+ "type": "SIMPLE",
51
+ "inputParameters": { "priority": "normal", "sla": "24h" }
52
+ }
53
+ ],
54
+ "free": [
55
+ {
56
+ "name": "queue_request",
57
+ "taskReferenceName": "queue_ref",
58
+ "type": "SET_VARIABLE",
59
+ "inputParameters": { "queuePosition": "${workflow.input.requestId}" }
60
+ }
61
+ ]
62
+ },
63
+ "defaultCase": [
64
+ {
65
+ "name": "handle_unknown_tier",
66
+ "taskReferenceName": "unknown_tier_ref",
67
+ "type": "TERMINATE",
68
+ "inputParameters": {
69
+ "terminationStatus": "FAILED",
70
+ "reasonForIncompletion": "Unknown user tier"
71
+ }
72
+ }
73
+ ]
74
+ },
75
+ {
76
+ "name": "log_completion",
77
+ "taskReferenceName": "log_ref",
78
+ "type": "INLINE",
79
+ "inputParameters": {
80
+ "expression": "console.log('Workflow complete')"
81
+ }
82
+ }
83
+ ],
84
+ "schemaVersion": 2
85
+ },
86
+ "tasks": [
87
+ {
88
+ "taskId": "task_lookup_001",
89
+ "referenceTaskName": "lookup_user_ref",
90
+ "status": "COMPLETED",
91
+ "taskType": "HTTP",
92
+ "startTime": 1704546000000,
93
+ "endTime": 1704546005000,
94
+ "inputData": { "uri": "https://api.example.com/users/req_555" },
95
+ "outputData": { "userId": "usr_999", "tier": "premium", "email": "user@example.com" }
96
+ },
97
+ {
98
+ "taskId": "task_switch_001",
99
+ "referenceTaskName": "route_ref",
100
+ "status": "COMPLETED",
101
+ "taskType": "SWITCH",
102
+ "startTime": 1704546006000,
103
+ "endTime": 1704546006500,
104
+ "inputData": { "switchCaseValue": "premium" },
105
+ "outputData": { "caseOutput": "premium" }
106
+ },
107
+ {
108
+ "taskId": "task_premium_proc_001",
109
+ "referenceTaskName": "premium_proc_ref",
110
+ "status": "COMPLETED",
111
+ "taskType": "SIMPLE",
112
+ "startTime": 1704546007000,
113
+ "endTime": 1704546040000,
114
+ "inputData": { "priority": "high", "sla": "1h" },
115
+ "outputData": { "jobId": "job_premium_789", "estimatedTime": "45m" }
116
+ },
117
+ {
118
+ "taskId": "task_premium_notify_001",
119
+ "referenceTaskName": "premium_notify_ref",
120
+ "status": "COMPLETED",
121
+ "taskType": "EVENT",
122
+ "startTime": 1704546041000,
123
+ "endTime": 1704546043000,
124
+ "outputData": { "eventId": "evt_premium_sent" }
125
+ },
126
+ {
127
+ "taskId": "task_log_001",
128
+ "referenceTaskName": "log_ref",
129
+ "status": "COMPLETED",
130
+ "taskType": "INLINE",
131
+ "startTime": 1704546044000,
132
+ "endTime": 1704546046000,
133
+ "outputData": { "result": "logged" }
134
+ }
135
+ ]
136
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Conductor 任务类型枚举
3
3
  */
4
- export type TaskType = 'SIMPLE' | 'DYNAMIC' | 'FORK_JOIN' | 'FORK_JOIN_DYNAMIC' | 'DECISION' | 'SWITCH' | 'JOIN' | 'DO_WHILE' | 'SUB_WORKFLOW' | 'EVENT' | 'WAIT' | 'HUMAN' | 'USER_DEFINED' | 'HTTP' | 'LAMBDA' | 'EXCLUSIVE_JOIN' | 'TERMINATE' | 'KAFKA_PUBLISH' | 'JSON_JQ_TRANSFORM' | 'SET_VARIABLE';
4
+ export type TaskType = 'SIMPLE' | 'DYNAMIC' | 'FORK_JOIN' | 'FORK_JOIN_DYNAMIC' | 'DECISION' | 'SWITCH' | 'JOIN' | 'EXCLUSIVE_JOIN' | 'DO_WHILE' | 'SUB_WORKFLOW' | 'EVENT' | 'WAIT' | 'HUMAN' | 'USER_DEFINED' | 'HTTP' | 'INLINE' | 'LAMBDA' | 'TERMINATE' | 'KAFKA_PUBLISH' | 'JSON_JQ_TRANSFORM' | 'SET_VARIABLE' | 'START_WORKFLOW' | 'NOOP';
5
5
  /**
6
6
  * Conductor 任务定义
7
7
  */
@@ -47,11 +47,30 @@ export interface TaskDef {
47
47
  uri?: string;
48
48
  headers?: Record<string, string>;
49
49
  body?: any;
50
+ contentType?: string;
51
+ accept?: string;
52
+ connectionTimeOut?: number;
53
+ readTimeOut?: number;
50
54
  };
51
55
  sink?: string;
56
+ evaluatorType?: 'graaljs' | 'javascript' | 'value-param' | 'python';
52
57
  caseExpression?: string;
58
+ keepLastN?: number;
59
+ forkTaskType?: string;
60
+ forkTaskName?: string;
61
+ forkTaskWorkflow?: string;
62
+ forkTaskWorkflowVersion?: string;
63
+ dynamicTaskNameParam?: string;
64
+ humanTaskDef?: {
65
+ userFormTemplate?: string;
66
+ assignmentCompletionStrategy?: string;
67
+ displayName?: string;
68
+ };
53
69
  retryCount?: number;
70
+ retryLogic?: 'FIXED' | 'EXPONENTIAL_BACKOFF' | 'LINEAR_BACKOFF';
71
+ retryDelaySeconds?: number;
54
72
  timeoutSeconds?: number;
73
+ timeoutPolicy?: 'RETRY' | 'TIME_OUT_WF' | 'ALERT_ONLY' | 'FAIL_WORKFLOW';
55
74
  }
56
75
  /**
57
76
  * Conductor 工作流定义
@@ -25,6 +25,7 @@ export interface TaskExecutionData {
25
25
  input?: any;
26
26
  reasonForIncompletion?: string;
27
27
  iteration?: number;
28
+ totalIterations?: number;
28
29
  }
29
30
  /**
30
31
  * 解析结果
@@ -34,7 +35,6 @@ export interface ParserResult {
34
35
  edges: Edge[];
35
36
  taskMap: Record<string, TaskDef>;
36
37
  nextId: number;
37
- joinNodeId?: string;
38
38
  }
39
39
  /**
40
40
  * 校验条目
@@ -71,6 +71,9 @@ export interface WorkflowNodeData {
71
71
  decisionCases?: Record<string, TaskDef[]>;
72
72
  sourcePosition?: Position;
73
73
  targetPosition?: Position;
74
+ parentRef?: string;
75
+ edgeData?: Record<string, any>;
76
+ isDynamicRuntime?: boolean;
74
77
  }
75
78
  /**
76
79
  * 强类型节点
@@ -102,6 +105,7 @@ export interface WorkflowState {
102
105
  selectedTask: TaskDef | null;
103
106
  selectedTaskInstance: TaskInstance | null;
104
107
  executionData: Record<string, TaskExecutionData> | null;
108
+ dynamicRuntimeTasksByFork: Record<string, TaskInstance[]>;
105
109
  validationResults: ValidationResults;
106
110
  theme: ThemeMode;
107
111
  themeColor: ThemeColor;
@@ -36,6 +36,12 @@ export declare const TASK_RULES: {
36
36
  level: string;
37
37
  message: string;
38
38
  })[];
39
+ INLINE: {
40
+ field: string;
41
+ type: string;
42
+ validate: (_val: any, task: any) => boolean;
43
+ message: string;
44
+ }[];
39
45
  LAMBDA: {
40
46
  field: string;
41
47
  type: string;
@@ -51,6 +57,17 @@ export declare const TASK_RULES: {
51
57
  type: string;
52
58
  message: string;
53
59
  }[];
60
+ START_WORKFLOW: {
61
+ field: string;
62
+ type: string;
63
+ validate: (_val: any, task: any) => boolean;
64
+ message: string;
65
+ }[];
66
+ DYNAMIC: {
67
+ field: string;
68
+ type: string;
69
+ message: string;
70
+ }[];
54
71
  TERMINATE: ({
55
72
  field: string;
56
73
  type: string;
@@ -67,6 +84,7 @@ export declare const TASK_RULES: {
67
84
  DO_WHILE: {
68
85
  field: string;
69
86
  type: string;
87
+ validate: (_val: any, task: any) => boolean;
70
88
  message: string;
71
89
  }[];
72
90
  DECISION: {
@@ -81,5 +99,12 @@ export declare const TASK_RULES: {
81
99
  validate: (val: any) => boolean;
82
100
  message: string;
83
101
  }[];
102
+ FORK_JOIN_DYNAMIC: {
103
+ field: string;
104
+ type: string;
105
+ validate: (_val: any, task: any) => boolean;
106
+ message: string;
107
+ level: string;
108
+ }[];
84
109
  };
85
110
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yiyi_zhang/reactflow-ui",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Conductor Workflow IDE — a visual workflow designer built with React 19, ReactFlow and Zustand for editing, validating and monitoring Netflix Conductor workflows.",
5
5
  "keywords": [
6
6
  "conductor",