OSS-first docs
These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.
Purpose
`EntityRegistry` is the single runtime store for entity and edge contracts. It extends `SpecContractRegistry<'entity', ContractEntitySpec>` and adds a secondary edge map for named `ContractEdgeSpec` entries.
Initialization (C12 Precondition)
The registry **must** be initialized (entities and edges registered) before any graph `DataViewRenderer` reads entity slugs or edge relationships. Inline-edge-only views do not share this requirement.
API Summary
| Method | Description | |--------|-------------| | `register(spec)` | Register a `ContractEntitySpec` (inherited). | | `registerEdge(spec)` | Register a named `ContractEdgeSpec`. | | `list()` | List all entity specs (inherited). | | `listEdgeSpecs()` | List all named edge specs. | | `listEdges()` | Unified flat list of all `EdgeSpec` (inline + named). | | `get(key, version?)` | Retrieve entity spec by key (inherited). | | `getEdge(key, version?)` | Retrieve named edge spec by key. |
Example
const registry = new EntityRegistry([UserEntity, ProjectEntity]);
registry.registerEdge(UserToProjectEdge);
const edges = registry.listEdges();
// [{ id: 'user-to-project', from: 'user', to: 'project', relation: 'has-many', cardinality: 'one-to-many', ... }]