Skip to main content

Function: writeCommandToService()

writeCommandToService(directory): (command, service, options) => Promise<void>

Defined in: commands.ts:154

Write an command to a service in EventCatalog.

Parameters

ParameterType
directorystring

Returns

Function

Parameters

ParameterType
commandCommand
service{ id: string; version: string; }
service.idstring
service.version?string
options{ format: "md" | "mdx"; override: boolean; path: string; }
options.format?"md" | "mdx"
options.override?boolean
options.path?string

Returns

Promise<void>

Example

import utils from '@eventcatalog/utils';

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

// Write an event to a given service in the catalog
// Event would be written to services/Inventory/commands/UpdateInventory
await writeCommandToService({
id: 'UpdateInventory',
name: 'Update Inventory',
version: '0.0.1',
summary: 'This is a summary',
markdown: '# Hello world',
}, { id: 'Inventory' });