@xemahq/registry
v0.1.3
Published
Generic key-indexed registry data structure with fail-fast duplicate/missing-key errors. Zero runtime dependencies. Used by every Kernel package that needs a typed lookup table (orchestrator adapters, agent workspaces, opencode-client agent registry, biom
Readme
@xemahq/registry
Typed key-indexed registry with fail-fast lookups.
Overview
A tiny, generic registry data structure: a typed lookup table keyed by string.
Registering a duplicate key throws a structured error rather than silently
overwriting, and require fails loudly on a missing key instead of returning
undefined. It has zero runtime dependencies and serves as the building block
under the many typed catalogs across the Xema kernel.
When to use it
- Use it when you need an in-memory, strongly-typed lookup table whose duplicate and missing-key paths must fail loudly.
- Reach for it as a base class to specialize with your own key and entry types.
Installation
pnpm add @xemahq/registryUsage
import { Registry } from '@xemahq/registry';
const registry = new Registry<string, { key: string; label: string }>({
name: 'labels',
});
registry.register({ key: 'alpha', label: 'Alpha' });
const entry = registry.require('alpha'); // throws if absent
const all = registry.list();License
Apache-2.0 © Xema — xema.dev
