Update package versions and use new FastEnpoints methods.

- Updated `Directory.Packages.props` with new package versions, including `ElsaStudioVersion`, `MicrosoftVersion`, and others.
- Changed `System.Formats.Asn1` version in `_build.csproj`.
- Re-factored `Endpoint.cs` to use new `Send` methods for updated FastEndpoints packages.
This commit is contained in:
Matt 2025-08-05 23:50:40 +01:00
parent dd8a6f5866
commit c36f1c977b
63 changed files with 142 additions and 314 deletions

View file

@ -4,8 +4,8 @@
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<PropertyGroup>
<ElsaStudioVersion>3.6.0-preview.1170</ElsaStudioVersion>
<MicrosoftVersion>9.0.7</MicrosoftVersion>
<ElsaStudioVersion>3.6.0-preview.1175</ElsaStudioVersion>
<MicrosoftVersion>9.0.8</MicrosoftVersion>
<ResilienceVersion>9.7.0</ResilienceVersion>
</PropertyGroup>
<ItemGroup>
@ -17,13 +17,13 @@
<PackageVersion Include="AppAny.Quartz.EntityFrameworkCore.Migrations.SQLite" Version="0.5.1"/>
<PackageVersion Include="AspNetCore.Authentication.ApiKey" Version="9.0.0"/>
<PackageVersion Include="AutoMapper" Version="14.0.0" PrivateAssets="All"/>
<PackageVersion Include="Azure.Identity" Version="1.14.0"/>
<PackageVersion Include="Azure.Identity" Version="1.14.2"/>
<PackageVersion Include="Azure.Messaging.ServiceBus" Version="7.19.0"/>
<PackageVersion Include="Azure.ResourceManager" Version="1.13.1"/>
<PackageVersion Include="Azure.ResourceManager.AppContainers" Version="1.3.0"/>
<PackageVersion Include="Azure.ResourceManager.Resources" Version="1.9.1"/>
<PackageVersion Include="Azure.ResourceManager.ServiceBus" Version="1.1.0"/>
<PackageVersion Include="BenchmarkDotNet" Version="0.15.1"/>
<PackageVersion Include="BenchmarkDotNet" Version="0.15.2"/>
<PackageVersion Include="Bogus" Version="35.6.3"/>
<PackageVersion Include="ConfigureAwait.Fody" Version="3.3.2" PrivateAssets="All"/>
<PackageVersion Include="Confluent.Kafka" Version="2.10.0"/>
@ -42,14 +42,14 @@
<PackageVersion Include="Elsa.Studio.Agents" Version="$(ElsaStudioVersion)"/>
<PackageVersion Include="Elsa.Studio.Core.BlazorWasm" Version="$(ElsaStudioVersion)"/>
<PackageVersion Include="Elsa.Studio.Login.BlazorWasm" Version="$(ElsaStudioVersion)"/>
<PackageVersion Include="FastEndpoints" Version="6.1.0"/>
<PackageVersion Include="FastEndpoints.Security" Version="6.1.0"/>
<PackageVersion Include="FastEndpoints.Swagger" Version="6.1.0"/>
<PackageVersion Include="FastEndpoints" Version="7.0.1"/>
<PackageVersion Include="FastEndpoints.Security" Version="7.0.1"/>
<PackageVersion Include="FastEndpoints.Swagger" Version="7.0.1"/>
<PackageVersion Include="FluentMigrator" Version="7.1.0"/>
<PackageVersion Include="FluentMigrator.Runner" Version="7.1.0"/>
<PackageVersion Include="FluentStorage" Version="5.6.0"/>
<PackageVersion Include="FluentStorage.Azure.Blobs" Version="5.3.0"/>
<PackageVersion Include="Fluid.Core" Version="2.24.0"/>
<PackageVersion Include="Fluid.Core" Version="2.25.0"/>
<PackageVersion Include="Fody" Version="6.9.2"/>
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1"/>
<PackageVersion Include="Google.Protobuf" Version="3.31.1"/>
@ -61,8 +61,8 @@
<PackageVersion Include="Hangfire.Storage.SQLite" Version="0.4.2"/>
<PackageVersion Include="Humanizer.Core" Version="2.14.1"/>
<PackageVersion Include="IronCompress" Version="1.6.3"/>
<PackageVersion Include="JetBrains.Annotations" Version="2024.3.0"/>
<PackageVersion Include="Jint" Version="4.2.2"/>
<PackageVersion Include="JetBrains.Annotations" Version="2025.2.0"/>
<PackageVersion Include="Jint" Version="4.4.1"/>
<PackageVersion Include="LinqKit.Core" Version="1.2.8"/>
<PackageVersion Include="MailKit" Version="4.12.1"/>
<PackageVersion Include="MassTransit" Version="8.4.1"/>
@ -130,8 +130,8 @@
<PackageVersion Include="OpenTelemetry.Instrumentation.SqlClient" Version="1.12.0-beta.1"/>
<PackageVersion Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.12.0-beta.1"/>
<PackageVersion Include="Oracle.EntityFrameworkCore" Version="9.23.80"/>
<PackageVersion Include="Polly" Version="8.6.0"/>
<PackageVersion Include="Polly.Extensions" Version="8.6.0"/>
<PackageVersion Include="Polly" Version="8.6.2"/>
<PackageVersion Include="Polly.Extensions" Version="8.6.2"/>
<PackageVersion Include="Polly.Extensions.Http" Version="3.0.0"/>
<PackageVersion Include="PolySharp" Version="1.15.0"/>
<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="9.0.0-preview.3.efcore.9.0.0"/>
@ -156,194 +156,22 @@
<PackageVersion Include="StackExchange.Redis" Version="2.8.37"/>
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1"/>
<PackageVersion Include="System.Data.SqlClient" Version="4.9.0"/>
<PackageVersion Include="System.Linq.Async" Version="6.0.1"/>
<PackageVersion Include="System.Linq.Dynamic.Core" Version="1.6.5"/>
<PackageVersion Include="System.Linq.Async" Version="6.0.3"/>
<PackageVersion Include="System.Linq.Dynamic.Core" Version="1.6.7"/>
<PackageVersion Include="System.Net.Http" Version="4.3.4"/>
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1"/>
<PackageVersion Include="System.Formats.Asn1" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="System.Text.Json" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Testcontainers" Version="4.5.0"/>
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.5.0"/>
<PackageVersion Include="Testcontainers.RabbitMq" Version="4.5.0"/>
<PackageVersion Include="Testcontainers.Redis" Version="4.5.0"/>
<PackageVersion Include="Testcontainers" Version="4.6.0"/>
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.6.0"/>
<PackageVersion Include="Testcontainers.RabbitMq" Version="4.6.0"/>
<PackageVersion Include="Testcontainers.Redis" Version="4.6.0"/>
<PackageVersion Include="ThrottleDebounce" Version="2.0.1"/>
<PackageVersion Include="WebhooksCore" Version="0.0.1"/>
<PackageVersion Include="xunit" Version="2.9.3"/>
<PackageVersion Include="xunit.abstractions" Version="2.0.3"/>
<PackageVersion Include="xunit.extensibility.core" Version="2.9.3"/>
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.1"/>
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.3"/>
<PackageVersion Include="Yarp.ReverseProxy" Version="2.3.0"/>
</ItemGroup>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<PropertyGroup>
<ElsaStudioVersion>3.6.0-preview.1170</ElsaStudioVersion>
<MicrosoftVersion>9.0.7</MicrosoftVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Antlr4.Runtime.Standard" Version="4.13.1"/>
<PackageVersion Include="AppAny.Quartz.EntityFrameworkCore.Migrations" Version="0.5.1"/>
<PackageVersion Include="AppAny.Quartz.EntityFrameworkCore.Migrations.MySql" Version="0.5.1"/>
<PackageVersion Include="AppAny.Quartz.EntityFrameworkCore.Migrations.PostgreSQL" Version="0.5.1"/>
<PackageVersion Include="AppAny.Quartz.EntityFrameworkCore.Migrations.SqlServer" Version="0.5.1"/>
<PackageVersion Include="AppAny.Quartz.EntityFrameworkCore.Migrations.SQLite" Version="0.5.1"/>
<PackageVersion Include="AspNetCore.Authentication.ApiKey" Version="9.0.0"/>
<PackageVersion Include="AutoMapper" Version="14.0.0" PrivateAssets="All"/>
<PackageVersion Include="Azure.Identity" Version="1.14.0"/>
<PackageVersion Include="Azure.Messaging.ServiceBus" Version="7.19.0"/>
<PackageVersion Include="Azure.ResourceManager" Version="1.13.1"/>
<PackageVersion Include="Azure.ResourceManager.AppContainers" Version="1.3.0"/>
<PackageVersion Include="Azure.ResourceManager.Resources" Version="1.9.1"/>
<PackageVersion Include="Azure.ResourceManager.ServiceBus" Version="1.1.0"/>
<PackageVersion Include="BenchmarkDotNet" Version="0.15.1"/>
<PackageVersion Include="Bogus" Version="35.6.3"/>
<PackageVersion Include="ConfigureAwait.Fody" Version="3.3.2" PrivateAssets="All"/>
<PackageVersion Include="Confluent.Kafka" Version="2.10.0"/>
<PackageVersion Include="Confluent.SchemaRegistry.Serdes.Avro" Version="2.10.0"/>
<PackageVersion Include="coverlet.collector" Version="6.0.4" PrivateAssets="All"/>
<PackageVersion Include="Cronos" Version="0.11.0"/>
<PackageVersion Include="Dapper" Version="2.1.66"/>
<PackageVersion Include="Datadog.Trace.Bundle" Version="3.16.0"/>
<PackageVersion Include="DistributedLock.Core" Version="1.0.8"/>
<PackageVersion Include="DistributedLock.FileSystem" Version="1.0.3"/>
<PackageVersion Include="DistributedLock.Postgres" Version="1.3.0"/>
<PackageVersion Include="DistributedLock.Redis" Version="1.0.3"/>
<PackageVersion Include="Elastic.Clients.Elasticsearch" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Elsa.Studio" Version="$(ElsaStudioVersion)"/>
<PackageVersion Include="Elsa.Studio.Agents" Version="$(ElsaStudioVersion)"/>
<PackageVersion Include="Elsa.Studio.Core.BlazorWasm" Version="$(ElsaStudioVersion)"/>
<PackageVersion Include="Elsa.Studio.Login.BlazorWasm" Version="$(ElsaStudioVersion)"/>
<PackageVersion Include="FastEndpoints" Version="6.1.0"/>
<PackageVersion Include="FastEndpoints.Security" Version="6.1.0"/>
<PackageVersion Include="FastEndpoints.Swagger" Version="6.1.0"/>
<PackageVersion Include="FluentMigrator" Version="7.1.0"/>
<PackageVersion Include="FluentMigrator.Runner" Version="7.1.0"/>
<PackageVersion Include="FluentStorage" Version="5.6.0"/>
<PackageVersion Include="FluentStorage.Azure.Blobs" Version="5.3.0"/>
<PackageVersion Include="Fluid.Core" Version="2.24.0"/>
<PackageVersion Include="Fody" Version="6.9.2"/>
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1"/>
<PackageVersion Include="Google.Protobuf" Version="3.31.1"/>
<PackageVersion Include="Grpc.Net.Client" Version="2.71.0"/>
<PackageVersion Include="Grpc.Tools" Version="2.72.0"/>
<PackageVersion Include="Hangfire" Version="1.8.20"/>
<PackageVersion Include="Hangfire.MemoryStorage" Version="1.8.1.1"/>
<PackageVersion Include="Hangfire.PostgreSql" Version="1.20.12"/>
<PackageVersion Include="Hangfire.Storage.SQLite" Version="0.4.2"/>
<PackageVersion Include="Humanizer.Core" Version="2.14.1"/>
<PackageVersion Include="IronCompress" Version="1.6.3"/>
<PackageVersion Include="JetBrains.Annotations" Version="2024.3.0"/>
<PackageVersion Include="Jint" Version="4.3.0"/>
<PackageVersion Include="LinqKit.Core" Version="1.2.8"/>
<PackageVersion Include="MailKit" Version="4.12.1"/>
<PackageVersion Include="MassTransit" Version="8.4.1"/>
<PackageVersion Include="MassTransit.Azure.ServiceBus.Core" Version="8.4.1"/>
<PackageVersion Include="MassTransit.Extensions.DependencyInjection" Version="7.3.1"/>
<PackageVersion Include="MassTransit.RabbitMQ" Version="8.4.1"/>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.14.0"/>
<PackageVersion Include="Microsoft.Data.SqlClient" Version="6.0.2"/>
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite.Design" Version="1.1.6"/>
<PackageVersion Include="Microsoft.Identity.Client" Version="4.72.1"/>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1"/>
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0"/>
<PackageVersion Include="MongoDB.Driver" Version="3.4.0"/>
<PackageVersion Include="MongoDB.Driver.Core.Extensions.DiagnosticSources" Version="2.1.0"/>
<PackageVersion Include="MongoDB.Driver.Extensions" Version="2.0.2"/>
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3"/>
<PackageVersion Include="NSubstitute" Version="5.3.0"/>
<PackageVersion Include="NuGet.Packaging" Version="6.14.0"/>
<PackageVersion Include="NuGet.Protocol" Version="6.14.0"/>
<PackageVersion Include="Nuke.Components" Version="9.0.4"/>
<PackageVersion Include="Open.Linq.AsyncExtensions" Version="1.2.0"/>
<PackageVersion Include="OpenTelemetry" Version="1.12.0"/>
<PackageVersion Include="OpenTelemetry.AutoInstrumentation" Version="1.11.0"/>
<PackageVersion Include="OpenTelemetry.Exporter.Console" Version="1.12.0"/>
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.12.0"/>
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.12.0"/>
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.12.0"/>
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.12.0"/>
<PackageVersion Include="OpenTelemetry.Instrumentation.SqlClient" Version="1.12.0-beta.1"/>
<PackageVersion Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.12.0-beta.1"/>
<PackageVersion Include="Polly" Version="8.6.0"/>
<PackageVersion Include="Polly.Extensions" Version="8.6.0"/>
<PackageVersion Include="Polly.Extensions.Http" Version="3.0.0"/>
<PackageVersion Include="PolySharp" Version="1.15.0"/>
<PackageVersion Include="Pomelo.EntityFrameworkCore.MySql" Version="9.0.0-preview.3.efcore.9.0.0"/>
<PackageVersion Include="Proto.Actor" Version="1.7.0"/>
<PackageVersion Include="Proto.Cluster" Version="1.7.0"/>
<PackageVersion Include="Proto.Cluster.CodeGen" Version="1.7.0"/>
<PackageVersion Include="Proto.Cluster.AzureContainerApps" Version="1.7.0"/>
<PackageVersion Include="Proto.Cluster.Kubernetes" Version="1.7.0"/>
<PackageVersion Include="Proto.Cluster.TestProvider" Version="1.7.0"/>
<PackageVersion Include="Proto.OpenTelemetry" Version="1.7.0"/>
<PackageVersion Include="Proto.Persistence" Version="1.7.0"/>
<PackageVersion Include="Proto.Persistence.Sqlite" Version="1.7.0"/>
<PackageVersion Include="Proto.Persistence.SqlServer" Version="1.7.0"/>
<PackageVersion Include="Proto.Remote" Version="1.7.0"/>
<PackageVersion Include="pythonnet" Version="3.1.0-preview2024-09-06"/>
<PackageVersion Include="Quartz.Extensions.Hosting" Version="3.14.0"/>
<PackageVersion Include="Quartz.Serialization.Json" Version="3.14.0"/>
<PackageVersion Include="Scrutor" Version="6.1.0"/>
<PackageVersion Include="ShortGuid" Version="2.0.1"/>
<PackageVersion Include="StackExchange.Redis" Version="2.8.37"/>
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1"/>
<PackageVersion Include="System.Data.SqlClient" Version="4.9.0"/>
<PackageVersion Include="System.Linq.Async" Version="6.0.1"/>
<PackageVersion Include="System.Linq.Dynamic.Core" Version="1.6.5"/>
<PackageVersion Include="System.Net.Http" Version="4.3.4"/>
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1"/>
<PackageVersion Include="System.Formats.Asn1" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="System.Text.Json" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Testcontainers" Version="4.5.0"/>
<PackageVersion Include="Testcontainers.PostgreSql" Version="4.5.0"/>
<PackageVersion Include="Testcontainers.RabbitMq" Version="4.5.0"/>
<PackageVersion Include="Testcontainers.Redis" Version="4.5.0"/>
<PackageVersion Include="ThrottleDebounce" Version="2.0.1"/>
<PackageVersion Include="WebhooksCore" Version="0.0.1"/>
<PackageVersion Include="Yarp.ReverseProxy" Version="2.3.0"/>
<PackageVersion Include="Microsoft.AspNetCore.Authorization" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.AspNetCore.Components" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.AspNetCore.DataProtection.Abstractions" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Data.Sqlite" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Data.Sqlite.Core" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.Http" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.Http.Polly" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.Logging" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.Options" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="$(MicrosoftVersion)"/>
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="$(ResilienceVersion)"/>
<PackageVersion Include="Microsoft.Extensions.Resilience" Version="$(ResilienceVersion)"/>
<PackageVersion Include="MySql.Data" Version="9.3.0"/>
<PackageVersion Include="Npgsql" Version="9.0.3"/>
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4"/>
<PackageVersion Include="Oracle.EntityFrameworkCore" Version="9.23.80"/>
<PackageVersion Include="Refit" Version="8.0.0"/>
<PackageVersion Include="Refit.HttpClientFactory" Version="8.0.0"/>
<PackageVersion Include="xunit.abstractions" Version="2.0.3"/>
<PackageVersion Include="xunit.extensibility.core" Version="2.9.3"/>
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.1"/>
<PackageVersion Include="xunit" Version="2.9.3"/>
</ItemGroup>
</Project>

View file

@ -24,7 +24,7 @@
<!--Overridden for vulnerability reasons with dependencies referencing older versions.-->
<ItemGroup>
<PackageReference Include="System.Formats.Asn1" Version="9.0.5" />
<PackageReference Include="System.Formats.Asn1" Version="9.0.8" />
</ItemGroup>
</Project>

View file

@ -40,7 +40,7 @@ internal class Get : ElsaEndpoint<Request>
if (workflowGraph == null)
{
AddError($"Workflow definition {request.WorkflowDefinitionId} not found");
await SendErrorsAsync(cancellation: cancellationToken);
await Send.ErrorsAsync(cancellation: cancellationToken);
return;
}
@ -49,7 +49,7 @@ internal class Get : ElsaEndpoint<Request>
var fileName = $"elsa.{request.WorkflowDefinitionId}.d.ts";
var data = Encoding.UTF8.GetBytes(typeDefinitions);
await SendBytesAsync(data, fileName, "application/x-typescript", cancellation: cancellationToken);
await Send.BytesAsync(data, fileName, "application/x-typescript", cancellation: cancellationToken);
}
private async Task<WorkflowGraph?> GetWorkflowGraphAsync(string workflowDefinitionId, CancellationToken cancellationToken)

View file

@ -82,6 +82,6 @@ internal class Create : ElsaEndpoint<Request, Response>
hashedClientSecret.EncodeSecret(),
hashedClientSecret.EncodeSalt());
await SendOkAsync(response, cancellationToken);
await Send.OkAsync(response, cancellationToken);
}
}

View file

@ -60,6 +60,6 @@ internal class Create : ElsaEndpoint<Request, Response>
role.Name,
role.Permissions);
await SendOkAsync(response, cancellationToken);
await Send.OkAsync(response, cancellationToken);
}
}

View file

@ -67,6 +67,6 @@ internal class Create : ElsaEndpoint<Request, Response>
hashedPassword.EncodeSecret(),
hashedPassword.EncodeSalt());
await SendOkAsync(response, cancellationToken);
await Send.OkAsync(response, cancellationToken);
}
}

View file

@ -23,12 +23,12 @@ public class Endpoint(IRetryAttemptReader reader) : ElsaEndpointWithoutRequest
if (string.IsNullOrWhiteSpace(activityInstanceId))
{
AddError("ActivityInstanceId is required.");
await SendErrorsAsync(cancellation: ct);
await Send.ErrorsAsync(cancellation: ct);
return;
}
var page = await reader.ReadAttemptsAsync(activityInstanceId, pageArgs, ct);
var response = new PagedListResponse<RetryAttemptRecord>(page);
await SendOkAsync(response, ct);
await Send.OkAsync(response, ct);
}
}

View file

@ -43,7 +43,7 @@ public class SimulateResponseEndpoint(IMemoryCache memoryCache) : EndpointWithou
});
}
await SendAsync(new(message), currentCode, ct);
await Send.ResponseAsync(new(message), currentCode, ct);
}
private int[] GetCodes()

View file

@ -25,7 +25,7 @@ public class Endpoint(ITenantService tenantService, IIdentityGenerator identityG
};
await tenantStore.AddAsync(tenant, ct);
await tenantService.RefreshAsync(ct);
await SendOkAsync(tenant, ct);
await Send.OkAsync(tenant, ct);
}
}

View file

@ -18,11 +18,11 @@ public class Endpoint(ITenantService tenantService, ITenantStore store) : ElsaEn
if (!found)
{
await SendNotFoundAsync(ct);
await Send.NotFoundAsync(ct);
return;
}
await tenantService.RefreshAsync(ct);
await SendOkAsync(ct);
await Send.OkAsync(ct);
}
}

View file

@ -19,10 +19,10 @@ public class Endpoint(ITenantService tenantService) : ElsaEndpointWithoutRequest
if (tenant == null)
{
await SendNotFoundAsync(ct);
await Send.NotFoundAsync(ct);
return;
}
await SendOkAsync(tenant, ct);
await Send.OkAsync(tenant, ct);
}
}

View file

@ -20,6 +20,6 @@ public class Endpoint(ITenantService tenantService) : ElsaEndpointWithoutRequest
var tenants = await tenantService.ListAsync(ct);
var response = new ListResponse<Tenant>(tenants.ToList());
var json = JsonSerializer.Serialize(response, SerializerOptions.ConfigurationJsonSerializerOptions);
await SendStringAsync(json, contentType: MediaTypeNames.Application.Json, cancellation: ct);
await Send.StringAsync(json, contentType: MediaTypeNames.Application.Json, cancellation: ct);
}
}

View file

@ -14,6 +14,6 @@ public class Endpoint(ITenantService tenantService) : ElsaEndpointWithoutRequest
public override async Task HandleAsync(CancellationToken ct)
{
await tenantService.RefreshAsync(ct);
await SendOkAsync(ct);
await Send.OkAsync(ct);
}
}

View file

@ -21,7 +21,7 @@ public class Endpoint(ITenantService tenantService, ITenantStore tenantStore) :
if (tenant == null)
{
await SendNotFoundAsync(ct);
await Send.NotFoundAsync(ct);
return;
}
@ -30,7 +30,7 @@ public class Endpoint(ITenantService tenantService, ITenantStore tenantStore) :
tenant.Configuration = Serializers.DeserializeConfiguration(req.Configuration);
await tenantStore.UpdateAsync(tenant, ct);
await tenantService.RefreshAsync(ct);
await SendOkAsync(tenant, ct);
await Send.OkAsync(tenant, ct);
}
}

View file

@ -30,18 +30,18 @@ internal class Get : ElsaEndpoint<Request, Response>
{
var descriptor = request.Version == null ? await _registryLookup.FindAsync(request.ActivityTypeName) : await _registryLookup.FindAsync(request.ActivityTypeName, request.Version.Value);
if (descriptor == null)
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
var propertyDescriptor = descriptor!.Inputs.FirstOrDefault(x => x.Name == request.PropertyName);
if(propertyDescriptor == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
var inputOptions = await _optionsResolver.GetUIPropertiesAsync(propertyDescriptor.PropertyInfo!, request.Context, cancellationToken);
await SendOkAsync(new Response(inputOptions), cancellationToken);
await Send.OkAsync(new Response(inputOptions), cancellationToken);
}
}

View file

@ -28,8 +28,8 @@ internal class Get : ElsaEndpoint<Request, ActivityDescriptor>
var descriptor = request.Version == null ? await _registryLookup.FindAsync(request.TypeName) : await _registryLookup.FindAsync(request.TypeName, request.Version.Value);
if (descriptor == null)
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
else
await SendOkAsync(descriptor, cancellationToken);
await Send.OkAsync(descriptor, cancellationToken);
}
}

View file

@ -32,10 +32,10 @@ internal class Endpoint(IActivityExecutionStore store) : ElsaEndpointWithoutRequ
if (record == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
await SendOkAsync(record, cancellationToken);
await Send.OkAsync(record, cancellationToken);
}
}

View file

@ -33,14 +33,14 @@ internal class Resume(ITokenService tokenService, IBookmarkQueue bookmarkQueue,
if (ValidationFailed)
{
await SendErrorsAsync(cancellation: cancellationToken);
await Send.ErrorsAsync(cancellation: cancellationToken);
return;
}
await ResumeBookmarkedWorkflowAsync(payload, input, cancellationToken);
if (!HttpContext.Response.HasStarted)
await SendOkAsync(cancellationToken);
await Send.OkAsync(cancellationToken);
}
private IDictionary<string, object>? GetInputFromQueryString()

View file

