< Summary

Information
Class: Elsa.Workflows.Api.Endpoints.Scripting.ExpressionDescriptors.List.ExpressionDescriptorModel
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/Scripting/ExpressionDescriptors/List/Endpoint.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 1
Coverable lines: 1
Total lines: 45
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
get_Type()100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/Scripting/ExpressionDescriptors/List/Endpoint.cs

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Expressions.Contracts;
 3using Elsa.Expressions.Models;
 4using Elsa.Models;
 5using JetBrains.Annotations;
 6
 7namespace Elsa.Workflows.Api.Endpoints.Scripting.ExpressionDescriptors.List;
 8
 9/// <summary>
 10/// Returns a TypeScript definition that is used by the Monaco editor to display intellisense for JavaScript expressions
 11/// </summary>
 12[UsedImplicitly]
 13internal class List(IExpressionDescriptorRegistry expressionDescriptorRegistry) : ElsaEndpointWithoutRequest<ListRespons
 14{
 15    /// <inheritdoc />
 16    public override void Configure()
 17    {
 18        Get("/descriptors/expression-descriptors");
 19        ConfigurePermissions("read:*", "read:expression-descriptors");
 20    }
 21
 22    /// <inheritdoc />
 23    public override Task HandleAsync(CancellationToken cancellationToken)
 24    {
 25        var descriptors = expressionDescriptorRegistry.ListAll().ToList();
 26        var models = Map(descriptors).ToList();
 27        var response = new ListResponse<ExpressionDescriptorModel>(models);
 28        return Send.OkAsync(response, cancellationToken);
 29    }
 30
 31    private static IEnumerable<ExpressionDescriptorModel> Map(List<ExpressionDescriptor> descriptors) => descriptors.Sel
 32
 33    private static ExpressionDescriptorModel Map(ExpressionDescriptor descriptor)
 34    {
 35        var properties = descriptor.Properties;
 36        return new ExpressionDescriptorModel(
 37            descriptor.Type,
 38            descriptor.DisplayName,
 39            descriptor.IsSerializable,
 40            descriptor.IsBrowsable,
 41            properties);
 42    }
 43}
 44
 045internal record ExpressionDescriptorModel(string Type, string DisplayName, bool IsSerializable, bool IsBrowsable, IDicti

Methods/Properties

get_Type()