Skip to content

Connectum API Reference / @connectum/core / defineCatalog

Function: defineCatalog()

defineCatalog<T>(record): Readonly<T>

Defined in: packages/core/src/serviceCatalog.ts:61

Build a ServiceCatalog from a literal record, preserving the literal key type for downstream inference. Equivalent to writing the record inline, but freezes the result and documents intent.

Throws CatalogConfigError if any key does not equal its descriptor's typeName — a mis-keyed entry would bypass the duplicate-typeName intent and break resolution by canonical type name.

Type Parameters

T

T extends Record<string, DescService>

Parameters

record

T

Returns

Readonly<T>

Example

ts
const catalog = defineCatalog({
  [OrdersService.typeName]: OrdersService,
  [InventoryService.typeName]: InventoryService,
});