@ -39,14 +39,14 @@ internal class Trigger : ElsaEndpoint<Request>
if (workflowExecutionMode == WorkflowExecutionMode.Asynchronous)
{
await _eventPublisher.PublishAsync(eventName, correlationId, workflowInstanceId, activityInstanceId, input, true, cancellationToken);
await SendOkAsync(cancellationToken);
await Send.OkAsync(cancellationToken);
}
else
{
await _eventPublisher.PublishAsync(eventName, correlationId, workflowInstanceId, activityInstanceId, input, false, cancellationToken);
if (!HttpContext.Response.HasStarted)
await SendOkAsync(cancellationToken);
await Send.OkAsync(cancellationToken);
}
}
}

View file

@ -36,7 +36,7 @@ internal class Trigger : ElsaEndpointWithoutRequest
if (!_tokenService.TryDecryptToken<EventTokenPayload>(token, out var payload))
{
AddError("Invalid token.");
await SendErrorsAsync(cancellation: cancellationToken);
await Send.ErrorsAsync(cancellation: cancellationToken);
return;
}
@ -45,6 +45,6 @@ internal class Trigger : ElsaEndpointWithoutRequest
await _eventPublisher.PublishAsync(eventName, workflowInstanceId: workflowInstanceId, cancellationToken: cancellationToken);
if (!HttpContext.Response.HasStarted)
await SendOkAsync(cancellationToken);
await Send.OkAsync(cancellationToken);
}
}

View file

@ -34,10 +34,10 @@ internal class Get : ElsaEndpointWithoutRequest<FeatureDescriptor>
if (descriptor == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
await SendOkAsync(descriptor, cancellationToken);
await Send.OkAsync(descriptor, cancellationToken);
}
}

View file

@ -22,7 +22,7 @@ internal class Version : EndpointWithoutRequest<Response>
var versionAttribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
var version = RemoveAutoGeneratedPostfix(versionAttribute);
await SendOkAsync(new Response(version), cancellationToken);
await Send.OkAsync(new Response(version), cancellationToken);
}
private static string RemoveAutoGeneratedPostfix(AssemblyInformationalVersionAttribute? versionAttribute) =>

View file

@ -25,7 +25,7 @@ internal class List(IExpressionDescriptorRegistry expressionDescriptorRegistry)
var descriptors = expressionDescriptorRegistry.ListAll().ToList();
var models = Map(descriptors).ToList();
var response = new ListResponse<ExpressionDescriptorModel>(models);
return SendOkAsync(response, cancellationToken);
return Send.OkAsync(response, cancellationToken);
}
private static IEnumerable<ExpressionDescriptorModel> Map(List<ExpressionDescriptor> descriptors) => descriptors.Select(Map);

View file

@ -28,6 +28,6 @@ public class Complete : ElsaEndpoint<Request, Response>
public override async Task HandleAsync(Request request, CancellationToken cancellationToken)
{
await _taskReporter.ReportCompletionAsync(request.TaskId, request.Result, cancellationToken);
if (!HttpContext.Response.HasStarted) await SendOkAsync(cancellationToken);
if (!HttpContext.Response.HasStarted) await Send.OkAsync(cancellationToken);
}
}

View file

@ -37,7 +37,7 @@ internal class Endpoint(
if (workflowGraph == null)
{
AddError("Workflow definition not found.");
await SendErrorsAsync(cancellation: cancellationToken);
await Send.ErrorsAsync(cancellation: cancellationToken);
return;
}
@ -46,7 +46,7 @@ internal class Endpoint(
if (activity == null)
{
AddError("Activity not found.");
await SendErrorsAsync(cancellation: cancellationToken);
await Send.ErrorsAsync(cancellation: cancellationToken);
return;
}
@ -63,7 +63,7 @@ internal class Endpoint(
Status = record.Status
};
await SendOkAsync(response, cancellationToken);
await Send.OkAsync(response, cancellationToken);
}
}

View file

@ -23,7 +23,7 @@ internal class BulkDelete(IWorkflowDefinitionManager workflowDefinitionManager,
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
await Send.ForbiddenAsync(cancellationToken);
return null!;
}

View file

@ -23,7 +23,7 @@ internal class BulkDeleteVersions(IWorkflowDefinitionManager workflowDefinitionM
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
await Send.ForbiddenAsync(cancellationToken);
return null!;
}

View file

@ -26,7 +26,7 @@ internal class Endpoint(IWorkflowDefinitionService workflowDefinitionService, IW
if (workflowGraph == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
@ -48,6 +48,6 @@ internal class Endpoint(IWorkflowDefinitionService workflowDefinitionService, IW
instanceIds.Add(instanceId);
}
await SendOkAsync(new Response(instanceIds), cancellationToken);
await Send.OkAsync(new Response(instanceIds), cancellationToken);
}
}

View file

@ -25,7 +25,7 @@ internal class BulkPublish(IWorkflowDefinitionStore store, IWorkflowDefinitionPu
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
await Send.ForbiddenAsync(cancellationToken);
return null!;
}

View file

@ -25,7 +25,7 @@ internal class BulkRetract(IWorkflowDefinitionStore store, IWorkflowDefinitionPu
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
await Send.ForbiddenAsync(cancellationToken);
return null!;
}

View file

@ -20,6 +20,6 @@ internal class Count(IWorkflowDefinitionStore store) : ElsaEndpointWithoutReques
{
var count = await store.CountDistinctAsync(cancellationToken);
var response = new Response(count);
await SendOkAsync(response, cancellationToken);
await Send.OkAsync(response, cancellationToken);
}
}

View file

@ -29,7 +29,7 @@ internal class Delete(IWorkflowDefinitionManager workflowDefinitionManager, IAut
if (definition == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
@ -37,15 +37,15 @@ internal class Delete(IWorkflowDefinitionManager workflowDefinitionManager, IAut
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
await Send.ForbiddenAsync(cancellationToken);
return;
}
var result = await workflowDefinitionManager.DeleteByDefinitionIdAsync(request.DefinitionId, cancellationToken);
if (result == 0)
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
else
await SendNoContentAsync(cancellationToken);
await Send.NoContentAsync(cancellationToken);
}
}

View file

@ -23,15 +23,15 @@ internal class DeleteVersion(IWorkflowDefinitionManager workflowDefinitionManage
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
await Send.ForbiddenAsync(cancellationToken);
return;
}
var deleted = await workflowDefinitionManager.DeleteByIdAsync(request.Id, cancellationToken);
if (!deleted)
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
else
await SendNoContentAsync(cancellationToken);
await Send.NoContentAsync(cancellationToken);
}
}

View file

