Skip to main content

Function: entityHasVersion()

entityHasVersion(directory): (id, version?) => Promise<boolean>

Defined in: entities.ts:195

Check to see if the catalog has a version for the given entity.

Parameters

ParameterType
directorystring

Returns

Function

Parameters

ParameterType
idstring
version?string

Returns

Promise<boolean>

Example

import utils from '@eventcatalog/utils';

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

// returns true if version is found for the given entity and version (supports semver)
await entityHasVersion('User', '0.0.1');
await entityHasVersion('User', 'latest');
await entityHasVersion('User', '0.0.x');