Relationships
@schema-reflection/algebra
Know what points at what.
Someone deletes the send-welcome-email action. Two workflows still call it. Nobody notices until a new hire's first day passes without a single email.
Declare ids and references right on your Effect Schema fields. Algebra extracts the graph and reports duplicate ids and dangling references with exact paths — the same graph that powers rename, go-to-definition, and “what breaks if I change this?”
- Pricing plans that bundle features
- CMS entries that link to each other
- Workflows that call reusable actions
- Autocomplete and rename for ids in an editor
import { Schema } from "effect"
import { Relation } from "@schema-reflection/algebra"
const Action = Schema.Struct({
id: Relation.id("Action"),
label: Schema.String,
})
const Workflow = Schema.Struct({
id: Relation.id("Workflow"),
actionIds: Relation.refs("Action"),
})
const Workspace = Schema.Struct({
actions: Schema.Array(Action),
workflows: Schema.Array(Workflow),
})
Relation.validate(Workspace, config)
// → [{ code: "unresolved-ref", path: [...], message: ... }]Interactive simulation loads when this panel comes into view.