3.0.0 • Published 2 months ago

@onehilltech/dab v3.0.0

Weekly downloads
15
License
Apache-2.0
Repository
github
Last release
2 months ago

dab

A complex data builder that uses simple definitions

npm version Build Status Dependencies Coverage Status

Features

  • Build data models from data definitions to seed databases
  • Compute data values based on other parts of the data model
  • Supports MongoDB via Mongoose
  • Plays nicely with faker.js

Getting Started

First, define your data model.

// demo.js

const dab = require ('@onehilltech/dab');

var data = {
  users: [
    {first_name: 'John', last_name: 'Doe'},
    {first_name: 'Jane', last_name: 'Doe'}
  ],
  
  family: [
    {user1: dab.ref ('users.0'), user2: dab.ref ('users.1'), relationship: 'spouse'}
  ]
};

Direct Integration

Next, build the data model.

// client.js

const backend = require ('@onehilltech/dab-mongodb');

dab.build (data, { backend }).then (models => {
  // model is the final data model  
});

You must provide a target backend for the build. In the example above, the target backend is MongoDB. The result will be a data model where all objects have an _id property, and all computed values are resolved. The returned model can also seed a MongoDB database. Each collection in the data model will contain instances of Mongoose documents.

// client.js

dab.seed (models, conn, { backend }).then (models => {
  // models will be MongoDB models
});

Command-line Usage

It is possible to generate a dab model from the command-line:

dab build <dabfile>

You can even seed a database from the command-line:

dab seed --connection <CONNECTION> <dabfile>

Next Steps

See our Wiki for more details on using dab.

Need help? Contact us

3.0.0

2 months ago

2.12.3

1 year ago

2.11.1

2 years ago

2.11.0

2 years ago

2.10.1

2 years ago

2.10.2

2 years ago

2.10.0

2 years ago

2.10.3

2 years ago

2.8.6

3 years ago

2.8.0

3 years ago

2.7.5

3 years ago

2.7.4

3 years ago

2.7.3

4 years ago

2.7.2

4 years ago

2.6.0

4 years ago

2.7.0

4 years ago

2.7.1

4 years ago

2.5.1

4 years ago

2.5.0

4 years ago

2.4.0

4 years ago

2.3.2

4 years ago

2.3.1

4 years ago

2.3.0

4 years ago

2.2.0

4 years ago

2.0.0-alpha.3

4 years ago

2.0.0-alpha.4

4 years ago

2.0.0-alpha.0

4 years ago

2.0.0-alpha.1

4 years ago

2.0.0-alpha.2

4 years ago

2.0.0

4 years ago

2.1.2

4 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.0

4 years ago

1.4.0

4 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

1.0.0-0

6 years ago

0.11.0

6 years ago

0.10.3

6 years ago

0.10.2

6 years ago

0.10.1

6 years ago

0.10.0

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago

0.8.4

7 years ago

0.8.3

7 years ago

0.8.2

7 years ago

0.8.1

7 years ago

0.8.0

7 years ago

0.7.0

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago

0.5.4

7 years ago

0.5.3

7 years ago

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago