https://github.com/hyper63/hyper-adapter-pouchdb
PouchDB adapter for Hyper Data port
https://github.com/hyper63/hyper-adapter-pouchdb
Last synced: 8 months ago
JSON representation
PouchDB adapter for Hyper Data port
- Host: GitHub
- URL: https://github.com/hyper63/hyper-adapter-pouchdb
- Owner: hyper63
- Created: 2022-04-04T18:39:04.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-11-29T00:18:10.000Z (over 2 years ago)
- Last Synced: 2025-06-11T20:38:37.789Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 107 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
hyper-adapter-pouchdb
A Data port adapter that uses PouchDB in the hyper service framework
---
- [Getting Started](#getting-started)
- [Storage Options](#storage-options)
- [Storage Directory](#storage-directory)
- [Installation](#installation)
- [Features](#features)
- [Methods](#methods)
- [Contributing](#contributing)
- [Testing](#testing)
- [License](#license)
## Getting Started
`hyper.config.js`
```js
import { default as pouchdb } from 'https://x.nest.land/hyper-adapter-pouchdb@VERSION/mod.js'
export default {
app: opine,
adapter: [
{ port: 'data', plugins: [pouchdb()] },
],
}
```
### Storage Options
This adapter can use either `memory`, `idb` (IndexedDB polyfill), or `indexeddb` (IndexedDB BETA.
See [distinction here](https://pouchdb.com/2020/02/12/pouchdb-7.2.0.html)) for `PouchDB` storage.
You may choose which storage to use by passing the `storage` option to the adapter:
```js
import {
default as pouchdb,
PouchDbAdapterTypes,
} from 'https://x.nest.land/hyper-adapter-pouchdb@VERSION/mod.js'
pouchdb({ storage: PouchDbAdapterTypes.memory })
// OR use IndexedDB for persistence
pouchdb({ storage: PouchDbAdapterTypes.idb })
```
The default storage option is `idb`
### Storage Directory
When using the `idb` (IndexedDB polyfill), you can specify where `.sqlite` files used by `indexeddb`
are placed by providing a `dir` option:
```js
import { default as pouchdb } from 'https://x.nest.land/hyper-adapter-pouchdb@VERSION/mod.js'
pouchdb({ dir: '/tmp' })
```
The default directory is the `cwd`
## Installation
This is a Deno module available to import from
[nest.land](https://nest.land/package/hyper-adapter-pouchdb)
deps.js
```js
export { default as pouchdb } from 'https://x.nest.land/hyper-adapter-pouchdb@VERSION/mod.js'
```
## Features
- Create a `PouchDB` datastore
- Remove a `PouchDB` datastore
- Create a document in a `PouchDB` datastore
- Retrieve a document in a `PouchDB` datastore
- Update a document in a `PouchDB` datastore
- Remove a document from a `PouchDB` datastore
- List documents in a `PouchDB` datastore
- Query documents in a `PouchDB` datastore
- Index documents in a `PouchDB` datastore
- Bulk create documents in a `PouchDB` datastore
## Methods
This adapter fully implements the Data port and can be used as the
[hyper Data service](https://docs.hyper.io/data-api) adapter
See the full port [here](https://nest.land/package/hyper-port-data)
## Contributing
Contributions are welcome! See the hyper
[contribution guide](https://docs.hyper.io/oss/contributing-to-hyper)
## Testing
```
./scripts/test.sh
```
To lint, check formatting, and run unit tests
## License
Apache-2.0