diff --git a/src/modules/Elsa.Alterations/Features/AlterationsFeature.cs b/src/modules/Elsa.Alterations/Features/AlterationsFeature.cs
index 426a34109..947221322 100644
--- a/src/modules/Elsa.Alterations/Features/AlterationsFeature.cs
+++ b/src/modules/Elsa.Alterations/Features/AlterationsFeature.cs
@@ -1,10 +1,12 @@
using Elsa.Alterations.Core.Contracts;
using Elsa.Alterations.Core.Entities;
using Elsa.Alterations.Core.Extensions;
+using Elsa.Alterations.Core.Models;
using Elsa.Alterations.Core.Stores;
using Elsa.Alterations.Extensions;
using Elsa.Alterations.Services;
using Elsa.Alterations.Workflows;
+using Elsa.Expressions.Options;
using Elsa.Extensions;
using Elsa.Features.Abstractions;
using Elsa.Features.Services;
@@ -58,6 +60,12 @@ public class AlterationsFeature : FeatureBase
///
public override void Apply()
{
+ Services.Configure(options =>
+ {
+ options.RegisterTypeAlias(typeof(AlterationPlanParams), typeof(AlterationPlanParams).GetSimpleAssemblyQualifiedName());
+ options.RegisterTypeAlias(typeof(AlterationPlanParams), nameof(AlterationPlanParams));
+ });
+
Services.AddScoped();
Services.AddAlterations();
Services.AddAlterationsCore();
@@ -73,4 +81,4 @@ public class AlterationsFeature : FeatureBase
Services.AddScoped(AlterationJobStoreFactory);
Services.AddScoped(AlterationJobDispatcherFactory);
}
-}
\ No newline at end of file
+}
diff --git a/src/modules/Elsa.Common/Entities/OrderDefinition.cs b/src/modules/Elsa.Common/Entities/OrderDefinition.cs
index 99108ec84..8a50560f5 100644
--- a/src/modules/Elsa.Common/Entities/OrderDefinition.cs
+++ b/src/modules/Elsa.Common/Entities/OrderDefinition.cs
@@ -1,4 +1,5 @@
using System.Linq.Expressions;
+using System.Text.Json.Serialization;
namespace Elsa.Common.Entities;
@@ -31,5 +32,12 @@ public class OrderDefinition
///
/// The key selector to use to order the results.
///
+ [JsonIgnore]
public Expression> KeySelector { get; set; } = null!;
-}
\ No newline at end of file
+
+ ///
+ /// A best-effort textual representation of the key selector for cache-key generation.
+ ///
+ [JsonIgnore]
+ public string? KeySelectorText => KeySelector?.ToString();
+}
diff --git a/src/modules/Elsa.Expressions.JavaScript/Features/JavaScriptFeature.cs b/src/modules/Elsa.Expressions.JavaScript/Features/JavaScriptFeature.cs
index 043008a60..b41b8bec2 100644
--- a/src/modules/Elsa.Expressions.JavaScript/Features/JavaScriptFeature.cs
+++ b/src/modules/Elsa.Expressions.JavaScript/Features/JavaScriptFeature.cs
@@ -1,4 +1,5 @@
using Elsa.Caching.Features;
+using Elsa.Expressions.Options;
using Elsa.Common.Features;
using Elsa.Expressions.Features;
using Elsa.Extensions;
@@ -59,6 +60,7 @@ public class JavaScriptFeature : FeatureBase
public override void Apply()
{
Services.Configure(JintOptions);
+ Services.Configure(JavaScriptExceptionTypeAliasRegistrar.Register);
// JavaScript services.
Services
@@ -94,4 +96,4 @@ public class JavaScriptFeature : FeatureBase
// UI property handlers.
Services.AddScoped();
}
-}
\ No newline at end of file
+}
diff --git a/src/modules/Elsa.Expressions.JavaScript/JavaScriptExceptionTypeAliasRegistrar.cs b/src/modules/Elsa.Expressions.JavaScript/JavaScriptExceptionTypeAliasRegistrar.cs
new file mode 100644
index 000000000..dea8c76a7
--- /dev/null
+++ b/src/modules/Elsa.Expressions.JavaScript/JavaScriptExceptionTypeAliasRegistrar.cs
@@ -0,0 +1,21 @@
+using System.Reflection;
+using Acornima;
+using Elsa.Expressions.Options;
+using Jint;
+using Jint.Runtime;
+
+namespace Elsa.Expressions.JavaScript;
+
+internal static class JavaScriptExceptionTypeAliasRegistrar
+{
+ public static void Register(ExpressionOptions options)
+ {
+ options.RegisterTypeAlias(typeof(ScriptPreparationException), nameof(ScriptPreparationException));
+ options.RegisterTypeAlias(typeof(JavaScriptException), nameof(JavaScriptException));
+ options.RegisterTypeAlias(typeof(SyntaxErrorException), nameof(SyntaxErrorException));
+
+ var wrapperExceptionType = typeof(JavaScriptException).GetNestedType("JavaScriptErrorWrapperException", BindingFlags.Public | BindingFlags.NonPublic);
+ if (wrapperExceptionType != null)
+ options.RegisterTypeAlias(wrapperExceptionType, "Jint.JavaScriptErrorWrapperException");
+ }
+}
diff --git a/src/modules/Elsa.Expressions.JavaScript/ShellFeatures/JavaScriptFeature.cs b/src/modules/Elsa.Expressions.JavaScript/ShellFeatures/JavaScriptFeature.cs
index 8111b335b..1b5f26760 100644
--- a/src/modules/Elsa.Expressions.JavaScript/ShellFeatures/JavaScriptFeature.cs
+++ b/src/modules/Elsa.Expressions.JavaScript/ShellFeatures/JavaScriptFeature.cs
@@ -8,6 +8,7 @@ using Elsa.Expressions.JavaScript.Providers;
using Elsa.Expressions.JavaScript.Services;
using Elsa.Expressions.JavaScript.TypeDefinitions.Contracts;
using Elsa.Expressions.JavaScript.TypeDefinitions.Services;
+using Elsa.Expressions.Options;
using Elsa.Extensions;
using Elsa.PackageManifest.Generator.Hints;
using Elsa.Workflows;
@@ -104,6 +105,7 @@ public class JavaScriptFeature : IShellFeature
options.DisableWrappers = DisableWrappers;
options.DisableVariableCopying = DisableVariableCopying;
});
+ services.Configure(JavaScriptExceptionTypeAliasRegistrar.Register);
// JavaScript services.
services
diff --git a/src/modules/Elsa.Expressions/Options/ExpressionOptions.cs b/src/modules/Elsa.Expressions/Options/ExpressionOptions.cs
index e9ba8b338..5e448a8a2 100644
--- a/src/modules/Elsa.Expressions/Options/ExpressionOptions.cs
+++ b/src/modules/Elsa.Expressions/Options/ExpressionOptions.cs
@@ -40,6 +40,7 @@ public class ExpressionOptions
this.AddTypeAlias();
this.AddTypeAlias();
this.AddTypeAlias();
+ this.AddTypeAlias();
this.AddTypeAlias>("StringDictionary");
this.AddTypeAlias>("ObjectDictionary");
this.AddTypeAlias>("StringMap");
@@ -59,4 +60,4 @@ public class ExpressionOptions
_aliasTypeDictionary[alias] = type;
return this;
}
-}
\ No newline at end of file
+}
diff --git a/src/modules/Elsa.Http/Features/HttpFeature.cs b/src/modules/Elsa.Http/Features/HttpFeature.cs
index f147cdb63..441789ee4 100644
--- a/src/modules/Elsa.Http/Features/HttpFeature.cs
+++ b/src/modules/Elsa.Http/Features/HttpFeature.cs
@@ -1,3 +1,4 @@
+using System.Net;
using Elsa.Expressions.Options;
using Elsa.Extensions;
using Elsa.Features.Abstractions;
@@ -259,6 +260,9 @@ public class HttpFeature(IModule module) : FeatureBase(module)
options.AddTypeAlias("HttpFile[]");
options.AddTypeAlias("Downloadable");
options.AddTypeAlias("Downloadable[]");
+ options.AddTypeAlias();
+ options.AddTypeAlias();
+ options.AddTypeAlias();
});
}
-}
\ No newline at end of file
+}
diff --git a/src/modules/Elsa.Http/ShellFeatures/HttpFeature.cs b/src/modules/Elsa.Http/ShellFeatures/HttpFeature.cs
index f87dc3daa..956460357 100644
--- a/src/modules/Elsa.Http/ShellFeatures/HttpFeature.cs
+++ b/src/modules/Elsa.Http/ShellFeatures/HttpFeature.cs
@@ -1,3 +1,4 @@
+using System.Net;
using CShells.AspNetCore.Features;
using CShells.Features;
using Elsa.Expressions.Options;
@@ -230,6 +231,9 @@ public class HttpFeature : IMiddlewareShellFeature
options.AddTypeAlias("HttpFile[]");
options.AddTypeAlias("Downloadable");
options.AddTypeAlias("Downloadable[]");
+ options.AddTypeAlias();
+ options.AddTypeAlias();
+ options.AddTypeAlias();
});
}
@@ -238,4 +242,4 @@ public class HttpFeature : IMiddlewareShellFeature
{
app.UseWorkflows();
}
-}
\ No newline at end of file
+}
diff --git a/src/modules/Elsa.Persistence.EFCore/Modules/Management/WorkflowDefinitionPersistenceFeature.cs b/src/modules/Elsa.Persistence.EFCore/Modules/Management/WorkflowDefinitionPersistenceFeature.cs
index 0c8e27392..104a90694 100644
--- a/src/modules/Elsa.Persistence.EFCore/Modules/Management/WorkflowDefinitionPersistenceFeature.cs
+++ b/src/modules/Elsa.Persistence.EFCore/Modules/Management/WorkflowDefinitionPersistenceFeature.cs
@@ -1,3 +1,4 @@
+using Elsa.Expressions.Options;
using Elsa.Features.Attributes;
using Elsa.Features.Services;
using Elsa.Workflows.Management.Entities;
@@ -26,6 +27,7 @@ public class EFCoreWorkflowDefinitionPersistenceFeature(IModule module) : Persis
public override void Apply()
{
base.Apply();
+ Services.Configure(options => options.RegisterTypeAlias(EFCoreWorkflowDefinitionStore.WorkflowDefinitionStateType, "EFCoreWorkflowDefinitionState"));
AddEntityStore();
}
-}
\ No newline at end of file
+}
diff --git a/src/modules/Elsa.Persistence.EFCore/Modules/Management/WorkflowDefinitionStore.cs b/src/modules/Elsa.Persistence.EFCore/Modules/Management/WorkflowDefinitionStore.cs
index e805caeaa..451792359 100644
--- a/src/modules/Elsa.Persistence.EFCore/Modules/Management/WorkflowDefinitionStore.cs
+++ b/src/modules/Elsa.Persistence.EFCore/Modules/Management/WorkflowDefinitionStore.cs
@@ -22,6 +22,8 @@ namespace Elsa.Persistence.EFCore.Modules.Management;
public class EFCoreWorkflowDefinitionStore(EntityStore store, IPayloadSerializer payloadSerializer, ILogger logger)
: IWorkflowDefinitionStore
{
+ internal static Type WorkflowDefinitionStateType => typeof(WorkflowDefinitionState);
+
///
public async Task FindAsync(WorkflowDefinitionFilter filter, CancellationToken cancellationToken = default)
{
@@ -267,4 +269,4 @@ public class EFCoreWorkflowDefinitionStore(EntityStore Outcomes { get; set; } = new List();
public IDictionary CustomProperties { get; set; } = new Dictionary();
}
-}
\ No newline at end of file
+}
diff --git a/src/modules/Elsa.Scheduling/Features/SchedulingFeature.cs b/src/modules/Elsa.Scheduling/Features/SchedulingFeature.cs
index 6b9db34c3..e29405991 100644
--- a/src/modules/Elsa.Scheduling/Features/SchedulingFeature.cs
+++ b/src/modules/Elsa.Scheduling/Features/SchedulingFeature.cs
@@ -1,5 +1,6 @@
using Elsa.Common.Features;
using Elsa.Common.Multitenancy;
+using Elsa.Expressions.Options;
using Elsa.Extensions;
using Elsa.Features.Abstractions;
using Elsa.Features.Attributes;
@@ -58,6 +59,16 @@ public class SchedulingFeature : FeatureBase
// Graceful shutdown: register scheduled-trigger ingress for diagnostic visibility (FR-006).
.AddSingleton();
+ Services.Configure(options =>
+ {
+ options.AddTypeAlias();
+ options.AddTypeAlias();
+ options.AddTypeAlias();
+ options.AddTypeAlias();
+ options.AddTypeAlias();
+ options.AddTypeAlias();
+ });
+
Module.Configure(management => management.AddActivitiesFrom());
}
-}
\ No newline at end of file
+}
diff --git a/src/modules/Elsa.Workflows.Core/Features/WorkflowsFeature.cs b/src/modules/Elsa.Workflows.Core/Features/WorkflowsFeature.cs
index 6fde09cbf..05c84b7d2 100644
--- a/src/modules/Elsa.Workflows.Core/Features/WorkflowsFeature.cs
+++ b/src/modules/Elsa.Workflows.Core/Features/WorkflowsFeature.cs
@@ -2,13 +2,16 @@ using Elsa.Common;
using Elsa.Common.Features;
using Elsa.Common.Serialization;
using Elsa.Expressions.Features;
+using Elsa.Expressions.Options;
using Elsa.Extensions;
using Elsa.Features.Abstractions;
using Elsa.Features.Attributes;
using Elsa.Features.Services;
using Elsa.Workflows.ActivationValidators;
+using Elsa.Workflows.Activities.Flowchart.Models;
using Elsa.Workflows.Builders;
using Elsa.Workflows.CommitStates;
+using Elsa.Workflows.Exceptions;
using Elsa.Workflows.IncidentStrategies;
using Elsa.Workflows.LogPersistence;
using Elsa.Workflows.LogPersistence.Strategies;
@@ -21,12 +24,14 @@ using Elsa.Workflows.Serialization.Configurators;
using Elsa.Workflows.Serialization.Helpers;
using Elsa.Workflows.Serialization.Serializers;
using Elsa.Workflows.Services;
+using Elsa.Workflows.State;
using Elsa.Workflows.UIHints.CheckList;
using Elsa.Workflows.UIHints.Dictionary;
using Elsa.Workflows.UIHints.Dropdown;
using Elsa.Workflows.UIHints.JsonEditor;
using Elsa.Workflows.UIHints.RadioList;
using Microsoft.Extensions.DependencyInjection;
+using Newtonsoft.Json.Linq;
namespace Elsa.Workflows.Features;
@@ -159,6 +164,36 @@ public class WorkflowsFeature : FeatureBase
private void AddElsaCore(IServiceCollection services)
{
+ services.Configure(options =>
+ {
+ options.RegisterTypeAlias(typeof(ExceptionState), nameof(ExceptionState));
+ options.RegisterTypeAlias(typeof(FaultException), nameof(FaultException));
+ options.RegisterTypeAlias(typeof(VariablesDictionary), nameof(VariablesDictionary));
+ options.RegisterTypeAlias(typeof(Token), nameof(Token));
+ options.RegisterTypeAlias(typeof(FlowJoinMode), "Elsa.Workflows.Core.Activities.Flowchart.Models.FlowJoinMode, Elsa.Workflows.Core");
+ options.RegisterTypeAlias(typeof(FlowJoinMode), typeof(FlowJoinMode).GetSimpleAssemblyQualifiedName());
+ options.RegisterTypeAlias(typeof(FlowJoinMode), nameof(FlowJoinMode));
+ options.RegisterTypeAlias(typeof(WorkflowStorageDriver), typeof(WorkflowStorageDriver).GetSimpleAssemblyQualifiedName());
+ options.RegisterTypeAlias(typeof(WorkflowStorageDriver), nameof(WorkflowStorageDriver));
+ options.RegisterTypeAlias(typeof(WorkflowInstanceStorageDriver), typeof(WorkflowInstanceStorageDriver).GetSimpleAssemblyQualifiedName());
+ options.RegisterTypeAlias(typeof(WorkflowInstanceStorageDriver), nameof(WorkflowInstanceStorageDriver));
+ options.RegisterTypeAlias(typeof(MemoryStorageDriver), typeof(MemoryStorageDriver).GetSimpleAssemblyQualifiedName());
+ options.RegisterTypeAlias(typeof(MemoryStorageDriver), nameof(MemoryStorageDriver));
+ options.RegisterTypeAlias(typeof(FaultStrategy), typeof(FaultStrategy).GetSimpleAssemblyQualifiedName());
+ options.RegisterTypeAlias(typeof(FaultStrategy), nameof(FaultStrategy));
+ options.RegisterTypeAlias(typeof(Exception), nameof(Exception));
+ options.RegisterTypeAlias(typeof(ArgumentException), nameof(ArgumentException));
+ options.RegisterTypeAlias(typeof(ArgumentNullException), nameof(ArgumentNullException));
+ options.RegisterTypeAlias(typeof(InvalidOperationException), nameof(InvalidOperationException));
+ options.RegisterTypeAlias(typeof(NullReferenceException), nameof(NullReferenceException));
+ options.RegisterTypeAlias(typeof(OperationCanceledException), nameof(OperationCanceledException));
+ options.RegisterTypeAlias(typeof(TaskCanceledException), nameof(TaskCanceledException));
+ options.RegisterTypeAlias(typeof(TimeoutException), nameof(TimeoutException));
+ options.RegisterTypeAlias(typeof(NotSupportedException), nameof(NotSupportedException));
+ options.RegisterTypeAlias(typeof(JObject), nameof(JObject));
+ options.RegisterTypeAlias(typeof(JArray), nameof(JArray));
+ });
+
services
// Core.
@@ -259,4 +294,4 @@ public class WorkflowsFeature : FeatureBase
// Logging
.AddLogging();
}
-}
\ No newline at end of file
+}
diff --git a/src/modules/Elsa.Workflows.Core/Serialization/Converters/ExcludeFromHashConverter.cs b/src/modules/Elsa.Workflows.Core/Serialization/Converters/ExcludeFromHashConverter.cs
index 4e3ee4925..b425eb865 100644
--- a/src/modules/Elsa.Workflows.Core/Serialization/Converters/ExcludeFromHashConverter.cs
+++ b/src/modules/Elsa.Workflows.Core/Serialization/Converters/ExcludeFromHashConverter.cs
@@ -1,4 +1,5 @@
using System.Reflection;
+using System.Runtime.CompilerServices;
using System.Text.Json;
using System.Text.Json.Serialization;
using Elsa.Extensions;
@@ -8,9 +9,12 @@ namespace Elsa.Workflows.Serialization.Converters;
///
/// Serializes an object to JSON, excluding properties marked with .
+/// Properties ignored by are also excluded according to their configured ignore condition;
+/// avoid adding or changing these attributes on bookmark or stimulus payloads whose hashes must remain compatible with existing stored hashes.
///
public class ExcludeFromHashConverter : JsonConverter