< Summary

Information
Class: Elsa.Workflows.Api.Features.WorkflowsApiFeature
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Features/WorkflowsApiFeature.cs
Line coverage
100%
Covered lines: 14
Uncovered lines: 0
Coverable lines: 14
Total lines: 48
Line coverage: 100%
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
.ctor(...)100%11100%
Configure()100%11100%
Apply()100%11100%

File(s)

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

#LineLine coverage
 1using Elsa.Extensions;
 2using Elsa.Features.Abstractions;
 3using Elsa.Features.Attributes;
 4using Elsa.Features.Services;
 5using Elsa.SasTokens.Features;
 6using Elsa.Workflows.Api.Constants;
 7using Elsa.Workflows.Api.Contracts;
 8using Elsa.Workflows.Api.Requirements;
 9using Elsa.Workflows.Api.Serialization;
 10using Elsa.Workflows.Api.Services;
 11using Elsa.Workflows.Management.Features;
 12using Elsa.Workflows.Runtime.Features;
 13using Microsoft.AspNetCore.Authorization;
 14using Microsoft.Extensions.DependencyInjection;
 15
 16namespace Elsa.Workflows.Api.Features;
 17
 18/// <summary>
 19/// Adds workflows API features.
 20/// </summary>
 21[DependsOn(typeof(WorkflowInstancesFeature))]
 22[DependsOn(typeof(WorkflowManagementFeature))]
 23[DependsOn(typeof(WorkflowRuntimeFeature))]
 24[DependsOn(typeof(SasTokensFeature))]
 325public class WorkflowsApiFeature(IModule module) : FeatureBase(module)
 26{
 27    /// <inheritdoc />
 28    public override void Configure()
 29    {
 330        Module.AddFastEndpointsAssembly(GetType());
 331    }
 32
 33    /// <inheritdoc />
 34    public override void Apply()
 35    {
 336        Services.AddSerializationOptionsConfigurator<SerializationConfigurator>();
 337        Module.AddFastEndpointsFromModule();
 38
 339        Services.AddScoped<IWorkflowDefinitionLinker, StaticWorkflowDefinitionLinker>();
 340        Services.AddScoped<IAuthorizationHandler, NotReadOnlyRequirementHandler>();
 341        Services.Configure<AuthorizationOptions>(options =>
 342        {
 643            options.AddPolicy(AuthorizationPolicies.NotReadOnlyPolicy, policy => policy.AddRequirements(new NotReadOnlyR
 644        });
 345        Services.AddScoped<IWorkflowInstanceExportNameProvider, DefaultWorkflowInstanceExportNameProvider>();
 346        Services.AddSingleton<IShellReloadOrchestrator, ShellReloadOrchestrator>();
 347    }
 48}