ContractSpec docs

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.

ContractEdgeSpec — Declarative Graph Edge Contract

ContractEdgeSpec is the declarative graph edge contract: a versioned, ownership-tagged wrapper around EdgeSpec for use in EntityRegistry and graph DataViewSpec sources.

field.key.label
ContractEdgeSpec — Declarative Graph Edge Contract
field.version.label
field.type.label
field.title.label
ContractEdgeSpec — Declarative Graph Edge Contract
field.description.label

ContractEdgeSpec is the declarative graph edge contract: a versioned, ownership-tagged wrapper around EdgeSpec for use in EntityRegistry and graph DataViewSpec sources.

field.tags.label
tech,contracts,entities,edge,graph
field.owners.label
field.stability.label
public

Purpose

`ContractEdgeSpec` pairs an `EdgeSpec` with standard ownership metadata so graph edges can be registered, versioned, and discovered the same way other ContractSpec contracts are.

Factory

import { defineContractEdge } from '@lssm-tech/lib.contracts-spec';

export const UserToProjectEdge = defineContractEdge({
  meta: {
    key: 'user-to-project',
    version: '1.0.0',
    description: 'A user owns zero or more projects.',
    stability: 'stable',
    owners: ['platform.core'],
    tags: ['graph'],
  },
  edge: { id: 'user-to-project', from: 'user', to: 'project', relation: 'has-many', cardinality: 'one-to-many', directed: true },
});

Registry

Register via `EntityRegistry`:

const registry = new EntityRegistry();
registry.registerEdge(UserToProjectEdge);

Related

`EdgeSpec` — the inline edge shape (see `entities/types.ts`)

`ContractEntitySpec` — entity-level wrapper that can declare edges inline

`EntityRegistry` — stores both entity and edge contracts