Skip to main content

getEvent

Callable

  • getEvent(directory: string): (id: string, version?: string, options?: { attachSchema?: boolean }) => Promise<Event>

  • Returns an event from EventCatalog.

    You can optionally specify a version to get a specific version of the event

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

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

    // Gets the latest version of the event
    const event = await getEvent('InventoryAdjusted');

    // Gets a version of the event
    const event = await getEvent('InventoryAdjusted', '0.0.1');

    // Get the event with the schema attached
    const event = await getEvent('InventoryAdjusted', '0.0.1', { attachSchema: true });