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

database-adapter

v0.1.0

Published

An abstraction layer for database operation adapters

Downloads

4

Readme

database-adapter NPM version pipeline status

An abstraction layer for database operation adapters

Why?

Databases are a great thing. They come in many different ~~colors~~ shapes with a lot of different features but also, most importantly, different query mechanisms and languages.

This module is supposed to make stuff easier (just like a lot of other modules).

What?

Its goal is to define an abstraction layer you can implement your database operations in without the need to worry about the hassle of rewriting your code in case you should ever want to change the kind of database you're using for your project.

This module is still in an early stage and some parts of the tech inside may still not be as configurable and cool as you'd want them to be. If you're interested, please take your time to contribute to this project!

(Other) developers (or you yourself) can create NPM modules that function as peer dependencies which define database adapters using the interface in here to make your code do what it's supposed to do.

One use-case could be reading the string-typed handle of database adapters from a config file, allowing you to (pseudo-)hotswap your database model by installing another adapter module and simply replacing its key (and configuration) in your config file!

By default the database adapter tries to connect to the database, validates its scheme against whatever you pass it in its configuration object and then returns its object for you to use. In case something goes wrong, it can try to reconnect or repair itself (which could also just be creating the datastore for file-based database models).

How?

This code is written in TypeScript. Using its typings and inheritance functionality allows you to define nice adapters for various database models.

The source code of this module has an example for the awesome LokiJS datastore attached (even though it also supports adapters itself).

- View example -

I also turned that example adapter into an NPM module.

Roadmap

There's still stuff to do! Please do not hesitate to contribute!

  • Add abstract methods for default operations like inserting or querying data.
  • Add the plugin infrastructure mentioned above