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

nano

Package Overview
Dependencies
Maintainers
2
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 5.11.0 to 5.11.2

13

nano.js

@@ -1011,4 +1011,5 @@ /* minimal couch in node

var stubs = attachments.reduce(function(memo, att) {
memo[att.name] = {
doc = _.extend({ _attachments: {} }, doc);
attachments.forEach(function(att) {
doc._attachments[att.name] = {
follows: true,

@@ -1018,9 +1019,7 @@ length: att.data.length,

};
return memo;
}, {});
});
var multipart = [
{
'content-type': 'application/json',
body: JSON.stringify(_.extend({}, doc, { _attachments: stubs }))
body: JSON.stringify(doc)
}

@@ -1290,3 +1289,3 @@ ];

port = path.port ? ':' + path.port : '';
db = cfg.db ? cfg.db : path_array[0];
db = cfg.db ? cfg.db : decodeURIComponent(path_array[0]);

@@ -1293,0 +1292,0 @@ var format = {

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

"repository": "git://github.com/dscape/nano",
"version": "5.11.0",
"version": "5.11.2",
"author": "Nuno Job <nunojobpinto@gmail.com> (http://nunojob.com)",

@@ -58,6 +58,6 @@ "contributors": [

"dependencies": {
"request": "^2.40.0",
"request": "~2.42.0",
"follow": "~0.11.2",
"errs": "^0.3.0",
"underscore": "^1.7.0"
"errs": "~0.3.0",
"underscore": "~1.7.0"
},

@@ -64,0 +64,0 @@ "devDependencies": {

@@ -5,2 +5,4 @@ var specify = require('specify')

, nano = helpers.nano
, Nano = helpers.Nano
, couch = helpers.couch
, nock = helpers.nock

@@ -23,2 +25,9 @@ ;

specify("db_create:encoded_name_from_config", timeout, function (assert) {
var config = Nano(helpers.couch + "/" + encodeURIComponent("with/slash")).config;
Nano(config.url).db.create(config.db, function (err) {
assert.equal(err, undefined, "Failed to create database");
});
});
specify("db_create:teardown", timeout, function (assert) {

@@ -29,3 +38,6 @@ nano.db.destroy("db_create", function (err) {

assert.equal(err, undefined, "Failed to destroy database");
assert.ok(mock.isDone(), "Some mocks didn't run");
nano.db.destroy("with/slash", function (err) {
assert.equal(err, undefined, "Failed to destroy database");
assert.ok(mock.isDone(), "Some mocks didn't run");
});
});

@@ -35,2 +47,2 @@ });

specify.run(process.argv.slice(2));
specify.run(process.argv.slice(2));

@@ -12,2 +12,7 @@ [

}
, { "method" : "put"
, "path" : "/with%2Fslash"
, "status" : 201
, "response" : "{ \"ok\": true }"
}
, { "method" : "delete"

@@ -21,2 +26,6 @@ , "path" : "/db_create"

}
, { "method" : "delete"
, "path" : "/with%2Fslash"
, "response" : "{ \"ok\": true }"
}
]

@@ -13,2 +13,22 @@ [

}
, { "method" : "put"
, "path" : "/multipart_insert/mydoc/one"
, "body" : "Hello World!"
, "status" : 201
, "response" : "{\"ok\": true, \"id\": \"one\", \"rev\": \"1-921bd51\" }"
}
, { "path" : "/multipart_insert/mydoc"
, "status" : 200
, "response" : "{\"_id\": \"mydoc\", \"_rev\": \"1-921bd51\", \"_attachments\": { \"one\": { \"stub\": true } } }"
}
, { "method" : "put"
, "path" : "/multipart_insert/mydoc"
, "body" : "*"
, "status" : 201
, "response" : "{\"ok\": true, \"id\": \"mydoc\", \"rev\": \"2-921bd51\""
}
, { "path" : "/multipart_insert/mydoc"
, "status" : 200
, "response" : "{\"_id\": \"mydoc\", \"_rev\": \"2-921bd51\", \"_attachments\": { \"one\": { \"stub\": true }, \"two\": { \"stub\": true } } }"
}
, { "method" : "delete"

@@ -15,0 +35,0 @@ , "path" : "/multipart_insert"

@@ -6,3 +6,2 @@ var specify = require('specify')

, nock = helpers.nock
, rev
;

@@ -27,3 +26,2 @@

db.multipart.insert({"foo": "baz"}, [att], "foobaz", function (error, foo) {
rev = foo.rev;
assert.equal(error, undefined, "Should have stored foo and attachment");

@@ -35,2 +33,21 @@ assert.equal(foo.ok, true, "Response should be ok");

specify("multipart_insert:test_with_present_attachment", timeout, function (assert) {
var att = {
name: 'two',
data: 'Hello World!',
content_type: 'text/plain'
};
db.attachment.insert("mydoc", "one", "Hello World!", "text/plain", function () {
db.get("mydoc", function(_, doc) {
db.multipart.insert(doc, [att], "mydoc", function () {
db.get("mydoc", function(error, two) {
assert.equal(error, undefined, "Should get the doc");
assert.equal(Object.keys(two._attachments).length, 2, "Both attachments should be present");
});
});
});
});
});
specify("multipart_insert:teardown", timeout, function (assert) {

@@ -37,0 +54,0 @@ nano.db.destroy("multipart_insert", function (err) {

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