Commit graph

6316 commits

Author SHA1 Message Date
Sipke Schoorstra 72ad243ed4
Merge 3.5.1 into 3.6.0 (#6907)
* Introduce `IWorkflowResumer` and `ActivityInputEvaluatorContext`, refactor endpoint handling, extend logging, and improve bookmark queue processing.

* Remove deprecated WorkflowContexts module and optimize project.

Deleted the Elsa.Studio.WorkflowContexts module and references from solution files. Corrected minor errors in remaining code and updated project configurations to align with the new structure.```

* Update GitHub workflows to track `develop/3.6.0` branch instead of `patch/3.5.1`.

* Fix inconsistent formatting in `InputDescriptor` constructor and properties.

* Add XML documentation for `DictionaryValueEvaluator` in `UIHints/Dictionary` module

* Refactor `DictionaryValueEvaluator` to improve readability and simplify dictionary evaluation logic.
2025-09-13 13:05:52 +02:00
Sipke Schoorstra b1d9d04150
Parse VariableTestValues more robustly, leveraging ExpandoObject and type conversion logic. (#6883)
* Parse `VariableTestValues` more robustly, leveraging `ExpandoObject` and type conversion logic.

* Clean up unused imports in `JavaScriptAndNetTypeTest`.
2025-08-31 08:50:07 +02:00
Sipke Schoorstra 2a10738d94
Merge remote-tracking branch 'origin/patch/3.5.1' into develop/3.6.0 2025-08-20 14:12:25 +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 3e5374bced
Add missing Pending state to ActivityStatus enum (#6856) 2025-08-19 19:44:14 +02:00
Sipke Schoorstra 6363ee84c4
Merge remote-tracking branch 'origin/develop/3.5.0' into develop/3.6.0 2025-08-15 20:27:21 +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
Lucas Hipólito 3c871afbce
Downgrading JetBrains.Annotations for fixing the packages build (#6848) 2025-08-07 10:54:31 +02:00
Sipke Schoorstra bc3543fcb6
Merge 3.5.0 2025-08-06 20:40:27 +02:00
Lucas Hipólito 6dfa5251df
Merge pull request #6841 from elsa-workflows/feat/task-activity-attribute
Improving behaviour of Run Asynchronously property for the TaskActivity Attribute
2025-08-06 12:37:47 +02:00
lucas.hipolito 20d33f8682 Explaining the reasoning for the test fixes with comments 2025-08-06 12:01:08 +02:00
lucas.hipolito 977ce4b529 Small refactor for DRY principle + Fixing integration tests 2025-08-06 11:31:36 +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
lucas.hipolito 2e8ce50e27 Merge branch 'develop/3.6.0' into feat/task-activity-attribute 2025-08-06 08:47:13 +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
Matt c36f1c977b Update package versions and use new FastEnpoints methods.
- Updated `Directory.Packages.props` with new package versions, including `ElsaStudioVersion`, `MicrosoftVersion`, and others.
- Changed `System.Formats.Asn1` version in `_build.csproj`.
- Re-factored `Endpoint.cs` to use new `Send` methods for updated FastEndpoints packages.
2025-08-05 23:50:40 +01: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
lucas.hipolito 3d0d1c7b5b Added TaskActivityAttribute class 2025-08-05 14:13:10 +02:00
lucas.hipolito 1bf9b11ffc Improving behaviour of Run Asynchronously property for the TaskActivityAttribute 2025-08-05 13:50:35 +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 dd8a6f5866
Merge remote-tracking branch 'origin/develop/3.5.0' into develop/3.6.0 2025-08-04 15:44:17 +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 6d38ebbc97
Merge remote-tracking branch 'origin/bug/activity-execution-record-state' into develop/3.6.0 2025-08-01 22:55:09 +02:00
Sipke Schoorstra 82c3ceeb08
Refactor workflow services and update project references
Fixed code indentation in WorkflowStateExtractor, adjusted output handling in LocalWorkflowClient, and replaced project references in Elsa.Api and Elsa.Http. Reactivated JavaScript engine configuration in Elsa.Server.Web for enhanced script execution capabilities.
2025-08-01 22:44:15 +02:00
Sipke Schoorstra 30139dedc6
Merge remote-tracking branch 'origin/develop/3.5.0' into develop/3.6.0 2025-08-01 22:09:48 +02:00
Sipke Schoorstra 8e347a8ae6
Refactor activity execution record capturing
Replaced `CaptureActivityExecutionRecordMiddleware` with a notification-based approach using `ActivityCompleted` and `CaptureActivityExecutionState`. Removed obsolete middleware setup and extensions for better maintainability.
2025-08-01 20:53:48 +02:00
lukhipolito-nexxbiz 0767fc43b0
Merge pull request #6835 from elsa-workflows/develop/refactor-io-module
Removing IO module (moved to Extensions)
2025-08-01 15:17:15 +02:00
lucas.hipolito 4eac2967a1 Removing IO module (moved to Extensions) 2025-08-01 15:04:20 +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
Matt cf6a17e5b3
Merge pull request #6789 from n84ck/develop/3.5.0
Update BackgroundStimulusDispatcher.cs
2025-07-28 23:34:23 +01:00
Sipke Schoorstra 34ad766cad Update packages 2025-07-28 23:57:16 +02:00
Sipke Schoorstra deb42d7f19
Update ActivityExecutionContextRecordExtensions to preserve and update serialized snapshots (#6823)
Refactor the extension method to merge existing serialized snapshots with updated activity execution properties, ensuring the latest context state is retained without overwriting prior data.
2025-07-25 14:32:12 +02:00
Sipke Schoorstra 3fd8a252cd
Add cancellation handling for executing scheduled tasks (#6819)
* Add cancellation handling for executing scheduled tasks

Enhanced `ScheduledRecurringTask`, `ScheduledCronTask`, and `ScheduledSpecificInstantTask` to properly handle cancellation scenarios when tasks are executing. Introduced `_executing` and `_cancellationRequested` flags to ensure clean cancellation processes.

* Refactor `ScheduledRecurringTask` to improve readability and fix formatting issues.

* Add `SemaphoreSlim` for concurrent task execution control in scheduled tasks

Introduce `SemaphoreSlim` to manage and safeguard concurrent executions in `ScheduledRecurringTask`, `ScheduledCronTask`, and `ScheduledSpecificInstantTask`. Enhances thread safety and prevents overlapping executions. Added exception handling and proper semaphore release to ensure robustness.

* Add ILogger to scheduled tasks and improve error logging

Integrated `ILogger` into `ScheduledRecurringTask` to enhance logging capabilities and replaced the generic comment-based error handling with proper logging for better traceability. Cleaned up and formatted `ScheduledCronTask` for improved code readability.

* Dispose of semaphore fields in scheduled task classes to ensure proper resource cleanup.

* Update src/modules/Elsa.Scheduling/ScheduledTasks/ScheduledRecurringTask.cs

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

* Set `_executing` to `false` in task `finally` blocks to ensure state reset after execution.

* Update src/modules/Elsa.Scheduling/ScheduledTasks/ScheduledSpecificInstantTask.cs

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

* Remove redundant `_executing` assignment after `SendAsync` in scheduled task classes.

* Update src/modules/Elsa.Scheduling/ScheduledTasks/ScheduledRecurringTask.cs

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

* Update src/modules/Elsa.Scheduling/ScheduledTasks/ScheduledRecurringTask.cs

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

* Update src/modules/Elsa.Scheduling/ScheduledTasks/ScheduledCronTask.cs

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

* Update src/modules/Elsa.Scheduling/ScheduledTasks/ScheduledSpecificInstantTask.cs

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

* Update semaphore logic to prevent blocked tasks when cancellation is requested

Refactored `_executionSemaphore.WaitAsync` usage in `ScheduledRecurringTask`, `ScheduledCronTask`, and `ScheduledSpecificInstantTask` to use non-blocking semaphore acquisition with cancellation token support. This ensures graceful handling of pending tasks during cancellation scenarios.

* Refactor delay condition checks to use `TimeSpan.Zero` for improved readability and precision.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-25 07:46:35 +02:00
Sipke Schoorstra 9b1a76d047
Extend ActivityExecutionRecordSnapshot and update DefaultActivityExecutionMapper to include additional activity execution details. 2025-07-24 21:38:18 +02:00
Sipke Schoorstra 61179bcb53
Remove redundant activity metadata properties from ActivityExecutionRecordSnapshot and streamline mapping logic
Deleted unused metadata properties to simplify `ActivityExecutionRecordSnapshot`. Updated `GetOrMapCapturedActivityExecutionRecordAsync` to maintain serialized snapshots when mapping, ensuring consistency in activity execution records.
2025-07-24 19:47:26 +02:00
Sipke Schoorstra 18ee694d23
Refactor variable reading and workflow state extraction logic.
Revised method parameters, simplified object initializations in `DefaultWorkflowInstanceVariableReader`, and enhanced hierarchy reconstruction in `WorkflowStateExtractor` with logging for missing parent contexts.
2025-07-24 19:47:08 +02:00
Sipke Schoorstra b85ed3b329 Remove unused GetCapturedActivityExecutionRecord method from ActivityExecutionContextRecordExtensions. 2025-07-22 21:37:23 +02:00
Sipke Schoorstra f97e2e9e77
Updates Elsa Studio version
Updates the Elsa Studio version to the latest preview.

This ensures that the project uses the most recent features and fixes available in the Elsa Studio development environment.
2025-07-19 12:23:55 +02:00
Sipke Schoorstra 0a9ece71dc
Remove unused TestRun endpoint and update activity execution logic
Eliminated the TestRun endpoint and related functionality from the API. Enhanced activity execution by leveraging pre-serialized snapshots and refactored mapping operations to use asynchronous methods. Also updated package versions to align with the latest dependencies.
2025-07-18 21:46:53 +02:00
Sipke Schoorstra 931d242f40
Merge remote-tracking branch 'origin/develop/3.5.0' into develop/3.6.0 2025-07-18 21:29:09 +02:00
Sipke Schoorstra ed14a1e577
Refactor activity execution record serialization with snapshots (#6807)
- Introduced `ActivityExecutionRecordSnapshot` for encapsulated serialized data.
- Updated `DefaultActivityExecutionMapper` to build serialized snapshots.
- Adjusted `ActivityExecutionLogStore` to persist pre-serialized snapshots.
- Streamlined package version management with `MicrosoftVersion` property.
2025-07-18 14:14:19 +02:00
lukhipolito-nexxbiz 904284ce6b
Fixed wrong naming in resulting entries when file is inputted from http (#6806)
Co-authored-by: lucas.hipolito <lukhipolito@yahoo.com.br>
2025-07-18 12:24:36 +02:00
Sipke Schoorstra b0fd60330a
Simplify activity execution record retrieval with async mapping extension method 2025-07-16 20:28:57 +02:00
Sipke Schoorstra adbea90ccd
Introduce activity execution record capturing and serialization improvements (#6800)
* Introduce activity execution record capturing and serialization improvements

- Added middleware for capturing activity execution records during workflow execution.
- Introduced async mapping in `DefaultActivityExecutionMapper` with additional serialization support.
- Enhanced `ActivityExecutionRecord` with new serialized properties for efficient storage.
- Updated extensions to include `UseActivityExecutionLogCapturing`.
- Simplified logging persistence by leveraging pre-serialized values in `ActivityExecutionLogStore`.

* Update src/modules/Elsa.EntityFrameworkCore/Modules/Runtime/ActivityExecutionLogStore.cs

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

* Update src/modules/Elsa.Workflows.Runtime/Middleware/Activities/CaptureActivityExecutionRecordMiddleware.cs

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

* Apply suggestion from @Copilot

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-16 18:05:32 +02:00