Skip to main content

writeEventToService

Callable

  • writeEventToService(directory: string): (event: Event, service: { id: string; version?: string }, options?: { path: string }) => Promise<void>

  • Write an event to a service in EventCatalog.

    You can optionally override the path of the event.

    @example
    import utils from '@eventcatalog/utils';

    const { writeEventToService } = utils('/path/to/eventcatalog');

    // Write an event to a given service in the catalog
    // Event would be written to services/Inventory/events/InventoryAdjusted
    await writeEventToService({
    id: 'InventoryAdjusted',
    name: 'Inventory Adjusted',
    version: '0.0.1',
    summary: 'This is a summary',
    markdown: '# Hello world',
    }, { id: 'Inventory' });