Skip to content

hyper63/hyper-adapter-pouchdb

Repository files navigation

hyper-adapter-pouchdb

A Data port adapter that uses PouchDB in the hyper service framework

Nest Badge Test Current Version


Getting Started

hyper.config.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) for PouchDB storage. You may choose which storage to use by passing the storage option to the adapter:

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:

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

deps.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 adapter

See the full port here

Contributing

Contributions are welcome! See the hyper contribution guide

Testing

./scripts/test.sh

To lint, check formatting, and run unit tests

License

Apache-2.0