Skip to content

Commit 42409a0

Browse files
authored
Merge pull request #99 from neuroglia-io/add-workflow-expression-variable
Fixed the WorkflowRuntimeContext by renaming the CONTEXT runtime expression variable into `WORKFLOW`
2 parents b98fa0f + 44f8bfd commit 42409a0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/apps/Synapse.Worker/Services/WorkflowRuntimeContext.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,28 +175,28 @@ protected virtual async Task<IDictionary<string, object>> BuildRuntimExpressionA
175175
{
176176
var args = new Dictionary<string, object>
177177
{
178-
{ "CONTEXT", await this.BuildRuntimeExpressionContextArgumentAsync(cancellationToken) },
178+
{ "WORKFLOW", await this.BuildWorkflowExpressionContextArgumentAsync(cancellationToken) },
179179
{ "CONST", await this.BuildRuntimeExpressionConstantsArgumentAsync(cancellationToken) },
180180
{ "SECRETS", await this.BuildRuntimeExpressionSecretsArgumentAsync(cancellationToken) }
181181
};
182182
return args;
183183
}
184184

185185
/// <summary>
186-
/// Builds the runtime expression '$CONTEXT' argument object
186+
/// Builds the runtime expression '$WORKFLOW' argument object
187187
/// </summary>
188188
/// <param name="cancellationToken">A <see cref="CancellationToken"/></param>
189-
/// <returns>The runtime expression '$CONTEXT' argument object</returns>
190-
protected virtual async Task<object> BuildRuntimeExpressionContextArgumentAsync(CancellationToken cancellationToken)
189+
/// <returns>The runtime expression '$WORKFLOW' argument object</returns>
190+
protected virtual async Task<object> BuildWorkflowExpressionContextArgumentAsync(CancellationToken cancellationToken)
191191
{
192-
return new
192+
return await Task.FromResult(new
193193
{
194194
workflow = new
195195
{
196196
id = this.Workflow.Definition.GetUniqueIdentifier(),
197197
instanceId = this.Workflow.Instance.Id
198198
}
199-
}; //todo
199+
});
200200
}
201201

202202
/// <summary>
@@ -206,10 +206,10 @@ protected virtual async Task<object> BuildRuntimeExpressionContextArgumentAsync(
206206
/// <returns>The runtime expression '$CONST' argument object</returns>
207207
protected virtual async Task<object> BuildRuntimeExpressionConstantsArgumentAsync(CancellationToken cancellationToken)
208208
{
209-
var constants = this.Workflow.Definition.Constants?.ToObject(); //todo
209+
var constants = this.Workflow.Definition.Constants?.ToObject();
210210
if (constants == null)
211211
constants = new();
212-
return constants;
212+
return await Task.FromResult(constants);
213213
}
214214

215215
/// <summary>

0 commit comments

Comments
 (0)