@ -24,7 +24,7 @@ internal class Endpoint(IWorkflowDefinitionService workflowDefinitionService, IW
if(workflowGraph == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
@ -33,7 +33,7 @@ internal class Endpoint(IWorkflowDefinitionService workflowDefinitionService, IW
if(input != null && input is not IDictionary<string, object>)
{
AddError("Input must be a dictionary.");
await SendErrorsAsync(cancellation: cancellationToken);
await Send.ErrorsAsync(cancellation: cancellationToken);
return;
}
@ -57,10 +57,10 @@ internal class Endpoint(IWorkflowDefinitionService workflowDefinitionService, IW
{
var fault = result.Fault!;
AddError(fault.Message, fault.Code);
await SendErrorsAsync(cancellation: cancellationToken);
await Send.ErrorsAsync(cancellation: cancellationToken);
return;
}
await SendOkAsync(new Response(instanceId), cancellationToken);
await Send.OkAsync(new Response(instanceId), cancellationToken);
}
}

View file

@ -35,7 +35,7 @@ internal abstract class EndpointBase<T>(
if (workflowGraph == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
@ -57,7 +57,7 @@ internal abstract class EndpointBase<T>(
if (startResponse.CannotStart)
{
await SendOkAsync(cancellationToken);
await Send.OkAsync(cancellationToken);
return;
}
@ -89,7 +89,7 @@ internal abstract class EndpointBase<T>(
if (HttpContext.Response.StatusCode == StatusCodes.Status200OK)
{
var workflowState = await workflowClient.ExportStateAsync(cancellationToken);
await SendOkAsync(new(workflowState), cancellationToken);
await Send.OkAsync(new(workflowState), cancellationToken);
}
}
}

View file

@ -61,7 +61,7 @@ internal class Export : ElsaEndpoint<Request>
if (!definitions.Any())
{
await SendNoContentAsync(cancellationToken);
await Send.NoContentAsync(cancellationToken);
return;
}
@ -82,7 +82,7 @@ internal class Export : ElsaEndpoint<Request>
// Send the zip file to the client:
zipStream.Position = 0;
await SendBytesAsync(zipStream.ToArray(), "workflow-definitions.zip", cancellation: cancellationToken);
await Send.BytesAsync(zipStream.ToArray(), "workflow-definitions.zip", cancellation: cancellationToken);
}
private async Task DownloadSingleWorkflowAsync(string definitionId, string? versionOptions, CancellationToken cancellationToken)
@ -96,7 +96,7 @@ internal class Export : ElsaEndpoint<Request>
if (definition == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
@ -104,7 +104,7 @@ internal class Export : ElsaEndpoint<Request>
var binaryJson = await SerializeWorkflowDefinitionAsync(model, cancellationToken);
var fileName = GetFileName(model);
await SendBytesAsync(binaryJson, fileName, cancellation: cancellationToken);
await Send.BytesAsync(binaryJson, fileName, cancellation: cancellationToken);
}
private string GetFileName(WorkflowDefinitionModel definition)

View file

@ -23,11 +23,11 @@ internal class GetByDefinitionId(IWorkflowDefinitionStore store, IWorkflowDefini
if (definition == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
var model = await linker.MapAsync(definition, cancellationToken);
await SendOkAsync(model, cancellationToken);
await Send.OkAsync(model, cancellationToken);
}
}

View file

@ -27,11 +27,11 @@ internal class GetById(IWorkflowDefinitionStore store, IWorkflowDefinitionLinker
if (definition == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
var model = await linker.MapAsync(definition, cancellationToken);
await SendOkAsync(model, cancellationToken);
await Send.OkAsync(model, cancellationToken);
}
}

View file

@ -26,6 +26,6 @@ internal class GetManyById(IWorkflowDefinitionStore store, IWorkflowDefinitionLi
var definitions = (await store.FindManyAsync(filter, cancellationToken)).ToList();
var models = await linker.MapAsync(definitions, cancellationToken);
var response = new ListResponse<LinkedWorkflowDefinitionModel>(models);
await SendOkAsync(response, cancellationToken);
await Send.OkAsync(response, cancellationToken);
}
}

View file

@ -23,7 +23,7 @@ internal class Graph(IWorkflowDefinitionService workflowDefinitionService, IApiS
if (workflowGraph == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}

View file

@ -26,7 +26,7 @@ internal class Nodes(IWorkflowDefinitionService workflowDefinitionService, IApiS
if (workflowGraph?.Root == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
@ -35,7 +35,7 @@ internal class Nodes(IWorkflowDefinitionService workflowDefinitionService, IApiS
if (!workflowGraph.NodeIdLookup.TryGetValue(nodeId, out var childNode))
{
AddError("Unknown node ID");
await SendErrorsAsync(cancellation: cancellationToken);
await Send.ErrorsAsync(cancellation: cancellationToken);
return;
}

View file

@ -49,7 +49,7 @@ internal class Import : ElsaEndpoint<WorkflowDefinitionModel>
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
await Send.ForbiddenAsync(cancellationToken);
return;
}
@ -58,13 +58,13 @@ internal class Import : ElsaEndpoint<WorkflowDefinitionModel>
if (result.Succeeded)
{
if (isNew)
await SendCreatedAtAsync<GetByDefinitionId.GetByDefinitionId>(new { DefinitionId = definitionId }, updatedModel, cancellation: cancellationToken);
await Send.CreatedAtAsync<GetByDefinitionId.GetByDefinitionId>(new { DefinitionId = definitionId }, updatedModel, cancellation: cancellationToken);
else
await SendOkAsync(updatedModel, cancellationToken);
await Send.OkAsync(updatedModel, cancellationToken);
}
if (ValidationFailed)
await SendErrorsAsync(400, cancellationToken);
await Send.ErrorsAsync(400, cancellationToken);
}
private async Task<ImportWorkflowResult> ImportSingleWorkflowDefinitionAsync(WorkflowDefinitionModel model, CancellationToken cancellationToken)

View file

@ -53,7 +53,7 @@ internal class ImportFiles : ElsaEndpoint<WorkflowDefinitionModel>
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
await Send.ForbiddenAsync(cancellationToken);
return;
}
@ -62,11 +62,11 @@ internal class ImportFiles : ElsaEndpoint<WorkflowDefinitionModel>
var count = await ImportFilesAsync(Files, cancellationToken);
if (!ValidationFailed)
await SendOkAsync(new { Count = count }, cancellationToken);
await Send.OkAsync(new { Count = count }, cancellationToken);
}
if (ValidationFailed)
await SendErrorsAsync(400, cancellationToken);
await Send.ErrorsAsync(400, cancellationToken);
}
private async Task<int> ImportFilesAsync(IFormFileCollection files, CancellationToken cancellationToken)

View file

@ -21,6 +21,6 @@ internal class IsNameUnique(IWorkflowDefinitionStore store) : ElsaEndpoint<Reque
var isUnique = await store.GetIsNameUnique(request.Name.Trim(), request.DefinitionId, cancellationToken);
var response = new Response(isUnique);
await SendOkAsync(response, cancellationToken);
await Send.OkAsync(response, cancellationToken);
}
}

View file

@ -60,7 +60,7 @@ internal class Post(
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
await Send.ForbiddenAsync(cancellationToken);
return;
}
@ -96,7 +96,7 @@ internal class Post(
foreach (var validationError in result.ValidationErrors)
AddError(validationError.Message);
await SendErrorsAsync(400, cancellationToken);
await Send.ErrorsAsync(400, cancellationToken);
return;
}
}

View file

@ -31,7 +31,7 @@ internal class Publish(IWorkflowDefinitionStore store, IWorkflowDefinitionPublis
if (definition == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
@ -39,7 +39,7 @@ internal class Publish(IWorkflowDefinitionStore store, IWorkflowDefinitionPublis
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
await Send.ForbiddenAsync(cancellationToken);
return;
}
@ -47,6 +47,6 @@ internal class Publish(IWorkflowDefinitionStore store, IWorkflowDefinitionPublis
var result = !isPublished ? await workflowDefinitionPublisher.PublishAsync(definition, cancellationToken) : null;
var mappedDefinition = await linker.MapAsync(definition, cancellationToken);
var response = new Response(mappedDefinition, isPublished, result?.AffectedWorkflows.WorkflowDefinitions.Count ?? 0);
await SendOkAsync(response, cancellationToken);
await Send.OkAsync(response, cancellationToken);
}
}

View file

@ -20,7 +20,7 @@ internal class Refresh(IWorkflowDefinitionsRefresher workflowDefinitionsRefreshe
public override async Task HandleAsync(Request request, CancellationToken cancellationToken)
{
var result = await RefreshWorkflowDefinitionsAsync(request.DefinitionIds, cancellationToken);
await SendOkAsync(new Response(result.Refreshed, result.NotFound), cancellationToken);
await Send.OkAsync(new Response(result.Refreshed, result.NotFound), cancellationToken);
}
private async Task<RefreshWorkflowDefinitionsResponse> RefreshWorkflowDefinitionsAsync(ICollection<string>? definitionIds, CancellationToken cancellationToken)

View file

@ -18,7 +18,7 @@ internal class Reload(IWorkflowDefinitionsReloader workflowDefinitionsReloader)
public override async Task HandleAsync(CancellationToken cancellationToken)
{
await ReloadWorkflowDefinitionsAsync(cancellationToken);
await SendOkAsync(cancellationToken);
await Send.OkAsync(cancellationToken);
}
private async Task ReloadWorkflowDefinitionsAsync(CancellationToken cancellationToken)

View file

@ -32,7 +32,7 @@ internal class Retract(IWorkflowDefinitionStore store, IWorkflowDefinitionPublis
if (definition == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
@ -40,19 +40,19 @@ internal class Retract(IWorkflowDefinitionStore store, IWorkflowDefinitionPublis
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
await Send.ForbiddenAsync(cancellationToken);
return;
}
if (!definition.IsPublished)
{
AddError($"Workflow with id {request.DefinitionId} is not published");
await SendErrorsAsync(cancellation: cancellationToken);
await Send.ErrorsAsync(cancellation: cancellationToken);
return;
}
await workflowDefinitionPublisher.RetractAsync(definition, cancellationToken);
var response = await linker.MapAsync(definition, cancellationToken);
await SendOkAsync(response, cancellationToken);
await Send.OkAsync(response, cancellationToken);
}
}

View file

@ -32,7 +32,7 @@ internal class UpdateReferences(IWorkflowReferenceUpdater workflowReferenceUpdat
if (definition == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
@ -40,13 +40,13 @@ internal class UpdateReferences(IWorkflowReferenceUpdater workflowReferenceUpdat
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
await Send.ForbiddenAsync(cancellationToken);
return;
}
var result = await workflowReferenceUpdater.UpdateWorkflowReferencesAsync(definition, cancellationToken);
var affectedWorkflows = result.UpdatedWorkflows;
var response = new Response(affectedWorkflows.Select(w => w.Name ?? w.DefinitionId));
await SendOkAsync(response, cancellationToken);
await Send.OkAsync(response, cancellationToken);
}
}

View file

@ -38,7 +38,7 @@ public class DeleteVersion(IWorkflowDefinitionManager workflowDefinitionManager,
if (definition == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
@ -46,7 +46,7 @@ public class DeleteVersion(IWorkflowDefinitionManager workflowDefinitionManager,
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
await Send.ForbiddenAsync(cancellationToken);
return;
}
@ -54,10 +54,10 @@ public class DeleteVersion(IWorkflowDefinitionManager workflowDefinitionManager,
if (!result)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
await SendOkAsync(cancellationToken);
await Send.OkAsync(cancellationToken);
}
}

View file

@ -32,10 +32,10 @@ internal class ListVersions(IWorkflowDefinitionStore store) : ElsaEndpointWithou
if (!definitions.Any())
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
await SendAsync(definitions, StatusCodes.Status200OK, cancellationToken);
await Send.OkAsync(definitions, cancellationToken);
}
}

View file

@ -35,7 +35,7 @@ internal class RevertVersion(IWorkflowDefinitionManager workflowDefinitionManage
if (definition == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
@ -43,14 +43,14 @@ internal class RevertVersion(IWorkflowDefinitionManager workflowDefinitionManage
if (!authorizationResult.Succeeded)
{
await SendForbiddenAsync(cancellationToken);
await Send.ForbiddenAsync(cancellationToken);
return;
}
var newDefinition = await workflowDefinitionManager.RevertVersionAsync(definitionId, version, cancellationToken);
var newDefinitionSummary = WorkflowDefinitionSummary.FromDefinition(newDefinition);
await SendCreatedAtAsync("GetWorkflowDefinitionById", new
await Send.CreatedAtAsync("GetWorkflowDefinitionById", new
{
id = newDefinition.Id
}, newDefinitionSummary, cancellation: cancellationToken);

View file

@ -21,6 +21,6 @@ internal class Cancel(IWorkflowCancellationService workflowCancellationService)
{
await workflowCancellationService.CancelWorkflowAsync(request.Id, cancellationToken);
await SendOkAsync(cancellationToken);
await Send.OkAsync(cancellationToken);
}
}

View file

@ -20,8 +20,8 @@ internal class Delete(IWorkflowInstanceManager store) : ElsaEndpoint<Request>
var deleted = await store.DeleteAsync(filter, cancellationToken);
if (deleted)
await SendNoContentAsync(cancellationToken);
await Send.NoContentAsync(cancellationToken);
else
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
}
}

View file

@ -25,7 +25,7 @@ internal class ExecutionState(IWorkflowInstanceStore store) : ElsaEndpoint<Reque
if (workflowInstance == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
@ -34,6 +34,6 @@ internal class ExecutionState(IWorkflowInstanceStore store) : ElsaEndpoint<Reque
workflowInstance.SubStatus,
workflowInstance.UpdatedAt);
await SendOkAsync(response, cancellationToken);
await Send.OkAsync(response, cancellationToken);
}
}

