Closed liorzam closed 2 weeks ago
Latest commit: dc70519aaaa6f3b926b5e725ae18ae32b52087d9
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
The changes enhance the rule engine within the workflows-service
by introducing extensive new functionality and structure. Key modifications include the integration of the RuleEngineModule
into the application's core module, the creation of custom error classes, and the development of various helper classes, schemas, enums, and type definitions. Together, these additions facilitate improved rule validation and error handling, laying a robust foundation for complex rule-based operations.
Files | Change Summary |
---|---|
services/.../src/app.module.ts |
Imported and included RuleEngineModule for initialization. |
services/.../src/rule-engine/core/errors.ts |
Introduced custom error classes: OperationNotFoundError , DataValueNotFoundError , MissingKeyError , and ValidationFailedError . Added EngineErrors type for handling specific errors. |
services/.../src/rule-engine/core/operators/constants.ts |
Added operationHelpers object mapping operations to helper functions. |
services/.../src/rule-engine/core/operators/enums.ts |
Introduced constants for operations and operators in the rule engine. |
services/.../src/rule-engine/core/operators/helpers.ts |
Defined various comparison operator classes extending BaseOperator , including Equals , GreaterThan , LessThan , and others. |
services/.../src/rule-engine/core/operators/schemas.ts |
Introduced schemas for different operations, such as PrimitiveSchema , BetweenSchema , LastYearsSchema , and ruleSchema . |
services/.../src/rule-engine/core/operators/types.ts |
Added type definitions for operators, like primitive , BetweenParams , and LastYearsParams , and detailed condition function types and mappings. |
services/.../src/rule-engine/core/rule-engine.ts |
Introduced functions validateRule and validateRuleSet for validating rules and rule sets. |
services/.../src/rule-engine/core/rule-engine.unit.test.ts |
Added tests for validating rule sets using mock data, covering different rules and expected outcomes. |
services/.../src/rule-engine/core/types.ts |
Introduced type definitions for operations, rules, rule sets, and validation results, such as TOperation , TOperator , Rule , and RuleSet . |
services/.../src/rule-engine/rule-engine.module.ts |
Created RuleEngineModule for providing and exporting RuleEngineService and RuleStoreService . |
services/.../src/rule-engine/rule-store.service.ts |
Added RuleStoreService class with a method findAll to retrieve RuleSet based on given parameters. |
In the world of code, a rabbit hops,
Bringing rules and constants to the crops.
With errors caught and schemas clear,
The logic flows without a fear.
Operators dance, comparisons cheer,
The rule engine's power now holds dear.
So code and dream, my friend, let's gear!
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Summary by CodeRabbit
New Features
Tests