@wmfs/relationize
Takes a set of JSON Schema definitions and returns a relational database structure capable of storing compliant data.
Last updated a month ago by wmfsbot .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @wmfs/relationize 
SYNC missed versions from official npm registry.

relationize

Tymly Package npm (scoped) CircleCI codecov CodeFactor Dependabot badge Commitizen friendly JavaScript Style Guide license

Takes a set of JSON Schema definitions and returns a relational database structure capable of storing compliant data.

Install

$ npm install relationize --save

Usage

  const relationize = require('relationize')

  relationize (
    {
      source: {
        paths: [
          {
            namespace: 'relationizeTest',
            path: '/somewhere/json-schemas/live'
          }
        ]
      }
    },
    function (err, dbStructure) {
      // Done!
      // - The value of 'dbStructure' takes the same form  
      //   as the output generated by the 'pg-info' package.
    }
  )

API

relationize(options, callback)

Options:

Option Type Notes
source object A source object for configuring where to derive JSON Schema data from.

source object

Examples

  • From files:
{
  paths: [
    {
      namespace: 'relationizeTest',
      path: '/somewhere/json-schemas/live'
    }
  ]
}
  • From Javascript object:
{
  schemas: [
    {
      namespace: 'relationizeTest',
      schema: {
        // JSON schema here
      }
    }
  ]
}

Properties

property Type Notes
paths [object] An array of objects containing a namespace property (used to separate related tables into schemas_ and path (a file-path from where to load JSON files from - uses glob, so the ** pattern is supported)
schemas [object] An array of objects containing a namespace property (used to separate related tables into schemas_ and schema (a ready-to-use JSON Schema)

Output

Relationize returns objects of the same form as those returned by the pg-info package. The output of Relationize can then be used to generate a relational database (complete with comments, tables, indexes and foreign key constraints) to store your JSON-structured data.

Testing

$ npm test

License

MIT

Current Tags

  • 1.22.0                                ...           latest (a month ago)

24 Versions

  • 1.22.0                                ...           a month ago
  • 1.21.0                                ...           a month ago
  • 1.20.0                                ...           3 months ago
  • 1.19.0                                ...           3 months ago
  • 1.18.0                                ...           3 months ago
  • 1.17.0                                ...           4 months ago
  • 1.16.0                                ...           5 months ago
  • 1.15.0                                ...           5 months ago
  • 1.14.0                                ...           a year ago
  • 1.13.0                                ...           a year ago
  • 1.12.0                                ...           a year ago
  • 1.11.0                                ...           a year ago
  • 1.10.0                                ...           2 years ago
  • 1.9.0                                ...           2 years ago
  • 1.8.0                                ...           2 years ago
  • 1.7.0                                ...           2 years ago
  • 1.6.0                                ...           2 years ago
  • 1.5.0                                ...           2 years ago
  • 1.4.0                                ...           2 years ago
  • 1.3.0                                ...           2 years ago
  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (4)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |