elsa-core/src/modules/Elsa.Dsl/Contracts/IFunctionActivityRegistry.cs
Raymond den Haan b092d62bcc Added Service for searching through ActivityRegistry
Added Refreshing of registry on miss when searching
2024-06-07 14:01:14 +02:00

33 lines
1.6 KiB
C#

using Elsa.Dsl.Models;
using Elsa.Workflows.Contracts;
namespace Elsa.Dsl.Contracts;
/// <summary>
/// Provides a registry for mapping functions to activities that can be invoked from a DSL script.
/// </summary>
public interface IFunctionActivityRegistry
{
/// <summary>
/// Registers a function that is mapped to an activity that can be invoked from a DSL script.
/// </summary>
/// <param name="functionName">The name of the function.</param>
/// <param name="activityTypeName">The name of the activity type.</param>
/// <param name="propertyNames">The names of the properties that are mapped to the function arguments.</param>
/// <param name="configure">An optional action that can be used to configure the activity.</param>
void RegisterFunction(string functionName, string activityTypeName, IEnumerable<string>? propertyNames = default, Action<IActivity>? configure = default);
/// <summary>
/// Registers a function that is mapped to an activity that can be invoked from a DSL script.
/// </summary>
/// <param name="descriptor">The descriptor that describes the function.</param>
void RegisterFunction(FunctionActivityDescriptor descriptor);
/// <summary>
/// Resolves a function to an activity that can be invoked from a DSL script.
/// </summary>
/// <param name="functionName">The name of the function.</param>
/// <param name="arguments">The arguments that are passed to the function.</param>
/// <returns>An activity that can be invoked from a DSL script.</returns>
Task<IActivity> ResolveFunction(string functionName, IEnumerable<object?>? arguments = default);
}