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>
Removed references to multiple packages that are not used within the project and some (Microsoft.AspNetCore.X) packages were deprecated and should not be used.
The code previously had the MassTransitBroker set to AzureServiceBus. This commit changes it to use in-memory MassTransitBroker. An "Memory" enumeration value is also added in the MassTransitBroker enumeration.
* Add DispatchWorkflowOptions and update MassTransit configuration
Introduced a new class `DispatchWorkflowOptions` to provide workflow dispatch options. Updated MassTransit configuration to include NET6.0 and NET7.0 support, and ensure correct MassTransit version usage per target framework version.
* Add support for configurable MassTransit message dispatching
Implemented a feature which allows for configurable MassTransit message dispatching. Added support for specifying channels and message brokers. Message dispatching code was massively refactored and relevant endpoints and response models were updated to support new message dispatching features.
* Add IEndpointChannelFormatter interface and implementation
An interface for formatting channel queue names, 'IEndpointChannelFormatter', has been added, along with its default implementation 'DefaultEndpointChannelFormatter'. The code that uses hardcoded queue name formatting has been modified to use the new formatter instead, making it more configurable and reusable. The implementation of the formatter uses the 'Humanizer' library to kebab-case the channel names.
* Add channel dispatch option to workflow activities
Introduced `WorkflowDispatcherChannelOptionsProvider` to provide dropdown channel options for workflow dispatch-related activities. Updated `DispatchWorkflow` and `BulkDispatchWorkflows` activities to include a new dropdown input for specifying a dispatch channel. Also, included the selected channel name in the `DispatchWorkflowOptions` during workflow dispatching process.
* Update MassTransit configurations and remove unused code
The MassTransit setup in Elsa.MassTransit module has been simplified by removing conditional code for different .NET versions. Additionally, unused parameter '__X_Channel' in 'DispatchWorkflowDefinition' was removed. Lastly, the MassTransit broker in Elsa.Server.Web was switched from RabbitMq to AzureServiceBus.
* Refactor dispatch workflow classes and methods
Simplified the class, method and variable names related to workflow dispatching in the Elsa.Workflows.Runtime module. For example, the 'WorkflowDispatcherChannelDescriptor' class was renamed to 'DispatcherChannel'. This refactoring was performed to make code more readable and maintainable by removing redundant wording in the naming convention.
* Update GitHub Workflow to support feature and issue branches
The workflow changes add support for feature and issue branches. Now, it extracts the branch name and verifies the commit exists in the given branch rather than just 'main'. The versioning scheme is also modified to include the branch name and not just the run number.
* Add 'bug/*' to triggering branches in packages workflow
The 'bug/*' pattern was missing from the triggers that initiate the GitHub actions within our packages workflow. This update includes any branch with a 'bug/' prefix to the list, allowing bug-related branches to start jobs in our CI/CD pipeline.
* Remove 'issue/*' and 'bug/*' branches from packages workflow
The 'issue/*' and 'bug/*' branches have been removed from the GitHub action workflow for packages. This change was made to simplify the workflow and optimize the triggering of package building.
* Update GitHub workflow to handle main branch versioning
This commit modifies the GitHub workflow script to accommodate changes when the branch name is "main." If the branch name is "main", a preview version is used. It also updates script execution to print the branch name for easier debugging and verifies commit existence on the correct branch instead of dispatch channels.
* Enclose branch names in quotes in packages.yml
The update modifies the branch names in the packages.yml GitHub Actions workflow file. The change consists of enclosing the branch names 'main' and 'feature/*' in single quotes, ensuring compatibility and preventing potential string interpretation issues.
* Update GitHub workflows package configuration
The workflows package configuration has been updated to specifically watch for changes on 'feature/dispatch-channels' rather than on all feature branches. This change will prevent unnecessary builds on less relevant feature branches.
* Update trigger branches in packages workflow
The triggering branches in the packages workflow have been updated. Previously, only changes in the 'main' and 'feature/dispatch-channels' would trigger the workflow, now any 'feature/*' branch will. This will cause more frequent and comprehensive testing.
* Add 'patch/*' to workflow trigger branches
This update adds 'patch/*' to the list of branches in .github/workflows/packages.yml that can trigger the workflow. It will allow the workflow to be initiated not just for main and feature branches, but also for patches.
* Add 'preview/*' to workflow triggers
This commit adds a new trigger for the GitHub Actions workflow. It now also responds to push events on 'preview/*' branches, allowing for automated testing and building of these preview branches.
* Update branch name extraction in GitHub Actions
The extraction of the branch name has been slightly modified in the packages.yml GitHub workflow file. This alteration ensures the correct branch name is obtained for further processing within the workflow without any discrepancy.
* Update branch name extraction in packages.yml
Corrected the syntax for extracting the branch name within the packages.yml github workflow file. Added an extra line to print out the ref which might be useful for debugging.
* Update branch name extraction in GitHub workflow
The commit simplifies the way the branch name is being extracted from the GitHub ref in the packages.yml workflow file. The new method employs straightforward string manipulation, making it easier to understand and debug in case of potential issues.
* Add extraction of branch name in workflow
Added a new line in the GitHub workflow file (.github/workflows/packages.yml) to extract the last part after the final slash from the branch name. This enhancement allows cleaner naming conventions, especially in cases where branches are named feature/issue-123, as it will only retain 'issue-123'.
* Update package naming in Github workflow
The Github workflow has been updated to handle package naming more effectively. Previously, the branch name was used directly for package versioning. Now, the last part of the branch name is extracted and used as the package prefix. If the branch name is "main", the package prefix is set to "preview".
* Move and add environment variable assignments
The placement of the assignment for BRANCH_NAME environment variable was moved for better readability. Additionally, the PACKAGE_PREFIX environment variable was also added. These environment variables are crucial for subsequent steps in the GitHub workflow.
* Add workflow dispatch validation and response handling
Removed several specific dispatch response classes and consolidated all types of dispatch responses into a single DispatchWorkflowResponse class. Added a new ValidatingWorkflowDispatcher service to validate dispatch requests before they're sent. Updated several classes to work with these changes, including the BackgroundWorkflowDispatcher, MassTransitWorkflowDispatcher, and the API endpoint class.
* Handle dispatch workflow failures with exceptions
The DispatchWorkflow and BulkDispatchWorkflows activities now throw a FaultException when the dispatch operations fail. Previously, these operations were not checking for success and could fail silently. Now, an unsuccessful dispatch response results in a FaultException with an error message from the dispatch response.
The updates in this commit refine the way branch names and package prefixes are determined in the GitHub workflow for package building. Moreover, the workflow now recognizes and supports additional branch patterns, including 'patch/*' and 'preview/*', extending the existing support for 'main' and 'feature/*' branches.
The commit message updates the branch names in the packages.yml GitHub workflows file by enclosing them in single quotes. The change is done on both 'main' and 'feature/*' branches.
This update modifies the GitHub packages workflow. 'issue/*' and 'bug/*' branches were removed from the workflow trigger, and branch name handling logic updated. Now, if the branch name is 'main', the version is labeled as 'preview'. Otherwise, the branch name is used.
This update modifies the GitHub workflow in packages.yml for improved branch name extraction and more accurate commit verification. It provides more feedback by outputting the extracted branch name, and checks for commits in the specific branch rather than in 'origin/dispatch-channels'.
Expanded GitHub action to now trigger on push events for feature/*, issue/*, and bug/* branches. The workflow has been modified to fetch the name of the current working branch, check if the commit exists on that branch, and append it to version number. This will effectively allow isolated workflows for each specific branch.
Added 'From' and 'From<T>' methods to the 'OutputProxy' class, which retrieve the value of a specified output from a certain activity. The pre-existing 'Get' methods, serving a similar function, have been marked as obsolete and updated to use the new 'From' methods.
A new Postgres service has been added to the docker-compose file, with its respective environmental variables and volume. This service uses postgres:13.3-alpine image and is accessible via the port 5432.
Modified `ActivityOutputRegister.cs` to utilize `LastOrDefault` instead of `FirstOrDefault` for retrieving the latest output by activityId or activityInstanceId. Now, in `ActivityExtensions.cs`, it differentiates between the output retrieval method based on whether the current activity context is identical to the requested one.
The GetOutput method was extracted from the execution contexts to ensure more precise and isolated functionality. It was simplified and redefined in three contexts which are: the ActivityExecutionContext, the WorkflowExecutionContext, and the ExpressionExecutionContext. This will enhance maintainability and readability of the code.
Refined the expression serialization context and its deserialization method for more extensive usage. Also, simplified the handling of value retrieval in the DefaultExpressionDescriptorProvider. This allows greater control over serialization processes and makes the code more concise.
The version number was removed from the Elsa.Environments.csproj file. This was unnecessary because the version number is now handled elsewhere, reducing redundancy and maintenance.
The change was made in the DefaultExpressionDescriptorProvider.cs under Elsa.Workflows.Management. Instead of relying on the GetString method, the updated code now uses the ToString method for default value retrieval. This change improves how we process and retrieve default values in unspecified cases.
* Improve Elsa workflow expression serialization
Added serialization support for expressions in Elsa workflows, enabling serialization and deserialization to maintain consistent types across sessions. Updated relevant test cases for validation.
* Remove PR workflow from GitHub actions
The PR workflow has been removed from GitHub actions.
The JSON data file used in the integration tests for serialization polymorphism has been updated. Specifically, the namespace for CustomDictionary in the type metadata section has been changed to match with its current location.
* issues(4918): fix resolve scoped service for Elsa.MongoDb.Modules
issues(4918): scope service by instance CreateIndices
* issues(4918): fix review, service scope as local var to be cleany disposed
---------
Co-authored-by: BEN AMEUR <Bechir.BEN-AMEUR.ext@sodexo.com>
* Improve InputJsonConverter handling and trimming suppression
A new switch case block has been added for better handling of different types of JsonValueKind in InputJsonConverter. Also, a suppression message for the IL2026 trimming warning has been included to prevent potential runtime issues caused by code trimming, although justifications for this suppression are still pending.
* Add UIHint to While activity's Condition input
The Condition input in the While activity in Elsa.Workflows.Core has been updated to also include a UIHint. This aims to improve user input by specifically defining it as a SingleLine type.
* Rename Elsa.IntegrationTests to Elsa.Workflows.IntegrationTests
* Include missed files
* Update WorkflowExecutionContext to assign Activities
This commit updates the constructor of WorkflowExecutionContext. It adds a loop that iterates through each activityExecutionContext and associates its Activity with a corresponding one in the NodeIdLookup by using its NodeId as the key.
* Add versionOptions parameter to RunWorkflowUntilEndAsync method
This update introduces the versionOptions parameter to the RunWorkflowUntilEndAsync method, giving the user control over the version of the workflow they want to run. If no options are provided, the method defaults to running the published version.
* Add new integration tests and workflow samples
Created new integration test projects, Elsa.Alterations.IntegrationTests and Elsa.Workflows.IntegrationTests, for added functionality verification. Also added new workflow sample files "alteration-test.json" and "alteration-test.-v2.json" to "samples/aspnet/ElsaAlterationMigrateBug/Workflows" for testing purposes.
* Remove ElsaAlterationMigrateBug sample
This commit removes the ElsaAlterationMigrateBug sample from the project. The sample is no longer needed and its related files including workflows and project references have been deleted from the solution. This removal helps streamline the solution and remove unnecessary clutter.
* Update comment in MigrationTests.cs
The comments in the MigrationTests.cs file have been revised to provide a more accurate description of what happens in the code. The migration process described does not involve resetting execution, so any reference to it was removed.
* Refactor MigrationTests class summary description
The summary description of the MigrationTests class has been revised. The verb 'Represents' was removed to make the comment more concise and straightforward, focusing solely on its functional aspect.
* Update MigrationTests class constructor comments
The summary comments for the MigrationTests class constructor were corrected. Previously, it indicated that it represented a class containing tests for migration, which was inaccurate. It now properly describes that it initializes a new instance of the MigrationTests class.