2023-03-03 21:47:23 +00:00
|
|
|
using Elsa.Expressions.Contracts;
|
2022-05-26 10:47:31 +00:00
|
|
|
using Elsa.Expressions.Models;
|
2023-11-14 19:44:42 +00:00
|
|
|
using Elsa.Extensions;
|
2022-05-26 10:47:31 +00:00
|
|
|
using Elsa.JavaScript.Expressions;
|
2023-11-14 19:44:42 +00:00
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2022-01-11 12:28:21 +00:00
|
|
|
|
2022-05-26 10:47:31 +00:00
|
|
|
namespace Elsa.JavaScript.Providers;
|
2022-01-11 12:28:21 +00:00
|
|
|
|
2023-11-14 19:44:42 +00:00
|
|
|
internal class JavaScriptExpressionDescriptorProvider : IExpressionDescriptorProvider
|
2022-01-11 12:28:21 +00:00
|
|
|
{
|
2023-11-14 19:44:42 +00:00
|
|
|
private const string TypeName = "JavaScript";
|
2022-01-11 12:28:21 +00:00
|
|
|
|
2023-12-10 20:43:24 +00:00
|
|
|
public IEnumerable<ExpressionDescriptor> GetDescriptors()
|
2022-01-11 12:28:21 +00:00
|
|
|
{
|
2023-12-10 20:43:24 +00:00
|
|
|
yield return new()
|
|
|
|
|
{
|
|
|
|
|
Type = TypeName,
|
|
|
|
|
DisplayName = "JavaScript",
|
|
|
|
|
Properties = new { MonacoLanguage = "javascript" }.ToDictionary(),
|
|
|
|
|
HandlerFactory = ActivatorUtilities.GetServiceOrCreateInstance<JavaScriptExpressionHandler>
|
|
|
|
|
};
|
2022-01-11 12:28:21 +00:00
|
|
|
}
|
|
|
|
|
}
|