2022-05-27 10:36:39 +00:00
|
|
|
using Elsa.Expressions.Features;
|
2022-05-26 15:05:36 +00:00
|
|
|
using Elsa.Expressions.Services;
|
2022-12-31 15:16:43 +00:00
|
|
|
using Elsa.Extensions;
|
2022-05-27 10:36:39 +00:00
|
|
|
using Elsa.Features.Abstractions;
|
|
|
|
|
using Elsa.Features.Attributes;
|
|
|
|
|
using Elsa.Features.Services;
|
2022-11-28 18:12:01 +00:00
|
|
|
using Elsa.JavaScript.Activities;
|
2022-05-26 15:05:36 +00:00
|
|
|
using Elsa.JavaScript.Expressions;
|
|
|
|
|
using Elsa.JavaScript.Implementations;
|
|
|
|
|
using Elsa.JavaScript.Providers;
|
|
|
|
|
using Elsa.JavaScript.Services;
|
2022-05-27 10:36:39 +00:00
|
|
|
using Elsa.Mediator.Features;
|
2022-11-28 18:12:01 +00:00
|
|
|
using Elsa.Workflows.Management.Implementations;
|
2022-05-26 15:05:36 +00:00
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
2022-05-27 10:36:39 +00:00
|
|
|
namespace Elsa.JavaScript.Features;
|
2022-05-26 15:05:36 +00:00
|
|
|
|
2022-12-30 12:11:29 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Installs JavaScript integration.
|
|
|
|
|
/// </summary>
|
2022-05-27 10:36:39 +00:00
|
|
|
[DependsOn(typeof(MediatorFeature))]
|
|
|
|
|
[DependsOn(typeof(ExpressionsFeature))]
|
|
|
|
|
public class JavaScriptFeature : FeatureBase
|
2022-05-26 15:05:36 +00:00
|
|
|
{
|
2022-12-30 12:11:29 +00:00
|
|
|
/// <inheritdoc />
|
2022-05-27 10:36:39 +00:00
|
|
|
public JavaScriptFeature(IModule module) : base(module)
|
2022-05-26 15:05:36 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-30 20:52:41 +00:00
|
|
|
/// <inheritdoc />
|
2022-05-26 15:05:36 +00:00
|
|
|
public override void Configure()
|
|
|
|
|
{
|
|
|
|
|
Services
|
|
|
|
|
.AddSingleton<IExpressionSyntaxProvider, JavaScriptExpressionSyntaxProvider>()
|
|
|
|
|
.AddSingleton<IJavaScriptEvaluator, JintJavaScriptEvaluator>()
|
2022-11-28 18:12:01 +00:00
|
|
|
.AddSingleton<IActivityPropertyOptionsProvider, RunJavaScriptOptionsProvider>()
|
2022-12-30 12:11:29 +00:00
|
|
|
.AddExpressionHandler<JavaScriptExpressionHandler, JavaScriptExpression>()
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
Module.UseWorkflowManagement(management => management.AddActivitiesFrom<JavaScriptFeature>());
|
2022-05-26 15:05:36 +00:00
|
|
|
}
|
|
|
|
|
}
|