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

@wmfs/relationize

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wmfs/relationize

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

  • 1.26.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
890
increased by234.59%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 24 Feb 2021

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