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

@schemat/parser-typeorm

v0.2.1

Published

TypeORM parser for Schemat (entity decorators -> IR, static AST).

Readme

@schemat/parser-typeorm

TypeORM parser for Schemat: turns TypeORM entity classes into the canonical Schemat IR by statically parsing the TypeScript (via ts-morph) — it never connects to a database or runs your code.

Install

npm i @schemat/parser-typeorm

Usage

import { typeormParser } from "@schemat/parser-typeorm";

const ir = await typeormParser.parse({ projectPath: "." });

// Or point at specific entity files:
const ir2 = await typeormParser.parse({ projectPath: ".", files: ["src/user.entity.ts"] });

typeormParser implements the SchemaParser interface (detect + parse) from @schemat/core and returns an IRSchema.

Detection

Detects a TypeORM project when any of these hold:

  • typeorm is a dependency in package.json, or
  • a *.entity.ts file exists, or
  • any .ts file contains an @Entity( decorator.

What it maps

  • @Entity('name') classes → tables (name from the decorator arg / name option, else the class name)
  • @Column / @PrimaryColumn / @PrimaryGeneratedColumn / @CreateDateColumn / … → columns; reads nullable, unique, default, type, name/fieldName, length
  • @PrimaryColumn / @PrimaryGeneratedColumn → primary keys (@PrimaryGeneratedColumn('uuid') → uuid type)
  • @Column({ type: 'enum', enum: … }) → enums (identifier enums are resolved from enum X {} declarations; inline arrays get a synthetic <table>_<col>_enum name)
  • Relations → @ManyToOne/@OneToOne = the FK-owning side (mapped to one-to-many / one-to-one); @ManyToMany + @JoinTable = many-to-many; @OneToMany is skipped (it's the inverse of a @ManyToOne, avoiding a duplicate edge). Relation targets referenced by class (() => User) are resolved to that entity's real table name.

Limitations (v1)

  • Synthetic FK columns. TypeORM doesn't always name the join column in the decorator, so a relation's fromColumns uses the <property>Id convention and toColumns defaults to ['id']. Explicit @JoinColumn({ name, referencedColumnName }), non-id primary keys, and composite keys aren't read yet.
  • Unresolved relation targets are skipped. A relation to a class that isn't a parsed @Entity (e.g. in a file outside the parsed set) is dropped rather than emitted as an edge to a nonexistent table. Pass all entity files (the default walk includes them) to capture every relation.
  • Enums referenced across files. @Column({ type: 'enum', enum: SomeEnum }) resolves SomeEnum's values only when its enum declaration is among the parsed files; otherwise the enum is emitted with its name and empty values.
  • Column type falls back to the property's TS type when no type option is given (number, string, boolean, Date→timestamp).

License

MIT © Ali Reza Hamid