- engine.removeRule() now supports removing rules by name
- Added engine.updateRule(rule)
- Updates Typescript types to include
failureEventsin EngineResult.
- BREAKING CHANGES
- To continue using selectn syntax for condition
paths, use the newpathResolverfeature. Read more here. Add the following to the engine constructor:(fixes #205)const pathResolver = (object, path) => { return selectn(path)(object) } const engine = new Engine(rules, { pathResolver })
- Engine and Rule events
on('success'),on('failure'), and Rule callbacksonSuccessandonFailurenow honor returned promises; any event handler that returns a promise will be waited upon to resolve before engine execution continues. (fixes #235) - Private
rule.eventproperty renamed. Userule.getEvent()to avoid breaking changes in the future. - The
success-eventsfact used to store successful events has been converted to an internal data structure and will no longer appear in the almanac's facts. (fixes #187)
- To continue using selectn syntax for condition
- NEW FEATURES
- Engine constructor now accepts a
pathResolveroption for resolving conditionpathproperties. Read more here. (fixes #210) - Engine.run() now returns three additional data structures:
failureEvents, an array of all failed rules events. (fixes #192)results, an array of RuleResults for each successful rule (fixes #216)failureResults, an array of RuleResults for each failed rule
- Engine constructor now accepts a
- Allow facts to have a value of
undefined
- No changes; published to correct an accidental publish of untagged alpha
- Upgrade dependencies to latest
- Upgrade jsonpath-plus dependency, to fix inconsistent scalar results (#175)
- BUGFIX: Add missing
DEBUGlog for almanac.addRuntimeFact()
- BUGFIX:
DEBUGenvs works with cookies disables
- BREAKING CHANGES
- Rule conditions'
pathproperty is now interpreted using json-path- To continue using the old syntax (provided via selectn),
npm install selectnas a direct dependency, andjson-rules-enginewill continue to interpret legacy paths this way. - Any path starting with
$will be assumed to usejson-pathsyntax
- To continue using the old syntax (provided via selectn),
- Rule conditions'
- Export Typescript definitions (@brianphillips)
- BREAKING CHANGES
engine.run()now returns a hash of events and almanac:{ events: [], almanac: Almanac instance }. Previously in v3, therun()returned theeventsarray.- For example,
const events = await engine.run()under v3 will need to be changed toconst { events } = await engine.run()under v4.
- For example,
- Feature:
rule.setName()andruleResult.name
- Fix "localStorage.debug" not working in browsers
- Fix "process" not defined error in browsers lacking node.js global shims
- BREAKING CHANGES
- Previously all conditions with undefined facts would resolve false. With this change, undefined facts values are treated as
undefined.
- Previously all conditions with undefined facts would resolve false. With this change, undefined facts values are treated as
- Greatly improved performance of
allowUndefinedfacts = trueengine option - Reduce package bundle size by ~40%
- Replace debug with vanilla console.log
- Use Array.isArray instead of instanceof to test Array parameters to address edge cases
- Fix rules cache not clearing after removeRule()
- Upgrade all dependencies to latest
- IE8 compatibility: replace Array.forEach with for loop (@knalbandianbrightgrove)
- Engine.removeFact() - removes fact from the engine (@SaschaDeWaal)
- Engine.removeRule() - removes rule from the engine (@SaschaDeWaal)
- Engine.removeOperator() - removes operator from the engine (@SaschaDeWaal)
- Performance: Constant facts now perform 18-26X better
- Performance: Removes await/async transpilation and json.stringify calls, significantly improving overall performance
- Publish dist updates for 2.0.3
- Add factResult and result to the JSON generated for Condition (@bjacobso)
- Bugfix IE8 support
- Bugfix rule result serialization
- Publishing 2.0.0
- Fix fact path object checking to work with objects that have prototypes (lodash isObjectLike instead of isPlainObject)
- Add rule results
- Document fact .path ability to parse properties containing dots
- Bump dependencies
- BREAKING CHANGES
engine.on('failure', (rule, almanac))is nowengine.on('failure', (event, almanac, ruleResult))engine.on(eventType, (eventParams, engine))is nowengine.on(eventType, (eventParams, almanac, ruleResult))
- Bugfix almanac.factValue skipping interpreting condition "path" for cached facts
- Add fact comparison conditions
- Add
allowUndefinedFactsengine option
- Bump object-hash dependency to latest
- Rule event emissions
- Rule chaining
- Use Array.indexOf instead of Array.includes for older node version compatibility
- Fact path support
- Custom operator support
- fix issue #6; runtime facts unique to each run()
- fix issue #5; dependency error babel-core/register
- api stable; releasing 1.0
- engine.run() now returns triggered events
- Completed the 'fact-dependecy' advanced example
- Updated addFact and addRule engine methods to return 'this' for easy chaining
- Completed the 'basic' example
- [BREAKING CHANGE] update engine.on('success') and engine.on('failure') to pass the current almanac instance as the second argument, rather than the engine