@@ -18,6 +18,9 @@ import (
1818 "fmt"
1919 "time"
2020
21+ "github.com/serverlessworkflow/sdk-go/v3/impl/expr"
22+ "github.com/serverlessworkflow/sdk-go/v3/impl/utils"
23+
2124 "github.com/serverlessworkflow/sdk-go/v3/impl/ctx"
2225 "github.com/serverlessworkflow/sdk-go/v3/model"
2326)
@@ -35,6 +38,8 @@ func NewTaskRunner(taskName string, task model.Task, workflowDef *model.Workflow
3538 return NewForTaskRunner (taskName , t )
3639 case * model.CallHTTP :
3740 return NewCallHttpRunner (taskName , t )
41+ case * model.ForkTask :
42+ return NewForkTaskRunner (taskName , t , workflowDef )
3843 default :
3944 return nil , fmt .Errorf ("unsupported task type '%T' for task '%s'" , t , taskName )
4045 }
@@ -117,7 +122,7 @@ func (d *DoTaskRunner) runTasks(input interface{}, taskSupport TaskSupport) (out
117122 }
118123
119124 taskSupport .SetTaskStatus (currentTask .Key , ctx .CompletedStatus )
120- input = deepCloneValue (output )
125+ input = utils . DeepCloneValue (output )
121126 idx , currentTask = d .TaskList .Next (idx )
122127 }
123128
@@ -126,7 +131,7 @@ func (d *DoTaskRunner) runTasks(input interface{}, taskSupport TaskSupport) (out
126131
127132func (d * DoTaskRunner ) shouldRunTask (input interface {}, taskSupport TaskSupport , task * model.TaskItem ) (bool , error ) {
128133 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 ())
130135 if err != nil {
131136 return false , model .NewErrExpression (err , task .Key )
132137 }
@@ -143,7 +148,7 @@ func (d *DoTaskRunner) evaluateSwitchTask(input interface{}, taskSupport TaskSup
143148 defaultThen = switchCase .Then
144149 continue
145150 }
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 ())
147152 if err != nil {
148153 return nil , model .NewErrExpression (err , taskKey )
149154 }
@@ -199,11 +204,11 @@ func (d *DoTaskRunner) processTaskInput(task *model.TaskBase, taskInput interfac
199204 return taskInput , nil
200205 }
201206
202- if err = validateSchema (taskInput , task .Input .Schema , taskName ); err != nil {
207+ if err = utils . ValidateSchema (taskInput , task .Input .Schema , taskName ); err != nil {
203208 return nil , err
204209 }
205210
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 {
207212 return nil , err
208213 }
209214
@@ -216,11 +221,11 @@ func (d *DoTaskRunner) processTaskOutput(task *model.TaskBase, taskOutput interf
216221 return taskOutput , nil
217222 }
218223
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 {
220225 return nil , err
221226 }
222227
223- if err = validateSchema (output , task .Output .Schema , taskName ); err != nil {
228+ if err = utils . ValidateSchema (output , task .Output .Schema , taskName ); err != nil {
224229 return nil , err
225230 }
226231
@@ -232,12 +237,12 @@ func (d *DoTaskRunner) processTaskExport(task *model.TaskBase, taskOutput interf
232237 return nil
233238 }
234239
235- output , err := traverseAndEvaluate (task .Export .As , taskOutput , taskName , taskSupport .GetContext ())
240+ output , err := expr . TraverseAndEvaluateObj (task .Export .As , taskOutput , taskName , taskSupport .GetContext ())
236241 if err != nil {
237242 return err
238243 }
239244
240- if err = validateSchema (output , task .Export .Schema , taskName ); err != nil {
245+ if err = utils . ValidateSchema (output , task .Export .Schema , taskName ); err != nil {
241246 return nil
242247 }
243248
0 commit comments