Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nano

Package Overview
Dependencies
Maintainers
7
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nano - npm Package Compare versions

Comparing version 7.1.0 to 7.1.1

tests/unit/document/head.js

35

lib/nano.js

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

opts.db = urlResolveFix(cfg.url, encodeURIComponent(dbName))
opts.httpAgent = httpAgent;
if (typeof callback === 'function') {

@@ -508,5 +509,3 @@ return followAgent(opts, callback)

function headDoc (docName, callback) {
// this function doesn't pass on the Promise from relax because it needs
// to return the headers when resolving the Promise
return new Promise(function (resolve, reject) {
if (callback) {
relax({

@@ -517,13 +516,21 @@ db: dbName,

qs: {}
}, function (err, body, headers) {
if (callback) {
callback(err, body, headers)
}
if (err) {
reject(err)
} else {
resolve(headers)
}
})
})
}, callback);
} else {
// this function doesn't pass on the Promise from relax because it needs
// to return the headers when resolving the Promise
return new Promise(function (resolve, reject) {
relax({
db: dbName,
doc: docName,
method: 'HEAD',
qs: {}
}, function (err, body, headers) {
if (err) {
reject(err);
} else {
resolve(headers);
}
});
});
}
}

@@ -530,0 +537,0 @@

4

package.json

@@ -7,3 +7,3 @@ {

"repository": "http://github.com/apache/couchdb-nano",
"version": "7.1.0",
"version": "7.1.1",
"author": "Apache CouchDB <dev@couchdb.apache.org> (http://couchdb.apache.org)",

@@ -22,3 +22,3 @@ "keywords": [

"@types/request": "^2.47.1",
"cloudant-follow": "~0.17.0",
"cloudant-follow": "^0.18.0",
"debug": "^2.2.0",

@@ -25,0 +25,0 @@ "errs": "^0.3.2",

@@ -72,3 +72,3 @@ [![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)

- [db.attachment.insert(docname, attname, att, contenttype, [params], [callback])](#dbattachmentinsertdocname-attname-att-contenttype-params-callback)
- [db.attachment.insertAsStream(docname, attname, att, contenttype, [params], [callback])](#dbmultipartinsertasstreamdoc-attachments-params-callback)
- [db.attachment.insertAsStream(docname, attname, att, contenttype, [params], [callback])](#dbattachmentinsertasstreamdocname-attname-att-contenttype-params-callback)
- [db.attachment.get(docname, attname, [params], [callback])](#dbattachmentgetdocname-attname-params-callback)

@@ -152,3 +152,3 @@ - [db.attachment.getAsStream(docname, attname, [params], [callback])](#dbattachmentgetasstreamdocname-attname-params-callback)

async function asyncCall() {
await nano.db.destory('alice')
await nano.db.destroy('alice')
await nano.db.create('alice')

@@ -168,3 +168,3 @@ const alice = nano.use('alice')

nano.db.destory('alice').then((response) => {
nano.db.destroy('alice').then((response) => {
return nano.db.create('alice')

@@ -759,3 +759,3 @@ }).then((response) => {

### db.multipart.insertAsStream(doc, attachments, params, [callback])
### db.attachment.insertAsStream(docname, attname, att, contenttype, [params], [callback])

@@ -766,4 +766,5 @@ It may be more memory-efficient to pipe a stream of data from a source (file, network etc) to a CouchDB attachment:

const rs = fs.createReadStream('logo.png');
const is = db.attachment.insertAsStream('mydoc', 'logo.png', null, 'image/png').on('end', () => {
console.log('done')
const is = db.attachment.insertAsStream('mydoc', 'logo.png', null, 'image/png',
{ rev: '12-150985a725ec88be471921a54ce91452' }).on('end', () => {
console.log('done')
});

@@ -905,3 +906,3 @@ rs.pipe(is);

var request_body = JSON.parse(req.body);
var field = request_body.field;

@@ -942,3 +943,3 @@ var value = request_body.value;

// find documents where the name = "Brian" and age > 25.
const q = {
const q = {
selector: {

@@ -962,3 +963,3 @@ name: { "$eq": "Brian"},

// find documents where the name = "Brian" and age > 25.
const q = {
const q = {
selector: {

@@ -991,3 +992,3 @@ name: { "$eq": "Brian"},

The second request works because the `nano` library has remembered the `AuthSession` cookie that was invisibily returned by the `nano.auth` call.
The second request works because the `nano` library has remembered the `AuthSession` cookie that was invisibily returned by the `nano.auth` call.

@@ -994,0 +995,0 @@ When you have a session, you can see what permissions you have by calling the `nano.session` function

@@ -92,2 +92,7 @@ // Licensed under the Apache License, Version 2.0 (the 'License'); you may not

if (method[1] === 'follow' || method[1] === 'followUpdates') {
assert.ok(typeof req.httpAgent, 'object');
delete req.httpAgent; // ignore 'httpAgent' in deep equal assert
}
assert.deepEqual(req, stub)

@@ -94,0 +99,0 @@ assert.end()

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