@@ -18,6 +18,9 @@ import (
18
18
"fmt"
19
19
"time"
20
20
21
+ "github.com/serverlessworkflow/sdk-go/v3/impl/expr"
22
+ "github.com/serverlessworkflow/sdk-go/v3/impl/utils"
23
+
21
24
"github.com/serverlessworkflow/sdk-go/v3/impl/ctx"
22
25
"github.com/serverlessworkflow/sdk-go/v3/model"
23
26
)
@@ -35,6 +38,8 @@ func NewTaskRunner(taskName string, task model.Task, workflowDef *model.Workflow
35
38
return NewForTaskRunner (taskName , t )
36
39
case * model.CallHTTP :
37
40
return NewCallHttpRunner (taskName , t )
41
+ case * model.ForkTask :
42
+ return NewForkTaskRunner (taskName , t , workflowDef )
38
43
default :
39
44
return nil , fmt .Errorf ("unsupported task type '%T' for task '%s'" , t , taskName )
40
45
}
@@ -117,7 +122,7 @@ func (d *DoTaskRunner) runTasks(input interface{}, taskSupport TaskSupport) (out
117
122
}
118
123
119
124
taskSupport .SetTaskStatus (currentTask .Key , ctx .CompletedStatus )
120
- input = deepCloneValue (output )
125
+ input = utils . DeepCloneValue (output )
121
126
idx , currentTask = d .TaskList .Next (idx )
122
127
}
123
128
@@ -126,7 +131,7 @@ func (d *DoTaskRunner) runTasks(input interface{}, taskSupport TaskSupport) (out
126
131
127
132
func (d * DoTaskRunner ) shouldRunTask (input interface {}, taskSupport TaskSupport , task * model.TaskItem ) (bool , error ) {
128
133
if task .GetBase ().If != nil {
129
- output , err := traverseAndEvaluateBool (task .GetBase ().If .String (), input , taskSupport .GetContext ())
134
+ output , err := expr . TraverseAndEvaluateBool (task .GetBase ().If .String (), input , taskSupport .GetContext ())
130
135
if err != nil {
131
136
return false , model .NewErrExpression (err , task .Key )
132
137
}
@@ -143,7 +148,7 @@ func (d *DoTaskRunner) evaluateSwitchTask(input interface{}, taskSupport TaskSup
143
148
defaultThen = switchCase .Then
144
149
continue
145
150
}
146
- result , err := traverseAndEvaluateBool (model .NormalizeExpr (switchCase .When .String ()), input , taskSupport .GetContext ())
151
+ result , err := expr . TraverseAndEvaluateBool (model .NormalizeExpr (switchCase .When .String ()), input , taskSupport .GetContext ())
147
152
if err != nil {
148
153
return nil , model .NewErrExpression (err , taskKey )
149
154
}
@@ -199,11 +204,11 @@ func (d *DoTaskRunner) processTaskInput(task *model.TaskBase, taskInput interfac
199
204
return taskInput , nil
200
205
}
201
206
202
- if err = validateSchema (taskInput , task .Input .Schema , taskName ); err != nil {
207
+ if err = utils . ValidateSchema (taskInput , task .Input .Schema , taskName ); err != nil {
203
208
return nil , err
204
209
}
205
210
206
- if output , err = traverseAndEvaluate (task .Input .From , taskInput , taskName , taskSupport .GetContext ()); err != nil {
211
+ if output , err = expr . TraverseAndEvaluateObj (task .Input .From , taskInput , taskName , taskSupport .GetContext ()); err != nil {
207
212
return nil , err
208
213
}
209
214
@@ -216,11 +221,11 @@ func (d *DoTaskRunner) processTaskOutput(task *model.TaskBase, taskOutput interf
216
221
return taskOutput , nil
217
222
}
218
223
219
- if output , err = traverseAndEvaluate (task .Output .As , taskOutput , taskName , taskSupport .GetContext ()); err != nil {
224
+ if output , err = expr . TraverseAndEvaluateObj (task .Output .As , taskOutput , taskName , taskSupport .GetContext ()); err != nil {
220
225
return nil , err
221
226
}
222
227
223
- if err = validateSchema (output , task .Output .Schema , taskName ); err != nil {
228
+ if err = utils . ValidateSchema (output , task .Output .Schema , taskName ); err != nil {
224
229
return nil , err
225
230
}
226
231
@@ -232,12 +237,12 @@ func (d *DoTaskRunner) processTaskExport(task *model.TaskBase, taskOutput interf
232
237
return nil
233
238
}
234
239
235
- output , err := traverseAndEvaluate (task .Export .As , taskOutput , taskName , taskSupport .GetContext ())
240
+ output , err := expr . TraverseAndEvaluateObj (task .Export .As , taskOutput , taskName , taskSupport .GetContext ())
236
241
if err != nil {
237
242
return err
238
243
}
239
244
240
- if err = validateSchema (output , task .Export .Schema , taskName ); err != nil {
245
+ if err = utils . ValidateSchema (output , task .Export .Schema , taskName ); err != nil {
241
246
return nil
242
247
}
243
248
0 commit comments