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

nabladb

v2.0.2

Published

An Advance yet simple to use Database

Downloads

5

Readme

An Advance File System API

🏠 Homepage

Install

npm install nabladb

Ideology

This Simple Database allows you to quickly start a project where you needs database. The Database is self stored means it can exists inside the project structure. NablaDb uses object oriented approach to handle files and directories. NablaDb's First Priority is to make API type-safe and simple.

Quick Start

import NablaClient from 'nabladb';

const client = new NablaClient({
    verbose: 2,
    root: Path.join(process.cwd(), "test/.ndb"),
})

const db = client.db("my_app");

const users = db.collection("users");

users.insertSync([
    {
        email: "[email protected]",
        username: "test_user",
        password: "super_secret_hehe",
        verified_email: false
    },
    {
        email: "[email protected]",
        username: "test_user_2",
        password: "you_can_not_hack_me",
        verified_email: false
    }
])

console.log(users.getAllSync()) // [{ email: "[email protected]"...}, { email: "[email protected]"...}]

API

Types

import * as NablaClientTypes from 'filic/types/NablaClient';
import * as NablaDbTypes from 'filic/types/NablaDb';
import * as NablaCollectionTypes from 'filic/types/NablaCollection';

NablaClient

  • static NablaClient.create

    Allows to create NablaClient Instance

        import NablaClient from 'nabladb'
    
        const client = NablaClient.create(options?: NablaClientTypes.NablaClientOptions);
    • options: NablaClientTypes.NablaClientOptions
  • NablaClient.init

    Manually Initialize Client

    If NablaClientTypes.NablaClientOptions.autoInit is true, you don't need to run this function.

        client.init();
  • NablaClient.db

    Returns a NablaDb Instance

        const db = client.db(dbName: string, options?: NablaDbTypes.NablaDbOptions);
    • dbName: string
      • Name of the Database
    • options: NablaDbTypes.NablaDbOptions

NablaDb

const db = client.db(dbName, options?: NablaDbTypes.NablaDbOptions);
  • dbName: string

    • Name of the Database
  • options: NablaDbTypes.NablaDbOptions

  • NablaDb.create

    Create Database

    If NablaDbTypes.NablaDbOptions.autoCreate is true, you don't need to run this function.

        db.create()
  • NablaDb.delete

    Delete Database

        db.delete()
  • NablaDb.collection

    Opens a Collection Inside a database

        const collection = db.collection(collectionName: string, options?: NablaCollectionTypes.NablaCollectionOptions)
    • collectionName: string
      • Name of the Collection
    • options: NablaCollectionTypes.NablaCollectionOptions
  • NablaDb.exists

    Checks if Database exists

        db.exists // boolean
  • NablaDb.$DbDir

    Returns Filic.Directory Instance of directory of the database

  • NablaDb.$CollectionsDir

    Returns Filic.Directory Instance of directory of "collections" inside database directory

  • NablaDb.$DbJson

    Returns Filic.File instance of "<db>.json" file

  • NablaDb.Client

    Returns NablaClient Instance.


NablaCollection

    const collection = db.collection(collectionName: string, options?: NablaCollectionTypes.NablaCollectionOptions)
  • collectionName: string

    • Name of the Collection
  • options: NablaCollectionTypes.NablaCollectionOptions

  • NablaCollection.create

    Create Collection

    If NablaCollectionTypes.NablaCollectionOptions.autoCreate is true, you don't need to run this function.

        collection.create()
  • NablaCollection.delete

    Delete Collection

        collection.delete()
  • NablaCollection.insert

    Insert a single document

    collection.insertSync({
        key1: "value1",
        key2: {
            key3: true,
            key4: [6, 4, 6]
        }
    })
  • NablaCollection.insertMany

    Insert multiple documents

    collection.insertManySync([
        doc1,
        doc2,
        doc3,
        ...
    ])
  • NablaCollection.getAll

    Gets all documents in collection

    collection.getAllSync()
  • NablaCollection.getMany

    Find Many multiple documents where fields that match given condition object

    collection.getManySync({
        verified: false
    })
    // finds every document in the collection with `verified` that is `false`
  • NablaCollection.getMany

    Find First document where fields that match given condition object

    collection.getFirstSync({
        verified: false
    })
    // finds first document in the collection with `verified` that is `false`
  • NablaCollection.deleteFirst

    Delete First document with fields that match given condition object

    collection.deleteFirstSync({
        email: "[email protected]"
    })
  • NablaCollection.deleteMany

    Delete every document with fields that match given condition object

    collection.deleteManySync({
        expired: true
    })
  • NablaCollection.updateFirst

    Update first document with fields that match given condition object

    collection.updateFirstSync({
        password: "123"
    }, {
        password: "new_password"
    })
  • NablaCollection.updateMany

    Update every document with fields that match given condition object

    collection.updateManySync({
        password: "123"
    }, {
        bad_password_user: true
    })
  • NablaCollection.exists

    Checks if Collection exists

        collection.exists // boolean
  • NablaCollection.$CollectionJson

    Returns Filic.Directory instance of <collection>.json file in collections directory of database

  • NablaCollection.Db

    Returns NablaDb Instance


Author

👤 Henil Malaviya

🤝 Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!