< Summary

Information
Class: Elsa.Workflows.Api.ShellFeatures.WorkflowsApiFeature
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/ShellFeatures/WorkflowsApiFeature.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 10
Coverable lines: 10
Total lines: 48
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
ConfigureServices(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/ShellFeatures/WorkflowsApiFeature.cs

#LineLine coverage
 1using CShells.FastEndpoints.Features;
 2using CShells.Features;
 3using Elsa.Extensions;
 4using Elsa.Workflows.Api.Constants;
 5using Elsa.Workflows.Api.Contracts;
 6using Elsa.Workflows.Api.Requirements;
 7using Elsa.Workflows.Api.Serialization;
 8using Elsa.Workflows.Api.Services;
 9using JetBrains.Annotations;
 10using Microsoft.AspNetCore.Authorization;
 11using Microsoft.Extensions.DependencyInjection;
 12
 13namespace Elsa.Workflows.Api.ShellFeatures;
 14
 15/// <summary>
 16/// Adds workflows API features with FastEndpoints support.
 17/// </summary>
 18/// <remarks>
 19/// This feature implements <see cref="IFastEndpointsShellFeature"/> to indicate that this assembly
 20/// contains FastEndpoints that should be automatically discovered and registered.
 21/// </remarks>
 22[ShellFeature(
 23    DisplayName = "Workflows API",
 24    Description = "Provides REST API endpoints for workflow management",
 25    DependsOn =
 26[
 27    "ElsaFastEndpoints",
 28    "WorkflowInstances",
 29    "WorkflowManagement",
 30    "WorkflowRuntime",
 31    "SasTokens"
 32])]
 33[UsedImplicitly]
 34public class WorkflowsApiFeature : IFastEndpointsShellFeature
 35{
 36    public void ConfigureServices(IServiceCollection services)
 37    {
 038        services.AddSerializationOptionsConfigurator<SerializationConfigurator>();
 039        services.AddScoped<IWorkflowDefinitionLinker, StaticWorkflowDefinitionLinker>();
 040        services.AddScoped<IAuthorizationHandler, NotReadOnlyRequirementHandler>();
 041        services.Configure<AuthorizationOptions>(options =>
 042        {
 043            options.AddPolicy(AuthorizationPolicies.NotReadOnlyPolicy, policy => policy.AddRequirements(new NotReadOnlyR
 044        });
 045        services.AddScoped<IWorkflowInstanceExportNameProvider, DefaultWorkflowInstanceExportNameProvider>();
 046        services.AddSingleton<IShellReloadOrchestrator, ShellReloadOrchestrator>();
 047    }
 48}