# medable-cli

> CLI tool to interact with Medable Cortex API

Latest version **0.0.8** (published 2024-10-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install medable-cli
pnpm add medable-cli
yarn add medable-cli
bun add medable-cli
```

Provides the command `mcli`.

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2024-10-24 |
| First published | 2023-08-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | 23.x |
| Dependencies | 8 |
| Unpacked size | 18.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | bahuguna_ankit@lilly.com |
| Maintainers | ankit-lilly |

## Links

- npm: https://www.npmjs.com/package/medable-cli
- npm.io page: https://npm.io/package/medable-cli

## Dependencies (8)

- [got](https://npm.io/package/got.md) ^14.4.3
- [dotenv](https://npm.io/package/dotenv.md) ^16.4.5
- [exceljs](https://npm.io/package/exceljs.md) ^4.4.0
- [json2csv](https://npm.io/package/json2csv.md) ^6.0.0-alpha.2
- [commander](https://npm.io/package/commander.md) ^12.1.0
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^9.0.2
- [tough-cookie](https://npm.io/package/tough-cookie.md) ^5.0.0
- [node-localstorage](https://npm.io/package/node-localstorage.md) ^3.0.5

## Recent versions

- 0.0.8 (latest) — 2024-10-24
- 0.0.6 — 2024-02-27
- 0.0.5 — 2024-02-22
- 0.0.4 — 2024-01-18
- 0.0.3 — 2023-08-22
- 0.0.2 — 2023-08-22
- 0.6.1 — 2023-08-22
- 0.5.1 — 2023-08-07
- 0.4.1 — 2023-08-06
- 0.3.1 — 2023-08-06
- 0.2.1 — 2023-08-06

## README

# What?

CLI tool to interact with Medable Cortex API

# How to run it?

```shell
npm install -g medable-cli
mcli --help
```

- You can either have an .env file with following values in your homedir or the
  directory where you running the command from

  ```
  username=test
  password=test
  org=mdbl-org
  apiKey=keydfkjk
  ```

- Run `mcli login` to login

- It should generate a token and log you in and then you should be able to run
  rest of commands like get,run and scripts download

### Usage:

```shell
mcli get c_public_user --where '{"c_email": "user@mail.com"}'
```

You can limit number of results with -l or --limit flag

```shell
mcli get c_public_user -l 1
```


### Running scripts

You can write your script in a file.

```js

return org.objects.c_public_users;

```

and then run it with mcli run command.

```shell
  mcli run test.js
```

### Transformation functions

You can also pass transformation functions to `mcli get object`. This can be any
valid javascript function.

For instance, if you want to find user with c_number 5 then you could do
something like this:

```shell
mcli get c_public_users --find "(item) => item.c_number === 5"
```

Similarly, you can pass a map function and transform the output according to
your needs

```shell
mcli get c_public_user --map "(item) => item.c_name"
```

## Exporting Data

You can export the results to either excel or csv file by passing in the --export excel --file users option. You don't need to pass extension with the file name. The tool will generate that based on the value in --export option.

If you don't pass in --file then it'll save the results in generic output.csv or output.xlsx file.

```shell
  
mcli get c_public_users --find "(item) => item.c_number === 5" --export csv --file user
```
Type mcli get [object] --help to see all the available options.

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