Commit graph

5659 commits

Author SHA1 Message Date
Sipke Schoorstra 96dd00838a Refine message handling in MessageReceived activity.
Ensure type validation for incoming messages and clean up workflow input to prevent unintended data propagation. Added a dedicated ResumeAsync method to handle bookmark resumption logic consistently.

Fixes #6294
2025-01-15 14:27:37 +01:00
Sipke Schoorstra eba7eb289d
Update README.md 2025-01-15 11:25:43 +01:00
Sipke Schoorstra 7b45811ef4
Merge pull request #6301 from elsa-workflows/bug/6299
Fix array type handling
2025-01-15 11:19:12 +01:00
Sipke Schoorstra 18765cc386 Refactor route normalization logic
Simplified route normalization logic by removing unnecessary lowercase conversion and adjusted usages accordingly. These changes improve code readability, maintain consistency and fixes that route values are stored lower-cased instead of original-cased.
2025-01-15 11:17:21 +01:00
Sipke Schoorstra 2c3843d5f5 Refactor variable mapping and improve type alias handling
Updated `VariableMapper` for null assignment consistency and streamlined `VariableModel` instantiation. Improved `TypeJsonConverter` to handle list type aliases more explicitly, replacing ambiguous syntax with clearer format.
2025-01-15 10:50:34 +01:00
Sipke Schoorstra aaab19509e Fix array type handling in ArgumentJsonConverter
Previously, the code incorrectly used `MakeCollectionType` for arrays. This has been corrected to use `MakeArrayType`, ensuring proper deserialization of array arguments.
2025-01-15 10:50:17 +01:00
Sipke Schoorstra 7a08dd70cb Refactor scheduling service registrations.
Removed unused and duplicate service registrations to simplify DI setup. Ensures cleaner and more maintainable code while preventing potential initialization conflicts.
2025-01-15 00:01:26 +01:00
Sipke Schoorstra 0adc3acd59 Remove unused code from CleanupJob
Deleted an unnecessary `using` directive and a debug `Console.WriteLine` call. These changes clean up the code, improve readability, and avoid potential clutter.
2025-01-14 23:38:38 +01:00
Sipke Schoorstra e74d8d7d65
Merge pull request #6296 from elsa-workflows/fix/object-converter
Refactor and enhance JavaScript and object conversions.
2025-01-14 23:27:12 +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 9842a0dd7b Remove unused SetVariableWorkflow class
The SetVariableWorkflow.cs file was deleted as it was no longer needed. This simplifies the codebase by removing unused workflows and reduces maintenance overhead.
2025-01-14 23:17:32 +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 03dc67d1ed
Merge pull request #6293 from elsa-workflows/feature/main-delete
Added DeleteVariablesAsync method for the workflow context - main
2025-01-14 13:53:27 +01:00
Marius Vasile Vușcan 190d6c3bda
Improvements 2025-01-14 14:43:58 +02:00
Marius Vasile Vușcan e365d44637
Added DeleteVariablesAsync method for the workflow context 2025-01-14 14:41:49 +02: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
Sipke Schoorstra 60db7cb964 Disable multitenancy and streamline NuGet publishing workflow.
Multitenancy is now disabled by default in `Program.cs` to simplify configuration. Additionally, removed the `publish_preview_nuget` step and refined conditions for `publish_nuget` to improve the workflow and align with the release process.
2025-01-11 19:55:06 +01:00
Sipke Schoorstra c8d7882c33
Merge pull request #6284 from elsa-workflows/bug/hangfire
Enable customizable Hangfire job storage and deprecate obsolete APIs.
2025-01-11 19:13:11 +01:00
Sipke Schoorstra 48c453d153 Enable customizable Hangfire job storage and deprecate obsolete APIs.
Added support for configuring Hangfire job storage per database provider, including PostgreSql, SQLite, and SQL Server. Introduced new methods for flexible Hangfire setup, while marking older APIs and storage configuration extensions as obsolete. Refactored related configurations for streamlined and centralized job scheduling logic.
2025-01-11 19:12:38 +01:00
Sipke Schoorstra 279d55c22c
Merge pull request #6276 from LarsNijholt/fix/no-ref/improve-workflow-instance-definition-filtering
Implemented name filter to workflow instance filter and added case insensitivity to searching definitions and instances by name
2025-01-10 18:39:58 +01:00
Sipke Schoorstra e395361bfd
Merge pull request #6283 from elsa-workflows/fix/array-wf-type
Refactor array type handling in variable and JSON converters
2025-01-10 14:38:54 +01:00
Sipke Schoorstra d759624321 Refactor array type handling in variable and JSON converters
Updated the logic to use `MakeArrayType` for array handling instead of generic collection types, ensuring consistency and better alignment with expected type structures. Adjustments were made in both the `VariableDefinitionMapper` and the `TypeJsonConverter`.
2025-01-10 11:40:54 +01:00
Sipke Schoorstra 8e27cf59a8
Merge pull request #6282 from elsa-workflows/perf/local-runtime-perf-degradation
Update workflow creation to use async commit method
2025-01-10 10:36:40 +01:00
Sipke Schoorstra 41d5160c41 Update workflow creation to use async commit method
Replaced synchronous `CreateWorkflowInstance` with `CreateAndCommitWorkflowInstanceAsync` to ensure instance creation is properly committed. Included support for cancellation tokens to improve process control and reliability.
2025-01-10 10:29:03 +01:00
Sipke Schoorstra ca4953d6ae
Merge pull request #6281 from elsa-workflows/perf/local-runtime-perf-degradation
Simplify and optimize workflow instance creation.
2025-01-10 10:11:19 +01:00
Sipke Schoorstra 03344bdc20 Adjust caching options and disable secrets usage
Enabled CachingOptions configuration and set a 1-day cache duration while disabling the use of secrets. These changes improve caching behavior and streamline application setup by avoiding secret dependencies.
2025-01-10 10:09:35 +01:00
Sipke Schoorstra d6c0ba45df Use sliding expiration for cache entries.
Replaced absolute expiration with sliding expiration for cache entries to ensure the cache is kept active during frequent access. This change optimizes cache behavior and improves resource utilization.
2025-01-10 10:08:25 +01:00
Sipke Schoorstra 605a46fdf7 Refactor workflow graph retrieval logic.
Extract shared workflow graph retrieval logic into a new `GetWorkflowGraphAsync` method, reducing code duplication. Updated call sites to use the new method for better maintainability and readability.
2025-01-10 10:07:54 +01:00
Sipke Schoorstra ada9f3967e Use null instead of default for optional parameters
Replaced `default` with explicit `null` for optional parameters to improve clarity and readability. Additionally, simplified object initialization by leveraging newer C# features like target-typed `new`.
2025-01-09 21:20:02 +01:00
Sipke Schoorstra 288097d503 Simplify and optimize workflow instance creation.
Replaced asynchronous instance creation methods with streamlined synchronous alternatives where applicable. Introduced `CreateAndCommitWorkflowInstanceAsync` for combined instantiation and persistence, along with a separate `CreateWorkflowInstance` method for non-committal instantiation. Refactored related code to improve readability, maintainability, and runtime performance.
2025-01-09 19:34:53 +01:00
Sipke Schoorstra 67b950f86c Refactor to use target-typed object creation
Replaced explicit type initializations with concise target-typed `new()` expressions where applicable, improving code readability and aligning with updated C# conventions. Updated .editorconfig to enforce consistent use of `var` for type declarations.
2025-01-09 10:27:55 +01:00
Lars Nijholt 05f8bc640b Add case insensitivity to the search term of the WorkflowInstanceFilter 2025-01-07 16:00:20 +01:00
Lars Nijholt dc2def3ad9 Add string comparison for searching definitions case insensitively to EfCoreWorkflowDefinitionStore 2025-01-07 15:43:56 +01:00
Lars Nijholt 788e6f7a0f Add case insensitivity to the name and description of the workflow definition filter 2025-01-07 14:53:21 +01:00
Lars Nijholt e48010e3f9 Use ToLower method for comparison 2025-01-07 14:46:03 +01:00
Lars Nijholt 1c9328597f Add workflow name property to workflow instance filter.
Add the name property to the workflow instance filter to make use of the name property that can be used in the Request class for the list endpoint. This allows us to filter purely on workflow instance name without using the SearchTerm
2025-01-07 14:34:14 +01:00
Sipke Schoorstra ace32dd50e
Merge pull request #6272 from elsa-workflows/perf/serialization
Refactor JsonWorkflowStateSerializer to improve performance
2025-01-07 11:27:33 +01:00
Sipke Schoorstra aef5921979 Refactor reference handling in serialization classes
Replaces static resolver state with an instance-level resolver in `CrossScopedReferenceHandler` to enhance flexibility and thread-safety. Refactors `JsonWorkflowStateSerializer` to use `GetOptions` for improved API consistency and clarity.
2025-01-06 18:11:11 +01:00
Sipke Schoorstra 25d9608b25 Refactor reference handling logic for serialization.
Replaced `PerCallReferenceHandlerWrapper` with `CrossScopedReferenceHandler` and optimized the resolver initialization using `AsyncLocal`. This simplifies the code and ensures a more efficient handling of reference resolution during serialization.
2025-01-06 17:57:05 +01:00
Sipke Schoorstra a3ce523faa Fix missing base method call in ApplyOptions implementation
The `ApplyOptions` method now correctly calls the base implementation before applying custom configurations. This ensures that any base behavior is preserved, preventing potential issues with serialization options.
2025-01-06 17:27:24 +01:00
Sipke Schoorstra d2777f70de Refactor reference handling to use a wrapper class
Replaced direct use of `CrossScopedReferenceHandler` with `PerCallReferenceHandlerWrapper` for improved abstraction and reusability. Updated `ApplyOptions` to leverage the new wrapper, simplifying reference resolver management. Commented out redundant code to streamline the implementation.
2025-01-06 17:13:20 +01:00
Sipke Schoorstra 506a36574b Update target framework to .NET 9 and improve null handling
Updated the target framework from .NET 8 to .NET 9 for future compatibility and language improvements. Adjusted null handling in `WorkflowDefinitionImporter` for better readability and correctness. Added a cancellation token to `ReadToEndAsync` for improved async operation control.
2025-01-06 15:35:06 +01:00
Sipke Schoorstra ba4645ea62 Refactor JsonWorkflowStateSerializer to improve performance
- **Improves performance:** The converters and static properties are pre-configured when the class is initialized. Only the `ReferenceHandler` is refreshed per call, avoiding repeated configuration of common options like converters.
- **Thread-safe:** Since `_cachedOptions` is immutable, it can safely be reused across threads.

