Events CLI Commands
Manage events in your EventCatalog from the command line.
getEvent​
Returns an event from EventCatalog by its ID
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the event to retrieve |
| version | string | No | Specific version to retrieve (supports semver) |
| options | json | No | Options 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:
| Name | Type | Required | Description |
|---|---|---|---|
| event | json | Yes | Event object with id, name, version, and markdown |
writeEventToService​
Writes an event to a specific service in EventCatalog
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| event | json | Yes | Event object with id, name, version, and markdown |
| service | json | Yes | Service reference: {id, version?} |
| options | json | No | Options: {path?, format?, override?} |
rmEvent​
Removes an event by its path
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| path | string | Yes | Path 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:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the event to remove |
| version | string | No | Specific 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:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the event to version |
Examples:
# Version an event
npx @eventcatalog/sdk versionEvent "OrderCreated"
addFileToEvent​
Adds a file to an event
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the event |
| file | json | Yes | File object: {content, fileName} |
| version | string | No | Specific version to add file to |
addSchemaToEvent​
Adds a schema file to an event
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the event |
| schema | json | Yes | Schema object: {schema, fileName} |
| version | string | No | Specific version to add schema to |
eventHasVersion​
Checks if a specific version of an event exists
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the event |
| version | string | Yes | Version 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"