3.0.0 • Published 1 year ago

@onehilltech/dab v3.0.0

Weekly downloads
15
License
Apache-2.0
Repository
github
Last release
1 year 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

1 year ago

2.12.3

2 years ago

2.11.1

3 years ago

2.11.0

3 years ago

2.10.1

4 years ago

2.10.2

4 years ago

2.10.0

4 years ago

2.10.3

3 years ago

2.8.6

4 years ago

2.8.0

4 years ago

2.7.5

4 years ago

2.7.4

4 years ago

2.7.3

5 years ago

2.7.2

5 years ago

2.6.0

5 years ago

2.7.0

5 years ago

2.7.1

5 years ago

2.5.1

5 years ago

2.5.0

5 years ago

2.4.0

5 years ago

2.3.2

5 years ago

2.3.1

5 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.0.0-alpha.3

5 years ago

2.0.0-alpha.4

5 years ago

2.0.0-alpha.0

5 years ago

2.0.0-alpha.1

5 years ago

2.0.0-alpha.2

5 years ago

2.0.0

5 years ago

2.1.2

5 years ago

2.1.4

5 years ago

2.1.3

5 years ago

2.1.0

5 years ago

1.4.0

5 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

1.0.0-0

7 years ago

0.11.0

7 years ago

0.10.3

8 years ago

0.10.2

8 years ago

0.10.1

8 years ago

0.10.0

8 years ago

0.9.1

8 years ago

0.9.0

8 years ago

0.8.4

8 years ago

0.8.3

8 years ago

0.8.2

8 years ago

0.8.1

8 years ago

0.8.0

8 years ago

0.7.0

8 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.5.4

8 years ago

0.5.3

8 years ago

0.5.2

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago