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

@game-infra/common-data-model

v0.2.0

Published

Generic narrative-content data model: codec registry, entity/schema-config types, maturity tiers. Games supply content via registries and config.

Readme

@game-infra/common-data-model

Generic data-model mechanism for narrative game content: a codec registry, entity/schema-config types (items, personas, organizations, cities), display and editor schema types, maturity tiers, event-JSON types, formation and objective types. Every file here is mechanism; games supply the actual content via value-level registries and config injection.

Published to npm. Also consumable as sibling source.

Install

"@game-infra/common-data-model": "link:../../game-infra/packages/common-data-model"
// or from npm
"@game-infra/common-data-model": "^0.1.0"

valibot is a peer dependency (^1.4.0).

Usage

The extension pattern is value-level registries + config injection, not module augmentation. A game defines extra codecs and merges them with the common set:

import { createCodecRegistry, commonPreconditionCodecs } from "@game-infra/common-data-model";
import { myGameCodecs } from "./codecs.js";

const registry = createCodecRegistry(
  [...commonPreconditionCodecs, ...myGameCodecs],
  "Precondition",
);
registry.get("HasItem"); // the common HasItem codec

Schema-config types (ItemSchemaConfig, PersonaSchemaConfig, EntityDisplaySchemaConfig, …) let a game supply a valibot schema plus UI metadata; editors render data-driven UI with compile-time key checking.

Tracking play state

The common*Codecs cover the state a game keeps as a number on the player — stats, skills, resources, items — plus whether a persona has been met, and the activations that move reputation, relationships and inventory in one direction. stateTrackingCodecs adds the rest of what a narrative game tracks, so the things an event can change are also things an event can gate on:

| Reads it | Writes it | | ----------------------------------------------------------------- | ----------------------------------------------- | | ReputationSufficient, ReputationBelow | ModifyReputation (common) | | RelationshipSufficient, PersonaMetStatusPrecondition (common) | ModifyRelationship (common), MarkPersonaMet | | KnowsSecret | LearnSecret | | HasCondition | ApplyCondition, RemoveCondition | | SkillSufficient (common) | ModifySkill | | ResourceSufficient (common) | ModifyResource, ConsumeResource | | HasItem (common) | RemoveItemFromInventory, ConsumeItem |

ConsumeResource and ConsumeItem are consumable conditions: checked before a choice is offered and paid when it is taken, which is what stops a choice that checks for ten and subtracts twelve.

They are opt-in — kept out of the common* arrays, because accepting a term is a promise to apply it, and a game whose engine has no notion of illness should not start validating events that inflict one:

import { createStrictEventSchemas } from "@game-infra/event-schemas";
import {
  commonActivationCodecs,
  commonPreconditionCodecs,
  stateTrackingCodecs,
} from "@game-infra/common-data-model";

const strict = createStrictEventSchemas({
  preconditions: [...commonPreconditionCodecs, ...stateTrackingCodecs.preconditions],
  activations: [...commonActivationCodecs, ...stateTrackingCodecs.activations],
  consumableConditions: [...stateTrackingCodecs.consumableConditions],
});

Each codec carries its params schema, its editor fields, its human-readable rendering and its AI instructions, so adopting the set gives the event editor forms for these terms and the generator prompts that use them.

Extension points

  • Codec registries — concatenate common*Codecs with game codecs, pass to createCodecRegistry (or EventEditorConfig.codecs).
  • Schema-config objects — provide a game valibot schema + display metadata.
  • State-tracking codecsstateTrackingCodecs, opt-in, for a game that tracks reputation, relationships, secrets or conditions.
  • Game-specific codecs (e.g. CastSpell, UseItem) live in the game's own data-model package, not here.

Dependencies

Peer valibot. No internal @game-infra/* deps.

Consumers

@game-infra/event-schemas (re-exports EntityInfo / AvailableEntities), event-editor, and game data-model packages.