Skip to main content

Events CLI Commands

Manage events in your EventCatalog from the command line.

getEvent​

Returns an event from EventCatalog by its ID

Arguments:

NameTypeRequiredDescription
idstringYesThe ID of the event to retrieve
versionstringNoSpecific version to retrieve (supports semver)
optionsjsonNoOptions object, e.g. {"attachSchema": true}

Examples:

# Get the latest version of an event
npx @eventcatalog/sdk getEvent "OrderCreated"

# Get a specific version
npx @eventcatalog/sdk getEvent "OrderCreated" "1.0.0"

getEvents​

Returns all events from EventCatalog

Arguments: None

Examples:

# Get all events
npx @eventcatalog/sdk getEvents

writeEvent​

Writes an event to EventCatalog

Arguments:

NameTypeRequiredDescription
eventjsonYesEvent object with id, name, version, and markdown

writeEventToService​

Writes an event to a specific service in EventCatalog

Arguments:

NameTypeRequiredDescription
eventjsonYesEvent object with id, name, version, and markdown
servicejsonYesService reference: {id, version?}
optionsjsonNoOptions: {path?, format?, override?}

rmEvent​

Removes an event by its path

Arguments:

NameTypeRequiredDescription
pathstringYesPath to the event, e.g. /InventoryAdjusted

Examples:

# Remove an event by path
npx @eventcatalog/sdk rmEvent "/InventoryAdjusted"

rmEventById​

Removes an event by its ID

Arguments:

NameTypeRequiredDescription
idstringYesThe ID of the event to remove
versionstringNoSpecific version to remove

Examples:

# Remove latest version
npx @eventcatalog/sdk rmEventById "OrderCreated"

# Remove specific version
npx @eventcatalog/sdk rmEventById "OrderCreated" "1.0.0"

versionEvent​

Moves the current event to a versioned directory

Arguments:

NameTypeRequiredDescription
idstringYesThe ID of the event to version

Examples:

# Version an event
npx @eventcatalog/sdk versionEvent "OrderCreated"

addFileToEvent​

Adds a file to an event

Arguments:

NameTypeRequiredDescription
idstringYesThe ID of the event
filejsonYesFile object: {content, fileName}
versionstringNoSpecific version to add file to

addSchemaToEvent​

Adds a schema file to an event

Arguments:

NameTypeRequiredDescription
idstringYesThe ID of the event
schemajsonYesSchema object: {schema, fileName}
versionstringNoSpecific version to add schema to

eventHasVersion​

Checks if a specific version of an event exists

Arguments:

NameTypeRequiredDescription
idstringYesThe ID of the event
versionstringYesVersion to check (supports semver)

Examples:

# Check if version exists
npx @eventcatalog/sdk eventHasVersion "OrderCreated" "1.0.0"

# Check with semver range
npx @eventcatalog/sdk eventHasVersion "OrderCreated" "1.0.x"