Skip to main content
New project sponsor 🪝Hookdeck: Serverless infrastructure for event-driven architecture. Learn more.

addServiceToDomain

Callable

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

  • Add an event/command to a service by it's id.

    Optionally specify a version to add the event to a specific version of the service.

    @example
    import utils from '@eventcatalog/utils';

    // Adds a service to the domain
    const { addServiceToDomain } = utils('/path/to/eventcatalog');

    // Adds a service (Orders Service) to the domain (Orders)
    await addServiceToDomain('Orders', { service: 'Order Service', version: '2.0.0' });
    // Adds a service (Orders Service) to the domain (Orders) with a specific version
    await addServiceToDomain('Orders', { service: 'Order Service', version: '2.0.0' }, '1.0.0');