Skip to main content

addEntityToService

Callable

  • addEntityToService(directory: string): (id: string, entity: { id: string; version: string }, version?: string) => Promise<void>

  • Add an entity to a service by its id.

    @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');