Skip to main content

Function: getEntity()

getEntity(directory): (id, version?) => Promise<Entity>

Defined in: entities.ts:27

Returns an entity from EventCatalog.

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

Parameters​

ParameterType
directorystring

Returns​

Function

Parameters​

ParameterType
idstring
version?string

Returns​

Promise<Entity>

Example​

import utils from '@eventcatalog/utils';

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

// Gets the latest version of the entity
const entity = await getEntity('User');

// Gets a version of the entity
const entity = await getEntity('User', '0.0.1');