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.
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.
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.
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.
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.
Introduced improved encoding by setting the JavaScriptEncoder to unicode ranges and added necessary using directives. Additionally, the Serialize method is now appropriately marked to indicate its use of code that requires unreferenced code during linking, following best practices for code that may be subject to trimming in a .NET environment.
The update enriches the serializers with Unicode encoding to handle a wider range of characters. Classes such as ConfigurableSerializer, ObjectConverter, and JsonContentFactory have been modified to use JavaScriptEncoder with UnicodeRanges.All, supporting serialization and deserialization of all Unicode characters. Furthermore, any unreferenced code now carries a note for JSON serializer stating that it's incompatible with .NET's trimming feature.
The commit adds a more comprehensive handling of different JsonValueKind values in DefaultExpressionDescriptorProvider.cs. Now `JsonValueKind.Undefined`, `JsonValueKind.Null`, `JsonValueKind.Object`, and `JsonValueKind.Array` are specifically addressed, improving the reliability of JSON manipulation within Elsa workflows.
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.
* Refactor search filtering and move ListWorkflowDefinitionsRequest file
Updated the searching mechanism in `WorkflowDefinitionFilter.cs` by validating that Name and Description are not null before performing the search. In `ListWorkflowDefinitionsRequest.cs`, the file was moved from the Responses namespace to Requests and a new property `SearchTerm` was added, allowing filtering of workflow definitions by their name, ID or description.
* Update code style settings for csproj
The .DotSettings file for the project has been adjusted with changes to code naming rules and settings migration. These modifications adjust policies for naming conventions of Instance and Static fields, enhancing code style conformance. Also, an additional settings migration rule has been applied.
* Add 'issue/*' branch to GitHub actions workflow
The GitHub actions workflow has been updated to include the 'issue/*' branch. This ensures that any changes made in the 'issue/*' branches will trigger the workflow and any associated tests or builds, improving the overall continuous integration process.
* Remove Skip and Take methods from SqlServerDialect
The mentioned functions have been removed from SqlServerDialect class in the Elsa.Dapper module. The base class provides the correct default implementation for the SQL Server dialect.
List,Delete, and Revert endpoints for editing endpoints by version were set to allow anonymous, meaning no authorisation policies were applied.
I have changed these to apply permissions as per the rest of the API.
* Modify error handling in Workflow middleware
The handling for workflow faults in the Workflow Middleware has been altered. Previously, the code was checking if the workflow state status was designated as 'Faulted'. Now it checks if there are any incidents or problems in the workflow state, which provides a more comprehensive fault check.
* Prevent deletion of all records with empty conditions
Added checks in the 'Delete' and 'PagedDelete' methods in the 'Store.cs' file to prevent the deletion of all records if the conditions are empty. This will protect the system from unintentional data loss by stopping the execution of these methods when they have no parameters.
The changes involve turning off the use of Dapper in Elsa.Server.Web project for database operations. In addition, the `EFCore.BulkExtensions.MIT` has been added in the Elsa.EntityFrameworkCore.Common project as a package reference. The BulkUpsertAsync function has been refactored to utilize the BulkInsertOrUpdateAsync function provided by the BulkExtensions package, streamlining the operation. The related package versions have also been introduced in the Directory.Packages.props file.
The AzureServiceBusFeature and RabbitMqServiceBusFeature in the Elsa.MassTransit module now have an added dependency on the InstanceManagementFeature. This change ensures the proper sequencing of feature initialization, enabling improved management of instances.
* Update Dapper for better support and pagination
The update includes a significant enhancement to the Dapper module. Improvements were made to support SQL Server and enhanced SQL query pagination. Additionally, table column size was increased for various fields to handle more extensive data. Minor refactoring was also done to improve code readability.
* Toggle SQL Server usage in Elsa Server
The previous setting had SQL Server usage in Elsa server enabled by default. This commit changes the useSqlServer constant in Elsa.Server.Web to false, effectively switching SQL Server off unless manually activated.
The Dapper usage flag has been set to true in the Elsa.Server.Web program. Additionally, in the Dapper feature, the DbConnectionProvider is now registered as a singleton instead of scoped, reflecting changes in the database connection strategy.
The changes made in the code comments out the sections where Azure ServiceBus and RabbitMQ were previously set up for the Elsa Server. This likely disables the respective services until the necessary configurations are uncommented or modified in the future.
The Docker commands in README.md have been updated to pull the latest version of elsa-server-and-studio container instead of elsa-v3. Additionally, a new environment variable `HTTP__BASEURL` was added to the `docker run` command for configuration purposes.
This commit ensures uniqueness within the 'ActivityTypes' and 'VariableDescriptors' collections in the WorkflowManagementFeature. 'ActivityTypes' has been updated to only add distinct activity types, and 'VariableDescriptors' has been refined to only add descriptors with unique 'Type' properties.
New RequiresUnreferencedCode attributes have been added to the Configure() methods in IFeature.cs and FeatureBase.cs. These attributes indicate that the assembly containing the specified marker type will be scanned for activity types.
Expanded the primitive data types representations by adding int and float types in WorkflowManagementFeature. Removed the unused System.IO.Compression import to improve code cleanliness and maintainability.
Closes#4971
* Added example for a programatic MassTransit triggered workflow (#4968)
* Fixed MassTransitActivities example to include the MassTransitDispatcher (#4968)
The code now uses IWorkflowSerializer instead of IActivitySerializer for deserialization in the Console application. This change also entailed updating imports, specifically replacing Elsa.Workflows.Activities with Elsa.Workflows.Management.Contracts.
* Fixed issue where updated and finished date where not set when cancelling a workflow
* Single instance cancellation
* Updated bulk cancellation to allow multiple options
* Fixed counting of bulk cancellation
* Added proto actor implementation for batch cancellation
* Moved bulk cancellation method to separate service
---------
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
* Implement distributed lock for registry population
Added distributed lock in 'PopulateRegistriesHostedService' to prevent concurrent registry updates. Also implemented a semaphore in 'DefaultWorkflowDefinitionStorePopulator' to control access to shared resources during add or update operations. This change helps to ensure the integrity and consistency of the workflow registries.
* Refactor dependency injection for IDistributedLockProvider
* Refactor option classes to parameter classes in workflow runtime
This refactoring enhances the clarity of the Elsa Workflow runtime by renaming "options" classes to "parameters" classes. The name "options" misrepresented the classes' role and created confusion, as they are used to parameterize method calls rather than to configure services. The change applies to various workflow methods and tests across the project.
The GitHub Actions configuration has been updated to also trigger on Push events and Workflow Dispatch events. OnPushBranches and OnPullRequestBranches now also include branches prefixed with 'feature', 'patch', 'fix', and 'enhancement'. This is reflected in both the Build.CI.GitHubActions.cs file and the packages.yml GitHub workflow.
A new middleware, SimulatedLatencyMiddleware, has been added to simulate latency in a designated range. This can be used for testing purposes by delaying a request for a random amount of time. Additionally, an extension method for IApplicationBuilder has been implemented to conveniently add this functionality to the application's pipeline.
Major refactoring done across several files in the src/modules directory. This includes simplifying complex sections of code, removing extraneous comments, and improving the clarity of existing comments. In addition, method names and certain variable names were updated to more accurately reflect their function.
The names for properties related to instance heartbeats have been refactored, providing clearer semantics. 'InstanceHeartbeatRhythm' changed to 'Interval', and 'HeartbeatTimeoutPeriod' to 'Timeout'. This change impacts the property name in the HeartbeatOptions class and anywhere else it is referenced, including the appsettings.json file.
* Add timestamp filtering for workflow instances
Implemented a new feature in the workflow instances' querying API, enabling filtering based on timestamps. The changes include adding a new TimestampFilter class and modifying existing classes accordingly. This new filter supports various operators such as greater than and less than, providing flexibility in filtering workflow instances.
* Improve timestamp filtering efficiency and update UI in WorkflowInstanceList
Timestamp filtering within WorkflowInstanceList is refactored using System.Linq.Dynamic.Core for more compact expression. This change results in simpler and more efficient code, reducing repetitive code lines. The UI updates include changing the MudGrid structure to table for timestamp filters display, offering a more organized view. Also, protection against null or minimum date values during parsing and comparisons is added, increasing stability and safety of operations.
* Refactor HTTP verbs and routes configuration in Endpoint.cs
The previous Get and Post method calls for handling '/workflow-instances' have been replaced with a Verbs method for HTTP verbs and a Routes method for setting the route.
* Update WorkflowInstanceFilter to use nullable HasIncidents
The HasIncidents property in WorkflowInstanceFilter has been updated from a bool to a nullable bool so that it can represent three states (true, false, or null) instead of only two. This allows not only to filter workflow instances that have incidents, but also those that don't have any, enhancing the flexibility of the filter in the process.
* Improve search functionality and UI in WorkflowInstanceList
Updated search term comparison in WorkflowInstanceFilter to use "Contains" instead of "Equals" to improve search flexibility. Also, enhanced the user interface in WorkflowInstanceList by adding debounce interval for the search input for performance reasons and by adding a Close button for convenience.
* Add input validation to WorkflowInstances endpoint
The code modifies the API endpoint for WorkflowInstances. It now checks that the input provided in the request is valid before proceeding. Furthermore, a new file called 'RequiredMembers.cs' has been added, which introduces two new attributes 'RequiredMemberAttribute' and 'CompilerFeatureRequiredAttribute'.
* Update src/modules/Elsa.Workflows.Management/Models/TimestampFilter.cs
Co-authored-by: Béchir BEN AMEUR <32399944+bbenameur@users.noreply.github.com>
* Update src/modules/Elsa.Workflows.Management/Models/TimestampFilter.cs
Co-authored-by: Béchir BEN AMEUR <32399944+bbenameur@users.noreply.github.com>
* Update src/modules/Elsa.Workflows.Management/Models/TimestampFilter.cs
Co-authored-by: Béchir BEN AMEUR <32399944+bbenameur@users.noreply.github.com>
---------
Co-authored-by: Béchir BEN AMEUR <32399944+bbenameur@users.noreply.github.com>