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

writeDomain

Callable

  • writeDomain(directory: string): (domain: Domain, options?: { path: string }) => Promise<void>

  • Write a domain to EventCatalog.

    You can optionally overide the path of the domain.

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

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

    // Write a domain
    // Event would be written to domains/Payment
    await writeDomain({
    id: 'Payment',
    name: 'Payment domain',
    version: '0.0.1',
    summary: 'Domain for all things to do with payments',
    markdown: '# Hello world',
    });

    // Write a domain to the catalog but override the path
    // Event would be written to domains/Inventory/Payment
    await writeDomain({
    id: 'Payment',
    name: 'Inventory Adjusted',
    version: '0.0.1',
    summary: 'This is a summary',
    markdown: '# Hello world',
    }, { path: "/Inventory/Payment"});