Changed 'init' to 'set' in ActivityDescriptor properties to enable modification after initialization. Added new GitHub Actions workflow file (pr.yml) to the solution.
Changed the grep pattern from 'main' to 'origin/patch/3.2.x' in the release workflow. This ensures the script correctly identifies the relevant branch during the release process.
Switched the MassTransit broker configuration from RabbitMQ to in-memory. This change aims to simplify local development and testing by using an easier-to-configure broker.
* Refactor workflow definition events handling and dispatch
Removed IDistributedWorkflowDefinitionEventsDispatcher interface and related classes in favor of direct message publishing through MassTransit. Introduced new workflow definition refresh endpoints and services for better modularity and responsiveness. Adjusted caching and notification systems to support the new architecture.
* Add comment
* Added workflow definition refresh component test
* Fixed component tests issue
* Fixed id
* Fixed test
* Rename IsRaisedFromConsumer to IsConsumerExecutionContext
Updated the naming for clarity and consistency across the system. This change affects AmbientConsumerScope, related consumers, and condition checks to improve readability and understanding of the consumer context.
---------
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
Changed comment to enhance readability and clarity. The modification adds the article "a" to the description, providing a better understanding of the workflow execution context creation process.
Updated the RunAsync method in WorkflowRunner to consolidate its parameters onto a single line for improved readability and simplicity. This change does not affect the functionality but enhances code maintainability.
Ensure strict nullability checks by using the null-forgiving operator in IsInitialized. Additionally, rewrite comments for conciseness and clarity to enhance readability and understanding.
Introduced an interface `IWorkflowExecutionLogSink` for storing workflow execution log records and implemented it as `StoreWorkflowExecutionLogSink`. This centralizes and streamlines the handling of persisting execution logs into the workflow's runtime, thus making the process more modular and maintainable. The `PersistWorkflowExecutionLogMiddleware` has also been refactored to use this sink, replacing the direct usage of the workflow execution log store.
* Update serialization and conversion functions
Updated JSON conversion to be able to use type aliases when saving serialized data to the DB.
* Simplify and update type alias registration.
Removed redundant XML comments and replaced IDictionary type aliases with Dictionary equivalents for consistency. These changes improve code readability and maintainability.
* Use collection initializer syntax
* Change "_type" values to "ObjectDictionary" in test files
Updated the "_type" field in various JSON test files from multiple different values to a unified "ObjectDictionary". This ensures consistency across the test files and aligns with the expected type format.
---------
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
* Add workflow ancestor retrieval endpoint
Implemented an API endpoint to retrieve ancestor nodes of a specified child node within a workflow definition. This includes creating models and updating relevant interfaces to support the new functionality.
* Refactor workflow graph processing logic
Refactor to check `workflowGraph.Root` for null and streamline ancestor traversal logic. Ensure segments are processed correctly even when no ancestors are present, enhancing code readability and reliability.
* Fix node lookup error and stack segment order in endpoint
Added a safeguard to handle unknown node IDs by returning an error message. Replaced the segments list with a stack to ensure correct order and adjusted the logic for processing and responding with node ancestors.
* Fix workflow definition container null reference issue
Refactored the container assignment logic to handle cases where no leaf segment is found, ensuring it defaults to `childNode` if ancestors are empty. Additionally, added a TODO comment in DiagramDesignerWrapper.razor.cs for loading activity nodes if not already loaded.
* Refactor segment retrieval logic in Endpoint.cs
Replaced the use of `FirstOrDefault()` with `LastOrDefault()` to correctly identify the leaf segment. This change ensures that the container is set based on the last segment in the sequence, aligning with the intended logic.
* Add support for excluding activity types in filters
Introduced properties to exclude specific activity types in workflow execution log filters. Updated respective APIs and database extensions to utilize these new filtering capabilities, ensuring refined and more customized query operations.
* Refactor comments and add missing annotations
Updated various comments to be more precise and added `[UsedImplicitly]` annotation to `ActivityPathSegment` in `Elsa.Api.Client.Shared.Models`. Also, removed unnecessary folder reference in the `Elsa.Workflows.Api.csproj` file. These changes enhance clarity and maintain consistency across the codebase.
* Refactor workflow type checks and add ActivityExtensions.
Replaced string type checks with type comparisons for Workflow and Flowchart activities. Introduced an extension method in the newly created ActivityExtensions class to streamline flowchart type validation.
* Remove ActivityExtensions and update workflow comments
Deleted ActivityExtensions.cs as it was no longer needed. Updated comments in Models.cs and ActivityPathSegment.cs for clarity and accuracy.
* Refactor activity serialization process
Refactored the activity serialization process in Elsa workflow API. The changes include addition, modification and deletion of code blocks across various files to accommodate the restructuring. The changes focus primarily on the handling of composite root activities and their serialization. The utility of configuration options for serializer is also implemented.
* Stash
* Add IgnoreChildActivitiesConverter and improve activity JSON conversion
A new JSON converter, IgnoreChildActivitiesConverter, has been introduced to handle specific serialization scenarios. On top of this, improvements have been made to the existing ActivityJsonConverter. This includes more robust handling of synthetic properties and the ability to ignore child activities during serialization. In DiagramDesignerWrapper, an addition has been made to facilitate the handling of embedded activities.
* "Implement activity port tracking in workflow system"
Modified several components of the workflow system to include activity port tracking for better visibility and control over workflow structures. In addition, unnecessary files were deleted, new ones were introduced, and changes were made to existing files to incorporate the new functionality. Notably, IActivityResolver interface now includes GetActivityPortsAsync method to allow retrieving activity ports. This enhances the ability to track actions in complex workflows.
* Add specialized converter check in activity serialization
The commit introduces a check for specialized JSON converters in two serialization methods inside `ActivityJsonConverter.cs` and `ActivityNodeConverter.cs`. If a specialized converter exists for a particular activity type, the serializer now uses it to serialize the activity, enhancing the serialization process's flexibility.
* Ignore serialization of ConfigureSerializerOptions
Added JsonIgnore attribute to the ConfigureSerializerOptions in the ActivityDescriptor class. This will prevent it from being included during the JSON serialization process, ensuring that it is not unnecessarily processed or exposed in serialized data formats.
* Refactor method to find WorkflowDefinition instead of WorkflowGraph
The method FindWorkflowGraphAsync was revised to find WorkflowDefinition rather than WorkflowGraph, reflecting its new purpose in the code. This change has also affected the related variables and logic where this function was called. The rationale for this revision is that the WorkflowGraph is a dynamic entity that should be computed at runtime, and hence cannot be reliably retrieved for static inspection.
* Update API endpoint and simplify request handling in workflow
The API endpoint for fetching workflow definitions graph has been changed from "/workflow-definitions/{definitionId}/graph" to "/workflow-definitions/subgraph/{id}". Similarly, the request handling has been simplified by removing version options and directly passing "Id" to the "FindWorkflowGraphAsync" method.
* Update import statements and remove unused dependencies
Some import/using statements have been adjusted to remove the 'Contracts' suffix in contexts where it's not necessary. A few unused dependencies have also been removed. These changes clean up the code and ensure proper functionality in the Elsa workflows system.
* Update .editorconfig settings
The .editorconfig settings have been revised to enforce inheritance of settings from higher directories. Additionally, the parameter 'file_header_template' has been removed. This update optimizes the configuration settings for better coding standards across C# files.
* Remove App_Data folder from Elsa.Server.Web.csproj
The App_Data folder reference has been removed from the Elsa.Server.Web project file. This change is included as the folder no longer seems necessary for the operation of the project.
* Remove unused namespace in ServiceProviderExtensions.cs
The Elsa.Workflows.Runtime.Options namespace, previously imported in the ServiceProviderExtensions file within the Elsa.Testing.Shared project, has been removed as it is not utilized. This cleanup enhances readability and maintains cleaner code.
* Implement GetActivityPortsAsync method in various classes
Added the implementation of GetActivityPortsAsync method in WorkplaceDefinitionActivityPortResolver, SendHttpRequestActivityPortResolver, OutboundActivityPortResolver, and SwitchActivityPortResolver classes. Changes also include adding inheritdoc comments for these methods, making GetActivityPortsInternal method private and static, and removing unneeded white spaces.
* Remove GetActivitiesAsync method from activity resolvers
The GetActivitiesAsync method has been removed from various activity resolver classes including WorkflowDefinitionActivityPortResolver, SendHttpRequestActivityPortResolver, OutboundActivityPortResolver, and SwitchActivityPortResolver. The corresponding interface IActivityResolver has also been updated to reflect this change. This simplifies the structure by focusing only on the activity ports.
* Simplify workflow definition serialization
Removed the cloning of serializer options and the exclusion of composite activities from being serialized in the workflow definition model. This simplification results in cleaner code with less redundancy and unnecessary operations.
* Refactor workflow definition endpoints, optimize response handling
Major refactor of workflow definition endpoints in the Elsa.Workflows.Api module. Unnecessary serialization processes have been removed. Response handling was also streamlined to use the SendOkAsync method, optimizing resource usage and increasing application performance. Commit also includes removal of some unused namespaces.
* Remove IncludeCompositeRoot property from Models
The IncludeCompositeRoot property has been removed from the Models in the GetByDefinitionId, GetById, and GetManyById endpoints. These changes simplify the code as the property was commented out and not used in current workflow logic.
* Simplify workflow definition publishing process
This commit simplifies the workflow definition publishing process in the Elsa.Workflows.Api module. The code associated with checking if a workflow definition is already published and publishing it if not has been reduced for increased readability and maintainability.
* Refactor code in workflow publish endpoint
Removed unused import for better code clarity and simplified variable declaration for publishing result. The refactoring is carried out to improve code readability and maintainability in the workflow definition publishing endpoint.
* Refactor ActivityPort in Elsa.Workflows module
This commit simplifies the code in the ActivityPort class, part of the Elsa.Workflows module. It includes a significant rework of the comments for better clarity and understanding. Effort has been made to make the code more readable and easier to maintain in this refactor.
* Refactor serialization methods and improve Synthetic Properties handling
This commit refactors the activity serialization methods and improves the handling of synthetic properties. The changes remove the IgnoreChildActivitiesConverter and move synthetic property writing to a separate helper class, SyntheticPropertiesWriter. Various refinements have been made to different converter classes to better handle activity serialization. Furthermore, a function's name was improved from "FindWorkflowGraphAsync" to "GetWorkflowDefinitionAsync" to more accurately reflects its purpose.
* Add ActivityWriter to help serialize workflow activities
This commit introduces a new class ActivityWriter, that handles the serialization of workflow activities to JSON. Other classes such as ActivityNodeConverter and ActivityJsonConverter have been refactored to utilize this new helper. The codebase is now more DRY, avoids duplicate code and increases code maintainability.
* Refactor Json serialization for ignoring specialized converters
Removed 'IActivityRegistry' from 'JsonIgnoreCompositeRootConverter'. Instead, added an 'ignoreSpecializedConverters' argument to the 'WriteActivity' method in 'ActivityWriter'. This adjustment facilitates managing specialized converter behavior more efficiently during JSON serialization.
* Update ActivityNode serialization description
The comments for the ActivityNodeConverter class have been modified to clarify the serialization process. It now explicitly states that it includes descendant nodes based on the specified depth rather than just immediate child nodes. The parameter 'depth' description has been updated to 'the number of levels of descendants to include'.
* Refine workflow serializer and update activity writer parameters
The WorkflowSerializer clone operation has been simplified to directly call GetOptions from the API Serializer. Furthermore, an unnecessary comment was removed. In the ActivityWriter, an additional parameter was introduced for controlling whether to ignore the availability of converters that can handle IActivity objects. A superfluous front slash was removed from the class description comment.
* Add WorkflowJsonStructureTests and related JSON files
This commit introduces the WorkflowJsonStructureTests class which includes tests for the structure of the workflow definition in JSON format. In addition, main.json and sub.json files, containing mock data for testing, were added to the `WorkflowJsonStructures` scenario within the Elsa Workflows Component Tests. Updates to the project file ensure these new files are included correctly.
* Update WorkflowJsonStructureTests with subgraph test
This commit introduces a new test case named 'Requesting_Subgraph_Returns_ExpectedSubgraph' in the WorkflowJsonStructureTests file. It also refactors 'Workflow_ContainingWorkflowActivity_ShouldNotIncludeChildrenOfWorkflowActivity' test to make use of constants for IDs. These changes increase the coverage and maintainability of the code.
* Update max line length in .editorconfig
This commit increases the max line length to 420 characters in the .editorconfig. Additionally, it removes the redundant 'resharper_csharp_max_line_length' setting.
* Replace ActivityNodeConverter with RootActivityNodeConverter
The commit involves a change in serialization strategy for ActivityNode in the Elsa Workflows modules. The ActivityNodeConverter has been replaced with a RootActivityNodeConverter, which changes the approach from serializing the ActivityNode type and its descendants based on specified depth to serializing the ActivityNode type without its children, with activity children now serialized as properties. Corresponding alterations have also been made in the test cases.
* Remove IActivityRegistry parameter from classes
The IActivityRegistry parameter was removed from WorkflowDefinitionActivityProvider and JsonIgnoreCompositeRootConverterFactory classes, simplifying their constructors. This change also affected Elsa.Workflows.ComponentTests where the node access through "root" was adjusted for these updates.
This update enhances the handling of workflow definition retraction across multiple files and includes new notifications for workflow definition version retraction. The logic for updating the workflow definition registry has been adapted to keep published workflows in the registry unless they are no longer marked as an activity.
The default MassTransitBroker value in Elsa.Server.Web/Program.cs has been modified. It used to be set as RabbitMq, but it was changed to Memory to adjust to new project requirements.
* Implement automated cleanup for Azure Service Bus subscriptions
An automated cleanup process has been added for subscriptions that do not have queues connected to Azure Service Bus. This new feature deletes orphaned topics and cleans up other remnants within the namespace.
* Removed string interpolation from log message.
* Update Program.cs
Use Memory transport to ensure docker image for demo purposes functions correctly.
* Update AzureServiceBusFeature.cs
* Update CleanupSubscriptions.cs
* Refactor notifications to commands in MassTransit module
Replaced the usage of notifications with commands in the Elsa.MassTransit.AzureServiceBus module. This included changing notification handler to command handler in methods and updating services to use the new command handlers.
---------
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
The Jint package was downgraded from version "4.0.0-preview-644" to "3.1.3". The preview source of Jint from 'myget.org' in NuGet.Config was also removed since it's not needed with the stable version now in use.
* Add HTTP file download activity and supporting classes
This commit adds a new activity, DownloadHttpFile, which provides the capability to download a file from a specified URL. It introduces supporting classes like HttpFile, FileHttpContentParser, and several extensions methods related to handling HTTP headers and file content. It also contains necessary updates in existing classes to accommodate the new file-download feature.
* Add response stream to context in DownloadHttpFile
In DownloadHttpFile.cs, context data now includes response content's file stream. Changes to DefaultDownloadableManager.cs simplify the return statement when no provider is found, directly returning an empty array.
* Add byte array converter and enhance HTTP file download
A new ByteArrayConverter class has been added to Elsa.JavaScript that converts byte arrays to Uint8Arrays. In Elsa.Http, the DownloadHttpFile activity now also stores the downloaded file's content in bytes. In addition, various new type aliases have been added to the Elsa.Http and Elsa.JavaScript modules, making it easier to handle non-string responses and the transfer of data.
* Update Elsa.Studio package versions
The package versions for Elsa.Studio, Elsa.Studio.Core.BlazorWasm, and Elsa.Studio.Login.BlazorWasm have been updated from 3.2.0-preview.346 to 3.2.0
* Update Jint version and adjust configuration
Updated the Jint package version to 4.0.0-preview-644. Also, added the Jint Preview package source in the NuGet configuration. Furthermore, made a change to use ArrayBuffer instead of Uint8Array in ByteArrayConverter.cs to align with the updated Jint version.
Added a new enum, DistributedCachingTransport, to handle different distributed caching transport options. Made relevant project reference changes in Elsa.ServerAndStudio.Web.csproj file. Updated references in Program.cs to reflect these changes.
* Flowchart variables are not serialized by FlowchartJsonConverter
* Added unit tests to ensure that serialized/deserialized container is equivalent to original, and fixed issues found
---------
Co-authored-by: Bob Hauser <rhauser@kinaxis.com>
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
Removed unused imports in JavaScript evaluator and instantiated ObjectWrapper using static Create method. This simplifies the object instantiation process. Additionally, updated the mediator reference and activated the useCaching feature on the Elsa server to optimize performance.
A new ByteArrayConverter class has been added to Elsa.JavaScript that converts byte arrays to Uint8Arrays. In Elsa.Http, the DownloadHttpFile activity now also stores the downloaded file's content in bytes. In addition, various new type aliases have been added to the Elsa.Http and Elsa.JavaScript modules, making it easier to handle non-string responses and the transfer of data.
In DownloadHttpFile.cs, context data now includes response content's file stream. Changes to DefaultDownloadableManager.cs simplify the return statement when no provider is found, directly returning an empty array.
This commit adds a new activity, DownloadHttpFile, which provides the capability to download a file from a specified URL. It introduces supporting classes like HttpFile, FileHttpContentParser, and several extensions methods related to handling HTTP headers and file content. It also contains necessary updates in existing classes to accommodate the new file-download feature.