Commit graph

5176 commits

Author SHA1 Message Date
raymonddenhaan fbf3418544
Merge pull request #5896 from elsa-workflows/bug/5895
Add ExpandoObjectConverter for JavaScript object conversion
2024-08-14 09:42:10 +02:00
Sipke Schoorstra 71d56e1665 Add ExpandoObjectConverter for JavaScript object conversion
Introduced `ConverterHelper` and `ExpandoObjectConverter` to handle conversions from .NET dynamic objects to JavaScript objects. Updated integration tests to validate the conversion and sorting functionalities.

Fixes #5895
2024-08-13 19:58:18 +02:00
raymonddenhaan 0a9d4102c9
Merge pull request #5894 from elsa-workflows/fix/rename_ex_helpers
rename DbExceptionHandlers to better reflect their intent.
2024-08-13 15:12:27 +02:00
Raymond den Haan aa28329e47 rename DbExceptionHandlers to better reflect their intent. 2024-08-13 14:29:25 +02:00
Sipke Schoorstra c8669d1bc1
Add optional refresh parameter (#5876)
* Add optional refresh parameter

Renamed several `RefreshDescriptors` methods to `RefreshDescriptorsAsync` to reflect their asynchronous nature consistently. Added an optional refresh parameter in the `ListActivityDescriptorsRequest` class and updated related endpoints to handle this parameter, triggering a registry refresh if necessary.

* Update version to 3.2.0-rc5 in GitHub Actions

Modified the `packages.yml` workflow to change the version from `3.2.0-rc4` to `3.2.0-rc5` for non-tagged releases. This ensures version consistency with the new release candidate.
2024-08-12 09:42:25 +02:00
Sipke Schoorstra ef2dfd3957
Refactor journal data access and improve byte[] handling (#5878)
Switched to dictionary index access for "ResumeAt" in Delay.cs to ensure more efficient updating. Added handling for byte[] in ObjectConverter.cs to correctly deserialize from base64 strings.
2024-08-09 18:20:49 +02:00
rosca-sabina b6acb18dc6
Changed RegisterClassMap to TryRegisterClassMap on SerializedKeyValuePair classmap registration (#5877) 2024-08-09 18:14:09 +02:00
raymonddenhaan bf642cb6d8
Merge pull request #5869 from elsa-workflows/enh/db_error_handling
Add customizable DB exception handlers
2024-08-09 09:18:59 +02:00
Raymond den Haan 7341f1f93a Add customizable DB exception handlers
Introduced customizable database exception handlers across various modules, enabling specific error handling strategies for different DbContexts. Implemented a generic interface for exception handling and provided specific implementations for PostgreSQL and a No-op handler. Updated the code to utilize these handlers in various persistence features, enhancing error management and modularity.
2024-08-08 16:08:01 +02:00
Sipke Schoorstra 75175e120d Update elsa-v3-avatar.png 2024-08-07 21:13:41 +02:00
Sipke Schoorstra 659dd8f5ff Add new Elsa v3 avatar to design and update README
Introducing a new avatar image for Elsa 3.0. The README file has been updated to reference the new avatar image instead of the old logo art.
2024-08-07 21:09:39 +02:00
Sipke Schoorstra df9d0ca41f Add MyEvent activity to Elsa services
This change integrates the MyEvent activity into the Elsa Workflow engine configuration. It ensures that the MyEvent activity is available for workflows in the console application. This setup is essential for utilizing custom events within the application's workflow definitions.
2024-08-07 20:33:33 +02:00
raymonddenhaan 1437635903
Merge pull request #5860 from elsa-workflows/enh/engine_ex
Add engine exception handling middleware
2024-08-07 11:37:48 +02:00
Raymond den Haan 4f90ee71d9 Add TODO 2024-08-07 11:33:38 +02:00
Raymond den Haan 9f841c70c6 Fix logger type 2024-08-07 09:48:31 +02:00
Sipke Schoorstra 83d9f03288 Update ElsaStudioVersion to 3.2.0-rc4.473
This commit changes the ElsaStudioVersion property from 3.2.0-rc3 to 3.2.0-rc4.473 in the Directory.Build.props file. This update ensures compatibility with the latest features and bug fixes in the new release candidate version.
2024-08-06 23:42:15 +02:00
Sipke Schoorstra 1dd2c1c3d5 Update pre-release version in GitHub Actions workflow
The packages.yml file was modified to use version 3.2.0-rc4 instead of 3.2.0-rc3. This change ensures that the latest pre-release version is correctly set during the workflow execution.
2024-08-06 22:56:03 +02:00
Sipke Schoorstra d2fc7fb005
Rework Workflow Context Feature (#5861)
* Refactor workflow context extension structure

Removed unused WorkflowContextWorkflowDefinitionExtensions and renamed several extension and middleware classes for clarity and consistency. Simplified context provider type handling using JsonArray in custom properties.

* Refactor context provider and update email workflow

Refactored `CustomerWorkflowContextProvider` to use constructor parameter directly, removing redundant fields and constructors. Updated comments and list syntax in `CustomerCommunicationsWorkflow`. Improved README.md documentation for workflow contexts and context providers.

* Adjust logging levels and improve workflow logic

Modified `appsettings.json` to reduce the verbosity of logging by adjusting log levels. Updated `CustomerCommunicationsWorkflow` to include a timer activity and simplified the workflow context parameter setting.

* Remove PropertyBag and related functionalities.

Deleted the PropertyBag class and extension methods, and removed all instances where PropertyBag was utilized across various modules. This simplifies the workflow configuration and management by relying solely on CustomProperties for storing metadata.

* Add workflow context management extensions and optimizations

Introduces `WorkflowExecutionContextExtensions` for loading and saving workflow contexts more efficiently. Replaces `JsonArray` usage with `List<object>` for context provider types, simplifying the type management in the workflow execution context. Streamlines `WorkflowContextActivityExecutionMiddleware` by removing redundant service scope creation and enhancing readability.

* Remove redundant timer in CustomerCommunicationsWorkflow

The timer activity that was set to not start the workflow has been removed to streamline the workflow process. Updated the README to include instructions on how to start the CustomerCommunicationsWorkflow using the REST API or Elsa Studio.

* Refactor middleware to streamline context management

Removed dependency on `IServiceScopeFactory` and refactored middleware to directly load and save workflow contexts. Simplified workflow context provider invocation, enhancing code readability and maintainability.

* Remove redundant PropertyBag property

The PropertyBag property was commented out and is no longer needed in the WorkflowDefinition class. This change removes the commented-out code to clean up the class definition.

* Add JsonSerializerOptions for deserialization

Introduce JsonSerializerOptions with camelCase policy and case insensitivity for property names. This ensures consistent deserialization of custom properties in activity workflow context settings.
2024-08-06 22:36:24 +02:00
Raymond den Haan de4a4b3505 Add engine exception handling middleware
Integrate new EngineExceptionHandlingMiddleware into the workflow execution pipeline to catch and log exceptions outside of running workflow activity.
2024-08-06 13:54:02 +02:00
raymonddenhaan c413f210a9
Add activity execution log sink (#5833)
* Add activity execution log sink

Introduced an interface `IActivityExecutionLogSink` for storing workflow execution log records and implemented it as `StoreActivityExecutionLogSink`. This centralizes and streamlines the handling of persisting execution logs into the workflow's runtime, thus making the process more modular and maintainable. The `PersistActivityExecutionLogMiddleware` has also been refactored to use this sink, replacing the direct usage of the workflow execution log store.

* Refactor logging interfaces and implementations

Replaced specific logging interfaces and implementations with generic ones. The individual interfaces for workflow and activity execution logging have been replaced with a single ILogRecordExtractor and ILogRecordSink interface. Specific implementations have been adjusted to use these new interfaces. This allows for greater flexibility and reuse of logging code.

* Introduce ILogRecordStore interface

The `ILogRecordStore` interface has been introduced to provide a centralized place for handling log records. Both `IActivityExecutionStore` and `IWorkflowExecutionLogStore` have been updated to inherit from this new interface. As a result of this change, the `SaveManyAsync` methods in these two interfaces have been removed to avoid redundancy.
2024-07-24 22:30:14 +02:00
Mohamed Ali 53cb8e75c3
fix workflow context execution middleware and scrip completion (#5802) 2024-07-20 12:35:56 +02:00
Sipke Schoorstra c117ebaad1 Update ElsaStudioVersion in Directory.Build.props
Corrected the ElsaStudioVersion property to match the expected version format, removing the incorrect suffix. This ensures compatibility and proper version tracking in the build process.
2024-07-18 18:26:56 +02:00
Sipke Schoorstra e5ba9a8a9d Refactor scheduling and system clock configurations
Moved specific services from Scoped to Singleton in SchedulingFeature and SystemClockFeature for better performance and consistency. Refactored DefaultWorkflowScheduler to use a constructor with an IScheduler parameter and removed redundant private field. Removed attribute RequiresUnreferencedCode in WorkflowManagementFeature.
2024-07-18 16:00:49 +02:00
Sipke Schoorstra 68c6623555 Fix Workflow Reload Test and Update Activity Registry Logic
Unskip the test for workflow reload after updating the source provider and fix the issue with activity name formatting using Humanizer library. Ensure activity names are consistent for both workflow versions in the test.
2024-07-18 14:23:39 +02:00
Raymond den Haan 481545813d Skip failing test 2024-07-18 10:34:48 +02:00
Sipke Schoorstra 149f91e538
Update API endpoint for Polling Observer (#5787)
* Rename and refactor journal update endpoint

Replaced `/workflow-instances/{id}/journal/has-updates` endpoint with `/workflow-instances/{id}/updated-at` to simplify API responses. Deleted `HasUpdates` related classes and introduced `GetUpdatedAtResponse` for consistency and clarity. Updated client contracts accordingly.

* Remove HasUpdates endpoint and refactor workflow observer

Deleted the HasUpdates endpoint and refactored related code to use an updated timestamp approach instead. Improved nullable handling in WorkflowInstanceDesigner and ensured proper observer disposal to avoid memory leaks. Updated workflow observer factory and observer implementations to support observer names and enhanced logging.

* Rename updated workflow instance endpoint and handle execution state

Renamed the endpoint from "/updated-at" to "/execution-state" to better reflect its purpose. Updated related response models and documentation to capture workflow execution state details such as status, sub-status, and last updated timestamp.

* Enable SignalR for real-time workflows

Add a flag to use SignalR and activate real-time workflows when enabled. Refactor code to wrap SignalR setup in conditional checks based on the new flag. This enhances the application's interactivity through real-time capabilities.

* Remove obsolete endpoints and rename execution state paths

Deleted the outdated Api1 and DynamicWorkflows endpoints under Elsa.Server.Web. Also, renamed paths related to execution state models and endpoint to remove "Journal" from the namespace for better clarity and organization.
2024-07-18 07:51:46 +02:00
Sipke Schoorstra f448e9520a
Fix reloading logic for workflow definitions (#5781)
* Add reloading logic for workflow definitions

Introduced a new mechanism to handle reloaded workflow definitions. This includes creating a "ReloadedWorkflowDefinition" model, updating the caching logic, and modifying notification handlers to work with the enhanced workflow reloading logic. This ensures workflow definitions are updated and managed correctly when published, retracted, or deleted.

* Improve RefreshActivityRegistry documentation

Updated the XML documentation to clarify that `RefreshActivityRegistry` refreshes the `IActivityRegistry` for `WorkflowDefinitionActivityProvider` whenever workflow definitions are reloaded, instead of when they are published, retracted, or deleted.

* Add 'materializer' to user dictionary

The term 'materializer' has been added to the user dictionary to improve code spelling and naming consistency. This change ensures that 'materializer' is recognized as a correct term in the codebase.

* Organize test files by adding a 'Workflows' directory

Renamed 'http-workflow.json' to indicate it belongs under 'Workflows'. This improves file organization and clarity within the 'WorkflowDefinitionReload' scenario.

* Add TestWorkflowMaterializer and TestWorkflowProvider

Introduce `TestWorkflowMaterializer` for deserializing workflows from `TestWorkflowProvider`. Added integration of these new components in the `ReloadWorkflowTests` and `WorkflowServer`. Also renamed `RemoveReloadWorkflowTests` to `ReloadWorkflowTests`.

* Rename and expand workflow reload tests

Renamed `RemoveReloadWorkflowTests` to `ReloadWorkflowTests` to better reflect its purpose and expanded with additional test cases. Added tests to verify workflow and activity registry updates after source provider changes and workflow reloads.

* Update copy settings for workflow test scenarios

Reorganized and added 'CopyToOutputDirectory' settings for JSON files in workflow test scenarios. Ensured all necessary files are correctly included and copied during output directory builds to maintain test consistency.
2024-07-17 09:51:45 +02:00
raymonddenhaan ab8deafcc1
Merge pull request #5779 from elsa-workflows/fix/vuln_formats
Overwriting System.Formats.Asn1 due to vulnerability
2024-07-16 15:07:27 +02:00
Raymond den Haan 85c701e5d0 Overwriting System.Formats.Asn1 due to vulnerability 2024-07-16 15:04:46 +02:00
Mohamed Ali a0846effae
bugfixing issues related to new PropertyBag in workflow definition (#5778) 2024-07-16 14:54:20 +02:00
raymonddenhaan 49c0a29427
Merge pull request #5777 from elsa-workflows/fix/vuln_json
Overwritten System.Text.Json version due to vulnerability
2024-07-16 14:46:31 +02:00
Raymond den Haan a69492d521 Overwritten System.Text.Json version due to vulnerability 2024-07-16 14:31:20 +02:00
Sipke Schoorstra 9fb51c6cd0 Add functions to get workflow definition details
Introduced three new functions: `getWorkflowDefinitionId`, `getWorkflowDefinitionVersionId`, and `getWorkflowDefinitionVersion`. These functions provide easy access to specific workflow definition details within the JavaScript evaluator. Removed redundant constructor in CommonFunctionsDefinitionProvider to streamline the code.
2024-07-16 13:55:23 +02:00
Sipke Schoorstra f63f823e7b Update ElsaStudioVersion to 3.2.0-rc3.443.
This change updates the ElsaStudioVersion property to the latest release candidate. It ensures compatibility with recent updates and bug fixes provided in version 3.2.0-rc3.443.
2024-07-16 09:02:24 +02:00
Sipke Schoorstra 1a0d4714bd
Update activity ID reference in BroadcastWorkflowProgress (#5767)
Replaced the use of ActivityId with ActivityNodeId when retrieving distinct activity IDs. This change ensures that we are using the correct node identifier for logging workflow progress.
2024-07-16 07:58:27 +02:00
raymonddenhaan a96180ed8b
Merge pull request #5751 from elsa-workflows/enh/journal_polling
Added endpoint to poll for journal updates
2024-07-12 08:43:28 +02:00
MariusVuscanNx feb7da4d28
Implemented workflows reload endpoint (#5732)
* Implemented workflows reload endpoint

* Added componenent tests for reload

* Adjusted cache handling

* Made the refresh endpoint return refreshed and not found definitions

* Update test/component/Elsa.Workflows.ComponentTests/Scenarios/WorkflowDefinitionReload/RemoveReloadWorkflowTests.cs

Fix typo

Co-authored-by: raymonddenhaan <155616759+raymonddenhaan@users.noreply.github.com>

---------

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
Co-authored-by: raymonddenhaan <155616759+raymonddenhaan@users.noreply.github.com>
2024-07-12 08:35:46 +02:00
Raymond den Haan e52d716eaa Used DateTimeOffset instead of DateTime 2024-07-12 08:26:21 +02:00
Sipke Schoorstra 1c7a96034c Merge branch 'patch/3.2.x' of github.com:elsa-workflows/elsa-core into patch/3.2.x 2024-07-11 22:09:32 +02:00
Sipke Schoorstra 1c068373fd Refactor API client DI methods for cleaner configuration
Refactor `AddElsaApiKeyClient`, `AddElsaClient`, and related methods to improve readability and maintainability. Introduced `AddDefaultApiClientsUsingApiKey`, `AddDefaultApiClients`, and `AddApiClients` for a more structured approach, consolidating redundant code and ensuring better configurability.
2024-07-11 22:09:13 +02:00
Raymond den Haan bd3797dea5 Fix datetime conversion when sending datetime to API endpoints 2024-07-11 15:18:17 +02:00
raymonddenhaan d777252e77
Merge pull request #5728 from elsa-workflows/enh/log_extractor
Add WorkflowExecutionLogRecordExtractor
2024-07-11 10:56:14 +02:00
Raymond den Haan 99c0797438 Add endpoint for checking for journal updates 2024-07-11 10:34:09 +02:00
Sipke Schoorstra 7e29472b87 Merge branch 'patch/3.2.x' of github.com:elsa-workflows/elsa-core into patch/3.2.x 2024-07-10 19:48:10 +02:00
Sipke Schoorstra dc4f904108 Update workflow revert to return summary and location
Enhanced the Revert endpoint to return a summary of the newly created workflow definition and include its location. Adjusted the API contract and endpoint configuration accordingly.
2024-07-10 19:47:50 +02:00
raymonddenhaan c7b5caafdc
Added aliases for all missing types used in UI (#5743) 2024-07-10 18:38:11 +02:00
Sipke Schoorstra 59bc7bc6a2 Add caching modules to project references
Included Elsa.Caching.Distributed.MassTransit and Elsa.Caching.Distributed as project references in Elsa.ServerAndStudio.Web.csproj. This integration aims to enhance caching capabilities in the application.
2024-07-10 17:58:28 +02:00
Sipke Schoorstra 4d41cd743b Add DistributedCachingTransport enum
Introduced the DistributedCachingTransport enum to define caching transport options. Also cleaned up the code by removing an unnecessary using directive and a commented summary in the MassTransitBroker enum.
2024-07-10 15:32:01 +02:00
Sipke Schoorstra 073598c748 Remove obsolete project reference
Deleted the project reference to Elsa.Server.Web.csproj from Elsa.ServerAndStudio.Web.csproj. This reference is no longer needed and was causing redundancy in the project configuration.
2024-07-10 15:28:50 +02:00
Sipke Schoorstra 90fba5f4bf Update Docker image tags in GitHub workflows
Corrected Docker image tags in workflow files to ensure consistent naming conventions. This update affects elsa-server, elsa-studio, and elsa-server-and-studio YAML files.
2024-07-10 15:09:12 +02:00