# validaus-js

> Validaus NPM Module

Latest version **0.1.1** (published 2021-06-03) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2021-06-03 |
| First published | 2021-06-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 3.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Validaus Inc. |
| Maintainers | validaus |
| Keywords | validaus |

## Links

- npm: https://www.npmjs.com/package/validaus-js
- Homepage: https://www.validaus.com
- npm.io page: https://npm.io/package/validaus-js

## Dependencies (2)

- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.0
- [@types/node](https://npm.io/package/@types/node.md) ^13.7.7

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2021-06-03
- 0.1.0 — 2021-06-03

## README

# Validaus NPM Module

This is a Javascript/Typescript wrapper around Validaus API calls. See below for examples. The code below can also be dynamically generated for you in the **Code Integration** tab of the Validaus UI.

### Instantiate Validaus

```
import Validaus from "validaus-js";

const validaus = new Validaus({
  validausURL: "http://localhost:4001,
  app: "my-app-id",
  apiKey: "2b94d049-28ed-4476-a544-8bd9034cab53"
});
```

### Pull Mode (i.e. "Build Health" in the UI)

Use the code below to run a regression test on multiple facts, and get a full validation report from Validaus. This is most suitable to integrate into your CI.

```
// First, get all Facts that this App is subscribed to
const facts = await validaus.getFacts({
  metric: "my-metric-id"
});

// Next, run your own code here.
// Plug the params for each fact into your code,
// and save the resulting value. You'll submit
// these to Validaus in the final step.

// Finally, stream all Facts to Validaus with your code's values.
// Validaus will return an object with information on your
// data accuracy across all subscribed playbooks.
const resp = await validaus.validateFacts(
  metric: "my-metric-id",
  facts: [
    {
      paramValues: [
        { name: "a", value: YOUR_PARAM_NUMERIC_VALUE },
        { name: "b", value: YOUR_PARAM_NUMERIC_VALUE }
      ],
      value: YOUR_FACT_NUMERIC_VALUE
    },
    {
      paramValues: [
        { name: "a", value: YOUR_PARAM_NUMERIC_VALUE },
        { name: "b", value: YOUR_PARAM_NUMERIC_VALUE }
      ],
      value: YOUR_FACT_NUMERIC_VALUE
    }
  ]
});
```

### Push Mode (i.e. "Live Health" in the UI)

In Push mode, stream a Fact to Validaus in any environment, and receive reports and alerts about any errors. This is most suitable for catching live errors, typically in production.

```
// Stream a Fact to Validaus - put this code snippet in the part
// of your code that is producing the data you want to validate.
validaus.publishFact({
  metric: "my-metric-id",
  fact: {
    paramValues: [
      { name: "a", value: YOUR_PARAM_NUMERIC_VALUE },
      { name: "b", value: YOUR_PARAM_NUMERIC_VALUE }
    ],
    value: YOUR_FACT_NUMERIC_VALUE
  }
});
```

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