Skip to main content

addDataStoreToService

Callable

  • addDataStoreToService(directory: string): (id: string, operation: writesTo | readsFrom, dataStore: { id: string; version: string }, version?: string) => Promise<void>

  • Add a data store to a service by it's id.

    Optionally specify a version to add the data store to a specific version of the service.

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

    // Adds an data store to the service
    const { addDataStoreToService } = utils('/path/to/eventcatalog');

    // Adds a new data store (orders-db) that the InventoryService will write to
    await addDataStoreToService('InventoryService', 'writesTo', { id: 'orders-db', version: '2.0.0' });

    * // Adds a new data store (OrderComplete) that the InventoryService will read from
    await addDataStoreToService('InventoryService', 'readsFrom', { id: 'orders-db', version: '1.0.0' });