@autofleet/events
v5.3.31
Published
Downloads
5,350
Maintainers
Keywords
Readme
V5 migration -
The breaking change in this version includes:
- The removal of '@autofleet/zehut' which was used in order to retrieve the user_id.
- The addition of the required
getUserIdfunction in the class constructor options. - The minimum node version is now 18.
this will make it easier managing updates to zehut as both packages are used in most of our micro services while keeping the focus on the functionality of sending events to pubsub solely.
instead of current implementation which relies on a specific zehut version to populate the user_id column
import Events from '@autofleet/events';
import logger from './logger';
export default new Events({ logger });a required getUserId function is introduced, in order to populate the user_id in the payload
import Events from '@autofleet/events';
import logger from './logger';
import zehut from '@autofleet/zehut';
export default new Events({
logger,
getUserId:() => zehut.getUser()?.id;
});
// or you can use parameters from the payload in order to populate instead
export default new Events({
logger,
getUserId: (payload) => (typeof payload.user_id === string && payload.user_id) || zehut.getUser()?.id;
});