Function: addEntityToService()
addEntityToService(
directory): (id,entity,version?) =>Promise<void>
Defined in: services.ts:517
Add an entity to a service by its id.
Parameters
| Parameter | Type |
|---|---|
directory | string |
Returns
Function
Parameters
| Parameter | Type |
|---|---|
id | string |
entity | { id: string; version: string; } |
entity.id | string |
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');