View file

@ -73,7 +73,7 @@ internal class Export : ElsaEndpointWithMapper<Request, WorkflowInstanceMapper>
if (!instances.Any())
{
await SendNoContentAsync(cancellationToken);
await Send.NoContentAsync(cancellationToken);
return;
}
@ -94,7 +94,7 @@ internal class Export : ElsaEndpointWithMapper<Request, WorkflowInstanceMapper>
// Send the zip file to the client:
zipStream.Position = 0;
await SendBytesAsync(zipStream.ToArray(), "workflow-instances.zip", cancellation: cancellationToken);
await Send.BytesAsync(zipStream.ToArray(), "workflow-instances.zip", cancellation: cancellationToken);
}
private async Task DownloadSingleInstanceAsync(Request request, string id, CancellationToken cancellationToken)
@ -103,7 +103,7 @@ internal class Export : ElsaEndpointWithMapper<Request, WorkflowInstanceMapper>
if (instance == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
@ -111,7 +111,7 @@ internal class Export : ElsaEndpointWithMapper<Request, WorkflowInstanceMapper>
var binaryJson = SerializeWorkflowInstance(model);
var fileName = GetFileName(instance.WorkflowState);
await SendBytesAsync(binaryJson, fileName, cancellation: cancellationToken);
await Send.BytesAsync(binaryJson, fileName, cancellation: cancellationToken);
}
private async Task<ExportedWorkflowState> CreateExportModelAsync(Request request, WorkflowInstance instance, CancellationToken cancellationToken)

View file

@ -21,8 +21,8 @@ internal class Get(IWorkflowInstanceStore store) : ElsaEndpoint<Request, Workflo
var workflowInstance = await store.FindAsync(filter, cancellationToken);
if (workflowInstance == null)
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
else
await SendOkAsync(Map.FromEntity(workflowInstance), cancellationToken);
await Send.OkAsync(Map.FromEntity(workflowInstance), cancellationToken);
}
}

View file

@ -60,7 +60,7 @@ internal class Import : ElsaEndpointWithoutRequest<Response>
var count = await ImportFilesAsync(Files, cancellationToken);
var response = new Response { Imported = count };
await SendOkAsync(response, cancellationToken);
await Send.OkAsync(response, cancellationToken);
}
private async Task<int> ImportFilesAsync(IFormFileCollection files, CancellationToken cancellationToken)

View file

@ -40,10 +40,10 @@ public class Get(IWorkflowExecutionLogStore store) : ElsaEndpoint<Request, Workf
if (entry == null)
{
await SendNotFoundAsync(cancellationToken);
await Send.NotFoundAsync(cancellationToken);
return;
}
await SendOkAsync(entry, cancellationToken);
await Send.OkAsync(entry, cancellationToken);
}
}

View file

@ -30,7 +30,7 @@ internal class List(IWorkflowInstanceStore store) : ElsaEndpoint<Request, Respon
if (ValidationFailed)
{
await SendErrorsAsync(StatusCodes.Status400BadRequest, cancellationToken);
await Send.ErrorsAsync(StatusCodes.Status400BadRequest, cancellationToken);
return;
}
@ -53,7 +53,7 @@ internal class List(IWorkflowInstanceStore store) : ElsaEndpoint<Request, Respon
var summaries = await FindAsync(request, filter, pageArgs, cancellationToken);
var response = new Response(summaries.Items, summaries.TotalCount);
await SendOkAsync(response, cancellationToken);
await Send.OkAsync(response, cancellationToken);
}
private IEnumerable<TEnum> ParseEnumStrings<TEnum>(IEnumerable<string> strings) where TEnum : struct

View file

@ -23,14 +23,14 @@ internal class List(IWorkflowInstanceVariableManager workflowInstanceVariableMan
if (string.IsNullOrWhiteSpace(workflowInstanceId))
{
AddError("The workflow instance ID is required.");
await SendErrorsAsync(StatusCodes.Status400BadRequest, cancellationToken);
await Send.ErrorsAsync(StatusCodes.Status400BadRequest, cancellationToken);
return;
}
var variables = await workflowInstanceVariableManager.GetVariablesAsync(workflowInstanceId, ["LargeData"],cancellationToken).ToList();
var variableModels = variables.Select(x => new ResolvedVariableModel(x.Variable.Id, x.Variable.Name, x.Value)).ToList();
var response = new ListResponse<ResolvedVariableModel>(variableModels);
await SendOkAsync(response, cancellationToken);
await Send.OkAsync(response, cancellationToken);
}
}

View file

@ -23,14 +23,14 @@ internal class List(IWorkflowInstanceVariableManager workflowInstanceVariableMan
if (string.IsNullOrWhiteSpace(workflowInstanceId))
{
AddError("The workflow instance ID is required.");
await SendErrorsAsync(StatusCodes.Status400BadRequest, cancellationToken);
await Send.ErrorsAsync(StatusCodes.Status400BadRequest, cancellationToken);
return;
}
var resolvedVariables = await workflowInstanceVariableManager.SetVariablesAsync(workflowInstanceId, request.Variables, cancellationToken).ToList();
var variableModels = resolvedVariables.Select(x => new ResolvedVariableModel(x.Variable.Id, x.Variable.Name, x.Value)).ToList();
var response = new ListResponse<ResolvedVariableModel>(variableModels);
await SendOkAsync(response, cancellationToken);
await Send.OkAsync(response, cancellationToken);
}
}