Commit graph

5414 commits

Author SHA1 Message Date
Sipke Schoorstra fdd4306d2d Refactor DeleteWorkflowTests to comment out redundant scopes.
Commented out unused service scopes to streamline the DeleteWorkflow tests in Elsa.Workflows. This change includes disabling associated calls and registry checks for scopes 2 and 3, focusing solely on scope1 operations.
2024-10-30 11:53:48 +01:00
Sipke Schoorstra 97e628161b Add signal removal upon timeout in SignalManager
Ensure that signals are removed from the dictionary when the timeout is reached in the `WaitForSignalAsync` method. This prevents memory leaks and maintains the integrity of the signal management system. Also, remove trailing spaces for cleaner code in the `Trigger` method.
2024-10-30 11:53:22 +01:00
Sipke Schoorstra a6ff1f5506
Refactor JS expressions for accessing secrets (#6070)
* Add support for secret accessor functions in JavaScript

Refactored the rendering and evaluation of JavaScript to include method definitions alongside existing properties. Enhanced secret handling by generating asynchronous accessor functions, improving the clarity and functionality of secret management in scripting.

* Refactor secret retrieval logic in JavaScript engine configuration

Refactored the code to use a dedicated method `ResolveSecretAsync` for secret retrieval, improving clarity and maintainability. Added a check to ensure that only active secrets are decrypted, enhancing robustness and error handling.

* Add SecretExpired notification and mediator to updater

Introduces a new SecretExpired notification class and integrates it within DefaultExpiredSecretsUpdater. The updater now sends a SecretExpired notification via the mediator upon expiring a secret.
2024-10-30 09:19:14 +01:00
Sipke Schoorstra 123a95c07c Refactor LocalScheduler task removal and disable multitenancy
Refactored `RemoveScheduledTask` and `RemoveScheduledTasks` in `LocalScheduler.cs` to improve consistency and correctness in task management. Disabled multitenancy in `Program.cs` by setting `useMultitenancy` to false.
2024-10-29 10:09:37 +01:00
Sipke Schoorstra d3d171f59f Refactor retention module to use recurring tasks
Replaced the CleanupHostedService with CleanupRecurringTask for better scheduling and simpler configuration. Converted several classes to use constructor-based dependency injection and streamlined some type assignments. Removed unneeded files and updated existing code to follow more concise conventions. This enhances maintainability and readability.
2024-10-29 08:36:31 +01:00
Sverre Winkelmans d899b674dc
Retention Module (#5344)
* Retention module

* Remove unused batch size

* Use ISystemClock instead of DateTime.Now

* Remove TargetFramework

* Use WorkflowInstanceManager

* Update using statement, remove cloneable from WorkflowInstanceFilter.cs

* Update project description and remove unnecessary properties

* Move to BackgroundService

* Generic retention module

---------

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2024-10-28 19:44:23 +01:00
Sipke Schoorstra 939fb95a97
Add multitenancy support for background tasks (#6059)
* Remove initial migrations

Deleted obsolete initial migration files from multiple databases: MySQL, SQL Server, SQLite, and PostgreSQL. This cleanup helps maintain a streamlined and updated migration history.

* Add Document base class and create tenant-specific indices

Introduced a new abstract `Document` base class to unify common properties. Implemented tenant-specific unique indices across multiple collections by including `TenantId` alongside `Id` to ensure uniqueness within tenant scopes.

* Remove outdated migration files

Deleted various migration files under MySql, PostgreSql, Sqlite, and SqlServer directories. This cleanup removes unnecessary schema definitions and helps to streamline the codebase.

* Refactor workflow identity assignment logic

Streamline workflow identity handling to ensure consistent assignment of Id, DefinitionId, and TenantId values. This change integrates tenant prefix and version suffix cleanly, enhancing clarity and maintainability.

* Enable multitenancy support

Added configuration for a new tenant (tenant-1) in appsettings.json and enabled multitenancy feature in Program.cs. This change allows the application to support multiple tenants, with specific configurations for each.

* Refactor route table update to run as startup task

Replaced `UpdateRouteTableHostedService` with `UpdateRouteTableStartupTask` to ensure route table updates are executed during application startup instead of as a hosted service. Updated configuration in `HttpFeature` and adjusted trigger validation logic in `ValidateWorkflowRequestHandler`.

* Add recurring task scheduling and single-node task support.

Introduce `IntervalExpressionType`, recurring task scheduling classes, and `SingleNodeTaskAttribute`. Update `RecurringTasksRunner` to handle schedules and add single-node task logic to `StartupTasksRunner`. Ensure proper namespace changes and configure sample recurring tasks.

* Refactor recurring tasks scheduling system

Replaced existing scheduling classes with a more modular and granular approach. Introduced new classes and interfaces like `ISchedule`, `CronSchedule`, `IntervalSchedule`, and `RecurringTaskScheduleManager`. Updated related methods and code to comply with the new design.

* Refactor background task management

Removed `ExpiredSecretsHostedService` and refactored it into a recurring task. Introduced `TaskExecutor` for shared task execution logic. Updated and renamed feature classes to better represent their purpose, improving task scheduling and execution management.

* Add BackgroundTask abstract class to Elsa.Common module

This new abstract class implements the IBackgroundTask interface with default methods for executing, starting, and stopping tasks asynchronously. It provides a basic framework for background task management in the Elsa.Common module.

* Switch to CreateAsyncScope in DefaultTenantScopeFactory

Updated the CreateScope method to use CreateAsyncScope instead of CreateScope. This change improves asynchronous handling of service scopes within the DefaultTenantScopeFactory class.

* Add tenant handling and move StartWorkers background task

Introduce ITenantAccessor in Worker class for multitenancy support. Rename and relocate StartWorkers service to BackgroundTask, ensuring smoother workflow initialization. Also, update the configuration to support Azure Service Bus connection string.

* Add tenant support and refactor ProtoActor client

Integrated ITenantAccessor in ProtoActorWorkflowClient class to handle multi-tenancy. Refactored methods in the client to support custom headers and added async disposable pattern in various services for proper resource management. Additionally, enabled Azure Service Bus and updated related documentation.

* Add support for custom headers in ProtoActor grain methods

Introduced a T4 template to generate grain methods with custom headers, enabling the use of tenant ID in requests. Updated `ProtoActorWorkflowClient` to employ these methods, removing redundant code and directly utilizing the client for various workflow operations.

* Add tenant middleware to MassTransit configurations

Introduced multitenancy middleware for MassTransit message handling. Added new message type `OrderReceived` and updated RabbitMQ setup in Elsa Server. Applied middleware to configure tenant data on send, publish, and consume operations.

* Add new product workflow and streamline ID handling

Introduced a new `RequestResponseWorkflow` for handling product requests. Simplified ID handling in `WorkflowBuilder` and `ClrWorkflowsProvider` by defaulting to empty strings and adding a version prefix. Enhanced `HttpWorkflowsMiddleware` to correctly parse full request paths.

* Remove redundant files and update configuration

Deleted unused files `Product.cs` and `RequestResponseWorkflow.cs` to clean up the codebase. Updated `Program.cs` configuration: switched MassTransitBroker to Memory and disabled multitenancy.

* Remove MultitenantRecurringTaskService and update AzureServiceBus

Removed `MultitenantRecurringTaskService` and adjusted related code for Azure Service Bus to work without it. This includes removal of tenant accessor dependency from `Worker` and cleanup of service configuration flags in `Program.cs`.

* Increase signal wait timeout to 10000 milliseconds.

Extended the default timeout for signal awaiting methods from 8000 to 10000 milliseconds. This change ensures more flexible and resilient waiting periods, reducing timeout occurrences in scenarios with longer processing times.

* Refactor scheduling service to be a background task

Renamed `CreateSchedulesHostedService` to `CreateSchedulesBackgroundTask` and refactored it to inherit from `BackgroundTask` instead of `BackgroundService`. Simplified the constructor by injecting the required dependencies directly, eliminating the need for a scoped factory.

* Refactor workflow version suffix formatting

Changed the version suffix format from `:v{version}` to `v{version}` and adjusted the ID concatenation accordingly. This improves consistency and readability of workflow IDs.

* Enable multitenancy support in Quartz scheduler

Added `TenantJobListener` to inject tenant context into jobs. Modified `QuartzWorkflowScheduler` to incorporate tenant IDs into job data maps and adjusted the configuration to acknowledge multitenancy settings.

* Remove ConfigureSchedulerHostedService and TenantJobListener

Consolidated tenant resolution logic into JobExecutionExtensions class. Updated ResumeWorkflowJob and RunWorkflowJob to use the new extension method for tenant retrieval. This simplifies the QuartzSchedulerFeature setup by removing the hosted service configuration.

* Refactor HTTP feature and update route table task

Move 'UpdateRouteTableStartupTask' from 'HostedServices' to 'Tasks' and update dependency injection configurations accordingly. Simplify 'DefaultRouteTableUpdater' by removing unnecessary options and tenant-agnostic settings from filters.

* Disable multitenancy in Program.cs

The useMultitenancy flag has been changed from true to false. This update affects the Elsa.Server.Web application configuration.

* Simplify variable usage in HttpWorkflowsMiddleware

Replaced 'fullPath' variable with 'path' to streamline code. This change enhances readability by reducing redundancy and ensures consistency in variable naming throughout the method.

* Enable multitenancy and refactor tenant handling logic

Enable multitenancy in the application and refactor tenant handling logic to use ITenantFinder and ITenantContextInitializer interfaces. Added header constants, updated middleware to use these interfaces, and moved extension methods to the appropriate namespace.

* Add input validation to user registration form

Implemented checks to ensure all required fields are filled and that input data adheres to format requirements. This change reduces errors and enhances form reliability.

* Remove unused import from TenantPrefixHttpEndpointRoutesProvider

This change cleans up the code by removing an unnecessary import statement. It improves code readability and reduces clutter, making future maintenance easier. The functionality remains unchanged.

* Rename filter scope to "tenantPublish" in Probe method

Updated the Probe method in TenantPublishMiddleware.cs to use "tenantPublish" instead of "tenantSend" for better clarity. Ensures consistency with the method's context and aligns with naming conventions.

* Refactor: Remove extraneous whitespace

Eliminate unnecessary whitespace in ProtoActorWorkflowClient.cs for cleaner code. This change helps maintain consistent formatting and improves readability.

* Refactor DefaultRegistriesPopulator for cleaner initialization

Converted constructor to use read-only fields directly, removing unnecessary instance variables. This change simplifies the code by reducing redundancy and making the constructor cleaner.
2024-10-28 19:38:24 +01:00
Sipke Schoorstra 7edfe188a7
Update packages (#6058)
* Update dependencies and refactor MongoDB usages to IQueryable

Updated MongoDB-related methods to use IQueryable instead of IMongoQueryable for better compatibility and cleaner code. Additionally, upgraded several dependencies and packages to newer versions, ensuring enhanced security and performance.

* Remove TargetFramework from MongoDb project file

The TargetFramework property has been removed from Elsa.MongoDb.csproj. This change is likely to allow for a more flexible build configuration or to delegate framework specification to a higher-level configuration.

* Update package versions in _build.csproj

Upgraded Azure.Identity to 1.13.1, NuGet.Packaging to 6.11.1, and Microsoft.Identity.Client to 4.66.1. These updates address vulnerabilities and ensure compatibility with dependencies.
2024-10-25 22:38:41 +02:00
Sipke Schoorstra fd92557469 Merge remote-tracking branch 'origin/patch/3.2.x' 2024-10-25 20:19:01 +02:00
Sipke Schoorstra ca78f73e0a
Introduce Log Persistence Strategy (#6057)
* Implement log persistence strategy management

Added interfaces, services, and strategies for log persistence. Introduced new endpoint to list available log persistence strategies. Updated configurations and dependency injections accordingly.

* Refactor log record methods to asynchronous

Updated methods for extracting and persisting log records to be asynchronous, enhancing performance and scalability. This change includes modifying interfaces and implementations for better async support in workflow execution logging.

* Remove commented code

* Support nullable values in ActivityState dictionaries

Update ActivityState to support nullable values by changing type to 'IDictionary<string, object?>'. Enhanced DefaultActivityExecutionMapper to handle multiple persistence strategies for logging inputs and outputs.

* Rename ShouldPersistAsync to GetPersistenceModeAsync

Refactor method names for log persistence strategies to improve readability and consistency. Added summary comments for clarification and removed redundant configurations from appsettings.json. Added implicit uses and updated namespaces for better maintainability.

* Refactor activity payload and output retrieval logic

Extract payload and output retrieval into `GetPayload` and `GetOutputs` methods respectively. This modularizes the code for better readability and maintainability, and allows for potential reusability of these methods in other parts of the codebase.

* Add new project reference and update PostgreSQL provider usage

Added a project reference to Elsa.Agents.Persistence.EntityFrameworkCore.PostgreSql in the test project file. Also modified the WorkflowServer setup to specify the assembly in the PostgreSQL provider configuration.

* Add agent persistence to WorkflowServer

Integrated agent support and persistence using PostgreSQL in WorkflowServer. This includes adding necessary project references and configuring agents in the workflow server setup.
2024-10-25 19:41:10 +02:00
Sipke Schoorstra fefe36f49a
Include $schema when exporting workflow definition (#6056)
* Refactor AdditionalConvertersConfigurator constructor

Simplify AdditionalConvertersConfigurator by using constructor injection directly in the class declaration. Also, annotate the class with [UsedImplicitly] to improve code clarity and maintainability.

* Update workflow serialization to be asynchronous

Refactor the workflow definition serialization to use asynchronous operations, improving efficiency and handling cancellation tokens. This change ensures the schema is correctly included in the serialized output.
2024-10-25 14:51:27 +02:00
Sipke Schoorstra cdea979cc5 Enable agent support and remove unused tenant configurations
Turned on agent support by setting `useAgents` to true in `Program.cs`. Also, cleaned up the `appsettings.json` file by removing configurations for tenants 'tenant-1' and 'tenant-2' which are no longer needed.
2024-10-23 19:20:31 +02:00
Sipke Schoorstra 32bd3ddfea Integrate improved workflow handling in bulk dispatch tests
Updated workflow creation and dispatching methods to streamline bulk dispatch tests. Modified signal triggering in `TriggerSignal` activity and upgraded `ElsaStudioVersion` for compatibility improvements. Removed unused imports for cleaner code structure.
2024-10-23 19:12:10 +02:00
Sipke Schoorstra 3208be7b89 Merge remote-tracking branch 'origin/blueberry' 2024-10-23 16:07:32 +02:00
Sipke Schoorstra 52516aa0ff
Fix Bulk Dispatch Missing Input (#6052)
* Remove outdated sample workflows and activities

Deleted CompositeExample, SampleWorkflow, and SlowActivity classes as they are no longer needed. These deletions help clean up the codebase and maintain relevance in the code structure.

* Handle null WorkflowBuilderType in ClrWorkflowMaterializer

Introduce a fallback NotFoundWorkflowbuilder class when WorkflowBuilderType is null. This ensures the MaterializeAsync method functions even if the provided context lacks a specific workflow builder type.

* Add merging of itemDictionary to input

This change ensures that the itemDictionary's contents are also merged into the input dictionary, preventing possible data loss. It builds on existing logic by adding an additional merge operation to incorporate all necessary data.

* Add new workflows to BulkDispatchWorkflows and modify tests

Introduce `FruitWorkflow` and `MixFruitsWorkflow` for bulk dispatch scenarios. Refactor `BulkDispatchWorkflowsTests` to include new tests and rename signals for clarity. Optimize `BulkDispatchWorkflows` activity by removing redundant dictionary merge.
2024-10-23 16:06:28 +02:00
Sipke Schoorstra 0c10113d7b Remove outdated database migration files
Deleted obsolete migration files from SQL Server, MySQL, and SQLite projects. This cleanup removes unused schema definitions and indexes, ensuring the repository remains up to date and free of unnecessary files.
2024-10-23 14:32:50 +02:00
Sipke Schoorstra 481570909a Disable multitenancy and agents
Multitenancy and agents have been disabled by setting `useMultitenancy` and `useAgents` to `false`. This change simplifies the current configuration by reducing the active features.
2024-10-23 14:08:39 +02:00
Sipke Schoorstra 9bc6371dc0 Merge remote-tracking branch 'origin/blueberry' 2024-10-23 12:13:06 +02:00
Sipke Schoorstra a0001d3891
Enhance error handling in PolymorphicObjectConverter (#6051)
Add null checks for `referenceResolver` in cases where `RefPropertyName` and `IdPropertyName` are being processed. This prevents potential null reference exceptions and ensures safer deserialization of objects.
2024-10-23 12:12:18 +02:00
Sipke Schoorstra b46d432579
Add JsonNode BSON serializer (#6043)
Introduce JsonNodeBsonConverter for BSON serialization of JsonNode objects. Update MongoDbFeature to register the new serializer, enhancing JSON handling within MongoDB serialization context.
2024-10-19 11:56:50 +02:00
Sipke Schoorstra a200412896 Update package versions to fix vulnerabilities
Upgrade various packages to their latest versions to address vulnerabilities and improve stability. This includes updates to Microsoft.Extensions, EntityFrameworkCore, and Npgsql among others.
2024-10-19 10:44:28 +02:00
Devin Lin 5311c81747
fix: missing DefaultHttpEndpointBasePathProvider registeration (#6040)
Add the missing registeration for DefaultHttpEndpointBasePathProvider

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2024-10-19 10:40:36 +02:00
Abhishek 7563abd103
Add Functionality to Copy Entire Path from HTTP Endpoint Activity #133 (#6037) 2024-10-19 10:39:57 +02:00
Sipke Schoorstra 61f9e2a59a Add version override for System.Text.Json
This change overrides the version of System.Text.Json due to vulnerabilities found in dependencies referencing older versions. This ensures better security and reliability in performance tests.
2024-10-18 12:39:16 +02:00
Sipke Schoorstra f6eccde968 Switch to project references from package references
Replaced package references for various Elsa modules with direct project references. This change aims to streamline dependency management and avoid issues related to differing package versions. Updated the solution file and Directory.Build.props accordingly to reflect the new paths.
2024-10-18 10:54:23 +02:00
Sipke Schoorstra 5cb7cbf66d Switch to project references from package references
Replaced package references for various Elsa modules with direct project references. This change aims to streamline dependency management and avoid issues related to differing package versions. Updated the solution file and Directory.Build.props accordingly to reflect the new paths.
2024-10-18 10:54:23 +02:00
Sipke Schoorstra bdaae64e72 Add base path providers and standardize tenant accessor property
Introduce DefaultHttpEndpointBasePathProvider and TenantPrefixHttpEndpointBasePathProvider to manage HTTP endpoint base paths. Update ITenantAccessor property from CurrentTenant to Tenant for consistency across the codebase.
2024-10-17 19:47:55 +02:00
Sipke Schoorstra b8ab05ce2e Refactor WorkflowInstancesFeature class constructor
Updated the WorkflowInstancesFeature class constructor to remove an unnecessary method override, simplifying the class design. This change enhances code readability and maintains the same functionality.
2024-10-17 08:52:07 +02:00
Devin Lin 2eee58af66
fix: register SerializedKeyValuePair.Key to BsonClassMap (#6036)
Manually register SerializedKeyValuePair.Key to BsonClassMap to prevent index creation failure.
2024-10-16 19:20:17 +02:00
Sipke Schoorstra 99ab5e4ba1 Refactor StopAsync method to return completed task
Modified the StopAsync method to directly return a completed task instead of running through tenants asynchronously. This change simplifies the shutdown process and removes redundant tenant processing during service stop.
2024-10-15 23:47:17 +02:00
Sipke Schoorstra 225ad49ea8
Improved multitenancy support for HTTP workflows with per-tenant DbContext (#6032)
* Refactor: Update namespaces and add TenantExtensions

Updated namespaces throughout the project to improve clarity and consistency by moving from 'Common' to appropriate modules. Added TenantExtensions class to simplify fetching connection strings for tenants.

* Implement multitenant DB connection strings

Redesign tenant-specific classes to support multitenancy more effectively. Introduce `MultitenantBackgroundService` and `MultitenantHostedService` for handling tasks per tenant.

* Refactor constructors and remove redundant code

Simplified the constructor parameters for `MultitenantBackgroundService` and `List` class. Removed the unused parameter in `MultitenantBackgroundService` and redundant folder inclusion in the project file. Updated the method calls to use direct parameters in `List` class.

* Remove unused import in ActivityDescriptors Endpoint

The Elsa.Common.Multitenancy import was removed as it is unused in the List/Endpoint.cs file. Removing unused imports helps to improve code readability and maintainability. This change does not affect functionality.
2024-10-15 23:16:50 +02:00
Sipke Schoorstra 7e7a899bbf
Implement multitenant HTTP routing (#6031)
* Add tenant awareness to bookmark handling and route resolution

Added tenant ID support across various components, including bookmark updates, route resolution, and middleware processing. This ensures that bookmark and route operations can now appropriately handle tenant-specific data, improving the system's multitenancy capabilities.

* Add Multitenant HTTP Routing feature to Tenants module

Introduced a new MultitenantHttpRoutingFeature class to the Elsa.Tenants.AspNetCore module, enhancing the tenant resolution capabilities. Moved RoutePrefixTenantResolver from Elsa.Http to Elsa.Tenants.AspNetCore and updated relevant project references and namespaces accordingly. This refactor improves modularity and separation of concerns between HTTP and tenancy features.

* Refactor route handling and tenant configuration

Removed redundant `RouteTableExtensions` and replaced with new route providers and updaters, enhancing flexibility and modularity. Introduced tenant-specific HTTP endpoint configurations for better customization and configuration management.

* Rename HttpEndpointBookmarkStimulus to HttpEndpointBookmarkPayload

Refactor various classes and methods to reflect the renaming from `HttpEndpointBookmarkStimulus` to `HttpEndpointBookmarkPayload`. Add and configure new extension methods for tenant route handling, update the route provider to support multi-tenancy, and adjust the tenants provider to bind configuration properly.

* Add HeaderTenantResolver and refactor Http namespace.

Introduce HeaderTenantResolver to resolve tenants via HTTP headers. Refactor multiple classes and interfaces to move from the Elsa.Http.Models namespace directly into Elsa.Http for clarity and consistency.

* Add Host-based tenant resolution

Implemented a HostTenantResolver to resolve tenants based on the request's host and updated tenant configurations with host information. Modified the tenant resolver pipeline and added the new host resolver to the service registrations.

* Add tenant-aware caching and accessor support

Enhanced caching by incorporating tenant identifiers into cache keys for more granular cache management. Introduced ITenantAccessor dependencies in various services to retrieve the current tenant information. This ensures that cache entries are correctly isolated per tenant.

* Reorder tenant resolvers for pipeline setup.

Reordered the tenant resolvers in the pipeline to prioritize HostTenantResolver before RoutePrefixTenantResolver. This ensures that tenant resolution is correctly aligned with host-based resolving before checking the route prefix.

* Remove unused imports

This commit eliminates redundant `using` directives across multiple files to streamline the codebase. This cleanup helps improve code readability and maintainability by removing unnecessary dependencies.
2024-10-14 21:27:11 +02:00
jdevillard 9808020d57
Add db providers for secrets features (#6020)
* Add PostgreSql provider to Secrets

* Add SqlServer provider to Secrets

* fix sqlserver Method name

* resolve conflict Elsa.sln

* resolve conflict Elsa.sln

---------

Co-authored-by: Jérémie DEVILLARD <jdevillard@users.noreply.github.com>
2024-10-14 21:03:39 +02:00
Sipke Schoorstra 299f165978 Refactor project paths in solution files
Updated the paths for multiple projects in the solution files to better organize modules under a common directory structure. Modified project references in `ElsaX.Web.Server.csproj` to match the new directory structure. Added a label to an item group for clarity in `Elsa.Server.Web.csproj`.
2024-10-14 09:48:32 +02:00
Sipke Schoorstra 121bc52b07 Remove sample files.
Samples are moved to the elsa-samples repository.
2024-10-12 19:19:10 +02:00
Sipke Schoorstra 68f0bcb183 Update package references in Directory.Packages.props
Replaced hardcoded version of System.Text.Json with a variable. Added Microsoft.AspNetCore.DataProtection.Abstractions package for the net8.0 target framework.
2024-10-12 19:04:22 +02:00
Sipke Schoorstra 9928d56640 Merge remote-tracking branch 'origin/main' 2024-10-12 18:52:34 +02:00
Sipke Schoorstra b8f2bb5834 Update branch trigger in GitHub workflow
Changed the workflow trigger branch from 'blueberry' to 'main'. This ensures the workflow runs on pushes to the 'main' branch, aligning with our new branching strategy.
2024-10-12 18:52:01 +02:00
dependabot[bot] e90fe0a762
Bump System.Text.Json from 7.0.4 to 8.0.5 in /build (#6021)
Bumps [System.Text.Json](https://github.com/dotnet/runtime) from 7.0.4 to 8.0.5.
- [Release notes](https://github.com/dotnet/runtime/releases)
- [Commits](https://github.com/dotnet/runtime/compare/v7.0.4...v8.0.5)

---
updated-dependencies:
- dependency-name: System.Text.Json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-12 18:45:27 +02:00
Sipke Schoorstra a7d9ebc797 Update System.Text.Json to version 8.0.5 for all projects
Updated the System.Text.Json package to version 8.0.5 across multiple projects to address security vulnerabilities and ensure consistency. Additionally, modified the Directory.Packages.props to reflect the new version and added necessary overrides in various csproj files.
2024-10-12 18:42:16 +02:00
Sipke Schoorstra ee07b83e60 Merge remote-tracking branch 'origin/patch/3.2.x' 2024-10-12 12:30:41 +02:00
Sipke Schoorstra 1905918247 Update System.Text.Json package reference to use property variable
Switched from a hardcoded version to a property variable `$(SystemTextJsonVersion)` for the `System.Text.Json` package reference in multiple project files. This change centralizes version management and ensures consistency across all projects.
2024-10-12 12:27:54 +02:00
rosca-sabina 090a3fd1b0
Register MongoDb client as singleton (#6013)
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2024-10-12 12:21:39 +02:00
rosca-sabina 1b4ce452ee
Add MongoDB collection naming strategy (#6005) 2024-10-12 12:16:09 +02:00
Sipke Schoorstra a5cc3fc9e8
Refactor Tenant Resolution to Use Async Local Storage for Operation-wide Access (#6022)
* Remove obsolete tenant-related classes and add ASP.NET Core middleware

Refactored tenant resolution by removing obsolete interfaces and classes, such as `IAmbientTenantAccessor` and `ITenantResolutionStrategy`. Introduced new ASP.NET Core middleware for tenant resolution, encapsulated in the new `Elsa.Tenants.AspNetCore` project. Updated related usage in various parts of the application to align with these changes.

* Remove HttpContextTenantResolver.

Removed HttpContextTenantResolver from the multitenancy pipeline and related service registrations. This simplifies the tenant resolution by relying on remaining resolvers like ClaimsTenantResolver and RoutePrefixTenantResolver.

* Add Elsa solution definition file

This commit introduces the main solution file, Elsa.slnx, defining the folder structure, projects, and configuration for the Elsa repository. This includes folders for Docker, documentation, pipelines, samples, scripts, source code, and tests.

* Refactor DefaultAccessTokenIssuer for clarity and efficiency

Refactored the DefaultAccessTokenIssuer class by simplifying its constructor and utilizing scoped variables for token options. Improved token creation logic by adding a dedicated method to configure token options, enhancing code readability and maintainability.

* Remove Elsa.slnx solution file

No dotnet build support yet.

* Refactor tenant resolver service registrations

Updated the service registrations to use interfaces for DefaultTenantResolver and DefaultTenantResolverPipelineInvoker. This improves the code's flexibility, making it easier to replace or extend these implementations in the future.

* Add multitenancy support and tenant scope management

Introduced ITenantScopeFactory and related implementations for tenant scope management across the application. Enhanced the HTTP workflows middleware to handle tenants and updated relevant configurations and extension methods to support tenant resolution.

* Remove unnecessary folder inclusion

The <Folder> tag for "Modules\Modules\" was redundant and has been removed to clean up the project file. This change will not affect the existing functionality or project structure.

* Rename Create to CreateScope and improve authorization.

Updated the method name from Create to CreateScope for better clarity in the TenantScopeFactory. Fixed a logical error in the authorization process, ensuring proper status code setting for unauthorized requests, and refactored token expiration calculation for clarity.

* Add tenant agnostic filters and remove tenant setup

This commit introduces tenant agnostic filters in AutoUpdateTests to ensure workflows can trigger regardless of tenant. Additionally, it removes tenant configuration from WorkflowServer setup as it is no longer required for the current tests.
2024-10-12 12:08:09 +02:00
Sipke Schoorstra 4bf050788e Merge branch 'enh/multi-tenancy-refactorings' 2024-10-11 20:49:10 +02:00
Sipke Schoorstra 7417fc8738 Add OpenTelemetry middleware import to Program.cs
This change includes the addition of the `Elsa.OpenTelemetry.Middleware` namespace to `Program.cs`, enabling OpenTelemetry instrumentation and tracing. This is intended to improve observability and monitoring of the application.
2024-10-11 20:44:11 +02:00
Sipke Schoorstra f3961c0af5 Update namespaces and correct merge artefacts 2024-10-11 20:41:49 +02:00
Sipke Schoorstra ff487fad80 Merge remote-tracking branch 'origin/blueberry' into enh/multi-tenancy-refactorings 2024-10-11 19:45:40 +02:00
Sipke Schoorstra a70a199a78 Merge branch 'main' into enh/multi-tenancy-refactorings 2024-10-11 19:12:58 +02:00