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

@esnark/typeorm-mapped-types

v1.0.0

Published

Mapped types (PickType, OmitType) for TypeORM entities

Readme

typeorm-mapped-types presents a new way to manage TypeORM entities. You can prototype entities that reflect actual database tables and create new entities appropriate for your domain as needed.

This module is based on @nestjs/mapped-types. However, unlike @nestjs/mapped-types, it does not support @nestjs/swagger but only the typeorm decorator. Future versions may include support for @nestjs/swagger.

Available mapped types:

  • PickType - constructs a new type (class) by picking a set of properties from an input type
  • OmitType - constructs a type by picking all properties from an input type and then removing a particular set of keys
  • ~~IntersectionType~~ - (Not implemented) combines two types into one new type

Install

npm install @esnark/typeorm-mapped-types

typeorm is a peer dependency, so it is whichever copy your project already has.

Compatibility

| | Supported | | --- | --- | | typeorm | 0.3.20 and above, including 1.x | | Node.js | whatever the typeorm version in use requires — >=16.13.0 for typeorm 0.3.x, ^20.19.0 \|\| ^22.13.0 \|\| >=24.11.0 for typeorm 1.x | | TypeScript | experimentalDecorators and emitDecoratorMetadata enabled, as typeorm itself requires |

Both typeorm lines are covered by CI at the oldest and newest version of each.

How to use

import { Column, PrimaryColumn } from 'typeorm';

export class UserModel {
  @PrimaryColumn()
  id: number;

  @Column()
  email: string;

  /** no need for most cases */
  @Column()
  privacyData: string;
}
import { PickType } from '@esnark/typeorm-mapped-types';
import { Entity } from 'typeorm';
import { UserModel } from './user-model';

@Entity('user')
export class QueriedUser extends PickType(UserModel, ['id', 'email'] as const) {}

What gets inherited

The mapped class receives the metadata the source class registered for the properties it keeps: @Entity table options, @Column, @PrimaryGeneratedColumn generation strategies, relations together with their @JoinColumn/@JoinTable configuration, standalone @ForeignKey constraints (typeorm 0.3.21 and above), @Index, @Unique, @Check, @Exclusion, embedded columns, entity listeners, and property initializers.

Constraints that cannot apply to the mapped class are left behind rather than copied, so the resulting schema stays valid:

  • an @Index or @Unique is dropped unless every property it references is kept;
  • a @Check or @Exclusion is dropped when its expression mentions a dropped column. Those expressions are raw SQL, so they are matched by column name — a constraint whose expression merely happens to contain the name of a dropped column is dropped too.

Known limitations

  • @Tree, @TableInheritance/@ChildEntity and @RelationId metadata is not inherited.
  • Table names are copied verbatim, so making an @Entity inherit from another @Entity produces two classes mapped to the same table. Source classes are meant to be plain, undecorated prototypes as in the example above.

Releasing

Releases are driven by the version in package.json. Once a commit carrying a version that is not yet on npm lands on main, .github/workflows/publish.yml lints, builds and tests it, publishes it to npm with provenance through trusted publishing, and creates the matching v<version> tag and GitHub Release. The release body is the ## <version> section of CHANGELOG.md, with the commit list GitHub generates appended below it.

Bumping the version is therefore the whole release process — there is no tag to push and no Release to create by hand. A push whose version is already on npm does nothing, so the workflow is safe to re-run.