npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cleya/domain

v1.0.0

Published

Type-only contracts for graph regions, helpers and labels

Downloads

49

Readme

@cleya/domain

Public, type-only graph contracts. The package contains the graph label registry and the common region contract. It provides no runtime implementation.

Packages extending the registry must declare @cleya/domain as a peerDependency so all augmentations resolve to the same module identity. Their declarations must be included in the consumer's TypeScript program (for example through the declaring package's public type entry point).

import type { Domain, LabelsOf } from "@cleya/domain";

export interface ScreenNode extends Domain.Node.Base {
  _label: "Screen";
}

declare module "@cleya/domain" {
  export namespace Domain.Registry {
    export interface Node {
      "@example/navigation": ScreenNode;
    }
  }
}

type NodeLabels = LabelsOf<Domain.Node>; // "Screen"

Without registrations, nodes carry only _label: string and edges accept string labels for from and to. Once registered, the unions contain the declared types and edge defaults restrict endpoints to all registered node labels. Node columns and graph lifecycle remain the declaring packages' responsibility.

Region, helper and database contracts

Everything lives under the Domain namespace:

  • Domain.Region<Id, N, E> — a region's literal id, its node and edge unions, the regions it dependsOn (objects, not ids), its helpers, and migrateUp/migrateDown over a Domain.Db.Client. Domain.Region.Payload<R> is the { nodes, edges } shape a contributor hands the engine; payload edges carry fromId/toId.
  • Domain.Helper<I, O> — a named read operation with Standard Schema input/output, run against a Domain.Db.ReadClient. Helpers are found through the resolved regions, not through the registry.
  • Domain.Db — the query tagged template (every ${} is a prepared-statement parameter), fragment, and the Node<>/Edge<> shapes lbug returns.

bun run typecheck checks the source and three isolated compiler projects: an empty registry, a registry augmented independently by two packages, and the region, helper and database contracts.