Commit graph

6237 commits

Author SHA1 Message Date
Sipke Schoorstra bdfbd0886f
Add ForEach tests, introduce asynchronous workflow runner and enhance workflow events. (#6926)
* Introduce asynchronous workflow runner and enhance workflow events.

- Added `AsyncWorkflowRunner` to enable asynchronous workflow execution and result tracking.
- Introduced new event arguments, such as `ActivityExecutedEventArgs` and `WorkflowStateCommittedEventArgs`.
- Expanded `WorkflowEvents` class to include `ActivityExecuted`, `ActivityExecutedLogUpdated`, and `WorkflowStateCommitted` events.
- Refactored event arguments into the `Elsa.Testing.Shared.EventArgs` namespace.
- Enhanced tests with `AsyncWorkflowRunner` and new event-driven workflow scenarios.

* Refactor event argument classes to unify namespace and simplify inheritance

* Add shared component DotSettings file to support namespace exclusions
2025-09-24 20:06:00 +02:00
Copilot 54c8a010fe
Add comprehensive Copilot coding agent instructions for repository onboarding (#6920)
* Initial plan

* Add comprehensive .github/copilot-instructions.md with validated build instructions

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
2025-09-19 21:08:54 +02:00
Sipke Schoorstra 67fb43e0ba
Remove TlsSmoke project and related solution references
- Deleted `TlsSmoke` project files (`Program.cs` and `TlsSmoke.csproj`).
- Removed `TlsSmoke` project reference from the solution file (`Elsa.sln`).
2025-09-19 12:07:13 +02:00
Sipke Schoorstra 42ac08c575
Ensure Docker images ship CA trust and add TLS smoke tests (#6918) 2025-09-19 11:57:30 +02:00
Sipke Schoorstra d045e495f8
Update Microsoft.AspNetCore.Authorization to use MicrosoftVersion property 2025-09-19 11:53:02 +02:00
Sipke Schoorstra 3094c0dc64
Update Polly packages
- Bump Polly and Polly.Extensions package versions to 8.6.3.
2025-09-19 11:52:44 +02:00
Sipke Schoorstra eab562e270
Updates KubernetesClient and Microsoft packages (#6917)
* Remove Proto.Cluster.Kubernetes dependency due to vulnerability

- Temporarily removed `Proto.Cluster.Kubernetes` package and provider integration because of a vulnerability in its dependency (https://avd.aquasec.com/nvd/2025/cve-2025-9708).
- Adjusted related cluster provider and remote configuration logic.
- Updated `PortAttribute` default parameter for clarity.

* Revert "Remove Proto.Cluster.Kubernetes dependency due to vulnerability"

This reverts commit 0720d970968e4f7338825407258b34ddffb1d2a4.

* Add KubernetesClient package and update MicrosoftVersion to 9.0.9

- Added `KubernetesClient` package to the project dependencies.
- Updated `MicrosoftVersion` to `9.0.9` in `Directory.Packages.props`.
2025-09-19 11:11:13 +02:00
Sipke Schoorstra 18fe3e827a
Add WorkflowStateCommitted notification support and update state handling logic
- Introduced `WorkflowStateCommitted` notification to encapsulate workflow execution context, state, and instance details.
- Updated `DefaultCommitStateHandler` to publish `WorkflowStateCommitted` via `IMediator`.
- Adjusted `DispatchWorkflowExtensions` to use `WorkflowStateCommitted` for workflow completion.
2025-09-17 21:26:24 +02:00
Sipke Schoorstra 6dfce283b2
Expand HttpClient configuration and improve SendHttpRequest activity port handling
- Updated `HttpFeature` to include `SendHttpRequest` in `HttpClient` configuration delegate support.
- Added `[Port]` attributes to `FailedToConnect` and `Timeout` properties in `SendHttpRequest` activity.
- Simplified `ValueTask` return syntax in `SendHttpRequestActivityPortResolver`.
2025-09-17 18:31:03 +02:00
Sipke Schoorstra 5fb25170cf
Handle premature request cancellation during workflow resumption
- Use `CancellationToken.None` to avoid canceling workflow execution when clients, like Blazor, terminate requests prematurely.
- Add comments for clarification on potential causes.
2025-09-17 15:25:59 +02:00
Sipke Schoorstra f2d3c540ee
Add support for asynchronous workflow resumption in Resume endpoint
- Introduced `async` parameter to enable asynchronous workflow resumption.
- Refactored `ResumeBookmarkedWorkflowAsync` to handle both synchronous and asynchronous resumption via `IWorkflowResumer` and `IBookmarkQueue`.
- Updated dependency injection to include `IWorkflowResumer`.
2025-09-17 14:26:31 +02:00
Sipke Schoorstra 07986de7a8
Refactor TypeDefinition rendering and improve VariableTypeDefinitionProvider
- Adjusted `RenderEnumMember` to include a trailing comma in rendered enums.
- Excluded compiler-generated methods in `TypeDescriber`.
- Extended `VariableTypeDefinitionProvider` to handle `ManagementOptions` and refined variable type exclusion logic.
2025-09-16 21:40:18 +02:00
Sipke Schoorstra d4a2a5f03a
Throw InputEvaluationException for input evaluation errors
Introduced `InputEvaluationException` to encapsulate errors during input evaluation in `ActivityExecutionContextExtensions`. Refactored the input evaluation logic by adding a core evaluation method to improve error handling and clarity.
2025-09-16 20:37:05 +02:00
Sipke Schoorstra b613ff6b61
Addresses workflow identity reload conflict (#6909)
* Refactor `IndexTriggersAsync` to use `WorkflowDefinition` and update null assignment for serialization logic.

* Change default parameter value from `default` to `null` in `UseFluentStorageProvider` method signature.

* Add in-memory workflows provider and materializer for integration tests

Introduced `InMemoryWorkflowsProvider` and `InMemoryWorkflowMaterializer` to support integration testing scenarios for workflow definition population. Enhanced workflow handling with fluent method `WithId` for `WorkflowBuilder`. Updated event publishing and dependency injection logic.

* Remove extraneous whitespace in DefaultWorkflowDefinitionStorePopulator.

* Refine test class documentation for `WorkflowDefinitionStorePopulation` scenario.
2025-09-15 11:56:01 +02:00
Sipke Schoorstra c019cfa3da
- Fix persistence issue by converting ChangeTrackingDictionary to a standard dictionary in BackgroundActivityInvoker.
- Adjust lock acquisition timeout in `appsettings.json` for improved distributed locking behavior.
- Remove unused Oracle setup and volume configurations from `docker-compose.yml`.
2025-09-12 19:58:19 +02:00
Sipke Schoorstra c549f49dfb
Fix race condition when sending same stimuli (#6895)
* Introduce `WorkflowResumer` service and deprecate `BookmarkResumer`.

- Adds `IWorkflowResumer` and its implementation for workflow resumption.
- Marks `BookmarkResumer` and related interfaces as obsolete.
- Refactors dependent services to use `WorkflowResumer`.
- Enhances `ResumeBookmarkRequest` to include `ActivityInstanceId`.
- Updates logging and queue handling logic to align with the new resumption approach.

* Update lock key prefix in `WorkflowResumer` for consistency with service naming.

* Add exception handling for distributed lock acquisition in `WorkflowResumer`

- Wrap distributed lock logic with `try-catch` to handle `TimeoutException`.
- Improve error message when lock acquisition fails due to timeout.
- Preserve existing workflow resumption behavior and logging.

* Update src/modules/Elsa.Workflows.Runtime/Filters/BookmarkFilter.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Optimize `BookmarkFilter` hashing logic for improved performance and readability.

* Merge remote-tracking branch 'origin/enh/locked-bookmark-resumption-2' into enh/locked-bookmark-resumption-2

* Remove unused variable and redundant line breaks for cleaner code.

* Clean up logging configuration by removing unused debug log levels.

* Update src/modules/Elsa.Workflows.Runtime/Services/WorkflowResumer.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Handle collections in `BookmarkFilter` hashing to ensure determinism and improve compatibility.

* Refactor `BookmarkFilter` hashing logic for clarity and consistency.

* Improve `TimeoutException` handling with a more descriptive message in `WorkflowResumer`.

* Update src/modules/Elsa.Workflows.Runtime/Filters/BookmarkFilter.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Simplify `BookmarkFilter` by utilizing `using` directives and refining type references.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-11 22:30:25 +02:00
MariusVuscanNx 6c714fe793
Merge pull request #6904 from elsa-workflows/feature/content-length
Fixed content type check from execute endpoint
2025-09-10 15:02:51 +03:00
Marius Vasile Vușcan eeec5949ef
revert 2025-09-10 15:02:33 +03:00
Marius Vasile Vușcan 4ec48e1a2c
Fixed content type check from execute endpoint 2025-09-10 15:01:29 +03:00
Marius Vasile Vușcan 001f406e5c
push 2025-09-10 14:39:36 +03:00
Marius Vasile Vușcan 5a0112fbd6
Explicitly set content lenght 2025-09-10 14:37:07 +03:00
MariusVuscanNx dd93c5947b
Merge pull request #6902 from elsa-workflows/feature/execute-insensivite
Feature/execute insensivite
2025-09-10 11:40:32 +03:00
Marius Vasile Vușcan dc6d57a1e5
Made execute endpoint model case insensitive 2025-09-10 11:39:24 +03:00
MariusVuscanNx 007b84aea1
Made incidents items flat as otel does not support complex objects like arrays (#6893) 2025-09-05 10:17:58 +02:00
lukhipolito-nexxbiz 43fb93fb3a
Fixing unit tests (#6891)
* Fixing unit tests

* Update src/modules/Elsa.Workflows.Core/Extensions/ActivityExecutionContextExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: lucas.hipolito <lukhipolito@yahoo.com.br>
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-04 18:06:26 +02:00
Lucas Hipólito 90b4e7d6c5
Initial implementation of log activity + base sink (#6859)
* Initial implementation of log activity + base sink

* Update src/modules/Elsa.ProcessLogging/Extensions/ModuleExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Refactor logging implementation: replace `Elsa.ProcessLogging` with a new modular `Elsa.Logging` framework, introducing support for configurable log sinks, enhanced logging extensibility, and updated dependencies in consuming projects.

* Enhance logging framework: introduce custom `NullableBoolConverter` and update JSON serialization/deserialization logic for log sink handling.

* Update description for `Log` activity input: clarify target sinks configuration

* Set default value of `SinkNames` input in `Log` activity to non-nullable collection

* Set `DisplayName` for `Sinks` input in `Log` activity

* Refactor logging framework: update `ILogSink` and `ILogSinkRouter` to support arguments and attributes, enhance `Log` activity to use updated interfaces, and add default category handling.

* Refactor logging framework: simplify argument handling in `ILogSink` and `ILogSinkRouter`, update `Log` activity inputs, and improve message formatting in `MelLogSink`.

* Update logging framework to simplify log sink creation, enhance category filtering, and refactor `ILogSink`/`ILogSinkRouter` interface methods.

* Introduce modular logging framework enhancements: add `Console` and `Serilog` logging features, refactor `ILogSink` framework, and update projects to align with a modular architecture.

* Refactor logging framework: introduce `AddCategoryFilters` extension, replace `DefaultCategory` handling with enhanced category filters, and update sink creation logic for consistency.

* Refactor logging framework: rename `SinkOptions` to `LogSinkOptions`, standardize naming across log sink types, and update configuration and sink factory logic for consistency.

* Enhance logging framework: add `ConfigureDefaults` methods, update `ILogSinkCatalog` to use `IServiceScopeFactory`, and improve logging configuration handling and defaults setup.

* Introduce asynchronous log entry processing: add `ILogEntryQueue`, `LogEntryBackgroundWorker`, and related models to enable queue-based logging and background processing. Update `Log` activity to enqueue log entries for processing.

* Add unit and integration tests for `Elsa.Logging.Core` library, refactor logger setup in `Elsa.Server.Web`, enhance logging configuration, and standardize `Directory.Packages.props` file.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add documentation comments to logging framework classes, interfaces, methods, and factories to enhance code readability and maintainability. Remove unused `CustomPurpleConsoleFormatter` class and `logs` folder from server project.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Make `LogEntryInstruction` and `LogEntryQueue` classes public and simplify return statement in `LogSinkCatalog.ListAsync` method.

* Standardize terminology in `ILogSink` interface and `LoggerSink` implementation: rename `properties` to `attributes`. Update project files and solution structure to reflect integration test additions.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update documentation comments in `LoggingFeature` and `LogEntryInstruction` to clarify functionality and improve precision.

* Add README for `Elsa.Logging` module with configuration examples, usage details, and extension guidance.

* Add `Dictionary` UI hint to `InputUIHints` and update `Attributes` in `Log` activity to use it.

* Update `Log` activity default category to "Process", add integration tests for logging, and enhance null safety in `ConfigurationLogSinkProvider`.

* Remove `UseLoggingFramework` middleware from `Program.cs` to streamline workflow initialization.

* Log Activity

* Auto stash before merge of "feat/6854-process-log-activity" and "patch/3.5.1"

* Refactor `LoggerSink` to simplify logging logic and remove unused `FormatMessage` method. Enhance `Log` activity argument handling by introducing JSON parsing for string inputs.

* Refactor logging tests to improve consistency and update variable initialization in `WorkflowExecutionContext` for cleaner syntax.

* Replace mocked logger dependencies in tests with `TestLogger` and `TestLoggerFactory` for improved readability and maintainability.

* Add `JsonDestructuringConsoleFormatter` for structured JSON logging and update logging configuration to support new formatter.

* Handling Dictionary component values with expressions

* Small improvements

* Increasing studio version

* Introduce custom activity input evaluators and support evaluator type registration. (#6889)

* Introduce custom activity input evaluators and support evaluator type registration.

Added `DefaultActivityInputEvaluator` and `DictionaryValueEvaluator` for custom input evaluation logic. Modified `InputAttribute` and `InputDescriptor` to support specifying evaluator types. Updated relevant activity, service, and feature registrations to integrate the new evaluators.

* Remove legacy Dictionary UI hint implementation and refactor `DictionaryValueEvaluator` integration.

* Removed obsolete `Dictionary` UI hint-related classes.
* Introduced `DictionaryUIHintInputModifier` for centralized modifier logic.
* Relocated `DictionaryValueEvaluator` to the appropriate namespace and updated feature registrations.

* Fix formatting of `Category` property in `Log` activity.

* Refactor input evaluation: replace `ActivatorUtilities` with `GetRequiredService` and update `DictionaryValueEvaluator` to handle dynamic types.

* Remove unused logging-related imports from `Program.cs`.

* Update src/modules/Elsa.Workflows.Core/UIHints/Dictionary/DictionaryValueEvaluator.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add logging to `DictionaryValueEvaluator` for missing property warnings.

---------

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
Co-authored-by: lukhipolito-nexxbiz <lucas.hipolito@nexxbiz.io>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-04 10:57:48 +02:00
MariusVuscanNx 17bb1d08c9
Otel improvements (#6890)
* Otel improvements

* Update src/modules/Elsa.Workflows.Core/Extensions/ActivityExecutionContextExtensions.cs

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>

* Update src/modules/Elsa.OpenTelemetry/Middleware/OpenTelemetryTracingActivityExecutionMiddleware.cs

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>

* Fixed comments

---------

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2025-09-04 08:43:37 +02:00
MariusVuscanNx 48be5a1569
Enrich Activity Spans with Correlation ID (#6888) 2025-09-03 10:21:20 +02:00
Sipke Schoorstra 9739aebb82
Update component tests to expect NotFound for missing DefinitionId and fix BaseAddress inconsistency (#6885) 2025-09-02 09:33:27 +02:00
Sipke Schoorstra 3702fcfc7c
Restore ability to send no body and no content type to Execute endpoint (#6882)
* Refactor workflow execution endpoints and introduce helper utility

Replaced `EndpointBase` class with lighter `WorkflowExecutionHelper` for handling workflow execution logic. Simplified Get & Post endpoints and added comprehensive component tests for enhanced validation.

* Update GetTests to expect NotFound instead of BadRequest
2025-09-01 09:49:07 +02:00
Sipke Schoorstra 6764d4acc4
Fix log string template argument processing (#6880)
* Refactor logging system and replace JsonDestructuringConsoleFormatter.

Removed `JsonDestructuringConsoleFormatter` in favor of native JSON console formatting. Introduced `LogArgumentHelper` to process log arguments efficiently and added comprehensive unit tests. Updated `ConsoleLogSinkOptions` to use extensible `JsonFormatterOptions`.

* Refactor `LogArgumentHelper` methods for clarity and remove redundant string handling logic.

* Update src/modules/Elsa.Logging.Core/Helpers/LogArgumentHelper.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Elsa.Logging.Core/Helpers/LogArgumentHelper.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Elsa.Logging.Core/Helpers/LogArgumentHelper.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Refactor `LogArgumentHelper` to improve type handling and dictionary conversion

Introduced a temporary list in `ConvertDictionaryToPairs` for better handling of dictionary entries. Updated property-to-pair conversion to cast results as objects, ensuring type consistency.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-28 21:10:32 +02:00
Sipke Schoorstra ca85fe0f6d
Improve Logger With Destructuring of ExpandoObject (#6877)
* Initial implementation of log activity + base sink

* Refactor logging implementation: replace `Elsa.ProcessLogging` with a new modular `Elsa.Logging` framework, introducing support for configurable log sinks, enhanced logging extensibility, and updated dependencies in consuming projects.

* Enhance logging framework: introduce custom `NullableBoolConverter` and update JSON serialization/deserialization logic for log sink handling.

* Update description for `Log` activity input: clarify target sinks configuration

* Set default value of `SinkNames` input in `Log` activity to non-nullable collection

* Set `DisplayName` for `Sinks` input in `Log` activity

* Refactor logging framework: update `ILogSink` and `ILogSinkRouter` to support arguments and attributes, enhance `Log` activity to use updated interfaces, and add default category handling.

* Refactor logging framework: simplify argument handling in `ILogSink` and `ILogSinkRouter`, update `Log` activity inputs, and improve message formatting in `MelLogSink`.

* Update logging framework to simplify log sink creation, enhance category filtering, and refactor `ILogSink`/`ILogSinkRouter` interface methods.

* Introduce modular logging framework enhancements: add `Console` and `Serilog` logging features, refactor `ILogSink` framework, and update projects to align with a modular architecture.

* Refactor logging framework: introduce `AddCategoryFilters` extension, replace `DefaultCategory` handling with enhanced category filters, and update sink creation logic for consistency.

* Refactor logging framework: rename `SinkOptions` to `LogSinkOptions`, standardize naming across log sink types, and update configuration and sink factory logic for consistency.

* Enhance logging framework: add `ConfigureDefaults` methods, update `ILogSinkCatalog` to use `IServiceScopeFactory`, and improve logging configuration handling and defaults setup.

* Introduce asynchronous log entry processing: add `ILogEntryQueue`, `LogEntryBackgroundWorker`, and related models to enable queue-based logging and background processing. Update `Log` activity to enqueue log entries for processing.

* Add unit and integration tests for `Elsa.Logging.Core` library, refactor logger setup in `Elsa.Server.Web`, enhance logging configuration, and standardize `Directory.Packages.props` file.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add documentation comments to logging framework classes, interfaces, methods, and factories to enhance code readability and maintainability. Remove unused `CustomPurpleConsoleFormatter` class and `logs` folder from server project.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Make `LogEntryInstruction` and `LogEntryQueue` classes public and simplify return statement in `LogSinkCatalog.ListAsync` method.

* Standardize terminology in `ILogSink` interface and `LoggerSink` implementation: rename `properties` to `attributes`. Update project files and solution structure to reflect integration test additions.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update documentation comments in `LoggingFeature` and `LogEntryInstruction` to clarify functionality and improve precision.

* Add README for `Elsa.Logging` module with configuration examples, usage details, and extension guidance.

* Add `Dictionary` UI hint to `InputUIHints` and update `Attributes` in `Log` activity to use it.

* Update `Log` activity default category to "Process", add integration tests for logging, and enhance null safety in `ConfigurationLogSinkProvider`.

* Remove `UseLoggingFramework` middleware from `Program.cs` to streamline workflow initialization.

* Refactor `LoggerSink` to simplify logging logic and remove unused `FormatMessage` method. Enhance `Log` activity argument handling by introducing JSON parsing for string inputs.

* Refactor logging tests to improve consistency and update variable initialization in `WorkflowExecutionContext` for cleaner syntax.

* Replace mocked logger dependencies in tests with `TestLogger` and `TestLoggerFactory` for improved readability and maintainability.

* Add `JsonDestructuringConsoleFormatter` for structured JSON logging and update logging configuration to support new formatter.

* Refactor JSON converters: replace `NullableBoolConverter` with `NullableBooleanConverter` and `BooleanConverter` for improved readability and consistency.

* Add error handling and logging to `LogEntryBackgroundWorker`

Introduce exception handling with logging in `LogEntryBackgroundWorker` to capture and log errors during log entry processing. Added `ILogger` dependency for structured error reporting.

---------

Co-authored-by: lucas.hipolito <lukhipolito@yahoo.com.br>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-28 08:53:15 +02:00
Sipke Schoorstra 8645493b04
Introduces modular logging framework (#6872)
* Initial implementation of log activity + base sink

* Refactor logging implementation: replace `Elsa.ProcessLogging` with a new modular `Elsa.Logging` framework, introducing support for configurable log sinks, enhanced logging extensibility, and updated dependencies in consuming projects.

* Enhance logging framework: introduce custom `NullableBoolConverter` and update JSON serialization/deserialization logic for log sink handling.

* Update description for `Log` activity input: clarify target sinks configuration

* Set default value of `SinkNames` input in `Log` activity to non-nullable collection

* Set `DisplayName` for `Sinks` input in `Log` activity

* Refactor logging framework: update `ILogSink` and `ILogSinkRouter` to support arguments and attributes, enhance `Log` activity to use updated interfaces, and add default category handling.

* Refactor logging framework: simplify argument handling in `ILogSink` and `ILogSinkRouter`, update `Log` activity inputs, and improve message formatting in `MelLogSink`.

* Update logging framework to simplify log sink creation, enhance category filtering, and refactor `ILogSink`/`ILogSinkRouter` interface methods.

* Introduce modular logging framework enhancements: add `Console` and `Serilog` logging features, refactor `ILogSink` framework, and update projects to align with a modular architecture.

* Refactor logging framework: introduce `AddCategoryFilters` extension, replace `DefaultCategory` handling with enhanced category filters, and update sink creation logic for consistency.

* Refactor logging framework: rename `SinkOptions` to `LogSinkOptions`, standardize naming across log sink types, and update configuration and sink factory logic for consistency.

* Enhance logging framework: add `ConfigureDefaults` methods, update `ILogSinkCatalog` to use `IServiceScopeFactory`, and improve logging configuration handling and defaults setup.

* Introduce asynchronous log entry processing: add `ILogEntryQueue`, `LogEntryBackgroundWorker`, and related models to enable queue-based logging and background processing. Update `Log` activity to enqueue log entries for processing.

* Add unit and integration tests for `Elsa.Logging.Core` library, refactor logger setup in `Elsa.Server.Web`, enhance logging configuration, and standardize `Directory.Packages.props` file.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add documentation comments to logging framework classes, interfaces, methods, and factories to enhance code readability and maintainability. Remove unused `CustomPurpleConsoleFormatter` class and `logs` folder from server project.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Make `LogEntryInstruction` and `LogEntryQueue` classes public and simplify return statement in `LogSinkCatalog.ListAsync` method.

* Standardize terminology in `ILogSink` interface and `LoggerSink` implementation: rename `properties` to `attributes`. Update project files and solution structure to reflect integration test additions.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update documentation comments in `LoggingFeature` and `LogEntryInstruction` to clarify functionality and improve precision.

* Add README for `Elsa.Logging` module with configuration examples, usage details, and extension guidance.

* Add `Dictionary` UI hint to `InputUIHints` and update `Attributes` in `Log` activity to use it.

* Update `Log` activity default category to "Process", add integration tests for logging, and enhance null safety in `ConfigurationLogSinkProvider`.

* Remove `UseLoggingFramework` middleware from `Program.cs` to streamline workflow initialization.

---------

Co-authored-by: lucas.hipolito <lukhipolito@yahoo.com.br>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-25 09:55:27 +02:00
Sipke Schoorstra c54f60ff07
Update workflows to target patch/3.5.1 branch and remove preview from Docker tag names 2025-08-23 15:51:01 +02:00
Sipke Schoorstra 28876da5e8
Update workflow packages.yml to use preview as a version tag prefix 2025-08-20 14:22:55 +02:00
Sipke Schoorstra 51d8c99775
Update workflow base_version to 3.5.1 and adjust branch reference for patch release 2025-08-20 14:13:38 +02:00
Sipke Schoorstra 2175a3470a
Refactors JavaScript type handling (#6858)
* Exclude blacklisted types (`string`, `object`, `Array`, `DateTime`) from workflow variable registration logic.

* Add integration tests for JavaScript evaluation and update type blacklist in `ConfigureEngineWithVariableTypes`

* Disable central package transitive pinning and update Elsa Studio version to `3.5.0`.

* Update Microsoft version to 9.0.8 in Directory.Packages.props

* Enable central package transitive pinning in `Directory.Packages.props`.
2025-08-20 14:10:16 +02:00
Sipke Schoorstra 6ddcd71c26
Exclude blacklisted types (string, object, Array, DateTime) from workflow variable registration logic. (#6857) 2025-08-20 10:50:56 +02:00
Sipke Schoorstra d72c4974d2
Refactor ObjectConverter to improve readability and add backward-compatible default value handling in non-strict mode. (#6852)
* Refactor `ObjectConverter` to improve readability and add backward-compatible default value handling in non-strict mode.

* Add `StrictMode` option to `ObjectConverterOptions` and update related tests

Introduced a `StrictMode` option to `ObjectConverterOptions` to control strict type conversion behavior. Updated the `ObjectConverter` logic to utilize this new option and refactored unit tests to include `ObjectConverterOptions` where necessary, ensuring comprehensive test coverage for strict and non-strict mode scenarios.

* Fix ObjectConverter default value handling and update unit tests

Standardize usage of `targetType` for default values in `ObjectConverter`. Refactor and consolidate unit tests to improve coverage and clarity, addressing various conversion and exception scenarios.
2025-08-11 08:50:45 +02:00
Sipke Schoorstra 67e6a0b36a
Refine variable type registration by excluding object and optimizing collection processing. (#6849) 2025-08-08 08:37:08 +02:00
Sipke Schoorstra 1570cc929e
Send ActivityCompleted notification from middleware and remove redundant notification logic in activity execution context. (#6842)
* Send `ActivityCompleted` notification from middleware and remove redundant notification logic in activity execution context.

* Update src/modules/Elsa.Workflows.Core/Middleware/Activities/DefaultActivityInvokerMiddleware.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Elsa.Workflows.Core/Middleware/Activities/DefaultActivityInvokerMiddleware.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-06 08:47:23 +02:00
Sipke Schoorstra 133e8dfc63
Introduce TenantDeleted event to handle tenant cleanup (#6843)
* Introduce `TenantDeleted` event to handle tenant cleanup

Added a `TenantDeleted` event to differentiate between tenant deactivation and deletion. Updated event handlers and services to support unregistering resources only during tenant deletion, ensuring clearer separation of responsibilities. Included ADR documentation for the new event.

* Remove unnecessary blank line in tenant deactivation logic
2025-08-06 08:43:39 +02:00
Sipke Schoorstra fc5612687d
Refactors notification system for context (#6821)
* Fix `CancellationToken` usage in `BackgroundCommandSenderHostedService`

Corrected the `CancellationToken` parameter to use `commandContext.CancellationToken` instead of the method's cancellation token, ensuring proper propagation and handling within the command sender.

Fixes #6449

* Refactor notifications system to use `NotificationContext` across channels and middleware

* Update src/common/Elsa.Mediator/Extensions/HandlerExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Simplify `InvokeAsync` method call by replacing braces with brackets in argument array.

* Refactor `NotificationContext` usage in mediator strategies and handler extensions

Replaced direct references to `Notification` and `CancellationToken` with `NotificationContext` across mediator strategies to align with updated context structure. Simplified handler invocations by passing `CommandContext` and `NotificationContext` where applicable.

* Refactor notification extraction in publishing strategies

Standardize notification retrieval by introducing `notificationContext.Notification` in `SequentialProcessingStrategy` and `ParallelProcessingStrategy` for improved clarity and consistency.

* Refactor hosted services to improve worker channel management and cancellation handling

Implemented better round-robin distribution and added linked cancellation token sources in `BackgroundCommandSender`, `JobRunner`, and `BackgroundEventPublisher` hosted services. Enhanced logging and comments for clarity.

* Update src/common/Elsa.Mediator/HostedServices/BackgroundCommandSenderHostedService.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-05 22:22:13 +02:00
Sipke Schoorstra adad649fa5
Update tenant HTTP prefix in appsettings.json for consistency 2025-08-05 22:16:25 +02:00
Sipke Schoorstra 95346c98a3
Fix RunMigrations Propagation Issue (#6838)
* Introduce `MigrationOptions` for configurable EF Core migration execution

Added `MigrationOptions` to control migration execution on a per-DbContext basis. Updated `RunMigrationsStartupTask` to respect these options, and refactored configurations in `PersistenceFeatureBase`.

This fixes an issue where the `RunMigrations` setting is not properly propagated to dependency features.

Fixes #6912

* Propagate `DbContextOptionsBuilder`, `UseContextPooling`, and `RunMigrations` settings to dependency features in `WorkflowManagementPersistenceFeature`.

* Update src/modules/Elsa.EntityFrameworkCore.Common/RunMigrationsStartupTask.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Frans van Ek <frans@fransvanek.nl>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-05 08:31:53 +02:00
Sipke Schoorstra aab80dd30b Add Activity Execution Snapshots ADR
Document architecture decision to capture `ActivityExecutionContext` snapshots at execution time. Updated TOC and dependency graph to reference the new ADR.
2025-08-04 15:42:46 +02:00
Sipke Schoorstra 4b3b39f74e
Refactor activity execution record capturing (#6836)
Replaced `CaptureActivityExecutionRecordMiddleware` with a notification-based approach using `ActivityCompleted` and `CaptureActivityExecutionState`. Removed obsolete middleware setup and extensions for better maintainability.
2025-08-04 08:44:42 +02:00
Sipke Schoorstra 207356cf5b
Add Bookmarks property to workflow state mapping in LocalWorkflowClient 2025-07-30 13:11:02 +02:00
Sipke Schoorstra cbcd9c3dc9
Refactor BookmarkExpressionExecutionContextExtensions to BookmarkExecutionContextExtensions and add new helper methods for generating bookmark trigger URLs. 2025-07-30 09:13:18 +02:00
Sipke Schoorstra 7467b6347d
Add support for flow authorization activities and bookmark trigger URL generation (#6828)
* Add support for flow authorization activities and bookmark trigger URL generation

- Introduced `AuthorizeFlow` activity for configurable policy-based flow authorization.
- Added extensions for generating bookmark trigger URLs.
- Created `BookmarkTokenPayload` and updated APIs to handle bookmark resumption with SAS tokens.
- Refactored and consolidated related code for improved modularity and clarity.

* Update src/modules/Elsa.Http/Extensions/BookmarkExpressionExecutionContextExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/modules/Elsa.Http/Extensions/BookmarkExpressionExecutionContextExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/apps/Elsa.Server.Web/Activities/AuthorizeFlow.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-29 20:22:39 +02:00