Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

call Rule.ruleEvent by its correct name #404

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class Rule extends EventEmitter {
this.ruleEvent = {
type: event.type
}
this.event = this.ruleEvent
if (event.params) this.ruleEvent.params = event.params
return this
}
Expand Down
4 changes: 4 additions & 0 deletions test/rule.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('Rule', () => {
expect(rule.priority).to.eql(opts.priority)
expect(rule.conditions).to.eql(opts.conditions)
expect(rule.ruleEvent).to.eql(opts.event)
expect(rule.event).to.eql(opts.event)
expect(rule.name).to.eql(opts.name)
})

Expand All @@ -52,6 +53,7 @@ describe('Rule', () => {
expect(rule.priority).to.eql(opts.priority)
expect(rule.conditions).to.eql(opts.conditions)
expect(rule.ruleEvent).to.eql(opts.event)
expect(rule.event).to.eql(opts.event)
expect(rule.name).to.eql(opts.name)
})
})
Expand Down Expand Up @@ -322,6 +324,7 @@ describe('Rule', () => {
expect(hydratedRule.conditions).to.eql(rule.conditions)
expect(hydratedRule.priority).to.eql(rule.priority)
expect(hydratedRule.ruleEvent).to.eql(rule.ruleEvent)
expect(hydratedRule.event).to.eql(rule.event)
expect(hydratedRule.name).to.eql(rule.name)
})

Expand All @@ -333,6 +336,7 @@ describe('Rule', () => {
expect(hydratedRule.conditions).to.eql(rule.conditions)
expect(hydratedRule.priority).to.eql(rule.priority)
expect(hydratedRule.ruleEvent).to.eql(rule.ruleEvent)
expect(hydratedRule.event).to.eql(rule.event)
expect(hydratedRule.name).to.eql(rule.name)
})
})
Expand Down
3 changes: 2 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ export class Rule implements RuleProperties {
constructor(ruleProps: RuleProperties | string);
name: string;
conditions: TopLevelCondition;
event: Event;
ruleEvent: Event;
event: Event
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last thing, we should mark one of these as deprecated.
No reason to remove it until a v8 but we should be starting that process.

Copy link
Contributor Author

@emilefokkemanavara emilefokkemanavara Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we'll deprecate ruleEvent, right? (Because we want a Rule to still implement RuleOptions RuleProperties)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct.

priority: number;
setConditions(conditions: TopLevelCondition): this;
setEvent(event: Event): this;
Expand Down
Loading