import { sorciEventFactory } from 'sorci';
import { v4 as createId } from 'uuid';
const SorciEvent = sorciEventFactory(() => createId());
const event = SorciEvent.create({
type: 'course-created',
data: {
courseId: '6c811e1c-a441-4dc0-af89-b92f6e1784ed',
name: 'Maths'
}
});
console.log(event.id); // 98e4654d-ff79-4636-854b-7f51fcf54988
This is a factory to create a SorciEvent class with a custom createId function