Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@naturalcycles/db-lib

Package Overview
Dependencies
Maintainers
3
Versions
301
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@naturalcycles/db-lib

Lowest Common Denominator API to supported Databases

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
103
decreased by-49.01%
Maintainers
3
Weekly downloads
 
Created
Source

@naturalcycles/db-lib

Lowest Common Denominator API to supported Databases

npm code style: prettier

Supported databases

  • datastore-lib (GCP Datastore, or Firestore in Datastore mode)
  • firestore-lib (Firestore in Native mode)
  • mysql-lib (MySQL)
  • redis-lib
  • mongo-lib

Features

  • CommonDB, CommonDao, DBQuery
  • Streaming (Node.js streams with backpressure)
  • DBM / BM, validation, conversion (Joi-powered)
  • Conventions
    • String ids
    • created, updated (unix timestamps)
    • Dates as ISO strings, e.g 2019-06-21
    • Timestamps as unixtimestamps (seconds, not milliseconds; UTC)
    • Complex objects as JSON serialized to string (DBM), converted to object (BM)

Concept

CommonDB is a low-level API (no high-level sugar-syntax). CommonDao is the opposite - a high-level API (with convenience methods), built on top of CommonDB.

Concerns of CommonDB:

  • Access to DB (all tables): CRUD (create, read, update, delete)
  • Batch methods (cause they can be more optimal if implemented "natively")
  • Querying
  • Streaming

Concerns of CommonDao:

  • Access to one DB Table ("kind")
  • Transformation between DBM and BM, validation/conversion
  • Auto-generating id, created, updated fields
  • Anonymization hook to be able to plug your implementation (privacy by design)

DEBUG namespaces

  • nc:db-lib:commondao
  • nc:db-lib:inmemorydb

Packaging

  • engines.node >= 10.13: Latest Node.js LTS
  • main: dist/index.js: commonjs, es2018
  • types: dist/index.d.ts: typescript types
  • /src folder with source *.ts files included

Keywords

FAQs

Package last updated on 19 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc