Commit graph

460 commits

Author SHA1 Message Date
Sipke Schoorstra 13d7e91e0d
Remove agent-related configurations and dependencies.
This commit removes the "Agents" configuration section, related API keys, services, and persistence logic across the codebase. Unused agent-related NuGet packages and code references were also eliminated to simplify the project and focus on core functionality.
2025-03-02 16:08:51 +01:00
Sipke Schoorstra 74a1c50f66
Remove Agents projects
Deleted Agents projects. These projects are being migrated to elsa-integrations.
2025-03-02 15:55:29 +01:00
Sipke Schoorstra 43157fb6d6
Remove Azure Service Bus integration and related tests
Deleted the entire Azure Service Bus module, including activities, configurations, tests, and supporting code. This removal eliminates features like message handling workflows, queue/topic providers, and unit testing utilities for Azure Service Bus.
2025-02-23 23:43:15 +01:00
Bob Hauser 4e76a32e4e Update flowchart activity scheduling, implicit join (and FlowJoin/WaitAll) now only waits for followed connections 2025-02-12 23:27:40 -05:00
Sipke Schoorstra 71c0a5396e Add "Item 3" to looping workflow test scenarios.
Extended test data in `LoopingWorkflow` to include a third item, "Item 3". Updated assertions in `Tests.cs` to validate the new expected output for the additional item.
2025-01-30 23:29:46 +01:00
Sipke Schoorstra e54e116977 Fix activity output
Updated `ActivityOutputRegister` to always return the last output value. Added new integration test to validate the functionality.
2025-01-30 22:56:30 +01:00
Sipke Schoorstra 0560d11432 Improve JSON array conversion in ObjectConverter
Refactored ObjectConverter to handle JSON array conversions more robustly, including support for arrays of complex types. Added a `Person` class for unit testing and updated tests to validate the new functionality. Included necessary project reference updates to ensure proper functionality.
2025-01-29 10:50:42 +01:00
Sipke Schoorstra cc694bf15b Use var for local variables in test cases
Updated all instances of explicitly typed `string` and `JsonElement` to `var` in `JsonElementConverterTests.cs` to improve code readability and maintain consistency with modern C# coding practices. This change does not affect functionality but aligns with better style conventions.
2025-01-14 23:19:51 +01:00
Sipke Schoorstra efd114944c Refactor and enhance JavaScript and object conversions.
Replaced InputProxy with alternative implementations, adding flexibility to handle inputs. Introduced a JsonElementConverter to deepen JavaScript and JSON element integration. Enhanced testing and object conversion logic, improving type handling and support for complex JSON scenarios.
2025-01-14 23:16:29 +01:00
Sipke Schoorstra b2331f73db Handle collection and array serialization in TypeJsonConverter
Refactored TypeJsonConverter to distinguish and properly handle serialization of arrays and generic collections. Updated integration tests to include cases for round-tripping primitive arrays and collections for improved coverage.
2025-01-11 20:23:05 +01:00
sergergood 3e76e3efb0 Added example of perfomance test 2024-12-27 18:57:22 +03:00
Sipke Schoorstra 0992404d96 Add integration test for workflow serialization
Introduce a new integration test to verify workflow serialization functionality, ensuring that newly created workflow definitions can be serialized and deserialized correctly. Adjust default nullability for certain fields in `WorkflowDefinition` to improve consistency and prevent null reference issues. Minor argument update in `New` method of `WorkflowDefinitionPublisher`.
2024-12-26 11:17:54 +01:00
Mathijs Dumon c25ef53dcc Fix for #6082 - dropdowns are not populated for inputs without UIHints 2024-12-16 16:15:58 +01:00
Sipke Schoorstra 4770c21604 Refactor DispatchWorkflows tests and skip flaky test.
Removed unused workflow event handlers and simplified signal usage. Marked the flaky `DispatchAndWaitWorkflow_ShouldWaitForChildWorkflowToComplete` test for review and fixing. This improves maintainability and prepares for future test stability work.
2024-12-14 20:30:27 +01:00
Sipke Schoorstra b99c0c8412 Disable flaky test in BulkDispatchWorkflowsTests.
Commented out a test that was marked as flaky and skipped. This ensures the test suite remains reliable while the issue is addressed in the future.
2024-12-14 20:01:11 +01:00
Sipke Schoorstra bd9e006900 Skip flaky BulkDispatchWorkflows test temporarily
The test 'DispatchAndWaitWorkflow_ShouldWaitForChildWorkflowToComplete' was marked as flaky and skipped to prevent instability in the suite. It should be revisited and fixed to ensure reliable execution.
2024-12-14 19:40:44 +01:00
Sipke Schoorstra cb6a7dfc11 Update RabbitMQ image to version 4-management
Upgraded RabbitMQ from version 3-management to 4-management across tests and the Docker setup. This ensures compatibility with the latest features and improvements in RabbitMQ while maintaining consistency across environments.
2024-12-14 11:44:52 +01:00
Sipke Schoorstra 4793c6eac5 Refactor ProtoActor and workflow testing logic
Reorganized ProtoActor configuration to be conditionally applied based on runtime settings. Updated test workflows to simplify signal handling and improved test structure by introducing scoped dependencies and removing unused event subscriptions.
2024-12-14 09:59:29 +01:00
Sipke Schoorstra 9d00466ef3
Merge pull request #6157 from Suchiman/fixPrimitiveSerialization
Fix Primitive Collection serialization
2024-12-11 08:59:02 +01:00
Robin Sue 4d6b7a17fb Add .NET 9.0 target 2024-12-10 21:06:42 +01:00
Sipke Schoorstra 75cb3a3de2
Add synthetic properties to JS engine for exclusion (#6178)
* Add synthetic properties to JS engine for exclusion

This fixes an issue where inputs would be declared as new variables, causing a "miss" when trying to read the input.

* Add InputOutput workflows and tests for data exchange

Introduce new Consumer and Provider JSON workflows to facilitate testing of input and output functionalities, ensuring seamless data exchange between processes. Implement corresponding tests to verify the correct reception and transmission of input data within the Provider workflow back to the Consumer, validating the setup with an assertion for expected output. Update the project configuration to include these workflows in the build output.
2024-12-05 09:30:31 +01:00
Robin Sue c4a6ce2796 Fix Primitive Collection serialization
This was broken by both #5871 and #5682:
1. When a List<Guid> was serialized, it was recognized as a primitive collection and thus plainly written to the JSON without any type information: ["d4d8404c-4357-47ff-a343-649a116539f5"]
2. When this JSON was deserialized, due to lack of type info, it was deserialized as List<object>, containing strings. This is already not good.
3. When this List<object> gets serialized again (e.g. due to multiple workflow suspends causing WorkflowState serialization), this time it fails the primitive collection recognition, because object is not a primitive type. It now gets serialized as {"_items": ["d4d8404c-4357-47ff-a343-649a116539f5"], "_type": "Object[]"}
4. When that JSON gets deserialized, it tries to ReadType() but ReadType() fails to parse Object[] since it lacks the logic from TypeJsonConverter to throw away the [] before looking up Object in the WellKnownTypeRegistry, so it returns null as a type. Without a type but being faced with a json object { ... } it now deserializes into an ExpandoObject
5. Any further serialization / deserializations will now cause the expando object to get nested deeper and deeper every time.
2024-12-04 15:47:01 +01:00
Sipke Schoorstra 8c40475cc6
Fix route data handling (#6176)
* Fix route data handling

* Cleanup
2024-12-04 11:31:03 +01:00
Sipke Schoorstra a0a0482f5d
Fix JS Variable Setting Bug in Workflow Variable Sync Logic (#6175)
* Fix `variables` handling override values set via `Set{VariableName}()` syntax

* Make `TenantsFeature` a dependency of `Multitenancy` to ensure streamlined initialization

From this point on, all application instances are multi-tenant with a single, default tenant. This streamlines the startup tasks that are designed around multitenancy.

* Add JS variable handling tests

* Ensure ExpandoObjects are correctly processed and synchronized between contexts and engines

Introduced a new helper method to process ExpandoObject conversions to JavaScript objects. Updated various handlers and functions to ensure ExpandoObjects are correctly processed and synchronized between contexts and engines. Added a new workflow test to validate the updated processing logic.
2024-12-04 11:30:44 +01:00
FunShow 5ac63f1485
fix JavaScript BigInt mapping to BigInteger serialization incorrect (#6164)
* fix: fix JavaScript BigInt mapping to BigInteger serialization incorrect

* test: add test for BigIntegerJsonConverter

* test: add test for BigIntegerJsonConverter

---------

Co-authored-by: funshow.liu <funshow.liu@didatravel.com>
2024-12-03 15:07:40 +01:00
Robin Sue 0a349451cd
Fix Serialization of generic types including collections (#6148)
#5682 broke serialization in two ways:
- When a generic type was being serialized, such as List`1, the ` was being escaped by JsonSerializer.Serialize to "\u0060". The PolymorphicObjectConverter would then .Trim('"') without unescaping the `, causing "\\u0060" to be written into the final json.
- When the type is generic with one type parameter, e.g. List<T>, and also IEnumerable<T>, as List<T> is, then it would append "[]" at the end of the type name, resulting in: "System.Collections.Generic.List\\u00601[[Elsa.Workflows.IntegrationTests.Serialization.JsonSerialization.WorkflowAction, Elsa.Workflows.IntegrationTests]], System.Private.CoreLib[]" which is very invalid. It may only do that, if the typename was simplified because the elementType is in the WellKnownTypeRegistry. And even then, this is questionable, as you'd be deserializing an string[] where you've serialized a List<string> for example.
2024-11-26 09:19:16 +01:00
Sipke Schoorstra 1ed6695872
Add ExecuteWorkflow activity (#6134)
* Add ExecuteWorkflow activity and enable multitenancy

Introduced the ExecuteWorkflow activity to create and execute workflow instances, and updated runtime settings to use ProtoActor for distributed caching transport. Enabled multitenancy for the Elsa Server Web application.

* Namespace renames (#6135)

* Create ExecuteWorkflows tests and workflows

Add unit tests for executing workflows, including MainWorkflow and SubroutineWorkflow. Also, rename ExecutedWorkflowResult to ExecuteWorkflowResult in the runtime module for consistency.

* Add output definitions to WorkflowBuilder

Refactored the `WithInput` method for clarity and added multiple `WithOutput` methods to support different ways of defining workflow outputs. These changes enhance the flexibility and readability of the workflow configuration process by providing a consistent API for input and output definitions.

* Refactor namespaces in component tests

Updated namespaces from Helpers to specific contexts like Fixtures, Abstractions, Consumers, Decorators, etc., to improve code organization and readability. This change affects multiple files across different test scenarios and modules.

* Disable RabbitMQ and multitenancy, rename test class

Commented out RabbitMQ usage in WorkflowServer.cs to focus on other transports. Changed multitenancy flag to false in Program.cs. Renamed DispatchWorkflowsTests to ExecuteWorkflowsTests for clarity.
2024-11-21 16:44:25 +01:00
AlmightyLks 153397e63c
Fix all broken summary xml docs (#6123)
* Add proper summary tags back

* Apply suggestions from code review

Co-authored-by: Robin Sue <robinsue@live.de>

* 69 more files fixed

---------

Co-authored-by: Robin Sue <robinsue@live.de>
2024-11-18 13:41:27 +01:00
Sipke Schoorstra 648fbf74cf Merge remote-tracking branch 'origin/blueberry' 2024-11-08 21:58:32 +01:00
Sipke Schoorstra b6e653e151 Add cleanup step to workflow definition reload test
Added a cleanup step in the ReloadWorkflowTests to delete the workflow definition and its versions after the test runs. This ensures that the tests do not leave residual data, maintaining a clean state for subsequent tests.
2024-11-08 21:58:11 +01:00
Sipke Schoorstra e79b8c87d7 Merge remote-tracking branch 'origin/blueberry' 2024-11-08 21:50:55 +01:00
Sipke Schoorstra 111fa10aab Remove unused dependency from ReloadWorkflowTests
Eliminated the IWorkflowDefinitionCacheManager dependency from the ReloadWorkflowTests constructor and fields. This cleanup helps streamline the code and maintainability by removing an unnecessary service.
2024-11-08 21:39:27 +01:00
Sipke Schoorstra e5e7211504 Add workflow definition cache manager to test setup
The IWorkflowDefinitionCacheManager has been added to the test class. This ensures proper cache management during workflow definition reload tests. Additionally, a cleanup step to delete the workflow definition and its versions has been included.
2024-11-08 21:39:01 +01:00
Sipke Schoorstra 9ecbb3f360 Comment out scope disposal and update server configurations
Commented out Scope disposal to prevent test runner hangs in component tests. Adjusted Cluster class to use property initializers instead of constructor. Updated workflow server connection strings and added detailed SQL Server configuration in Program.cs.
2024-11-01 18:02:47 +01:00
Marko Lahma 575892c44f
Enable CPM transitive pinning and resolve version conflicts (#6069)
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2024-10-31 09:12:21 +01:00
Sipke Schoorstra c49a92b5b7 Refactor signals and activity cancellation logic
Changed static signals to instance variables in test classes for better encapsulation. Increased default timeout in `SignalManager` to 60 seconds. Removed unused cancellation token logic in `ActivityExecutionContext`.
2024-10-30 19:04:48 +01:00
Sipke Schoorstra fdd4306d2d Refactor DeleteWorkflowTests to comment out redundant scopes.
Commented out unused service scopes to streamline the DeleteWorkflow tests in Elsa.Workflows. This change includes disabling associated calls and registry checks for scopes 2 and 3, focusing solely on scope1 operations.
2024-10-30 11:53:48 +01:00
Sipke Schoorstra ca78f73e0a
Introduce Log Persistence Strategy (#6057)
* Implement log persistence strategy management

Added interfaces, services, and strategies for log persistence. Introduced new endpoint to list available log persistence strategies. Updated configurations and dependency injections accordingly.

* Refactor log record methods to asynchronous

Updated methods for extracting and persisting log records to be asynchronous, enhancing performance and scalability. This change includes modifying interfaces and implementations for better async support in workflow execution logging.

* Remove commented code

* Support nullable values in ActivityState dictionaries

Update ActivityState to support nullable values by changing type to 'IDictionary<string, object?>'. Enhanced DefaultActivityExecutionMapper to handle multiple persistence strategies for logging inputs and outputs.

* Rename ShouldPersistAsync to GetPersistenceModeAsync

Refactor method names for log persistence strategies to improve readability and consistency. Added summary comments for clarification and removed redundant configurations from appsettings.json. Added implicit uses and updated namespaces for better maintainability.

* Refactor activity payload and output retrieval logic

Extract payload and output retrieval into `GetPayload` and `GetOutputs` methods respectively. This modularizes the code for better readability and maintainability, and allows for potential reusability of these methods in other parts of the codebase.

* Add new project reference and update PostgreSQL provider usage

Added a project reference to Elsa.Agents.Persistence.EntityFrameworkCore.PostgreSql in the test project file. Also modified the WorkflowServer setup to specify the assembly in the PostgreSQL provider configuration.

* Add agent persistence to WorkflowServer

Integrated agent support and persistence using PostgreSQL in WorkflowServer. This includes adding necessary project references and configuring agents in the workflow server setup.
2024-10-25 19:41:10 +02:00
Sipke Schoorstra 32bd3ddfea Integrate improved workflow handling in bulk dispatch tests
Updated workflow creation and dispatching methods to streamline bulk dispatch tests. Modified signal triggering in `TriggerSignal` activity and upgraded `ElsaStudioVersion` for compatibility improvements. Removed unused imports for cleaner code structure.
2024-10-23 19:12:10 +02:00
Sipke Schoorstra 3208be7b89 Merge remote-tracking branch 'origin/blueberry' 2024-10-23 16:07:32 +02:00
Sipke Schoorstra 52516aa0ff
Fix Bulk Dispatch Missing Input (#6052)
* Remove outdated sample workflows and activities

Deleted CompositeExample, SampleWorkflow, and SlowActivity classes as they are no longer needed. These deletions help clean up the codebase and maintain relevance in the code structure.

* Handle null WorkflowBuilderType in ClrWorkflowMaterializer

Introduce a fallback NotFoundWorkflowbuilder class when WorkflowBuilderType is null. This ensures the MaterializeAsync method functions even if the provided context lacks a specific workflow builder type.

* Add merging of itemDictionary to input

This change ensures that the itemDictionary's contents are also merged into the input dictionary, preventing possible data loss. It builds on existing logic by adding an additional merge operation to incorporate all necessary data.

* Add new workflows to BulkDispatchWorkflows and modify tests

Introduce `FruitWorkflow` and `MixFruitsWorkflow` for bulk dispatch scenarios. Refactor `BulkDispatchWorkflowsTests` to include new tests and rename signals for clarity. Optimize `BulkDispatchWorkflows` activity by removing redundant dictionary merge.
2024-10-23 16:06:28 +02:00
Sipke Schoorstra 0c10113d7b Remove outdated database migration files
Deleted obsolete migration files from SQL Server, MySQL, and SQLite projects. This cleanup removes unused schema definitions and indexes, ensuring the repository remains up to date and free of unnecessary files.
2024-10-23 14:32:50 +02:00
Sipke Schoorstra 9bc6371dc0 Merge remote-tracking branch 'origin/blueberry' 2024-10-23 12:13:06 +02:00
Sipke Schoorstra 61f9e2a59a Add version override for System.Text.Json
This change overrides the version of System.Text.Json due to vulnerabilities found in dependencies referencing older versions. This ensures better security and reliability in performance tests.
2024-10-18 12:39:16 +02:00
Sipke Schoorstra 7e7a899bbf
Implement multitenant HTTP routing (#6031)
* Add tenant awareness to bookmark handling and route resolution

Added tenant ID support across various components, including bookmark updates, route resolution, and middleware processing. This ensures that bookmark and route operations can now appropriately handle tenant-specific data, improving the system's multitenancy capabilities.

* Add Multitenant HTTP Routing feature to Tenants module

Introduced a new MultitenantHttpRoutingFeature class to the Elsa.Tenants.AspNetCore module, enhancing the tenant resolution capabilities. Moved RoutePrefixTenantResolver from Elsa.Http to Elsa.Tenants.AspNetCore and updated relevant project references and namespaces accordingly. This refactor improves modularity and separation of concerns between HTTP and tenancy features.

* Refactor route handling and tenant configuration

Removed redundant `RouteTableExtensions` and replaced with new route providers and updaters, enhancing flexibility and modularity. Introduced tenant-specific HTTP endpoint configurations for better customization and configuration management.

* Rename HttpEndpointBookmarkStimulus to HttpEndpointBookmarkPayload

Refactor various classes and methods to reflect the renaming from `HttpEndpointBookmarkStimulus` to `HttpEndpointBookmarkPayload`. Add and configure new extension methods for tenant route handling, update the route provider to support multi-tenancy, and adjust the tenants provider to bind configuration properly.

* Add HeaderTenantResolver and refactor Http namespace.

Introduce HeaderTenantResolver to resolve tenants via HTTP headers. Refactor multiple classes and interfaces to move from the Elsa.Http.Models namespace directly into Elsa.Http for clarity and consistency.

* Add Host-based tenant resolution

Implemented a HostTenantResolver to resolve tenants based on the request's host and updated tenant configurations with host information. Modified the tenant resolver pipeline and added the new host resolver to the service registrations.

* Add tenant-aware caching and accessor support

Enhanced caching by incorporating tenant identifiers into cache keys for more granular cache management. Introduced ITenantAccessor dependencies in various services to retrieve the current tenant information. This ensures that cache entries are correctly isolated per tenant.

* Reorder tenant resolvers for pipeline setup.

Reordered the tenant resolvers in the pipeline to prioritize HostTenantResolver before RoutePrefixTenantResolver. This ensures that tenant resolution is correctly aligned with host-based resolving before checking the route prefix.

* Remove unused imports

This commit eliminates redundant `using` directives across multiple files to streamline the codebase. This cleanup helps improve code readability and maintainability by removing unnecessary dependencies.
2024-10-14 21:27:11 +02:00
Sipke Schoorstra a5cc3fc9e8
Refactor Tenant Resolution to Use Async Local Storage for Operation-wide Access (#6022)
* Remove obsolete tenant-related classes and add ASP.NET Core middleware

Refactored tenant resolution by removing obsolete interfaces and classes, such as `IAmbientTenantAccessor` and `ITenantResolutionStrategy`. Introduced new ASP.NET Core middleware for tenant resolution, encapsulated in the new `Elsa.Tenants.AspNetCore` project. Updated related usage in various parts of the application to align with these changes.

* Remove HttpContextTenantResolver.

Removed HttpContextTenantResolver from the multitenancy pipeline and related service registrations. This simplifies the tenant resolution by relying on remaining resolvers like ClaimsTenantResolver and RoutePrefixTenantResolver.

* Add Elsa solution definition file

This commit introduces the main solution file, Elsa.slnx, defining the folder structure, projects, and configuration for the Elsa repository. This includes folders for Docker, documentation, pipelines, samples, scripts, source code, and tests.

* Refactor DefaultAccessTokenIssuer for clarity and efficiency

Refactored the DefaultAccessTokenIssuer class by simplifying its constructor and utilizing scoped variables for token options. Improved token creation logic by adding a dedicated method to configure token options, enhancing code readability and maintainability.

* Remove Elsa.slnx solution file

No dotnet build support yet.

* Refactor tenant resolver service registrations

Updated the service registrations to use interfaces for DefaultTenantResolver and DefaultTenantResolverPipelineInvoker. This improves the code's flexibility, making it easier to replace or extend these implementations in the future.

* Add multitenancy support and tenant scope management

Introduced ITenantScopeFactory and related implementations for tenant scope management across the application. Enhanced the HTTP workflows middleware to handle tenants and updated relevant configurations and extension methods to support tenant resolution.

* Remove unnecessary folder inclusion

The <Folder> tag for "Modules\Modules\" was redundant and has been removed to clean up the project file. This change will not affect the existing functionality or project structure.

* Rename Create to CreateScope and improve authorization.

Updated the method name from Create to CreateScope for better clarity in the TenantScopeFactory. Fixed a logical error in the authorization process, ensuring proper status code setting for unauthorized requests, and refactored token expiration calculation for clarity.

* Add tenant agnostic filters and remove tenant setup

This commit introduces tenant agnostic filters in AutoUpdateTests to ensure workflows can trigger regardless of tenant. Additionally, it removes tenant configuration from WorkflowServer setup as it is no longer required for the current tests.
2024-10-12 12:08:09 +02:00
Sipke Schoorstra f3961c0af5 Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00
Sipke Schoorstra ff487fad80 Merge remote-tracking branch 'origin/blueberry' into enh/multi-tenancy-refactorings 2024-10-11 19:45:40 +02:00
Sipke Schoorstra dd812645c7 Refactor imports to reduce use of Elsa.Common.Contracts
Consolidate imports by replacing Elsa.Common.Contracts with Elsa.Common and Elsa.Common.Multitenancy. This update streamlines import statements across various modules, improving code readability and maintainability.
2024-10-05 18:30:45 +02:00
Sipke Schoorstra 41e1062148 Enhance JSON deserialization to include service provider
Updated ReadAsJsonAsync method to accept an IServiceProvider parameter for improved JSON deserialization. Modified corresponding tests and helper classes to utilize the service provider for more flexible JSON serialization options.
2024-10-03 19:12:00 +02:00