New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cloudant-nano

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudant-nano - npm Package Compare versions

Comparing version 6.4.1 to 6.5.0

.github/ISSUE_TEMPLATE.md

24

CONTRIBUTING.md

@@ -1,8 +0,18 @@

# DCO
# Contributing to nano
To contribute to this project you must accept our [developer certificate of origin](https://github.com/dscape/nano/blob/master/README.md)
Please take a moment to review this document in order to make the contribution
process easy and effective for everyone involved.
Following these guidelines helps to communicate that you respect the time of
the developers managing and developing this open source project. In return,
they should reciprocate that respect in addressing your issue, assessing
changes, and helping you finalize your pull requests.
Contributions to CouchDB are governed by our [Code of Conduct][6] and a set of
[Project Bylaws][7]. Apache CouchDB itself also has a [CONTRIBUTING.md][9] if
you want to help with the larger project. Come join us!
# Contributing
Everyone is welcome to contribute with patches, bug-fixes and new features
Everyone is welcome to contribute with patches, bug-fixes and new features.

@@ -18,3 +28,3 @@ 1. Create an [issue][2] on github so the community can comment on your idea

to run tests make sure you npm test but also run tests without mocks:
To run tests, make sure you run `npm test` but also run tests without mocks:

@@ -43,2 +53,6 @@ ``` sh

[2]: http://github.com/dscape/nano/issues
[2]: http://github.com/apache/couchdb-nano/issues
[6]: http://couchdb.apache.org/conduct.html
[7]: http://couchdb.apache.org/bylaws.html
[9]: https://github.com/apache/couchdb/blob/master/CONTRIBUTING.md

@@ -21,3 +21,3 @@ // Licensed under the Apache License, Version 2.0 (the 'License'); you may not

var _ = require('underscore');
var follow = require('follow');
var follow = require('cloudant-follow');
var logger = require('./logger');

@@ -29,2 +29,3 @@

var serverScope = {};
var replications = {};

@@ -194,3 +195,3 @@ if (typeof cfg === 'string') {

return httpAgent(req, function(e, h, b) {
return httpAgent(req, function(e, h, b) {
rh = h && h.headers || {};

@@ -336,2 +337,3 @@ rh.statusCode = h && h.statusCode || 500;

qs = qs || {};
qs.db = urlResolveFix(cfg.url, encodeURIComponent(dbName));

@@ -360,3 +362,3 @@

}
// _replicate
opts.source = _serializeAsUrl(source);

@@ -378,2 +380,33 @@ opts.target = _serializeAsUrl(target);

// http://guide.couchdb.org/draft/replication.html
function enableReplication(source, target, opts, callback) {
if (typeof opts === 'function') {
callback = opts;
opts = {};
}
// _replicator
opts.source = _serializeAsUrl(source);
opts.target = _serializeAsUrl(target);
return relax({db: '_replicator', body: opts, method: 'POST'}, callback);
}
// http://guide.couchdb.org/draft/replication.html
function queryReplication(id, opts, callback) {
if (typeof opts === 'function') {
callback = opts;
opts = {};
}
return relax({db: '_replicator', method: 'GET', path: id}, callback);
}
// http://guide.couchdb.org/draft/replication.html
function disableReplication(id, rev, opts, callback) {
if (typeof opts === 'function') {
callback = opts;
opts = {};
}
return relax({db: '_replicator', method: 'DELETE', path: id, qs: {rev: rev}}, callback);
}
function docModule(dbName) {

@@ -523,2 +556,3 @@ var docScope = {};

}
qs = qs || {};

@@ -631,2 +665,3 @@ var viewPath = '_design/' + ddoc + '/_' + meta.type + '/' + viewName;

}
qs = qs || {};

@@ -671,2 +706,3 @@ var docName = qs.docName;

}
qs = qs || {};

@@ -772,3 +808,15 @@ qs.attachments = true;

view: viewDocs,
viewWithList: viewWithList
viewWithList: viewWithList,
server: serverScope,
replication: {
enable: function(target, opts, cb) {
return enableReplication(dbName, target, opts, cb);
},
disable: function(id, revision, opts, cb) {
return disableReplication(id, revision, opts, cb);
},
query: function(id, opts, cb) {
return queryReplication(id, opts, cb);
}
}
};

@@ -794,2 +842,7 @@

replicate: replicateDb,
replication: {
enable: enableReplication,
disable: disableReplication,
query: queryReplication
},
changes: changesDb,

@@ -796,0 +849,0 @@ follow: followDb,

{
"name": "cloudant-nano",
"description": "A Cloudant-specific fork of the official CouchDB client for Node.js",
"description": "A minimalistic Cloudant/CouchDB driver for Node.js",
"license": "Apache-2.0",
"homepage": "http://github.com/cloudant-labs/cloudant-nano",
"repository": "git://github.com/cloudant-labs/cloudant-nano",
"version": "6.4.1",
"author": "Glynn Bird <glynn.bird@gmail.com>",
"homepage": "https://github.com/cloudant-labs/cloudant-nano",
"repository": {
"type": "git",
"url": "git@github.com:cloudant-labs/cloudant-nano.git"
},
"version": "6.5.0",
"author": {
"name": "IBM Cloudant",
"email": "support@cloudant.com"
},
"keywords": [
"cloudant",
"couchdb",

@@ -20,4 +27,4 @@ "data",

"dependencies": {
"request": "^2.76.0",
"follow": "^0.12.1",
"request": "^2.81.0",
"cloudant-follow": "^0.13.0",
"errs": "^0.3.2",

@@ -38,3 +45,3 @@ "underscore": "^1.8.3",

"scripts": {
"test": "bash scripts/run_couchdb_on_travis.sh; npm run mocha; bash scripts/stop_couchdb_on_travis.sh",
"test": "bash scripts/run_couchdb_on_travis.sh && npm run mocha && bash scripts/stop_couchdb_on_travis.sh",
"mocha": "DEBUG=* NOCK_OFF=true istanbul cover tape tests/*/*/*.js",

@@ -41,0 +48,0 @@ "unmocked": "NOCK_OFF=true tape tests/*/*/*.js",

@@ -1,18 +0,7 @@

[![By](https://img.shields.io/badge/made%20by-yld!-32bbee.svg?style=flat-square)](http://yld.io/contact?source=github-nano)[![Chat](https://img.shields.io/badge/help-gitter-eb9348.svg?style=flat-square)](https://gitter.im/dscape/nano)[![Tests](http://img.shields.io/travis/dscape/nano.svg?style=flat-square)](https://travis-ci.org/dscape/nano)![Coverage](https://img.shields.io/badge/coverage-100%-ff69b4.svg?style=flat-square)[![Dependencies](https://img.shields.io/david/dscape/nano.svg?style=flat-square)](https://david-dm.org/dscape/nano)[![NPM](http://img.shields.io/npm/v/nano.svg?style=flat-square)](http://browsenpm.org/package/nano)
[![Build Status](https://travis-ci.org/apache/couchdb-nano.svg?branch=master)](https://travis-ci.org/apache/couchdb-nano)![Coverage](https://img.shields.io/badge/coverage-100%-ff69b4.svg)[![dependencies Status](https://david-dm.org/apache/couchdb-nano/status.svg)](https://david-dm.org/apache/couchdb-nano)[![NPM](http://img.shields.io/npm/v/nano.svg?style=flat-square)](https://www.npmjs.com/package/nano)
# cloudant-nano
# nano
minimalistic couchdb driver for node.js
-------------------------------------------------
This is a fork of the [Apache CouchDB Nano](https://github.com/apache/couchdb-nano) project. Which can be used with `npm install nano`. *This* fork
is maintained here because the [Cloudant Node.js Library](https://github.com/cloudant/nodejs-cloudant) is dependent on the Nano and we (Cloudant)
needed a version of this library with up-to-date Travis tests, newer dependency versions and some bug fixes. The changes found in this repo may
eventually make their way into the Apache project, when Apache CouchDB Nano is properly open for business.
This library is usually consumed by using the [Cloudant npm package](https://www.npmjs.com/package/cloudant) e.g. `npm install cloudant`.
-------------------------------------------------
`nano` features:

@@ -43,2 +32,5 @@

- [nano.db.replicate(source, target, [opts], [callback])](#nanodbreplicatesource-target-opts-callback)
- [nano.db.replication.enable(source, target, [opts], [callback])](#nanodbreplicatorenablesource-target-opts-callback)
- [nano.db.replication.query(id, [opts], [callback])](#nanodbreplicatorquery-id-opts-callback)
- [nano.db.replication.disable(id, [opts], [callback])](#nanodbreplicatordisable-id-opts-callback)
- [nano.db.changes(name, [params], [callback])](#nanodbchangesname-params-callback)

@@ -289,2 +281,51 @@ - [nano.db.follow(name, [params], [callback])](#nanodbfollowname-params-callback)

### nano.db.replication.enable(source, target, [opts], [callback])
enables replication using the new couchdb api from `source` to `target`
with options `opts`. `target` has to exist, add `create_target:true` to
`opts` to create it prior to replication.
replication will survive server restarts.
``` js
nano.db.replication.enable('alice', 'http://admin:password@otherhost.com:5984/alice',
{ create_target:true }, function(err, body) {
if (!err)
console.log(body);
});
```
### nano.db.replication.query(id, [opts], [callback])
queries the state of replication using the new couchdb api. `id` comes from the response
given by the call to enable.
``` js
nano.db.replication.enable('alice', 'http://admin:password@otherhost.com:5984/alice',
{ create_target:true }, function(err, body) {
if (!err) {
nano.db.replication.query(body.id, function(error, reply) {
if (!err)
console.log(reply);
}
}
});
```
### nano.db.replication.disable(id, [opts], [callback])
disables replication using the new couchdb api. `id` comes from the response given
by the call to enable.
``` js
nano.db.replication.enable('alice', 'http://admin:password@otherhost.com:5984/alice',
{ create_target:true }, function(err, body) {
if (!err) {
nano.db.replication.disable(body.id, function(error, reply) {
if (!err)
console.log(reply);
}
}
});
```
### nano.db.changes(name, [params], [callback])

@@ -651,2 +692,29 @@

``` js
alice.view('characters', 'crazy_ones', {
'key': 'Tea Party',
'include_docs': true
}, function(err, body) {
if (!err) {
body.rows.forEach(function(doc) {
console.log(doc.value);
});
}
});
```
``` js
alice.view('characters', 'soldiers', {
'keys': ['Hearts', 'Clubs']
}, function(err, body) {
if (!err) {
body.rows.forEach(function(doc) {
console.log(doc.value);
});
}
});
```
When `params` is not supplied, or no keys are specified, it will simply return all docs in the view.
``` js
alice.view('characters', 'crazy_ones', function(err, body) {

@@ -661,2 +729,12 @@ if (!err) {

``` js
alice.view('characters', 'crazy_ones', { include_docs: true }, function(err, body) {
if (!err) {
body.rows.forEach(function(doc) {
console.log(doc.value);
});
}
});
```
### db.viewWithList(designname, viewname, listname, [params], [callback])

@@ -892,15 +970,13 @@

* code: `git clone git://github.com/dscape/nano.git`
* home: <http://github.com/dscape/nano>
* bugs: <http://github.com/dscape/nano/issues>
* build: [![build status](https://secure.travis-ci.org/dscape/nano.png)](http://travis-ci.org/dscape/nano)
* deps: [![deps status](https://david-dm.org/dscape/nano.png)](https://david-dm.org/dscape/nano)
* chat: <https://gitter.im/dscape/nano>
* code: `git clone git://github.com/apache/couchdb-nano.git`
* home: <http://github.com/apache/couchdb-nano>
* bugs: <http://github.com/apache/couchdb-nano/issues>
* build: [![Build Status](https://travis-ci.org/apache/couchdb-nano.svg?branch=master)](https://travis-ci.org/apache/couchdb-nano)
* deps: [![dependencies Status](https://david-dm.org/apache/couchdb-nano/status.svg)](https://david-dm.org/apache/couchdb-nano)
* chat: [Freenode IRC @ #couchdb-dev][8]
`(oo)--',-` in [caos][3]
[1]: http://npmjs.org
[2]: http://github.com/dscape/nano/issues
[3]: http://caos.di.uminho.pt/
[4]: https://github.com/dscape/nano/blob/master/cfg/couch.example.js
[2]: http://github.com/apache/couchdb-nano/issues
[4]: https://github.com/apache/couchdb-nano/blob/master/cfg/couch.example.js
[8]: http://webchat.freenode.net?channels=%23couchdb-dev
[follow]: https://github.com/jhs/follow

@@ -907,0 +983,0 @@ [request]: https://github.com/request/request

[
{ "method" : "get"
, "path" : "/uuids?count=3"
{ "method" : "put"
, "path" : "/util_uuid"
, "status" : 201
, "response" : "{ \"ok\": true }"
}
, { "method" : "get"
, "path" : "/_uuids?count=3"
, "status" : 200

@@ -8,6 +13,11 @@ , "response" : "{ \"uuids\": [\"1\",\"2\",\"3\"] }"

, { "method" : "get"
, "path" : "/uuids"
, "path" : "/_uuids?count=1"
, "status" : 200
, "response" : "{ \"uuids\": [\"1\"] }"
}
, { "method" : "delete"
, "path" : "/util_uuid"
, "status" : 200
, "response" : "{ \"ok\": true }"
}
]

@@ -59,3 +59,14 @@ // Licensed under the Apache License, Version 2.0 (the 'License'); you may not

if(method[0] === 'database') {
f = cli.server.db[method[1]];
//
// Due to the way this harness is designed we cannot differentiate between different methods
// when those methods are embedded on an object.
// We have two options, either we hardcode the resolution or we write a full harness that
// can differentiate between methods embedded on an object.
// I go the hardcoded route for now.
//
if (method[1] === 'replicator') {
f = cli.server.db.replication.enable;
} else {
f = cli.server.db[method[1]];
}
} else if(method[0] === 'view' && method[1] === 'compact') {

@@ -62,0 +73,0 @@ f = cli.view.compact;

@@ -26,4 +26,5 @@ // Licensed under the Apache License, Version 2.0 (the 'License'); you may not

assert.equal(error, null, 'should generate uuids');
assert.ok(data, 'got response');
assert.ok(data.uuids, 'got uuids');
assert.equal(data.uuids.count, 3, 'got 3');
assert.equal(data.uuids.length, 3, 'got 3');
assert.end();

@@ -36,6 +37,7 @@ });

assert.equal(error, null, 'should generate uuids');
assert.ok(data.uuids, 'got uuids');
assert.equal(data.uuids.count, 1, 'got 1');
assert.ok(data, 'got response');
assert.ok(data.uuids, 'got uuid');
assert.equal(data.uuids.length, 1, 'got 1');
assert.end();
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc