Entities CLI Commands
Manage entities in your EventCatalog from the command line.
getEntity​
Returns an entity from EventCatalog by its ID
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the entity to retrieve |
| version | string | No | Specific version to retrieve |
Examples:
# Get the latest entity
npx @eventcatalog/sdk getEntity "Order"
# Get a specific version
npx @eventcatalog/sdk getEntity "Order" "1.0.0"
getEntities​
Returns all entities from EventCatalog
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| options | json | No | Options: {latestOnly?} |
Examples:
# Get all entities
npx @eventcatalog/sdk getEntities
writeEntity​
Writes an entity to EventCatalog
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| entity | json | Yes | Entity object with id, name, version, and markdown |
| options | json | No | Options: {path?, override?, versionExistingContent?} |
rmEntity​
Removes an entity by its path
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| path | string | Yes | Path to the entity |
Examples:
# Remove an entity
npx @eventcatalog/sdk rmEntity "/Order"
rmEntityById​
Removes an entity by its ID
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the entity to remove |
| version | string | No | Specific version to remove |
Examples:
# Remove an entity
npx @eventcatalog/sdk rmEntityById "Order"
versionEntity​
Moves the current entity to a versioned directory
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the entity to version |
Examples:
# Version an entity
npx @eventcatalog/sdk versionEntity "Order"
entityHasVersion​
Checks if a specific version of an entity exists
Arguments:
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | The ID of the entity |
| version | string | Yes | Version to check |
Examples:
# Check if version exists
npx @eventcatalog/sdk entityHasVersion "Order" "1.0.0"