Commit graph

6237 commits

Author SHA1 Message Date
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 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 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
Lucas Hipólito 51fb7bfaef
Merge pull request #6797 from elsa-workflows/feat/6796-streamtobase64-streamtobytes-custom-js-functions
Implemented custom js functions: streamToBytes and streamToBase64
2025-07-16 09:17:45 +02:00
lucas.hipolito be8e61f1b4 Implemented custom js functions: streamToBytes and streamToBase64 2025-07-15 16:30:41 +02:00
Sipke Schoorstra b535ed4b8c
Update Jint to 4.3.0 (#6794) 2025-07-15 14:09:48 +02:00
Lucas Hipólito f9b9c84cf0
Fixing Stream variable saved in instance issue (#6785) 2025-07-15 13:59:39 +02:00
n84ck f11b7d5a21
Update BackgroundStimulusDispatcher.cs
Include tenant headers during command dispatch.
2025-07-12 18:40:52 +02:00
Lucas Hipólito fd5579e551
Merge pull request #6783 from elsa-workflows/bug/zip-activity-base64-correction
Implementing better base64 evaluation + appropriate zip entry naming
2025-07-10 12:51:47 +02:00
lucas.hipolito fe08794f09 fix on padding index validation for base64 2025-07-10 11:00:22 +02:00
lucas.hipolito 9346595d80 improving entry naming logic for better performance and readability 2025-07-10 10:54:05 +02:00
lucas.hipolito f6e1ed093a small QoL improvements: more edge cases and constraints for base64 2025-07-10 10:44:35 +02:00
lucas.hipolito 792155c794 Improving performance of existing entry check 2025-07-10 10:24:32 +02:00
lucas.hipolito 35cdaad7ef Implementing better base64 evaluation + appropriate zip entry naming 2025-07-10 10:07:01 +02:00
Lucas Hipólito 940e3b5b13
Merge pull request #6777 from elsa-workflows/bug/zip-activity
Fixing wrong strategy selection for some string content
2025-07-08 20:38:57 +02:00
Lucas Hipólito 9e3e93c580
changing logic to include non-Data URI scenarios
changing logic to include non-Data URI scenarios

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-08 20:31:35 +02:00
lucas.hipolito 1f0e67926f Fixing wrong strategy selection for some string content 2025-07-08 11:26:06 +02:00
Sipke Schoorstra 876c76e443
Merge remote-tracking branch 'origin/patch/3.4.2' into develop/3.5.0
# Conflicts:
#	.github/workflows/packages.yml
#	src/modules/Elsa.MongoDb/Features/MongoDbFeature.cs
2025-07-04 10:03:35 +02:00
Sipke Schoorstra 45bfcc9eeb
Update release workflow for 3.4.2 patch tracking
Adjusted branch filtering logic in `packages.yml` to track `3.4.2` patch release.
2025-07-04 09:58:09 +02:00
Sipke Schoorstra 1a554e7e06
Fix MongoDB serialization issues (#6762)
* Ongoing MongoDB work

* Refactor MongoDB serializer configuration and improve type handling

- Added `BsonSerializerHelpers` for streamlined serializer registration with error handling.
- Introduced `ConfigureMongoDbSerializers` hosted service to centralize serializer setup.
- Enhanced `FlowScopeSerializer` to handle additional BSON types.
- Cleaned up and reorganized MongoDB feature implementations, removing redundant code and improving consistency.

* Remove `BsonSerializerHelpers` and update MongoDB serializer registration

- Deleted `BsonSerializerHelpers` as it was redundant.
- Updated `ConfigureMongoDbSerializers` to directly register serializers using `BsonSerializer`.
- Simplified `FlowScopeSerializer` null handling for improved readability.

* Switch persistence provider to Entity Framework Core in `Program.cs`.

* Update src/modules/Elsa.MongoDb/Serializers/FlowScopeSerializer.cs

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

* Configures MongoDB services and options.

Configures MongoDB services, including client and database creation.

Registers default naming strategy and collection naming strategy.

Adds BsonClassMap configuration for KeyValuePair.

* Simplify null check in `FlowScopeSerializer`.

* Allow `FlowScopeSerializer` to handle nullable `FlowScope`.

* Registers FlowScope BSON class map

Registers the `FlowScope` class with BSON to enable proper serialization and deserialization of workflow scopes within MongoDB.

This ensures that workflow scopes, which are used to manage variables within a workflow, are correctly stored and retrieved from the database.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-04 09:46:20 +02:00
Sipke Schoorstra 9a82b8b66b
Add backward compatibility for WorkflowInstance.Name mapping in WorkflowStateMapper (#6767)
* Add backward compatibility for `WorkflowInstance.Name` mapping in `WorkflowStateMapper`

- Introduced constant `WorkflowInstanceNameKey` to handle legacy workflow instance name properties.
- Updated `MapWorkflowStateToWorkflowInstance` method to set `Name` property for older instances.

* Remove unused `Elsa.Workflows.Activities` import from `WorkflowStateMapper`

* Update src/modules/Elsa.Workflows.Management/Mappers/WorkflowStateMapper.cs

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-04 09:34:00 +02:00
Sipke Schoorstra ea9c94de7e
Add missing import for Flowchart.Models in MongoDbFeature 2025-07-03 22:24:37 +02:00
Sipke Schoorstra b8a04b11d1
Register FlowScope class map in MongoDB feature to handle serialization and ignore extra elements. (#6766) 2025-07-03 22:21:40 +02:00
lukhipolito-nexxbiz c4451c4f40
Feat/6732 zip archive activities (#6751)
* Io module and content strategies

* Restructuring the folders and projects

* Create zip activity + shared content resolver

* Fixing build on github.com

* Update src/modules/Elsa.IO/Services/ContentResolver.cs

explicit nullable field

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

* QoL improvements

* More QoL improvements + removing some logic duplications

* Update src/modules/Elsa.IO.Compression/Activities/CreateZipArchive.cs

avoiding duplicate extensions

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

* Assigning file path correctly to the variable

* More QoL changes, new Elsa.IO.Http module, more modular content strategy

* Addresing QoL review comments + Correct extension handling

---------

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-06-30 16:56:51 +02:00
Matt 2dbd050e64 Revert ChecklistItem back from Record to Class and remove left over RadioListActivity. Update Nuget packages. 2025-06-26 01:32:05 +01:00
Matt 4530dfd1f7 Refactor checklists and radio lists to use records
Converted `CheckList` and `CheckListItem` to records,
adding XML documentation for clarity. Updated properties
in `CheckListProps`, `RadioList`, and `RadioListItem`
with similar changes. Enhanced documentation in
`DropDownOptionsProviderBase` and modified
`RadioListOptionsProviderBase` to reflect new
functionality. Overall improvements for readability
and maintainability.
2025-06-26 01:30:39 +01:00
Matt b4fd26d523 Add radio list support and related UI components
- Renamed `CheckList` to `RadioList` in `RadioListProps`.
- Updated `WorkflowsFeature` to include `RadioListUIHintHandler` and `StaticRadioListOptionsProvider`.
- Introduced `TestRadioList` class for executing radio list functionality.
- Created `RadioList` and `RadioListItem` classes for managing radio list items.
- Added `RadioListOptionsProviderBase` for custom radio list data logic.
- Implemented `StaticRadioListOptionsProvider` for static radio list options.
2025-06-26 01:30:39 +01:00
Matt 776630a556 Create Api Client Models for upcoming RadioList UIHint. 2025-06-26 01:30:38 +01:00
raymonddenhaan e36b4976b4
Merge pull request #6741 from elsa-workflows/feat/6740
Fix Ancestor Faulting
2025-06-18 09:29:00 +02:00
Sipke Schoorstra ab6bb23df9
Update src/modules/Elsa.Workflows.Core/Extensions/WorkflowExecutionContextExtensions.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-14 13:00:45 +02:00
Sipke Schoorstra 54fcd9305b
Simplify exception handling logic in ExceptionHandlingMiddleware
- Removed `LogExceptionAndTransition` and `FaultAncestors` methods.
- Integrated exception fault handling with `ActivityExecutionContext.Fault()`.
2025-06-14 12:15:46 +02:00
Sipke Schoorstra 2cbcefee83
Remove HealActivity alteration and handler
- Deleted `HealActivity` alteration type and associated `HealActivityHandler`.
- Unregistered `HealActivity` from alteration services.
2025-06-14 12:15:34 +02:00
Sipke Schoorstra ce3a0b9ce0
Refactors alteration job dispatcher.
Refactors the background alteration job dispatcher to use a service scope
to resolve the alteration job runner. This ensures that the runner
is resolved within a scope, allowing it to utilize scoped services.
2025-06-14 11:38:25 +02:00
Sipke Schoorstra b860370d9d
Add HealActivity alteration and handler with workflow fault recovery support
- Introduced `HealActivity` alteration type for resolving faulted activity states.
- Added `HealActivityHandler` to manage execution of `HealActivity`.
- Enhanced `WorkflowExecutionContextExtensions` with `FindActivityExecutionContexts` method for locating activity execution contexts based on provided handles.
- Updated `AlterationHandlerContext` to enable custom commit actions during `Succeed` calls.
- Registered `HealActivity` and its handler in alteration services.
- Upgraded `ElsaStudioVersion` to `3.5.0-preview.1092`.
2025-06-13 20:35:19 +02:00
Sipke Schoorstra 607dc73e67
Fix ordering and pagination logic in FindManyAsync method for WorkflowExecutionLogStore
Reordered query operations to ensure consistent execution of `OrderBy` before `Paginate`, improving clarity and maintaining the expected query behavior.
2025-06-13 19:44:10 +02:00
Sipke Schoorstra 99370502dc
Refactor query composition to ensure proper ordering before pagination in WorkflowExecutionLogStore. 2025-06-13 19:43:46 +02:00
Sipke Schoorstra 0811a4042d
Merge remote-tracking branch 'origin/patch/3.4.1' into develop/3.5.0 2025-06-13 19:04:29 +02:00
Sipke Schoorstra c694a18c13
Enhances Mediator with Tenant Context Propagation (#6738)
* Update package versions in Directory.Packages.props

Upgraded multiple package dependencies to latest versions, ensuring compatibility, security, and access to the newest features.

* Refactor mediator pipeline to support tenant context propagation

- Introduced `TenantPropagatingMiddleware` to handle tenant context propagation during command execution.
- Added `SetupMediatorPipelines` hosted service for configuring mediator pipelines.
- Enhanced `CommandPipeline` and builder to allow middleware insertion, removal, and reordering.
- Updated `CommandContext` and related components to support headers for tenant context handling.
- Improved logging and refactored `BackgroundWorkflowDispatcher` to include tenant headers during command dispatch.

* Fix typos in XML documentation and improve middleware extension clarity

- Corrected duplicated slashes in XML doc comments in `ICommandSender.cs`.
- Refined phrasing in `MiddlewareExtensions.cs` to clarify method parameters and improve readability.

* Update src/common/Elsa.Mediator/Middleware/Command/Components/CommandLoggingMiddleware.cs

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-13 14:26:51 +02:00
Sipke Schoorstra 935d6987d5
Commits workflow state during alteration (#6736)
* Reduce default logging verbosity in appsettings.json

* Commit workflow state during alteration execution

Added `ICommitStateHandler` dependency and implemented workflow state commitment in `DefaultAlterationRunner` to ensure state persistence during alteration execution.
2025-06-13 08:30:02 +02:00
Sipke Schoorstra 623b75ed2c
Fix order of Order and Pagination (#6727)
* Refactor query composition to ensure consistent ordering and pagination logic.

Reordered method calls for `OrderBy` and `Paginate` across multiple stores to enhance readability and maintain consistent execution. Simplified redundant query operations for improved clarity and performance.

* Updates Elsa Studio version to 3.4.0

Updates the Elsa Studio version to the stable release.

Removes the preview tag from the version number.

* Move `ElsaStudioVersion` property to `Directory.Packages.props` for centralized management.
2025-06-12 09:25:43 +02:00
Sipke Schoorstra 6eccb3540a
Update package versions (#6722)
* Update package versions

Updated multiple package versions to their latest release, including `Polly`, `Elastic.Clients.Elasticsearch`, `System.Text.Json`, and others.

* Remove duplicate package entry

* Fix case mismatch in package name for SQL Server migration dependency.

* Add `Proto.Cluster.AzureContainerApps` package version to dependencies

* Update Directory.Packages.props

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

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-11 09:48:00 +02:00
Sipke Schoorstra 33fecf4a0e
Update Docker image tags to v3-5-0-preview in GitHub workflows 2025-06-06 18:51:08 +02:00