New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ouch-rx

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ouch-rx

Reactive wrapper for pouchdb

latest
Source
npmnpm
Version
2.2.0
Version published
Maintainers
1
Created
Source

[!NOTE]
Package renamed @agrzes/pouch-rx and moved to new repository. This repository is no longer maintained. Please use the new package instead.

Ouch Rx Build Status Coverage Status

Library wrapping PouchDB with rxjs observables.

Usage

To use Ouch Rx one have to wrap database object with Ouch instance and then use its methods to create Observables and Observers.

const {Ouch} = require('ouch-rx');
const ouch = new Ouch(db);
ouch.all().pipe(transform).subscribe(ouch.sink())

Reference

Constructor

Wraps single pouchdb database.

new Ouch(db)
ArgumentDescription
dbA PouchDB database

Methods

all

Returns observable of all documents.

ouch.all(options)
ArgumentDescription
optionsAn options object passed to db.all_docs. The following fields are not passed: include_docs

changes

Returns observable of a change feed.

ouch.changes(options)
ArgumentDescription
optionsAn options object passed to db.changes.

view

Returns observable of view results.

ouch.view(name,options)
ArgumentDescription
nameA view name
optionsAn options object passed to db.query. The following fields are not passed: include_docs

To use this method the db object must support query method.

sink

Returns observer that writes incoming objects into db.

The operation will fail on any error so it is useful for inserting completely new documents and for updating documents previously fetched from db (so current _rev is known).

ouch.sink()

merge

Returns observer that writes incoming objects into db.

The operation will call the merge function with incoming object to prepare document to store. The operation will call the merge function again with incoming object and current document state if conflict is encountered. It will then retry write with the result of merge function.

ouch.merge(mergeFunction)    
ArgumentDescription
mergeFunctionA merge function (object,current) => document to store

Merge Functions

The following ready to use merge functions are provided

  • skip - if document exist in database then skip update
  • override - override document in database with new document
  • assign - merge the existing and new document the way that uses new properties over existing but leave existing properties if new values are not provided. The merge is shallow, it considers only top level properties.

Keywords

rx

FAQs

Package last updated on 27 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts