kuzzleio / kuzzle

Open-source Back-end, self-hostable & ready to use - Real-time, storage, advanced search - Web, Apps, Mobile, IoT -
https://kuzzle.io
Apache License 2.0
1.44k stars 124 forks source link

Enable wildcarded events on before* or after* actions #1078

Closed ballinette closed 6 years ago

ballinette commented 6 years ago

For now, we can add listeners to kuzzle events like that

It could be useful to also configure pipe with prefixes wildcards (document:before* or document:after*), to trigger every actions of document controller, either before, or after the request.

Possible Solution

trigger method use [getWildardEvent(event)](https://github.com/kuzzleio/kuzzle/blob/master/lib/api/core/plugins/pluginsManager.js#L831] to get the related wildcarded event and trigger, for example, both document:beforeGet and document:* events.

We could, for example, change this method to use an additional optional parameter prefix (which can be either before or after), and return an array of wilcarded events (['document:*', 'document:before*'] if we call getWilcarderEvents('document:beforeGet', 'before')

Aschen commented 6 years ago

https://jira.kaliop.net/browse/KZL-291