A small functional Rule Engine - simple maybe an understatement...
History
- 02/08/16 Original Javascript without AI
- 06/25/24 New Typescript version with AI
Simplicity is elegance. This rule engine is NOT forward chaining, backward chaining, nor is this an inference engine. What it is, is a pragmatic reactive engine. Simply stated, when there is a condition, execute an action -- most assuredly in a stateless manner.
Prime directives, and ables ...
- Stateless
- Simple input, output, and process
- Asynchronous non-blocking invocations
- Rules to be self contained and serializable to a database (persistable)
- Rules to be versioned (versionable)
- Rules to be inventoried and stored in a library (sharable)
- Rules can be modified on-the-fly (adaptable)
- Rules can be unit tested independently (testable)
- Crazy fast
Much has changed in the last 9 years this simple example was created. We are in the AI Age and Prompts can do much of the work. It is the intention of this code to be used with AI prompts to generate versionalble rule-sets.
// Rule Abilities
{ables: [persistable, versionable, shareable, adaptable, testable, chainable, reusable, extensible]}
- Use your imagination
- Upgrade Existing Code
- Use AI
- Validations
- Mappings
- Calculations
- Batch processing
- Automated business rules - decision engine
- Automation of sequential events and process
- Home security, sprinkler systems, and darn maybe your car...
- Repository of rules
- Traceability
- Modify the rule not the code
- Dynamic changeability - conditions change so do the execution
- Easy to understand and modify
- Extensible
- Maintainable
- Reusable
- Chainable
- Micro foot print and scalable