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

@dcsv-io/d2-error-codes-registry

v0.1.2

Published

<!-- Copyright (c) DCSV. Licensed under the Apache License, Version 2.0. -->

Downloads

186

Readme

@dcsv-io/d2-error-codes-registry

Merged cross-catalog error-code registry for D2. Aggregates every *-error-codes.spec.json catalog under contracts/ into a single frozen code → ErrorCodeInfo lookup table — so any consuming service can resolve a wire error code to its full metadata (httpStatus, semantic category, user-message TK key, factory name/shape, doc, domain) without importing the producer's catalog.

Install

pnpm add @dcsv-io/d2-error-codes-registry

Key facts

  • Generated: src/generated/error-code-registry.g.ts is auto-generated from the error-codes specs (sources committed) — do not hand-edit. Re-generate with pnpm --filter ts-codegen run codegen --force.
  • Leaf package: depends only on @dcsv-io/d2-i18n-abstractions + @dcsv-io/d2-i18n-keys; nothing depends up into it except boundary consumers (Edge/BFF).
  • Collision-safe: the emitter hard-fails at codegen time on any cross-catalog code collision (D2ERC004) or reserved-namespace violation (D2ERC005). No registry is emitted until violations are resolved.
  • Cross-runtime parity: mirrors DcsvIo.D2.ErrorCodes.Registry (.NET) — same 8 fields, same domain tokens, same category wire-strings.

API

import {
  errorCodeRegistry,
  type ErrorCodeInfo,
} from "@dcsv-io/d2-error-codes-registry";

// Resolve a wire code → full metadata (undefined on unknown code).
const info: ErrorCodeInfo | undefined =
  errorCodeRegistry.resolve("AUTH_JWT_EXPIRED");
if (info !== undefined) {
  info.code; // "AUTH_JWT_EXPIRED"
  info.httpStatus; // 401
  info.category; // "validation_failure"
  info.userMessageKey; // TK.auth.errors.UNAUTHORIZED (TKMessage)
  info.factoryName; // "JwtExpired"
  info.factoryShape; // "standard"
  info.doc; // "JWT is expired..."
  info.domain; // "auth"
}

// Membership check.
errorCodeRegistry.has("NOT_FOUND"); // true

// Iterate all registered codes.
for (const entry of errorCodeRegistry.all) {
  /* ... */
}

ErrorCodeInfo fields

| Field | Type | Source | | ---------------- | ----------------------- | -------------------------------------------- | | code | string | SCREAMING_SNAKE wire code | | httpStatus | number | HTTP status integer | | category | ErrorCategory | 9-value string-union (schema category) | | userMessageKey | TKMessage | Typed TK constant from @dcsv-io/d2-i18n-keys | | factoryName | string | PascalCase factory symbol | | factoryShape | ErrorCodeFactoryShape | 2-value string-union (standard / none) | | doc | string | Developer documentation text | | domain | string | Derived from spec filename (common/auth) |

Domain tokens

The domain field is derived from the spec filename:

  • contracts/error-codes/error-codes.spec.json"common"
  • contracts/auth-error-codes/auth-error-codes.spec.json"auth"
  • Future: contracts/geo-error-codes/geo-error-codes.spec.json"geo"

Build

pnpm --filter @dcsv-io/d2-error-codes-registry run build
pnpm --filter @dcsv-io/d2-error-codes-registry run test