# oada-app-cache

> A javascript wrapper for syncing data between an OADA server and a PouchDb cache.

Latest version **0.1.1** (published 2017-04-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install oada-app-cache
pnpm add oada-app-cache
yarn add oada-app-cache
bun add oada-app-cache
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2017-04-13 |
| First published | 2017-04-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jake Chung jakerev110@gmail.com |
| Maintainers | jakerev110 |
| Keywords | cache, pouchdb, oada |

## Links

- npm: https://www.npmjs.com/package/oada-app-cache
- Repository: https://github.com/OpenATK/oada-app-cache
- Homepage: https://github.com/OpenATK/oada-app-cache#readme
- Issues: https://github.com/OpenATK/oada-app-cache/issues
- npm.io page: https://npm.io/package/oada-app-cache

## Dependencies (6)

- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [pouchdb](https://npm.io/package/pouchdb.md) ^6.1.2
- [bluebird](https://npm.io/package/bluebird.md) ^3.5.0
- [superagent](https://npm.io/package/superagent.md) ^3.5.2
- [json-pointer](https://npm.io/package/json-pointer.md) ^0.6.0
- [superagent-promise](https://npm.io/package/superagent-promise.md) ^1.1.0

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2017-04-13
- 0.1.0 — 2017-04-07

## README

## Install

```bash
npm install oada-app-cache
```


## API

```bash
var cache = require('oada-app-cache');
```


## db
db is a function that returns PouchDB instance.
It can be used by the cache if you want to share with it.

```bash
var db = require('oada-app-cache').db
```


## .setup(domain, token, oadaTree, pouchdbInstanceName)

```bash
var oadaTree = {
	rocks: {
    _type: 'application/vnd.oada.rocks.1+json',
    'list-index': {
      '*': {
      },
    },
  },
};
cache.setup(domain, token, oadaTree, 'TheRockApp');
```


## .get(url, token)

```bash
var url = 'https://' + domain + '/bookmarks/rocks/list-index/';
cache.get(url, token);
```


## .put(domain, token, bookmarkUrl, data)

```bash
var bookmarkUrl = 'https://' + domain + '/bookmarks/rocks/list-index/' + data.id + '/';
var data = {
  id: id,
  location: {
    latitude: lat,
    longitude: lng,
  },
  picked: false,
  comments: '',
  sync_status: 'new',
};
cache.put(domain, token, bookmarkUrl, data);
```


## .delete(resourceUrl, token)

```bash
var resourceUrl = 'https://' + domain + '/resources/' + obj.id + '/';
cache.delete(url, token);
```

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