@yiyi_zhang/reactflow-ui 0.1.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.
- package/README.md +107 -0
- package/dist/WorkflowIDE.d.ts +108 -0
- package/dist/components/AICopilot/AIChatPanel.d.ts +8 -0
- package/dist/components/AICopilot/ParameterSuggester.d.ts +16 -0
- package/dist/components/ConfirmDialog.d.ts +7 -0
- package/dist/components/Controls/ActionBar.d.ts +10 -0
- package/dist/components/Controls/ControlButton.d.ts +13 -0
- package/dist/components/Controls/ControlHub.d.ts +3 -0
- package/dist/components/Editor/NodeSelector.d.ts +8 -0
- package/dist/components/EmptyStatePanel.d.ts +7 -0
- package/dist/components/ExecutionStatusBar.d.ts +5 -0
- package/dist/components/ExecutionTaskPanel.d.ts +5 -0
- package/dist/components/HealthCheckPanel.d.ts +12 -0
- package/dist/components/TaskDetailPanel.d.ts +11 -0
- package/dist/components/Toast.d.ts +11 -0
- package/dist/components/WorkflowDesigner.d.ts +15 -0
- package/dist/components/WorkflowSettingsPanel.d.ts +10 -0
- package/dist/components/edges/AddableEdge.d.ts +8 -0
- package/dist/components/nodes/DecisionNode.d.ts +5 -0
- package/dist/components/nodes/ExecutionStatusBadge.d.ts +7 -0
- package/dist/components/nodes/ForkJoinNode.d.ts +16 -0
- package/dist/components/nodes/LoopNode.d.ts +5 -0
- package/dist/components/nodes/NodeLayout.d.ts +16 -0
- package/dist/components/nodes/NodeWrapper.d.ts +15 -0
- package/dist/components/nodes/SubWorkflowNode.d.ts +5 -0
- package/dist/components/nodes/TaskNode.d.ts +5 -0
- package/dist/config/taskTypes.d.ts +14 -0
- package/dist/hooks/useConfirm.d.ts +14 -0
- package/dist/hooks/useNodeExecution.d.ts +8 -0
- package/dist/hooks/useNodeLayout.d.ts +10 -0
- package/dist/hooks/useShortcuts.d.ts +11 -0
- package/dist/hooks/useToast.d.ts +9 -0
- package/dist/index.d.ts +5 -0
- package/dist/layout/autoLayout.d.ts +22 -0
- package/dist/parser/conductorGenerator.d.ts +28 -0
- package/dist/parser/conductorParser.d.ts +24 -0
- package/dist/reactflow-ui.css +1 -0
- package/dist/reactflow-ui.es.js +11035 -0
- package/dist/reactflow-ui.umd.js +229 -0
- package/dist/sample-workflows/complex-workflow.json +210 -0
- package/dist/sample-workflows/decision-workflow.json +118 -0
- package/dist/sample-workflows/fork-join-workflow.json +112 -0
- package/dist/sample-workflows/sample-execution.json +327 -0
- package/dist/sample-workflows/simple-workflow.json +42 -0
- package/dist/services/aiService.d.ts +24 -0
- package/dist/services/promptTemplates.d.ts +6 -0
- package/dist/store/workflowStore.d.ts +30 -0
- package/dist/types/conductor.d.ts +170 -0
- package/dist/types/workflow.d.ts +165 -0
- package/dist/utils/validationRules.d.ts +85 -0
- package/dist/utils/validator.d.ts +6 -0
- package/dist/vite.svg +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
{
|
|
2
|
+
"workflowId": "wf_1234567890",
|
|
3
|
+
"status": "COMPLETED",
|
|
4
|
+
"startTime": 1704546000000,
|
|
5
|
+
"endTime": 1704546060000,
|
|
6
|
+
"workflowDefinition": {
|
|
7
|
+
"name": "complex_workflow",
|
|
8
|
+
"description": "综合示例:包含多种任务类型和嵌套结构",
|
|
9
|
+
"version": 1,
|
|
10
|
+
"tasks": [
|
|
11
|
+
{
|
|
12
|
+
"name": "initialize",
|
|
13
|
+
"taskReferenceName": "init_ref",
|
|
14
|
+
"type": "SIMPLE",
|
|
15
|
+
"inputParameters": {
|
|
16
|
+
"workflowId": "${workflow.workflowId}"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "check_environment",
|
|
21
|
+
"taskReferenceName": "env_check_ref",
|
|
22
|
+
"type": "DECISION",
|
|
23
|
+
"inputParameters": {
|
|
24
|
+
"environment": "${workflow.input.environment}"
|
|
25
|
+
},
|
|
26
|
+
"caseValueParam": "environment",
|
|
27
|
+
"decisionCases": {
|
|
28
|
+
"production": [
|
|
29
|
+
{
|
|
30
|
+
"name": "prod_validation",
|
|
31
|
+
"taskReferenceName": "prod_valid_ref",
|
|
32
|
+
"type": "SIMPLE",
|
|
33
|
+
"inputParameters": {
|
|
34
|
+
"strict": true
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "prod_parallel_tasks",
|
|
39
|
+
"taskReferenceName": "prod_fork_ref",
|
|
40
|
+
"type": "FORK_JOIN",
|
|
41
|
+
"forkTasks": [
|
|
42
|
+
[
|
|
43
|
+
{
|
|
44
|
+
"name": "security_check",
|
|
45
|
+
"taskReferenceName": "security_ref",
|
|
46
|
+
"type": "HTTP",
|
|
47
|
+
"inputParameters": {
|
|
48
|
+
"uri": "https://api.example.com/security/check"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
[
|
|
53
|
+
{
|
|
54
|
+
"name": "compliance_check",
|
|
55
|
+
"taskReferenceName": "compliance_ref",
|
|
56
|
+
"type": "SIMPLE",
|
|
57
|
+
"inputParameters": {
|
|
58
|
+
"level": "strict"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "join_prod_checks",
|
|
66
|
+
"taskReferenceName": "prod_join_ref",
|
|
67
|
+
"type": "JOIN",
|
|
68
|
+
"joinOn": [
|
|
69
|
+
"security_ref",
|
|
70
|
+
"compliance_ref"
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"staging": [
|
|
75
|
+
{
|
|
76
|
+
"name": "staging_validation",
|
|
77
|
+
"taskReferenceName": "staging_valid_ref",
|
|
78
|
+
"type": "SIMPLE"
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
"defaultCase": [
|
|
83
|
+
{
|
|
84
|
+
"name": "dev_validation",
|
|
85
|
+
"taskReferenceName": "dev_valid_ref",
|
|
86
|
+
"type": "SIMPLE"
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "process_data_loop",
|
|
92
|
+
"taskReferenceName": "loop_ref",
|
|
93
|
+
"type": "DO_WHILE",
|
|
94
|
+
"loopOver": [
|
|
95
|
+
{
|
|
96
|
+
"name": "process_item",
|
|
97
|
+
"taskReferenceName": "process_item_ref",
|
|
98
|
+
"type": "SIMPLE"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "transform_item",
|
|
102
|
+
"taskReferenceName": "transform_item_ref",
|
|
103
|
+
"type": "JSON_JQ_TRANSFORM"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "invoke_sub_workflow",
|
|
109
|
+
"taskReferenceName": "sub_wf_ref",
|
|
110
|
+
"type": "SUB_WORKFLOW",
|
|
111
|
+
"subWorkflowParam": {
|
|
112
|
+
"name": "data_aggregation_workflow",
|
|
113
|
+
"version": 1
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "final_processing",
|
|
118
|
+
"taskReferenceName": "final_ref",
|
|
119
|
+
"type": "FORK_JOIN",
|
|
120
|
+
"forkTasks": [
|
|
121
|
+
[
|
|
122
|
+
{
|
|
123
|
+
"name": "save_to_database",
|
|
124
|
+
"taskReferenceName": "db_save_ref",
|
|
125
|
+
"type": "SIMPLE"
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
[
|
|
129
|
+
{
|
|
130
|
+
"name": "publish_event",
|
|
131
|
+
"taskReferenceName": "event_ref",
|
|
132
|
+
"type": "EVENT"
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
[
|
|
136
|
+
{
|
|
137
|
+
"name": "send_notification",
|
|
138
|
+
"taskReferenceName": "notify_ref",
|
|
139
|
+
"type": "KAFKA_PUBLISH"
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"name": "join_final_tasks",
|
|
146
|
+
"taskReferenceName": "final_join_ref",
|
|
147
|
+
"type": "JOIN",
|
|
148
|
+
"joinOn": [
|
|
149
|
+
"db_save_ref",
|
|
150
|
+
"event_ref",
|
|
151
|
+
"notify_ref"
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "cleanup",
|
|
156
|
+
"taskReferenceName": "cleanup_ref",
|
|
157
|
+
"type": "SIMPLE"
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
"inputParameters": [
|
|
161
|
+
"environment",
|
|
162
|
+
"items"
|
|
163
|
+
],
|
|
164
|
+
"outputParameters": {
|
|
165
|
+
"result": "${cleanup_ref.output}"
|
|
166
|
+
},
|
|
167
|
+
"schemaVersion": 2
|
|
168
|
+
},
|
|
169
|
+
"tasks": [
|
|
170
|
+
{
|
|
171
|
+
"taskId": "task_init",
|
|
172
|
+
"referenceTaskName": "init_ref",
|
|
173
|
+
"status": "COMPLETED",
|
|
174
|
+
"taskType": "SIMPLE",
|
|
175
|
+
"startTime": 1704546000000,
|
|
176
|
+
"endTime": 1704546002000,
|
|
177
|
+
"inputData": {
|
|
178
|
+
"workflowId": "wf_1234567890"
|
|
179
|
+
},
|
|
180
|
+
"outputData": {
|
|
181
|
+
"items": [
|
|
182
|
+
"Task A"
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"taskId": "task_decision",
|
|
188
|
+
"referenceTaskName": "env_check_ref",
|
|
189
|
+
"status": "COMPLETED",
|
|
190
|
+
"taskType": "DECISION",
|
|
191
|
+
"startTime": 1704546003000,
|
|
192
|
+
"endTime": 1704546004000,
|
|
193
|
+
"inputData": {
|
|
194
|
+
"environment": "production"
|
|
195
|
+
},
|
|
196
|
+
"outputData": {
|
|
197
|
+
"case": "production"
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"taskId": "task_prod_valid",
|
|
202
|
+
"referenceTaskName": "prod_valid_ref",
|
|
203
|
+
"status": "COMPLETED",
|
|
204
|
+
"taskType": "SIMPLE",
|
|
205
|
+
"startTime": 1704546005000,
|
|
206
|
+
"endTime": 1704546007000
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
"taskId": "task_prod_fork",
|
|
210
|
+
"referenceTaskName": "prod_fork_ref",
|
|
211
|
+
"status": "COMPLETED",
|
|
212
|
+
"taskType": "FORK",
|
|
213
|
+
"startTime": 1704546008000,
|
|
214
|
+
"endTime": 1704546008100
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"taskId": "task_security",
|
|
218
|
+
"referenceTaskName": "security_ref",
|
|
219
|
+
"status": "COMPLETED",
|
|
220
|
+
"taskType": "HTTP",
|
|
221
|
+
"startTime": 1704546009000,
|
|
222
|
+
"endTime": 1704546012000
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"taskId": "task_compliance",
|
|
226
|
+
"referenceTaskName": "compliance_ref",
|
|
227
|
+
"status": "COMPLETED",
|
|
228
|
+
"taskType": "SIMPLE",
|
|
229
|
+
"startTime": 1704546009000,
|
|
230
|
+
"endTime": 1704546011000
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"taskId": "task_prod_join",
|
|
234
|
+
"referenceTaskName": "prod_join_ref",
|
|
235
|
+
"status": "COMPLETED",
|
|
236
|
+
"taskType": "JOIN",
|
|
237
|
+
"startTime": 1704546013000,
|
|
238
|
+
"endTime": 1704546013500
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"taskId": "task_loop",
|
|
242
|
+
"referenceTaskName": "loop_ref",
|
|
243
|
+
"status": "COMPLETED",
|
|
244
|
+
"taskType": "DO_WHILE",
|
|
245
|
+
"startTime": 1704546014000,
|
|
246
|
+
"endTime": 1704546025000
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"taskId": "task_process_item",
|
|
250
|
+
"referenceTaskName": "process_item_ref",
|
|
251
|
+
"status": "COMPLETED",
|
|
252
|
+
"taskType": "SIMPLE",
|
|
253
|
+
"startTime": 1704546015000,
|
|
254
|
+
"endTime": 1704546018000
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"taskId": "task_transform",
|
|
258
|
+
"referenceTaskName": "transform_item_ref",
|
|
259
|
+
"status": "COMPLETED",
|
|
260
|
+
"taskType": "JSON_JQ_TRANSFORM",
|
|
261
|
+
"startTime": 1704546019000,
|
|
262
|
+
"endTime": 1704546020000
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"taskId": "task_subwf",
|
|
266
|
+
"referenceTaskName": "sub_wf_ref",
|
|
267
|
+
"status": "COMPLETED",
|
|
268
|
+
"taskType": "SUB_WORKFLOW",
|
|
269
|
+
"startTime": 1704546026000,
|
|
270
|
+
"endTime": 1704546035000
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"taskId": "task_final_fork",
|
|
274
|
+
"referenceTaskName": "final_ref",
|
|
275
|
+
"status": "COMPLETED",
|
|
276
|
+
"taskType": "FORK",
|
|
277
|
+
"startTime": 1704546036000,
|
|
278
|
+
"endTime": 1704546036100
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"taskId": "task_db_save",
|
|
282
|
+
"referenceTaskName": "db_save_ref",
|
|
283
|
+
"status": "COMPLETED",
|
|
284
|
+
"taskType": "SIMPLE",
|
|
285
|
+
"startTime": 1704546037000,
|
|
286
|
+
"endTime": 1704546042000
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"taskId": "task_event",
|
|
290
|
+
"referenceTaskName": "event_ref",
|
|
291
|
+
"status": "COMPLETED",
|
|
292
|
+
"taskType": "EVENT",
|
|
293
|
+
"startTime": 1704546037000,
|
|
294
|
+
"endTime": 1704546039000
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"taskId": "task_notify",
|
|
298
|
+
"referenceTaskName": "notify_ref",
|
|
299
|
+
"status": "COMPLETED",
|
|
300
|
+
"taskType": "KAFKA_PUBLISH",
|
|
301
|
+
"startTime": 1704546037000,
|
|
302
|
+
"endTime": 1704546040000
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"taskId": "task_final_join",
|
|
306
|
+
"referenceTaskName": "final_join_ref",
|
|
307
|
+
"status": "COMPLETED",
|
|
308
|
+
"taskType": "JOIN",
|
|
309
|
+
"startTime": 1704546043000,
|
|
310
|
+
"endTime": 1704546043500
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"taskId": "task_cleanup",
|
|
314
|
+
"referenceTaskName": "cleanup_ref",
|
|
315
|
+
"status": "COMPLETED",
|
|
316
|
+
"taskType": "SIMPLE",
|
|
317
|
+
"startTime": 1704546044000,
|
|
318
|
+
"endTime": 1704546050000
|
|
319
|
+
}
|
|
320
|
+
],
|
|
321
|
+
"input": {
|
|
322
|
+
"environment": "production"
|
|
323
|
+
},
|
|
324
|
+
"output": {
|
|
325
|
+
"status": "Finished"
|
|
326
|
+
}
|
|
327
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "simple_sequential_workflow",
|
|
3
|
+
"description": "简单的顺序工作流示例",
|
|
4
|
+
"version": 1,
|
|
5
|
+
"tasks": [
|
|
6
|
+
{
|
|
7
|
+
"name": "fetch_user_data",
|
|
8
|
+
"taskReferenceName": "fetch_user_ref",
|
|
9
|
+
"type": "HTTP",
|
|
10
|
+
"inputParameters": {
|
|
11
|
+
"http_request": {
|
|
12
|
+
"uri": "https://api.example.com/users/${workflow.input.userId}",
|
|
13
|
+
"method": "GET"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "transform_data",
|
|
19
|
+
"taskReferenceName": "transform_ref",
|
|
20
|
+
"type": "JSON_JQ_TRANSFORM",
|
|
21
|
+
"inputParameters": {
|
|
22
|
+
"data": "${fetch_user_ref.output.response.body}",
|
|
23
|
+
"queryExpression": ".user | {id, name, email}"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "send_notification",
|
|
28
|
+
"taskReferenceName": "notify_ref",
|
|
29
|
+
"type": "SIMPLE",
|
|
30
|
+
"inputParameters": {
|
|
31
|
+
"userId": "${transform_ref.output.id}",
|
|
32
|
+
"message": "User data processed successfully"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"inputParameters": ["userId"],
|
|
37
|
+
"outputParameters": {
|
|
38
|
+
"result": "${notify_ref.output}"
|
|
39
|
+
},
|
|
40
|
+
"schemaVersion": 2,
|
|
41
|
+
"ownerEmail": "team@example.com"
|
|
42
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Interaction Service (OpenAI Standard)
|
|
3
|
+
*/
|
|
4
|
+
export interface AIServiceConfig {
|
|
5
|
+
apiKey: string;
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
model: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ChatMessage {
|
|
10
|
+
role: 'system' | 'user' | 'assistant';
|
|
11
|
+
content: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 非流式调用(兼容旧逻辑)
|
|
15
|
+
*/
|
|
16
|
+
export declare const callAICopilot: (messages: ChatMessage[], config?: Partial<AIServiceConfig>, signal?: AbortSignal) => Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* 流式调用 - 通过 onToken 回调逐 token 返回内容
|
|
19
|
+
*/
|
|
20
|
+
export declare const callAICopilotStream: (messages: ChatMessage[], config: Partial<AIServiceConfig> | undefined, onToken: (token: string) => void, onDone?: () => void, signal?: AbortSignal) => Promise<string>;
|
|
21
|
+
/**
|
|
22
|
+
* System Prompt for Conductor Workflow Modeling
|
|
23
|
+
*/
|
|
24
|
+
export declare const CONDUCTOR_SYSTEM_PROMPT = "\nYou are an expert in Netflix Conductor Workflow modeling.\nYour goal is to help users design JSON-based workflows.\n\nCONSTRANTS:\n1. Always output valid Conductor JSON within blocks if suggesting changes.\n2. Use standard task types: SIMPLE, FORK_JOIN, SWITCH, DO_WHILE, SUB_WORKFLOW, EVENT, WAIT, TERMINATE.\n3. Every task must have a unique 'taskReferenceName'.\n4. For SWITCH/DECISION, ensure 'decisionCases' and 'defaultCase' are properly structured.\n5. For FORK_JOIN, ensure a corresponding JOIN task follows.\n\nProvide clear, enterprise-grade logic with proper error handling paths.\n";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { WorkflowDef, TaskDef } from '../types/conductor';
|
|
2
|
+
/**
|
|
3
|
+
* AI Prompt Template System
|
|
4
|
+
*/
|
|
5
|
+
export declare const generateWorkflowSuggestionPrompt: (userRequest: string, currentWorkflow: WorkflowDef | null) => string;
|
|
6
|
+
export declare const generateParameterHintPrompt: (task: TaskDef, workflow: WorkflowDef | null) => string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { WorkflowStore, LayoutDirection, EditorMode, ThemeMode, ThemeColor } from '../types/workflow';
|
|
2
|
+
import { WorkflowDef, TaskDef } from '../types/conductor';
|
|
3
|
+
declare const useWorkflowStore: import("zustand").UseBoundStore<Omit<Omit<import("zustand").StoreApi<WorkflowStore>, "setState" | "persist"> & {
|
|
4
|
+
setState(partial: WorkflowStore | Partial<WorkflowStore> | ((state: WorkflowStore) => WorkflowStore | Partial<WorkflowStore>), replace?: false | undefined): unknown;
|
|
5
|
+
setState(state: WorkflowStore | ((state: WorkflowStore) => WorkflowStore), replace: true): unknown;
|
|
6
|
+
persist: {
|
|
7
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<WorkflowStore, any, unknown>>) => void;
|
|
8
|
+
clearStorage: () => void;
|
|
9
|
+
rehydrate: () => Promise<void> | void;
|
|
10
|
+
hasHydrated: () => boolean;
|
|
11
|
+
onHydrate: (fn: (state: WorkflowStore) => void) => () => void;
|
|
12
|
+
onFinishHydration: (fn: (state: WorkflowStore) => void) => () => void;
|
|
13
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<WorkflowStore, any, unknown>>;
|
|
14
|
+
};
|
|
15
|
+
}, "temporal"> & {
|
|
16
|
+
temporal: import("zustand").StoreApi<import("zundo").TemporalState<{
|
|
17
|
+
workflowDef: WorkflowDef | null;
|
|
18
|
+
layoutDirection: LayoutDirection;
|
|
19
|
+
nodes: import("../types/workflow").WorkflowNode[];
|
|
20
|
+
edges: import("reactflow").Edge[];
|
|
21
|
+
taskMap: Record<string, TaskDef>;
|
|
22
|
+
theme: ThemeMode;
|
|
23
|
+
themeColor: ThemeColor;
|
|
24
|
+
mode: EditorMode;
|
|
25
|
+
edgeType: string;
|
|
26
|
+
nodesLocked: boolean;
|
|
27
|
+
copiedTask: TaskDef | null;
|
|
28
|
+
}>>;
|
|
29
|
+
}>;
|
|
30
|
+
export default useWorkflowStore;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conductor 任务类型枚举
|
|
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';
|
|
5
|
+
/**
|
|
6
|
+
* Conductor 任务定义
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Conductor 任务定义
|
|
10
|
+
*/
|
|
11
|
+
export interface TaskDef {
|
|
12
|
+
/** 任务名称 (必须唯一) */
|
|
13
|
+
name: string;
|
|
14
|
+
/** 任务引用名称 (在工作流内必须唯一) */
|
|
15
|
+
taskReferenceName: string;
|
|
16
|
+
/** 任务类型 */
|
|
17
|
+
type: TaskType;
|
|
18
|
+
/** 任务描述 */
|
|
19
|
+
description?: string;
|
|
20
|
+
/**
|
|
21
|
+
* 输入参数映射
|
|
22
|
+
* 支持 JSONPath 表达式 (e.g. `${workflow.input.value}`)
|
|
23
|
+
*/
|
|
24
|
+
inputParameters?: Record<string, any>;
|
|
25
|
+
/** Decision case key 参数名 */
|
|
26
|
+
caseValueParam?: string;
|
|
27
|
+
/** 分支定义映射 (caseValue -> Task List) */
|
|
28
|
+
decisionCases?: Record<string, TaskDef[]>;
|
|
29
|
+
/** 默认分支 */
|
|
30
|
+
defaultCase?: TaskDef[];
|
|
31
|
+
/** 并行分支列表 */
|
|
32
|
+
forkTasks?: TaskDef[][];
|
|
33
|
+
dynamicForkTasksParam?: string;
|
|
34
|
+
dynamicForkTasksInputParamName?: string;
|
|
35
|
+
joinOn?: string[];
|
|
36
|
+
loopCondition?: string;
|
|
37
|
+
loopOver?: TaskDef[];
|
|
38
|
+
subWorkflowParam?: {
|
|
39
|
+
name: string;
|
|
40
|
+
version?: number;
|
|
41
|
+
};
|
|
42
|
+
optional?: boolean;
|
|
43
|
+
asyncComplete?: boolean;
|
|
44
|
+
startDelay?: number;
|
|
45
|
+
httpRequest?: {
|
|
46
|
+
method?: string;
|
|
47
|
+
uri?: string;
|
|
48
|
+
headers?: Record<string, string>;
|
|
49
|
+
body?: any;
|
|
50
|
+
};
|
|
51
|
+
sink?: string;
|
|
52
|
+
caseExpression?: string;
|
|
53
|
+
retryCount?: number;
|
|
54
|
+
timeoutSeconds?: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Conductor 工作流定义
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* Conductor 工作流定义
|
|
61
|
+
*/
|
|
62
|
+
export interface WorkflowDef {
|
|
63
|
+
/** 工作流名称 */
|
|
64
|
+
name: string;
|
|
65
|
+
/** 工作流描述 */
|
|
66
|
+
description?: string;
|
|
67
|
+
/** 版本号 */
|
|
68
|
+
version?: number;
|
|
69
|
+
/** 任务列表 (DAG 定义) */
|
|
70
|
+
tasks: TaskDef[];
|
|
71
|
+
/** 输入参数定义 (用于文档生成) */
|
|
72
|
+
inputParameters?: any[];
|
|
73
|
+
/** 输出参数映射 */
|
|
74
|
+
outputParameters?: Record<string, any>;
|
|
75
|
+
schemaVersion?: number;
|
|
76
|
+
restartable?: boolean;
|
|
77
|
+
workflowStatusListenerEnabled?: boolean;
|
|
78
|
+
ownerEmail?: string;
|
|
79
|
+
timeoutPolicy?: 'TIME_OUT_WF' | 'ALERT_ONLY';
|
|
80
|
+
timeoutSeconds?: number;
|
|
81
|
+
variables?: Record<string, any>;
|
|
82
|
+
/** 失败时触发的补偿工作流名称 */
|
|
83
|
+
failureWorkflow?: string;
|
|
84
|
+
/** 默认输入模板 */
|
|
85
|
+
inputTemplate?: Record<string, any>;
|
|
86
|
+
/** 状态事件发送目标 */
|
|
87
|
+
workflowStatusListenerSink?: string;
|
|
88
|
+
/** 并发限流配置 */
|
|
89
|
+
rateLimitConfig?: {
|
|
90
|
+
rateLimitKey?: string;
|
|
91
|
+
concurrentExecLimit?: number;
|
|
92
|
+
};
|
|
93
|
+
/** 输入 Schema 定义 */
|
|
94
|
+
inputSchema?: {
|
|
95
|
+
name?: string;
|
|
96
|
+
type?: string;
|
|
97
|
+
};
|
|
98
|
+
/** 输出 Schema 定义 */
|
|
99
|
+
outputSchema?: {
|
|
100
|
+
name?: string;
|
|
101
|
+
type?: string;
|
|
102
|
+
};
|
|
103
|
+
/** 是否强制 Schema 校验 */
|
|
104
|
+
enforceSchema?: boolean;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Conductor 任务实例 (运行时)
|
|
108
|
+
*/
|
|
109
|
+
export interface TaskInstance {
|
|
110
|
+
taskType: string;
|
|
111
|
+
status: 'IN_PROGRESS' | 'CANCELED' | 'FAILED' | 'FAILED_WITH_TERMINAL_ERROR' | 'COMPLETED' | 'COMPLETED_WITH_ERRORS' | 'SCHEDULED' | 'TIMED_OUT' | 'SKIPPED';
|
|
112
|
+
inputData?: Record<string, any>;
|
|
113
|
+
outputData?: Record<string, any>;
|
|
114
|
+
referenceTaskName: string;
|
|
115
|
+
retryCount?: number;
|
|
116
|
+
iteration?: number;
|
|
117
|
+
seq?: number;
|
|
118
|
+
correlationId?: string;
|
|
119
|
+
pollCount?: number;
|
|
120
|
+
taskDefName?: string;
|
|
121
|
+
scheduledTime?: number;
|
|
122
|
+
startTime?: number;
|
|
123
|
+
endTime?: number;
|
|
124
|
+
updateTime?: number;
|
|
125
|
+
startDelayInSeconds?: number;
|
|
126
|
+
retriedTaskId?: string;
|
|
127
|
+
retried?: boolean;
|
|
128
|
+
executed?: boolean;
|
|
129
|
+
callbackFromWorker?: boolean;
|
|
130
|
+
responseTimeoutSeconds?: number;
|
|
131
|
+
workflowInstanceId: string;
|
|
132
|
+
workflowType?: string;
|
|
133
|
+
taskId: string;
|
|
134
|
+
reasonForIncompletion?: string;
|
|
135
|
+
callbackAfterSeconds?: number;
|
|
136
|
+
workerId?: string;
|
|
137
|
+
externalInputPayloadStoragePath?: string;
|
|
138
|
+
externalOutputPayloadStoragePath?: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Conductor 工作流实例 (运行时)
|
|
142
|
+
*/
|
|
143
|
+
export interface WorkflowInstance {
|
|
144
|
+
status: 'RUNNING' | 'COMPLETED' | 'FAILED' | 'TIMED_OUT' | 'TERMINATED' | 'PAUSED';
|
|
145
|
+
endTime?: number;
|
|
146
|
+
workflowId: string;
|
|
147
|
+
parentWorkflowId?: string;
|
|
148
|
+
parentWorkflowTaskId?: string;
|
|
149
|
+
tasks: TaskInstance[];
|
|
150
|
+
input?: Record<string, any>;
|
|
151
|
+
output?: Record<string, any>;
|
|
152
|
+
correlationId?: string;
|
|
153
|
+
reRunFromWorkflowId?: string;
|
|
154
|
+
reasonForIncompletion?: string;
|
|
155
|
+
event?: string;
|
|
156
|
+
taskToDomain?: Record<string, string>;
|
|
157
|
+
failedReferenceTaskNames?: string[];
|
|
158
|
+
failedTaskNames?: string[];
|
|
159
|
+
workflowDefinition: WorkflowDef;
|
|
160
|
+
externalInputPayloadStoragePath?: string;
|
|
161
|
+
externalOutputPayloadStoragePath?: string;
|
|
162
|
+
priority?: number;
|
|
163
|
+
variables?: Record<string, any>;
|
|
164
|
+
lastRetriedTime?: number;
|
|
165
|
+
createTime: number;
|
|
166
|
+
updateTime?: number;
|
|
167
|
+
startTime?: number;
|
|
168
|
+
createdBy?: string;
|
|
169
|
+
updatedBy?: string;
|
|
170
|
+
}
|