feat(rule): support filter callback for rule events
Rule authors can now pass an optional callback to filter events before calling the listener.
Checklist
-
Documentation updated -
Change covered by a testcase -
Commit history cleaned (no WIP, fixups, etc)