using Elsa.Expressions.Helpers; using Elsa.Expressions.Models; using Elsa.Extensions; // ReSharper disable InconsistentNaming namespace Elsa.Python.Models; /// /// Provides access to activity outputs. /// public class OutputProxy { /// /// Initializes a new instance of the class. /// public OutputProxy(ExpressionExecutionContext expressionExecutionContext) { Context = expressionExecutionContext; } /// /// Gets the expression execution context. /// public ExpressionExecutionContext Context { get; } /// /// Gets the value of the specified output. /// /// The ID or name of the activity that produced the output. /// The name of the output. /// The value of the output. public object? get(string activityIdOrName, string? outputName = default) => Context.GetOutput(activityIdOrName, outputName); /// /// Gets the value of the specified output. /// /// The type to convert the output value to. /// The ID or name of the activity that produced the output. /// The name of the output. /// The value of the output. public object? get(Type returnType, string activityIdOrName, string? outputName = default) => get(activityIdOrName, outputName).ConvertTo(returnType); /// /// Gets the result of the last activity that executed. /// public object? last_result => Context.GetLastResult(); }