Skip to main content

Function: getEvents()

getEvents(directory): (options?) => Promise<Event[]>

Defined in: events.ts:63

Returns all events from EventCatalog.

You can optionally specify if you want to get the latest version of the events.

Parameters

ParameterType
directorystring

Returns

Function

Parameters

ParameterType
options?{ attachSchema: boolean; latestOnly: boolean; }
options.attachSchema?boolean
options.latestOnly?boolean

Returns

Promise<Event[]>

Example

import utils from '@eventcatalog/utils';

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

// Gets all events (and versions) from the catalog
const events = await getEvents();

// Gets all events (only latest version) from the catalog
const events = await getEvents({ latestOnly: true });

// Get all events with the schema attached
const events = await getEvents({ attachSchema: true });