Skip to content

Commit 7b4880f

Browse files
Merge branch 'master' into features/v7.3
2 parents 1f0dbb4 + 7604636 commit 7b4880f

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

docs/engine.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ engine.addOperatorDecorator('caseInsensitive', (factValue, jsonValue, next) => {
236236
return next(factValue.toLowerCase(), jsonValue.toLowerCase())
237237
})
238238

239-
engine.removeOperator('first');
239+
engine.removeOperatorDecorator('first');
240240
```
241241

242242
### engine.setCondition(String name, Object conditions)

src/rule.js

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class Rule extends EventEmitter {
101101
this.ruleEvent = {
102102
type: event.type
103103
}
104+
this.event = this.ruleEvent
104105
if (event.params) this.ruleEvent.params = event.params
105106
return this
106107
}

test/rule.test.js

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ describe('Rule', () => {
3030
expect(rule.priority).to.eql(opts.priority)
3131
expect(rule.conditions).to.eql(opts.conditions)
3232
expect(rule.ruleEvent).to.eql(opts.event)
33+
expect(rule.event).to.eql(opts.event)
3334
expect(rule.name).to.eql(opts.name)
3435
})
3536

@@ -52,6 +53,7 @@ describe('Rule', () => {
5253
expect(rule.priority).to.eql(opts.priority)
5354
expect(rule.conditions).to.eql(opts.conditions)
5455
expect(rule.ruleEvent).to.eql(opts.event)
56+
expect(rule.event).to.eql(opts.event)
5557
expect(rule.name).to.eql(opts.name)
5658
})
5759
})
@@ -322,6 +324,7 @@ describe('Rule', () => {
322324
expect(hydratedRule.conditions).to.eql(rule.conditions)
323325
expect(hydratedRule.priority).to.eql(rule.priority)
324326
expect(hydratedRule.ruleEvent).to.eql(rule.ruleEvent)
327+
expect(hydratedRule.event).to.eql(rule.event)
325328
expect(hydratedRule.name).to.eql(rule.name)
326329
})
327330

@@ -333,6 +336,7 @@ describe('Rule', () => {
333336
expect(hydratedRule.conditions).to.eql(rule.conditions)
334337
expect(hydratedRule.priority).to.eql(rule.priority)
335338
expect(hydratedRule.ruleEvent).to.eql(rule.ruleEvent)
339+
expect(hydratedRule.event).to.eql(rule.event)
336340
expect(hydratedRule.name).to.eql(rule.name)
337341
})
338342
})

types/index.d.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ export class Rule implements RuleProperties {
175175
constructor(ruleProps: RuleProperties | string);
176176
name: string;
177177
conditions: TopLevelCondition;
178-
event: Event;
178+
/**
179+
* @deprecated Use {@link Rule.event} instead.
180+
*/
181+
ruleEvent: Event;
182+
event: Event
179183
priority: number;
180184
setConditions(conditions: TopLevelCondition): this;
181185
setEvent(event: Event): this;

0 commit comments

Comments
 (0)