* Update multitenancy logic and improve `Result` handling:
- Introduce `TenantsOptions` with `IsEnabled` flag to conditionally apply tenant-specific logic.
- Refactor `Result` class to support strongly-typed operations and async handlers.
- Implement tenant filters respecting multitenancy enablement.
- Enhance error logging for workflow definition addition, upgrading error handling.
- Refactor tests and storage drivers to use `IsSuccess` from `Result`.
* Update src/modules/Elsa.Workflows.Runtime/Services/DefaultWorkflowDefinitionStorePopulator.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add exception handling when accessing `Value` on failed results; introduce `ValueOrDefault` property for better null support.
* Add `ThrowIfFailure` method to handle exceptions in `Result` model and use it in `DefaultWorkflowRegistry` to ensure operation success.
* Normalize tenant ID handling by using `NormalizeTenantId()` in `DefaultWorkflowDefinitionStorePopulator`.
* Normalize tenant ID usage in unit tests by returning `tenantId.NormalizeTenantId()` in `DefaultWorkflowDefinitionStorePopulatorTests`.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 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.
Set ObjectConverter.StrictMode to true in the test constructor to enforce stricter conversion rules during tests. This ensures better reliability and consistency in test coverage.
* Add strict type checking for variable parsing
Introduced a `StrictMode` flag for variables, enforcing stricter type validation during parsing and conversions. Updated related methods and tests to reflect the stricter parsing behavior, ensuring consistent type compatibility and error handling.
* Refactor StrictMode handling and improve ObjectConverter logic
Moved StrictMode flag from Variable to ObjectConverter for better cohesion and updated related references. Additionally, removed unused parameters and simplified ObjectConverterOptions to streamline configuration and maintain consistency across the codebase.
* Refactor type conversion logic and update logging defaults
Improve type conversion reliability by introducing `TryConvertValue` and refining exception handling. Update JSON scenarios to use "Inherit" as the default for log persistence modes, ensuring consistency across configurations.
* Refactor exception handling in ObjectConverter.
Introduce a helper method `ReturnOrThrow` to streamline and centralize exception handling logic. This change also adds support for non-strict mode, allowing value fallback instead of throwing exceptions when enabled.
* Add numeric type checks and improve type conversion handling
Introduce `IsNumericType` extension method to identify numeric types. Enhance type conversion logic in `ObjectConverter` to handle numeric, boolean, and string types more accurately. Update variable deserialization workflows to handle conversion failures gracefully.
* Set a default comment for ObjectConverter.StrictMode assignment
Added a comment clarifying that StrictMode is set to its default value. This improves code readability and helps maintainers understand the intent.
* Fix formatting inconsistencies and improve code clarity
Removed redundant whitespace and adjusted formatting to align with coding standards. These changes enhance the readability and maintainability of the code without altering functionality.
* Fix typo in Program.cs variable comment
Corrected a minor issue in the comment for `identityTokenSection` to remove the unnecessary "Modify" text. This change improves code readability and removes potential confusion for developers.
* Simplify imports in ModifyVariableHandler.cs
Removed unused `Microsoft.Extensions.Options` and `Elsa.Workflows.Options` imports to clean up dependencies and improve maintainability. This change reduces clutter without affecting the existing functionality.
* Handle conversion of enumerables to arrays in ObjectConverter
Added functionality to convert enumerables to arrays when the target type is an array. The implementation ensures each item is properly cast to the target array's element type and then added to the resulting array.
* Add unit test for converting object array to double array
This commit introduces a new test ensuring the proper conversion of an object array of doubles to a double array. It verifies both the validity of the conversion and that the result is not null.
Refactored ObjectConverter to handle JSON array conversions more robustly, including support for arrays of complex types. Added a `Person` class for unit testing and updated tests to validate the new functionality. Included necessary project reference updates to ensure proper functionality.
Replaced InputProxy with alternative implementations, adding flexibility to handle inputs. Introduced a JsonElementConverter to deepen JavaScript and JSON element integration. Enhanced testing and object conversion logic, improving type handling and support for complex JSON scenarios.