# mlab-js

> mLab API strictly for deploying DBs & adding users.

Latest version **1.1.0** (published 2019-01-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install mlab-js
pnpm add mlab-js
yarn add mlab-js
bun add mlab-js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2019-01-11 |
| First published | 2018-06-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 33.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | e-ly |
| Maintainers | e-ly |

## Links

- npm: https://www.npmjs.com/package/mlab-js
- Repository: https://github.com/e-ly/mlab.js
- Homepage: https://github.com/e-ly/mlab-js#readme
- Issues: https://github.com/e-ly/mlab-js/issues
- npm.io page: https://npm.io/package/mlab-js

## Dependencies (2)

- [request](https://npm.io/package/request.md) ^2.87.0
- [request-promise](https://npm.io/package/request-promise.md) ^4.2.2

## Recent versions

- 1.1.0 (latest) — 2019-01-11
- 1.0.9 — 2018-10-03
- 1.0.8 — 2018-09-24
- 1.0.7 — 2018-08-30
- 1.0.6 — 2018-07-22
- 1.0.5 — 2018-06-18
- 1.0.4 — 2018-06-18
- 1.0.3 — 2018-06-11
- 1.0.2 — 2018-06-11
- 1.0.1 — 2018-06-10
- 1.0.0 — 2018-06-10

## README

# mlab-js

Uses mLab's hidden API (probably for good reason) to strictly deploy & remove databases along with adding and removing users to them.

By using this package, you agree that I am not liable for whatever happens to you and your account, in any way shape or form. Read mLab's [acceptable use policy](https://mlab.com/company/legal/aup/) and their [terms of service](https://mlab.com/company/legal/tos/)

## example of use
```js
// refer to test.js for a more in-depth example
const mLab = require('mlab-js')

let lab = new mLab({ name: 'name', password: 'pass' })
lab.Connect().then(async () => {
    let db = await lab.DeployDatabase({ name: 'example', region: 'us-east-1' })
    console.log('URL = ' + db.Meta.uriTemplate)
})
```

## available options
```js
new mLab({
    
    name: 'string',
    // the username of the account

    password: 'string',
    // the password of the account

    Id: null,
    // the id of the account, must be a string
    // if not provided, will be automatically retrieved when connected

    waitEnabled: false,
    // if true, then it will ensure to wait until the db is loaded
    
    waitInterval: 30,
    // the wait interval used when waiting for db to be loaded

    refreshInterval: 60000 * 30
    // the refresh interval for retrieving the csrf token

})
```

## deploying a database
```js
mLab.DeployDatabase({

    name: 'string',
    // the name of the database

    region: 'string',
    // the region of the database to be located in
    // ex. us-east-1

    ignore: false,
    // if true, it will not throw an error if the db already exists.

    // everything below will default to sandbox options
    // no documentation will be given.

    provider: 'AWS',
    
    version: '3.6.8',

    plan: 'aws-sandbox-v2'

})
```

## adding a user
```js
mBase.addUser({
    
    // self explanatory
    name: 'string',
    password: 'string',

    ignore: false,
    // if true, will not throw an error if the user already exists

})
```

---
_Source: https://npm.io/package/mlab-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
