# triplecheck-repository-fauna

> Database utility for using FaunaDB with the TripleCheck broker.

Latest version **1.0.0** (published 2021-05-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install triplecheck-repository-fauna
pnpm add triplecheck-repository-fauna
yarn add triplecheck-repository-fauna
bun add triplecheck-repository-fauna
```

## 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.0.0 |
| Published | 2021-05-18 |
| First published | 2021-05-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 725.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mikael Vesavuori |
| Maintainers | mikaelvesavuori |
| Keywords | triplecheck, triplecheck-repository, fauna, faunadb, contract-testing, consumer-contracts, pacts |

## Links

- npm: https://www.npmjs.com/package/triplecheck-repository-fauna
- npm.io page: https://npm.io/package/triplecheck-repository-fauna

## Dependencies (2)

- [faunadb](https://npm.io/package/faunadb.md) ^4.2.0
- [triplecheck-core](https://npm.io/package/triplecheck-core.md) latest

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-05-18
- 0.0.2 — 2021-05-15

## README

# triplecheck-repository-fauna

![TripleCheck database repository](readme/triplecheck-repository.png)

## TripleCheck: FaunaDB database repository

Database utility for using FaunaDB with the [TripleCheck broker](https://github.com/mikaelvesavuori/triplecheck-broker). It implements the repository base at [triplecheck-core](https://github.com/mikaelvesavuori/triplecheck-core).

## Instructions

- In Fauna, create a database called `triplecheck-broker`.
- Under `Security`, create a key for the database and set the role to `Server`
- Paste the key's value into the `.env` file like this: `FAUNA_KEY=some-secret-random-key`
- Create a new collection (call it `triplecheck`)
- Create an index called `Key` and set the term to `data.key`; also enable `Serialized` and `Unique`
- By default the Fauna repository will pick up an environment variable called `FAUNA_KEY` (as per above), so use something like [dotenv](https://www.npmjs.com/package/dotenv) to simplify getting that value

## Basic implementation

```TypeScript
import { TripleCheckBroker } from 'triplecheck-broker';
import { FaunaRepository } from 'triplecheck-repository-fauna';

import dotenv from 'dotenv';
dotenv.config();

const repository = FaunaRepository();
const request = "Get this from your API request and transform it as needed";
const payload = "Body";
const { responseData, status, headers } = await TripleCheckBroker(request, payload, repository);
```

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