**Tradeoffs:** Small performance cost during cloning, but still much faster than fully recreating options each time.
2025-01-06 15:34:43 +01:00
Sipke Schoorstra 965a67c62f Fix punctuation in link text for better clarity.
Added a missing comma in the README link text for the Elsa 2 section to improve readability and align with proper punctuation standards. No functional changes were made.
2025-01-05 20:29:08 +01:00
Sipke Schoorstra 106c335918
Merge pull request #6260 from elsa-workflows/bug/6258
Refactor workflow runtime structure and update handlers
2025-01-02 11:48:31 +01:00
Sipke Schoorstra 9aeacd6e4d Update workflow state persistence during cancellation
Enhanced the workflow cancellation process by saving the updated workflow state using `IWorkflowInstanceManager`. Similar updates were applied to state import logic to ensure consistency in persisting workflow state changes.
2025-01-02 11:45:49 +01:00
Sipke Schoorstra 5e2644f751 Refactor workflow runtime structure and update handlers.
Moved `CancelWorkflowsCommandHandler` to the shared runtime module. Updated related project references, features, and configurations accordingly. Improved `WorkflowInstance` actor to save state using `IWorkflowInstanceManager`.
2025-01-02 11:43:21 +01:00
Sipke Schoorstra be68b4c33f
Merge pull request #6259 from elsa-workflows/bug/6251
Refactor recurring tasks scheduling logic.
2025-01-02 11:12:45 +01:00
Sipke Schoorstra 6c0f7a48e7 Refactor recurring tasks scheduling logic.
Removed `ConfigureRecurringTasksScheduleStartupTask` and moved its functionality into `RecurringTaskScheduleManager`. Simplified recurring task configuration and streamlined dependencies, improving maintainability. Added retention policies to `Elsa.Server.Web`.
2025-01-02 11:11:42 +01:00
Sipke Schoorstra d3af106c32
Merge pull request #6256 from elsa-workflows/bug/6255
Handle exceptions in variable loading and fix type checking.
2025-01-01 22:08:33 +01:00