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

dabatoric

v1.0.0

Published

NodeJS plain object data-base (Redis, Mongo) manipulation over object validation schemes

Readme

dabatoric

Overview

Provides a way to manipulate plain Object data in some data-bases:

Documentation

A pre-generated version of the documentation is located in ./artifacts/jsdoc/dabatoric/<VERSION>/index.html. Primarily check the globals namespace and the class DataModels.

WoW

Install with:

npm install dabatoric --save

The index of the modules exports functions:

  • init the mongo controller with initMongoController
  • init the redis controller with initRedisController

Mongo

Mongo instances save documents in collections. So, you insert:

{
    'a': 2,
    'b': 3,
    'id': 'ab'
}

... under the collection data-a with the query

{
    'id': 'ab'
}

Redis

For Redis, the term collection is mapped to a hash. So, if you insert:

{
    'a': 2,
    'b': 3,
    'id': 'ab'
}

... under the collection data-a with the query

'ab'

... you will get a hash named data-a with a key ab and the stringified object as the value.


For both instances, you need to define:

  • MongoDB/RedisDB URI
  • ObjectValidationScheme - user defined scheme as described (documentation)
  • Array<DataModelIdentifier> - array of identifiers as described (documentation)
  • Array<CollectionName> - strings to be used as Regular Expression as to validate a name of a collection on each action (documentation)

Example:

    const dabatoric = require('dabatoric'))
    let redisController = dabatoric.initRedisController(
        'redis://localhost:6379',
        {
            'content': {
                'videos': path to a user-defined object validation sheme,
                'images': path to a user-defined object validation sheme
            }
        },
        [
            'content.videos',
            'content.images',
        ],
        [
            'content\\-.*'
        ]
    );

And you have access to some DB actions:

  • find
    redisController.find([{
        'collection': 'content-images',
        'model': 'content.images',
        'query': '...'
    }, {
        'collection': 'content-images',
        'model': 'content.images',
        'query': '...'
    }], (results) => {
        ...
    });
  • insert only if the document does not exist
    redisController.insert([{
        'collection': 'content-images',
        'model': 'content.images',
        'query': '...',
        'data': { ... }
    }], (results) => {
        ...
    });
  • upsert; insert (if new) or modify (if existing); works with partial data if the document exists
    redisController.upsert([{
        'collection': 'content-images',
        'model': 'content.images',
        'query': '...',
        'data': { ... }
    }], (results) => {
        ...
    });
  • remove
    redisController.remove([{
        'collection': 'content-images',
        'model': 'content.images',
        'query': '...'
    }], (results) => {
        ...
    });

For all of those, the first parameter is a array of objects that describe the action:

  • collection to reference the collection (hash for Redis)
  • model to reference the model (as defined during the initialization)
  • query to identify the document:
    • for MongoDB is a query object
    • for RedisDB is a string that is a key in a hash (collection)
  • data - insert and upsert require data

No more than ten actions can be performed in one go. Each action is checked against the corresponding data-model. Callback result is always an array of individual results - check individual docs.

Additionally, you have:

  • getConnectionClient()
  • getDataModels()
  • closeConnection()
  • isReady()

There are some examples in the tests:

  • ./src/test/tests/data_base_controllers/mongo_test
  • ./src/test/tests/data_base_controllers/redis_test

Logging

The module has the capability to log to:

  • the terminal
  • the Linux system log

Terminal

The terminal logging is to be enabled with a environmental variable:

DBTRC_TERM_F=OK

Syslog

The Linux system log logging is to be enabled with a environmental variable:

DBTRC_SYSLOG_F=OK

To enable this, open /etc/rsyslog.conf and enable UDP on port 514. This is usually just commented and needs uncommenting:

# provides UDP syslog reception
module(load="imudp")
input(type="imudp" port="514")

... and restart the service with ./etc/init.d/rsyslog restart. The logs should appear in /var/log/syslog. This was tested on Ubuntu 16.04.

Source

The source is located on bitbucket

Tests

To run the tests, run (in the root of the project):

npm test

You need to have installed (and running) both Redis and Mongo locally on default URIS.

Besides unit, functionality and regression tests, a static analysis is performed with the help of plato module. This creates a folder ./artifacts/plato_analysis/. There, the file index.html is to be opened in a browser.