Skip to main content

Function: addEntityToService()

addEntityToService(directory): (id, entity, version?) => Promise<void>

Defined in: services.ts:517

Add an entity to a service by its id.

Parameters

ParameterType
directorystring

Returns

Function

Parameters

ParameterType
idstring
entity{ id: string; version: string; }
entity.idstring
entity.version?string
version?string

Returns

Promise<void>

Example

import utils from '@eventcatalog/utils';

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

// adds a new entity (User) to the InventoryService
await addEntityToService('InventoryService', { id: 'User', version: '1.0.0' });

// adds a new entity (Product) to a specific version of the InventoryService
await addEntityToService('InventoryService', { id: 'Product', version: '1.0.0' }, '2.0.0');