import utils from'@eventcatalog/utils'; const{ writeEvent }=utils('/path/to/eventcatalog'); // Write an event to the catalog // Event would be written to events/InventoryAdjusted awaitwriteEvent({ id:'InventoryAdjusted', name:'Inventory Adjusted', version:'0.0.1', summary:'This is a summary', markdown:'# Hello world', }); // Write an event to the catalog but override the path // Event would be written to events/Inventory/InventoryAdjusted awaitwriteEvent({ id:'InventoryAdjusted', name:'Inventory Adjusted', version:'0.0.1', summary:'This is a summary', markdown:'# Hello world', },{ path:"/Inventory/InventoryAdjusted"}); // Write a event to the catalog and override the existing content (if there is any) awaitwriteEvent({ id:'InventoryAdjusted', name:'Inventory Adjusted', version:'0.0.1', summary:'This is a summary', markdown:'# Hello world', },{ override:true}); // Write a event to the catalog and version the previous version // only works if the new version is greater than the previous version awaitwriteEvent({ id:'InventoryAdjusted', name:'Inventory Adjusted', version:'0.0.1', summary:'This is a summary', markdown:'# Hello world', },{ versionExistingContent:true});
Write an event to EventCatalog.
You can optionally overide the path of the event.