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

@trainheroic-unofficial/dto

v3.6.0

Published

Domain DTOs and zod schemas for TrainHeroic — the single source of truth for shapes.

Readme

@trainheroic-unofficial/dto

Domain DTOs and zod schemas for the TrainHeroic API. This package is the single source of truth for request and response shapes. The SDK, the MCP tool layer, and the CLI all import their types from here.

Part of the trainheroic-unofficial workspace.

Contents

Install

Published to npm as a single ESM entry with type declarations; other packages in this workspace depend on it via workspace:*. You can install it on its own:

npm install @trainheroic-unofficial/dto

It depends on zod (v4), pulled in automatically as a dependency. Each schema travels with its inferred type, so you validate and type from one import. .parse() throws a ZodError on bad data; use .safeParse() if you want a result object instead.

import { workoutSpecSchema, type WorkoutSpec } from "@trainheroic-unofficial/dto";

// `input` is untrusted data (e.g. a parsed JSON file or request body).
const spec: WorkoutSpec = workoutSpecSchema.parse(input);

It imports no node:* and touches no filesystem, so it runs in Node, browsers, and Cloudflare workerd.

What's inside

Schemas come in two flavors. Input schemas are strict enough to validate user-supplied data such as workout specs, exercise-create bodies, and message drafts. Response schemas are deliberately tolerant: they use loose objects and accept a number or a numeric string for ids, so upstream API drift adds fields without breaking parsing.

src/ is organized by domain (common, exercise, workout, messaging, responses), re-exported through index.ts. The central pieces:

  • idSchema normalizes the API's number-or-string ids.
  • workoutSpecSchema / WorkoutSpec is the input you hand to the SDK's workout encoder (the code in js that turns a spec into TrainHeroic's payload): an optional top-level instruction plus an array of blocks, where each block carries an exercises array and each exercise references an exercise-library id. blockSpecSchema and exerciseSpecSchema are its parts; leaderboardSpecSchema covers Red Zone leaderboards (TrainHeroic's competitive block type, where athletes are ranked on a score).
  • The read-back types (ReadResult, ReadBlock, ReadExercise) describe a session decoded back out of the API into a readable shape, and Advisory carries the unit notes and warnings the encoder emits (for example, a prescription whose unit does not match the exercise's parameter type).
  • The responses module holds the tolerant schemas the SDK uses to sanity-check an API response before trusting it; these schemas accept unknown fields.

Develop

Run pnpm install once at the repo root (Node >= 24, pnpm 11), then from this package:

pnpm build       # tsdown -> dist (ESM + .d.mts)
pnpm typecheck
pnpm test                                  # vitest
pnpm exec vitest run test/workout.test.ts  # one file