1.31.0 • Published 1 year ago

@wmfs/relationize v1.31.0

Weekly downloads
229
License
MIT
Repository
github
Last release
1 year ago

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:

OptionTypeNotes
sourceobjectA 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

propertyTypeNotes
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

1.31.0

1 year ago

1.29.0

2 years ago

1.30.0

2 years ago

1.28.0

2 years ago

1.27.0

3 years ago

1.26.0

3 years ago

1.25.0

3 years ago

1.24.0

4 years ago

1.23.0

4 years ago

1.22.0

4 years ago

1.21.0

4 years ago

1.20.0

4 years ago

1.19.0

4 years ago

1.18.0

4 years ago

1.17.0

4 years ago

1.15.0

4 years ago

1.16.0

4 years ago

1.14.0

5 years ago

1.13.0

5 years ago

1.12.0

5 years ago

1.11.0

5 years ago

1.10.0

6 years ago

1.9.0

6 years ago

1.8.0

6 years ago

1.7.0

6 years ago

1.6.0

6 years ago

1.5.0

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago