diff --git a/Directory.Build.props b/Directory.Build.props
index 91c00454..4ed5e34f 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -38,8 +38,8 @@
- 3.6.0-preview.3433
- 3.6.0-preview.1216
+ 3.6.0-preview.3447
+ 3.6.0-preview.1237
9.0.9
diff --git a/Elsa.Extensions.sln b/Elsa.Extensions.sln
index d20d457f..b6c269af 100644
--- a/Elsa.Extensions.sln
+++ b/Elsa.Extensions.sln
@@ -90,10 +90,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.ServiceBus.MassTransit
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "alterations", "alterations", "{F670C86F-ACDA-4549-B9E1-E530B1ED5538}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Alterations.Core", "src\modules\alterations\Elsa.Alterations.Core\Elsa.Alterations.Core.csproj", "{5D17BB88-130E-3A6E-CC4C-5DBB10C6C78F}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Alterations", "src\modules\alterations\Elsa.Alterations\Elsa.Alterations.csproj", "{492E9E6D-403E-E473-F3CC-4CEBA57448FF}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Alterations.MassTransit", "src\modules\alterations\Elsa.Alterations.MassTransit\Elsa.Alterations.MassTransit.csproj", "{95C8EFEE-9396-F334-9B76-78322650A0C6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "caching", "caching", "{9732C4B1-3E94-4705-8CBE-1DC48F55C8EA}"
@@ -124,20 +120,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.Dapper", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.Dapper.Migrations", "src\modules\persistence\Elsa.Persistence.Dapper.Migrations\Elsa.Persistence.Dapper.Migrations.csproj", "{D0CFE3DE-32FB-ECF3-5B2B-F97661AC0ED4}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.EFCore", "src\modules\persistence\Elsa.Persistence.EFCore\Elsa.Persistence.EFCore.csproj", "{C3E8C39A-E21B-C549-1F97-C6D9DFF87BD0}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.EFCore.Common", "src\modules\persistence\Elsa.Persistence.EFCore.Common\Elsa.Persistence.EFCore.Common.csproj", "{1140D58B-2D85-B4A7-F9A5-BC0869E0F029}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.EFCore.MySql", "src\modules\persistence\Elsa.Persistence.EFCore.MySql\Elsa.Persistence.EFCore.MySql.csproj", "{07FA7E65-7AF3-36CB-2025-AD1488E454F3}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.EFCore.Oracle", "src\modules\persistence\Elsa.Persistence.EFCore.Oracle\Elsa.Persistence.EFCore.Oracle.csproj", "{F5D3AA01-9144-31EB-AA4B-268158670981}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.EFCore.PostgreSql", "src\modules\persistence\Elsa.Persistence.EFCore.PostgreSql\Elsa.Persistence.EFCore.PostgreSql.csproj", "{E0EEE211-E2AE-34BF-8BF3-096E37E4B609}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.EFCore.Sqlite", "src\modules\persistence\Elsa.Persistence.EFCore.Sqlite\Elsa.Persistence.EFCore.Sqlite.csproj", "{7CE4BE88-EDFD-B468-86FF-965E6E86C7DD}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.EFCore.SqlServer", "src\modules\persistence\Elsa.Persistence.EFCore.SqlServer\Elsa.Persistence.EFCore.SqlServer.csproj", "{350909FD-FF4F-7DF5-7529-7EF6374E6980}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.Elasticsearch", "src\modules\persistence\Elsa.Persistence.Elasticsearch\Elsa.Persistence.Elasticsearch.csproj", "{2D745C3D-A97B-8538-71D4-0DB9ADB13ECB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Persistence.MongoDb", "src\modules\persistence\Elsa.Persistence.MongoDb\Elsa.Persistence.MongoDb.csproj", "{41A9C3FC-6F99-1EA8-3EB4-3638AF172CB5}"
@@ -263,10 +245,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.MongoDb.UnitTests", "t
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Slack.Tests", "test\modules\slack\Elsa.Slack.Tests\Elsa.Slack.Tests.csproj", "{3DD78303-DF05-4FCA-8DC7-B6503B182264}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "labels", "labels", "{E84955B7-DDFB-49B1-9A90-5AB0740CB349}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.Labels", "src\modules\labels\Elsa.Labels\Elsa.Labels.csproj", "{B7DA6D81-BEC1-454E-BC58-613B5FC41AA4}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "diagnostics", "diagnostics", "{8D0EC628-350F-47FC-8B36-DD98B4B7CC93}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elsa.OpenTelemetry", "src\modules\diagnostics\Elsa.OpenTelemetry\Elsa.OpenTelemetry.csproj", "{28D04FA3-4DCC-4137-8ED4-9F6F1A815909}"
@@ -393,14 +371,6 @@ Global
{BB81E01D-7453-9068-B1E3-90E3072C820B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB81E01D-7453-9068-B1E3-90E3072C820B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB81E01D-7453-9068-B1E3-90E3072C820B}.Release|Any CPU.Build.0 = Release|Any CPU
- {5D17BB88-130E-3A6E-CC4C-5DBB10C6C78F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5D17BB88-130E-3A6E-CC4C-5DBB10C6C78F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5D17BB88-130E-3A6E-CC4C-5DBB10C6C78F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5D17BB88-130E-3A6E-CC4C-5DBB10C6C78F}.Release|Any CPU.Build.0 = Release|Any CPU
- {492E9E6D-403E-E473-F3CC-4CEBA57448FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {492E9E6D-403E-E473-F3CC-4CEBA57448FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {492E9E6D-403E-E473-F3CC-4CEBA57448FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {492E9E6D-403E-E473-F3CC-4CEBA57448FF}.Release|Any CPU.Build.0 = Release|Any CPU
{95C8EFEE-9396-F334-9B76-78322650A0C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{95C8EFEE-9396-F334-9B76-78322650A0C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{95C8EFEE-9396-F334-9B76-78322650A0C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -449,34 +419,6 @@ Global
{D0CFE3DE-32FB-ECF3-5B2B-F97661AC0ED4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D0CFE3DE-32FB-ECF3-5B2B-F97661AC0ED4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D0CFE3DE-32FB-ECF3-5B2B-F97661AC0ED4}.Release|Any CPU.Build.0 = Release|Any CPU
- {C3E8C39A-E21B-C549-1F97-C6D9DFF87BD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C3E8C39A-E21B-C549-1F97-C6D9DFF87BD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C3E8C39A-E21B-C549-1F97-C6D9DFF87BD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C3E8C39A-E21B-C549-1F97-C6D9DFF87BD0}.Release|Any CPU.Build.0 = Release|Any CPU
- {1140D58B-2D85-B4A7-F9A5-BC0869E0F029}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1140D58B-2D85-B4A7-F9A5-BC0869E0F029}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1140D58B-2D85-B4A7-F9A5-BC0869E0F029}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1140D58B-2D85-B4A7-F9A5-BC0869E0F029}.Release|Any CPU.Build.0 = Release|Any CPU
- {07FA7E65-7AF3-36CB-2025-AD1488E454F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {07FA7E65-7AF3-36CB-2025-AD1488E454F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {07FA7E65-7AF3-36CB-2025-AD1488E454F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {07FA7E65-7AF3-36CB-2025-AD1488E454F3}.Release|Any CPU.Build.0 = Release|Any CPU
- {F5D3AA01-9144-31EB-AA4B-268158670981}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F5D3AA01-9144-31EB-AA4B-268158670981}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F5D3AA01-9144-31EB-AA4B-268158670981}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F5D3AA01-9144-31EB-AA4B-268158670981}.Release|Any CPU.Build.0 = Release|Any CPU
- {E0EEE211-E2AE-34BF-8BF3-096E37E4B609}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E0EEE211-E2AE-34BF-8BF3-096E37E4B609}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E0EEE211-E2AE-34BF-8BF3-096E37E4B609}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E0EEE211-E2AE-34BF-8BF3-096E37E4B609}.Release|Any CPU.Build.0 = Release|Any CPU
- {7CE4BE88-EDFD-B468-86FF-965E6E86C7DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7CE4BE88-EDFD-B468-86FF-965E6E86C7DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7CE4BE88-EDFD-B468-86FF-965E6E86C7DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7CE4BE88-EDFD-B468-86FF-965E6E86C7DD}.Release|Any CPU.Build.0 = Release|Any CPU
- {350909FD-FF4F-7DF5-7529-7EF6374E6980}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {350909FD-FF4F-7DF5-7529-7EF6374E6980}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {350909FD-FF4F-7DF5-7529-7EF6374E6980}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {350909FD-FF4F-7DF5-7529-7EF6374E6980}.Release|Any CPU.Build.0 = Release|Any CPU
{2D745C3D-A97B-8538-71D4-0DB9ADB13ECB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2D745C3D-A97B-8538-71D4-0DB9ADB13ECB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2D745C3D-A97B-8538-71D4-0DB9ADB13ECB}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -633,10 +575,6 @@ Global
{3DD78303-DF05-4FCA-8DC7-B6503B182264}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DD78303-DF05-4FCA-8DC7-B6503B182264}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DD78303-DF05-4FCA-8DC7-B6503B182264}.Release|Any CPU.Build.0 = Release|Any CPU
- {B7DA6D81-BEC1-454E-BC58-613B5FC41AA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B7DA6D81-BEC1-454E-BC58-613B5FC41AA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B7DA6D81-BEC1-454E-BC58-613B5FC41AA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B7DA6D81-BEC1-454E-BC58-613B5FC41AA4}.Release|Any CPU.Build.0 = Release|Any CPU
{28D04FA3-4DCC-4137-8ED4-9F6F1A815909}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28D04FA3-4DCC-4137-8ED4-9F6F1A815909}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28D04FA3-4DCC-4137-8ED4-9F6F1A815909}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -716,8 +654,6 @@ Global
{1FD27C49-8173-249A-80E9-DBA071A56E8D} = {2BF08754-1FB0-405D-9F0C-1BEFF9084E6E}
{4C4DAF3C-DE71-F6B3-F3A3-15583A8B719F} = {2BF08754-1FB0-405D-9F0C-1BEFF9084E6E}
{BB81E01D-7453-9068-B1E3-90E3072C820B} = {2BF08754-1FB0-405D-9F0C-1BEFF9084E6E}
- {5D17BB88-130E-3A6E-CC4C-5DBB10C6C78F} = {F670C86F-ACDA-4549-B9E1-E530B1ED5538}
- {492E9E6D-403E-E473-F3CC-4CEBA57448FF} = {F670C86F-ACDA-4549-B9E1-E530B1ED5538}
{95C8EFEE-9396-F334-9B76-78322650A0C6} = {F670C86F-ACDA-4549-B9E1-E530B1ED5538}
{C568B847-15AB-C4DB-5675-0D5F400ED14D} = {9732C4B1-3E94-4705-8CBE-1DC48F55C8EA}
{C4D65789-A62A-DAD5-7246-A0E476F86CDF} = {9732C4B1-3E94-4705-8CBE-1DC48F55C8EA}
@@ -730,13 +666,6 @@ Global
{2D72DB60-227D-49F0-44F0-9FAF52244EB6} = {B5E5264A-5DF3-4A23-8387-D3C10A9B1F9B}
{47F17474-6841-126A-ADF8-DD2A7631C8C6} = {91656D55-A0E6-45B6-B48D-24DF192DAD02}
{D0CFE3DE-32FB-ECF3-5B2B-F97661AC0ED4} = {91656D55-A0E6-45B6-B48D-24DF192DAD02}
- {C3E8C39A-E21B-C549-1F97-C6D9DFF87BD0} = {91656D55-A0E6-45B6-B48D-24DF192DAD02}
- {1140D58B-2D85-B4A7-F9A5-BC0869E0F029} = {91656D55-A0E6-45B6-B48D-24DF192DAD02}
- {07FA7E65-7AF3-36CB-2025-AD1488E454F3} = {91656D55-A0E6-45B6-B48D-24DF192DAD02}
- {F5D3AA01-9144-31EB-AA4B-268158670981} = {91656D55-A0E6-45B6-B48D-24DF192DAD02}
- {E0EEE211-E2AE-34BF-8BF3-096E37E4B609} = {91656D55-A0E6-45B6-B48D-24DF192DAD02}
- {7CE4BE88-EDFD-B468-86FF-965E6E86C7DD} = {91656D55-A0E6-45B6-B48D-24DF192DAD02}
- {350909FD-FF4F-7DF5-7529-7EF6374E6980} = {91656D55-A0E6-45B6-B48D-24DF192DAD02}
{2D745C3D-A97B-8538-71D4-0DB9ADB13ECB} = {91656D55-A0E6-45B6-B48D-24DF192DAD02}
{41A9C3FC-6F99-1EA8-3EB4-3638AF172CB5} = {91656D55-A0E6-45B6-B48D-24DF192DAD02}
{9250D8B1-9D69-A957-D378-8173686A0F9C} = {45B793EC-7BFF-45C0-BD0E-2D1601C8D01E}
@@ -805,8 +734,6 @@ Global
{04087802-CE19-4700-A4A9-536D7537F927} = {3DDE6F89-531C-47F8-9CD7-7A4E6984FA48}
{64AB629A-BE06-455C-98DF-C961623928BB} = {273F8587-516E-41F3-93B9-D2F8FDC188A4}
{3DD78303-DF05-4FCA-8DC7-B6503B182264} = {04087802-CE19-4700-A4A9-536D7537F927}
- {E84955B7-DDFB-49B1-9A90-5AB0740CB349} = {30CF0330-4B09-4784-B499-46BED303810B}
- {B7DA6D81-BEC1-454E-BC58-613B5FC41AA4} = {E84955B7-DDFB-49B1-9A90-5AB0740CB349}
{8D0EC628-350F-47FC-8B36-DD98B4B7CC93} = {30CF0330-4B09-4784-B499-46BED303810B}
{28D04FA3-4DCC-4137-8ED4-9F6F1A815909} = {8D0EC628-350F-47FC-8B36-DD98B4B7CC93}
{04265302-AF6B-4627-807C-DE9E1699D7C9} = {30CF0330-4B09-4784-B499-46BED303810B}
diff --git a/src/modules/agents/Elsa.Agents.Persistence.EFCore.MySql/Elsa.Agents.Persistence.EFCore.MySql.csproj b/src/modules/agents/Elsa.Agents.Persistence.EFCore.MySql/Elsa.Agents.Persistence.EFCore.MySql.csproj
index e693d3fa..8a54f31b 100644
--- a/src/modules/agents/Elsa.Agents.Persistence.EFCore.MySql/Elsa.Agents.Persistence.EFCore.MySql.csproj
+++ b/src/modules/agents/Elsa.Agents.Persistence.EFCore.MySql/Elsa.Agents.Persistence.EFCore.MySql.csproj
@@ -12,8 +12,15 @@
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/modules/agents/Elsa.Agents.Persistence.EFCore.PostgreSql/Elsa.Agents.Persistence.EFCore.PostgreSql.csproj b/src/modules/agents/Elsa.Agents.Persistence.EFCore.PostgreSql/Elsa.Agents.Persistence.EFCore.PostgreSql.csproj
index e9c7c170..30c3df73 100644
--- a/src/modules/agents/Elsa.Agents.Persistence.EFCore.PostgreSql/Elsa.Agents.Persistence.EFCore.PostgreSql.csproj
+++ b/src/modules/agents/Elsa.Agents.Persistence.EFCore.PostgreSql/Elsa.Agents.Persistence.EFCore.PostgreSql.csproj
@@ -11,8 +11,15 @@
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/modules/agents/Elsa.Agents.Persistence.EFCore.SqlServer/Elsa.Agents.Persistence.EFCore.SqlServer.csproj b/src/modules/agents/Elsa.Agents.Persistence.EFCore.SqlServer/Elsa.Agents.Persistence.EFCore.SqlServer.csproj
index 2b9169fe..240b9e1a 100644
--- a/src/modules/agents/Elsa.Agents.Persistence.EFCore.SqlServer/Elsa.Agents.Persistence.EFCore.SqlServer.csproj
+++ b/src/modules/agents/Elsa.Agents.Persistence.EFCore.SqlServer/Elsa.Agents.Persistence.EFCore.SqlServer.csproj
@@ -11,8 +11,15 @@
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/modules/agents/Elsa.Agents.Persistence.EFCore.Sqlite/Elsa.Agents.Persistence.EFCore.Sqlite.csproj b/src/modules/agents/Elsa.Agents.Persistence.EFCore.Sqlite/Elsa.Agents.Persistence.EFCore.Sqlite.csproj
index be2743ba..98750688 100644
--- a/src/modules/agents/Elsa.Agents.Persistence.EFCore.Sqlite/Elsa.Agents.Persistence.EFCore.Sqlite.csproj
+++ b/src/modules/agents/Elsa.Agents.Persistence.EFCore.Sqlite/Elsa.Agents.Persistence.EFCore.Sqlite.csproj
@@ -12,8 +12,15 @@
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/modules/agents/Elsa.Agents.Persistence.EFCore/Elsa.Agents.Persistence.EFCore.csproj b/src/modules/agents/Elsa.Agents.Persistence.EFCore/Elsa.Agents.Persistence.EFCore.csproj
index 60b74f94..259d6d3e 100644
--- a/src/modules/agents/Elsa.Agents.Persistence.EFCore/Elsa.Agents.Persistence.EFCore.csproj
+++ b/src/modules/agents/Elsa.Agents.Persistence.EFCore/Elsa.Agents.Persistence.EFCore.csproj
@@ -6,8 +6,15 @@
-
+
+
+
+
+
+
+
+
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Abstractions/AlterationBase.cs b/src/modules/alterations/Elsa.Alterations.Core/Abstractions/AlterationBase.cs
deleted file mode 100644
index e7f0f247..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Abstractions/AlterationBase.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-
-namespace Elsa.Alterations.Core.Abstractions;
-
-///
-/// A base class for alterations.
-///
-public abstract class AlterationBase : IAlteration
-{
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Abstractions/AlterationHandlerBase.cs b/src/modules/alterations/Elsa.Alterations.Core/Abstractions/AlterationHandlerBase.cs
deleted file mode 100644
index 06522342..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Abstractions/AlterationHandlerBase.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using Elsa.Alterations.Core.Contexts;
-using Elsa.Alterations.Core.Contracts;
-
-namespace Elsa.Alterations.Core.Abstractions;
-
-///
-/// A base class for alterations.
-///
-public abstract class AlterationHandlerBase : IAlterationHandler
-{
- ///
- public abstract bool CanHandle(IAlteration alteration);
-
- ///
- public abstract ValueTask HandleAsync(AlterationContext context);
-}
-
-///
-public abstract class AlterationHandlerBase : AlterationHandlerBase where T : IAlteration
-{
- ///
- public override bool CanHandle(IAlteration alteration) => alteration is T;
-
- ///
- public override ValueTask HandleAsync(AlterationContext context) => HandleAsync(context, (T)context.Alteration);
-
- ///
- /// Applies the alteration to the specified context.
- ///
- /// A context object that contains information for the alteration and provides a way to alter the workflow instance and control the alteration process.
- /// A strongly typed alteration.
- protected abstract ValueTask HandleAsync(AlterationContext context, T alteration);
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Contexts/AlterationHandlerContext.cs b/src/modules/alterations/Elsa.Alterations.Core/Contexts/AlterationHandlerContext.cs
deleted file mode 100644
index f98fc601..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Contexts/AlterationHandlerContext.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Models;
-using Elsa.Workflows;
-using Elsa.Workflows.Activities;
-using Microsoft.Extensions.Logging;
-
-namespace Elsa.Alterations.Core.Contexts;
-
-///
-/// Provides contextual information about an alteration.
-///
-public class AlterationContext
-{
- ///
- /// Initializes a new instance of the class.
- ///
- public AlterationContext(
- IAlteration alteration,
- WorkflowExecutionContext workflowExecutionContext,
- AlterationLog log,
- CancellationToken cancellationToken)
- {
- Alteration = alteration;
- WorkflowExecutionContext = workflowExecutionContext;
- AlterationLog = log;
- CancellationToken = cancellationToken;
- }
-
- ///
- /// The alteration being handled.
- ///
- public IAlteration Alteration { get; }
-
- ///
- /// A workflow execution context of the workflow instance being altered. This offers maximum flexibility for altering the workflow state.
- ///
- public WorkflowExecutionContext WorkflowExecutionContext { get; set; }
-
- ///
- /// The workflow of the workflow instance being altered.
- ///
- public Workflow Workflow => WorkflowExecutionContext.Workflow;
-
- ///
- /// The cancellation token.
- ///
- public CancellationToken CancellationToken { get; }
-
- ///
- /// The service provider.
- ///
- public IServiceProvider ServiceProvider => WorkflowExecutionContext.ServiceProvider;
-
- ///
- /// The alteration log.
- ///
- public AlterationLog AlterationLog { get; }
-
- ///
- /// A flag indicating whether the alteration has succeeded.
- ///
- public bool HasSucceeded { get; private set; }
-
- ///
- /// A flag indicating whether the alteration has failed.
- ///
- public bool HasFailed { get; private set; }
-
- ///
- /// An optional action to be executed when the alteration is committed. Set this to perform permanent side effects such as deleting records form the database.
- ///
- public Func? CommitAction { get; set; }
-
- ///
- /// Logs a message.
- ///
- /// The event name to log.
- /// The message to log.
- /// The log level.
- public void Log(string eventName, string message, LogLevel logLevel = LogLevel.Information)
- {
- AlterationLog.Add(message, logLevel, eventName);
- }
-
- ///
- /// Marks the alteration as succeeded.
- ///
- public void Succeed()
- {
- Succeed($"{Alteration.GetType().Name} succeeded");
- }
-
- ///
- /// Marks the alteration as succeeded.
- ///
- public void Succeed(Func commitAction)
- {
- Succeed();
- CommitAction = commitAction;
- }
-
- ///
- /// Marks the alteration as succeeded.
- ///
- public void Succeed(Action commitAction)
- {
- Succeed();
- CommitAction = () =>
- {
- commitAction();
- return Task.CompletedTask;
- };
- }
-
- ///
- /// Marks the alteration as succeeded.
- ///
- public void Succeed(string message)
- {
- HasSucceeded = true;
- Log($"Alteration {Alteration.GetType().Name} succeeded", message);
- }
-
- ///
- /// Marks the alteration as succeeded.
- ///
- public void Succeed(string message, Func commitAction)
- {
- Succeed(message);
- CommitAction = commitAction;
- }
-
- ///
- /// Marks the alteration as succeeded.
- ///
- public void Succeed(string message, Action commitAction)
- {
- Succeed(message);
- CommitAction = () =>
- {
- commitAction();
- return Task.CompletedTask;
- };
- }
-
- ///
- /// Marks the alteration as failed.
- ///
- /// An optional message.
- public void Fail(string? message = null)
- {
- HasFailed = true;
- Log($"Alteration {Alteration.GetType().Name} failed", message ?? $"{Alteration.GetType().Name} failed", LogLevel.Error);
- }
-}
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlteration.cs b/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlteration.cs
deleted file mode 100644
index 33150b90..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlteration.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Elsa.Alterations.Core.Contracts;
-
-///
-/// Represents an alteration.
-///
-public interface IAlteration
-{
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationHandler.cs b/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationHandler.cs
deleted file mode 100644
index e8aee6e0..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationHandler.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using Elsa.Alterations.Core.Contexts;
-
-namespace Elsa.Alterations.Core.Contracts;
-
-///
-/// Represents a change to a given type T.
-///
-public interface IAlterationHandler
-{
- ///
- /// Returns true if the alteration is supported by this handler; otherwise, false.
- ///
- ///
- bool CanHandle(IAlteration alteration);
-
- ///
- /// Applies the alteration to the specified context.
- ///
- /// A context object that contains information for the alteration and provides a way to alter the workflow instance and control the alteration process.
- ValueTask HandleAsync(AlterationContext context);
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationJobDispatcher.cs b/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationJobDispatcher.cs
deleted file mode 100644
index e3191dd9..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationJobDispatcher.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-namespace Elsa.Alterations.Core.Contracts;
-
-///
-/// Dispatches an alteration job for execution.
-///
-public interface IAlterationJobDispatcher
-{
- ///
- /// Dispatches an alteration job for execution.
- ///
- /// The ID of the job to dispatch.
- /// An optional cancellation token.
- ValueTask DispatchAsync(string jobId, CancellationToken cancellationToken = default);
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationJobRunner.cs b/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationJobRunner.cs
deleted file mode 100644
index 82139c71..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationJobRunner.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using Elsa.Alterations.Core.Entities;
-
-namespace Elsa.Alterations.Core.Contracts;
-
-///
-/// Executes an alteration job.
-///
-public interface IAlterationJobRunner
-{
- ///
- /// Executes the specified alteration plan.
- ///
- /// The Id of the alteration job to execute.
- /// An optional cancellation token.
- /// The job with updated state.
- Task RunAsync(string jobId, CancellationToken cancellationToken = default);
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationJobStore.cs b/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationJobStore.cs
deleted file mode 100644
index 6d2dc59b..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationJobStore.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using Elsa.Alterations.Core.Entities;
-using Elsa.Alterations.Core.Filters;
-
-namespace Elsa.Alterations.Core.Contracts;
-
-///
-/// A store for alteration jobs.
-///
-public interface IAlterationJobStore
-{
- ///
- /// Saves the specified alteration job.
- ///
- Task SaveAsync(AlterationJob job, CancellationToken cancellationToken = default);
-
- ///
- /// Saves the specified alteration jobs.
- ///
- Task SaveManyAsync(IEnumerable jobs, CancellationToken cancellationToken = default);
-
- ///
- /// Finds the alteration job matching the specified filter.
- ///
- Task FindAsync(AlterationJobFilter filter, CancellationToken cancellationToken = default);
-
- ///
- /// Finds all alteration jobs matching the specified filter.
- ///
- Task> FindManyAsync(AlterationJobFilter filter, CancellationToken cancellationToken = default);
-
- ///
- /// Finds the IDs of all alteration jobs matching the specified filter.
- ///
- ///
- Task> FindManyIdsAsync(AlterationJobFilter filter, CancellationToken cancellationToken = default);
-
- ///
- /// Returns the number of alteration jobs matching the specified filter.
- ///
- Task CountAsync(AlterationJobFilter filter, CancellationToken cancellationToken = default);
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationPlanManager.cs b/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationPlanManager.cs
deleted file mode 100644
index 617cf282..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationPlanManager.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using Elsa.Alterations.Core.Entities;
-
-namespace Elsa.Alterations.Core.Contracts;
-
-///
-/// Represents a manager for alteration plans.
-///
-public interface IAlterationPlanManager
-{
- ///
- /// Gets an alteration plan by ID.
- ///
- Task GetPlanAsync(string planId, CancellationToken cancellationToken = default);
-
- ///
- /// Gets a value indicating whether all jobs in the plan have been completed.
- ///
- Task GetIsAllJobsCompletedAsync(string planId, CancellationToken cancellationToken = default);
-
- ///
- /// Completes an alteration plan.
- ///
- Task CompletePlanAsync(AlterationPlan plan, CancellationToken cancellationToken = default);
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationPlanScheduler.cs b/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationPlanScheduler.cs
deleted file mode 100644
index 68ee9b2a..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationPlanScheduler.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using Elsa.Alterations.Core.Models;
-
-namespace Elsa.Alterations.Core.Contracts;
-
-///
-/// Scheduler for alteration plans.
-///
-public interface IAlterationPlanScheduler
-{
- ///
- /// Submits an alteration plan for execution.
- ///
- Task SubmitAsync(AlterationPlanParams planParams, CancellationToken cancellationToken = default);
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationPlanStore.cs b/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationPlanStore.cs
deleted file mode 100644
index 9029948a..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationPlanStore.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using Elsa.Alterations.Core.Entities;
-using Elsa.Alterations.Core.Filters;
-
-namespace Elsa.Alterations.Core.Contracts;
-
-///
-/// A store for alteration plans.
-///
-public interface IAlterationPlanStore
-{
- ///
- /// Saves the specified alteration plan.
- ///
- Task SaveAsync(AlterationPlan plan, CancellationToken cancellationToken = default);
-
- ///
- /// Finds the alteration plan matching the specified filter.
- ///
- Task FindAsync(AlterationPlanFilter filter, CancellationToken cancellationToken = default);
-
- ///
- /// Returns the number of alteration plans matching the specified filter.
- ///
- Task CountAsync(AlterationPlanFilter filter, CancellationToken cancellationToken = default);
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationRunner.cs b/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationRunner.cs
deleted file mode 100644
index 8693938b..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationRunner.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using Elsa.Alterations.Core.Results;
-
-namespace Elsa.Alterations.Core.Contracts;
-
-///
-/// Runs a series of alterations on the specified workflow execution context.
-///
-public interface IAlterationRunner
-{
- ///
- /// Runs a series of alterations on the specified workflow instances.
- ///
- /// The IDs of the workflow instances to alter.
- /// The alterations to run.
- /// An optional cancellation token.
- Task> RunAsync(IEnumerable workflowInstanceIds, IEnumerable alterations, CancellationToken cancellationToken = default);
-
- ///
- /// Runs a series of alterations on the specified workflow instances.
- ///
- /// The ID of the workflow instance to alter.
- /// The alterations to run.
- /// An optional cancellation token.
- Task RunAsync(string workflowInstanceId, IEnumerable alterations, CancellationToken cancellationToken = default);
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationSerializer.cs b/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationSerializer.cs
deleted file mode 100644
index c273789a..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlterationSerializer.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-namespace Elsa.Alterations.Core.Contracts;
-
-///
-/// Serializes and deserializes objects.
-///
-public interface IAlterationSerializer
-{
- ///
- /// Serializes the specified object.
- ///
- string Serialize(IAlteration alteration);
-
- ///
- /// Serializes the specified set of objects.
- ///
- string SerializeMany(IEnumerable alterations);
-
- ///
- /// Deserializes the specified JSON string into an object.
- ///
- IAlteration Deserialize(string json);
-
- ///
- /// Deserializes the specified JSON string into a set of objects.
- ///
- IEnumerable DeserializeMany(string json);
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlteredWorkflowDispatcher.cs b/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlteredWorkflowDispatcher.cs
deleted file mode 100644
index 38374cad..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IAlteredWorkflowDispatcher.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Elsa.Alterations.Core.Results;
-
-namespace Elsa.Alterations.Core.Contracts;
-
-///
-/// Schedules a workflow instance to be resumed when an alteration job has been completed.
-///
-public interface IAlteredWorkflowDispatcher
-{
- ///
- /// Schedules the altered workflow instances to be resumed.
- ///
- /// The results of running a series of alterations.
- /// An optional cancellation token.
- Task DispatchAsync(IEnumerable results, CancellationToken cancellationToken = default);
-
- ///
- /// Schedules the altered workflow instance to be resumed.
- ///
- /// The result of running a series of alterations.
- /// An optional cancellation token.
- Task DispatchAsync(RunAlterationsResult result, CancellationToken cancellationToken = default);
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IWorkflowInstanceFinder.cs b/src/modules/alterations/Elsa.Alterations.Core/Contracts/IWorkflowInstanceFinder.cs
deleted file mode 100644
index fd325937..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Contracts/IWorkflowInstanceFinder.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using Elsa.Alterations.Core.Models;
-
-namespace Elsa.Alterations.Core.Contracts;
-
-///
-/// Represents a service that can find workflow instances based on specified filters.
-///
-public interface IWorkflowInstanceFinder
-{
- ///
- /// Finds workflow instances based on the specified filter.
- ///
- Task> FindAsync(AlterationWorkflowInstanceFilter filter, CancellationToken cancellationToken = default);
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Elsa.Alterations.Core.csproj b/src/modules/alterations/Elsa.Alterations.Core/Elsa.Alterations.Core.csproj
deleted file mode 100644
index b7b4d790..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Elsa.Alterations.Core.csproj
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- Provides core interfaces, models and services that support the alteration engine.
-
- elsa extension module alterations
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Entities/AlterationJob.cs b/src/modules/alterations/Elsa.Alterations.Core/Entities/AlterationJob.cs
deleted file mode 100644
index 7eada254..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Entities/AlterationJob.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using Elsa.Alterations.Core.Enums;
-using Elsa.Alterations.Core.Models;
-using Elsa.Common.Entities;
-
-namespace Elsa.Alterations.Core.Entities;
-
-///
-/// Represents the execution of the plan for an individual workflow instance.
-///
-public class AlterationJob : Entity
-{
- ///
- /// The ID of the plan that this job belongs to.
- ///
- public string PlanId { get; set; } = null!;
-
- ///
- /// The ID of the workflow instance that this job applies to.
- ///
- public string WorkflowInstanceId { get; set; } = null!;
-
- ///
- /// The status of the job.
- ///
- public AlterationJobStatus Status { get; set; }
-
- ///
- /// The serialized log of the job.
- ///
- public ICollection? Log { get; set; } = new List();
-
- ///
- /// The date and time at which the job was created.
- ///
- public DateTimeOffset CreatedAt { get; set; }
-
- ///
- /// The date and time at which the job was started.
- ///
- public DateTimeOffset? StartedAt { get; set; }
-
- ///
- /// The date and time at which the job was completed.
- ///
- public DateTimeOffset? CompletedAt { get; set; }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Entities/AlterationPlan.cs b/src/modules/alterations/Elsa.Alterations.Core/Entities/AlterationPlan.cs
deleted file mode 100644
index 10c6a472..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Entities/AlterationPlan.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Enums;
-using Elsa.Alterations.Core.Models;
-using Elsa.Common.Entities;
-
-namespace Elsa.Alterations.Core.Entities;
-
-///
-/// A plan that contains a list of alterations to be applied to a set of workflow instances.
-///
-public class AlterationPlan : Entity
-{
- ///
- /// The alterations to be applied.
- ///
- public ICollection Alterations { get; set; } = new List();
-
- ///
- /// The IDs of the workflow instances that this plan applies to.
- ///
- public AlterationWorkflowInstanceFilter WorkflowInstanceFilter { get; set; } = new();
-
- ///
- /// The status of the plan.
- ///
- public AlterationPlanStatus Status { get; set; }
-
- ///
- /// The date and time at which the plan was created.
- ///
- public DateTimeOffset CreatedAt { get; set; }
-
- ///
- /// The date and time at which the plan was started.
- ///
- public DateTimeOffset? StartedAt { get; set; }
-
- ///
- /// The date and time at which the plan was completed.
- ///
- public DateTimeOffset? CompletedAt { get; set; }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Enums/AlterationJobStatus.cs b/src/modules/alterations/Elsa.Alterations.Core/Enums/AlterationJobStatus.cs
deleted file mode 100644
index d9d7ac7f..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Enums/AlterationJobStatus.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-namespace Elsa.Alterations.Core.Enums;
-
-///
-/// The status of an alteration plan for a workflow instance.
-///
-public enum AlterationJobStatus
-{
- ///
- /// The plan is pending execution.
- ///
- Pending,
-
- ///
- /// The plan is currently being executed.
- ///
- Running,
-
- ///
- /// The plan has been completed.
- ///
- Completed,
-
- ///
- /// The job has failed.
- ///
- Failed
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Enums/AlterationPlanStatus.cs b/src/modules/alterations/Elsa.Alterations.Core/Enums/AlterationPlanStatus.cs
deleted file mode 100644
index 2ba9eea2..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Enums/AlterationPlanStatus.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-namespace Elsa.Alterations.Core.Enums;
-
-///
-/// The status of an alteration plan.
-///
-public enum AlterationPlanStatus
-{
- ///
- /// The plan is pending execution.
- ///
- Pending,
-
- ///
- /// The plan is currently generating jobs.
- ///
- Generating,
-
- ///
- /// The plan is currently dispatching jobs.
- ///
- Dispatching,
-
- ///
- /// The plan is currently being executed.
- ///
- Running,
-
- ///
- /// The plan has been completed.
- ///
- Completed,
-
- ///
- /// The plan has failed.
- ///
- Failed
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Extensions/ServiceCollectionExtensions.cs b/src/modules/alterations/Elsa.Alterations.Core/Extensions/ServiceCollectionExtensions.cs
deleted file mode 100644
index 13f473b6..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Extensions/ServiceCollectionExtensions.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Options;
-using Elsa.Alterations.Core.Serialization;
-using Elsa.Alterations.Core.Services;
-using Elsa.Extensions;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace Elsa.Alterations.Core.Extensions;
-
-///
-/// Extension methods for .
-///
-public static class ServiceCollectionExtensions
-{
- ///
- /// Adds the core Elsa alterations services.
- ///
- public static IServiceCollection AddAlterationsCore(this IServiceCollection services)
- {
- services.Configure(_ => { }); // Ensure that the options are configured even if the application doesn't do so.
- services.AddScoped();
- services.AddScoped();
- services.AddSingleton();
- services.AddSerializationOptionsConfigurator();
- return services;
- }
-
- ///
- /// Adds an alteration handler.
- ///
- public static IServiceCollection AddAlteration(this IServiceCollection services) where T : IAlteration where THandler : class, IAlterationHandler
- {
- services.Configure(options => options.AlterationTypes.Add(typeof(T)));
- services.AddScoped();
- return services;
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Filters/AlterationJobFilter.cs b/src/modules/alterations/Elsa.Alterations.Core/Filters/AlterationJobFilter.cs
deleted file mode 100644
index 37751d05..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Filters/AlterationJobFilter.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using Elsa.Alterations.Core.Entities;
-using Elsa.Alterations.Core.Enums;
-
-namespace Elsa.Alterations.Core.Filters;
-
-///
-/// A filter for querying alteration jobs.
-///
-public class AlterationJobFilter
-{
- ///
- /// The ID of the job.
- ///
- public string? Id { get; set; }
-
- ///
- /// The ID of the plan.
- ///
- public string? PlanId { get; set; }
-
- ///
- /// The status of the job.
- ///
- public AlterationJobStatus? Status { get; set; }
-
- ///
- /// The statuses of the job to match.
- ///
- public ICollection? Statuses { get; set; }
-
- ///
- /// Applies the filter to the specified query.
- ///
- public IQueryable Apply(IQueryable query)
- {
- if (!string.IsNullOrWhiteSpace(Id))
- query = query.Where(x => x.Id == Id);
-
- if (!string.IsNullOrWhiteSpace(PlanId))
- query = query.Where(x => x.PlanId == PlanId);
-
- if (Status != null)
- query = query.Where(x => x.Status == Status);
-
- if (Statuses != null)
- query = query.Where(x => Statuses.Contains(x.Status));
-
- return query;
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Filters/AlterationPlanFilter.cs b/src/modules/alterations/Elsa.Alterations.Core/Filters/AlterationPlanFilter.cs
deleted file mode 100644
index cc2cbc03..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Filters/AlterationPlanFilter.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using Elsa.Alterations.Core.Entities;
-
-namespace Elsa.Alterations.Core.Filters;
-
-///
-/// A filter for querying alteration plans.
-///
-public class AlterationPlanFilter
-{
- ///
- /// The ID of the plan.
- ///
- public string? Id { get; set; }
-
- ///
- /// Applies the filter to the specified query.
- ///
- public IQueryable Apply(IQueryable query)
- {
- if (!string.IsNullOrWhiteSpace(Id))
- query = query.Where(x => x.Id == Id);
-
- return query;
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/FodyWeavers.xml b/src/modules/alterations/Elsa.Alterations.Core/FodyWeavers.xml
deleted file mode 100644
index 00e1d9a1..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/FodyWeavers.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Models/ActivityFilter.cs b/src/modules/alterations/Elsa.Alterations.Core/Models/ActivityFilter.cs
deleted file mode 100644
index f13ba2cd..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Models/ActivityFilter.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using Elsa.Workflows;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.Core.Models;
-
-///
-/// Represents a filter for activities.
-///
-[UsedImplicitly]
-public class ActivityFilter
-{
- ///
- /// The ID of the activity.
- ///
- public string? ActivityId { get; set; }
-
- ///
- /// The ID of the activity instance.
- ///
- public string? ActivityInstanceId { get; set; }
-
- ///
- /// The node ID of the activity.
- ///
- public string? NodeId { get; set; }
-
- ///
- /// The name of the activity.
- ///
- public string? Name { get; set; }
-
- ///
- /// The status of the activity.
- ///
- public ActivityStatus? Status { get; set; }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Models/AlterationLog.cs b/src/modules/alterations/Elsa.Alterations.Core/Models/AlterationLog.cs
deleted file mode 100644
index 1032bb52..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Models/AlterationLog.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using Elsa.Common;
-using Microsoft.Extensions.Logging;
-
-namespace Elsa.Alterations.Core.Models;
-
-
-///
-/// Represents a log of alterations.
-///
-public class AlterationLog
-{
- private readonly ISystemClock _systemClock;
- private readonly List _logEntries = new();
-
- ///
- /// Initializes a new instance of the class.
- ///
- public AlterationLog(ISystemClock systemClock)
- {
- _systemClock = systemClock;
- }
-
- ///
- /// Gets the log entries.
- ///
- public IReadOnlyCollection LogEntries => _logEntries.ToList().AsReadOnly();
-
- ///
- /// Adds a log entry.
- ///
- /// The message.
- /// The log level.
- /// The event that generated the log entry.
- public void Add(string message, LogLevel logLevel = LogLevel.Information, string? eventName = null)
- {
- var entry = new AlterationLogEntry(message, logLevel, _systemClock.UtcNow, eventName);
-
- _logEntries.Add(entry);
- }
-
- ///
- /// Adds a set of log entries.
- ///
- ///
- public void AddRange(IEnumerable entries) => _logEntries.AddRange(entries);
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Models/AlterationLogEntry.cs b/src/modules/alterations/Elsa.Alterations.Core/Models/AlterationLogEntry.cs
deleted file mode 100644
index 77b772c6..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Models/AlterationLogEntry.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using Microsoft.Extensions.Logging;
-
-namespace Elsa.Alterations.Core.Models;
-
-///
-/// A log entry for an alteration.
-///
-/// The log message.
-/// The log level.
-/// The timestamp when the log entry was created.
-/// The event that generated the log entry.
-public record AlterationLogEntry(string Message, LogLevel LogLevel, DateTimeOffset Timestamp, string? EventName = null);
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Models/AlterationPlanParams.cs b/src/modules/alterations/Elsa.Alterations.Core/Models/AlterationPlanParams.cs
deleted file mode 100644
index 08c266c4..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Models/AlterationPlanParams.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-
-namespace Elsa.Alterations.Core.Models;
-
-///
-/// Represents a new alteration plan.
-///
-public class AlterationPlanParams
-{
- ///
- /// The unique identifier for the alteration plan. If not specified, a new ID will be generated.
- ///
- public string? Id { get; set; }
-
- ///
- /// The alterations to be applied.
- ///
- public ICollection Alterations { get; set; } = new List();
-
- ///
- /// The filter used to determine which workflow instances that this plan applies to.
- ///
- public AlterationWorkflowInstanceFilter Filter { get; set; } = new();
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Models/AlterationWorkflowInstanceFilter.cs b/src/modules/alterations/Elsa.Alterations.Core/Models/AlterationWorkflowInstanceFilter.cs
deleted file mode 100644
index 51f2cd68..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Models/AlterationWorkflowInstanceFilter.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-using Elsa.Workflows;
-using Elsa.Workflows.Management.Models;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.Core.Models;
-
-///
-/// Represents a filter for workflow instances.
-///
-[UsedImplicitly]
-public class AlterationWorkflowInstanceFilter
-{
- ///
- /// If the filter is empty, all records are matched.
- ///
- public bool EmptyFilterSelectsAll { get; set; }
-
- ///
- /// The IDs of the workflow instances that this plan applies to.
- ///
- public IEnumerable? WorkflowInstanceIds { get; set; }
-
- ///
- /// The correlation IDs of the workflow instances that this plan applies to.
- ///
- public IEnumerable? CorrelationIds { get; set; }
-
- ///
- /// A collection of names associated with the workflow instances being filtered.
- ///
- public ICollection? Names { get; set; }
-
- ///
- /// A search term used to filter workflow instances based on matching criteria.
- ///
- public string? SearchTerm { get; set; }
-
- ///
- /// A collection of timestamp filters used for filtering data based on specified timestamp columns and operators.
- ///
- public IEnumerable? TimestampFilters { get; set; }
-
- ///
- /// The IDs of the workflow definitions that this plan applies to.
- ///
- public ICollection? DefinitionIds { get; set; }
-
- ///
- /// The IDs of the workflow definitions that this plan applies to.
- ///
- public IEnumerable? DefinitionVersionIds { get; set; }
-
- ///
- /// Whether the workflow instances to match have incidents.
- ///
- public bool? HasIncidents { get; set; }
-
- ///
- /// Whether the workflow instances to match are system workflows. Defaults to false.
- ///
- public bool? IsSystem { get; set; } = false;
-
- ///
- /// Represents the workflow statuses included in the filter.
- ///
- public ICollection? Statuses { get; set; }
-
- ///
- /// A collection of sub-statuses used to filter workflow instances by their specific sub-state.
- ///
- public ICollection? SubStatuses { get; set; }
-
- ///
- /// Represents a collection of filters for activities.
- ///
- public IEnumerable? ActivityFilters { get; set; }
-
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Models/NewAlterationJob.cs b/src/modules/alterations/Elsa.Alterations.Core/Models/NewAlterationJob.cs
deleted file mode 100644
index 8b994b64..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Models/NewAlterationJob.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Elsa.Alterations.Core.Models;
-
-public class NewAlterationJob
-{
- public string PlanId { get; set; }
- public string WorkflowInstanceId { get; set; }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Notifications/AlterationJobCompleted.cs b/src/modules/alterations/Elsa.Alterations.Core/Notifications/AlterationJobCompleted.cs
deleted file mode 100644
index b15d44cb..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Notifications/AlterationJobCompleted.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using Elsa.Alterations.Core.Entities;
-using Elsa.Mediator.Contracts;
-
-namespace Elsa.Alterations.Core.Notifications;
-
-///
-/// A notification that is published when an alteration job is completed.
-///
-public record AlterationJobCompleted(AlterationJob Job, bool WorkflowContainsScheduledWork) : INotification;
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Notifications/AlterationPlanCompleted.cs b/src/modules/alterations/Elsa.Alterations.Core/Notifications/AlterationPlanCompleted.cs
deleted file mode 100644
index 70a13fb5..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Notifications/AlterationPlanCompleted.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using Elsa.Alterations.Core.Entities;
-using Elsa.Mediator.Contracts;
-
-namespace Elsa.Alterations.Core.Notifications;
-
-///
-/// A notification that is published when an alteration plan is completed.
-///
-public record AlterationPlanCompleted(AlterationPlan Plan) : INotification;
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Notifications/AlterationPlanSubmitted.cs b/src/modules/alterations/Elsa.Alterations.Core/Notifications/AlterationPlanSubmitted.cs
deleted file mode 100644
index e9681838..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Notifications/AlterationPlanSubmitted.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using Elsa.Alterations.Core.Entities;
-using Elsa.Mediator.Contracts;
-
-namespace Elsa.Alterations.Core.Notifications;
-
-///
-/// A notification that is published when an alteration plan is submitted.
-///
-public record AlterationPlanSubmitted(AlterationPlan Plan) : INotification;
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Options/AlterationOptions.cs b/src/modules/alterations/Elsa.Alterations.Core/Options/AlterationOptions.cs
deleted file mode 100644
index 3d54cc21..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Options/AlterationOptions.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace Elsa.Alterations.Core.Options;
-
-///
-/// Options for the Alteration module.
-///
-public class AlterationOptions
-{
- ///
- /// The types of alterations that are supported.
- ///
- public ISet AlterationTypes { get; set; } = new HashSet();
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Results/RunAlterationsResult.cs b/src/modules/alterations/Elsa.Alterations.Core/Results/RunAlterationsResult.cs
deleted file mode 100644
index 42e5e979..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Results/RunAlterationsResult.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using Elsa.Alterations.Core.Models;
-using Microsoft.Extensions.Logging;
-
-namespace Elsa.Alterations.Core.Results;
-
-///
-/// The result of running a series of alterations.
-///
-public class RunAlterationsResult
-{
- ///
- /// Initializes a new instance of the class.
- ///
- public RunAlterationsResult(string workflowInstanceId, AlterationLog log)
- {
- WorkflowInstanceId = workflowInstanceId;
- Log = log;
- }
-
- ///
- /// The ID of the workflow instance that was altered.
- ///
- public string WorkflowInstanceId { get; }
-
- ///
- /// A log of the alterations that were run.
- ///
- public AlterationLog Log { get; set; }
-
- ///
- /// A flag indicating whether the workflow has scheduled work.
- ///
- public bool WorkflowHasScheduledWork { get; set; }
-
- ///
- /// A flag indicating whether the alterations have succeeded.
- ///
- public bool IsSuccessful => Log.LogEntries.Any(x => x.LogLevel <= LogLevel.Warning);
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Serialization/AlterationSerializationOptionConfigurator.cs b/src/modules/alterations/Elsa.Alterations.Core/Serialization/AlterationSerializationOptionConfigurator.cs
deleted file mode 100644
index 217331a5..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Serialization/AlterationSerializationOptionConfigurator.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using System.Text.Json.Serialization;
-using System.Text.Json.Serialization.Metadata;
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Options;
-using Elsa.Workflows;
-using JetBrains.Annotations;
-using Microsoft.Extensions.Options;
-
-namespace Elsa.Alterations.Core.Serialization;
-
-///
-/// Add additional objects.
-///
-[UsedImplicitly]
-public class AlterationSerializationOptionConfigurator(IOptions options) : SerializationOptionsConfiguratorBase
-{
- ///
- public override IEnumerable> GetModifiers()
- {
- var alterationTypes = options.Value.AlterationTypes;
-
- yield return typeInfo =>
- {
- if (typeInfo.Type != typeof(IAlteration))
- return;
-
- if (typeInfo.Kind != JsonTypeInfoKind.Object)
- return;
-
- var polymorphismOptions = new JsonPolymorphismOptions
- {
- TypeDiscriminatorPropertyName = "type"
- };
-
- foreach (var alterationType in alterationTypes.ToList())
- {
- polymorphismOptions.DerivedTypes.Add(new(alterationType, alterationType.Name));
- }
-
- typeInfo.PolymorphismOptions = polymorphismOptions;
- };
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Serialization/AlterationSerializer.cs b/src/modules/alterations/Elsa.Alterations.Core/Serialization/AlterationSerializer.cs
deleted file mode 100644
index 001dc5aa..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Serialization/AlterationSerializer.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using System.Diagnostics.CodeAnalysis;
-using System.Text.Json;
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Common.Serialization;
-
-namespace Elsa.Alterations.Core.Serialization;
-
-///
-/// A serializer for objects.
-///
-public class AlterationSerializer : ConfigurableSerializer, IAlterationSerializer
-{
- ///
- public AlterationSerializer(IServiceProvider serviceProvider) : base(serviceProvider)
- {
- }
-
- ///
- [RequiresUnreferencedCode("The type of the alteration must be known at compile time.")]
- public string Serialize(IAlteration alteration)
- {
- var options = GetOptions();
- return JsonSerializer.Serialize(alteration, options);
- }
-
- ///
- [RequiresUnreferencedCode("The type of the alteration must be known at compile time.")]
- public string SerializeMany(IEnumerable alterations)
- {
- var options = GetOptions();
- return JsonSerializer.Serialize(alterations.ToArray(), options);
- }
-
- ///
- [RequiresUnreferencedCode("The type of the alteration must be known at compile time.")]
- public IAlteration Deserialize(string json)
- {
- var options = GetOptions();
- return JsonSerializer.Deserialize(json, options)!;
- }
-
- ///
- [RequiresUnreferencedCode("The type of the alteration must be known at compile time.")]
- public IEnumerable DeserializeMany(string json)
- {
- var options = GetOptions();
- return JsonSerializer.Deserialize(json, options)!;
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Services/AlteredWorkflowDispatcher.cs b/src/modules/alterations/Elsa.Alterations.Core/Services/AlteredWorkflowDispatcher.cs
deleted file mode 100644
index 1014dfda..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Services/AlteredWorkflowDispatcher.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Results;
-using Elsa.Workflows.Runtime;
-using Elsa.Workflows.Runtime.Contracts;
-using Elsa.Workflows.Runtime.Requests;
-
-namespace Elsa.Alterations.Core.Services;
-
-///
-public class AlteredWorkflowDispatcher : IAlteredWorkflowDispatcher
-{
- private readonly IWorkflowDispatcher _workflowDispatcher;
-
- ///
- /// Initializes a new instance of the class.
- ///
- public AlteredWorkflowDispatcher(IWorkflowDispatcher workflowDispatcher)
- {
- _workflowDispatcher = workflowDispatcher;
- }
-
- ///
- public async Task DispatchAsync(IEnumerable results, CancellationToken cancellationToken = default)
- {
- foreach (var result in results.Where(x => x is { IsSuccessful: true, WorkflowHasScheduledWork: true }))
- await DispatchAsync(result, cancellationToken);
- }
-
- ///
- public async Task DispatchAsync(RunAlterationsResult result, CancellationToken cancellationToken = default)
- {
- await _workflowDispatcher.DispatchAsync(new DispatchWorkflowInstanceRequest(result.WorkflowInstanceId), cancellationToken: cancellationToken);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Services/WorkflowInstanceFinder.cs b/src/modules/alterations/Elsa.Alterations.Core/Services/WorkflowInstanceFinder.cs
deleted file mode 100644
index b48b86e6..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Services/WorkflowInstanceFinder.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Models;
-using Elsa.Workflows;
-using Elsa.Workflows.Management;
-using Elsa.Workflows.Management.Filters;
-using Elsa.Workflows.Runtime;
-using Elsa.Workflows.Runtime.Filters;
-
-namespace Elsa.Alterations.Core.Services;
-
-///
-public class WorkflowInstanceFinder(IWorkflowInstanceStore workflowInstanceStore, IActivityExecutionStore activityExecutionStore) : IWorkflowInstanceFinder
-{
- ///
- public async Task> FindAsync(AlterationWorkflowInstanceFilter filter, CancellationToken cancellationToken = default)
- {
- var workflowInstanceFilter = new WorkflowInstanceFilter
- {
- Ids = filter.WorkflowInstanceIds?.ToList(),
- DefinitionIds = filter.DefinitionIds,
- DefinitionVersionIds = filter.DefinitionVersionIds?.ToList(),
- CorrelationIds = filter.CorrelationIds?.ToList(),
- HasIncidents = filter.HasIncidents,
- IsSystem = filter.IsSystem,
- TimestampFilters = filter.TimestampFilters?.ToList(),
- WorkflowStatuses = filter.Statuses?.ToList(),
- WorkflowSubStatuses = filter.SubStatuses?.ToList(),
- Names = filter.Names?.ToList(),
- SearchTerm = filter.SearchTerm,
- };
- var activityExecutionFilters = filter.ActivityFilters?.Select(x => new ActivityExecutionRecordFilter
- {
- ActivityId = x.ActivityId,
- Id = x.ActivityInstanceId,
- ActivityNodeId = x.NodeId,
- Name = x.Name,
- Status = x.Status,
- }).ToList();
-
- var emptyFilterSelectsAll = filter.EmptyFilterSelectsAll;
- var workflowInstanceFilterIsEmpty = WorkflowFilterIsEmpty(workflowInstanceFilter);
-
- var workflowInstanceIds = workflowInstanceFilterIsEmpty && !emptyFilterSelectsAll
- ? Enumerable.Empty().ToHashSet()
- : (await workflowInstanceStore.FindManyIdsAsync(workflowInstanceFilter, cancellationToken)).ToHashSet();
-
- if (activityExecutionFilters == null)
- return workflowInstanceIds;
-
- foreach (ActivityExecutionRecordFilter activityExecutionFilter in activityExecutionFilters.Where(x => !x.IsEmpty))
- {
- var activityExecutionRecords = await activityExecutionStore.FindManySummariesAsync(activityExecutionFilter, cancellationToken);
- var matchingWorkflowInstanceIds = activityExecutionRecords.Select(x => x.WorkflowInstanceId).ToHashSet();
-
- if (workflowInstanceFilterIsEmpty)
- workflowInstanceIds = matchingWorkflowInstanceIds;
- else
- workflowInstanceIds.IntersectWith(matchingWorkflowInstanceIds);
- }
-
- // Alterations must apply only to running workflows.
- workflowInstanceIds = (await FilterRunningWorkflowInstancesAsync(workflowInstanceIds, cancellationToken)).ToHashSet();
-
- return workflowInstanceIds;
- }
-
- private async Task> FilterRunningWorkflowInstancesAsync(IEnumerable workflowInstanceIds, CancellationToken cancellationToken)
- {
- var filter = new WorkflowInstanceFilter
- {
- Ids = workflowInstanceIds.ToList(),
- WorkflowStatus = WorkflowStatus.Running
- };
-
- return await workflowInstanceStore.FindManyIdsAsync(filter, cancellationToken);
- }
-
- private bool WorkflowFilterIsEmpty(WorkflowInstanceFilter filter)
- {
- return filter.Id == null &&
- filter.Ids == null &&
- filter.DefinitionId == null &&
- filter.DefinitionVersionId == null &&
- filter.DefinitionIds == null &&
- filter.DefinitionVersionIds == null &&
- filter.Version == null &&
- filter.CorrelationId == null &&
- filter.CorrelationIds == null &&
- filter.HasIncidents == null &&
- filter.TimestampFilters == null
- && string.IsNullOrWhiteSpace(filter.SearchTerm);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Stores/MemoryAlterationJobStore.cs b/src/modules/alterations/Elsa.Alterations.Core/Stores/MemoryAlterationJobStore.cs
deleted file mode 100644
index 1af9f76f..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Stores/MemoryAlterationJobStore.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Entities;
-using Elsa.Alterations.Core.Filters;
-using Elsa.Common.Services;
-
-namespace Elsa.Alterations.Core.Stores;
-
-///
-/// A memory-based store for alteration jobs.
-///
-public class MemoryAlterationJobStore : IAlterationJobStore
-{
- private readonly MemoryStore _store;
-
- ///
- /// Initializes a new instance of the class.
- ///
- public MemoryAlterationJobStore(MemoryStore store)
- {
- _store = store;
- }
-
- ///
- public Task SaveAsync(AlterationJob job, CancellationToken cancellationToken = default)
- {
- _store.Save(job, x => x.Id);
- return Task.CompletedTask;
- }
-
- ///
- public Task SaveManyAsync(IEnumerable jobs, CancellationToken cancellationToken = default)
- {
- _store.SaveMany(jobs, x => x.Id);
- return Task.CompletedTask;
- }
-
- ///
- public Task FindAsync(AlterationJobFilter filter, CancellationToken cancellationToken = default)
- {
- var entity = _store.Query(query => Filter(query, filter)).FirstOrDefault();
- return Task.FromResult(entity);
- }
-
- ///
- public Task> FindManyAsync(AlterationJobFilter filter, CancellationToken cancellationToken)
- {
- var entities = _store.Query(query => Filter(query, filter)).ToList().AsEnumerable();
- return Task.FromResult(entities);
- }
-
- ///
- public Task> FindManyIdsAsync(AlterationJobFilter filter, CancellationToken cancellationToken = default)
- {
- var ids = _store.Query(query => Filter(query, filter)).Select(x => x.Id).ToList().AsEnumerable();
- return Task.FromResult(ids);
- }
-
- ///
- public Task CountAsync(AlterationJobFilter filter, CancellationToken cancellationToken = default)
- {
- var count = _store.Query(query => Filter(query, filter)).LongCount();
- return Task.FromResult(count);
- }
-
-
- private static IQueryable Filter(IQueryable query, AlterationJobFilter filter) => filter.Apply(query);
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.Core/Stores/MemoryAlterationPlanStore.cs b/src/modules/alterations/Elsa.Alterations.Core/Stores/MemoryAlterationPlanStore.cs
deleted file mode 100644
index 9657c586..00000000
--- a/src/modules/alterations/Elsa.Alterations.Core/Stores/MemoryAlterationPlanStore.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Entities;
-using Elsa.Alterations.Core.Filters;
-using Elsa.Common.Services;
-
-namespace Elsa.Alterations.Core.Stores;
-
-///
-/// A memory-based store for alteration plans.
-///
-public class MemoryAlterationPlanStore : IAlterationPlanStore
-{
- private readonly MemoryStore _store;
-
- ///
- /// Initializes a new instance of the class.
- ///
- public MemoryAlterationPlanStore(MemoryStore store)
- {
- _store = store;
- }
-
- ///
- public Task SaveAsync(AlterationPlan plan, CancellationToken cancellationToken = default)
- {
- _store.Save(plan, x => x.Id);
- return Task.CompletedTask;
- }
-
- ///
- public Task FindAsync(AlterationPlanFilter filter, CancellationToken cancellationToken = default)
- {
- var entity = _store.Query(query => Filter(query, filter)).FirstOrDefault();
- return Task.FromResult(entity);
- }
-
- ///
- public Task CountAsync(AlterationPlanFilter filter, CancellationToken cancellationToken = default)
- {
- var count = _store.Query(query => Filter(query, filter)).LongCount();
- return Task.FromResult(count);
- }
-
- private static IQueryable Filter(IQueryable query, AlterationPlanFilter filter) => filter.Apply(query);
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations.MassTransit/Elsa.Alterations.MassTransit.csproj b/src/modules/alterations/Elsa.Alterations.MassTransit/Elsa.Alterations.MassTransit.csproj
index 1415ad40..1d5a2a6c 100644
--- a/src/modules/alterations/Elsa.Alterations.MassTransit/Elsa.Alterations.MassTransit.csproj
+++ b/src/modules/alterations/Elsa.Alterations.MassTransit/Elsa.Alterations.MassTransit.csproj
@@ -9,7 +9,14 @@
-
+
+
+
+
+
+
+
+
diff --git a/src/modules/alterations/Elsa.Alterations/Activities/AlterationPlanCompleted.cs b/src/modules/alterations/Elsa.Alterations/Activities/AlterationPlanCompleted.cs
deleted file mode 100644
index 45cd022e..00000000
--- a/src/modules/alterations/Elsa.Alterations/Activities/AlterationPlanCompleted.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.ComponentModel;
-using System.Runtime.CompilerServices;
-using Elsa.Alterations.Bookmarks;
-using Elsa.Extensions;
-using Elsa.Workflows;
-using Elsa.Workflows.Attributes;
-using Elsa.Workflows.Memory;
-using Elsa.Workflows.Models;
-
-namespace Elsa.Alterations.Activities;
-
-///
-/// Submits an alteration plan for execution.
-///
-[Browsable(false)]
-[Activity("Elsa", "Alterations", "Triggered when an Alteration Plan completed")]
-public class AlterationPlanCompleted : Trigger
-{
- ///
- public AlterationPlanCompleted(Variable planId, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, line)
- {
- PlanId = new Input(planId);
- }
-
- ///
- public AlterationPlanCompleted([CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, line)
- {
- }
-
- ///
- /// The ID of the alteration plan.
- ///
- public Input PlanId { get; set; } = null!;
-
- ///
- protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
- {
- if (context.IsTriggerOfWorkflow())
- {
- await context.CompleteActivityAsync();
- return;
- }
-
- var planId = context.Get(PlanId)!;
- var bookmarkPayload = new AlterationPlanCompletedPayload(planId);
- context.CreateBookmark(bookmarkPayload, false);
- }
-
- ///
- protected override object GetTriggerPayload(TriggerIndexingContext context)
- {
- var planId = context.Get(PlanId)!;
- return new AlterationPlanCompletedPayload(planId);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Activities/CompleteAlterationPlan.cs b/src/modules/alterations/Elsa.Alterations/Activities/CompleteAlterationPlan.cs
deleted file mode 100644
index 0c1d504b..00000000
--- a/src/modules/alterations/Elsa.Alterations/Activities/CompleteAlterationPlan.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System.ComponentModel;
-using System.Runtime.CompilerServices;
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Workflows;
-using Elsa.Workflows.Attributes;
-using Elsa.Workflows.Exceptions;
-using Elsa.Workflows.Memory;
-using Elsa.Workflows.Models;
-
-namespace Elsa.Alterations.Activities;
-
-///
-/// Marks an alteration plan as completed.
-///
-[Browsable(false)]
-[Activity("Elsa", "Alterations", "Dispatches jobs for the specified Alteration Plan", Kind = ActivityKind.Task)]
-public class CompleteAlterationPlan : CodeActivity
-{
- ///
- public CompleteAlterationPlan(Variable planId, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, line)
- {
- PlanId = new Input(planId);
- }
-
- ///
- public CompleteAlterationPlan([CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, line)
- {
- }
-
- ///
- /// The ID of the alteration plan.
- ///
- public Input PlanId { get; set; } = null!;
-
- ///
- protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
- {
- var cancellationToken = context.CancellationToken;
- var planId = context.Get(PlanId)!;
- var manager = context.GetRequiredService();
- var plan = await manager.GetPlanAsync(planId, cancellationToken);
-
- if (plan == null)
- throw new FaultException(AlterationFaultCodes.PlanNotFound, AlterationFaultCategories.Alteration, DefaultFaultTypes.System, $"Alteration Plan with ID {planId} not found.");
-
- await manager.CompletePlanAsync(plan, cancellationToken);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Activities/DispatchAlterationJobs.cs b/src/modules/alterations/Elsa.Alterations/Activities/DispatchAlterationJobs.cs
deleted file mode 100644
index 965a25c6..00000000
--- a/src/modules/alterations/Elsa.Alterations/Activities/DispatchAlterationJobs.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-using System.ComponentModel;
-using System.Runtime.CompilerServices;
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Enums;
-using Elsa.Alterations.Core.Filters;
-using Elsa.Workflows;
-using Elsa.Workflows.Attributes;
-using Elsa.Workflows.Exceptions;
-using Elsa.Workflows.Memory;
-using Elsa.Workflows.Models;
-
-namespace Elsa.Alterations.Activities;
-
-///
-/// Submits an alteration plan for execution.
-///
-[Browsable(false)]
-[Activity("Elsa", "Alterations", "Dispatches jobs for the specified Alteration Plan", Kind = ActivityKind.Task)]
-public class DispatchAlterationJobs : CodeActivity
-{
- ///
- public DispatchAlterationJobs(Variable planId, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, line)
- {
- PlanId = new Input(planId);
- }
-
- ///
- public DispatchAlterationJobs([CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, line)
- {
- }
-
- ///
- /// The ID of the alteration plan.
- ///
- public Input PlanId { get; set; } = null!;
-
- ///
- protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
- {
- var cancellationToken = context.CancellationToken;
- var planId = context.Get(PlanId)!;
- var alterationPlanStore = context.GetRequiredService();
- var planFilter = new AlterationPlanFilter
- {
- Id = planId
- };
- var plan = await alterationPlanStore.FindAsync(planFilter, cancellationToken);
-
- if (plan == null)
- throw new FaultException(AlterationFaultCodes.PlanNotFound, AlterationFaultCategories.Alteration, DefaultFaultTypes.System, $"Alteration Plan with ID {planId} not found.");
-
- // Update status.
- plan.Status = AlterationPlanStatus.Dispatching;
- await alterationPlanStore.SaveAsync(plan, cancellationToken);
-
- // Find all jobs for the plan and dispatch them.
- var filter = new AlterationJobFilter
- {
- PlanId = plan.Id
- };
- var alterationJobStore = context.GetRequiredService();
- var alterationJobIds = await alterationJobStore.FindManyIdsAsync(filter, cancellationToken);
-
- // Dispatch each job.
- var alterationJobDispatcher = context.GetRequiredService();
- foreach (var jobId in alterationJobIds)
- await alterationJobDispatcher.DispatchAsync(jobId, cancellationToken);
-
- // Update status.
- plan.Status = AlterationPlanStatus.Running;
- await alterationPlanStore.SaveAsync(plan, cancellationToken);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Activities/GenerateAlterationJobs.cs b/src/modules/alterations/Elsa.Alterations/Activities/GenerateAlterationJobs.cs
deleted file mode 100644
index 8bae6664..00000000
--- a/src/modules/alterations/Elsa.Alterations/Activities/GenerateAlterationJobs.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-using System.ComponentModel;
-using System.Runtime.CompilerServices;
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Entities;
-using Elsa.Alterations.Core.Enums;
-using Elsa.Alterations.Core.Filters;
-using Elsa.Alterations.Core.Models;
-using Elsa.Common;
-using Elsa.Extensions;
-using Elsa.Workflows;
-using Elsa.Workflows.Attributes;
-using Elsa.Workflows.Exceptions;
-using Elsa.Workflows.Memory;
-using Elsa.Workflows.Models;
-
-namespace Elsa.Alterations.Activities;
-
-///
-/// Submits an alteration plan for execution.
-///
-[Browsable(false)]
-[Activity("Elsa", "Alterations", "Generates jobs for the specified Alteration Plan", Kind = ActivityKind.Task)]
-public class GenerateAlterationJobs : CodeActivity
-{
- ///
- public GenerateAlterationJobs([CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, line)
- {
- }
-
- ///
- public GenerateAlterationJobs(Variable planId, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, line)
- {
- PlanId = new Input(planId);
- }
-
- ///
- /// The ID of the submitted alteration plan.
- ///
- public Input PlanId { get; set; } = null!;
-
- ///
- protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
- {
- var plan = await GetPlanAsync(context);
- await UpdatePlanStatusAsync(context, plan);
- var workflowInstanceIds = (await FindMatchingWorkflowInstanceIdsAsync(context, plan.WorkflowInstanceFilter)).ToList();
-
- if (workflowInstanceIds.Any())
- await GenerateJobsAsync(context, plan, workflowInstanceIds);
-
- context.SetResult(workflowInstanceIds.Count);
- }
-
- private async Task GetPlanAsync(ActivityExecutionContext context)
- {
- var cancellationToken = context.CancellationToken;
- var planId = context.Get(PlanId)!;
- var alterationPlanStore = context.GetRequiredService();
- var planFilter = new AlterationPlanFilter
- {
- Id = planId
- };
- var plan = await alterationPlanStore.FindAsync(planFilter, cancellationToken);
-
- if (plan == null)
- throw new FaultException(AlterationFaultCodes.PlanNotFound, AlterationFaultCategories.Alteration, DefaultFaultTypes.System, $"Alteration Plan with ID {planId} not found.");
-
- return plan;
- }
-
- private async Task UpdatePlanStatusAsync(ActivityExecutionContext context, AlterationPlan plan)
- {
- var cancellationToken = context.CancellationToken;
- var alterationPlanStore = context.GetRequiredService();
- plan.Status = AlterationPlanStatus.Generating;
- await alterationPlanStore.SaveAsync(plan, cancellationToken);
- }
-
- private async Task> FindMatchingWorkflowInstanceIdsAsync(ActivityExecutionContext context, AlterationWorkflowInstanceFilter filter)
- {
- var cancellationToken = context.CancellationToken;
- var workflowInstanceFinder = context.GetRequiredService();
- return await workflowInstanceFinder.FindAsync(filter, cancellationToken);
- }
-
- private async Task GenerateJobsAsync(ActivityExecutionContext context, AlterationPlan plan, IEnumerable workflowInstanceIds)
- {
- var cancellationToken = context.CancellationToken;
- var identityGenerator = context.GetRequiredService();
- var systemClock = context.GetRequiredService();
- var jobs = workflowInstanceIds.Select(workflowInstanceId => new AlterationJob
- {
- Id = identityGenerator.GenerateId(),
- PlanId = plan.Id,
- Status = AlterationJobStatus.Pending,
- WorkflowInstanceId = workflowInstanceId,
- CreatedAt = systemClock.UtcNow
- })
- .ToList();
-
- var alterationJobStore = context.GetRequiredService();
- await alterationJobStore.SaveManyAsync(jobs, cancellationToken);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Activities/SubmitAlterationPlan.cs b/src/modules/alterations/Elsa.Alterations/Activities/SubmitAlterationPlan.cs
deleted file mode 100644
index d1624a4c..00000000
--- a/src/modules/alterations/Elsa.Alterations/Activities/SubmitAlterationPlan.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using System.ComponentModel;
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Entities;
-using Elsa.Alterations.Core.Enums;
-using Elsa.Alterations.Core.Models;
-using Elsa.Common;
-using Elsa.Extensions;
-using Elsa.Workflows;
-using Elsa.Workflows.Attributes;
-using Elsa.Workflows.Models;
-
-namespace Elsa.Alterations.Activities;
-
-///
-/// Submits an alteration plan for execution.
-///
-[Browsable(false)]
-[Output(
- DisplayName = "Plan ID",
- Description = "The ID of the submitted alteration plan."
-)]
-[Activity("Elsa", "Alterations", "Submits an Alteration Plan", Kind = ActivityKind.Task)]
-public class SubmitAlterationPlan : CodeActivity
-{
- ///
- /// The parameters for the alteration plan to be submitted.
- ///
- public Input Params { get; set; } = null!;
-
- ///
- protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
- {
- var systemClock = context.GetRequiredService();
- var identityGenerator = context.GetRequiredService();
- var now = systemClock.UtcNow;
- var planParams = context.Get(Params)!;
-
- var plan = new AlterationPlan
- {
- Id = string.IsNullOrWhiteSpace(planParams.Id) ? identityGenerator.GenerateId() : planParams.Id,
- Alterations = planParams.Alterations,
- WorkflowInstanceFilter = planParams.Filter,
- Status = AlterationPlanStatus.Pending,
- CreatedAt = now
- };
-
- var alterationPlanStore = context.GetRequiredService();
- var cancellationToken = context.CancellationToken;
- await alterationPlanStore.SaveAsync(plan, cancellationToken);
- Result.Set(context, plan.Id);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/AlterationHandlers/CancelActivityHandler.cs b/src/modules/alterations/Elsa.Alterations/AlterationHandlers/CancelActivityHandler.cs
deleted file mode 100644
index 95ffa2db..00000000
--- a/src/modules/alterations/Elsa.Alterations/AlterationHandlers/CancelActivityHandler.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-using Elsa.Alterations.AlterationTypes;
-using Elsa.Alterations.Core.Abstractions;
-using Elsa.Alterations.Core.Contexts;
-using Elsa.Extensions;
-using Elsa.Workflows;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.AlterationHandlers;
-
-///
-/// Cancels an activity.
-///
-[UsedImplicitly]
-public class CancelActivityHandler : AlterationHandlerBase
-{
- ///
- protected override ValueTask HandleAsync(AlterationContext context, CancelActivity alteration)
- {
- if (alteration.ActivityInstanceId == null && alteration.ActivityId == null)
- {
- context.Fail("Either ActivityInstanceId or ActivityId must be specified");
- return ValueTask.CompletedTask;
- }
-
- var activityExecutionContexts = GetActivityExecutionContexts(context, alteration).ToList();
-
- if (!activityExecutionContexts.Any())
- {
- context.Fail(
- alteration.ActivityInstanceId != null
- ? $"Activity execution context with ID {alteration.ActivityInstanceId} not found"
- : $"Activity execution contexts for activity with ID {alteration.ActivityId} not found");
-
- return ValueTask.CompletedTask;
- }
-
- context.Succeed(() => CancelAsync(activityExecutionContexts));
- return ValueTask.CompletedTask;
- }
-
- private async Task CancelAsync(IEnumerable activityExecutionContexts)
- {
- foreach (var activityExecutionContext in activityExecutionContexts)
- await CancelAsync(activityExecutionContext);
- }
-
- private async Task CancelAsync(ActivityExecutionContext activityExecutionContext)
- {
- await activityExecutionContext.CancelActivityAsync();
- }
-
- private static IEnumerable GetActivityExecutionContexts(AlterationContext context, CancelActivity alteration)
- {
- var workflowExecutionContext = context.WorkflowExecutionContext;
-
- return alteration.ActivityInstanceId != null
- ? workflowExecutionContext.ActivityExecutionContexts.Where(x => x.Id == alteration.ActivityInstanceId)
- : alteration.ActivityId != null
- ? workflowExecutionContext.ActivityExecutionContexts.Where(x => x.Activity.Id == alteration.ActivityId)
- : Enumerable.Empty();
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/AlterationHandlers/CancelHandler.cs b/src/modules/alterations/Elsa.Alterations/AlterationHandlers/CancelHandler.cs
deleted file mode 100644
index 38bc3240..00000000
--- a/src/modules/alterations/Elsa.Alterations/AlterationHandlers/CancelHandler.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using Elsa.Alterations.AlterationTypes;
-using Elsa.Alterations.Core.Abstractions;
-using Elsa.Alterations.Core.Contexts;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.AlterationHandlers;
-
-///
-/// Upgrades the version of the workflow instance.
-///
-[UsedImplicitly]
-public class CancelHandler : AlterationHandlerBase
-{
- ///
- protected override ValueTask HandleAsync(AlterationContext context, Cancel alteration)
- {
- context.WorkflowExecutionContext.Cancel();
-
- context.Succeed();
- return ValueTask.CompletedTask;
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/AlterationHandlers/MigrateHandler.cs b/src/modules/alterations/Elsa.Alterations/AlterationHandlers/MigrateHandler.cs
deleted file mode 100644
index 25418ede..00000000
--- a/src/modules/alterations/Elsa.Alterations/AlterationHandlers/MigrateHandler.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using Elsa.Alterations.AlterationTypes;
-using Elsa.Alterations.Core.Abstractions;
-using Elsa.Alterations.Core.Contexts;
-using Elsa.Common.Models;
-using Elsa.Workflows.Management;
-using JetBrains.Annotations;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace Elsa.Alterations.AlterationHandlers;
-
-///
-/// Upgrades the version of the workflow instance.
-///
-[UsedImplicitly]
-public class MigrateHandler : AlterationHandlerBase
-{
- ///
- protected override async ValueTask HandleAsync(AlterationContext context, Migrate alteration)
- {
- var workflowDefinitionService = context.ServiceProvider.GetRequiredService();
- var definitionId = context.Workflow.Identity.DefinitionId;
- var targetVersion = alteration.TargetVersion;
- var cancellationToken = context.CancellationToken;
- var targetWorkflowDefinition = await workflowDefinitionService.FindWorkflowDefinitionAsync(definitionId, VersionOptions.SpecificVersion(targetVersion), cancellationToken);
-
- if (targetWorkflowDefinition == null)
- {
- context.Fail($"Workflow definition with ID {definitionId} and version {targetVersion} not found");
- return;
- }
-
- var targetWorkflow = await workflowDefinitionService.MaterializeWorkflowAsync(targetWorkflowDefinition, cancellationToken);
- await context.WorkflowExecutionContext.SetWorkflowGraphAsync(targetWorkflow);
-
- context.Succeed();
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/AlterationHandlers/ModifyVariableHandler.cs b/src/modules/alterations/Elsa.Alterations/AlterationHandlers/ModifyVariableHandler.cs
deleted file mode 100644
index e42d5162..00000000
--- a/src/modules/alterations/Elsa.Alterations/AlterationHandlers/ModifyVariableHandler.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using System.Diagnostics.CodeAnalysis;
-using Elsa.Alterations.AlterationTypes;
-using Elsa.Alterations.Core.Abstractions;
-using Elsa.Alterations.Core.Contexts;
-using Elsa.Extensions;
-using Elsa.Workflows;
-using Elsa.Workflows.Activities;
-using Elsa.Workflows.Memory;
-using JetBrains.Annotations;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace Elsa.Alterations.AlterationHandlers;
-
-///
-/// Modifies a workflow variable.
-///
-[UsedImplicitly]
-public class ModifyVariableHandler : AlterationHandlerBase
-{
- ///
- [RequiresUnreferencedCode("Calls System.Text.Json.JsonSerializer.Serialize(TValue, JsonSerializerOptions)")]
- protected override async ValueTask HandleAsync(AlterationContext context, ModifyVariable alteration)
- {
- var workflow = context.Workflow;
- var cancellationToken = context.CancellationToken;
- var variable = await FindVariable(context, alteration, workflow, cancellationToken);
-
- if (variable == null)
- {
- context.Fail($"Variable with ID {alteration.VariableId} not found");
- return;
- }
-
- var convertedValue = variable.ParseValue(alteration.Value);
- UpdateVariable(context, variable, convertedValue);
- context.Succeed();
- }
-
- private void UpdateVariable(AlterationContext context, Variable variable, object? value)
- {
- var activityExecutionContext = FindActivityExecutionContextContainingVariable(context, variable);
-
- if (activityExecutionContext == null)
- {
- context.Fail($"Activity execution context containing variable with ID {variable.Id} not found");
- return;
- }
-
- variable.Set(activityExecutionContext, value);
- }
-
- private ActivityExecutionContext? FindActivityExecutionContextContainingVariable(AlterationContext context, Variable variable)
- {
- var query =
- from activityExecutionContext in context.WorkflowExecutionContext.ActivityExecutionContexts
- from var in activityExecutionContext.Variables
- where var.Id == variable.Id
- select activityExecutionContext;
-
- return query.FirstOrDefault();
- }
-
- private async Task FindVariable(AlterationContext context, ModifyVariable alteration, Workflow workflow, CancellationToken cancellationToken)
- {
- var activityVisitor = context.ServiceProvider.GetRequiredService();
- var graph = await activityVisitor.VisitAsync(workflow, cancellationToken);
- var flattenedList = graph.Flatten().ToList();
-
- return flattenedList
- .Where(x => x.Activity is IVariableContainer)
- .SelectMany(x => ((IVariableContainer)x.Activity).Variables)
- .FirstOrDefault(x => x.Id == alteration.VariableId);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/AlterationHandlers/ScheduleActivityHandler.cs b/src/modules/alterations/Elsa.Alterations/AlterationHandlers/ScheduleActivityHandler.cs
deleted file mode 100644
index 89c7fd9c..00000000
--- a/src/modules/alterations/Elsa.Alterations/AlterationHandlers/ScheduleActivityHandler.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using Elsa.Alterations.AlterationTypes;
-using Elsa.Alterations.Core.Abstractions;
-using Elsa.Alterations.Core.Contexts;
-using Elsa.Extensions;
-using Elsa.Workflows;
-using Elsa.Workflows.Signals;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.AlterationHandlers;
-
-///
-/// Schedules an activity for execution.
-///
-[UsedImplicitly]
-public class ScheduleActivityHandler : AlterationHandlerBase
-{
- ///
- protected override async ValueTask HandleAsync(AlterationContext context, ScheduleActivity alteration)
- {
- if (alteration.ActivityInstanceId == null && alteration.ActivityId == null)
- {
- context.Fail("Either ActivityInstanceId or ActivityId must be specified");
- return;
- }
-
- var workflowExecutionContext = context.WorkflowExecutionContext;
- var existingActivityExecutionContext = GetActivityExecutionContext(context, alteration);
-
- if (existingActivityExecutionContext != null)
- {
- // If the activity is in a faulted state, reset it to Running.
- if (existingActivityExecutionContext.Status == ActivityStatus.Faulted)
- existingActivityExecutionContext.TransitionTo(ActivityStatus.Running);
-
- // Schedule the activity execution context.
- var parentContext = existingActivityExecutionContext.ParentActivityExecutionContext;
- await parentContext!.SendSignalAsync(new ScheduleChildActivity(existingActivityExecutionContext));
- context.Succeed();
- return;
- }
-
- // Schedule a new activity instance.
- var activityId = alteration.ActivityId;
-
- if (activityId == null)
- {
- context.Fail("No existing activity execution context was found and no activity ID was specified");
- return;
- }
-
- var activityNode = workflowExecutionContext.FindNodeByActivityId(activityId);
-
- if (activityNode == null)
- {
- context.Fail($"Activity with ID {activityId} not found");
- return;
- }
-
- // Find the parent activity execution context within which to schedule the activity.
- var parentActivityContexts = workflowExecutionContext.ActivityExecutionContexts.Reverse().ToList();
-
- var parentExecutionContext =
- (from ancestorNode in activityNode.Ancestors()
- from parentActivityContext in parentActivityContexts
- where parentActivityContext.Activity.Id == ancestorNode.Activity.Id
- select parentActivityContext).FirstOrDefault();
-
- if (parentExecutionContext == null)
- {
- context.Fail($"Could not find parent activity execution context for activity with ID {activityId}");
- return;
- }
-
- await parentExecutionContext.SendSignalAsync(new ScheduleChildActivity(activityNode.Activity));
- context.Succeed();
- }
-
- private static ActivityExecutionContext? GetActivityExecutionContext(AlterationContext context, ScheduleActivity alteration)
- {
- if (alteration.ActivityInstanceId != null)
- return context.WorkflowExecutionContext.ActivityExecutionContexts.FirstOrDefault(x => x.Id == alteration.ActivityInstanceId);
-
- return null;
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/AlterationTypes/Cancel.cs b/src/modules/alterations/Elsa.Alterations/AlterationTypes/Cancel.cs
deleted file mode 100644
index c0a5f7fd..00000000
--- a/src/modules/alterations/Elsa.Alterations/AlterationTypes/Cancel.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using Elsa.Alterations.Core.Abstractions;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.AlterationTypes;
-
-///
-/// Cancels the workflow instances in an alteration plan.
-///
-[UsedImplicitly]
-public class Cancel : AlterationBase;
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/AlterationTypes/CancelActivity.cs b/src/modules/alterations/Elsa.Alterations/AlterationTypes/CancelActivity.cs
deleted file mode 100644
index 15083bae..00000000
--- a/src/modules/alterations/Elsa.Alterations/AlterationTypes/CancelActivity.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using Elsa.Alterations.Core.Abstractions;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.AlterationTypes;
-
-///
-/// Cancels an activity.
-///
-[UsedImplicitly]
-public class CancelActivity : AlterationBase
-{
- ///
- /// The ID of the activity to be cancelled. If not specified, the activity instance ID will be used.
- ///
- public string? ActivityId { get; set; }
-
- ///
- /// The ID of the activity instance to be cancelled. If specified, overrides .
- ///
- public string? ActivityInstanceId { get; set; }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/AlterationTypes/Migrate.cs b/src/modules/alterations/Elsa.Alterations/AlterationTypes/Migrate.cs
deleted file mode 100644
index 2097bedc..00000000
--- a/src/modules/alterations/Elsa.Alterations/AlterationTypes/Migrate.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using Elsa.Alterations.Core.Abstractions;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.AlterationTypes;
-
-///
-/// Migrates a workflow instance to a newer version.
-///
-[UsedImplicitly]
-public class Migrate : AlterationBase
-{
- ///
- /// The target version to upgrade to.
- ///
- public int TargetVersion { get; set; }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/AlterationTypes/ModifyVariable.cs b/src/modules/alterations/Elsa.Alterations/AlterationTypes/ModifyVariable.cs
deleted file mode 100644
index 9cbd9d16..00000000
--- a/src/modules/alterations/Elsa.Alterations/AlterationTypes/ModifyVariable.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using Elsa.Alterations.Core.Abstractions;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.AlterationTypes;
-
-///
-/// Modifies a variable.
-///
-[UsedImplicitly]
-public class ModifyVariable : AlterationBase
-{
- ///
- /// The ID of the variable to modify.
- ///
- public string VariableId { get; set; } = null!;
-
- ///
- /// The new value of the variable.
- ///
- public object? Value { get; set; }
-
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/AlterationTypes/ScheduleActivity.cs b/src/modules/alterations/Elsa.Alterations/AlterationTypes/ScheduleActivity.cs
deleted file mode 100644
index de447852..00000000
--- a/src/modules/alterations/Elsa.Alterations/AlterationTypes/ScheduleActivity.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using Elsa.Alterations.Core.Abstractions;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.AlterationTypes;
-
-///
-/// Schedules an activity for execution.
-///
-[UsedImplicitly]
-public class ScheduleActivity : AlterationBase
-{
- ///
- /// The ID of the next activity to be scheduled. If not specified, the ActivityInstanceId will be used.
- ///
- public string? ActivityId { get; set; }
-
- ///
- /// The ID of the activity instance to be scheduled. If not specified, the ActivityId will be used.
- ///
- public string? ActivityInstanceId { get; set; }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Bookmarks/AlterationPlanCompletedPayload.cs b/src/modules/alterations/Elsa.Alterations/Bookmarks/AlterationPlanCompletedPayload.cs
deleted file mode 100644
index 2c1f6e99..00000000
--- a/src/modules/alterations/Elsa.Alterations/Bookmarks/AlterationPlanCompletedPayload.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using Elsa.Alterations.Activities;
-
-namespace Elsa.Alterations.Bookmarks;
-
-///
-/// Represents bookmark payload for the trigger.
-///
-/// The ID of the alteration plan.
-public record AlterationPlanCompletedPayload(string PlanId);
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Constants/AlterationFaultCategories.cs b/src/modules/alterations/Elsa.Alterations/Constants/AlterationFaultCategories.cs
deleted file mode 100644
index dc528751..00000000
--- a/src/modules/alterations/Elsa.Alterations/Constants/AlterationFaultCategories.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Elsa.Alterations;
-
-public static class AlterationFaultCategories
-{
- public const string Alteration = "Alteration";
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Constants/AlterationFaultCodes.cs b/src/modules/alterations/Elsa.Alterations/Constants/AlterationFaultCodes.cs
deleted file mode 100644
index f3ea75e9..00000000
--- a/src/modules/alterations/Elsa.Alterations/Constants/AlterationFaultCodes.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Elsa.Alterations;
-
-public static class AlterationFaultCodes
-{
- public const string PlanNotFound = "PlanNotFound";
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Elsa.Alterations.csproj b/src/modules/alterations/Elsa.Alterations/Elsa.Alterations.csproj
deleted file mode 100644
index d0796780..00000000
--- a/src/modules/alterations/Elsa.Alterations/Elsa.Alterations.csproj
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- Provides alterations for workflow instances.
-
- elsa extension module alterations
-
-
-
-
-
-
diff --git a/src/modules/alterations/Elsa.Alterations/Elsa.Alterations.csproj.DotSettings b/src/modules/alterations/Elsa.Alterations/Elsa.Alterations.csproj.DotSettings
deleted file mode 100644
index fa772529..00000000
--- a/src/modules/alterations/Elsa.Alterations/Elsa.Alterations.csproj.DotSettings
+++ /dev/null
@@ -1,2 +0,0 @@
-
- True
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/DryRun/Endpoint.cs b/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/DryRun/Endpoint.cs
deleted file mode 100644
index 4bc173d3..00000000
--- a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/DryRun/Endpoint.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using Elsa.Abstractions;
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Models;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.Endpoints.Alterations.DryRun;
-
-///
-/// Determines which workflow instances a "Submit" request would target without actually running an alteration.
-///
-[PublicAPI]
-public class DryRun(IWorkflowInstanceFinder workflowInstanceFinder) : ElsaEndpoint
-{
- ///
- public override void Configure()
- {
- Post("/alterations/dry-run");
- ConfigurePermissions("run:alterations");
- }
-
- ///
- public override async Task HandleAsync(AlterationWorkflowInstanceFilter filter, CancellationToken cancellationToken)
- {
- var workflowInstanceIds = await workflowInstanceFinder.FindAsync(filter, cancellationToken);
- var response = new Response(workflowInstanceIds.ToList());
- await Send.OkAsync(response, cancellationToken);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/DryRun/Response.cs b/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/DryRun/Response.cs
deleted file mode 100644
index fdae58b0..00000000
--- a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/DryRun/Response.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Elsa.Alterations.Endpoints.Alterations.DryRun;
-
-///
-/// The response from the endpoint.
-///
-public record Response(ICollection WorkflowInstanceIds);
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Get/Endpoint.cs b/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Get/Endpoint.cs
deleted file mode 100644
index 497cb6f1..00000000
--- a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Get/Endpoint.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using Elsa.Abstractions;
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Filters;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.Endpoints.Alterations.Get;
-
-///
-/// Gets an alteration plan and its associated jobs.
-///
-[PublicAPI]
-public class Get : ElsaEndpointWithoutRequest
-{
- private readonly IAlterationPlanStore _alterationPlanStore;
- private readonly IAlterationJobStore _alterationJobStore;
-
- ///
- public Get(IAlterationPlanStore alterationPlanStore, IAlterationJobStore alterationJobStore)
- {
- _alterationPlanStore = alterationPlanStore;
- _alterationJobStore = alterationJobStore;
- }
-
- ///
- public override void Configure()
- {
- Get("/alterations/{id}");
- ConfigurePermissions("read:alterations");
- }
-
- ///
- public override async Task HandleAsync(CancellationToken cancellationToken)
- {
- var planId = Route("id");
-
- // Load the plan.
- var plan = await _alterationPlanStore.FindAsync(new AlterationPlanFilter { Id = planId }, cancellationToken);
-
- if (plan == null)
- {
- await Send.NotFoundAsync(cancellationToken);
- return;
- }
-
- // Load the jobs.
- var jobs = (await _alterationJobStore.FindManyAsync(new AlterationJobFilter { PlanId = planId }, cancellationToken)).ToList();
-
- // Write response.
- var response = new Response(plan, jobs);
- await Send.OkAsync(response, cancellationToken);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Get/Response.cs b/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Get/Response.cs
deleted file mode 100644
index 673a7768..00000000
--- a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Get/Response.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using Elsa.Alterations.Core.Entities;
-
-namespace Elsa.Alterations.Endpoints.Alterations.Get;
-
-///
-/// Represents a response to a request to get an alteration plan.
-///
-/// The alteration plan.
-/// The jobs created for the plan.
-public record Response(AlterationPlan Plan, ICollection Jobs);
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Run/Endpoint.cs b/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Run/Endpoint.cs
deleted file mode 100644
index c36a607d..00000000
--- a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Run/Endpoint.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using Elsa.Abstractions;
-using Elsa.Alterations.Core.Contracts;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.Endpoints.Alterations.Run;
-
-///
-/// Executes an alteration plan by targeting workflow instances by ID.
-///
-[PublicAPI]
-public class Run : ElsaEndpoint
-{
- private readonly IAlterationRunner _alterationRunner;
- private readonly IAlteredWorkflowDispatcher _workflowDispatcher;
-
- ///
- public Run(IAlterationRunner alterationRunner, IAlteredWorkflowDispatcher workflowDispatcher)
- {
- _alterationRunner = alterationRunner;
- _workflowDispatcher = workflowDispatcher;
- }
-
- ///
- public override void Configure()
- {
- Post("/alterations/run");
- ConfigurePermissions("run:alterations");
- }
-
- ///
- public override async Task HandleAsync(Request request, CancellationToken cancellationToken)
- {
- // Run the alterations.
- var results = await _alterationRunner.RunAsync(request.WorkflowInstanceIds, request.Alterations, cancellationToken);
-
- // Schedule each successfully updated workflow containing scheduled work.
- await _workflowDispatcher.DispatchAsync(results, cancellationToken);
-
- // Write response.
- var response = new Response(results);
- await Send.OkAsync(response, cancellationToken);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Run/Request.cs b/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Run/Request.cs
deleted file mode 100644
index 9b661f91..00000000
--- a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Run/Request.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-// ReSharper disable CollectionNeverUpdated.Global
-
-namespace Elsa.Alterations.Endpoints.Alterations.Run;
-
-///
-/// A plan that contains a list of alterations to be applied to a set of workflow instances.
-///
-public class Request
-{
- ///
- /// The alterations to be applied.
- ///
- public ICollection Alterations { get; set; } = new List();
-
- ///
- /// The IDs of the workflow instances that this plan applies to.
- ///
- public ICollection WorkflowInstanceIds { get; set; } = new List();
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Run/Response.cs b/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Run/Response.cs
deleted file mode 100644
index d2b04d6e..00000000
--- a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Run/Response.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Elsa.Alterations.Core.Results;
-
-namespace Elsa.Alterations.Endpoints.Alterations.Run;
-
-///
-/// The response from the endpoint.
-///
-public record Response(ICollection Results);
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Submit/Endpoint.cs b/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Submit/Endpoint.cs
deleted file mode 100644
index e36a910b..00000000
--- a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Submit/Endpoint.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using Elsa.Abstractions;
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Models;
-using Elsa.Common;
-using Elsa.Workflows;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.Endpoints.Alterations.Submit;
-
-///
-/// Submits an alteration plan to be executed targeting workflow instances by a filter.
-///
-[PublicAPI]
-public class Submit : ElsaEndpoint
-{
- private readonly IAlterationPlanScheduler _alterationPlanScheduler;
- private readonly IIdentityGenerator _identityGenerator;
- private readonly ISystemClock _systemClock;
-
- ///
- public Submit(IAlterationPlanScheduler alterationPlanScheduler, IIdentityGenerator identityGenerator, ISystemClock systemClock)
- {
- _alterationPlanScheduler = alterationPlanScheduler;
- _identityGenerator = identityGenerator;
- _systemClock = systemClock;
- }
-
- ///
- public override void Configure()
- {
- Post("/alterations/submit");
- ConfigurePermissions("run:alterations");
- }
-
- ///
- public override async Task HandleAsync(AlterationPlanParams planParams, CancellationToken cancellationToken)
- {
- // Submit the plan.
- var planId = await _alterationPlanScheduler.SubmitAsync(planParams, cancellationToken);
-
- // Write response.
- var response = new Response(planId);
- await Send.OkAsync(response, cancellationToken);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Submit/Response.cs b/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Submit/Response.cs
deleted file mode 100644
index f888d378..00000000
--- a/src/modules/alterations/Elsa.Alterations/Endpoints/Alterations/Submit/Response.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Elsa.Alterations.Endpoints.Alterations.Submit;
-
-///
-/// The response from the endpoint.
-///
-public record Response(string PlanId);
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Endpoints/Workflows/Retry/Endpoint.cs b/src/modules/alterations/Elsa.Alterations/Endpoints/Workflows/Retry/Endpoint.cs
deleted file mode 100644
index ba736716..00000000
--- a/src/modules/alterations/Elsa.Alterations/Endpoints/Workflows/Retry/Endpoint.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-using Elsa.Abstractions;
-using Elsa.Alterations.AlterationTypes;
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Results;
-using Elsa.Workflows.Management;
-using Elsa.Workflows.Management.Entities;
-using Elsa.Workflows.Management.Filters;
-using Elsa.Workflows.Runtime;
-using Elsa.Workflows.Runtime.Contracts;
-using Elsa.Workflows.Runtime.Requests;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.Endpoints.Workflows.Retry;
-
-///
-/// Retries the specified workflow instances.
-///
-[PublicAPI]
-public class Retry : ElsaEndpoint
-{
- private readonly IAlterationRunner _alterationRunner;
- private readonly IWorkflowDispatcher _workflowDispatcher;
- private readonly IWorkflowInstanceStore _workflowInstanceStore;
-
- ///
- public Retry(IAlterationRunner alterationRunner, IWorkflowDispatcher workflowDispatcher, IWorkflowInstanceStore workflowInstanceStore)
- {
- _alterationRunner = alterationRunner;
- _workflowDispatcher = workflowDispatcher;
- _workflowInstanceStore = workflowInstanceStore;
- }
-
- ///
- public override void Configure()
- {
- Routes("/alterations/workflows/retry");
- Verbs(FastEndpoints.Http.GET, FastEndpoints.Http.POST);
- ConfigurePermissions("run:alterations");
- }
-
- ///
- public override async Task HandleAsync(Request request, CancellationToken cancellationToken)
- {
- var allResults = new List();
-
- // Load each workflow instance.
- var workflowInstances = (await _workflowInstanceStore.FindManyAsync(new WorkflowInstanceFilter { Ids = request.WorkflowInstanceIds }, cancellationToken)).ToList();
-
- foreach (var workflowInstance in workflowInstances)
- {
- // Setup an alteration plan.
- var activityIds = GetActivityIds(request, workflowInstance).ToList();
- var alterations = activityIds.Select(activityId => new ScheduleActivity { ActivityId = activityId }).Cast().ToList();
-
- // Run the plan.
- var results = await _alterationRunner.RunAsync(request.WorkflowInstanceIds, alterations, cancellationToken);
- allResults.AddRange(results);
-
- // Schedule updated workflow.
- await _workflowDispatcher.DispatchAsync(new DispatchWorkflowInstanceRequest(workflowInstance.Id), cancellationToken: cancellationToken);
- }
-
- // Write response.
- var response = new Response(allResults);
- await Send.OkAsync(response, cancellationToken);
- }
-
- private IEnumerable GetActivityIds(Request request, WorkflowInstance workflowInstance)
- {
- // If activity IDs are explicitly specified, use them.
- if (request.ActivityIds?.Any() == true)
- return request.ActivityIds;
-
- // Otherwise, select IDs of all faulted activities.
- return workflowInstance.WorkflowState.Incidents.Select(x => x.ActivityId).Distinct().ToList();
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Endpoints/Workflows/Retry/Request.cs b/src/modules/alterations/Elsa.Alterations/Endpoints/Workflows/Retry/Request.cs
deleted file mode 100644
index 7539fe3e..00000000
--- a/src/modules/alterations/Elsa.Alterations/Endpoints/Workflows/Retry/Request.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace Elsa.Alterations.Endpoints.Workflows.Retry;
-
-///
-/// A request to retry one or more faulted workflow instances.
-///
-public class Request
-{
- ///
- /// The IDs of the workflow instances that have incidents to be retried.
- ///
- public ICollection WorkflowInstanceIds { get; set; } = new List();
-
- ///
- /// An optional list of explicitly specified activity IDs to retry. If omitted, all faulted activities will be retried.
- ///
- public ICollection? ActivityIds { get; set; }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Endpoints/Workflows/Retry/Response.cs b/src/modules/alterations/Elsa.Alterations/Endpoints/Workflows/Retry/Response.cs
deleted file mode 100644
index 99a910c6..00000000
--- a/src/modules/alterations/Elsa.Alterations/Endpoints/Workflows/Retry/Response.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Elsa.Alterations.Core.Results;
-
-namespace Elsa.Alterations.Endpoints.Workflows.Retry;
-
-///
-/// The response from the endpoint.
-///
-public record Response(ICollection Results);
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Extensions/ModuleExtensions.cs b/src/modules/alterations/Elsa.Alterations/Extensions/ModuleExtensions.cs
deleted file mode 100644
index c7488eb2..00000000
--- a/src/modules/alterations/Elsa.Alterations/Extensions/ModuleExtensions.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Elsa.Alterations.Features;
-using Elsa.Extensions;
-using Elsa.Features.Services;
-
-namespace Elsa.Alterations.Extensions;
-
-///
-/// Adds the .
-///
-public static class ModuleExtensions
-{
- ///
- /// Adds the .
- ///
- public static IModule UseAlterations(this IModule module, Action? configure = null)
- {
- return module.Use(configure);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Extensions/ServiceCollectionExtensions.cs b/src/modules/alterations/Elsa.Alterations/Extensions/ServiceCollectionExtensions.cs
deleted file mode 100644
index b930d287..00000000
--- a/src/modules/alterations/Elsa.Alterations/Extensions/ServiceCollectionExtensions.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using Elsa.Alterations.AlterationHandlers;
-using Elsa.Alterations.AlterationTypes;
-using Elsa.Alterations.Core.Extensions;
-using Elsa.Alterations.Features;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace Elsa.Alterations.Extensions;
-
-///
-/// Extension methods for .
-///
-public static class ServiceCollectionExtensions
-{
- ///
- /// Adds various alteration handlers.
- ///
- public static IServiceCollection AddAlterations(this IServiceCollection services)
- {
- services.AddAlteration();
- services.AddAlteration();
- services.AddAlteration();
- services.AddAlteration();
- services.AddAlteration();
- services.AddNotificationHandlersFrom();
- return services;
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Features/AlterationsFeature.cs b/src/modules/alterations/Elsa.Alterations/Features/AlterationsFeature.cs
deleted file mode 100644
index 426a3410..00000000
--- a/src/modules/alterations/Elsa.Alterations/Features/AlterationsFeature.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Entities;
-using Elsa.Alterations.Core.Extensions;
-using Elsa.Alterations.Core.Stores;
-using Elsa.Alterations.Extensions;
-using Elsa.Alterations.Services;
-using Elsa.Alterations.Workflows;
-using Elsa.Extensions;
-using Elsa.Features.Abstractions;
-using Elsa.Features.Services;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace Elsa.Alterations.Features;
-
-///
-/// Adds the Elsa alterations services.
-///
-public class AlterationsFeature : FeatureBase
-{
- ///
- public AlterationsFeature(IModule module) : base(module)
- {
- }
-
- ///
- /// Gets or sets the factory for the alteration plan store.
- ///
- public Func AlterationPlanStoreFactory { get; set; } = sp => sp.GetRequiredService();
-
- ///
- /// Gets or sets the factory for the alteration job store.
- ///
- public Func AlterationJobStoreFactory { get; set; } = sp => sp.GetRequiredService();
-
- ///
- /// Gets or sets the factory for the alteration job dispatcher.
- ///
- public Func AlterationJobDispatcherFactory { get; set; } = sp => sp.GetRequiredService();
-
- ///
- /// Adds an alteration and its handler.
- ///
- /// The type of alteration.
- /// The type of alteration handler.
- public AlterationsFeature AddAlteration() where T : class, IAlteration where THandler : class, IAlterationHandler
- {
- Services.AddAlteration();
- return this;
- }
-
- ///
- public override void Configure()
- {
- Module.AddFastEndpointsAssembly();
- Module.AddWorkflow();
- }
-
- ///
- public override void Apply()
- {
- Services.AddScoped();
- Services.AddAlterations();
- Services.AddAlterationsCore();
- Services.AddScoped();
- Services.AddScoped();
- Services.AddScoped();
- Services.AddScoped();
-
- Services.AddMemoryStore();
- Services.AddMemoryStore();
-
- Services.AddScoped(AlterationPlanStoreFactory);
- Services.AddScoped(AlterationJobStoreFactory);
- Services.AddScoped(AlterationJobDispatcherFactory);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/FodyWeavers.xml b/src/modules/alterations/Elsa.Alterations/FodyWeavers.xml
deleted file mode 100644
index 00e1d9a1..00000000
--- a/src/modules/alterations/Elsa.Alterations/FodyWeavers.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Handlers/AlterationJobCompletedHandler.cs b/src/modules/alterations/Elsa.Alterations/Handlers/AlterationJobCompletedHandler.cs
deleted file mode 100644
index e9b2758e..00000000
--- a/src/modules/alterations/Elsa.Alterations/Handlers/AlterationJobCompletedHandler.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Notifications;
-using Elsa.Mediator.Contracts;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.Handlers;
-
-///
-/// Handles notifications and updates the plan status if all jobs are completed.
-///
-[UsedImplicitly]
-public class AlterationJobCompletedHandler(IAlterationPlanManager manager) : INotificationHandler
-{
- ///
- public async Task HandleAsync(AlterationJobCompleted notification, CancellationToken cancellationToken)
- {
- var job = notification.Job;
- var planId = job.PlanId;
- var plan = (await manager.GetPlanAsync(planId, cancellationToken))!;
- var allJobsCompleted = await manager.GetIsAllJobsCompletedAsync(planId, cancellationToken);
-
- if(!allJobsCompleted)
- return;
-
- await manager.CompletePlanAsync(plan, cancellationToken);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Handlers/AlterationPlanCompletedHandler.cs b/src/modules/alterations/Elsa.Alterations/Handlers/AlterationPlanCompletedHandler.cs
deleted file mode 100644
index f9b60505..00000000
--- a/src/modules/alterations/Elsa.Alterations/Handlers/AlterationPlanCompletedHandler.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using Elsa.Alterations.Bookmarks;
-using Elsa.Alterations.Core.Notifications;
-using Elsa.Mediator.Contracts;
-using Elsa.Workflows;
-using Elsa.Workflows.Helpers;
-using Elsa.Workflows.Runtime;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.Handlers;
-
-///
-/// Handles notifications and triggers any workflows that are waiting for the plan to complete.
-///
-[UsedImplicitly]
-public class AlterationPlanCompletedHandler(IBookmarkQueue bookmarkQueue, IStimulusHasher stimulusHasher) : INotificationHandler
-{
- ///
- public async Task HandleAsync(AlterationPlanCompleted notification, CancellationToken cancellationToken)
- {
- // Trigger any workflow instances that are waiting for the plan to complete.
- var planId = notification.Plan.Id;
- var bookmarkPayload = new AlterationPlanCompletedPayload(planId);
- var activityTypeName = ActivityTypeNameHelper.GenerateTypeName();
- var item = new NewBookmarkQueueItem
- {
- ActivityTypeName = activityTypeName,
- StimulusHash = stimulusHasher.Hash(activityTypeName, bookmarkPayload)
- };
- await bookmarkQueue.EnqueueAsync(item, cancellationToken);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Handlers/ResumeWorkflowInstance.cs b/src/modules/alterations/Elsa.Alterations/Handlers/ResumeWorkflowInstance.cs
deleted file mode 100644
index 91bb827a..00000000
--- a/src/modules/alterations/Elsa.Alterations/Handlers/ResumeWorkflowInstance.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using Elsa.Alterations.Core.Enums;
-using Elsa.Alterations.Core.Notifications;
-using Elsa.Mediator.Contracts;
-using Elsa.Workflows.Runtime;
-using Elsa.Workflows.Runtime.Contracts;
-using Elsa.Workflows.Runtime.Requests;
-using JetBrains.Annotations;
-
-namespace Elsa.Alterations.Handlers;
-
-///
-/// Resumes a workflow instance when an alteration job has been completed and the workflow contains scheduled work.
-///
-[UsedImplicitly]
-public class ResumeWorkflowInstance : INotificationHandler
-{
- private readonly IWorkflowDispatcher _workflowDispatcher;
-
- ///
- /// Initializes a new instance of the class.
- ///
- public ResumeWorkflowInstance(IWorkflowDispatcher workflowDispatcher)
- {
- _workflowDispatcher = workflowDispatcher;
- }
-
- ///
- public async Task HandleAsync(AlterationJobCompleted notification, CancellationToken cancellationToken)
- {
- var job = notification.Job;
-
- // Check if job is completed.
- if(job.Status != AlterationJobStatus.Completed)
- return;
-
- // Check if the workflow contains scheduled work.
- if(!notification.WorkflowContainsScheduledWork)
- return;
-
- // Resume workflow instance.
- await _workflowDispatcher.DispatchAsync(new DispatchWorkflowInstanceRequest(job.WorkflowInstanceId), cancellationToken: cancellationToken);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Middleware/Workflows/RunAlterationsMiddleware.cs b/src/modules/alterations/Elsa.Alterations/Middleware/Workflows/RunAlterationsMiddleware.cs
deleted file mode 100644
index f412a8cb..00000000
--- a/src/modules/alterations/Elsa.Alterations/Middleware/Workflows/RunAlterationsMiddleware.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using Elsa.Alterations.Core.Contexts;
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Models;
-using Elsa.Extensions;
-using Elsa.Workflows;
-using Elsa.Workflows.Pipelines.WorkflowExecution;
-
-namespace Elsa.Alterations.Middleware.Workflows;
-
-///
-/// Middleware that runs alterations.
-///
-internal class RunAlterationsMiddleware(WorkflowMiddlewareDelegate next, IEnumerable handlers) : WorkflowExecutionMiddleware(next)
-{
- public static readonly object AlterationsPropertyKey = new();
- public static readonly object AlterationsLogPropertyKey = new();
-
- public override async ValueTask InvokeAsync(WorkflowExecutionContext context)
- {
- var alterations = (IEnumerable)(context.TransientProperties.GetValue(AlterationsPropertyKey) ?? throw new InvalidOperationException("No alterations found in the transient properties."));
- var log = (AlterationLog)(context.TransientProperties.GetValue(AlterationsLogPropertyKey) ?? throw new InvalidOperationException("No alteration log found in the transient properties."));
- await RunAsync(context, alterations, log, context.CancellationToken);
- }
-
- private async Task RunAsync(WorkflowExecutionContext workflowExecutionContext, IEnumerable alterations, AlterationLog log, CancellationToken cancellationToken = default)
- {
- var commitActions = new List>();
-
- foreach (var alteration in alterations)
- {
- // Find handlers.
- var supportedHandlers = handlers.Where(x => x.CanHandle(alteration)).ToList();
-
- foreach (var handler in supportedHandlers)
- {
- // Execute handler.
- var alterationContext = new AlterationContext(alteration, workflowExecutionContext, log, cancellationToken);
- await handler.HandleAsync(alterationContext);
-
- // If the handler has failed, exit.
- if (alterationContext.HasFailed)
- return;
-
- // Collect the commit handler, if any.
- if (alterationContext.CommitAction != null)
- commitActions.Add(alterationContext.CommitAction);
- }
- }
-
- // Execute commit handlers.
- foreach (var commitAction in commitActions)
- await commitAction();
-
- // Add alteration logs to the workflow execution log.
- foreach (var alterationLogEntry in log.LogEntries)
- workflowExecutionContext.AddExecutionLogEntry(alterationLogEntry.EventName ?? alterationLogEntry.Message, alterationLogEntry.Message);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Services/AlterationPlanManager.cs b/src/modules/alterations/Elsa.Alterations/Services/AlterationPlanManager.cs
deleted file mode 100644
index 23e05421..00000000
--- a/src/modules/alterations/Elsa.Alterations/Services/AlterationPlanManager.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Entities;
-using Elsa.Alterations.Core.Enums;
-using Elsa.Alterations.Core.Filters;
-using Elsa.Alterations.Core.Notifications;
-using Elsa.Common;
-using Elsa.Mediator.Contracts;
-
-namespace Elsa.Alterations.Services;
-
-///
-public class AlterationPlanManager(IAlterationPlanStore planStore, IAlterationJobStore jobStore, ISystemClock systemClock, INotificationSender notificationSender) : IAlterationPlanManager
-{
- ///
- public async Task GetPlanAsync(string planId, CancellationToken cancellationToken = default)
- {
- var planFilter = new AlterationPlanFilter { Id = planId };
- return await planStore.FindAsync(planFilter, cancellationToken);
- }
-
- ///
- public async Task GetIsAllJobsCompletedAsync(string planId, CancellationToken cancellationToken = default)
- {
- // Check if all jobs are completed.
- var jobFilter = new AlterationJobFilter
- {
- PlanId = planId,
- Statuses = [AlterationJobStatus.Pending, AlterationJobStatus.Running]
- };
-
- return await jobStore.CountAsync(jobFilter, cancellationToken) == 0;
- }
-
- ///
- public async Task CompletePlanAsync(AlterationPlan plan, CancellationToken cancellationToken = default)
- {
- plan.Status = AlterationPlanStatus.Completed;
- plan.CompletedAt = systemClock.UtcNow;
-
- await planStore.SaveAsync(plan, cancellationToken);
- await notificationSender.SendAsync(new AlterationPlanCompleted(plan), cancellationToken);
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Services/BackgroundAlterationJobDispatcher.cs b/src/modules/alterations/Elsa.Alterations/Services/BackgroundAlterationJobDispatcher.cs
deleted file mode 100644
index e9180a56..00000000
--- a/src/modules/alterations/Elsa.Alterations/Services/BackgroundAlterationJobDispatcher.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Mediator.Contracts;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace Elsa.Alterations.Services;
-
-///
-/// Dispatches an alteration job for execution using an in-memory channel.
-///
-public class BackgroundAlterationJobDispatcher(IJobQueue jobQueue, IServiceScopeFactory scopeFactory) : IAlterationJobDispatcher
-{
- ///
- public ValueTask DispatchAsync(string jobId, CancellationToken cancellationToken = default)
- {
- jobQueue.Enqueue(ct => ExecuteJobAsync(jobId, ct));
- return default;
- }
-
- private async Task ExecuteJobAsync(string alterationJobId, CancellationToken cancellationToken)
- {
- using var scope = scopeFactory.CreateScope();
- var alterationJobRunner = scope.ServiceProvider.GetRequiredService();
- await alterationJobRunner.RunAsync(alterationJobId, cancellationToken);
- }
-}
diff --git a/src/modules/alterations/Elsa.Alterations/Services/DefaultAlterationJobRunner.cs b/src/modules/alterations/Elsa.Alterations/Services/DefaultAlterationJobRunner.cs
deleted file mode 100644
index 020d970a..00000000
--- a/src/modules/alterations/Elsa.Alterations/Services/DefaultAlterationJobRunner.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Entities;
-using Elsa.Alterations.Core.Enums;
-using Elsa.Alterations.Core.Filters;
-using Elsa.Alterations.Core.Notifications;
-using Elsa.Common;
-using Elsa.Mediator.Contracts;
-
-namespace Elsa.Alterations.Services;
-
-///
-public class DefaultAlterationJobRunner : IAlterationJobRunner
-{
- private readonly IAlterationPlanStore _alterationPlanStore;
- private readonly IAlterationJobStore _alterationJobStore;
- private readonly IAlterationRunner _alterationRunner;
- private readonly INotificationSender _notificationSender;
- private readonly ISystemClock _systemClock;
-
- ///
- /// Initializes a new instance of the class.
- ///
- public DefaultAlterationJobRunner(
- IAlterationPlanStore alterationPlanStore,
- IAlterationJobStore alterationJobStore,
- IAlterationRunner alterationRunner,
- INotificationSender notificationSender,
- ISystemClock systemClock)
- {
- _alterationPlanStore = alterationPlanStore;
- _alterationJobStore = alterationJobStore;
- _alterationRunner = alterationRunner;
- _notificationSender = notificationSender;
- _systemClock = systemClock;
- }
-
- ///
- public async Task RunAsync(string jobId, CancellationToken cancellationToken = default)
- {
- var job = (await _alterationJobStore.FindAsync(new AlterationJobFilter { Id = jobId }, cancellationToken))!;
- var plan = (await _alterationPlanStore.FindAsync(new AlterationPlanFilter { Id = job.PlanId }, cancellationToken))!;
- var workflowInstanceId = job.WorkflowInstanceId;
-
- job.Status = AlterationJobStatus.Running;
- job.StartedAt = _systemClock.UtcNow;
- await _alterationJobStore.SaveAsync(job, cancellationToken);
-
- var result = await _alterationRunner.RunAsync(workflowInstanceId, plan.Alterations, cancellationToken);
-
- job.Status = result.IsSuccessful ? AlterationJobStatus.Completed : AlterationJobStatus.Failed;
- job.Log = result.Log.LogEntries.ToList();
- job.CompletedAt = _systemClock.UtcNow;
- await _alterationJobStore.SaveAsync(job, cancellationToken);
- await _notificationSender.SendAsync(new AlterationJobCompleted(job, result.WorkflowHasScheduledWork), cancellationToken);
-
- return job;
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Services/DefaultAlterationPlanScheduler.cs b/src/modules/alterations/Elsa.Alterations/Services/DefaultAlterationPlanScheduler.cs
deleted file mode 100644
index 4ab30f43..00000000
--- a/src/modules/alterations/Elsa.Alterations/Services/DefaultAlterationPlanScheduler.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Models;
-using Elsa.Alterations.Workflows;
-using Elsa.Common;
-using Elsa.Common.Models;
-using Elsa.Workflows;
-using Elsa.Workflows.Management;
-using Elsa.Workflows.Runtime;
-using Elsa.Workflows.Runtime.Contracts;
-using Elsa.Workflows.Runtime.Requests;
-
-namespace Elsa.Alterations.Services;
-
-///
-/// Stores the new plan and schedules it for immediate execution.
-///
-public class DefaultAlterationPlanScheduler : IAlterationPlanScheduler
-{
- private readonly IWorkflowDefinitionService _workflowDefinitionService;
- private readonly IWorkflowDispatcher _workflowDispatcher;
- private readonly IIdentityGenerator _identityGenerator;
- private readonly IJsonSerializer _jsonSerializer;
-
- ///
- /// Initializes a new instance of the class.
- ///
- public DefaultAlterationPlanScheduler(IWorkflowDefinitionService workflowDefinitionService, IWorkflowDispatcher workflowDispatcher, IIdentityGenerator identityGenerator, IJsonSerializer jsonSerializer)
- {
- _workflowDefinitionService = workflowDefinitionService;
- _workflowDispatcher = workflowDispatcher;
- _identityGenerator = identityGenerator;
- _jsonSerializer = jsonSerializer;
- }
-
- ///
- public async Task SubmitAsync(AlterationPlanParams planParams, CancellationToken cancellationToken = default)
- {
- if(string.IsNullOrWhiteSpace(planParams.Id))
- planParams.Id = _identityGenerator.GenerateId();
-
- var definitionId = ExecuteAlterationPlanWorkflow.WorkflowDefinitionId;
- var workflowGraph = await _workflowDefinitionService.FindWorkflowGraphAsync(definitionId, VersionOptions.Published, cancellationToken);
-
- if (workflowGraph == null)
- throw new($"Workflow definition with ID '{definitionId}' not found");
-
- var serializedPlan = _jsonSerializer.Serialize(planParams);
- var request = new DispatchWorkflowDefinitionRequest(workflowGraph.Workflow.Identity.Id)
- {
- Input = new Dictionary
- {
- ["Plan"] = serializedPlan
- }
- };
- await _workflowDispatcher.DispatchAsync(request, cancellationToken);
-
- return planParams.Id;
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Services/DefaultAlterationRunner.cs b/src/modules/alterations/Elsa.Alterations/Services/DefaultAlterationRunner.cs
deleted file mode 100644
index 37ae0e87..00000000
--- a/src/modules/alterations/Elsa.Alterations/Services/DefaultAlterationRunner.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-using Elsa.Alterations.Core.Contracts;
-using Elsa.Alterations.Core.Models;
-using Elsa.Alterations.Core.Results;
-using Elsa.Alterations.Middleware.Workflows;
-using Elsa.Common;
-using Elsa.Workflows;
-using Elsa.Workflows.CommitStates;
-using Elsa.Workflows.Management;
-using Elsa.Workflows.Pipelines.WorkflowExecution;
-using Elsa.Workflows.Runtime;
-using Microsoft.Extensions.Logging;
-
-namespace Elsa.Alterations.Services;
-
-///
-public class DefaultAlterationRunner(
- IWorkflowRuntime workflowRuntime,
- IWorkflowExecutionPipeline workflowExecutionPipeline,
- IWorkflowDefinitionService workflowDefinitionService,
- IWorkflowStateExtractor workflowStateExtractor,
- ICommitStateHandler commitStateHandler,
- ISystemClock systemClock,
- IServiceProvider serviceProvider)
- : IAlterationRunner
-{
- ///
- public async Task> RunAsync(IEnumerable workflowInstanceIds, IEnumerable alterations, CancellationToken cancellationToken = default)
- {
- var results = new List();
- var alterationList = alterations as ICollection ?? alterations.ToList();
-
- foreach (var workflowInstanceId in workflowInstanceIds)
- {
- var result = await RunAsync(workflowInstanceId, alterationList, cancellationToken);
- results.Add(result);
- }
-
- return results;
- }
-
- ///
- public async Task RunAsync(string workflowInstanceId, IEnumerable alterations, CancellationToken cancellationToken = default)
- {
- var log = new AlterationLog(systemClock);
- var result = new RunAlterationsResult(workflowInstanceId, log);
- var workflowClient = await workflowRuntime.CreateClientAsync(workflowInstanceId, cancellationToken: cancellationToken);
-
- // Load workflow instance.
- var workflowState = await workflowClient.ExportStateAsync(cancellationToken);
-
- if (workflowState == null)
- {
- log.Add($"Workflow instance with ID '{workflowInstanceId}' not found.", LogLevel.Error);
- return result;
- }
-
- // Load workflow definition.
- var workflowGraph = await workflowDefinitionService.FindWorkflowGraphAsync(workflowState.DefinitionVersionId, cancellationToken);
-
- if (workflowGraph == null)
- {
- log.Add($"Workflow definition with ID '{workflowState.DefinitionVersionId}' not found.", LogLevel.Error);
- return result;
- }
-
- // Create workflow execution context.
- var workflowExecutionContext = await WorkflowExecutionContext.CreateAsync(serviceProvider, workflowGraph, workflowState, cancellationToken: cancellationToken);
- workflowExecutionContext.TransientProperties.Add(RunAlterationsMiddleware.AlterationsPropertyKey, alterations);
- workflowExecutionContext.TransientProperties.Add(RunAlterationsMiddleware.AlterationsLogPropertyKey, log);
-
- // Build a new workflow execution pipeline.
- var pipelineBuilder = new WorkflowExecutionPipelineBuilder(serviceProvider);
- workflowExecutionPipeline.ConfigurePipelineBuilder(pipelineBuilder);
-
- // Replace the terminal DefaultActivitySchedulerMiddleware with the RunAlterationsMiddleware terminal.
- pipelineBuilder.ReplaceTerminal();
-
- // Build modified pipeline.
- var pipeline = pipelineBuilder.Build();
-
- // Execute the pipeline.
- await pipeline(workflowExecutionContext);
-
- // Extract workflow state.
- workflowState = workflowStateExtractor.Extract(workflowExecutionContext);
-
- // Commit workflow state.
- await commitStateHandler.CommitAsync(workflowExecutionContext, workflowState, cancellationToken);
-
- // Apply updated workflow state.
- // TODO: Importing back into the workflow runtime makes sense, but this also causes another SAVE ction of the workflow instance in the DB, which also happens in the previous step during the commit action.
- // Can we avoid this? Perhaps we need more granular control over when we purge and when we save to DB.
- await workflowClient.ImportStateAsync(workflowState, cancellationToken);
-
- // Check if the workflow has scheduled work.
- result.WorkflowHasScheduledWork = workflowExecutionContext.Scheduler.HasAny;
-
- return result;
- }
-}
\ No newline at end of file
diff --git a/src/modules/alterations/Elsa.Alterations/Workflows/ExecuteAlterationPlanWorkflow.cs b/src/modules/alterations/Elsa.Alterations/Workflows/ExecuteAlterationPlanWorkflow.cs
deleted file mode 100644
index 0994c79e..00000000
--- a/src/modules/alterations/Elsa.Alterations/Workflows/ExecuteAlterationPlanWorkflow.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using Elsa.Alterations.Activities;
-using Elsa.Alterations.Core.Models;
-using Elsa.Extensions;
-using Elsa.Workflows;
-using Elsa.Workflows.Activities;
-
-namespace Elsa.Alterations.Workflows;
-
-///
-/// Executes an alteration plan.
-///
-public class ExecuteAlterationPlanWorkflow : WorkflowBase
-{
- internal const string WorkflowDefinitionId = "Elsa.Alterations.ExecuteAlterationPlan";
-
- ///
- protected override void Build(IWorkflowBuilder builder)
- {
- builder.WithDefinitionId(WorkflowDefinitionId);
- builder.AsSystemWorkflow();
- var plan = builder.WithInput("Plan", "The parameters for the new plan");
- var planId = builder.WithVariable();
- var jobCount = builder.WithVariable();
-
- builder.Root = new Sequence
- {
- Activities =
- {
- new SubmitAlterationPlan
- {
- Params = new(context => context.GetInput(plan)!),
- Result = new(planId)
- },
- new Correlate(planId),
- new GenerateAlterationJobs(planId)
- {
- Result = new(jobCount)
- },
- new If(context => jobCount.Get(context) > 0)
- {
- Then = new DispatchAlterationJobs(planId),
- Else = new CompleteAlterationPlan(planId)
- },
- new AlterationPlanCompleted(planId),
- }
- };
- }
-}
\ No newline at end of file
diff --git a/src/modules/connections/Elsa.Connections.Persistence.EFCore.Sqlite/Elsa.Connections.Persistence.EFCore.Sqlite.csproj b/src/modules/connections/Elsa.Connections.Persistence.EFCore.Sqlite/Elsa.Connections.Persistence.EFCore.Sqlite.csproj
index 4c7ec446..b9912a5c 100644
--- a/src/modules/connections/Elsa.Connections.Persistence.EFCore.Sqlite/Elsa.Connections.Persistence.EFCore.Sqlite.csproj
+++ b/src/modules/connections/Elsa.Connections.Persistence.EFCore.Sqlite/Elsa.Connections.Persistence.EFCore.Sqlite.csproj
@@ -12,8 +12,15 @@
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/modules/connections/Elsa.Connections.Persistence.EFCore/Elsa.Connections.Persistence.EFCore.csproj b/src/modules/connections/Elsa.Connections.Persistence.EFCore/Elsa.Connections.Persistence.EFCore.csproj
index b7bd760e..a9375eb4 100644
--- a/src/modules/connections/Elsa.Connections.Persistence.EFCore/Elsa.Connections.Persistence.EFCore.csproj
+++ b/src/modules/connections/Elsa.Connections.Persistence.EFCore/Elsa.Connections.Persistence.EFCore.csproj
@@ -6,8 +6,15 @@
-
+
+
+
+
+
+
+
+
diff --git a/src/modules/labels/Elsa.Labels/Contracts/ILabelStore.cs b/src/modules/labels/Elsa.Labels/Contracts/ILabelStore.cs
deleted file mode 100644
index 8e731e1b..00000000
--- a/src/modules/labels/Elsa.Labels/Contracts/ILabelStore.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using Elsa.Common.Models;
-using Elsa.Labels.Entities;
-
-namespace Elsa.Labels.Contracts;
-
-public interface ILabelStore
-{
- Task SaveAsync(Label record, CancellationToken cancellationToken = default);
- Task SaveManyAsync(IEnumerable