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.
The 'input' parameter in 'PublishAsync', 'DispatchAsync' and related methods across multiple classes has been replaced with 'payload'. The renaming of 'input' to 'payload' provides a more intuitive understanding of the parameter as the actual content or data of the event being published or dispatched. It also includes changes in 'PublishInternalAsync' where the workflow input dictionary is now being populated with the payload.
The script source paths in both "Elsa.Studio.Web" and "Elsa.ServerAndStudio.Web" _Host.cshtml files have been modified to use the defined base path. This change is necessary for correctly loading the "blazor.webassembly.js" script from the appropriate directory.
This update adds a comprehensive guide to the README file detailing the steps for interested individuals to contribute to the Elsa Workflow project. The guide covers everything from forking and cloning the repository, to understanding the structure of the solution, submitting changes via a pull request, and the importance of opening an issue first for discussing intended changes.
Converted the result of the Select() operation to a list, within the BuildContainsExpression method. This prevents multiple enumerations of the 'entities' variable, improving the performance of the method by reducing the number of iterations.
This commit introduces a new integration test for the "DependencyWorkflowsPublishing" scenario. It also adds two new JSON files, "child.json" and "parent.json" to simulate the child and parent workflows accordingly. Updates are also made to the 'Elsa.IntegrationTests.csproj' and 'ServiceProviderExtensions.cs' as a part of testing setup.
This update modifies how WorkflowDefinitionManager fetches and handles workflow definitions. It now considers both the latest and published workflow definitions rather than only the published ones. It also removes the dependency id from the list of workflows to consider. A redundant workflow validator from the WorkflowDefinitionPublisher is also removed.
The code change deletes the line where the messageInput is added to the Inputs list of the builder in the `Workflows.cs` file, since this operation is redundant. The input is automatically added during its creation and doesn't need an explicit addition, thus improving code efficiency.
Implemented new integration tests for serialization of programmatic workflows. Additionally, major refactoring was performed on the serialization classes. This involved moving the classes to new namespaces and enhancing their functionalities to correctly handle null inputs and to support the serialization of activities and expressions. Also, updated Elsa.sln.DotSettings and JsonActivitySerializer to handle new serializers.
* Remove unused using directives in test classes
The using directives for System, System.Collections.Generic, System.IO, and others were not necessary in many of the test classes. These unused directives have been removed to enhance code readability and maintainability.
* Update source port retrieval in ConnectionJsonConverter
The source port retrieval code in ConnectionJsonConverter.cs has been updated. It now uses TryGetProperty instead of GetProperty, enabling it to handle cases where the "port" property may not exist. This enhances error handling and resilience in the activities module.
* Refactor InputJsonConverter for proper variable expressions handling
The InputJsonConverter in the Elsa.Workflows.Serialization has been expanded for efficient handling of variable expressions during the JSON conversion process. The refactor ensures appropriate extraction and assignment of values to variables. This adds robustness to the serialization process, maintaining variable types after serialization.
* Add tests for variable expressions serialization
A new `Tests.cs` file has been added under the `Elsa.IntegrationTests/Serialization/VariableExpressions` directory. This file contains tests for ensuring the serialization of variable expressions works correctly. A corresponding `SampleWorkflow` file has also been established, providing the workflows to be used in the tests.
* Refactor workflow builder extension class
The WorkflowDefinitionBuilderExtensions class has been deleted and replaced with WorkflowBuilderExtensions in Elsa.Workflows.Core. This new class retains similar functionality but includes more detailed comments and dynamic member access capabilities in its method definition.
Updated the WorkflowBuilder and its interface, IWorkflowBuilder, to include a series of fluent methods for handling inputs. These methods allow easier set up and addition of input definitions to workflows. An extension method to get input names was also added to the ExpressionExecutionContextExtensions.
The methods in the workflow runtime now accept nullable runtime options. Providing workflow options is now optional - if no options are provided, default values are used. Changes have been applied across all relevant methods in IWorkflowRuntime, ProtoActorWorkflowRuntime and DefaultWorkflowRuntime classes, thus ensuring consistent behavior and null safety across the workflow runtime.
Removed ICompressionStrategyResolver interface and file, and added ICompressionCodec and ICompressionCodecResolver interface. Updated relevant classes for the new interface. Specifically, added Zstd class under Compression as a new compression method. Also modified WorkflowInstanceStore.cs, None.cs, EFCoreWorkflowInstanceStore.cs, GZip.cs, and ActivityExecutionLogStore.cs for uniform compression terminology.
The typo in the Obsolete attribute message of the ActivityState field has been corrected. "USe" has been changed to "Use" in the suggestion to use ActivityInstanceId instead to locate activity state from ActivityExecutionLog.