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

@antelopejs/interface-database-decorators

v0.4.0

Published

AntelopeJS decorators for database tables and typed data models, with encrypted, hashed and localized fields

Readme

@antelopejs/interface-database-decorators

Database tables and data models as TypeScript classes, on top of @antelopejs/interface-database. Declare fields and indexes with decorators, then read and write rows through a typed model.

Part of AntelopeJS. Used by AntelopeJS DMS, the open-source back office for your PostgreSQL, MongoDB or RethinkDB database.

What it offers

  • Table, @RegisterTable, @Field, @Index and @Fixture declare tables, indexes and seed rows; RegisterSchema provisions them.
  • BasicDataModel and GetModel give each table typed CRUD methods with optional validation.
  • @Encrypted, @Hashed, @Localized, @CreationTime and @UpdateTime transform field values on write and read.
  • await row.setHashAsync(field, value) and await row.testHashAsync(field, value) hash a password off the event loop. Use them on a server: assigning a @Hashed field blocks the event loop for about 150 ms. See Table modifiers.
  • @Model injects a model into an @antelopejs/interface-api controller.

Implementations

The package runs in your module and has no implementing module of its own. The project needs a module that implements @antelopejs/interface-database:

| Module | Notes | | ------------------------------------------------------------------ | --------- | | @antelopejs/mongodb | MongoDB | | @antelopejs/rethinkdb | RethinkDB |

Install

Add the package to the module that declares tables:

pnpm add @antelopejs/interface-database-decorators

Then add a database module to the project:

ajs project modules add @antelopejs/mongodb

Quick start

import {
  BasicDataModel,
  Field,
  GetModel,
  Index,
  RegisterSchema,
  RegisterTable,
  Table,
} from "@antelopejs/interface-database-decorators";

@RegisterTable("recipes", "cookbook")
class Recipe extends Table {
  @Index()
  @Field("string")
  declare slug: string;

  @Field("string")
  declare tagline: string;
}

class RecipeModel extends BasicDataModel(Recipe) {}

export async function construct() {
  await RegisterSchema("cookbook");
}

export async function start() {
  const recipes = GetModel(RecipeModel);
  await recipes.insert({ slug: "grilled-halloumi", tagline: "Smoky skewers" });
  const [recipe] = await recipes.getBy("slug", "grilled-halloumi");
  await recipes.update(recipe._id, { tagline: "Smoky halloumi skewers" });
}

RegisterSchema creates every table registered for the schema and inserts their fixtures. Call it once, in the module that declares the tables.

Documentation

Compatibility

The package declares these @antelopejs/* peer dependencies:

| Package | Supported | Tested with | | -------------------------------- | ----------------- | ----------- | | @antelopejs/interface-api | >=0.0.15 <1.0.0 | 0.0.15 | | @antelopejs/interface-core | >=0.2.4 <1.0.0 | 0.4.0 | | @antelopejs/interface-database | >=0.1.11 <1.0.0 | 0.3.0 |

Contributing

Read CONTRIBUTING.md before you open a pull request. The local checks are:

pnpm install
pnpm lint
pnpm test

License

Apache-2.0