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 🙏

© 2024 – Pkg Stats / Ryan Hefner

db-one

v0.0.1-b

Published

DB-one - Database Model & API Generator built on top of Sequelize *****************************************************************

Downloads

6

Readme

DB-one - Database Model & API Generator built on top of Sequelize


DB One is a package for generating database APIs based on Sequelize model definitions.

Features

  • generates a complete set of methods for listing, creating, retrieving, updating and deleting items
  • methods for managing associations (setters, getters and inclusion flags)
  • allows for usage of middlewares via hooks, which can be used for extra data validation, permissions and logging
  • generation can be static or dynamic - it can either generate the class as a file you can include in your project or generate the methods dyncamically at runtime

DBGenerator and DBSessionFactory Classes

The two classes for generating custom DBSession classes both inherit from the DBModelLoader class. Inherited methods are for loading models and for internal

DBSession Main Class

To obtain this class customized for your database, you need to generate it either statically or dynamically. For static generation have a look at the DBGenerator section, for dynamic generation check out the DBSessionFactory class.

The DB Session is the main class you should be using as a user. It is built around the DB Core and provides methods for manipulating database entries. Each database table will have a set of methods based on the table / model name / (singular/plural). Some methods refer to a second model for associations /.

Additionally, there is a set of static methods.

The constructor can be built around an ownerId. An user table can be specified as well as a group table for user groups (they can be in a one-to-many or many-to-many relationshp). By default they are set to users and groups (model names user and group). If such a table is found and an ownerId is specified in the constructor session, an ownership chain will be established for each resource in the database (at query time). This is an important detail for permission middlewares.

Other Classes

DBCore

The DB Core database provides entity-level access to the database via generic functions. Normally you shouldn't have to do with this class. It stores model information, retrieves entity from the database, creates entities, stores associations.

Input