defineDomain
defineDomain<
TDomain,TEvents,TCommands,TRpc>(domainName,definition):DomainDefinition<TDomain,TEvents,TCommands,TRpc>
Defined in: packages/hoppity/src/contracts/defineDomain.ts:50
Defines a domain and returns typed contract objects for all its operations.
The returned contracts are pure data — they carry metadata and derived topology properties (exchange, routingKey) but have no knowledge of RabbitMQ or rascal. Topology generation happens later in ServiceBuilder.
Accepts both bare Zod schemas and extended { schema, …options } objects for each operation, enabling future per-operation options (e.g. partitionBy) without a breaking API change.
Type Parameters
Section titled “Type Parameters”TDomain
Section titled “TDomain”TDomain extends string
TEvents
Section titled “TEvents”TEvents extends EventsDefinition
TCommands
Section titled “TCommands”TCommands extends CommandsDefinition
TRpc extends RpcDefinition
Parameters
Section titled “Parameters”domainName
Section titled “domainName”TDomain
The domain identifier. Used as a namespace for all generated topology artifact names. Must be non-empty.
definition
Section titled “definition”DomainDefinitionInput<TEvents, TCommands, TRpc>
The event, command, and RPC operation schemas for this domain.
Returns
Section titled “Returns”DomainDefinition<TDomain, TEvents, TCommands, TRpc>
A DomainDefinition with typed contract objects for each operation.