0.1.0-b9 • Published 1 day ago

docorm v0.1.0-b9

Weekly downloads
-
License
MIT
Repository
github
Last release
1 day ago

DocORM

Data persistence manager for document-oriented data

Prerequisites

DocORM is compatible with Node 16 and higher.

Installation

Install the latest version from npmjs.com:

npm install docorm

If you need to use the latest version on GitHub instead, install it this way:

npm install docorm@git+ssh://github.com/bbi-lab/docorm

Setup

import cls from 'cls-hooked'
import {db, initDocOrm, registerEntityTypes, registerSchemaDirectory} from 'docorm'
import path, {dirname} from 'path'
import {fileURLToPath} from 'url'
import {v4 as uuidv4} from 'uuid'

import config from '../config.js'
import logger from './logger.js'

const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)

export async function initDataPersistence() {
 initDocOrm({
    logger // Optional Winston logger
    clsNamespaceName: 'arbitrary-namespace-name',
    operationIdKey: 'operation-id',
    postgresql: {
      host: 'localhost',
      port: 5432,
      username: 'postgres',
      password: 'postgres',
      database: 'my_database',
      allowUnknownSslCertificate: true,
      ssl: true
    }
  })
  await registerSchemaDirectory(path.join(__dirname, 'models-directory'), 'model')
  await registerEntityTypes(path.join(__dirname, 'schemas-directory'))
}

Configuration

Features

  • Data models based on JSON Schema
  • A JSON-based query language suitable for exposure in APIs
  • Relationship fetching
  • Two query execution modes: immediate execution and streaming query execution using database cursors

Database support

Currently, only PostgreSQL 13 and higher are supported.

Schemas

Data model schemas adhere to JSON Schema, with some limitations and some extensions.

Supported and unsupported JSON Schema keywords

Applicator keywords

Supported:

  • allOf

Unsupported:

  • oneOf and anyOf
  • if, then, else, and not
  • properties, patternProperties, and additionalProperties
  • dependentSchemas
  • propertyNames
  • prefixItems
  • contains

Validation keywords

Any validation keywords may be used, but currently only the following keywords are used in DocORM's built-in validation. Your own code may add support for other validation keywords.

  • type
  • enum

Metadata keywords

All metadata keywords are allowed, but these do not entail any behavior in DocORM.

Data models

Queries

Data storage

Connection management

Running queries

Use of JSON paths

JSONPath, JSON pointers, and simple (dot-separated or array) paths

Use of JSONPath-Plus

Current & future directions

  • More ORM-like interface for interacting with relationships between documents
  • Ability to map JSON properties to relational database columns
0.1.0-b6

1 day ago

0.1.0-b7

1 day ago

0.1.0-b8

1 day ago

0.1.0-b9

1 day ago

0.1.0-b2

1 day ago

0.1.0-b3

1 day ago

0.1.0-b4

1 day ago

0.1.0-b5

1 day ago

0.1.0-b1

2 days ago

0.0.10

2 months ago

0.0.10-b6

3 months ago

0.0.10-b7

3 months ago

0.0.10-b4

3 months ago

0.0.10-b5

3 months ago

0.0.10-b2

3 months ago

0.0.10-b3

3 months ago

0.0.10-b1

3 months ago

0.0.9

4 months ago

0.0.9-a6

5 months ago

0.0.8-b

7 months ago

0.0.8-a

7 months ago

0.0.8-b10

5 months ago

0.0.8-b9

5 months ago

0.0.8-b6

5 months ago

0.0.9-a5

5 months ago

0.0.8-b5

5 months ago

0.0.8-b8

5 months ago

0.0.8-b7

5 months ago

0.0.9-a2

5 months ago

0.0.8-b2

6 months ago

0.0.9-a1

5 months ago

0.0.9-a4

5 months ago

0.0.8-b4

5 months ago

0.0.9-a3

5 months ago

0.0.8-b3

6 months ago

0.0.8

5 months ago

0.0.7

8 months ago

0.0.6-a1

11 months ago

0.0.6

11 months ago

0.0.5

11 months ago

0.0.4

12 months ago

0.0.3

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago