Commit graph

4944 commits

Author SHA1 Message Date
Sipke Schoorstra 96ba4f4e1c Add feature check and refactor dependencies in Elsa
The commit introduces a new feature check in the `Module` class and refactors the dependencies in MassTransit features. Specifically, it enables querying for a specific feature before configuring the dispatcher endpoints, increasing flexibility and control. In addition, the responsibility for creating `IEndpointChannelFormatter` has been shifted from `MassTransitWorkflowDispatcherFeature` to `MassTransitFeature`, aligning with responsibility distribution.

Fixes #5165
2024-04-01 23:17:17 +02:00
Sipke Schoorstra 298ee70ae2 Add GetOutput method in ActivityExtensions
A new GetOutput method has been added to the ActivityExtensions.cs file. This method allows the retrieval of output with a specific name from an activity. Useful for handling complex types in workflow activities.
2024-04-01 23:17:09 +02:00
Sipke Schoorstra af8c668743 Move DynamicActivity.cs to Activities directory
The DynamicActivity.cs file has been moved from the Models directory to the Activities directory. This reorganization aims to ensure that the file's location correctly reflects its namespace.
2024-04-01 23:17:01 +02:00
Sipke Schoorstra 7c9f9f5d38 Update branch verification in GitHub workflows
This commit modifies the branch verification procedure in the GitHub workflows file. The code now includes a condition that checks if the event is a release that has been published before proceeding with fetching from the main branch. For other cases, the procedure remains the same, with fetching taking place from the referenced branch.
2024-03-29 22:22:33 +01:00
Sipke Schoorstra 69aacd654b
Regenerate V3.1 EF Core migrations with custom runtime schema support (#5155)
* Reset EF Core migrations to 3.0

* Add V3_1 migration altering Status column and SerializableWorkflowInstanceIds

This commit adds a new migration file (V3_1) which alters the 'Status' column in the 'AlterationJobs' and 'AlterationPlans' tables to be of type string instead of int. It also renames the 'SerializedWorkflowInstanceIds' to 'SerializedWorkflowInstanceFilter' in the same tables. This update applies across multiple databases (MySQL, SQL Server, SQLite, PostgreSQL).

* Remove migration command from efcore-3.1.sh script

The Entity Framework Core 3.1 migration command line has been removed from the efcore-3.1.sh script. This modification ensures that migration handling relies solely on the 'ef-migration-runtime-schema' function.
2024-03-29 21:15:23 +01:00
raymonddenhaan 20f0134089
Fixed per instance distributed messaging (#5154)
- Configured MassTransitWorkflowCancellationDispatcher
- Fixed RabbitMQ endpoint configuration
- Fixed consumer configuration when running InMemory
2024-03-29 20:43:39 +01:00
Sipke Schoorstra c3686bf165
Fix flowchart completion after faulted child activity cancellation (#5145)
* Refactor alteration runner logic and simplify CancelActivityHandler

The DefaultAlterationRunner.cs file was refactored to include a workflow middleware pipeline, replacing the previous method of updating workflow state. Comments were added to discuss potential solutions for reusing the same pipeline in the workflow runtime. The CancelActivityHandler was simplified by removing multiple functions and replacing them with a single CancelAsync method.

* Add RunAlterationsMiddleware to handle workflow alterations

The commit introduces a new middleware, RunAlterationsMiddleware, that is designed to process workflow alterations. The middleware is in charge of executing alteration handlers and taking care of any required commit actions. The original code for handling alterations in DefaultAlterationRunner has been significantly reduced as it now delegates most of its responsibility to this new middleware.

* Add comments to IAlterationPlanManager interface methods

In the IAlterationPlanManager interface, explanatory comments were added to each method. These include methods for getting a plan by ID, checking if all jobs in the plan have been completed, and completing an alteration plan. The changes made will greatly aid in understanding the purpose and functionality of each method.

* Refactor pipeline execution methods and replace middleware

The workflow execution pipeline has been refactored to allow for dynamic configuration. The middleware components are now retrievable properties and can be replaced individually. This change provides more extensibility with modifying the pipeline execution and replacing the DefaultActivitySchedulerMiddleware with desired middleware.

* Refactor pipeline alteration and addition methods

Simplified the pipeline alteration process in Elsa.Alterations. Instead of manually handling middleware delegates, added a new extension method, ReplaceTerminal, in WorkflowExecutionMiddlewareExtensions.cs to replace the terminal middleware component. This approach improves code readability and maintenance.

* Refactor RunAlterationsMiddleware class

Removed an unnecessary extension class and updated the RunAlterationsMiddleware class to streamline its structure. The handlers are now initialized directly in the constructor, eliminating the need for an additional field. Renamed local variable for better code clarity.

* Refactor variable name in RunAlterationsMiddleware

The variable name 'handlers1' has been renamed to 'supportedHandlers' in the RunAlterationsMiddleware.cs file. This change improves code readability and makes it clear that the list contains only the handlers that can handle the given alteration.

* Change RunAsync method to return void

The RunAsync function in the RunAlterationsMiddleware class no longer returns a boolean value. The returned 'false' has been replaced with a 'return' statement, and the 'return true' statement has been completely removed. This refactor simplifies the control flow when executing alterations.

* Refactor variable handling and improve flowchart completion

Refactored variable value conversion and update logic in ModifyVariableHandler classes. Removal of some service dependencies simplifies the implementation and reduces coupling. Also streamlined completion process in Flowchart classes, making it more efficient and improving readability.

* Add running status filter to workflow instance finder

A new method was introduced to filter only running workflow instances before applying alterations in the "WorkflowInstanceFinder" service. The change ensures that alterations affect only workflows that are currently running, increasing the effectiveness and accuracy of the system.

* Rename ActivityId to ActivityNodeId in related classes

Modified the name of the 'ActivityId' property to 'ActivityNodeId' across multiple classes including 'ActivityWorkItemState' and 'WorkflowStateExtractor'. This change reflects the usage of NodeId more accurately in the workflow process. The methods 'FindActivityById' across classes were updated accordingly. Also, an attribute '[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]' was added to two methods in 'WorkflowRunner'.

* Refactor code in Flowchart class

Removed unnecessary variable 'flowchartContext' in the 'CompleteIfNoPendingWorkAsync' method of the Flowchart class. The 'context' variable has been used directly for the 'HasPendingWork' check and 'CompleteActivityAsync' call, simplifying the code without altering functionality.

* Update workflow methods with parameterless constructor constraints

This change introduces parameterless constructor constraints on workflow-related methods in Elsa.Workflows.Core. Specifically, both RunAsync and BuildWorkflowAsync methods had their generics constraint updated to require a parameterless constructor. This ensures only workflows with a parameterless constructor can be run or built. Additionally, unused usages of `RequiresUnreferencedCode` attribute were removed from Elsa.Features.
2024-03-29 20:38:09 +01:00
Sipke Schoorstra 0993b38b7a
Fix Alteration Runner (#5142)
* Refactor alteration runner logic and simplify CancelActivityHandler

The DefaultAlterationRunner.cs file was refactored to include a workflow middleware pipeline, replacing the previous method of updating workflow state. Comments were added to discuss potential solutions for reusing the same pipeline in the workflow runtime. The CancelActivityHandler was simplified by removing multiple functions and replacing them with a single CancelAsync method.

* Add RunAlterationsMiddleware to handle workflow alterations

The commit introduces a new middleware, RunAlterationsMiddleware, that is designed to process workflow alterations. The middleware is in charge of executing alteration handlers and taking care of any required commit actions. The original code for handling alterations in DefaultAlterationRunner has been significantly reduced as it now delegates most of its responsibility to this new middleware.

* Add comments to IAlterationPlanManager interface methods

In the IAlterationPlanManager interface, explanatory comments were added to each method. These include methods for getting a plan by ID, checking if all jobs in the plan have been completed, and completing an alteration plan. The changes made will greatly aid in understanding the purpose and functionality of each method.

* Refactor pipeline execution methods and replace middleware

The workflow execution pipeline has been refactored to allow for dynamic configuration. The middleware components are now retrievable properties and can be replaced individually. This change provides more extensibility with modifying the pipeline execution and replacing the DefaultActivitySchedulerMiddleware with desired middleware.

* Refactor pipeline alteration and addition methods

Simplified the pipeline alteration process in Elsa.Alterations. Instead of manually handling middleware delegates, added a new extension method, ReplaceTerminal, in WorkflowExecutionMiddlewareExtensions.cs to replace the terminal middleware component. This approach improves code readability and maintenance.

* Refactor RunAlterationsMiddleware class

Removed an unnecessary extension class and updated the RunAlterationsMiddleware class to streamline its structure. The handlers are now initialized directly in the constructor, eliminating the need for an additional field. Renamed local variable for better code clarity.

* Refactor variable name in RunAlterationsMiddleware

The variable name 'handlers1' has been renamed to 'supportedHandlers' in the RunAlterationsMiddleware.cs file. This change improves code readability and makes it clear that the list contains only the handlers that can handle the given alteration.

* Change RunAsync method to return void

The RunAsync function in the RunAlterationsMiddleware class no longer returns a boolean value. The returned 'false' has been replaced with a 'return' statement, and the 'return true' statement has been completely removed. This refactor simplifies the control flow when executing alterations.
2024-03-29 19:58:35 +01:00
Sipke Schoorstra f0eb19ac22
Make JetBrains.Annotations Private (#5151)
* Format Directory.Packages.props for readability

Indentation was adjusted in the Directory.Packages.props file to enhance readability and maintain a consistent style. No functional changes or impact on package versions were made.

* Update JetBrains.Annotations to private assets

The change in the commit modifies the JetBrains.Annotations package reference in Directory.Build.props to be included as private assets. This adjustment ensures that the JetBrains.Annotations won't be exposed publicly, increasing the security and the overall robustness of the system.

* Added missing references

---------

Co-authored-by: Raymond den Haan <raymond.den.haan@nexxbiz.io>
2024-03-29 19:46:00 +01:00
Sipke Schoorstra a84f33e1b6
Update FlowNode status terminology in BulkDispatchWorkflows (#5150)
* Update FlowNode status terminology in BulkDispatchWorkflows

The terminology for the task completion status has been changed in the BulkDispatchWorkflows class. This includes renaming 'Finished' to 'Complete' in the FlowNode attribute, and when calling CompleteActivityWithOutcomesAsync method. This change makes the status names more consistent across the application.

* Update input description in BulkDispatchWorkflows

The input description for the WaitForCompletion property in the BulkDispatchWorkflows activity has been modified for clarity. The previously mentioned condition about the 'Finished' outcome not triggering has been removed as it was creating confusion.

* Rename 'Finished' instances to 'Completed' instances

The code modifies the keywords related to instance statuses and actions in the Workflow activities, changing the term 'Finished' to 'Completed'. This is a global change, impacting variables, properties, cases, and methods. The update serves to improve the clarity and preciseness of the terms used in the workflow process.

* Add SuppressUnreferencedCode attributes and rename methods

The Elsa.Workflows.Runtime module has been updated to suppress warnings from the new .NET 5.0 UnreferencedCode attribute in two methods. Additionally, the name of the method "CheckIfFinishedAsync" in "BulkDispatchWorkflows.cs" has been renamed to "CheckIfCompletedAsync" for clarity and improved readability.
2024-03-29 09:55:17 +01:00
James Thompson 1b56f5d6a2
#5106 Cleanup packages to leverage framework (#5129) 2024-03-29 09:54:44 +01:00
James Thompson 4f250f4b7b
#5107 Add framework reference & package removal (#5128) 2024-03-28 21:35:47 +01:00
Raymond den Haan 830ed03c13 Converted registry to use concurrent dictionaries 2024-03-28 16:18:47 +01:00
Raymond den Haan b870c1efe6 Added check if workflow exists before cancelling 2024-03-28 16:18:47 +01:00
Sipke Schoorstra b7074e45d2 Refactor BackgroundTaskDispatcher and update lifecycle
Refactored the BackgroundTaskDispatcher class to accept the INotificationSender service directly rather than the IServiceScopeFactory. This change simplifies the dispatch process. Also, adjusted the service lifecycle of RunTaskDispatcher, changing it from singleton to scoped.
2024-03-28 16:05:28 +01:00
raymonddenhaan 673f5dfdbc
Prevented creation of default queues for temporary consumers (#5148) 2024-03-28 15:42:51 +01:00
raymonddenhaan 4b151ff8af
Feature/cancel dispatched workflows (#5136)
* Made cancel API call dispatch the request

* Added ParentWorkflowInstanceId

* Recursively cancel child workflows

* Made single workflow cancellation include child workflows

* Updated migrations

* Processed comments
2024-03-27 12:07:55 +01:00
Sipke Schoorstra b7991fd99d Add ConfigureAwait to FodyWeavers.xml
A ConfigureAwait tag was added to the FodyWeavers.xml file in the Elsa.Server.LoadBalancer bundle. This adjustment will influence how awaitable tasks are resumed in the .NET asynchronous programming model.
2024-03-25 11:00:07 +01:00
Sipke Schoorstra 5214207af6 Update Elsa.Server.LoadBalancer project settings and Elsa.sln
The Elsa.Server.LoadBalancer project settings have been updated to support multiple target frameworks (net7.0 and net8.0), with Linux defined as the default target OS for Docker. Additionally, the build.sh file reference has been added to the Elsa.sln solution.
2024-03-25 10:54:27 +01:00
Sipke Schoorstra 3aa6c7dbe5 Update Elsa.Server.LoadBalancer project settings
Two new properties have been introduced in the Elsa.Server.LoadBalancer project file. These include setting the 'IsPackable' attribute to 'false', preventing the project from being packaged and setting the 'LangVersion' to 'latest', to use the latest available version of C#.
2024-03-25 09:21:31 +01:00
raymonddenhaan 9d3f685bb6
Implemented distributed cache refresh for workflow definitions (#5095)
* Moved handler to correct namespace

* Added version deletion messages to activity registry handler

* Add MassTransit support for workflow management

* Moved logic from Workflow.Management.MassTransit project into Elsa.MassTransit project

* Added notifier to MT project for creating distributed messages

* Rename and update workflow consumer class

Renamed `WorkflowDefinitionConsumer` to `WorkflowDefinitionEventsConsumer` to better reflect its purpose. Updated references accordingly in the `MassTransitWorkflowManagementFeature` class to align with the new name.

* Shortened instance (queue) names

* Remove unnecessary comment in handler definition

An unnecessary comment mark ("/") was removed in the definition of the DistributedWorkflowDefinitionNotificationsHandler class. This change contributes to code cleanup and increases code readability.

* Add additional destinations in LoadBalancer settings

Three new destinations have been added to the LoadBalancer settings in Elsa Server. These are primarily intended to provide broader network coverage and improve overall server performance.

* Add MassTransit support in Elsa.Server

A new using directive for Elsa.MassTransit.Extensions has been included at the start of the script. In addition, under certain conditions, the system now uses the MassTransit Dispatcher in the workflow management system. These changes provide support for using MassTransit in the Elsa.Server component.

* Add MassTransitBroker enum for MassTransit setup

A new enum called MassTransitBroker has been added to represent different types of messaging brokers used in MassTransit. This has also been integrated into the Web project's Program.cs file to allow conditional usage of brokers in the MassTransit setup, enabling more flexible and dynamic configuration.

* Refactor WorkflowManagementFeature class

The WorkflowManagementFeature class has been cleaned up and its formatting has been corrected. A blank line was removed, a line break was added for readability in the AddVariableType method, and several stray spaces were also removed.

* Refactor RefreshActivityRegistryHandler.cs

This commit removes unnecessary whitespace and improves the code readability in RefreshActivityRegistryHandler.cs. The changes include deletion of extra lines and adjustment of indentation.

---------

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2024-03-24 21:09:51 +01:00
Sipke Schoorstra 83dd776233 Add new docker-compose files, new activities and services
Create new docker-compose files for non-data dog and data dog services. New services include Postgres, cockroachdb, rabbitmq, redis, and elsa-server. Along with the services, a new bash script for migration and various new activities and endpoints are also added for the Elsa server. This set of changes broadens the operational environment of Elsa.
2024-03-24 20:28:19 +01:00
Sipke Schoorstra a720688bfd Add LoadBalancer bundle to Elsa.Server
This commit introduces a new bundle for load balancing into the Elsa.Server solution. It includes initial configuration files, launch settings, and reverse proxy setup. The load balancer is configured with a RoundRobin policy and the project references the Yarp.ReverseProxy package.
2024-03-24 20:27:38 +01:00
Sipke Schoorstra baeeedc650
Add logging to ScheduledCronTask constructor and setup (#5122)
The ScheduledCronTask now receives an ILogger instance and handles exceptions during timer setup by logging the error. Additionally, a constructor overload with the logger parameter has been added, and a new TrySetupTimer method encapsulates the timer setup with error handling.
2024-03-21 19:46:52 +01:00
Sipke Schoorstra d11754324e
Add DryRun endpoint and workflow instance finder (#5110)
* Add DryRun endpoint and workflow instance finder

Added a new DryRun endpoint for executing alteration plans and implemented the IWorkflowInstanceFinder interface to search for workflow instances. Refactored existing code to use new workflow instance finder service, resulting in cleaner activity implementation.

* Fix empty check in WorkflowInstanceFinder

Change the conditional logic to use `IsEmpty` method on filters rather than checking if the collection `workflowInstanceIds` is empty. This ensures that matching workflow instances are correctly identified when no specific filters are set.

* Refactor WorkflowInstanceFinder with WorkflowStatus default

The WorkflowInstanceFinder service has been refactored to include a default workflow status of Running and to utilize a new method WorkflowFilterIsEmpty, which checks if the workflow instance filter is empty. This improves code readability and encapsulates the logic for determining an empty filter.
2024-03-21 08:22:11 +01:00
Sipke Schoorstra e67a6fe752
Add log message sanitization for PostgreSQL (#5104)
* Fix callback clearing in workflow execution

The method ClearCompletionCallbacks in the ActivityExecutionContext was modifying the collection during enumeration, which can lead to issues. Converting to a List before removal ensures safe modification without side effects.

* Add log message sanitization for PostgreSQL

The new LogStringExtensions class provides methods to sanitize log messages, ensuring that null characters are replaced with "\0". These changes prevent issues with PostgreSQL's inability to store null characters in strings, improving log data compatibility with the database.

* Rename and update log extension class

Refactor LogStringExtensions to LogExtensions and update summary comment for clarity. This change emphasizes the broader application of the extension methods beyond string manipulation, focusing on sanitizing log messages.
2024-03-20 19:29:12 +01:00
Sipke Schoorstra 8079dd0de1
Add alteration notifications and management (#5097)
* Add alteration notifications and management

Implement notification publishing for completed alteration plans and add related handlers and management logic to coordinate alterations workflow triggering and completion status updates.

* Refactor queue address configuration in MassTransit

The initialization of the queue address and mapping for the `RunAlterationJob` has been moved out of the `Apply` method to the module configuration.

* Refactor CompleteAlterationPlan activity description

The activity summary comment in CompleteAlterationPlan.cs was updated to accurately describe its functionality. The description has been changed from "Submits an alteration plan for execution" to "Marks an alteration plan as completed."
2024-03-20 10:58:59 +01:00
MariusVuscanNx 05fd1440c1
Test workflows housekeeping (#5092)
* Updated WorkflowStorageDriver namespace reference

* Updated UI hint name
2024-03-19 13:51:18 +01:00
Sipke Schoorstra 67cd1f3709
Fix ID assignment logic in Scheduler (#5094)
Refactor the ID generation for Alteration Plans to ensure the `planParams.Id` is always set directly before creating a DispatchWorkflowDefinitionRequest. This avoids the unnecessary extra variable and ensures the ID property is consistently used throughout the method.

Fixes 5093
2024-03-19 13:46:47 +01:00
Sipke Schoorstra 3140b72e15 Add Postgres support to Elsa.Server.Web
Introduced support for PostgreSQL in the Elsa Server configuration and updated the docker-compose to reflect the new database option. Adjusted the dependencies to include the EntityFrameworkCore PostgreSQL project reference.
2024-03-19 11:38:51 +01:00
nuvotex-tk 47d4d20606
Add configuration value accessor in JintJavaScriptEvaluator (#5024)
close #4825
2024-03-18 23:20:12 +01:00
Pietervo e7766ce189
Update VersionOptions.cs (#5053)
When setting the VersionOptions with the TryParse function to LatestAndPublished, it sets IsLatestOrPublished to true instead of IsLatestAndPublished.
2024-03-18 23:18:15 +01:00
Dave Elbro a4a05dcbf9
Update MongoDb collection service retrieval (#5083)
The previous implementation used the generic MongoCollectionBase service to retrieve workflow definition and instance collections. Now, the code has been updated to use IMongoCollection specifically designed for WorkflowDefinition and WorkflowInstance. This change ensures better typing and possibly performance improvements.
2024-03-18 23:15:24 +01:00
Raymond den Haan c1d0e7a0a2 Made loading workflows more robust 2024-03-14 16:08:30 +01:00
Sipke Schoorstra b8cb2caf78 Refactor workflow and update EF Core config
Removed unnecessary namespace in OrderBatchProcessor workflow and set a descriptive name for the workflow sequence. Updated the EF Core configuration in Program.cs to use SQLite with a specified connection string and ensure Order types are accessible in CSharp expressions.
2024-03-14 10:00:06 +01:00
Sipke Schoorstra a0cda3830c Add DecimalJsonConverter and update usage
Introduce a new DecimalJsonConverter class and refactor serialization setup. Renamed IntegerConverter to IntegerJsonConverter and updated its implementation to handle both number and string JSON tokens. Adjusted serializer options in ConfigurableSerializer and ObjectExpressionHandler accordingly.
2024-03-14 09:59:22 +01:00
Sipke Schoorstra 0b0e26a327 Add DisplayName attribute to BulkDispatch
Enhanced the clarity of the input field by adding a `DisplayName` attribute in the `BulkDispatchWorkflows` activity. This better describes the purpose of the input field for workflow definition selection.
2024-03-14 09:29:12 +01:00
Sipke Schoorstra ffd9ae7cc2 Fix log message parameter name
Corrected the parameter token in the error log message to match the expected variable name, ensuring accurate logging when attempting to create duplicate workflows. This helps in diagnosing the root cause of issue #5033 more efficiently.
2024-03-13 20:45:44 +01:00
Sipke Schoorstra bb4a764eb8 Revert "Prevented overwriting of existing workflows (#5067)"
This reverts commit 2dcaab9bf8.
2024-03-13 20:43:34 +01:00
Sipke Schoorstra 20d936d3c2
Alterations with Queries (#5032)
* Remove Elsa.Alteration Handlers and implement workflow alteration activities

The Elsa.Alterations.Handlers, Services, and Endpoints have been removed and replaced with Elsa.Alterations.Activities for various steps in executing an alteration plan. These activities include submitting an alteration plan, generating alteration jobs, and dispatching alteration jobs. New models for ActivityFilter, AlterationWorkflowInstanceFilter, and alteration activity summaries are also introduced for better management of alteration plans.

* Add 'PrintMessage' custom activity and update naming rules

A new 'PrintMessage' activity has been added to the custom activities of the ConsoleApp, which simply writes a 'Hello world!' message. On top of this, the naming rules in the code styling settings have been expanded, introducing separate rules for instance and static private fields.

* Remove V3_1 database migration files

The V3_1 database migration files were deleted across all database providers, including MySql, SQL Server, SQLite and PostgreSQL. This is indicative of a rollback or significant revision to the data migration strategy.

* Update product version and modify tables in Elsa DB context

Updated "Elsa" DbSet product version from "7.0.11" to "7.0.14". Additionally, added new properties as well as modified existing ones in tables like "Elsa.KeyValues.Entities.SerializedKeyValuePair" to improve data structure. Also properly ignored certain entities in the Alterations DbContext.

* Add V3_1 migration for Elsa

This commit introduces the V3_1 migration for the Elsa module. Changes involve the introduction of new tables and alteration of existing tables. Specifically, a new 'KeyValuePairs' table was added and several columns on various tables were renamed or altered.

* Remove multiple Elsa.EfCore V3_1 migration files

The commit removes several migration files related to the V3_1 migration in multiple Elsa.EntityFrameworkCore modules including SqlServer, PostgreSQL, and SQLite. These files encompass changes in table structures and alterations.

* Update default value for ArgumentDefinition Type

The default value for the `Type` property in the `ArgumentDefinition` class was updated to `typeof(object)`. The `Type` property of `inputDefinition` in the `WorkflowBuilder` class was also modified to be set as `typeof(T)`. These modifications enable more flexible type handling.

* Refactor SafeSerializer and serialization services

The SafeSerializer service and related serialization services have been comprehensively refactored. This includes the removal of internal notifications, the incorporation of [RequiresUnreferencedCode] attributes, and changes in method signatures. Methods have been simplified to return ValueTasks directly from the JsonSerializer, and the notification sender dependency was removed.

* Add JSON serialization for alterations

Implemented a JSON serializer and a custom converter for the IAlteration interface in the Elsa.Alterations.Core.Serialization namespace. Also, introduced a new IJsonSerializer interface and an implementation for standard JSON serialization in Elsa.Common. These serialization changes enhance modularity and extensibility of JSON operations, and improve handling of IAlteration objects.

* Add "IsSystem" field to Workflow Definitions and Instances

This update introduces a new boolean field "IsSystem" to the Workflow Definition and Workflow Instance models. This field is designed to identify system workflows which aren't meant to be modified by users. Management and Runtime module code, API endpoints, database migrations, and related classes have been updated to include this new field. The MongoDB indices and Dapper migrations have been updated as well, and serialization/deserialization processes for these types have been modified to handle this new attribute.

* Remove outdated database migrations

Deleted database migration files from the MySql, SqlServer, and PostgreSql projects.

* Add V3_1 migration for Elsa.EntityFrameworkCore.Sqlite

This commit introduces the V3_1 migration for the Elsa.EntityFrameworkCore.Sqlite module. It includes changes in Alterations, Runtime, Management, and Identity contexts. These changes involve table alterations, addition of new columns, and creation of new tables. Each context alteration encapsulates relevant changes for specific functionalities of the module.

* Add `IsSystem` property to workflow classes

The `IsSystem` property has been added to several sections of the codebase related to workflows, such as `WorkflowStateMapper.cs`, `ListWorkflowDefinitionsRequest.cs`, `WorkflowDefinitionStore.cs`, and `ListWorkflowInstancesRequest.cs`. This property flag allows us to include or filter system workflows in our queries and results.

* Add 'UsedImplicitly' attribute to Alteration Handlers and Types

The 'UsedImplicitly' attribute from JetBrains.Annotations has been added to all Alteration Handlers and Alteration Types in the Elsa.Alterations module. This change specifies that these classes are being used implicitly and helps tools like ReSharper prevent false unused code detection.

* Update migration script for efcore-3.1

The migration script efcore-3.1.sh has been updated. Module "Alterations" and provider "Sqlite" are added back into the lists while unused elements are removed for cleanup. The script now covers all necessary modules and providers, improving its overall effectiveness.

* Remove PrintMessage class from Elsa.Server.Web bundle

This commit deletes the PrintMessage.cs file that was previously part of the Elsa.Server.Web bundle.

* Refactor MassTransit service configuration

This commit reduces line code length by merging splitted long lines into one, improves maintainability of code. It also updates the Service configuration and removes unused namespaces across files, which help to simplify the codebase. Changes have also been made to switch the MassTransit broker from RabbitMq to memory and adjust the endpoint name formatter configuration.

* Remove extra whitespace in Program.cs

Removed a trailing whitespace on the line declaring the useSqlServer constant in the Program.cs file. No functionality changes were made, simply a minor formatting correction to maintain clean and consistent code.

* Remove AlterationJsonConverter and update other files

The AlterationJsonConverter class has been removed, simplifying the serialization process. The AlterationSerializer.cs file was updated with additional attribute tags, giving more information about serialization expectations. Lastly, the AlterationSerializationOptionConfigurator.cs was simplified by removing unnecessary overrides and the Elsa.Alterations.Core.csproj file was tidied up by removing unused services folder reference.

* Refactor code for improved readability and maintainability

The diff shows changes across multiple files in multiple modules. Primarily, these changes revolve around formatting edits such as removing unnecessary spaces or line breaks and adjusting alignments. A significant change was also made to the MySQL server version in the `DbContextOptionsBuilder.cs` file. These adjustments help improve the readability and maintainability of the code, making it easier to understand and modify in future iterations.

* Remove unnecessary notification files and refactor code

Several files pertaining to workflow serialization notifications were deemed unnecessary and removed. The Endpoint class in the `Elsa.Workflows.Api` module has been refactored for efficient usage of the `IWorkflowDefinitionStore` store, and similarly the `HttpFeature.cs` and `DesignTimeDbContextFactoryBase.cs` files have been slightly refactored for better readability and optimization.

* Refactor HttpFeature class on variable types order

The variable types order within the HttpFeature class in the Elsa Http module has been reorganized for cleaner code. No functional changes have been made - only the order of the types has been rearranged. This refactoring contributes to better readability and code maintenance.

* Add 'issue/*' branch to GitHub workflow triggers

This update includes 'issue/*' branches in the trigger configuration of GitHub workflows. Now, these branches will trigger specified GitHub actions, facilitating more effective issue tracking and resolution.

* Change version option in WorkflowDefinitionManager

The version option in the WorkflowDefinitionManager has been updated. Previously it was set to "LatestAndPublished", but this has been changed to "LatestOrPublished", adjusting the way the manager handles workflow versions.

* Update GitHub Actions to remove duplicate branch pattern

Removed the duplicated 'issue/*' entry from the branch trigger list in packages.yml to prevent redundancy in GitHub Actions workflow triggers. This ensures workflows are triggered correctly and efficiently for branch patterns intended for CI processes.

* Refactor job generation in GenerateAlterationJobs

Refactored the GenerateAlterationJobs activity to enhance code readability and maintainability. Broke down the ExecuteAsync method into smaller, purpose-specific private methods and added the missing `Elsa.Alterations.Core.Models` namespace.

* Refactor consumer concatenation logic in MassTransitFeature

Removed the commented-out code that filtered temporary queues, simplifying the concatenation of consumer types with workflow message consumers.

* Refactor whitespace and improve readability

Removed extraneous whitespaces and reformatted the `IsEmpty` property for better code readability. This enhances the code structure without affecting functionality.

* Refactor MassTransitFeature configuration

Moved transport configuration logic into the dedicated `ConfigureInMemoryTransport` method and removed unused usings to simplify the `MassTransitFeature` class setup. This streamlines setting up MassTransit in-memory transport and improves code maintainability.

---------

Co-authored-by: Raymond den Haan <raymond.den.haan@nexxbiz.io>
Co-authored-by: Marius Vasile Vușcan <marius.vuscan@nexxbiz.io>
2024-03-13 20:34:46 +01:00
Sipke Schoorstra 03beb39cff Merge branch 'issue/5068' 2024-03-13 20:00:59 +01:00
Sipke Schoorstra e0a20c2dfc Add logging to OrderBatchProcessor workflow
Added a sequence with WriteLine activity to log processing of each order. Also, ensured the activity execution context properly sets its Tag property when a completion callback is provided.
2024-03-13 19:59:56 +01:00
Sipke Schoorstra c4543848ae
Refactor workflow instance listing and enum parsing (#5069)
Refactor the endpoint for listing workflow instances to use a more robust enum parsing method and improve validation. Update models to accept string collections for statuses and sub-statuses, which enables validating and parsing these enums directly within the endpoint.
2024-03-13 19:00:44 +01:00
Sipke Schoorstra 15518ba6db Refactor workflow instance listing and enum parsing
Refactor the endpoint for listing workflow instances to use a more robust enum parsing method and improve validation. Update models to accept string collections for statuses and sub-statuses, which enables validating and parsing these enums directly within the endpoint.
2024-03-13 18:59:05 +01:00
Sipke Schoorstra cad90e4e4e Remove FetchProducts activity and model
The FetchProducts.cs and Product.cs files have been removed as they are no longer needed. Additionally, changes in the OrderBatchProcessor.cs and FetchOrders.cs reflect updates to order fetching logic to accommodate these removals.
2024-03-13 12:07:39 +01:00
Sipke Schoorstra ee89b30e13 Add variable type management methods
Extended ModuleExtensions with methods for adding variable types, including with an alias, to aid in workflow variable management and organization. These new methods allow module users to register custom variable types easily and associate them with a category or alias.
2024-03-13 12:05:01 +01:00
raymonddenhaan 2dcaab9bf8
Prevented overwriting of existing workflows (#5067) 2024-03-13 10:05:50 +01:00
raymonddenhaan 395790d4d0
Added missing text parser for HTTP responses (#5066) 2024-03-13 09:48:18 +01:00
Sipke Schoorstra f7b010a518
Add Unicode string serialization tests (#5064)
Added tests in `Elsa.Workflows.Core.UnitTests` and `Elsa.JavaScript.UnitTests` to ensure unicode string serialization works correctly. Added a shared `UnicodeRangeGenerator` for test data generation and updated project references accordingly. Renamed `WorkflowDefinitionActivityJavaScriptHandlerTests.cs` to `ToJsonTests.cs` to reflect the focused test purpose.
2024-03-12 19:31:39 +01:00
zergmk2 cef0cceef0
Enhance: Add isStart property to determine if current node is a start node. (#5040) 2024-03-12 18:08:38 +01:00