Skip to main content

@eventcatalog/sdk

EventCatalog SDK

The EventCatalog SDK provides methods to interact with domains, services, and messages.

Installation

npm install @eventcatalog/sdk

Usage

import utils from '@eventcatalog/sdk';

const { getEvent } = utils(PATH_TO_CATALOG);

// Get an event by the id
const event = getEvent('event-name');

// Get an event by the id and it's version
const event = getEvent('event-name', '0.3.4');

Functions

FunctionDescription
addDataStoreToServiceAdd a data store to a service by it's id.
addEntityToDomainAdd an entity to a domain by its id. Optionally specify a version to add the entity to a specific version of the domain.
addEntityToServiceAdd an entity to a service by its id.
addFileToCommandAdd a file to a command by it's id.
addFileToDataStoreAdd a file to a data store (e.g. database, cache, etc.) by it's id.
addFileToDomainAdd a file to a domain by it's id.
addFileToEventAdd a file to an event by it's id.
addFileToQueryAdd a file to a query by it's id.
addFileToServiceAdd a file to a service by it's id.
addMessageToChannelAdd an event/command/query to a channel by it's id.
addMessageToServiceAdd an event/command to a service by it's id.
addSchemaToCommandAdd a schema to a command by it's id.
addSchemaToEventAdd a schema to an event by it's id.
addSchemaToQueryAdd a schema to a query by it's id.
addServiceToDomainAdd a service to a domain by it's id.
addSubDomainToDomainAdd a subdomain to a domain by it's id. Optionally specify a version to add the subdomain to a specific version of the domain.
addUbiquitousLanguageToDomainAdds a ubiquitous language dictionary to a domain.
channelHasVersionCheck to see if the catalog has a version for the given channel.
commandHasVersionCheck to see if the catalog has a version for the given command.
dataStoreHasVersionCheck to see if the catalog has a version for the given data store (e.g. database, cache, etc.).
domainHasVersionCheck to see if the catalog has a version for the given domain.
dumpCatalogDumps the catalog to a JSON file.
entityHasVersionCheck to see if the catalog has a version for the given entity.
eventHasVersionCheck to see if the catalog has a version for the given event.
getChannelReturns a channel from EventCatalog.
getChannelsReturns all channels from EventCatalog.
getCommandReturns a command from EventCatalog.
getCommandsReturns all commands from EventCatalog.
getConsumersOfSchemaReturns the consumers of a given schema path.
getCustomDocReturns a custom doc from EventCatalog by the given file path.
getCustomDocsReturns all custom docs for the project.
getDataStoreReturns a data store (e.g. database, cache, etc.) from EventCatalog.
getDataStoresReturns all data stores (e.g. databases, caches, etc.) from EventCatalog.
getDomainReturns a domain from EventCatalog.
getDomainsReturns all domains from EventCatalog.
getEntitiesReturns all entities from EventCatalog.
getEntityReturns an entity from EventCatalog.
getEventReturns an event from EventCatalog.
getEventCatalogConfigurationFileReturns the event catalog configuration file. The event catalog configuration file is the file that contains the configuration for the event catalog.
getEventsReturns all events from EventCatalog.
getMessageBySchemaPathReturns a message from EventCatalog by a given schema path.
getOwnersForResourceReturns the owners for a given resource (e.g domain, service, event, command, query, etc.)
getProducersAndConsumersForMessageReturns the producers and consumers (services) for a given message.
getProducersOfSchemaReturns the producers of a given schema path.
getQueriesReturns all queries from EventCatalog.
getQueryReturns a query from EventCatalog.
getServiceReturns a service from EventCatalog.
getServiceByPathReturns a service from EventCatalog by it's path.
getServicesReturns all services from EventCatalog.
getSpecificationFilesForServiceReturns specification files for a service
getTeamReturns a team from EventCatalog.
getTeamsReturns all teams from EventCatalog.
getUbiquitousLanguageFromDomainReturns the ubiquitous language dictionary from a domain.
getUserReturns a user from EventCatalog.
getUsersReturns all users from EventCatalog.
isServiceCheck to see if the path is a service.
queryHasVersionCheck to see if the catalog has a version for the given query.
rmChannelDelete a channel at it's given path.
rmChannelByIdDelete a channel by it's id.
rmCommandDelete a command at it's given path.
rmCommandByIdDelete a command by it's id.
rmCustomDocDelete a custom doc by its' path
rmDataStoreDelete an data store (e.g. database, cache, etc.) at its given path.
rmDataStoreByIdDelete an data store (e.g. database, cache, etc.) by its id.
rmDomainDelete a domain at it's given path.
rmDomainByIdDelete a domain by it's id.
rmEntityDelete an entity at its given path.
rmEntityByIdDelete an entity by its id.
rmEventDelete an event at it's given path.
rmEventByIdDelete an event by it's id.
rmQueryDelete a query at it's given path.
rmQueryByIdDelete a query by it's id.
rmServiceDelete a service at it's given path.
rmServiceByIdDelete a service by it's id.
rmTeamByIdDelete a team by it's id.
rmUserByIdDelete a user by it's id.
serviceHasVersionCheck to see if the catalog has a version for the given service.
toServiceTakes a given raw file and converts it to a service.
versionChannelVersion a channel by it's id.
versionCommandVersion a command by it's id.
versionDataStoreVersion an data store (e.g. database, cache, etc.) by its id.
versionDomainVersion a domain by it's id.
versionEntityVersion an entity by its id.
versionEventVersion an event by it's id.
versionQueryVersion a query by it's id.
versionServiceVersion a service by it's id.
writeChannelWrite a channel to EventCatalog.
writeCommandWrite a command to EventCatalog.
writeCommandToServiceWrite an command to a service in EventCatalog.
writeCustomDocWrite a custom doc to EventCatalog.
writeDataStoreWrite a data store (e.g. database, cache, etc.) to EventCatalog.
writeDataStoreToServiceWrite an data store (e.g. database, cache, etc.) to a service in EventCatalog.
writeDomainWrite a domain to EventCatalog.
writeEntityWrite an entity to EventCatalog.
writeEventWrite an event to EventCatalog.
writeEventToServiceWrite an event to a service in EventCatalog.
writeQueryWrite a query to EventCatalog.
writeQueryToServiceWrite a query to a service in EventCatalog.
writeServiceWrite a Service to EventCatalog.
writeServiceToDomainWrite a service to a domain in EventCatalog.
writeTeamWrite a team to EventCatalog.
writeUserWrite a user to EventCatalog.
writeVersionedServiceWrite a versioned service to EventCatalog.